Browse Source

策略改成搜索框

intex
zhang_li 2 days ago
parent
commit
afbc0198cb
  1. 205
      src/views/wms/basicDataManage/strategySetting/strategy/batchStrategy/AddForm.vue
  2. 290
      src/views/wms/basicDataManage/strategySetting/strategy/repairMaterialStrategy/AddForm.vue
  3. 4
      src/views/wms/basicDataManage/strategySetting/strategy/storageCapacityStrategy/AddForm.vue

205
src/views/wms/basicDataManage/strategySetting/strategy/batchStrategy/AddForm.vue

@ -80,22 +80,20 @@
:key="'供应商OperatorOption'+index+cur.value" :key="'供应商OperatorOption'+index+cur.value"
/> />
</el-select> </el-select>
<el-select :key="'供应商Value'+index" <el-input key="客户Value" style="flex:1" placeholder="请选择客户" v-model="item.Value" @blur="blurWarehouse({module:'condition',type:'CustomerCode'})" v-if="item.ParamCode == 'CustomerCode'" :disabled="formData.priority==0&&formType=='update'">
v-model="item.Value" <template #suffix>
:placeholder="`请选择${item.ParamCode == 'SupplierCode' ? '供应商' : '客户'}`" <el-button :disabled="formData.priority==0&&formType=='update'" type="text" plain style="color:var(--el-button-text-color)" @click.stop="searchWarehouse({ module: 'condition', type: 'CustomerCode' })">
style="flex: 1" <Icon icon="ep:search" class="mr-5px" />
clearable </el-button>
multiple </template>
collapse-tags </el-input>
:disabled="formData.priority==0&&formType=='update'" <el-input key="供应商Value" style="flex:1" placeholder="请选择供应商" v-model="item.Value" @blur="blurWarehouse({module:'condition',type:'SupplierCode'})" v-if="item.ParamCode == 'SupplierCode'" :disabled="formData.priority==0&&formType=='update'">
> <template #suffix>
<el-option <el-button :disabled="formData.priority==0&&formType=='update'" type="text" plain style="color:var(--el-button-text-color)" @click.stop="searchWarehouse({ module: 'condition', type: 'SupplierCode' })">
v-for="cur in options.supplierList" <Icon icon="ep:search" class="mr-5px" />
:key="'供应商ValueOption'+index+cur.code" </el-button>
:label="cur.name" </template>
:value="cur.code" </el-input>
/>
</el-select>
</el-form-item> </el-form-item>
<!-- 选择物料类型 --> <!-- 选择物料类型 -->
<el-form-item :key="'物料类型formItem'+index" label="" label-width="0" class="err-240" v-if="index == 1"> <el-form-item :key="'物料类型formItem'+index" label="" label-width="0" class="err-240" v-if="index == 1">
@ -176,14 +174,14 @@
v-else-if="item.ParamCode == 'Project'" v-else-if="item.ParamCode == 'Project'"
:disabled="formData.priority==0&&formType=='update'" :disabled="formData.priority==0&&formType=='update'"
/> />
<el-input :key="'物料Value'+index" <el-input key="物料Value" style="flex:1" placeholder="请选择物料" v-model="item.Value" @blur="blurWarehouse({module:'condition',type:'ItemCode'})" v-else-if="item.ParamCode == 'ItemCode'">
v-model="item.Value" <template #suffix>
placeholder="请输入物料,多个物料以逗号分隔" <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' })"
clearable >
style="flex: 1" <Icon icon="ep:search" class="mr-5px" />
v-else-if="item.ParamCode == 'ItemCode'" </el-button>
:disabled="formData.priority==0&&formType=='update'" </template>
/> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -264,6 +262,10 @@
<TableHead :HeadButttondata="Butttondata" @buttonBaseClick="buttonBaseClick" /> <TableHead :HeadButttondata="Butttondata" @buttonBaseClick="buttonBaseClick" />
</template> </template>
</Dialog> </Dialog>
<SearchTable
ref="searchTableRef"
@searchTableSuccess="searchTableSuccess"
/>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
@ -273,6 +275,13 @@ import { getCustomerList } from '@/api/wms/customer'
import * as RuleApi from '@/api/wms/rule' import * as RuleApi from '@/api/wms/rule'
import { isString } from '@/utils/is' import { isString } from '@/utils/is'
import * as ItembasicApi from '@/api/wms/itembasic'
import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data'
import * as SupplierApi from '@/api/wms/supplier'
import { Supplier } from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data'
import { Customer, CustomerRules } from '@/views/wms/basicDataManage/customerManage/customer/customer.data'
import * as CustomerApi from '@/api/wms/customer'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
import { json } from 'stream/consumers' import { json } from 'stream/consumers'
@ -593,6 +602,154 @@ const inputBlur = () => {
formData.value.configurationRules = '1' formData.value.configurationRules = '1'
} }
} }
const searchTableRef = ref()
const searchTableModule = ref('') // 条件 / 配置
const searchWarehouse = ({module='config',type})=>{
searchTableModule.value = module
// module: config condition
if(module=='condition'&&type=='CustomerCode' || module=='config'&&warehouseType.value == 'CustomerCode'){
//
searchTableRef.value.open(
'请选择客户',
Customer.allSchemas,
CustomerApi.getCustomerPage,
'CustomerCode',
'code',
true,
undefined,
undefined,
undefined
)
}else if(module=='condition'&&type=='SupplierCode' || module=='config'&&warehouseType.value == 'SupplierCode'){
//
searchTableRef.value.open(
'请选择供应商',
Supplier.allSchemas,
SupplierApi.getSupplierPage,
'SupplierCode',
'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 = []
if(module=='condition'&&type=='CustomerCode' || module=='config'&&warehouseType.value == 'CustomerCode'){
//
verifyRes = await CustomerApi.getCustomerByCodes({
codes:warehouseValue
})
console.log('客户verifyRes',verifyRes)
}else if(module=='condition'&&type=='SupplierCode' || module=='config'&&warehouseType.value == 'SupplierCode'){
//
verifyRes = await SupplierApi.getSupplierListByCodes({
codes: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> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.item { .item {

290
src/views/wms/basicDataManage/strategySetting/strategy/repairMaterialStrategy/AddForm.vue

@ -114,32 +114,40 @@
:value="cur.value" :value="cur.value"
/> />
</el-select> </el-select>
<el-input <!-- <el-input
v-model="item.Value" v-model="item.Value"
placeholder="请输入物料,多个物料以逗号分隔" placeholder="请输入物料,多个物料以逗号分隔"
clearable clearable
style="flex: 1" style="flex: 1"
:disabled="formData.priority==0&&formType=='update'" :disabled="formData.priority==0&&formType=='update'"
v-else-if="item.ParamCode == 'ItemCode'" v-else-if="item.ParamCode == 'ItemCode'"
/> /> -->
<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>
<!-- 仓库 库区 库位组 库位 --> <!-- 仓库 库区 库位组 库位 -->
<el-form-item label="" label-width="0" class="err-240" v-if="index == 1"> <el-form-item label="" label-width="0" class="err-240" v-if="index == 1">
<el-select <el-select key="仓库条件"
v-model="item.ParamCode" v-model="item.ParamCode"
placeholder="" placeholder=""
style="width: 110px; margin-right: 10px" style="width: 110px; margin-right: 10px"
@change="changeWarehouse"
:disabled="formData.priority==0&&formType=='update'" :disabled="formData.priority==0&&formType=='update'"
@change="item.Value = ''"
> >
<el-option <el-option
:label= "cur.label" :label= "cur.label"
:value="cur.value" :value="cur.value"
v-for="(cur, index) in options.warehouseTypeOptions" v-for="(cur, index) in options.warehouseTypeOptions"
:key="index" :key="'仓库'+cur.value"
/> />
</el-select> </el-select>
<el-select <el-select key="供应商和客户Operator"
v-model="item.Operator" v-model="item.Operator"
placeholder="请选择范围" placeholder="请选择范围"
style="width: 110px; margin-right: 10px" style="width: 110px; margin-right: 10px"
@ -149,35 +157,44 @@
:label="cur.label" :label="cur.label"
:value="cur.value" :value="cur.value"
v-for="cur in options.rangeOptions1" v-for="cur in options.rangeOptions1"
:key="cur.value" :key="'供应商和客户Operator'+cur.value"
/>
</el-select>
<el-select
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="cur.code"
:label="cur.code"
:value="cur.code"
/> />
</el-select> </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-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -302,16 +319,28 @@
<TableHead :HeadButttondata="Butttondata" @buttonBaseClick="buttonBaseClick" /> <TableHead :HeadButttondata="Butttondata" @buttonBaseClick="buttonBaseClick" />
</template> </template>
</Dialog> </Dialog>
<SearchTable
ref="searchTableRef"
@searchTableSuccess="searchTableSuccess"
/>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
defineOptions({ name: 'UpShelfStrategyAddForm' }) 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 RuleApi from '@/api/wms/rule' import * as RuleApi from '@/api/wms/rule'
import { isString } from '@/utils/is' 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 { validateHanset, validateEmail } from '@/utils/validator' import { validateHanset, validateEmail } from '@/utils/validator'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
@ -645,7 +674,194 @@ const validateFeedQty = (rule, value, callback) => {
callback() callback()
} }
} }
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> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.item { .item {

4
src/views/wms/basicDataManage/strategySetting/strategy/storageCapacityStrategy/AddForm.vue

@ -309,10 +309,6 @@
<script setup lang="ts"> <script setup lang="ts">
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
defineOptions({ name: 'UpShelfStrategyAddForm' }) 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 RuleApi from '@/api/wms/rule' import * as RuleApi from '@/api/wms/rule'
import { isString } from '@/utils/is' import { isString } from '@/utils/is'

Loading…
Cancel
Save