|
|
@ -54,21 +54,21 @@ |
|
|
|
<el-col :span="24" v-for="(item, index) in formData.condition" :key="'规则条件col'+index"> |
|
|
|
<!-- 仓库 库区 库位组 库位 --> |
|
|
|
<el-form-item :key="'规则条件formItem'+index" label="" label-width="0" class="err-130" v-if="index == 0"> |
|
|
|
<el-select :key="'规则条件select'+index" |
|
|
|
<el-select key="仓库条件" |
|
|
|
v-model="item.ParamCode" |
|
|
|
placeholder="" |
|
|
|
style="width: 120px; margin-right: 10px" |
|
|
|
@change="changeWarehouse" |
|
|
|
style="width: 110px; margin-right: 10px" |
|
|
|
:disabled="formData.priority==0&&formType=='update'" |
|
|
|
@change="item.Value = ''" |
|
|
|
> |
|
|
|
<el-option |
|
|
|
:label="cur.label" |
|
|
|
:label= "cur.label" |
|
|
|
:value="cur.value" |
|
|
|
v-for="(cur, index) in options.warehouseTypeOptions" |
|
|
|
:key="'规则条件option'+index" |
|
|
|
:key="'仓库'+cur.value" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
<el-select :key="'请选择范围select'+index" |
|
|
|
<el-select key="供应商和客户Operator" |
|
|
|
v-model="item.Operator" |
|
|
|
placeholder="请选择范围" |
|
|
|
style="width: 110px; margin-right: 10px" |
|
|
@ -78,35 +78,44 @@ |
|
|
|
:label="cur.label" |
|
|
|
:value="cur.value" |
|
|
|
v-for="cur in options.RangeOptions" |
|
|
|
:key="'选择范围option'+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 |
|
|
|
style="flex: 1" |
|
|
|
multiple |
|
|
|
collapse-tags |
|
|
|
:disabled="formData.priority==0&&formType=='update'" |
|
|
|
> |
|
|
|
<el-option |
|
|
|
v-for="cur in options.warehouseList" |
|
|
|
:key="'规则条件option'+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> |
|
|
@ -231,14 +240,24 @@ |
|
|
|
<TableHead :HeadButttondata="Butttondata" @buttonBaseClick="buttonBaseClick" /> |
|
|
|
</template> |
|
|
|
</Dialog> |
|
|
|
|
|
|
|
<SearchTable |
|
|
|
ref="searchTableRef" |
|
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
<script setup lang="ts"> |
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
|
defineOptions({ name: 'UpShelfStrategyAddForm' }) |
|
|
|
import { getWarehouseList } from '@/api/wms/warehouse' |
|
|
|
import { getAreaList } from '@/api/wms/areabasic' |
|
|
|
import { getLocationgroupList } from '@/api/wms/locationgroup' |
|
|
|
import { getLocationList } from '@/api/wms/location' |
|
|
|
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 RuleApi from '@/api/wms/rule' |
|
|
|
import { isString } from '@/utils/is' |
|
|
|
|
|
|
@ -461,6 +480,193 @@ const open = async (type: string, strategyCode: string, id?: number) => { |
|
|
|
] |
|
|
|
} |
|
|
|
} |
|
|
|
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 |
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
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) |
|
|
|
} |
|
|
|
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) => { |
|
|
|
// let searchTableTitle = warehouseType.value == 'WarehouseCode'?'请选择仓库':warehouseType.value == 'AreaCode'?'请选择库区':warehouseType.value == 'LocationGroupCode'?'请选择库位组':warehouseType.value == 'LocationCode'?'请选择库位':'' |
|
|
|
console.log('searchTableSuccess',formField, searchField, val, type, row) |
|
|
|
console.log(val.map(item=>(item['code'])).join(',')) |
|
|
|
// if(formField=='BusinessType'){ |
|
|
|
// let BusinessType = formData.value.condition.find(item=>item['ParamCode']=='BusinessType') |
|
|
|
// if(BusinessType){ |
|
|
|
// BusinessType.Value = val.map(item=>(item['code'])).join(',') |
|
|
|
// } |
|
|
|
// return |
|
|
|
// }else |
|
|
|
if(formField=='BusinessType'){ |
|
|
|
console.log('condition',formData.value.condition) |
|
|
|
|
|
|
|
let businessType = formData.value.condition.find(item=>item['ParamCode']=='BusinessType') |
|
|
|
console.log('businessType',businessType) |
|
|
|
if(businessType){ |
|
|
|
businessType.Value = val.map(item=>(item['code'])).join(',') |
|
|
|
} |
|
|
|
return |
|
|
|
}else if(searchTableModule.value == 'condition'){ |
|
|
|
// module: config 配置 condition 条件 |
|
|
|
// 仓库 库区 库位 库位组 |
|
|
|
let conditionObj = formData.value.condition.find(item=>['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] = '' |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
|
|
|
|
|
|
|
/** 提交表单 */ |
|
|
|