index.vue 6.2 KB

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