houdaoshougong.vue 30 KB

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