TraceList.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. <template>
  2. <div>
  3. <TraceHeader :type="'traceList'"></TraceHeader>
  4. <div>
  5. <div>
  6. <ul class="nav nav-tabs">
  7. <li @click="param.traceUserStatus='I_LAUNCH'" :class="{'active' : param.traceUserStatus == 'I_LAUNCH'}"><a>我负责的</a></li>
  8. <li @click="param.traceUserStatus='I_ATTEND_PROJECT_ALL'" :class="{'active' : param.traceUserStatus == 'I_ATTEND_PROJECT_ALL'}"><a>我参与项目的</a></li>
  9. <li @click="param.traceUserStatus='I_RESPONSE'" :class="{'active' : param.traceUserStatus == 'I_RESPONSE'}"><a>我发起的</a></li>
  10. </ul>
  11. </div>
  12. <br />
  13. <div class="form-group">
  14. <label for="exampleInputEmail2">选择任务状态</label>
  15. <select v-model="param.traceStatus" class="form-control">
  16. <option value="RUNNING">追踪中</option>
  17. <option value="FINISHED">完成的</option>
  18. </select>
  19. </div>
  20. <div class="form-group">
  21. <label for="exampleInputEmail2">查询条件</label>
  22. <QueryWidget ref="queryWidget" @search="getDatas()" @valueChanged="getDatas()"></QueryWidget>
  23. </div>
  24. </div>
  25. <div class="panel panel-default">
  26. <div class="panel-body">
  27. <vuedraggable class="wrapper" v-model="traceDtos" @change="end">
  28. <transition-group>
  29. <div v-for="item in traceDtos" :key="item.id" style="margin-top: 5px; cursor: pointer;">
  30. <span>
  31. <span>
  32. <Checkbox :id="'trace-finish-' + item.id" class-name="terms" v-model="item.finished" class="trace-checkbox"
  33. @input="updateTracefinished(item)">
  34. </Checkbox>
  35. </span>
  36. <span @click="openLine(item)">
  37. <span v-html="item.summary" class="trace-summary" :class="{'font-color': item.timeLineCompletion==true}">
  38. </span>
  39. <span class="glyphicon glyphicon-option-vertical trace-icon" aria-hidden="true"></span>
  40. <span class="label trace-user" :class="{'label-danger' : item.overdue == true, 'label-primary' : item.overdue != true}">
  41. <span v-html="item.receiveUserName"></span>
  42. <span>{{formatDate(item.planFinishedDate)}}</span>
  43. </span>
  44. </span>
  45. <a class="fa-pull-right" @click="edit(item)" style="color: blue;">编辑</a>
  46. </span>
  47. </div>
  48. </transition-group>
  49. </vuedraggable>
  50. </div>
  51. </div>
  52. <div >
  53. <div class="pull-left">
  54. <span>第{{(pagination.current_page-1)*pagination.per_page+1}}-{{pagination.current_page*pagination.per_page}}条,共计{{pagination.total}}条,每页显示</span>
  55. <PageSizeSelect v-on:pageSizeChanged="gridSizeSelect"></PageSizeSelect>
  56. <span>条</span>
  57. </div>
  58. <div class="pull-right">
  59. <Pagination :pagination="pagination" :callback="getDatas" ></Pagination>
  60. </div>
  61. </div>
  62. <!-- <div>
  63. <Pagination :pagination="pagination" :callback="getDatas" ></Pagination>
  64. </div> -->
  65. <h3>&nbsp;</h3>
  66. </div>
  67. </template>
  68. <script>
  69. var Common = require("../common/Common.js");
  70. var Uuid = require("pc-client-component").Uuid;
  71. import TraceCommon from "./TraceCommon.js";
  72. import QueryWidget from "../widget/QueryWidget.vue";
  73. import TraceHeader from "./TraceHeader.vue";
  74. var Pagination = require("vue-bootstrap-pagination").default;
  75. var PageSizeSelect = require("pc-client-component").PageSizeSelect;
  76. var Navbar = require("pc-client-component").Navbar;
  77. import TraceResource from "./TraceResource.js";
  78. var Checkbox = require("pc-client-component").Checkbox;
  79. import vuedraggable from 'vuedraggable';
  80. export default {
  81. data: function() {
  82. return {
  83. "param": {
  84. "condition": "",
  85. "traceStatus": "RUNNING",
  86. "traceUserStatus": "I_ATTEND_PROJECT_ALL",
  87. "range": {
  88. start: 0,
  89. length: 20
  90. },
  91. },
  92. "totalSize": 1,
  93. "traceDtos": [],
  94. pagination: {
  95. total: 0,
  96. per_page: 20, // required
  97. current_page: 1, // required
  98. last_page: 10, // required
  99. },
  100. formatDate: TraceCommon.formatDate,
  101. }
  102. },
  103. components: {
  104. QueryWidget,
  105. Pagination,
  106. Navbar,
  107. TraceHeader,
  108. TraceResource,
  109. Checkbox,
  110. vuedraggable,
  111. PageSizeSelect
  112. },
  113. methods: {
  114. gridSizeSelect: function(newPageSize) {
  115. this.pagination.per_page = newPageSize;
  116. this.pagination.current_page = 1;
  117. // 刷新界面
  118. this.getDatas();
  119. },
  120. end(evt) {
  121. var _self = this;
  122. _self.param.condition = _self.$refs.queryWidget.getSearchText();
  123. _self.param.id = evt.moved.element.id;
  124. _self.param.oldIndex = evt.moved.oldIndex;
  125. _self.param.newIndex = evt.moved.newIndex;
  126. _self.param.range = {
  127. start: (_self.pagination.current_page - 1) * _self.pagination.per_page,
  128. length: _self.pagination.per_page,
  129. };
  130. $.ajax({
  131. url: Common.getApiURL('TraceResource/sortTraceByTraceQueryParamDto'),
  132. type: 'post',
  133. dataType: 'json',
  134. contentType: "application/json",
  135. data: JSON.stringify(_self.param),
  136. beforeSend: function(request) {
  137. Common.addTokenToRequest(request);
  138. },
  139. success: function(data) {
  140. _self.getDatas();
  141. },
  142. error: function(XMLHttpRequest, textStatus, errorThrown) {
  143. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  144. }
  145. })
  146. },
  147. /**
  148. * 查询数据
  149. * @author GuoZhiBo 20180226
  150. */
  151. getDatas: function() {
  152. var _self = this;
  153. _self.param.condition = _self.$refs.queryWidget.getSearchText();
  154. _self.param.range = {
  155. start: (_self.pagination.current_page - 1) * _self.pagination.per_page,
  156. length: _self.pagination.per_page,
  157. };
  158. $.ajax({
  159. url: Common.getApiURL('TraceResource/listByTraceQueryParamDto'),
  160. type: 'post',
  161. dataType: 'json',
  162. contentType: "application/json",
  163. data: JSON.stringify(_self.param),
  164. beforeSend: function(request) {
  165. Common.addTokenToRequest(request);
  166. },
  167. success: function(data) {
  168. if (data != null && data.dataList != null) {
  169. _self.traceDtos = data.dataList;
  170. }
  171. _self.pagination.total = data.totalSize;
  172. _self.pagination.last_page = Math.ceil(data.totalSize / data.range.length);
  173. },
  174. error: function(XMLHttpRequest, textStatus, errorThrown) {
  175. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  176. }
  177. });
  178. },
  179. /**
  180. * 打开明细
  181. * @author GuoZhiBo 20171201
  182. */
  183. openLine: function(obj) {
  184. this.$router.push({
  185. path: '/trace/trace/' + obj.id
  186. });
  187. },
  188. /**
  189. * 编辑
  190. */
  191. edit: function(item) {
  192. var _self = this;
  193. this.$router.push("/trace/traceUpdate/" + item.id);
  194. },
  195. /**
  196. * 修改追踪单的状态
  197. * @author YangZhiJie 20171201
  198. */
  199. updateTracefinished: function(trace) {
  200. var _self = this;
  201. TraceResource.updateTraceFinished(trace.id).then(successData => {
  202. _self.getDatas();
  203. }, errorData => {
  204. Common.processException(errorData);
  205. });
  206. },
  207. },
  208. mounted: function() {
  209. TraceResource.getImg();
  210. this.param.traceUserStatus = this.$route.params.traceState;
  211. this.getDatas();
  212. },
  213. watch: {
  214. "param.traceStatus": function(val) {
  215. this.getDatas();
  216. },
  217. "param.traceUserStatus": function(val) {
  218. this.$router.push("/trace/traceList/" + val);
  219. this.param.traceUserStatus = this.$route.params.traceState;
  220. this.pagination.total = 0;
  221. this.pagination.per_page = Common.pageSize;
  222. this.pagination.current_page = 1;
  223. this.pagination.last_page = 10;
  224. this.pagination.from = 1;
  225. this.pagination.to = 10;
  226. this.getDatas();
  227. }
  228. }
  229. }
  230. </script>
  231. <style scoped>
  232. .active-div {
  233. background-color: #007aff;
  234. color: white !important;
  235. }
  236. .div-btn {
  237. float: left;
  238. height: 40px;
  239. text-align: center;
  240. line-height: 40px;
  241. color: #007aff;
  242. }
  243. .mid-div {
  244. border-left: 1px solid #007aff;
  245. border-right: 1px solid #007aff;
  246. }
  247. .font-color {
  248. color: red;
  249. }
  250. .divrow {
  251. border: 1px solid #007aff;
  252. height: 40px;
  253. }
  254. .select select {
  255. width: 100%;
  256. height: 30px;
  257. }
  258. .trace-summary {
  259. font-size: large;
  260. margin-left: 5px;
  261. margin-right: 5px;
  262. }
  263. .trace-icon {
  264. opacity: 0.5;
  265. }
  266. .trace-user {
  267. font-size: 100%;
  268. }
  269. .trace-checkbox {
  270. display: inline;
  271. font-size: large;
  272. }
  273. </style>