修正处理追加

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) => {
return request({
url: '/api/inspection/inspectionRoute/submit',
url: '/api/inspection/inspectionRoute/update',
method: 'post',
data: row
})

@ -13,6 +13,11 @@
@click="handleFormSubmit"
v-if="addUpdateShowButton">
确定</el-button>
<el-button type="primary"
size="small"
@click="seachToUpdate"
v-if="shouldShowButton">
修改</el-button>
</span>
</div>
</basic-container>
@ -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,12 +171,12 @@
},
//
Submit() {
if(this.$route.query.frameMode=="add"){
this.$confirm("是否新增所填数据?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.form.checkStatus="1"
add(this.form).then(()=>{
this.$router.push({
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() {
if (["view"].includes(this.$route.query.frameMode)) {

Loading…
Cancel
Save