diff --git a/src/views/modules/case/typicalcase-add-or-update.vue b/src/views/modules/case/typicalcase-add-or-update.vue index a5563d43..6a59bc71 100644 --- a/src/views/modules/case/typicalcase-add-or-update.vue +++ b/src/views/modules/case/typicalcase-add-or-update.vue @@ -178,6 +178,8 @@ export default { }, uploadUrl: '', dataForm: { + id: '', + state: 1, caseTitle: '', caseNumber: 0, mainPicture: '', @@ -188,6 +190,10 @@ export default { requiredFlag: false } }, + mounted () { + this.dataForm.id = this.$route.query.id + this.init() + }, computed: { dataRule () { return { @@ -333,8 +339,24 @@ export default { this.visible = true this.$nextTick(() => { this.$refs['dataForm'].resetFields() + if (this.dataForm.id) { + this.getInfo() + } }) }, + // 获取信息 + getInfo () { + this.$http.get(`/cloudAnalysis/typicalcase/${this.dataForm.id}`).then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg) + } + this.dataForm = { + ...this.dataForm, + ...res.data + } + }).catch(() => {}) + this.requiredFlag = true + }, // 表单提交 dataFormSubmitHandle: debounce(function () { this.$refs['dataForm'].validate((valid) => { diff --git a/src/views/modules/case/typicalcase-list.vue b/src/views/modules/case/typicalcase-list.vue index 6e9a83f7..3489aa6a 100644 --- a/src/views/modules/case/typicalcase-list.vue +++ b/src/views/modules/case/typicalcase-list.vue @@ -115,7 +115,7 @@ export default { }, methods: { detailHandle (id) { - this.$parent.selectComponent = 'CaseInfoDetailView' + this.$parent.selectComponent = 'CaseInfoAdd' this.$router.push({ path: '/case-typicalcase', query: { id: id } }) }, formatState: function (row, column) {