From b65f83044791262fc9adb50f80423b8b7754555e Mon Sep 17 00:00:00 2001 From: zhangli <2235006734@qq.com> Date: Wed, 11 Oct 2023 09:59:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=92=8C=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/disposition/defaultButtons.ts | 6 +- src/views/wms/itembasic/ItembasicDetail.vue | 124 ++++++++++++++------ src/views/wms/itembasic/ItembasicForm.vue | 87 ++++++-------- src/views/wms/itempackaging/index.vue | 2 + 4 files changed, 125 insertions(+), 94 deletions(-) diff --git a/src/utils/disposition/defaultButtons.ts b/src/utils/disposition/defaultButtons.ts index f6f1cbb89..f49a80b7d 100644 --- a/src/utils/disposition/defaultButtons.ts +++ b/src/utils/disposition/defaultButtons.ts @@ -119,7 +119,8 @@ export function formSaveBtn(option:any) { hide: false, type: 'primary', icon: 'ep:select', - color: '' + color: '', + float:'right' }) } @@ -130,7 +131,8 @@ export function formCloseBtn(option:any) { name: 'close', hide: false, icon: 'ep:closeBold', - color: '' + color: '', + float:'right' }) } diff --git a/src/views/wms/itembasic/ItembasicDetail.vue b/src/views/wms/itembasic/ItembasicDetail.vue index 8730f7571..6e49fa6d3 100644 --- a/src/views/wms/itembasic/ItembasicDetail.vue +++ b/src/views/wms/itembasic/ItembasicDetail.vue @@ -1,37 +1,37 @@ diff --git a/src/views/wms/itembasic/ItembasicForm.vue b/src/views/wms/itembasic/ItembasicForm.vue index 3ac1e6405..dd0afc5f9 100644 --- a/src/views/wms/itembasic/ItembasicForm.vue +++ b/src/views/wms/itembasic/ItembasicForm.vue @@ -5,8 +5,13 @@ @@ -15,6 +20,7 @@ import { DICT_TYPE, getStrDictOptions, getIntDictOptions } from '@/utils/dict' import * as ItembasicApi from '@/api/wms/itembasic' import { ItemBasic, ItemBasicRules } from '@/utils/disposition/tableColumns.ts' +import * as defaultButtons from '@/utils/disposition/defaultButtons' const { t } = useI18n() // 国际化 const message = useMessage() // 消息弹窗 @@ -23,49 +29,6 @@ const dialogVisible = ref(false) // 弹窗的是否展示 const dialogTitle = ref('') // 弹窗的标题 const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 const formType = ref('') // 表单的类型:create - 新增;update - 修改 -const formData = ref({ - code: undefined, - name: undefined, - desc1: undefined, - desc2: undefined, - status: undefined, - uom: undefined, - altUom: undefined, - isStdPack: undefined, - enableBuy: undefined, - enableMake: undefined, - enableOutsourcing: undefined, - isRecycled: undefined, - isPhantom: undefined, - abcClass: undefined, - type: undefined, - category: undefined, - itemGroup: undefined, - color: undefined, - configuration: undefined, - project: undefined, - eqLevel: undefined, - validityDays: undefined, - available: undefined, - activeTime: undefined, - expireTime: undefined, - remark: undefined -}) -const formRules = reactive({ - code: [{ required: true, message: '代码不能为空', trigger: 'blur' }], - status: [{ required: true, message: '状态不能为空', trigger: 'change' }], - uom: [{ required: true, message: '计量单位不能为空', trigger: 'change' }], - isStdPack: [{ required: true, message: '是否标包不能为空', trigger: 'change' }], - enableBuy: [{ required: true, message: '可采购不能为空', trigger: 'change' }], - enableMake: [{ required: true, message: '可制造不能为空', trigger: 'change' }], - enableOutsourcing: [{ required: true, message: '可委外加工不能为空', trigger: 'change' }], - isRecycled: [{ required: true, message: '回收件不能为空', trigger: 'change' }], - isPhantom: [{ required: true, message: '虚零件不能为空', trigger: 'change' }], - abcClass: [{ required: true, message: 'ABC类不能为空', trigger: 'change' }], - type: [{ required: true, message: '类型不能为空', trigger: 'change' }], - validityDays: [{ required: true, message: '有效天数不能为空', trigger: 'blur' }], - available: [{ required: true, message: '是否可用不能为空', trigger: 'blur' }] -}) const formRef = ref() // 表单 Ref /** 打开弹窗 */ @@ -75,14 +38,14 @@ const open = async (type: string, id?: number) => { formType.value = type resetForm() // 修改时,设置数据 - if (id) { - formLoading.value = true - try { - formData.value = await ItembasicApi.getItembasic(id) - } finally { - formLoading.value = false - } - } + // if (id) { + // formLoading.value = true + // try { + // formData.value = await ItembasicApi.getItembasic(id) + // } finally { + // formLoading.value = false + // } + // } } defineExpose({ open }) // 提供 open 方法,用于打开弹窗 @@ -144,6 +107,24 @@ const resetForm = () => { } formRef.value?.resetFields() } + +// 弹窗按钮 +const Butttondata = [ + defaultButtons.formSaveBtn(null), // 保存 + defaultButtons.formCloseBtn(null), // 关闭 +] +// 按钮事件 +const buttonBaseClick = (val, item) => { + // 保存 + if (val == 'save') { + console.log(417, item) + } + // 关闭 + else if (val == 'close') { + dialogVisible.value = false + } +} +