parent
55da446de2
commit
384cb3959f
3 changed files with 671 additions and 0 deletions
@ -0,0 +1,69 @@ |
||||
import request from '@/router/axios'; |
||||
|
||||
export const getList = (current, size, params) => { |
||||
return request({ |
||||
url: '/api/inspection/inspectionRoute/list', |
||||
method: 'get', |
||||
params: { |
||||
...params, |
||||
current, |
||||
size, |
||||
} |
||||
}) |
||||
} |
||||
|
||||
export const getDetail = (id) => { |
||||
return request({ |
||||
url: '/api/inspection/inspectionRoute/detail', |
||||
method: 'get', |
||||
params: { |
||||
id |
||||
} |
||||
}) |
||||
} |
||||
|
||||
export const remove = (ids) => { |
||||
return request({ |
||||
url: '/api/inspection/inspectionRoute/remove', |
||||
method: 'post', |
||||
params: { |
||||
ids, |
||||
} |
||||
}) |
||||
} |
||||
|
||||
export const add = (row) => { |
||||
return request({ |
||||
url: '/api/inspection/inspectionRoute/submit', |
||||
method: 'post', |
||||
data: row |
||||
}) |
||||
} |
||||
|
||||
export const update = (row) => { |
||||
return request({ |
||||
url: '/api/inspection/inspectionRoute/submit', |
||||
method: 'post', |
||||
data: row |
||||
}) |
||||
} |
||||
|
||||
export const takeEffect = (ids) => { |
||||
return request({ |
||||
url: '/api/inspection/inspectionRoute/takeEffect', |
||||
method: 'post', |
||||
params: { |
||||
ids, |
||||
} |
||||
}) |
||||
} |
||||
|
||||
export const lapse = (ids) => { |
||||
return request({ |
||||
url: '/api/inspection/inspectionRoute/lapse', |
||||
method: 'post', |
||||
params: { |
||||
ids, |
||||
} |
||||
}) |
||||
} |
@ -0,0 +1,388 @@ |
||||
<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> |
||||
</basic-container> |
||||
</template> |
||||
|
||||
<script> |
||||
import {getList, getDetail, add, update, remove, takeEffect, lapse} from "@/api/inspection/inspectionroute"; |
||||
import {mapGetters} from "vuex"; |
||||
import {getToken} from "@/util/auth"; |
||||
import expUtil from "@/util/exportUtil"; |
||||
|
||||
export default { |
||||
data() { |
||||
return { |
||||
form: {}, |
||||
search:{}, |
||||
query: {}, |
||||
loading: true, |
||||
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, |
||||
column: [ |
||||
{ |
||||
label: "路线编号", |
||||
prop: "routeNo", |
||||
search: true, |
||||
rules: [{ |
||||
required: true, |
||||
message: "请输入路线编号", |
||||
trigger: "blur" |
||||
}] |
||||
}, |
||||
{ |
||||
label: "路线名称", |
||||
prop: "routeName", |
||||
search: true, |
||||
rules: [{ |
||||
required: true, |
||||
message: "请输入路线名称", |
||||
trigger: "blur" |
||||
}] |
||||
}, |
||||
{ |
||||
label: "场站", |
||||
prop: "stations", |
||||
type: "select", |
||||
search: true, |
||||
dicUrl: "/api/daf-system/dict/dictionary?code=station", |
||||
props: { |
||||
label: "dictValue", |
||||
value: "dictKey" |
||||
}, |
||||
rules: [{ |
||||
required: true, |
||||
message: "请输入场站", |
||||
trigger: "blur" |
||||
}] |
||||
}, |
||||
{ |
||||
label: "类型", |
||||
prop: "type", |
||||
search: true, |
||||
rules: [{ |
||||
required: true, |
||||
message: "请输入类型", |
||||
trigger: "blur" |
||||
}] |
||||
}, |
||||
{ |
||||
label: "状态", |
||||
prop: "istatus", |
||||
type: "select", |
||||
search: true, |
||||
dicUrl: "/api/daf-system/dict/dictionary?code=istatus", |
||||
props: { |
||||
label: "dictValue", |
||||
value: "dictKey" |
||||
}, |
||||
rules: [{ |
||||
required: true, |
||||
message: "请输入状态", |
||||
trigger: "blur" |
||||
}] |
||||
}, |
||||
{ |
||||
label: "维护工厂", |
||||
prop: "factory", |
||||
rules: [{ |
||||
required: true, |
||||
message: "请输入维护工厂", |
||||
trigger: "blur" |
||||
}] |
||||
}, |
||||
{ |
||||
label: "取消原因", |
||||
prop: "cancelReason", |
||||
rules: [{ |
||||
required: true, |
||||
message: "请输入取消原因", |
||||
trigger: "blur" |
||||
}] |
||||
}, |
||||
] |
||||
}, |
||||
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 |
||||
}; |
||||
}, |
||||
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: "操作成功!" |
||||
}); |
||||
}); |
||||
}, |
||||
handleDetailAdd() { |
||||
this.$router.push({ |
||||
path: "/inspection/inspectionrouteDetail", |
||||
query: { |
||||
frameMode:"add" |
||||
}, |
||||
}); |
||||
}, |
||||
handleDetailSearch(row) { |
||||
debugger |
||||
this.$router.push({ |
||||
path: "/inspection/inspectionrouteDetail", |
||||
query: { |
||||
frameMode:"view", |
||||
id: row.id |
||||
}, |
||||
}); |
||||
}, |
||||
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(); |
||||
}); |
||||
}, |
||||
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.$confirm("是否将选择数据改为失效状态?", { |
||||
confirmButtonText: "确定", |
||||
cancelButtonText: "取消", |
||||
type: "warning" |
||||
}) |
||||
.then(() => { |
||||
return lapse(this.ids); |
||||
}) |
||||
.then(() => { |
||||
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/inspectionRoute/export?daf-auth=${getToken()}`, this.search, ['stations', "istatus"]); |
||||
}); |
||||
}, |
||||
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; |
||||
} |
||||
</style> |
@ -0,0 +1,214 @@ |
||||
<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> |
||||
</span> |
||||
</div> |
||||
</basic-container> |
||||
</template> |
||||
|
||||
<script> |
||||
import {getList, getDetail, add, update, remove, takeEffect, lapse} from "@/api/inspection/inspectionroute"; |
||||
import {mapGetters} from "vuex"; |
||||
import {getToken} from "@/util/auth"; |
||||
|
||||
export default { |
||||
name: "inspectionrouteDetail", |
||||
data() { |
||||
return { |
||||
addUpdateShowButton:{}, |
||||
readonlyForm:{}, |
||||
frame_class: '', |
||||
form: {}, |
||||
query: {}, |
||||
option: { |
||||
submitBtn: false, |
||||
emptyBtn: false, |
||||
column: [ |
||||
{ |
||||
label: "路线编号", |
||||
prop: "routeNo", |
||||
span: 8, |
||||
}, |
||||
{ |
||||
label: "路线名称", |
||||
prop: "routeName", |
||||
span: 8, |
||||
rules: [{ |
||||
required: true, |
||||
message: "请输入路线名称", |
||||
trigger: "blur" |
||||
}] |
||||
}, |
||||
{ |
||||
label: "场站", |
||||
prop: "stations", |
||||
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: "type", |
||||
span: 8, |
||||
rules: [{ |
||||
required: true, |
||||
message: "请输入类型", |
||||
trigger: "blur" |
||||
}] |
||||
}, |
||||
{ |
||||
label: "状态", |
||||
prop: "istatus", |
||||
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: "factory", |
||||
span: 8, |
||||
rules: [{ |
||||
required: true, |
||||
message: "请输入维护工厂", |
||||
trigger: "blur" |
||||
}] |
||||
}, |
||||
{ |
||||
label: "取消原因", |
||||
prop: "cancelReason", |
||||
}, |
||||
] |
||||
}, |
||||
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(); |
||||
}, |
||||
methods: { |
||||
handleFormSubmit() { |
||||
const form = this.$refs.form; |
||||
form.validate((valid) => { |
||||
if (valid) { |
||||
this.Submit(); |
||||
} else { |
||||
this.$message({ |
||||
type: "warning", |
||||
message: "请输入必要信息!" |
||||
}); |
||||
} |
||||
}); |
||||
}, |
||||
// 处理表单提交 |
||||
Submit() { |
||||
this.$confirm("是否新增所填数据?", "提示", { |
||||
confirmButtonText: "确定", |
||||
cancelButtonText: "取消", |
||||
type: "warning" |
||||
}).then(() => { |
||||
this.form.checkStatus="1" |
||||
add(this.form).then(()=>{ |
||||
this.$router.push({ |
||||
path: "/inspection/inspectionroute", |
||||
query: { |
||||
}, |
||||
}); |
||||
this.$message({ |
||||
type: "success", |
||||
message: "操作成功!" |
||||
}); |
||||
}).catch((error) => { |
||||
this.$message({ |
||||
type: "error", |
||||
message: "操作失败!" |
||||
}); |
||||
}); |
||||
}); |
||||
}, |
||||
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> |
Loading…
Reference in new issue