|
|
@ -393,6 +393,7 @@ export default { |
|
|
|
this.$emit('setEmptyInfo'); |
|
|
|
setTimeout(() => { |
|
|
|
const info = this.$t.storage.getStorageSync('infoList'); |
|
|
|
console.log('info: ', info); |
|
|
|
if (info !== 'null') { |
|
|
|
this.infoList = JSON.parse(info); |
|
|
|
} |
|
|
@ -404,7 +405,6 @@ export default { |
|
|
|
methods: { |
|
|
|
changeVal(e, index, itemIndex) { |
|
|
|
const info = this.infoList[index][itemIndex]; |
|
|
|
|
|
|
|
if (info.value === null) { |
|
|
|
info.value = e.toString(); |
|
|
|
} else { |
|
|
@ -838,9 +838,13 @@ export default { |
|
|
|
async updateTrainee(item) { |
|
|
|
try { |
|
|
|
if (!this.validationRequired(item)) return; |
|
|
|
this.$t.ui.showLoading(); |
|
|
|
const params = this.setParams(item); |
|
|
|
await this.$u.api.updateTrainee(params); |
|
|
|
this.$t.ui.hideLoading(); |
|
|
|
this.$emit('showToast', 'success', `${item.name}修改成功`); |
|
|
|
} catch (error) { |
|
|
|
this.$t.ui.hideLoading(); |
|
|
|
console.error('error: ', error); |
|
|
|
this.$emit('showToast', 'default', `${item.name}修改失败`, false); |
|
|
|
} |
|
|
@ -949,6 +953,89 @@ export default { |
|
|
|
} |
|
|
|
return params; |
|
|
|
}, |
|
|
|
|
|
|
|
// 提交完清空数据 |
|
|
|
setEmptyInfo() { |
|
|
|
const array = [...this.infoList]; |
|
|
|
array.forEach(info => { |
|
|
|
info.forEach(item => { |
|
|
|
switch (item.type) { |
|
|
|
case 14: |
|
|
|
if (item.label === 'apoeGene') { |
|
|
|
this.$set(item, 'value', '0'); |
|
|
|
} else if (item.label === 'isStrongFlavour' || item.label === 'isMoreOil') { |
|
|
|
this.$set(item, 'value', 0); |
|
|
|
} else { |
|
|
|
this.$set(item, 'value', null); |
|
|
|
} |
|
|
|
break; |
|
|
|
case 5: |
|
|
|
this.$set(item, 'value', []); |
|
|
|
item.checkList.forEach(list => { |
|
|
|
list.checked = false; |
|
|
|
}); |
|
|
|
break; |
|
|
|
case 10: |
|
|
|
this.$set(item, 'value', 0); |
|
|
|
break; |
|
|
|
case 11: |
|
|
|
this.$set(item, 'value', 0); |
|
|
|
break; |
|
|
|
case 12: |
|
|
|
this.$set(item, 'value', 0); |
|
|
|
break; |
|
|
|
case 13: |
|
|
|
this.$set(item, 'value', 0); |
|
|
|
break; |
|
|
|
default: |
|
|
|
this.$set(item, 'value', null); |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
if (item.showType === 1) { |
|
|
|
item.show = true; |
|
|
|
if (item.label === 'physicalAct') { |
|
|
|
item.value = '低'; |
|
|
|
} |
|
|
|
if (item.label === 'isLikeMeat') { |
|
|
|
item.value = 1; |
|
|
|
} |
|
|
|
} else { |
|
|
|
item.show = false; |
|
|
|
} |
|
|
|
if (item.otherValue) { |
|
|
|
item.otherValue = null; |
|
|
|
} |
|
|
|
if (item.value1) { |
|
|
|
item.value1 = null; |
|
|
|
} |
|
|
|
if (item.value2) { |
|
|
|
item.value2 = null; |
|
|
|
} |
|
|
|
if (item.value3) { |
|
|
|
item.value3 = null; |
|
|
|
} |
|
|
|
if (item.classesValue) { |
|
|
|
item.classesValue = null; |
|
|
|
} |
|
|
|
if (item.frequencyValue) { |
|
|
|
item.frequencyValue = null; |
|
|
|
} |
|
|
|
if (item.showClasses) { |
|
|
|
item.showClasses = false; |
|
|
|
item.showOther = false; |
|
|
|
item.classesValue = null; |
|
|
|
item.frequencyValue = null; |
|
|
|
item.otherValue = null; |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.infoList = [...array]; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
destroyed() { |
|
|
|
this.setEmptyInfo(); |
|
|
|
}, |
|
|
|
}; |
|
|
|
</script> |
|
|
|