baozhuangbaogong.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796
  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;">{{_code}}报工</h1>
  8. <el-row :gutter="10" style="align-items: center; margin-bottom: 20px;">
  9. <!-- 子订单编号输入框 -->
  10. <el-col :span="4" style="padding: 0px;margin: 0px;">
  11. <el-input v-model="add_searchInfo" placeholder="请扫描子订单编号"@keyup.enter="add_onSubmit" id="searchInput" style="width: 100%; height: 50px;"/>
  12. </el-col>
  13. <!-- 查询按钮 -->
  14. <el-col :span="1.5" style="padding: 0px;margin: 0px;">
  15. <el-button type="primary" icon="search" @click="add_onSubmit"style="height: 50px;width: 80px;">查询</el-button>
  16. </el-col>
  17. <el-col :span="1.5" style="padding: 0px;margin: 0px;">
  18. <el-text style="font-size: 30px;">机台号</el-text>
  19. </el-col>
  20. <!-- 机台号输入框 -->
  21. <el-col :span="2"><el-input v-model="add_formData['机台号']" readonly style="width: 100%; height: 40px;"/></el-col>
  22. <el-col :span="1.5" style="padding: 0px;margin: 0px;">
  23. <el-text style="font-size: 30px;">工序</el-text>
  24. </el-col>
  25. <!-- 工序输入框 -->
  26. <el-col :span="2"><el-input v-model="add_formData['工序']" readonly style="width: 100%; height: 40px;" /></el-col>
  27. <el-col :span="1.5" style="padding: 0px;margin: 0px;">
  28. <el-text style="font-size: 30px;">组别</el-text>
  29. </el-col>
  30. <!-- 组别输入框 -->
  31. <el-col :span="2"><el-input v-model="add_formData['组别']" readonly style="width: 100%; height: 40px;" /></el-col>
  32. <el-col :span="1.5" style="padding: 0px;margin: 0px;">
  33. <el-text style="font-size: 30px;">人员</el-text>
  34. </el-col>
  35. <!-- 人员输入框 -->
  36. <el-col :span="2"><el-input v-model="add_formData['人员']" readonly style="width: 100%; height: 40px;"/></el-col>
  37. </el-row>
  38. <el-row :gutter="10" style="align-items: center; margin-bottom: 20px;">
  39. <el-col :span="1.5" style="padding: 0px;margin: 0px;">
  40. <el-text style="font-size: 30px;">尺码</el-text>
  41. </el-col>
  42. <!-- 尺码输入框 -->
  43. <el-col :span="2"><el-input v-model="add_formData['尺码']" readonly style="width: 100%; height: 40px;"/></el-col>
  44. <el-col :span="1.5" style="padding: 0px;margin: 0px;">
  45. <el-text style="font-size: 30px;">总数量</el-text>
  46. </el-col>
  47. <!-- 总数量输入框 -->
  48. <el-col :span="2"><el-input v-model="add_formData['总数量']" readonly style="width: 100%; height: 40px;"/></el-col>
  49. <el-col :span="1.5" style="padding: 0px;margin: 0px;">
  50. <el-text style="font-size: 30px;">剩余数量</el-text>
  51. </el-col>
  52. <!--剩余数量输入框 -->
  53. <el-col :span="2"><el-input v-model="add_formData['剩余数量']" readonly style="width: 100%; height: 40px;"/></el-col>
  54. <el-col :span="1.5" style="padding: 0px;margin: 0px;">
  55. <el-text style="font-size: 30px;">上报数量</el-text>
  56. </el-col>
  57. <!--上报数量输入框 -->
  58. <el-col :span="2"><el-input v-model="add_formData['上报数量']" @input="baogongslpd" id="s_num" style="width: 100%; height: 40px;"/></el-col>
  59. <!-- 是否尾包文本 -->
  60. <el-col :span="2.5">
  61. <el-text style="font-size: 30px;">是否尾包</el-text>
  62. </el-col>
  63. <!-- 是否尾包按钮 -->
  64. <el-col :span="1">
  65. <el-button
  66. :class="{'info-button': activeButtonValue === '1', 'default-button': activeButtonValue !== '1'}"
  67. style="margin-top:-6px; margin-right:15px; height: 50px; width: 60px;
  68. display: flex; justify-content: center; align-items: center; cursor: not-allowed; border: 1px solid #ccc;
  69. border-radius: 4px; color: #000000; font-size: 24px;"
  70. :style="{ backgroundColor: activeButtonValue === '1' ? '#ff0000' : '#808080' }"
  71. >是</el-button>
  72. </el-col>
  73. <el-col :span="1">
  74. <el-button
  75. :class="{'info-button': activeButtonValue === '0', 'default-button': activeButtonValue !== '0'}"
  76. style="margin-top:-6px; height: 50px; width: 60px; margin-left: 10px;
  77. display: flex; justify-content: center; align-items: center; cursor: not-allowed; border: 1px solid #ccc;
  78. border-radius: 4px; color: #000000; font-size: 24px;"
  79. :style="{ backgroundColor: activeButtonValue === '0' ? '#ff0000' : '#808080' }"
  80. >否</el-button>
  81. </el-col>
  82. </el-row>
  83. <layout-content >
  84. <el-main>
  85. <el-row :gutter="24" style="margin-bottom: 15px;">
  86. <!-- 表格数据 -->
  87. <el-tabs v-model="activeName">
  88. <el-tab-pane label="报工历史记录" @click="showTable('报工历史记录')" name="first">
  89. <el-table ref="multipleTableRef" style="width: 100%;height: 53vh"
  90. :row-style="{ height: '50px' }" :header-cell-style="{ padding: '5px', fontSize: '20px' }"
  91. :cell-style="{ padding: '10px', fontSize: '20px' }" :header-row-style="{ height: '20px' }"
  92. :data="add_tableData" border row-key="ID" size="small"
  93. highlight-current-row="true" tooltip-effect="dark"
  94. @row-dblclick="add_updateCompanyFunc" @row-click="add_tableRowClick" @row-contextmenu="handleRightClick"
  95. :show-overflow-tooltip="true" @selection-change="add_xpSelectionChange">
  96. <!-- <el-table-column type="selection" width="70" /> -->
  97. <el-table-column sortable align="left" label="流水号" prop="serial" width="100"/>
  98. <el-table-column sortable align="left" label="报工时间" prop="sys_rq" width="160"/>
  99. <el-table-column sortable align="left" label="订单编号" prop="订单编号" width="130"/>
  100. <el-table-column sortable align="left" label="订单子编号" prop="子订单编号" width="140"/>
  101. <el-table-column sortable align="left" label="款式" prop="款式" width="140"/>
  102. <el-table-column sortable align="left" label="色系名称" prop="颜色" width="130"/>
  103. <el-table-column sortable align="left" label="尺码" prop="尺码" width="110"/>
  104. <el-table-column sortable align="left" label="数量" prop="数量" width="110"/>
  105. <el-table-column sortable align="left" label="上报数量" prop="上报数量" width="110"/>
  106. <el-table-column sortable align="left" label="是否尾包" prop="尾包" width="130"/>
  107. <!-- <el-table-column sortable align="left" label="组别" prop="组别" width="130"/> -->
  108. </el-table>
  109. </el-tab-pane>
  110. <el-tab-pane label="技术附件" @click="showTable('技术附件')" name="fourth">
  111. <el-table ref="multipleTable"
  112. :row-style="{ height: '20px' }"
  113. :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
  114. :header-cell-style="{ padding: '0px' }"
  115. :show-overflow-tooltip="true"
  116. :cell-class-name="planUsageCellClass"
  117. highlight-current-row="true"
  118. @row-dblclick="ExcelShow"
  119. style="width: 100%;height: 36vh" border tooltip-effect="dark" :data="jstableData" row-key="ID" @selection-change="handleSelectionChange">
  120. <!-- <el-table-column type="selection" width="55" /> -->
  121. <el-table-column align="left" label="备注" prop="附件备注" width="120"/>
  122. <el-table-column align="left" label="文件类型" prop="附件类型" width="120"/>
  123. <el-table-column align="left" label="关联产品" prop="关联编号" width="120"/>
  124. <el-table-column align="left" label="建档用户" prop="sys_id" width="120"/>
  125. <el-table-column align="left" label="建档时间" prop="sys_rq" width="160"/>
  126. <el-table-column align="left" label="更新时间" prop="mod_rq" width="120"/>
  127. </el-table>
  128. </el-tab-pane>
  129. </el-tabs>
  130. </el-row>
  131. </el-main>
  132. </layout-content>
  133. <div class="dialog-footer" style="text-align: left;margin-right: 60px;">
  134. <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>
  135. <el-button type="primary" @click="gd_yulan" style="width: 100px;height: 60px;font-size: 20px;">订单表预览</el-button>
  136. </div>
  137. </div>
  138. <!-- </el-main> -->
  139. </layout-content>
  140. </layout>
  141. <!-- 技术附件预览弹窗 -->
  142. <el-dialog v-model="luckyexcelVisible" :before-close="luckyexcelCloseDialog" width="100%" top="0vh">
  143. <div id="luckyexcel" style="width: 100%;height: 100vh;"></div>
  144. </el-dialog>
  145. <PrintPage ref="printPageRef" />
  146. </div>
  147. </template>
  148. <script>
  149. export default {
  150. data() {
  151. return {
  152. currentTable: '', // 当前展示的表格
  153. activeName: 'first',
  154. };
  155. },
  156. methods: {
  157. handleKeyDown(event, prevId, currentId, nextId) {
  158. const currentElement = document.getElementById(currentId);
  159. const isEmpty = currentElement.value === '';
  160. const atStart = currentElement.selectionStart === 0;
  161. const atEnd = currentElement.selectionStart === currentElement.value.length;
  162. switch (event.keyCode) {
  163. case 13: // Enter
  164. case 40: // 向下箭头
  165. if (nextId) {
  166. document.getElementById(nextId).focus();
  167. }
  168. break;
  169. case 38: // 向上箭头
  170. if (prevId) {
  171. document.getElementById(prevId).focus();
  172. }
  173. break;
  174. case 8: // 删除键
  175. if (prevId && (isEmpty || atStart)) {
  176. document.getElementById(prevId).focus();
  177. }
  178. break;
  179. case 37: // 向左箭头
  180. if (prevId && atStart) {
  181. document.getElementById(prevId).focus();
  182. }
  183. break;
  184. case 39: // 向右箭头
  185. if (nextId && atEnd) {
  186. document.getElementById(nextId).focus();
  187. }
  188. break;
  189. default:
  190. break;
  191. }
  192. },
  193. },
  194. };
  195. </script>
  196. <script setup>
  197. // 全量引入格式化工具 请按需保留
  198. import $script from 'scriptjs'
  199. import $ from 'jquery';
  200. import LuckyExcel from 'luckyexcel';
  201. import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
  202. import {hiprint} from "vue-plugin-hiprint";
  203. import {ref, reactive,nextTick,watch, setBlockTracking } from 'vue'
  204. import {getSpotList,search,getTab,OrderAttachments,getTabByGdbh } from '@/api/mes/job'
  205. import {getMachineMac} from '@/api/jixiaoguanli/jitairibaobiao'
  206. import {getMac} from '@/api/jixiaoguanli/baogong'
  207. import PrintPage from '../yunyin/shengchanguanli/components/print.vue';
  208. import {ElMessage} from "element-plus";
  209. import { get } from 'scriptjs';
  210. import { useUserStore } from '@/pinia/modules/user';
  211. defineOptions({name: 'Company'})
  212. //获取登录用户信息
  213. const userStore = useUserStore()
  214. const _username = ref('')
  215. _username.value = userStore.userInfo.userName + '/' + userStore.userInfo.nickName
  216. console.log('获取用户名称',_username.value)
  217. //全局获取当前日期
  218. const today = new Date();
  219. const year = today.getFullYear();
  220. const month = String(today.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始,需要补零
  221. const day = String(today.getDate()).padStart(2, '0');
  222. const hours = String(today.getHours()).padStart(2, '0');
  223. const minutes = String(today.getMinutes()).padStart(2, '0');
  224. const seconds = String(today.getSeconds()).padStart(2, '0');
  225. const currentDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  226. const currentDates = `${year}-${month}-${day}`;
  227. const printPageRef = ref()
  228. //全局获取code,接口接收code
  229. const _code = '包装'
  230. //全局接口接受的物理地址
  231. const Machine = ref('')
  232. //全局获取UniqId
  233. const UniqId = ref('')
  234. //全局获取工序
  235. const _gx = '7'
  236. //全局获取工序名称
  237. const _gxmc = _code
  238. const add_formData = reactive({
  239. 机台号: '',
  240. 工序: '',
  241. 组别: '',
  242. 人员: '',
  243. 尺码: '',
  244. 数量: '',
  245. 剩余数量: '',
  246. 上报数量:'',
  247. 是否订单尾包: '',
  248. });
  249. //物理地址获取机台编号
  250. const getMachineMacdata = async () => {
  251. console.log(_code,"机台获取物理地址",Machine.value)
  252. try {
  253. const data = await getMachineMac({sys_sbID:Machine.value});
  254. add_formData['机台号'] = data.data['机台号']
  255. add_formData['工序'] = data.data['生产工序']
  256. add_formData['组别'] = data.data['组别']
  257. add_formData['人员'] = data.data['组长']
  258. setTimeout(() => {
  259. const inputElement = document.getElementById('searchInput');
  260. if (inputElement) {
  261. inputElement.focus();
  262. }
  263. }, 100); // 延迟100毫秒
  264. } catch (error) {
  265. console.error(error)
  266. }
  267. }
  268. //自动获取物理地址
  269. const GetAddr = () => {
  270. var xmlhttp = null;
  271. var res;
  272. if (window.XMLHttpRequest) {
  273. xmlhttp = new XMLHttpRequest();
  274. } else if (window.ActiveXObject) {
  275. xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  276. }
  277. // 2. 设置回调函数
  278. xmlhttp.onreadystatechange = function() {
  279. if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
  280. res = eval('('+xmlhttp.response+')');
  281. let result = ''
  282. for (let i = 0; i < res.macAddress.length; i++) {
  283. if (i % 2 === 0 && i !== 0) {
  284. result += '-' // 根据实际需求修改分隔符
  285. }
  286. result += res.macAddress[i]
  287. }
  288. Machine.value = result
  289. getMachineMacdata(Machine.value)
  290. }
  291. }
  292. // 3. 打开一个连接
  293. xmlhttp.open("get", "http://127.0.0.1:8090/init")
  294. // 5. 发送
  295. xmlhttp.send();
  296. }
  297. // getMachineMacdata();
  298. GetAddr()
  299. //搜索
  300. const add_searchInfo = ref('')
  301. //表格
  302. const add_tableData = reactive([]);
  303. //尾包选中值
  304. const activeButtonValue = ref('')
  305. //代表扫描两次自动保存
  306. const searcs = ref('')
  307. const _order = ref('')
  308. //技术附件
  309. const jstableData = reactive([])
  310. const _list = ref('')
  311. // 查询按钮
  312. const add_onSubmit = async ()=>{
  313. if(add_formData['机台号'] === ''){
  314. ElMessage({type: 'warning',message: '未获取到机台'})
  315. return false;
  316. }
  317. if(add_searchInfo.value === '' || add_searchInfo.value === undefined){
  318. const WorkListdata = [];
  319. add_tableData.splice(0,add_tableData.length,...WorkListdata);
  320. ElMessage({type: 'warning',message: '请扫描小票二维码' })
  321. return false;
  322. }
  323. setTimeout(() => {
  324. const inputElement = document.getElementById('s_num');
  325. if (inputElement) {
  326. inputElement.focus();
  327. }
  328. }, 100);
  329. _order.value = add_searchInfo.value;
  330. //获取下面报工历史记录
  331. const getSpotLists = await getSpotList({order:add_searchInfo.value,code:_code,sys_sbID:add_formData['机台号']});
  332. console.log(getSpotLists)
  333. if(getSpotLists.data === null){
  334. add_searchInfo.value = ''
  335. add_formData['尺码'] = ''
  336. add_formData['总数量'] = ''
  337. add_formData['剩余数量'] = ''
  338. setTimeout(() => {
  339. const inputElement = document.getElementById('searchInput');
  340. if (inputElement) {
  341. inputElement.focus();
  342. }
  343. }, 100);
  344. }
  345. activeButtonValue.value = getSpotLists.data.result.wb
  346. UniqId.value = getSpotLists.data.result.UniqId
  347. _list.value = getSpotLists.data.result
  348. add_formData['尺码'] = getSpotLists.data.result.cm
  349. add_formData['总数量'] = getSpotLists.data.result.sl
  350. add_formData['剩余数量'] = getSpotLists.data.result.ci_num
  351. add_tableData.splice(0,add_tableData.length,...getSpotLists.data.records);
  352. //技术附件
  353. const searchValue = add_searchInfo.value.split('-')[0];
  354. const jsOrderAttachments = await OrderAttachments({order:searchValue,desc:'技术附件'})
  355. jstableData.splice(0,jsOrderAttachments.data.length,...jsOrderAttachments.data);
  356. }
  357. //技术资料excel展示
  358. const ExcelShow = (row) =>{
  359. console.log("技术资料excel展示")
  360. console.log(row)
  361. if(!row.附件内容) return
  362. $.getScript('/luckysheet/plugins/js/plugin.js', () => {
  363. $script('/luckysheet/luckysheet.umd.js', () => {
  364. function dataURLtoBlob(dataUrl) {
  365. const byteString = atob(dataUrl.split(',')[1]);
  366. const ab = new ArrayBuffer(byteString.length);
  367. const ia = new Uint8Array(ab);
  368. for (let i = 0; i < byteString.length; i++) {
  369. ia[i] = byteString.charCodeAt(i);
  370. }
  371. return new Blob([ab], { type: 'application/octet-stream' });
  372. }
  373. const blob = dataURLtoBlob(row.附件内容);
  374. luckyexcelVisible.value = true
  375. LuckyExcel.transformExcelToLucky(blob, function(exportJson, luckysheetfile){
  376. if(exportJson.sheets==null || exportJson.sheets.length==0){
  377. alert("Failed to read the content of the excel file, currently does not support xls files!");
  378. return;
  379. }
  380. if(luckyExcel) luckyExcel.destroy();
  381. luckysheet.create({
  382. container: 'luckyexcel', //容器的ID
  383. data: exportJson.sheets,
  384. title: exportJson.info.name, // 工作簿名称
  385. lang: "zh", // 设定表格语言 国际化设置,允许设置表格的语言,支持中文("zh")和英文("en")
  386. showtoolbar: false, // 是否显示工具栏
  387. showinfobar: false, // 是否显示顶部信息栏
  388. allowEdit: false, // 是否允许前台编辑
  389. enableAddRow: false, // 允许增加行
  390. enableAddCol: false, // 允许增加列
  391. userInfo: false, // 右上角的用户信息展示样式
  392. showRowBar: false, // 是否显示行号区域
  393. showColumnBar: false, // 是否显示列号区域
  394. sheetFormulaBar: false, // 是否显示公式栏
  395. enableAddBackTop: false,//返回头部按钮
  396. });
  397. luckyExcel = luckysheet;
  398. })
  399. })
  400. })
  401. $('head').append($('<link rel="stylesheet" type="text/css" />').attr('href', '/luckysheet/plugins/css/pluginsCss.css'));
  402. $('head').append($('<link rel="stylesheet" type="text/css" />').attr('href', '/luckysheet/plugins/plugins.css'));
  403. $('head').append($('<link rel="stylesheet" type="text/css" />').attr('href', '/luckysheet/css/luckysheet.css'));
  404. $('head').append($('<link rel="stylesheet" type="text/css" />').attr('href', '/luckysheet/assets/iconfont/iconfont.css'));
  405. }
  406. let luckyExcel = null
  407. const luckyexcelVisible = ref(false)
  408. const luckyexcelCloseDialog = () => {
  409. luckyexcelVisible.value = false
  410. }
  411. const AttendanceVisible=ref(false)
  412. //清空对象的属性值
  413. const gd_clearFormData = () => {
  414. Object.keys(add_formData).forEach(key => {
  415. add_formData[key] = '';
  416. });
  417. };
  418. const add_Dialogonclick = ref(false)
  419. //获取input事件
  420. function baogongslpd() {
  421. // 将字符串转换为数字
  422. const reportedQuantity = parseInt(add_formData['上报数量'], 10) || 0;
  423. const totalQuantity = parseInt(add_formData['剩余数量'], 10) || 0;
  424. if (reportedQuantity > totalQuantity) {
  425. ElMessage({ type: 'warning', message: '上报数量不能大于剩余数量' });
  426. add_Dialogonclick.value = false;
  427. }else if(reportedQuantity === ''){
  428. add_Dialogonclick.value = false;
  429. } else {
  430. add_Dialogonclick.value = true;
  431. }
  432. }
  433. const currentSlValue=ref('')
  434. //报工
  435. const add_Dialog = async ()=>{
  436. console.log(UniqId.value)
  437. if(add_formData['上报数量'] === ''){
  438. ElMessage({type: 'warning',message: '上报数量为空,请填写上报数量'})
  439. return;
  440. }
  441. if(_order.value === ''){
  442. ElMessage({type: 'warning',message: '请重新扫描小票二维码'})
  443. return;
  444. }else{
  445. let params ={}
  446. params.code = _code
  447. params.order = _order.value.split(',')[0].split('-')[0]
  448. params.order_id = _order.value.split(',')[0]
  449. params.gx = _gx
  450. params.gxmc = _gxmc
  451. params.cm = _order.value.split(',')[3]
  452. params.sl = _order.value.split(',')[4]
  453. params.sczl_jtbh = add_formData['机台号']
  454. params.sczl_bh = add_formData['组别']
  455. params.wb = _order.value.split(',')[5]
  456. params.sys_id = add_formData['人员']
  457. params.UniqId = UniqId.value
  458. params.s_num = add_formData['上报数量']
  459. params.ci_num = add_formData['剩余数量']
  460. console.log(params)
  461. // 记录每一次上报数据信息日志
  462. let datalog = {};
  463. datalog.code = _code;
  464. datalog.订单编号 = _list.value.订单编号;
  465. datalog.子订单编号 = _list.value.order;
  466. datalog.款号 = _list.value.生产款号;
  467. datalog.款式 = _list.value.款式;
  468. datalog.颜色 = _list.value.颜色;
  469. datalog.上报时间 = currentDate;
  470. datalog.上报数量 = add_formData['上报数量'];
  471. // 记录总实裁数
  472. datalog.sctotal = _list.value.sctotal;
  473. datalog.zdtotal = _list.value.zdtotal;
  474. datalog['组别'] = add_formData['组别'];
  475. console.log(_list)
  476. console.log(datalog)
  477. const getTabByGdbhs = await getTabByGdbh(datalog);
  478. // return false;
  479. const cf_gettab = await search(params); // 调用search函数
  480. if (cf_gettab.code === 0) {
  481. // const firstPart = add_searchInfo.value.split(',')[0];
  482. //上报后历史记录表格刷新
  483. const lsjltable = await getTab({order_id:_order.value.split(',')[0],sczl_jtbh:add_formData['机台号']});
  484. add_tableData.splice(0,add_tableData.length,...lsjltable.data.records);
  485. // //上报后刷新表格数据
  486. // const getSpotLists = await getSpotList({order:_order.value.split(',')[0],code:_code,sys_sbID:sys_sbID});
  487. // add_tableData.splice(0,add_tableData.length,...getSpotLists.data.records);
  488. add_searchInfo.value = '';
  489. setTimeout(() => {
  490. const inputElement = document.getElementById('searchInput');
  491. if (inputElement) {
  492. inputElement.focus();
  493. }
  494. }, 100); // 延迟100毫秒
  495. // searcs.value = '';
  496. add_formData['尺码']=''
  497. add_formData['总数量']=''
  498. add_formData['上报数量']=''
  499. add_formData['剩余数量']=''
  500. // searcs.value = 1;
  501. add_searchInfo.value = ''
  502. ElMessage({type: 'success', message: '报工成功'});
  503. }
  504. }
  505. }
  506. const gd_yulan = () => {
  507. if(_order.value === '' || _order.value === null){
  508. ElMessage({type: 'warning',message: '请选择具体的工单后,再操作此功能'})
  509. return false;
  510. }else{
  511. const order = _order.value.split('-')[0]
  512. printPageRef.value.open(order)
  513. }
  514. }
  515. //单击
  516. const add_tableRowClick = async (row) => {
  517. const orderString = `${row['子订单编号']},${row['组别']},3,${row['尺码']},${row['数量']},${row['尾包']}`;
  518. add_formData['尺码'] = row.尺码
  519. add_formData['总数量'] = row.数量
  520. add_formData['剩余数量'] = row.剩余数量
  521. _order.value = orderString
  522. console.log(row)
  523. }
  524. //双击
  525. const add_updateCompanyFunc = async (row) => {
  526. }
  527. //右键
  528. const handleRightClick = async (row) => {
  529. }
  530. //复选框
  531. const add_xpSelectionChange = async (selection) => {
  532. console.log(selection.length)
  533. selectedRows.value = selection;
  534. if (selection.length === 0) {
  535. ElMessage({type: 'warning', message: '请勾选打印的数据' });
  536. return false;
  537. }else if(selection.length>0){
  538. allPrintData.value = selection.map((row) => {
  539. let weibao = row['是否尾包'] === '是' ? 1 : 0;
  540. const ewm = `${row['订单子编号']},01,${row['尺码']},${row['数量']},${weibao}`;
  541. return {
  542. emm: ewm,
  543. zddbh: row['子订单编号'],
  544. kh: row['款号'],
  545. pm: row['款式'],
  546. ys: row['颜色'],
  547. cm: row['尺码'],
  548. sl: row['数量'],
  549. zb: row['组别'],
  550. dyrq: currentDates,
  551. wb: row['尾包']
  552. };
  553. });
  554. }else{
  555. allPrintData.value = [];
  556. }
  557. console.log(allPrintData.value)
  558. }
  559. // =========== 删除按钮 ===========
  560. //记录复选框的值
  561. const bgSelection = ref(null)
  562. const baogong_del = () => {
  563. if(bgSelection.value === null || bgSelection.value === ''){
  564. ElMessage({type: 'warning',message: '请选择删除的数据' })
  565. }else{
  566. console.log(bgSelection.value)
  567. }
  568. }
  569. // 保存当前选中的行数据
  570. const table_selectrows = ref([]);
  571. // 表格复选框选中变化时触发
  572. const table_SelectionChange = (val) => {
  573. table_selectrows.value = val; // 将选中的行数据保存到 table_selectrows
  574. }
  575. // =========== 分页 ===========
  576. // 分页相关的响应式变量
  577. const page = ref(1)
  578. const total = ref(0)
  579. const pageSize = ref(10)
  580. // 分页
  581. const handleCurrentChange = (val) => {
  582. page.value = val;
  583. _getStaffList();
  584. };
  585. // 修改页面容量 点击多少条/页
  586. const handleSizeChange = (val) => {
  587. page.value = 10;//默认显示
  588. pageSize.value = val;
  589. _getStaffList();
  590. };
  591. </script>
  592. <style scoped>
  593. .form-container {
  594. display: flex;
  595. flex-wrap: wrap;
  596. }
  597. .form-column {
  598. /*flex: 1;*/
  599. margin-right: 15px; /* 调整列之间的间距 */
  600. }
  601. /* 左侧输入框宽度调整 */
  602. .form-column .el-form-item .el-input {
  603. width: 150px; /* 调整左侧输入框的宽度 */
  604. }
  605. /* 媒体查询,根据需要调整断点 */
  606. @media screen and (max-width: 768px) {
  607. .form-column {
  608. flex: 1 0 100%; /* 在小屏幕下变成单列布局 */
  609. margin-right: 0;
  610. }
  611. }
  612. /* 表格复选框大小调整 */
  613. :deep(.el-checkbox.el-checkbox--small .el-checkbox__inner) {
  614. width: 30px; /* 复选框宽度 */
  615. height: 20px; /* 复选框高度 */
  616. }
  617. :deep(.el-checkbox.el-checkbox--small.is-checked .el-checkbox__inner::after) {
  618. transform: scale(1.2) rotate(45deg); /* 调整选中后的对勾大小 */
  619. top: 5%; /* 调整对勾位置 */
  620. left: 40%; /* 调整对勾位置 */
  621. width: 5px; /* 调整对勾宽度 */
  622. height: 9px; /* 调整对勾高度 */
  623. }
  624. /*:deep(.el-table td .cell) {*/
  625. /* line-height: 30px !important;*/
  626. /*}*/
  627. .JKWTree-container {
  628. display: flex;
  629. }
  630. .JKWTree-tree {
  631. /*width: 300px;*/
  632. background-color: #fff;
  633. padding: 10px;
  634. margin-right: 20px;
  635. }
  636. .JKWTree-tree h3 {
  637. font-size: 15px;
  638. font-weight: 700;
  639. margin: 10px 0;
  640. }
  641. .JKWTree-content {
  642. flex: 1;
  643. }
  644. /* 图片上传 */
  645. .upload-box {
  646. width: 200px;
  647. height: 200px;
  648. border: 2px dashed #e2e2e2;
  649. display: flex;
  650. justify-content: center;
  651. align-items: center;
  652. position: relative;
  653. cursor: pointer;
  654. }
  655. .uploaded-image {
  656. width: 100%;
  657. height: 100%;
  658. object-fit: cover;
  659. }
  660. .upload-icon {
  661. font-size: 40px;
  662. color: #c0c4cc;
  663. }
  664. .file-input {
  665. display: none;
  666. }
  667. .el-table .warning-row {
  668. background: oldlace;
  669. }
  670. /* 选中某行时的背景色 */
  671. :deep(.el-table__body tr.current-row) > td {
  672. background: #ff80ff !important;
  673. }
  674. </style>
  675. <style scoped>
  676. :deep(.el-table td .cell) {
  677. line-height: 20px !important;
  678. }
  679. :deep(.el-tabs__header){
  680. margin-bottom: 0;
  681. }
  682. .search{
  683. margin-left: 0px !important;
  684. margin-right: 10px !important;
  685. }
  686. .bt{
  687. margin-left: 2px !important;
  688. padding: 3px !important;
  689. font-size: 12px;
  690. }
  691. .el-tabs__header{
  692. margin: 0px !important;
  693. }
  694. .gva-table-box{
  695. padding: 0px !important;
  696. margin-left: -10px !important;
  697. }
  698. .mab{
  699. margin-bottom: 5px;
  700. }
  701. /* 点击按钮改变颜色 */
  702. .active-button {
  703. background-color: #ff0000;
  704. }
  705. .default-button {
  706. background-color: #808080;
  707. }
  708. /* 搜索样式 */
  709. ::v-deep .el-input__wrapper #searchInput {
  710. font-size: 16px;
  711. }
  712. ::v-deep .el-input__wrapper #jitaihao {
  713. font-size: 18px;
  714. }
  715. ::v-deep .el-input__wrapper #gongxu {
  716. font-size: 18px;
  717. }
  718. ::v-deep .el-input__wrapper #zubie {
  719. font-size: 18px;
  720. }
  721. ::v-deep .el-input__wrapper #renyuan {
  722. font-size: 18px;
  723. }
  724. ::v-deep .el-input__wrapper #shuliang {
  725. font-size: 18px;
  726. color: red;
  727. }
  728. ::v-deep .el-input__wrapper #chima {
  729. font-size: 18px;
  730. }
  731. ::v-deep .el-input__wrapper #sbsl {
  732. font-size: 18px;
  733. color: red;
  734. }
  735. </style>