dialog-lotReporting.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  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 v-if="!editStatus" 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 editStatus = ref(false)
  125. const showRight = ref(null) // 抽屉
  126. function open(data) {
  127. // if (data === 'test') {
  128. // baseDialog.value.open()
  129. // lotData.value = [{
  130. // lotCode: '测试',
  131. // process: { processAlias: '测试长数据结果' }
  132. // }, {
  133. // lotCode: '测试',
  134. // process: { processAlias: '测试长数据结果' }
  135. // }, {
  136. // lotCode: '测试',
  137. // process: { processAlias: '测试长数据结果' }
  138. // }]
  139. // item.value = {
  140. // lotCode: '测试',
  141. // process: { processAlias: '测试长数据结果' }
  142. // }
  143. // } else {
  144. lotData.value = data.items
  145. item.value = data.items[0]
  146. // lotData.value.map(v => v.lotCode).join(",")
  147. baseDialog.value.open()
  148. workshopList.value = data.workShops.map(v => ({
  149. value: v.id,
  150. text: v.name,
  151. deptList: v.depts
  152. }))
  153. curDaywork.value = {}
  154. deptList.value = []
  155. init()
  156. // }
  157. }
  158. function init() {
  159. //查询车间
  160. }
  161. function handleClickProcessList(item) {
  162. console.log(item,7979)
  163. if(item.isWasteRecycling ==1 || item.isAmend ==1){
  164. editStatus.value = true
  165. }else{
  166. editStatus.value = false
  167. }
  168. var filteredProcess = item.processSequence.filter(i => i.processStepNumber == item.process.processStepNumber);
  169. currentTechnologicalProcessDetailId.value = filteredProcess[0].technologicalProcessDetailId
  170. console.log(currentTechnologicalProcessDetailId.value)
  171. currentLotCode.value = item.lotCode
  172. curProcessAfte.value = lotData.value[0].nextProcesses;
  173. showRight.value.open();
  174. }
  175. //切换车间
  176. function handleChangeWorkshop(arg) {
  177. // console.log(arg)
  178. deptList.value = workshopList.value.find(v => v.value === arg).deptList.map(v => ({
  179. value: v.deptId,
  180. text: v.deptName
  181. }))
  182. }
  183. //结束扫码
  184. function handleFinishScan() {
  185. // 保存新报工信息
  186. // 然后关闭dialog
  187. // console.log(props)
  188. addDayworkItem(() => {
  189. baseDialog.value.close()
  190. props.getList()
  191. })
  192. }
  193. //打开电子图纸
  194. function handleOpenDrawing(){
  195. // 对 technologicalProcessDetailId 进行URL编码
  196. var encodedId = encodeURIComponent(currentTechnologicalProcessDetailId.value);
  197. var encodeCode = encodeURIComponent(currentLotCode.value);
  198. // 构建查询参数字符串
  199. var queryParam = `param1=${encodedId}&param2=${encodeCode}`;
  200. // 使用模板字符串构建完整的URL
  201. var navigateUrl = `/pages/drawingMenu/index?${queryParam}`;
  202. // 导航到指定页面
  203. uni.navigateTo({
  204. url: navigateUrl
  205. });
  206. }
  207. function addDayworkItem(callback) {
  208. // 判断选择下工段和下车间
  209. if (curDaywork.value.workshopId == null || curDaywork.value.deptId == null || deptList.value.find(v => v.value ===
  210. curDaywork.value.deptId) == null) {
  211. uni.showToast({
  212. icon: 'none',
  213. title: '请选择周转车间和下序工段'
  214. })
  215. return
  216. }
  217. const params = lotData.value.map(v => ({
  218. ...v,
  219. daywork: {
  220. ...v.daywork,
  221. processId: v.process.id,
  222. processStepNumber: v.process.processStepNumber,
  223. technologicalProcessDetailId: v.process.technologicalProcessDetailId
  224. },
  225. quickInfo: {
  226. deptId: curDaywork.value.deptId,
  227. workshopId: curDaywork.value.workshopId,
  228. deptName: deptList.value.find(v => v.value === curDaywork.value.deptId).text
  229. }
  230. }))
  231. // console.log(params)
  232. reportDaywork(params).then(res => {
  233. callback()
  234. })
  235. // callback()
  236. }
  237. //继续扫码
  238. function handleContinueScan() {
  239. // 保存报工信息
  240. // 调用前一个页面的扫码方法
  241. // 关闭dialog
  242. // console.log(props)
  243. addDayworkItem(() => {
  244. props.getList()
  245. baseDialog.value.close()
  246. emit("scan")
  247. })
  248. }
  249. function close() {
  250. baseDialog.value.close()
  251. }
  252. defineExpose({
  253. open
  254. })
  255. </script>
  256. <style lang="scss">
  257. .dialog-body {
  258. // height: 60%;
  259. // margin: auto auto;
  260. overflow: auto;
  261. }
  262. .item-info {
  263. margin: 8rpx;
  264. .label {
  265. font-size: 28rpx;
  266. width: 220rpx;
  267. color: #808080;
  268. &.right {
  269. flex: 1;
  270. color: #000000;
  271. }
  272. }
  273. }
  274. .middle {
  275. display: flex;
  276. flex-direction: row;
  277. align-items: center;
  278. justify-content: center
  279. }
  280. .segment {
  281. width: 280rpx;
  282. background-color: rgba(213, 213, 213, 1);
  283. border: 1rpx solid rgba(213, 213, 213, 1);
  284. }
  285. .middle {
  286. display: flex;
  287. flex-direction: row;
  288. align-items: center;
  289. justify-content: center
  290. }
  291. .segment {
  292. width: 80rpx;
  293. background-color: rgba(213, 213, 213, 1);
  294. border: 1rpx solid rgba(213, 213, 213, 1);
  295. }
  296. .add-btn-container {
  297. margin-top: 32rpx;
  298. .leftBtn {
  299. flex: 1;
  300. background-color: rgb(164, 173, 179);
  301. color: #FFFFFF;
  302. }
  303. .rightBtn {
  304. flex: 1;
  305. margin-left: 24rpx;
  306. background-color: rgb(91, 214, 165);
  307. color: #FFFFFF;
  308. }
  309. }
  310. </style>