|
|
@ -4,10 +4,11 @@ |
|
|
|
<Dialog :title="dialogTitle" v-model="dialogVisible"> |
|
|
|
<div class="p-20px m--10px" style="max-height: 500px;overflow-y: auto;"> |
|
|
|
<!-- 规则 --> |
|
|
|
<el-form ref="formRef" :model="formData" :rules="rules" label-width="140px" label-position="left"> |
|
|
|
<el-row> |
|
|
|
<el-col :span="24"> |
|
|
|
<div class="item"> |
|
|
|
<div class="title">规则</div> |
|
|
|
<el-form ref="formRef1" :model="formData" :rules="rules" label-width="120px" label-position="left"> |
|
|
|
<el-row> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item label="代码" prop="code"> |
|
|
|
<el-input v-model="formData.code" placeholder="请输入代码" clearable disabled /> |
|
|
@ -33,14 +34,12 @@ |
|
|
|
<el-switch v-model="formData.status" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
</el-form> |
|
|
|
</div> |
|
|
|
</el-col> |
|
|
|
<!-- 规则条件 --> |
|
|
|
<el-col :span="24"> |
|
|
|
<div class="item mt-20px"> |
|
|
|
<div class="title">规则条件</div> |
|
|
|
<el-form ref="formRef2" :model="formData" :rules="rules" label-width="120px" label-position="left"> |
|
|
|
<el-row> |
|
|
|
<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"> |
|
|
@ -65,87 +64,57 @@ |
|
|
|
<el-option v-for="cur in options.supplierList" :key="cur.id" :label="cur.name" :value="cur.id" /> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<!-- 星期几 --> |
|
|
|
<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-option :label="cur.label" :value="cur.value" v-for="cur in options.weekRangeOptions" |
|
|
|
:key="cur.value" /> |
|
|
|
</el-select> |
|
|
|
<div class="checkbox"> |
|
|
|
<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-group> |
|
|
|
</div> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
</el-form> |
|
|
|
</div> |
|
|
|
</el-col> |
|
|
|
<!-- 规则配置 --> |
|
|
|
<el-col :span="24"> |
|
|
|
<div class="item mt-20px"> |
|
|
|
<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-form-item v-if="item.ParamCode == 'ByItem'" label="按零件拆分" :prop="'configuration.' + index + '.Value'" |
|
|
|
:rules="{ |
|
|
|
required: true, |
|
|
|
message: '请选择开始时间', |
|
|
|
trigger: 'change', |
|
|
|
}"> |
|
|
|
<el-time-select v-model="item.Value" start="00:00" end="23:59" step="00:15" placeholder="请选择开始时间" |
|
|
|
style="width: 100%;" /> |
|
|
|
</el-form-item> |
|
|
|
<!-- 结束时间 --> |
|
|
|
<el-form-item v-else-if="item.ParamCode == 'EndTime'" label="结束时间" |
|
|
|
:prop="'configuration.' + index + '.Value'" :rules="{ |
|
|
|
required: true, |
|
|
|
message: '请选择结束时间', |
|
|
|
trigger: 'change', |
|
|
|
}"> |
|
|
|
<el-time-select v-model="item.Value" start="00:00" end="23:59" step="00:15" placeholder="请选择结束时间" |
|
|
|
style="width: 100%;" /> |
|
|
|
<el-switch v-model="item.Value" /> |
|
|
|
</el-form-item> |
|
|
|
<!-- 仓库 --> |
|
|
|
<el-form-item v-else-if="item.ParamCode == 'WarehouseCode'" label="仓库" |
|
|
|
<!-- 按库位拆分 --> |
|
|
|
<el-form-item v-else-if="item.ParamCode == 'ByLocation'" label="按库位拆分" |
|
|
|
:prop="'configuration.' + index + '.Value'" :rules="{ |
|
|
|
required: true, |
|
|
|
message: '请选择仓库', |
|
|
|
message: '请选择按库位拆分', |
|
|
|
trigger: 'change', |
|
|
|
}"> |
|
|
|
<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-switch v-model="item.Value" /> |
|
|
|
</el-form-item> |
|
|
|
<!-- 月台 --> |
|
|
|
<el-form-item v-else-if="item.ParamCode == 'DockCode'" label="月台" |
|
|
|
<!--按器具拆分--> |
|
|
|
<el-form-item v-else-if="item.ParamCode == 'ByContainer'" label="按器具拆分" |
|
|
|
:prop="'configuration.' + index + '.Value'" :rules="{ |
|
|
|
required: true, |
|
|
|
message: '请选择月台', |
|
|
|
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-switch v-model="item.Value" /> |
|
|
|
</el-form-item> |
|
|
|
<!-- 在途库位 --> |
|
|
|
<el-form-item v-else-if="item.ParamCode == 'OnTheWayLocationCode'" label="在途库位" |
|
|
|
<!-- 每个任务明细数量 --> |
|
|
|
<el-form-item v-else-if="item.ParamCode == 'JobDetailCount'" label="每个任务明细数量" |
|
|
|
:prop="'configuration.' + index + '.Value'" :rules="{ |
|
|
|
required: true, |
|
|
|
message: '请选择在途库位', |
|
|
|
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-input v-model="item.Value" placeholder="请输入每个任务明细数量" clearable /> --> |
|
|
|
<el-input-number v-model="item.Value" :min="0" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</div> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
</el-form> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<template #footer> |
|
|
|
<!-- 按钮--> |
|
|
|
<TableHead :HeadButttondata="Butttondata" @buttonBaseClick="buttonBaseClick" /> |
|
|
@ -171,9 +140,7 @@ 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 change = (e) => { |
|
|
|
console.log(e); |
|
|
|
|
|
|
@ -181,7 +148,8 @@ const change = (e) => { |
|
|
|
const formStrategyCode = ref('') |
|
|
|
// form表单数据 |
|
|
|
const formData = ref({ |
|
|
|
strategyCode: formStrategyCode.value,//策略代码 |
|
|
|
id: '', |
|
|
|
strategyCode: formStrategyCode.value,//策略代码id |
|
|
|
code: formStrategyCode.value,//规则代码 |
|
|
|
name: '',//名称 |
|
|
|
description: '',//描述 |
|
|
@ -192,21 +160,17 @@ const formData = ref({ |
|
|
|
// 供应商类型 |
|
|
|
{ ParamCode: 'SupplierType', Operator: "==", Value: "" }, |
|
|
|
// 供应商 |
|
|
|
{ ParamCode: 'SupplierCode', Operator: "IN", Value: "" }, |
|
|
|
// 星期几 |
|
|
|
{ ParamCode: 'Weekday', Operator: "IN", Value: [] } |
|
|
|
{ ParamCode: 'SupplierCode', Operator: "IN", Value: "" } |
|
|
|
], |
|
|
|
configuration: [ |
|
|
|
// 开始时间 |
|
|
|
{ ParamCode: 'BeginTime', Value: "" }, |
|
|
|
// 结束时间 |
|
|
|
{ ParamCode: 'EndTime', Value: "" }, |
|
|
|
// 仓库代码 |
|
|
|
{ ParamCode: 'WarehouseCode', Value: '' }, |
|
|
|
// 月台代码 |
|
|
|
{ ParamCode: 'DockCode', Value: '' }, |
|
|
|
// 在途库位代码 |
|
|
|
{ ParamCode: 'OnTheWayLocationCode', Value: '' }, |
|
|
|
// 按零件拆分 |
|
|
|
{ ParamCode: 'ByItem', Value: false }, |
|
|
|
// 按库位拆分 |
|
|
|
{ ParamCode: 'ByLocation', Value: true }, |
|
|
|
// 按器具拆分 |
|
|
|
{ ParamCode: 'ByContainer', Value: 'false' }, |
|
|
|
// 每个任务明细数量 |
|
|
|
{ ParamCode: 'JobDetailCount', Value: 0 }, |
|
|
|
] |
|
|
|
}) |
|
|
|
|
|
|
@ -215,12 +179,7 @@ const rules = ref({ |
|
|
|
code: [{ required: true, message: '请输入代码', trigger: 'blur' }], |
|
|
|
name: [{ required: true, message: '请输入名字', trigger: 'blur' }], |
|
|
|
description: [{ 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' }], |
|
|
|
priority: [{ required: true, message: '请输入优先级', trigger: 'blur' }] |
|
|
|
}) |
|
|
|
|
|
|
|
// 所有的范围类型 |
|
|
@ -252,10 +211,6 @@ const options = reactive({ |
|
|
|
supplierRangeOptions: formatRangeOptions('IN', 'NOT IN'), |
|
|
|
//供应商列表 |
|
|
|
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: [], |
|
|
|
//月台列表 |
|
|
@ -275,6 +230,7 @@ const getFormSupplierList = async () => { |
|
|
|
// 选择供应商类型 |
|
|
|
const changeSupplierType = (e) => { |
|
|
|
querySupplierParams.value.type = e |
|
|
|
formData.value.condition[1].Value = [] |
|
|
|
getFormSupplierList() |
|
|
|
} |
|
|
|
|
|
|
@ -309,6 +265,7 @@ const open = async (type: string, strategyCode: string, id?: number) => { |
|
|
|
formLoading.value = true |
|
|
|
try { |
|
|
|
let data = await RuleApi.getRule(id) |
|
|
|
formData.value.id = data.id |
|
|
|
formData.value.strategyCode = data.strategyCode |
|
|
|
formData.value.code = data.code |
|
|
|
formData.value.name = data.name |
|
|
@ -322,6 +279,9 @@ const open = async (type: string, strategyCode: string, id?: number) => { |
|
|
|
formData.value.configuration = JSON.parse(data.configuration) |
|
|
|
} |
|
|
|
|
|
|
|
querySupplierParams.value.type = formData.value?.condition[0]?.Value || '' |
|
|
|
getFormSupplierList() |
|
|
|
|
|
|
|
} finally { |
|
|
|
formLoading.value = false |
|
|
|
} |
|
|
@ -333,15 +293,14 @@ 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,//策略代码 |
|
|
|
code: formData.value.code,//规则代码 |
|
|
|
name: formData.value.name,//名称 |
|
|
@ -370,6 +329,7 @@ const submitForm = async () => { |
|
|
|
/** 重置表单 */ |
|
|
|
const resetForm = () => { |
|
|
|
formData.value = { |
|
|
|
id: '', |
|
|
|
strategyCode: formStrategyCode.value,//策略代码 |
|
|
|
code: formStrategyCode.value,//规则代码 |
|
|
|
name: '',//名称 |
|
|
@ -382,20 +342,16 @@ const resetForm = () => { |
|
|
|
{ ParamCode: 'SupplierType', Operator: "==", Value: "" }, |
|
|
|
// 供应商 |
|
|
|
{ ParamCode: 'SupplierCode', Operator: "IN", Value: "" }, |
|
|
|
// 星期几 |
|
|
|
{ ParamCode: 'Weekday', Operator: "IN", Value: [] } |
|
|
|
], |
|
|
|
configuration: [ |
|
|
|
// 开始时间 |
|
|
|
{ ParamCode: 'BeginTime', Value: "" }, |
|
|
|
// 结束时间 |
|
|
|
{ ParamCode: 'EndTime', Value: "" }, |
|
|
|
// 仓库代码 |
|
|
|
{ ParamCode: 'WarehouseCode', Value: '' }, |
|
|
|
// 月台代码 |
|
|
|
{ ParamCode: 'DockCode', Value: '' }, |
|
|
|
// 在途库位代码 |
|
|
|
{ ParamCode: 'OnTheWayLocationCode', Value: '' }, |
|
|
|
// 按零件拆分 |
|
|
|
{ ParamCode: 'ByItem', Value: false}, |
|
|
|
// 按库位拆分 |
|
|
|
{ ParamCode: 'ByLocation', Value: true }, |
|
|
|
// 按器具拆分 |
|
|
|
{ ParamCode: 'ByContainer', Value: 'false' }, |
|
|
|
// 每个任务明细数量 |
|
|
|
{ ParamCode: 'JobDetailCount', Value: 0 }, |
|
|
|
] |
|
|
|
} |
|
|
|
} |
|
|
|