DownloadDetail.uvue 8.9 KB

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