InfoDetail.uvue 7.0 KB

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