Commit 5003fd35 by linjinhong

申报规则页面完成

parent 6a0c26ab
......@@ -49,7 +49,6 @@ export function deleteLogisticsWay(ids: string) {
params: { ids: ids },
})
}
//获取申报规则列表
export function getRuleList() {
return axios.get<never, BaseRespData<never>>(
......@@ -163,3 +162,34 @@ export function getLogisticsQuotationByID(params: any) {
{ params },
)
}
/**
* @description 申报规则
*/
//列表
export function getLogisticsCustomsRuleList(params: any) {
return axios.post<never, BaseRespData<never>>(
'/logisticsCustomsRule/list_page',
params,
)
}
//新增
export function addLogisticsCustomsRule(params: any) {
return axios.post<never, BaseRespData<never>>(
'/logisticsCustomsRule/add',
params,
)
}
//修改
export function updateLogisticsCustomsRule(params: any) {
return axios.post<never, BaseRespData<never>>(
'/logisticsCustomsRule/update',
params,
)
}
//删除
export function deleteLogisticsCustomsRule(params: any) {
return axios.get<never, BaseRespData<never>>('/logisticsCustomsRule/delete', {
params,
})
}
......@@ -13,12 +13,14 @@ import type { FormItemRule } from 'element-plus'
// 定义表单项配置接口
export interface IFormConfig {
fixed?: string
title?: string
prop?: string
label?: string
type?: string
btn?: JSX.Element | (() => JSX.Element)
attrs?: Record<string, unknown>
isIncludeProp?: boolean
rules?: FormItemRule | FormItemRule[]
render?: (
item?: IFormConfig,
......@@ -77,7 +79,15 @@ export default defineComponent({
setup(props, { emit, attrs }) {
const formRef = ref<FormInstance>()
const formData = ref<Record<string, unknown>>(props.modelValue)
const tableConfig = ref<any[]>([])
watch(
() => props.config,
(val) => {
tableConfig.value = val
},
{ immediate: true, deep: true },
)
// 监听表单数据变化
watch(
() => formData.value,
......@@ -91,7 +101,7 @@ export default defineComponent({
watch(
() => props.modelValue,
(val) => {
// console.log(84, val)
console.log(84, val)
formData.value = val
},
......@@ -120,6 +130,22 @@ export default defineComponent({
await formRef.value?.resetFields()
}
function refashConfig(showFields: string[]) {
if (showFields.length) {
const filterArr = props.config.filter((item) =>
showFields.includes(item.prop as string),
)
tableConfig.value = [
...props.config.filter((item) => !item.isIncludeProp),
...filterArr,
]
.filter((item) => !item.fixed)
.concat(tableConfig.value.filter((item) => item.fixed))
}
console.log('tableConfig', tableConfig.value)
}
return {
formRef,
formData,
......@@ -127,6 +153,8 @@ export default defineComponent({
resetFields,
getFormAttrs,
getComponentAttrs,
refashConfig,
tableConfig,
}
},
render() {
......@@ -142,7 +170,7 @@ export default defineComponent({
style={{ display: 'flex', flexWrap: 'wrap' }}
class="customForm"
>
{this.config.map((item, index) =>
{this.tableConfig.map((item, index) =>
item.title ? (
<div
style={{
......
......@@ -36,6 +36,7 @@ const props = withDefaults(
initChange?: boolean // 首次是否触发change事件
modelValue?: string | number
isRefresh?: boolean
isValueKey?: boolean
load?: (arg: (val: boolean) => void) => void // focus后再加载数据的
}>(),
{
......@@ -48,6 +49,7 @@ const props = withDefaults(
modelValue: '',
isRefresh: false,
load: null,
isValueKey: false,
},
)
......@@ -91,6 +93,7 @@ const getOptions = computed(() => {
const changeFn = (id) => {
const value = props.labelIsValue ? fields.label : fields.value
const findItem = props.options.find((item) => item[value] === id)
if (findItem) {
emits('change', findItem, id)
}
......
......@@ -141,6 +141,13 @@ const router = createRouter({
},
component: () => import('@/views/logistics/logisticsQuotation.vue'),
},
{
path: '/logistics/declarationRule',
meta: {
title: '申报规则',
},
component: () => import('@/views/logistics/declarationRule.vue'),
},
{
path: '/warehouse/manage',
......
......@@ -144,7 +144,11 @@ const menu: MenuItem[] = [
id: 1,
label: '物流报价',
},
{
index: '/logistics/declarationRule',
id: 1,
label: '申报规则',
},
],
},
// {
......
export interface DeclarationRuleList {
countries: string
createTime: string
currency: string
defaulted: string
fixedValue: string
fixedWeight: string
id: number
name: string
orderPercent: number
remark: string
shops: string
type: number
valueUp: number
wayIds: string
wayNames: string
weightPercent: number
weightUp: number
}
export interface AddDeclarationRuleObj {
currency?: string
fixedValue?: string
fixedWeight?: string
id?: number
limitAmountType?: string
limitWeightType?: string
name?: string
orderPercent?: number | string | null
remark?: string
shops?: string
type?: number
valueUp?: number | string | null
weightPercent?: number | string | null
weightUp?: number | string | null
}
......@@ -13,7 +13,7 @@ export default defineConfig({
host: true,
proxy: {
'/api': {
target: 'http://10.168.31.194:8060',
target: 'http://10.168.1.132:8060',
},
},
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment