Browse Source

修复测试bug

master
ljlong_2630 8 months ago
parent
commit
5232de2cb3
  1. 31
      src/views/eam/device/devicemaintenancejob/index.vue
  2. 28
      src/views/eam/mold/moldmaintenancejob/index.vue

31
src/views/eam/device/devicemaintenancejob/index.vue

@ -753,8 +753,10 @@ function turnOrder(type, row) {
//
function finishOrder(row) {
if (validateRow(row)) {
showTempIdeaRefView.value = true
tempIdeaRefViewData.value = row
}
}
function confirmFinish(row) {
@ -926,6 +928,7 @@ const detailSubmitForm = async (formType, data, formRef, tableList) => {
message.success(t('common.updateSuccess'))
}
formRef.dialogVisible = false
await detailRef.value.getList()
//
detailRef.value.tableObject.tableList.forEach(item=>{
if (item.itemNumbers?.length>0) {
@ -935,9 +938,7 @@ const detailSubmitForm = async (formType, data, formRef, tableList) => {
})
item.itemNumbers1 = str.substring(0, str.length - 1)
}
})
await detailRef.value.getList()
await getList()
} finally {
@ -1015,6 +1016,7 @@ const confirmIsTemporary = () => {
confirmFinish(tempIdeaRefViewData.value)
}
const cancel = () => {
showTempIdeaRefView.value = false;
};
@ -1034,6 +1036,31 @@ const judgeIfDeviceRole = () => {
}
}
const validateRow = (row) => {
let flag = true;
const validateResult = ref([]);
for (const [key, rules] of Object.entries(DeviceMaintenanceMainRules)) {
for (const rule of rules) {
if (rule.required) {
const schemaItem = DeviceMaintenanceMain.allSchemas.formSchema.find(item => item.field == key);
if (schemaItem && (row[key] === undefined || row[key] === null || row[key] === '')) {
validateResult.value.push({
msg: '[' + schemaItem.label + ']'
});
flag = false;
}
}
}
}
if (!flag) {
// HTML
const errorMessage = validateResult.value.map(error => error.msg).join(', ');
message.alert('请填写以下必填项:'+errorMessage); // 使HTML
return false; //
}
//
return true;
};
/** 初始化 **/
onMounted(async () => {

28
src/views/eam/mold/moldmaintenancejob/index.vue

@ -513,8 +513,10 @@ function turnOrder() { }
//
function finishOrder(row) {
if (validateRow(row)) {
showTempIdeaRefView.value = true
tempIdeaRefViewData.value = row
}
}
function confirmFinish(row) {
@ -984,6 +986,32 @@ const cancel = () => {
showTempIdeaRefView.value = false;
};
const validateRow = (row) => {
let flag = true;
const validateResult = ref([]);
for (const [key, rules] of Object.entries(MoldMaintenanceMainRules)) {
for (const rule of rules) {
if (rule.required) {
const schemaItem = MoldMaintenanceMain.allSchemas.formSchema.find(item => item.field == key);
if (schemaItem && (row[key] === undefined || row[key] === null || row[key] === '')) {
validateResult.value.push({
msg: '[' + schemaItem.label + ']'
});
flag = false;
}
}
}
}
if (!flag) {
// HTML
const errorMessage = validateResult.value.map(error => error.msg).join(', ');
message.alert('请填写以下必填项:'+errorMessage); // 使HTML
return false; //
}
//
return true;
};
/** 初始化 **/
onMounted(async () => {

Loading…
Cancel
Save