巡检对象 详细追加

main
weitingdong 11 months ago
parent b488d8493a
commit 572d7f03ef
  1. 10
      src/api/inspection/inspectionobject.js
  2. 57
      src/views/inspection/inspectionobject.vue
  3. 373
      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,171 +11,198 @@
<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:{},
readonlyForm:{}, shouldShowButton:{},
frame_class: '', readonlyForm:{},
form: {}, frame_class: '',
query: {}, form: {},
option: { query: {},
submitBtn: false, option: {
emptyBtn: false, submitBtn: false,
column: [ emptyBtn: false,
{ column: [
label: "对象编号", {
prop: "objectNo", label: "对象编号",
span:8, prop: "objectNo",
rules: [{ span:8,
required: true, disabled: true,
message: "请输入对象编号", rules: [{
trigger: "blur" required: true,
}] message: "请输入对象编号",
}, trigger: "blur"
{ }]
label: "对象名称", },
prop: "objectName", {
search:true, label: "对象名称",
type: "select", prop: "objectName",
span:8, search:true,
dicUrl: "/api/daf-system/dict/dictionary?code=obj_name", type: "select",
props: { span:8,
label: "dictValue", dicUrl: "/api/daf-system/dict/dictionary?code=obj_name",
value: "dictKey" props: {
}, label: "dictValue",
rules: [{ value: "dictKey"
required: true,
message: "请输入对象名称",
trigger: "blur"
}]
},
{
label: "场站",
prop: "station",
search:true,
type: "select",
span:8,
dicUrl: "/api/daf-system/dict/dictionary?code=station",
props: {
label: "dictValue",
value: "dictKey"
},
rules: [{
required: true,
message: "请输入场站",
trigger: "blur"
}]
},
{
label: "对象类型",
prop: "objectType",
span:8,
rules: [{
required: true,
message: "请输入对象类型",
trigger: "blur"
}]
}, },
{ rules: [{
label: "对象区域", required: true,
prop: "objectArea", message: "请输入对象名称",
search:true, trigger: "blur"
span:8, }]
rules: [{ },
required: true, {
message: "请输入对象区域", label: "场站",
trigger: "blur" prop: "station",
}] search:true,
type: "select",
span:8,
dicUrl: "/api/daf-system/dict/dictionary?code=station",
props: {
label: "dictValue",
value: "dictKey"
}, },
{ rules: [{
label: "对象状态", required: true,
prop: "istatus", message: "请输入场站",
search:true, trigger: "blur"
span:8, }]
rules: [{ },
required: true, {
message: "请输入对象状态", label: "对象类型",
trigger: "blur" prop: "objectType",
}] span:8,
rules: [{
required: true,
message: "请输入对象类型",
trigger: "blur"
}]
},
{
label: "对象区域",
prop: "objectArea",
search:true,
span:8,
rules: [{
required: true,
message: "请输入对象区域",
trigger: "blur"
}]
},
{
label: "对象状态",
prop: "istatus",
search:true,
type: "select",
dicUrl: "/api/daf-system/dict/dictionary?code=istatus",
props: {
label: "dictValue",
value: "dictKey"
}, },
{ span:8,
label: "KKS编号", rules: [{
prop: "kksNo", required: true,
search:true, message: "请输入对象状态",
span:8, trigger: "blur"
rules: [{ }]
required: true, },
message: "请输入KKS编号", {
trigger: "blur" label: "KKS编号",
}] prop: "kksNo",
}, search:true,
] span:8,
}, rules: [{
data: [] required: true,
}; message: "请输入KKS编号",
}, trigger: "blur"
computed: { }]
...mapGetters(["permission"]), },
permissionList() { {
// this.option.column = this.option.column.filter(v => { label: "取消原因",
// return this.permission['inspectionobject_col_' + v.prop] prop: "cancelReason",
// }) span: 8,
return { },
addBtn: false, ]
viewBtn: false,
delBtn: false,
editBtn: false
};
}, },
data: []
};
},
computed: {
...mapGetters(["permission"]),
permissionList() {
// this.option.column = this.option.column.filter(v => {
// return this.permission['inspectionroute_col_' + v.prop]
// })
return {
addBtn: false,
viewBtn: false,
delBtn: false,
editBtn: false
};
}, },
created () { },
if(["view"].includes(this.$route.query.frameMode)){ created () {
this.readonlyForm = true; if(["view"].includes(this.$route.query.frameMode)){
this.addUpdateShowButton = false; this.readonlyForm = true;
this.frame_class = 'frame_class'; this.addUpdateShowButton = false;
}else{ this.shouldShowButton=true;
this.readonlyForm = false; this.frame_class = 'frame_class';
this.addUpdateShowButton = true; }else{
this.frame_class = null; const objectNo = this.findObject(this.option.column, "objectNo");
} objectNo.value = ' ';
this.SearchDetail(); 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.addUpdateShowButton = true;
this.shouldShowButton=false;
this.frame_class = null;
}
this.SearchDetail();
},
methods: {
handleFormSubmit() {
const form = this.$refs.form;
form.validate((valid) => {
if (valid) {
this.Submit();
} else {
this.$message({
type: "warning",
message: "请输入必要信息!"
});
}
});
}, },
methods: { //
handleFormSubmit() { Submit() {
const form = this.$refs.form; if(this.$route.query.frameMode=="add"){
form.validate((valid) => {
if (valid) {
this.Submit();
} else {
this.$message({
type: "warning",
message: "请输入必要信息!"
});
}
});
},
//
Submit() {
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,17 +220,51 @@
}); });
}); });
}); });
}, }else {
SearchDetail() { this.$confirm("是否修改所填数据?", "提示", {
if (["view"].includes(this.$route.query.frameMode)) { confirmButtonText: "确定",
getDetail(this.$route.query.id).then(res => { cancelButtonText: "取消",
this.form = res.data.data; 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: "操作失败!"
});
}); });
} });
done(); }
}, },
} seachToUpdate () {
}; this.shouldShowButton=false;
this.addUpdateShowButton=true;
this.readonlyForm=false;
this.frame_class = null;
},
SearchDetail() {
if (["view"].includes(this.$route.query.frameMode)) {
getDetail(this.$route.query.id).then(res => {
this.form = res.data.data;
});
}
done();
},
}
};
</script> </script>
<style> <style>

Loading…
Cancel
Save