houdaoshougong.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473
  1. <template>
  2. <div>
  3. <layout>
  4. <layout-content >
  5. <!-- <el-main> -->
  6. <div class="gva-table-box">
  7. <h1 id="title" style="margin: 0%;margin-bottom: 10px;">后道(手工确认)</h1>
  8. <el-row :gutter="24" style="margin-bottom: 0px;">
  9. <el-input v-model="add_searchInfo" placeholder="请扫描子订单编号" @keyup.enter="add_onSubmit" id="searchInput"
  10. style="width: 280px;height: 50px;margin-left: 10px;"></el-input>
  11. <el-button type="primary" icon="search" @click="add_onSubmit" style="height: 50px;width: 60px;">查询</el-button>
  12. <el-form-item label="机台号:" prop="jitaihao" class="mab" style="font-size: 30px;margin: 10px;" label-width="116px">
  13. <el-input v-model="add_formData['机台号']" readonly style="width: 100px; height: 40px;" id="jitaihao" />
  14. </el-form-item>
  15. <el-form-item label="工序:" prop="gongxu" class="mab" style="font-size: 30px; margin: 10px;" label-width="81px">
  16. <el-input v-model="add_formData['工序']" readonly style="width: 100px; height: 40px;" id="gongxu" />
  17. </el-form-item>
  18. <el-form-item label="组别:" prop="zubie" class="mab" style="font-size: 30px; margin: 10px;" label-width="81px">
  19. <el-input v-model="add_formData['组别']" readonly style="width: 140px; height: 40px;" id="zubie" />
  20. </el-form-item>
  21. <el-form-item label="人员:" prop="renyuan" class="mab" style="font-size: 30px; margin: 10px;" label-width="81px">
  22. <el-input v-model="add_formData['人员']" readonly style="width: 110px; height: 40px;" id="renyuan" />
  23. </el-form-item>
  24. </el-row>
  25. <el-row :gutter="24">
  26. <el-form-item label="数量:" prop="shuliang" class="mab" style="font-size: 30px;margin: 10px;" label-width="90">
  27. <el-input v-model="add_formData['数量']" style="width: 110px;height: 40px;" id="shuliang" />
  28. </el-form-item>
  29. <el-form-item label="尺码:" prop="chima" class="mab" style="font-size: 30px;margin: 10px;" label-width="90">
  30. <el-input v-model="add_formData['尺码']" readonly style="width: 110px;height: 40px;" id="chima" />
  31. </el-form-item>
  32. <el-form-item label="是否尾包:" prop="joinDate" style="font-size: 30px; margin: 10px;" label-width="150">
  33. <!-- 假设 activeButtonValue 是从后端或某个方法获取的,这里直接硬编码为 0 或 1 -->
  34. <div :class="{'info-button': activeButtonValue === '1', 'default-button': activeButtonValue !== '1'}"
  35. style="margin-top:-20px; margin-right:15px; height: 50px; width: 70px;
  36. display: flex; justify-content: center; align-items: center; cursor: not-allowed; border: 1px solid #ccc;
  37. border-radius: 4px; color: #000000; font-size: 24px;"
  38. :style="{ backgroundColor: activeButtonValue === '1' ? '#ff0000' : '#808080' }">是</div>
  39. <div :class="{'info-button': activeButtonValue === '0', 'default-button': activeButtonValue !== '0'}"
  40. style="margin-top:-20px; height: 50px; width: 70px;
  41. display: flex; justify-content: center; align-items: center; cursor: not-allowed; border: 1px solid #ccc;
  42. border-radius: 4px; color: #000000; font-size: 24px;"
  43. :style="{ backgroundColor: activeButtonValue === '0' ? '#ff0000' : '#808080' }">否</div>
  44. </el-form-item>
  45. </el-row>
  46. <el-row :gutter="24" style="margin-bottom: 15px;margin-left: 0px;">
  47. <div @contextmenu.prevent>
  48. <el-table ref="multipleTableRef" style="width: 100%;height: 53vh"
  49. :row-style="{ height: '50px' }" :header-cell-style="{ padding: '5px', fontSize: '20px' }"
  50. :cell-style="{ padding: '10px', fontSize: '20px' }" :header-row-style="{ height: '20px' }"
  51. :data="add_tableData" border row-key="ID" size="small"
  52. highlight-current-row="true" tooltip-effect="dark"
  53. @row-dblclick="add_updateCompanyFunc" @row-click="add_tableRowClick" @row-contextmenu="handleRightClick"
  54. :show-overflow-tooltip="true" @selection-change="add_xpSelectionChange">
  55. <el-table-column type="selection" width="70" />
  56. <el-table-column sortable align="left" label="订单编号" prop="订单编号" width="140"/>
  57. <el-table-column sortable align="left" label="订单子编号" prop="子订单编号" width="140"/>
  58. <el-table-column sortable align="left" label="生产款号" prop="款号" width="140"/>
  59. <el-table-column sortable align="left" label="款式" prop="款式" width="140"/>
  60. <el-table-column sortable align="left" label="色系名称" prop="颜色" width="140"/>
  61. <el-table-column sortable align="left" label="尺码" prop="尺码" width="140"/>
  62. <el-table-column sortable align="left" label="数量" prop="数量" width="140"/>
  63. <el-table-column sortable align="left" label="是否尾包" prop="尾包" width="140"/>
  64. <el-table-column sortable align="left" label="组别" prop="组别" width="140"/>
  65. </el-table>
  66. </div>
  67. </el-row>
  68. <div class="dialog-footer" style="text-align: left;margin-right: 60px;">
  69. <el-button type="primary" @click="add_Dialog" style="width: 110px;height: 60px;font-size: 20px;">确认</el-button>
  70. </div>
  71. </div>
  72. <!-- </el-main> -->
  73. </layout-content>
  74. </layout>
  75. </div>
  76. </template>
  77. <script>
  78. export default {
  79. methods: {
  80. handleKeyDown(event, prevId, currentId, nextId) {
  81. const currentElement = document.getElementById(currentId);
  82. const isEmpty = currentElement.value === '';
  83. const atStart = currentElement.selectionStart === 0;
  84. const atEnd = currentElement.selectionStart === currentElement.value.length;
  85. switch (event.keyCode) {
  86. case 13: // Enter
  87. case 40: // 向下箭头
  88. if (nextId) {
  89. document.getElementById(nextId).focus();
  90. }
  91. break;
  92. case 38: // 向上箭头
  93. if (prevId) {
  94. document.getElementById(prevId).focus();
  95. }
  96. break;
  97. case 8: // 删除键
  98. if (prevId && (isEmpty || atStart)) {
  99. document.getElementById(prevId).focus();
  100. }
  101. break;
  102. case 37: // 向左箭头
  103. if (prevId && atStart) {
  104. document.getElementById(prevId).focus();
  105. }
  106. break;
  107. case 39: // 向右箭头
  108. if (nextId && atEnd) {
  109. document.getElementById(nextId).focus();
  110. }
  111. break;
  112. default:
  113. break;
  114. }
  115. },
  116. },
  117. };
  118. </script>
  119. <script setup>
  120. // 全量引入格式化工具 请按需保留
  121. import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
  122. import {hiprint} from "vue-plugin-hiprint";
  123. import {ref, reactive,nextTick,watch, setBlockTracking } from 'vue'
  124. import {getSpotList,search,getMachineMac,getTab} from '@/api/mes/job'
  125. import {ElMessage} from "element-plus";
  126. import { get } from 'scriptjs';
  127. defineOptions({name: 'Company'})
  128. // =========== 全局获取当前日期 ===========
  129. // currentDate 年月日 时分秒
  130. // currentDates 年月日
  131. const today = new Date();
  132. const year = today.getFullYear();
  133. const month = String(today.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始,需要补零
  134. const day = String(today.getDate()).padStart(2, '0');
  135. const hours = String(today.getHours()).padStart(2, '0');
  136. const minutes = String(today.getMinutes()).padStart(2, '0');
  137. const seconds = String(today.getSeconds()).padStart(2, '0');
  138. const currentDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  139. const currentDates = `${year}-${month}-${day}`;
  140. //全局接口接受的物理地址
  141. const Machine = '68-ED-A4-26-60-D1'
  142. //全局获取code,接口接收code
  143. const _code = '后道'
  144. //全局获取UniqId
  145. const UniqId = ref('')
  146. //物理地址获取机台编号
  147. const getMachineMacdata = async () => {
  148. try {
  149. const data = await getMachineMac({sys_sbID:Machine,code:_code});
  150. add_formData['机台号'] = data.data['机台号']
  151. add_formData['工序'] = data.data['生产工序']
  152. add_formData['组别'] = data.data['组别']
  153. add_formData['人员'] = data.data['组长']
  154. } catch (error) {
  155. console.error(error)
  156. }
  157. }
  158. getMachineMacdata();
  159. //搜索
  160. const add_searchInfo = ref('')
  161. //表格
  162. const add_tableData = reactive([]);
  163. //尾包选中值
  164. const activeButtonValue = ref('')
  165. //代表扫描两次自动保存
  166. const searcs = ref('')
  167. //查询询钮
  168. const add_onSubmit = async ()=>{
  169. if(add_searchInfo.value === '' || add_searchInfo.value === undefined){
  170. const WorkListdata = [];
  171. add_tableData.splice(0,add_tableData.length,...WorkListdata);
  172. ElMessage({type: 'warning',message: '请扫描小票二维码' })
  173. }else{
  174. if(searcs.value === ''){
  175. const order =add_searchInfo.value;
  176. const sys_sbID = add_formData['机台号']
  177. //获取下面报工历史记录
  178. const getSpotLists = await getSpotList({order:order,code:_code,sys_sbID:sys_sbID});
  179. activeButtonValue.value = getSpotLists.data.result.wb
  180. UniqId.value = getSpotLists.data.result.UniqId
  181. add_formData['数量'] = getSpotLists.data.result.sl
  182. add_formData['尺码'] = getSpotLists.data.result.cm
  183. add_tableData.splice(0,add_tableData.length,...getSpotLists.data.records);
  184. searcs.value = 1;
  185. add_searchInfo.value = ''
  186. }else{
  187. add_Dialog();
  188. }
  189. setTimeout(() => {
  190. const inputElement = document.getElementById('searchInput');
  191. if (inputElement) {
  192. inputElement.focus();
  193. }
  194. }, 100); // 延迟100毫秒
  195. }
  196. }
  197. const AttendanceVisible=ref(false)
  198. //清空对象的属性值
  199. const gd_clearFormData = () => {
  200. Object.keys(add_formData).forEach(key => {
  201. add_formData[key] = '';
  202. });
  203. };
  204. const add_formData = reactive({
  205. 机台号: '',
  206. 工序: '',
  207. 组别: '',
  208. 人员: '',
  209. 尺码: '',
  210. 数量: '',
  211. 是否订单尾包: '',
  212. });
  213. const currentSlValue=ref('')
  214. //后道确认按钮
  215. const add_Dialog = async ()=>{
  216. if(add_searchInfo.value === ''){
  217. ElMessage({type: 'warning',message: '请勾选具体的出库订单后,再操作此功能'})
  218. }else{
  219. console.log(UniqId.value)
  220. // return false;
  221. const cf_gettab = await search({UniqId:UniqId.value,code:_code}); // 调用search函数
  222. if (cf_gettab.code === 0) {
  223. const firstPart = add_searchInfo.value.split(',')[0];
  224. const lsjltable = await getTab({order_id:firstPart,sczl_jtbh:add_formData['机台号']});
  225. console.log(lsjltable)
  226. add_tableData.splice(0,add_tableData.length,...lsjltable.data.records);
  227. add_searchInfo.value = '';
  228. setTimeout(() => {
  229. const inputElement = document.getElementById('searchInput');
  230. if (inputElement) {
  231. inputElement.focus();
  232. }
  233. }, 100); // 延迟100毫秒
  234. searcs.value = '';
  235. ElMessage({type: 'success', message: '报工成功'});
  236. }
  237. }
  238. }
  239. //单机
  240. const add_tableRowClick = async (row) => {
  241. roww.value = row
  242. }
  243. //双击
  244. const add_updateCompanyFunc = async (row) => {
  245. }
  246. //右键
  247. const handleRightClick = async (row) => {
  248. }
  249. //复选框
  250. const add_xpSelectionChange = async (selection) => {
  251. console.log(selection.length)
  252. selectedRows.value = selection;
  253. if (selection.length === 0) {
  254. ElMessage({type: 'warning', message: '请勾选打印的数据' });
  255. return false;
  256. }else if(selection.length>0){
  257. allPrintData.value = selection.map((row) => {
  258. let weibao = row['是否尾包'] === '是' ? 1 : 0;
  259. const ewm = `${row['订单子编号']},01,${row['尺码']},${row['数量']},${weibao}`;
  260. return {
  261. emm: ewm,
  262. zddbh: row['子订单编号'],
  263. kh: row['款号'],
  264. pm: row['款式'],
  265. ys: row['颜色'],
  266. cm: row['尺码'],
  267. sl: row['数量'],
  268. zb: row['组别'],
  269. dyrq: currentDates,
  270. wb: row['尾包']
  271. };
  272. });
  273. }else{
  274. allPrintData.value = [];
  275. }
  276. console.log(allPrintData.value)
  277. }
  278. // =========== 删除按钮 ===========
  279. //记录复选框的值
  280. const bgSelection = ref(null)
  281. const baogong_del = () => {
  282. if(bgSelection.value === null || bgSelection.value === ''){
  283. ElMessage({type: 'warning',message: '请选择删除的数据' })
  284. }else{
  285. console.log(bgSelection.value)
  286. }
  287. }
  288. // 保存当前选中的行数据
  289. const table_selectrows = ref([]);
  290. // 表格复选框选中变化时触发
  291. const table_SelectionChange = (val) => {
  292. table_selectrows.value = val; // 将选中的行数据保存到 table_selectrows
  293. }
  294. // =========== 分页 ===========
  295. // 分页相关的响应式变量
  296. const page = ref(1)
  297. const total = ref(0)
  298. const pageSize = ref(10)
  299. // 分页
  300. const handleCurrentChange = (val) => {
  301. page.value = val;
  302. _getStaffList();
  303. };
  304. // 修改页面容量 点击多少条/页
  305. const handleSizeChange = (val) => {
  306. page.value = 10;//默认显示
  307. pageSize.value = val;
  308. _getStaffList();
  309. };
  310. </script>
  311. <style scoped>
  312. .form-container {
  313. display: flex;
  314. flex-wrap: wrap;
  315. }
  316. .form-column {
  317. /*flex: 1;*/
  318. margin-right: 15px; /* 调整列之间的间距 */
  319. }
  320. /* 左侧输入框宽度调整 */
  321. .form-column .el-form-item .el-input {
  322. width: 150px; /* 调整左侧输入框的宽度 */
  323. }
  324. /* 媒体查询,根据需要调整断点 */
  325. @media screen and (max-width: 768px) {
  326. .form-column {
  327. flex: 1 0 100%; /* 在小屏幕下变成单列布局 */
  328. margin-right: 0;
  329. }
  330. }
  331. /* 表格复选框大小调整 */
  332. :deep(.el-checkbox.el-checkbox--small .el-checkbox__inner) {
  333. width: 30px; /* 复选框宽度 */
  334. height: 20px; /* 复选框高度 */
  335. }
  336. :deep(.el-checkbox.el-checkbox--small.is-checked .el-checkbox__inner::after) {
  337. transform: scale(1.2) rotate(45deg); /* 调整选中后的对勾大小 */
  338. top: 5%; /* 调整对勾位置 */
  339. left: 40%; /* 调整对勾位置 */
  340. width: 5px; /* 调整对勾宽度 */
  341. height: 9px; /* 调整对勾高度 */
  342. }
  343. /*:deep(.el-table td .cell) {*/
  344. /* line-height: 30px !important;*/
  345. /*}*/
  346. .JKWTree-container {
  347. display: flex;
  348. }
  349. .JKWTree-tree {
  350. /*width: 300px;*/
  351. background-color: #fff;
  352. padding: 10px;
  353. margin-right: 20px;
  354. }
  355. .JKWTree-tree h3 {
  356. font-size: 15px;
  357. font-weight: 700;
  358. margin: 10px 0;
  359. }
  360. .JKWTree-content {
  361. flex: 1;
  362. }
  363. /* 图片上传 */
  364. .upload-box {
  365. width: 200px;
  366. height: 200px;
  367. border: 2px dashed #e2e2e2;
  368. display: flex;
  369. justify-content: center;
  370. align-items: center;
  371. position: relative;
  372. cursor: pointer;
  373. }
  374. .uploaded-image {
  375. width: 100%;
  376. height: 100%;
  377. object-fit: cover;
  378. }
  379. .upload-icon {
  380. font-size: 40px;
  381. color: #c0c4cc;
  382. }
  383. .file-input {
  384. display: none;
  385. }
  386. .el-table .warning-row {
  387. background: oldlace;
  388. }
  389. /* 选中某行时的背景色 */
  390. :deep(.el-table__body tr.current-row) > td {
  391. background: #ff80ff !important;
  392. }
  393. </style>
  394. <style scoped>
  395. :deep(.el-table td .cell) {
  396. line-height: 20px !important;
  397. }
  398. :deep(.el-tabs__header){
  399. margin-bottom: 0;
  400. }
  401. .search{
  402. margin-left: 0px !important;
  403. margin-right: 10px !important;
  404. }
  405. .bt{
  406. margin-left: 2px !important;
  407. padding: 3px !important;
  408. font-size: 12px;
  409. }
  410. .el-tabs__header{
  411. margin: 0px !important;
  412. }
  413. .gva-table-box{
  414. padding: 0px !important;
  415. }
  416. .mab{
  417. margin-bottom: 5px;
  418. }
  419. /* 点击按钮改变颜色 */
  420. .active-button {
  421. background-color: #ff0000;
  422. }
  423. .default-button {
  424. background-color: #808080;
  425. }
  426. /* 搜索样式 */
  427. ::v-deep .el-input__wrapper #searchInput {
  428. font-size: 16px;
  429. }
  430. ::v-deep .el-input__wrapper #jitaihao {
  431. font-size: 18px;
  432. }
  433. ::v-deep .el-input__wrapper #gongxu {
  434. font-size: 18px;
  435. }
  436. ::v-deep .el-input__wrapper #zubie {
  437. font-size: 18px;
  438. }
  439. ::v-deep .el-input__wrapper #renyuan {
  440. font-size: 18px;
  441. }
  442. ::v-deep .el-input__wrapper #shuliang {
  443. font-size: 18px;
  444. color: red;
  445. }
  446. ::v-deep .el-input__wrapper #chima {
  447. font-size: 18px;
  448. }
  449. </style>