Browse Source

策略

master
zhangli 1 year ago
parent
commit
5b52ad658f
  1. 431
      src/views/wms/strategy/batchStrategy/AddForm.vue
  2. 86
      src/views/wms/strategy/batchStrategy/index.vue
  3. 44
      src/views/wms/strategy/inspectStrategy/AddForm.vue
  4. 350
      src/views/wms/strategy/manageAccuracyStrategy/AddForm copy.vue
  5. 71
      src/views/wms/strategy/manageAccuracyStrategy/AddForm.vue
  6. 301
      src/views/wms/strategy/utensilCapacityStrategy/AddForm.vue
  7. 86
      src/views/wms/strategy/utensilCapacityStrategy/index.vue

431
src/views/wms/strategy/batchStrategy/AddForm.vue

@ -1,15 +1,15 @@
<!-- 批次策略弹窗 -->
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible" width="900px">
<Dialog :title="dialogTitle" v-model="dialogVisible">
<div class="p-20px m--10px" style="max-height: 500px;overflow-y: auto;">
<!-- 规则 -->
<div class="item">
<div class="title">规则</div>
<el-form ref="formRef1" :model="formData" :rules="rules" label-width="120px" label-position="left">
<el-row gutter="10">
<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 label="代码" prop="strategyCode">
<el-input v-model="formData.strategyCode" placeholder="请输入代码" clearable disabled />
</el-form-item>
</el-col>
<el-col :span="24">
@ -18,8 +18,8 @@
</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 label="描述" prop="description">
<el-input v-model="formData.description" placeholder="请输入描述" clearable />
</el-form-item>
</el-col>
<el-col :span="12">
@ -33,85 +33,97 @@
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<!-- 规则条件 -->
<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 gutter="10">
<!-- 选择供应商和客户 -->
<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" />
</div>
<!-- 规则条件 -->
<div class="item mt-20px">
<div class="title">规则条件</div>
<el-row>
<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="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-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="请选择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-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-col>
</el-row>
</el-form>
</div>
<!-- 规则配置 -->
<div class="item mt-20px">
<div class="title">规则配置</div>
<el-form ref="formRef3" :model="formData" :rules="rules" label-width="120px" label-position="left">
</div>
<!-- 规则配置 -->
<div class="item mt-20px">
<div class="title">规则配置</div>
<el-row gutter="10">
<!-- 抽检规则 -->
<el-col :span="24">
<el-form-item label="" label-width="0" class="flex-top" prop="rulesConfig">
<el-col :span="24" v-for="(item, index) in formData.configuration" :key="index">
<!-- 存储类型 -->
<el-form-item label="" label-width="0" class="flex-top" prop="configurationRules">
<div style="width: 100%;display:flex;align-items:center;margin-bottom:10px"
v-for="(item, index) in formData.rulesConfigList" :key="index">
v-for="(cur, key) in item.Value" :key="key">
<div style="width: 26px;display: flex;">
<Icon icon="ep:remove" color="#757575" size="26" style="cursor: pointer;"
@click="handleDeleteTable(item, index)" v-if="formData.rulesConfigList?.length > 1" />
@click="handleDeleteTable(item.Value, cur, key)" v-if="item.Value?.length > 1" />
</div>
<div class="flex w-[28%]">
<div class="ml-10px mr-10px">批次类型</div>
<el-select v-model="item.batchType" placeholder="请选择批次类型" style="flex:1" @change="inputBlur">
<el-option v-for="cur in options.batchTypeOptions" :key="cur.value" :label="cur.label" :value="cur.value" />
<el-select v-model="cur.BatchType" placeholder="请选择批次类型" style="flex:1">
<el-option v-for="it in getStrDictOptions(DICT_TYPE.BATCH_TYPE)" :key="it.value" :label="it.label"
:value="it.value" />
</el-select>
</div>
<div class="flex w-[28%]">
<div class="ml-10px mr-10px">批次格式</div>
<el-input v-model="item.batchFormat" placeholder="yyyyMMDD" clearable style="flex:1" @blur="inputBlur"/>
<el-input v-model="cur.BatchFormat" placeholder="yyyyMMDD" clearable style="flex:1"
@blur="inputBlur" />
</div>
<div class="flex" style="flex:1">
<div class="ml-10px mr-10px">批次方向</div>
<div class="checkbox">
<el-radio-group v-model="item.batchDirection">
<el-radio :label="cur.value" v-for="cur in options.directionOptions" :key="cur.value">{{ cur.label }}</el-radio>
<el-radio-group v-model="cur.BatchDirection">
<el-radio :label="cur.value" v-for="cur in getStrDictOptions(DICT_TYPE.BATCH_DIRECTION)"
:key="cur.value">{{ cur.label }}</el-radio>
</el-radio-group>
</div>
</div>
</div>
<div class="button flex">
<div @click="handleAddTable">
<div @click="handleAddTable(item.Value)">
<Icon icon="ep:circle-plus" color="#409eff" size="26" style="cursor: pointer;" />
<div>添加条件</div>
</div>
@ -119,8 +131,8 @@
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</div>
</el-form>
</div>
<template #footer>
<!-- 按钮-->
@ -130,7 +142,12 @@
</template>
<script setup lang="ts">
import * as defaultButtons from '@/utils/disposition/defaultButtons'
defineOptions({ name: 'BatchStrategyAddForm' })
defineOptions({ name: 'UpShelfStrategyAddForm' })
import { getSupplierList } from '@/api/wms/supplier'
import { getCustomerList } from '@/api/wms/customer'
import * as RuleApi from '@/api/wms/rule'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
const { t } = useI18n() //
const message = useMessage() //
@ -139,138 +156,207 @@ 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 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: '',//
status: true,//
//
condition: [
//
{ ParamCode: 'SupplierCode', Operator: "IN", Value: "" },
// ///abc//
{ ParamCode: 'ItemType', Operator: "IN", Value: "" },
],
configuration: [
//
{
ParamCode: 'ManagementPrecision', Value: [{
BatchType: 'ARRIVE_TIME',
BatchFormat: '',
BatchDirection: 'ASC',
}]
},
],
//
rulesConfigList: [{
batchType: 1,
batchFormat: '',
batchDirection:1,
}],//
rulesConfig:''//
configurationRules: '1'//
})
//
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' }],
rulesConfig: [{ required: true, message: '规则配置请填写完全', trigger: 'blur' }],
configurationRules: [{ 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('IN'),
//
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' }],
//
batchTypeOptions: [{ value: 1, label: '生产时间' }, { value: 2, label: '到货时间' }, { value: 3, label: '失效时间' }, { value: 4, label: '供应商批次' }, { value: 5, label: '供应商优先级' }, { value: 6, label: '其他批次' }],
//
directionOptions: [{ value: 1, label: '从小到大' }, { value: 2, label: '从大到小' }],
itemTypeOptions: [{ value: 'ItemType', label: '物品类型' }, { value: 'ItemGroup', label: '物品分组' }, { value: 'ItemCode', label: '物品' }, { value: 'Project', label: '项目' }, { value: 'AbcClass', label: 'ABC类' }],
})
//
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 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()
//
}
defineExpose({ open }) // open
//
const inputBlur = () => {
console.log(formData.value.rulesConfigList);
const isEmpty = formData.value.rulesConfigList.some((item, index) => {
return !item.batchType || !item.batchFormat
})
console.log(isEmpty);
if (isEmpty) {
formData.value.rulesConfig = ''
} else {
formData.value.rulesConfig = '1'
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 == 0 ? 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()
}
} finally {
formLoading.value = false
}
}
console.log(formData.value.rulesConfig);
}
defineExpose({ open }) // open
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {
//
const isEmpty = formData.value.rulesConfigList.some((item, index) => {
return !item.batchFormat
})
if (isEmpty) {
formData.value.rulesConfig = ''
} else {
formData.value.rulesConfig = '1'
}
//
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
inputBlur()
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 ? 0 : 1,//
//
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: '',//
//
rulesConfigList: [{
batchType:1,
batchFormat: '',
batchDirection: 1,
}],//
rulesConfig: ''//
id: '',
strategyCode: formStrategyCode.value,//id
name: '',//
description: '',//
priority: '',//
status: true,//
//
condition: [
//
{ ParamCode: 'SupplierCode', Operator: "IN", Value: "" },
// ///abc//
{ ParamCode: 'ItemType', Operator: "IN", Value: "" },
],
configuration: [
//
{
ParamCode: 'ManagementPrecision', Value: [{
BatchType: 'ARRIVE_TIME',
BatchFormat: '',
BatchDirection: 'ASC',
}]
},
],
configurationRules: '1'//
}
}
@ -291,18 +377,41 @@ const buttonBaseClick = (val, item) => {
}
}
//
const handleAddTable = () => {
formData.value.rulesConfigList.push({
batchType: '',
batchFormat: '',
batchDirection: 1,
const handleAddTable = (item) => {
item.push({
BatchType: 'ARRIVE_TIME',
BatchFormat: '',
BatchDirection: 'ASC',
})
}
//
const handleDeleteTable = (item, index) => {
formData.value.rulesConfigList.splice(index, 1)
const handleDeleteTable = (item, cur, key) => {
item.splice(key, 1)
}
//
const inputBlur = () => {
let arr = []
formData.value.configuration.forEach(item => {
let bol = false
item.Value.forEach(cur => {
if (!cur.BatchFormat) {
bol = false
} else {
bol = true
}
arr.push(bol)
})
})
const isEmpty = arr.some(cur => {
return !cur
})
if (isEmpty) {
formData.value.configurationRules = ''
return;
} else {
formData.value.configurationRules = '1'
}
}
</script>
<style scoped lang="scss">
.item {

86
src/views/wms/strategy/batchStrategy/index.vue

@ -2,27 +2,86 @@
<template>
<!-- 列表头部 -->
<TableHead :HeadButttondata="HeadButttondata" @buttonBaseClick="buttonBaseClick" />
<!-- 表单弹窗添加/修改 -->
<AddForm ref="formRef" @success="getList" />
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="loading" :data="list">
<el-table-column align="center" label="策略代码" prop="strategyCode" />
<el-table-column align="center" label="策略名称" prop="name" show-overflow-tooltip />
<el-table-column align="center" label="策略描述" prop="description" />
<el-table-column align="center" label="优先级" prop="priority" />
<el-table-column align="center" label="状态" prop="status">
<template #default="scope">
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column align="center" label="操作" fixed="right" width="240">
<template #default="scope">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event, scope.row)" />
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNo" :total="total"
@pagination="getList" />
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<AddForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts">
import { DICT_TYPE } from '@/utils/dict'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import * as RuleApi from '@/api/wms/rule'
import AddForm from './AddForm.vue'
// import { dateFormatter } from '@/utils/formatTime'
defineOptions({ name: 'SupplieDeliveryStrategy' })
const { t } = useI18n() //
const message = useMessage() //
const loading = ref(true) //
const total = ref(0) //
const list = ref([]) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
strategyCode: 'S010',
})
/** 查询字典类型列表 */
const getList = async () => {
loading.value = true
try {
const data = await RuleApi.getRulePage(queryParams)
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
defineOptions({ name: 'BatchStrategy' })
//
const formRef = ref()
const openForm = (type: string) => {
formRef.value.open(type)
const openForm = (type: string, strategyCode: string, id: number) => {
formRef.value.open(type, strategyCode, id)
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await RuleApi.deleteRule(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch { }
}
//
const HeadButttondata = [
defaultButtons.defaultAddBtn(null), //
defaultButtons.defaultImportBtn(null), //
defaultButtons.defaultExportBtn(null), //
// defaultButtons.defaultFilterBtn(), //
defaultButtons.defaultFreshBtn(null), //
]
@ -30,7 +89,7 @@ const HeadButttondata = [
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
openForm('create')
openForm('create', queryParams.strategyCode)
} else if (val == 'import') { //
handleImport()
} else if (val == 'export') { //
@ -52,10 +111,15 @@ const butttondata = [
// -
const buttonTableClick = (val, row) => {
if (val == 'edit') { //
openForm('update', row.id)
openForm('update', queryParams.strategyCode, row.id)
} else if (val == 'delete') { //
handleDelete(row.id)
}
}
/** 初始化 **/
onMounted(() => {
getList()
})
</script>

44
src/views/wms/strategy/inspectStrategy/AddForm.vue

@ -103,7 +103,7 @@
</div>
</el-form-item>
<!-- 抽检规则 -->
<el-form-item label="抽检规则" class="flex-top" v-if="index == 2">
<el-form-item label="抽检规则" class="flex-top" v-if="index == 2" prop="configurationRules">
<div style="flex:1;display:flex;align-items:center;margin-bottom:10px" v-for="(cur, key) in item.Value"
:key="key">
<div style="width: 26px;display: flex;">
@ -143,9 +143,6 @@ import * as defaultButtons from '@/utils/disposition/defaultButtons'
defineOptions({ name: 'SupplieDeliveryStrategyAddForm' })
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
import { getSupplierList } from '@/api/wms/supplier'
import { getWarehouseList } from '@/api/wms/warehouse'
import { getDockList } from '@/api/wms/dock'
import { getLocationList } from '@/api/wms/location'
import * as RuleApi from '@/api/wms/rule'
@ -192,8 +189,9 @@ const formData = ref({
CeilingQty:2,
SampleValue: 1,
}]
},
]
}
],
configurationRules: '1'//
})
//
@ -202,6 +200,7 @@ const rules = ref({
name: [{ required: true, message: '请输入名字', trigger: 'blur' }],
description: [{ required: true, message: '请输入描述', trigger: 'blur' }],
priority: [{ required: true, message: '请输入优先级', trigger: 'blur' }],
configurationRules: [{ required: true, message: '抽奖规则请填写完全', trigger: 'blur' }],
})
//
@ -291,6 +290,7 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗
const emit = defineEmits(['success']) // success
const submitForm = async () => {
//
inputNumberBlur()
if (!formRef) return
const valid = await formRef.value.validate()
if (!valid) return
@ -355,7 +355,8 @@ const resetForm = () => {
SampleValue: 1,
}]
},
]
],
configurationRules: '1'//
}
}
@ -388,6 +389,35 @@ const handleAddTable = (item) => {
const handleDeleteTable = (item,cur, key) => {
item.splice(key, 1)
}
//
const inputNumberBlur=()=>{
let arr = []
formData.value.configuration.forEach(item => {
let bol = false
if(item.ParamCode == 'AqlList'){
item.Value.forEach(cur => {
if (!cur.FloorQty|| !cur.CeilingQty || !cur.SampleValue) {
bol = false
} else {
bol = true
}
arr.push(bol)
})
}
})
console.log(arr);
const isEmpty = arr.some(cur => {
return !cur
})
if (isEmpty) {
formData.value.configurationRules = ''
return;
} else {
formData.value.configurationRules = '1'
}
}
</script>
<style scoped lang="scss">

350
src/views/wms/strategy/manageAccuracyStrategy/AddForm copy.vue

@ -1,350 +0,0 @@
<!-- 管理精度策略弹窗 -->
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible">
<div class="p-20px m--10px" style="max-height: 500px;overflow-y: auto;">
<!-- 规则 -->
<div class="item">
<div class="title">规则</div>
<el-form ref="formRef1" :model="formData" :rules="rules" label-width="120px" label-position="left">
<el-row gutter="10">
<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>
</el-form>
</div>
<!-- 规则条件 -->
<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 gutter="10">
<!-- 选择供应商和客户 -->
<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-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>
<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>
</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-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>
<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>
</el-form-item>
</el-col>
<!-- 仓库 库区 库位组 库位 -->
<el-col :span="24">
<el-form-item label="" label-width="0" prop="warehouse" class="err-240">
<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-select>
<el-select v-model="formData.warehouseTypeRange" 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.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>
</el-form-item>
</el-col>
<!-- 忽略物品 -->
<el-col :span="24">
<el-form-item label="忽略物品" prop="ignoreItems" class="err-120">
<el-select v-model="formData.ignoreItemsRange" 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.ignoreItems" placeholder="请选择物品" style="flex: 1;" clearable>
<el-option v-for="item in options.ignoreItemsList" :key="item.value" :label="item.label"
:value="item.value" />
</el-select>
</el-form-item>
</el-col>
<!-- 忽略库位 -->
<el-col :span="24">
<el-form-item label="忽略库位" prop="ignoreWarehouse" class="err-120">
<el-select v-model="formData.ignoreWarehouseRange" 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.ignoreWarehouse" placeholder="请选择库位" style="flex: 1;" clearable>
<el-option v-for="item in options.ignoreWarehouseList" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<!-- 规则配置 -->
<div class="item mt-20px">
<div class="title">规则配置</div>
<el-form ref="formRef3" :model="formData" :rules="rules" label-width="120px" label-position="left">
<el-row gutter="10">
<!-- 管理类型 -->
<el-col :span="24">
<el-form-item label="管理类型" class="flex-top" prop="manageType">
<div class="checkbox">
<el-radio-group v-model="formData.manageType">
<el-radio :label="item.value" v-for="item in options.manageTypeOptions" :key="item.value">{{
item.label
}}</el-radio>
</el-radio-group>
</div>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</div>
<template #footer>
<!-- 按钮-->
<TableHead :HeadButttondata="Butttondata" @buttonBaseClick="buttonBaseClick" />
</template>
</Dialog>
</template>
<script setup lang="ts">
import * as defaultButtons from '@/utils/disposition/defaultButtons'
defineOptions({ name: 'ManageAccuracyStrategyAddForm' })
const { t } = useI18n() //
const message = useMessage() //
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
// form
const formData = ref({
code: '',//
name: '',//
describe: '',//
priority: '',//
status: false,//
//
type: 1,//
supplierTypeRange: 1,//
supplier: '',//
//
itemType: 1,//
itemTypeRange: 1, //
item: '',//
//
warehouseType: 1,/////
warehouseTypeRange: 1, //
warehouse: '',/////
//
ignoreItemsRange: 1, //
ignoreItems: '',//
//
ignoreWarehouseRange: 1, //
ignoreWarehouse: '',//
manageType:1,//
})
//
const rules = ref({
code: [{ required: true, message: '请输入代码', trigger: 'blur' }],
name: [{ required: true, message: '请输入名字', trigger: 'blur' }],
describe: [{ required: true, message: '请输入描述', trigger: 'blur' }],
priority: [{ required: true, message: '请输入优先级', trigger: 'blur' }],
supplier: [{ required: true, message: '请选择供应商', trigger: 'blur' }],
item: [{ required: true, message: '请选择物品', trigger: 'blur' }],
warehouse: [{ required: true, message: '请选择仓库', trigger: 'blur' }],
ignoreItems: [{ required: true, message: '请选择物品', trigger: 'blur' }],
ignoreWarehouse: [{ required: true, message: '请选择库位', trigger: 'blur' }],
})
//
const options = reactive({
//
typeOptions: [{ value: 1, label: '供应商' }, { value: 2, label: '客户' }],
//
rangeOptions: [{ value: 1, label: '包含' }, { value: 2, label: '大于', }],
//
supplierList: [{ value: 1, label: '供应商1' }, { value: 2, label: '供应商2' }, { value: 3, label: '供应商3' }],
//
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' }],
//
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' }],
//
ignoreItemsList: [{ value: 1, label: '物品1' }, { value: 2, label: '物品2' }, { value: 3, label: '物品3' }],
//
ignoreWarehouseList: [{ value: 1, label: '库位1' }, { value: 2, label: '库位2' }, { value: 3, label: '库位3' }],
//
manageTypeOptions: [{ value: 1, label: '包装' }, { value: 2, label: '容器' }, { value: 3, label: '单件' }]
})
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
resetForm()
//
}
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
//
formLoading.value = true
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
code: '',
name: '',
describe: '',
priority: '',
status: false,
//
type: 1,//
supplierTypeRange: 1,//
supplier: '',//
//
itemType: 1,//
itemTypeRange: 1, //
item: '',//
//
warehouseType: 1,/////
warehouseTypeRange: 1, //
warehouse: '',/////
//
ignoreItemsRange: 1, //
ignoreItems: '',//
//
ignoreWarehouseRange: 1, //
ignoreWarehouse: '',//
manageType: 1,//
}
}
//
const Butttondata = [
defaultButtons.formSaveBtn(null), //
defaultButtons.formCloseBtn(null), //
]
//
const buttonBaseClick = (val, item) => {
//
if (val == 'save') {
submitForm()
}
//
else if (val == 'close') {
dialogVisible.value = false
}
}
</script>
<style scoped lang="scss">
.item {
border: 1px solid #dedede;
border-radius: 4px;
padding: 30px 30px 5px;
position: relative;
.title {
position: absolute;
background: white;
padding: 0px 10px;
position: absolute;
top: 0px;
height: 30px;
line-height: 30px;
margin-top: -15px;
}
}
.checkbox {
background: #f5f5f5;
flex: 1;
padding: 0px 15px;
border-radius: 2px;
}
::v-deep .flex-top .el-form-item__content {
align-items: flex-start !important;
}
::v-deep .err-240 .el-form-item__error {
padding-left: 240px !important;
}
::v-deep .err-120 .el-form-item__error {
padding-left: 120px !important;
}
</style>

71
src/views/wms/strategy/manageAccuracyStrategy/AddForm.vue

@ -85,29 +85,29 @@
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="" 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="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="item.Value"
:placeholder="`请选择${item.ParamCode == 'WarehouseCode' ? '仓库' : item.ParamCode == 'AreaCode' ? '库区' : item.ParamCode == 'LocationGroupCode' ? '库位组' : item.ParamCode == 'LocationCode' ? '库位' : ''}`"
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-form-item label="" label-width="0" class="err-240" v-if="index == 2">
<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="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="item.Value"
:placeholder="`请选择${item.ParamCode == 'WarehouseCode' ? '仓库' : item.ParamCode == 'AreaCode' ? '库区' : item.ParamCode == 'LocationGroupCode' ? '库位组' : item.ParamCode == 'LocationCode' ? '库位' : ''}`"
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-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.rangeOptions2"
:key="cur.value" />
</el-select>
<el-input v-model="item.Value" placeholder="请输入忽略物品" clearable style="flex: 1;"/>
<el-input v-model="item.Value" placeholder="请输入忽略物品" clearable style="flex: 1;" />
</el-form-item>
<!-- 忽略库位 -->
<el-form-item label="忽略库位" class="err-120" v-if="index == 4">
@ -115,29 +115,28 @@
<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="请输入忽略库位" clearable style="flex: 1;"/>
<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 gutter="10">
<el-col :span="24" v-for="(item, index) in formData.configuration" :key="index">
<!-- 存储类型 -->
<el-form-item label="管理精度" v-if="index == 0">
<div class="checkbox">
<el-radio-group v-model="item.Value">
<el-radio :label="cur.value" v-for="cur in getStrDictOptions(DICT_TYPE.MANAGEMENT_MODE)"
:key="cur.value">{{ cur.label }}</el-radio>
</el-radio-group>
</div>
</el-form-item>
</el-col>
</el-row>
</div>
<!-- 规则配置 -->
<div class="item mt-20px">
<div class="title">规则配置</div>
<el-row gutter="10">
<el-col :span="24" v-for="(item, index) in formData.configuration" :key="index">
<!-- 存储类型 -->
<el-form-item label="管理精度" v-if="index == 0">
<div class="checkbox">
<el-radio-group v-model="item.Value">
<el-radio :label="cur.value" v-for="cur in getStrDictOptions(DICT_TYPE.MANAGEMENT_MODE)"
:key="cur.value">{{ cur.label }}</el-radio>
</el-radio-group>
</div>
</el-form-item>
</el-col>
</el-row>
</div>
</el-form>
</div>
<template #footer>

301
src/views/wms/strategy/utensilCapacityStrategy/AddForm.vue

@ -2,14 +2,14 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible">
<div class="p-20px m--10px" style="max-height: 500px;overflow-y: auto;">
<!-- 规则 -->
<div class="item">
<div class="title">规则</div>
<el-form ref="formRef1" :model="formData" :rules="rules" label-width="120px" label-position="left">
<el-form ref="formRef" :model="formData" :rules="rules" label-width="120px" label-position="left">
<!-- 规则 -->
<div class="item">
<div class="title">规则</div>
<el-row gutter="10">
<el-col :span="24">
<el-form-item label="代码" prop="code">
<el-input v-model="formData.code" placeholder="请输入代码" clearable />
<el-form-item label="代码" prop="strategyCode">
<el-input v-model="formData.strategyCode" placeholder="请输入代码" clearable disabled />
</el-form-item>
</el-col>
<el-col :span="24">
@ -18,8 +18,8 @@
</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 label="描述" prop="description">
<el-input v-model="formData.description" placeholder="请输入描述" clearable />
</el-form-item>
</el-col>
<el-col :span="12">
@ -33,58 +33,75 @@
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<!-- 规则条件 -->
<div class="item mt-20px">
<div class="title">规则条件</div>
<el-form ref="formRef2" :model="formData" :rules="rules" label-width="120px" label-position="left">
</div>
<!-- 规则条件 -->
<div class="item mt-20px">
<div class="title">规则条件</div>
<el-row gutter="10">
<!-- 选择供应商和客户 -->
<el-col :span="24">
<el-form-item label="器具类型" prop="utensilType" class="err-120">
<el-select v-model="formData.utensilTypeRange" 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-col :span="24" v-for="(item, index) in formData.condition" :key="index">
<!-- 器具类型 -->
<el-form-item label="器具类型" class="err-120" v-if="index == 0" :prop="'condition.' + index + '.Value'"
:rules="{
required: true,
message: '请选择器具类型',
trigger: 'change',
}">
<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="item.Value" placeholder="请选择器具类型" style="flex: 1;" clearable>
<el-option v-for="cur in getStrDictOptions(DICT_TYPE.CONTAINER_TYPE)" :key="cur.value" :label="cur.label"
:value="cur.value" />
</el-select>
</el-form-item>
<!-- 选择物品类型 -->
<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="cur.label" :value="cur.value" v-for="cur in options.itemTypeOptions"
:key="cur.value" />
</el-select>
<el-select v-model="formData.utensilType" placeholder="请选择器具" style="flex: 1;" clearable>
<el-option v-for="item in options.utensilTypeList" :key="item.value" :label="item.label" :value="item.value" />
</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-option :label="item.label" :value="item.value" v-for="item in options.itemTypeOptions"
: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.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.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-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="请选择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-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-col>
</el-row>
</el-form>
</div>
<!-- 规则配置 -->
<div class="item mt-20px">
<div class="title">规则配置</div>
<el-form ref="formRef3" :model="formData" :rules="rules" label-width="120px" label-position="left">
</div>
<!-- 规则配置 -->
<div class="item mt-20px">
<div class="title">规则配置</div>
<el-row gutter="10">
<!-- 容纳数量 -->
<el-col :span="24">
<el-form-item label="容纳数量" prop="number">
<el-input-number v-model="formData.number" :min="0" controls-position="right" />
<el-col :span="24" v-for="(item, index) in formData.configuration" :key="index">
<!-- 容纳数量 -->
<el-form-item label="容纳数量" v-if="index == 0" :prop="'configuration.' + index + '.Value'"
:rules="[{ required: true, message: '请输入容纳数量', trigger: 'change', }]">
<el-input-number v-model="item.Value" :min="-1" controls-position="right" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</div>
</el-form>
</div>
<template #footer>
<!-- 按钮-->
@ -94,7 +111,11 @@
</template>
<script setup lang="ts">
import * as defaultButtons from '@/utils/disposition/defaultButtons'
defineOptions({ name: 'BatchStrategyAddForm' })
defineOptions({ name: 'UpShelfStrategyAddForm' })
import * as RuleApi from '@/api/wms/rule'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
const { t } = useI18n() //
const message = useMessage() //
@ -103,59 +124,100 @@ 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 formStrategyCode = ref('')
// form
const formData = ref({
code: '',//
id: '',
strategyCode: formStrategyCode.value,//id
name: '',//
describe: '',//
description: '',//
priority: '',//
status: false,//
//
utensilTypeRange: 1,//
utensilType: '',//
//
itemType: 1,//
itemTypeRange: 1, //
item: '',//
status: true,//
//
condition: [
//
{ ParamCode: 'ContainerType', Operator: "IN", Value: "" },
// ///abc//
{ ParamCode: 'ItemGroup', Operator: "IN", Value: "" },
],
configuration: [
//
{ ParamCode: 'ContentCount', Value: 0 },
]
number: 0,//
})
//
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' }],
utensilType: [{ required: true, message: '请选择器具类型', trigger: 'blur' }],
item: [{ required: true, message: '请选择物品', trigger: 'blur' }],
number: [{ required: true, message: '请输入容纳数量', trigger: ['change', '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({
//
rangeOptions: [{ value: 1, label: '包含' }, { value: 2, label: '大于', }],
//
utensilTypeList: [{ value: 1, label: '器具类型1' }, { value: 2, label: '器具类型2' }, { value: 3, label: '器具类型3' }],
//
rangeOptions1: formatRangeOptions('IN', 'NOT IN'),
//
itemTypeOptions: [{ value: 2, label: '物品分组' }, { value: 3, label: '物品' }, { value: 4, label: '项目' }],
//
itemList: [{ value: 1, label: '物品1' }, { value: 2, label: '物品2' }, { value: 3, label: '物品3' }],
itemTypeOptions: [{ value: 'ItemGroup', label: '物品分组' }, { value: 'ItemCode', label: '物品' }, { value: 'Project', label: '项目' }],
})
// //abc//
const changeItemsType = () => {
formData.value.condition[1].Value = ''
}
/** 打开弹窗 */
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 == 0 ? true : false
if (data.condition) {
formData.value.condition = JSON.parse(data.condition)
}
if (data.configuration) {
formData.value.configuration = JSON.parse(data.configuration)
}
} finally {
formLoading.value = false
}
}
}
defineExpose({ open }) // open
@ -163,35 +225,58 @@ 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 ? 0 : 1,//
//
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,
//
utensilTypeRange: 1,//
utensilType: '',//
//
itemType: 2,//
itemTypeRange: 1, //
item: '',//
number: 0,//
id: '',
strategyCode: formStrategyCode.value,//id
name: '',//
description: '',//
priority: '',//
status: true,//
//
condition: [
//
{ ParamCode: 'ContainerType', Operator: "IN", Value: "" },
// ///abc//
{ ParamCode: 'ItemGroup', Operator: "IN", Value: "" },
],
configuration: [
//
{ ParamCode: 'ContentCount', Value: 0 },
]
}
}
@ -212,6 +297,18 @@ const buttonBaseClick = (val, item) => {
}
}
const validatorNum = (rule: any, value: any, callback: any) => {
if (value && formData.value.configuration[0].Value != -1) {
if (value > formData.value.configuration[0].Value) {
callback(new Error("11"))
} else {
callback()
}
} else {
callback()
}
}
</script>
<style scoped lang="scss">
.item {
@ -250,4 +347,8 @@ const buttonBaseClick = (val, item) => {
::v-deep .err-120 .el-form-item__error {
padding-left: 120px !important;
}
::v-deep .err-130 .el-form-item__error {
padding-left: 130px !important;
}
</style>

86
src/views/wms/strategy/utensilCapacityStrategy/index.vue

@ -2,27 +2,86 @@
<template>
<!-- 列表头部 -->
<TableHead :HeadButttondata="HeadButttondata" @buttonBaseClick="buttonBaseClick" />
<!-- 表单弹窗添加/修改 -->
<AddForm ref="formRef" @success="getList" />
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="loading" :data="list">
<el-table-column align="center" label="策略代码" prop="strategyCode" />
<el-table-column align="center" label="策略名称" prop="name" show-overflow-tooltip />
<el-table-column align="center" label="策略描述" prop="description" />
<el-table-column align="center" label="优先级" prop="priority" />
<el-table-column align="center" label="状态" prop="status">
<template #default="scope">
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column align="center" label="操作" fixed="right" width="240">
<template #default="scope">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event, scope.row)" />
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNo" :total="total"
@pagination="getList" />
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<AddForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts">
import { DICT_TYPE } from '@/utils/dict'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import * as RuleApi from '@/api/wms/rule'
import AddForm from './AddForm.vue'
// import { dateFormatter } from '@/utils/formatTime'
defineOptions({ name: 'SupplieDeliveryStrategy' })
const { t } = useI18n() //
const message = useMessage() //
const loading = ref(true) //
const total = ref(0) //
const list = ref([]) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
strategyCode: 'S012',
})
/** 查询字典类型列表 */
const getList = async () => {
loading.value = true
try {
const data = await RuleApi.getRulePage(queryParams)
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
defineOptions({ name: 'BatchStrategy' })
//
const formRef = ref()
const openForm = (type: string) => {
formRef.value.open(type)
const openForm = (type: string, strategyCode: string, id: number) => {
formRef.value.open(type, strategyCode, id)
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await RuleApi.deleteRule(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch { }
}
//
const HeadButttondata = [
defaultButtons.defaultAddBtn(null), //
defaultButtons.defaultImportBtn(null), //
defaultButtons.defaultExportBtn(null), //
// defaultButtons.defaultFilterBtn(), //
defaultButtons.defaultFreshBtn(null), //
]
@ -30,7 +89,7 @@ const HeadButttondata = [
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
openForm('create')
openForm('create', queryParams.strategyCode)
} else if (val == 'import') { //
handleImport()
} else if (val == 'export') { //
@ -52,10 +111,15 @@ const butttondata = [
// -
const buttonTableClick = (val, row) => {
if (val == 'edit') { //
openForm('update', row.id)
openForm('update', queryParams.strategyCode, row.id)
} else if (val == 'delete') { //
handleDelete(row.id)
}
}
/** 初始化 **/
onMounted(() => {
getList()
})
</script>

Loading…
Cancel
Save