大数据局-工单系统-前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

211 lines
5.2 KiB

<template>
<div class="cus-container">
<el-form :model="searchForm">
<div class="search">
<div style="display: flex; align-items: center">
<el-select
v-model="searchForm.taskParentId"
placeholder="任务父类"
class="search-select"
>
<el-option
v-for="item in parentList"
:key="item.id"
:label="item.dictValue"
:value="item.id"
>
</el-option>
</el-select>
<el-select
v-model="searchForm.taskTypeName"
placeholder="任务种类"
class="search-select"
>
<el-option
v-for="item in taskTypeList"
:key="item.taskTypeName"
:label="item.taskTypeName"
:value="item.taskTypeName"
>
</el-option>
</el-select>
<el-select
v-model="searchForm.taskLevel"
placeholder="任务等级"
class="search-select"
>
<el-option
v-for="item in levelList"
:key="item.id"
:label="item.dictValue"
:value="item.id"
>
</el-option>
</el-select>
<el-date-picker
style="width: 314px; margin-right: 20px"
v-model="searchForm.timeArr"
format="yyyy-MM-dd HH:mm"
value-format="yyyy-MM-dd HH:mm:ss"
class="search-picker"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
<div style="display: flex">
<el-button class="search-btn" @click="searchHandle(1)"
>查询</el-button
>
<div class="search-reset" @click="searchHandle(2)">
<i class="el-icon-refresh-right" style="font-size: 20px"></i>
</div>
</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"
@current-change="currentChange"
@size-change="sizeChange"
>
</avue-crud>
</div>
</div>
</template>
<script>
import { getList } from "@/api/logs";
import { tableOption } from "@/const/journal/journal.js";
export default {
data() {
return {
searchForm: {
timeArr: null,
},
option: tableOption,
page: {
current: 1,
total: 0,
size: 10,
},
// 表格数据
tableData: [],
loading: false,
parentList: [],
levelList: [],
};
},
created() {
// this.getDict();
this.onLoad();
},
methods: {
// 字典请求
// getDict() {
// getTaskParent().then((res) => {
// this.parentList = res.data.data;
// const column = this.findObject(this.option.column, "taskParentId");
// column.dicData = res.data.data;
// });
// getTaskLevel().then((res) => {
// this.levelList = res.data.data;
// const column = this.findObject(this.option.column, "taskLevel");
// column.dicData = res.data.data;
// });
// getTaskTypeData().then((res) => {
// this.taskTypeList = res.data.data;
// });
// },
// 列表
onLoad() {
this.loading = true;
const { current, size } = this.page;
if (
this.searchForm.timeArr !== null &&
this.searchForm.timeArr !== undefined
) {
this.searchForm.startTime = this.searchForm.timeArr[0];
this.searchForm.endTime = this.searchForm.timeArr[1];
}
const {
taskParentId,
taskTypeName,
taskLevel,
startTime,
endTime,
} = this.searchForm;
let params = {
taskParentId,
taskTypeName,
taskLevel,
startTime,
endTime,
};
getList({ current, size, ...params }).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) {
this.page.current = 1;
if (index === 2) {
this.searchForm = {
timeArr: null,
};
}
this.onLoad();
},
},
};
</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-left: 40px;
margin-right: 20px;
}
.search-reset {
width: 46px;
height: 44px !important;
background: #ff9130;
color: #fff;
text-align: center;
line-height: 46px;
}
/deep/ .el-input__inner {
height: 46px;
}
</style>