xzgdtl.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  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="73"
  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="90"
  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="110"
  99. />
  100. <el-table-column
  101. label="实际投料(大张)"
  102. width="200"
  103. >
  104. <template #default="{ row }">
  105. <el-input @keyup.enter="handleUpdate" v-model="row['实际投料']" />
  106. </template>
  107. </el-table-column>
  108. </el-table>
  109. </el-dialog>
  110. </template>
  111. <script>
  112. export default {
  113. name: 'Xzgdtl',
  114. }
  115. // 5.1修正工单实际投料-获取列表
  116. import service from '@/utils/request'
  117. const getOrderFeedList = (params) => {
  118. return service({
  119. url: '/mes_server/order_super_loss/getOrderFeedList',
  120. method: 'get',
  121. params
  122. })
  123. }
  124. // 5.2更新工单实际投料
  125. const updateOrderFeed = (data) => {
  126. return service({
  127. url: '/mes_server/order_super_loss/updateOrderFeed',
  128. method: 'post',
  129. data
  130. })
  131. }
  132. </script>
  133. <script setup>
  134. import { ElMessage, ElMessageBox } from 'element-plus'
  135. import { watch, ref, reactive, defineProps, defineEmits, onBeforeUnmount } from 'vue'
  136. import { useUserStore } from '@/pinia/modules/user'
  137. const userStore = useUserStore()
  138. const sys_id='['+userStore.userInfo.userName+'/'+userStore.userInfo.nickName+']'
  139. const props = defineProps(['modelValue', 'gdbh','yjno'])
  140. const emits = defineEmits(['update:modelValue','update-data'])
  141. const tableData = ref([])
  142. const table = ref(null)
  143. const multipleSelection = ref([])
  144. const getTable = async() => {
  145. let params
  146. if (props?.['gdbh']) {
  147. const { gdbh,yjno } = props
  148. params = {
  149. workorder: gdbh,
  150. yjno: yjno,
  151. }
  152. } else {
  153. return
  154. }
  155. const res = await getOrderFeedList(params)
  156. if (res['code'] === 0) {
  157. const { data } = res
  158. tableData.value = data
  159. }
  160. }
  161. getTable()
  162. const handleSelectionChange = (val) => {
  163. multipleSelection.value = val
  164. console.log(multipleSelection.value)
  165. }
  166. const handleSearch = () => {
  167. ElMessageBox.prompt('输入工单编号', '定位', {
  168. confirmButtonText: '确认',
  169. cancelButtonText: '取消',
  170. })
  171. .then(({ value }) => {
  172. console.log(value)
  173. if (!value) {
  174. getTable()
  175. } else {
  176. tableData.value = tableData.value.filter(item => {
  177. return item['Gd_gdbh'] === value ?? item
  178. })
  179. }
  180. ElMessage({
  181. type: 'success',
  182. message: '定位',
  183. })
  184. })
  185. .catch(() => {
  186. ElMessage({
  187. type: 'info',
  188. message: '取消',
  189. })
  190. })
  191. }
  192. const handleUpdate = async() => {
  193. if (multipleSelection.value.length === 0) {
  194. ElMessage({
  195. type: 'error',
  196. message: '未选择行',
  197. })
  198. return
  199. }
  200. const params = multipleSelection.value.map(item => ({
  201. UniqId: item['UniqId'],
  202. number: item['实际投料'],
  203. old_number: item['原投料'],
  204. sys_id:sys_id
  205. }))
  206. const res = await updateOrderFeed(params)
  207. if (res['code'] === 0) {
  208. ElMessage({
  209. type: 'success',
  210. message: '更新成功',
  211. })
  212. emits('update-data', false);
  213. }
  214. }
  215. </script>
  216. <style scoped>
  217. </style>