DownloadDetail.uvue 8.8 KB

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