chafengbaogong.vue 51 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288
  1. <template>
  2. <div>
  3. <layout>
  4. <layout-content >
  5. <div class="gva-table-box">
  6. <h1 style="margin: 0%;margin-bottom: 10px;">车缝完工报工</h1>
  7. <el-row :gutter="24">
  8. <el-input v-model="add_searchInfo" placeholder="请扫描子订单编号" @keyup.enter="add_onSubmit"id="searchInput"
  9. style="width: 220px;height: 50px;margin-left: 10px;"></el-input>
  10. <el-button type="primary" icon="search" @click="add_onSubmit" style="height: 50px;width: 80px;">查询</el-button>
  11. <el-form-item label="机台号:" prop="jitaihao" class="mab" style="font-size: 30px;margin: 10px;" label-width="116px">
  12. <el-input v-model="add_formData['机台号']" readonly style="width: 80px; height: 40px;" id="jitaihao" />
  13. </el-form-item>
  14. <el-form-item label="工序:" prop="gongxu" class="mab" style="font-size: 30px; margin: 10px;" label-width="81px">
  15. <el-input v-model="add_formData['工序']" readonly style="width: 100px; height: 40px;" id="gongxu" />
  16. </el-form-item>
  17. <el-form-item label="组别:" prop="zubie" class="mab" style="font-size: 30px; margin: 10px;" label-width="81px">
  18. <el-input v-model="add_formData['组别']" readonly style="width: 100px; height: 40px;" id="zubie" />
  19. </el-form-item>
  20. <el-form-item label="人员:" prop="renyuan" class="mab" style="font-size: 30px; margin: 10px;" label-width="81px">
  21. <el-input v-model="add_formData['人员']" readonly style="width: 100px; height: 40px;" id="renyuan" />
  22. </el-form-item>
  23. <el-form-item label="是否尾包:" prop="joinDate" style="font-size: 30px;margin-top: 15px;" label-width="150">
  24. <el-button :type="activeButton === 'yes' ? 'info' : 'primary'" @click="setActiveButton('yes')"
  25. :style="activeButton === 'yes' ? activeButtonStyle : defaultButtonStyle"
  26. style="margin-top:-20px;height: 50px;width: 70px;">
  27. <span class="custom-button-text">是</span>
  28. </el-button>
  29. <el-button :type="activeButton === 'no' ? 'info' : 'primary'" @click="setActiveButton('no')"
  30. :style="activeButton === 'no' ? activeButtonStyle : defaultButtonStyle"
  31. style="margin-top:-20px;height: 50px;width: 70px;">
  32. <span class="custom-button-text">否</span>
  33. </el-button>
  34. </el-form-item>
  35. </el-row>
  36. <el-row :gutter="24">
  37. <el-form-item label="尺码" class="mab" prop="keyOrder" label-width="140" style="font-size: 30px;">
  38. <el-input v-model="cmformdata.cm1" id="cm1" readonly style="width: 65px;height: 40px;"/>
  39. <el-input v-model="cmformdata.cm2" id="cm2" readonly style="width: 65px;height: 40px;"/>
  40. <el-input v-model="cmformdata.cm3" id="cm3" readonly style="width: 65px;height: 40px;"/>
  41. <el-input v-model="cmformdata.cm4" id="cm4" readonly style="width: 65px;height: 40px;"/>
  42. <el-input v-model="cmformdata.cm5" id="cm5" readonly style="width: 65px;height: 40px;"/>
  43. <el-input v-model="cmformdata.cm6" id="cm6" readonly style="width: 65px;height: 40px;"/>
  44. <el-input v-model="cmformdata.cm7" id="cm7" readonly style="width: 65px;height: 40px;"/>
  45. <el-input v-model="cmformdata.cm8" id="cm8" readonly style="width: 65px;height: 40px;"/>
  46. <el-input v-model="cmformdata.cm9" id="cm9" readonly style="width: 65px;height: 40px;"/>
  47. <el-input v-model="cmformdata.cm10" id="cm10" readonly style="width: 65px;height: 40px;"/>
  48. <el-input v-model="cmformdata.cm11" id="cm11" readonly style="width: 65px;height: 40px;"/>
  49. </el-form-item>
  50. </el-row>
  51. <el-row :gutter="24">
  52. <el-form-item label="制单数" class="mab" prop="keyOrder" label-width="140" style="font-size: 30px;margin-top: -5px;">
  53. <el-input v-model="zdslformdata.cmsl1" readonly style="width: 65px;height: 40px;" id="zdsc1"/>
  54. <el-input v-model="zdslformdata.cmsl2" readonly style="width: 65px;height: 40px;" id="zdsc2"/>
  55. <el-input v-model="zdslformdata.cmsl3" readonly style="width: 65px;height: 40px;" id="zdsc3"/>
  56. <el-input v-model="zdslformdata.cmsl4" readonly style="width: 65px;height: 40px;" id="zdsc4"/>
  57. <el-input v-model="zdslformdata.cmsl5" readonly style="width: 65px;height: 40px;" id="zdsc5"/>
  58. <el-input v-model="zdslformdata.cmsl6" readonly style="width: 65px;height: 40px;" id="zdsc6"/>
  59. <el-input v-model="zdslformdata.cmsl7" readonly style="width: 65px;height: 40px;" id="zdsc7"/>
  60. <el-input v-model="zdslformdata.cmsl8" readonly style="width: 65px;height: 40px;" id="zdsc8"/>
  61. <el-input v-model="zdslformdata.cmsl9" readonly style="width: 65px;height: 40px;" id="zdsc9"/>
  62. <el-input v-model="zdslformdata.cmsl10" readonly style="width: 65px;height: 40px;" id="zdsc10"/>
  63. <el-input v-model="zdslformdata.zdtotal" readonly style="width: 65px;height: 40px;" id="zdtotal"/>
  64. </el-form-item>
  65. </el-row>
  66. <el-row :gutter="24">
  67. <el-form-item label="实裁数" class="mab" prop="keyOrder" label-width="140" style="font-size: 30px;margin-top: -10px;">
  68. <el-input v-model="scslformdata.scsl1" readonly style="width: 65px;height: 40px;" id="scsl1"/>
  69. <el-input v-model="scslformdata.scsl2" readonly style="width: 65px;height: 40px;" id="scsl2"/>
  70. <el-input v-model="scslformdata.scsl3" readonly style="width: 65px;height: 40px;" id="scsl3"/>
  71. <el-input v-model="scslformdata.scsl4" readonly style="width: 65px;height: 40px;" id="scsl4"/>
  72. <el-input v-model="scslformdata.scsl5" readonly style="width: 65px;height: 40px;" id="scsl5"/>
  73. <el-input v-model="scslformdata.scsl6" readonly style="width: 65px;height: 40px;" id="scsl6"/>
  74. <el-input v-model="scslformdata.scsl7" readonly style="width: 65px;height: 40px;" id="scsl7"/>
  75. <el-input v-model="scslformdata.scsl8" readonly style="width: 65px;height: 40px;" id="scsl8"/>
  76. <el-input v-model="scslformdata.scsl9" readonly style="width: 65px;height: 40px;" id="scsl9"/>
  77. <el-input v-model="scslformdata.scsl10" readonly style="width: 65px;height: 40px;" id="scsl10"/>
  78. <el-input v-model="scslformdata.sctotal" readonly style="width: 65px;height: 40px;" id="sctotal"/>
  79. </el-form-item>
  80. </el-row>
  81. <el-row :gutter="24">
  82. <el-form-item label="上报数量" class="mab" prop="keyOrder" label-width="140" style="font-size: 30px;margin-top: -10px;">
  83. <el-input v-model="slformdata.sl1" :readonly="!zdslformdata.cmsl1" @input="updateTotal" style="width: 65px;height: 40px;" id="sl1" @keydown="handleKeyDown($event, 'sl10', 'sl1', 'sl2')"/>
  84. <el-input v-model="slformdata.sl2" :readonly="!zdslformdata.cmsl2" @input="updateTotal" style="width: 65px;height: 40px;" id="sl2" @keydown="handleKeyDown($event, 'sl1', 'sl2', 'sl3')"/>
  85. <el-input v-model="slformdata.sl3" :readonly="!zdslformdata.cmsl3" @input="updateTotal" style="width: 65px;height: 40px;" id="sl3"@keydown="handleKeyDown($event, 'sl2', 'sl3', 'sl4')"/>
  86. <el-input v-model="slformdata.sl4" :readonly="!zdslformdata.cmsl4" @input="updateTotal" style="width: 65px;height: 40px;" id="sl4"@keydown="handleKeyDown($event, 'sl3', 'sl4', 'sl5')"/>
  87. <el-input v-model="slformdata.sl5" :readonly="!zdslformdata.cmsl5 "@input="updateTotal" style="width: 65px;height: 40px;" id="sl5"@keydown="handleKeyDown($event, 'sl4', 'sl5', 'sl6')"/>
  88. <el-input v-model="slformdata.sl6" :readonly="!zdslformdata.cmsl6" @input="updateTotal" style="width: 65px;height: 40px;" id="sl6"@keydown="handleKeyDown($event, 'sl5', 'sl6', 'sl7')"/>
  89. <el-input v-model="slformdata.sl7" :readonly="!zdslformdata.cmsl7" @input="updateTotal" style="width: 65px;height: 40px;" id="sl7"@keydown="handleKeyDown($event, 'sl6', 'sl7', 'sl8')"/>
  90. <el-input v-model="slformdata.sl8" :readonly="!zdslformdata.cmsl8" @input="updateTotal" style="width: 65px;height: 40px;" id="sl8"@keydown="handleKeyDown($event, 'sl7', 'sl8', 'sl9')"/>
  91. <el-input v-model="slformdata.sl9" :readonly="!zdslformdata.cmsl9" @input="updateTotal" style="width: 65px;height: 40px;" id="sl9"@keydown="handleKeyDown($event, 'sl8', 'sl9', 'sl10')"/>
  92. <el-input v-model="slformdata.sl10" :readonly="!zdslformdata.cmsl10" @input="updateTotal" style="width: 65px;height: 40px;" id="sl10"@keydown="handleKeyDown($event, 'sl9', 'sl10', 'sl1')"/>
  93. <el-input v-model="slformdata.sctotal" readonly style="width: 65px;height: 40px;" id="sctotal"/>
  94. <el-button type="primary" @click="add_Dialog" style="width: 100px;height: 60px;font-size: 20px;margin: -20px 0 0 10px">确认上报</el-button>
  95. <el-button type="primary" @click="add_printxp" style="width: 100px;height: 60px;font-size: 20px;margin: -20px 0 0 10px">打印预览</el-button>
  96. </el-form-item>
  97. </el-row>
  98. <hr>
  99. <el-row :gutter="24" style="margin-bottom: 15px;margin-left: 0px;">
  100. <el-main>
  101. <div @contextmenu.prevent>
  102. <el-table
  103. ref="multipleTableRef"
  104. style="width:100%; height: 40vh"
  105. tooltip-effect="dark"
  106. :row-style="{ height: '40px' }"
  107. :header-cell-style="{ padding: '5px', fontSize: '20px' }"
  108. :cell-style="{ padding: '10px', fontSize: '20px' }"
  109. :header-row-style="{ height: '20px' }"
  110. :data="add_tableData"
  111. border
  112. row-key="ID"
  113. size="small"
  114. highlight-current-row="true"
  115. @row-dblclick="add_updateCompanyFunc"
  116. @row-click="add_tableRowClick"
  117. @row-contextmenu="handleRightClick"
  118. :show-overflow-tooltip="true"
  119. @selection-change="add_xpSelectionChange">
  120. <!-- <el-table-column type="selection" width="50" /> -->
  121. <el-table-column v-slot="scope" align="left" label="操作" width="150">
  122. <el-button type="primary" @click="add_bdprintxp(scope.row)" style="width: 110px; height: 40px; font-size: 20px;">补打小票</el-button>
  123. </el-table-column>
  124. <el-table-column v-slot="scope" align="left" label="报工时间" width="150">
  125. <div style="margin-left: -9px">{{ scope.row.sys_rq }}</div>
  126. </el-table-column>
  127. <el-table-column v-slot="scope" align="left" label="子订单编号" width="110">
  128. <div style="margin-left: -9px">{{ scope.row.子订单编号 }}</div>
  129. </el-table-column>
  130. <el-table-column v-slot="scope" align="left" label="组别" width="80">
  131. <div style="margin-left: -9px">{{ scope.row.组别 }}</div>
  132. </el-table-column>
  133. <el-table-column v-for="item in sizeDatas" :key="item" align="center" :label="item"
  134. :prop="item" width="100" :cell-style="cellStyle">
  135. <template v-slot="scope">
  136. <div :class="{ 'highlight-cell': isCellHighlighted(scope.$index, item) }" style="margin-left: -5px;width: 80px;"
  137. @click="handleSizeClick(scope.$index, item, scope.row)">
  138. {{ scope.row[item] }}
  139. </div>
  140. </template>
  141. </el-table-column>
  142. <el-table-column v-slot="scope" align="left" label="数量" width="70">
  143. <div style="margin-left: -9px">{{ scope.row.数量 }}</div>
  144. </el-table-column>
  145. <el-table-column v-slot="scope" align="left" label="流水号" width="150">
  146. <div>{{ scope.row.serial }}</div>
  147. </el-table-column>
  148. </el-table>
  149. </div>
  150. </el-main>
  151. </el-row>
  152. </div>
  153. <!-- 是否订单尾包确认弹窗 -->
  154. <el-dialog v-model="DialogVisible" title="是否订单尾包" destroy-on-close width="30%" style="top: 20%;">
  155. <h3>请再次确认是否该订单产品已全部报工,该批为订单尾包?</h3>
  156. <div class="dialog-footer" style="text-align: right;">
  157. <el-button @click="confirmDialogVisible">取消</el-button>
  158. <el-button type="primary" @click="handleConfirm">确认</el-button>
  159. </div>
  160. </el-dialog>
  161. </layout-content>
  162. </layout>
  163. </div>
  164. </template>
  165. <script>
  166. export default {
  167. methods: {
  168. handleKeyDown(event, prevId, currentId, nextId) {
  169. const currentElement = document.getElementById(currentId);
  170. const isEmpty = currentElement.value === '';
  171. const atStart = currentElement.selectionStart === 0;
  172. const atEnd = currentElement.selectionStart === currentElement.value.length;
  173. switch (event.keyCode) {
  174. case 13: // Enter
  175. case 40: // 向下箭头
  176. if (nextId) {
  177. document.getElementById(nextId).focus();
  178. }
  179. break;
  180. case 38: // 向上箭头
  181. if (prevId) {
  182. document.getElementById(prevId).focus();
  183. }
  184. break;
  185. case 8: // 删除键
  186. if (prevId && (isEmpty || atStart)) {
  187. document.getElementById(prevId).focus();
  188. }
  189. break;
  190. case 37: // 向左箭头
  191. if (prevId && atStart) {
  192. document.getElementById(prevId).focus();
  193. }
  194. break;
  195. case 39: // 向右箭头
  196. if (nextId && atEnd) {
  197. document.getElementById(nextId).focus();
  198. }
  199. break;
  200. default:
  201. break;
  202. }
  203. },
  204. },
  205. };
  206. </script>
  207. <script setup>
  208. // 全量引入格式化工具 请按需保留
  209. import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
  210. import {hiprint} from "vue-plugin-hiprint";
  211. import {ref, reactive,nextTick,watch, setBlockTracking } from 'vue'
  212. import {getSpotList,search,getTab} from '@/api/mes/job'
  213. import {getMachineMac} from '@/api/jixiaoguanli/jitairibaobiao'
  214. import {getMac} from '@/api/jixiaoguanli/baogong'
  215. import {ElMessage} from "element-plus";
  216. import { get } from 'scriptjs';
  217. defineOptions({name: 'Company'})
  218. // =========== 全局获取当前日期 ===========
  219. // currentDate 年月日 时分秒
  220. // currentDates 年月日
  221. const today = new Date();
  222. const year = today.getFullYear();
  223. const month = String(today.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始,需要补零
  224. const day = String(today.getDate()).padStart(2, '0');
  225. const hours = String(today.getHours()).padStart(2, '0');
  226. const minutes = String(today.getMinutes()).padStart(2, '0');
  227. const seconds = String(today.getSeconds()).padStart(2, '0');
  228. const currentDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  229. const currentDates = `${year}-${month}-${day}`;
  230. //全局获取code,接口接收code
  231. const _code = '车缝'
  232. //全局接口接受的物理地址
  233. const Machine = ref('')
  234. //全局获取UniqId
  235. const UniqId = ref('')
  236. //物理地址获取机台编号
  237. const getMachineMacdata = async () => {
  238. console.log("本页面获取物理地址",Machine.value)
  239. try {
  240. const data = await getMachineMac({sys_sbID:'68-ED-A4-26-60-84'});
  241. if(data.data===null){
  242. ElMessage({
  243. type: 'error',
  244. message: '未获取到机台编号请确认MAC地址或与管理员联系'
  245. })
  246. }else{
  247. add_formData['机台号'] = data.data['机台号']
  248. add_formData['工序'] = data.data['生产工序']
  249. add_formData['组别'] = data.data['组别']
  250. add_formData['人员'] = data.data['组长']
  251. setTimeout(() => {
  252. const inputElement = document.getElementById('searchInput');
  253. if (inputElement) {
  254. inputElement.focus();
  255. }
  256. }, 100); // 延迟100毫秒
  257. }
  258. } catch (error) {
  259. console.error(error)
  260. }
  261. }
  262. //自动获取物理地址
  263. const GetAddr = () => {
  264. var xmlhttp = null;
  265. var res;
  266. if (window.XMLHttpRequest) {
  267. xmlhttp = new XMLHttpRequest();
  268. } else if (window.ActiveXObject) {
  269. xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  270. }
  271. // 2. 设置回调函数
  272. xmlhttp.onreadystatechange = function() {
  273. if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
  274. res = eval('('+xmlhttp.response+')');
  275. let result = ''
  276. for (let i = 0; i < res.macAddress.length; i++) {
  277. if (i % 2 === 0 && i !== 0) {
  278. result += '-' // 根据实际需求修改分隔符
  279. }
  280. result += res.macAddress[i]
  281. }
  282. Machine.value = result
  283. getMachineMacdata(Machine.value)
  284. }
  285. }
  286. // 3. 打开一个连接
  287. xmlhttp.open("get", "http://127.0.0.1:8090/init")
  288. // 5. 发送
  289. xmlhttp.send();
  290. }
  291. getMachineMacdata();
  292. // GetAddr()
  293. // 尺码
  294. const cmformdata = reactive({
  295. cm1:'',
  296. cm2:'',
  297. cm3:'',
  298. cm4:'',
  299. cm5:'',
  300. cm6:'',
  301. cm7:'',
  302. cm8:'',
  303. cm9:'',
  304. cm10:'',
  305. cm11:'合计',
  306. });
  307. // 制单数
  308. const zdslformdata = reactive({
  309. cmsl1:'',
  310. cmsl2:'',
  311. cmsl3:'',
  312. cmsl4:'',
  313. cmsl5:'',
  314. cmsl6:'',
  315. cmsl7:'',
  316. cmsl8:'',
  317. cmsl9:'',
  318. cmsl10:'',
  319. zdtotal:'',
  320. });
  321. // 实裁量
  322. const scslformdata = reactive({
  323. scsl1:'',
  324. scsl2:'',
  325. scsl3:'',
  326. scsl4:'',
  327. scsl5:'',
  328. scsl6:'',
  329. scsl7:'',
  330. scsl8:'',
  331. scsl9:'',
  332. scsl10:'',
  333. sctotal:'',
  334. });
  335. // 数量
  336. const slformdata = reactive({
  337. sl1:'',
  338. sl2:'',
  339. sl3:'',
  340. sl4:'',
  341. sl5:'',
  342. sl6:'',
  343. sl7:'',
  344. sl8:'',
  345. sl9:'',
  346. sl10:'',
  347. sctotal:'',
  348. });
  349. //实裁相加
  350. function updateTotal() {
  351. // 直接指定要累加的属性名
  352. const relevantKeys = ['sl1', 'sl2', 'sl3', 'sl4', 'sl5', 'sl6', 'sl7', 'sl8', 'sl9', 'sl10'];
  353. const values = relevantKeys.map(key => parseInt(slformdata[key], 10) || 0); // 使用 || 0 来处理可能的 NaN 或 undefined/null
  354. slformdata.sctotal = values.reduce((sum, value) => sum + value, 0);
  355. }
  356. //历史记录表格
  357. const add_tableData = reactive([]);
  358. //全局获取颜色款式款号
  359. const _yskskh= ref('')
  360. //全局获取新增流水号
  361. const _serial = ref('')
  362. //全局获取序号
  363. const _serial_num = ref('')
  364. //流水号补零
  365. function padNumber(num, length) {
  366. let str = '' + num;
  367. while (str.length < length) {
  368. str = '0' + str;
  369. }
  370. return str;
  371. }
  372. // 代表扫描两次自动保存
  373. const searcs = ref('')
  374. //尺寸列表
  375. const sizeDatas = reactive([])
  376. //搜索
  377. const add_searchInfo = ref('')
  378. //查询事件
  379. const add_onSubmit = async ()=>{
  380. sizeDatas.length = 0;
  381. add_tableData.length = 0;
  382. if(add_searchInfo.value === '' || add_searchInfo.value === undefined){
  383. const WorkListdata = [];
  384. add_tableData.splice(0,add_tableData.length,...WorkListdata);
  385. ElMessage({type: 'warning',message: '请扫描小票二维码' })
  386. }else{
  387. //获取下面报工历史记录
  388. const getSpotLists = await getSpotList({order:add_searchInfo.value,code:_code,sys_sbID:add_formData['机台号']});
  389. console.log(getSpotLists)
  390. if (!add_searchInfo.value.includes('-') && getSpotLists.data.records.length === 0) {
  391. ElMessage({type: 'warning',message: '未查询到报工历史数据' })
  392. return false;
  393. }
  394. _yskskh.value = getSpotLists.data.list[0] //颜色、款式、款号
  395. _serial.value = getSpotLists.data.serial //流水号
  396. _serial_num.value = getSpotLists.data.serial_num //序号
  397. let number = parseInt(getSpotLists.data.serial_num, 10);
  398. _serial_num.value = number+1,
  399. console.log(_serial_num.value)
  400. //获取尺码、制单数/实裁量上面信息
  401. const keys1 = ['cm1', 'cm2', 'cm3', 'cm4','cm5','cm6','cm7','cm8','cm9','cm10',];
  402. const keys2 = ['cmsl1', 'cmsl2', 'cmsl3', 'cmsl4','cmsl5','cmsl6','cmsl7','cmsl8','cmsl9','cmsl10','zdtotal',];
  403. const keys3 = ['scsl1', 'scsl2', 'scsl3', 'scsl4','scsl5','scsl6','scsl7','scsl8','scsl9','scsl10','sctotal',];
  404. //如果搜索是子订单编号
  405. if(add_searchInfo.value.includes('-')){
  406. for (let key of keys1) {
  407. if (getSpotLists.data.list[0].hasOwnProperty(key)) { // 确保键存在于对象中
  408. cmformdata[key] = getSpotLists.data.list[0][key];
  409. }
  410. }
  411. for (let key of keys2) {
  412. if (getSpotLists.data.list[0].hasOwnProperty(key)) { // 确保键存在于对象中
  413. zdslformdata[key] = getSpotLists.data.list[0][key];
  414. }
  415. }
  416. for (let key of keys3) {
  417. if (getSpotLists.data.list[0].hasOwnProperty(key)) { // 确保键存在于对象中
  418. scslformdata[key] = getSpotLists.data.list[0][key];
  419. }
  420. }
  421. setTimeout(() => {
  422. const inputElement = document.getElementById('sl1');
  423. if (inputElement) {
  424. inputElement.focus();
  425. }
  426. }, 100); // 延迟100毫秒
  427. }else{
  428. for (let key of keys1) {
  429. cmformdata[key] = '';
  430. }
  431. for (let key of keys2) {
  432. zdslformdata[key] = '';
  433. }
  434. }
  435. //历史记录
  436. if(getSpotLists.data.headers){
  437. sizeDatas.splice(0,getSpotLists.data.headers.length,...getSpotLists.data.headers);//型号数据
  438. add_tableData.splice(0,add_tableData.length,...getSpotLists.data.records);//表格数据
  439. }
  440. }
  441. }
  442. const AttendanceVisible=ref(false)
  443. //清空对象的属性值
  444. const gd_clearFormData = () => {
  445. Object.keys(add_formData).forEach(key => {
  446. add_formData[key] = '';
  447. });
  448. };
  449. const add_formData = reactive({
  450. 机台号: '',
  451. 工序: '',
  452. 组别: '',
  453. 人员: '',
  454. 尺码: '',
  455. 数量: '',
  456. 是否订单尾包: '',
  457. });
  458. const currentSlValue = ref('')
  459. //车缝确认上报按钮
  460. const add_Dialog = async ()=>{
  461. sizeDatas.length = 0;
  462. add_tableData.length = 0;
  463. console.log(_serial.value)
  464. if(_serial.value === NaN){
  465. ElMessage({type: 'warning',message: '网络异常.请检查'})
  466. return fasle;
  467. }
  468. if(add_searchInfo.value === ''){
  469. ElMessage({type: 'warning',message: '请扫描子订单编号输入数量后,再进行上报'})
  470. return fasle;
  471. }
  472. let cmArray = [cmformdata.cm1, cmformdata.cm2,cmformdata.cm3,cmformdata.cm4,cmformdata.cm5,cmformdata.cm6,cmformdata.cm7,cmformdata.cm8,cmformdata.cm9,cmformdata.cm10];
  473. let zdsl1Array = [zdslformdata.zdsl1, zdslformdata.zdsl12,zdslformdata.zdsl13,zdslformdata.zdsl14,zdslformdata.zdsl15,zdslformdata.zdsl16,zdslformdata.zdsl17,zdslformdata.zdsl18,zdslformdata.zdsl19,zdslformdata.zdsl110];
  474. let slArray = [slformdata.sl1, slformdata.sl2,slformdata.sl3,slformdata.sl4,slformdata.sl5,slformdata.sl6,slformdata.sl7,slformdata.sl8,slformdata.sl9,slformdata.sl10];
  475. let resultArrays = [];
  476. for (let i = 0; i < slArray.length; i++) {
  477. // 创建一个新数组来存储当前索引下的所有值
  478. let currentValues = [add_formData['机台号'],cmArray[i], zdsl1Array[i], slArray[i]];
  479. // 添加到结果数组中
  480. resultArrays.push(currentValues);
  481. }
  482. let paramsList = []; // 用于存储每个元素的 cm 和 sl
  483. let serialNumber = parseInt(_serial.value, 10);
  484. for (let i = 0; i < resultArrays.length; i++) {
  485. if (slArray[i]) {
  486. let params = {};
  487. params.order_id =add_searchInfo.value;
  488. params.sczl_jtbh = add_formData['机台号'];
  489. params.gxmc = add_formData['工序'];
  490. params.sys_id = add_formData['人员'];
  491. params.wb = add_formData['是否订单尾包'];
  492. params.cm = resultArrays[i][1];
  493. params.sl = resultArrays[i][3];
  494. params.sys_rq =currentDates;
  495. params.code = '车缝';
  496. serialNumber++;
  497. params.serial = padNumber(serialNumber, 3);
  498. params.sczl_bh = add_formData['组别'];
  499. params.serial_num = _serial_num.value;
  500. paramsList.push(params);
  501. }
  502. }
  503. if (paramsList.length === 0) {
  504. ElMessage({ type: 'info', message: '请填写报工尺码数量' });
  505. return;
  506. }
  507. console.log(paramsList)
  508. let allSuccess = true;
  509. for (let i = 0; i < paramsList.length; i++) {
  510. const cf_gettab = await search(paramsList[i]);
  511. if (cf_gettab.code !== 0) {
  512. // ElMessage({ type: 'error', message: '报工失败' });
  513. allSuccess = false;
  514. break; // 如果某个报工失败,则中断循环
  515. }
  516. }
  517. if (allSuccess) {
  518. const lsjltable = await getTab({order_id:add_searchInfo.value,sczl_jtbh:add_formData['机台号']});
  519. const getSpotLists = await getSpotList({order:add_searchInfo.value,code:_code,sys_sbID:add_formData['机台号']});
  520. sizeDatas.splice(0,getSpotLists.data.headers.length,...getSpotLists.data.headers);//型号数据
  521. add_tableData.splice(0,add_tableData.length,...getSpotLists.data.records);//表格数据
  522. add_printxp();
  523. searcs.value = '';
  524. add_searchInfo.value = ''; // 清除选择
  525. ElMessage({ type: 'success', message: '报工成功' });
  526. }
  527. }
  528. // 新增取消
  529. const add_closeDialog = () => {
  530. AttendanceVisible.value = false
  531. };
  532. //是否订单尾包选择是否按钮
  533. const activeButton = ref('no')
  534. add_formData['是否订单尾包']='0'
  535. const DialogVisible = ref(false)
  536. // 定义按钮的默认样式和激活样式
  537. const defaultButtonStyle = {
  538. backgroundColor: '#808080',//用于默认状态
  539. color: 'white',
  540. };
  541. const activeButtonStyle = {
  542. backgroundColor: 'red',//用于选中状态
  543. color: 'white',
  544. };
  545. const setActiveButton = (button) => {
  546. activeButton.value = button;
  547. if (button === 'yes') {
  548. add_formData['是否订单尾包'] = '1';
  549. DialogVisible.value = true;
  550. } else if (button === 'no') {
  551. add_formData['是否订单尾包'] = '0';
  552. DialogVisible.value = false;
  553. }
  554. };
  555. // 确定
  556. const handleConfirm = () => {
  557. add_formData['是否订单尾包'] = '1'
  558. DialogVisible.value = false
  559. };
  560. // 取消
  561. const confirmDialogVisible = () => {
  562. add_formData['是否订单尾包'] = '0'
  563. DialogVisible.value = false
  564. };
  565. // =========== 新增打印小票 ===========
  566. const jsondata ={"panels":[{"index":0,"name":1,"height":296.6,"width":210,"paperHeader":19.5,"paperFooter":832.5,"printElements":[{"options":{"left":226.5,"top":25.5,"height":61.5,"width":349.5,"title":"这是更新后的元素","right":418.9921875,"bottom":397.2421875,"vCenter":313.2421875,"hCenter":366.4921875,"field":"zddbh","coordinateSync":false,"widthHeightSync":false,"hideTitle":true,"fontSize":40,"textContentVerticalAlign":"middle","qrCodeLevel":0},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":0,"top":25.5,"height":60,"width":220.5,"title":"子订单编号:","coordinateSync":false,"widthHeightSync":false,"fontSize":40,"textContentVerticalAlign":"middle","qrCodeLevel":0,"right":187.74375915527344,"bottom":392.25,"vCenter":84.24375915527344,"hCenter":360.75},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":100.5,"top":325.5,"height":60,"width":478.5,"title":"这是更新后的元素","right":372.75,"bottom":386.25,"vCenter":241.5,"hCenter":356.25,"field":"kh","coordinateSync":false,"widthHeightSync":false,"hideTitle":true,"fontSize":40,"textContentVerticalAlign":"middle","qrCodeLevel":0,"qid":"zddbh_1","textContentWrap":"clip"},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":0,"top":325.5,"height":60,"width":100,"title":"款号:","coordinateSync":false,"widthHeightSync":false,"fontSize":40,"textContentVerticalAlign":"middle","qrCodeLevel":0,"right":97,"bottom":361.5,"vCenter":47,"hCenter":331.5},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":421.5,"top":93,"height":159,"width":159,"title":"二维码","qrcodeType":"qrcode","testData":"qrcode","right":577.5,"bottom":251.25,"vCenter":498,"hCenter":171.75,"field":"emm","qrCodeLevel":0,"coordinateSync":false,"widthHeightSync":false,"hideTitle":true},"printElementType":{"title":"二维码","type":"qrcode"}},{"options":{"left":100.5,"top":85.5,"height":60,"width":262.5,"title":"这是更新后的元素","right":374.25,"bottom":143.25,"vCenter":243,"hCenter":113.25,"field":"pm","coordinateSync":false,"widthHeightSync":false,"hideTitle":true,"fontSize":40,"textContentVerticalAlign":"middle","qrCodeLevel":0,"qid":"kh_1"},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":0,"top":85.5,"height":60,"width":100,"title":"品名:","coordinateSync":false,"widthHeightSync":false,"fontSize":40,"textContentVerticalAlign":"middle","qrCodeLevel":0,"right":68.5,"bottom":263.25,"vCenter":18.5,"hCenter":233.25},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":100.5,"top":145.5,"height":60,"width":261,"title":"这是更新后的元素","right":324,"bottom":205.5,"vCenter":218.25,"hCenter":175.5,"field":"ys","coordinateSync":false,"widthHeightSync":false,"hideTitle":true,"fontSize":40,"textContentVerticalAlign":"middle","qrCodeLevel":0,"qid":"kh_2"},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":0,"top":144,"height":60,"width":100,"title":"颜色:","coordinateSync":false,"widthHeightSync":false,"fontSize":40,"textContentVerticalAlign":"middle","qrCodeLevel":0,"right":80.5,"bottom":386.25,"vCenter":30.5,"hCenter":356.25},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":100.5,"top":205.5,"height":60,"width":264,"title":"这是更新后的元素","right":324,"bottom":264.75,"vCenter":218.25,"hCenter":234.75,"field":"cm","coordinateSync":false,"widthHeightSync":false,"hideTitle":true,"fontSize":40,"textContentVerticalAlign":"middle","qrCodeLevel":0,"qid":"kh_3"},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":0,"top":204,"height":60,"width":100,"title":"尺码","coordinateSync":false,"widthHeightSync":false,"fontSize":40,"textContentVerticalAlign":"middle","qrCodeLevel":0,"right":100,"bottom":349.5,"vCenter":50,"hCenter":319.5},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":102,"top":385.5,"height":60,"width":246,"title":"这是更新后的元素","right":385.5,"bottom":388.5,"vCenter":247.5,"hCenter":357.75,"field":"zb","coordinateSync":false,"widthHeightSync":false,"hideTitle":true,"fontSize":40,"textContentVerticalAlign":"middle","qrCodeLevel":0,"qid":"kh_5"},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":0,"top":264,"height":60,"width":100,"title":"数量:","coordinateSync":false,"widthHeightSync":false,"fontSize":40,"textContentVerticalAlign":"middle","qrCodeLevel":0,"right":96.25,"bottom":322.5,"vCenter":46.25,"hCenter":292.5},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":453,"top":385.5,"height":61.5,"width":120,"title":"这是更新后的元素","right":573.75,"bottom":445.5,"vCenter":513.75,"hCenter":414.75,"field":"wb","coordinateSync":false,"widthHeightSync":false,"hideTitle":true,"fontSize":40,"textContentVerticalAlign":"middle","qrCodeLevel":0,"qid":"kh_7"},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":100.5,"top":265.5,"height":61.5,"width":262.5,"title":"这是更新后的元素","right":324.75,"bottom":324.75,"vCenter":219,"hCenter":294,"field":"sl","coordinateSync":false,"widthHeightSync":false,"hideTitle":true,"fontSize":40,"textContentVerticalAlign":"middle","qrCodeLevel":0,"qid":"kh_4"},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":354,"top":385.5,"height":60,"width":100,"title":"尾包:","coordinateSync":false,"widthHeightSync":false,"fontSize":40,"textContentVerticalAlign":"middle","qrCodeLevel":0,"right":440.25,"bottom":445.5,"vCenter":396.75,"hCenter":415.5},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":0,"top":385.5,"height":60,"width":100,"title":"组别:","coordinateSync":false,"widthHeightSync":false,"fontSize":40,"textContentVerticalAlign":"middle","qrCodeLevel":0,"right":100,"bottom":448.5,"vCenter":50,"hCenter":418.5},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":181.5,"top":445.5,"height":61.5,"width":259.5,"title":"这是更新后的元素","right":603,"bottom":505.5,"vCenter":393,"hCenter":474.75,"field":"dyrq","coordinateSync":false,"widthHeightSync":false,"hideTitle":true,"fontSize":40,"textContentVerticalAlign":"middle","qrCodeLevel":0,"qid":"kh_6"},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":0,"top":445.5,"height":60,"width":180,"title":"打印日期:","coordinateSync":false,"widthHeightSync":false,"fontSize":40,"textContentVerticalAlign":"middle","qrCodeLevel":0,"right":168,"bottom":505.5,"vCenter":84,"hCenter":475.5},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":421.5,"top":261,"height":52.5,"width":40.5,"title":"第","right":459,"bottom":313.5,"vCenter":438.75,"hCenter":287.25,"coordinateSync":false,"widthHeightSync":false,"fontSize":40,"textContentVerticalAlign":"middle","qrCodeLevel":0},"printElementType":{"title":"文本","type":"text"}},{"options":{"left":540,"top":261,"height":52.5,"width":40.5,"title":"包","right":577.5,"bottom":312,"vCenter":557.25,"hCenter":285.75,"coordinateSync":false,"widthHeightSync":false,"fontSize":40,"textContentVerticalAlign":"middle","qrCodeLevel":0},"printElementType":{"title":"文本","type":"text"}},{"options":{"left":460.5,"top":261,"height":52.5,"width":79.5,"title":"1000","right":538.5,"bottom":313.5,"vCenter":498.75,"hCenter":287.25,"field":"lsh","coordinateSync":false,"widthHeightSync":false,"hideTitle":true,"fontSize":40,"textAlign":"center","textContentVerticalAlign":"middle","qrCodeLevel":0},"printElementType":{"title":"文本","type":"text"}}],"paperNumberLeft":568.5,"paperNumberTop":330,"paperNumberContinue":true,"watermarkOptions":{"content":"vue-plugin-hiprint","rotate":25,"timestamp":true,"format":"YYYY-MM-DD HH:mm"},"panelLayoutOptions":{}}]}
  567. // 右键点击行时触发
  568. const roww = ref(null)
  569. const selectedRows = ref([]);
  570. const allPrintData = ref([]);
  571. const printdata = ref({});
  572. //单机
  573. const add_tableRowClick = async (row) => {
  574. roww.value = row
  575. }
  576. //双击
  577. const add_updateCompanyFunc = async (row) => {
  578. }
  579. //右键
  580. const handleRightClick = async (row) => {
  581. }
  582. //复选框
  583. const add_xpSelectionChange = async (selection) => {
  584. console.log(selection.length)
  585. selectedRows.value = selection;
  586. if (selection.length === 0) {
  587. ElMessage({type: 'warning', message: '请勾选打印的数据' });
  588. return false;
  589. }else if(selection.length>0){
  590. allPrintData.value = selection.map((row) => {
  591. console.log(111,row)
  592. let weibao = row['是否尾包'] === '是' ? 1 : 0;
  593. const ewm = `${row['订单子编号']},01,${row['尺码']},${row['数量']},${weibao}`;
  594. return {
  595. emm: ewm,
  596. zddbh: row['子订单编号'],
  597. kh: row['款号'],
  598. pm: row['款式'],
  599. ys: row['颜色'],
  600. cm: row['尺码'],
  601. sl: row['数量'],
  602. zb: row['组别'],
  603. dyrq: currentDates,
  604. wb: row['尾包'],
  605. lsh: row['serial']
  606. };
  607. });
  608. }else{
  609. allPrintData.value = [];
  610. }
  611. console.log(allPrintData.value)
  612. }
  613. const selectedSizes = ref([]);
  614. // 存储所有高亮单元格的信息
  615. const highlightedCells = ref([]);
  616. let table_serial = ref('');
  617. let table_order_id = ref('');
  618. let table_kh = ref('');
  619. let table_sczl_jtbh = ref('');
  620. let table_gx = ref('');
  621. let table_wb = ref('');
  622. let table_ks = ref('');
  623. let table_color = ref('');
  624. function handleSizeClick(rowIndex, item, row) {
  625. table_serial = row['serial']
  626. table_order_id = row['子订单编号']
  627. table_sczl_jtbh = row['机台号']
  628. table_gx = row['工序名称']
  629. table_ks = row['款式']
  630. table_wb = row['尾包']
  631. table_color = row['颜色']
  632. table_kh = row['款号']
  633. // 查找当前单元格是否已高亮
  634. const index = highlightedCells.value.findIndex(hc => hc.rowIndex === rowIndex && hc.item === item);
  635. if (index !== -1) {
  636. // 如果已高亮,则移除
  637. highlightedCells.value.splice(index, 1);
  638. } else {
  639. // 否则,添加新的高亮信息
  640. highlightedCells.value.push({ rowIndex, item });
  641. }
  642. let newSizeItem = { size: item };
  643. const quantityWithParentheses = row[item];
  644. const match = quantityWithParentheses.match(/^([^()]+)\(([^()]+)\)$/);
  645. if (match) {
  646. newSizeItem.serial = match[1];
  647. newSizeItem.sl = parseInt(match[2], 10);
  648. const existingIndex = selectedSizes.value.findIndex(s => s.size === item);
  649. if (existingIndex !== -1) {
  650. selectedSizes.value.splice(existingIndex, 1);
  651. }
  652. selectedSizes.value.push(newSizeItem);
  653. } else {
  654. console.error('Invalid match format:', quantityWithParentheses);
  655. }
  656. }
  657. function isCellHighlighted(rowIndex, item) {
  658. return highlightedCells.value.some(hc => hc.rowIndex === rowIndex && hc.item === item);
  659. }
  660. //补打小票
  661. let _table_print = ref([]);
  662. let allParams = [];
  663. const add_bdprintxp = () => {
  664. console.log(selectedSizes.value)
  665. if(selectedSizes.value.length === 0){
  666. ElMessage({type: 'warning', message: '请选择要补打的数量'});
  667. return false;
  668. }
  669. allParams = [];
  670. for (let i = 0; i < selectedSizes.value.length; i++) {
  671. if (selectedSizes.value[i]) {
  672. let params = {};
  673. params.order_id = table_order_id ;
  674. params.kh = table_kh;
  675. params.ks = table_ks;
  676. params.color = table_color;
  677. params.cm = selectedSizes.value[i].size;
  678. params.sl = selectedSizes.value[i].sl;
  679. params.sczl_jtbh = table_sczl_jtbh;
  680. params.sys_rq =currentDate;
  681. params.sys_rq =currentDate;
  682. params.serial = selectedSizes.value[i].serial;
  683. params.wb = table_wb;
  684. allParams.push(params);
  685. _table_print.value = allParams.map((row) => {
  686. let weibao = table_wb === '是' ? '1': '0';
  687. const ewm = `${row['order_id']},${add_formData['机台号']},3,${row['cm']},${row['sl']},${weibao}`;
  688. return {
  689. emm: ewm,
  690. zddbh: row['order_id'],
  691. kh: row['kh'],
  692. pm: row['ks'],
  693. ys: row['color'],
  694. cm: row['cm'],
  695. sl: row['sl'],
  696. zb: row['sczl_jtbh'],
  697. dyrq: currentDates,
  698. wb: table_wb,
  699. lsh:row['serial']
  700. };
  701. });
  702. console.log(_table_print.value)
  703. const hiprintTemplate = new hiprint.PrintTemplate({ template: jsondata });
  704. hiprintTemplate.print(_table_print.value)
  705. }
  706. }
  707. };
  708. const _print = ref('')
  709. // 打印预览
  710. const add_printxp = () => {
  711. let cmArray = [cmformdata.cm1, cmformdata.cm2,cmformdata.cm3,cmformdata.cm4,cmformdata.cm5,cmformdata.cm6,cmformdata.cm7,cmformdata.cm8,cmformdata.cm9,cmformdata.cm10];
  712. let slArray = [slformdata.sl1, slformdata.sl2,slformdata.sl3,slformdata.sl4,slformdata.sl5,slformdata.sl6,slformdata.sl7,slformdata.sl8,slformdata.sl9,slformdata.sl10];
  713. let allParams = []; // 用于存储所有要打印的参数对象
  714. let allParamss = ref([]); // 用于存储所有要打印的参数对象
  715. if (!slArray.some(item => item !== "" && item !== null && item !== undefined)) {
  716. ElMessage({type: 'warning', message: '请填写上报数量后再使用打印功能'});
  717. return;
  718. }else{
  719. let serialNumber = parseInt(_serial.value, 10);
  720. for (let i = 0; i < slArray.length; i++) {
  721. if (slArray[i]) {
  722. let params = {};
  723. serialNumber++
  724. params.serial = padNumber(serialNumber, 3)
  725. params.order_id = add_searchInfo.value ;
  726. params.sczl_jtbh = add_formData['组别'];
  727. params.gx = add_formData['工序'];
  728. params.sys_id = add_formData['人员'];
  729. params.wb = add_formData['是否订单尾包'];
  730. params.cm = cmArray[i];
  731. params.sl = slArray[i];
  732. params.sys_rq =currentDate;
  733. allParams.push(params);
  734. allParamss.value = allParams.map((row) => {
  735. let weibao = add_formData['是否订单尾包'] === '1' ? '是': '否';
  736. //二维码数据:订单子编号,组别,工序(固定),尺码,数量,是否尾包(1代表是0代表否)如2408001-1,CF01,3,10,20,0
  737. const ewm = `${row['order_id']},${add_formData['机台号']},3,${row['cm']},${row['sl']},${add_formData['是否订单尾包']}`;
  738. return {
  739. emm: ewm,
  740. zddbh: row['order_id'],
  741. kh: _yskskh.value['款号'],
  742. pm: _yskskh.value['款式'],
  743. ys: _yskskh.value['颜色'],
  744. cm: row['cm'],
  745. sl: row['sl'],
  746. zb: row['sczl_jtbh'],
  747. dyrq: currentDates,
  748. wb: weibao,
  749. lsh:row['serial']
  750. };
  751. });
  752. // const hiprintTemplate = new hiprint.PrintTemplate({ template: jsondata });
  753. // hiprintTemplate.print2(allParamss.value);
  754. const hiprintTemplate = new hiprint.PrintTemplate({ template: jsondata });
  755. hiprintTemplate.print(allParamss.value)
  756. }
  757. }
  758. // console.log(allParamss.value)
  759. }
  760. };
  761. // =========== 删除按钮 ===========
  762. //记录复选框的值
  763. const bgSelection = ref(null)
  764. const baogong_del = () => {
  765. if(bgSelection.value === null || bgSelection.value === ''){
  766. ElMessage({type: 'warning',message: '请选择删除的数据' })
  767. }else{
  768. console.log(bgSelection.value)
  769. }
  770. }
  771. // 保存当前选中的行数据
  772. const table_selectrows = ref([]);
  773. // 表格复选框选中变化时触发
  774. const table_SelectionChange = (val) => {
  775. table_selectrows.value = val; // 将选中的行数据保存到 table_selectrows
  776. }
  777. // =========== 批量打印小票 ===========
  778. const onxiaopiaoclick = async () => {
  779. if (table_selectrows.value.length === 0) {
  780. ElMessage({type: 'warning', message: '请勾选打印的数据' });
  781. return false;
  782. }
  783. const allPrintData = table_selectrows.value.map((row) => {
  784. let weibao = row['是否尾包'] === '是' ? 1 : 0;
  785. const ewm = `${row['订单子编号']},01,${row['尺码']},${row['数量']},${weibao}`;
  786. return {
  787. emm: ewm,
  788. zddbh: row['订单子编号'],
  789. kh: row['生产款号'],
  790. pm: row['款式'],
  791. ys: row['颜色'],
  792. cm: row['尺码'],
  793. sl: row['报工数量'],
  794. zb: row['组别'],
  795. dyrq: currentDate,
  796. wb: row['是否尾包'],
  797. };
  798. });
  799. // 将所有数据一次性传递给打印模板
  800. const hiprintTemplate = new hiprint.PrintTemplate({ template: jsondata });
  801. hiprintTemplate.print(allPrintData);
  802. }
  803. // // 表格复选框
  804. // const handleSelectionChange = (selection, type) => {
  805. // const ids = selection.map(item => {
  806. // return item.订单子编号
  807. // })
  808. // bgSelection.value = ids.join(',')
  809. // }
  810. // // 表格复选框
  811. // const table_SelectionChange = (val, type) => {
  812. // console.log(val)
  813. // }
  814. // // =========== 补打小票 ===========
  815. // const onxiaopiaoclick = async () => {
  816. // if(row_onclick.value === '' || row_onclick.value === null || row_onclick.value === undefined){
  817. // ElMessage({type: 'warning',message: '请选择一条数据' })
  818. // return false;
  819. // }
  820. // let weibao;
  821. // if (row_onclick.value['是否尾包'] === '是') {
  822. // weibao = 1;
  823. // } else {
  824. // weibao = 0;
  825. // }
  826. // const ewm = `${row_onclick.value['订单子编号']},01,${row_onclick.value['尺码']},${row_onclick.value['数量']},${weibao}`;
  827. // printdata.value = {
  828. // emm: ewm,
  829. // zddbh: row_onclick.value['订单子编号'],
  830. // kh: row_onclick.value['生产款号'],
  831. // pm: row_onclick.value['款式'],
  832. // ys: row_onclick.value['颜色'],
  833. // cm: row_onclick.value['尺码'],
  834. // sl: row_onclick.value['报工数量'],
  835. // zb: row_onclick.value['组别'],
  836. // dyrq: currentDate,
  837. // wb: row_onclick.value['是否尾包'],
  838. // };
  839. // hiprint.init();
  840. // const hiprintTemplate = new hiprint.PrintTemplate({ template: jsondata });
  841. // hiprintTemplate.print(printdata.value);
  842. // }
  843. // =========== 修改 ===========
  844. const dialogFormVisible = ref(false)
  845. const edit_formData = ref({})
  846. // 双击修改
  847. const updateCompanyFunc = async (row) => {
  848. console.log(row)
  849. dialogFormVisible.value = true;
  850. Object.assign(edit_formData.value,row);
  851. edit_formData.value['是否订单尾包'] = row['是否尾包'];
  852. // let code = row['员工编号'];
  853. // const getStaffInfo_data = await getStaffInfo({code:code});
  854. // formDataTest.value = getStaffInfo_data.data;
  855. };
  856. // 弹窗修改确定
  857. const edit_Dialog = async () => {
  858. _ygjbzledit();
  859. }
  860. // 弹窗修改关闭
  861. const edit_closeDialog = () => {
  862. dialogFormVisible.value = false
  863. }
  864. const _ygjbzledit = async ()=>{
  865. // const formattedData = {
  866. // '订单子编号': edit_formData.value['订单子编号'],
  867. // '订单号': edit_formData.value['订单号'],
  868. // '生产款号': edit_formData.value['生产款号'],
  869. // '款式': edit_formData.value['款式'],
  870. // '颜色': edit_formData.value['颜色'],
  871. // '制单总数': edit_formData.value['制单总数'],
  872. // '组别': edit_formData.value['组别'],
  873. // '排产单数': edit_formData.value['排产单数'],
  874. // '尺码': edit_formData.value['尺码'],
  875. // '报工数量': edit_formData.value['报工数量'],
  876. // '是否为尾包': edit_formData.value['是否为尾包'],
  877. // '工序': edit_formData.value['工序'],
  878. // '验片人': edit_formData.value['验片人'],
  879. // '日期': edit_formData.value['日期'],
  880. // };
  881. // try {
  882. // const edid_edit_formData = await 修改接口(formattedData);
  883. // if (edid_edit_formData .code === 0) {
  884. // dialogFormVisible.value = false;
  885. // ElMessage({type: 'success',message: '更新成功'})
  886. // } else {
  887. // ElMessage({ type: 'error',message: '更新失败'})
  888. // }
  889. // } catch (error) {
  890. // console.error(error);
  891. // }
  892. }
  893. // =========== 分页 ===========
  894. // 分页相关的响应式变量
  895. const page = ref(1)
  896. const total = ref(0)
  897. const pageSize = ref(10)
  898. // 分页
  899. const handleCurrentChange = (val) => {
  900. page.value = val;
  901. _getStaffList();
  902. };
  903. // 修改页面容量 点击多少条/页
  904. const handleSizeChange = (val) => {
  905. page.value = 10;//默认显示
  906. pageSize.value = val;
  907. _getStaffList();
  908. };
  909. </script>
  910. <style scoped>
  911. .form-container {
  912. display: flex;
  913. flex-wrap: wrap;
  914. }
  915. .form-column {
  916. /*flex: 1;*/
  917. margin-right: 15px; /* 调整列之间的间距 */
  918. }
  919. /* 左侧输入框宽度调整 */
  920. .form-column .el-form-item .el-input {
  921. width: 150px; /* 调整左侧输入框的宽度 */
  922. }
  923. /* 媒体查询,根据需要调整断点 */
  924. @media screen and (max-width: 768px) {
  925. .form-column {
  926. flex: 1 0 100%; /* 在小屏幕下变成单列布局 */
  927. margin-right: 0;
  928. }
  929. }
  930. /* 表格复选框大小调整 */
  931. :deep(.el-checkbox.el-checkbox--small .el-checkbox__inner) {
  932. width: 30px; /* 复选框宽度 */
  933. height: 20px; /* 复选框高度 */
  934. }
  935. :deep(.el-checkbox.el-checkbox--small.is-checked .el-checkbox__inner::after) {
  936. transform: scale(1.2) rotate(45deg); /* 调整选中后的对勾大小 */
  937. top: 5%; /* 调整对勾位置 */
  938. left: 40%; /* 调整对勾位置 */
  939. width: 5px; /* 调整对勾宽度 */
  940. height: 9px; /* 调整对勾高度 */
  941. }
  942. /*:deep(.el-table td .cell) {*/
  943. /* line-height: 30px !important;*/
  944. /*}*/
  945. .JKWTree-container {
  946. display: flex;
  947. }
  948. .JKWTree-tree {
  949. /*width: 300px;*/
  950. background-color: #fff;
  951. padding: 10px;
  952. margin-right: 20px;
  953. }
  954. .JKWTree-tree h3 {
  955. font-size: 15px;
  956. font-weight: 700;
  957. margin: 10px 0;
  958. }
  959. .JKWTree-content {
  960. flex: 1;
  961. }
  962. /* 图片上传 */
  963. .upload-box {
  964. width: 200px;
  965. height: 200px;
  966. border: 2px dashed #e2e2e2;
  967. display: flex;
  968. justify-content: center;
  969. align-items: center;
  970. position: relative;
  971. cursor: pointer;
  972. }
  973. .uploaded-image {
  974. width: 100%;
  975. height: 100%;
  976. object-fit: cover;
  977. }
  978. .upload-icon {
  979. font-size: 40px;
  980. color: #c0c4cc;
  981. }
  982. .file-input {
  983. display: none;
  984. }
  985. .el-table .warning-row {
  986. background: oldlace;
  987. }
  988. :deep(.el-input .is-disabled .cm_input){
  989. color: red;
  990. }
  991. /* 选中某行时的背景色 */
  992. :deep(.el-table__body tr.current-row) > td {
  993. background: #ff80ff !important;
  994. }
  995. </style>
  996. <style scoped>
  997. :deep(.el-table td .cell) {
  998. line-height: 20px !important;
  999. }
  1000. :deep(.el-tabs__header){
  1001. margin-bottom: 0;
  1002. }
  1003. .search{
  1004. margin-left: 0px !important;
  1005. margin-right: 10px !important;
  1006. }
  1007. .bt{
  1008. margin-left: 2px !important;
  1009. padding: 3px !important;
  1010. font-size: 12px;
  1011. }
  1012. .el-tabs__header{
  1013. margin: 0px !important;
  1014. }
  1015. .gva-table-box{
  1016. max-width: 1400px;
  1017. padding: 0px !important;
  1018. margin-left: -10px !important;
  1019. }
  1020. .mab{
  1021. margin-bottom: 5px;
  1022. }
  1023. /* 点击按钮改变颜色 */
  1024. .active-button {
  1025. background-color: #ff0000;
  1026. }
  1027. .default-button {
  1028. background-color: #808080;
  1029. }
  1030. ::v-deep .el-input_inner {
  1031. font-size: 20px; /* 更改为你想要的字体大小 */
  1032. }
  1033. /* 搜索样式 */
  1034. ::v-deep .el-input__wrapper #searchInput {
  1035. font-size: 16px;
  1036. }
  1037. ::v-deep .el-input__wrapper #jitaihao {
  1038. font-size: 18px;
  1039. }
  1040. ::v-deep .el-input__wrapper #gongxu {
  1041. font-size: 18px;
  1042. }
  1043. ::v-deep .el-input__wrapper #zubie {
  1044. font-size: 18px;
  1045. }
  1046. ::v-deep .el-input__wrapper #renyuan {
  1047. font-size: 18px;
  1048. }
  1049. ::v-deep .el-input__wrapper #shuliang {
  1050. font-size: 18px;
  1051. color: red;
  1052. }
  1053. ::v-deep .el-input__wrapper #chima {
  1054. font-size: 18px;
  1055. }
  1056. /* 尺码 */
  1057. ::v-deep .el-input__wrapper #cm1{
  1058. font-size: 20px;
  1059. }
  1060. ::v-deep .el-input__wrapper #cm2{
  1061. font-size: 20px;
  1062. }
  1063. ::v-deep .el-input__wrapper #cm3{
  1064. font-size: 20px;
  1065. }
  1066. ::v-deep .el-input__wrapper #cm4{
  1067. font-size: 20px;
  1068. }
  1069. ::v-deep .el-input__wrapper #cm5{
  1070. font-size: 20px;
  1071. }
  1072. ::v-deep .el-input__wrapper #cm6{
  1073. font-size: 20px;
  1074. }
  1075. ::v-deep .el-input__wrapper #cm7{
  1076. font-size: 20px;
  1077. }
  1078. ::v-deep .el-input__wrapper #cm8{
  1079. font-size: 20px;
  1080. }
  1081. ::v-deep .el-input__wrapper #cm9{
  1082. font-size: 20px;
  1083. }
  1084. ::v-deep .el-input__wrapper #cm10{
  1085. font-size: 20px;
  1086. }
  1087. ::v-deep .el-input__wrapper #cm11{
  1088. font-size: 20px;
  1089. }
  1090. /* 制单数 */
  1091. ::v-deep .el-input__wrapper #zdsc1{
  1092. font-size: 20px;
  1093. }
  1094. ::v-deep .el-input__wrapper #zdsc2{
  1095. font-size: 20px;
  1096. }
  1097. ::v-deep .el-input__wrapper #zdsc3{
  1098. font-size: 20px;
  1099. }
  1100. ::v-deep .el-input__wrapper #zdsc4{
  1101. font-size: 20px;
  1102. }
  1103. ::v-deep .el-input__wrapper #zdsc5{
  1104. font-size: 20px;
  1105. }
  1106. ::v-deep .el-input__wrapper #zdsc6{
  1107. font-size: 20px;
  1108. }
  1109. ::v-deep .el-input__wrapper #zdsc7{
  1110. font-size: 20px;
  1111. }
  1112. ::v-deep .el-input__wrapper #zdsc8{
  1113. font-size: 20px;
  1114. }
  1115. ::v-deep .el-input__wrapper #zdsc9{
  1116. font-size: 20px;
  1117. }
  1118. ::v-deep .el-input__wrapper #zdsc10{
  1119. font-size: 20px;
  1120. }
  1121. ::v-deep .el-input__wrapper #zdtotal{
  1122. font-size: 20px;
  1123. }
  1124. /* 实裁数 */
  1125. ::v-deep .el-input__wrapper #scsl1{
  1126. font-size: 20px;
  1127. color: red !important;
  1128. }
  1129. ::v-deep .el-input__wrapper #scsl2{
  1130. font-size: 20px;
  1131. color: red !important;
  1132. }
  1133. ::v-deep .el-input__wrapper #scsl3{
  1134. font-size: 20px;
  1135. color: red !important;
  1136. }
  1137. ::v-deep .el-input__wrapper #scsl4{
  1138. font-size: 20px;
  1139. color: red !important;
  1140. }
  1141. ::v-deep .el-input__wrapper #scsl5{
  1142. font-size: 20px;
  1143. color: red !important;
  1144. }
  1145. ::v-deep .el-input__wrapper #scsl6{
  1146. font-size: 20px;
  1147. color: red !important;
  1148. }
  1149. ::v-deep .el-input__wrapper #scsl7{
  1150. font-size: 20px;
  1151. color: red !important;
  1152. }
  1153. ::v-deep .el-input__wrapper #scsl8{
  1154. font-size: 20px;
  1155. color: red !important;
  1156. }
  1157. ::v-deep .el-input__wrapper #scsl9{
  1158. font-size: 20px;
  1159. color: red !important;
  1160. }
  1161. ::v-deep .el-input__wrapper #scsl10{
  1162. font-size: 20px;
  1163. color: red !important;
  1164. }
  1165. ::v-deep .el-input__wrapper #sctotal{
  1166. font-size: 20px;
  1167. color: red !important;
  1168. }
  1169. /* 数量 */
  1170. ::v-deep .el-input__wrapper #sl1{
  1171. font-size: 20px;
  1172. }
  1173. ::v-deep .el-input__wrapper #sl2{
  1174. font-size: 20px;
  1175. }
  1176. ::v-deep .el-input__wrapper #sl3{
  1177. font-size: 20px;
  1178. }
  1179. ::v-deep .el-input__wrapper #sl4{
  1180. font-size: 20px;
  1181. }
  1182. ::v-deep .el-input__wrapper #sl5{
  1183. font-size: 20px;
  1184. }
  1185. ::v-deep .el-input__wrapper #sl6{
  1186. font-size: 20px;
  1187. }
  1188. ::v-deep .el-input__wrapper #sl7{
  1189. font-size: 20px;
  1190. }
  1191. ::v-deep .el-input__wrapper #sl8{
  1192. font-size: 20px;
  1193. }
  1194. ::v-deep .el-input__wrapper #sl9{
  1195. font-size: 20px;
  1196. }
  1197. ::v-deep .el-input__wrapper #sl10{
  1198. font-size: 20px;
  1199. }
  1200. ::v-deep .el-input__wrapper #sctotal{
  1201. font-size: 20px;
  1202. }
  1203. /* 选择历史记录改变颜色 */
  1204. .highlight-cell{
  1205. height: 40px;
  1206. /* 背景 */
  1207. background-color: rgba(190, 79, 79, 0.7) !important;
  1208. /* 使用 Flexbox 布局 */
  1209. display: flex;
  1210. /* 垂直居中 */
  1211. align-items: center;
  1212. /* 水平居中 */
  1213. justify-content: center;
  1214. /* 可选,确保 div 宽度填满单元格 */
  1215. width: 100%;
  1216. /* 可选,确保 padding 和 border 不会增加 div 的宽度 */
  1217. box-sizing: border-box;
  1218. }
  1219. /* :deep(.el-table__body tr.current-row) > td {
  1220. background: #ff80ff !important;
  1221. } */
  1222. .custom-button-text {
  1223. font-size: 25px; /* 或者你想要的任何大小 */
  1224. }
  1225. </style>