baozhuangbaogong.vue 30 KB

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