dialog-lotReporting.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. <template>
  2. <dialog-base class="dialog-body" ref="baseDialog" title="添加批次报工">
  3. <view style="overflow: auto;">
  4. <!-- <view v-for="(item, index) in lotData" :key="index" class="list-item"> -->
  5. <view class="item-info uni-row">
  6. <text class="label">批次号</text>
  7. <text class="label right">{{ lotData.map(v => v.lotCode).join(",") }}</text>
  8. </view>
  9. <!-- <view class="item-info uni-row">
  10. <text class="label">生产计划单号</text>
  11. <text class="label right">{{ item['productionPlanNo'] }}</text>
  12. </view> -->
  13. <view class="item-info uni-row">
  14. <text class="label">产品描述</text>
  15. <text class="label right">{{ item['productDescription'] }}</text>
  16. </view>
  17. <view class="item-info uni-row">
  18. <text class="label">箱号</text>
  19. <text class="label right">{{ item['carrierName'] }}</text>
  20. </view>
  21. <view class="item-info uni-row">
  22. <text class="label">当前序</text>
  23. <view class="label right uni-row" style="display: flex; flex-direction: row; flex-wrap: wrap;">
  24. <view>{{ item['process'] ? item['process'].processAlias : '-' }}
  25. </view>
  26. <view style="color: #1684fc;" @click.stop="handleClickProcessList(item)">(&nbsp;工艺列表&nbsp;)
  27. </view>
  28. </view>
  29. </view>
  30. <view class="item-info uni-row">
  31. <text class="label">下序</text>
  32. <view class="label right uni-row">{{ item['nextProcess'] ? item['nextProcess'].processAlias : '-' }}
  33. </view>
  34. </view>
  35. <!-- <view class='middle'>
  36. <view class='segment'></view>
  37. <uni-icons type="paperclip" size="30" style="margin: 10rpx;"></uni-icons>
  38. <view class='segment'></view>
  39. </view> -->
  40. <!-- </view> -->
  41. </view>
  42. <view class="list-item">
  43. <view class="item-info uni-row">
  44. <text class="label">下序车间</text>
  45. <uni-data-select v-model="curDaywork.workshopId" :localdata="workshopList"
  46. @change="handleChangeWorkshop" :clear="false"
  47. style="outline: 2rpx solid #999999;border-radius: 10rpx;"></uni-data-select>
  48. </view>
  49. <view class="item-info uni-row">
  50. <text class="label">下序工段</text>
  51. <uni-data-select v-model="curDaywork.deptId" :localdata="deptList" :clear="false"
  52. style="outline: 2rpx solid #999999;border-radius: 10rpx;"></uni-data-select>
  53. </view>
  54. </view>
  55. <!-- 抽屉 -->
  56. <view>
  57. </view>
  58. <view style="z-index: 99999;">
  59. <!-- <uni-drawer ref="showRight" mode="right" :mask-click="true">
  60. <view class="scroll-view">
  61. <scroll-view class="scroll-view-box" style="height:100%;">
  62. <view style="width: 100%;text-align: center;;font-size: 48rpx;margin: 48rpx 0 24rpx 0;">工艺列表
  63. </view>
  64. <view style="font-size: 24rpx;width: 100%;text-align: center;color: red;margin-bottom: 48rpx;">
  65. 仅显示当前工序后面工艺</view>
  66. <view class="info-content" v-for="(item,index) in curProcessAfte" :key="index"
  67. style="width: 100%;margin: 8rpx 0 8rpx 14%;">
  68. <text>{{ index + 1 }}.{{item.processAlias}}</text>
  69. </view>
  70. </scroll-view>
  71. </view>
  72. </uni-drawer> -->
  73. <uni-drawer ref="showRight" mode="right" :mask-click="true">
  74. <view style="text-align: center; font-size: 48rpx; padding: 48rpx 0 24rpx 0;">工艺列表</view>
  75. <view style="font-size: 24rpx;text-align: center;color: red; margin-bottom: 16rpx;">
  76. 仅显示当前工序后面工艺
  77. </view>
  78. <scroll-view scroll-y="true" style="height: 80%;" @touchmove.stop>
  79. <view v-for="(item,index) in curProcessAfte" :key="index"
  80. style="padding: 8rpx 5% 8rpx 14%; border-top: 1px solid #cccccc">
  81. <text>{{ index + 1 }}.{{item.processAlias}}</text>
  82. </view>
  83. </scroll-view>
  84. <view><button class="start-batch-btn" style="margin-bottom: 10rpx;" type="primary" @click="handleOpenDrawing">查看本工序图纸</button></view>
  85. </uni-drawer>
  86. </view>
  87. <view class="add-btn-container uni-row">
  88. <button type="default" class="leftBtn" @click="handleFinishScan">结束扫码</button>
  89. <button type="default" class="rightBtn" @click="handleContinueScan">继续扫码</button>
  90. </view>
  91. </dialog-base>
  92. </template>
  93. <script setup>
  94. import {
  95. ref,
  96. getCurrentInstance,
  97. toRef
  98. } from 'vue'
  99. import {
  100. getDictInfoByType
  101. } from '@/api/dict/dict.js'
  102. import {
  103. getQuickDayworkList,
  104. finishQuick,
  105. getDayworkByCarrierId,
  106. reportDaywork
  107. } from '@/api/business/quickDaywork'
  108. const props = defineProps({
  109. getList: {
  110. type: Function,
  111. default: () => {}
  112. }
  113. })
  114. const emit = defineEmits();
  115. const baseDialog = ref(null)
  116. const lotData = ref(null)
  117. const curDaywork = ref({})
  118. const currentTechnologicalProcessDetailId = ref(null)
  119. const currentLotCode = ref("")
  120. const workshopList = ref([])
  121. const curProcessAfte = ref([])
  122. const deptList = ref([])
  123. const item = ref({})
  124. const showRight = ref(null) // 抽屉
  125. function open(data) {
  126. // if (data === 'test') {
  127. // baseDialog.value.open()
  128. // lotData.value = [{
  129. // lotCode: '测试',
  130. // process: { processAlias: '测试长数据结果' }
  131. // }, {
  132. // lotCode: '测试',
  133. // process: { processAlias: '测试长数据结果' }
  134. // }, {
  135. // lotCode: '测试',
  136. // process: { processAlias: '测试长数据结果' }
  137. // }]
  138. // item.value = {
  139. // lotCode: '测试',
  140. // process: { processAlias: '测试长数据结果' }
  141. // }
  142. // } else {
  143. lotData.value = data.items
  144. item.value = data.items[0]
  145. // lotData.value.map(v => v.lotCode).join(",")
  146. baseDialog.value.open()
  147. workshopList.value = data.workShops.map(v => ({
  148. value: v.id,
  149. text: v.name,
  150. deptList: v.depts
  151. }))
  152. curDaywork.value = {}
  153. deptList.value = []
  154. init()
  155. // }
  156. }
  157. function init() {
  158. //查询车间
  159. }
  160. function handleClickProcessList(item) {
  161. console.log(item,7979)
  162. var filteredProcess = item.processSequence.filter(i => i.processStepNumber == item.process.processStepNumber);
  163. currentTechnologicalProcessDetailId.value = filteredProcess[0].technologicalProcessDetailId
  164. console.log(currentTechnologicalProcessDetailId.value)
  165. currentLotCode.value = item.lotCode
  166. curProcessAfte.value = lotData.value[0].nextProcesses;
  167. showRight.value.open();
  168. }
  169. //切换车间
  170. function handleChangeWorkshop(arg) {
  171. // console.log(arg)
  172. deptList.value = workshopList.value.find(v => v.value === arg).deptList.map(v => ({
  173. value: v.deptId,
  174. text: v.deptName
  175. }))
  176. }
  177. //结束扫码
  178. function handleFinishScan() {
  179. // 保存新报工信息
  180. // 然后关闭dialog
  181. // console.log(props)
  182. addDayworkItem(() => {
  183. baseDialog.value.close()
  184. props.getList()
  185. })
  186. }
  187. //打开电子图纸
  188. function handleOpenDrawing(){
  189. // 对 technologicalProcessDetailId 进行URL编码
  190. var encodedId = encodeURIComponent(currentTechnologicalProcessDetailId.value);
  191. var encodeCode = encodeURIComponent(currentLotCode.value);
  192. // 构建查询参数字符串
  193. var queryParam = `param1=${encodedId}&param2=${encodeCode}`;
  194. // 使用模板字符串构建完整的URL
  195. var navigateUrl = `/pages/drawingMenu/index?${queryParam}`;
  196. // 导航到指定页面
  197. uni.navigateTo({
  198. url: navigateUrl
  199. });
  200. }
  201. function addDayworkItem(callback) {
  202. // 判断选择下工段和下车间
  203. if (curDaywork.value.workshopId == null || curDaywork.value.deptId == null || deptList.value.find(v => v.value ===
  204. curDaywork.value.deptId) == null) {
  205. uni.showToast({
  206. icon: 'none',
  207. title: '请选择周转车间和下序工段'
  208. })
  209. return
  210. }
  211. const params = lotData.value.map(v => ({
  212. ...v,
  213. daywork: {
  214. ...v.daywork,
  215. processId: v.process.id,
  216. processStepNumber: v.process.processStepNumber,
  217. technologicalProcessDetailId: v.process.technologicalProcessDetailId
  218. },
  219. quickInfo: {
  220. deptId: curDaywork.value.deptId,
  221. workshopId: curDaywork.value.workshopId,
  222. deptName: deptList.value.find(v => v.value === curDaywork.value.deptId).text
  223. }
  224. }))
  225. // console.log(params)
  226. reportDaywork(params).then(res => {
  227. callback()
  228. })
  229. // callback()
  230. }
  231. //继续扫码
  232. function handleContinueScan() {
  233. // 保存报工信息
  234. // 调用前一个页面的扫码方法
  235. // 关闭dialog
  236. // console.log(props)
  237. addDayworkItem(() => {
  238. props.getList()
  239. baseDialog.value.close()
  240. emit("scan")
  241. })
  242. }
  243. function close() {
  244. baseDialog.value.close()
  245. }
  246. defineExpose({
  247. open
  248. })
  249. </script>
  250. <style lang="scss">
  251. .dialog-body {
  252. // height: 60%;
  253. // margin: auto auto;
  254. overflow: auto;
  255. }
  256. .item-info {
  257. margin: 8rpx;
  258. .label {
  259. font-size: 28rpx;
  260. width: 220rpx;
  261. color: #808080;
  262. &.right {
  263. flex: 1;
  264. color: #000000;
  265. }
  266. }
  267. }
  268. .middle {
  269. display: flex;
  270. flex-direction: row;
  271. align-items: center;
  272. justify-content: center
  273. }
  274. .segment {
  275. width: 280rpx;
  276. background-color: rgba(213, 213, 213, 1);
  277. border: 1rpx solid rgba(213, 213, 213, 1);
  278. }
  279. .middle {
  280. display: flex;
  281. flex-direction: row;
  282. align-items: center;
  283. justify-content: center
  284. }
  285. .segment {
  286. width: 80rpx;
  287. background-color: rgba(213, 213, 213, 1);
  288. border: 1rpx solid rgba(213, 213, 213, 1);
  289. }
  290. .add-btn-container {
  291. margin-top: 32rpx;
  292. .leftBtn {
  293. flex: 1;
  294. background-color: rgb(164, 173, 179);
  295. color: #FFFFFF;
  296. }
  297. .rightBtn {
  298. flex: 1;
  299. margin-left: 24rpx;
  300. background-color: rgb(91, 214, 165);
  301. color: #FFFFFF;
  302. }
  303. }
  304. </style>