From 768e16999a8ce4bb500490ee76c659aa61ea1783 Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期二, 25 三月 2025 10:08:13 +0800
Subject: [PATCH] Merge branch 'master' of http://bore.pub:10439/r/ERP_override
---
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/ProjectDetail.vue | 609 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 609 insertions(+), 0 deletions(-)
diff --git a/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/ProjectDetail.vue b/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/ProjectDetail.vue
new file mode 100644
index 0000000..97cb04b
--- /dev/null
+++ b/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/ProjectDetail.vue
@@ -0,0 +1,609 @@
+<script setup>
+import {nextTick, onMounted, reactive, ref, watch,onBeforeUnmount } from "vue";
+import {useI18n} from "vue-i18n";
+import {Folder, Plus, Setting, Operation,} from "@element-plus/icons-vue";
+import OptimizeCompute from "@/views/pp/glassOptimize/page/OptimizeCompute.vue";
+import SetAmount from "@/views/pp/glassOptimize/page/SetAmount.vue";
+import SetTrimming from "@/views/pp/glassOptimize/page/SetTrimming.vue";
+import CheckInventory from "@/views/pp/glassOptimize/page/CheckInventory.vue";
+import request from "@/utils/request";
+import {ElMessage, ElMessageBox} from "element-plus";
+import {useRoute} from 'vue-router';
+
+
+const {t} = useI18n()
+
+const xGrid = ref()
+const gridOptions = reactive({
+ height: '100%',
+ loading: false,
+ border: "full",//琛ㄦ牸鍔犺竟妗�
+ keepSource: true,//淇濇寔婧愭暟鎹�
+ align: 'center',//鏂囧瓧灞呬腑
+ stripe: true,//鏂戦┈绾�
+ rowConfig: {isCurrent: true, isHover: true, height: 30, useKey: true},//榧犳爣绉诲姩鎴栭�夋嫨楂樹寒
+ id: 'ProjectDetail',
+ scrollX: {enabled: true},
+ scrollY: {enabled: true, gt: 0},//寮�鍚櫄鎷熸粴鍔�
+ showOverflow: true,
+ columnConfig: {
+ resizable: true,
+ useKey: true
+ },
+ filterConfig: { //绛涢�夐厤缃」
+ remote: true
+ },
+ customConfig: {
+ storage: true
+ },
+ editConfig: {
+ trigger: 'click',
+ mode: 'row',
+ showStatus: true
+ },
+
+ columns: [
+ {type: 'seq', fixed: "left", title: ' ', slots: {content: 'content'}, width: 50},
+ {field: 'order_number', title: '璁㈠簭', width: 70},
+ {field: 'child_width',
+ width: 100,
+ title: t('order.width'),
+ sortable: true
+ },
+ {
+ field: 'child_height',
+ width: 100,
+ title: t('order.height'),
+ sortable: true
+ },
+ {
+ field: 'quantity',
+ width: 150,
+ title: t('order.quantity'),
+ filters: [{data: ''}],
+ slots: {filter: 'num1_filter'},
+ sortable: true
+ },
+ {
+ field: 'longGrind1',
+ width: 150,
+ title: '闀跨(1',
+ filters: [{data: ''}],
+ slots: {filter: 'num1_filter'},
+ sortable: true
+ },
+ {
+ field: 'longGrind2',
+ width: 150,
+ title: '闀跨(2',
+ filters: [{data: ''}],
+ slots: {filter: 'num1_filter'},
+ sortable: true
+ },
+ {
+ field: 'shortGrind1',
+ width: 150,
+ title: '鐭(1',
+ filters: [{data: ''}],
+ slots: {filter: 'num1_filter'},
+ sortable: true
+ },
+ {
+ field: 'shortGrind2',
+ width: 150,
+ title: '鐭(2',
+ filters: [{data: ''}],
+ slots: {filter: 'num1_filter'},
+ sortable: true
+ },
+ {
+ field: 'shape',
+ width: 150,
+ title: t('order.shape'),
+ filters: [{data: ''}],
+ slots: {filter: 'num1_filter'},
+ sortable: true
+ },
+ {
+ field: 'process_cards',
+ width: 150,
+ title: '娴佺▼鍗″彿',
+ filters: [{data: ''}],
+ slots: {filter: 'num1_filter'},
+ sortable: true
+ },
+ {
+ field: 'product_name',
+ width: 150,
+ title: t('order.product'),
+ filters: [{data: ''}],
+ slots: {filter: 'num1_filter'},
+ sortable: true
+ },
+ {
+ field: 'price',
+ width: 150,
+ title: t('鍗曚环'),
+ filters: [{data: ''}],
+ slots: {filter: 'num1_filter'},
+ sortable: true
+ },
+ {
+ field: 'remark',
+ width: 150,
+ title: t('basicData.remarks'),
+ filters: [{data: ''}],
+ slots: {filter: 'num1_filter'},
+ sortable: true
+ },
+ {
+ field: 'building_number',
+ width: 150,
+ title: '妤煎眰鍙�',
+ filters: [{data: ''}],
+ slots: {filter: 'num1_filter'},
+ sortable: true
+ },
+ {
+ field: 'perimeter',
+ width: 150,
+ title: t('order.perimeter'),
+ filters: [{data: ''}],
+ slots: {filter: 'num1_filter'},
+ sortable: true
+ },
+ {
+ field: 'area',
+ width: 150,
+ title: t('order.grossArea'),
+ filters: [{data: ''}],
+ slots: {filter: 'num1_filter'},
+ sortable: true
+ },
+
+ {
+ field: 'shelf_number',
+ width: 150,
+ title: '鏋跺彿',
+ filters: [{data: ''}],
+ slots: {filter: 'num1_filter'},
+ sortable: true
+ },
+ {
+ field: 'technology_number',
+ width: 150,
+ title: '灞�',
+ filters: [{data: ''}],
+ slots: {filter: 'num1_filter'},
+ sortable: true
+ },
+ {
+ field: 'glass_child',
+ width: 150,
+ title: '鍗曠墖鍚嶇О',
+ filters: [{data: ''}],
+ slots: {filter: 'num1_filter'},
+ sortable: true
+ },
+ {
+ field: 'icon',
+ width: 150,
+ title: '鍗版爣绫诲瀷',
+ filters: [{data: ''}],
+ slots: {filter: 'num1_filter'},
+ sortable: true
+ },
+ ],//琛ㄥご鍙傛暟
+ data: null,//琛ㄦ牸鏁版嵁
+ toolbarConfig: {
+ buttons: [
+ ],
+ import: false,
+ // export: true,
+ // print: true,
+ zoom: true,
+ custom: true
+ },
+ //鍙抽敭鑿滃崟
+ menuConfig: {
+ body: {
+ options: [
+ [
+ {code: 'setAmount', name: '璁剧疆缁熶竴纾ㄩ噺',},
+ {code: 'displayProcessCard', name: '鏄剧ず娴佺▼鍗�',},
+ {code: 'hideProcessCard', name: '闅愯棌娴佺▼鍗�',},
+ {code: 'setShape', name: '璁剧疆鍥惧舰',},
+ {code: 'Export', name: '鏁版嵁瀵煎嚭', prefixIcon: 'vxe-icon-download', visible: true, disabled: false},
+ {code: 'safeDXF', name: '鍥惧舰鍙﹀瓨涓篋XF',},
+ {code: 'exportOPTIMA', name: '瀵煎嚭鏁版嵁鍒癘PTIMA',},
+ ],
+ []
+ ]
+ },
+ },
+})
+const processCardColumns = reactive({
+ columns:[
+ {field: 'process_id', title: '娴佺▼鍗�', width: 200, align: 'center'},
+ {field: 'project', title: '椤圭洰鍚�', width: 150, align: 'center'},
+ {field: 'order_number', title: '璁㈠簭', width: 100, align: 'center'},
+ {field: 'sizes', title: '灏哄', width: 200, align: 'center'},
+ {field: 'layer', title: '灞�', width: 100, align: 'center'},
+ {field: 'quantity', title: '鏁伴噺', width: 100, align: 'center'}
+],
+ toolbarConfig: {
+ buttons: [
+ ],
+ import: false,
+ // export: true,
+ // print: true,
+
+ },
+});
+
+// 鍙抽敭鑿滃崟
+const operationConfigs = [
+ {
+ code: 'setAmount', // 璁剧疆缁熶竴纾ㄩ噺
+ successMsg: '宸叉墦寮�锛�',
+ gridRef: xGrid,
+ requiresRow: false,
+ openAmount: async () => {
+ dialogVisible.value[2] = true;
+ }
+ },
+ {
+ code: 'displayProcessCard',
+ successMsg: '鎿嶄綔鎴愬姛锛�',
+ gridRef: xGrid,
+ requiresRow: false,
+ displayProcess: () => {
+ getProcessCard();
+ // 鏄剧ず娴佺▼鍗℃椂锛屽皢 left-table 瀹藉害鏀逛负 50%
+ leftTableWidth.value = 60;
+ showProcessCardTable.value = true;
+ }
+ },
+ {
+ code: 'hideProcessCard',
+ successMsg: '鎿嶄綔鎴愬姛锛�',
+ gridRef: xGrid,
+ requiresRow: false,
+ hideProcess: () => {
+ leftTableWidth.value = 100;
+ showProcessCardTable.value = false;
+ }
+ },
+ {
+ code: 'setShape',
+ successMsg: '鎿嶄綔鎴愬姛锛�',
+ gridRef: xGrid,
+ requiresRow: false,
+ showMessage: () => {
+ ElMessage.info('姝ゅ姛鑳芥殏鏈畬鍠勶紝鏆傛椂鏃犳硶鎵ц璁剧疆鍥惧舰鎿嶄綔銆�');
+ }
+ },
+ {
+ code: 'Export', // 瀵煎嚭鏂囦欢鎿嶄綔鐨勯厤缃�
+ successMsg: '鏂囦欢瀵煎嚭鎴愬姛锛�',
+ gridRef: xGrid,
+ requiresRow: false,
+ },
+ {
+ code: 'safeDXF',
+ successMsg: '鎿嶄綔鎴愬姛锛�',
+ gridRef: xGrid,
+ requiresRow: false,
+ showMessage: () => {
+ ElMessage.info('姝ゅ姛鑳芥殏鏈畬鍠勶紝鏆傛椂鏃犳硶鎵ц鍥惧舰鍙﹀瓨涓篋XF鎿嶄綔銆�');
+ }
+ },
+ {
+ code: 'exportOPTIMA',
+ successMsg: '鎿嶄綔鎴愬姛锛�',
+ gridRef: xGrid,
+ requiresRow: false,
+ showMessage: () => {
+ ElMessage.info('姝ゅ姛鑳芥殏鏈畬鍠勶紝鏆傛椂鏃犳硶鎵ц瀵煎嚭鏁版嵁鍒癘PTIMA鎿嶄綔銆�');
+ }
+ },
+]
+
+// 鍙抽敭鑿滃崟鐐瑰嚮閫昏緫
+const gridEvents = {
+ menuClick({menu}) {
+ const $grid = xGrid.value;
+ if ($grid) {
+ const config = operationConfigs.find(c => c.code === menu.code);
+ if (config) {
+ if (config.code === 'Export') {
+ config.gridRef.value.exportData();
+ ElMessage.success(config.successMsg);
+ return;
+ }
+ // 娣诲姞纭鎻愮ず寮圭獥锛岃闂敤鎴锋槸鍚﹁繘琛屽綋鍓嶆搷浣�
+ ElMessageBox.confirm('鏄惁杩涜褰撳墠鎿嶄綔锛�', '纭鎿嶄綔', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ if (config.code === 'setAmount') {
+ config.openAmount();
+ ElMessage.success(config.successMsg);
+ } else if (config.code === 'displayProcessCard') {
+ config.displayProcess();
+ ElMessage.success(config.successMsg);
+ } else if (config.code === 'hideProcessCard') {
+ config.hideProcess();
+ ElMessage.success(config.successMsg);
+ } else if (['setShape', 'safeDXF', 'exportOPTIMA'].includes(config.code)) {
+ config.showMessage();
+ }
+ }).catch(() => {
+ // 鐢ㄦ埛鐐瑰嚮鍙栨秷鍚庢墽琛岀殑閫昏緫
+ ElMessage.info('宸插彇娑堟搷浣�');
+ });
+ } else {
+ console.error(`鏈壘鍒版搷浣滈�夐」 ${menu.code} 瀵瑰簲鐨勯厤缃紝璇锋鏌ラ厤缃」`);
+ }
+ }
+ },
+};
+
+const handleCommand = async (command) => {
+ await emit('changeDialog', command)
+}
+
+//浼樺寲璁$畻
+const dialogVisible = ref({});
+const openDialog = (index) => {
+ dialogVisible.value[index] = true;
+};
+//鍏抽棴寮圭獥
+const closeDialog = (index) => {
+ dialogVisible.value[index] = false;
+};
+
+//鍙抽敭鑿滃崟缁熶竴淇竟
+const props = defineProps({
+ TrimmingDialogVisible: Boolean
+});
+watch(() => props.TrimmingDialogVisible, (newValue) => {
+ if (newValue === true) {
+ dialogVisible.value[3] = newValue;
+ }
+});
+
+const route = useRoute();
+//宸ョ▼鍙�
+const projectNo = ref(route.params.projectNo);
+const projectName = ref('');
+onBeforeUnmount(() => {
+ localStorage.setItem('projectNo', projectNo.value);
+});
+
+const fetchData = () => {
+ request.post(`/glassOptimize/projectInfo/${projectNo.value}`).then((res) => {
+ if ((Number(res.code) === 200)) {
+ const data = res.data.data;
+ data.forEach(item => {
+ item.longGrind1 = 0;
+ item.longGrind2 = 0;
+ item.shortGrind1 = 0;
+ item.shortGrind2 = 0;
+ item.shelf_number = 0;
+ });
+ xGrid.value.loadData(res.data.data);
+ gridOptions.data = res.data.data;
+ projectName.value = res.data.data[0].project_name;
+ } else {
+ ElMessage.warning(res.msg);
+ }
+ }).catch((error) => {
+ console.error("鑾峰彇鏁版嵁鍑洪敊:", error);
+ });
+};
+onMounted(() => {
+ if (projectNo.value) {
+ fetchData();
+ }
+});
+
+// 娴佺▼鍗� 瀹藉害
+const leftTableWidth = ref(100);
+const showProcessCardTable = ref(false);
+// 鐢ㄤ簬瀛樺偍娴佺▼鍗℃暟鎹�
+const processCardData = ref(null);
+//娴佺▼鍗�
+const getProcessCard = () => {
+ request.post(`/glassOptimize/getProcessCard/${projectNo.value}`).then((res) => {
+ if (Number(res.code) === 200) {
+ processCardData.value = res.data.data;
+ } else {
+ ElMessage.warning(res.msg);
+ }
+ });
+};
+
+
+// 浠庡瓙缁勪欢SetAmount鑾峰彇纾ㄩ噺鍊硷紝骞舵洿鏂拌〃鏍兼暟鎹�
+const Amount = (amountData) => {
+ nextTick(() => {
+ const data = gridOptions.data;
+ if (data) {
+ try {
+ const updatedData = [];
+ for (let i = 0; i < data.length; i++) {
+ const item = data[i];
+ const updatedItem = {
+ ...item,
+ longGrind1: Number(amountData.quicksetTop),
+ longGrind2: Number(amountData.quicksetRight),
+ shortGrind1: Number(amountData.quicksetBottom),
+ shortGrind2: Number(amountData.quicksetLeft)
+ };
+ updatedData.push(updatedItem);
+ }
+ gridOptions.data = updatedData;
+ xGrid.value.loadData(updatedData);
+ } catch (error) {
+ console.error('鏇存柊琛ㄦ牸鏁版嵁鏃跺嚭閿�:', error);
+ // 杩欓噷鍙互鏍规嵁瀹為檯闇�姹傛坊鍔犱竴浜涘洖婊氭搷浣滄垨鑰呮彁绀虹敤鎴风殑閫昏緫锛屾瘮濡傛樉绀轰竴涓敊璇彁绀烘绛�
+ ElMessage.error('鏇存柊纾ㄩ噺鏁版嵁鏃跺嚭鐜伴敊璇紝璇锋鏌ヨ緭鍏ユ垨鑱旂郴绠$悊鍛�');
+ }
+ } else {
+ console.warn('琛ㄦ牸鏁版嵁涓虹┖锛屾棤娉曟洿鏂扮(閲忓��');
+ }
+ });
+};
+
+//涓浆绔欐帴鍙桽etTrimming鐨勫�硷紙璁剧疆淇竟锛�
+const emit = defineEmits([
+ 'changeDialog',
+ 'forward-data-to-grandparent',
+ 'send-inventory-to-op'
+]);
+
+const handleTrimmingData = (data) => {
+ emit('forward-data-to-grandparent', data);
+};
+
+//涓浆绔欐帴鍙桟heckInventory鐨勫�硷紙鏌ヨ搴撳瓨锛�
+const handleInventory = (selectedLabel1, selectedLabel2) => {
+ emit('send-inventory-to-op', selectedLabel1, selectedLabel2);
+}
+
+</script>
+
+<template>
+ <div style="width: 100%;height: 85%;">
+ <!-- 澶撮儴 -->
+ <div id="header" >
+ <!--宸ョ▼鏂囦欢鑿滃崟-->
+ <el-dropdown @command="handleCommand">
+ <el-button type="primary" :icon="Folder" style="margin-top: 8px; margin-left: 5px">
+ 宸ョ▼鏂囦欢
+ </el-button>
+ <template #dropdown>
+ <el-dropdown-menu>
+ <el-dropdown-item :command="1" :icon="Plus">鍒涘缓宸ョ▼</el-dropdown-item>
+ <el-dropdown-item :command="2" :icon="Setting">宸ョ▼绠$悊</el-dropdown-item>
+ <el-dropdown-item :command="3" :icon="Operation">妯℃嫙璁$畻</el-dropdown-item>
+ </el-dropdown-menu>
+ </template>
+ </el-dropdown>
+
+ <div id="title">
+ <span>宸ョ▼缂栧彿锛�</span>
+ <el-input readonly placeholder="" style="width: 150px" v-model="projectNo"></el-input>
+ <span>宸ョ▼鍚嶇О锛�</span>
+ <el-input readonly placeholder="" style="width: 150px; margin-right: 340px;" v-model="projectName" ></el-input>
+ <el-button id="checkinventory" type="primary" @click="openDialog(1)">鏌ヨ搴撳瓨</el-button>
+ <el-dialog v-model="dialogVisible[1]" title="鏌ヨ搴撳瓨" destroy-on-close style="width: 35%;height:35%;">
+ <check-inventory :closeDialog="closeDialog" @send-data-inventory="handleInventory"/>
+ </el-dialog>
+ <el-button id="button" type="primary" @click="openDialog(2)">璁剧疆纾ㄩ噺</el-button>
+ <el-dialog v-model="dialogVisible[2]" title="璁剧疆纾ㄩ噺锛坢m锛�" destroy-on-close
+ style="width: 35%;height:80%;margin-top: 3vh;">
+ <set-amount :closeDialog="closeDialog" @set-amount="Amount"/>
+ </el-dialog>
+ <el-button id="button" type="primary" @click="openDialog(3)">璁剧疆淇竟</el-button>
+ <el-dialog v-model="dialogVisible[3]" title="璁剧疆淇竟锛坢m锛�" destroy-on-close
+ style="width: 35%;height:80%;margin-top: 3vh;">
+ <set-trimming :closeDialog="closeDialog" @send-data-event="handleTrimmingData"/>
+ </el-dialog>
+ <el-button id="button" type="primary">淇濆瓨</el-button>
+ <el-button id="button" type="primary" @click="openDialog(4)">浼樺寲</el-button>
+ <el-dialog v-model="dialogVisible[4]" title="浼樺寲璁$畻" destroy-on-close
+ style="width: 75%;height:90%;margin-top: 3vh;">
+ <optimize-compute/>
+ </el-dialog>
+ </div>
+ </div>
+
+ <!-- 琛ㄦ牸瀹瑰櫒 -->
+ <div class="table-container">
+ <vxe-grid
+ class="left-table"
+ @filter-change="filterChanged"
+ height="100%"
+ ref="xGrid"
+ v-bind="gridOptions"
+ v-on="gridEvents"
+ v-bind:style="{ width: leftTableWidth + '%' }"
+ >
+ <template #num2_filter="{ column, $panel }">
+ <div>
+ <div v-for="(option, index) in column.filters" :key="index">
+ <vxe-select v-model="option.data" :placeholder="$t('processCard.pleaseSelect')"
+ @change="changeFilterEvent($event, option, $panel)">
+ <vxe-option value="0" :label="$t('basicData.unchecked')"></vxe-option>
+ <vxe-option value="1" :label="$t('basicData.selected')"></vxe-option>
+ </vxe-select>
+ </div>
+ </div>
+ </template>
+ <template #num1_filter="{ column, $panel }">
+ <div>
+ <div v-for="(option, index) in column.filters" :key="index">
+ <input
+ type="type"
+ v-model="option.data"
+ @keyup.enter.native="$panel.confirmFilter()"
+ @input="changeFilterEvent($event, option, $panel)"/>
+ </div>
+ </div>
+ </template>
+ </vxe-grid>
+
+ <!-- 娴佺▼鍗¤〃鏍� -->
+ <vxe-grid
+ height="100%"
+ class="right-table"
+ :data="processCardData"
+ v-bind="processCardColumns"
+ v-if="showProcessCardTable"
+ :header-cell-style="{'height': '51.9px'}"
+ >
+ </vxe-grid>
+
+ </div>
+ </div>
+</template>
+
+<style scoped>
+.table-container {
+ width: 100%;
+ height: 100%;
+ flex: 1;
+ display: flex;
+}
+
+.left-table {
+ float: left;
+}
+
+.right-table {
+ width: 40%;
+}
+
+:deep(.vxe-toolbar){
+ height: 40px;
+}
+
+#header {
+ height: 50px;
+ display: flex;
+
+}
+
+#title {
+ margin: 8px 5px;
+ width: 1240px;
+}
+
+#button {
+ margin-left: 10px;
+}
+
+</style>
\ No newline at end of file
--
Gitblit v1.8.0