|
|
@@ -530,37 +530,118 @@
|
|
|
});
|
|
|
},
|
|
|
|
|
|
+ // applyStatus(actionType) {
|
|
|
+ // if (actionType !== 1) return;
|
|
|
+
|
|
|
+ // const statusMap = {
|
|
|
+ // 1: { form: 2, item: 2 },
|
|
|
+ // 2: { form: 3, item: 3 }
|
|
|
+ // };
|
|
|
+
|
|
|
+ // const config = statusMap[this.type];
|
|
|
+ // if (!config) return;
|
|
|
+
|
|
|
+ // this.form.status = config.form;
|
|
|
+ // this.form.items.forEach((item) => {
|
|
|
+ // item.status = config.item;
|
|
|
+ // });
|
|
|
+ // },
|
|
|
+
|
|
|
applyStatus(actionType) {
|
|
|
if (actionType !== 1) return;
|
|
|
|
|
|
- const statusMap = {
|
|
|
- 1: { form: 2, item: 2 },
|
|
|
- 2: { form: 3, item: 3 }
|
|
|
+ const map = {
|
|
|
+ 1: {
|
|
|
+ resultField: 'selfCheckResult',
|
|
|
+ itemStatus: 2,
|
|
|
+ formStatus: 2
|
|
|
+ },
|
|
|
+ 2: {
|
|
|
+ resultField: 'specialCheckResult',
|
|
|
+ itemStatus: 3,
|
|
|
+ formStatus: 3
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
- const config = statusMap[this.type];
|
|
|
+ const config = map[this.type];
|
|
|
if (!config) return;
|
|
|
|
|
|
- this.form.status = config.form;
|
|
|
+ const { resultField, itemStatus, formStatus } = config;
|
|
|
+
|
|
|
this.form.items.forEach((item) => {
|
|
|
- item.status = config.item;
|
|
|
+ if (item[resultField] === 1) {
|
|
|
+ item.status = itemStatus;
|
|
|
+ }
|
|
|
});
|
|
|
+
|
|
|
+ const allPass = this.form.items.every(
|
|
|
+ (item) => item[resultField] === 1
|
|
|
+ );
|
|
|
+
|
|
|
+ if (allPass) {
|
|
|
+ this.form.status = formStatus;
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
+ // validateCheckResult() {
|
|
|
+ // const map = {
|
|
|
+ // 1: ['selfCheckResult', '请填写完整自检结果后再提交'],
|
|
|
+ // 2: ['specialCheckResult', '请填写完整专检结果后再提交']
|
|
|
+ // };
|
|
|
+
|
|
|
+ // const config = map[this.type];
|
|
|
+ // if (!config) return true;
|
|
|
+
|
|
|
+ // const [field, msg] = config;
|
|
|
+ // if (this.form.items.some((item) => !item[field])) {
|
|
|
+ // this.$message.warning(msg);
|
|
|
+ // return false;
|
|
|
+ // }
|
|
|
+ // return true;
|
|
|
+ // },
|
|
|
+
|
|
|
validateCheckResult() {
|
|
|
const map = {
|
|
|
- 1: ['selfCheckResult', '请填写完整自检结果后再提交'],
|
|
|
- 2: ['specialCheckResult', '请填写完整专检结果后再提交']
|
|
|
+ 1: {
|
|
|
+ field: 'selfCheckResult',
|
|
|
+ checkStatus: 0,
|
|
|
+ entrustStatus: 1
|
|
|
+ },
|
|
|
+ 2: {
|
|
|
+ field: 'specialCheckResult',
|
|
|
+ checkStatus: 2,
|
|
|
+ entrustStatus: 1
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
const config = map[this.type];
|
|
|
if (!config) return true;
|
|
|
|
|
|
- const [field, msg] = config;
|
|
|
- if (this.form.items.some((item) => !item[field])) {
|
|
|
- this.$message.warning(msg);
|
|
|
+ const { field, checkStatus, entrustStatus } = config;
|
|
|
+ const hasEntrustPending = this.form.items.some(
|
|
|
+ (item) =>
|
|
|
+ item.status === entrustStatus &&
|
|
|
+ (item[field] === null || item[field] === undefined)
|
|
|
+ );
|
|
|
+
|
|
|
+ if (hasEntrustPending) {
|
|
|
+ this.$message.warning('请托结果还没有返回');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ const checkItems = this.form.items.filter(
|
|
|
+ (item) => item.status === checkStatus
|
|
|
+ );
|
|
|
+
|
|
|
+ if (checkItems.some((item) => item[field] == null)) {
|
|
|
+ this.$message.warning(
|
|
|
+ this.type === 1
|
|
|
+ ? '请填写完整自检结果后再提交'
|
|
|
+ : '请填写完整专检结果后再提交'
|
|
|
+ );
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
return true;
|
|
|
},
|
|
|
|