UseFinishedTrace.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <div>
  3. <Navbar
  4. :title="&quot;团队-&quot; + userName + &quot; 已完成的任务&quot; + &quot;(&quot; + pagination.total + &quot;)&quot;"
  5. :is-go-back="true"
  6. />
  7. <p
  8. v-if="traces == null || traces.length == 0"
  9. class="bg-danger"
  10. style="padding: 15px;"
  11. >
  12. 未完成任何任务
  13. </p>
  14. <div
  15. v-else
  16. class="panel panel-default"
  17. style="margin-bottom: 10px;"
  18. >
  19. <div class="panel-body">
  20. <input v-model="content" autocomplete="off" type="text" class="form-control" placeholder="任务名称、任务内容" @blur="initData" @keyup.enter="initData" />
  21. <div
  22. v-for="trace in traces"
  23. :key="trace.id"
  24. style="margin-top: 5px; cursor: pointer;"
  25. >
  26. <span>
  27. <span>
  28. <Checkbox
  29. :id="'trace-finish-' + trace.id"
  30. v-model="trace.finished"
  31. class-name="terms"
  32. class="trace-checkbox"
  33. @input="updateTracefinished(trace)"
  34. />
  35. </span>
  36. <span @click="openLine(trace)">
  37. <span
  38. v-dompurify-html="trace.summary"
  39. class="trace-summary"
  40. :class="{'font-color': trace.timeLineCompletion==true}"
  41. />
  42. <span
  43. class="glyphicon glyphicon-option-vertical trace-icon"
  44. aria-hidden="true"
  45. />
  46. <span class="label label-primary trace-user">
  47. <span v-dompurify-html="trace.receiveUserName" />
  48. <span>{{ formatDate(trace.planFinishedDate) }}</span>
  49. </span>
  50. <span class="badge">
  51. <span>{{ trace.projectName }}</span>
  52. </span>
  53. <span class="badge">
  54. <span>完成时间:{{ formatDate(trace.finishedDate) }}</span>
  55. </span>
  56. </span>
  57. </span>
  58. </div>
  59. </div>
  60. </div>
  61. <Pagination
  62. v-if="traces.length"
  63. :pagination="pagination"
  64. :callback="initData"
  65. />
  66. </div>
  67. </template>
  68. <script>
  69. var Common = require('../common/Common.js');
  70. var Uuid = require('pc-component-v3').default.Uuid;
  71. import TraceCommon from './TraceCommon.js';
  72. var Checkbox = require('pc-component-v3').default.Checkbox;
  73. import TraceResource from './TraceResource.js';
  74. var Navbar = require('pc-component-v3').default.Navbar;
  75. var Pagination = require('pc-component-v3').default.VueBootstrapPagination;;
  76. export default {
  77. components: {
  78. Common, Uuid, Navbar, Checkbox, TraceResource, TraceCommon, Pagination,
  79. },
  80. data: function () {
  81. return {
  82. traceNumber: {},
  83. uuid: Uuid.createUUID(),
  84. userId: '',
  85. userName: '',
  86. traces: [],
  87. formatDate: TraceCommon.formatDate,
  88. pagination: {
  89. total: 0,
  90. per_page: 50, // 每页10条信息
  91. current_page: 1, // 当前页码
  92. last_page: 10, // 最后页码
  93. },
  94. content: undefined,
  95. };
  96. },
  97. mounted: function () {
  98. this.initData();
  99. },
  100. methods: {
  101. /**
  102. * 初始化人员
  103. */
  104. initData: function () {
  105. var _self = this;
  106. _self.traces.splice(0, _self.traces.length);
  107. _self.userId = _self.$route.params.userId;
  108. _self.userName = _self.$route.query.userName;
  109. $.ajax({
  110. url: Common.getApiURL('TraceResource/useFinishedTrace'),
  111. type: 'get',
  112. dataType: 'json',
  113. contentType: 'application/json',
  114. data: {
  115. 'receiveUserId': _self.userId,
  116. 'currentPage': _self.pagination.current_page,
  117. 'pageSize': _self.pagination.per_page,
  118. 'content': _self.content,
  119. },
  120. beforeSend: function (request) {
  121. Common.addTokenToRequest(request);
  122. },
  123. success: function (data) {
  124. _self.pagination.total = data.totalSize;
  125. _self.pagination.last_page = Math.ceil(_self.pagination.total / _self.pagination.per_page);
  126. _self.traces = data.traceDtos;
  127. },
  128. });
  129. },
  130. /**
  131. * 打开明细
  132. * @author ZhangTeng 2019131
  133. */
  134. openLine: function (obj) {
  135. this.$router.push({
  136. path: '/trace/trace/' + obj.id,
  137. });
  138. },
  139. /**
  140. * 修改追踪单的状态
  141. * @author YangZhiJie 20171201
  142. */
  143. updateTracefinished: function (trace) {
  144. var _self = this;
  145. TraceResource.updateTraceFinished(trace.id).then(successData => {
  146. _self.initData();
  147. }, errorData => {
  148. Common.processException(errorData);
  149. });
  150. },
  151. },
  152. };
  153. </script>
  154. <style scoped>
  155. .trace-summary {
  156. font-size: large;
  157. margin-left: 5px;
  158. margin-right: 5px;
  159. }
  160. .trace-icon {
  161. opacity: 0.5;
  162. }
  163. .trace-user {
  164. font-size: 100%;
  165. }
  166. .trace-checkbox {
  167. display: inline;
  168. font-size: large;
  169. }
  170. </style>