DownloadList.uvue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  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 } from '@/api/work';
  64. type Download = {
  65. pdid : number,
  66. workorder : string,
  67. invname : string,
  68. productno : string,
  69. graphid : string,
  70. cardno : string,
  71. processno : string,
  72. ver : string,
  73. updatetime : string,
  74. progress : string,
  75. status : number
  76. }
  77. var initDownloads = [] as Download[]
  78. var downloads = ref<Download[]>([]);
  79. // #ifdef APP-ANDROID
  80. getList('app_product', null, null).then((res:UTSJSONObject) => {
  81. console.log(res)
  82. let dataList = res?.['data'] as UTSJSONObject[] ?? Array<UTSJSONObject>()
  83. if(dataList!=null && dataList.length>0){
  84. dataList.forEach(item =>{
  85. if(item!=null){
  86. let download = JSON.parse<Download>(item.toJSONString());
  87. if(download!=null){
  88. initDownloads.push(download)
  89. }
  90. }
  91. });
  92. }
  93. console.log(initDownloads)
  94. downloads.value = initDownloads
  95. })
  96. // #endif
  97. // #ifdef H5
  98. const downloads = [{
  99. pdid: 1,
  100. workorder: "632-P-01",
  101. invname: "箱间段",
  102. productno: "1CFA1040-00#S",
  103. graphid: "HBJ0100-00",
  104. cardno: "LK20230707070012",
  105. processno: "Pb/XXX-E11",
  106. ver: "A.1",
  107. updatetime: "2025-06-23",
  108. progress: "3/3",
  109. status: 3
  110. }, {
  111. pdid: 2,
  112. workorder: "712-SY-10-6",
  113. invname: "级间架",
  114. productno: "1XA1020-00A",
  115. graphid: "1XC002-00",
  116. cardno: "LK20250215003",
  117. processno: "Pb/XXX-E11",
  118. ver: "B.1",
  119. updatetime: "2025-08-25",
  120. progress: "2/4",
  121. status: 2
  122. }, {
  123. pdid: 3,
  124. workorder: "712-SY-10-6",
  125. invname: "级间架",
  126. productno: "1XA1020-00A",
  127. graphid: "1XC002-00",
  128. cardno: "LK20250215003",
  129. processno: "Pb/XXX-E11",
  130. ver: "B.1",
  131. updatetime: "2025-08-25",
  132. progress: "0/4",
  133. status: 1
  134. }] as Download[];
  135. // #endif
  136. const download = (e : any) => {
  137. console.log("开始下载...")
  138. }
  139. const upload = (e : any) => {
  140. console.log("开始上传...")
  141. }
  142. const enterItem = (id : number) => {
  143. uni.navigateTo({
  144. url: `/pages/work/download/DownloadDetail?id=${id}`
  145. });
  146. }
  147. </script>
  148. <style scope>
  149. .container {
  150. padding: 24rpx;
  151. background-color: #f0f4f8;
  152. flex: 1;
  153. display: flex;
  154. flex-direction: column;
  155. font-family: "PingFang SC", "Helvetica Neue", Helvetica, Arial, sans-serif;
  156. /* #ifndef APP-ANDROID */
  157. min-height: 100vh;
  158. /* #endif */
  159. height: 120rpx;
  160. }
  161. .download-card {
  162. background: #ffffff;
  163. border-radius: 20rpx;
  164. padding: 24rpx 32rpx;
  165. box-shadow: 0 8rpx 15rpx rgba(0, 43, 92, 0.1);
  166. display: flex;
  167. flex-direction: column;
  168. margin-bottom: 20rpx;
  169. margin-top: 40rpx;
  170. }
  171. .download-card .view {
  172. margin-bottom: 16rpx;
  173. }
  174. /* 信息行 */
  175. .info-row {
  176. display: flex;
  177. flex-direction: row;
  178. font-size: 28rpx;
  179. color: #33475b;
  180. align-items: center;
  181. }
  182. .info-row>.label {
  183. margin-left: 10rpx;
  184. }
  185. .info-row>.value {
  186. margin-left: 10rpx;
  187. }
  188. .btn-panel {
  189. display: flex;
  190. justify-content: space-between;
  191. align-items: center;
  192. margin-left: 5rpx;
  193. margin-right: 5rpx;
  194. }
  195. .label {
  196. font-weight: bold;
  197. color: #102a43;
  198. min-width: 100rpx;
  199. }
  200. .value {
  201. flex: 1;
  202. white-space: nowrap;
  203. overflow: hidden;
  204. text-overflow: ellipsis;
  205. }
  206. .btn {
  207. align-self: flex-end;
  208. background-color: #00aaff;
  209. color: #fff;
  210. border: none;
  211. border-radius: 32rpx;
  212. padding: 2rpx 30rpx;
  213. font-size: 24rpx;
  214. font-weight: bold;
  215. /* #ifndef APP-ANDROID */
  216. transition: background-color 0.3s ease;
  217. /* #endif */
  218. margin-top: 30rpx;
  219. }
  220. .process-value {
  221. width: 120rpx;
  222. min-width: 100rpx;
  223. text-align: center;
  224. border-radius: 10rpx;
  225. }
  226. .bg-green {
  227. background-color: seagreen;
  228. }
  229. .bg-yellow {
  230. background-color: yellow;
  231. }
  232. .bg-black {
  233. background-color: #102a43;
  234. }
  235. .btn-first {
  236. margin-left: 5rpx;
  237. }
  238. .btn-second {
  239. margin-right: 5rpx;
  240. }
  241. </style>