guoyuji
2024-12-17 cfa4a3fdb3dcd9a811157c4bd8f82ba4025917bc
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/ProjectDetail.vue
@@ -1,5 +1,5 @@
<script setup>
import {nextTick, onMounted, reactive, ref} from "vue";
import {nextTick, onMounted, reactive, ref, watch} 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";
@@ -7,8 +7,8 @@
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} from "element-plus";
import { useRoute } from 'vue-router';
import {ElMessage, ElMessageBox} from "element-plus";
import {useRoute} from 'vue-router';
const {t} = useI18n()
@@ -45,12 +45,53 @@
  columns: [
    {field: 'order_number', title: '订序', width: 70},
    {field: 'child_width', width: 100, title: t('order.width'), filters: [{data: ''}], slots: {filter: 'num2_filter'}},
    {field: 'child_height', width: 100, title: t('order.height'),filters: [{data: ''}],slots: {filter: 'num2_filter'}},
    {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: 'child_height',
      width: 100,
      title: t('order.height'),
      filters: [{data: ''}],
      slots: {filter: 'num2_filter'}
    },
    {
      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,
@@ -59,7 +100,14 @@
      slots: {filter: 'num1_filter'},
      sortable: true
    },
    {field: 'process_cards', width: 150, title: '流程卡号', 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,
@@ -135,14 +183,130 @@
    },
  ],//表头参数
  data: null,//表格数据
  //右键菜单
  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: '图形另存为DXF',},
          {code: 'exportOPTIMA', name: '导出数据到OPTIMA',},
        ],
        []
      ]
    },
  },
  toolbarConfig: {
    buttons: [],
    slots: {
      buttons: "toolbar"
    },
  },
})
// 右键菜单
const operationConfigs = [
  {
    code: 'setAmount', // 设置统一磨量
    successMsg: '已打开!',
    gridRef: xGrid,
    requiresRow: false,
    openAmount: async () => {
      dialogVisible.value[2] = true;
    }
  },
  {
    code: 'displayProcessCard',
    successMsg: '操作成功!',
    gridRef: xGrid,
    requiresRow: false,
    showMessage: () => {
      ElMessage.info('此功能暂未完善,暂时无法执行显示流程卡操作。');
    }
  },
  {
    code: 'hideProcessCard',
    successMsg: '操作成功!',
    gridRef: xGrid,
    requiresRow: false,
    showMessage: () => {
      ElMessage.info('此功能暂未完善,暂时无法执行隐藏流程卡操作。');
    }
  },
  {
    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('此功能暂未完善,暂时无法执行图形另存为DXF操作。');
    }
  },
  {
    code: 'exportOPTIMA',
    successMsg: '操作成功!',
    gridRef: xGrid,
    requiresRow: false,
    showMessage: () => {
      ElMessage.info('此功能暂未完善,暂时无法执行导出数据到OPTIMA操作。');
    }
  },
]
// 右键菜单点击逻辑
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 (['displayProcessCard', 'hideProcessCard', 'setShape', 'safeDXF', 'exportOPTIMA'].includes(config.code)) {
            config.showMessage();
          }
        }).catch(() => {
          // 用户点击取消后执行的逻辑
          ElMessage.info('已取消操作');
        });
      } else {
        console.error(`未找到操作选项 ${menu.code} 对应的配置,请检查配置项`);
      }
    }
  },
};
const handleCommand = async (command) => {
  await emit('changeDialog', command)
@@ -153,10 +317,20 @@
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();
//工程号
@@ -194,8 +368,6 @@
const Amount = (amountData) => {
  nextTick(() => {
    const data = gridOptions.data;
    console.log('接收到的amountData:', amountData);
    console.log('表格原始数据:', data);
    if (data) {
      try {
        const updatedData = [];
@@ -223,15 +395,21 @@
  });
};
//中转站接受SetTrimming的值
//中转站接受SetTrimming的值(设置修边)
const emit = defineEmits([
  'changeDialog',
  'forward-data-to-grandparent'
  'forward-data-to-grandparent',
  'send-inventory-to-op'
]);
const handleTrimmingData = (data) => {
  emit('forward-data-to-grandparent', data);
};
//中转站接受CheckInventory的值(查询库存)
const handleInventory = (selectedLabel1, selectedLabel2) => {
  emit('send-inventory-to-op', selectedLabel1, selectedLabel2);
}
</script>
@@ -274,16 +452,17 @@
        <div id="header">
          <div id="title">
            <span>工程编号:</span>
            <el-input disabled  placeholder="" style="width: 150px" v-model="projectNo"></el-input>&nbsp;
            <el-input disabled placeholder="" style="width: 150px" v-model="projectNo"></el-input>&nbsp;
            <span>工程名称:</span>
            <el-input disabled placeholder="" style="width: 150px; margin-right: 350px" v-model="projectName"></el-input>
            <el-input disabled placeholder="" style="width: 150px; margin-right: 350px"
                      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 />
              <check-inventory :closeDialog="closeDialog" @send-data-inventory="handleInventory"/>
            </el-dialog>
            <el-button id="button" type="primary" @click="openDialog(2)">设置磨量</el-button>
@@ -292,7 +471,7 @@
                title="设置磨量"
                destroy-on-close
                style="width: 35%;height:80%;margin-top: 3vh;">
               <set-amount :closeDialog="closeDialog" @set-amount="Amount"/>
              <set-amount :closeDialog="closeDialog" @set-amount="Amount"/>
            </el-dialog>
            <el-button id="button" type="primary" @click="openDialog(3)">设置修边</el-button>
@@ -315,7 +494,6 @@
            >
              <optimize-compute/>
            </el-dialog>
          </div>
          <!--工程文件菜单-->
          <el-dropdown @command="handleCommand">
@@ -351,7 +529,7 @@
  margin-top: 8px;
}
#button{
#button {
  margin-left: 10px;
}