|
|
@ -4,187 +4,172 @@ |
|
|
|
<div class="p-20px m--10px" style="max-height: 500px;overflow-y: auto;"> |
|
|
|
<el-form ref="formRef" :model="formData" :rules="rules" label-width="120px" label-position="left"> |
|
|
|
<!-- 规则 --> |
|
|
|
<div class="item"> |
|
|
|
<div class="title">规则</div> |
|
|
|
<el-row> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item label="代码" prop="code"> |
|
|
|
<el-input v-model="formData.code" placeholder="请输入代码" clearable /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item label="名称" prop="name"> |
|
|
|
<el-input v-model="formData.name" placeholder="请输入名称" clearable /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item label="描述" prop="describe"> |
|
|
|
<el-input v-model="formData.describe" placeholder="请输入描述" clearable /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="优先级" prop="priority"> |
|
|
|
<el-input-number v-model="formData.priority" :min="1" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="状态" prop="status"> |
|
|
|
<el-switch v-model="formData.status" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
</div> |
|
|
|
<div class="item"> |
|
|
|
<div class="title">规则</div> |
|
|
|
<el-row> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item label="代码" prop="strategyCode"> |
|
|
|
<el-input v-model="formData.strategyCode" placeholder="请输入代码" clearable disabled /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item label="名称" prop="name"> |
|
|
|
<el-input v-model="formData.name" placeholder="请输入名称" clearable /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item label="描述" prop="description"> |
|
|
|
<el-input v-model="formData.description" placeholder="请输入描述" clearable /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="优先级" prop="priority"> |
|
|
|
<el-input-number v-model="formData.priority" :min="1" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="状态" prop="status"> |
|
|
|
<el-switch v-model="formData.status" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
</div> |
|
|
|
|
|
|
|
<!-- 规则条件 --> |
|
|
|
|
|
|
|
<div class="item mt-20px"> |
|
|
|
|
|
|
|
<div class="title">规则条件</div> |
|
|
|
<!-- 选择供应商和客户 --> |
|
|
|
|
|
|
|
<el-row> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item label="" label-width="0" prop="supplier" class="err-240"> |
|
|
|
<el-select v-model="formData.type" placeholder="" style="width: 110px;margin-right: 10px;"> |
|
|
|
<el-option :label="item.label" :value="item.value" v-for="item in options.typeOptions" |
|
|
|
:key="item.value" /> |
|
|
|
<el-col :span="24" v-for="(item, index) in formData.condition" :key="index"> |
|
|
|
<!-- 选择供应商和客户 --> |
|
|
|
<el-form-item label="" label-width="0" class="err-240" v-if="index == 0"> |
|
|
|
<el-select v-model="item.ParamCode" placeholder="" style="width: 110px;margin-right: 10px;" |
|
|
|
@change="changeSupplierCustomer"> |
|
|
|
<el-option :label="cur.label" :value="cur.value" v-for="(cur, index) in options.typeOptions" |
|
|
|
:key="index" /> |
|
|
|
</el-select> |
|
|
|
<el-select v-model="formData.supplierTypeRange" placeholder="请选择范围" |
|
|
|
style="width: 110px;;margin-right: 10px;"> |
|
|
|
<el-option :label="item.label" :value="item.value" v-for="item in options.rangeOptions" |
|
|
|
:key="item.value" /> |
|
|
|
<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.rangeOptions1" |
|
|
|
:key="cur.value" /> |
|
|
|
</el-select> |
|
|
|
<el-select v-model="formData.supplier" placeholder="请选择供应商" style="flex: 1;" clearable> |
|
|
|
<el-option v-for="item in options.supplierList" :key="item.value" :label="item.label" |
|
|
|
:value="item.value" /> |
|
|
|
<el-select v-model="item.Value" :placeholder="`请选择${item.ParamCode == 'SupplierCode' ? '供应商' : '客户'}`" |
|
|
|
style="flex: 1;" clearable> |
|
|
|
<el-option v-for="cur in options.supplierList" :key="cur.id" :label="cur.name" :value="cur.id" /> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<!-- 选择物品类型 --> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item label="" label-width="0" prop="item" class="err-240"> |
|
|
|
<el-select v-model="formData.itemType" placeholder="" style="width: 110px;margin-right: 10px;"> |
|
|
|
<!-- 选择物品类型 --> |
|
|
|
<el-form-item label="" label-width="0" class="err-240" v-if="index == 1"> |
|
|
|
<el-select v-model="item.ParamCode" placeholder="" @change="changeItemsType" |
|
|
|
style="width: 110px;margin-right: 10px;"> |
|
|
|
<el-option :label="item.label" :value="item.value" v-for="item in options.itemTypeOptions" |
|
|
|
:key="item.value" /> |
|
|
|
</el-select> |
|
|
|
<el-select v-model="formData.itemTypeRange" placeholder="请选择范围" style="width: 110px;;margin-right: 10px;"> |
|
|
|
<el-option :label="item.label" :value="item.value" v-for="item in options.rangeOptions" |
|
|
|
:key="item.value" /> |
|
|
|
<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.rangeOptions1" |
|
|
|
:key="cur.value" /> |
|
|
|
</el-select> |
|
|
|
<el-select v-model="formData.item" placeholder="请选择物品" style="flex: 1;" clearable> |
|
|
|
<el-option v-for="item in options.itemList" :key="item.value" :label="item.label" :value="item.value" /> |
|
|
|
<el-select v-model="item.Value" placeholder="请选择物品类型" style="flex: 1;" clearable |
|
|
|
v-if="item.ParamCode == 'ItemType'"> |
|
|
|
<el-option v-for="cur in getStrDictOptions(DICT_TYPE.ITEM_TYPE)" :key="cur.value" :label="cur.label" |
|
|
|
:value="cur.value" /> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<!-- 选择重量体积还是面积 --> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item label="" label-width="0" prop="calculation" class="err-240"> |
|
|
|
<el-select v-model="formData.calculationType" placeholder="" style="width: 110px;margin-right: 10px;"> |
|
|
|
<el-option :label="item.label" :value="item.value" v-for="item in options.calculationTypeOptions" |
|
|
|
:key="item.value" /> |
|
|
|
<el-select v-model="item.Value" placeholder="请选择ABC类" style="flex: 1;" clearable |
|
|
|
v-else-if="item.ParamCode == 'AbcClass'"> |
|
|
|
<el-option v-for="cur in getStrDictOptions(DICT_TYPE.ABC_CLASS)" :key="cur.value" :label="cur.label" |
|
|
|
:value="cur.value" /> |
|
|
|
</el-select> |
|
|
|
<el-select v-model="formData.calculationTypeRange" placeholder="请选择范围" |
|
|
|
style="width: 110px;;margin-right: 10px;"> |
|
|
|
<el-option :label="item.label" :value="item.value" v-for="item in options.rangeOptions" |
|
|
|
:key="item.value" /> |
|
|
|
<el-input v-model="item.Value" placeholder="请输入物品分组" clearable style="flex: 1;" |
|
|
|
v-else-if="item.ParamCode == 'ItemGroup'" /> |
|
|
|
<el-input v-model="item.Value" placeholder="请输入项目" clearable style="flex: 1;" |
|
|
|
v-else-if="item.ParamCode == 'Project'" /> |
|
|
|
<el-input v-model="item.Value" placeholder="请输入物品" clearable style="flex: 1;" |
|
|
|
v-else-if="item.ParamCode == 'ItemCode'" /> |
|
|
|
</el-form-item> |
|
|
|
<!-- 选择重量体积还是面积 --> |
|
|
|
<el-form-item label="" label-width="0" class="err-240" v-if="index == 2"> |
|
|
|
<el-select v-model="item.ParamCode" placeholder="" @change="changeCalculation" |
|
|
|
style="width: 110px;margin-right: 10px;"> |
|
|
|
<el-option :label="cur.label" :value="cur.value" v-for="cur in options.calculationTypeOptions" |
|
|
|
:key="cur.value" /> |
|
|
|
</el-select> |
|
|
|
<el-select v-model="formData.calculation" placeholder="请选择物品" style="flex: 1;" clearable> |
|
|
|
<el-option v-for="item in options.calculationList" :key="item.value" :label="item.label" |
|
|
|
:value="item.value" /> |
|
|
|
<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.rangeOptions2" |
|
|
|
:key="cur.value" /> |
|
|
|
</el-select> |
|
|
|
<el-input v-model="item.Value" |
|
|
|
:placeholder="`请输入${item.ParamCode == 'Weight' ? '重量' : item.ParamCode == 'Area' ? '面积' : '体积'}`" |
|
|
|
clearable style="flex: 1;" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<!-- 库存状态 --> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item label="库存状态" prop="inventoryStatus" class="err-120"> |
|
|
|
<el-select v-model="formData.inventoryStatusRange" placeholder="请选择范围" |
|
|
|
style="width: 110px;;margin-right: 10px;"> |
|
|
|
<el-option :label="item.label" :value="item.value" v-for="item in options.rangeOptions" |
|
|
|
:key="item.value" /> |
|
|
|
<!-- 库存状态 --> |
|
|
|
<el-form-item label="库存状态" class="err-120" v-if="index == 3"> |
|
|
|
<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.rangeOptions1" |
|
|
|
:key="cur.value" /> |
|
|
|
</el-select> |
|
|
|
<el-select v-model="formData.inventoryStatus" placeholder="请选择库存状态" style="flex: 1;" clearable> |
|
|
|
<el-option v-for="item in options.inventoryStatusList" :key="item.value" :label="item.label" |
|
|
|
:value="item.value" /> |
|
|
|
<el-select v-model="item.Value" placeholder="请选择库存状态" style="flex: 1;" clearable> |
|
|
|
<el-option v-for="cur in getStrDictOptions(DICT_TYPE.INVENTORY_STATUS)" :key="cur.value" |
|
|
|
:label="cur.label" :value="cur.value" /> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<!-- 存储类型 --> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item label="存储状态" prop="storageType" class="err-120"> |
|
|
|
<el-select v-model="formData.storageTypeRange" placeholder="请选择范围" |
|
|
|
style="width: 110px;;margin-right: 10px;"> |
|
|
|
<el-option :label="item.label" :value="item.value" v-for="item in options.rangeOptions" |
|
|
|
:key="item.value" /> |
|
|
|
<!-- 存储类型 --> |
|
|
|
<el-form-item label="存储类型" class="err-120" v-if="index == 4"> |
|
|
|
<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.rangeOptions1" |
|
|
|
:key="cur.value" /> |
|
|
|
</el-select> |
|
|
|
<el-select v-model="formData.storageType" placeholder="请选择存储状态" style="flex: 1;" clearable> |
|
|
|
<el-option v-for="item in options.storageTypeList" :key="item.value" :label="item.label" |
|
|
|
:value="item.value" /> |
|
|
|
<el-select v-model="item.Value" placeholder="请选择存储类型" style="flex: 1;" clearable> |
|
|
|
<el-option v-for="cur in getStrDictOptions(DICT_TYPE.STORAGE_TYPE)" :key="cur.value" :label="cur.label" |
|
|
|
:value="cur.value" /> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<!-- 库存事务 --> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item label="库存事务" prop="inventoryAffair" class="err-120"> |
|
|
|
<el-select v-model="formData.inventoryAffairRange" placeholder="请选择范围" |
|
|
|
style="width: 110px;;margin-right: 10px;"> |
|
|
|
<el-option :label="item.label" :value="item.value" v-for="item in options.rangeOptions" |
|
|
|
:key="item.value" /> |
|
|
|
</el-select> |
|
|
|
<el-select v-model="formData.inventoryAffair" placeholder="请选择库存事务" style="flex: 1;" clearable> |
|
|
|
<el-option v-for="item in options.inventoryAffairList" :key="item.value" :label="item.label" |
|
|
|
:value="item.value" /> |
|
|
|
<!-- 库存事务 --> |
|
|
|
<el-form-item label="库存事务" class="err-120" v-if="index == 5"> |
|
|
|
<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.rangeOptions1" |
|
|
|
:key="cur.value" /> |
|
|
|
</el-select> |
|
|
|
<el-input v-model="item.Value" placeholder="请输入库存事务" clearable style="flex: 1;" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
</div> |
|
|
|
|
|
|
|
<!-- 规则配置 --> |
|
|
|
|
|
|
|
<div class="item mt-20px"> |
|
|
|
<div class="title">规则配置</div> |
|
|
|
<el-row> |
|
|
|
<!-- 仓库 库区 库位组 库位 --> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item label="" label-width="0" prop="warehouse" class="err-120"> |
|
|
|
<el-select v-model="formData.warehouseType" style="width: 110px;;margin-right: 10px;"> |
|
|
|
<el-option :label="item.label" :value="item.value" v-for="item in options.warehouseTypeOptions" |
|
|
|
:key="item.value" /> |
|
|
|
<el-col :span="24" v-for="(item, index) in formData.configuration" :key="index"> |
|
|
|
<el-form-item label="" label-width="0" prop="warehouse" class="err-120" v-if="index == 0"> |
|
|
|
<el-select v-model="item.ParamCode" placeholder="" style="width: 110px;margin-right: 10px;" |
|
|
|
@change="changeWarehouse"> |
|
|
|
<el-option :label="cur.label" :value="cur.value" v-for="(cur, index) in options.warehouseTypeOptions" |
|
|
|
:key="index" /> |
|
|
|
</el-select> |
|
|
|
<el-select v-model="formData.warehouse" placeholder="请选择库位" style="flex: 1;" clearable> |
|
|
|
<el-option v-for="item in options.warehouseTypeList" :key="item.value" :label="item.label" |
|
|
|
:value="item.value" /> |
|
|
|
<el-select v-model="item.Value" placeholder="请选择仓库" clearable style="flex: 1;"> |
|
|
|
<el-option v-for="cur in options.warehouseList" :key="cur.id" :label="cur.name" :value="cur.id" /> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<!-- 优先空位库 --> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item label="优先空位库" prop="firstWarehouse"> |
|
|
|
<el-switch v-model="formData.firstWarehouse" /> |
|
|
|
<!-- 优先空位库 --> |
|
|
|
<el-form-item label="优先空位库" v-else-if="index == 1"> |
|
|
|
<el-switch v-model="item.Value" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<!-- 优先非空位库 --> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item label="优先非空位库" prop="firstNoWarehouse"> |
|
|
|
<el-switch v-model="formData.firstNoWarehouse" /> |
|
|
|
<!-- 优先非空位库 --> |
|
|
|
<el-form-item label="优先非空位库" v-else-if="index == 2"> |
|
|
|
<el-switch v-model="item.Value" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<!-- 允许混物品 --> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item label="允许混合品" prop="allowMixedItems"> |
|
|
|
<el-switch v-model="formData.allowMixedItems" /> |
|
|
|
<!-- 可以混物品 --> |
|
|
|
<el-form-item label="可以混物品" v-else-if="index == 3"> |
|
|
|
<el-switch v-model="item.Value" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<!-- 允许混批次 --> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item label="允许混批次" prop="allowMixedBatch"> |
|
|
|
<el-switch v-model="formData.allowMixedBatch" /> |
|
|
|
<!-- 可以混批次 --> |
|
|
|
<el-form-item label="可以混批次" v-else-if="index == 4"> |
|
|
|
<el-switch v-model="item.Value" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<!-- 允许混状态 --> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item label="允许混状态" prop="allowMixedStatus"> |
|
|
|
<el-switch v-model="formData.allowMixedStatus" /> |
|
|
|
<!-- 可以混状态 --> |
|
|
|
<el-form-item label="可以混状态" v-else-if="index == 5"> |
|
|
|
<el-switch v-model="item.Value" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
@ -200,6 +185,15 @@ |
|
|
|
<script setup lang="ts"> |
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
|
defineOptions({ name: 'UpShelfStrategyAddForm' }) |
|
|
|
import { getSupplierList } from '@/api/wms/supplier' |
|
|
|
import { getCustomerList } from '@/api/wms/customer' |
|
|
|
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 { DICT_TYPE, getStrDictOptions } from '@/utils/dict' |
|
|
|
|
|
|
|
const { t } = useI18n() // 国际化 |
|
|
|
const message = useMessage() // 消息弹窗 |
|
|
@ -208,105 +202,201 @@ const dialogVisible = ref(false) // 弹窗的是否展示 |
|
|
|
const dialogTitle = ref('') // 弹窗的标题 |
|
|
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 |
|
|
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改 |
|
|
|
const formRef1 = ref() // 表单 Ref |
|
|
|
const formRef2 = ref() // 表单 Ref |
|
|
|
const formRef3 = ref() // 表单 Ref |
|
|
|
const formRef = ref() // 表单 Ref |
|
|
|
|
|
|
|
|
|
|
|
const formStrategyCode = ref('') |
|
|
|
// form表单数据 |
|
|
|
const formData = ref({ |
|
|
|
code: '',//代码 |
|
|
|
id: '', |
|
|
|
strategyCode: formStrategyCode.value,//策略代码id |
|
|
|
name: '',//名称 |
|
|
|
describe: '',//描述 |
|
|
|
description: '',//描述 |
|
|
|
priority: '',//优先级 |
|
|
|
status: false,//状态 |
|
|
|
// 供应商类型 |
|
|
|
type: 1,//供应商类型范围 |
|
|
|
supplierTypeRange: 1,//选择的供应商类型范围 |
|
|
|
supplier: '',//选择的供应商 |
|
|
|
|
|
|
|
// 物品类型 |
|
|
|
itemType: 1,//选择的物品类型 |
|
|
|
itemTypeRange: 1, //物品类型范围 |
|
|
|
item: '',//选择的物品 |
|
|
|
|
|
|
|
//重量体积面积 |
|
|
|
calculationType: 1,//默认选择重量 |
|
|
|
calculationTypeRange: 1, // 选择重量范围 |
|
|
|
calculation: '',//选择重量之后选择的内容 |
|
|
|
|
|
|
|
// 库存状态 |
|
|
|
inventoryStatusRange: 1, // 选择的库存状态范围 |
|
|
|
inventoryStatus: '',//选择的库存状态 |
|
|
|
|
|
|
|
// 存储状态 |
|
|
|
storageTypeRange: 1, // 选择的存储状态范围 |
|
|
|
storageType: '',//选择的存储状态 |
|
|
|
|
|
|
|
// 库存事务 |
|
|
|
inventoryAffairRange: 1, // 选择的库存事务范围 |
|
|
|
inventoryAffair: '',//选择的库存事务 |
|
|
|
|
|
|
|
// 仓库 库位 |
|
|
|
warehouseType: 1,//选择的是仓库/库区/库位组/库位类型 |
|
|
|
warehouse: '',//选择的仓库/库区/库位组/库位 |
|
|
|
status: true,//状态 |
|
|
|
//规则条件集合 |
|
|
|
condition: [ |
|
|
|
// 供应商 |
|
|
|
{ ParamCode: 'SupplierCode', Operator: "IN", Value: "" }, |
|
|
|
// 物品类型/物品分组/物品/abc类/项目/ |
|
|
|
{ ParamCode: 'ItemType', Operator: "IN", Value: "" }, |
|
|
|
// 重量/体积/面积 |
|
|
|
{ ParamCode: 'Weight', Operator: ">", Value: [] }, |
|
|
|
// 库存状态 |
|
|
|
{ ParamCode: 'InventoryStatus', Operator: "IN", Value: [] }, |
|
|
|
// 存储类型 |
|
|
|
{ ParamCode: 'StorageType', Operator: "IN", Value: [] }, |
|
|
|
// 库存事务 |
|
|
|
{ ParamCode: 'TransactionType', Operator: "IN", Value: [] } |
|
|
|
], |
|
|
|
configuration: [ |
|
|
|
// 仓库 |
|
|
|
{ ParamCode: 'WarehouseCode', Value: "" }, |
|
|
|
// 优先空库位 |
|
|
|
{ ParamCode: 'EmptyLocationFirst', Value: false }, |
|
|
|
// 优先非空库位 |
|
|
|
{ ParamCode: 'NotEmptyLocationFirst', Value: false }, |
|
|
|
// 可以混物品 |
|
|
|
{ ParamCode: 'EnableMixItem', Value: true }, |
|
|
|
// 可以混批次 |
|
|
|
{ ParamCode: 'EnableMixLot', Value: true }, |
|
|
|
// 可以混状态 |
|
|
|
{ ParamCode: 'EnableMixStatus', Value: true }, |
|
|
|
] |
|
|
|
|
|
|
|
firstWarehouse: false,//优先空库位 |
|
|
|
firstNoWarehouse: false,//优先非空库位 |
|
|
|
allowMixedItems: false,//允许混物品 |
|
|
|
allowMixedBatch: false,//允许混批次 |
|
|
|
allowMixedStatus: false,//允许混状态 |
|
|
|
}) |
|
|
|
// 验证规则 |
|
|
|
const rules = ref({ |
|
|
|
code: [{ required: true, message: '请输入代码', trigger: 'blur' }], |
|
|
|
strategyCode: [{ required: true, message: '请输入代码', trigger: 'blur' }], |
|
|
|
name: [{ required: true, message: '请输入名字', trigger: 'blur' }], |
|
|
|
describe: [{ required: true, message: '请输入描述', trigger: 'blur' }], |
|
|
|
description: [{ required: true, message: '请输入描述', trigger: 'blur' }], |
|
|
|
priority: [{ required: true, message: '请输入优先级', trigger: 'blur' }], |
|
|
|
supplier: [{ required: true, message: '请选择供应商', trigger: 'blur' }], |
|
|
|
item: [{ required: true, message: '请选择物品', trigger: 'blur' }], |
|
|
|
calculation: [{ required: true, message: '请选择', trigger: 'blur' }], |
|
|
|
inventoryStatus: [{ required: true, message: '请选择库存状态', trigger: 'blur' }], |
|
|
|
storageType: [{ required: true, message: '请选择存储类型', trigger: 'blur' }], |
|
|
|
inventoryAffair: [{ required: true, message: '请选择库存事务', trigger: 'blur' }], |
|
|
|
warehouse: [{ required: true, message: '请选择仓库', trigger: 'blur' }], |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
// 所有的范围类型 |
|
|
|
const rangeOptions = [ |
|
|
|
{ value: '==', label: '等于' }, |
|
|
|
{ value: '!=', label: '不等于' }, |
|
|
|
{ value: '>', label: '大于' }, |
|
|
|
{ value: '<', label: '小于' }, |
|
|
|
{ value: '>=', label: '大于等于' }, |
|
|
|
{ value: '<=', label: '小于等于' }, |
|
|
|
{ value: 'IN', label: '包含' }, |
|
|
|
{ value: 'NOT IN', label: '不包含' }, |
|
|
|
{ value: 'NULL', label: '为空' }, |
|
|
|
{ value: 'NOT NULL', label: '不为空' }, |
|
|
|
] |
|
|
|
const formatRangeOptions = (...rest) => { |
|
|
|
// 交集 |
|
|
|
let result = rangeOptions.filter(aItem => rest.some(bItem => aItem.value === bItem)); |
|
|
|
return result |
|
|
|
} |
|
|
|
|
|
|
|
// 下拉框列表集合 |
|
|
|
const options = reactive({ |
|
|
|
//范围下拉框列表 |
|
|
|
rangeOptions1: formatRangeOptions('IN', 'NOT IN'), |
|
|
|
rangeOptions2: formatRangeOptions('>', '<', '>=', '<='), |
|
|
|
// 供应商客户下拉框列表 |
|
|
|
typeOptions: [{ value: 1, label: '供应商' }, { value: 2, label: '客户' }], |
|
|
|
// 范围下拉框列表 |
|
|
|
rangeOptions: [{ value: 1, label: '包含' }, { value: 2, label: '大于', }], |
|
|
|
typeOptions: [{ value: 'SupplierCode', label: '供应商' }, { value: 'CustomerCode', label: '客户' }], |
|
|
|
//供应商列表 |
|
|
|
supplierList: [{ value: 1, label: '供应商1' }, { value: 2, label: '供应商2' }, { value: 3, label: '供应商3' }], |
|
|
|
|
|
|
|
supplierList: [], |
|
|
|
// 物品类型列表 |
|
|
|
itemTypeOptions: [{ value: 1, label: '物品分类' }, { value: 2, label: '物品分组' }, { value: 3, label: '物品' }, { value: 4, label: '项目' }, { value: 5, label: 'ABC类' }], |
|
|
|
// 物品列表 |
|
|
|
itemList: [{ value: 1, label: '物品1' }, { value: 2, label: '物品2' }, { value: 3, label: '物品3' }], |
|
|
|
itemTypeOptions: [{ value: 'ItemType', label: '物品类型' }, { value: 'ItemGroup', label: '物品分组' }, { value: 'ItemCode', label: '物品' }, { value: 'Project', label: '项目' }, { value: 'AbcClass', label: 'ABC类' }], |
|
|
|
|
|
|
|
// 重量体积面积类型列表 |
|
|
|
calculationTypeOptions: [{ value: 1, label: '重量' }, { value: 2, label: '体积' }, { value: 3, label: '面积' }], |
|
|
|
// 重量体积面积列表 |
|
|
|
calculationList: [{ value: 1, label: '重量1' }, { value: 2, label: '重量2' }, { value: 3, label: '重量3' }], |
|
|
|
// 库存状态列表 |
|
|
|
inventoryStatusList: [{ value: 1, label: '库存状态1' }, { value: 2, label: '库存状态2' }, { value: 3, label: '库存状态3' }], |
|
|
|
// 存储状态列表 |
|
|
|
storageTypeList: [{ value: 1, label: '存储状态1' }, { value: 2, label: '存储状态2' }, { value: 3, label: '存储状态3' }], |
|
|
|
// 库存事务列表 |
|
|
|
inventoryAffairList: [{ value: 1, label: '库存事务1' }, { value: 2, label: '库存事务2' }, { value: 3, label: '库存事务3' }], |
|
|
|
// 仓库类型 |
|
|
|
warehouseTypeOptions: [{ value: 1, label: '仓库' }, { value: 2, label: '库区' }, { value: 3, label: '库位组' }, { value: 4, label: '库位' }], |
|
|
|
// 仓库列表 |
|
|
|
warehouseTypeList: [{ value: 1, label: '仓库1' }, { value: 2, label: '仓库2' }, { value: 3, label: '仓库3' }], |
|
|
|
calculationTypeOptions: [{ value: 'Weight', label: '重量' }, { value: 'Volume', label: '体积' }, { value: 'Area', label: '面积' }], |
|
|
|
|
|
|
|
warehouseTypeOptions: [{ value: 'WarehouseCode', label: '仓库' }, { value: 'AreaCode', label: '库区' }, { value: 'LocationGroupCode', label: '库位组' }, { value: 'LocationCode', label: '库位' }], |
|
|
|
//仓库列表 |
|
|
|
warehouseList: [], |
|
|
|
}) |
|
|
|
|
|
|
|
// 获取供应商列表 |
|
|
|
const getFormSupplierList = async () => { |
|
|
|
options.supplierList = await getSupplierList(); |
|
|
|
} |
|
|
|
// 获取客户列表 |
|
|
|
const getFormCustomerList = async () => { |
|
|
|
options.supplierList = await getCustomerList(); |
|
|
|
} |
|
|
|
// 选择客户还是承运商 |
|
|
|
const changeSupplierCustomer = (e) => { |
|
|
|
formData.value.condition[0].Value = '' |
|
|
|
if (e == 'CustomerCode') { |
|
|
|
getFormCustomerList() |
|
|
|
} else if (e == 'SupplierCode') { |
|
|
|
getFormSupplierList() |
|
|
|
} |
|
|
|
} |
|
|
|
getFormSupplierList() |
|
|
|
// 选择物品类型/物品分组/abc类/物品/项目 |
|
|
|
const changeItemsType = () => { |
|
|
|
formData.value.condition[1].Value = '' |
|
|
|
} |
|
|
|
// 选择重量/体积/面积 |
|
|
|
const changeCalculation = () => { |
|
|
|
formData.value.condition[2].Value = '' |
|
|
|
} |
|
|
|
// 获取仓库列表 |
|
|
|
const getFormWarehouseList = async () => { |
|
|
|
options.warehouseList = await getWarehouseList(); |
|
|
|
} |
|
|
|
getFormWarehouseList() |
|
|
|
// 获取库区列表 |
|
|
|
const getFormAreaList = async () => { |
|
|
|
options.warehouseList = await getAreaList(); |
|
|
|
} |
|
|
|
getFormWarehouseList() |
|
|
|
// 获取库位组列表 |
|
|
|
const getFormLocationgrouList = async () => { |
|
|
|
options.warehouseList = await getLocationgroupList(); |
|
|
|
} |
|
|
|
getFormWarehouseList() |
|
|
|
// 获取库位列表 |
|
|
|
const getFormLocationList = async () => { |
|
|
|
options.warehouseList = await getLocationList(); |
|
|
|
} |
|
|
|
getFormWarehouseList() |
|
|
|
// 选择仓库/库位/库位组/库区 |
|
|
|
const changeWarehouse = (e) => { |
|
|
|
formData.value.configuration[0].Value = '' |
|
|
|
if (e == 'WarehouseCode') { |
|
|
|
getFormWarehouseList() |
|
|
|
} else if (e == 'AreaCode') { |
|
|
|
getFormAreaList() |
|
|
|
} else if (e == 'LocationGroupCode') { |
|
|
|
getFormLocationgrouList() |
|
|
|
} else if (e == 'LocationCode') { |
|
|
|
getFormLocationList() |
|
|
|
} |
|
|
|
} |
|
|
|
/** 打开弹窗 */ |
|
|
|
const open = async (type: string, id?: number) => { |
|
|
|
const open = async (type: string, strategyCode: string, id?: number) => { |
|
|
|
formStrategyCode.value = strategyCode |
|
|
|
dialogVisible.value = true |
|
|
|
dialogTitle.value = t('action.' + type) |
|
|
|
formType.value = type |
|
|
|
resetForm() |
|
|
|
// 修改时,设置数据 |
|
|
|
|
|
|
|
if (id) { |
|
|
|
formLoading.value = true |
|
|
|
try { |
|
|
|
let data = await RuleApi.getRule(id) |
|
|
|
formData.value.id = data.id |
|
|
|
formData.value.strategyCode = data.strategyCode |
|
|
|
formData.value.name = data.name |
|
|
|
formData.value.description = data.description |
|
|
|
formData.value.priority = data.priority |
|
|
|
formData.value.status = data.status == 1 ? true : false |
|
|
|
if (data.condition) { |
|
|
|
formData.value.condition = JSON.parse(data.condition) |
|
|
|
} |
|
|
|
if (data.configuration) { |
|
|
|
formData.value.configuration = JSON.parse(data.configuration) |
|
|
|
} |
|
|
|
// 判断是获取客户列表还是供应上列表 |
|
|
|
if(formData.value.condition[0].ParamCode == 'SupplierCode'){ |
|
|
|
getFormSupplierList() |
|
|
|
}else{ |
|
|
|
getFormCustomerList() |
|
|
|
} |
|
|
|
// 判断是获取仓库/库位/库位组/库区列表 |
|
|
|
if (formData.value.configuration[0].ParamCode == 'WarehouseCode') { |
|
|
|
getFormWarehouseList() |
|
|
|
} else if (formData.value.configuration[0].ParamCode == 'AreaCode') { |
|
|
|
getFormAreaList() |
|
|
|
} else if (formData.value.configuration[0].ParamCode == 'LocationGroupCode') { |
|
|
|
getFormLocationgrouList() |
|
|
|
} else if (formData.value.configuration[0].ParamCode == 'LocationCode') { |
|
|
|
getFormLocationList() |
|
|
|
} |
|
|
|
|
|
|
|
} finally { |
|
|
|
formLoading.value = false |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
|
|
|
|
|
|
@ -314,58 +404,77 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
|
|
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 |
|
|
|
const submitForm = async () => { |
|
|
|
// 校验表单 |
|
|
|
if (!formRef1 || !formRef2 || !formRef3) return |
|
|
|
const valid2 = formRef2.value.validate() |
|
|
|
const valid1 = formRef1.value.validate() |
|
|
|
const valid3 = await formRef3.value.validate() |
|
|
|
if (!valid1 || !valid2 || !valid3) return |
|
|
|
if (!formRef) return |
|
|
|
const valid = await formRef.value.validate() |
|
|
|
if (!valid) return |
|
|
|
// 提交请求 |
|
|
|
formLoading.value = true |
|
|
|
|
|
|
|
try { |
|
|
|
let data = { |
|
|
|
id: formData.value.id, |
|
|
|
strategyCode: formData.value.strategyCode,//策略代码 |
|
|
|
name: formData.value.name,//名称 |
|
|
|
description: formData.value.description,//描述 |
|
|
|
priority: formData.value.priority,//优先级 |
|
|
|
status: formData.value.status ? 1 : 0,//状态 |
|
|
|
//规则条件集合 |
|
|
|
condition: JSON.stringify(formData.value.condition), |
|
|
|
configuration: JSON.stringify(formData.value.configuration) |
|
|
|
} |
|
|
|
if (formType.value === 'create') { |
|
|
|
await RuleApi.createRule(data) |
|
|
|
message.success(t('common.createSuccess')) |
|
|
|
} else { |
|
|
|
await RuleApi.updateRule(data) |
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
} |
|
|
|
dialogVisible.value = false |
|
|
|
// 发送操作成功的事件 |
|
|
|
emit('success') |
|
|
|
} finally { |
|
|
|
formLoading.value = false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** 重置表单 */ |
|
|
|
const resetForm = () => { |
|
|
|
formData.value = { |
|
|
|
code: '', |
|
|
|
name: '', |
|
|
|
describe: '', |
|
|
|
priority: '', |
|
|
|
status: false, |
|
|
|
// 供应商类型 |
|
|
|
type: 1,//供应商类型范围 |
|
|
|
supplierTypeRange: 1,//选择的供应商类型范围 |
|
|
|
supplier: '',//选择的供应商 |
|
|
|
// 物品类型 |
|
|
|
itemType: 1,//选择的物品类型 |
|
|
|
itemTypeRange: 1, //物品类型范围 |
|
|
|
item: '',//选择的物品 |
|
|
|
//重量体积面积 |
|
|
|
calculationType: 1,//默认选择重量 |
|
|
|
calculationTypeRange: 1, // 选择重量范围 |
|
|
|
calculation: '',//选择重量之后选择的内容 |
|
|
|
|
|
|
|
// 库存状态 |
|
|
|
inventoryStatusRange: 1, // 选择的库存状态范围 |
|
|
|
inventoryStatus: '',//选择的库存状态 |
|
|
|
|
|
|
|
// 存储状态 |
|
|
|
storageTypeRange: 1, // 选择的存储状态范围 |
|
|
|
storageType: '',//选择的存储状态 |
|
|
|
|
|
|
|
// 库存事务 |
|
|
|
inventoryAffairRange: 1, // 选择的库存事务范围 |
|
|
|
inventoryAffair: '',//选择的库存事务 |
|
|
|
|
|
|
|
// 仓库 库位 |
|
|
|
warehouseType: 1,//选择的是仓库/库区/库位组/库位类型 |
|
|
|
warehouse: '',//选择的仓库/库区/库位组/库位 |
|
|
|
|
|
|
|
firstWarehouse: false,//优先空库位 |
|
|
|
firstNoWarehouse: false,//优先非空库位 |
|
|
|
allowMixedItems: false,//允许混物品 |
|
|
|
allowMixedBatch: false,//允许混批次 |
|
|
|
allowMixedStatus: false,//允许混状态 |
|
|
|
id: '', |
|
|
|
strategyCode: formStrategyCode.value,//策略代码id |
|
|
|
name: '',//名称 |
|
|
|
description: '',//描述 |
|
|
|
priority: '',//优先级 |
|
|
|
status: true,//状态 |
|
|
|
//规则条件集合 |
|
|
|
condition: [ |
|
|
|
// 供应商 |
|
|
|
{ ParamCode: 'SupplierCode', Operator: "IN", Value: "" }, |
|
|
|
// 物品类型/物品分组/物品/abc类/项目/ |
|
|
|
{ ParamCode: 'ItemType', Operator: "IN", Value: "" }, |
|
|
|
// /重量/体积/面积 |
|
|
|
{ ParamCode: 'Weight', Operator: ">", Value: [] }, |
|
|
|
// 库存状态 |
|
|
|
{ ParamCode: 'InventoryStatus', Operator: "IN", Value: [] }, |
|
|
|
// 存储类型 |
|
|
|
{ ParamCode: 'StorageType', Operator: "IN", Value: [] }, |
|
|
|
// 库存事务 |
|
|
|
{ ParamCode: 'TransactionType', Operator: "IN", Value: [] } |
|
|
|
], |
|
|
|
|
|
|
|
configuration: [ |
|
|
|
// 仓库 |
|
|
|
{ ParamCode: 'WarehouseCode', Value: "" }, |
|
|
|
// 优先空库位 |
|
|
|
{ ParamCode: 'EmptyLocationFirst', Value: false }, |
|
|
|
// 优先非空库位 |
|
|
|
{ ParamCode: 'NotEmptyLocationFirst', Value: false }, |
|
|
|
// 可以混物品 |
|
|
|
{ ParamCode: 'EnableMixItem', Value: true }, |
|
|
|
// 可以混批次 |
|
|
|
{ ParamCode: 'EnableMixLot', Value: true }, |
|
|
|
// 可以混状态 |
|
|
|
{ ParamCode: 'EnableMixStatus', Value: true }, |
|
|
|
] |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|