|
|
@ -130,32 +130,40 @@ |
|
|
|
v-else-if="item.ParamCode == 'Project'" |
|
|
|
:disabled="formData.priority==0&&formType=='update'" |
|
|
|
/> |
|
|
|
<el-input :key="'物料Value'+index" |
|
|
|
<!-- <el-input :key="'物料Value'+index" |
|
|
|
v-model="item.Value" |
|
|
|
placeholder="请输入物料,多个物料以逗号分隔" |
|
|
|
clearable |
|
|
|
style="flex: 1" |
|
|
|
v-else-if="item.ParamCode == 'ItemCode'" |
|
|
|
:disabled="formData.priority==0&&formType=='update'" |
|
|
|
/> |
|
|
|
/> --> |
|
|
|
<el-input key="物料Value" style="flex:1" placeholder="请选择物料" v-model="item.Value" @blur="blurWarehouse({module:'condition',type:'ItemCode'})" v-else-if="item.ParamCode == 'ItemCode'"> |
|
|
|
<template #suffix> |
|
|
|
<el-button :disabled="formData.priority==0&&formType=='update'" type="text" plain style="color:var(--el-button-text-color)" @click.stop="searchWarehouse({ module: 'condition', type: 'ItemCode' })" |
|
|
|
> |
|
|
|
<Icon icon="ep:search" class="mr-5px" /> |
|
|
|
</el-button> |
|
|
|
</template> |
|
|
|
</el-input> |
|
|
|
</el-form-item> |
|
|
|
<!-- 仓库 库区 库位组 库位 --> |
|
|
|
<el-form-item :key="'仓库'+index" label="" label-width="0" class="err-240" v-if="index == 1"> |
|
|
|
<el-select :key="'仓库title'+index" |
|
|
|
<el-select key="仓库条件" |
|
|
|
v-model="item.ParamCode" |
|
|
|
placeholder="" |
|
|
|
style="width: 110px; margin-right: 10px" |
|
|
|
@change="changeWarehouse" |
|
|
|
:disabled="formData.priority==0&&formType=='update'" |
|
|
|
@change="item.Value = ''" |
|
|
|
> |
|
|
|
<el-option |
|
|
|
:label= "cur.label" |
|
|
|
:value="cur.value" |
|
|
|
v-for="(cur, index) in options.warehouseTypeOptions" |
|
|
|
:key="'仓库titleOption'+index+cur.value" |
|
|
|
:key="'仓库'+cur.value" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
<el-select :key="'仓库Operator'+index" |
|
|
|
<el-select key="供应商和客户Operator" |
|
|
|
v-model="item.Operator" |
|
|
|
placeholder="请选择范围" |
|
|
|
style="width: 110px; margin-right: 10px" |
|
|
@ -165,35 +173,44 @@ |
|
|
|
:label="cur.label" |
|
|
|
:value="cur.value" |
|
|
|
v-for="cur in options.rangeOptions1" |
|
|
|
:key="'仓库Operator'+index+cur.value" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
<el-select :key="'仓库Value'+index" |
|
|
|
v-model="item.Value" |
|
|
|
:placeholder="`请选择${ |
|
|
|
item.ParamCode == 'WarehouseCode' |
|
|
|
? '仓库' |
|
|
|
: item.ParamCode == 'AreaCode' |
|
|
|
? '库区' |
|
|
|
: item.ParamCode == 'LocationGroupCode' |
|
|
|
? '库位组' |
|
|
|
: item.ParamCode == 'LocationCode' |
|
|
|
? '库位' |
|
|
|
: '' |
|
|
|
}`" |
|
|
|
clearable |
|
|
|
multiple |
|
|
|
collapse-tags |
|
|
|
style="flex: 1" |
|
|
|
:disabled="formData.priority==0&&formType=='update'" |
|
|
|
> |
|
|
|
<el-option |
|
|
|
v-for="cur in options.warehouseList" |
|
|
|
:key="'仓库Value'+index+cur.code" |
|
|
|
:label="cur.code" |
|
|
|
:value="cur.code" |
|
|
|
:key="'供应商和客户Operator'+cur.value" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
<!-- 仓库 --> |
|
|
|
<el-input style="flex:1" v-show="item.ParamCode == 'WarehouseCode'" placeholder="请选择从仓库" v-model="item.Value" @blur="blurWarehouse({module:'condition',type:'WarehouseCode'})" :disabled="formData.priority==0&&formType=='update'"> |
|
|
|
<template #suffix> |
|
|
|
<el-button type="text" plain style="color:var(--el-button-text-color)" @click.stop="searchWarehouse({module:'condition',type:'WarehouseCode'})"> |
|
|
|
<Icon icon="ep:search" class="mr-5px" /> |
|
|
|
</el-button> |
|
|
|
</template> |
|
|
|
</el-input> |
|
|
|
|
|
|
|
<!-- 库区 --> |
|
|
|
<el-input style="flex:1" v-show="item.ParamCode == 'AreaCode'" placeholder="请选择从库区" v-model="item.Value" @blur="blurWarehouse({module:'condition',type:'AreaCode'})"> |
|
|
|
<template #suffix> |
|
|
|
<el-button type="text" plain style="color:var(--el-button-text-color)" @click="searchWarehouse({module:'condition',type:'AreaCode'})"> |
|
|
|
<Icon icon="ep:search" class="mr-5px" /> |
|
|
|
</el-button> |
|
|
|
</template> |
|
|
|
</el-input> |
|
|
|
|
|
|
|
<!-- 库位组 --> |
|
|
|
<el-input style="flex:1" v-show="item.ParamCode == 'LocationGroupCode'" placeholder="请选择从库位组" v-model="item.Value" @blur="blurWarehouse({module:'condition',type:'LocationGroupCode'})"> |
|
|
|
<template #suffix> |
|
|
|
<el-button type="text" plain style="color:var(--el-button-text-color)" @click="searchWarehouse({module:'condition',type:'LocationGroupCode'})"> |
|
|
|
<Icon icon="ep:search" class="mr-5px" /> |
|
|
|
</el-button> |
|
|
|
</template> |
|
|
|
</el-input> |
|
|
|
|
|
|
|
<!-- 库位 --> |
|
|
|
<el-input style="flex:1" v-show="item.ParamCode == 'LocationCode'" placeholder="请选择从库位" v-model="item.Value" @blur="blurWarehouse({module:'condition',type:'LocationCode'})"> |
|
|
|
<template #suffix> |
|
|
|
<el-button type="text" plain style="color:var(--el-button-text-color)" @click="searchWarehouse({module:'condition',type:'LocationCode'})"> |
|
|
|
<Icon icon="ep:search" class="mr-5px" /> |
|
|
|
</el-button> |
|
|
|
</template> |
|
|
|
</el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
@ -284,6 +301,10 @@ |
|
|
|
<TableHead :HeadButttondata="Butttondata" @buttonBaseClick="buttonBaseClick" /> |
|
|
|
</template> |
|
|
|
</Dialog> |
|
|
|
<SearchTable |
|
|
|
ref="searchTableRef" |
|
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
<script setup lang="ts"> |
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
@ -295,6 +316,19 @@ import { getLocationList } from '@/api/wms/location' |
|
|
|
import * as RuleApi from '@/api/wms/rule' |
|
|
|
import { isString } from '@/utils/is' |
|
|
|
|
|
|
|
import * as WarehouseApi from '@/api/wms/warehouse' |
|
|
|
import { Warehouse } from '@/views/wms/basicDataManage/factoryModeling/warehouse/warehouse.data' |
|
|
|
import * as AreaApi from '@/api/wms/areabasic' |
|
|
|
import { Area } from '@/views/wms/basicDataManage/factoryModeling/areabasic/areabasic.data' |
|
|
|
import * as LocationgroupApi from '@/api/wms/locationgroup' |
|
|
|
import { Locationgroup } from '@/views/wms/basicDataManage/factoryModeling/locationgroup/locationgroup.data' |
|
|
|
|
|
|
|
import * as LocationApi from '@/api/wms/location' |
|
|
|
import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data' |
|
|
|
|
|
|
|
import * as ItembasicApi from '@/api/wms/itembasic' |
|
|
|
import { Itembasic} from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data' |
|
|
|
|
|
|
|
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' |
|
|
|
|
|
|
|
const { t } = useI18n() // 国际化 |
|
|
@ -506,6 +540,7 @@ const open = async (type: string, strategyCode: string, id?: number) => { |
|
|
|
defaultButtons.formSaveBtn(null), // 保存 |
|
|
|
defaultButtons.formCloseBtn(null) // 关闭 |
|
|
|
] |
|
|
|
resetForm() |
|
|
|
} |
|
|
|
} |
|
|
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
|
|
@ -599,7 +634,194 @@ const resetForm = () => { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
const searchTableRef = ref() |
|
|
|
const searchTableModule = ref('') // 条件 / 配置 |
|
|
|
const searchWarehouse = ({module='config',type})=>{ |
|
|
|
searchTableModule.value = module |
|
|
|
// module: config 配置 condition 条件 |
|
|
|
if( module=='condition'&&type=='WarehouseCode' || module=='config'&&warehouseType.value == 'WarehouseCode'){ |
|
|
|
// 仓库 |
|
|
|
searchTableRef.value.open( |
|
|
|
'请选择仓库', |
|
|
|
Warehouse.allSchemas, |
|
|
|
WarehouseApi.getWarehousePage, |
|
|
|
'WarehouseCode', |
|
|
|
'code', |
|
|
|
true, |
|
|
|
undefined, |
|
|
|
undefined, |
|
|
|
undefined |
|
|
|
) |
|
|
|
}else if(module=='condition'&&type=='AreaCode' || module=='config'&&warehouseType.value == 'AreaCode'){ |
|
|
|
searchTableRef.value.open( |
|
|
|
'请选择库区', |
|
|
|
Area.allSchemas, |
|
|
|
AreaApi.getAreaPage, |
|
|
|
'WarehouseCode', |
|
|
|
'code', |
|
|
|
true, |
|
|
|
undefined, |
|
|
|
undefined, |
|
|
|
undefined |
|
|
|
) |
|
|
|
|
|
|
|
}else if(module=='condition'&&type=='LocationGroupCode' || module=='config'&&warehouseType.value == 'LocationGroupCode'){ |
|
|
|
|
|
|
|
searchTableRef.value.open( |
|
|
|
'请选择库位组', |
|
|
|
Locationgroup.allSchemas, |
|
|
|
LocationgroupApi.getLocationgroupPage, |
|
|
|
'WarehouseCode', |
|
|
|
'code', |
|
|
|
true, |
|
|
|
undefined, |
|
|
|
undefined, |
|
|
|
undefined |
|
|
|
) |
|
|
|
|
|
|
|
}else if(module=='condition'&&type=='LocationCode' || module=='config'&&warehouseType.value == 'LocationCode'){ |
|
|
|
searchTableRef.value.open( |
|
|
|
'请选择库位', |
|
|
|
Location.allSchemas, |
|
|
|
LocationApi.getLocationPage, |
|
|
|
'WarehouseCode', |
|
|
|
'code', |
|
|
|
true, |
|
|
|
undefined, |
|
|
|
undefined, |
|
|
|
undefined |
|
|
|
) |
|
|
|
|
|
|
|
}else if(module=='condition'&&type=='ItemCode' || module=='config'&&warehouseType.value == 'ItemCode'){ |
|
|
|
searchTableRef.value.open( |
|
|
|
'请选择物料', |
|
|
|
Itembasic.allSchemas, |
|
|
|
ItembasicApi.getItembasicPage, |
|
|
|
'ItemCode', |
|
|
|
'code', |
|
|
|
true, |
|
|
|
undefined, |
|
|
|
undefined, |
|
|
|
undefined |
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
const warehouseType = ref('') |
|
|
|
const blurWarehouse = async ({module='config',type})=>{ |
|
|
|
|
|
|
|
// 校验的值 |
|
|
|
let warehouseValue = formData.value.configuration[warehouseType.value] |
|
|
|
let conditionObj = null |
|
|
|
if(module=='condition'){ |
|
|
|
// 规则条件 |
|
|
|
conditionObj = formData.value.condition.find(item=>item['ParamCode']==type) |
|
|
|
if(conditionObj){ |
|
|
|
warehouseValue = conditionObj['Value'] |
|
|
|
} |
|
|
|
// { value: 'WarehouseCode', label: '仓库' }, |
|
|
|
// { value: 'AreaCode', label: '库区' }, |
|
|
|
// { value: 'LocationGroupCode', label: '库位组' }, |
|
|
|
// { value: 'LocationCode', label: '库位' } |
|
|
|
} |
|
|
|
if(!warehouseValue){ |
|
|
|
return |
|
|
|
} |
|
|
|
let verifyRes = [] |
|
|
|
console.log(222,warehouseValue) |
|
|
|
if(module=='condition'&&type=='WarehouseCode' || module=='config'&&warehouseType.value == 'WarehouseCode'){ |
|
|
|
// 仓库 |
|
|
|
verifyRes = await WarehouseApi.verifyWarehouse({ |
|
|
|
code:warehouseValue |
|
|
|
}) |
|
|
|
console.log('仓库verifyRes',verifyRes) |
|
|
|
}else if(module=='condition'&&type=='AreaCode' || module=='config'&&warehouseType.value == 'AreaCode'){ |
|
|
|
// 库区 |
|
|
|
verifyRes = await AreaApi.verifyAreaList({ |
|
|
|
code:warehouseValue |
|
|
|
}) |
|
|
|
console.log('库区verifyRes',verifyRes) |
|
|
|
}else if(module=='condition'&&type=='LocationGroupCode' || module=='config'&&warehouseType.value == 'LocationGroupCode'){ |
|
|
|
// 库位组 |
|
|
|
verifyRes = await LocationgroupApi.verifyLocationgroup({ |
|
|
|
code:warehouseValue |
|
|
|
}) |
|
|
|
console.log('库位组verifyRes',verifyRes) |
|
|
|
}else if(module=='condition'&&type=='LocationCode' || module=='config'&&warehouseType.value == 'LocationCode'){ |
|
|
|
// 库位 |
|
|
|
verifyRes = await LocationApi.verifyLocation({ |
|
|
|
code:warehouseValue |
|
|
|
}) |
|
|
|
console.log('库位verifyRes',verifyRes) |
|
|
|
}else if(module=='condition'&&type=='ItemCode' || module=='config'&&warehouseType.value == 'ItemCode'){ |
|
|
|
// 物料 |
|
|
|
verifyRes = await ItembasicApi.getItemListByCodes({ |
|
|
|
codes:warehouseValue |
|
|
|
}) |
|
|
|
console.log('物料verifyRes',verifyRes) |
|
|
|
} |
|
|
|
if(verifyRes&&verifyRes.length>0){ |
|
|
|
let verifyList = verifyRes.map(item=>(item['code'])) |
|
|
|
if(module=='condition'){ |
|
|
|
// 条件 |
|
|
|
let codeList = warehouseValue.split(',') |
|
|
|
conditionObj['Value'] = codeList.filter(item=>verifyList.indexOf(item)>-1).join(',') |
|
|
|
const str = codeList.filter(item => verifyList.indexOf(item) == -1).join(',') |
|
|
|
if (str) { |
|
|
|
message.alert('代码' + str + '没有找到对应数据') |
|
|
|
} |
|
|
|
}else{ |
|
|
|
// 配置 |
|
|
|
let codeList = formData.value.configuration[warehouseType.value].split(',') |
|
|
|
formData.value.configuration[warehouseType.value] = codeList.filter(item=>verifyList.indexOf(item)>-1).join(',') |
|
|
|
const str = codeList.filter(item => verifyList.indexOf(item) == -1).join(',') |
|
|
|
if (str) { |
|
|
|
message.alert('代码' + str + '没有找到对应数据') |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
if(module=='condition'){ |
|
|
|
message.alert('代码' + conditionObj['Value'] + '没有找到对应数据') |
|
|
|
// 条件 |
|
|
|
conditionObj['Value'] = '' |
|
|
|
}else{ |
|
|
|
message.alert('代码' + formData.value.configuration[warehouseType.value] + '没有找到对应数据') |
|
|
|
formData.value.configuration[warehouseType.value] = '' |
|
|
|
} |
|
|
|
} |
|
|
|
if(module!='condition'){ |
|
|
|
let fields = ['WarehouseCode','AreaCode','LocationGroupCode','LocationCode'] |
|
|
|
fields.forEach(item=>{ |
|
|
|
if(item!=warehouseType.value){ |
|
|
|
formData.value.configuration[item] = '' |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
const searchTableSuccess = (formField, searchField, val, type, row) => { |
|
|
|
|
|
|
|
if(searchTableModule.value == 'condition'){ |
|
|
|
// module: config 配置 condition 条件 |
|
|
|
// 仓库 库区 库位 库位组 |
|
|
|
let conditionObj = formData.value.condition.find(item=>['ItemCode','WarehouseCode','AreaCode','LocationGroupCode','LocationCode'].includes(item['ParamCode'])) |
|
|
|
conditionObj['Value'] = val.map(item=>(item['code'])).join(',') |
|
|
|
}else{ |
|
|
|
// 配置 |
|
|
|
// 仓库 库区 库位 库位组 |
|
|
|
formData.value.configuration[warehouseType.value] = val.map(item=>(item['code'])).join(',') |
|
|
|
let fields = ['WarehouseCode','AreaCode','LocationGroupCode','LocationCode'] |
|
|
|
fields.forEach(item=>{ |
|
|
|
if(item!=warehouseType.value){ |
|
|
|
formData.value.configuration[item] = '' |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
</script> |
|
|
|
<style scoped lang="scss"> |
|
|
|
.item { |
|
|
|