commit
599c6ea3d8
4 changed files with 795 additions and 7 deletions
@ -0,0 +1,71 @@ |
|||||||
|
import request from '@/router/axios'; |
||||||
|
|
||||||
|
export const getList = (current, size, params) => { |
||||||
|
return request({ |
||||||
|
url: '/api/inspection/inspectionplan/list', |
||||||
|
method: 'get', |
||||||
|
params: { |
||||||
|
...params, |
||||||
|
current, |
||||||
|
size, |
||||||
|
} |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
export const getDetail = (id) => { |
||||||
|
return request({ |
||||||
|
url: '/api/inspection/inspectionplan/detail', |
||||||
|
method: 'get', |
||||||
|
params: { |
||||||
|
id |
||||||
|
} |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
export const remove = (ids) => { |
||||||
|
return request({ |
||||||
|
url: '/api/inspection/inspectionplan/remove', |
||||||
|
method: 'post', |
||||||
|
params: { |
||||||
|
ids, |
||||||
|
} |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
export const add = (row) => { |
||||||
|
return request({ |
||||||
|
url: '/api/inspection/inspectionplan/submit', |
||||||
|
method: 'post', |
||||||
|
data: row |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
export const update = (row) => { |
||||||
|
return request({ |
||||||
|
url: '/api/inspection/inspectionplan/update', |
||||||
|
method: 'post', |
||||||
|
data: row |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
export const takeEffect = (ids) => { |
||||||
|
return request({ |
||||||
|
url: '/api/inspection/inspectionplan/takeEffect', |
||||||
|
method: 'post', |
||||||
|
params: { |
||||||
|
ids, |
||||||
|
} |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
export const lapse = (ids, reason) => { |
||||||
|
return request({ |
||||||
|
url: '/api/inspection/inspectionplan/lapse', |
||||||
|
method: 'post', |
||||||
|
params: { |
||||||
|
ids, |
||||||
|
reason, |
||||||
|
} |
||||||
|
}) |
||||||
|
} |
||||||
|
|
@ -0,0 +1,301 @@ |
|||||||
|
<template> |
||||||
|
<basic-container> |
||||||
|
<avue-form :option="option" |
||||||
|
v-model="form" |
||||||
|
ref="form" |
||||||
|
:before-open="beforeOpen" |
||||||
|
:class="frame_class"> |
||||||
|
</avue-form> |
||||||
|
<div class="container"> |
||||||
|
<span > |
||||||
|
<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/inspectionplan"; |
||||||
|
import {mapGetters} from "vuex"; |
||||||
|
import {getToken} from "@/util/auth"; |
||||||
|
|
||||||
|
export default { |
||||||
|
name: "inspectionPlanDetail", |
||||||
|
data() { |
||||||
|
var validateTime = (rule, value, callback) => { |
||||||
|
if (value === '') { |
||||||
|
callback(new Error('请输入计划终了时间')); |
||||||
|
} else if(this.form.startTime > value) { |
||||||
|
callback(new Error('输入的计划起始时间大于计划终了时间')); |
||||||
|
} else { |
||||||
|
callback(); |
||||||
|
} |
||||||
|
}; |
||||||
|
return { |
||||||
|
addUpdateShowButton:{}, |
||||||
|
shouldShowButton:{}, |
||||||
|
readonlyForm:{}, |
||||||
|
frame_class: '', |
||||||
|
form: {}, |
||||||
|
query: {}, |
||||||
|
option: { |
||||||
|
submitBtn: false, |
||||||
|
emptyBtn: false, |
||||||
|
column: [ |
||||||
|
{ |
||||||
|
label: "计划编号", |
||||||
|
prop: "planNo", |
||||||
|
disabled: true, |
||||||
|
span: 8, |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: "计划名称", |
||||||
|
prop: "planName", |
||||||
|
span: 8, |
||||||
|
rules: [{ |
||||||
|
required: true, |
||||||
|
message: "请输入计划名称", |
||||||
|
trigger: "blur" |
||||||
|
}] |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: "场站", |
||||||
|
prop: "station", |
||||||
|
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: "planType", |
||||||
|
span: 8, |
||||||
|
rules: [{ |
||||||
|
required: true, |
||||||
|
message: "请输入计划类型", |
||||||
|
trigger: "blur" |
||||||
|
}] |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: "周期类型", |
||||||
|
prop: "periodType", |
||||||
|
span: 8, |
||||||
|
rules: [{ |
||||||
|
required: true, |
||||||
|
message: "请输入周期类型", |
||||||
|
trigger: "blur" |
||||||
|
}] |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: "周期值", |
||||||
|
prop: "periodValue", |
||||||
|
span: 8, |
||||||
|
rules: [{ |
||||||
|
required: true, |
||||||
|
message: "请输入周期值", |
||||||
|
trigger: "blur" |
||||||
|
}] |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: "计划起始时间", |
||||||
|
prop: "startTime", |
||||||
|
span: 8, |
||||||
|
type: "date", |
||||||
|
labelWidth: 120, |
||||||
|
format: 'yyyy年MM月dd日', |
||||||
|
valueFormat: "yyyyMMdd", |
||||||
|
rules: [{ |
||||||
|
required: true, |
||||||
|
message: "请输入计划起始时间", |
||||||
|
trigger: "blur" |
||||||
|
}] |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: "计划终了时间", |
||||||
|
prop: "endTime", |
||||||
|
span: 8, |
||||||
|
type: "date", |
||||||
|
labelWidth: 120, |
||||||
|
format: 'yyyy年MM月dd日', |
||||||
|
valueFormat: "yyyyMMdd", |
||||||
|
rules: [{ validator: validateTime, trigger: 'blur' }] |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: "状态", |
||||||
|
prop: "planStatus", |
||||||
|
span: 8, |
||||||
|
type: "select", |
||||||
|
dicUrl: "/api/daf-system/dict/dictionary?code=istatus", |
||||||
|
props: { |
||||||
|
label: "dictValue", |
||||||
|
value: "dictKey" |
||||||
|
}, |
||||||
|
rules: [{ |
||||||
|
required: true, |
||||||
|
message: "请输入状态", |
||||||
|
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.shouldShowButton=true; |
||||||
|
this.frame_class = 'frame_class'; |
||||||
|
}else{ |
||||||
|
const planNo = this.findObject(this.option.column, "planNo"); |
||||||
|
planNo.value = ' '; |
||||||
|
planNo.disabled = true; |
||||||
|
const planStatus = this.findObject(this.option.column, "planStatus"); |
||||||
|
planStatus.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() { |
||||||
|
this.$refs.form.validate((valid, done, msg) => { |
||||||
|
if (valid) { |
||||||
|
done() |
||||||
|
this.Submit(); |
||||||
|
} else { |
||||||
|
console.log('error submit!!'); |
||||||
|
return false; |
||||||
|
} |
||||||
|
}) |
||||||
|
}, |
||||||
|
// 处理表单提交 |
||||||
|
Submit() { |
||||||
|
if(this.$route.query.frameMode=="add"){ |
||||||
|
this.$confirm("是否新增所填数据?", "提示", { |
||||||
|
confirmButtonText: "确定", |
||||||
|
cancelButtonText: "取消", |
||||||
|
type: "warning" |
||||||
|
}).then(() => { |
||||||
|
add(this.form).then(()=>{ |
||||||
|
this.$router.push({ |
||||||
|
path: "/inspection/inspectionplan", |
||||||
|
query: { |
||||||
|
}, |
||||||
|
}); |
||||||
|
this.$message({ |
||||||
|
type: "success", |
||||||
|
message: "操作成功!" |
||||||
|
}); |
||||||
|
}).catch((error) => { |
||||||
|
this.$message({ |
||||||
|
type: "error", |
||||||
|
message: "操作失败!" |
||||||
|
}); |
||||||
|
}); |
||||||
|
}); |
||||||
|
}else { |
||||||
|
this.$confirm("是否修改所填数据?", "提示", { |
||||||
|
confirmButtonText: "确定", |
||||||
|
cancelButtonText: "取消", |
||||||
|
type: "warning" |
||||||
|
}).then(() => { |
||||||
|
update(this.form).then(() => { |
||||||
|
this.$router.push({ |
||||||
|
path: "/inspection/inspectionplan", |
||||||
|
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)) { |
||||||
|
getDetail(this.$route.query.id).then(res => { |
||||||
|
this.form = res.data.data; |
||||||
|
}); |
||||||
|
} |
||||||
|
done(); |
||||||
|
}, |
||||||
|
} |
||||||
|
}; |
||||||
|
</script> |
||||||
|
|
||||||
|
<style> |
||||||
|
.frame_class input.el-input__inner { |
||||||
|
border: none; |
||||||
|
box-shadow: none; |
||||||
|
outline: none; |
||||||
|
pointer-events: none; |
||||||
|
} |
||||||
|
.frame_class .el-input__icon { |
||||||
|
display: none; |
||||||
|
} |
||||||
|
.frame_class .el-input--prefix .el-input__inner { |
||||||
|
padding-left: 15px; |
||||||
|
} |
||||||
|
.frame_class input::placeholder { |
||||||
|
color: transparent; |
||||||
|
display: none; /* 默认隐藏 */ |
||||||
|
} |
||||||
|
.container { |
||||||
|
display: flex; |
||||||
|
justify-content: flex-end; /* 将子元素推到容器的末端 */ |
||||||
|
} |
||||||
|
</style> |
@ -0,0 +1,418 @@ |
|||||||
|
<template> |
||||||
|
<basic-container> |
||||||
|
<avue-crud :option="option" |
||||||
|
:table-loading="loading" |
||||||
|
:data="data" |
||||||
|
:page="page" |
||||||
|
:permission="permissionList" |
||||||
|
:before-open="beforeOpen" |
||||||
|
:search.sync="search" |
||||||
|
:header-cell-class-name="headerClass" |
||||||
|
v-model="form" |
||||||
|
ref="crud" |
||||||
|
@row-update="rowUpdate" |
||||||
|
@row-save="rowSave" |
||||||
|
@row-del="rowDel" |
||||||
|
@search-change="searchChange" |
||||||
|
@search-reset="searchReset" |
||||||
|
@selection-change="selectionChange" |
||||||
|
@current-change="currentChange" |
||||||
|
@size-change="sizeChange" |
||||||
|
@on-load="onLoad"> |
||||||
|
<template slot="menuLeft"> |
||||||
|
<el-button type="danger" |
||||||
|
size="small" |
||||||
|
icon="el-icon-delete" |
||||||
|
plain |
||||||
|
v-if="permission.inspectionroute_delete" |
||||||
|
@click="handleDelete">批量删除 |
||||||
|
</el-button> |
||||||
|
</template> |
||||||
|
<template slot="menuRight"> |
||||||
|
<el-button type="primary" |
||||||
|
size="small" |
||||||
|
v-if="permission.inspectionroute_add" |
||||||
|
plain |
||||||
|
@click="handleDetailAdd">新增 |
||||||
|
</el-button> |
||||||
|
<el-button type="primary" |
||||||
|
size="small" |
||||||
|
plain |
||||||
|
@click="handleTakeEffect">生效 |
||||||
|
</el-button> |
||||||
|
<el-button type="primary" |
||||||
|
size="small" |
||||||
|
plain |
||||||
|
@click="handleLapse">失效 |
||||||
|
</el-button> |
||||||
|
<el-button type="primary" |
||||||
|
size="small" |
||||||
|
plain |
||||||
|
@click="handleExport">导出 |
||||||
|
</el-button> |
||||||
|
</template> |
||||||
|
<template #menu="{row,index,size}"> |
||||||
|
<el-button v-if="permission.inspectionroute_view" @click="handleDetailSearch(row,index)" type="text">查看</el-button> |
||||||
|
<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> |
||||||
|
|
||||||
|
<script> |
||||||
|
import {getList, getDetail, add, update, remove, takeEffect, lapse} from "@/api/inspection/inspectionplan"; |
||||||
|
import {mapGetters} from "vuex"; |
||||||
|
import expUtil from "@/util/exportUtil"; |
||||||
|
import {getToken} from "@/util/auth"; |
||||||
|
|
||||||
|
export default { |
||||||
|
data() { |
||||||
|
return { |
||||||
|
form: {}, |
||||||
|
search:{}, |
||||||
|
query: {}, |
||||||
|
loading: true, |
||||||
|
cancelBox: false, |
||||||
|
page: { |
||||||
|
pageSize: 10, |
||||||
|
currentPage: 1, |
||||||
|
total: 0 |
||||||
|
}, |
||||||
|
selectionList: [], |
||||||
|
option: { |
||||||
|
height: 'auto', |
||||||
|
calcHeight: 210, |
||||||
|
searchShow: true, |
||||||
|
searchMenuSpan: 6, |
||||||
|
tip: false, |
||||||
|
border: true, |
||||||
|
index: false, |
||||||
|
viewBtn: true, |
||||||
|
selection: true, |
||||||
|
searchBtnText: '查询', |
||||||
|
emptyBtnText: '重置', |
||||||
|
column: [ |
||||||
|
{ |
||||||
|
label: "计划编号", |
||||||
|
prop: "planNo", |
||||||
|
search: true |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: "计划名称", |
||||||
|
prop: "planName", |
||||||
|
search: true |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: "场站", |
||||||
|
prop: "station", |
||||||
|
type: "select", |
||||||
|
search: true, |
||||||
|
dicUrl: "/api/daf-system/dict/dictionary?code=station", |
||||||
|
props: { |
||||||
|
label: "dictValue", |
||||||
|
value: "dictKey" |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: "计划类型", |
||||||
|
prop: "planType" |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: "周期类型", |
||||||
|
prop: "periodType", |
||||||
|
search: true |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: "周期值", |
||||||
|
prop: "periodValue" |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: "计划起始时间", |
||||||
|
prop: "startTime", |
||||||
|
type: "date", |
||||||
|
format: 'yyyy年MM月dd日', |
||||||
|
valueFormat: "yyyyMMdd", |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: "计划终了时间", |
||||||
|
prop: "endTime", |
||||||
|
type: "date", |
||||||
|
format: 'yyyy年MM月dd日', |
||||||
|
valueFormat: "yyyyMMdd", |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: "计划状态", |
||||||
|
prop: "planStatus", |
||||||
|
type: "select", |
||||||
|
search: true, |
||||||
|
dicUrl: "/api/daf-system/dict/dictionary?code=istatus", |
||||||
|
props: { |
||||||
|
label: "dictValue", |
||||||
|
value: "dictKey" |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: "取消原因", |
||||||
|
prop: "cancelReason" |
||||||
|
}, |
||||||
|
] |
||||||
|
}, |
||||||
|
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: [] |
||||||
|
}; |
||||||
|
}, |
||||||
|
computed: { |
||||||
|
...mapGetters(["permission"]), |
||||||
|
permissionList() { |
||||||
|
// this.option.column = this.option.column.filter(v => { |
||||||
|
// return this.permission['inspectionplan_col_' + v.prop] |
||||||
|
// }) |
||||||
|
return { |
||||||
|
addBtn: false, |
||||||
|
viewBtn: false, |
||||||
|
delBtn: false, |
||||||
|
editBtn: false |
||||||
|
}; |
||||||
|
}, |
||||||
|
ids() { |
||||||
|
let ids = []; |
||||||
|
this.selectionList.forEach(ele => { |
||||||
|
ids.push(ele.id); |
||||||
|
}); |
||||||
|
return ids.join(","); |
||||||
|
} |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
rowSave(row, done, loading) { |
||||||
|
add(row).then(() => { |
||||||
|
done(); |
||||||
|
this.onLoad(this.page); |
||||||
|
this.$message({ |
||||||
|
type: "success", |
||||||
|
message: "操作成功!" |
||||||
|
}); |
||||||
|
}, error => { |
||||||
|
window.console.log(error); |
||||||
|
loading(); |
||||||
|
}); |
||||||
|
}, |
||||||
|
rowUpdate(row, index, done, loading) { |
||||||
|
update(row).then(() => { |
||||||
|
done(); |
||||||
|
this.onLoad(this.page); |
||||||
|
this.$message({ |
||||||
|
type: "success", |
||||||
|
message: "操作成功!" |
||||||
|
}); |
||||||
|
}, error => { |
||||||
|
window.console.log(error); |
||||||
|
loading(); |
||||||
|
}); |
||||||
|
}, |
||||||
|
rowDel(row) { |
||||||
|
this.$confirm("确定将选择数据删除?", { |
||||||
|
confirmButtonText: "确定", |
||||||
|
cancelButtonText: "取消", |
||||||
|
type: "warning" |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
return remove(row.id); |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
this.onLoad(this.page); |
||||||
|
this.$message({ |
||||||
|
type: "success", |
||||||
|
message: "操作成功!" |
||||||
|
}); |
||||||
|
}); |
||||||
|
}, |
||||||
|
handleDelete() { |
||||||
|
if (this.selectionList.length === 0) { |
||||||
|
this.$message.warning("请选择至少一条数据"); |
||||||
|
return; |
||||||
|
} |
||||||
|
this.$confirm("确定将选择数据删除?", { |
||||||
|
confirmButtonText: "确定", |
||||||
|
cancelButtonText: "取消", |
||||||
|
type: "warning" |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
return remove(this.ids); |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
this.onLoad(this.page); |
||||||
|
this.$message({ |
||||||
|
type: "success", |
||||||
|
message: "操作成功!" |
||||||
|
}); |
||||||
|
this.$refs.crud.toggleSelection(); |
||||||
|
}); |
||||||
|
}, |
||||||
|
handleDetailAdd() { |
||||||
|
this.$router.push({ |
||||||
|
path: "/inspection/inspectionPlanDetail", |
||||||
|
query: { |
||||||
|
frameMode:"add" |
||||||
|
}, |
||||||
|
}); |
||||||
|
}, |
||||||
|
handleDetailSearch(row) { |
||||||
|
debugger |
||||||
|
this.$router.push({ |
||||||
|
path: "/inspection/inspectionPlanDetail", |
||||||
|
query: { |
||||||
|
frameMode:"view", |
||||||
|
id: row.id |
||||||
|
}, |
||||||
|
}); |
||||||
|
}, |
||||||
|
handleTakeEffect() { |
||||||
|
if (this.selectionList.length === 0) { |
||||||
|
this.$message.warning("请选择至少一条数据"); |
||||||
|
return; |
||||||
|
} |
||||||
|
this.$confirm("是否将选择数据改为生效状态?", { |
||||||
|
confirmButtonText: "确定", |
||||||
|
cancelButtonText: "取消", |
||||||
|
type: "warning" |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
return takeEffect(this.ids); |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
this.onLoad(this.page); |
||||||
|
this.$message({ |
||||||
|
type: "success", |
||||||
|
message: "操作成功!" |
||||||
|
}); |
||||||
|
this.$refs.crud.toggleSelection(); |
||||||
|
}); |
||||||
|
}, |
||||||
|
handleLapse() { |
||||||
|
if (this.selectionList.length === 0) { |
||||||
|
this.$message.warning("请选择至少一条数据"); |
||||||
|
return; |
||||||
|
} |
||||||
|
this.cancelBox = true; |
||||||
|
}, |
||||||
|
handleDetailCancel() { |
||||||
|
this.$confirm("是否将选择数据改为失效状态?", { |
||||||
|
confirmButtonText: "确定", |
||||||
|
cancelButtonText: "取消", |
||||||
|
type: "warning" |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
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() |
||||||
|
}); |
||||||
|
}, |
||||||
|
handleExport() { |
||||||
|
this.$confirm("是否导出数据?", "提示", { |
||||||
|
confirmButtonText: "确定", |
||||||
|
cancelButtonText: "取消", |
||||||
|
type: "warning" |
||||||
|
}).then(() => { |
||||||
|
expUtil.excelExport(`/api/inspection/inspectionplan/export?daf-auth=${getToken()}`, this.search, ['station', "planStatus"]); |
||||||
|
}); |
||||||
|
}, |
||||||
|
beforeOpen(done, type) { |
||||||
|
if (["edit", "view"].includes(type)) { |
||||||
|
getDetail(this.form.id).then(res => { |
||||||
|
this.form = res.data.data; |
||||||
|
}); |
||||||
|
} |
||||||
|
done(); |
||||||
|
}, |
||||||
|
searchReset() { |
||||||
|
this.query = {}; |
||||||
|
this.onLoad(this.page); |
||||||
|
}, |
||||||
|
searchChange(params, done) { |
||||||
|
this.query = params; |
||||||
|
this.page.currentPage = 1; |
||||||
|
this.onLoad(this.page, params); |
||||||
|
done(); |
||||||
|
}, |
||||||
|
selectionChange(list) { |
||||||
|
this.selectionList = list; |
||||||
|
}, |
||||||
|
selectionClear() { |
||||||
|
this.selectionList = []; |
||||||
|
this.$refs.crud.toggleSelection(); |
||||||
|
}, |
||||||
|
currentChange(currentPage){ |
||||||
|
this.page.currentPage = currentPage; |
||||||
|
}, |
||||||
|
sizeChange(pageSize){ |
||||||
|
this.page.pageSize = pageSize; |
||||||
|
}, |
||||||
|
onLoad(page, params = {}) { |
||||||
|
this.loading = true; |
||||||
|
getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => { |
||||||
|
const data = res.data.data; |
||||||
|
this.page.total = data.total; |
||||||
|
this.data = data.records; |
||||||
|
this.loading = false; |
||||||
|
this.selectionClear(); |
||||||
|
}); |
||||||
|
}, |
||||||
|
headerClass() { |
||||||
|
return 'header-class' |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
</script> |
||||||
|
|
||||||
|
<style> |
||||||
|
.header-class{ |
||||||
|
background-color: #3366cc !important; |
||||||
|
color: #FFFFFF !important; |
||||||
|
} |
||||||
|
.container { |
||||||
|
display: flex; |
||||||
|
justify-content: flex-end; /* 将子元素推到容器的末端 */ |
||||||
|
} |
||||||
|
</style> |
Loading…
Reference in new issue