baozhuangbaogong.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928
  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. <!-- 尺码列表 -->
  102. <el-table-column
  103. v-for="item in sizeDatas"
  104. :key="item"
  105. align="center"
  106. :label="item"
  107. width="100"
  108. :cell-style="cellStyle"
  109. >
  110. <template v-slot="scope">
  111. <div
  112. :class="{ 'highlight-cell': isCellHighlighted(scope.$index, item) }"
  113. style="margin-left: -5px; width: 80px;"
  114. @click="handleSizeClick(scope.$index, item, scope.row)"
  115. >
  116. {{ scope.row[item] || '—' }}
  117. </div>
  118. </template>
  119. </el-table-column>
  120. <el-table-column align="left" label="数量" prop="数量" width="100"/>
  121. <el-table-column align="left" label="剩余数量" prop="剩余数量" width="85"/>
  122. <el-table-column align="left" label="尾包" prop="尾包" width="60"/>
  123. <el-table-column align="left" label="流水号" prop="serial" width="69"/>
  124. <el-table-column align="left" label="订单款号" prop="款号" width="120"/>
  125. <el-table-column align="left" label="款式" prop="款式" width="100"/>
  126. <el-table-column align="left" label="组别" prop="组别" width="80"/>
  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. warningres('请扫描子订单(条码)后再查看');
  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 = '7'
  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. warningres('未获取到机台')
  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. warningres('请扫描小票二维码')
  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. if(getSpotLists.data.code === 1){
  417. warningres(getSpotLists.msg);
  418. return false;
  419. }
  420. //获取尺码
  421. sizeDatas.splice(0, getSpotLists.data.headers.length, ...getSpotLists.data.headers); //型号数据
  422. if(getSpotLists.data.result.ci_num === 0 || getSpotLists.data.result.ci_num === '0'){
  423. errorres('已上报,无需再次报工')
  424. add_searchInfo.value = ''
  425. }
  426. console.log(getSpotLists)
  427. if(getSpotLists.data === null){
  428. add_searchInfo.value = ''
  429. add_formData['尺码'] = ''
  430. add_formData['总数量'] = ''
  431. add_formData['剩余数量'] = ''
  432. setTimeout(() => {
  433. const inputElement = document.getElementById('searchInput');
  434. if (inputElement) {
  435. inputElement.focus();
  436. }
  437. }, 100);
  438. }
  439. activeButtonValue.value = getSpotLists.data.result.wb
  440. UniqId.value = getSpotLists.data.result.UniqId
  441. _list.value = getSpotLists.data.result
  442. add_formData['尺码'] = getSpotLists.data.result.cm
  443. add_formData['总数量'] = getSpotLists.data.result.sl
  444. add_formData['剩余数量'] = getSpotLists.data.result.ci_num
  445. add_tableData.splice(0,add_tableData.length,...getSpotLists.data.records);
  446. console.log(add_tableData)
  447. //xlsx附件
  448. const searchValue = add_searchInfo.value.split('-')[0];
  449. const jsOrderAttachments = await OrderAttachments({order:searchValue,desc:'技术附件'})
  450. const ddOrderAttachments = await OrderAttachments({order:searchValue,desc:'订单资料附件'})
  451. jstableData.splice(0,jsOrderAttachments.data.length,...jsOrderAttachments.data);
  452. ddtableData.splice(0,ddOrderAttachments.data.length,...ddOrderAttachments.data);
  453. }
  454. //点击显示表格高亮
  455. function isCellHighlighted(rowIndex, item) {
  456. return highlightedCells.value.some(hc => hc.rowIndex === rowIndex && hc.item === item);
  457. console.log(highlightedCells.value)
  458. }
  459. const highlightedCells = ref([]);
  460. const selectedSizes = ref([]);
  461. let _table_row = ref('');
  462. //点击表格行事件
  463. function handleSizeClick(rowIndex, item, row) {
  464. _table_row = row
  465. // 查找当前单元格是否已高亮
  466. const index = highlightedCells.value.findIndex(hc => hc.rowIndex === rowIndex && hc.item === item);
  467. if (index !== -1) {
  468. // 如果已高亮,则移除
  469. highlightedCells.value.splice(index, 1);
  470. } else {
  471. // 如果已经有一个高亮条目,移除第一个高亮条目
  472. if (highlightedCells.value.length > 0) {
  473. highlightedCells.value.splice(0, 1);
  474. }
  475. // 添加新的高亮信息
  476. highlightedCells.value.push({
  477. rowIndex,
  478. item
  479. });
  480. }
  481. let newSizeItem = {
  482. size: item
  483. };
  484. const quantityWithParentheses = row[item];
  485. const match = quantityWithParentheses.match(/^([^()]+)\(([^()]+)\)$/);
  486. if (match) {
  487. // console.log("点击尺码包数据",match)
  488. //获取流水号(包数)
  489. newSizeItem.serial = match[1];
  490. //获取数量
  491. newSizeItem.sl = parseInt(match[2], 10);
  492. const existingIndex = selectedSizes.value.findIndex(s => s.size === item);
  493. if (existingIndex !== -1) {
  494. selectedSizes.value.splice(existingIndex, 1);
  495. }
  496. // 清空 selectedSizes 数组
  497. selectedSizes.value = [];
  498. selectedSizes.value.push(newSizeItem);
  499. } else {
  500. console.error('Invalid match format:', quantityWithParentheses);
  501. }
  502. }
  503. const AttendanceVisible=ref(false)
  504. //清空对象的属性值
  505. const gd_clearFormData = () => {
  506. Object.keys(add_formData).forEach(key => {
  507. add_formData[key] = '';
  508. });
  509. };
  510. const add_Dialogonclick = ref(false)
  511. //获取input事件
  512. function baogongslpd() {
  513. // 将字符串转换为数字
  514. const reportedQuantity = parseInt(add_formData['上报数量'], 10) || 0;
  515. const totalQuantity = parseInt(add_formData['剩余数量'], 10) || 0;
  516. if (reportedQuantity > totalQuantity) {
  517. warningres('上报数量不能大于剩余数量');
  518. add_Dialogonclick.value = false;
  519. }else if(reportedQuantity === ''){
  520. add_Dialogonclick.value = false;
  521. } else {
  522. add_Dialogonclick.value = true;
  523. }
  524. }
  525. const currentSlValue=ref('')
  526. //报工
  527. const add_Dialog = async ()=>{
  528. if(add_formData['机台号'] === '测试机台'){
  529. warningres('测试机台禁止报工')
  530. return;
  531. }
  532. if(add_formData['上报数量'] === ''){
  533. warningres('上报数量为空,请填写上报数量')
  534. return;
  535. }
  536. if(_order.value === ''){
  537. warningres('请重新扫描小票二维码')
  538. return;
  539. }else{
  540. let params ={}
  541. params.code = _code
  542. params.order = _order.value.split(',')[0].split('-')[0]
  543. params.order_id = _order.value.split(',')[0]
  544. params.gx = _gx
  545. params.gxmc = _gxmc
  546. params.cm = _order.value.split(',')[3]
  547. params.sl = _order.value.split(',')[4]
  548. params.sczl_jtbh = add_formData['机台号']
  549. params.sczl_bh = add_formData['组别']
  550. params.wb = _order.value.split(',')[5]
  551. params.sys_id = add_formData['人员']
  552. params.UniqId = UniqId.value
  553. params.s_num = add_formData['上报数量']
  554. params.ci_num = add_formData['剩余数量']
  555. console.log(params)
  556. const cf_gettab = await search(params); // 调用search函数
  557. if (cf_gettab.code === 0) {
  558. add_onSubmit();
  559. add_searchInfo.value = '';
  560. setTimeout(() => {
  561. const inputElement = document.getElementById('searchInput');
  562. if (inputElement) {
  563. inputElement.focus();
  564. }
  565. }, 100);
  566. add_formData['尺码']=''
  567. add_formData['总数量']=''
  568. add_formData['上报数量']=''
  569. add_formData['剩余数量']=''
  570. add_searchInfo.value = ''
  571. successres('报工成功')
  572. }
  573. }
  574. }
  575. //退出
  576. const SubWorkOrderClose = () => {
  577. SubWorkOrderStatusListlog.value = false
  578. }
  579. //单击
  580. const add_tableRowClick = async (row) => {
  581. // 使用 split 方法手动分割字符串
  582. const serialParts = row['serial'].split('('); // 按 '(' 分割
  583. const serial = serialParts[1] ? serialParts[1].split(')')[0] : ''; // 提取括号内的内容,如果没有则返回空字符串
  584. // 根据尾包判断是否为 1 或 0
  585. const tailPackage = row['尾包'] ? 1 : 0;
  586. // 拼接 searchInfo 字符串
  587. const searchInfo = `${row['子订单编号']},${row['组别']},3,${row['尺码']},${row['数量']},${tailPackage},${serial}`;
  588. add_searchInfo.value = searchInfo;
  589. add_formData['尺码'] = row.尺码
  590. add_formData['总数量'] = row.数量
  591. add_formData['剩余数量'] = row.剩余数量
  592. // _order.value = orderString
  593. }
  594. //双击
  595. const add_updateCompanyFunc = async (row) => {
  596. }
  597. //右键
  598. const handleRightClick = async (row) => {
  599. }
  600. //复选框
  601. const add_xpSelectionChange = async (selection) => {
  602. console.log(selection.length)
  603. selectedRows.value = selection;
  604. if (selection.length === 0) {
  605. warningres('请勾选打印的数据')
  606. return false;
  607. }else if(selection.length>0){
  608. allPrintData.value = selection.map((row) => {
  609. let weibao = row['是否尾包'] === '是' ? 1 : 0;
  610. const ewm = `${row['订单子编号']},01,${row['尺码']},${row['数量']},${weibao}`;
  611. return {
  612. emm: ewm,
  613. zddbh: row['子订单编号'],
  614. kh: row['款号'],
  615. pm: row['款式'],
  616. ys: row['颜色'],
  617. cm: row['尺码'],
  618. sl: row['数量'],
  619. zb: row['组别'],
  620. dyrq: currentDates,
  621. wb: row['尾包']
  622. };
  623. });
  624. }else{
  625. allPrintData.value = [];
  626. }
  627. console.log(allPrintData.value)
  628. }
  629. // =========== 删除按钮 ===========
  630. //记录复选框的值
  631. const bgSelection = ref(null)
  632. const baogong_del = () => {
  633. if(bgSelection.value === null || bgSelection.value === ''){
  634. warningres('请选择删除的数据')
  635. }else{
  636. console.log(bgSelection.value)
  637. }
  638. }
  639. // 保存当前选中的行数据
  640. const table_selectrows = ref([]);
  641. // 表格复选框选中变化时触发
  642. const table_SelectionChange = (val) => {
  643. table_selectrows.value = val; // 将选中的行数据保存到 table_selectrows
  644. }
  645. //报工删除
  646. const delall = ref(true)
  647. const Selection = ref('')
  648. const selectionChange = (selection, type) => {
  649. const ids = selection.map(item => {
  650. return item.UniqId
  651. })
  652. Selection.value = ids.join(',')
  653. console.log(Selection.value)
  654. }
  655. const del_delclick = async () => {
  656. console.log(Selection.value)
  657. console.log(add_formData['组别'])
  658. const res1 = await spotcheckdel({UniqId:Selection.value,sys_id:add_formData['组别']})
  659. res1.code === 0 && successres('删除成功')
  660. add_onSubmit()
  661. }
  662. // =========== 分页 ===========
  663. // 分页相关的响应式变量
  664. const page = ref(1)
  665. const total = ref(0)
  666. const pageSize = ref(10)
  667. // 分页
  668. const handleCurrentChange = (val) => {
  669. page.value = val;
  670. _getStaffList();
  671. };
  672. // 修改页面容量 点击多少条/页
  673. const handleSizeChange = (val) => {
  674. page.value = 10;//默认显示
  675. pageSize.value = val;
  676. _getStaffList();
  677. };
  678. // 成功
  679. const successres = (arr) => {
  680. ElMessage({
  681. type: '',
  682. dangerouslyUseHTMLString: true,
  683. // duration: 0, // 不自动关闭
  684. message: `<strong style="font-size: 60px; color: black; background-color: #80FA80; padding: 30px 280px; width: 482px; line-height: 60px; text-align: center; display: block;">${arr}</strong>`,
  685. customClass: 'custom-warning-message'
  686. });
  687. }
  688. // 失败
  689. const errorres = (arr) => {
  690. ElMessage({
  691. type: '',
  692. dangerouslyUseHTMLString: true,
  693. // duration: 0, // 不自动关闭
  694. message: `<strong style="font-size: 60px; color: white; background-color: red; padding: 30px 280px; width: 482px; line-height: 60px; text-align: center; display: block;">${arr}</strong>`,
  695. customClass: 'custom-warning-message'
  696. });
  697. }
  698. // 警告
  699. const warningres = (arr) => {
  700. ElMessage({
  701. type: '',
  702. dangerouslyUseHTMLString: true,
  703. // duration: 0, // 不自动关闭
  704. message: `<strong style="font-size: 60px; color: black; background-color: #f5ff2f; padding: 30px 280px; width: 482px; line-height: 60px; text-align: center; display: block;">${arr}</strong>`,
  705. customClass: 'custom-warning-message'
  706. });
  707. }
  708. </script>
  709. <style scoped>
  710. .form-container {
  711. display: flex;
  712. flex-wrap: wrap;
  713. }
  714. .form-column {
  715. /*flex: 1;*/
  716. margin-right: 15px; /* 调整列之间的间距 */
  717. }
  718. /* 左侧输入框宽度调整 */
  719. .form-column .el-form-item .el-input {
  720. width: 150px; /* 调整左侧输入框的宽度 */
  721. }
  722. /* 媒体查询,根据需要调整断点 */
  723. @media screen and (max-width: 768px) {
  724. .form-column {
  725. flex: 1 0 100%; /* 在小屏幕下变成单列布局 */
  726. margin-right: 0;
  727. }
  728. }
  729. /* 表格复选框大小调整 */
  730. :deep(.el-checkbox.el-checkbox--small .el-checkbox__inner) {
  731. width: 30px; /* 复选框宽度 */
  732. height: 20px; /* 复选框高度 */
  733. }
  734. :deep(.el-checkbox.el-checkbox--small.is-checked .el-checkbox__inner::after) {
  735. transform: scale(1.2) rotate(45deg); /* 调整选中后的对勾大小 */
  736. top: 5%; /* 调整对勾位置 */
  737. left: 40%; /* 调整对勾位置 */
  738. width: 5px; /* 调整对勾宽度 */
  739. height: 9px; /* 调整对勾高度 */
  740. }
  741. /*:deep(.el-table td .cell) {*/
  742. /* line-height: 30px !important;*/
  743. /*}*/
  744. .JKWTree-container {
  745. display: flex;
  746. }
  747. .JKWTree-tree {
  748. /*width: 300px;*/
  749. background-color: #fff;
  750. padding: 10px;
  751. margin-right: 20px;
  752. }
  753. .JKWTree-tree h3 {
  754. font-size: 15px;
  755. font-weight: 700;
  756. margin: 10px 0;
  757. }
  758. .JKWTree-content {
  759. flex: 1;
  760. }
  761. /* 图片上传 */
  762. .upload-box {
  763. width: 200px;
  764. height: 200px;
  765. border: 2px dashed #e2e2e2;
  766. display: flex;
  767. justify-content: center;
  768. align-items: center;
  769. position: relative;
  770. cursor: pointer;
  771. }
  772. .uploaded-image {
  773. width: 100%;
  774. height: 100%;
  775. object-fit: cover;
  776. }
  777. .upload-icon {
  778. font-size: 40px;
  779. color: #c0c4cc;
  780. }
  781. .file-input {
  782. display: none;
  783. }
  784. .el-table .warning-row {
  785. background: oldlace;
  786. }
  787. /* 选中某行时的背景色 */
  788. :deep(.el-table__body tr.current-row) > td {
  789. background: #ff80ff !important;
  790. }
  791. </style>
  792. <style scoped>
  793. :deep(.el-table td .cell) {
  794. line-height: 20px !important;
  795. }
  796. :deep(.el-tabs__header){
  797. margin-bottom: 0;
  798. }
  799. .search{
  800. margin-left: 0px !important;
  801. margin-right: 10px !important;
  802. }
  803. .bt{
  804. margin-left: 2px !important;
  805. padding: 3px !important;
  806. font-size: 12px;
  807. }
  808. .el-tabs__header{
  809. margin: 0px !important;
  810. }
  811. .gva-table-box{
  812. padding: 0px !important;
  813. margin-left: -10px !important;
  814. }
  815. .mab{
  816. margin-bottom: 5px;
  817. }
  818. /* 点击按钮改变颜色 */
  819. .active-button {
  820. background-color: #ff0000;
  821. }
  822. .default-button {
  823. background-color: #808080;
  824. }
  825. /* 搜索样式 */
  826. ::v-deep .el-input__wrapper #searchInput {
  827. font-size: 16px;
  828. }
  829. ::v-deep .el-input__wrapper #inputtext {
  830. font-size: 18px;
  831. }
  832. ::v-deep .el-input__wrapper #jitaihao {
  833. font-size: 18px;
  834. }
  835. ::v-deep .el-input__wrapper #gongxu {
  836. font-size: 18px;
  837. }
  838. ::v-deep .el-input__wrapper #zubie {
  839. font-size: 18px;
  840. }
  841. ::v-deep .el-input__wrapper #renyuan {
  842. font-size: 18px;
  843. }
  844. ::v-deep .el-input__wrapper #shuliang {
  845. font-size: 18px;
  846. color: red;
  847. }
  848. ::v-deep .el-input__wrapper #s_num {
  849. font-size: 18px;
  850. }
  851. ::v-deep .el-input__wrapper #sbsl {
  852. font-size: 18px;
  853. color: red;
  854. }
  855. </style>