BAOLH
2026-11-10 4d730af0447c686133130d0116a0fa3dd82c2dca
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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
<template>
  <div class="app-container">
    <div class="head-container">
      <div>
        <!-- 搜索 -->
        <el-date-picker
          v-model="query.fillDates"
          type="daterange"
          clearable
          class="filter-item"
          value-format="yyyy-MM-dd"
          placeholder="请选择日报日期"
          range-separator=" ~ "
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          style="width: 285px; margin-top: 6px;"
        />
        <el-cascader
          v-model="selectedValue"
          :filterable="true"
          :options="options"
          :props="props"
          clearable
          placeholder="员工"
          :show-all-levels="false"
          :collapse-tags="true"
          class="cascader-item"
          @change="changeUserList"
        />
        <el-select v-model="query.projectId" filterable clearable placeholder="所属项目" :loading="loadingProject" style="width: 185px; margin-top: 6px;" class="filter-item" @change="queryProjectChange" @clear="clearQueryTasks">
          <el-option
            v-for="item in queryProjects"
            :key="item.id"
            :label="item.name"
            :value="item.id"
          />
        </el-select>
        <el-select v-model="query.taskMongoId" filterable clearable placeholder="所属任务" :loading="loadingTask" style="width: 185px; margin-top: 6px;" class="filter-item">
          <el-option
            v-for="item in queryTasks"
            :key="item.id"
            :label="item.name"
            :value="item.id"
          />
        </el-select>
        <el-input v-model="query.name" filterable clearable placeholder="任务名称" style="width: 185px; margin-top: 6px;" class="filter-item" />
 
        <rrOperation :crud="crud" />
 
        <div style="color: red;">*检索条件【所属项目】仅包含状态为【进行中】的项目</div>
      </div>
      <!--表格渲染-->
      <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" :summary-method="getSummaries" show-summary @selection-change="crud.selectionChangeHandler">
        <el-table-column type="selection" width="55" />
        <el-table-column :show-overflow-tooltip="true" prop="fillDate" label="填写日期" fixed="left" min-width="100px">
          <template slot-scope="scope">
            {{ crud.toDate(scope.row.fillDate) }}
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="userNickName" label="所属员工" fixed="left" min-width="100px">
          <template slot-scope="scope">
            <el-tag>{{ scope.row.userNickName }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="projectName" label="所属项目" min-width="140px">
          <template slot-scope="scope">
            <el-tag>{{ scope.row.projectName }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="taskName" label="所属任务" min-width="180px">
          <template slot-scope="scope">
            <el-tag>{{ scope.row.taskName }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="taskUserMongo.name" label="分配任务" min-width="180px">
          <template slot-scope="scope">
            <el-tag>{{ scope.row.taskUserMongo.name }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="consumedHours" label="消耗工时" min-width="80px" />
        <el-table-column :show-overflow-tooltip="true" prop="taskProgress" label="任务进度" min-width="80px">
          <template slot-scope="scope">
            {{ scope.row.taskProgress }}%
          </template>
        </el-table-column>
        <el-table-column v-if="checkPer(['task:businessLeader'])" :show-overflow-tooltip="true" prop="taskUserMongo.taskHours" label="计划工时" min-width="80px" />
        <el-table-column v-if="checkPer(['task:businessLeader'])" :show-overflow-tooltip="true" prop="accumulateHours" label="累计工时" min-width="80px" />
        <el-table-column :show-overflow-tooltip="true" prop="settlementStatus" min-width="80px" label="绩效类型">
          <template slot-scope="scope">
            <el-tag>{{ scope.row.taskUserMongo.performanceType === "1" ? "绩效" : "非绩效" }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="remarks" label="备注" min-width="140px" />
      </el-table>
      <!--分页组件-->
      <pagination />
    </div>
  </div>
</template>
 
<script>
import crudTaskDaliy from '@/api/task/taskDaliy'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import pagination from '@crud/Pagination'
import { mapGetters } from 'vuex'
import constant from '@/utils/constant'
import crudProject from '@/api/project/project'
import crudTask from '@/api/task/task'
import crudUser from '@/api/system/user'
 
const defaultForm = { id: null, projectId: null, taskId: null, taskName: null, taskMongoId: null, taskUserMongo: {}, userId: null, fillDate: null, consumedHours: null, todayFixedHours: 0, todayAttendanceHours: 0, alreadyConsumedHours: 0, taskHours: 0, consumedWorkload: null, consumedWorkloadUnit: null, taskProgress: null, settlementStatus: constant.SETTLEMENT_STATUS_UNSETTLED, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null }
export default {
  name: 'OtherDaliy',
  components: { pagination, rrOperation },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  dicts: [constant.STANDARD_WORKLOAD_UNIT, constant.SETTLEMENT_STATUS],
  cruds() {
    return CRUD({ title: '员工任务日报', url: 'api/taskDaliy/4dept', idField: 'id', sort: 'fillDate,desc', crudMethod: { ...crudTaskDaliy }})
  },
  data() {
    return {
      permission: {
        add: ['admin', 'taskDaliy:add'],
        edit: ['admin', 'taskDaliy:edit'],
        del: ['admin', 'taskDaliy:del'],
        download: ['admin', 'taskDaliy:download']
      },
      queryTypeOptions: [
        { key: 'userId', display_name: '所属员工' },
        { key: 'projectId', display_name: '所属项目' },
        { key: 'taskId', display_name: '所属任务' },
        { key: 'taskUserId', display_name: '分配任务' },
        { key: 'TaskUserName', display_name: '任务名称' },
        { key: 'taskMongoId', display_name: '任务名称' }
      ],
      // 字典:结算状态
      settlementStatus: constant.SETTLEMENT_STATUS,
      // 字典:绩效对象
      performanceType: constant.PERFORMANCE_TYPE,
      // 用户列表
      users: [],
      // 检索项目列表
      queryProjects: [],
      // 检索任务列表
      queryTasks: [],
      loadingProject: true,
      loadingTask: false,
 
      options: [],
      selectedValue: [],
 
      props: { multiple: true }
    }
  },
  computed: {
    ...mapGetters([
      'user'
    ])
  },
  mounted() {
    this.getUser()
    this.getQueryProject()
  },
  methods: {
    changeUserList(e) {
      var tempList = []
      for (let i = 0; i < e.length; i++) {
        var temp = e[i]
        tempList.push(temp[e[i].length - 1])
      }
      this.query.userIds = tempList
    },
    // 获取用户
    getUser() {
      // 获取用户
      crudUser.getAll().then(res => {
        // 用户列表
        this.users = res
      })
 
      crudUser.getUserDept().then(res => {
        this.options = res
      })
    },
    // 获取检索项目
    getQueryProject() {
      this.loadingProject = true
      this.queryProjects = []
      // 获取项目(liableUserId传''用于占位)
      crudProject.getAll({ projectStatusIn: ['project_status_under_way'], liableUserId: this.checkPer(['task:businessLeader']) ? '' : null }).then(res => {
        // 检索项目列表
        this.queryProjects = res
        this.loadingProject = false
      })
    },
    // 检索项目变更
    queryProjectChange() {
      this.queryTasks = []
      this.loadingTask = true
      // 检索赋值
      this.$set(this.query, 'taskId', null)
      // 判断检索项目是否为空
      if (this.query.projectId === null || this.query.projectId === '') {
        // 检索任务列表
        this.queryTasks = []
      } else {
        // 获取任务
        crudTask.getAll({ projectId: this.query.projectId }).then(res => {
          // 检索任务列表
          this.queryTasks = res
          this.loadingTask = false
        })
      }
    },
    clearQueryTasks() {
      this.loadingTask = false
    },
    // 表格工时汇总
    getSummaries(param) {
      const { columns, data } = param
      const sums = []
      sums[0] = '合计'
      columns.forEach((column, index) => {
        if (column.property === 'consumedHours') {
          const values = data.map(item => Number(item[column.property]))
          if (!values.every(value => isNaN(value))) {
            sums[index] = values.reduce((prev, curr) => {
              const value = Number(curr)
              if (!isNaN(value)) {
                return prev + curr
              } else {
                return prev
              }
            }, 0)
            sums[index] += ' 小时'
          } else {
            sums[index] = ''
          }
        }
      })
      return sums
    }
  }
}
</script>
 
<style scoped>
  adventTable tr:first-child {
    display: none;
  }
  .cascader-item >>> .el-input__inner {
    height: 29.5px !important;
    line-height: 29.5px !important;
  }
  .cascader-item >>> .el-cascader__search-input {
    height: 20px !important;
    margin: 2px 0px 0px 15px !important;
  }
  .cascader-item >>> .el-tag {
    margin-top: 4.5px;
  }
  .cascader-item >>> .el-input__suffix {
    height: 29.5px !important;
  }
  .cascader-item >>> .el-input--small {
    height: 29.5px !important;
  }
  .cascader-item >>> .el-cascader__tags {
    height: 29.5px !important;
  }
  .cascader-item >>> .el-input--small {
    height: 29.5px !important;
  }
</style>