zongjianbaogong.vue 29 KB

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