Browse Source

策略

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

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

@ -4,10 +4,11 @@
<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="140px" label-position="left">
<el-row>
<el-col :span="24">
<div class="item"> <div class="item">
<div class="title">规则</div> <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-col :span="24">
<el-form-item label="代码" prop="code"> <el-form-item label="代码" prop="code">
<el-input v-model="formData.code" placeholder="请输入代码" clearable disabled /> <el-input v-model="formData.code" placeholder="请输入代码" clearable disabled />
@ -33,14 +34,12 @@
<el-switch v-model="formData.status" /> <el-switch v-model="formData.status" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row>
</el-form>
</div> </div>
</el-col>
<!-- 规则条件 --> <!-- 规则条件 -->
<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="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-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">
@ -65,87 +64,57 @@
<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-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-col>
</el-row>
</el-form>
</div> </div>
</el-col>
<!-- 规则配置 --> <!-- 规则配置 -->
<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-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="{ :rules="{
required: true, required: true,
message: '请选择开始时间', message: '请选择开始时间',
trigger: 'change', trigger: 'change',
}"> }">
<el-time-select v-model="item.Value" start="00:00" end="23:59" step="00:15" placeholder="请选择开始时间" <el-switch v-model="item.Value" />
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-form-item> </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="{ :prop="'configuration.' + index + '.Value'" :rules="{
required: true, required: true,
message: '请选择仓库', message: '请选择按库位拆分',
trigger: 'change', trigger: 'change',
}"> }">
<el-select v-model="item.Value" placeholder="请选择仓库" clearable> <el-switch v-model="item.Value" />
<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>
<!-- 月台 --> <!--按器具拆分-->
<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="{ :prop="'configuration.' + index + '.Value'" :rules="{
required: true, required: true,
message: '请选择月台', message: '请选择按器具拆分',
trigger: 'change', trigger: 'change',
}"> }">
<el-select v-model="item.Value" placeholder="请选择月台" clearable> <el-switch v-model="item.Value" />
<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>
<!-- 在途库位 --> <!-- 每个任务明细数量 -->
<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="{ :prop="'configuration.' + index + '.Value'" :rules="{
required: true, required: true,
message: '请选择在途库位', message: '请选择每个任务明细数量',
trigger: 'change', trigger: 'change',
}"> }">
<el-select v-model="item.Value" placeholder="请选择在途库位" clearable> <!-- <el-input v-model="item.Value" placeholder="请输入每个任务明细数量" clearable /> -->
<el-option v-for="cur in options.locationList" :key="cur.id" :label="cur.name" :value="cur.id" /> <el-input-number v-model="item.Value" :min="0" />
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</div>
</el-col>
</el-row> </el-row>
</el-form> </el-form>
</div> </div>
</div>
<template #footer> <template #footer>
<!-- 按钮--> <!-- 按钮-->
<TableHead :HeadButttondata="Butttondata" @buttonBaseClick="buttonBaseClick" /> <TableHead :HeadButttondata="Butttondata" @buttonBaseClick="buttonBaseClick" />
@ -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,6 +265,7 @@ 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
@ -322,6 +279,9 @@ const open = async (type: string, strategyCode: string, id?: number) => {
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,15 +293,14 @@ 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,//
@ -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',
}) })
/** 查询字典类型列表 */ /** 查询字典类型列表 */

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

@ -3,11 +3,12 @@
<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">
<el-row>
<!-- 规则 --> <!-- 规则 -->
<el-col :span="24">
<div class="item"> <div class="item">
<div class="title">规则</div> <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-col :span="24">
<el-form-item label="代码" prop="code"> <el-form-item label="代码" prop="code">
<el-input v-model="formData.code" placeholder="请输入代码" clearable disabled /> <el-input v-model="formData.code" placeholder="请输入代码" clearable disabled />
@ -33,14 +34,12 @@
<el-switch v-model="formData.status" /> <el-switch v-model="formData.status" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row>
</el-form>
</div> </div>
</el-col>
<!-- 规则条件 --> <!-- 规则条件 -->
<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="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-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">
@ -78,19 +77,17 @@
</div> </div>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row>
</el-form>
</div> </div>
</el-col>
<!-- 规则配置 --> <!-- 规则配置 -->
<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-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 == 'BeginTime'" label="开始时间"
:rules="{ :prop="'configuration.' + index + '.Value'" :rules="{
required: true, required: true,
message: '请选择开始时间', message: '请选择开始时间',
trigger: 'change', trigger: 'change',
@ -142,10 +139,12 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</div>
</el-col>
</el-row> </el-row>
</el-form> </el-form>
</div> </div>
</div>
<template #footer> <template #footer>
<!-- 按钮--> <!-- 按钮-->
<TableHead :HeadButttondata="Butttondata" @buttonBaseClick="buttonBaseClick" /> <TableHead :HeadButttondata="Butttondata" @buttonBaseClick="buttonBaseClick" />
@ -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);
@ -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' }],
}) })
// //
@ -339,11 +331,9 @@ 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 {

Loading…
Cancel
Save