Personage.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <template>
  2. <div>
  3. <Navbar :title='"团队——"+userName'
  4. :isGoBack="true"></Navbar>
  5. <div class="container-fluid"
  6. id="trace-content">
  7. <div class="boxes">
  8. <div class="col-sm-4">
  9. <a class="box">
  10. <span>&nbsp;</span>
  11. <span class="box__statistics box__statistics--upcoming2">
  12. <span>{{userName.substr(userName.length-1,userName.length)}}</span>
  13. </span>
  14. <p class="box__title">{{userName}}</p>
  15. </a>
  16. </div>
  17. </div>
  18. </div>
  19. <hr>
  20. <b style="font-size:20px">任务({{pagination.total}})</b>
  21. <hr>
  22. <button @click="finished(userId)"
  23. type="button"
  24. class="btn btn-link"
  25. style="color:green;margin-left:90%">
  26. 查看已完成的任务</button>
  27. <div v-for="trace in traces"
  28. :key="trace.id"
  29. style="margin-top: 5px; cursor: pointer;">
  30. <div class="panel panel-default"
  31. style="margin-bottom: 0px;">
  32. <div class="panel-body">
  33. <span>
  34. <Checkbox :id="'trace-finish-' + trace.id"
  35. class-name="terms"
  36. v-model="trace.finished"
  37. class="trace-checkbox"
  38. @input="updateTracefinished(trace)"
  39. style=""></Checkbox>
  40. </span>
  41. <span @click="openLine(trace)">
  42. <span v-html="trace.summary"
  43. class="trace-summary"
  44. :class="{'font-color': trace.timeLineCompletion==true}">
  45. </span>
  46. <span class="glyphicon glyphicon-option-vertical trace-icon"
  47. aria-hidden="true"></span>
  48. <span class="label trace-user"
  49. :class="{'label-danger' : trace.overdue == true, 'label-primary' : trace.overdue != true}">
  50. <span v-html="trace.receiveUserName"></span>
  51. <span>{{formatDate(trace.planFinishedDate)}}</span>
  52. </span>
  53. <span class="badge">
  54. <span>{{trace.projectName}}</span>
  55. </span>
  56. </span>
  57. </div>
  58. </div>
  59. </div>
  60. <Pagination :pagination="pagination"
  61. :callback="initData"
  62. v-if="traces.length">
  63. </Pagination>
  64. <p class="bg-danger"
  65. style="padding: 15px;"
  66. v-if="flag">未安排任何任务~</p>
  67. </div>
  68. </template>
  69. <script>
  70. var Common = require("../common/Common.js");
  71. var Uuid = require("pc-client-component").Uuid;
  72. var Navbar = require("pc-client-component").Navbar;
  73. import TraceCommon from "./TraceCommon.js";
  74. var Checkbox = require("pc-client-component").Checkbox;
  75. import TraceResource from "./TraceResource.js";
  76. var Pagination = require("vue-bootstrap-pagination").default;
  77. export default {
  78. data: function () {
  79. return {
  80. uuid: Uuid.createUUID(),
  81. userId: '',
  82. userName: '',
  83. traces: [],
  84. flag: false,
  85. formatDate: TraceCommon.formatDate,
  86. pagination: {
  87. total: 0,
  88. per_page: 10, // 每页10条信息
  89. current_page: 1, // 当前页码
  90. last_page: 10, // 最后页码
  91. from: 1,
  92. to: 10 // required
  93. },
  94. }
  95. },
  96. components: {
  97. Common, Uuid, Navbar, TraceCommon, TraceResource, Checkbox, Pagination
  98. },
  99. methods: {
  100. /**
  101. * 打开明细
  102. * @author ZhangTeng 2019131
  103. */
  104. openLine: function (obj) {
  105. this.$router.push({
  106. path: '/trace/trace/' + obj.id
  107. });
  108. },
  109. /**
  110. * 初始化人员
  111. */
  112. initData: function () {
  113. var _self = this;
  114. _self.traces.splice(0, _self.traces.length);
  115. var uuid = _self.$route.params.uuid;
  116. var dataStr = localStorage.getItem(uuid);
  117. var user = JSON.parse(dataStr);
  118. _self.userId = user.userId;
  119. _self.userName = user.userName;
  120. $.ajax({
  121. url: Common.getApiURL('TraceResource/userNotFinishedTrace'),
  122. type: 'get',
  123. dataType: 'json',
  124. contentType: "application/json",
  125. data: {
  126. "receiveUserId": user.userId,
  127. "currentPage": _self.pagination.current_page,
  128. "pageSize": _self.pagination.per_page,
  129. },
  130. beforeSend: function (request) {
  131. Common.addTokenToRequest(request);
  132. },
  133. success: function (data) {
  134. if (data == '') {
  135. _self.flag = true
  136. }
  137. // for (var index = 0; index < data.length; index++) {
  138. // _self.$set(_self.traces, index, data[index]);
  139. // }
  140. _self.pagination.total = data.totalSize;
  141. _self.pagination.last_page = Math.ceil(_self.pagination.total / _self.pagination.per_page);
  142. _self.traces = data.traceDtos
  143. },
  144. });
  145. },
  146. /**
  147. * 修改追踪单的状态
  148. * @author YangZhiJie 20171201
  149. */
  150. updateTracefinished: function (trace) {
  151. var _self = this;
  152. TraceResource.updateTraceFinished(trace.id).then(successData => {
  153. _self.initData();
  154. }, errorData => {
  155. Common.processException(errorData);
  156. });
  157. },
  158. finished: function (userId) {
  159. var obj = {
  160. userId: this.userId,
  161. userName: this.userName
  162. }
  163. localStorage.setItem(this.uuid, JSON.stringify(obj))
  164. this.$router.push("/trace/finished/" + this.uuid);
  165. },
  166. },
  167. mounted: function () {
  168. this.initData();
  169. }
  170. }
  171. </script>
  172. <style scoped>
  173. .boxes .box {
  174. display: block;
  175. width: 288px;
  176. height: 235px;
  177. border-radius: 4px;
  178. text-align: center;
  179. color: #000;
  180. }
  181. .boxes .box__statistics {
  182. display: block;
  183. width: 90px;
  184. height: 90px;
  185. padding: 10px;
  186. margin: 15px auto 0;
  187. border-radius: 50%;
  188. color: #fff;
  189. font-size: 46px;
  190. }
  191. .boxes .box__statistics--upcoming2 {
  192. background-color: #f6aa39;
  193. }
  194. a {
  195. text-decoration: none;
  196. margin: 10px;
  197. font-size: 100%;
  198. vertical-align: baseline;
  199. background: transparent;
  200. }
  201. .boxes .box__title {
  202. margin-top: 25px;
  203. font-size: 24px;
  204. }
  205. .boxes .box__title__weeks {
  206. font-size: 18px;
  207. }
  208. .box:hover {
  209. background-color: ghostwhite;
  210. width: 288px;
  211. height: 235px;
  212. }
  213. .row {
  214. height: 200px;
  215. margin-bottom: 10px;
  216. }
  217. .dashboard-header {
  218. cursor: pointer;
  219. font-family: "\5FAE\8F6F\96C5\9ED1";
  220. font-weight: bold;
  221. font-size: 1.1em;
  222. }
  223. .trace-summary {
  224. font-size: large;
  225. margin-left: 5px;
  226. margin-right: 5px;
  227. }
  228. .trace-icon {
  229. opacity: 0.5;
  230. }
  231. .trace-user {
  232. font-size: 100%;
  233. }
  234. .trace-checkbox {
  235. display: inline;
  236. font-size: large;
  237. }
  238. </style>