Browse Source

策略

master
zhangli 1 year ago
parent
commit
29a17c546a
  1. 338
      src/views/wms/strategy/purchaseReceiptStrategy/AddForm.vue
  2. 2
      src/views/wms/strategy/purchaseReceiptStrategy/index.vue
  3. 314
      src/views/wms/strategy/supplieDeliveryStrategy/AddForm.vue

338
src/views/wms/strategy/purchaseReceiptStrategy/AddForm.vue

@ -4,147 +4,116 @@
<Dialog :title="dialogTitle" v-model="dialogVisible"> <Dialog :title="dialogTitle" v-model="dialogVisible">
<div class="p-20px m--10px" style="max-height: 500px;overflow-y: auto;"> <div class="p-20px m--10px" style="max-height: 500px;overflow-y: auto;">
<!-- 规则 --> <!-- 规则 -->
<div class="item"> <el-form ref="formRef" :model="formData" :rules="rules" label-width="140px" label-position="left">
<div class="title">规则</div> <el-row>
<el-form ref="formRef1" :model="formData" :rules="rules" label-width="120px" label-position="left"> <el-col :span="24">
<el-row> <div class="item">
<el-col :span="24"> <div class="title">规则</div>
<el-form-item label="代码" prop="code"> <el-col :span="24">
<el-input v-model="formData.code" placeholder="请输入代码" clearable disabled /> <el-form-item label="代码" prop="code">
</el-form-item> <el-input v-model="formData.code" placeholder="请输入代码" clearable disabled />
</el-col> </el-form-item>
<el-col :span="24"> </el-col>
<el-form-item label="名称" prop="name"> <el-col :span="24">
<el-input v-model="formData.name" placeholder="请输入名称" clearable /> <el-form-item label="名称" prop="name">
</el-form-item> <el-input v-model="formData.name" placeholder="请输入名称" clearable />
</el-col> </el-form-item>
<el-col :span="24"> </el-col>
<el-form-item label="描述" prop="description"> <el-col :span="24">
<el-input v-model="formData.description" placeholder="请输入描述" clearable /> <el-form-item label="描述" prop="description">
</el-form-item> <el-input v-model="formData.description" placeholder="请输入描述" clearable />
</el-col> </el-form-item>
<el-col :span="12"> </el-col>
<el-form-item label="优先级" prop="priority"> <el-col :span="12">
<el-input-number v-model="formData.priority" :min="1" /> <el-form-item label="优先级" prop="priority">
</el-form-item> <el-input-number v-model="formData.priority" :min="1" />
</el-col> </el-form-item>
<el-col :span="12"> </el-col>
<el-form-item label="状态" prop="status"> <el-col :span="12">
<el-switch v-model="formData.status" /> <el-form-item label="状态" prop="status">
</el-form-item> <el-switch v-model="formData.status" />
</el-col> </el-form-item>
</el-row> </el-col>
</el-form> </div>
</div> </el-col>
<!-- 规则条件 --> <!-- 规则条件 -->
<div class="item mt-20px"> <el-col :span="24">
<div class="title">规则条件</div> <div class="item mt-20px">
<el-form ref="formRef2" :model="formData" :rules="rules" label-width="120px" label-position="left"> <div class="title">规则条件</div>
<el-row> <el-col :span="24" v-for="(item, index) in formData.condition" :key="index">
<el-col :span="24" v-for="(item, index) in formData.condition" :key="index"> <!-- 供应商类型 -->
<!-- 供应商类型 --> <el-form-item v-if="item.ParamCode == 'SupplierType'" label="供应商类型" class="flex-top err-120">
<el-form-item v-if="item.ParamCode == 'SupplierType'" label="供应商类型" class="flex-top err-120"> <el-select v-model="item.Operator" placeholder="请选择范围" style="width: 110px;;margin-right: 10px;">
<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.supplierTypeRangeOptions"
<el-option :label="cur.label" :value="cur.value" v-for="cur in options.supplierTypeRangeOptions" :key="cur.value" />
:key="cur.value" /> </el-select>
</el-select> <el-select v-model="item.Value" placeholder="请选择供应商类型" style="flex: 1;" clearable
<el-select v-model="item.Value" placeholder="请选择供应商类型" style="flex: 1;" clearable @change="changeSupplierType">
@change="changeSupplierType"> <el-option v-for="dict in getStrDictOptions(DICT_TYPE.SUPPLIER_TYPE)" :key="dict.value"
<el-option v-for="dict in getStrDictOptions(DICT_TYPE.SUPPLIER_TYPE)" :key="dict.value" :label="dict.label" :value="dict.value" />
:label="dict.label" :value="dict.value" /> </el-select>
</el-select> <!-- </div> -->
<!-- </div> --> </el-form-item>
</el-form-item> <!-- 供应商 -->
<!-- 供应商 --> <el-form-item v-else-if="item.ParamCode == 'SupplierCode'" label="供应商" class="err-120">
<el-form-item v-else-if="item.ParamCode == 'SupplierCode'" label="供应商" class="err-120"> <el-select v-model="item.Operator" placeholder="请选择范围" style="width: 110px;margin-right: 10px;">
<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.supplierRangeOptions"
<el-option :label="cur.label" :value="cur.value" v-for="cur in options.supplierRangeOptions" :key="cur.value" />
:key="cur.value" /> </el-select>
</el-select> <el-select v-model="item.Value" placeholder="请选择供应商" style="flex: 1;" clearable>
<el-select v-model="item.Value" placeholder="请选择供应商" style="flex: 1;" clearable> <el-option v-for="cur in options.supplierList" :key="cur.id" :label="cur.name" :value="cur.id" />
<el-option v-for="cur in options.supplierList" :key="cur.id" :label="cur.name" :value="cur.id" /> </el-select>
</el-select> </el-form-item>
</el-form-item> </el-col>
<!-- 星期几 --> </div>
<el-form-item v-else-if="item.ParamCode == 'Weekday'" label="星期几" class="flex-top err-120"> </el-col>
<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.weekRangeOptions" <el-col :span="24">
:key="cur.value" /> <div class="item mt-20px">
</el-select> <div class="title">规则配置</div>
<div class="checkbox"> <el-col :span="24" v-for="(item, index) in formData.configuration" :key="index">
<el-checkbox-group v-model="item.Value" @change="change"> <!-- 按零件拆分 -->
<el-checkbox :label="cur.label" v-for="cur in options.weekOptions" :key="cur.value" /> <el-form-item v-if="item.ParamCode == 'ByItem'" label="按零件拆分" :prop="'configuration.' + index + '.Value'"
</el-checkbox-group> :rules="{
</div> required: true,
</el-form-item> message: '请选择开始时间',
</el-col> trigger: 'change',
</el-row> }">
</el-form> <el-switch v-model="item.Value" />
</div> </el-form-item>
<!-- 规则配置 --> <!-- 按库位拆分 -->
<div class="item mt-20px"> <el-form-item v-else-if="item.ParamCode == 'ByLocation'" label="按库位拆分"
<div class="title">规则配置</div> :prop="'configuration.' + index + '.Value'" :rules="{
<el-form ref="formRef3" :model="formData" label-width="120px" label-position="left"> required: true,
<el-row> message: '请选择按库位拆分',
<!-- 开始时间 --> trigger: 'change',
<el-col :span="24" v-for="(item, index) in formData.configuration" :key="index"> }">
<!-- 开始时间 --> <el-switch v-model="item.Value" />
<el-form-item v-if="item.ParamCode == 'BeginTime'" label="开始时间" :prop="'configuration.' + index + '.Value'" </el-form-item>
:rules="{ <!--按器具拆分-->
required: true, <el-form-item v-else-if="item.ParamCode == 'ByContainer'" label="按器具拆分"
message: '请选择开始时间', :prop="'configuration.' + index + '.Value'" :rules="{
trigger: 'change', required: true,
}"> message: '请选择按器具拆分',
<el-time-select v-model="item.Value" start="00:00" end="23:59" step="00:15" placeholder="请选择开始时间" trigger: 'change',
style="width: 100%;" /> }">
</el-form-item> <el-switch v-model="item.Value" />
<!-- 结束时间 --> </el-form-item>
<el-form-item v-else-if="item.ParamCode == 'EndTime'" label="结束时间" <!-- 每个任务明细数量 -->
:prop="'configuration.' + index + '.Value'" :rules="{ <el-form-item v-else-if="item.ParamCode == 'JobDetailCount'" label="每个任务明细数量"
required: true, :prop="'configuration.' + index + '.Value'" :rules="{
message: '请选择结束时间', required: true,
trigger: 'change', message: '请选择每个任务明细数量',
}"> trigger: 'change',
<el-time-select v-model="item.Value" start="00:00" end="23:59" step="00:15" placeholder="请选择结束时间" }">
style="width: 100%;" /> <!-- <el-input v-model="item.Value" placeholder="请输入每个任务明细数量" clearable /> -->
</el-form-item> <el-input-number v-model="item.Value" :min="0" />
<!-- 仓库 --> </el-form-item>
<el-form-item v-else-if="item.ParamCode == 'WarehouseCode'" label="仓库" </el-col>
:prop="'configuration.' + index + '.Value'" :rules="{ </div>
required: true, </el-col>
message: '请选择仓库', </el-row>
trigger: 'change', </el-form>
}">
<el-select v-model="item.Value" placeholder="请选择仓库" clearable>
<el-option v-for="cur in options.warehouseList" :key="cur.id" :label="cur.name" :value="cur.id" />
</el-select>
</el-form-item>
<!-- 月台 -->
<el-form-item v-else-if="item.ParamCode == 'DockCode'" label="月台"
:prop="'configuration.' + index + '.Value'" :rules="{
required: true,
message: '请选择月台',
trigger: 'change',
}">
<el-select v-model="item.Value" placeholder="请选择月台" clearable>
<el-option v-for="cur in options.dockList" :key="cur.id" :label="cur.name" :value="cur.id" />
</el-select>
</el-form-item>
<!-- 在途库位 -->
<el-form-item v-else-if="item.ParamCode == 'OnTheWayLocationCode'" label="在途库位"
:prop="'configuration.' + index + '.Value'" :rules="{
required: true,
message: '请选择在途库位',
trigger: 'change',
}">
<el-select v-model="item.Value" placeholder="请选择在途库位" clearable>
<el-option v-for="cur in options.locationList" :key="cur.id" :label="cur.name" :value="cur.id" />
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</div> </div>
<template #footer> <template #footer>
<!-- 按钮--> <!-- 按钮-->
@ -171,9 +140,7 @@ const dialogVisible = ref(false) // 弹窗的是否展示
const dialogTitle = ref('') // const dialogTitle = ref('') //
const formLoading = ref(false) // 12 const formLoading = ref(false) // 12
const formType = ref('') // create - update - const formType = ref('') // create - update -
const formRef1 = ref() // Ref const formRef = ref() // Ref
const formRef2 = ref() // Ref
const formRef3 = ref() // Ref
const change = (e) => { const change = (e) => {
console.log(e); console.log(e);
@ -181,7 +148,8 @@ const change = (e) => {
const formStrategyCode = ref('') const formStrategyCode = ref('')
// form // form
const formData = ref({ const formData = ref({
strategyCode: formStrategyCode.value,// id: '',
strategyCode: formStrategyCode.value,//id
code: formStrategyCode.value,// code: formStrategyCode.value,//
name: '',// name: '',//
description: '',// description: '',//
@ -192,21 +160,17 @@ const formData = ref({
// //
{ ParamCode: 'SupplierType', Operator: "==", Value: "" }, { ParamCode: 'SupplierType', Operator: "==", Value: "" },
// //
{ ParamCode: 'SupplierCode', Operator: "IN", Value: "" }, { ParamCode: 'SupplierCode', Operator: "IN", Value: "" }
//
{ ParamCode: 'Weekday', Operator: "IN", Value: [] }
], ],
configuration: [ configuration: [
// //
{ ParamCode: 'BeginTime', Value: "" }, { ParamCode: 'ByItem', Value: false },
// //
{ ParamCode: 'EndTime', Value: "" }, { ParamCode: 'ByLocation', Value: true },
// //
{ ParamCode: 'WarehouseCode', Value: '' }, { ParamCode: 'ByContainer', Value: 'false' },
// //
{ ParamCode: 'DockCode', Value: '' }, { ParamCode: 'JobDetailCount', Value: 0 },
//
{ ParamCode: 'OnTheWayLocationCode', Value: '' },
] ]
}) })
@ -215,12 +179,7 @@ const rules = ref({
code: [{ required: true, message: '请输入代码', trigger: 'blur' }], code: [{ required: true, message: '请输入代码', trigger: 'blur' }],
name: [{ required: true, message: '请输入名字', trigger: 'blur' }], name: [{ required: true, message: '请输入名字', trigger: 'blur' }],
description: [{ required: true, message: '请输入描述', trigger: 'blur' }], description: [{ required: true, message: '请输入描述', trigger: 'blur' }],
priority: [{ required: true, message: '请输入优先级', trigger: 'blur' }], priority: [{ required: true, message: '请输入优先级', trigger: 'blur' }]
BeginTime: [{ required: true, message: '请选择开始时间', trigger: 'change' }],
EndTime: [{ required: true, message: '请选择结束时间', trigger: 'change' }],
WarehouseCode: [{ required: true, message: '请选择仓库', trigger: 'change' }],
DockCode: [{ required: true, message: '请选择月台', trigger: 'change' }],
OnTheWayLocationCode: [{ required: true, message: '请选择在途库位', trigger: 'change' }],
}) })
// //
@ -252,10 +211,6 @@ const options = reactive({
supplierRangeOptions: formatRangeOptions('IN', 'NOT IN'), supplierRangeOptions: formatRangeOptions('IN', 'NOT IN'),
// //
supplierList: [{ value: 1, label: '供应商1' }, { value: 2, label: '供应商2' }, { value: 3, label: '供应商3' }], supplierList: [{ value: 1, label: '供应商1' }, { value: 2, label: '供应商2' }, { value: 3, label: '供应商3' }],
//
weekRangeOptions: formatRangeOptions('IN', 'NOT IN'),
//
weekOptions: [{ value: 1, label: '星期一' }, { value: 2, label: '星期二' }, { value: 3, label: '星期三' }, { value: 4, label: '星期四' }, { value: 5, label: '星期五' }, { value: 6, label: '星期六' }, { value: 7, label: '星期日' }],
// //
warehouseList: [], warehouseList: [],
// //
@ -275,6 +230,7 @@ const getFormSupplierList = async () => {
// //
const changeSupplierType = (e) => { const changeSupplierType = (e) => {
querySupplierParams.value.type = e querySupplierParams.value.type = e
formData.value.condition[1].Value = []
getFormSupplierList() getFormSupplierList()
} }
@ -309,19 +265,23 @@ const open = async (type: string, strategyCode: string, id?: number) => {
formLoading.value = true formLoading.value = true
try { try {
let data = await RuleApi.getRule(id) let data = await RuleApi.getRule(id)
formData.value.id = data.id
formData.value.strategyCode = data.strategyCode formData.value.strategyCode = data.strategyCode
formData.value.code = data.code formData.value.code = data.code
formData.value.name = data.name formData.value.name = data.name
formData.value.description = data.description formData.value.description = data.description
formData.value.priority = data.priority formData.value.priority = data.priority
formData.value.status = data.status==1?true:false formData.value.status = data.status == 1 ? true : false
if(data.condition){ if (data.condition) {
formData.value.condition = JSON.parse(data.condition) formData.value.condition = JSON.parse(data.condition)
} }
if(data.configuration){ if (data.configuration) {
formData.value.configuration = JSON.parse(data.configuration) formData.value.configuration = JSON.parse(data.configuration)
} }
querySupplierParams.value.type = formData.value?.condition[0]?.Value || ''
getFormSupplierList()
} finally { } finally {
formLoading.value = false formLoading.value = false
} }
@ -333,21 +293,20 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗
const emit = defineEmits(['success']) // success const emit = defineEmits(['success']) // success
const submitForm = async () => { const submitForm = async () => {
// //
if (!formRef1 || !formRef2 || !formRef3) return if (!formRef) return
const valid2 = formRef2.value.validate() const valid = await formRef.value.validate()
const valid1 = formRef1.value.validate() if (!valid) return;
const valid3 = await formRef3.value.validate()
if (!valid1 || !valid2 || !valid3) return
// //
formLoading.value = true formLoading.value = true
try { try {
let data = { let data = {
id: formData.value.id,
strategyCode: formData.value.strategyCode,// strategyCode: formData.value.strategyCode,//
code: formData.value.code,// code: formData.value.code,//
name: formData.value.name,// name: formData.value.name,//
description: formData.value.description,// description: formData.value.description,//
priority: formData.value.priority,// priority: formData.value.priority,//
status: formData.value.status?1:0,// status: formData.value.status ? 1 : 0,//
// //
condition: JSON.stringify(formData.value.condition), condition: JSON.stringify(formData.value.condition),
configuration: JSON.stringify(formData.value.configuration) configuration: JSON.stringify(formData.value.configuration)
@ -370,6 +329,7 @@ const submitForm = async () => {
/** 重置表单 */ /** 重置表单 */
const resetForm = () => { const resetForm = () => {
formData.value = { formData.value = {
id: '',
strategyCode: formStrategyCode.value,// strategyCode: formStrategyCode.value,//
code: formStrategyCode.value,// code: formStrategyCode.value,//
name: '',// name: '',//
@ -382,20 +342,16 @@ const resetForm = () => {
{ ParamCode: 'SupplierType', Operator: "==", Value: "" }, { ParamCode: 'SupplierType', Operator: "==", Value: "" },
// //
{ ParamCode: 'SupplierCode', Operator: "IN", Value: "" }, { ParamCode: 'SupplierCode', Operator: "IN", Value: "" },
//
{ ParamCode: 'Weekday', Operator: "IN", Value: [] }
], ],
configuration: [ configuration: [
// //
{ ParamCode: 'BeginTime', Value: "" }, { ParamCode: 'ByItem', Value: false},
// //
{ ParamCode: 'EndTime', Value: "" }, { ParamCode: 'ByLocation', Value: true },
// //
{ ParamCode: 'WarehouseCode', Value: '' }, { ParamCode: 'ByContainer', Value: 'false' },
// //
{ ParamCode: 'DockCode', Value: '' }, { ParamCode: 'JobDetailCount', Value: 0 },
//
{ ParamCode: 'OnTheWayLocationCode', Value: '' },
] ]
} }
} }

2
src/views/wms/strategy/purchaseReceiptStrategy/index.vue

@ -48,7 +48,7 @@ const list = ref([]) // 字典表格数据
const queryParams = reactive({ const queryParams = reactive({
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
strategyCode: 'S001', strategyCode: 'S002',
}) })
/** 查询字典类型列表 */ /** 查询字典类型列表 */

314
src/views/wms/strategy/supplieDeliveryStrategy/AddForm.vue

@ -3,148 +3,147 @@
<template> <template>
<Dialog :title="dialogTitle" v-model="dialogVisible"> <Dialog :title="dialogTitle" v-model="dialogVisible">
<div class="p-20px m--10px" style="max-height: 500px;overflow-y: auto;"> <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"> <el-row>
<div class="title">规则</div> <!-- 规则 -->
<el-form ref="formRef1" :model="formData" :rules="rules" label-width="120px" label-position="left"> <el-col :span="24">
<el-row> <div class="item">
<el-col :span="24"> <div class="title">规则</div>
<el-form-item label="代码" prop="code"> <el-col :span="24">
<el-input v-model="formData.code" placeholder="请输入代码" clearable disabled /> <el-form-item label="代码" prop="code">
</el-form-item> <el-input v-model="formData.code" placeholder="请输入代码" clearable disabled />
</el-col> </el-form-item>
<el-col :span="24"> </el-col>
<el-form-item label="名称" prop="name"> <el-col :span="24">
<el-input v-model="formData.name" placeholder="请输入名称" clearable /> <el-form-item label="名称" prop="name">
</el-form-item> <el-input v-model="formData.name" placeholder="请输入名称" clearable />
</el-col> </el-form-item>
<el-col :span="24"> </el-col>
<el-form-item label="描述" prop="description"> <el-col :span="24">
<el-input v-model="formData.description" placeholder="请输入描述" clearable /> <el-form-item label="描述" prop="description">
</el-form-item> <el-input v-model="formData.description" placeholder="请输入描述" clearable />
</el-col> </el-form-item>
<el-col :span="12"> </el-col>
<el-form-item label="优先级" prop="priority"> <el-col :span="12">
<el-input-number v-model="formData.priority" :min="1" /> <el-form-item label="优先级" prop="priority">
</el-form-item> <el-input-number v-model="formData.priority" :min="1" />
</el-col> </el-form-item>
<el-col :span="12"> </el-col>
<el-form-item label="状态" prop="status"> <el-col :span="12">
<el-switch v-model="formData.status" /> <el-form-item label="状态" prop="status">
</el-form-item> <el-switch v-model="formData.status" />
</el-col> </el-form-item>
</el-row> </el-col>
</el-form> </div>
</div> </el-col>
<!-- 规则条件 --> <!-- 规则条件 -->
<div class="item mt-20px"> <el-col :span="24">
<div class="title">规则条件</div> <div class="item mt-20px">
<el-form ref="formRef2" :model="formData" :rules="rules" label-width="120px" label-position="left"> <div class="title">规则条件</div>
<el-row> <el-col :span="24" v-for="(item, index) in formData.condition" :key="index">
<el-col :span="24" v-for="(item, index) in formData.condition" :key="index"> <!-- 供应商类型 -->
<!-- 供应商类型 --> <el-form-item v-if="item.ParamCode == 'SupplierType'" label="供应商类型" class="flex-top err-120">
<el-form-item v-if="item.ParamCode == 'SupplierType'" label="供应商类型" class="flex-top err-120"> <el-select v-model="item.Operator" placeholder="请选择范围" style="width: 110px;;margin-right: 10px;">
<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.supplierTypeRangeOptions"
<el-option :label="cur.label" :value="cur.value" v-for="cur in options.supplierTypeRangeOptions" :key="cur.value" />
:key="cur.value" /> </el-select>
</el-select> <el-select v-model="item.Value" placeholder="请选择供应商类型" style="flex: 1;" clearable
<el-select v-model="item.Value" placeholder="请选择供应商类型" style="flex: 1;" clearable @change="changeSupplierType">
@change="changeSupplierType"> <el-option v-for="dict in getStrDictOptions(DICT_TYPE.SUPPLIER_TYPE)" :key="dict.value"
<el-option v-for="dict in getStrDictOptions(DICT_TYPE.SUPPLIER_TYPE)" :key="dict.value" :label="dict.label" :value="dict.value" />
:label="dict.label" :value="dict.value" /> </el-select>
</el-select> <!-- </div> -->
<!-- </div> --> </el-form-item>
</el-form-item> <!-- 供应商 -->
<!-- 供应商 --> <el-form-item v-else-if="item.ParamCode == 'SupplierCode'" label="供应商" class="err-120">
<el-form-item v-else-if="item.ParamCode == 'SupplierCode'" label="供应商" class="err-120"> <el-select v-model="item.Operator" placeholder="请选择范围" style="width: 110px;margin-right: 10px;">
<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.supplierRangeOptions"
<el-option :label="cur.label" :value="cur.value" v-for="cur in options.supplierRangeOptions" :key="cur.value" />
:key="cur.value" /> </el-select>
</el-select> <el-select v-model="item.Value" placeholder="请选择供应商" style="flex: 1;" clearable>
<el-select v-model="item.Value" placeholder="请选择供应商" style="flex: 1;" clearable> <el-option v-for="cur in options.supplierList" :key="cur.id" :label="cur.name" :value="cur.id" />
<el-option v-for="cur in options.supplierList" :key="cur.id" :label="cur.name" :value="cur.id" /> </el-select>
</el-select> </el-form-item>
</el-form-item> <!-- 星期几 -->
<!-- 星期几 --> <el-form-item v-else-if="item.ParamCode == 'Weekday'" label="星期几" class="flex-top err-120">
<el-form-item v-else-if="item.ParamCode == 'Weekday'" label="星期几" class="flex-top err-120"> <el-select v-model="item.Operator" placeholder="请选择范围" style="width: 110px;;margin-right: 10px;">
<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.weekRangeOptions"
<el-option :label="cur.label" :value="cur.value" v-for="cur in options.weekRangeOptions" :key="cur.value" />
:key="cur.value" /> </el-select>
</el-select> <div class="checkbox">
<div class="checkbox"> <el-checkbox-group v-model="item.Value" @change="change">
<el-checkbox-group v-model="item.Value" @change="change"> <el-checkbox :label="cur.label" v-for="cur in options.weekOptions" :key="cur.value" />
<el-checkbox :label="cur.label" v-for="cur in options.weekOptions" :key="cur.value" /> </el-checkbox-group>
</el-checkbox-group> </div>
</div> </el-form-item>
</el-form-item> </el-col>
</el-col> </div>
</el-row> </el-col>
</el-form> <!-- 规则配置 -->
</div> <el-col :span="24">
<!-- 规则配置 --> <div class="item mt-20px">
<div class="item mt-20px"> <div class="title">规则配置</div>
<div class="title">规则配置</div>
<el-form ref="formRef3" :model="formData" label-width="120px" label-position="left">
<el-row>
<!-- 开始时间 -->
<el-col :span="24" v-for="(item, index) in formData.configuration" :key="index">
<!-- 开始时间 --> <!-- 开始时间 -->
<el-form-item v-if="item.ParamCode == 'BeginTime'" label="开始时间" :prop="'configuration.' + index + '.Value'" <el-col :span="24" v-for="(item, index) in formData.configuration" :key="index">
:rules="{ <!-- 开始时间 -->
required: true, <el-form-item v-if="item.ParamCode == 'BeginTime'" label="开始时间"
message: '请选择开始时间', :prop="'configuration.' + index + '.Value'" :rules="{
trigger: 'change', required: true,
}"> message: '请选择开始时间',
<el-time-select v-model="item.Value" start="00:00" end="23:59" step="00:15" placeholder="请选择开始时间" trigger: 'change',
style="width: 100%;" /> }">
</el-form-item> <el-time-select v-model="item.Value" start="00:00" end="23:59" step="00:15" placeholder="请选择开始时间"
<!-- 结束时间 --> style="width: 100%;" />
<el-form-item v-else-if="item.ParamCode == 'EndTime'" label="结束时间" </el-form-item>
:prop="'configuration.' + index + '.Value'" :rules="{ <!-- 结束时间 -->
required: true, <el-form-item v-else-if="item.ParamCode == 'EndTime'" label="结束时间"
message: '请选择结束时间', :prop="'configuration.' + index + '.Value'" :rules="{
trigger: 'change', required: true,
}"> message: '请选择结束时间',
<el-time-select v-model="item.Value" start="00:00" end="23:59" step="00:15" placeholder="请选择结束时间" trigger: 'change',
style="width: 100%;" /> }">
</el-form-item> <el-time-select v-model="item.Value" start="00:00" end="23:59" step="00:15" placeholder="请选择结束时间"
<!-- 仓库 --> style="width: 100%;" />
<el-form-item v-else-if="item.ParamCode == 'WarehouseCode'" label="仓库" </el-form-item>
:prop="'configuration.' + index + '.Value'" :rules="{ <!-- 仓库 -->
required: true, <el-form-item v-else-if="item.ParamCode == 'WarehouseCode'" label="仓库"
message: '请选择仓库', :prop="'configuration.' + index + '.Value'" :rules="{
trigger: 'change', required: true,
}"> message: '请选择仓库',
<el-select v-model="item.Value" placeholder="请选择仓库" clearable> trigger: 'change',
<el-option v-for="cur in options.warehouseList" :key="cur.id" :label="cur.name" :value="cur.id" /> }">
</el-select> <el-select v-model="item.Value" placeholder="请选择仓库" clearable>
</el-form-item> <el-option v-for="cur in options.warehouseList" :key="cur.id" :label="cur.name" :value="cur.id" />
<!-- 月台 --> </el-select>
<el-form-item v-else-if="item.ParamCode == 'DockCode'" label="月台" </el-form-item>
:prop="'configuration.' + index + '.Value'" :rules="{ <!-- 月台 -->
required: true, <el-form-item v-else-if="item.ParamCode == 'DockCode'" label="月台"
message: '请选择月台', :prop="'configuration.' + index + '.Value'" :rules="{
trigger: 'change', required: true,
}"> message: '请选择月台',
<el-select v-model="item.Value" placeholder="请选择月台" clearable> trigger: 'change',
<el-option v-for="cur in options.dockList" :key="cur.id" :label="cur.name" :value="cur.id" /> }">
</el-select> <el-select v-model="item.Value" placeholder="请选择月台" clearable>
</el-form-item> <el-option v-for="cur in options.dockList" :key="cur.id" :label="cur.name" :value="cur.id" />
<!-- 在途库位 --> </el-select>
<el-form-item v-else-if="item.ParamCode == 'OnTheWayLocationCode'" label="在途库位" </el-form-item>
:prop="'configuration.' + index + '.Value'" :rules="{ <!-- 在途库位 -->
required: true, <el-form-item v-else-if="item.ParamCode == 'OnTheWayLocationCode'" label="在途库位"
message: '请选择在途库位', :prop="'configuration.' + index + '.Value'" :rules="{
trigger: 'change', required: true,
}"> message: '请选择在途库位',
<el-select v-model="item.Value" placeholder="请选择在途库位" clearable> trigger: 'change',
<el-option v-for="cur in options.locationList" :key="cur.id" :label="cur.name" :value="cur.id" /> }">
</el-select> <el-select v-model="item.Value" placeholder="请选择在途库位" clearable>
</el-form-item> <el-option v-for="cur in options.locationList" :key="cur.id" :label="cur.name" :value="cur.id" />
</el-col> </el-select>
</el-row> </el-form-item>
</el-form> </el-col>
</div> </div>
</el-col>
</el-row>
</el-form>
</div> </div>
<template #footer> <template #footer>
<!-- 按钮--> <!-- 按钮-->
@ -171,9 +170,7 @@ const dialogVisible = ref(false) // 弹窗的是否展示
const dialogTitle = ref('') // const dialogTitle = ref('') //
const formLoading = ref(false) // 12 const formLoading = ref(false) // 12
const formType = ref('') // create - update - const formType = ref('') // create - update -
const formRef1 = ref() // Ref const formRef = ref() // Ref
const formRef2 = ref() // Ref
const formRef3 = ref() // Ref
const change = (e) => { const change = (e) => {
console.log(e); console.log(e);
@ -181,7 +178,7 @@ const change = (e) => {
const formStrategyCode = ref('') const formStrategyCode = ref('')
// form // form
const formData = ref({ const formData = ref({
id:'', id: '',
strategyCode: formStrategyCode.value,//id strategyCode: formStrategyCode.value,//id
code: formStrategyCode.value,// code: formStrategyCode.value,//
name: '',// name: '',//
@ -217,11 +214,6 @@ const rules = ref({
name: [{ required: true, message: '请输入名字', trigger: 'blur' }], name: [{ required: true, message: '请输入名字', trigger: 'blur' }],
description: [{ required: true, message: '请输入描述', trigger: 'blur' }], description: [{ required: true, message: '请输入描述', trigger: 'blur' }],
priority: [{ required: true, message: '请输入优先级', trigger: 'blur' }], priority: [{ required: true, message: '请输入优先级', trigger: 'blur' }],
BeginTime: [{ required: true, message: '请选择开始时间', trigger: 'change' }],
EndTime: [{ required: true, message: '请选择结束时间', trigger: 'change' }],
WarehouseCode: [{ required: true, message: '请选择仓库', trigger: 'change' }],
DockCode: [{ required: true, message: '请选择月台', trigger: 'change' }],
OnTheWayLocationCode: [{ required: true, message: '请选择在途库位', trigger: 'change' }],
}) })
// //
@ -317,17 +309,17 @@ const open = async (type: string, strategyCode: string, id?: number) => {
formData.value.name = data.name formData.value.name = data.name
formData.value.description = data.description formData.value.description = data.description
formData.value.priority = data.priority formData.value.priority = data.priority
formData.value.status = data.status==1?true:false formData.value.status = data.status == 1 ? true : false
if(data.condition){ if (data.condition) {
formData.value.condition = JSON.parse(data.condition) formData.value.condition = JSON.parse(data.condition)
} }
if(data.configuration){ if (data.configuration) {
formData.value.configuration = JSON.parse(data.configuration) formData.value.configuration = JSON.parse(data.configuration)
} }
querySupplierParams.value.type = formData.value?.condition[0]?.Value || '' querySupplierParams.value.type = formData.value?.condition[0]?.Value || ''
getFormSupplierList() getFormSupplierList()
} finally { } finally {
formLoading.value = false formLoading.value = false
} }
@ -339,22 +331,20 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗
const emit = defineEmits(['success']) // success const emit = defineEmits(['success']) // success
const submitForm = async () => { const submitForm = async () => {
// //
if (!formRef1 || !formRef2 || !formRef3) return if (!formRef) return
const valid2 = formRef2.value.validate() const valid = await formRef.value.validate()
const valid1 = formRef1.value.validate() if (!valid) return
const valid3 = await formRef3.value.validate()
if (!valid1 || !valid2 || !valid3) return
// //
formLoading.value = true formLoading.value = true
try { try {
let data = { let data = {
id: formData.value.id, id: formData.value.id,
strategyCode: formData.value.strategyCode,// strategyCode: formData.value.strategyCode,//
code: formData.value.code,// code: formData.value.code,//
name: formData.value.name,// name: formData.value.name,//
description: formData.value.description,// description: formData.value.description,//
priority: formData.value.priority,// priority: formData.value.priority,//
status: formData.value.status?1:0,// status: formData.value.status ? 1 : 0,//
// //
condition: JSON.stringify(formData.value.condition), condition: JSON.stringify(formData.value.condition),
configuration: JSON.stringify(formData.value.configuration) configuration: JSON.stringify(formData.value.configuration)

Loading…
Cancel
Save