dialog-lotReporting.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. <template>
  2. <dialog-base class="dialog-body" ref="baseDialog" title="添加批次报工">
  3. <view style="overflow: auto;height: 800rpx;">
  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">{{ item['process'] ? item['process'].processAlias : '-' }}
  24. (<view style="color: #1684fc;" @click.stop="handleClickProcessList(item)">&nbsp;工艺列表&nbsp;
  25. </view>)
  26. </view>
  27. </view>
  28. <view class="item-info uni-row">
  29. <text class="label">下序</text>
  30. <view class="label right uni-row">{{ item['nextProcess'] ? item['nextProcess'].processAlias : '-' }}
  31. </view>
  32. </view>
  33. <!-- <view class='middle'>
  34. <view class='segment'></view>
  35. <uni-icons type="paperclip" size="30" style="margin: 10rpx;"></uni-icons>
  36. <view class='segment'></view>
  37. </view> -->
  38. <!-- </view> -->
  39. </view>
  40. <view class="list-item">
  41. <view class="item-info uni-row">
  42. <text class="label">下序车间</text>
  43. <uni-data-select v-model="curDaywork.workshopId" :localdata="workshopList"
  44. @change="handleChangeWorkshop" :clear="false"
  45. style="outline: 2rpx solid #999999;border-radius: 10rpx;"></uni-data-select>
  46. </view>
  47. <view class="item-info uni-row">
  48. <text class="label">下序工段</text>
  49. <uni-data-select v-model="curDaywork.deptId" :localdata="deptList" :clear="false"
  50. style="outline: 2rpx solid #999999;border-radius: 10rpx;"></uni-data-select>
  51. </view>
  52. </view>
  53. <!-- 抽屉 -->
  54. <view>
  55. </view>
  56. <view style="z-index: 99999;">
  57. <uni-drawer ref="showRight" mode="right" :mask-click="true">
  58. <view class="scroll-view">
  59. <scroll-view class="scroll-view-box" style="height:100%;">
  60. <view style="width: 100%;text-align: center;;font-size: 48rpx;margin: 48rpx 0 24rpx 0;">工艺列表
  61. </view>
  62. <view style="font-size: 24rpx;width: 100%;text-align: center;color: red;margin-bottom: 48rpx;">
  63. 仅显示当前工序后面工艺</view>
  64. <view class="info-content" v-for="(item,index) in curProcessAfte" :key="index"
  65. style="width: 100%;margin: 8rpx 0 8rpx 14%;">
  66. <text>{{ index + 1 }}.{{item.processAlias}}</text>
  67. </view>
  68. </scroll-view>
  69. </view>
  70. </uni-drawer>
  71. </view>
  72. <view class="add-btn-container uni-row">
  73. <button type="default" class="leftBtn" @click="handleFinishScan">结束扫码</button>
  74. <button type="default" class="rightBtn" @click="handleContinueScan">继续扫码</button>
  75. </view>
  76. </dialog-base>
  77. </template>
  78. <script setup>
  79. import {
  80. ref,
  81. getCurrentInstance,
  82. toRef
  83. } from 'vue'
  84. import {
  85. getDictInfoByType
  86. } from '@/api/dict/dict.js'
  87. import {
  88. getQuickDayworkList,
  89. finishQuick,
  90. getDayworkByCarrierId,
  91. reportDaywork
  92. } from '@/api/business/quickDaywork'
  93. const props = defineProps({
  94. getList: {
  95. type: Function,
  96. default: () => {}
  97. }
  98. })
  99. const emit = defineEmits();
  100. const baseDialog = ref(null)
  101. const lotData = ref(null)
  102. const curDaywork = ref({})
  103. const workshopList = ref([])
  104. const curProcessAfte = ref([])
  105. const deptList = ref([])
  106. const item = ref({})
  107. const showRight = ref(null) // 抽屉
  108. function open(data) {
  109. lotData.value = data.items
  110. item.value = data.items[0]
  111. // lotData.value.map(v => v.lotCode).join(",")
  112. baseDialog.value.open()
  113. workshopList.value = data.workShops.map(v => ({
  114. value: v.id,
  115. text: v.name,
  116. deptList: v.depts
  117. }))
  118. curDaywork.value = {}
  119. deptList.value = []
  120. init()
  121. }
  122. function init() {
  123. //查询车间
  124. }
  125. function handleClickProcessList(item) {
  126. curProcessAfte.value = lotData.value[0].nextProcesses;
  127. showRight.value.open();
  128. }
  129. //切换车间
  130. function handleChangeWorkshop(arg) {
  131. // console.log(arg)
  132. deptList.value = workshopList.value.find(v => v.value === arg).deptList.map(v => ({
  133. value: v.deptId,
  134. text: v.deptName
  135. }))
  136. }
  137. //结束扫码
  138. function handleFinishScan() {
  139. // 保存新报工信息
  140. // 然后关闭dialog
  141. // console.log(props)
  142. addDayworkItem(() => {
  143. baseDialog.value.close()
  144. props.getList()
  145. })
  146. }
  147. function addDayworkItem(callback) {
  148. // 判断选择下工段和下车间
  149. if (curDaywork.value.workshopId == null || curDaywork.value.deptId == null || deptList.value.find(v => v.value ===
  150. curDaywork.value.deptId) == null) {
  151. uni.showToast({
  152. icon: 'none',
  153. title: '请选择周转车间和下序工段'
  154. })
  155. return
  156. }
  157. const params = lotData.value.map(v => ({
  158. ...v,
  159. daywork: {
  160. ...v.daywork,
  161. processId: v.process.id,
  162. technologicalProcessDetailId: v.process.technologicalProcessDetailId
  163. },
  164. quickInfo: {
  165. deptId: curDaywork.value.deptId,
  166. workshopId: curDaywork.value.workshopId,
  167. deptName: deptList.value.find(v => v.value === curDaywork.value.deptId).text
  168. }
  169. }))
  170. // console.log(params)
  171. reportDaywork(params).then(res => {
  172. callback()
  173. })
  174. // callback()
  175. }
  176. //继续扫码
  177. function handleContinueScan() {
  178. // 保存报工信息
  179. // 调用前一个页面的扫码方法
  180. // 关闭dialog
  181. // console.log(props)
  182. addDayworkItem(() => {
  183. props.getList()
  184. baseDialog.value.close()
  185. emit("scan")
  186. })
  187. }
  188. function close() {
  189. baseDialog.value.close()
  190. }
  191. defineExpose({
  192. open
  193. })
  194. </script>
  195. <style lang="scss">
  196. .dialog-body {
  197. // height: 60%;
  198. // margin: auto auto;
  199. overflow: auto;
  200. }
  201. .item-info {
  202. margin: 8rpx;
  203. .label {
  204. font-size: 28rpx;
  205. width: 220rpx;
  206. color: #808080;
  207. &.right {
  208. flex: 1;
  209. color: #000000;
  210. }
  211. }
  212. }
  213. .middle {
  214. display: flex;
  215. flex-direction: row;
  216. align-items: center;
  217. justify-content: center
  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. .middle {
  225. display: flex;
  226. flex-direction: row;
  227. align-items: center;
  228. justify-content: center
  229. }
  230. .segment {
  231. width: 80rpx;
  232. background-color: rgba(213, 213, 213, 1);
  233. border: 1rpx solid rgba(213, 213, 213, 1);
  234. }
  235. .add-btn-container {
  236. margin-top: 32rpx;
  237. .leftBtn {
  238. flex: 1;
  239. background-color: rgb(164, 173, 179);
  240. color: #FFFFFF;
  241. }
  242. .rightBtn {
  243. flex: 1;
  244. margin-left: 24rpx;
  245. background-color: rgb(91, 214, 165);
  246. color: #FFFFFF;
  247. }
  248. }
  249. </style>