InfoDetail.uvue 7.0 KB

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