diff --git a/src/api/wms/supplierAddrDeliTime/index.ts b/src/api/wms/supplierAddrDeliTime/index.ts index 7e4e9b0a4..8312784f9 100644 --- a/src/api/wms/supplierAddrDeliTime/index.ts +++ b/src/api/wms/supplierAddrDeliTime/index.ts @@ -46,4 +46,8 @@ export const exportSupplierAddrDeliTimeDetail = async (params) => { // 下载用户导入模板 export const importTemplate = () => { return request.download({ url: '/wms/supplier-addr-deli-time-detail/get-import-template' }) +} +// 查询供应商地点 +export const getSupplierAddrList = async (supplierCode) => { + return await request.get({ url: `/wms/supplieritem/getAddrBySupplierCode?supplierCode=` + supplierCode }) } \ No newline at end of file diff --git a/src/views/wms/basicDataManage/supplierManage/supplierAddrDeliTime/index.vue b/src/views/wms/basicDataManage/supplierManage/supplierAddrDeliTime/index.vue index d96162223..73986d8cc 100644 --- a/src/views/wms/basicDataManage/supplierManage/supplierAddrDeliTime/index.vue +++ b/src/views/wms/basicDataManage/supplierManage/supplierAddrDeliTime/index.vue @@ -103,7 +103,7 @@ const tableColumns = ref(SupplierAddrDeliTime.allSchemas.tableColumns) const detailAllSchemas = ref(SupplierAddrDeliTimeDetail.allSchemas) // 查询页面返回 const searchTableSuccess = (formField, searchField, val, formRef, type, row) => { - nextTick(() => { + nextTick(async() => { if (formField == 'code') { let codes = val.filter((item) => tableData.value.find((item1) => item1['code'] == item['code']) @@ -132,9 +132,21 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row) => const setV = {} setV[formField] = val[0][searchField] - if (formField == 'supplierCode') { + if (formField == 'supplierCode') { setV['supplierCode'] = val[0].code - setV['supplierName'] = val[0].name + setV['supplierName'] = val[0].name + console.log(SupplierAddrDeliTime.allSchemas.formSchema) + const options = await SupplierAddrDeliTimeDetailApi.getSupplierAddrList(val[0].code) + SupplierAddrDeliTime.allSchemas.formSchema.forEach(item => { + if(item.field == 'supplierAddressShow'){ + item.componentProps.options = options.map(item=> { + return { + label: item, + value:item + } + }) + } + }) } formRef.setValues(setV) }) @@ -150,6 +162,8 @@ const submitForm = async (formType, submitData) => { if (data.masterId) { data.id = data.masterId } + data.supplierAddress =data.supplierAddressShow.join(',') + data.yearAndMonth =data.yearAndMonthShow.join(',') data.subList = tableData.value // 拼接子表数据参数 data.subList.forEach((item) => { item.toWarehouseCode = data.toWarehouseCode @@ -277,13 +291,27 @@ const openForm = async (type: string, row?: any) => { item.componentProps.isSearchList = false item.componentProps.disabled = true } + if (item.field == 'supplierAddressShow') { + item.componentProps.disabled = true + } + if (item.field == 'yearAndMonthShow') { + item.componentProps.disabled = true + } }) + row.yearAndMonthShow =row.yearAndMonth.split(',') + row.supplierAddressShow =row.supplierAddress.split(',') } else { SupplierAddrDeliTime.allSchemas.formSchema.forEach((item) => { if (item.field == 'supplierCode') { item.componentProps.isSearchList = true item.componentProps.disabled = false } + if (item.field == 'supplierAddressShow') { + item.componentProps.disabled = false + } + if (item.field == 'yearAndMonthShow') { + item.componentProps.disabled = false + } }) } formRef.value.open(type, row) diff --git a/src/views/wms/basicDataManage/supplierManage/supplierAddrDeliTime/supplierAddrDeliTimeDetail.data.ts b/src/views/wms/basicDataManage/supplierManage/supplierAddrDeliTime/supplierAddrDeliTimeDetail.data.ts index 5d56d5ffe..3f6133a60 100644 --- a/src/views/wms/basicDataManage/supplierManage/supplierAddrDeliTime/supplierAddrDeliTimeDetail.data.ts +++ b/src/views/wms/basicDataManage/supplierManage/supplierAddrDeliTime/supplierAddrDeliTimeDetail.data.ts @@ -15,7 +15,39 @@ export const SupplierAddrDeliTimeDetailRules = reactive({ delayDeli: [required], }) - +function getMonthArr() { + let dateArr = []; + let year = new Date().getFullYear(); + let month = new Date().getMonth(); + const n = 12 + if (n < month) { + //1.nmonth的情况 + for (let i = (12 - (n - month) + 1); i <= 12; i++) { + let m1 = i < 10 ? "0" + i : i; + dateArr.push({ + label: year + '-' + m1, + value: year + '-' + m1 + }); + } + for (let i = 1; i <= month; i++) { + let m1 = i < 10 ? "0" + i : i; + dateArr.push({ + label: (parseFloat(year) + 1) + '-' + m1, + value: (parseFloat(year) + 1) + '-' + m1, + }); + } + } + return dateArr; +} export const SupplierAddrDeliTime = useCrudSchemas(reactive([ { @@ -27,6 +59,7 @@ export const SupplierAddrDeliTime = useCrudSchemas(reactive([ // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, // 开启查询弹窗 + enterSearch: true, searchListPlaceholder: '请选择供应商代码', // 输入框占位文本 searchField: 'number', // 查询弹窗赋值字段 searchTitle: '供应商', // 查询弹窗标题 @@ -38,7 +71,16 @@ export const SupplierAddrDeliTime = useCrudSchemas(reactive([ value: "TRUE", isMainValue: false } - ] + ], + // 失去焦点校验参数 + verificationParams: [{ + key: 'code', + action: '==', + value: '', + isMainValue: false, + isSearch: 'true', + isFormModel: true, + }] } } }, @@ -54,15 +96,69 @@ export const SupplierAddrDeliTime = useCrudSchemas(reactive([ }, { label: '供应商地点', - field: 'supplierAddress', + field: 'supplierAddressShow', sort: 'custom', isSearch: true, + isTable: false, + isDetail: false, + form: { + component: 'Select', + componentProps: { + multiple: true, + collapseTags: true, + collapseTagsTooltip: true, + maxCollapseTags: "2", + optionsAlias: { + labelField: 'label', + valueField: 'value' + } + } + } + }, + { + label: '供应商地点', + field: 'supplierAddress', + sort: 'custom', + isTable: true, + isDetail: true, + isForm: false, + }, + { + label: '年月', + field: 'yearAndMonthShow', + sort: 'custom', + isTable: false, + isDetail: false, + form: { + component: 'Select', + api: () => getMonthArr(), + componentProps: { + multiple: true, + collapseTags: true, + collapseTagsTooltip: true, + maxCollapseTags:"2", + optionsAlias: { + labelField: 'label', + valueField: 'value' + } + } + } }, { label: '年月', field: 'yearAndMonth', sort: 'custom', + isTable: true, + isDetail: true, + isForm: false, isSearch: true, + search: { + component: 'DatePicker', + componentProps: { + type: 'month', + valueFormat: 'YYYY-MM', + } + }, }, { label: '延后便次', diff --git a/src/views/wms/supplierManage/supplierDeliMain/supplierDeliMain.data.ts b/src/views/wms/supplierManage/supplierDeliMain/supplierDeliMain.data.ts index 2971294a9..0e34589d2 100644 --- a/src/views/wms/supplierManage/supplierDeliMain/supplierDeliMain.data.ts +++ b/src/views/wms/supplierManage/supplierDeliMain/supplierDeliMain.data.ts @@ -53,10 +53,10 @@ export const SupplierDeliMain = useCrudSchemas(reactive([ isSearch: true, search: { component: 'DatePicker', - value: formatDate(new Date(),'YYYYMM'), + value: formatDate(new Date(),'YYYY-MM'), componentProps: { type: 'month', - valueFormat: 'YYYYMM', + valueFormat: 'YYYY-MM', } } },