diff --git a/src/api/inspection/inspectionroute.js b/src/api/inspection/inspectionroute.js index 03ab1db..4d8e5c5 100644 --- a/src/api/inspection/inspectionroute.js +++ b/src/api/inspection/inspectionroute.js @@ -42,7 +42,7 @@ export const add = (row) => { export const update = (row) => { return request({ - url: '/api/inspection/inspectionRoute/submit', + url: '/api/inspection/inspectionRoute/update', method: 'post', data: row }) diff --git a/src/views/inspection/inspectionrouteDetail.vue b/src/views/inspection/inspectionrouteDetail.vue index c211d70..109c017 100644 --- a/src/views/inspection/inspectionrouteDetail.vue +++ b/src/views/inspection/inspectionrouteDetail.vue @@ -13,6 +13,11 @@ @click="handleFormSubmit" v-if="addUpdateShowButton"> 确定 + + 修改 @@ -28,6 +33,7 @@ data() { return { addUpdateShowButton:{}, + shouldShowButton:{}, readonlyForm:{}, frame_class: '', form: {}, @@ -39,7 +45,7 @@ { label: "路线编号", prop: "routeNo", - display: true, + disabled: true, span: 8, }, { @@ -132,6 +138,7 @@ if(["view"].includes(this.$route.query.frameMode)){ this.readonlyForm = true; this.addUpdateShowButton = false; + this.shouldShowButton=true; this.frame_class = 'frame_class'; }else{ const routeNo = this.findObject(this.option.column, "routeNo"); @@ -143,6 +150,7 @@ cancelReason.display = false; this.readonlyForm = false; this.addUpdateShowButton = true; + this.shouldShowButton=false; this.frame_class = null; } this.SearchDetail(); @@ -163,29 +171,58 @@ }, // 处理表单提交 Submit() { - this.$confirm("是否新增所填数据?", "提示", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(() => { - this.form.checkStatus="1" - add(this.form).then(()=>{ - this.$router.push({ - path: "/inspection/inspectionroute", - query: { - }, - }); - this.$message({ - type: "success", - message: "操作成功!" + if(this.$route.query.frameMode=="add"){ + this.$confirm("是否新增所填数据?", "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning" + }).then(() => { + add(this.form).then(()=>{ + this.$router.push({ + path: "/inspection/inspectionroute", + query: { + }, + }); + this.$message({ + type: "success", + message: "操作成功!" + }); + }).catch((error) => { + this.$message({ + type: "error", + message: "操作失败!" + }); }); - }).catch((error) => { - this.$message({ - type: "error", - message: "操作失败!" + }); + }else { + this.$confirm("是否修改所填数据?", "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning" + }).then(() => { + update(this.form).then(() => { + this.$router.push({ + path: "/inspection/inspectionroute", + query: {}, + }); + this.$message({ + type: "success", + message: "操作成功!" + }); + }).catch((error) => { + this.$message({ + type: "error", + message: "操作失败!" + }); }); }); - }); + } + }, + seachToUpdate () { + this.shouldShowButton=false; + this.addUpdateShowButton=true; + this.readonlyForm=false; + this.frame_class = null; }, SearchDetail() { if (["view"].includes(this.$route.query.frameMode)) {