view.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772
  1. <template>
  2. <div class="app-container">
  3. <el-row>
  4. <el-col :span="22">
  5. <el-form :model="queryParams" ref="queryForm" size="mini" :inline="true">
  6. <el-form-item label="日期" prop="startDate">
  7. <el-date-picker
  8. v-model="queryParams.startDate"
  9. type="date"
  10. value-format="yyyy-MM-dd"
  11. @change="getList"
  12. placeholder="开始日期"
  13. :clearable="false"
  14. style="width: 135px">
  15. </el-date-picker>
  16. </el-form-item>
  17. <el-form-item label="至" prop="endDate">
  18. <el-date-picker
  19. v-model="queryParams.endDate"
  20. type="date"
  21. value-format="yyyy-MM-dd"
  22. @change="getList"
  23. placeholder="结束日期"
  24. :clearable="false"
  25. style="width: 135px">
  26. </el-date-picker>
  27. </el-form-item>
  28. <el-form-item prop="statusGroup">
  29. <el-checkbox-group v-model="queryParams.statusGroup" size="mini" @change="getList">
  30. <el-checkbox-button
  31. v-for="dict in dict.type.task_status"
  32. :key="dict.value"
  33. :label="dict.value"
  34. >{{ dict.value === '0' ? '待查看' : dict.label }}
  35. </el-checkbox-button>
  36. </el-checkbox-group>
  37. </el-form-item>
  38. <el-form-item prop="priority">
  39. <el-select
  40. v-model="queryParams.priority"
  41. @change="getList"
  42. clearable
  43. placeholder="优先级"
  44. style="width: 85px">
  45. <el-option
  46. v-for="dict in dict.type.task_priority"
  47. :key="dict.value"
  48. :label="dict.label"
  49. :value="dict.value">
  50. <el-tag :color="priorityColorMap[dict.value]" effect="dark" :hit="false">
  51. {{ dict.label }}
  52. </el-tag>
  53. </el-option>
  54. </el-select>
  55. </el-form-item>
  56. </el-form>
  57. </el-col>
  58. <el-col :span="2">
  59. <el-button
  60. type="primary"
  61. plain
  62. icon="el-icon-plus"
  63. size="mini"
  64. @click="handleAdd"
  65. >日常任务
  66. </el-button>
  67. </el-col>
  68. </el-row>
  69. <el-table
  70. class="view-table"
  71. :data="tableData"
  72. size="mini"
  73. @cell-mouse-enter="cellMouseEnter"
  74. @cell-mouse-leave="cellMouseLeave"
  75. :cell-style="cellStyle"
  76. @cell-click="cellClick"
  77. @cell-dblclick="cellDbClick"
  78. @row-click="rowClick"
  79. height="calc(100vh - 120px)"
  80. border>
  81. <el-table-column fixed prop="id" label="编号" align="center" width="50"/>
  82. <el-table-column fixed prop="taskName" label="任务名称" align="center" class="task-name-cell" width="180"/>
  83. <el-table-column fixed prop="executorName" label="主负责人" align="center" width="90">
  84. <template slot-scope="scope">
  85. <div style="line-height: 15px">{{ scope.row.executorName }}</div>
  86. <el-tag size="mini" :type="statusMap[scope.row.status].type">
  87. {{ statusMap[scope.row.status].name + ' ' + scope.row.progressValue + '%' }}
  88. </el-tag>
  89. </template>
  90. </el-table-column>
  91. <el-table-column fixed prop="" label="优先级" align="center" width="60">
  92. <template slot-scope="scope">
  93. <el-tag :color="priorityColorMap[scope.row.priority]" effect="dark" :hit="false">
  94. {{ getTaskPriority(scope.row.priority) }}
  95. </el-tag>
  96. </template>
  97. </el-table-column>
  98. <el-table-column align="center" v-for="header in tableHeaders" :key="header.day" :prop="header.day" width="42">
  99. <template slot="header">
  100. <el-popover placement="top" trigger="hover">
  101. <div>{{ header.day }}已反馈工时:
  102. <span style="font-size: 16px;font-weight: bold; margin-right: 5px">{{ header.dayHours }}</span>
  103. 小时
  104. </div>
  105. <div slot="reference" style="width:40px;text-align: center;cursor: pointer">
  106. <div style="font-size: 10px;">{{ header.day }}</div>
  107. <div v-if="header.week=='周六'" class="view-cell" style="color: #1c84c6">{{ header.week }}</div>
  108. <div v-else-if="header.week=='周日'" class="view-cell" style="color: #1c84c6">{{ header.week }}</div>
  109. <div v-else-if="header.week=='今日'" class="view-cell" style="color: #00E704">{{ header.week }}</div>
  110. <div v-else class="view-cell">{{ header.week }}</div>
  111. </div>
  112. </el-popover>
  113. </template>
  114. <template slot-scope="scope">
  115. <span v-if="scope.row[header.day].comment" class="comment-badge"></span>
  116. <span v-if="scope.row[header.day].audit" class="audit-badge"></span>
  117. <el-popover
  118. v-if="scope.row[header.day].value!=''"
  119. placement="top"
  120. width="700"
  121. trigger="click">
  122. <el-table :data="feedbacks" border size="mini">
  123. <el-table-column width="75" label="反馈状态" align="center">
  124. <template slot-scope="temp">
  125. <div>{{ getFeedbackTypeName(temp.row.feedbackType) }}</div>
  126. </template>
  127. </el-table-column>
  128. <el-table-column width="60" property="userName" label="反馈人" align="center"/>
  129. <el-table-column width="55" label="完成度" align="center">
  130. <template slot-scope="temp">
  131. <div>{{ !temp.row.value ? '' : temp.row.value + '%' }}</div>
  132. </template>
  133. </el-table-column>
  134. <el-table-column width="60" prop="hours" label="工时(h)" align="center"/>
  135. <el-table-column width="110" property="createTime" label="反馈时间" align="center">
  136. <template slot-scope="temp">
  137. <div>{{ parseTime(temp.row.createTime) }}</div>
  138. </template>
  139. </el-table-column>
  140. <el-table-column label="反馈备注" align="center">
  141. <template slot-scope="temp">
  142. <div>
  143. <span>{{ temp.row.description }}</span>
  144. <span v-for="(file,index) in temp.row.fileList">
  145. <a :href="file.url" style="color: darkgreen">
  146. <span style="margin-left: 5px">{{ file.name }}</span>
  147. </a>
  148. </span>
  149. </div>
  150. </template>
  151. </el-table-column>
  152. <el-table-column label="当前达成进度" width="100px" align="center">
  153. <template slot-scope="temp">
  154. <el-popover
  155. v-if="temp.row.descriptionDetail&&temp.row.descriptionDetail.length>0"
  156. placement="top"
  157. width="600"
  158. trigger="hover">
  159. <div v-html="temp.row.descriptionDetail"></div>
  160. <el-button slot="reference" type="text">详情</el-button>
  161. </el-popover>
  162. <span
  163. v-if="(temp.row.feedbackType === '4'||temp.row.feedbackType === '5')&& scope.row.executor===userId && temp.row.commentConfirm!='1'"
  164. style="margin-left: 10px">
  165. <el-button type="text" icon="el-icon-thumb" size="mini"
  166. @click="confirmComment(temp.row)">确认</el-button>
  167. </span>
  168. </template>
  169. </el-table-column>
  170. </el-table>
  171. <div slot="reference" style="line-height:40px;font-size: 10px;cursor: pointer">
  172. {{ scope.row[header.day].value }}
  173. </div>
  174. </el-popover>
  175. </template>
  176. </el-table-column>
  177. </el-table>
  178. <el-dialog title="反馈任务" :visible.sync="open" width="680px" class="feed-dialog" append-to-body @close="cancel">
  179. <el-form ref="form" :model="form" :rules="rules" size="mini" label-width="106px">
  180. <el-form-item label="任务名称">
  181. <div>{{ form.taskName }}</div>
  182. </el-form-item>
  183. <el-row :gutter="20">
  184. <el-col :span="12">
  185. <el-form-item label="所属项目">
  186. <div>{{ form.projectName }}</div>
  187. </el-form-item>
  188. </el-col>
  189. <el-col :span="12">
  190. <el-form-item label="反馈时间">
  191. <div>{{ form.feedbackDate }}</div>
  192. </el-form-item>
  193. </el-col>
  194. </el-row>
  195. <el-row :gutter="20">
  196. <el-col :span="12">
  197. <el-form-item label="计划工时">
  198. <el-input-number v-model="form.planHours" :min="0.1" :step="0.1"
  199. :step-strictly="true"
  200. :controls="false"></el-input-number>
  201. <span style="margin-left: 5px">小时</span>
  202. </el-form-item>
  203. </el-col>
  204. <el-col :span="12">
  205. <el-form-item label="已反馈工时">
  206. <span>{{ form.feedbackHours }}</span>
  207. <span style="margin-left: 5px">小时</span>
  208. </el-form-item>
  209. </el-col>
  210. </el-row>
  211. <el-row :gutter="20">
  212. <el-col :span="12">
  213. <el-form-item label="工作时长" prop="hours">
  214. <el-input-number v-model="form.hours" :min="0.1" :max="24" :step="0.1"
  215. :step-strictly="true" :controls="false"></el-input-number>
  216. <span style="margin-left: 5px">小时</span>
  217. </el-form-item>
  218. </el-col>
  219. <el-col :span="12">
  220. <el-form-item label="任务进度" prop="value">
  221. <el-input-number v-model="form.value" :min="1" :max="100" :step="1"
  222. :step-strictly="true" :controls="false"></el-input-number>
  223. <span style="margin-left: 5px">%</span>
  224. </el-form-item>
  225. </el-col>
  226. </el-row>
  227. <el-row :gutter="20">
  228. <el-col :span="12">
  229. <el-form-item label="附件" prop="fileUrl">
  230. <file-upload ref="fu" @getFileUrl="getFileUrl" @removeFile="removeFile"></file-upload>
  231. </el-form-item>
  232. </el-col>
  233. </el-row>
  234. <el-form-item label="反馈描述" prop="description">
  235. <el-input v-model="form.description" type="textarea" autosize/>
  236. </el-form-item>
  237. <el-form-item label="当前达成进度" prop="descriptionDetail">
  238. <rich-text-editor v-model="form.descriptionDetail"></rich-text-editor>
  239. </el-form-item>
  240. </el-form>
  241. <div slot="footer" class="dialog-footer">
  242. <el-button type="primary" @click="submitForm" size="mini">确 定</el-button>
  243. <el-button @click="cancel" size="mini">取 消</el-button>
  244. </div>
  245. </el-dialog>
  246. <el-dialog :title="detailForm.id+'、'+detailForm.taskName" :visible.sync="openDetail" width="900px" class="feed-dialog"
  247. :close-on-click-modal="true"
  248. append-to-body>
  249. <task-detail :detailForm="detailForm"></task-detail>
  250. </el-dialog>
  251. <el-dialog title="新增日常任务" :visible.sync="openAdd" width="800px" class="feed-dialog" append-to-body
  252. @close="cancelAddForm">
  253. <el-form ref="addForm" :model="addForm" :rules="addRules" size="mini" label-width="115px">
  254. <el-form-item label="任务名称" prop="taskName">
  255. <el-input v-model="addForm.taskName" placeholder="请输入任务名称"/>
  256. </el-form-item>
  257. <el-row>
  258. <el-col :span="12">
  259. <el-form-item label="开始时间" prop="beginDate">
  260. <el-date-picker
  261. v-model="addForm.beginDate"
  262. type="date"
  263. value-format="yyyy-MM-dd"
  264. @change="checkDates(addForm.beginDate,addForm.endDate)"
  265. style="width: 220px"
  266. placeholder="开始日期">
  267. </el-date-picker>
  268. </el-form-item>
  269. </el-col>
  270. <el-col :span="12">
  271. <el-form-item label="结束时间" prop="endDate">
  272. <el-date-picker
  273. v-model="addForm.endDate"
  274. @change="checkDates(addForm.beginDate,addForm.endDate)"
  275. type="date"
  276. value-format="yyyy-MM-dd"
  277. style="width: 220px"
  278. placeholder="开始日期">
  279. </el-date-picker>
  280. </el-form-item>
  281. </el-col>
  282. </el-row>
  283. <el-row>
  284. <el-col :span="12">
  285. <el-form-item label="优先级">
  286. <el-select
  287. v-model="addForm.priority"
  288. style="width: 220px"
  289. placeholder="任务优先级">
  290. <el-option
  291. v-for="dict in dict.type.task_priority"
  292. :key="dict.value"
  293. :label="dict.label"
  294. :value="dict.value">
  295. <span v-if="dict.value==='1'" style="color: #fa8888;margin-right: 5px">!!!</span>
  296. <span v-else-if="dict.value==='2'" style="color: #fb7fb7;margin-right: 5px">!!</span>
  297. <span v-else-if="dict.value==='3'" style="color: #40e0c3;margin-right: 5px">!</span>
  298. <span v-else style="color: #5dcfff;margin-right: 5px">!</span>
  299. <span>{{ dict.label }}</span>
  300. </el-option>
  301. </el-select>
  302. </el-form-item>
  303. </el-col>
  304. <el-col :span="12">
  305. <el-form-item label="任务附件">
  306. <file-upload ref="afu" :files="addForm.fileList" @getFileUrl="getFileUrl"
  307. @removeFile="removeFile"></file-upload>
  308. </el-form-item>
  309. </el-col>
  310. </el-row>
  311. <el-form-item label="任务描述" prop="description">
  312. <rich-text-editor v-model="addForm.description"></rich-text-editor>
  313. </el-form-item>
  314. <el-form-item label="审核流程">
  315. <audit-module ref="auditModule" :audit-users="auditUsers"
  316. :project-audit-configs="projectAuditConfigs"></audit-module>
  317. </el-form-item>
  318. </el-form>
  319. <div slot="footer" class="dialog-footer">
  320. <el-button type="primary" size="mini" @click="submitAddForm">确 定</el-button>
  321. <el-button size="mini" @click="cancelAddForm">取 消</el-button>
  322. </div>
  323. </el-dialog>
  324. </div>
  325. </template>
  326. <script>
  327. import {
  328. getTask,
  329. listView,
  330. addTaskFeedback,
  331. getFeedbackList,
  332. confirmComment,
  333. addTask,
  334. updateTask, projectAuditConfigs
  335. } from "@/api/task/task";
  336. import DateUtil from "@/utils/date"
  337. import TaskDetail from "./components/taskDetail"
  338. import FileUpload from "@/components/FileUpload"
  339. import RichTextEditor from '@/components/RichTextEditor'
  340. import AuditModule from './components/auditModule'
  341. import {mapGetters} from 'vuex'
  342. import task from "@/views/mixins/task";
  343. import {listProject} from "@/api/task/project";
  344. import {getAuditUsers} from "@/api/system/user";
  345. export default {
  346. components: {TaskDetail, FileUpload, RichTextEditor, AuditModule},
  347. dicts: ['task_status', 'feedback_type', 'task_priority'],
  348. mixins: [task],
  349. computed: {
  350. ...mapGetters(['userId'])
  351. },
  352. data() {
  353. let validateValue = (rule, value, callback) => {
  354. if (value === null || value === undefined) {
  355. return callback(new Error('进度不能为空'));
  356. }
  357. if (!Number.isInteger(value) || value < 0 || value > 100) {
  358. return callback(new Error('进度值必须为0到100的整数'));
  359. }
  360. return callback();
  361. };
  362. let validateHours = (rule, value, callback) => {
  363. // const regex = /^(?:[0-1]?\d|2[0-4])(\.\d)?$/;
  364. if (value < 0 || value > 24) {
  365. return callback(new Error('工时必须为0到24的数,最小维度为0.1小时'));
  366. }
  367. if (!value) {
  368. return callback(new Error('工时不能为空'));
  369. }
  370. return callback();
  371. };
  372. let validateDescription = (rule, value, callback) => {
  373. if (!value) {
  374. return callback(new Error('反馈描述不能为空'));
  375. }
  376. if (value.length < 5 || value.length > 500) {
  377. return callback(new Error('反馈描述字符数在5到500之间'));
  378. }
  379. return callback();
  380. };
  381. let validateDescriptionDetail = (rule, value, callback) => {
  382. if (!value) {
  383. return callback(new Error('当前达成进度不能为空'));
  384. }
  385. let text = value.replaceAll('<p>', '').replaceAll('</p>', '').replaceAll('<br>', '').replaceAll('&nbsp;', '').trim();
  386. if (text.length === 0) {
  387. return callback(new Error('当前达成进度不能为空'));
  388. }
  389. return callback();
  390. };
  391. return {
  392. queryParams: {
  393. projectId: undefined,
  394. startDate: undefined,
  395. endDate: undefined,
  396. statusGroup: ['0', '1', '2', '3'],
  397. priority: undefined,
  398. userId: undefined
  399. },
  400. projectTree: [],
  401. tableHeaders: [],
  402. tableData: [],
  403. open: false,
  404. form: {},
  405. feedbacks: [],
  406. rules: {
  407. feedbackType: [
  408. {required: true, message: "反馈类型不能为空", trigger: "change"}
  409. ],
  410. value: [
  411. {required: true, validator: validateValue, trigger: 'blur'}
  412. ],
  413. hours: [
  414. {required: true, validator: validateHours, trigger: 'blur'}
  415. ],
  416. description: [
  417. {required: true, validator: validateDescription, trigger: "blur"},
  418. ],
  419. descriptionDetail: [
  420. {required: true, validator: validateDescriptionDetail, trigger: "change"},
  421. ]
  422. },
  423. openDetail: false,
  424. detailForm: {},
  425. openAdd: false,
  426. addForm: {},
  427. addRules: {
  428. taskName: [
  429. {required: true, message: "任务名称不能为空", trigger: "blur"}
  430. ],
  431. beginDate: [
  432. {required: true, message: "开始时间不能为空", trigger: "change"}
  433. ],
  434. endDate: [
  435. {required: true, message: "结束时间不能为空", trigger: "change"}
  436. ]
  437. },
  438. projectAuditConfigs: [],
  439. auditUsers: []
  440. }
  441. },
  442. created() {
  443. this.initData();
  444. },
  445. methods: {
  446. initData() {
  447. this.$set(this.queryParams, 'startDate', DateUtil.beforeDay(null, 15))
  448. this.$set(this.queryParams, 'endDate', DateUtil.afterDay(null, 15))
  449. this.getList()
  450. },
  451. getList() {
  452. if (DateUtil.unix(this.queryParams.startDate) > DateUtil.unix(this.queryParams.endDate)) {
  453. this.$message.warning("开始时间不能超过结束时间")
  454. return
  455. }
  456. let dayDiff = DateUtil.dayDiff(this.queryParams.startDate, this.queryParams.endDate);
  457. if (dayDiff > 366) {
  458. this.$message.warning("时间跨度不可超过一年")
  459. return
  460. }
  461. this.queryParams.userId = this.userId
  462. listView(this.queryParams).then(res => {
  463. let data = res.data.data || []
  464. if (data.length > 0) {
  465. this.tableHeaders = res.data.headers.map(header => {
  466. let dayHours = 0;
  467. data.forEach(item => {
  468. if (item[header.day].hours) {
  469. dayHours += item[header.day].hours
  470. }
  471. })
  472. header['dayHours'] = dayHours
  473. return header;
  474. })
  475. } else {
  476. this.tableHeaders = res.data.headers
  477. }
  478. this.tableData = res.data.data
  479. })
  480. },
  481. cellStyle({row, column, rowIndex, columnIndex}) {
  482. let style = {
  483. // fontSize: '12px',
  484. padding: '2px 0'
  485. }
  486. if (row[column.property]) {
  487. style.background = this.cellColorMap[row[column.property].color]
  488. }
  489. return style
  490. },
  491. cellClick(row, column, cell, event) {
  492. this.feedbacks = []
  493. if (!row[column.property].value || row[column.property].value === '') {
  494. return;
  495. }
  496. let date = row[column.property].date
  497. if (DateUtil.unix(date) > DateUtil.unix()) {
  498. return;
  499. }
  500. getFeedbackList(row.id, date).then(res => {
  501. this.feedbacks = res.data.map(item => {
  502. item['executor'] = row.executor
  503. return item
  504. })
  505. })
  506. },
  507. cellDbClick(row, column, cell, event) {
  508. if (row.status === '4' || row.status === '5') {
  509. this.$message.warning("任务已完成,不可反馈")
  510. return;
  511. }
  512. if (row.status === '5') {
  513. this.$message.warning("任务已终止,不可反馈")
  514. return;
  515. }
  516. let feedbackDate = DateUtil.getFeedBackDate(this.queryParams.startDate, this.queryParams.endDate, column.property)
  517. if (DateUtil.unix(feedbackDate) > DateUtil.unix()) {
  518. this.$message.warning("反馈时间不能超过:" + DateUtil.day())
  519. return;
  520. }
  521. this.form = {
  522. id: undefined,
  523. taskName: row.taskName,
  524. taskId: row.id,
  525. projectName: row.projectName,
  526. feedbackDate: feedbackDate,
  527. planHours: row.planHours,
  528. feedbackHours: row.feedbackHours,
  529. feedbackType: '1',
  530. value: row.progressValue,
  531. hours: undefined,
  532. fileUrl: undefined,
  533. description: undefined
  534. };
  535. this.open = true
  536. },
  537. rowClick(row, column, event) {
  538. if (column.property != "taskName") {
  539. return
  540. }
  541. getTask(row.id).then(res => {
  542. this.detailForm = res.data
  543. this.openDetail = true
  544. })
  545. },
  546. feedbackTypeChange(val) {
  547. if (val === '2') {
  548. this.form.value = 100
  549. } else {
  550. this.form.value = undefined
  551. }
  552. },
  553. // 取消按钮
  554. cancel() {
  555. this.$refs.fu.clear();
  556. this.open = false;
  557. this.reset();
  558. },
  559. // 表单重置
  560. reset() {
  561. this.form = {
  562. id: undefined,
  563. taskName: undefined,
  564. taskId: undefined,
  565. projectName: undefined,
  566. feedbackDate: undefined,
  567. feedbackType: undefined,
  568. value: undefined,
  569. hours: undefined,
  570. fileUrl: undefined,
  571. description: undefined
  572. };
  573. this.resetForm("form");
  574. },
  575. getFileUrl(val) {
  576. this.form.files = val
  577. },
  578. removeFile(val) {
  579. this.form.files = val
  580. },
  581. /** 提交按钮 */
  582. submitForm() {
  583. this.$refs["form"].validate(valid => {
  584. if (valid) {
  585. if (this.form.files) {
  586. let files = this.form.files.map(item => item.name);
  587. this.form.fileUrl = JSON.stringify(files)
  588. }
  589. let descriptionDetail = _.cloneDeep(this.form.descriptionDetail)
  590. if (!this.checkRichText(descriptionDetail)) {
  591. this.form.descriptionDetail = null
  592. }
  593. addTaskFeedback(this.form).then(res => {
  594. if (res.code === 'S.F-2001') {
  595. let message = ''
  596. res.data.forEach(item => {
  597. message += item.taskName + ' '
  598. })
  599. this.$alert(message, res.message);
  600. } else {
  601. this.$message.success("反馈成功");
  602. this.open = false;
  603. this.getList();
  604. }
  605. });
  606. }
  607. })
  608. },
  609. getFeedbackTypeName(type) {
  610. if (type === '1') {
  611. return '进度反馈'
  612. } else if (type === '2') {
  613. return '完成'
  614. } else if (type === '3') {
  615. return '终止'
  616. } else if (type === '4') {
  617. return '评论'
  618. }
  619. return '审批'
  620. },
  621. /** 确认收到评论 */
  622. confirmComment(row) {
  623. confirmComment({feedbackId: row.id}).then(res => {
  624. if (res.code === '2000') {
  625. this.$message.success("操作成功")
  626. this.getList()
  627. }
  628. })
  629. },
  630. hoursChange() {
  631. let planHours = Number.parseFloat(this.form.planHours)
  632. let hours = Number.parseFloat(this.form.hours)
  633. if (planHours && hours) {
  634. let feedbackHours = Number.parseFloat(this.form.feedbackHours)
  635. let percent = (hours + feedbackHours) / planHours * 100;
  636. let value = Number.parseInt(percent > 100 ? 100 : percent);
  637. this.form.value = value === 0 ? 1 : value
  638. }
  639. },
  640. handleAdd() {
  641. this.resetAdd();
  642. this.openAdd = true;
  643. this.$set(this.addForm, 'priority', '4')
  644. this.$set(this.addForm, 'executor', this.userId)
  645. this.$set(this.addForm, 'projectId', 751562823)
  646. projectAuditConfigs({projectId: this.addForm.projectId}).then(res => {
  647. this.projectAuditConfigs = res.data
  648. })
  649. getAuditUsers().then(res => {
  650. this.auditUsers = res.data
  651. })
  652. },
  653. submitAddForm() {
  654. if (DateUtil.unix(this.addForm.beginDate) > DateUtil.unix(this.addForm.endDate)) {
  655. this.$message.warning("开始时间不能超过结束时间")
  656. return
  657. }
  658. this.$refs["addForm"].validate(valid => {
  659. if (valid) {
  660. if (this.addForm.files) {
  661. let tempFiles = this.addForm.files.map(item => item.name);
  662. this.addForm.fileUrl = JSON.stringify(tempFiles)
  663. }
  664. this.addForm['auditConfigs'] = this.$refs.auditModule.getAuditConfigs()
  665. this.addForm.checkTaskConflict = false;
  666. addTask(this.addForm).then(res => {
  667. this.$message.success("新增成功");
  668. this.openAdd = false;
  669. this.resetAdd();
  670. this.getList();
  671. });
  672. }
  673. });
  674. },
  675. cancelAddForm() {
  676. this.$refs.afu.clear()
  677. this.resetAdd()
  678. this.openAdd = false;
  679. },
  680. resetAdd() {
  681. this.addForm = {
  682. id: undefined,
  683. taskName: undefined,
  684. projectId: undefined,
  685. executor: undefined,
  686. planHours: undefined,
  687. beginDate: undefined,
  688. endDate: undefined,
  689. description: undefined,
  690. priority: undefined
  691. };
  692. this.resetForm("addForm");
  693. }
  694. }
  695. }
  696. </script>
  697. <style scoped lang="scss">
  698. ::v-deep.el-table .cell {
  699. padding: 0px;
  700. }
  701. ::v-deep.el-table th.el-table__cell > .cell {
  702. padding: 0px;
  703. }
  704. .el-form-item--mini.el-form-item, .el-form-item--small.el-form-item {
  705. margin-bottom: 10px;
  706. }
  707. .view-cell {
  708. width: 40px;
  709. font-size: 10px;
  710. text-align: center
  711. }
  712. .comment-badge {
  713. height: 10px;
  714. width: 10px;
  715. border-radius: 5px;
  716. background-color: #409eff;
  717. position: absolute;
  718. top: 1px;
  719. right: 1px;
  720. font-size: 8px;
  721. color: white;
  722. vertical-align: text-top;
  723. }
  724. .audit-badge {
  725. height: 10px;
  726. width: 10px;
  727. border-radius: 5px;
  728. background-color: #ff4949;
  729. position: absolute;
  730. top: 1px;
  731. right: 1px;
  732. font-size: 8px;
  733. color: white;
  734. vertical-align: text-top;
  735. }
  736. .feed-dialog ::v-deep .el-dialog__body {
  737. padding: 0 20px 10px 20px;
  738. }
  739. .el-tag--dark {
  740. border-color: white;
  741. }
  742. </style>