DownloadList.uvue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <view class="info-row btn-panel">
  3. <button class="btn btn-first" @click="download">
  4. 下载数据
  5. </button>
  6. <button class="btn btn-second" @click="upload">
  7. 上传数据
  8. </button>
  9. </view>
  10. <!-- #ifdef APP -->
  11. <scroll-view style="flex:1">
  12. <!-- #endif -->
  13. <view class="download-card" v-for="(item, index) in downloads" :key="index" @click="enterItem(item.pdid)">
  14. <view class="info-row">
  15. <text class="label">工作令:</text>
  16. <text class="value">{{ item.workorder }}</text>
  17. </view>
  18. <view class="info-row">
  19. <text class="label">产品名称:</text>
  20. <text class="value">{{ item.invname }}</text>
  21. </view>
  22. <view class="info-row">
  23. <text class="label">图号:</text>
  24. <text class="value">{{ item.graphid }}</text>
  25. </view>
  26. <view class="info-row">
  27. <text class="label">产品编码:</text>
  28. <text class="value">{{ item.productno }}</text>
  29. </view>
  30. <view class="info-row">
  31. <text class="label">路卡号:</text>
  32. <text class="value">{{ item.cardno }}</text>
  33. </view>
  34. <view class="info-row">
  35. <text class="label">工艺编号:</text>
  36. <text class="value">{{ item.processno }}</text>
  37. </view>
  38. <view class="info-row">
  39. <text class="label">版本号:</text>
  40. <text class="value">{{ item.ver }}</text>
  41. </view>
  42. <view class="info-row">
  43. <text class="label">最近更新时间:</text>
  44. <text class="value">{{ item.updatetime }}</text>
  45. </view>
  46. <view class="info-row">
  47. <text class="label">进度:</text>
  48. <text class="process-value" :class="{
  49. 'bg-green': item.status === 3,
  50. 'bg-yellow': item.status === 2,
  51. 'bg-black': item.status === 1
  52. }">{{ item.progress }}</text>
  53. </view>
  54. </view>
  55. <!-- #ifdef APP -->
  56. </scroll-view>
  57. <!-- #endif -->
  58. </template>
  59. <script setup>
  60. import {
  61. ref
  62. } from 'vue'
  63. import { getList, Download } from '@/api/work';
  64. var initDownloads = [] as Download[]
  65. var downloads = ref<Download[]>([]);
  66. // #ifdef APP-ANDROID
  67. getList('app_product', null, null, null).then((res:UTSJSONObject) => {
  68. console.log(res)
  69. let dataList = res?.['data'] as UTSJSONObject[] ?? Array<UTSJSONObject>()
  70. if(dataList!=null && dataList.length>0){
  71. dataList.forEach(item =>{
  72. if(item!=null){
  73. let download = JSON.parse<Download>(item.toJSONString());
  74. if(download!=null){
  75. initDownloads.push(download)
  76. }
  77. }
  78. });
  79. }
  80. console.log(initDownloads)
  81. downloads.value = initDownloads
  82. })
  83. // #endif
  84. // #ifdef H5
  85. downloads = [{
  86. pdid: 1,
  87. workorder: "632-P-01",
  88. invname: "箱间段",
  89. productno: "1CFA1040-00#S",
  90. graphid: "HBJ0100-00",
  91. cardno: "LK20230707070012",
  92. processno: "Pb/XXX-E11",
  93. ver: "A.1",
  94. updatetime: "2025-06-23",
  95. progress: "3/3",
  96. status: 3
  97. }, {
  98. pdid: 2,
  99. workorder: "712-SY-10-6",
  100. invname: "级间架",
  101. productno: "1XA1020-00A",
  102. graphid: "1XC002-00",
  103. cardno: "LK20250215003",
  104. processno: "Pb/XXX-E11",
  105. ver: "B.1",
  106. updatetime: "2025-08-25",
  107. progress: "2/4",
  108. status: 2
  109. }, {
  110. pdid: 3,
  111. workorder: "712-SY-10-6",
  112. invname: "级间架",
  113. productno: "1XA1020-00A",
  114. graphid: "1XC002-00",
  115. cardno: "LK20250215003",
  116. processno: "Pb/XXX-E11",
  117. ver: "B.1",
  118. updatetime: "2025-08-25",
  119. progress: "0/4",
  120. status: 1
  121. }] as Download[];
  122. // #endif
  123. const download = (e : any) => {
  124. console.log("开始下载...")
  125. }
  126. const upload = (e : any) => {
  127. console.log("开始上传...")
  128. }
  129. const enterItem = (id : number) => {
  130. uni.navigateTo({
  131. url: `/pages/work/download/DownloadDetail?id=${id}`
  132. });
  133. }
  134. </script>
  135. <style scope>
  136. .container {
  137. padding: 24rpx;
  138. background-color: #f0f4f8;
  139. flex: 1;
  140. display: flex;
  141. flex-direction: column;
  142. font-family: "PingFang SC", "Helvetica Neue", Helvetica, Arial, sans-serif;
  143. /* #ifndef APP-ANDROID */
  144. min-height: 100vh;
  145. /* #endif */
  146. height: 120rpx;
  147. }
  148. .download-card {
  149. background: #ffffff;
  150. border-radius: 20rpx;
  151. padding: 24rpx 32rpx;
  152. box-shadow: 0 8rpx 15rpx rgba(0, 43, 92, 0.1);
  153. display: flex;
  154. flex-direction: column;
  155. margin-bottom: 20rpx;
  156. margin-top: 40rpx;
  157. }
  158. .download-card .view {
  159. margin-bottom: 16rpx;
  160. }
  161. /* 信息行 */
  162. .info-row {
  163. display: flex;
  164. flex-direction: row;
  165. font-size: 28rpx;
  166. color: #33475b;
  167. align-items: center;
  168. }
  169. .info-row>.label {
  170. margin-left: 10rpx;
  171. }
  172. .info-row>.value {
  173. margin-left: 10rpx;
  174. }
  175. .btn-panel {
  176. display: flex;
  177. justify-content: space-between;
  178. align-items: center;
  179. margin-left: 5rpx;
  180. margin-right: 5rpx;
  181. }
  182. .label {
  183. font-weight: bold;
  184. color: #102a43;
  185. min-width: 100rpx;
  186. }
  187. .value {
  188. flex: 1;
  189. white-space: nowrap;
  190. overflow: hidden;
  191. text-overflow: ellipsis;
  192. }
  193. .btn {
  194. align-self: flex-end;
  195. background-color: #00aaff;
  196. color: #fff;
  197. border: none;
  198. border-radius: 32rpx;
  199. padding: 2rpx 30rpx;
  200. font-size: 24rpx;
  201. font-weight: bold;
  202. /* #ifndef APP-ANDROID */
  203. transition: background-color 0.3s ease;
  204. /* #endif */
  205. margin-top: 30rpx;
  206. }
  207. .process-value {
  208. width: 120rpx;
  209. min-width: 100rpx;
  210. text-align: center;
  211. border-radius: 10rpx;
  212. }
  213. .bg-green {
  214. background-color: seagreen;
  215. }
  216. .bg-yellow {
  217. background-color: yellow;
  218. }
  219. .bg-black {
  220. background-color: #102a43;
  221. }
  222. .btn-first {
  223. margin-left: 5rpx;
  224. }
  225. .btn-second {
  226. margin-right: 5rpx;
  227. }
  228. </style>