parent
c28dce9f17
commit
2d3bb806bd
11 changed files with 802 additions and 143 deletions
@ -0,0 +1,34 @@ |
||||
import request from '@/router/axios'; |
||||
const prefix = '/api/blade-workflow/taskInfo' |
||||
// 查询
|
||||
export const getList = () => { |
||||
return request({ |
||||
url: `${prefix}/list`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
export const add = (row) => { |
||||
return request({ |
||||
url: `${prefix}/save`, |
||||
method: 'post', |
||||
data: row |
||||
}) |
||||
} |
||||
export const update = (row) => { |
||||
return request({ |
||||
url: `${prefix}/update`, |
||||
method: 'post', |
||||
data: row |
||||
}) |
||||
} |
||||
export const remove = (ids) => { |
||||
return request({ |
||||
url: `${prefix}/remove`, |
||||
method: 'post', |
||||
params: { |
||||
ids, |
||||
} |
||||
}) |
||||
} |
||||
|
||||
|
||||
@ -0,0 +1,84 @@ |
||||
export const tableOption = { |
||||
index: true, |
||||
indexLabel: "序号", |
||||
indexWidth:120, |
||||
labelPosition: "top", |
||||
selection: true, |
||||
border: false, |
||||
headerAlign: "left", |
||||
align: "left", |
||||
menuAlign:'left', |
||||
menuHeaderAlign:'left', |
||||
menuBtn: true, |
||||
editBtn: false, |
||||
delBtn: false, |
||||
addBtn: false, |
||||
tip: false, |
||||
searchMenuSpan: 3, //控制搜索按钮
|
||||
columnBtn: false, |
||||
refreshBtn: false, |
||||
header: false, |
||||
menuWidth:220, |
||||
dialogCustomClass:"custom", |
||||
column: [ |
||||
{ |
||||
type: "select", |
||||
label: "任务父类", |
||||
prop: "taskParentId", |
||||
align: "left", |
||||
overHidden: true, |
||||
dicUrl:'/api/blade-system/dict-biz/dictionary?code=task_parent', |
||||
props: { |
||||
label: "dictValue", |
||||
value: "id", |
||||
}, |
||||
rules: [{ required: true, message: "请选择任务父类" }], |
||||
span:8 |
||||
|
||||
}, |
||||
{ |
||||
type: "input", |
||||
label: "任务种类", |
||||
prop: "taskTypeName", |
||||
align: "left", |
||||
overHidden: true, |
||||
rules: [{ required: true, message: "请输入任务种类" }], |
||||
span:8 |
||||
}, |
||||
|
||||
{ |
||||
type: "select", |
||||
label: "任务等级", |
||||
prop: "taskLevel", |
||||
align: "left", |
||||
overHidden: true, |
||||
dicUrl:'/api/blade-system/dict-biz/dictionary?code=task_level', |
||||
props: { |
||||
label: "dictValue", |
||||
value: "id", |
||||
}, |
||||
rules: [{ required: true, message: "请选择任务等级" }], |
||||
span:8 |
||||
}, |
||||
{ |
||||
type: "input", |
||||
label: "创建人", |
||||
prop: "createUser", |
||||
align: "left", |
||||
overHidden: true, |
||||
addDisplay:false, |
||||
editDisplay: false |
||||
}, |
||||
|
||||
{ |
||||
label: "创建时间", |
||||
type: "datetime", |
||||
overHidden: true, |
||||
prop: "createTime", |
||||
format: "yyyy-MM-dd HH:mm", |
||||
valueFormat: "yyyy-MM-dd HH:mm:ss", |
||||
addDisplay:false, |
||||
editDisplay: false |
||||
}, |
||||
], |
||||
} |
||||
@ -0,0 +1,80 @@ |
||||
export const tableOption = { |
||||
selection: true, |
||||
border: false, |
||||
gutter: 60, //设置input的大小
|
||||
headerAlign: "left", |
||||
align: "left", |
||||
menuAlign:'left', |
||||
menuHeaderAlign:'left', |
||||
menuBtn: true, |
||||
editBtn: false, |
||||
delBtn: false, |
||||
addBtn: false, |
||||
tip: false, |
||||
searchMenuSpan: 3, //控制搜索按钮
|
||||
columnBtn: false, |
||||
refreshBtn: false, |
||||
// dialogCustomClass: "custom",
|
||||
header: false, |
||||
menuWidth:120, |
||||
column: [ |
||||
{ |
||||
type: "input", |
||||
label: "任务名称", |
||||
prop: "year", |
||||
align: "left", |
||||
overHidden: true, |
||||
}, |
||||
{ |
||||
type: "input", |
||||
label: "当前责任人", |
||||
prop: "userStatusAnalysis", |
||||
align: "left", |
||||
overHidden: true, |
||||
}, |
||||
{ |
||||
type: "input", |
||||
label: "公司名称", |
||||
prop: "count", |
||||
align: "left", |
||||
overHidden: true, |
||||
}, |
||||
{ |
||||
type: "input", |
||||
label: "发起人", |
||||
prop: "count", |
||||
align: "left", |
||||
overHidden: true, |
||||
}, |
||||
{ |
||||
type: "input", |
||||
label: "状态", |
||||
prop: "status", |
||||
align: "left", |
||||
overHidden: true, |
||||
}, |
||||
{ |
||||
label: "创建时间", |
||||
type: "datetime", |
||||
overHidden: true, |
||||
prop: "startTime", |
||||
format: "yyyy-MM-dd HH:mm", |
||||
valueFormat: "yyyy-MM-dd HH:mm:ss", |
||||
}, |
||||
{ |
||||
label: "结束时间", |
||||
type: "datetime", |
||||
overHidden: true, |
||||
prop: "startTime", |
||||
format: "yyyy-MM-dd HH:mm", |
||||
valueFormat: "yyyy-MM-dd HH:mm:ss", |
||||
}, |
||||
{ |
||||
type: "input", |
||||
label: "处理状态", |
||||
prop: "status", |
||||
align: "left", |
||||
overHidden: true, |
||||
}, |
||||
], |
||||
} |
||||
@ -0,0 +1,247 @@ |
||||
<template> |
||||
<div class="cus-container"> |
||||
<el-form :model="searchForm"> |
||||
<div class="search"> |
||||
<div> |
||||
<el-select |
||||
v-model="searchForm.taskParentId" |
||||
placeholder="任务父类" |
||||
class="search-select" |
||||
> |
||||
<el-option |
||||
v-for="item in conpanyList" |
||||
:key="item.value" |
||||
:label="item.label" |
||||
:value="item.value" |
||||
> |
||||
</el-option> |
||||
</el-select> |
||||
<el-select |
||||
v-model="searchForm.taskTypeName" |
||||
placeholder="任务种类" |
||||
class="search-select" |
||||
> |
||||
<el-option |
||||
v-for="item in conpanyList" |
||||
:key="item.value" |
||||
:label="item.label" |
||||
:value="item.value" |
||||
> |
||||
</el-option> |
||||
</el-select> |
||||
<el-select |
||||
v-model="searchForm.taskLevel" |
||||
placeholder="任务等级" |
||||
class="search-select" |
||||
> |
||||
<el-option |
||||
v-for="item in conpanyList" |
||||
:key="item.value" |
||||
:label="item.label" |
||||
:value="item.value" |
||||
> |
||||
</el-option> |
||||
</el-select> |
||||
<el-date-picker |
||||
style="width: 180px" |
||||
v-model="searchForm.createTime" |
||||
type="datetime" |
||||
placeholder="创建日期" |
||||
format="yyyy-MM-dd HH:mm" |
||||
valueFormat="yyyy-MM-dd HH:mm:ss" |
||||
> |
||||
</el-date-picker> |
||||
</div> |
||||
<div style="display: flex"> |
||||
<el-input |
||||
:rows="18" |
||||
v-model="searchForm.name" |
||||
placeholder="请输入创建人" |
||||
class="search-input" |
||||
></el-input> |
||||
<el-button class="search-btn" @click="searchHandle(1)" |
||||
>查询</el-button |
||||
> |
||||
<el-button |
||||
class="search-btn" |
||||
style="margin: 0; background: #2ee27c" |
||||
@click="addHandle" |
||||
>新增</el-button |
||||
> |
||||
<div class="search-reset" @click="searchHandle(2)"> |
||||
<i class="el-icon-refresh-right" style="font-size: 20px"></i> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</el-form> |
||||
<div style="margin-top: 30px"> |
||||
<avue-crud |
||||
id="avue-id" |
||||
ref="crud" |
||||
:option="option" |
||||
:data="tableData" |
||||
:page.sync="page" |
||||
:table-loading="loading" |
||||
@row-save="rowSave" |
||||
@row-update="rowUpdate" |
||||
@row-del="rowDel" |
||||
@current-change="currentChange" |
||||
@size-change="sizeChange" |
||||
> |
||||
<template slot-scope="scope" slot="menu"> |
||||
<el-button type="primary" @click="editHandle(scope.row)" |
||||
>编辑 |
||||
</el-button> |
||||
<el-button type="danger" @click="rowDel(scope.row)">删除 </el-button> |
||||
</template> |
||||
</avue-crud> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
<script> |
||||
import { getList, add, update, remove } from "@/api/maintenance/task.js"; |
||||
import { tableOption } from "@/const/maintenance/task.js"; |
||||
export default { |
||||
data() { |
||||
return { |
||||
searchForm: {}, |
||||
conpanyList: [{ label: "运维公司", value: 1 }], |
||||
option: tableOption, |
||||
page: { |
||||
current: 1, |
||||
total: 0, |
||||
size: 10, |
||||
}, |
||||
// 表格数据 |
||||
tableData: [], |
||||
loading: false, |
||||
}; |
||||
}, |
||||
created() { |
||||
this.onLoad(); |
||||
}, |
||||
methods: { |
||||
// 列表 |
||||
onLoad() { |
||||
this.loading = true; |
||||
const { current, size } = this.page; |
||||
getList(Object.assign({ current, size })).then((res) => { |
||||
const { total, records } = res.data.data; |
||||
this.page.total = total; |
||||
this.tableData = records; |
||||
this.loading = false; |
||||
}); |
||||
}, |
||||
// 分页 |
||||
currentChange(currentPage) { |
||||
this.page.current = currentPage; |
||||
this.onLoad(); |
||||
}, |
||||
sizeChange(pageSize) { |
||||
this.page.size = pageSize; |
||||
this.onLoad(); |
||||
}, |
||||
// 查询重置 |
||||
searchHandle(index) { |
||||
if (index === 1) { |
||||
// 查询 |
||||
} else { |
||||
// 重置 |
||||
} |
||||
this.onLoad(); |
||||
}, |
||||
// 新增 |
||||
addHandle() { |
||||
this.$refs.crud.rowAdd(); |
||||
}, |
||||
editHandle(row) { |
||||
this.$refs.crud.rowEdit(row); |
||||
}, |
||||
// 新增 |
||||
rowSave(row, done, loading) { |
||||
add(row).then( |
||||
(res) => { |
||||
const data = res.data.data; |
||||
row.id = data.id; |
||||
this.$message({ type: "success", message: "新增成功!" }); |
||||
this.onLoad(); |
||||
// 数据回调进行刷新 |
||||
done(row); |
||||
}, |
||||
(error) => { |
||||
window.console.log(error); |
||||
loading(); |
||||
} |
||||
); |
||||
}, |
||||
// 编辑 |
||||
rowUpdate(row, index, done, loading) { |
||||
update(row).then( |
||||
() => { |
||||
this.onLoad(this.page); |
||||
this.$message({ |
||||
type: "success", |
||||
message: "修改成功!", |
||||
}); |
||||
done(); |
||||
}, |
||||
(error) => { |
||||
window.console.log(error); |
||||
loading(); |
||||
} |
||||
); |
||||
}, |
||||
// 行删除 |
||||
rowDel(row) { |
||||
this.$confirm("此操作会删除该数据,且无法恢复,确定删除数据?", "提示", { |
||||
confirmButtonText: "确定", |
||||
cancelButtonText: "取消", |
||||
type: "warning", |
||||
}) |
||||
.then(() => { |
||||
remove(row.id).then((res) => { |
||||
// 测试用的假方法 |
||||
console.log(res); |
||||
this.$message.success("删除成功!"); |
||||
this.onLoad(this.page[0]); |
||||
}); |
||||
}) |
||||
.catch(() => { |
||||
// this.$message({ type: "info", message: "已取消删除" }); |
||||
}); |
||||
}, |
||||
}, |
||||
}; |
||||
</script> |
||||
<style lang="scss" scoped> |
||||
.search { |
||||
display: flex; |
||||
justify-content: space-between; |
||||
} |
||||
.search-select { |
||||
width: 150px; |
||||
margin-right: 20px; |
||||
} |
||||
.search-input { |
||||
width: 288px; |
||||
} |
||||
.search-btn { |
||||
width: 130px; |
||||
height: 46px !important; |
||||
background: #2e92f6; |
||||
color: #fff; |
||||
margin: 0 20px; |
||||
} |
||||
.search-reset { |
||||
width: 46px; |
||||
height: 46px !important; |
||||
background: #ff9130; |
||||
margin-left: 20px; |
||||
color: #fff; |
||||
text-align: center; |
||||
line-height: 46px; |
||||
} |
||||
/deep/ .el-input__inner { |
||||
height: 46px; |
||||
} |
||||
</style> |
||||
Loading…
Reference in new issue