xzgdtl.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <el-dialog
  3. :model-value="modelValue"
  4. :title="`修正工单实际投料(${props?.['date']})`"
  5. fullscreen
  6. :before-close="()=>{emits('update:modelValue', false )}"
  7. >
  8. <el-button
  9. type="primary"
  10. style="width:80px; height: 40px;margin-bottom: 20px"
  11. @click="handleUpdate"
  12. >更新</el-button>
  13. <el-button
  14. type="primary"
  15. style="width:80px; height: 40px;margin-bottom: 20px"
  16. @click="handleSearch"
  17. >定位</el-button>
  18. <el-button
  19. type="primary"
  20. style="width:80px; height: 40px;margin-bottom: 20px"
  21. @click="emits('update:modelValue', false )"
  22. >退出</el-button>
  23. <el-table
  24. ref="table"
  25. highlight-current-row
  26. show-overflow-tooltip
  27. border
  28. :data="tableData"
  29. :row-style="{ height: '25px' }"
  30. :cell-style="{ padding: '0px' }"
  31. :header-row-style="{ height: '20px' }"
  32. :header-cell-style="{ padding: '0px' }"
  33. style="width: 100%;height: 75vh;"
  34. @selection-change="handleSelectionChange"
  35. >
  36. <el-table-column
  37. type="selection"
  38. width="55"
  39. />
  40. <el-table-column
  41. label="工单编号"
  42. prop="Gd_gdbh"
  43. width="100"
  44. />
  45. <el-table-column
  46. label="印件号"
  47. prop="yj_Yjno"
  48. width="100"
  49. />
  50. <el-table-column
  51. label="印件代号"
  52. prop="yj_yjdh"
  53. width="100"
  54. />
  55. <el-table-column
  56. label="开数*联数"
  57. prop="yj_ls"
  58. width="120"
  59. />
  60. <el-table-column
  61. label="物料代码"
  62. prop="yj_zzdh"
  63. width="100"
  64. />
  65. <el-table-column
  66. label="物料名称"
  67. prop="BOM_物料名称"
  68. width="250"
  69. />
  70. <el-table-column
  71. label="规格"
  72. prop="yj_tlgg"
  73. width="100"
  74. />
  75. <el-table-column
  76. label="领用单位"
  77. prop="BOM_投料单位"
  78. width="100"
  79. />
  80. <el-table-column
  81. label="订单数量(万张)"
  82. prop="订单数量"
  83. width="150"
  84. />
  85. <el-table-column
  86. label="当前投料"
  87. prop="yj_平张投料"
  88. width="100"
  89. />
  90. <el-table-column
  91. label="实际用量"
  92. prop="BOM_实际用量"
  93. width="100"
  94. />
  95. <el-table-column
  96. label="换算率"
  97. prop=""
  98. width="100"
  99. />
  100. <el-table-column
  101. label="折算投料(万张)"
  102. width="150"
  103. >
  104. <template #default="{ row }">
  105. <el-input v-model="row['实际投料']" />
  106. </template>
  107. </el-table-column>
  108. <el-table-column
  109. label="投料确认"
  110. prop="投料确认"
  111. width="200"
  112. />
  113. </el-table>
  114. </el-dialog>
  115. </template>
  116. <script>
  117. export default {
  118. name: 'Xzgdtl',
  119. }
  120. // 5.1修正工单实际投料-获取列表
  121. import service from '@/utils/request'
  122. const getOrderFeedList = (params) => {
  123. return service({
  124. url: '/mes_server/order_super_loss/getOrderFeedList',
  125. method: 'get',
  126. params
  127. })
  128. }
  129. // 5.2更新工单实际投料
  130. const updateOrderFeed = (data) => {
  131. return service({
  132. url: '/mes_server/order_super_loss/updateOrderFeed',
  133. method: 'post',
  134. data
  135. })
  136. }
  137. </script>
  138. <script setup>
  139. import { ElMessage, ElMessageBox } from 'element-plus'
  140. import { watch, ref, reactive, defineProps, defineEmits, onBeforeUnmount } from 'vue'
  141. const props = defineProps(['modelValue', 'gdbh','yjno'])
  142. const emits = defineEmits(['update:modelValue'])
  143. const tableData = ref([])
  144. const table = ref(null)
  145. const multipleSelection = ref([])
  146. const getTable = async() => {
  147. let params
  148. if (props?.['gdbh']) {
  149. const { gdbh,yjno } = props
  150. params = {
  151. workorder: gdbh,
  152. yjno: yjno,
  153. }
  154. } else {
  155. return
  156. }
  157. const res = await getOrderFeedList(params)
  158. if (res['code'] === 0) {
  159. const { data } = res
  160. tableData.value = data
  161. }
  162. }
  163. getTable()
  164. const handleSelectionChange = (val) => {
  165. multipleSelection.value = val
  166. }
  167. const handleSearch = () => {
  168. ElMessageBox.prompt('输入工单编号', '定位', {
  169. confirmButtonText: '确认',
  170. cancelButtonText: '取消',
  171. })
  172. .then(({ value }) => {
  173. console.log(value)
  174. if (!value) {
  175. getTable()
  176. } else {
  177. tableData.value = tableData.value.filter(item => {
  178. return item['Gd_gdbh'] === value ?? item
  179. })
  180. }
  181. ElMessage({
  182. type: 'success',
  183. message: '定位',
  184. })
  185. })
  186. .catch(() => {
  187. ElMessage({
  188. type: 'info',
  189. message: '取消',
  190. })
  191. })
  192. }
  193. const handleUpdate = async() => {
  194. if (multipleSelection.value.length === 0) {
  195. console.log('未选择行')
  196. return
  197. }
  198. const params = multipleSelection.value.map(item => ({
  199. UniqId: item['UniqId'],
  200. number: item['实际投料'],
  201. }))
  202. const res = await updateOrderFeed(params)
  203. if (res['code'] === 0) {
  204. ElMessage({
  205. type: 'success',
  206. message: '更新成功',
  207. })
  208. }
  209. }
  210. </script>
  211. <style scoped>
  212. </style>