From f7a2fcdda7f1120498c5c5f75c5a99955fc54b43 Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期二, 16 十二月 2025 16:54:09 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10105/r/ERP_override
---
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/ComputeCard.vue | 227 +++++++++++++++++++++++++-------------------------------
1 files changed, 103 insertions(+), 124 deletions(-)
diff --git a/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/ComputeCard.vue b/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/ComputeCard.vue
index 6822cd9..f2aa11a 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/ComputeCard.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/ComputeCard.vue
@@ -4,6 +4,7 @@
import {useI18n} from "vue-i18n";
import {ElMessage} from "element-plus";
import deepClone from "@/utils/deepClone";
+import {addListener, toolbarButtonClickEvent} from "@/hook/mouseMove";
const { t } = useI18n()
const xGrid = ref()
@@ -31,6 +32,16 @@
scrollX:{enabled: true},
scrollY:{ enabled: true ,gt:0},//寮�鍚櫄鎷熸粴鍔�
showOverflow:true,
+ menuConfig: {
+ body: {
+ options: [
+ [
+ { code: 'copyChecked', name: t('basicData.selectSame'), prefixIcon: 'vxe-icon-copy', visible: true, disabled: false },
+ { code: 'copyAll', name: t('basicData.sameAfterwards'), prefixIcon: 'vxe-icon-feedback', visible: true, disabled: false },
+ ]
+ ]
+ }
+ },
columnConfig: {
resizable: true,
useKey: true
@@ -49,11 +60,9 @@
columns:[
{type: 'seq', title: t('basicData.Number'), width: 80},
- {field: 'curtain_wall',type:'checkbox',title: '骞曞妯″紡', width: 80},
- {field: 'allow_rotate',type:'checkbox',title: '鍏佽妯帓', width: 80},
- {field: 'tempering',type:'checkbox',title: '閽㈠寲', width: 80},
- /*{field: "allow_rotate", title: '鍏佽妯帓', width: 80, slots: { default: 'state' }},
- {field: "tempering", title: '閽㈠寲', width: 80, slots: { default: 'state' }},*/
+ {field: 'curtain_wall',title: '骞曞妯″紡',width: 80, slots: { default: 'state1' }},
+ {field: "allow_rotate", title: '鍏佽妯帓', width: 80, slots: { default: 'state2' }},
+ {field: "tempering", title: '閽㈠寲', width: 80, slots: { default: 'state3' }},
{field: 'processId',width: 150, title: t('processCard.processId'), sortable: true},
{field: 'technologyNumber',width: 70, title: '灞�', sortable: true},
@@ -91,128 +100,24 @@
processId: null,
technologyNumber: null,
patchState: null,
+ glassThickness: String, // 娣诲姞鐜荤拑鍘氬害灞炴��
+ glassType: String // 娣诲姞鐜荤拑绫诲瀷灞炴��
});
-const handleCheckChange=({ column, records })=> {
- if (column.field === 'tempering') {
- console.log(records)
- }
-}
+
+
+
watch(() => props.tableData, async (newData) => {
if (Array.isArray(newData)) {
+ addListener(xGrid.value,gridOptions)
console.log(newData)
xGrid.value.loadData(deepClone(newData))
- const data=xGrid.value.getTableData().fullData
+ const data = xGrid.value.getTableData().fullData
data.forEach(item => {
item.tempering = item.tempering === 1;
item.allow_rotate = item.allow_rotate === 1;
item.curtain_wall = item.curtain_wall === 1;
})
- xGrid.value.reloadData(data);
- /*await nextTick();
- if (xGrid.value) {
- const grid = xGrid.value;
- if (typeof grid.refresh === 'function') {
- grid.refresh();
- }
-
-
- // 鎻愬彇鎵�鏈夊敮涓�鐨刾rocess_id
- const processIds = Array.from(new Set(newData.map(item => item.process_id)));
-
- /!*const requests = newData.map(item =>
- request.post(`/glassOptimize/selectComputeDetail/${item.process_id}/${item.technologyNumber}/${item.patchState}`)
- );*!/
-
- /!*try {
- const responses = await Promise.all(requests);
-
- // 鏁村悎鏁版嵁
- const processData = responses.reduce((acc, res, index) => {
- const processId = processIds[index];
-
- // 妫�鏌es.data鏄惁涓哄璞★紝骞朵笖鍖呭惈'data'瀛楁
- if (typeof res.data === 'object' && res.data !== null && 'data' in res.data) {
- const data = res.data.data;
-
- // 妫�鏌ata鏄惁涓烘暟缁�
- if (!Array.isArray(data)) {
- console.error(`鍝嶅簲鏁版嵁涓殑'data'瀛楁涓嶆槸鏁扮粍锛宲rocess_id: ${processId}`);
- return acc;
- }
-
- // 鑾峰彇瀵瑰簲process_id鐨刵ewData鏉$洰
- const relatedNewData = newData.filter(item => item.process_id === processId);
-
- // 鍒濆鍖杙rocess_card瀵硅薄
- const processCard = {
- process_no: processId,
- layers: relatedNewData.technology_number,
- total_layers: relatedNewData.TotalNumber,
- total_num: relatedNewData.quantity,
- total_area: relatedNewData.area,
- is_must: true,
- allow_rotate: relatedNewData.check === 1 ? true : false,
- priority_level: 0,
- tempering: relatedNewData.check === 2 ? true : false,
- curtain_wall: relatedNewData.check === 3 ? true : false,
- patch_state: 0,
- merge: 0,
- glass_details: []
-};
-
-
- // 鏁村悎glass_details
- data.forEach(detail => {
- const matchedNewData = relatedNewData.find(
- item => item.technology_number === detail.technology_number
- );
-
- processCard.glass_details.push({
- process_id: processId,
- technology_number: detail.technology_number,
- order_number: detail.order_number,
- layers_number: detail.layers_number,
- max_width: detail.width,
- max_height: detail.height,
- child_width: detail.child_width,
- child_height: detail.child_height,
- quantity: matchedNewData ? matchedNewData.quantity : 0,
- patch_state: 0
- });
- });
-
- // 灏唒rocessCard娣诲姞鍒癮cc涓�
- if (!acc.process_cards) {
- acc.process_cards = [];
- }
- acc.process_cards.push(processCard);
- // 璁剧疆鍏朵粬瀛楁鐨勫��
-
- } else {
- console.error(`鍝嶅簲鏁版嵁鏍煎紡涓嶆纭紝process_id: ${processId}`);
- }
- return acc;
- }, {});
- if (newData.length > 0) {
- // 鍋囪鎵�鏈夋潯鐩殑thickness鍜実lassType鐩稿悓
- processData.glass_thickness = newData[0].thickness;
- processData.glass_type = newData[0].glassType;
- } else {
- processData.glass_thickness = "";
- processData.glass_type = "";
- }
-
-
-
- // 鍙戦�佹暣鍚堝悗鐨勬暟鎹埌鐖剁粍浠�
- emit('sendData', processData);
- } catch (error) {
- console.error('璇锋眰澶辫触:', error);
- }*!/
- }*/
- } else {
- console.error('浼犻�掔粰琛ㄦ牸鐨勬暟鎹牸寮忎笉绗﹀悎瑕佹眰锛屾湡鏈涙槸鏁扮粍鏍煎紡');
}
});
@@ -226,8 +131,72 @@
cellClick({row}) {
rowClickIndex.value = row
// Emit 浜嬩欢灏嗘洿鏂板悗鐨勫�间紶閫掔粰鐖剁粍浠�
- emit('upProcessId', rowClickIndex.value.process_id,rowClickIndex.value.patch_state,rowClickIndex.value.technology_number);
- emit('updateTechnologyNumber', rowClickIndex.value.process_id,rowClickIndex.value.patch_state,rowClickIndex.value.technology_number);
+ emit('upProcessId', rowClickIndex.value.processId,rowClickIndex.value.patch_state,rowClickIndex.value.technologyNumber);
+ emit('updateTechnologyNumber', rowClickIndex.value.processId,rowClickIndex.value.patch_state,rowClickIndex.value.technologyNumber);
+ },
+ menuClick ({ menu, row, column }) {
+ const $grid = xGrid.value
+ if ($grid) {
+ switch (menu.code) {
+
+ case 'copyChecked' :{
+ let result = toolbarButtonClickEvent()
+ if(result){
+ const dataList = xGrid.value.getTableData().visibleData
+ let firstVal=null;
+ if(result.cell.indexOf('.')>-1){
+ firstVal = eval("dataList["+result.start +"]."+result.cell)
+ }else {
+ firstVal=dataList[result.start][result.cell];
+ }
+ dataList.forEach((item,index) =>{
+ if(index>=result.start && index<=result.end){
+ //鍙栨秷閫変腑
+ if(parseInt(firstVal)<=0){
+ xGrid.value.setCheckboxRow(item, false);
+ }
+ if(result.cell.indexOf('.')>-1){
+ const columnArr = result.cell.split('.')
+ item[columnArr[0]][columnArr[1]] = firstVal
+ }else{
+ item[result.cell] = firstVal
+ }
+
+ }
+ })
+ }
+ break
+ }
+ case 'copyAll' :{
+ let result = toolbarButtonClickEvent()
+ if(result){
+ const dataList = xGrid.value.getTableData().visibleData
+ let firstVal=null;
+ if(result.cell.indexOf('.')>-1){
+ firstVal = eval("dataList["+result.start +"]."+result.cell)
+ }else {
+ firstVal=dataList[result.start][result.cell];
+ }
+ dataList.forEach((item,index) =>{
+ if(index>=result.start){
+ //鍙栨秷閫変腑
+ if(parseInt(firstVal)<=0){
+ xGrid.value.setCheckboxRow(item, false);
+ }
+ if(result.cell.indexOf('.')>-1){
+ const columnArr = result.cell.split('.')
+ item[columnArr[0]][columnArr[1]] = firstVal
+ }else{
+ item[result.cell] = firstVal
+ }
+
+ }
+ })
+ }
+ break
+ }
+ }
+ }
}
}
@@ -244,7 +213,6 @@
ref="xGrid"
v-bind="gridOptions"
v-on="gridEvents"
- @checkbox-change="handleCheckChange"
>
<template #num2_filter="{ column, $panel }">
<div>
@@ -270,13 +238,17 @@
</div>
</template>
- <template #state="{ row,column}">
+ <template #state1="{ row,column}">
<el-checkbox
- v-if="row[column.field] === 1"
- :checked="true"/>
+ v-model="row.curtain_wall"/>
+ </template>
+ <template #state2="{ row,column}">
<el-checkbox
- v-else
- :checked="false"/>
+ v-model="row.allow_rotate"/>
+ </template>
+ <template #state3="{ row,column}">
+ <el-checkbox
+ v-model="row.tempering"/>
</template>
</vxe-grid>
</div>
@@ -287,5 +259,12 @@
height: 20px;
margin-top: -20px;
}
+.vxe-grid {
+ /* 绂佺敤娴忚鍣ㄩ粯璁ら�変腑 */
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
</style>
\ No newline at end of file
--
Gitblit v1.8.0