Browse Source

物品基础信息 根据生效时间和有效天数 自动计算失效时间

master
陈薪名 10 months ago
parent
commit
4489c23fe4
  1. 19
      src/views/wms/basicDataManage/itemManage/itembasic/index.vue
  2. 4
      src/views/wms/basicDataManage/itemManage/itembasic/itembasic.data.ts

19
src/views/wms/basicDataManage/itemManage/itembasic/index.vue

@ -44,6 +44,7 @@
:apiUpdate="ItembasicApi.updateItembasic"
:apiCreate="ItembasicApi.createItembasic"
:isBusiness="false"
@onChange="onChange"
/>
<!-- 详情 -->
@ -190,15 +191,29 @@ 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;
return
}
}
if(data.activeTime==0)data.activeTime = null;

4
src/views/wms/basicDataManage/itemManage/itembasic/itembasic.data.ts

@ -317,7 +317,8 @@ export const Itembasic = useCrudSchemas(reactive<CrudSchema[]>([
form: {
component: 'InputNumber',
componentProps: {
min: 0
min: 0,
precision: 0
}
},
},
@ -386,6 +387,7 @@ export const Itembasic = useCrudSchemas(reactive<CrudSchema[]>([
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
disabled: true
}
},
},

Loading…
Cancel
Save