datangbaogong.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803
  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 = '5'
  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. if (data.data === null) {
  255. ElMessage({
  256. type: 'error',
  257. message: '未获取到机台编号请确认MAC地址或与管理员联系'
  258. })
  259. return;
  260. }
  261. add_formData['机台号'] = data.data['机台号']
  262. add_formData['工序'] = data.data['生产工序']
  263. add_formData['组别'] = data.data['组别']
  264. add_formData['人员'] = data.data['组长']
  265. setTimeout(() => {
  266. const inputElement = document.getElementById('searchInput');
  267. if (inputElement) {
  268. inputElement.focus();
  269. }
  270. }, 100); // 延迟100毫秒
  271. } catch (error) {
  272. console.error(error)
  273. }
  274. }
  275. //自动获取物理地址
  276. const GetAddr = () => {
  277. var xmlhttp = null;
  278. var res;
  279. if (window.XMLHttpRequest) {
  280. xmlhttp = new XMLHttpRequest();
  281. } else if (window.ActiveXObject) {
  282. xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  283. }
  284. // 2. 设置回调函数
  285. xmlhttp.onreadystatechange = function() {
  286. if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
  287. res = eval('('+xmlhttp.response+')');
  288. let result = ''
  289. for (let i = 0; i < res.macAddress.length; i++) {
  290. if (i % 2 === 0 && i !== 0) {
  291. result += '-' // 根据实际需求修改分隔符
  292. }
  293. result += res.macAddress[i]
  294. }
  295. Machine.value = result
  296. getMachineMacdata(Machine.value)
  297. }
  298. }
  299. // 3. 打开一个连接
  300. xmlhttp.open("get", "http://127.0.0.1:8090/init")
  301. // 5. 发送
  302. xmlhttp.send();
  303. }
  304. // getMachineMacdata();
  305. GetAddr()
  306. //搜索
  307. const add_searchInfo = ref('')
  308. //表格
  309. const add_tableData = reactive([]);
  310. //尾包选中值
  311. const activeButtonValue = ref('')
  312. //代表扫描两次自动保存
  313. const searcs = ref('')
  314. const _order = ref('')
  315. //技术附件
  316. const jstableData = reactive([])
  317. const _list = ref('')
  318. // 查询按钮
  319. const add_onSubmit = async ()=>{
  320. if(add_formData['机台号'] === ''){
  321. ElMessage({type: 'warning',message: '未获取到机台'})
  322. return false;
  323. }
  324. if(add_searchInfo.value === '' || add_searchInfo.value === undefined){
  325. const WorkListdata = [];
  326. add_tableData.splice(0,add_tableData.length,...WorkListdata);
  327. ElMessage({type: 'warning',message: '请扫描小票二维码' })
  328. return false;
  329. }
  330. setTimeout(() => {
  331. const inputElement = document.getElementById('s_num');
  332. if (inputElement) {
  333. inputElement.focus();
  334. }
  335. }, 100);
  336. _order.value = add_searchInfo.value;
  337. //获取下面报工历史记录
  338. const getSpotLists = await getSpotList({order:add_searchInfo.value,code:_code,sys_sbID:add_formData['机台号']});
  339. console.log(getSpotLists)
  340. if(getSpotLists.data === null){
  341. add_searchInfo.value = ''
  342. add_formData['尺码'] = ''
  343. add_formData['总数量'] = ''
  344. add_formData['剩余数量'] = ''
  345. setTimeout(() => {
  346. const inputElement = document.getElementById('searchInput');
  347. if (inputElement) {
  348. inputElement.focus();
  349. }
  350. }, 100);
  351. }
  352. activeButtonValue.value = getSpotLists.data.result.wb
  353. UniqId.value = getSpotLists.data.result.UniqId
  354. _list.value = getSpotLists.data.result
  355. add_formData['尺码'] = getSpotLists.data.result.cm
  356. add_formData['总数量'] = getSpotLists.data.result.sl
  357. add_formData['剩余数量'] = getSpotLists.data.result.ci_num
  358. add_tableData.splice(0,add_tableData.length,...getSpotLists.data.records);
  359. //技术附件
  360. const searchValue = add_searchInfo.value.split('-')[0];
  361. const jsOrderAttachments = await OrderAttachments({order:searchValue,desc:'技术附件'})
  362. jstableData.splice(0,jsOrderAttachments.data.length,...jsOrderAttachments.data);
  363. }
  364. //技术资料excel展示
  365. const ExcelShow = (row) =>{
  366. console.log("技术资料excel展示")
  367. console.log(row)
  368. if(!row.附件内容) return
  369. $.getScript('/luckysheet/plugins/js/plugin.js', () => {
  370. $script('/luckysheet/luckysheet.umd.js', () => {
  371. function dataURLtoBlob(dataUrl) {
  372. const byteString = atob(dataUrl.split(',')[1]);
  373. const ab = new ArrayBuffer(byteString.length);
  374. const ia = new Uint8Array(ab);
  375. for (let i = 0; i < byteString.length; i++) {
  376. ia[i] = byteString.charCodeAt(i);
  377. }
  378. return new Blob([ab], { type: 'application/octet-stream' });
  379. }
  380. const blob = dataURLtoBlob(row.附件内容);
  381. luckyexcelVisible.value = true
  382. LuckyExcel.transformExcelToLucky(blob, function(exportJson, luckysheetfile){
  383. if(exportJson.sheets==null || exportJson.sheets.length==0){
  384. alert("Failed to read the content of the excel file, currently does not support xls files!");
  385. return;
  386. }
  387. if(luckyExcel) luckyExcel.destroy();
  388. luckysheet.create({
  389. container: 'luckyexcel', //容器的ID
  390. data: exportJson.sheets,
  391. title: exportJson.info.name, // 工作簿名称
  392. lang: "zh", // 设定表格语言 国际化设置,允许设置表格的语言,支持中文("zh")和英文("en")
  393. showtoolbar: false, // 是否显示工具栏
  394. showinfobar: false, // 是否显示顶部信息栏
  395. allowEdit: false, // 是否允许前台编辑
  396. enableAddRow: false, // 允许增加行
  397. enableAddCol: false, // 允许增加列
  398. userInfo: false, // 右上角的用户信息展示样式
  399. showRowBar: false, // 是否显示行号区域
  400. showColumnBar: false, // 是否显示列号区域
  401. sheetFormulaBar: false, // 是否显示公式栏
  402. enableAddBackTop: false,//返回头部按钮
  403. });
  404. luckyExcel = luckysheet;
  405. })
  406. })
  407. })
  408. $('head').append($('<link rel="stylesheet" type="text/css" />').attr('href', '/luckysheet/plugins/css/pluginsCss.css'));
  409. $('head').append($('<link rel="stylesheet" type="text/css" />').attr('href', '/luckysheet/plugins/plugins.css'));
  410. $('head').append($('<link rel="stylesheet" type="text/css" />').attr('href', '/luckysheet/css/luckysheet.css'));
  411. $('head').append($('<link rel="stylesheet" type="text/css" />').attr('href', '/luckysheet/assets/iconfont/iconfont.css'));
  412. }
  413. let luckyExcel = null
  414. const luckyexcelVisible = ref(false)
  415. const luckyexcelCloseDialog = () => {
  416. luckyexcelVisible.value = false
  417. }
  418. const AttendanceVisible=ref(false)
  419. //清空对象的属性值
  420. const gd_clearFormData = () => {
  421. Object.keys(add_formData).forEach(key => {
  422. add_formData[key] = '';
  423. });
  424. };
  425. const add_Dialogonclick = ref(false)
  426. //获取input事件
  427. function baogongslpd() {
  428. // 将字符串转换为数字
  429. const reportedQuantity = parseInt(add_formData['上报数量'], 10) || 0;
  430. const totalQuantity = parseInt(add_formData['剩余数量'], 10) || 0;
  431. if (reportedQuantity > totalQuantity) {
  432. ElMessage({ type: 'warning', message: '上报数量不能大于剩余数量' });
  433. add_Dialogonclick.value = false;
  434. }else if(reportedQuantity === ''){
  435. add_Dialogonclick.value = false;
  436. } else {
  437. add_Dialogonclick.value = true;
  438. }
  439. }
  440. const currentSlValue=ref('')
  441. //报工
  442. const add_Dialog = async ()=>{
  443. console.log(UniqId.value)
  444. if(add_formData['上报数量'] === ''){
  445. ElMessage({type: 'warning',message: '上报数量为空,请填写上报数量'})
  446. return;
  447. }
  448. if(_order.value === ''){
  449. ElMessage({type: 'warning',message: '请重新扫描小票二维码'})
  450. return;
  451. }else{
  452. let params ={}
  453. params.code = _code
  454. params.order = _order.value.split(',')[0].split('-')[0]
  455. params.order_id = _order.value.split(',')[0]
  456. params.gx = _gx
  457. params.gxmc = _gxmc
  458. params.cm = _order.value.split(',')[3]
  459. params.sl = _order.value.split(',')[4]
  460. params.sczl_jtbh = add_formData['机台号']
  461. params.sczl_bh = add_formData['组别']
  462. params.wb = _order.value.split(',')[5]
  463. params.sys_id = add_formData['人员']
  464. params.UniqId = UniqId.value
  465. params.s_num = add_formData['上报数量']
  466. params.ci_num = add_formData['剩余数量']
  467. console.log(params)
  468. // 记录每一次上报数据信息日志
  469. // let datalog = {};
  470. // datalog.code = _code;
  471. // datalog.订单编号 = _list.value.订单编号;
  472. // datalog.子订单编号 = _list.value.order;
  473. // datalog.款号 = _list.value.生产款号;
  474. // datalog.款式 = _list.value.款式;
  475. // datalog.颜色 = _list.value.颜色;
  476. // datalog.上报时间 = currentDate;
  477. // datalog.上报数量 = add_formData['上报数量'];
  478. // // 记录总实裁数
  479. // datalog.sctotal = _list.value.sctotal;
  480. // datalog.zdtotal = _list.value.zdtotal;
  481. // datalog['组别'] = add_formData['组别'];
  482. // console.log(_list)
  483. // console.log(datalog)
  484. // const getTabByGdbhs = await getTabByGdbh(datalog);
  485. // return false;
  486. const cf_gettab = await search(params); // 调用search函数
  487. if (cf_gettab.code === 0) {
  488. // const firstPart = add_searchInfo.value.split(',')[0];
  489. //上报后历史记录表格刷新
  490. const lsjltable = await getTab({order_id:_order.value.split(',')[0],sczl_jtbh:add_formData['机台号']});
  491. add_tableData.splice(0,add_tableData.length,...lsjltable.data.records);
  492. // //上报后刷新表格数据
  493. // const getSpotLists = await getSpotList({order:_order.value.split(',')[0],code:_code,sys_sbID:sys_sbID});
  494. // add_tableData.splice(0,add_tableData.length,...getSpotLists.data.records);
  495. add_searchInfo.value = '';
  496. setTimeout(() => {
  497. const inputElement = document.getElementById('searchInput');
  498. if (inputElement) {
  499. inputElement.focus();
  500. }
  501. }, 100); // 延迟100毫秒
  502. // searcs.value = '';
  503. add_formData['尺码']=''
  504. add_formData['总数量']=''
  505. add_formData['上报数量']=''
  506. add_formData['剩余数量']=''
  507. // searcs.value = 1;
  508. add_searchInfo.value = ''
  509. ElMessage({type: 'success', message: '报工成功'});
  510. }
  511. }
  512. }
  513. const gd_yulan = () => {
  514. if(_order.value === '' || _order.value === null){
  515. ElMessage({type: 'warning',message: '请选择具体的工单后,再操作此功能'})
  516. return false;
  517. }else{
  518. const order = _order.value.split('-')[0]
  519. printPageRef.value.open(order)
  520. }
  521. }
  522. //单击
  523. const add_tableRowClick = async (row) => {
  524. const orderString = `${row['子订单编号']},${row['组别']},3,${row['尺码']},${row['数量']},${row['尾包']}`;
  525. add_formData['尺码'] = row.尺码
  526. add_formData['总数量'] = row.数量
  527. add_formData['剩余数量'] = row.剩余数量
  528. _order.value = orderString
  529. console.log(row)
  530. }
  531. //双击
  532. const add_updateCompanyFunc = async (row) => {
  533. }
  534. //右键
  535. const handleRightClick = async (row) => {
  536. }
  537. //复选框
  538. const add_xpSelectionChange = async (selection) => {
  539. console.log(selection.length)
  540. selectedRows.value = selection;
  541. if (selection.length === 0) {
  542. ElMessage({type: 'warning', message: '请勾选打印的数据' });
  543. return false;
  544. }else if(selection.length>0){
  545. allPrintData.value = selection.map((row) => {
  546. let weibao = row['是否尾包'] === '是' ? 1 : 0;
  547. const ewm = `${row['订单子编号']},01,${row['尺码']},${row['数量']},${weibao}`;
  548. return {
  549. emm: ewm,
  550. zddbh: row['子订单编号'],
  551. kh: row['款号'],
  552. pm: row['款式'],
  553. ys: row['颜色'],
  554. cm: row['尺码'],
  555. sl: row['数量'],
  556. zb: row['组别'],
  557. dyrq: currentDates,
  558. wb: row['尾包']
  559. };
  560. });
  561. }else{
  562. allPrintData.value = [];
  563. }
  564. console.log(allPrintData.value)
  565. }
  566. // =========== 删除按钮 ===========
  567. //记录复选框的值
  568. const bgSelection = ref(null)
  569. const baogong_del = () => {
  570. if(bgSelection.value === null || bgSelection.value === ''){
  571. ElMessage({type: 'warning',message: '请选择删除的数据' })
  572. }else{
  573. console.log(bgSelection.value)
  574. }
  575. }
  576. // 保存当前选中的行数据
  577. const table_selectrows = ref([]);
  578. // 表格复选框选中变化时触发
  579. const table_SelectionChange = (val) => {
  580. table_selectrows.value = val; // 将选中的行数据保存到 table_selectrows
  581. }
  582. // =========== 分页 ===========
  583. // 分页相关的响应式变量
  584. const page = ref(1)
  585. const total = ref(0)
  586. const pageSize = ref(10)
  587. // 分页
  588. const handleCurrentChange = (val) => {
  589. page.value = val;
  590. _getStaffList();
  591. };
  592. // 修改页面容量 点击多少条/页
  593. const handleSizeChange = (val) => {
  594. page.value = 10;//默认显示
  595. pageSize.value = val;
  596. _getStaffList();
  597. };
  598. </script>
  599. <style scoped>
  600. .form-container {
  601. display: flex;
  602. flex-wrap: wrap;
  603. }
  604. .form-column {
  605. /*flex: 1;*/
  606. margin-right: 15px; /* 调整列之间的间距 */
  607. }
  608. /* 左侧输入框宽度调整 */
  609. .form-column .el-form-item .el-input {
  610. width: 150px; /* 调整左侧输入框的宽度 */
  611. }
  612. /* 媒体查询,根据需要调整断点 */
  613. @media screen and (max-width: 768px) {
  614. .form-column {
  615. flex: 1 0 100%; /* 在小屏幕下变成单列布局 */
  616. margin-right: 0;
  617. }
  618. }
  619. /* 表格复选框大小调整 */
  620. :deep(.el-checkbox.el-checkbox--small .el-checkbox__inner) {
  621. width: 30px; /* 复选框宽度 */
  622. height: 20px; /* 复选框高度 */
  623. }
  624. :deep(.el-checkbox.el-checkbox--small.is-checked .el-checkbox__inner::after) {
  625. transform: scale(1.2) rotate(45deg); /* 调整选中后的对勾大小 */
  626. top: 5%; /* 调整对勾位置 */
  627. left: 40%; /* 调整对勾位置 */
  628. width: 5px; /* 调整对勾宽度 */
  629. height: 9px; /* 调整对勾高度 */
  630. }
  631. /*:deep(.el-table td .cell) {*/
  632. /* line-height: 30px !important;*/
  633. /*}*/
  634. .JKWTree-container {
  635. display: flex;
  636. }
  637. .JKWTree-tree {
  638. /*width: 300px;*/
  639. background-color: #fff;
  640. padding: 10px;
  641. margin-right: 20px;
  642. }
  643. .JKWTree-tree h3 {
  644. font-size: 15px;
  645. font-weight: 700;
  646. margin: 10px 0;
  647. }
  648. .JKWTree-content {
  649. flex: 1;
  650. }
  651. /* 图片上传 */
  652. .upload-box {
  653. width: 200px;
  654. height: 200px;
  655. border: 2px dashed #e2e2e2;
  656. display: flex;
  657. justify-content: center;
  658. align-items: center;
  659. position: relative;
  660. cursor: pointer;
  661. }
  662. .uploaded-image {
  663. width: 100%;
  664. height: 100%;
  665. object-fit: cover;
  666. }
  667. .upload-icon {
  668. font-size: 40px;
  669. color: #c0c4cc;
  670. }
  671. .file-input {
  672. display: none;
  673. }
  674. .el-table .warning-row {
  675. background: oldlace;
  676. }
  677. /* 选中某行时的背景色 */
  678. :deep(.el-table__body tr.current-row) > td {
  679. background: #ff80ff !important;
  680. }
  681. </style>
  682. <style scoped>
  683. :deep(.el-table td .cell) {
  684. line-height: 20px !important;
  685. }
  686. :deep(.el-tabs__header){
  687. margin-bottom: 0;
  688. }
  689. .search{
  690. margin-left: 0px !important;
  691. margin-right: 10px !important;
  692. }
  693. .bt{
  694. margin-left: 2px !important;
  695. padding: 3px !important;
  696. font-size: 12px;
  697. }
  698. .el-tabs__header{
  699. margin: 0px !important;
  700. }
  701. .gva-table-box{
  702. padding: 0px !important;
  703. margin-left: -10px !important;
  704. }
  705. .mab{
  706. margin-bottom: 5px;
  707. }
  708. /* 点击按钮改变颜色 */
  709. .active-button {
  710. background-color: #ff0000;
  711. }
  712. .default-button {
  713. background-color: #808080;
  714. }
  715. /* 搜索样式 */
  716. ::v-deep .el-input__wrapper #searchInput {
  717. font-size: 16px;
  718. }
  719. ::v-deep .el-input__wrapper #jitaihao {
  720. font-size: 18px;
  721. }
  722. ::v-deep .el-input__wrapper #gongxu {
  723. font-size: 18px;
  724. }
  725. ::v-deep .el-input__wrapper #zubie {
  726. font-size: 18px;
  727. }
  728. ::v-deep .el-input__wrapper #renyuan {
  729. font-size: 18px;
  730. }
  731. ::v-deep .el-input__wrapper #shuliang {
  732. font-size: 18px;
  733. color: red;
  734. }
  735. ::v-deep .el-input__wrapper #chima {
  736. font-size: 18px;
  737. }
  738. ::v-deep .el-input__wrapper #sbsl {
  739. font-size: 18px;
  740. color: red;
  741. }
  742. </style>