DownloadDetail.uvue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. <template>
  2. <!-- #ifdef APP -->
  3. <scroll-view style="flex:1">
  4. <!-- #endif -->
  5. <!-- 报告基础信息 -->
  6. <view class="section">
  7. <view class="info-item">
  8. <text class="label">声像记录任务</text>
  9. <text class="value">{{ download.workorder}}</text>
  10. </view>
  11. <view class="info-item">
  12. <text class="label">{{ download.productno }}</text>
  13. <text class="value">{{ download.invname }}</text>
  14. </view>
  15. </view>
  16. <view class="section">
  17. <uni-table>
  18. <uni-tr class="section-title" v-for="(item,index) in titleList" :key="index">
  19. <uni-td class="grid-text">{{item.title1}}</uni-td>
  20. <uni-td class="grid-text">{{item.title2}}</uni-td>
  21. <uni-td class="grid-text">{{item.title3}}</uni-td>
  22. </uni-tr>
  23. <uni-tr class="section-title" v-for="(taskProcess : TaskProcess,index2 : number) in taskProcessList"
  24. :key="index2" @click="enterProcess(taskProcess.id)">
  25. <uni-td class="grid-text">{{taskProcess.name}}</uni-td>
  26. <uni-td class="grid-text">
  27. <text :class="{
  28. 'bg-green bg-text': taskProcess.status === 3,
  29. 'bg-yellow bg-text': taskProcess.status === 2,
  30. 'bg-black bg-text': taskProcess.status === 1,
  31. 'bg-red bg-text': taskProcess.status === 4
  32. }">
  33. {{taskProcess.step}}/{{taskProcess.num}}
  34. </text>
  35. </uni-td>
  36. <uni-td class="grid-text">
  37. <text :class="{
  38. 'ft-red': taskProcess.status === 4
  39. }">{{ taskProcess.status === 4 ? "检验失败" : "" }}</text>
  40. </uni-td>
  41. </uni-tr>
  42. </uni-table>
  43. </view>
  44. <!-- #ifdef APP -->
  45. </scroll-view>
  46. <!-- #endif -->
  47. </template>
  48. <script setup>
  49. import {
  50. ref,
  51. onMounted
  52. } from 'vue'
  53. import { getList, Download, TaskProcess } from '@/api/work';
  54. const titleList = [{
  55. title1: "部位", title2: "进度", title3: "状态"
  56. }];
  57. var taskProcessList = ref<TaskProcess[]>([]);
  58. var initTasks = [] as TaskProcess[]
  59. const download = ref<Download>({
  60. pdid: 0,
  61. workorder: "",
  62. invname: "",
  63. productno: "",
  64. graphid: "",
  65. cardno: "",
  66. processno: "",
  67. ver: "",
  68. updatetime: "",
  69. progress: "",
  70. status: 1
  71. })
  72. // #ifdef H5
  73. download.value = {
  74. pdid: 1,
  75. workorder: "632-P-01",
  76. invname: "箱间段",
  77. productno: "1CFA1040-00#S",
  78. graphid: "HBJ0100-00",
  79. cardno: "LK20230707070012",
  80. processno: "Pb/XXX-E11",
  81. ver: "A.1",
  82. updatetime: "2025-06-23",
  83. progress: "1/3"
  84. }
  85. taskProcessList.value = [
  86. { id: 1, name: "前底-外侧", num: 5, step: 5, status: 3 },
  87. { id: 2, name: "后底-外侧", num: 3, step: 3, status: 4 },
  88. { id: 3, name: "简段-外侧", num: 12, step: 2, status: 2 },
  89. { id: 4, name: "前底-内侧", num: 5, step: 0, status: 1 },
  90. { id: 5, name: "后底-内侧", num: 6, step: 0, status: 1 },
  91. { id: 6, name: "简段-内侧", num: 3, step: 0, status: 1 },
  92. { id: 7, name: "隧道管", num: 5, step: 0, status: 1 },
  93. ];
  94. // #endif
  95. onLoad((options) => {
  96. const downloadId = options?.id ?? ""
  97. // 模拟数据加载,建议替换为后端接口请求
  98. // #ifdef APP-ANDROID
  99. //获取下载产品数据
  100. getList('app_product', 'pdid', downloadId, null).then((res:UTSJSONObject) => {
  101. console.log(res)
  102. let dataList = res?.['data'] as UTSJSONObject[] ?? Array<UTSJSONObject>()
  103. if(dataList!=null && dataList.length>0){
  104. dataList.forEach(item =>{
  105. if(item!=null){
  106. let data = JSON.parse<Download>(item.toJSONString());
  107. if(data!=null){
  108. download.value = data
  109. }
  110. }
  111. });
  112. }
  113. })
  114. //获取下载产品任务数据
  115. getList('app_product_task', 'pid', downloadId, null).then((res:UTSJSONObject) => {
  116. console.log(res)
  117. let dataList = res?.['data'] as UTSJSONObject[] ?? Array<UTSJSONObject>()
  118. if(dataList!=null && dataList.length>0){
  119. dataList.forEach(item =>{
  120. if(item!=null){
  121. let task = JSON.parse<TaskProcess>(item.toJSONString());
  122. if(task!=null){
  123. initTasks.push(task)
  124. }
  125. }
  126. });
  127. }
  128. console.log(initTasks)
  129. taskProcessList.value = initTasks
  130. })
  131. // #endif
  132. })
  133. const goBack = () => {
  134. uni.navigateBack()
  135. }
  136. const enterProcess = (id : number) => {
  137. console.log(id);
  138. uni.navigateTo({
  139. url: `/pages/work/record/RecordList?id=${id}`
  140. });
  141. }
  142. </script>
  143. <style scoped>
  144. .container {
  145. padding: 40rpx;
  146. background-color: #f5f7fa;
  147. flex: 1;
  148. box-sizing: border-box;
  149. }
  150. .banner {
  151. background: linear-gradient(135deg, #2193b0, #6dd5ed);
  152. border-radius: 24rpx;
  153. padding: 40rpx 30rpx;
  154. margin-bottom: 40rpx;
  155. box-shadow: 0 8rpx 16rpx rgba(33, 147, 176, 0.3);
  156. }
  157. .banner-title {
  158. color: white;
  159. font-size: 36rpx;
  160. font-weight: bold;
  161. text-align: center;
  162. }
  163. .section {
  164. background-color: #fff;
  165. border-radius: 20rpx;
  166. padding: 30rpx;
  167. margin-bottom: 30rpx;
  168. box-shadow: 0 6rpx 16rpx rgba(0, 0, 0, 0.05);
  169. }
  170. .section-title {
  171. display: flex;
  172. flex-direction: row;
  173. flex: 1;
  174. }
  175. .info-item {
  176. display: flex;
  177. justify-content: space-between;
  178. /* #ifdef APP-NVUE */
  179. font-size: 28rpx;
  180. color: #666;
  181. /* #endif */
  182. margin-bottom: 18rpx;
  183. flex-direction: row;
  184. }
  185. .section-content {
  186. font-size: 28rpx;
  187. color: #444;
  188. line-height: 1.8;
  189. white-space: normal;
  190. }
  191. .grid-text {
  192. /* #ifdef APP-NVUE */
  193. font-size: 24rpx;
  194. color: #000;
  195. /* #endif */
  196. padding: 10rpx 0 10rpx 0rpx;
  197. box-sizing: border-box;
  198. margin: 10rpx 10rpx;
  199. min-width: 180rpx;
  200. }
  201. .footer-btn {
  202. margin-top: 40rpx;
  203. display: flex;
  204. justify-content: center;
  205. }
  206. .main-btn {
  207. width: 80%;
  208. padding: 28rpx 0;
  209. font-size: 30rpx;
  210. color: #fff;
  211. border: none;
  212. border-radius: 100rpx;
  213. background: linear-gradient(to right, #36d1dc, #5b86e5);
  214. box-shadow: 0 10rpx 24rpx rgba(91, 134, 229, 0.3);
  215. }
  216. .label {
  217. font-weight: bold;
  218. color: #102a43;
  219. min-width: 150rpx;
  220. margin-right: 30rpx;
  221. }
  222. .value {
  223. flex: 1;
  224. /* #ifdef APP-NVUE */
  225. white-space: nowrap;
  226. text-overflow: ellipsis;
  227. /* #endif */
  228. overflow: hidden;
  229. margin-left: 30rpx;
  230. }
  231. .my-radius {
  232. border-radius: 10rpx;
  233. }
  234. .bg-text {
  235. width: 100rpx;
  236. min-width: 80rpx;
  237. border-radius: 10rpx;
  238. text-align: center;
  239. }
  240. .bg-green {
  241. background-color: seagreen;
  242. color: #fff;
  243. }
  244. .bg-yellow {
  245. background-color: yellow;
  246. }
  247. .bg-black {
  248. background-color: #102a43;
  249. color: #fff;
  250. }
  251. .bg-red {
  252. background-color: red;
  253. color: #fff;
  254. }
  255. .ft-red {
  256. color: red;
  257. }
  258. </style>