index.vue 6.2 KB

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