index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. <template>
  2. <view class="uni-column container">
  3. <view style="margin: 12rpx;">
  4. <view class="margenTop" style="font-size: 30rpx;font-weight: bold;">批次号:{{product.lotCode}}</view>
  5. <view class="margenTop" style="font-size: 30rpx;font-weight: bold;">产品描述:{{product.productDescription}}
  6. </view>
  7. <view class="margenTop" style="font-size: 30rpx;font-weight: bold; flex-direction: row;">
  8. <view>工艺版本:{{product.technologyVersion}}</view>
  9. <view style="margin-left: 200rpx;">工序:</view>
  10. <uni-data-select v-model="curSelectedProcessCode" :localdata="selectedProcessList" :clear="false"
  11. @change="handleSelectedChange"></uni-data-select>
  12. </view>
  13. </view>
  14. <view class='middle'>
  15. <view class='segment'></view>
  16. <uni-icons type="paperclip" size="30"></uni-icons>
  17. <view class='segment'></view>
  18. </view>
  19. <view style="overflow: auto;">
  20. <view :class="{'list-container':true}" v-for="(item, index) in drawingList" :key="item.id">
  21. <view><text style="text-align: center; font-size: 28rpx; padding: 48rpx 0 24rpx 0;color: #1684fc;"
  22. @click="handleOpenDrawing(item)">{{item.drawingName}}</text></view>
  23. </view>
  24. </view>
  25. </view>
  26. </template>
  27. <script setup>
  28. import {
  29. getDrawingList,
  30. getTechnologicalProcess,
  31. getDeptProcess
  32. } from '@/api/business/drawing.js'
  33. import {
  34. ref
  35. } from 'vue'
  36. import {
  37. onLoad,
  38. } from '@dcloudio/uni-app'
  39. import {
  40. store
  41. } from '../../store';
  42. const technologicalProcessId = ref("")
  43. const drawingList = ref([])
  44. const processCode = ref("")
  45. const productId = ref("")
  46. const product = ref({})
  47. const lotCode = ref("")
  48. const selectedProcessList = ref([]);
  49. const curSelectedProcessCode = ref("");
  50. const processAlias = ref("")
  51. onLoad((options) => {
  52. console.log(options, 1111)
  53. technologicalProcessId.value = options.param4
  54. lotCode.value = options.param2
  55. productId.value = options.param1
  56. processCode.value = options.param3
  57. curSelectedProcessCode.value = processCode.value
  58. processAlias.value = decodeURIComponent(options.param5)
  59. init();
  60. })
  61. // 获取所有的本工段可加工工序
  62. function getProcesses(data) {
  63. console.log(data)
  64. getDeptProcess(data).then(res => {
  65. selectedProcessList.value = res.data.map(v => ({
  66. text: v.processAlias,
  67. value: v.processCode
  68. }))
  69. curSelectedProcessCode.value = processCode.value
  70. })
  71. }
  72. function init() {
  73. console.log(product.value)
  74. getTechnologicalProcess(technologicalProcessId.value).then(response => {
  75. console.log(response, 1123)
  76. if (response.code == 200) {
  77. product.value = response.data
  78. product.value.lotCode = lotCode.value
  79. product.value.processAlias = processAlias.value
  80. getProcesses({
  81. productVersion: product.value.technologyVersion,
  82. deptId: store.curDeptDetails.deptId,
  83. productId: productId.value
  84. })
  85. getDrawingList({
  86. productVersion: product.value.technologyVersion,
  87. processCode: processCode.value,
  88. productId: productId.value
  89. }).then(res => {
  90. if (res.code == 200) {
  91. drawingList.value = res.data
  92. // product.value = drawingList.value[0].product
  93. // product.value.technologyVersion = drawingList.value[0].technologyVersion
  94. // product.value.processAlias = drawingList.value[0].processAlias
  95. // product.value.lotCode = lotCode.value
  96. }
  97. })
  98. }
  99. })
  100. }
  101. function handleOpenDrawing(row) {
  102. // 检查 filteredProcess 是否有元素,并选择第一个元素
  103. var encodeUrl = row.url;
  104. console.log(row)
  105. // 构建查询参数字符串
  106. var queryParam = `param1=${encodeUrl}`;
  107. // 使用模板字符串构建完整的URL
  108. var navigateUrl = `/pages/pdfviewer/index?${queryParam}`;
  109. // 导航到指定页面
  110. uni.navigateTo({
  111. url: navigateUrl
  112. });
  113. }
  114. //切换工序查询
  115. function handleSelectedChange(item) {
  116. getDrawingList({
  117. productVersion: product.value.technologyVersion,
  118. processCode: curSelectedProcessCode.value,
  119. productId: productId.value
  120. }).then(res => {
  121. if (res.code == 200) {
  122. drawingList.value = res.data
  123. }
  124. })
  125. }
  126. </script>
  127. <style lang="scss">
  128. .container {
  129. height: 100%;
  130. background-color: #f5f5f5;
  131. }
  132. .middle {
  133. display: flex;
  134. flex-direction: row;
  135. align-items: center;
  136. justify-content: center;
  137. margin-top: 20rpx;
  138. }
  139. .scroll-container {
  140. position: absolute;
  141. top: 24rpx;
  142. right: 0;
  143. bottom: 160rpx;
  144. left: 0;
  145. }
  146. .segment {
  147. width: 280rpx;
  148. background-color: rgba(213, 213, 213, 1);
  149. border: 1rpx solid rgba(213, 213, 213, 1);
  150. }
  151. .selected {
  152. border: 1px solid #1684fc;
  153. }
  154. .margenTop {
  155. margin: 20rpx;
  156. }
  157. .list-item {
  158. background-color: #fff;
  159. position: relative;
  160. padding: 16rpx;
  161. padding-bottom: 24rpx;
  162. margin: 0 24rpx;
  163. margin-bottom: 24rpx;
  164. border-radius: 8rpx;
  165. .title-container {
  166. justify-content: space-between;
  167. margin-top: 8rpx;
  168. margin-bottom: 16rpx;
  169. .title {
  170. height: 48rpx;
  171. align-items: center;
  172. .label {
  173. color: #1684fc;
  174. font-size: 32rpx;
  175. font-weight: bold;
  176. &.code {
  177. color: #000000;
  178. margin-left: 32rpx;
  179. }
  180. }
  181. }
  182. }
  183. .item-info {
  184. margin-bottom: 16rpx;
  185. .label {
  186. font-size: 28rpx;
  187. width: 152rpx;
  188. color: #808080;
  189. &.right {
  190. flex: 1;
  191. color: #808080;
  192. }
  193. }
  194. }
  195. .right-info {
  196. justify-content: flex-end;
  197. margin-top: 2rpx;
  198. .label {
  199. font-size: 28rpx;
  200. color: #ff0000;
  201. }
  202. }
  203. }
  204. .bottom {
  205. position: fixed;
  206. right: 0;
  207. bottom: 0;
  208. left: 0;
  209. height: 100rpx;
  210. padding: 16rpx 24rpx;
  211. align-items: center;
  212. background-color: #FFFFFF;
  213. justify-content: space-between;
  214. .bottom-btn {
  215. flex: 1;
  216. font-size: 28rpx;
  217. color: #FFFFFF;
  218. &.left-btn {
  219. background-color: #1684fc;
  220. }
  221. &.right-btn {
  222. background-color: rgb(255, 121, 1);
  223. margin-left: 24rpx;
  224. }
  225. }
  226. }
  227. </style>