BAOLH
2025-10-16 ee756969610b6b0aaa39df85cebcdd0c8cef960e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <div>
        <!-- 搜索 -->
        <el-select v-model="query.projectId" value-key="id" clearable filterable placeholder="所属项目" style="width: 250px;"
          class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option v-for="item in projects" :key="item.id" :label="item.name" :value="item">
            <span style="float: left">{{ item.name }}</span>
          </el-option>
        </el-select>
        <el-select v-model="query.userId" filterable clearable placeholder="所属员工" style="width: 185px;"
          class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option v-for="item in users" :key="item.id" :label="item.nickName" :value="item.id" />
        </el-select>
        <el-select v-model="query.taskStatus" filterable clearable multiple collapse-tags placeholder="任务状态"
          style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option v-for="item in dict[taskStatus]" :key="item.id" :label="item.label" :value="item.value" />
        </el-select>
        <rrOperation :crud="crud" />
      </div>
    </div>
    <!--表格渲染-->
    <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;"
      @selection-change="crud.selectionChangeHandler">
      <el-table-column type="selection" width="55" />
      <el-table-column :show-overflow-tooltip="true" prop="projectName" label="项目名称" fixed="left" width="270">
        <template slot-scope="scope">
          <el-tag slot="reference">{{ scope.row.projectName }}</el-tag>
        </template>
      </el-table-column>
      <el-table-column :show-overflow-tooltip="true" prop="name" label="名称" fixed="left" width="270">
        <template slot-scope="scope">
          <el-tag slot="reference">{{ scope.row.name }}</el-tag>
        </template>
      </el-table-column>
      <el-table-column :show-overflow-tooltip="true" prop="taskStartDate" label="任务开始时间" width="140" />
      <el-table-column :show-overflow-tooltip="true" prop="taskEndDate" label="任务结束时间" width="140" />
      <el-table-column :show-overflow-tooltip="true" prop="taskHours" label="任务工时" width="80" />
      <el-table-column :show-overflow-tooltip="true" prop="userNickName" label="所属员工" width="100">
        <template slot-scope="scope">
          <el-tag v-if="scope.row.userNickName">{{
            scope.row.userNickName
          }}</el-tag>
          <el-tag v-else>未指定</el-tag>
        </template>
      </el-table-column>
      <el-table-column :show-overflow-tooltip="true" prop="performanceType" label="绩效类型" width="80">
          <template slot-scope="scope">
            <el-tag>{{ dict.label[performanceType][scope.row.performanceType] }}</el-tag>
          </template>
        </el-table-column>
      <el-table-column :show-overflow-tooltip="true" prop="performanceHours" label="分配工时" width="80" />
      <el-table-column :show-overflow-tooltip="true" prop="costHours" label="消耗工时" width="80" />
      <el-table-column :show-overflow-tooltip="true" label="任务进度" width="80">
        <template slot-scope="scope">
          <span style="margin-left: 10px">{{ scope.row.newTaskProgress }}%</span>
        </template>
      </el-table-column>
      <el-table-column :show-overflow-tooltip="true" prop="taskStatus" label="任务状态" width="80">
        <template slot-scope="scope">
          <el-tag>{{
            dict.label[taskStatus][scope.row.taskStatus]
          }}</el-tag>
        </template>
      </el-table-column>
    </el-table>
    <!--分页组件-->
    <pagination />
  </div>
</template>
<script>
import crudTaskUser from "@/api/task/taskUser";
import crudTask from "@/api/task/task";
import crudUser from "@/api/system/user";
import CRUD, { presenter, header, form, crud } from "@crud/crud";
import rrOperation from "@crud/RR.operation";
import crudOperation from "@crud/CRUD.operation";
import udOperation from "@crud/UD.operation";
import pagination from "@crud/Pagination";
import DateRangePicker from "@/components/DateRangePicker";
import Treeselect from "@riophae/vue-treeselect";
import { mapGetters } from "vuex";
import constant from "@/utils/constant";
import UploadExcelComponent from "@/components/UploadExcel/index.vue";
import UploadExcelComponentTwo from "@/components/UploadExcel/excelIndex.vue";
const defaultForm = {
  id: null,
  name: null,
  userId: null,
  projectId: null,
  task: { id: null, name: null },
  taskStartDate: null,
  taskEndDate: null,
  taskHours: null,
  performanceHours: null,
  newTaskProgress: null,
  taskStatus: null,
  remarks: null,
  divideUserIds: [],
  is_ok: null
};
export default {
  name: "HomePage",
  components: {
    Treeselect,
    crudOperation,
    rrOperation,
    udOperation,
    pagination,
    DateRangePicker,
    UploadExcelComponent,
    UploadExcelComponentTwo
  },
  cruds() {
    return CRUD({
      title: "任务分配",
      url: "api/taskUser",
      crudMethod: { ...crudTaskUser }
    });
  },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  // 数据字典
  dicts: [
    constant.TASK_STATUS,
    constant.TAST_CLASSIFICATION,
    constant.STANDARD_WORKLOAD_UNIT,
    constant.PERFORMANCE_TYPE
  ],
  data() {
    return {
      projectId: null,
      projectDatas: [],
      taskName: "",
      selectedTaskName: "",
      planStartTime: null,
      planEndTime: null,
      taskTotal: {},
      taskDatas: [],
      taskLoading: false,
      defaultProps: { children: "nodes", label: "name", isLeaf: "leaf" },
      permission: {
        list: ["admin", "taskUser:list"],
      },
      queryTypeOptions: [
        { key: "userId", display_name: "所属员工" },
        { key: "taskStatus", display_name: "任务状态" },
        { key: "createTime", display_name: "创建时间" }
      ],
      // 字典:任务状态
      taskStatus: constant.TASK_STATUS,
      // 字典:任务分类
      taskClassification: constant.TAST_CLASSIFICATION,
      // 字典:标准工作量单位
      standardWorkloadUnit: constant.STANDARD_WORKLOAD_UNIT,
      // 字典:绩效对象
      performanceType: constant.PERFORMANCE_TYPE,
      // 字典:批准状态-未承认
      approveStatusUnrecognized: constant.APPROVE_STATUS_UNRECOGNIZED,
      // CRUD状态
      crudStatusPrepared: CRUD.STATUS.PREPARED,
      Is_ok: false,
      generateForm: [],
      tableHeader: [],
      users: [],
      // 项目列表
      projects: [],
      // 检索任务列表
      queryTasks: [],
      // 表单任务列表
      formTasks: [],
      selectedTask: "",
      dialogVisible_taskUser: false,
      dialogLoading_taskUser: true,
      taskLoading_L: true,
      dialogVisible_task: false,
      dialogVisible_task_LQ: false,
      dialogLoading_task: true,
      dialogLoading_task_LQ: true,
      steps: [],
      TaskName: "",
      expectedHours: "",
      actualHours: "",
      taskUserDetail: {},
      taskDetail: {},
      taskProgress: "",
      ProgressStatus: "",
      advList: [],
      tobeOver: "first",
      tobeTasked: "任务详细",
      total: 0,
      currentPage: 1,
      pageSize: 10,
      slong: false,
      taskSo: constant.TASK_STATUS_UNRECOGNIZED,
      taskSt: constant.TASK_STATUS_COMPLETED,
      taskStatusOne: ''
    };
  },
  computed: {
    ...mapGetters(["user"])
  },
  mounted() {
    this.getAllProjectDatas();
  },
  methods: {
    getAllProjectDatas() {
      crudTask.getProjects().then(res => {
        this.projectDatas = res;
      });
    },
  }
};
</script>
 
<style rel="stylesheet/scss" lang="scss">
.hide-time .el-button--text {
  display: none;
}
 
.tree-scroll {
  height: 100%;
  width: 100%;
}
 
.flow-tree {
  overflow-x: hidden;
  overflow-y: auto;
  max-height: 600px;
  width: 100%;
 
  >>>.el-tree-node {
    >.el-tree-node__children {
      overflow-y: visible !important;
    }
 
    >.el-tree-node__content {
      height: 100%;
    }
  }
}
 
::v-deep .vue-treeselect__control,
::v-deep .vue-treeselect__placeholder,
::v-deep .vue-treeselect__single-value {
  height: 40px;
  line-height: 40px;
}
 
.active {
  /* 添加长亮效果的样式 */
  color: #1890ff;
}
</style>