DownloadDetail.uvue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  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.productcode }}</text>
  13. <text class="value">{{ download.invname }}</text>
  14. </view>
  15. </view>
  16. <view class="section">
  17. <uni-table v-for="(item,index) in taskProcessList" :key="index">
  18. <uni-tr>
  19. <uni-td class="grid-text">{{item.gxno}}</uni-td>
  20. </uni-tr>
  21. <uni-tr class="section-title" @click="enterItem(item.pdid, 0)">
  22. <uni-td class="grid-text">拍照点</uni-td>
  23. <uni-td class="grid-text">
  24. <text :class="{
  25. 'bg-green bg-text': item.photoStatus == '已完成',
  26. 'bg-yellow bg-text': item.photoCount > 0 && item.photoCount < item.photoTotal,
  27. 'bg-black bg-text': item.photoCount == 0,
  28. }">
  29. {{item.photoCount}} / {{item.photoTotal}}
  30. </text>
  31. </uni-td>
  32. <uni-td class="grid-text">{{item.photoStatus}}</uni-td>
  33. </uni-tr>
  34. <uni-tr class="section-title" @click="enterItem(item.pdid, 1)">
  35. <uni-td class="grid-text">检验记录</uni-td>
  36. <uni-td class="grid-text">
  37. <text :class="{
  38. 'bg-green bg-text': item.recordCount == item.recordTotal,
  39. 'bg-yellow bg-text': item.recordCount > 0 && item.recordCount < item.recordTotal,
  40. 'bg-black bg-text': item.recordCount == 0,
  41. }">
  42. {{item.recordCount}} / {{item.recordTotal}}
  43. </text>
  44. </uni-td>
  45. <uni-td class="grid-text"><text :class="{
  46. 'ft-red':item.recordStatus == '不合格'
  47. }">{{item.recordStatus}}</text></uni-td>
  48. </uni-tr>
  49. <uni-tr class="section-title" @click="enterItem(item.pdid, 2)">
  50. <uni-td class="grid-text">关键工序记录</uni-td>
  51. <uni-td class="grid-text">
  52. <text :class="{
  53. 'bg-green bg-text': item.keyStatus == '已完成',
  54. 'bg-yellow bg-text': item.keyCount > 0 && item.keyCount < item.keyTotal,
  55. 'bg-black bg-text': item.keyCount == 0,
  56. }">
  57. {{item.keyCount}} / {{item.keyTotal}}
  58. </text>
  59. </uni-td>
  60. <uni-td class="grid-text">{{item.keyStatus}}</uni-td>
  61. </uni-tr>
  62. </uni-table>
  63. </view>
  64. <!-- #ifdef APP -->
  65. </scroll-view>
  66. <!-- #endif -->
  67. </template>
  68. <script setup>
  69. import {
  70. ref,
  71. onMounted
  72. } from 'vue'
  73. import { getList, TaskDownload, statusDict, TaskInfo, getTaskDetail, TaskDetail } from '@/api/work';
  74. //自定义返回行为,覆盖系统默认返回按钮
  75. const backPressOptions = reactive({
  76. from: 'backbutton'
  77. } as OnBackPressOptions)
  78. onBackPress((options : OnBackPressOptions) : boolean | null => {
  79. console.log('onBackPress', options)
  80. uni.navigateTo({
  81. url: `/pages/work/download/DownloadList`,
  82. // 修改动画方向为从左到右退回
  83. animationType: 'slide-in-left', // 使用从左到右滑出的动画效果
  84. animationDuration: 300 // 动画持续时间,单位ms
  85. })
  86. // 返回true表示拦截默认返回行为
  87. return true
  88. })
  89. const titleList = [{
  90. title1: "部位", title2: "进度", title3: "状态"
  91. }];
  92. var taskProcessList = ref<TaskDetail[]>([]);
  93. var initTasks = [] as TaskDetail[]
  94. //const statusMap = ref(new Map<number, string>([[1,'未执行'],[2,'执行中'],[3,'执行完'],[4,'检验失败']]))
  95. const download = ref<TaskDownload>({
  96. pdid: 0,
  97. gxpk: '',
  98. cardno: '',
  99. productcode: '',
  100. model: '',
  101. workorder: '',
  102. invname: '',
  103. graphid: '',
  104. processno: '',
  105. gxno: '',
  106. ver: '',
  107. lastupdatetime: '',
  108. updateuser: '',
  109. uploadflag: 0,
  110. progress: ''
  111. })
  112. onLoad((options) => {
  113. const downloadId = options?.id ?? ""
  114. // 模拟数据加载,建议替换为后端接口请求
  115. // #ifdef APP-ANDROID
  116. //获取下载产品数据
  117. getList('app_task_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. let obj = dataList[0]
  122. if (obj != null) {
  123. let data = JSON.parse<TaskDownload>(obj.toJSONString());
  124. if (data != null) {
  125. download.value = data
  126. }
  127. }
  128. }
  129. })
  130. //获取下载产品任务数据
  131. getTaskDetail('pdid', downloadId).then((res : UTSJSONObject) => {
  132. console.log(res)
  133. let dataList = res?.['data'] as UTSJSONObject[] ?? Array<UTSJSONObject>()
  134. if (dataList != null && dataList.length > 0) {
  135. dataList.forEach(item => {
  136. if (item != null) {
  137. let task = JSON.parse<TaskDetail>(item.toJSONString());
  138. if (task != null) {
  139. initTasks.push(task)
  140. }
  141. }
  142. });
  143. }
  144. taskProcessList.value = initTasks
  145. })
  146. // #endif
  147. })
  148. const goBack = () => {
  149. uni.navigateBack()
  150. }
  151. const enterItem = (id : string, type : number) => {
  152. let url = ''
  153. if (type == 0) {
  154. url = `/pages/work/download/PhotoRecord?pdid=${id}`
  155. } else if (type == 1) {
  156. url = `/pages/work/report/InspectionList?pdid=${id}`
  157. } else if (type == 2) {
  158. url = `/pages/work/process/ProcessList`
  159. }
  160. uni.navigateTo({
  161. url
  162. });
  163. }
  164. </script>
  165. <style scoped>
  166. .container {
  167. padding: 40rpx;
  168. background-color: #f5f7fa;
  169. flex: 1;
  170. box-sizing: border-box;
  171. }
  172. .banner {
  173. background: linear-gradient(135deg, #2193b0, #6dd5ed);
  174. border-radius: 24rpx;
  175. padding: 40rpx 30rpx;
  176. margin-bottom: 40rpx;
  177. box-shadow: 0 8rpx 16rpx rgba(33, 147, 176, 0.3);
  178. }
  179. .banner-title {
  180. color: white;
  181. font-size: 36rpx;
  182. font-weight: bold;
  183. text-align: center;
  184. }
  185. .section {
  186. background-color: #fff;
  187. border-radius: 20rpx;
  188. padding: 30rpx;
  189. margin-bottom: 30rpx;
  190. box-shadow: 0 6rpx 16rpx rgba(0, 0, 0, 0.05);
  191. }
  192. .section-title {
  193. display: flex;
  194. flex-direction: row;
  195. flex: 1;
  196. }
  197. .info-item {
  198. display: flex;
  199. justify-content: space-between;
  200. /* #ifdef APP-NVUE */
  201. font-size: 28rpx;
  202. color: #666;
  203. /* #endif */
  204. margin-bottom: 18rpx;
  205. flex-direction: row;
  206. }
  207. .section-content {
  208. font-size: 28rpx;
  209. color: #444;
  210. line-height: 1.8;
  211. white-space: normal;
  212. }
  213. /* 表格容器样式 */
  214. uni-table {
  215. width: 100%;
  216. background-color: #fff;
  217. /* 设置表格背景色 */
  218. border-radius: 8rpx;
  219. overflow: hidden;
  220. /* 去除列表样式,解决第一列前的小短横 */
  221. list-style-type: none;
  222. }
  223. /* 表格行样式 */
  224. uni-tr {
  225. width: 100%;
  226. /* #ifdef APP-ANDROID */
  227. border-bottom: 1rpx solid #f0f0f0;
  228. /* Android设备添加底边框 */
  229. /* #endif */
  230. }
  231. /* 表格单元格样式 */
  232. uni-td {
  233. /* #ifdef APP-ANDROID */
  234. border-right: 1rpx solid #f0f0f0;
  235. /* Android设备添加右边框 */
  236. /* #endif */
  237. }
  238. /* 最后一列去除右边框 */
  239. uni-tr uni-td:last-child {
  240. /* #ifdef APP-ANDROID */
  241. border-right: none;
  242. /* #endif */
  243. }
  244. /* 最后一行去除底边框 */
  245. uni-table uni-tr:last-child {
  246. /* #ifdef APP-ANDROID */
  247. border-bottom: none;
  248. /* #endif */
  249. }
  250. .grid-text {
  251. /* #ifdef APP-NVUE */
  252. font-size: 24rpx;
  253. color: #000;
  254. /* #endif */
  255. padding: 10rpx 0 10rpx 0rpx;
  256. box-sizing: border-box;
  257. margin: 10rpx 10rpx;
  258. min-width: 180rpx;
  259. }
  260. .footer-btn {
  261. margin-top: 40rpx;
  262. display: flex;
  263. justify-content: center;
  264. }
  265. .main-btn {
  266. width: 80%;
  267. padding: 28rpx 0;
  268. font-size: 30rpx;
  269. color: #fff;
  270. border: none;
  271. border-radius: 100rpx;
  272. background: linear-gradient(to right, #36d1dc, #5b86e5);
  273. box-shadow: 0 10rpx 24rpx rgba(91, 134, 229, 0.3);
  274. }
  275. .label {
  276. font-weight: bold;
  277. color: #102a43;
  278. min-width: 150rpx;
  279. margin-right: 30rpx;
  280. }
  281. .value {
  282. flex: 1;
  283. /* #ifdef APP-NVUE */
  284. white-space: nowrap;
  285. text-overflow: ellipsis;
  286. /* #endif */
  287. overflow: hidden;
  288. margin-left: 30rpx;
  289. }
  290. .my-radius {
  291. border-radius: 10rpx;
  292. }
  293. .bg-text {
  294. width: 120rpx;
  295. min-width: 100rpx;
  296. border-radius: 10rpx;
  297. text-align: center;
  298. }
  299. .bg-green {
  300. background-color: seagreen;
  301. color: #fff;
  302. }
  303. .bg-yellow {
  304. background-color: yellow;
  305. }
  306. .bg-black {
  307. background-color: #102a43;
  308. color: #fff;
  309. }
  310. .bg-red {
  311. background-color: red;
  312. color: #fff;
  313. }
  314. .ft-red {
  315. color: red;
  316. }
  317. </style>