修正处理追加

main
yangzhicheng 11 months ago
parent 9a87d835b3
commit b9ee01555f
  1. 2
      src/api/inspection/inspectionroute.js
  2. 41
      src/views/inspection/inspectionrouteDetail.vue

@ -42,7 +42,7 @@ export const add = (row) => {
export const update = (row) => { export const update = (row) => {
return request({ return request({
url: '/api/inspection/inspectionRoute/submit', url: '/api/inspection/inspectionRoute/update',
method: 'post', method: 'post',
data: row data: row
}) })

@ -13,6 +13,11 @@
@click="handleFormSubmit" @click="handleFormSubmit"
v-if="addUpdateShowButton"> v-if="addUpdateShowButton">
确定</el-button> 确定</el-button>
<el-button type="primary"
size="small"
@click="seachToUpdate"
v-if="shouldShowButton">
修改</el-button>
</span> </span>
</div> </div>
</basic-container> </basic-container>
@ -28,6 +33,7 @@
data() { data() {
return { return {
addUpdateShowButton:{}, addUpdateShowButton:{},
shouldShowButton:{},
readonlyForm:{}, readonlyForm:{},
frame_class: '', frame_class: '',
form: {}, form: {},
@ -39,7 +45,7 @@
{ {
label: "路线编号", label: "路线编号",
prop: "routeNo", prop: "routeNo",
display: true, disabled: true,
span: 8, span: 8,
}, },
{ {
@ -132,6 +138,7 @@
if(["view"].includes(this.$route.query.frameMode)){ if(["view"].includes(this.$route.query.frameMode)){
this.readonlyForm = true; this.readonlyForm = true;
this.addUpdateShowButton = false; this.addUpdateShowButton = false;
this.shouldShowButton=true;
this.frame_class = 'frame_class'; this.frame_class = 'frame_class';
}else{ }else{
const routeNo = this.findObject(this.option.column, "routeNo"); const routeNo = this.findObject(this.option.column, "routeNo");
@ -143,6 +150,7 @@
cancelReason.display = false; cancelReason.display = false;
this.readonlyForm = false; this.readonlyForm = false;
this.addUpdateShowButton = true; this.addUpdateShowButton = true;
this.shouldShowButton=false;
this.frame_class = null; this.frame_class = null;
} }
this.SearchDetail(); this.SearchDetail();
@ -163,12 +171,12 @@
}, },
// //
Submit() { Submit() {
if(this.$route.query.frameMode=="add"){
this.$confirm("是否新增所填数据?", "提示", { this.$confirm("是否新增所填数据?", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
}).then(() => { }).then(() => {
this.form.checkStatus="1"
add(this.form).then(()=>{ add(this.form).then(()=>{
this.$router.push({ this.$router.push({
path: "/inspection/inspectionroute", path: "/inspection/inspectionroute",
@ -186,6 +194,35 @@
}); });
}); });
}); });
}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() { SearchDetail() {
if (["view"].includes(this.$route.query.frameMode)) { if (["view"].includes(this.$route.query.frameMode)) {

Loading…
Cancel
Save