From 4489c23fe4af0674a073e3b5c9642ed04a6f2e6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E8=96=AA=E5=90=8D?= <942005050@qq.com> Date: Mon, 15 Jan 2024 14:05:29 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=89=A9=E5=93=81=E5=9F=BA=E7=A1=80?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=20=E6=A0=B9=E6=8D=AE=E7=94=9F=E6=95=88?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E5=92=8C=E6=9C=89=E6=95=88=E5=A4=A9=E6=95=B0?= =?UTF-8?q?=20=E8=87=AA=E5=8A=A8=E8=AE=A1=E7=AE=97=E5=A4=B1=E6=95=88?= =?UTF-8?q?=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../itemManage/itembasic/index.vue | 55 ++++++++++++------- .../itemManage/itembasic/itembasic.data.ts | 4 +- 2 files changed, 38 insertions(+), 21 deletions(-) diff --git a/src/views/wms/basicDataManage/itemManage/itembasic/index.vue b/src/views/wms/basicDataManage/itemManage/itembasic/index.vue index aa9d89bcd..be3a08f10 100644 --- a/src/views/wms/basicDataManage/itemManage/itembasic/index.vue +++ b/src/views/wms/basicDataManage/itemManage/itembasic/index.vue @@ -44,6 +44,7 @@ :apiUpdate="ItembasicApi.updateItembasic" :apiCreate="ItembasicApi.createItembasic" :isBusiness="false" + @onChange="onChange" /> @@ -190,28 +191,42 @@ const basicFormRef = ref() const openForm = (type: string, id?: number) => { basicFormRef.value.open(type, id) } + +/** + * 监听改变事件 + * @param field 当前操作字段 + * @param cur 改变后值 + */ +const onChange = (field, cur) => { + // 当有效天数 和 生效时间 发生变化 + if (field == 'validityDays' || field == 'activeTime') { + // 根据 有效天数 和 生效时间 计算 失效时间 + basicFormRef.value.formRef.formModel.expireTime = basicFormRef.value.formRef.formModel.activeTime + basicFormRef.value.formRef.formModel.validityDays * 24 * 60 * 60 * 1000 + } +} + // form表单提交 const formsSuccess = async (formType,data) => { - var isHave =Itembasic.allSchemas.formSchema.some(function (item) { - return item.field === 'activeTime' || item.field === 'expireTime'; - }); - if(isHave){ - if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){ - message.error('失效时间要大于生效时间') - return; - } - } - if(data.activeTime==0)data.activeTime = null; - if(data.expireTime==0)data.expireTime = null; - if (formType === 'create') { - await ItembasicApi.createItembasic(data) - message.success(t('common.createSuccess')) - } else { - await ItembasicApi.updateItembasic(data) - message.success(t('common.updateSuccess')) - } - basicFormRef.value.dialogVisible = false - getList() + var isHave =Itembasic.allSchemas.formSchema.some(function (item) { + return item.field === 'activeTime' || item.field === 'expireTime'; + }) + if(isHave){ + if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){ + message.error('失效时间要大于生效时间') + return + } + } + if(data.activeTime==0)data.activeTime = null; + if(data.expireTime==0)data.expireTime = null; + if (formType === 'create') { + await ItembasicApi.createItembasic(data) + message.success(t('common.createSuccess')) + } else { + await ItembasicApi.updateItembasic(data) + message.success(t('common.updateSuccess')) + } + basicFormRef.value.dialogVisible = false + getList() } const detailRef = ref() diff --git a/src/views/wms/basicDataManage/itemManage/itembasic/itembasic.data.ts b/src/views/wms/basicDataManage/itemManage/itembasic/itembasic.data.ts index a64b80195..33be69fc9 100644 --- a/src/views/wms/basicDataManage/itemManage/itembasic/itembasic.data.ts +++ b/src/views/wms/basicDataManage/itemManage/itembasic/itembasic.data.ts @@ -317,7 +317,8 @@ export const Itembasic = useCrudSchemas(reactive([ form: { component: 'InputNumber', componentProps: { - min: 0 + min: 0, + precision: 0 } }, }, @@ -386,6 +387,7 @@ export const Itembasic = useCrudSchemas(reactive([ type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', + disabled: true } }, }, From 5b11fe9e4d13add17c7337a981534460ddb77e0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E8=96=AA=E5=90=8D?= <942005050@qq.com> Date: Mon, 15 Jan 2024 14:35:06 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E5=89=8D=E7=BD=AE=E6=9D=A1=E4=BB=B6=E7=A9=BA=E7=BB=99=E5=87=BA?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + src/components/BasicForm/src/BasicForm.vue | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a51323c2d..5c8a587fa 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ form: { searchCondition: [{ key:'productionLineCode', // 查询列表中字段 value:'prodLine', // 指主表某字段 + message: '请选择生产线信息!', // 当前置条件为空时 弹出信息提示 isMainValue: true // 表示查询条件是主表的字段的值 }, { diff --git a/src/components/BasicForm/src/BasicForm.vue b/src/components/BasicForm/src/BasicForm.vue index 6fd86866e..1bb6b76b1 100644 --- a/src/components/BasicForm/src/BasicForm.vue +++ b/src/components/BasicForm/src/BasicForm.vue @@ -300,7 +300,7 @@ const opensearchTable = ( isNull = true } if (isNull) { - message.warning(searchCondition[i].message) + message.warning(searchCondition[i].message?searchCondition[i].message:'前置条件未选择!') return } } else {