廖井涛
2025-03-25 768e16999a8ce4bb500490ee76c659aa61ea1783
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/ProjectDetail.vue
@@ -1,5 +1,5 @@
<script setup>
import {nextTick, onMounted, reactive, ref, watch} from "vue";
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";
@@ -43,14 +43,18 @@
  },
  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'), filters: [{data: ''}], slots: {filter: 'num2_filter'}},
    {field: 'child_width',
      width: 100,
      title: t('order.width'),
      sortable: true
    },
    {
      field: 'child_height',
      width: 100,
      title: t('order.height'),
      filters: [{data: ''}],
      slots: {filter: 'num2_filter'}
      sortable: true
    },
    {
      field: 'quantity',
@@ -112,6 +116,14 @@
      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
@@ -183,6 +195,15 @@
    },
  ],//表头参数
  data: null,//表格数据
  toolbarConfig: {
    buttons: [
    ],
    import: false,
    // export: true,
    // print: true,
    zoom: true,
    custom: true
  },
  //右键菜单
  menuConfig: {
    body: {
@@ -200,25 +221,25 @@
      ]
    },
  },
})
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: [],
    slots: {
      buttons: "toolbar"
    },
    buttons: [
    ],
    import: false,
    // export: true,
    // print: true,
  },
})
const processCardColumns = reactive([
  {field: 'process_id', title: '流程卡', width: 200},
  {field: 'project', title: '项目名', width: 150},
  {field: 'order_number', title: '项目名', width: 150},
  {field: 'width', title: '宽', width: 150},
  {field: 'height', title: '高', width: 150},
  {field: 'technology_number', title: '层', width: 150},
  {field: 'layout_status', title: '总层数', width: 150},
  {field: 'quantity', title: '数量', width: 150},
]);
});
// 右键菜单
const operationConfigs = [
@@ -236,10 +257,11 @@
    successMsg: '操作成功!',
    gridRef: xGrid,
    requiresRow: false,
    showMessage: () => {
    displayProcess: () => {
      getProcessCard();
      processCardDialogVisible.value = true;
      ElMessage.info('操作成功!');
      // 显示流程卡时,将 left-table 宽度改为 50%
      leftTableWidth.value = 60;
      showProcessCardTable.value = true;
    }
  },
  {
@@ -247,9 +269,9 @@
    successMsg: '操作成功!',
    gridRef: xGrid,
    requiresRow: false,
    showMessage: () => {
      processCardDialogVisible.value = false;
      ElMessage.info('此功能暂未完善,暂时无法执行隐藏流程卡操作。');
    hideProcess: () => {
      leftTableWidth.value = 100;
      showProcessCardTable.value = false;
    }
  },
  {
@@ -308,7 +330,13 @@
          if (config.code === 'setAmount') {
            config.openAmount();
            ElMessage.success(config.successMsg);
          } else if (['displayProcessCard', 'hideProcessCard', 'setShape', 'safeDXF', 'exportOPTIMA'].includes(config.code)) {
          } 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(() => {
@@ -350,6 +378,9 @@
//工程号
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) => {
@@ -378,13 +409,13 @@
  }
});
// 流程卡窗口
const processCardDialogVisible = ref(false);
// 流程卡 宽度
const leftTableWidth = ref(100);
const showProcessCardTable = ref(false);
// 用于存储流程卡数据
const processCardData = ref(null);
//流程卡
const getProcessCard = () => {
  const projectNo = ref('P24120301')
  request.post(`/glassOptimize/getProcessCard/${projectNo.value}`).then((res) => {
    if (Number(res.code) === 200) {
      processCardData.value = res.data.data;
@@ -393,6 +424,7 @@
    }
  });
};
// 从子组件SetAmount获取磨量值,并更新表格数据
const Amount = (amountData) => {
@@ -444,136 +476,130 @@
</script>
<template>
  <div style="width: 100%;height: 100%">
    <vxe-grid
        @filter-change="filterChanged"
        height="100%"
        class="mytable-scrollbar"
        ref="xGrid"
        v-bind="gridOptions"
        v-on="gridEvents"
    >
  <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>
      <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 id="title">
        <span>工程编号:</span>
        <el-input readonly placeholder="" style="width: 150px" v-model="projectNo"></el-input>&nbsp;
        <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="设置磨量(mm)" 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="设置修边(mm)" 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>
        </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)"/>
        </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>
        </div>
      </template>
        </template>
      </vxe-grid>
      <template #toolbar>
        <div id="header">
          <div id="title">
            <span>工程编号:</span>
            <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-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="设置磨量(mm)"
                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="设置修边(mm)"
                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>
          <!--工程文件菜单-->
          <el-dropdown @command="handleCommand">
            <el-button type="primary" :icon="Folder" style="margin-top: 8px">
              工程文件
            </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-item command="4">文件导出</el-dropdown-item>
                              <el-dropdown-item command="5">文件导入</el-dropdown-item>-->
              </el-dropdown-menu>
            </template>
          </el-dropdown>
        </div>
      </template>
    </vxe-grid>
    <!-- 流程卡表格 -->
    <el-dialog
        v-model="processCardDialogVisible"
        title="流程卡数据"
        width="80%"
        heigth="600px"
        style="height: 80%;"
    >
      <!-- 流程卡表格 -->
      <vxe-grid
          height="100%"
          class="mytable - scrollbar"
          class="right-table"
          :data="processCardData"
          :columns="processCardColumns"
          v-bind="processCardColumns"
          v-if="showProcessCardTable"
          :header-cell-style="{'height': '51.9px'}"
      >
      </vxe-grid>
    </el-dialog>
    </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 {
  position: absolute;
  right: 10px;
  margin-top: 8px;
  margin: 8px 5px;
  width: 1240px;
}
#button {