| | |
| | | </template> |
| | | |
| | | <script> |
| | | import {getDetailById} from '../service' |
| | | export default { |
| | | name: 'CraftDialog', |
| | | props: { |
| | |
| | | reportData: { |
| | | type: Object, |
| | | default: () => { } |
| | | } |
| | | },id: { |
| | | type: [String, Number], |
| | | default: "", |
| | | // required: true, |
| | | }, |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | modelValue: { |
| | | handler(val) { |
| | | this.dialogVisible = val; |
| | | if (val && this.id) { |
| | | this.fetchDetail(); |
| | | } |
| | | }, |
| | | immediate: true |
| | | }, |
| | | reportData: { |
| | | handler(val) { |
| | | if (val) { |
| | | this.form.reportNo = val.reportNo || ''; |
| | | this.form.reportName = val.reportName || ''; |
| | | } |
| | | }, |
| | | immediate: true |
| | | } |
| | | id(val) { |
| | | if (this.modelValue && val) { |
| | | this.fetchDetail(); |
| | | } |
| | | }, |
| | | }, |
| | | methods: { |
| | | async fetchDetail() { |
| | | try { |
| | | const res = await getDetailById({ id: this.id }); |
| | | if (res) { |
| | | this.evaluateInfo = { ...res }; |
| | | this.form.reportNo = res.reportCode || ""; |
| | | this.form.reportName = res.reportTitle || ""; |
| | | // 详情回显分数 |
| | | if (res.evaluateScore) { |
| | | if ( |
| | | this.type === "detail" && |
| | | typeof res.evaluateScore === "string" |
| | | ) { |
| | | const scoreArr = res.evaluateScore |
| | | .split(",") |
| | | .map((s) => Number(s)); |
| | | this.criteriaList.forEach((item, idx) => { |
| | | item.score = scoreArr[idx] || 0; |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | } catch (e) { |
| | | this.$message && this.$message.error("获取详情失败"); |
| | | } |
| | | }, |
| | | handleClose() { |
| | | this.$emit('update:modelValue', false); |
| | | }, |