materialIssuance.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. <template>
  2. <gui-page :custom-header="true" :header-class="['gui-theme-background-color']">
  3. <template #gHeader>
  4. <view style="height:44px;" class="gui-flex gui-nowrap gui-rows gui-align-items-center">
  5. <!-- 使用组件实现返回按钮及返回首页按钮 -->
  6. <text style="font-size:44rpx;" class="gui-header-leader-btns gui-color-white font-icons"
  7. @tap="goBack">&#xe6c5;</text>
  8. <!-- 导航文本此处也可以是其他自定义内容 -->
  9. <text
  10. class="gui-h4 gui-blod gui-flex1 gui-text-center gui-ellipsis gui-color-white gui-primary-text">发料单</text>
  11. <!-- 此处加一个右侧展位元素与左侧同宽,实现标题居中 -->
  12. <!-- 实际宽度请根据自己情况设置 -->
  13. <view style="width:40px;" />
  14. <!-- 如果右侧有其他内容可以利用条件编译和定位来实现-->
  15. </view>
  16. </template>
  17. <template #gBody>
  18. <view class="list-content">
  19. <view class="body-card">
  20. <view class="body-card-row">
  21. <span>领料单</span>
  22. <span>{{ objectJSON.workOrderBomNo }}</span>
  23. </view>
  24. <view class="body-card-row">
  25. <span>订单号</span>
  26. <span>{{ objectJSON.workOrderNo }}</span>
  27. </view>
  28. <view class="body-card-row">
  29. <span>产品号</span>
  30. <span>{{ objectJSON.productCode }}</span>
  31. </view>
  32. </view>
  33. <view class="table-title" style="margin-top: 16px;">
  34. <span>发料明细</span>
  35. </view>
  36. <view class="custom-table">
  37. <uni-table border stripe empty-text="暂无更多数据">
  38. <!-- 表头行 -->
  39. <uni-tr class="custom-table-head">
  40. <uni-th align="center" width="140px">物料</uni-th>
  41. <uni-th align="center" width="140px">批次</uni-th>
  42. <uni-th align="center" width="140px">发料量</uni-th>
  43. </uni-tr>
  44. <!-- 表格数据行 -->
  45. <uni-tr v-for="(item, key) in tableData" :key="key">
  46. <uni-td align="center">{{ item.erpMaterialId }}({{ item.materialName }})</uni-td>
  47. <uni-td align="center">{{ item.batchNumber }}</uni-td>
  48. <uni-td align="center">{{ item.batchQty }}</uni-td>
  49. </uni-tr>
  50. </uni-table>
  51. </view>
  52. <view class="card-list-item"
  53. style="margin: 12px 0;display: grid;grid-template-columns: 1fr 1fr;grid-template-rows: 1fr;">
  54. <button type="default" style="width: calc(100% - 8px);margin: 0 4px;"
  55. @click="handleComplete">签收</button>
  56. <button type="primary" style="width: calc(100% - 8px);margin: 0 4px;"
  57. @click="handleSubmit">提交</button>
  58. </view>
  59. </view>
  60. </template>
  61. </gui-page>
  62. </template>
  63. <script>
  64. import {
  65. ref,
  66. onMounted,
  67. defineComponent,
  68. onBeforeMount
  69. } from 'vue'
  70. export default defineComponent({
  71. setup(options) {
  72. const parentRow = uni.getStorageSync('ids') ?? {}
  73. const objectJSON = ref({
  74. productCode: '',
  75. workOrderBomNo: '',
  76. workOrderNo: ''
  77. })
  78. const tableData = ref([])
  79. const search = function() {
  80. uni.$reqGet('getOutStockAllPreparedPage', {
  81. pageNo: 1,
  82. pageSize: 100,
  83. detailErpId: objectJSON.value?.detailErpId ?? ''
  84. })
  85. .then(({
  86. code,
  87. data,
  88. msg
  89. }) => {
  90. if (code === 0) {
  91. tableData.value = data
  92. } else {
  93. uni.showToast({
  94. title: msg,
  95. icon: 'none',
  96. duration: 2000
  97. })
  98. }
  99. })
  100. }
  101. onBeforeMount(() => {
  102. if (!['', undefined, null, NaN].includes(parentRow)) {
  103. Object.assign(objectJSON.value, JSON.parse(parentRow))
  104. }
  105. })
  106. onMounted(() => {
  107. search()
  108. })
  109. const goBack = function() {
  110. uni.$goBack('/pages/workbranch/warehouse/production/scanMaterials')
  111. }
  112. const handleComplete = function() {
  113. // #ifdef APP-PLUS
  114. const mpaasScanModule = uni.requireNativePlugin('Mpaas-Scan-Module')
  115. mpaasScanModule.mpaasScan({
  116. // 扫码识别类型,参数可多选,qrCode、barCode,不设置,默认识别所有
  117. 'scanType': ['qrCode', 'barCode'],
  118. // 是否隐藏相册,默认false不隐藏
  119. 'hideAlbum': false
  120. },
  121. (ret) => {
  122. if (ret.resp_code === 1000) {
  123. // 扫描员工工号
  124. uni.$reqPut('completePrepareMaterial', {
  125. encodedEmployeeId: ret.resp_result,
  126. masterId: objectJSON.value.masterId
  127. })
  128. .then(({
  129. code,
  130. data,
  131. msg
  132. }) => {
  133. if (code === 0) {
  134. uni.showToast({
  135. title: '签收成功',
  136. icon: 'none',
  137. duration: 2000
  138. })
  139. uni.$goBack(
  140. '/pages/workbranch/warehouse/production/prepareMaterials')
  141. } else {
  142. uni.showToast({
  143. title: msg,
  144. icon: 'none',
  145. duration: 2000
  146. })
  147. }
  148. })
  149. }
  150. })
  151. // #endif
  152. // #ifdef H5
  153. // 扫描员工工号
  154. uni.$reqPut('completePrepareMaterial', {
  155. encodedEmployeeId: 'MTY0NTYxNDY4MjgzMjAyMzU1NA==',
  156. masterId: objectJSON.value.masterId
  157. })
  158. .then(({
  159. code,
  160. data,
  161. msg
  162. }) => {
  163. if (code === 0) {
  164. uni.showToast({
  165. title: '签收成功',
  166. icon: 'none',
  167. duration: 2000
  168. })
  169. } else {
  170. uni.showToast({
  171. title: msg,
  172. icon: 'none',
  173. duration: 2000
  174. })
  175. }
  176. })
  177. // #endif
  178. }
  179. const handleSubmit = function() {
  180. uni.$reqPut('createOutStockMaterial', {
  181. detailErpId: objectJSON.value.detailErpId
  182. })
  183. .then(({
  184. code,
  185. data,
  186. msg
  187. }) => {
  188. if (code === 0) {
  189. uni.$reqGet('getOutStockMainDetailPage', {
  190. pageNo: 1,
  191. pageSize: 100,
  192. keyWord: objectJSON.value.workOrderBomNo
  193. })
  194. .then(({
  195. data
  196. }) => {
  197. tableData.value = data?.list
  198. })
  199. uni.showToast({
  200. title: '提交成功!',
  201. icon: 'none',
  202. duration: 2000
  203. })
  204. } else {
  205. uni.showToast({
  206. title: msg,
  207. icon: 'none',
  208. duration: 2000
  209. })
  210. }
  211. })
  212. }
  213. return {
  214. goBack,
  215. objectJSON,
  216. tableData,
  217. handleComplete,
  218. handleSubmit
  219. }
  220. }
  221. })
  222. </script>
  223. <style lang="scss" scoped>
  224. .gui-header-leader-btns {
  225. color: black;
  226. font-size: 24px !important;
  227. margin-left: 24rpx;
  228. }
  229. .list-content {
  230. margin-top: 80px;
  231. background-color: #edeeee;
  232. }
  233. .card-list-flexbox {
  234. display: flex;
  235. flex-direction: row;
  236. align-items: center;
  237. flex-wrap: wrap;
  238. margin: 3px 2px;
  239. .card-list-item {
  240. width: 750rpx;
  241. height: 40px;
  242. margin: 2rpx 0;
  243. display: flex;
  244. flex-direction: row;
  245. align-items: center;
  246. justify-content: space-between;
  247. background-color: #fff;
  248. uni-text {
  249. font-size: 14px;
  250. height: 50rpx;
  251. text-align: left;
  252. padding: 0 12px;
  253. display: flex;
  254. flex-direction: row;
  255. align-items: center;
  256. }
  257. .text-1 {
  258. flex: 1;
  259. height: 40px;
  260. justify-content: flex-start;
  261. }
  262. .text-2 {
  263. flex: 3;
  264. height: 40px;
  265. justify-content: flex-end;
  266. margin-right: 4px;
  267. padding: 2px 6px;
  268. }
  269. }
  270. }
  271. .fixedTop {
  272. bottom: 0 !important;
  273. top: 3.25rem !important;
  274. }
  275. .popup-content {
  276. height: 75vh;
  277. overflow-y: scroll;
  278. background-color: #edeeee;
  279. }
  280. .font-icons {
  281. width: 40px;
  282. font-size: 20px;
  283. }
  284. .body-card {
  285. width: calc(100% - 48px);
  286. margin: 12px;
  287. padding: 0 12px;
  288. display: grid;
  289. grid-template-columns: 1fr;
  290. grid-template-rows: 1fr 1fr;
  291. border-radius: 6px;
  292. background-color: white;
  293. .body-card-row {
  294. height: 35px;
  295. line-height: 35px;
  296. display: flex;
  297. justify-content: space-between;
  298. }
  299. }
  300. .table-title {
  301. height: 40px;
  302. line-height: 40px;
  303. margin: 4px 0 -3px 0;
  304. padding: 0 12px;
  305. font-size: 16px;
  306. font-weight: bold;
  307. background-color: white;
  308. }
  309. .custom-table {
  310. height: 24vh;
  311. min-height: 230px;
  312. margin: 5px 0;
  313. // min-height: 600px;
  314. overflow-y: scroll;
  315. }
  316. </style>