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.
314 lines
9.5 KiB
314 lines
9.5 KiB
<template>
|
|
<div class="g-main">
|
|
<!-- 重点任务 -->
|
|
<div class="m-search">
|
|
<el-form :inline="true" :model="queryParams" ref="ref_searchform" :label-width="'100px'">
|
|
<div>
|
|
<el-form-item label="所属组织" prop="agencyId">
|
|
<el-cascader style="width: 100%;" v-model="cascaderAgencyId" :options="organizeOptions"
|
|
:props="{ checkStrictly: true, multiple: false, value: 'value', label: 'label', children: 'children' }"
|
|
:show-all-levels="false" @change="handleOrgChange" clearable></el-cascader>
|
|
</el-form-item>
|
|
|
|
<el-form-item label="任务名称" prop="title">
|
|
<el-input v-model.trim="queryParams.title" class="item_width_1" clearable placeholder="请输入">
|
|
</el-input>
|
|
</el-form-item>
|
|
|
|
<el-form-item label="有效时间" prop="timeRange">
|
|
<el-date-picker v-model="timeRange" type="daterange" value-format="yyyy-MM-dd"
|
|
format="yyyy-MM-dd" range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间">
|
|
</el-date-picker>
|
|
</el-form-item>
|
|
</div>
|
|
<div>
|
|
<div style="display: flex; justify-content: flex-end;">
|
|
<el-button style="margin-left:10px" class="diy-button--blue" size="small"
|
|
@click="handleSearch">查询</el-button>
|
|
<el-button style="margin-left:10px" class="diy-button--white" size="small"
|
|
@click="resetSearch">重置</el-button>
|
|
</div>
|
|
</div>
|
|
</el-form>
|
|
</div>
|
|
<div class="m-table">
|
|
<div class="div_btn">
|
|
<el-button style="" class="diy-button--add" size="small" @click="handleAdd">新增</el-button>
|
|
</div>
|
|
|
|
<el-table class="table" :data="tableData" border :height="tableHeight" v-loading="tableLoading"
|
|
style="width: 100%;margin-top:16px">
|
|
|
|
<el-table-column label="序号" header-align="center" align="center" type="index" width="50" />
|
|
<el-table-column prop="agencyName" header-align="center" align="center" label="所属组织" />
|
|
|
|
<el-table-column prop="title" header-align="center" align="center" label="任务名称" />
|
|
<el-table-column prop="title" header-align="center" align="center" label="有效期">
|
|
<template slot-scope="scope">
|
|
<!-- {{ dayjs(scope.row.startTime).format('YYYY-MM-DD') }}至{{ dayjs(scope.row.endTime).format('YYYY-MM-DD') }} -->
|
|
{{ scope.row.startTime.substring(0, 10) }} 至 {{ scope.row.endTime.substring(0, 10) }}
|
|
</template>
|
|
</el-table-column>
|
|
|
|
<el-table-column prop="releaseTime" header-align="center" align="center" label="发布时间">
|
|
|
|
</el-table-column>
|
|
<el-table-column label="操作" fixed="right" header-align="center" align="center" class="operate">
|
|
<template slot-scope="scope">
|
|
|
|
<el-button type="text" style="color:#1C6AFD;" size="small" @click="handleDetail(scope.row)">查看</el-button>
|
|
|
|
<el-button v-if="scope.row.status !== 1" type="text" style="color:#1C6AFD;" size="small"
|
|
@click="handleEdit(scope.row)">编辑</el-button>
|
|
|
|
<el-button v-if="scope.row.status !== 1" type="text" style="color:#1C6AFD;" size="small"
|
|
@click="handleDelete(scope.row)">删除</el-button>
|
|
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<div>
|
|
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="pageNo"
|
|
:page-sizes="[10, 20, 50]" :page-size="pageSize" layout="sizes, prev, pager, next, total" :total="total">
|
|
</el-pagination>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 新增 || 修改 || 查看弹出框 -->
|
|
<keyTask-dialog ref="keyTaskDialog" :visible.sync="dialogVisible" :title="dialogTitle"
|
|
@success="getDataList"></keyTask-dialog>
|
|
|
|
|
|
</div>
|
|
</template>
|
|
<script>
|
|
import dayjs from 'dayjs'
|
|
import { mapGetters } from 'vuex'
|
|
import keyTaskDialog from '@/views/modules/hengAnShield/keyTask/components/keyTaskDialog'
|
|
import { requestPost } from "@/js/dai/request";
|
|
import { Loading } from 'element-ui'
|
|
|
|
let loading // 加载动画
|
|
export default {
|
|
name: 'revitalizeIndex',
|
|
components: {
|
|
keyTaskDialog
|
|
},
|
|
data() {
|
|
return {
|
|
loading: false,
|
|
total: 0,
|
|
pageSize: 10,
|
|
pageNo: 1,
|
|
tableLoading: false,
|
|
timeRange: [],
|
|
queryParams: {
|
|
title: "",
|
|
agencyId: "",
|
|
startTime: "",
|
|
endTime: "",
|
|
},
|
|
cascaderAgencyId: [],
|
|
organizeOptions: [],
|
|
tableData: [],
|
|
dialogVisible: false,
|
|
dialogTitle: '',
|
|
}
|
|
},
|
|
created() {
|
|
this.getOptions();
|
|
// 获取列表数据
|
|
this.getDataList();
|
|
},
|
|
|
|
methods: {
|
|
// 获取所属组织
|
|
async getOptions() {
|
|
const { data } = await requestPost("/gov/org/customeragency/orgtree", {});
|
|
this.organizeOptions = data ? [this.computeOption(data)] : []
|
|
},
|
|
// 格式化数据
|
|
computeOption(opt) {
|
|
return {
|
|
label: opt.agencyName,
|
|
value: opt.agencyId,
|
|
type: "agency",
|
|
children: [
|
|
...this.processDepartmentList(opt.departmentList),
|
|
...this.processGridList(opt.gridList),
|
|
...this.processSubAgencyList(opt.subAgencyList),
|
|
],
|
|
};
|
|
},
|
|
// 处理部门列表
|
|
processDepartmentList(departmentList) {
|
|
return (departmentList || []).map((item) => ({
|
|
label: item.deptName,
|
|
value: item.deptId,
|
|
type: "dept",
|
|
typeName: "部门",
|
|
}))
|
|
},
|
|
// 处理网格列表
|
|
processGridList(gridList) {
|
|
return (gridList || []).map((item) => ({
|
|
label: item.gridName,
|
|
value: item.gridId,
|
|
type: "grid",
|
|
typeName: "网格",
|
|
}))
|
|
},
|
|
// 处理子机构列表
|
|
processSubAgencyList(subAgencyList) {
|
|
return (subAgencyList || []).map((item) => this.computeOption(item))
|
|
},
|
|
// 修改组织级联选择器值
|
|
handleOrgChange(val) {
|
|
this.queryParams.agencyId = val[val.length - 1];
|
|
},
|
|
async getDataList() {
|
|
const url = "/actual/base/importantTask/page";
|
|
this.queryParams.startTime = this.timeRange[0]? dayjs(this.timeRange[0]).startOf('day').format("YYYY-MM-DD HH:mm:ss") : '';
|
|
this.queryParams.endTime = this.timeRange[1]? dayjs(this.timeRange[1]).endOf('day').format("YYYY-MM-DD HH:mm:ss") : '';
|
|
let params = {
|
|
pageSize: this.pageSize,
|
|
pageNo: this.pageNo,
|
|
...this.queryParams,
|
|
};
|
|
let { data, code, msg } = await requestPost(url, params);
|
|
console.log('data===', data)
|
|
if (code === 0) {
|
|
this.total = data.total
|
|
this.tableData = data.list
|
|
} else {
|
|
this.$message.error(msg)
|
|
}
|
|
},
|
|
handleSearch() {
|
|
this.pageNo = 1
|
|
this.getDataList()
|
|
},
|
|
|
|
// 新增
|
|
handleAdd() {
|
|
this.dialogVisible = true
|
|
this.dialogTitle = '新增'
|
|
this.$nextTick(() => {
|
|
this.$refs.keyTaskDialog.initForm()
|
|
})
|
|
},
|
|
// 编辑
|
|
handleEdit(row) {
|
|
this.dialogVisible = true
|
|
this.dialogTitle = '编辑'
|
|
this.$nextTick(() => {
|
|
this.$refs.keyTaskDialog.initForm(row)
|
|
})
|
|
},
|
|
|
|
// 查看
|
|
handleDetail(row) {
|
|
this.dialogVisible = true
|
|
this.dialogTitle = '详情'
|
|
this.$nextTick(() => {
|
|
this.$refs.keyTaskDialog.initForm(row)
|
|
})
|
|
},
|
|
|
|
// 删除
|
|
async handleDelete(row) {
|
|
this.$confirm("确认删除?", "提示", {
|
|
confirmButtonText: "确定",
|
|
cancelButtonText: "取消",
|
|
type: "warning"
|
|
})
|
|
.then(async () => {
|
|
const url = "/actual/base/importantTask/delete"
|
|
let id = [row.id]
|
|
const { data, code, internalMsg } = await requestPost(url, id)
|
|
if (code === 0) {
|
|
this.$message({
|
|
type: "success",
|
|
message: "删除成功"
|
|
});
|
|
this.getDataList()
|
|
} else {
|
|
this.$message.error(internalMsg)
|
|
}
|
|
})
|
|
.catch(err => {
|
|
|
|
});
|
|
},
|
|
|
|
//重置搜索条件
|
|
resetSearch() {
|
|
this.timeRange = []
|
|
this.queryParams = {
|
|
title: "",
|
|
status: "",
|
|
startTime: "",
|
|
endTime: "",
|
|
}
|
|
this.pageSize = 10
|
|
this.pageNo = 1
|
|
this.getDataList()
|
|
},
|
|
|
|
handleSizeChange(val) {
|
|
this.pageSize = val
|
|
this.pageNo = 1
|
|
this.getDataList()
|
|
},
|
|
handleCurrentChange(val) {
|
|
this.pageNo = val
|
|
this.getDataList()
|
|
},
|
|
|
|
// 开启加载动画
|
|
startLoading() {
|
|
loading = Loading.service({
|
|
lock: true, // 是否锁定
|
|
text: '正在加载……', // 加载中需要显示的文字
|
|
background: 'rgba(0,0,0,.7)' // 背景颜色
|
|
})
|
|
},
|
|
// 结束加载动画
|
|
endLoading() {
|
|
// clearTimeout(timer);
|
|
if (loading) {
|
|
loading.close()
|
|
}
|
|
}
|
|
},
|
|
computed: {
|
|
tableHeight() {
|
|
return this.$store.state.inIframe ? this.clientHeight - 430 + this.iframeHeight : this.clientHeight - 430
|
|
},
|
|
...mapGetters(['clientHeight', 'iframeHeight'])
|
|
}
|
|
}
|
|
</script>
|
|
<style lang="scss" scoped>
|
|
.g-main {
|
|
width: 100%;
|
|
}
|
|
|
|
.m-search {
|
|
background: #ffffff;
|
|
border-radius: 4px;
|
|
padding: 24px 10px 10px;
|
|
box-shadow: 0px 2px 12px 0px rgba(0, 0, 0, 0.1);
|
|
margin: 20px 7px 7px;
|
|
}
|
|
|
|
.m-table {
|
|
background: #ffffff;
|
|
box-shadow: 0px 2px 12px 0px rgba(0, 0, 0, 0.1);
|
|
border-radius: 4px;
|
|
margin-top: 15px;
|
|
padding: 24px 16px 10px;
|
|
margin: 16px 7px 7px;
|
|
|
|
}
|
|
</style>
|