Browse Source

库位存储策略 添加操作符号

master
陈薪名 11 months ago
parent
commit
8bd8a296d4
  1. 53
      src/views/wms/basicDataManage/strategySetting/strategy/warehouseStorageStrategy/AddForm.vue

53
src/views/wms/basicDataManage/strategySetting/strategy/warehouseStorageStrategy/AddForm.vue

@ -67,6 +67,18 @@
:key="index" :key="index"
/> />
</el-select> </el-select>
<el-select
v-model="item.Operator"
placeholder="请选择范围"
style="width: 110px; margin-right: 10px"
>
<el-option
:label="cur.label"
:value="cur.value"
v-for="cur in options.RangeOptions"
:key="cur.value"
/>
</el-select>
<el-select <el-select
v-model="item.Value" v-model="item.Value"
:placeholder="`请选择${ :placeholder="`请选择${
@ -82,6 +94,8 @@
}`" }`"
clearable clearable
style="flex: 1" style="flex: 1"
multiple
collapse-tags
> >
<el-option <el-option
v-for="cur in options.warehouseList" v-for="cur in options.warehouseList"
@ -223,6 +237,7 @@ import { getAreaList } from '@/api/wms/areabasic'
import { getLocationgroupList } from '@/api/wms/locationgroup' import { getLocationgroupList } from '@/api/wms/locationgroup'
import { getLocationList } from '@/api/wms/location' import { getLocationList } from '@/api/wms/location'
import * as RuleApi from '@/api/wms/rule' import * as RuleApi from '@/api/wms/rule'
import { isString } from '@/utils/is'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
@ -246,8 +261,10 @@ const formData = ref({
status: true, // status: true, //
// //
condition: [ condition: [
// { ParamCode: 'WarehouseCode', Operator: 'IN', Value: '' },
{ ParamCode: 'LocationCode', Value: '' } { ParamCode: 'AreaCode', Operator: 'IN', Value: '' },
{ ParamCode: 'LocationGroupCode', Operator: 'IN', Value: '' },
{ ParamCode: 'LocationCode', Operator: 'IN', Value: '' }
], ],
configuration: { configuration: {
// //
@ -310,8 +327,8 @@ const formatRangeOptions = (...rest) => {
// //
const options = reactive({ const options = reactive({
// //
rangeOptions1: formatRangeOptions('IN', 'NOT IN'), RangeOptions: formatRangeOptions('IN', 'NOT IN'),
rangeOptions2: formatRangeOptions('>', '<', '>=', '<='), // rangeOptions2: formatRangeOptions('>', '<', '>=', '<='),
// //
warehouseTypeOptions: [ warehouseTypeOptions: [
@ -361,7 +378,7 @@ const getFormLocationList = async (queryParms) => {
options.warehouseList = await getLocationList() options.warehouseList = await getLocationList()
} }
} }
getFormLocationList() getFormWarehouseList()
// //
const queryParms = { const queryParms = {
type: 'OVERFLOW' type: 'OVERFLOW'
@ -411,6 +428,11 @@ const open = async (type: string, strategyCode: string, id?: number) => {
} }
if (data.condition) { if (data.condition) {
formData.value.condition = JSON.parse(data.condition) formData.value.condition = JSON.parse(data.condition)
formData.value.condition.forEach((item, index) => {
if (item.Operator == 'IN' || item.Operator == 'NOT IN') {
item.Value = item.Value.split(',')
}
})
} }
if (data.configuration) { if (data.configuration) {
formData.value.configuration = JSON.parse(data.configuration) formData.value.configuration = JSON.parse(data.configuration)
@ -452,6 +474,23 @@ const submitForm = async () => {
// //
formLoading.value = true formLoading.value = true
try { try {
const arr = formData.value.condition.map(item=> {
let str = item.Value
if(isString(item.Value)){
if(item.Value.indexOf(','>-1)){
str = item.Value.split(',').join(',')
}
}
if ((item.Operator == 'IN' || item.Operator == 'NOT IN')&& Array.isArray(item.Value)) {
str = item.Value.join(',')
}
return {
ParamCode:item.ParamCode,
Operator:item.Operator,
Value:str
}
})
let data = { let data = {
id: formData.value.id, id: formData.value.id,
strategyCode: formData.value.strategyCode, // strategyCode: formData.value.strategyCode, //
@ -460,7 +499,7 @@ const submitForm = async () => {
priority: formData.value.priority, // priority: formData.value.priority, //
status: formData.value.status ? 0 : 1, // status: formData.value.status ? 0 : 1, //
// //
condition: JSON.stringify(formData.value.condition), condition: JSON.stringify(arr),
configuration: JSON.stringify(formData.value.configuration) configuration: JSON.stringify(formData.value.configuration)
} }
if (formType.value === 'create') { if (formType.value === 'create') {
@ -490,7 +529,7 @@ const resetForm = () => {
// //
condition: [ condition: [
// //
{ ParamCode: 'LocationCode', Value: '' } { ParamCode: 'WarehouseCode', Operator: 'IN', Value: '' }
], ],
configuration: { configuration: {

Loading…
Cancel
Save