Browse Source

上架策略--多选

hella_online_20240829
wangyufei 3 months ago
parent
commit
583571f2d9
  1. 171
      src/views/wms/basicDataManage/strategySetting/strategy/upShelfStrategy/AddForm.vue

171
src/views/wms/basicDataManage/strategySetting/strategy/upShelfStrategy/AddForm.vue

@ -310,7 +310,6 @@
v-model="warehouseType"
placeholder=""
style="width: 110px; margin-right: 10px"
@change="changeWarehouse"
>
<el-option
:label="cur.label"
@ -319,7 +318,56 @@
:key="'仓库'+cur.value"
/>
</el-select>
<el-select
<!-- <el-row class="border-row" style="flex:1;display: flex; flex-direction: row;align-items: center;">
<el-tag class="mr-5px mb-5px"
v-for="tag in formData.configuration.WarehouseCodes"
:key="tag"
closable
:disable-transitions="false"
@close="tagHandleClose(tag,formData.configuration.WarehouseCodes)"
>
{{ tag }}
</el-tag> -->
<!-- 仓库 -->
<el-input style="flex:1" v-show="warehouseType == 'WarehouseCode'" placeholder="请选择仓库" v-model="formData.configuration.WarehouseCode">
<template #suffix>
<el-button type="text" plain style="color:var(--el-button-text-color)" @click="searchWarehouse">
<Icon icon="ep:search" class="mr-5px" />
</el-button>
</template>
</el-input>
<!-- 库区 -->
<el-input style="flex:1" v-show="warehouseType == 'AreaCode'" placeholder="请选择库区" v-model="formData.configuration.AreaCode">
<template #suffix>
<el-button type="text" plain style="color:var(--el-button-text-color)" @click="searchWarehouse">
<Icon icon="ep:search" class="mr-5px" />
</el-button>
</template>
</el-input>
<!-- 库位组 -->
<el-input style="flex:1" v-show="warehouseType == 'LocationGroupCode'" placeholder="请选择库位组" v-model="formData.configuration.LocationGroupCode">
<template #suffix>
<el-button type="text" plain style="color:var(--el-button-text-color)" @click="searchWarehouse">
<Icon icon="ep:search" class="mr-5px" />
</el-button>
</template>
</el-input>
<!-- 库位 -->
<el-input style="flex:1" v-show="warehouseType == 'LocationCode'" placeholder="请选择库位" v-model="formData.configuration.LocationCode">
<template #suffix>
<el-button type="text" plain style="color:var(--el-button-text-color)" @click="searchWarehouse">
<Icon icon="ep:search" class="mr-5px" />
</el-button>
</template>
</el-input>
<!-- </el-row> -->
<!-- <el-select
v-model="formData.configuration.WarehouseCode"
v-if="warehouseType == 'WarehouseCode'"
placeholder="请选择仓库"
@ -335,8 +383,8 @@
:label="cur.code"
:value="cur.code"
/>
</el-select>
<el-select
</el-select> -->
<!-- <el-select
v-model="formData.configuration.AreaCode"
v-if="warehouseType == 'AreaCode'"
placeholder="请选择库区"
@ -387,7 +435,7 @@
:label="cur.code"
:value="cur.code"
/>
</el-select>
</el-select> -->
</el-form-item>
</el-col>
<!-- 优先空位库 -->
@ -509,6 +557,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'
@ -520,7 +572,15 @@ 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 * 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 { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
import { isString } from '@/utils/is'
@ -564,6 +624,7 @@ const formData = ref({
configuration: {
//
WarehouseCode: '',
WarehouseCodes: ['Tag 1', 'Tag 2', 'Tag 3', 'Tag 2', 'Tag 3', 'Tag 2', 'Tag 3', 'Tag 2', 'Tag 3', 'Tag 2', 'Tag 3'],
//
AreaCode: '',
//
@ -674,6 +735,10 @@ const buttonBaseClick = (val, item) => {
dialogVisible.value = false
}
}
const tagHandleClose = (tag: string, list) => {
list.splice(list.indexOf(tag), 1)
}
//
const getFormSupplierList = async () => {
@ -756,6 +821,80 @@ const filterMethodWarehouseList = (query: string) => {
options.warehouseList = options.originWarehouseList
}
}
const searchTableRef = ref()
const searchWarehouse = ()=>{
if(warehouseType.value == 'WarehouseCode'){
//
searchTableRef.value.open(
'请选择仓库',
Warehouse.allSchemas,
WarehouseApi.getWarehousePage,
'WarehouseCode',
'code',
true,
undefined,
undefined,
undefined
)
}else if(warehouseType.value == 'AreaCode'){
searchTableRef.value.open(
'请选择库区',
Area.allSchemas,
AreaApi.getAreaPage,
'WarehouseCode',
'code',
true,
undefined,
undefined,
undefined
)
}else if(warehouseType.value == 'LocationGroupCode'){
searchTableRef.value.open(
'请选择库位组',
Locationgroup.allSchemas,
LocationgroupApi.getLocationgroupPage,
'WarehouseCode',
'code',
true,
undefined,
undefined,
undefined
)
}else if(warehouseType.value == 'LocationCode'){
searchTableRef.value.open(
'请选择库位',
Location.allSchemas,
LocationApi.getLocationPage,
'WarehouseCode',
'code',
true,
undefined,
undefined,
undefined
)
}
}
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(','))
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] = ''
}
})
}
// ///
const changeWarehouse = (e) => {
formData.value.configuration.WarehouseCode = ''
@ -772,6 +911,7 @@ const changeWarehouse = (e) => {
getFormLocationList()
}
}
/** 打开弹窗 */
const open = async (type: string, strategyCode: string, id?: number) => {
@ -780,7 +920,7 @@ const open = async (type: string, strategyCode: string, id?: number) => {
dialogTitle.value = t('action.' + type)
formType.value = type
warehouseType.value = 'WarehouseCode'
getFormWarehouseList()
// getFormWarehouseList()
resetForm()
//
@ -817,6 +957,7 @@ const open = async (type: string, strategyCode: string, id?: number) => {
if (data.configuration) {
formData.value.configuration = JSON.parse(data.configuration)
}
//
if (formData.value.condition[0].ParamCode == 'SupplierCode') {
getFormSupplierList()
@ -829,25 +970,25 @@ const open = async (type: string, strategyCode: string, id?: number) => {
formData.value.configuration.WarehouseCode
) {
warehouseType.value = 'WarehouseCode'
getFormWarehouseList()
// getFormWarehouseList()
} else if (
'AreaCode' in formData.value.configuration &&
formData.value.configuration.AreaCode
) {
warehouseType.value = 'AreaCode'
getFormAreaList()
// getFormAreaList()
} else if (
'LocationGroupCode' in formData.value.configuration &&
formData.value.configuration.LocationGroupCode
) {
warehouseType.value = 'LocationGroupCode'
getFormLocationgrouList()
// getFormLocationgrouList()
} else if (
'LocationCode' in formData.value.configuration &&
formData.value.configuration.LocationCode
) {
warehouseType.value = 'LocationCode'
getFormLocationList()
// getFormLocationList()
}
} finally {
formLoading.value = false
@ -860,6 +1001,7 @@ const open = async (type: string, strategyCode: string, id?: number) => {
}
}
defineExpose({ open }) // open
@ -965,6 +1107,7 @@ const resetForm = () => {
configuration: {
//
WarehouseCode: '',
// WarehouseCodes: ['Tag 1', 'Tag 2', 'Tag 3', 'Tag 2', 'Tag 3', 'Tag 2', 'Tag 3', 'Tag 2', 'Tag 3', 'Tag 2', 'Tag 3'],
//
AreaCode: '',
//
@ -1036,4 +1179,12 @@ const resetForm = () => {
color: var(--el-color-danger);
margin-right:4px;
}
.border-row{
padding:5px;
border:var(--el-border);
border-radius: var(--el-border-radius-base);
}
</style>

Loading…
Cancel
Save