todo.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733
  1. <template>
  2. <div class="w-main todo">
  3. <v-title>{{$L('待办')}}-{{$L('轻量级的团队在线协作')}}</v-title>
  4. <div class="w-nav">
  5. <div class="nav-row">
  6. <div class="w-nav-left">
  7. <div class="page-nav-left">
  8. <span><i class="ft icon">&#xE787;</i> {{$L('我的待办')}}</span>
  9. <div v-if="loadIng > 0" class="page-nav-loading"><w-loading></w-loading></div>
  10. <div v-else class="page-nav-refresh"><em @click="refreshTask">{{$L('刷新')}}</em></div>
  11. </div>
  12. </div>
  13. <div class="w-nav-flex"></div>
  14. <div class="w-nav-right">
  15. <span class="ft hover" @click="handleTodo('calendar')"><i class="ft icon">&#xE706;</i> {{$L('待办日程')}}</span>
  16. <span class="ft hover" @click="handleTodo('complete')"><i class="ft icon">&#xE73D;</i> {{$L('已完成的任务')}}</span>
  17. <span class="ft hover" @click="handleTodo('attention')"><i class="ft icon">&#xE748;</i> {{$L('我关注的任务')}}</span>
  18. <span class="ft hover" @click="handleTodo('report')"><i class="ft icon">&#xE743;</i> {{$L('周报/日报')}}</span>
  19. </div>
  20. </div>
  21. </div>
  22. <w-content>
  23. <div class="todo-main">
  24. <div v-for="subs in [['1', '2'], ['3', '4']]" class="todo-ul">
  25. <div v-for="index in subs" class="todo-li">
  26. <div class="todo-card">
  27. <div class="todo-card-head" :class="['p' + index]">
  28. <i class="ft icon flag">&#xE753;</i>
  29. <div class="todo-card-title">{{pTitle(index)}}</div>
  30. <label class="todo-input-box" :class="{active: !!taskDatas[index].focus}" @click="()=>{$set(taskDatas[index],'focus',true)}">
  31. <div class="todo-input-ibox" @click.stop="">
  32. <Input v-model="taskDatas[index].title" class="todo-input-enter" :placeholder="$L('在这里输入事项,回车即可保存')" @on-enter="addTask(index)"></Input>
  33. <div class="todo-input-close" @click="()=>{$set(taskDatas[index],'focus',false)}"><i class="ft icon">&#xE710;</i></div>
  34. </div>
  35. <div class="todo-input-pbox">
  36. <div class="todo-input-placeholder">{{$L('点击可快速添加需要处理的事项')}}</div>
  37. <div class="todo-input-close"><i class="ft icon">&#xE740;</i></div>
  38. </div>
  39. </label>
  40. </div>
  41. <div class="todo-card-content">
  42. <draggable
  43. v-model="taskDatas[index].lists"
  44. class="content-ul"
  45. group="task"
  46. draggable=".task-draggable"
  47. :animation="150"
  48. :disabled="taskSortDisabled"
  49. @sort="taskSortUpdate"
  50. @remove="taskSortUpdate">
  51. <div v-for="task in taskDatas[index].lists" class="content-li task-draggable" :key="task.id" :class="{complete:task.complete}" @click="openTaskModal(task)">
  52. <div v-if="task.subtask.length > 0" class="subtask-progress"><em :style="{width: subtaskProgress(task.subtask) + '%'}"></em></div>
  53. <Icon v-if="task.complete" class="task-check" type="md-checkbox-outline" @click.stop="taskComplete(task, false)"/>
  54. <Icon v-else class="task-check" type="md-square-outline" @click.stop="taskComplete(task, true)"/>
  55. <div v-if="!!task.loadIng" class="task-loading"><w-loading></w-loading></div>
  56. <div v-if="task.overdue" class="task-overdue">[{{$L('超期')}}]</div>
  57. <div class="task-title">{{task.title}}</div>
  58. </div>
  59. <div v-if="taskDatas[index].hasMorePages === true" class="content-li more" @click="getTaskLists(index, true)">{{$L('加载更多')}}</div>
  60. </draggable>
  61. <div v-if="taskDatas[index].lists.length === 0 && taskDatas[index].loadIng == 0" class="content-empty">{{$L('恭喜你!已完成了所有待办')}}</div>
  62. <div v-if="taskDatas[index].loadIng > 0" class="content-loading"><w-loading></w-loading></div>
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. </div>
  68. </w-content>
  69. <WDrawer v-model="todoDrawerShow" maxWidth="1000">
  70. <Tabs v-if="todoDrawerShow" v-model="todoDrawerTab">
  71. <TabPane :label="$L('待办日程')" name="calendar">
  72. <todo-calendar :canload="todoDrawerShow && todoDrawerTab == 'calendar'"></todo-calendar>
  73. </TabPane>
  74. <TabPane :label="$L('已完成的任务')" name="complete">
  75. <todo-complete :canload="todoDrawerShow && todoDrawerTab == 'complete'"></todo-complete>
  76. </TabPane>
  77. <TabPane :label="$L('我关注的任务')" name="attention">
  78. <todo-attention :canload="todoDrawerShow && todoDrawerTab == 'attention'"></todo-attention>
  79. </TabPane>
  80. </Tabs>
  81. </WDrawer>
  82. <WDrawer v-model="todoReportDrawerShow" maxWidth="1000">
  83. <Tabs v-if="todoReportDrawerShow" v-model="todoReportDrawerTab">
  84. <TabPane :label="$L('我的汇报')" name="my">
  85. <report-my :canload="todoReportDrawerShow && todoReportDrawerTab == 'my'"></report-my>
  86. </TabPane>
  87. <TabPane :label="$L('收到的汇报')" name="receive">
  88. <report-receive :canload="todoReportDrawerShow && todoReportDrawerTab == 'receive'"></report-receive>
  89. </TabPane>
  90. </Tabs>
  91. </WDrawer>
  92. </div>
  93. </template>
  94. <style lang="scss">
  95. .todo-input-enter {
  96. .ivu-input {
  97. border: 0;
  98. background-color: rgba(255, 255, 255, 0.9);
  99. }
  100. }
  101. </style>
  102. <style lang="scss" scoped>
  103. .todo {
  104. .todo-main {
  105. display: flex;
  106. flex-direction: column;
  107. align-items: center;
  108. justify-content: center;
  109. width: 100%;
  110. height: 100%;
  111. min-height: 500px;
  112. padding: 5px;
  113. .todo-ul {
  114. flex: 1;
  115. display: flex;
  116. flex-direction: row;
  117. align-items: center;
  118. justify-content: center;
  119. width: 100%;
  120. .todo-li {
  121. flex: 1;
  122. height: 100%;
  123. position: relative;
  124. .todo-card {
  125. position: absolute;
  126. top: 10px;
  127. left: 10px;
  128. right: 10px;
  129. bottom: 10px;
  130. display: flex;
  131. flex-direction: column;
  132. .todo-card-head {
  133. display: flex;
  134. align-items: center;
  135. padding: 0 10px;
  136. height: 38px;
  137. border-radius: 4px 4px 0 0;
  138. color: #ffffff;
  139. .ft.icon {
  140. transform: scale(1);
  141. }
  142. .flag {
  143. font-weight: bold;
  144. font-size: 14px;
  145. margin-right: 5px;
  146. min-width: 16px;
  147. }
  148. .todo-card-title {
  149. font-weight: bold;
  150. }
  151. .todo-input-box {
  152. flex: 1;
  153. display: flex;
  154. flex-direction: row;
  155. align-items: center;
  156. justify-content: flex-end;
  157. height: 100%;
  158. cursor: pointer;
  159. &:hover {
  160. .todo-input-placeholder {
  161. opacity: 1;
  162. }
  163. }
  164. &.active {
  165. .todo-input-pbox {
  166. display: none;
  167. }
  168. .todo-input-ibox {
  169. display: flex;
  170. }
  171. }
  172. .todo-input-placeholder {
  173. color: rgba(255, 255, 255, 0.6);
  174. padding-right: 6px;
  175. transition: all 0.2s;
  176. opacity: 0;
  177. }
  178. .todo-input-pbox,
  179. .todo-input-ibox {
  180. flex: 1;
  181. display: flex;
  182. flex-direction: row;
  183. align-items: center;
  184. justify-content: flex-end;
  185. padding-left: 14px;
  186. height: 100%;
  187. }
  188. .todo-input-ibox {
  189. display: none;
  190. }
  191. .todo-input-close {
  192. height: 100%;
  193. display: flex;
  194. align-items: center;
  195. padding-left: 8px;
  196. i {
  197. font-size: 18px;
  198. font-weight: normal;
  199. }
  200. }
  201. }
  202. &.p1 {
  203. background: rgba(248, 14, 21, 0.6);
  204. }
  205. &.p2 {
  206. background: rgba(236, 196, 2, 0.5);
  207. }
  208. &.p3 {
  209. background: rgba(0, 159, 227, 0.7);
  210. }
  211. &.p4 {
  212. background: rgba(121, 170, 28, 0.7);
  213. }
  214. }
  215. .todo-card-content {
  216. flex: 1;
  217. background-color: #f5f6f7;
  218. border-radius: 0 0 4px 4px;
  219. overflow: auto;
  220. transform: translateZ(0);
  221. .content-ul {
  222. display: flex;
  223. flex-direction: column;
  224. min-height: 20px;
  225. .content-li {
  226. display: flex;
  227. flex-direction: row;
  228. align-items: flex-start;
  229. width: 100%;
  230. padding: 8px;
  231. color: #444444;
  232. border-bottom: dotted 1px rgba(153, 153, 153, 0.25);
  233. position: relative;
  234. cursor: pointer;
  235. &.complete {
  236. color: #999999;
  237. .task-title {
  238. text-decoration: line-through;
  239. }
  240. }
  241. &.more {
  242. color: #666;
  243. justify-content: center;
  244. }
  245. .task-check {
  246. font-size: 16px;
  247. padding-right: 6px;
  248. padding-top: 3px;
  249. }
  250. .task-loading {
  251. width: 15px;
  252. height: 15px;
  253. margin-right: 6px;
  254. margin-top: 3px;
  255. }
  256. .task-overdue {
  257. color: #ff0000;
  258. padding-right: 2px;
  259. }
  260. .task-title {
  261. flex: 1;
  262. word-break: break-all;
  263. &:hover {
  264. color: #000000;
  265. }
  266. }
  267. .subtask-progress {
  268. position: absolute;
  269. top: 0;
  270. left: 0;
  271. width: 100%;
  272. height: 100%;
  273. z-index: -1;
  274. overflow: hidden;
  275. pointer-events: none;
  276. em {
  277. display: block;
  278. height: 100%;
  279. background-color: rgba(3, 150, 242, 0.07);
  280. }
  281. }
  282. }
  283. }
  284. .content-loading {
  285. width: 100%;
  286. height: 22px;
  287. text-align: center;
  288. margin-top: 8px;
  289. margin-bottom: 8px;
  290. }
  291. .content-empty {
  292. margin: 6px auto;
  293. text-align: center;
  294. color: #666;
  295. }
  296. }
  297. }
  298. }
  299. }
  300. }
  301. @media (max-width: 780px) {
  302. .todo-main {
  303. height: auto;
  304. .todo-ul {
  305. flex-direction: column;
  306. .todo-li {
  307. width: 100%;
  308. .todo-card {
  309. position: static;
  310. top: 0;
  311. right: 0;
  312. left: 0;
  313. bottom: 0;
  314. margin: 10px;
  315. display: flex;
  316. flex-direction: column;
  317. min-height: 320px;
  318. max-height: 520px;
  319. }
  320. }
  321. }
  322. }
  323. }
  324. }
  325. </style>
  326. <script>
  327. import draggable from 'vuedraggable'
  328. import WContent from "../components/WContent";
  329. import TodoCalendar from "../components/project/todo/calendar";
  330. import TodoComplete from "../components/project/todo/complete";
  331. import TodoAttention from "../components/project/todo/attention";
  332. import Task from "../mixins/task";
  333. import ReportMy from "../components/report/my";
  334. import ReportReceive from "../components/report/receive";
  335. import WDrawer from "../components/iview/WDrawer";
  336. export default {
  337. components: {
  338. WDrawer,
  339. ReportReceive,
  340. ReportMy, draggable, TodoAttention, TodoComplete, TodoCalendar, WContent},
  341. mixins: [
  342. Task
  343. ],
  344. data () {
  345. return {
  346. loadIng: 0,
  347. userInfo: {},
  348. taskDatas: {
  349. "1": {lists: [], hasMorePages: false},
  350. "2": {lists: [], hasMorePages: false},
  351. "3": {lists: [], hasMorePages: false},
  352. "4": {lists: [], hasMorePages: false},
  353. },
  354. taskSortData: '',
  355. taskSortDisabled: false,
  356. todoDrawerShow: false,
  357. todoDrawerTab: 'calendar',
  358. todoReportDrawerShow: false,
  359. todoReportDrawerTab: 'my',
  360. }
  361. },
  362. mounted() {
  363. if ($A.getToken() === false) {
  364. this.goForward({path: '/'}, true);
  365. return;
  366. }
  367. this.refreshTask();
  368. this.userInfo = $A.getUserInfo((res, isLogin) => {
  369. if (this.userInfo.id != res.id) {
  370. this.userInfo = res;
  371. isLogin && this.refreshTask();
  372. } else {
  373. this.userInfo = res;
  374. }
  375. }, false);
  376. //
  377. $A.setOnTaskInfoListener('pages/todo',(act, detail) => {
  378. if (detail.username != $A.getUserName()) {
  379. for (let level in this.taskDatas) {
  380. this.taskDatas[level].lists.some((task, i) => {
  381. if (task.id == detail.id) {
  382. this.taskDatas[level].lists.splice(i, 1);
  383. this.taskSortData = this.getTaskSort();
  384. return true;
  385. }
  386. });
  387. }
  388. return;
  389. }
  390. //特殊事件(非操作任务的)
  391. switch (act) {
  392. case 'deleteproject': // 删除项目
  393. case 'deletelabel': // 删除分类
  394. this.refreshTask();
  395. return;
  396. case 'addlabel': // 添加分类
  397. case "labelsort": // 调整分类排序
  398. case "tasksort": // 调整任务排序
  399. return;
  400. }
  401. //
  402. for (let level in this.taskDatas) {
  403. this.taskDatas[level].lists.some((task, i) => {
  404. if (task.id == detail.id) {
  405. this.taskDatas[level].lists.splice(i, 1, detail);
  406. return true;
  407. }
  408. });
  409. }
  410. //
  411. let addOrDelete = (isAdd) => {
  412. if (isAdd) {
  413. for (let level in this.taskDatas) {
  414. if (level == detail.level) {
  415. let index = this.taskDatas[level].lists.length;
  416. this.taskDatas[level].lists.some((task, i) => {
  417. if (detail.userorder > task.userorder || (detail.userorder == task.userorder && detail.id > task.id)) {
  418. index = i;
  419. return true;
  420. }
  421. });
  422. this.taskDatas[level].lists.splice(index, 0, detail);
  423. }
  424. }
  425. } else {
  426. for (let level in this.taskDatas) {
  427. this.taskDatas[level].lists.some((task, i) => {
  428. if (task.id == detail.id) {
  429. this.taskDatas[level].lists.splice(i, 1);
  430. return true;
  431. }
  432. });
  433. }
  434. }
  435. this.taskSortData = this.getTaskSort();
  436. };
  437. //
  438. switch (act) {
  439. case "title": // 标题
  440. case "desc": // 描述
  441. case "plannedtime": // 设置计划时间
  442. case "unplannedtime": // 取消计划时间
  443. case "complete": // 标记完成
  444. case "unfinished": // 标记未完成
  445. case "comment": // 评论
  446. // 这些都不用处理
  447. break;
  448. case "level": // 优先级
  449. for (let level in this.taskDatas) {
  450. this.taskDatas[level].lists.some((task, i) => {
  451. if (task.id == detail.id) {
  452. this.taskDatas[level].lists.splice(i, 1);
  453. return true;
  454. }
  455. });
  456. if (level == detail.level) {
  457. let index = this.taskDatas[level].lists.length;
  458. this.taskDatas[level].lists.some((task, i) => {
  459. if (detail.userorder > task.userorder || (detail.userorder == task.userorder && detail.id > task.id)) {
  460. index = i;
  461. return true;
  462. }
  463. });
  464. this.taskDatas[level].lists.splice(index, 0, detail);
  465. }
  466. }
  467. this.taskSortData = this.getTaskSort();
  468. break;
  469. case "create": // 创建任务
  470. case "username": // 负责人
  471. addOrDelete(detail.username == $A.getUserName());
  472. break;
  473. case "delete": // 删除任务
  474. case "archived": // 归档
  475. addOrDelete(false);
  476. break;
  477. case "unarchived": // 取消归档
  478. addOrDelete(true);
  479. break;
  480. }
  481. }, true);
  482. },
  483. deactivated() {
  484. this.todoDrawerShow = false;
  485. this.todoReportDrawerShow = false;
  486. },
  487. computed: {
  488. },
  489. watch: {
  490. },
  491. methods: {
  492. pTitle(p) {
  493. switch (p) {
  494. case "1":
  495. return this.$L("重要且紧急");
  496. case "2":
  497. return this.$L("重要不紧急");
  498. case "3":
  499. return this.$L("紧急不重要");
  500. case "4":
  501. return this.$L("不重要不紧急");
  502. }
  503. },
  504. refreshTask() {
  505. this.taskDatas = {
  506. "1": {lists: [], hasMorePages: false},
  507. "2": {lists: [], hasMorePages: false},
  508. "3": {lists: [], hasMorePages: false},
  509. "4": {lists: [], hasMorePages: false},
  510. };
  511. for (let i = 1; i <= 4; i++) {
  512. this.getTaskLists(i.toString());
  513. }
  514. },
  515. getTaskLists(index, isNext, withNextNum = 0) {
  516. let taskData = this.taskDatas[index];
  517. let currentPage = 1;
  518. let pagesize = 20;
  519. let withNextPage = false;
  520. //
  521. if (isNext === true) {
  522. if (taskData.hasMorePages !== true) {
  523. return;
  524. }
  525. currentPage = Math.max(1, $A.runNum(taskData['currentPage']));
  526. let tempLists = this.taskDatas[index].lists;
  527. if (tempLists.length >= currentPage * pagesize) {
  528. currentPage++;
  529. } else {
  530. withNextPage = true;
  531. }
  532. withNextNum = $A.runNum(withNextNum);
  533. }
  534. this.$set(taskData, 'hasMorePages', false);
  535. this.$set(taskData, 'loadIng', $A.runNum(taskData.loadIng) + 1);
  536. this.taskSortDisabled = true;
  537. this.loadIng++;
  538. $A.apiAjax({
  539. url: 'project/task/lists',
  540. data: {
  541. level: index,
  542. sorts: {key:'userorder', order:'desc'},
  543. page: currentPage,
  544. pagesize: pagesize,
  545. },
  546. complete: () => {
  547. this.loadIng--;
  548. this.taskSortDisabled = false;
  549. this.$set(taskData, 'loadIng', $A.runNum(taskData.loadIng) - 1);
  550. },
  551. success: (res) => {
  552. if (res.ret === 1) {
  553. let inLists;
  554. res.data.lists.forEach((data) => {
  555. inLists = false;
  556. taskData.lists.some((item, i) => {
  557. if (item.id == data.id) {
  558. taskData.lists.splice(i, 1, data);
  559. return inLists = true;
  560. }
  561. });
  562. if (!inLists) {
  563. taskData.lists.push(data);
  564. }
  565. });
  566. this.taskSortData = this.getTaskSort();
  567. this.$set(taskData, 'currentPage', res.data.currentPage);
  568. this.$set(taskData, 'hasMorePages', res.data.hasMorePages);
  569. if (res.data.currentPage && withNextPage && withNextNum < 5) {
  570. this.getTaskLists(index, true, withNextNum + 1);
  571. }
  572. } else {
  573. this.$set(taskData, 'lists', []);
  574. this.$set(taskData, 'hasMorePages', false);
  575. }
  576. }
  577. });
  578. },
  579. addTask(index) {
  580. let taskData = this.taskDatas[index];
  581. let title = $A.trim(taskData.title);
  582. if ($A.count(title) == 0) {
  583. return;
  584. }
  585. this.$set(taskData, 'focus', false);
  586. this.$set(taskData, 'title', '');
  587. //
  588. let tempId = $A.randomString(16);
  589. taskData.lists.unshift({
  590. id: tempId,
  591. title: title,
  592. loadIng: true,
  593. });
  594. this.taskSortDisabled = true;
  595. $A.apiAjax({
  596. url: 'project/task/add',
  597. data: {
  598. title: title,
  599. level: index,
  600. },
  601. complete: () => {
  602. this.taskSortDisabled = false;
  603. },
  604. error: () => {
  605. taskData.lists.some((item, i) => {
  606. if (item.id == tempId) {
  607. taskData.lists.splice(i, 1);
  608. return true;
  609. }
  610. });
  611. alert(this.$L('网络繁忙,请稍后再试!'));
  612. },
  613. success: (res) => {
  614. if (res.ret === 1) {
  615. this.$Message.success(res.msg);
  616. } else {
  617. this.$Modal.error({title: this.$L('温馨提示'), content: res.msg});
  618. }
  619. taskData.lists.some((item, i) => {
  620. if (item.id == tempId) {
  621. if (res.ret === 1) {
  622. taskData.lists.splice(i, 1, res.data);
  623. } else {
  624. taskData.lists.splice(i, 1);
  625. }
  626. return true;
  627. }
  628. });
  629. this.taskSortData = this.getTaskSort();
  630. }
  631. });
  632. },
  633. getTaskSort() {
  634. let sortData = "",
  635. taskData = "";
  636. for (let level in this.taskDatas) {
  637. taskData = "";
  638. this.taskDatas[level].lists.forEach((task) => {
  639. if (taskData) taskData += "-";
  640. taskData += task.id;
  641. });
  642. if (sortData) sortData += ";";
  643. sortData += level + ":" + taskData;
  644. }
  645. return sortData;
  646. },
  647. handleTodo(event) {
  648. switch (event) {
  649. case 'calendar':
  650. case 'complete':
  651. case 'attention': {
  652. this.todoDrawerShow = true;
  653. this.todoDrawerTab = event;
  654. break;
  655. }
  656. case 'report': {
  657. this.todoReportDrawerShow = true;
  658. break;
  659. }
  660. }
  661. },
  662. taskSortUpdate() {
  663. let oldSort = this.taskSortData;
  664. let newSort = this.getTaskSort();
  665. if (oldSort == newSort) {
  666. return;
  667. }
  668. this.taskSortData = newSort;
  669. this.taskSortDisabled = true;
  670. $A.apiAjax({
  671. url: 'project/sort/todo',
  672. data: {
  673. oldsort: oldSort,
  674. newsort: newSort,
  675. },
  676. complete: () => {
  677. this.taskSortDisabled = false;
  678. },
  679. error: () => {
  680. this.refreshTask();
  681. alert(this.$L('网络繁忙,请稍后再试!'));
  682. },
  683. success: (res) => {
  684. if (res.ret === 1) {
  685. this.$Message.success(res.msg);
  686. } else {
  687. this.refreshTask();
  688. this.$Modal.error({title: this.$L('温馨提示'), content: res.msg});
  689. }
  690. }
  691. });
  692. },
  693. subtaskProgress(subtask) {
  694. if (subtask.length === 0) {
  695. return 0;
  696. }
  697. const completeLists = subtask.filter((item) => { return item.status == 'complete'});
  698. return parseFloat(((completeLists.length / subtask.length) * 100).toFixed(2));
  699. },
  700. openTaskModal(taskDetail) {
  701. this.taskDetail(taskDetail);
  702. },
  703. },
  704. }
  705. </script>