DownloadDetail.uvue 8.5 KB

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