houdaoshougong.vue 27 KB

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