巡检对象 详细追加

main
weitingdong 11 months ago
parent b488d8493a
commit 572d7f03ef
  1. 10
      src/api/inspection/inspectionobject.js
  2. 57
      src/views/inspection/inspectionobject.vue
  3. 79
      src/views/inspection/inspectionobjectDetail.vue

@ -42,7 +42,7 @@ export const add = (row) => {
export const update = (row) => { export const update = (row) => {
return request({ return request({
url: '/api/inspection/inspectionobject/submit', url: '/api/inspection/inspectionobject/update',
method: 'post', method: 'post',
data: row data: row
}) })
@ -50,20 +50,20 @@ export const update = (row) => {
export const takeEffect = (ids) => { export const takeEffect = (ids) => {
return request({ return request({
url: '/api/inspection/inspectionRoute/takeEffect', url: '/api/inspection/inspectionobject/takeEffect',
method: 'post', method: 'post',
params: { params: {
ids, ids,
} }
}) })
} }
export const lapse = (ids) => { export const lapse = (ids, reason) => {
return request({ return request({
url: '/api/inspection/inspectionRoute/lapse', url: '/api/inspection/inspectionobject/lapse',
method: 'post', method: 'post',
params: { params: {
ids, ids,
reason,
} }
}) })
} }

@ -56,6 +56,22 @@
<el-button v-if="permission.inspectionroute_delete" @click="rowDel(row)" type="text">删除</el-button> <el-button v-if="permission.inspectionroute_delete" @click="rowDel(row)" type="text">删除</el-button>
</template> </template>
</avue-crud> </avue-crud>
<el-dialog title="失效"
append-to-body
:visible.sync="cancelBox"
width="555px">
<avue-form :option="cancelOption" v-model="cancelForm" ref="cancelForm">
</avue-form>
<div class="container">
<span>
<el-button type="primary"
size="small"
plain
@click="handleDetailCancel">失效
</el-button>
</span>
</div>
</el-dialog>
</basic-container> </basic-container>
</template> </template>
@ -72,6 +88,7 @@
search:{}, search:{},
query: {}, query: {},
loading: true, loading: true,
cancelBox: false,
page: { page: {
pageSize: 10, pageSize: 10,
currentPage: 1, currentPage: 1,
@ -157,12 +174,18 @@
label: "对象状态", label: "对象状态",
prop: "istatus", prop: "istatus",
search:true, search:true,
type: "select",
span:4.5, span:4.5,
rules: [{ rules: [{
required: true, required: true,
message: "请输入对象状态", message: "请输入对象状态",
trigger: "blur" trigger: "blur"
}] }],
dicUrl: "/api/daf-system/dict/dictionary?code=istatus",
props: {
label: "dictValue",
value: "dictKey"
}
}, },
{ {
label: "KKS编号", label: "KKS编号",
@ -185,6 +208,25 @@
}, },
] ]
}, },
cancelForm: {},
cancelOption: {
height: 'auto',
calcHeight: 210,
emptyBtn:false,
submitBtn:false,
tip: false,
border: true,
index: false,
selection: true,
column: [
{
label: "取消原因",
type: "textarea",
prop: "cancelReason",
span: 24
},
]
},
data: [] data: []
}; };
}, },
@ -246,6 +288,8 @@
return remove(row.id); return remove(row.id);
}) })
.then(() => { .then(() => {
const cancelReason = this.findObject(this.cancelOption.column, "cancelReason");
cancelReason.value = ' ';
this.onLoad(this.page); this.onLoad(this.page);
this.$message({ this.$message({
type: "success", type: "success",
@ -342,21 +386,26 @@
this.$message.warning("请选择至少一条数据"); this.$message.warning("请选择至少一条数据");
return; return;
} }
this.cancelBox = true;
},
handleDetailCancel() {
this.$confirm("是否将选择数据改为失效状态?", { this.$confirm("是否将选择数据改为失效状态?", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
}) })
.then(() => { .then(() => {
return lapse(this.ids); return lapse(this.ids, this.cancelForm.cancelReason);
}) })
.then(() => { .then(() => {
this.cancelForm.cancelReason = '';
this.cancelBox = false;
this.onLoad(this.page); this.onLoad(this.page);
this.$message({ this.$message({
type: "success", type: "success",
message: "操作成功!" message: "操作成功!"
}); });
this.$refs.crud.toggleSelection(); this.$refs.crud.toggleSelection()
}); });
}, },
handleExport() { handleExport() {
@ -365,7 +414,7 @@
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
}).then(() => { }).then(() => {
expUtil.excelExport(`/api/inspection/inspectionRoute/export?daf-auth=${getToken()}`, this.search, ['stations', "istatus"]); expUtil.excelExport(`/api/inspection/inspectionobject/export?daf-auth=${getToken()}`, this.search, ['stations', "istatus", "objectName"]);
}); });
}, },
beforeOpen(done, type) { beforeOpen(done, type) {

@ -11,23 +11,29 @@
<el-button type="primary" <el-button type="primary"
size="large" size="large"
@click="handleFormSubmit" @click="handleFormSubmit"
> 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>
</template> </template>
<script> <script>
import {getList, getDetail, add, update, remove, takeEffect, lapse} from "@/api/inspection/inspectionobject"; import {getList, getDetail, add, update, remove, takeEffect, lapse} from "@/api/inspection/inspectionobject";
import {mapGetters} from "vuex"; import {mapGetters} from "vuex";
import {getToken} from "@/util/auth"; import {getToken} from "@/util/auth";
export default { export default {
name: "inspectionobjectDetail", name: "inspectionrouteDetail",
data() { data() {
return { return {
addUpdateShowButton:{}, addUpdateShowButton:{},
shouldShowButton:{},
readonlyForm:{}, readonlyForm:{},
frame_class: '', frame_class: '',
form: {}, form: {},
@ -40,6 +46,7 @@
label: "对象编号", label: "对象编号",
prop: "objectNo", prop: "objectNo",
span:8, span:8,
disabled: true,
rules: [{ rules: [{
required: true, required: true,
message: "请输入对象编号", message: "请输入对象编号",
@ -105,6 +112,12 @@
label: "对象状态", label: "对象状态",
prop: "istatus", prop: "istatus",
search:true, search:true,
type: "select",
dicUrl: "/api/daf-system/dict/dictionary?code=istatus",
props: {
label: "dictValue",
value: "dictKey"
},
span:8, span:8,
rules: [{ rules: [{
required: true, required: true,
@ -123,6 +136,11 @@
trigger: "blur" trigger: "blur"
}] }]
}, },
{
label: "取消原因",
prop: "cancelReason",
span: 8,
},
] ]
}, },
data: [] data: []
@ -132,7 +150,7 @@
...mapGetters(["permission"]), ...mapGetters(["permission"]),
permissionList() { permissionList() {
// this.option.column = this.option.column.filter(v => { // this.option.column = this.option.column.filter(v => {
// return this.permission['inspectionobject_col_' + v.prop] // return this.permission['inspectionroute_col_' + v.prop]
// }) // })
return { return {
addBtn: false, addBtn: false,
@ -146,10 +164,19 @@
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 objectNo = this.findObject(this.option.column, "objectNo");
objectNo.value = ' ';
objectNo.disabled = true;
const iStatus = this.findObject(this.option.column, "istatus");
iStatus.display = false;
const cancelReason = this.findObject(this.option.column, "cancelReason");
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();
@ -170,12 +197,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/inspectionobject", path: "/inspection/inspectionobject",
@ -193,6 +220,40 @@
}); });
}); });
}); });
}else {
this.$confirm("是否修改所填数据?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
alert(this.form.istatus)
if (this.form.istatus==1){
this.form.cancelReason="";
}
alert(this.form.cancelReason)
update(this.form).then(() => {
this.$router.push({
path: "/inspection/inspectionobject",
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)) {
@ -203,7 +264,7 @@
done(); done();
}, },
} }
}; };
</script> </script>
<style> <style>

Loading…
Cancel
Save