Browse Source

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

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

Loading…
Cancel
Save