|
@@ -0,0 +1,421 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="5" style="position:relative;z-index: 20">
|
|
|
+ <el-radio-group v-model="typeRadio" @input="initData">
|
|
|
+ <el-radio-button label="归档项目"></el-radio-button>
|
|
|
+ <el-radio-button label="垃圾桶"></el-radio-button>
|
|
|
+ </el-radio-group>
|
|
|
+ <div style="height:calc(100vh - 148px);margin-top:10px;overflow: auto">
|
|
|
+ <el-tree
|
|
|
+ :data="projectData"
|
|
|
+ :props="defaultProps"
|
|
|
+ :expand-on-click-node="false"
|
|
|
+ :check-on-click-node="true"
|
|
|
+ :indent="10"
|
|
|
+ accordion
|
|
|
+ ref="projectTree"
|
|
|
+ class="custom-tree"
|
|
|
+ node-key="id"
|
|
|
+ :highlight-current="true"
|
|
|
+ :default-expanded-keys="expandedKeys"
|
|
|
+ @node-expand="nodeExpand"
|
|
|
+ @node-click="handleNodeClick">
|
|
|
+ <span class="custom-tree-node" slot-scope="{ node, data }">
|
|
|
+ <el-tooltip class="item" effect="dark" :content="node.label" :disabled="node.label&&node.label.length<11"
|
|
|
+ placement="top-end">
|
|
|
+ <div>{{ node.label | ellipsis }}</div>
|
|
|
+ </el-tooltip>
|
|
|
+
|
|
|
+ <div v-if="data.type!='模块'" style="font-size: 12px;color: #1c84c6">({{ data.type }})</div>
|
|
|
+ </span>
|
|
|
+ </el-tree>
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="19">
|
|
|
+ <div class="query-container">
|
|
|
+ <el-form :model="queryParams" ref="queryForm" size="mini" :inline="true">
|
|
|
+ <el-form-item prop="startDate">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="queryParams.startDate"
|
|
|
+ type="date"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ placeholder="开始日期"
|
|
|
+ clearable
|
|
|
+ style="width: 135px">
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="endDate">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="queryParams.endDate"
|
|
|
+ type="date"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ placeholder="结束日期"
|
|
|
+ clearable
|
|
|
+ style="width: 135px">
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="priority">
|
|
|
+ <el-select
|
|
|
+ v-model="queryParams.priority"
|
|
|
+ placeholder="优先级"
|
|
|
+ style="width: 85px">
|
|
|
+ <el-option
|
|
|
+ v-for="dict in dict.type.task_priority"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+ :value="dict.value">
|
|
|
+ <el-tag :color="priorityColorMap[dict.value]" effect="dark" :hit="false">
|
|
|
+ {{ dict.label }}
|
|
|
+ </el-tag>
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
|
+ <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <el-table :data="taskList"
|
|
|
+ ref="taskList"
|
|
|
+ height="calc(100vh - 150px)"
|
|
|
+ @cell-mouse-enter="cellMouseEnter"
|
|
|
+ @cell-mouse-leave="cellMouseLeave"
|
|
|
+ @cell-click="cellClick"
|
|
|
+ @sort-change="sortChange"
|
|
|
+ row-key="id"
|
|
|
+ :indent="10"
|
|
|
+ :tree-props="{children: 'children'}">
|
|
|
+ <el-table-column label="任务编号" prop="id" width="120"/>
|
|
|
+ <el-table-column label="任务名称" prop="taskName" min-width="150" :show-overflow-tooltip="true"/>
|
|
|
+ <el-table-column label="执行(负责)人" prop="executorName" width="95"/>
|
|
|
+ <!-- <el-table-column label="进度" prop="progressValue" width="60">-->
|
|
|
+ <!-- <template slot-scope="scope">-->
|
|
|
+ <!-- <span>{{ (scope.row.progressValue ? scope.row.progressValue : 0) + '%' }}</span>-->
|
|
|
+ <!-- </template>-->
|
|
|
+ <!-- </el-table-column>-->
|
|
|
+ <!-- <el-table-column label="状态" align="center" width="80">-->
|
|
|
+ <!-- <template slot-scope="scope">-->
|
|
|
+ <!-- <el-tag size="mini" :type="statusMap[scope.row.status].type">{{-->
|
|
|
+ <!-- statusMap[scope.row.status].name-->
|
|
|
+ <!-- }}-->
|
|
|
+ <!-- </el-tag>-->
|
|
|
+ <!-- </template>-->
|
|
|
+ <!-- </el-table-column>-->
|
|
|
+ <el-table-column label="优先级" prop="priority" align="center" width="60">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-tag v-if="scope.row.priority==='1'" color="#fa8888" effect="dark" :hit="false">
|
|
|
+ {{ getTaskPriority(scope.row.priority) }}
|
|
|
+ </el-tag>
|
|
|
+ <el-tag v-else-if="scope.row.priority==='2'" color="#fb7fb7" effect="dark" :hit="false">
|
|
|
+ {{ getTaskPriority(scope.row.priority) }}
|
|
|
+ </el-tag>
|
|
|
+ <el-tag v-else-if="scope.row.priority==='3'" color="#40e0c3" effect="dark" :hit="false">
|
|
|
+ {{ getTaskPriority(scope.row.priority) }}
|
|
|
+ </el-tag>
|
|
|
+ <el-tag v-else color="#5dcfff" effect="dark" :hit="false">{{
|
|
|
+ getTaskPriority(scope.row.priority)
|
|
|
+ }}
|
|
|
+ </el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="开始时间" prop="beginDate" width="100"/>
|
|
|
+ <el-table-column label="结束时间" prop="endDate" width="100"/>
|
|
|
+ <el-table-column label="完成时间" prop="finishDate" width="100"/>
|
|
|
+ <el-table-column v-if="typeRadio==='垃圾桶'" label="删除人" prop="operatorUserName" width="60"/>
|
|
|
+ <el-table-column v-if="typeRadio==='垃圾桶'" label="删除时间" prop="updateTime" width="120">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ parseTime(scope.row.updateTime) }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column v-if="typeRadio==='垃圾桶'" label="删除原因" prop="remark" :show-overflow-tooltip="true"/>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <div style="margin-top: 10px;text-align: center">
|
|
|
+ <el-pagination
|
|
|
+ background
|
|
|
+ @size-change="handleSizeChange"
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
+ :current-page="queryParams.pageNum"
|
|
|
+ :page-sizes="[10, 20, 50]"
|
|
|
+ :page-size="queryParams.pageSize"
|
|
|
+ layout="total, sizes, prev, pager, next, jumper"
|
|
|
+ :total="total">
|
|
|
+ </el-pagination>
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <!-- 任务详情对话框 -->
|
|
|
+ <el-dialog :title="detailForm.id+'、'+detailForm.taskName" :visible.sync="detailOpen" width="900px"
|
|
|
+ class="add-dialog" append-to-body
|
|
|
+ :close-on-click-modal="true">
|
|
|
+ <task-detail :detail-form="detailForm"></task-detail>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import {
|
|
|
+ listTask,
|
|
|
+ getTask,
|
|
|
+ delTask,
|
|
|
+ addTask,
|
|
|
+ updateTask,
|
|
|
+ auditTask,
|
|
|
+ splitTask,
|
|
|
+ projectAuditConfigs, taskAuditConfigs, addTaskFeedback, delTaskWithReason, getDeleteTasks
|
|
|
+} from "@/api/task/task";
|
|
|
+import {getProjectTree, listProject} from "@/api/task/project";
|
|
|
+import {getDeptUserTree, getAuditUsers, resetUserPwd} from "@/api/system/user";
|
|
|
+import Treeselect from "@riophae/vue-treeselect";
|
|
|
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
+import DeptUserTree from "@/components/DeptUserTree"
|
|
|
+import FileUpload from "@/components/FileUpload"
|
|
|
+import Project from "@/views/task/components/project";
|
|
|
+import TaskDetail from "@/views/task/components/taskDetail"
|
|
|
+import TaskSplit from "@/views/task/components/taskSplit"
|
|
|
+
|
|
|
+import RichTextEditor from '@/components/RichTextEditor'
|
|
|
+import {mapGetters} from "vuex";
|
|
|
+import task from "@/views/mixins/task";
|
|
|
+import DateUtil from "@/utils/date";
|
|
|
+
|
|
|
+import AuditModule from '@/views/task/components/auditModule';
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "Task",
|
|
|
+ components: {Project, TaskDetail, DeptUserTree, FileUpload, Treeselect, RichTextEditor, TaskSplit, AuditModule},
|
|
|
+ dicts: ['task_status', 'task_priority'],
|
|
|
+ mixins: [task],
|
|
|
+ computed: {
|
|
|
+ ...mapGetters(['userId'])
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ typeRadio: '归档项目',
|
|
|
+ projectData: [],
|
|
|
+ defaultProps: {
|
|
|
+ children: "children",
|
|
|
+ label: "name"
|
|
|
+ },
|
|
|
+ expandedKeys: [],
|
|
|
+
|
|
|
+ // 总条数
|
|
|
+ total: 0,
|
|
|
+ // 列表数据
|
|
|
+ taskList: [],
|
|
|
+
|
|
|
+ // 查询参数
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 20,
|
|
|
+ projectId: undefined,
|
|
|
+ projectIds: [],
|
|
|
+ startDate: undefined,
|
|
|
+ endDate: undefined,
|
|
|
+ priority: undefined,
|
|
|
+ sortField: undefined,
|
|
|
+ order: undefined
|
|
|
+ },
|
|
|
+ detailTitle: "",
|
|
|
+ detailOpen: false,
|
|
|
+ detailForm: {},
|
|
|
+
|
|
|
+ };
|
|
|
+ },
|
|
|
+ filters: {
|
|
|
+ ellipsis(val) {
|
|
|
+ if (!val) {
|
|
|
+ return ''
|
|
|
+ }
|
|
|
+ if (val.length > 10) {
|
|
|
+ return val.slice(0, 10) + '...'
|
|
|
+ }
|
|
|
+ return val
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.initData();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ initData() {
|
|
|
+ this.getProjectTree();
|
|
|
+ this.getList();
|
|
|
+ // getDeptUserTree('1').then(res => {
|
|
|
+ // this.userList = res.data
|
|
|
+ // })
|
|
|
+ },
|
|
|
+ getProjectTree() {
|
|
|
+ this.projectData = []
|
|
|
+ if (this.typeRadio === '归档项目') {
|
|
|
+ getProjectTree({status: '1'}).then(response => {
|
|
|
+ this.projectData = response.data
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (this.typeRadio === '垃圾桶') {
|
|
|
+ getProjectTree({status: '0'}).then(res => {
|
|
|
+ this.projectData = res.data
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ /** 查询项目列表 */
|
|
|
+ getList() {
|
|
|
+ if (DateUtil.unix(this.queryParams.startDate) > DateUtil.unix(this.queryParams.endDate)) {
|
|
|
+ this.$message.warning("开始时间不能超过结束时间")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.typeRadio === '归档项目') {
|
|
|
+ if (!this.queryParams.projectId && this.projectData.length === 0) {
|
|
|
+ this.taskList = [];
|
|
|
+ this.total = 0;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!this.queryParams.projectId) {
|
|
|
+ let tempProjectIds = []
|
|
|
+ this.projectData.forEach(item => {
|
|
|
+ item.children.forEach(p => {
|
|
|
+ tempProjectIds.push(p.id)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ this.queryParams.projectIds = tempProjectIds
|
|
|
+ }
|
|
|
+
|
|
|
+ listTask(this.queryParams).then(res => {
|
|
|
+ this.taskList = res.data.records;
|
|
|
+ this.total = res.data.total;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (this.typeRadio === '垃圾桶') {
|
|
|
+ getDeleteTasks(this.queryParams).then(res => {
|
|
|
+ this.taskList = res.data.records;
|
|
|
+ this.total = res.data.total;
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ nodeExpand(data, node, self) {
|
|
|
+ this.expandedKeys = [data.id]
|
|
|
+ },
|
|
|
+ /** 节点单击事件 */
|
|
|
+ handleNodeClick(data) {
|
|
|
+ this.queryParams.projectId = data.id;
|
|
|
+ this.queryParams.projectIds = []
|
|
|
+ this.handleQuery()
|
|
|
+ },
|
|
|
+
|
|
|
+ /** 搜索按钮操作 */
|
|
|
+ handleQuery() {
|
|
|
+ this.queryParams.pageNum = 1;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ /** 重置按钮操作 */
|
|
|
+ resetQuery() {
|
|
|
+ this.resetForm("queryForm");
|
|
|
+ this.queryParams.projectId = undefined;
|
|
|
+ this.queryParams.projectIds = []
|
|
|
+ this.$refs.taskList.clearSort();
|
|
|
+ this.queryParams.sortField = undefined
|
|
|
+ this.queryParams.order = undefined
|
|
|
+ // this.$refs.pjTree.clear()
|
|
|
+ // this.$refs.dut.clearText()
|
|
|
+ this.handleQuery();
|
|
|
+ },
|
|
|
+ handleSizeChange(val) {
|
|
|
+ this.queryParams.pageSize = val;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ handleCurrentChange(val) {
|
|
|
+ this.queryParams.pageNum = val;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ /** 查看任务详情*/
|
|
|
+ cellClick(row, column, event) {
|
|
|
+ if (!column.property || column.property != 'taskName') {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (row.status === '6' && row.auditUserId === this.userId) {
|
|
|
+ this.handleAudit(row)
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ getTask(row.id).then(res => {
|
|
|
+ this.detailForm = res.data;
|
|
|
+ this.detailOpen = true;
|
|
|
+ this.detailTitle = "任务详情";
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ sortChange({column, prop, order}) {
|
|
|
+ this.queryParams.sortField = prop
|
|
|
+ if (order) {
|
|
|
+ this.queryParams.order = order.replace('ending', '')
|
|
|
+ }
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+
|
|
|
+ /** 转换项目数据结构 */
|
|
|
+ normalizer(node) {
|
|
|
+ if (node.children && !node.children.length) {
|
|
|
+ delete node.children;
|
|
|
+ }
|
|
|
+ let newVar = {
|
|
|
+ id: node.id,
|
|
|
+ label: node.projectName || node.name,
|
|
|
+ children: node.children,
|
|
|
+ isDisabled: node.type === '分类'
|
|
|
+ };
|
|
|
+ return newVar;
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ selectExecutor(val) {
|
|
|
+ this.$set(this.form, 'executor', val)
|
|
|
+ },
|
|
|
+ getFileUrl(val) {
|
|
|
+ this.form.files = val
|
|
|
+ },
|
|
|
+ removeFile(val) {
|
|
|
+ this.form.files = val
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style scoped lang="scss">
|
|
|
+.custom-tree-node {
|
|
|
+ flex: 1;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ font-size: 14px;
|
|
|
+ padding-right: 8px;
|
|
|
+}
|
|
|
+
|
|
|
+.el-form-item--mini.el-form-item, .el-form-item--small.el-form-item {
|
|
|
+ margin-bottom: 10px;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+.card-header {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between
|
|
|
+}
|
|
|
+
|
|
|
+.add-dialog ::v-deep .el-dialog__body {
|
|
|
+ padding: 0 20px 10px 20px;
|
|
|
+}
|
|
|
+
|
|
|
+.el-tag--dark {
|
|
|
+ border-color: white;
|
|
|
+}
|
|
|
+
|
|
|
+</style>
|