index.vue 8.2 KB

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