index.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. <template>
  2. <view class="uni-column container" style="position: absolute;top: 0;left: 0;right: 0;">
  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({id:technologicalProcessId.value}).then(response => {
  118. console.log(response, 1123)
  119. if (response.code == 200) {
  120. product.value = response.data
  121. product.value.lotCode = lotCode.value
  122. product.value.processAlias = processAlias.value
  123. getLotProcesses({
  124. productVersion: product.value.technologyVersion,
  125. deptId: store.curDeptDetails.deptId,
  126. productId: productId.value,
  127. technologicalProcessId:technologicalProcessId.value
  128. })
  129. getDrawingList({
  130. productVersion: product.value.technologyVersion,
  131. processCode: processCode.value,
  132. productId: productId.value
  133. }).then(res => {
  134. if (res.code == 200) {
  135. drawingList.value = res.data
  136. // product.value = drawingList.value[0].product
  137. // product.value.technologyVersion = drawingList.value[0].technologyVersion
  138. // product.value.processAlias = drawingList.value[0].processAlias
  139. // product.value.lotCode = lotCode.value
  140. }
  141. })
  142. }
  143. })
  144. }else{
  145. getTechnologicalProcess(technologicalProcessId.value).then(response => {
  146. console.log(response, 1123)
  147. if (response.code == 200) {
  148. product.value = response.data
  149. product.value.lotCode = lotCode.value
  150. product.value.processAlias = processAlias.value
  151. getProcesses({
  152. productVersion: product.value.technologyVersion,
  153. deptId: store.curDeptDetails.deptId,
  154. productId: productId.value,
  155. technologicalProcessId:technologicalProcessId.value
  156. })
  157. getDrawingList({
  158. productVersion: product.value.technologyVersion,
  159. processCode: processCode.value,
  160. productId: productId.value
  161. }).then(res => {
  162. if (res.code == 200) {
  163. drawingList.value = res.data
  164. // product.value = drawingList.value[0].product
  165. // product.value.technologyVersion = drawingList.value[0].technologyVersion
  166. // product.value.processAlias = drawingList.value[0].processAlias
  167. // product.value.lotCode = lotCode.value
  168. }
  169. })
  170. }
  171. })
  172. }
  173. }
  174. function handleOpenDrawing(row) {
  175. // 检查 filteredProcess 是否有元素,并选择第一个元素
  176. var encodeUrl = row.url;
  177. console.log(row)
  178. // 构建查询参数字符串
  179. var queryParam = `param1=${encodeUrl}`;
  180. // 使用模板字符串构建完整的URL
  181. var navigateUrl = `/pages/pdfviewer/index?${queryParam}`;
  182. // 导航到指定页面
  183. uni.navigateTo({
  184. url: navigateUrl
  185. });
  186. }
  187. //切换工序查询
  188. function handleSelectedChange(item) {
  189. getDrawingList({
  190. productVersion: product.value.technologyVersion,
  191. processCode: curSelectedProcessCode.value,
  192. productId: productId.value
  193. }).then(res => {
  194. if (res.code == 200) {
  195. drawingList.value = res.data
  196. }
  197. })
  198. }
  199. </script>
  200. <style lang="scss">
  201. .container {
  202. height: 100%;
  203. background-color: #f5f5f5;
  204. }
  205. .middle {
  206. display: flex;
  207. flex-direction: row;
  208. align-items: center;
  209. justify-content: center;
  210. margin-top: 20rpx;
  211. }
  212. .scroll-container {
  213. position: absolute;
  214. top: 24rpx;
  215. right: 0;
  216. bottom: 160rpx;
  217. left: 0;
  218. }
  219. .segment {
  220. width: 280rpx;
  221. background-color: rgba(213, 213, 213, 1);
  222. border: 1rpx solid rgba(213, 213, 213, 1);
  223. }
  224. .selected {
  225. border: 1px solid #1684fc;
  226. }
  227. .margenTop {
  228. margin: 20rpx;
  229. }
  230. .list-item {
  231. background-color: #fff;
  232. position: relative;
  233. padding: 16rpx;
  234. padding-bottom: 24rpx;
  235. margin: 0 24rpx;
  236. margin-bottom: 24rpx;
  237. border-radius: 8rpx;
  238. .title-container {
  239. justify-content: space-between;
  240. margin-top: 8rpx;
  241. margin-bottom: 16rpx;
  242. .title {
  243. height: 48rpx;
  244. align-items: center;
  245. .label {
  246. color: #1684fc;
  247. font-size: 32rpx;
  248. font-weight: bold;
  249. &.code {
  250. color: #000000;
  251. margin-left: 32rpx;
  252. }
  253. }
  254. }
  255. }
  256. .item-info {
  257. margin-bottom: 16rpx;
  258. .label {
  259. font-size: 28rpx;
  260. width: 152rpx;
  261. color: #808080;
  262. &.right {
  263. flex: 1;
  264. color: #808080;
  265. }
  266. }
  267. }
  268. .right-info {
  269. justify-content: flex-end;
  270. margin-top: 2rpx;
  271. .label {
  272. font-size: 28rpx;
  273. color: #ff0000;
  274. }
  275. }
  276. }
  277. .bottom {
  278. position: fixed;
  279. right: 0;
  280. bottom: 0;
  281. left: 0;
  282. height: 100rpx;
  283. padding: 16rpx 24rpx;
  284. align-items: center;
  285. background-color: #FFFFFF;
  286. justify-content: space-between;
  287. .bottom-btn {
  288. flex: 1;
  289. font-size: 28rpx;
  290. color: #FFFFFF;
  291. &.left-btn {
  292. background-color: #1684fc;
  293. }
  294. &.right-btn {
  295. background-color: rgb(255, 121, 1);
  296. margin-left: 24rpx;
  297. }
  298. }
  299. }
  300. </style>