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">
<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) // 12
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 },
]
}
}

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

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

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

@ -3,11 +3,12 @@
<template>
<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="120px" 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">
@ -78,19 +77,17 @@
</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'"
:rules="{
<el-form-item v-if="item.ParamCode == 'BeginTime'" label="开始时间"
:prop="'configuration.' + index + '.Value'" :rules="{
required: true,
message: '请选择开始时间',
trigger: 'change',
@ -142,10 +139,12 @@
</el-select>
</el-form-item>
</el-col>
</div>
</el-col>
</el-row>
</el-form>
</div>
</div>
<template #footer>
<!-- 按钮-->
<TableHead :HeadButttondata="Butttondata" @buttonBaseClick="buttonBaseClick" />
@ -171,9 +170,7 @@ const dialogVisible = ref(false) // 弹窗的是否展示
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
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);
@ -217,11 +214,6 @@ const rules = ref({
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' }],
})
//
@ -339,11 +331,9 @@ 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 {

Loading…
Cancel
Save