index.vue 5.9 KB

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