dialog-lotReporting.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  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. </view>
  74. <view class="add-btn-container uni-row">
  75. <button type="default" class="leftBtn" @click="handleFinishScan">结束扫码</button>
  76. <button type="default" class="rightBtn" @click="handleContinueScan">继续扫码</button>
  77. </view>
  78. </dialog-base>
  79. </template>
  80. <script setup>
  81. import {
  82. ref,
  83. getCurrentInstance,
  84. toRef
  85. } from 'vue'
  86. import {
  87. getDictInfoByType
  88. } from '@/api/dict/dict.js'
  89. import {
  90. getQuickDayworkList,
  91. finishQuick,
  92. getDayworkByCarrierId,
  93. reportDaywork
  94. } from '@/api/business/quickDaywork'
  95. const props = defineProps({
  96. getList: {
  97. type: Function,
  98. default: () => {}
  99. }
  100. })
  101. const emit = defineEmits();
  102. const baseDialog = ref(null)
  103. const lotData = ref(null)
  104. const curDaywork = ref({})
  105. const workshopList = ref([])
  106. const curProcessAfte = ref([])
  107. const deptList = ref([])
  108. const item = ref({})
  109. const showRight = ref(null) // 抽屉
  110. function open(data) {
  111. // if (data === 'test') {
  112. // baseDialog.value.open()
  113. // lotData.value = [{
  114. // lotCode: '测试',
  115. // process: { processAlias: '测试长数据结果' }
  116. // }, {
  117. // lotCode: '测试',
  118. // process: { processAlias: '测试长数据结果' }
  119. // }, {
  120. // lotCode: '测试',
  121. // process: { processAlias: '测试长数据结果' }
  122. // }]
  123. // item.value = {
  124. // lotCode: '测试',
  125. // process: { processAlias: '测试长数据结果' }
  126. // }
  127. // } else {
  128. lotData.value = data.items
  129. item.value = data.items[0]
  130. // lotData.value.map(v => v.lotCode).join(",")
  131. baseDialog.value.open()
  132. workshopList.value = data.workShops.map(v => ({
  133. value: v.id,
  134. text: v.name,
  135. deptList: v.depts
  136. }))
  137. curDaywork.value = {}
  138. deptList.value = []
  139. init()
  140. // }
  141. }
  142. function init() {
  143. //查询车间
  144. }
  145. function handleClickProcessList(item) {
  146. curProcessAfte.value = lotData.value[0].nextProcesses;
  147. showRight.value.open();
  148. }
  149. //切换车间
  150. function handleChangeWorkshop(arg) {
  151. // console.log(arg)
  152. deptList.value = workshopList.value.find(v => v.value === arg).deptList.map(v => ({
  153. value: v.deptId,
  154. text: v.deptName
  155. }))
  156. }
  157. //结束扫码
  158. function handleFinishScan() {
  159. // 保存新报工信息
  160. // 然后关闭dialog
  161. // console.log(props)
  162. addDayworkItem(() => {
  163. baseDialog.value.close()
  164. props.getList()
  165. })
  166. }
  167. function addDayworkItem(callback) {
  168. // 判断选择下工段和下车间
  169. if (curDaywork.value.workshopId == null || curDaywork.value.deptId == null || deptList.value.find(v => v.value ===
  170. curDaywork.value.deptId) == null) {
  171. uni.showToast({
  172. icon: 'none',
  173. title: '请选择周转车间和下序工段'
  174. })
  175. return
  176. }
  177. const params = lotData.value.map(v => ({
  178. ...v,
  179. daywork: {
  180. ...v.daywork,
  181. processId: v.process.id,
  182. processStepNumber: v.process.processStepNumber,
  183. technologicalProcessDetailId: v.process.technologicalProcessDetailId
  184. },
  185. quickInfo: {
  186. deptId: curDaywork.value.deptId,
  187. workshopId: curDaywork.value.workshopId,
  188. deptName: deptList.value.find(v => v.value === curDaywork.value.deptId).text
  189. }
  190. }))
  191. // console.log(params)
  192. reportDaywork(params).then(res => {
  193. callback()
  194. })
  195. // callback()
  196. }
  197. //继续扫码
  198. function handleContinueScan() {
  199. // 保存报工信息
  200. // 调用前一个页面的扫码方法
  201. // 关闭dialog
  202. // console.log(props)
  203. addDayworkItem(() => {
  204. props.getList()
  205. baseDialog.value.close()
  206. emit("scan")
  207. })
  208. }
  209. function close() {
  210. baseDialog.value.close()
  211. }
  212. defineExpose({
  213. open
  214. })
  215. </script>
  216. <style lang="scss">
  217. .dialog-body {
  218. // height: 60%;
  219. // margin: auto auto;
  220. overflow: auto;
  221. }
  222. .item-info {
  223. margin: 8rpx;
  224. .label {
  225. font-size: 28rpx;
  226. width: 220rpx;
  227. color: #808080;
  228. &.right {
  229. flex: 1;
  230. color: #000000;
  231. }
  232. }
  233. }
  234. .middle {
  235. display: flex;
  236. flex-direction: row;
  237. align-items: center;
  238. justify-content: center
  239. }
  240. .segment {
  241. width: 280rpx;
  242. background-color: rgba(213, 213, 213, 1);
  243. border: 1rpx solid rgba(213, 213, 213, 1);
  244. }
  245. .middle {
  246. display: flex;
  247. flex-direction: row;
  248. align-items: center;
  249. justify-content: center
  250. }
  251. .segment {
  252. width: 80rpx;
  253. background-color: rgba(213, 213, 213, 1);
  254. border: 1rpx solid rgba(213, 213, 213, 1);
  255. }
  256. .add-btn-container {
  257. margin-top: 32rpx;
  258. .leftBtn {
  259. flex: 1;
  260. background-color: rgb(164, 173, 179);
  261. color: #FFFFFF;
  262. }
  263. .rightBtn {
  264. flex: 1;
  265. margin-left: 24rpx;
  266. background-color: rgb(91, 214, 165);
  267. color: #FFFFFF;
  268. }
  269. }
  270. </style>