Browse Source

fix: 修改药物使用记录验证必填项逻辑

develop
song 4 years ago
parent
commit
14ad8ee302
  1. 1
      CHANGELOG.md
  2. 13
      src/components/Info/Info.vue
  3. 70
      src/pagesProject/project/components/ConfigInfo/components/MedicineDetail.vue

1
CHANGELOG.md

@ -187,6 +187,7 @@
- | 提示信息显示bug及日常任务收缩问题 | [f2f06c5](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/f2f06c5)
- | 插件bug解决 | [41257eb](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/41257eb)
- | 收到消息修改任务状态 | [c378063](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/c378063)
- | 新建长者信息清除数据 | [df5d3f4](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/df5d3f4)
- | 日历无任务时添加小绿点,时间轴刻度无任务不显示时分 | [0f90868](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/0f90868)
- | 日常任务html数据查验 | [880ce5c](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/880ce5c)
- | 日常任务插件遍历时的key值修改 | [cd26285](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/cd26285)

13
src/components/Info/Info.vue

@ -391,10 +391,13 @@ export default {
this.$nextTick(() => {
if (!this.isEdit) {
this.$emit('setEmptyInfo');
const info = this.$t.storage.getStorageSync('infoList');
if (info !== 'null' && !this.isEdit) {
this.infoList = JSON.parse(info);
}
setTimeout(() => {
const info = this.$t.storage.getStorageSync('infoList');
console.log('info: ', info);
if (info !== 'null') {
this.infoList = JSON.parse(info);
}
}, 300);
}
});
},
@ -668,10 +671,8 @@ export default {
const info = this.infoList[i];
for (let j = 0; j < info.length; j++) {
const item = info[j];
console.log('item: ', item);
if (item.type !== 5) {
if (item.value === null) {
console.log('item.name', item.name);
this.$emit('showToast', 'default', `请填写${item.name}`, false);
isComplete = false;
break;

70
src/pagesProject/project/components/ConfigInfo/components/MedicineDetail.vue

@ -132,7 +132,7 @@ export default {
minute: true,
second: true,
},
isShow: false,
isShow: true,
originalValue: null,
};
},
@ -250,11 +250,11 @@ export default {
try {
const params = this.params;
if (!this.validationRequired(params)) return;
params.projectId = this.projectId;
await this.$u.api.addMedicine(params);
this.$emit('showToast', 'success', '药物使用添加成功');
this.show = false;
this.$emit('closeAdd');
// params.projectId = this.projectId;
// await this.$u.api.addMedicine(params);
// this.$emit('showToast', 'success', '使');
// this.show = false;
// this.$emit('closeAdd');
} catch (error) {
console.error('error: ', error);
this.$emit('showToast', 'error', '药物使用添加失败');
@ -268,55 +268,31 @@ export default {
const info = this.medicineInfo[i];
for (let j = 0; j < info.date.length; j++) {
const item = info.date[j];
switch (item.type) {
case 2: {
if (this.isShow && !item.value) {
this.$emit('showToast', 'default', '请选择测评时间', false);
isComplete = false;
}
if (item.type === 2) {
if (this.isShow && !item.value) {
this.$emit('showToast', 'default', '请选择测评时间', false);
isComplete = false;
break;
}
case 3: {
if (this.isShow && !item.value) {
this.$emit('showToast', 'default', `请填写${item.name}`, false);
isComplete = false;
}
} else if (item.type === 3) {
if (this.isShow && !item.value) {
this.$emit('showToast', 'default', `请填写${item.name}`, false);
isComplete = false;
break;
}
case 4: {
if (!item.value && !item.checked) {
this.$emit('showToast', 'default', `请填写${item.name}`, false);
isComplete = false;
}
} else if (item.type === 4) {
if (!item.value && !item.checked) {
this.$emit('showToast', 'default', `请填写${item.name}`, false);
isComplete = false;
break;
}
default: {
if (!item.value) {
this.$emit('showToast', 'default', `请填写${item.name}`, false);
isComplete = false;
}
} else {
if (!item.value) {
this.$emit('showToast', 'default', `请填写${item.name}`, false);
isComplete = false;
break;
}
}
// if (item.type === 2) {
// if (item.chooseTime && !item.value) {
// this.$t.ui.showToast(``);
// isComplete = false;
// break;
// }
// } else if (item.type === 4) {
// if (!item.value && !item.checked) {
// this.$t.ui.showToast(`${item.name}`);
// isComplete = false;
// break;
// }
// } else {
// if (!item.value) {
// this.$t.ui.showToast(`${item.name}`);
// isComplete = false;
// break;
// }
// }
}
if (!isComplete) {
break;
@ -335,7 +311,7 @@ export default {
for (let j = 0; j < info.date.length; j++) {
const item = info.date[j];
if (item.type === 2) {
this.isShow = false;
this.isShow = true;
}
if (item.type === 4) {
item.checked = false;

Loading…
Cancel
Save