caiqiebaogong.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. <template>
  2. <div>
  3. <layout>
  4. <layout-content >
  5. <div class="gva-table-box">
  6. <h1 style="margin: 0%;margin-bottom: 10px;">裁切完工报工</h1>
  7. <el-row :gutter="24" style="margin-bottom: 5px;">
  8. <el-input v-model="add_searchInfo" placeholder="扫描订单编号获取订单信息"
  9. @keyup.enter="add_onSubmit"
  10. id="searchInput"
  11. style="width: 230px;margin: 5px;height: 50px;">
  12. </el-input>
  13. <el-button type="primary" icon="search" @click="add_onSubmit" style="margin: 5px;height: 50px;">查询</el-button>
  14. </el-row>
  15. <el-row :gutter="24">
  16. <el-form-item label="尺码/制单数合计:" class="mab" prop="keyOrder" label-width="240" style="font-size: 30px;margin: 5px;">
  17. <el-input v-model="cmformdata.cm1" disabled style="width: 90px;height: 40px;"/>
  18. <el-input v-model="cmformdata.cm2" disabled style="width: 90px;height: 40px;"/>
  19. <el-input v-model="cmformdata.cm3" disabled style="width: 90px;height: 40px;"/>
  20. <el-input v-model="cmformdata.cm4" disabled style="width: 90px;height: 40px;"/>
  21. <el-input v-model="cmformdata.cm5" disabled style="width: 90px;height: 40px;"/>
  22. <el-input v-model="cmformdata.cm6" disabled style="width: 90px;height: 40px;"/>
  23. <el-input v-model="cmformdata.cm7" disabled style="width: 90px;height: 40px;"/>
  24. <el-input v-model="cmformdata.cm8" disabled style="width: 90px;height: 40px;"/>
  25. <el-input v-model="cmformdata.cm9" disabled style="width: 90px;height: 40px;"/>
  26. <el-input v-model="cmformdata.cm10" disabled style="width: 90px;height: 40px;"/>
  27. <el-input v-model="cmformdata.cm11" disabled style="width: 90px;height: 40px;"/>
  28. </el-form-item>
  29. </el-row>
  30. <el-row :gutter="24">
  31. <el-form-item label="本次实裁新增:" class="mab" prop="keyOrder" label-width="240" style="font-size: 30px;margin: 5px;">
  32. <el-input v-model="scsformdata.scs1"@input="updateTotal" style="width: 90px;height: 40px;" id="scs1" @keydown="handleKeyDown($event, 'scs10', 'scs1', 'scs2')"/>
  33. <el-input v-model="scsformdata.scs2"@input="updateTotal" style="width: 90px;height: 40px;" id="scs2" @keydown="handleKeyDown($event, 'scs1', 'scs2', 'scs3')"/>
  34. <el-input v-model="scsformdata.scs3"@input="updateTotal" style="width: 90px;height: 40px;" id="scs3"@keydown="handleKeyDown($event, 'scs2', 'scs3', 'scs4')"/>
  35. <el-input v-model="scsformdata.scs4"@input="updateTotal" style="width: 90px;height: 40px;" id="scs4"@keydown="handleKeyDown($event, 'scs3', 'scs4', 'scs5')"/>
  36. <el-input v-model="scsformdata.scs5"@input="updateTotal" style="width: 90px;height: 40px;" id="scs5"@keydown="handleKeyDown($event, 'scs4', 'scs5', 'scs6')"/>
  37. <el-input v-model="scsformdata.scs6"@input="updateTotal" style="width: 90px;height: 40px;" id="scs6"@keydown="handleKeyDown($event, 'scs5', 'scs6', 'scs7')"/>
  38. <el-input v-model="scsformdata.scs7"@input="updateTotal" style="width: 90px;height: 40px;" id="scs7"@keydown="handleKeyDown($event, 'scs6', 'scs7', 'scs8')"/>
  39. <el-input v-model="scsformdata.scs8"@input="updateTotal" style="width: 90px;height: 40px;" id="scs8"@keydown="handleKeyDown($event, 'scs7', 'scs8', 'scs9')"/>
  40. <el-input v-model="scsformdata.scs9"@input="updateTotal" style="width: 90px;height: 40px;" id="scs9"@keydown="handleKeyDown($event, 'scs8', 'scs9', 'scs10')"/>
  41. <el-input v-model="scsformdata.scs10"@input="updateTotal" style="width: 90px;height: 40px;" id="scs10"@keydown="handleKeyDown($event, 'scs9', 'scs10', 'scs1')"/>
  42. <el-input v-model="scsformdata.sctotal" disabled style="width: 90px;height: 40px;" id="sctotal"/>
  43. </el-form-item>
  44. </el-row>
  45. <!-- <el-row :gutter="24">
  46. <el-form-item label="总的制单数合计/总的实裁数累计:" class="mab" prop="keyOrder" label-width="390" style="font-size: 30px;margin:5px;">
  47. <el-input v-model="zdsformdata.zds1" disabled style="width: 90px;height: 40px;" id="zds1"/>
  48. <el-input v-model="zdsformdata.zds2" disabled style="width: 90px;height: 40px;" id="zds2"/>
  49. <el-input v-model="zdsformdata.zds3" disabled style="width: 90px;height: 40px;" id="zds3"/>
  50. <el-input v-model="zdsformdata.zds4" disabled style="width: 90px;height: 40px;" id="zds4"/>
  51. <el-input v-model="zdsformdata.zds5" disabled style="width: 90px;height: 40px;" id="zds5"/>
  52. <el-input v-model="zdsformdata.zds6" disabled style="width: 90px;height: 40px;" id="zds6"/>
  53. <el-input v-model="zdsformdata.zds7" disabled style="width: 90px;height: 40px;" id="zds7"/>
  54. <el-input v-model="zdsformdata.zds8" disabled style="width: 90px;height: 40px;" id="zds8"/>
  55. <el-input v-model="zdsformdata.zds9" disabled style="width: 90px;height: 40px;" id="zds9"/>
  56. <el-input v-model="zdsformdata.zds10" disabled style="width: 90px;height: 40px;" id="zds10"/>
  57. <el-input v-model="zdsformdata.zdtotal" disabled style="width: 90px;height: 40px;" id="zds11"/>
  58. </el-form-item>
  59. </el-row> -->
  60. <el-row :gutter="24" style="margin-bottom: 15px;">
  61. <el-table ref="multipleTable" style="width: 100%;height: 41vh" tooltip-effect="dark"
  62. :row-style="{ height: '50px' }" :header-cell-style="{ padding: '5px', fontSize: '20px' }"
  63. :cell-style="{ padding: '10px', fontSize: '20px' }" :header-row-style="{ height: '20px' }"
  64. :data="add_tableData" border row-key="ID"
  65. size="small"
  66. highlight-current-row="true" @row-dblclick="updateCompanyFunc"
  67. @row-click="tableRowClick" :show-overflow-tooltip="true"
  68. @selection-change="handleSelectionChange">
  69. <!-- <el-table-column type="selection" width="55" /> -->
  70. <el-table-column sortable align="center" label="订单编号" prop="订单编号" width="120"/>
  71. <el-table-column sortable align="left" label="订单子编号" prop="子订单编号" width="130"/>
  72. <el-table-column sortable align="left" label="生产款号" prop="生产款号" width="120" />
  73. <el-table-column sortable align="left" label="款式" prop="款式" width="110" />
  74. <el-table-column sortable align="left" label="颜色" prop="颜色" width="80" />
  75. <el-table-column sortable align="left" label="制单总数" prop="zdtotal" width="110" />
  76. <el-table-column sortable align="left" label="实裁总数" prop="sctotal" width="110" />
  77. <el-table-column sortable align="left" label="单位" prop="单位" width="80" />
  78. <!-- <el-table-column sortable align="left" label="工序" prop="工序" width="80" /> -->
  79. <el-table-column sortable align="left" label="验片人" prop="Sys_id" width="100" />
  80. <el-table-column sortable align="left" label="日期" prop="Sys_rq" width="160" />
  81. </el-table>
  82. </el-row>
  83. <div class="dialog-footer" style="text-align: left;margin-right: 60px;">
  84. <el-button type="primary" @click="add_Dialog" style="width: 110px;height: 60px;font-size: 20px;">确认</el-button>
  85. </div>
  86. </div>
  87. <!-- 是否订单尾包确认弹窗 -->
  88. <el-dialog v-model="DialogVisible" title="是否订单尾包" destroy-on-close width="30%" style="top: 20%;">
  89. <h3>请再次确认是否该订单产品已全部报工,该批为订单尾包?</h3>
  90. <div class="dialog-footer" style="text-align: right;">
  91. <el-button @click="confirmDialogVisible">取消</el-button>
  92. <el-button type="primary" @click="handleConfirm">确认</el-button>
  93. </div>
  94. </el-dialog>
  95. <!-- </el-main> -->
  96. </layout-content>
  97. </layout>
  98. </div>
  99. </template>
  100. <script>
  101. export default {
  102. data() {
  103. return {
  104. dialogFormVisible: false,
  105. formDataTest: {
  106. imageUrl: '' // 添加一个字段来保存上传的图片路径
  107. },
  108. rule: {} // 初始化rule对象
  109. };
  110. },
  111. methods: {
  112. handleKeyDown(event, prevId, currentId, nextId) {
  113. const currentElement = document.getElementById(currentId);
  114. const isEmpty = currentElement.value === '';
  115. const atStart = currentElement.selectionStart === 0;
  116. const atEnd = currentElement.selectionStart === currentElement.value.length;
  117. switch (event.keyCode) {
  118. case 13: // Enter
  119. case 40: // 向下箭头
  120. if (nextId) {
  121. document.getElementById(nextId).focus();
  122. }
  123. break;
  124. case 38: // 向上箭头
  125. if (prevId) {
  126. document.getElementById(prevId).focus();
  127. }
  128. break;
  129. case 8: // 删除键
  130. if (prevId && (isEmpty || atStart)) {
  131. document.getElementById(prevId).focus();
  132. }
  133. break;
  134. case 37: // 向左箭头
  135. if (prevId && atStart) {
  136. document.getElementById(prevId).focus();
  137. }
  138. break;
  139. case 39: // 向右箭头
  140. if (nextId && atEnd) {
  141. document.getElementById(nextId).focus();
  142. }
  143. break;
  144. default:
  145. break;
  146. }
  147. },
  148. },
  149. };
  150. </script>
  151. <script setup>
  152. // 全量引入格式化工具 请按需保留
  153. import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
  154. import {ref, reactive} from 'vue'
  155. import {getSpotList,getInfo} from '@/api/mes/job'
  156. import {ElMessage} from "element-plus";
  157. defineOptions({name: 'Company'})
  158. //
  159. //全局调用获取当前日期
  160. const today = new Date();
  161. const year = today.getFullYear();
  162. const month = String(today.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始,需要补零
  163. const day = String(today.getDate()).padStart(2, '0');
  164. const hours = String(today.getHours()).padStart(2, '0');
  165. const minutes = String(today.getMinutes()).padStart(2, '0');
  166. const seconds = String(today.getSeconds()).padStart(2, '0');
  167. const currentDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  168. const currentDates = `${year}-${month}-${day}`;
  169. const add_searchInfo = ref('')
  170. //清空对象的属性值
  171. const gd_clearFormData = () => {
  172. Object.keys(add_formData).forEach(key => {
  173. add_formData[key] = '';
  174. });
  175. };
  176. // 尺码
  177. const cmformdata = reactive({
  178. cm1:'',
  179. cm2:'',
  180. cm3:'',
  181. cm4:'',
  182. cm5:'',
  183. cm6:'',
  184. cm7:'',
  185. cm8:'',
  186. cm9:'',
  187. cm10:'',
  188. cm11:'合计',
  189. });
  190. // 制单数
  191. const zdsformdata = reactive({
  192. scs1: 0,
  193. scs2: 0,
  194. scs3: 0,
  195. scs4: 0,
  196. scs5: 0,
  197. scs6: 0,
  198. scs7: 0,
  199. scs8: 0,
  200. scs9: 0,
  201. scs10: 0,
  202. sctotal: 0
  203. });
  204. // 实裁数
  205. const scsformdata = reactive({
  206. scs1:'',
  207. scs2:'',
  208. scs3:'',
  209. scs4:'',
  210. scs5:'',
  211. scs6:'',
  212. scs7:'',
  213. scs8:'',
  214. scs9:'',
  215. scs10:'',
  216. sctotal:'',
  217. });
  218. //实采相加
  219. function updateTotal() {
  220. // 直接指定要累加的属性名
  221. const relevantKeys = ['scs1', 'scs2', 'scs3', 'scs4', 'scs5', 'scs6', 'scs7', 'scs8', 'scs9', 'scs10'];
  222. const values = relevantKeys.map(key => parseInt(scsformdata[key], 10) || 0); // 使用 || 0 来处理可能的 NaN 或 undefined/null
  223. scsformdata.sctotal = values.reduce((sum, value) => sum + value, 0);
  224. }
  225. // const sctotal = async ()=>{
  226. // return [
  227. // scsformdata.scs1,
  228. // scsformdata.scs2,
  229. // scsformdata.scs3,
  230. // scsformdata.scs4,
  231. // scsformdata.scs5,
  232. // scsformdata.scs6,
  233. // scsformdata.scs7,
  234. // scsformdata.scs8,
  235. // scsformdata.scs9,
  236. // ].reduce((total, currentValue) => total + currentValue, 0);
  237. // }
  238. const add_tableData = ref([]);
  239. const _order = ref('');
  240. //点击【查询】按钮
  241. const add_onSubmit = async ()=>{
  242. if(add_searchInfo.value === '' || add_searchInfo.value === undefined){
  243. const WorkListdata = [];
  244. add_tableData.splice(0,add_tableData.length,...WorkListdata);
  245. ElMessage({type: 'warning',message: '搜索内容不能为空' })
  246. }else{
  247. const order =add_searchInfo.value;
  248. _order.value =add_searchInfo.value;
  249. const getSpotLists = await getSpotList({order:order,code:'裁切'});
  250. console.log(getSpotLists)
  251. add_tableData.value = getSpotLists.data.data;
  252. const keys1 = ['cm1', 'cm2', 'cm3', 'cm4','cm5','cm6','cm7','cm8','cm9','cm10','cm11',];
  253. // const keys2 = ['zds1', 'zds2', 'zds3', 'zds4','zds5','zds6','zds7','zds8','zds9','zds10','zdtotal',];
  254. if(order.includes('-')){
  255. for (let key of keys1) {
  256. if (getSpotLists.data.list[0].hasOwnProperty(key)) { // 确保键存在于对象中
  257. cmformdata[key] = getSpotLists.data.list[0][key];
  258. }
  259. }
  260. // for (let key of keys2) {
  261. // if (getSpotLists.data.list[0].hasOwnProperty(key)) { // 确保键存在于对象中
  262. // zdsformdata[key] = getSpotLists.data.list[0][key];
  263. // }
  264. // }
  265. setTimeout(() => {
  266. const inputElement = document.getElementById('scs1');
  267. if (inputElement) {
  268. inputElement.focus();
  269. }
  270. }, 100); // 延迟100毫秒
  271. }else{
  272. for (let key of keys1) {
  273. cmformdata[key] = '';
  274. }
  275. for (let key of keys2) {
  276. zdsformdata[key] = '';
  277. }
  278. }
  279. setTimeout(() => {
  280. const inputElement = document.querySelector('#searchInput');
  281. if (inputElement) {
  282. inputElement.focus();
  283. }
  284. }, 100); // 延迟100毫秒
  285. }
  286. };
  287. //复选框选择
  288. const ckSelection = ref('')
  289. const handleSelectionChange = (selection, type) => {
  290. const ids = selection.map(item => {
  291. return item.子订单编号
  292. })
  293. ckSelection.value = ids.join(',')
  294. console.log(ckSelection.value)
  295. }
  296. //确认出库按钮
  297. const add_Dialog = async ()=>{
  298. if(_order.value === ''){
  299. ElMessage({type: 'warning',message: '请扫描子订单后,再操作此功能'})
  300. }else{
  301. if (_order.value.indexOf('-') !== -1) {
  302. let params = {}
  303. for (let i = 1; i <= 10; i++) {
  304. const key = `scs${i}`; // 动态构建键名
  305. if (scsformdata.hasOwnProperty(key)) { // 检查 scsformdata 是否包含该属性
  306. params[key] = scsformdata[key]; // 将属性复制到 params
  307. }
  308. }
  309. params.sctotal = scsformdata['sctotal'];
  310. params.order = _order.value;//子订单编号
  311. params.rq = currentDates;//时间
  312. console.log(params)
  313. //裁切完工报工
  314. const baogong_getInfo = await getInfo(params);
  315. if (baogong_getInfo.code === 0) {
  316. ElMessage({type: 'success',message: '报工成功'});
  317. const getSpotToLists = await getSpotToList();
  318. add_tableData.splice(0,add_tableData.length,...getSpotToLists.data.data);
  319. add_searchInfo.value = ''
  320. } else {
  321. ElMessage({ type: 'error',message: '出库失败'})
  322. }
  323. } else {
  324. ElMessage({type: 'warning',message: '请扫描子订单后,再操作此功能'})
  325. }
  326. }
  327. }
  328. // =========== 分页 ===========
  329. // 分页相关的响应式变量
  330. const page = ref(1)
  331. const total = ref(0)
  332. const pageSize = ref(10)
  333. // 分页
  334. const handleCurrentChange = (val) => {
  335. page.value = val;
  336. _getStaffList();
  337. };
  338. // 修改页面容量 点击多少条/页
  339. const handleSizeChange = (val) => {
  340. page.value = 10;//默认显示
  341. pageSize.value = val;
  342. _getStaffList();
  343. };
  344. </script>
  345. <style scoped>
  346. .form-container {
  347. display: flex;
  348. flex-wrap: wrap;
  349. }
  350. .form-column {
  351. /*flex: 1;*/
  352. margin-right: 15px; /* 调整列之间的间距 */
  353. }
  354. /* 左侧输入框宽度调整 */
  355. .form-column .el-form-item .el-input {
  356. width: 150px; /* 调整左侧输入框的宽度 */
  357. }
  358. /* 媒体查询,根据需要调整断点 */
  359. @media screen and (max-width: 768px) {
  360. .form-column {
  361. flex: 1 0 100%; /* 在小屏幕下变成单列布局 */
  362. margin-right: 0;
  363. }
  364. }
  365. /*:deep(.el-table td .cell) {*/
  366. /* line-height: 30px !important;*/
  367. /*}*/
  368. .JKWTree-container {
  369. display: flex;
  370. }
  371. .JKWTree-tree {
  372. /*width: 300px;*/
  373. background-color: #fff;
  374. padding: 10px;
  375. margin-right: 20px;
  376. }
  377. .JKWTree-tree h3 {
  378. font-size: 15px;
  379. font-weight: 700;
  380. margin: 10px 0;
  381. }
  382. .JKWTree-content {
  383. flex: 1;
  384. }
  385. /* 图片上传 */
  386. .upload-box {
  387. width: 200px;
  388. height: 200px;
  389. border: 2px dashed #e2e2e2;
  390. display: flex;
  391. justify-content: center;
  392. align-items: center;
  393. position: relative;
  394. cursor: pointer;
  395. }
  396. .uploaded-image {
  397. width: 100%;
  398. height: 100%;
  399. object-fit: cover;
  400. }
  401. .upload-icon {
  402. font-size: 40px;
  403. color: #c0c4cc;
  404. }
  405. .file-input {
  406. display: none;
  407. }
  408. .el-table .warning-row {
  409. background: oldlace;
  410. }
  411. /* 选中某行时的背景色 */
  412. :deep(.el-table__body tr.current-row) > td {
  413. background: #ff80ff !important;
  414. }
  415. </style>
  416. <style scoped>
  417. :deep(.el-table td .cell) {
  418. line-height: 20px !important;
  419. }
  420. :deep(.el-tabs__header){
  421. margin-bottom: 0;
  422. }
  423. .search{
  424. margin-left: 0px !important;
  425. margin-right: 10px !important;
  426. }
  427. .bt{
  428. margin-left: 2px !important;
  429. padding: 3px !important;
  430. font-size: 12px;
  431. }
  432. .el-tabs__header{
  433. margin: 0px !important;
  434. }
  435. .gva-table-box{
  436. padding: 0px !important;
  437. }
  438. .mab{
  439. margin-bottom: 5px;
  440. }
  441. </style>