chafengbaogong.vue 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814
  1. <template>
  2. <div>
  3. <layout>
  4. <layout-content >
  5. <el-main>
  6. <div class="gva-table-box">
  7. <h1 style="margin: 0%;margin-bottom: 10px;">车缝完工报工</h1>
  8. <el-row :gutter="24" style="margin-bottom: 15px;">
  9. <el-input v-model="add_searchInfo" placeholder="扫描订单子编号获取订单信息"
  10. @keyup.enter="add_onSubmit"
  11. id="searchInput"
  12. style="width: 230px;margin: 5px;height: 50px;">
  13. </el-input>
  14. <el-button type="primary" icon="search" @click="add_onSubmit" style="margin: 5px;height: 50px;">查询</el-button>
  15. <el-form-item label="机台号:" prop="deliveryDate" class="mab" style="font-size: 30px;margin: 10px;">
  16. <el-input v-model="add_formData['机台号']" style="width: 110px;height: 40px;" id="机台号" />
  17. </el-form-item>
  18. <el-form-item label="工序:" prop="deliveryDate" class="mab"style="font-size: 30px;margin: 10px;" label-width="90">
  19. <el-input v-model="add_formData['工序']" style="width: 110px;height: 40px;" id="工序" />
  20. </el-form-item>
  21. <el-form-item label="组别:" prop="deliveryDate" class="mab" style="font-size: 30px;margin: 10px;" label-width="90">
  22. <el-input v-model="add_formData['组别']" style="width: 110px;height: 40px;" id="组别" />
  23. </el-form-item>
  24. <el-form-item label="人员:" prop="deliveryDate" class="mab" style="font-size: 30px;margin: 10px;" label-width="90">
  25. <el-input v-model="add_formData['人员']" style="width: 110px;height: 40px;" id="人员" />
  26. </el-form-item>
  27. </el-row>
  28. <el-row :gutter="24">
  29. <el-form-item label="是否尾包:" prop="joinDate" style="font-size: 30px;margin: 10px;" label-width="150">
  30. <el-button :type="activeButton === 'yes' ? 'info' : 'primary'" @click="setActiveButton('yes')" :class="{'active-button': activeButton === 'yes', 'default-button': activeButton !== 'yes'}" style="margin-top:-20px;height: 50px;width: 70px;">是</el-button>
  31. <el-button :type="activeButton === 'no' ? 'info' : 'primary'" @click="setActiveButton('no')" :class="{'active-button': activeButton === 'no', 'default-button': activeButton !== 'no'}" style="margin-top:-20px;height: 50px;width: 70px;">否</el-button>
  32. </el-form-item>
  33. </el-row>
  34. <el-row :gutter="24">
  35. <el-form-item label="尺码" class="mab" prop="keyOrder" label-width="220" style="font-size: 30px;margin: 10px;">
  36. <el-input v-model="cmformdata.cm1" disabled style="width: 90px;height: 40px;"/>
  37. <el-input v-model="cmformdata.cm2" disabled style="width: 90px;height: 40px;"/>
  38. <el-input v-model="cmformdata.cm3" disabled style="width: 90px;height: 40px;"/>
  39. <el-input v-model="cmformdata.cm4" disabled style="width: 90px;height: 40px;"/>
  40. <el-input v-model="cmformdata.cm5" disabled style="width: 90px;height: 40px;"/>
  41. <el-input v-model="cmformdata.cm6" disabled style="width: 90px;height: 40px;"/>
  42. <el-input v-model="cmformdata.cm7" disabled style="width: 90px;height: 40px;"/>
  43. <el-input v-model="cmformdata.cm8" disabled style="width: 90px;height: 40px;"/>
  44. <el-input v-model="cmformdata.cm9" disabled style="width: 90px;height: 40px;"/>
  45. <el-input v-model="cmformdata.cm10" disabled style="width: 90px;height: 40px;"/>
  46. <el-input v-model="cmformdata.cm11" disabled style="width: 90px;height: 40px;"/>
  47. </el-form-item>
  48. </el-row>
  49. <el-row :gutter="24">
  50. <el-form-item label="制单数/实裁量" class="mab" prop="keyOrder" label-width="220" style="font-size: 30px;margin: 10px;">
  51. <el-input v-model="zdscformdata.zdsc1" disabled style="width: 90px;height: 40px;" id="zdsc1"/>
  52. <el-input v-model="zdscformdata.zdsc2" disabled style="width: 90px;height: 40px;" id="zdsc2"/>
  53. <el-input v-model="zdscformdata.zdsc3" disabled style="width: 90px;height: 40px;" id="zdsc3"/>
  54. <el-input v-model="zdscformdata.zdsc4" disabled style="width: 90px;height: 40px;" id="zdsc4"/>
  55. <el-input v-model="zdscformdata.zdsc5" disabled style="width: 90px;height: 40px;" id="zdsc5"/>
  56. <el-input v-model="zdscformdata.zdsc6" disabled style="width: 90px;height: 40px;" id="zdsc6"/>
  57. <el-input v-model="zdscformdata.zdsc7" disabled style="width: 90px;height: 40px;" id="zdsc7"/>
  58. <el-input v-model="zdscformdata.zdsc8" disabled style="width: 90px;height: 40px;" id="zdsc8"/>
  59. <el-input v-model="zdscformdata.zdsc9" disabled style="width: 90px;height: 40px;" id="zdsc9"/>
  60. <el-input v-model="zdscformdata.zdsc10" disabled style="width: 90px;height: 40px;" id="zdsc10"/>
  61. <el-input v-model="zdscformdata.zdtotal" disabled style="width: 90px;height: 40px;" id="zdsc11"/>
  62. </el-form-item>
  63. </el-row>
  64. <el-row :gutter="24">
  65. <el-form-item label="数量" class="mab" prop="keyOrder" label-width="220" style="font-size: 30px;margin: 10px;">
  66. <el-input v-model="slformdata.sl1" style="width: 90px;height: 40px;" id="sl1" @keydown="handleKeyDown($event, 'sl10', 'sl1', 'sl2')"/>
  67. <el-input v-model="slformdata.sl2" style="width: 90px;height: 40px;" id="sl2" @keydown="handleKeyDown($event, 'sl1', 'sl2', 'sl3')"/>
  68. <el-input v-model="slformdata.sl3" style="width: 90px;height: 40px;" id="sl3"@keydown="handleKeyDown($event, 'sl2', 'sl3', 'sl4')"/>
  69. <el-input v-model="slformdata.sl4" style="width: 90px;height: 40px;" id="sl4"@keydown="handleKeyDown($event, 'sl3', 'sl4', 'sl5')"/>
  70. <el-input v-model="slformdata.sl5" style="width: 90px;height: 40px;" id="sl5"@keydown="handleKeyDown($event, 'sl4', 'sl5', 'sl6')"/>
  71. <el-input v-model="slformdata.sl6" style="width: 90px;height: 40px;" id="sl6"@keydown="handleKeyDown($event, 'sl5', 'sl6', 'sl7')"/>
  72. <el-input v-model="slformdata.sl7" style="width: 90px;height: 40px;" id="sl7"@keydown="handleKeyDown($event, 'sl6', 'sl7', 'sl8')"/>
  73. <el-input v-model="slformdata.sl8" style="width: 90px;height: 40px;" id="sl8"@keydown="handleKeyDown($event, 'sl7', 'sl8', 'sl9')"/>
  74. <el-input v-model="slformdata.sl9" style="width: 90px;height: 40px;" id="sl9"@keydown="handleKeyDown($event, 'sl8', 'sl9', 'sl10')"/>
  75. <el-input v-model="slformdata.sl10" style="width: 90px;height: 40px;" id="sl10"@keydown="handleKeyDown($event, 'sl9', 'sl10', 'sl1')"/>
  76. <el-input v-model="slformdata.sctotal" disabled style="width: 90px;height: 40px;" id="sctotal"/>
  77. </el-form-item>
  78. </el-row>
  79. <el-row :gutter="24" style="margin-bottom: 15px;margin-left: 0px;">
  80. <div @contextmenu.prevent>
  81. <el-table
  82. ref="multipleTableRef"
  83. style="width: 100%;height: 37vh"
  84. tooltip-effect="dark"
  85. :row-style="{ height: '50px' }" :header-cell-style="{ padding: '5px', fontSize: '20px' }"
  86. :cell-style="{ padding: '10px', fontSize: '20px' }" :header-row-style="{ height: '20px' }"
  87. :data="add_tableData" border row-key="ID" size="small"
  88. highlight-current-row="true"
  89. @row-dblclick="add_updateCompanyFunc" @row-click="add_tableRowClick" @row-contextmenu="handleRightClick"
  90. :show-overflow-tooltip="true" @selection-change="add_xpSelectionChange">
  91. <el-table-column type="selection" width="70" />
  92. <el-table-column sortable align="left" label="订单编号" prop="订单编号" width="140"/>
  93. <el-table-column sortable align="left" label="订单子编号" prop="子订单编号" width="140"/>
  94. <el-table-column sortable align="left" label="生产款号" prop="款号" width="140"/>
  95. <el-table-column sortable align="left" label="款式" prop="款式" width="140"/>
  96. <el-table-column sortable align="left" label="颜色" prop="颜色" width="140"/>
  97. <el-table-column sortable align="left" label="尺码" prop="尺码" width="140"/>
  98. <el-table-column sortable align="left" label="数量" prop="数量" width="140"/>
  99. <el-table-column sortable align="left" label="是否尾包" prop="尾包" width="140"/>
  100. <el-table-column sortable align="left" label="组别" prop="组别" width="140"/>
  101. </el-table>
  102. </div>
  103. </el-row>
  104. <div class="dialog-footer" style="text-align: left;margin-right: 60px;">
  105. <el-button type="primary" @click="add_Dialog" style="width: 110px;height: 60px;font-size: 20px;">确认</el-button>
  106. <el-button type="primary" @click="add_bdprintxp" style="width: 110px;height: 60px;font-size: 20px;">补打小票</el-button>
  107. <el-button type="primary" @click="add_printxp" style="width: 110px;height: 60px;font-size: 20px;">打印小票</el-button>
  108. </div>
  109. </div>
  110. <!-- 是否订单尾包确认弹窗 -->
  111. <el-dialog v-model="DialogVisible" title="是否订单尾包" destroy-on-close width="30%" style="top: 20%;">
  112. <h3>请再次确认是否该订单产品已全部报工,该批为订单尾包?</h3>
  113. <div class="dialog-footer" style="text-align: right;">
  114. <el-button @click="confirmDialogVisible">取消</el-button>
  115. <el-button type="primary" @click="handleConfirm">确认</el-button>
  116. </div>
  117. </el-dialog>
  118. </el-main>
  119. </layout-content>
  120. </layout>
  121. </div>
  122. </template>
  123. <script>
  124. export default {
  125. methods: {
  126. handleKeyDown(event, prevId, currentId, nextId) {
  127. const currentElement = document.getElementById(currentId);
  128. const isEmpty = currentElement.value === '';
  129. const atStart = currentElement.selectionStart === 0;
  130. const atEnd = currentElement.selectionStart === currentElement.value.length;
  131. switch (event.keyCode) {
  132. case 13: // Enter
  133. case 40: // 向下箭头
  134. if (nextId) {
  135. document.getElementById(nextId).focus();
  136. }
  137. break;
  138. case 38: // 向上箭头
  139. if (prevId) {
  140. document.getElementById(prevId).focus();
  141. }
  142. break;
  143. case 8: // 删除键
  144. if (prevId && (isEmpty || atStart)) {
  145. document.getElementById(prevId).focus();
  146. }
  147. break;
  148. case 37: // 向左箭头
  149. if (prevId && atStart) {
  150. document.getElementById(prevId).focus();
  151. }
  152. break;
  153. case 39: // 向右箭头
  154. if (nextId && atEnd) {
  155. document.getElementById(nextId).focus();
  156. }
  157. break;
  158. default:
  159. break;
  160. }
  161. },
  162. },
  163. };
  164. </script>
  165. <script setup>
  166. // 全量引入格式化工具 请按需保留
  167. import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
  168. import {hiprint} from "vue-plugin-hiprint";
  169. import {ref, reactive,nextTick,watch, setBlockTracking } from 'vue'
  170. import {getSpotList,search,getMachineMac,getTab} from '@/api/mes/job'
  171. import {ElMessage} from "element-plus";
  172. import { get } from 'scriptjs';
  173. defineOptions({name: 'Company'})
  174. // =========== 全局获取当前日期 ===========
  175. // currentDate 年月日 时分秒
  176. // currentDates 年月日
  177. const today = new Date();
  178. const year = today.getFullYear();
  179. const month = String(today.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始,需要补零
  180. const day = String(today.getDate()).padStart(2, '0');
  181. const hours = String(today.getHours()).padStart(2, '0');
  182. const minutes = String(today.getMinutes()).padStart(2, '0');
  183. const seconds = String(today.getSeconds()).padStart(2, '0');
  184. const currentDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  185. const currentDates = `${year}-${month}-${day}`;
  186. //物理地址获取机台编号
  187. const getMachineMacdata = async () => {
  188. try {
  189. const Machine = '68-ED-A4-26-60-84'
  190. const data = await getMachineMac({sys_sbID:Machine,code:'车缝'});
  191. add_formData['机台号'] = data.data['机台号']
  192. add_formData['工序'] = data.data['生产工序']
  193. add_formData['组别'] = data.data['组别']
  194. add_formData['人员'] = data.data['组长']
  195. } catch (error) {
  196. console.error(error)
  197. }
  198. }
  199. getMachineMacdata();
  200. // 尺码
  201. const cmformdata = reactive({
  202. cm1:'',
  203. cm2:'',
  204. cm3:'',
  205. cm4:'',
  206. cm5:'',
  207. cm6:'',
  208. cm7:'',
  209. cm8:'',
  210. cm9:'',
  211. cm10:'',
  212. cm11:'合计',
  213. });
  214. // 制单数
  215. const zdscformdata = reactive({
  216. zdsc1:'',
  217. zdsc2:'',
  218. zdsc3:'',
  219. zdsc4:'',
  220. zdsc5:'',
  221. zdsc6:'',
  222. zdsc7:'',
  223. zdsc8:'',
  224. zdsc9:'',
  225. zdsc10:'',
  226. zdtotal:'',
  227. });
  228. // 实裁数
  229. const slformdata = reactive({
  230. sl1:'',
  231. sl2:'',
  232. sl3:'',
  233. sl4:'',
  234. sl5:'',
  235. sl6:'',
  236. sl7:'',
  237. sl8:'',
  238. sl9:'',
  239. sl10:'',
  240. sctotal:'',
  241. });
  242. //点击【查询】按钮
  243. const add_searchInfo = ref('')
  244. const add_tableData = reactive([]);
  245. //全局获取颜色款式款号
  246. const _yskskh= ref('')
  247. const add_onSubmit = async ()=>{
  248. if(add_searchInfo.value === '' || add_searchInfo.value === undefined){
  249. const WorkListdata = [];
  250. add_tableData.splice(0,add_tableData.length,...WorkListdata);
  251. ElMessage({type: 'warning',message: '请扫描小票二维码' })
  252. }else{
  253. const order =add_searchInfo.value;
  254. const sys_sbID = add_formData['机台号']
  255. const getSpotLists = await getSpotList({order:order,code:'车缝',sys_sbID:sys_sbID});
  256. _yskskh.value = getSpotLists.data.list[0]
  257. //获取上面信息
  258. const keys1 = ['cm1', 'cm2', 'cm3', 'cm4','cm5','cm6','cm7','cm8','cm9','cm10',];
  259. const keys2 = ['zdsc1', 'zdsc2', 'zdsc3', 'zdsc4','zdsc5','zdsc6','zdsc7','zdsc8','zdsc9','zdsc10','zdtotal',];
  260. if(order.includes('-')){
  261. for (let key of keys1) {
  262. if (getSpotLists.data.list[0].hasOwnProperty(key)) { // 确保键存在于对象中
  263. cmformdata[key] = getSpotLists.data.list[0][key];
  264. }
  265. }
  266. for (let key of keys2) {
  267. if (getSpotLists.data.list[0].hasOwnProperty(key)) { // 确保键存在于对象中
  268. zdscformdata[key] = getSpotLists.data.list[0][key];
  269. }
  270. }
  271. setTimeout(() => {
  272. const inputElement = document.getElementById('scs1');
  273. if (inputElement) {
  274. inputElement.focus();
  275. }
  276. }, 100); // 延迟100毫秒
  277. }else{
  278. for (let key of keys1) {
  279. cmformdata[key] = '';
  280. }
  281. for (let key of keys2) {
  282. zdscformdata[key] = '';
  283. }
  284. }
  285. //获取下面报工历史记录
  286. add_tableData.splice(0,add_tableData.length,...getSpotLists.data.records);//表格数据
  287. }
  288. }
  289. const AttendanceVisible=ref(false)
  290. //清空对象的属性值
  291. const gd_clearFormData = () => {
  292. Object.keys(add_formData).forEach(key => {
  293. add_formData[key] = '';
  294. });
  295. };
  296. const add_formData = reactive({
  297. 机台号: '',
  298. 工序: '',
  299. 组别: '',
  300. 人员: '',
  301. 尺码: '',
  302. 数量: '',
  303. 是否订单尾包: '',
  304. });
  305. const currentSlValue = ref('')
  306. //车缝确认按钮
  307. const add_Dialog = async ()=>{
  308. if(add_searchInfo.value === ''){
  309. ElMessage({type: 'warning',message: '请勾选具体的出库订单后,再操作此功能'})
  310. }else{
  311. let cmArray = [cmformdata.cm1, cmformdata.cm2,cmformdata.cm3,cmformdata.cm4,cmformdata.cm5,cmformdata.cm6,cmformdata.cm7,cmformdata.cm8,cmformdata.cm9,cmformdata.cm10,];
  312. let zdscArray = [zdscformdata.zdsc1, zdscformdata.zdsc2,zdscformdata.zdsc3,zdscformdata.zdsc4,zdscformdata.zdsc5,zdscformdata.zdsc6,zdscformdata.zdsc7,zdscformdata.zdsc8,zdscformdata.zdsc9,zdscformdata.zdsc10,];
  313. let slArray = [slformdata.sl1, slformdata.sl2,slformdata.sl3,slformdata.sl4,slformdata.sl5,slformdata.sl6,slformdata.sl7,slformdata.sl8,slformdata.sl9,slformdata.sl10,];
  314. let resultArrays = [];
  315. for (let i = 0; i < slArray.length; i++) {
  316. // 创建一个新数组来存储当前索引下的所有值
  317. let currentValues = [add_formData['机台号'],cmArray[i], zdscArray[i], slArray[i]];
  318. // 添加到结果数组中
  319. resultArrays.push(currentValues);
  320. }
  321. let paramsList = []; // 用于存储每个元素的 cm 和 sl
  322. for (let i = 0; i < resultArrays.length; i++) {
  323. if (slArray[i]) {
  324. let params = {};
  325. params.order_id =add_searchInfo.value;
  326. params.sczl_jtbh = add_formData['机台号'];
  327. params.gxmc = add_formData['工序'];
  328. params.sys_id = add_formData['人员'];
  329. params.wb = add_formData['是否订单尾包'];
  330. params.cm = resultArrays[i][1];
  331. params.sl = resultArrays[i][3];
  332. params.sys_rq =currentDates;
  333. params.code = '车缝';
  334. params.sczl_bh = add_formData['组别'];
  335. paramsList.push(params);
  336. }
  337. }
  338. console.log(paramsList)
  339. if (paramsList.length === 0) {
  340. ElMessage({ type: 'info', message: '请填写报告尺码数量' });
  341. return; // 如果没有有效的参数,则提前返回
  342. }
  343. let allSuccess = true;
  344. for (let i = 0; i < paramsList.length; i++) {
  345. const cf_gettab = await search(paramsList[i]);
  346. if (cf_gettab.code !== 0) {
  347. ElMessage({ type: 'error', message: '报工失败' });
  348. allSuccess = false;
  349. break; // 如果某个报工失败,则中断循环
  350. }
  351. }
  352. if (allSuccess) {
  353. const lsjltable = await getTab({order_id:add_searchInfo.value,sczl_jtbh:add_formData['机台号']});
  354. console.log(lsjltable)
  355. add_tableData.splice(0,add_tableData.length,...lsjltable.data.records);
  356. add_searchInfo.value = ''; // 清除选择
  357. ElMessage({ type: 'success', message: '报工成功' });
  358. }
  359. }
  360. }
  361. // 新增取消
  362. const add_closeDialog = () => {
  363. AttendanceVisible.value = false
  364. };
  365. //是否订单尾包选择是否按钮
  366. const activeButton = ref(null)
  367. const DialogVisible = ref(false)
  368. add_formData['是否订单尾包']='0'
  369. const setActiveButton= (button) => {
  370. activeButton.value = button;
  371. if (button === 'yes') {
  372. add_formData['是否订单尾包'] = '1';
  373. DialogVisible.value = true
  374. } else if (button === 'no') {
  375. add_formData['是否订单尾包'] = '0';
  376. DialogVisible.value = false
  377. }
  378. };
  379. // 确定
  380. const handleConfirm = () => {
  381. add_formData['是否订单尾包'] = '1'
  382. DialogVisible.value = false
  383. };
  384. // 取消
  385. const confirmDialogVisible = () => {
  386. add_formData['是否订单尾包'] = '0'
  387. DialogVisible.value = false
  388. };
  389. // =========== 新增打印小票 ===========
  390. 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":363,"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":111,"top":84,"height":60,"width":262.5,"title":"这是更新后的元素","right":373.74609375,"bottom":147.99609375,"vCenter":242.49609375,"hCenter":117.24609375,"field":"kh","coordinateSync":false,"widthHeightSync":false,"hideTitle":true,"fontSize":40,"textContentVerticalAlign":"middle","qrCodeLevel":0,"qid":"zddbh_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":73,"bottom":196.5,"vCenter":23,"hCenter":166.5},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":418.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":111,"top":144,"height":60,"width":262.5,"title":"这是更新后的元素","right":372.75,"bottom":205.5,"vCenter":241.5,"hCenter":175.5,"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":145.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":111,"top":204,"height":60,"width":211.5,"title":"这是更新后的元素","right":322.5,"bottom":267.75,"vCenter":216.75,"hCenter":237,"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":205.5,"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":111,"top":264,"height":60,"width":211.5,"title":"这是更新后的元素","right":315.75,"bottom":333,"vCenter":210,"hCenter":302.25,"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":265.5,"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":111,"top":385.5,"height":60,"width":211.5,"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":325.5,"height":60,"width":100,"title":"数量:","coordinateSync":false,"widthHeightSync":false,"fontSize":40,"textContentVerticalAlign":"middle","qrCodeLevel":0,"right":209.49375915527344,"bottom":705.4968795776367,"vCenter":105.99375915527344,"hCenter":673.9968795776367},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":454.5,"top":382.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":111,"top":324,"height":61.5,"width":211.5,"title":"这是更新后的元素","right":326.25,"bottom":390.75,"vCenter":220.5,"hCenter":360,"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":384,"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":65.25,"bottom":499.5,"vCenter":24,"hCenter":469.5},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":183,"top":444,"height":61.5,"width":420,"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"}}],"paperNumberLeft":568.5,"paperNumberTop":330,"paperNumberContinue":true,"watermarkOptions":{"content":"vue-plugin-hiprint","rotate":25,"timestamp":true,"format":"YYYY-MM-DD HH:mm"},"panelLayoutOptions":{}}]}
  391. // 右键点击行时触发
  392. const roww = ref(null)
  393. const selectedRows = ref([]);
  394. const allPrintData = ref([]);
  395. const printdata = ref({});
  396. //单机
  397. const add_tableRowClick = async (row) => {
  398. roww.value = row
  399. }
  400. //双击
  401. const add_updateCompanyFunc = async (row) => {
  402. }
  403. //右键
  404. const handleRightClick = async (row) => {
  405. }
  406. //复选框
  407. const add_xpSelectionChange = async (selection) => {
  408. console.log(selection.length)
  409. selectedRows.value = selection;
  410. if (selection.length === 0) {
  411. ElMessage({type: 'warning', message: '请勾选打印的数据' });
  412. return false;
  413. }else if(selection.length>0){
  414. allPrintData.value = selection.map((row) => {
  415. let weibao = row['是否尾包'] === '是' ? 1 : 0;
  416. const ewm = `${row['订单子编号']},01,${row['尺码']},${row['数量']},${weibao}`;
  417. return {
  418. emm: ewm,
  419. zddbh: row['子订单编号'],
  420. kh: row['款号'],
  421. pm: row['款式'],
  422. ys: row['颜色'],
  423. cm: row['尺码'],
  424. sl: row['数量'],
  425. zb: row['组别'],
  426. dyrq: currentDates,
  427. wb: row['尾包']
  428. };
  429. });
  430. }else{
  431. allPrintData.value = [];
  432. }
  433. console.log(allPrintData.value)
  434. }
  435. // 补打小票
  436. const add_bdprintxp = () => {
  437. console.log(allPrintData.value)
  438. if (allPrintData.value.length === 0) {
  439. alert('没有选中要打印的数据');
  440. return;
  441. }
  442. const hiprintTemplate = new hiprint.PrintTemplate({ template: jsondata });
  443. hiprintTemplate.print(allPrintData.value);
  444. };
  445. // 打印小票
  446. const add_printxp = () => {
  447. let cmArray = [cmformdata.cm1, cmformdata.cm2,cmformdata.cm3,cmformdata.cm4,cmformdata.cm5,cmformdata.cm6,cmformdata.cm7,cmformdata.cm8,cmformdata.cm9,cmformdata.cm10,];
  448. let slArray = [slformdata.sl1, slformdata.sl2,slformdata.sl3,slformdata.sl4,slformdata.sl5,slformdata.sl6,slformdata.sl7,slformdata.sl8,slformdata.sl9,slformdata.sl10,];
  449. let allParams = []; // 用于存储所有要打印的参数对象
  450. let allParamss = ref([]); // 用于存储所有要打印的参数对象
  451. console.log(slArray)
  452. if (!slArray.some(item => item !== "" && item !== null && item !== undefined)) {
  453. alert('没有填写数量,请填写数量后再使用此功能');
  454. return;
  455. }else{
  456. for (let i = 0; i < slArray.length; i++) {
  457. if (slArray[i]) {
  458. let params = {};
  459. params.order_id =add_searchInfo.value ;
  460. params.sczl_jtbh = add_formData['组别'];
  461. params.gx = add_formData['工序'];
  462. params.sys_id = add_formData['人员'];
  463. params.wb = add_formData['是否订单尾包'];
  464. params.cm = cmArray[i];
  465. params.sl = slArray[i];
  466. params.sys_rq =currentDate ;
  467. allParams.push(params);
  468. // console.log(allParams)
  469. allParamss.value = allParams.map((row) => {
  470. console.log(allParamss)
  471. let weibao = row['wb'] === '是' ? 1 : 0;
  472. //二维码数据:订单子编号,组别,工序(固定),尺码,数量,是否尾包(1代表是0代表否)如2408001-1,CF01,3,10,20,0
  473. const ewm = `${row['order_id']},${add_formData['机台号']},3,${row['cm']},${row['sl']},${weibao}`;
  474. console.log(123)
  475. console.log(_yskskh._value['款号'])
  476. return {
  477. emm: ewm,
  478. zddbh: row['order_id'],
  479. kh: _yskskh._value['款号'],
  480. pm: _yskskh._value['款式'],
  481. ys: _yskskh._value['颜色'],
  482. cm: row['cm'],
  483. sl: row['sl'],
  484. zb: row['sczl_jtbh'],
  485. dyrq: currentDates,
  486. wb: row['wb']
  487. };
  488. });
  489. console.log(allParamss)
  490. const hiprintTemplate = new hiprint.PrintTemplate({ template: jsondata });
  491. hiprintTemplate.print(allParamss.value);
  492. }
  493. }
  494. }
  495. };
  496. // =========== 删除按钮 ===========
  497. //记录复选框的值
  498. const bgSelection = ref(null)
  499. const baogong_del = () => {
  500. if(bgSelection.value === null || bgSelection.value === ''){
  501. ElMessage({type: 'warning',message: '请选择删除的数据' })
  502. }else{
  503. console.log(bgSelection.value)
  504. }
  505. }
  506. // 保存当前选中的行数据
  507. const table_selectrows = ref([]);
  508. // 表格复选框选中变化时触发
  509. const table_SelectionChange = (val) => {
  510. table_selectrows.value = val; // 将选中的行数据保存到 table_selectrows
  511. }
  512. // =========== 批量打印小票 ===========
  513. const onxiaopiaoclick = async () => {
  514. if (table_selectrows.value.length === 0) {
  515. ElMessage({type: 'warning', message: '请勾选打印的数据' });
  516. return false;
  517. }
  518. const allPrintData = table_selectrows.value.map((row) => {
  519. let weibao = row['是否尾包'] === '是' ? 1 : 0;
  520. const ewm = `${row['订单子编号']},01,${row['尺码']},${row['数量']},${weibao}`;
  521. return {
  522. emm: ewm,
  523. zddbh: row['订单子编号'],
  524. kh: row['生产款号'],
  525. pm: row['款式'],
  526. ys: row['颜色'],
  527. cm: row['尺码'],
  528. sl: row['报工数量'],
  529. zb: row['组别'],
  530. dyrq: currentDate,
  531. wb: row['是否尾包'],
  532. };
  533. });
  534. // 将所有数据一次性传递给打印模板
  535. const hiprintTemplate = new hiprint.PrintTemplate({ template: jsondata });
  536. hiprintTemplate.print(allPrintData);
  537. }
  538. // // 表格复选框
  539. // const handleSelectionChange = (selection, type) => {
  540. // const ids = selection.map(item => {
  541. // return item.订单子编号
  542. // })
  543. // bgSelection.value = ids.join(',')
  544. // }
  545. // // 表格复选框
  546. // const table_SelectionChange = (val, type) => {
  547. // console.log(val)
  548. // }
  549. // // =========== 补打小票 ===========
  550. // const onxiaopiaoclick = async () => {
  551. // if(row_onclick.value === '' || row_onclick.value === null || row_onclick.value === undefined){
  552. // ElMessage({type: 'warning',message: '请选择一条数据' })
  553. // return false;
  554. // }
  555. // let weibao;
  556. // if (row_onclick.value['是否尾包'] === '是') {
  557. // weibao = 1;
  558. // } else {
  559. // weibao = 0;
  560. // }
  561. // const ewm = `${row_onclick.value['订单子编号']},01,${row_onclick.value['尺码']},${row_onclick.value['数量']},${weibao}`;
  562. // printdata.value = {
  563. // emm: ewm,
  564. // zddbh: row_onclick.value['订单子编号'],
  565. // kh: row_onclick.value['生产款号'],
  566. // pm: row_onclick.value['款式'],
  567. // ys: row_onclick.value['颜色'],
  568. // cm: row_onclick.value['尺码'],
  569. // sl: row_onclick.value['报工数量'],
  570. // zb: row_onclick.value['组别'],
  571. // dyrq: currentDate,
  572. // wb: row_onclick.value['是否尾包'],
  573. // };
  574. // hiprint.init();
  575. // const hiprintTemplate = new hiprint.PrintTemplate({ template: jsondata });
  576. // hiprintTemplate.print(printdata.value);
  577. // }
  578. // =========== 修改 ===========
  579. const dialogFormVisible = ref(false)
  580. const edit_formData = ref({})
  581. // 双击修改
  582. const updateCompanyFunc = async (row) => {
  583. console.log(row)
  584. dialogFormVisible.value = true;
  585. Object.assign(edit_formData.value,row);
  586. edit_formData.value['是否订单尾包'] = row['是否尾包'];
  587. // let code = row['员工编号'];
  588. // const getStaffInfo_data = await getStaffInfo({code:code});
  589. // formDataTest.value = getStaffInfo_data.data;
  590. };
  591. // 弹窗修改确定
  592. const edit_Dialog = async () => {
  593. _ygjbzledit();
  594. }
  595. // 弹窗修改关闭
  596. const edit_closeDialog = () => {
  597. dialogFormVisible.value = false
  598. }
  599. const _ygjbzledit = async ()=>{
  600. // const formattedData = {
  601. // '订单子编号': edit_formData.value['订单子编号'],
  602. // '订单号': edit_formData.value['订单号'],
  603. // '生产款号': edit_formData.value['生产款号'],
  604. // '款式': edit_formData.value['款式'],
  605. // '颜色': edit_formData.value['颜色'],
  606. // '制单总数': edit_formData.value['制单总数'],
  607. // '组别': edit_formData.value['组别'],
  608. // '排产单数': edit_formData.value['排产单数'],
  609. // '尺码': edit_formData.value['尺码'],
  610. // '报工数量': edit_formData.value['报工数量'],
  611. // '是否为尾包': edit_formData.value['是否为尾包'],
  612. // '工序': edit_formData.value['工序'],
  613. // '验片人': edit_formData.value['验片人'],
  614. // '日期': edit_formData.value['日期'],
  615. // };
  616. // try {
  617. // const edid_edit_formData = await 修改接口(formattedData);
  618. // if (edid_edit_formData .code === 0) {
  619. // dialogFormVisible.value = false;
  620. // ElMessage({type: 'success',message: '更新成功'})
  621. // } else {
  622. // ElMessage({ type: 'error',message: '更新失败'})
  623. // }
  624. // } catch (error) {
  625. // console.error(error);
  626. // }
  627. }
  628. // =========== 分页 ===========
  629. // 分页相关的响应式变量
  630. const page = ref(1)
  631. const total = ref(0)
  632. const pageSize = ref(10)
  633. // 分页
  634. const handleCurrentChange = (val) => {
  635. page.value = val;
  636. _getStaffList();
  637. };
  638. // 修改页面容量 点击多少条/页
  639. const handleSizeChange = (val) => {
  640. page.value = 10;//默认显示
  641. pageSize.value = val;
  642. _getStaffList();
  643. };
  644. </script>
  645. <style scoped>
  646. .form-container {
  647. display: flex;
  648. flex-wrap: wrap;
  649. }
  650. .form-column {
  651. /*flex: 1;*/
  652. margin-right: 15px; /* 调整列之间的间距 */
  653. }
  654. /* 左侧输入框宽度调整 */
  655. .form-column .el-form-item .el-input {
  656. width: 150px; /* 调整左侧输入框的宽度 */
  657. }
  658. /* 媒体查询,根据需要调整断点 */
  659. @media screen and (max-width: 768px) {
  660. .form-column {
  661. flex: 1 0 100%; /* 在小屏幕下变成单列布局 */
  662. margin-right: 0;
  663. }
  664. }
  665. /* 表格复选框大小调整 */
  666. :deep(.el-checkbox.el-checkbox--small .el-checkbox__inner) {
  667. width: 30px; /* 复选框宽度 */
  668. height: 20px; /* 复选框高度 */
  669. }
  670. :deep(.el-checkbox.el-checkbox--small.is-checked .el-checkbox__inner::after) {
  671. transform: scale(1.2) rotate(45deg); /* 调整选中后的对勾大小 */
  672. top: 5%; /* 调整对勾位置 */
  673. left: 40%; /* 调整对勾位置 */
  674. width: 5px; /* 调整对勾宽度 */
  675. height: 9px; /* 调整对勾高度 */
  676. }
  677. /*:deep(.el-table td .cell) {*/
  678. /* line-height: 30px !important;*/
  679. /*}*/
  680. .JKWTree-container {
  681. display: flex;
  682. }
  683. .JKWTree-tree {
  684. /*width: 300px;*/
  685. background-color: #fff;
  686. padding: 10px;
  687. margin-right: 20px;
  688. }
  689. .JKWTree-tree h3 {
  690. font-size: 15px;
  691. font-weight: 700;
  692. margin: 10px 0;
  693. }
  694. .JKWTree-content {
  695. flex: 1;
  696. }
  697. /* 图片上传 */
  698. .upload-box {
  699. width: 200px;
  700. height: 200px;
  701. border: 2px dashed #e2e2e2;
  702. display: flex;
  703. justify-content: center;
  704. align-items: center;
  705. position: relative;
  706. cursor: pointer;
  707. }
  708. .uploaded-image {
  709. width: 100%;
  710. height: 100%;
  711. object-fit: cover;
  712. }
  713. .upload-icon {
  714. font-size: 40px;
  715. color: #c0c4cc;
  716. }
  717. .file-input {
  718. display: none;
  719. }
  720. .el-table .warning-row {
  721. background: oldlace;
  722. }
  723. /* 选中某行时的背景色 */
  724. :deep(.el-table__body tr.current-row) > td {
  725. background: #ff80ff !important;
  726. }
  727. </style>
  728. <style scoped>
  729. :deep(.el-table td .cell) {
  730. line-height: 20px !important;
  731. }
  732. :deep(.el-tabs__header){
  733. margin-bottom: 0;
  734. }
  735. .search{
  736. margin-left: 0px !important;
  737. margin-right: 10px !important;
  738. }
  739. .bt{
  740. margin-left: 2px !important;
  741. padding: 3px !important;
  742. font-size: 12px;
  743. }
  744. .el-tabs__header{
  745. margin: 0px !important;
  746. }
  747. .gva-table-box{
  748. padding: 0px !important;
  749. }
  750. .mab{
  751. margin-bottom: 5px;
  752. }
  753. /* 点击按钮改变颜色 */
  754. .active-button {
  755. background-color: #ff0000;
  756. }
  757. .default-button {
  758. background-color: #808080;
  759. }
  760. </style>