diff --git a/src/views/wms/basicDataManage/factoryModeling/areabasic/index.vue b/src/views/wms/basicDataManage/factoryModeling/areabasic/index.vue index 6b96d6994..1d5168097 100644 --- a/src/views/wms/basicDataManage/factoryModeling/areabasic/index.vue +++ b/src/views/wms/basicDataManage/factoryModeling/areabasic/index.vue @@ -49,6 +49,7 @@ @searchTableSuccess="searchTableSuccess" :isBusiness="false" @onBlur="onBlur" + @onChange="onChange" /> @@ -189,29 +190,37 @@ const handleDisable = async (id: number) => { /** 添加/修改操作 */ const basicFormRef = ref() const openForm = (type: string, row?: any) => { - if(type == "update"){ - Area.allSchemas.formSchema.forEach((item) => { - if (item.field == 'code') { - item.componentProps.disabled = true - } - if (item.field == 'warehouseCode') { - item.componentProps.disabled = true - item.componentProps.isSearchList = false - } - }) - - }else { - Area.allSchemas.formSchema.forEach((item) => { - if (item.field == 'code') { - item.componentProps.disabled = false - } - if (item.field == 'warehouseCode') { - item.componentProps.disabled = false - item.componentProps.isSearchList = true - } - }) - } basicFormRef.value.open(type, row) + nextTick(() => { + if (type == "update") { + Area.allSchemas.formSchema.forEach((item) => { + if (item.field == 'code') { + item.componentProps.disabled = true + }else if (item.field == 'warehouseCode') { + item.componentProps.disabled = true + item.componentProps.isSearchList = false + } else if (item.field == 'manageMode') { + if (row.type == 'WIP') { + item.componentProps.options = manageModeOptions.value + } else { + item.componentProps.options =manageModeOptions.value?.filter(item=>item.value!='BY_QUANTITY') + } + } + }) + }else { + Area.allSchemas.formSchema.forEach((item) => { + if (item.field == 'code') { + item.componentProps.disabled = false + }else if (item.field == 'warehouseCode') { + item.componentProps.disabled = false + item.componentProps.isSearchList = true + }else if (item.field == 'manageMode') { + item.componentProps.options = manageModeOptions.value?.filter(item=>item.value!='BY_QUANTITY') + basicFormRef.value.formRef.formModel.manageMode = item.componentProps.options[0].value + } + }) + } + }) } // form表单提交 @@ -320,6 +329,27 @@ const searchFormClick = (searchData) => { const onBlur = (field, e)=>{ } +const manageModeOptions = ref(JSON.parse(JSON.stringify(Area.allSchemas.formSchema.find(item=>item.field == 'manageMode').componentProps.options))) + +const onChange = (field, e)=>{ + if (field == 'type') { + if (e == 'WIP') { + Area.allSchemas.formSchema.forEach((item) => { + if (item.field == 'manageMode') { + item.componentProps.options = manageModeOptions.value + basicFormRef.value.formRef.formModel.manageMode = item.componentProps.options[0].value + } + }) + } else { + Area.allSchemas.formSchema.forEach((item) => { + if (item.field == 'manageMode') { + item.componentProps.options = manageModeOptions.value?.filter(item=>item.value!='BY_QUANTITY') + basicFormRef.value.formRef.formModel.manageMode = item.componentProps.options[0].value + } + }) + } + } +} /** 初始化 **/ onMounted(async() => { diff --git a/src/views/wms/basicDataManage/itemManage/itemarea/index.vue b/src/views/wms/basicDataManage/itemManage/itemarea/index.vue index 3ef652edc..b69d0aafe 100644 --- a/src/views/wms/basicDataManage/itemManage/itemarea/index.vue +++ b/src/views/wms/basicDataManage/itemManage/itemarea/index.vue @@ -118,6 +118,7 @@ const isShowButton = ref(true) const updataTableColumns = (val) => { tableColumns.value = val } +const manageModeOptions = ref(JSON.parse(JSON.stringify(Itemarea.allSchemas.formSchema.find(item=>item.field == 'manageMode').componentProps.options))) // 查询页面返回 const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { @@ -147,6 +148,21 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => setV['areaCode'] = val[0]['code'] setV['areaType'] = val[0]['type'] setV['manageMode'] = val[0]['manageMode'] + if (val[0]['type'] == 'WIP') { + Itemarea.allSchemas.formSchema.forEach((item) => { + if (item.field == 'manageMode') { + item.componentProps.options = manageModeOptions.value + setV['manageMode'] = item.componentProps.options[0].value + } + }) + } else { + Itemarea.allSchemas.formSchema.forEach((item) => { + if (item.field == 'manageMode') { + item.componentProps.options = manageModeOptions.value?.filter(item=>item.value!='BY_QUANTITY') + setV['manageMode'] = item.componentProps.options[0].value + } + }) + } }else if(formField == 'inPackUnit') { setV['inPackUnit'] = val[0]['packUnit'] @@ -305,28 +321,38 @@ const handleDisable = async (id: number) => { /** 添加/修改操作 */ const formRef = ref() const openForm =async (type: string, row?: number) => { - if(type == "update"){ - Itemarea.allSchemas.formSchema.forEach((item) => { - if (item.field == 'areaCode') { - item.componentProps.isSearchList = false, - item.componentProps.disabled = true - } - if (item.field == 'itemCode') { - item.componentProps.isSearchList = false, - item.componentProps.disabled = true - }}) - }else { - Itemarea.allSchemas.formSchema.forEach((item) => { - if (item.field == 'areaCode') { - item.componentProps.isSearchList = true - } - if (item.field == 'itemCode') { - item.componentProps.isSearchList = true - } - }) - } - tableData.value = [] // 重置明细数据 formRef.value.open(type, row) + nextTick(() => { + if(type == "update"){ + Itemarea.allSchemas.formSchema.forEach((item) => { + if (item.field == 'areaCode') { + item.componentProps.isSearchList = false, + item.componentProps.disabled = true + }else if (item.field == 'itemCode') { + item.componentProps.isSearchList = false, + item.componentProps.disabled = true + } else if (item.field == 'manageMode') { + if (row.areaType == 'WIP') { + item.componentProps.options = manageModeOptions.value + } else { + item.componentProps.options =manageModeOptions.value?.filter(item=>item.value!='BY_QUANTITY') + } + } + }) + }else { + Itemarea.allSchemas.formSchema.forEach((item) => { + if (item.field == 'areaCode') { + item.componentProps.isSearchList = true + }else if (item.field == 'itemCode') { + item.componentProps.isSearchList = true + }else if (item.field == 'manageMode') { + item.componentProps.options = manageModeOptions.value?.filter(item=>item.value!='BY_QUANTITY') + formRef.value.formRef.formModel.manageMode = item.componentProps.options[0].value + } + }) + } + }) + tableData.value = [] // 重置明细数据 } /**