巡检对象 详细追加

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

@ -56,6 +56,22 @@
<el-button v-if="permission.inspectionroute_delete" @click="rowDel(row)" type="text">删除</el-button>
</template>
</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>
</template>
@ -72,6 +88,7 @@
search:{},
query: {},
loading: true,
cancelBox: false,
page: {
pageSize: 10,
currentPage: 1,
@ -157,12 +174,18 @@
label: "对象状态",
prop: "istatus",
search:true,
type: "select",
span:4.5,
rules: [{
required: true,
message: "请输入对象状态",
trigger: "blur"
}]
}],
dicUrl: "/api/daf-system/dict/dictionary?code=istatus",
props: {
label: "dictValue",
value: "dictKey"
}
},
{
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: []
};
},
@ -246,6 +288,8 @@
return remove(row.id);
})
.then(() => {
const cancelReason = this.findObject(this.cancelOption.column, "cancelReason");
cancelReason.value = ' ';
this.onLoad(this.page);
this.$message({
type: "success",
@ -342,21 +386,26 @@
this.$message.warning("请选择至少一条数据");
return;
}
this.cancelBox = true;
},
handleDetailCancel() {
this.$confirm("是否将选择数据改为失效状态?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
return lapse(this.ids);
return lapse(this.ids, this.cancelForm.cancelReason);
})
.then(() => {
this.cancelForm.cancelReason = '';
this.cancelBox = false;
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
this.$refs.crud.toggleSelection();
this.$refs.crud.toggleSelection()
});
},
handleExport() {
@ -365,7 +414,7 @@
cancelButtonText: "取消",
type: "warning"
}).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) {

@ -11,171 +11,198 @@
<el-button type="primary"
size="large"
@click="handleFormSubmit"
>
v-if="addUpdateShowButton">
确定</el-button>
<el-button type="primary"
size="small"
@click="seachToUpdate"
v-if="shouldShowButton">
修改</el-button>
</span>
</div>
</basic-container>
</template>
<script>
import {getList, getDetail, add, update, remove, takeEffect, lapse} from "@/api/inspection/inspectionobject";
import {mapGetters} from "vuex";
import {getToken} from "@/util/auth";
import {getList, getDetail, add, update, remove, takeEffect, lapse} from "@/api/inspection/inspectionobject";
import {mapGetters} from "vuex";
import {getToken} from "@/util/auth";
export default {
name: "inspectionobjectDetail",
data() {
return {
addUpdateShowButton:{},
readonlyForm:{},
frame_class: '',
form: {},
query: {},
option: {
submitBtn: false,
emptyBtn: false,
column: [
{
label: "对象编号",
prop: "objectNo",
span:8,
rules: [{
required: true,
message: "请输入对象编号",
trigger: "blur"
}]
},
{
label: "对象名称",
prop: "objectName",
search:true,
type: "select",
span:8,
dicUrl: "/api/daf-system/dict/dictionary?code=obj_name",
props: {
label: "dictValue",
value: "dictKey"
},
rules: [{
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"
}]
export default {
name: "inspectionrouteDetail",
data() {
return {
addUpdateShowButton:{},
shouldShowButton:{},
readonlyForm:{},
frame_class: '',
form: {},
query: {},
option: {
submitBtn: false,
emptyBtn: false,
column: [
{
label: "对象编号",
prop: "objectNo",
span:8,
disabled: true,
rules: [{
required: true,
message: "请输入对象编号",
trigger: "blur"
}]
},
{
label: "对象名称",
prop: "objectName",
search:true,
type: "select",
span:8,
dicUrl: "/api/daf-system/dict/dictionary?code=obj_name",
props: {
label: "dictValue",
value: "dictKey"
},
{
label: "对象区域",
prop: "objectArea",
search:true,
span:8,
rules: [{
required: true,
message: "请输入对象区域",
trigger: "blur"
}]
rules: [{
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"
},
{
label: "对象状态",
prop: "istatus",
search:true,
span:8,
rules: [{
required: true,
message: "请输入对象状态",
trigger: "blur"
}]
rules: [{
required: true,
message: "请输入场站",
trigger: "blur"
}]
},
{
label: "对象类型",
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"
},
{
label: "KKS编号",
prop: "kksNo",
search:true,
span:8,
rules: [{
required: true,
message: "请输入KKS编号",
trigger: "blur"
}]
},
]
},
data: []
};
},
computed: {
...mapGetters(["permission"]),
permissionList() {
// this.option.column = this.option.column.filter(v => {
// return this.permission['inspectionobject_col_' + v.prop]
// })
return {
addBtn: false,
viewBtn: false,
delBtn: false,
editBtn: false
};
span:8,
rules: [{
required: true,
message: "请输入对象状态",
trigger: "blur"
}]
},
{
label: "KKS编号",
prop: "kksNo",
search:true,
span:8,
rules: [{
required: true,
message: "请输入KKS编号",
trigger: "blur"
}]
},
{
label: "取消原因",
prop: "cancelReason",
span: 8,
},
]
},
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)){
this.readonlyForm = true;
this.addUpdateShowButton = false;
this.frame_class = 'frame_class';
}else{
this.readonlyForm = false;
this.addUpdateShowButton = true;
this.frame_class = null;
}
this.SearchDetail();
},
created () {
if(["view"].includes(this.$route.query.frameMode)){
this.readonlyForm = true;
this.addUpdateShowButton = false;
this.shouldShowButton=true;
this.frame_class = 'frame_class';
}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.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() {
const form = this.$refs.form;
form.validate((valid) => {
if (valid) {
this.Submit();
} else {
this.$message({
type: "warning",
message: "请输入必要信息!"
});
}
});
},
//
Submit() {
//
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/inspectionobject",
@ -193,17 +220,51 @@
});
});
});
},
SearchDetail() {
if (["view"].includes(this.$route.query.frameMode)) {
getDetail(this.$route.query.id).then(res => {
this.form = res.data.data;
}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: "操作失败!"
});
});
}
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>
<style>

Loading…
Cancel
Save