| | |
| | | |
| | | import request from "@/utils/request" |
| | | import deepClone from "@/utils/deepClone" |
| | | import {ElDatePicker, ElMessage} from "element-plus" |
| | | import {ElCheckbox, ElDatePicker, ElMessage} from "element-plus" |
| | | import useProductGlassTypeStore from "@/stores/sd/product/productGlassType" |
| | | import {nextTick, onMounted, onUnmounted, reactive, ref, watch} from "vue" |
| | | import {ArrowLeftBold, Search} from "@element-plus/icons-vue" |
| | |
| | | } |
| | | flag = !flag |
| | | } |
| | | |
| | | //倒叙 |
| | | let flashback = ref(1) |
| | | |
| | | //定义排序规则 |
| | | const optionVal = ref(0) |
| | | const options = [ |
| | | { |
| | | value: 0, |
| | | label: t('processCard.mainWidth'), |
| | | }, |
| | | { |
| | | value: 1, |
| | | label: t('processCard.mainHeight'), |
| | | }, |
| | | ] |
| | | |
| | | //定义时间 |
| | | const form = reactive({ |
| | |
| | | |
| | | }) |
| | | produceList = produceList.value.concat(deepClone(res.data.data)) |
| | | produceList.forEach(item => { |
| | | // 如果 shape 可能是字符串就用 ==,如果一定是数字就用 === |
| | | item.shape = (item.shape == 2) ? t('order.alien') : t('order.universalShape'); |
| | | }); |
| | | xGrid.value.reloadData(produceList) |
| | | gridOptions.loading = false |
| | | } else { |
| | |
| | | ],//表头按钮 |
| | | |
| | | toolbarConfig: { |
| | | // buttons: [{ |
| | | // |
| | | // }], |
| | | slots:{ |
| | | buttons: "toolbar_buttons" |
| | | }, |
| | | buttons: [{ |
| | | |
| | | }], |
| | | // import: false, |
| | | // export: true, |
| | | // print: true, |
| | |
| | | |
| | | }) |
| | | const gridEventsRight = { |
| | | toolbarButtonClick({code}) { |
| | | const $grid = xGridLeft.value |
| | | if ($grid) { |
| | | switch (code) { |
| | | case 'sorting': { |
| | | request.post(`/processCard/selectSortingCard/${orderId}/${productionId}/${flashback.value}/${optionVal.value}`, filterData.value).then((res) => { |
| | | |
| | | if (res.code == 200) { |
| | | pageTotal.value = res.data.total |
| | | maxProcseeId=res.data.maxFlowCard[0].process_id |
| | | orderOtherMoney.value = res.data.orderOtherMoney |
| | | orderOtherMoney.value.forEach(item => { |
| | | let column = { |
| | | field: `${item.column}`, |
| | | width: 100, |
| | | title: item.alias, |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged, |
| | | sortable: true |
| | | } |
| | | |
| | | gridOptions.columns.push(column) |
| | | |
| | | }) |
| | | produceList = res.data.data |
| | | produceList.forEach(item => { |
| | | // 如果 shape 可能是字符串就用 ==,如果一定是数字就用 === |
| | | item.shape = (item.shape == 2) ? t('order.alien') : t('order.universalShape'); |
| | | }); |
| | | xGrid.value.reloadData(produceList) |
| | | gridOptions.loading = false |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | return; |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | }, |
| | | formSubmit () { |
| | | let form = gridOptions.formConfig.data |
| | | form.orderId =orderId |
| | |
| | | ElMessage.warning(t('processCard.schedulingOk')) |
| | | return |
| | | } |
| | | //productionId |
| | | |
| | | const $gridLeft = xGridLeft.value |
| | | const leftData = $gridLeft.getTableData().fullData |
| | | |
| | | //落架顺序 |
| | | let index = 1 |
| | | if (leftData.length !== 0) { |
| | | index = leftData[0].landingSequence + 1 |
| | | //index = index.toString().padStart(2, '0') |
| | | index = Math.max(...leftData.map(d => d.landingSequence || 0)) + 1 |
| | | } |
| | | let processId= null |
| | | // if (leftData.length !== 0){ |
| | | // processId = productionId + index.toString().padStart(3, '0') |
| | | // } |
| | | // else { |
| | | if (maxProcseeId!== null || maxProcseeId!== undefined|| maxProcseeId!== ''){ |
| | | if (leftData.length !== 0){ |
| | | const str=leftData[0].processId |
| | | const lastThree = str.slice(-3); |
| | | const result = lastThree*1 + 1; |
| | | processId= productionId + result.toString().padStart(3, '0') |
| | | } |
| | | else { |
| | | // 截取后三位 |
| | | const lastThree = maxProcseeId.slice(-3); |
| | | const result = lastThree*1 + 1; |
| | | processId= productionId + result.toString().padStart(3, '0') |
| | | } |
| | | |
| | | } |
| | | else { |
| | | processId = productionId + index.toString().padStart(3, '0') |
| | | } |
| | | //} |
| | | // 流程卡号 |
| | | let processId = null |
| | | if (maxProcseeId) { |
| | | const base = leftData.length !== 0 ? leftData[0].processId : maxProcseeId |
| | | const lastThree = base.slice(-3) |
| | | const result = parseInt(lastThree) + 1 |
| | | processId = productionId + result.toString().padStart(3, '0') |
| | | } else { |
| | | processId = productionId + index.toString().padStart(3, '0') |
| | | } |
| | | |
| | | |
| | | const regex = /^(\d+|)$/; |
| | | const regex = /^(\d+|)$/ |
| | | if (!regex.test(checkedNum.value)) { |
| | | ElMessage.warning(t('processCard.schedulingNo')) |
| | | return |
| | | } |
| | | //判断正整数 |
| | | if (/^[1-9]\d*$/.test(checkedNum.value)) { |
| | | checkedList.forEach((item) => { |
| | | //定义key值保持 |
| | | //判断可用数量是否大于等于输入的数量,不满足则抛出异常 |
| | | if (item.baiscQuantity * 1 < checkedNum.value * 1) throw new Error(t('processCard.schedulingQuantity')); |
| | | item.quantity = checkedNum.value |
| | | item.processId = processId |
| | | item.landingSequence = index |
| | | item.baiscQuantity = item.baiscQuantity - checkedNum.value |
| | | item.computeGrossArea = (item.computeGrossArea - item.width * item.height * checkedNum.value / 1000000).toFixed(2) |
| | | |
| | | //删除key |
| | | let key = item._X_ROW_KEY |
| | | delete item._X_ROW_KEY |
| | | if (item.baiscQuantity === 0) { |
| | | $grid.remove(item) |
| | | } |
| | | $gridLeft.insertAt(item) |
| | | //重新赋值key |
| | | item._X_ROW_KEY = key |
| | | }) |
| | | try { |
| | | if (/^[1-9]\d*$/.test(checkedNum.value)) { |
| | | //有输入数量 |
| | | checkedList.forEach((item) => { |
| | | if (item.baiscQuantity < checkedNum.value * 1) { |
| | | throw new Error(t('processCard.schedulingQuantity')) |
| | | } |
| | | item.quantity = checkedNum.value * 1 |
| | | item.processId = processId |
| | | item.landingSequence = index // ✅ 同一批次,落架顺序一致 |
| | | item.baiscQuantity -= checkedNum.value * 1 |
| | | item.computeGrossArea = ( |
| | | item.computeGrossArea - item.width * item.height * checkedNum.value / 1000000 |
| | | ).toFixed(2) |
| | | |
| | | //清除两边复选框 |
| | | const key = item._X_ROW_KEY |
| | | delete item._X_ROW_KEY |
| | | |
| | | if (item.baiscQuantity === 0) { |
| | | $grid.remove(item) |
| | | } |
| | | |
| | | const currentLeft = $gridLeft.getTableData().fullData |
| | | $gridLeft.clearSort() |
| | | $gridLeft.loadData([...currentLeft, item]) |
| | | item._X_ROW_KEY = key |
| | | }) |
| | | } else if (checkedNum.value === '') { |
| | | //没有输入数量 |
| | | checkedList.forEach((item) => { |
| | | item.processId = processId |
| | | item.landingSequence = index |
| | | item.quantity = item.baiscQuantity |
| | | delete item._X_ROW_KEY |
| | | }) |
| | | |
| | | $grid.remove(checkedList) |
| | | const currentLeft = $gridLeft.getTableData().fullData |
| | | $gridLeft.clearSort() |
| | | $gridLeft.loadData([...currentLeft, ...checkedList]) |
| | | } |
| | | |
| | | $gridLeft.clearCheckboxRow() |
| | | $grid.clearCheckboxRow() |
| | | } else if (checkedNum.value === '') {//判断数量输入框无输入数字 |
| | | checkedNum.value = '' |
| | | |
| | | checkedList.forEach((item) => { |
| | | item.processId = processId |
| | | item.landingSequence = index |
| | | item.quantity = item.baiscQuantity |
| | | }) |
| | | //删除key |
| | | checkedList.forEach((item) => { |
| | | delete item._X_ROW_KEY |
| | | }) |
| | | $gridLeft.insertAt(checkedList) |
| | | $grid.remove(checkedList) |
| | | //清除两边复选框 |
| | | $gridLeft.clearCheckboxRow() |
| | | $grid.clearCheckboxRow() |
| | | } |
| | | if (checkedNum.value){ |
| | | checkedNum.value ='' |
| | | // 插入后视觉排序 |
| | | // $nextTick(() => { |
| | | // $gridLeft.sort('landingSequence', 'asc') |
| | | // }) |
| | | } catch (e) { |
| | | ElMessage.warning(e.message ) |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | //按编号创建流程卡 |
| | |
| | | weight.value = parseFloat(weightsum.toFixed(2)); |
| | | }; |
| | | |
| | | //倒序赋值 |
| | | function onFlashbackChange(checked) { |
| | | flashback.value = checked ? 0 : 1 |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | |
| | | @checkbox-all="handleCheckboxChange" |
| | | @checkbox-range-end="handleCheckboxChange" |
| | | > |
| | | |
| | | <!-- 自定义 toolbar_buttons 插槽 --> |
| | | <template #toolbar_buttons="{ $grid }"> |
| | | |
| | | |
| | | <!-- 手动写出所有按钮 --> |
| | | |
| | | <el-select |
| | | :default-first-option="true" |
| | | ref="getSelect" style="width: 80px" |
| | | v-model="optionVal" |
| | | class="m-2" |
| | | > |
| | | <el-option |
| | | v-for="item in options" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | |
| | | <el-button |
| | | type="primary" |
| | | style="margin-right:8px;width: 50px" |
| | | @click="$grid.dispatchEvent('toolbar-button-click', { code: 'sorting' })" |
| | | > |
| | | {{ t('processCard.sorting') }} |
| | | </el-button> |
| | | |
| | | <el-checkbox |
| | | :model-value="flashback === 0" |
| | | @change="onFlashbackChange" |
| | | > |
| | | {{ t('processCard.flashback') }} |
| | | </el-checkbox> |
| | | |
| | | |
| | | </template> |
| | | |
| | | |
| | | |
| | | <!-- @toolbar-button-click="toolbarButtonClickEvent"--> |
| | | <!-- 下拉显示所有信息插槽--> |
| | | <template #content="{ row }"> |