chukubaogong.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. <template>
  2. <div>
  3. <layout>
  4. <!-- <layout-header> -->
  5. <div class="gva-table-box">
  6. <h1 style="margin: 0%;margin-bottom: 6px;">出库报工</h1>
  7. <el-row :gutter="24" style="margin-bottom: 6px;">
  8. <el-input v-model="add_searchInfo" placeholder="请扫描子订单编号"
  9. @keyup.enter="add_onSubmit"
  10. id="searchInput"
  11. style="width: 220px;height: 50px;margin-left: 10px;">
  12. </el-input>
  13. <el-button type="primary" icon="search" @click="add_onSubmit" style="height: 50px;font-size: 20px;">查询</el-button>
  14. <el-button type="primary" icon="" @click="Restore_onSubmit" style="height: 50px;font-size: 20px;">恢复未出库</el-button>
  15. <el-button type="primary" icon="" @click="add_Dialog" style="height: 50px;font-size: 20px;">确认出库</el-button>
  16. </el-row>
  17. </div>
  18. <!-- </layout-header> -->
  19. <layout>
  20. <layout-content >
  21. <div class="gva-table-box">
  22. <el-table ref="multipleTable" style="width: 100%;height: 64vh" tooltip-effect="dark"
  23. :row-style="{ height: '40px' }" :header-cell-style="{ padding: '0px' }"
  24. :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
  25. :data="add_tableData" border row-key="ID"
  26. size="small"
  27. :cell-class-name="tableDataCellClass"
  28. highlight-current-row="true" @row-dblclick="add_updateCompanyFunc"
  29. @row-click="add_tableRowClick" :show-overflow-tooltip="true"
  30. @selection-change="handleSelectionChange">
  31. <!-- <el-table-column type="selection" width="80" /> -->
  32. <el-table-column sortable align="left" label="订单编号" prop="订单编号" width="120" />
  33. <el-table-column sortable align="left" label="订单子编号" prop="子订单编号" width="140"/>
  34. <el-table-column sortable align="left" label="生产款号" prop="款号" width="220"/>
  35. <el-table-column sortable align="left" label="款式" prop="款式" width="100"/>
  36. <el-table-column sortable align="left" label="色系名称" prop="颜色" width="150"/>
  37. <el-table-column sortable align="left" label="是否出库" prop="是否出库" width="120"/>
  38. </el-table>
  39. <div class="dialog-footer" style="text-align: left;margin-right: 60px;">
  40. </div>
  41. </div>
  42. </layout-content>
  43. </layout>
  44. </layout>
  45. </div>
  46. </template>
  47. <script setup>
  48. // 全量引入格式化工具 请按需保留
  49. import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
  50. import {ref, reactive} from 'vue'
  51. import {getSpotList,getSpotTab} from '@/api/mes/job'
  52. import {ElMessage} from "element-plus";
  53. import { get } from 'scriptjs';
  54. defineOptions({name: 'Company'})
  55. import { useUserStore } from '@/pinia/modules/user'
  56. const userStore = useUserStore()
  57. const _username = ref('')
  58. _username.value = userStore.userInfo.userName + '/' + userStore.userInfo.nickName
  59. //全局调用获取当前日期
  60. const today = new Date();
  61. const year = today.getFullYear();
  62. const month = String(today.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始,需要补零
  63. const day = String(today.getDate()).padStart(2, '0');
  64. const hours = String(today.getHours()).padStart(2, '0');
  65. const minutes = String(today.getMinutes()).padStart(2, '0');
  66. const seconds = String(today.getSeconds()).padStart(2, '0');
  67. const currentDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  68. const currentDates = `${year}-${month}-${day}`;
  69. const getMachineMacdata = async () => {
  70. setTimeout(() => {
  71. const inputElement = document.getElementById('searchInput');
  72. if (inputElement) {
  73. inputElement.focus();
  74. }
  75. }, 100); // 延迟100毫秒
  76. }
  77. getMachineMacdata();
  78. const add_searchInfo = ref('')//搜索
  79. const add_tableData = reactive([])//表格
  80. const _orderid = ref('')//订单自编号
  81. const searcs = ref('')
  82. //表格行点击
  83. const add_tableRowClick = async (row)=>{
  84. console.log(row)
  85. _orderid.value = row.子订单编号
  86. }
  87. //点击【查询】按钮
  88. const add_onSubmit = async ()=>{
  89. setTimeout(() => {
  90. const inputElement = document.querySelector('#searchInput');
  91. if (inputElement) {
  92. inputElement.focus();
  93. }
  94. }, 100); // 延迟100毫秒
  95. if(add_searchInfo.value === ''){
  96. const WorkListdata = [];
  97. searcs.value = '';
  98. add_tableData.splice(0,add_tableData.length,...WorkListdata);
  99. ElMessage({type: 'warning',message: '请扫描子订单编号' })
  100. }else{
  101. if (add_searchInfo.value.includes('-')) {
  102. if(searcs.value == ''){
  103. console.log("查询子订单编号数据")
  104. const getSpotLists = await getSpotList({order:add_searchInfo.value,code:'出库'});
  105. add_tableData.splice(0,add_tableData.length,...getSpotLists.data.data);
  106. add_searchInfo.value = ''
  107. searcs.value = 1;
  108. return;
  109. }
  110. if(searcs.value == 1){
  111. if(add_tableData[0]['子订单编号'] === add_searchInfo.value){
  112. console.log("出库")
  113. add_Dialog();
  114. searcs.value = '';
  115. }else{
  116. ElMessage({type: 'warning',message: '两次扫码不一致,请重新扫描子订单出库' })
  117. searcs.value = '';
  118. const WorkListdata = [];
  119. add_tableData.splice(0,add_tableData.length,...WorkListdata);
  120. add_searchInfo.value = ''
  121. }
  122. }
  123. } else {
  124. console.log("查询订单编号数据")
  125. const WorkListdata = [];
  126. searcs.value = '';
  127. const getSpotLists = await getSpotList({order:add_searchInfo.value,code:'出库'});
  128. add_tableData.splice(0,add_tableData.length,...getSpotLists.data.data);
  129. add_searchInfo.value = ''
  130. }
  131. }
  132. };
  133. //确认出库按钮
  134. const add_Dialog = async () => {
  135. if(add_tableData[0]['子订单编号'] === add_searchInfo.value){
  136. let params = {
  137. order_id: add_searchInfo.value,
  138. code_ck_rq: currentDates,
  139. code: '出库',
  140. sys_id: _username.value,
  141. };
  142. console.log(params)
  143. const ck_gettab = await getSpotTab(params);// 发起出库请求
  144. if (ck_gettab.code === 0) {// 出库成功后的处理
  145. searcs.value = '';
  146. ElMessage({ type: 'success', message: '出库成功' });
  147. const getSpotLists = await getSpotList({ order: add_searchInfo.value, code: '出库' });// 获取并更新表格数据
  148. add_tableData.splice(0, add_tableData.length, ...getSpotLists.data.data);
  149. add_searchInfo.value = ''
  150. }else {
  151. searcs.value = '';
  152. const getSpotLists = await getSpotList({ order: add_searchInfo.value, code: '出库' }); // 出库失败,重新获取数据
  153. add_tableData.splice(0, add_tableData.length, ...getSpotLists.data.data);
  154. }
  155. }else{
  156. ElMessage({type: 'warning',message: '两次扫码不一致,请重新扫描子订单出库' })
  157. searcs.value = '';
  158. const WorkListdata = [];
  159. add_tableData.splice(0,add_tableData.length,...WorkListdata);
  160. add_searchInfo.value = ''
  161. }
  162. return false;
  163. if (add_tableData.length > 1) {
  164. searcs.value = '';
  165. ElMessage({ type: 'warning', message: '出库出现多条数据'});
  166. return;
  167. }
  168. const orderData = add_tableData[0];
  169. if (add_tableData[0]['子订单编号'] !== add_searchInfo.value) {
  170. const WorkListdata = [];
  171. searcs.value = '';
  172. const getSpotLists = await getSpotList({order:add_searchInfo.value,code:'出库'});
  173. add_tableData.splice(0,add_tableData.length,...getSpotLists.data.data);
  174. return;
  175. }
  176. let params = {
  177. order_id: orderData['子订单编号'],
  178. code_ck_rq: currentDates,
  179. code: '出库',
  180. sys_id: _username.value,
  181. };
  182. try {
  183. // 发起出库请求
  184. const ck_gettab = await getSpotTab(params);
  185. if (ck_gettab.code === 0) {
  186. // 出库成功后的处理
  187. add_searchInfo.value = '';
  188. searcs.value = '';
  189. ElMessage({ type: 'success', message: '出库成功' });
  190. // 获取并更新表格数据
  191. const getSpotLists = await getSpotList({ order: orderData['子订单编号'], code: '出库' });
  192. add_tableData.splice(0, add_tableData.length, ...getSpotLists.data.data);
  193. } else {
  194. searcs.value = '';
  195. // 出库失败,重新获取数据
  196. const getSpotLists = await getSpotList({ order: add_searchInfo.value, code: '出库' });
  197. add_tableData.splice(0, add_tableData.length, ...getSpotLists.data.data);
  198. }
  199. } catch (error) {
  200. console.error("出库请求失败", error);
  201. ElMessage({ type: 'error', message: '出库请求失败,请稍后重试' });
  202. }
  203. };
  204. //恢复未出库按钮
  205. const Restore_onSubmit = async ()=>{
  206. if(_orderid.value === '' || _orderid.value === null){
  207. ElMessage({type: 'warning',message: '请点击选择恢复的子订单' })
  208. }else{
  209. let params = {}
  210. params.order_id = _orderid.value;
  211. params.code_ck_rq = currentDates;
  212. params.code = '恢复';
  213. params.sys_id = _username.value;
  214. const ck_gettab = await getSpotTab(params);
  215. if (ck_gettab.code === 0) {
  216. searcs.value = '';
  217. add_searchInfo.value = ''
  218. ElMessage({type: 'success',message: '恢复成功'});
  219. const getSpotLists = await getSpotList({order:_orderid.value,code:'出库'});
  220. add_tableData.splice(0,add_tableData.length,...getSpotLists.data.data);
  221. }
  222. }
  223. setTimeout(() => {
  224. const inputElement = document.querySelector('#searchInput');
  225. if (inputElement) {
  226. inputElement.focus();
  227. }
  228. }, 100); // 延迟100毫秒
  229. }
  230. //复选框选择
  231. const ckSelection = ref('')
  232. const handleSelectionChange = (selection, type) => {
  233. const ids = selection.map(item => {
  234. return item.子订单编号
  235. })
  236. ckSelection.value = ids.join(',')
  237. console.log(ckSelection.value)
  238. }
  239. // =========== 分页 ===========
  240. // 分页相关的响应式变量
  241. const page = ref(1)
  242. const total = ref(0)
  243. const pageSize = ref(10)
  244. // 分页
  245. const handleCurrentChange = (val) => {
  246. page.value = val;
  247. _getStaffList();
  248. };
  249. // 修改页面容量 点击多少条/页
  250. const handleSizeChange = (val) => {
  251. page.value = 10;//默认显示
  252. pageSize.value = val;
  253. _getStaffList();
  254. };
  255. //根据出库状态文字颜色
  256. const tableDataCellClass = ({row, column, rowIndex, columnIndex}) =>{
  257. if(row['是否出库'] === '已出库'){
  258. return 'status-plan-usage-low';
  259. }
  260. if(row['是否出库'] === '未出库'){
  261. return 'statusy-plan-usage-low';
  262. }
  263. }
  264. </script>
  265. <style scoped>
  266. /* 根据出库状态文字颜色 */
  267. :deep(.status-plan-usage-low div) {
  268. color: #8c939d !important;
  269. }
  270. :deep(.statusy-plan-usage-low div) {
  271. color: blue !important;
  272. }
  273. .form-container {
  274. display: flex;
  275. flex-wrap: wrap;
  276. }
  277. .form-column {
  278. /*flex: 1;*/
  279. margin-right: 15px; /* 调整列之间的间距 */
  280. }
  281. /* 左侧输入框宽度调整 */
  282. .form-column .el-form-item .el-input {
  283. width: 150px; /* 调整左侧输入框的宽度 */
  284. }
  285. /* 媒体查询,根据需要调整断点 */
  286. @media screen and (max-width: 768px) {
  287. .form-column {
  288. flex: 1 0 100%; /* 在小屏幕下变成单列布局 */
  289. margin-right: 0;
  290. }
  291. }
  292. .JKWTree-container {
  293. display: flex;
  294. }
  295. .JKWTree-tree {
  296. /*width: 300px;*/
  297. background-color: #fff;
  298. padding: 10px;
  299. margin-right: 20px;
  300. }
  301. .JKWTree-tree h3 {
  302. font-size: 15px;
  303. font-weight: 700;
  304. margin: 10px 0;
  305. }
  306. .JKWTree-content {
  307. flex: 1;
  308. }
  309. /* 表格复选框大小调整 */
  310. :deep(.el-checkbox.el-checkbox--small .el-checkbox__inner) {
  311. width: 45px; /* 复选框宽度 */
  312. height: 23px; /* 复选框高度 */
  313. }
  314. :deep(.el-checkbox.el-checkbox--small.is-checked .el-checkbox__inner::after) {
  315. transform: scale(1.2) rotate(45deg); /* 调整选中后的对勾大小 */
  316. top: 5%; /* 调整对勾位置 */
  317. left: 40%; /* 调整对勾位置 */
  318. width: 5px; /* 调整对勾宽度 */
  319. height: 9px; /* 调整对勾高度 */
  320. }
  321. /* 选中某行时的背景色 */
  322. :deep(.el-table__body tr.current-row) > td {
  323. background: #ff80ff !important;
  324. }
  325. </style>
  326. <style scoped>
  327. :deep(.el-table td .cell) {
  328. line-height: 20px !important;
  329. }
  330. :deep(.el-tabs__header){
  331. margin-bottom: 0;
  332. }
  333. .search{
  334. margin-left: 0px !important;
  335. margin-right: 10px !important;
  336. }
  337. .bt{
  338. margin-left: 2px !important;
  339. padding: 3px !important;
  340. font-size: 12px;
  341. }
  342. .el-tabs__header{
  343. margin: 0px !important;
  344. }
  345. .gva-table-box{
  346. padding: 0px !important;
  347. margin-left: 5px !important;
  348. }
  349. .mab{
  350. margin-bottom: 5px;
  351. }
  352. /* 搜索样式 */
  353. ::v-deep .el-input__wrapper #searchInput {
  354. font-size: 16px;
  355. }
  356. </style>