index.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <view class="home padding-bottom">
  3. <cu-custom class="home-custom" bgColor=".bg-sancolor"
  4. bgImage="https://ahwgh.oss-cn-hangzhou.aliyuncs.com/enterprise/6525f808df760.png" :isBack="true">
  5. <block slot="content">任务列表</block>
  6. </cu-custom>
  7. <view class="padding-sm">
  8. <view class="cu-list menu margin-top taskDetail bg-white"
  9. v-for="(item, index) in taskListData" :key="index">
  10. <view class="cu-item">
  11. <view class="title text-black text-bold text-lg">
  12. <text class="cuIcon-titles text-green"></text>
  13. {{ item.ahTasksList[0].taskName }}
  14. <view class="cu-tag round bg-cyan light margin-left-sm text-sm">
  15. {{ setTaskType(item.taskType) }}
  16. </view>
  17. </view>
  18. <view class="action">
  19. <view class="text-gray">
  20. {{ setTaskStatus(item.status) }}
  21. </view>
  22. </view>
  23. </view>
  24. <view class="content padding-sm detail solid-bottom">
  25. <view>任务编号:{{ item.ahTasksList[0].taskNumber }}</view>
  26. <view>年度/季度:{{ item.ahTasksList[0].taskYear.substr(0, 4) }}-{{ item.ahTasksList[0].taskBatch }}</view>
  27. <view>发布单位:{{ item.publishName }}</view>
  28. <view>任务时间:{{ item.ahTasksList[0].startTime }}至{{ item.ahTasksList[0].endTime }}</view>
  29. </view>
  30. <view class="tools" style="justify-content: space-between">
  31. <view @tap.stop.capture="showModal" data-target="Modal" :data-taskId="item.taskId">
  32. <!-- <view class="cu-tag radius line-black padding-lr-sl">
  33. <text class="cuIcon-attentionfill text-lg padding-right-xs"></text>
  34. 抽样项目
  35. </view>-->
  36. <view class="btn-item text-black text-bold">
  37. <text class="cuIcon-tagfill lg"></text>
  38. <text class="text-sm">抽样项目</text>
  39. </view>
  40. </view>
  41. <view class="tool" v-if="item.ahTasksList[0].status ==='TASK_RUNNING'"
  42. @tap="handleTaskDetail(item)">
  43. <view class="cu-tag bg-blue light text-df text-bold">去抽样 >></view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="cu-modal" :class="modalName=='Modal'?'show':''">
  49. <view class="cu-dialog">
  50. <view class="cu-bar bg-white justify-end">
  51. <view class="content" style="width: 100%">抽样项</view>
  52. <view class="action" @tap="hideModal">
  53. <text class="cuIcon-close text-red"></text>
  54. </view>
  55. </view>
  56. <view class="padding-xl">
  57. <view class="cu-list menu" v-for="(item, index) in taskDetailList">
  58. <div class="cu-form-group">
  59. <view class="title">抽查样品名称</view>
  60. <span class="text-gray">{{ item.productName }}</span>
  61. </div>
  62. <div class="cu-form-group">
  63. <view class="title">检测参数</view>
  64. <span class="text-gray">{{ item.productHazard }}</span>
  65. </div>
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. </template>
  72. <script>
  73. import {
  74. _taskList
  75. } from "./task-list-model.js";
  76. export default {
  77. data() {
  78. return {
  79. taskListData: [],
  80. taskTypeList: [],
  81. taskDetailList: [],
  82. taskStatus: [],
  83. modalName: null
  84. };
  85. },
  86. created() {
  87. this.getTaskType();
  88. this.getTaskStatus();
  89. },
  90. onShow(){
  91. this.getTask();
  92. },
  93. methods: {
  94. rediectHome() {
  95. uni.redirectTo({
  96. url: "/pages/index/index"
  97. });
  98. },
  99. showModal(e) {
  100. this.modalName = e.currentTarget.dataset.target;
  101. console.log(e.currentTarget.dataset.taskid);
  102. _taskList.getTaskSampleDetail(e.currentTarget.dataset.taskid, res => {
  103. this.taskDetailList = res.data.data.records;
  104. });
  105. },
  106. hideModal(e) {
  107. this.modalName = null;
  108. },
  109. getTask() {
  110. _taskList.getTaskList(res => {
  111. console.log(res);
  112. this.taskListData = res.data.data.records;
  113. console.log(this.taskListData);
  114. });
  115. },
  116. handleTaskDetail(item) {
  117. uni.navigateTo({
  118. url: "/pages/sample-list/index?zoneId=" + item.zoneId +
  119. "&sampleId=" + item.sampleId + "&taskId=" + item.taskId + "&checkId=" + item.checkId + "&status=" + item.status
  120. });
  121. },
  122. getTaskType() {
  123. _taskList.getDictionary("TASK_TYPE", res => {
  124. this.taskTypeList = res.data.data;
  125. });
  126. },
  127. setTaskType(taskType) {
  128. const taskTypeList = this.taskTypeList;
  129. for (let i = 0; i < taskTypeList.length; i++) {
  130. if (taskTypeList[i].itemValue === taskType) {
  131. return taskTypeList[i].itemKey;
  132. }
  133. }
  134. },
  135. getTaskStatus() {
  136. _taskList.getDictionary("SAMPLE_CHECK_STATUS", res => {
  137. this.taskStatus = res.data.data;
  138. });
  139. },
  140. setTaskStatus(value) {
  141. console.log(value);
  142. let taskStatus = this.taskStatus;
  143. for (let i = 0; i < taskStatus.length; i++) {
  144. if (taskStatus[i].itemValue === value) {
  145. return taskStatus[i].itemKey;
  146. }
  147. }
  148. },
  149. setItemColor(value) {
  150. let taskStatus = this.taskStatus;
  151. const statusItem = taskStatus.find(v => v.itemValue === value);
  152. let color;
  153. const name = statusItem.itemKey;
  154. if (name.includes("执行中")) {
  155. color = "green";
  156. } else if (name.includes("已完成")) {
  157. color = "blue";
  158. } else if (name.includes("已转发")) {
  159. color = "orange";
  160. }
  161. return color;
  162. }
  163. }
  164. };
  165. </script>
  166. <style scoped>
  167. .detail view {
  168. height: 1.8em;
  169. line-height: 1.8em !important;
  170. border: none;
  171. color: gray;
  172. }
  173. .tools{
  174. display: flex;
  175. align-items: center;
  176. justify-content: space-between;
  177. padding: 20upx;
  178. }
  179. .taskDetail {
  180. /*border: 1rpx solid #8799a3;*/
  181. box-shadow: 0 0 25upx #aaa;
  182. border-radius: 10rpx;
  183. overflow: hidden;
  184. }
  185. .btn-item{
  186. display: flex;
  187. flex-direction: column;
  188. justify-content: center;
  189. align-items: center;
  190. }
  191. .cu-tag{
  192. padding: 20upx;
  193. border-radius: 10upx;
  194. }
  195. </style>