houdaoshougong.vue 19 KB

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