houdaoshougong.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520
  1. <template>
  2. <div>
  3. <layout>
  4. <layout-content >
  5. <!-- <el-main> -->
  6. <div class="gva-table-box">
  7. <h1 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['机台号']" 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['工序']" 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['组别']" 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['人员']" 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;"
  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;"
  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 getMachineMacdata = async () => {
  150. try {
  151. const Machine = '68-ED-A4-26-60-D1'
  152. const data = await getMachineMac({sys_sbID:Machine,code:'后道'});
  153. add_formData['机台号'] = data.data['机台号']
  154. add_formData['工序'] = data.data['生产工序']
  155. add_formData['组别'] = data.data['组别']
  156. add_formData['人员'] = data.data['组长']
  157. } catch (error) {
  158. console.error(error)
  159. }
  160. }
  161. getMachineMacdata();
  162. //点击【查询】按钮DC2408001-1,01,8,10,0
  163. const add_searchInfo = ref('')
  164. const add_tableData = reactive([]);
  165. const activeButtonValue = ref('')
  166. const UniqId = ref('')
  167. //全局获取颜色款式款号
  168. const _yskskh= ref('')
  169. const searcs = ref('')
  170. const add_onSubmit = async ()=>{
  171. if(add_searchInfo.value === '' || add_searchInfo.value === undefined){
  172. const WorkListdata = [];
  173. add_tableData.splice(0,add_tableData.length,...WorkListdata);
  174. ElMessage({type: 'warning',message: '请扫描小票二维码' })
  175. }else{
  176. if(searcs.value === ''){
  177. const order =add_searchInfo.value;
  178. const sys_sbID = add_formData['机台号']
  179. const getSpotLists = await getSpotList({order:order,code:'后道',sys_sbID:sys_sbID});
  180. activeButtonValue.value = getSpotLists.data.result.wb
  181. UniqId.value = getSpotLists.data.result.UniqId
  182. add_formData['数量'] = getSpotLists.data.result.sl
  183. add_formData['尺码'] = getSpotLists.data.result.cm
  184. //获取下面报工历史记录
  185. add_tableData.splice(0,add_tableData.length,...getSpotLists.data.records);//表格数据
  186. searcs.value = 1;
  187. }else{
  188. add_Dialog();
  189. }
  190. }
  191. }
  192. const AttendanceVisible=ref(false)
  193. //清空对象的属性值
  194. const gd_clearFormData = () => {
  195. Object.keys(add_formData).forEach(key => {
  196. add_formData[key] = '';
  197. });
  198. };
  199. const add_formData = reactive({
  200. 机台号: '',
  201. 工序: '',
  202. 组别: '',
  203. 人员: '',
  204. 尺码: '',
  205. 数量: '',
  206. 是否订单尾包: '',
  207. });
  208. const currentSlValue=ref('')
  209. //后道确认按钮
  210. const add_Dialog = async ()=>{
  211. if(add_searchInfo.value === ''){
  212. ElMessage({type: 'warning',message: '请勾选具体的出库订单后,再操作此功能'})
  213. }else{
  214. console.log(UniqId.value)
  215. // return false;
  216. const cf_gettab = await search({UniqId:UniqId.value,code:'后道'}); // 调用search函数
  217. if (cf_gettab.code === 0) {
  218. const firstPart = add_searchInfo.value.split(',')[0];
  219. const lsjltable = await getTab({order_id:firstPart,sczl_jtbh:add_formData['机台号']});
  220. console.log(lsjltable)
  221. add_tableData.splice(0,add_tableData.length,...lsjltable.data.records);
  222. add_searchInfo.value = '';
  223. setTimeout(() => {
  224. const inputElement = document.getElementById('searchInput');
  225. if (inputElement) {
  226. inputElement.focus();
  227. }
  228. }, 100); // 延迟100毫秒
  229. searcs.value = '';
  230. ElMessage({type: 'success', message: '报工成功'});
  231. }
  232. }
  233. }
  234. // AttendanceVisible.value = false
  235. // 新增取消
  236. const add_closeDialog = () => {
  237. AttendanceVisible.value = false
  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. const dialogFormVisible = ref(false)
  296. const edit_formData = ref({})
  297. // 双击修改
  298. const updateCompanyFunc = async (row) => {
  299. console.log(row)
  300. dialogFormVisible.value = true;
  301. Object.assign(edit_formData.value,row);
  302. edit_formData.value['是否订单尾包'] = row['是否尾包'];
  303. // let code = row['员工编号'];
  304. // const getStaffInfo_data = await getStaffInfo({code:code});
  305. // formDataTest.value = getStaffInfo_data.data;
  306. };
  307. // 弹窗修改确定
  308. const edit_Dialog = async () => {
  309. _ygjbzledit();
  310. }
  311. // 弹窗修改关闭
  312. const edit_closeDialog = () => {
  313. dialogFormVisible.value = false
  314. }
  315. const _ygjbzledit = async ()=>{
  316. // const formattedData = {
  317. // '订单子编号': edit_formData.value['订单子编号'],
  318. // '订单号': edit_formData.value['订单号'],
  319. // '生产款号': edit_formData.value['生产款号'],
  320. // '款式': edit_formData.value['款式'],
  321. // '颜色': edit_formData.value['颜色'],
  322. // '制单总数': edit_formData.value['制单总数'],
  323. // '组别': edit_formData.value['组别'],
  324. // '排产单数': edit_formData.value['排产单数'],
  325. // '尺码': edit_formData.value['尺码'],
  326. // '报工数量': edit_formData.value['报工数量'],
  327. // '是否为尾包': edit_formData.value['是否为尾包'],
  328. // '工序': edit_formData.value['工序'],
  329. // '验片人': edit_formData.value['验片人'],
  330. // '日期': edit_formData.value['日期'],
  331. // };
  332. // try {
  333. // const edid_edit_formData = await 修改接口(formattedData);
  334. // if (edid_edit_formData .code === 0) {
  335. // dialogFormVisible.value = false;
  336. // ElMessage({type: 'success',message: '更新成功'})
  337. // } else {
  338. // ElMessage({ type: 'error',message: '更新失败'})
  339. // }
  340. // } catch (error) {
  341. // console.error(error);
  342. // }
  343. }
  344. // =========== 分页 ===========
  345. // 分页相关的响应式变量
  346. const page = ref(1)
  347. const total = ref(0)
  348. const pageSize = ref(10)
  349. // 分页
  350. const handleCurrentChange = (val) => {
  351. page.value = val;
  352. _getStaffList();
  353. };
  354. // 修改页面容量 点击多少条/页
  355. const handleSizeChange = (val) => {
  356. page.value = 10;//默认显示
  357. pageSize.value = val;
  358. _getStaffList();
  359. };
  360. </script>
  361. <style scoped>
  362. .form-container {
  363. display: flex;
  364. flex-wrap: wrap;
  365. }
  366. .form-column {
  367. /*flex: 1;*/
  368. margin-right: 15px; /* 调整列之间的间距 */
  369. }
  370. /* 左侧输入框宽度调整 */
  371. .form-column .el-form-item .el-input {
  372. width: 150px; /* 调整左侧输入框的宽度 */
  373. }
  374. /* 媒体查询,根据需要调整断点 */
  375. @media screen and (max-width: 768px) {
  376. .form-column {
  377. flex: 1 0 100%; /* 在小屏幕下变成单列布局 */
  378. margin-right: 0;
  379. }
  380. }
  381. /* 表格复选框大小调整 */
  382. :deep(.el-checkbox.el-checkbox--small .el-checkbox__inner) {
  383. width: 30px; /* 复选框宽度 */
  384. height: 20px; /* 复选框高度 */
  385. }
  386. :deep(.el-checkbox.el-checkbox--small.is-checked .el-checkbox__inner::after) {
  387. transform: scale(1.2) rotate(45deg); /* 调整选中后的对勾大小 */
  388. top: 5%; /* 调整对勾位置 */
  389. left: 40%; /* 调整对勾位置 */
  390. width: 5px; /* 调整对勾宽度 */
  391. height: 9px; /* 调整对勾高度 */
  392. }
  393. /*:deep(.el-table td .cell) {*/
  394. /* line-height: 30px !important;*/
  395. /*}*/
  396. .JKWTree-container {
  397. display: flex;
  398. }
  399. .JKWTree-tree {
  400. /*width: 300px;*/
  401. background-color: #fff;
  402. padding: 10px;
  403. margin-right: 20px;
  404. }
  405. .JKWTree-tree h3 {
  406. font-size: 15px;
  407. font-weight: 700;
  408. margin: 10px 0;
  409. }
  410. .JKWTree-content {
  411. flex: 1;
  412. }
  413. /* 图片上传 */
  414. .upload-box {
  415. width: 200px;
  416. height: 200px;
  417. border: 2px dashed #e2e2e2;
  418. display: flex;
  419. justify-content: center;
  420. align-items: center;
  421. position: relative;
  422. cursor: pointer;
  423. }
  424. .uploaded-image {
  425. width: 100%;
  426. height: 100%;
  427. object-fit: cover;
  428. }
  429. .upload-icon {
  430. font-size: 40px;
  431. color: #c0c4cc;
  432. }
  433. .file-input {
  434. display: none;
  435. }
  436. .el-table .warning-row {
  437. background: oldlace;
  438. }
  439. /* 选中某行时的背景色 */
  440. :deep(.el-table__body tr.current-row) > td {
  441. background: #ff80ff !important;
  442. }
  443. </style>
  444. <style scoped>
  445. :deep(.el-table td .cell) {
  446. line-height: 20px !important;
  447. }
  448. :deep(.el-tabs__header){
  449. margin-bottom: 0;
  450. }
  451. .search{
  452. margin-left: 0px !important;
  453. margin-right: 10px !important;
  454. }
  455. .bt{
  456. margin-left: 2px !important;
  457. padding: 3px !important;
  458. font-size: 12px;
  459. }
  460. .el-tabs__header{
  461. margin: 0px !important;
  462. }
  463. .gva-table-box{
  464. padding: 0px !important;
  465. }
  466. .mab{
  467. margin-bottom: 5px;
  468. }
  469. /* 点击按钮改变颜色 */
  470. .active-button {
  471. background-color: #ff0000;
  472. }
  473. .default-button {
  474. background-color: #808080;
  475. }
  476. </style>