houdaoshougong.vue 14 KB

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