Browse Source

策略改成搜索弹框

intex
zhang_li 6 days ago
parent
commit
d00bb650e9
  1. 120
      src/views/wms/basicDataManage/strategySetting/strategy/arrivalInspectionStrategy/AddForm.vue
  2. 2
      src/views/wms/basicDataManage/strategySetting/strategy/inspectStrategy/AddForm.vue
  3. 290
      src/views/wms/basicDataManage/strategySetting/strategy/storageCapacityStrategy/AddForm.vue

120
src/views/wms/basicDataManage/strategySetting/strategy/arrivalInspectionStrategy/AddForm.vue

@ -104,7 +104,7 @@
:key="'供应商OperatorOption'+cur.value" :key="'供应商OperatorOption'+cur.value"
/> />
</el-select> </el-select>
<el-select key="供应商Value" <!-- <el-select key="供应商Value"
v-model="item.Value" v-model="item.Value"
placeholder="请选择供应商" placeholder="请选择供应商"
style="flex: 1" style="flex: 1"
@ -119,7 +119,14 @@
:label="cur.name" :label="cur.name"
:value="cur.code" :value="cur.code"
/> />
</el-select> </el-select> -->
<el-input key="供应商Value" style="flex:1" placeholder="请选择供应商" v-model="item.Value" @blur="blurWarehouse({module:'condition',type:'SupplierCode'})">
<template #suffix>
<el-button :disabled="formData.priority==0&&formType=='update'" type="text" plain style="color:var(--el-button-text-color)" @click.stop="searchList('SupplierCode')">
<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>
@ -149,6 +156,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'
@ -158,6 +169,9 @@ import { getSupplierList } from '@/api/wms/supplier'
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 SupplierApi from '@/api/wms/supplier'
import { Supplier } from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
@ -414,8 +428,110 @@ const resetForm = () => {
} }
} }
} }
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']
}
}
if(!warehouseValue){
return
}
let verifyRes = []
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 searchTableRef = ref()
const searchList = (type) => {
if (type == 'SupplierCode') {
searchTableRef.value.open(
'请选择供应商',
Supplier.allSchemas,
SupplierApi.getSupplierPage,
'SupplierCode',
'code',
true,
undefined,
undefined,
undefined
)
}
}
const searchTableSuccess = (formField, searchField, val, type, row) => {
if(formField=='SupplierCode'){
let transactionType = formData.value.condition.find(item=>item['ParamCode']== formField)
if(transactionType){
transactionType.Value = val.map(item=>(item['code'])).join(',')
}
return
}
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 {

2
src/views/wms/basicDataManage/strategySetting/strategy/inspectStrategy/AddForm.vue

@ -121,7 +121,7 @@
:value="cur.code" :value="cur.code"
/> />
</el-select> --> </el-select> -->
<el-input key="供应商和客户Value" style="flex:1" placeholder="请选择客户" v-model="item.Value" @blur="blurWarehouse({module:'condition',type:'SupplierCode'})"> <el-input key="供应商Value" style="flex:1" placeholder="请选择供应商" v-model="item.Value" @blur="blurWarehouse({module:'condition',type:'SupplierCode'})">
<template #suffix> <template #suffix>
<el-button :disabled="formData.priority==0&&formType=='update'" type="text" plain style="color:var(--el-button-text-color)" @click.stop="searchList('SupplierCode')"> <el-button :disabled="formData.priority==0&&formType=='update'" type="text" plain style="color:var(--el-button-text-color)" @click.stop="searchList('SupplierCode')">
<Icon icon="ep:search" class="mr-5px" /> <Icon icon="ep:search" class="mr-5px" />

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

@ -130,32 +130,40 @@
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'+index"
v-model="item.Value" v-model="item.Value"
placeholder="请输入物料,多个物料以逗号分隔" placeholder="请输入物料,多个物料以逗号分隔"
clearable clearable
style="flex: 1" style="flex: 1"
v-else-if="item.ParamCode == 'ItemCode'" v-else-if="item.ParamCode == 'ItemCode'"
:disabled="formData.priority==0&&formType=='update'" :disabled="formData.priority==0&&formType=='update'"
/> /> -->
<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 :key="'仓库'+index" label="" label-width="0" class="err-240" v-if="index == 1"> <el-form-item :key="'仓库'+index" label="" label-width="0" class="err-240" v-if="index == 1">
<el-select :key="'仓库title'+index" <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="'仓库titleOption'+index+cur.value" :key="'仓库'+cur.value"
/> />
</el-select> </el-select>
<el-select :key="'仓库Operator'+index" <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"
@ -165,35 +173,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="'仓库Operator'+index+cur.value" :key="'供应商和客户Operator'+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
multiple
collapse-tags
style="flex: 1"
:disabled="formData.priority==0&&formType=='update'"
>
<el-option
v-for="cur in options.warehouseList"
:key="'仓库Value'+index+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>
@ -284,6 +301,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'
@ -295,6 +316,19 @@ 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 { DICT_TYPE, getStrDictOptions } from '@/utils/dict' import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
const { t } = useI18n() // const { t } = useI18n() //
@ -506,6 +540,7 @@ const open = async (type: string, strategyCode: string, id?: number) => {
defaultButtons.formSaveBtn(null), // defaultButtons.formSaveBtn(null), //
defaultButtons.formCloseBtn(null) // defaultButtons.formCloseBtn(null) //
] ]
resetForm()
} }
} }
defineExpose({ open }) // open defineExpose({ open }) // open
@ -599,7 +634,194 @@ const resetForm = () => {
} }
} }
} }
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 {

Loading…
Cancel
Save