baozhuangbaogong.vue 18 KB

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