DownloadDetail.uvue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  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.recordStatus == '已完成',
  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. 5
  150. uni.navigateBack()
  151. }
  152. const enterItem = (id : string, type : number) => {
  153. let url = ''
  154. if (type == 0) {
  155. url = `/pages/work/download/PhotoRecord?pdid=${id}`
  156. } else if (type == 1) {
  157. url = `/pages/work/report/InspectionList?pdid=${id}`
  158. } else if (type == 2) {
  159. url = `/pages/work/process/ProcessList`
  160. }
  161. uni.navigateTo({
  162. url
  163. });
  164. }
  165. </script>
  166. <style scoped>
  167. .container {
  168. padding: 40rpx;
  169. background-color: #f5f7fa;
  170. flex: 1;
  171. box-sizing: border-box;
  172. }
  173. .banner {
  174. background: linear-gradient(135deg, #2193b0, #6dd5ed);
  175. border-radius: 24rpx;
  176. padding: 40rpx 30rpx;
  177. margin-bottom: 40rpx;
  178. box-shadow: 0 8rpx 16rpx rgba(33, 147, 176, 0.3);
  179. }
  180. .banner-title {
  181. color: white;
  182. font-size: 36rpx;
  183. font-weight: bold;
  184. text-align: center;
  185. }
  186. .section {
  187. background-color: #fff;
  188. border-radius: 20rpx;
  189. padding: 30rpx;
  190. margin-bottom: 30rpx;
  191. box-shadow: 0 6rpx 16rpx rgba(0, 0, 0, 0.05);
  192. }
  193. .section-title {
  194. display: flex;
  195. flex-direction: row;
  196. flex: 1;
  197. }
  198. .info-item {
  199. display: flex;
  200. justify-content: space-between;
  201. /* #ifdef APP-NVUE */
  202. font-size: 28rpx;
  203. color: #666;
  204. /* #endif */
  205. margin-bottom: 18rpx;
  206. flex-direction: row;
  207. }
  208. .section-content {
  209. font-size: 28rpx;
  210. color: #444;
  211. line-height: 1.8;
  212. white-space: normal;
  213. }
  214. /* 表格容器样式 */
  215. uni-table {
  216. width: 100%;
  217. background-color: #fff;
  218. /* 设置表格背景色 */
  219. border-radius: 8rpx;
  220. overflow: hidden;
  221. /* 去除列表样式,解决第一列前的小短横 */
  222. list-style-type: none;
  223. }
  224. /* 表格行样式 */
  225. uni-tr {
  226. width: 100%;
  227. /* #ifdef APP-ANDROID */
  228. border-bottom: 1rpx solid #f0f0f0;
  229. /* Android设备添加底边框 */
  230. /* #endif */
  231. }
  232. /* 表格单元格样式 */
  233. uni-td {
  234. /* #ifdef APP-ANDROID */
  235. border-right: 1rpx solid #f0f0f0;
  236. /* Android设备添加右边框 */
  237. /* #endif */
  238. }
  239. /* 最后一列去除右边框 */
  240. uni-tr uni-td:last-child {
  241. /* #ifdef APP-ANDROID */
  242. border-right: none;
  243. /* #endif */
  244. }
  245. /* 最后一行去除底边框 */
  246. uni-table uni-tr:last-child {
  247. /* #ifdef APP-ANDROID */
  248. border-bottom: none;
  249. /* #endif */
  250. }
  251. .grid-text {
  252. /* #ifdef APP-NVUE */
  253. font-size: 24rpx;
  254. color: #000;
  255. /* #endif */
  256. padding: 10rpx 0 10rpx 0rpx;
  257. box-sizing: border-box;
  258. margin: 10rpx 10rpx;
  259. min-width: 180rpx;
  260. }
  261. .footer-btn {
  262. margin-top: 40rpx;
  263. display: flex;
  264. justify-content: center;
  265. }
  266. .main-btn {
  267. width: 80%;
  268. padding: 28rpx 0;
  269. font-size: 30rpx;
  270. color: #fff;
  271. border: none;
  272. border-radius: 100rpx;
  273. background: linear-gradient(to right, #36d1dc, #5b86e5);
  274. box-shadow: 0 10rpx 24rpx rgba(91, 134, 229, 0.3);
  275. }
  276. .label {
  277. font-weight: bold;
  278. color: #102a43;
  279. min-width: 150rpx;
  280. margin-right: 30rpx;
  281. }
  282. .value {
  283. flex: 1;
  284. /* #ifdef APP-NVUE */
  285. white-space: nowrap;
  286. text-overflow: ellipsis;
  287. /* #endif */
  288. overflow: hidden;
  289. margin-left: 30rpx;
  290. }
  291. .my-radius {
  292. border-radius: 10rpx;
  293. }
  294. .bg-text {
  295. width: 120rpx;
  296. min-width: 100rpx;
  297. border-radius: 10rpx;
  298. text-align: center;
  299. }
  300. .bg-green {
  301. background-color: seagreen;
  302. color: #fff;
  303. }
  304. .bg-yellow {
  305. background-color: yellow;
  306. }
  307. .bg-black {
  308. background-color: #102a43;
  309. color: #fff;
  310. }
  311. .bg-red {
  312. background-color: red;
  313. color: #fff;
  314. }
  315. .ft-red {
  316. color: red;
  317. }
  318. </style>