datangbaogong.vue 17 KB

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