huang
2024-12-18 d863fad5fee3aaa4fed3a7619ceede11985476e8
修改 工程管理功能
2个文件已修改
86 ■■■■ 已修改文件
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/OptimizeProject.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/ProjectMange.vue 78 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/OptimizeProject.vue
@@ -20,6 +20,11 @@
  detailPage.value = 3;
};
//工程管理关闭弹窗
const handlePopupClose = () => {
  dialogVisible.value = false;
};
//获取SetTrimming的值
const dataForGlassInventory = ref();
const handleProjectDetailData = (data) => {
@@ -65,8 +70,9 @@
       z-index="100"
   >
     <project-create v-if="detailPage===1" />
     <project-mange  v-if="detailPage===2" @switch-dialog="switchDialog"/>
     <project-mange  v-if="detailPage===2" @switch-dialog="switchDialog" @closeDetailPage="handlePopupClose"/>
     <glass-computed v-if="detailPage===3" :project-no="projectNumber"/>
     <div v-else></div>
   </el-dialog>
 </div>
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/ProjectMange.vue
@@ -1,5 +1,5 @@
<script setup>
import {computed, reactive, ref} from "vue";
import {computed, nextTick, reactive, ref} from "vue";
import {useI18n} from "vue-i18n";
import deepClone from "@/utils/deepClone"
import {Search} from "@element-plus/icons-vue";
@@ -112,7 +112,7 @@
    code: 'openProject', // 打开工程
    initialState: ['10', '20', '100', '200'], //
    targetState: null,
    successMsg: '已打开工程!',
    successMsg: '已打开!',
    checkMessage: '当前工程状态不符合条件,请确认工程状态后再操作!',
    requiresRow: true,
    openFile: async ({row}) => {
@@ -139,7 +139,7 @@
    actionFunction: async ({row}) => {
      const projectNumber = row.projectNumber;
      emit('switch-dialog', projectNumber);
      }
    }
  },
  {
    code: 'undoCompute',
@@ -285,13 +285,15 @@
            return;
          } else {
            if (config.code === 'openProject') {
              config.openFile({row});
              ElMessage.success(config.successMsg);
            }else
            if (config.code === 'compute') {
              handleSameDataOperation(row).then(({isRoutesEqual}) => {
                if (!isRoutesEqual) {
                  config.openFile({row});
                  ElMessage.success(config.successMsg);
                }
              });
            } else if (config.code === 'compute') {
              config.actionFunction({row});
            }
             else {
            } else {
              row.state = config.targetState;
              const index = produceList.value.findIndex(item => item === row);
              if (index !== -1) {
@@ -310,11 +312,57 @@
      }
    }
  },
  cellDblclick: ({ row }) => {
    const menu = { code: 'openProject' };
    gridEvents.menuClick({ menu, row });  // 直接通过gridEvents对象调用menuClick
  }
  cellDblclick: ({row}) => {
    const menu = {code: 'openProject'};
    nextTick(() => {
      handleSameDataOperation(row).then(({isRoutesEqual}) => {
        if (!isRoutesEqual) {
          gridEvents.menuClick({menu, row});
        }
      });
    });
  },
};
// 公共处理函数,处理相同数据时的操作,并返回targetRoute对象(右键菜单和双击打开)
const handleSameDataOperation = async ({projectNumber, thickness, glassType}) => {
  const targetRoute = {
    name: 'optimizeInfo',
    params: {
      projectNo: projectNumber,
      thickNess: String(thickness),
      model: glassType
    }
  };
  const currentRoute = router.currentRoute.value;
  console.log('当前路由信息:', currentRoute);
  const isRoutesEqual = currentRoute.name === targetRoute.name &&
      currentRoute.params.projectNo === targetRoute.params.projectNo &&
      currentRoute.params.thickNess === targetRoute.params.thickNess &&
      currentRoute.params.model === targetRoute.params.model;
  if (isRoutesEqual) {
    handleConfirm();
  }
  return {isRoutesEqual};
};
//选中相同数据时弹窗提示
const handleConfirm = () => {
  const currentRoute = router.currentRoute.value;
  const projectNumber = currentRoute.params.projectNo;
  ElMessageBox.confirm(`当前工程(工程号:${projectNumber})已打开,是否重新打开?`, '确认操作', {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    type: 'warning'
  })
      .then(() => {
        emit('close-detail-page');
        ElMessage.success('已打开!');
      })
      .catch(() => {
        ElMessage.info('已取消操作');
      });
};
// 封装发送右键菜单请求、处理响应以及错误回滚等逻辑的函数
function rollbackStateAndReloadGrid(row, targetState) {
@@ -382,7 +430,7 @@
}
//定义切换模拟计算弹窗
const emit = defineEmits(['switch-dialog']);
const emit = defineEmits(['switch-dialog', 'close-detail-page']);
//定义工程状态
const optionVal = ref('all')
@@ -450,7 +498,7 @@
// 获取15天前到当前时间
function getNowTime() {
  const start = new Date(new Date().getTime() - 3600 * 1000 * 24 * 15)
  const start = new Date(new Date().getTime() - 3600 * 1000 * 24 * 70)
      .toISOString()
      .replace('T', ' ')
      .slice(0, 10) //默认开始时间15天前