gaoshp
2025-08-28 6de4878cf4487e937d1f31901e16d21e48a9fca4
搜索
已修改1个文件
200 ■■■■ 文件已修改
src/views/wel/shemi.vue 200 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/wel/shemi.vue
@@ -1,21 +1,9 @@
<template >
  <basic-container>
    <div class="norightmenu">
    <avue-crud
      :addBtn="false"
      :option="option"
      :table-loading="loading"
      :data="treeData"
      ref="crud"
      v-model:search="search"
      v-model:page="mypage"
      @current-change="currentChange"
      @size-change="sizeChange"
      @refresh-change="refreshChange"
      @on-load="onLoad"
      @tree-load="treeLoad"
      @row-click="rowClick"
    >
    <div class="norightmenu" v-if="!isSearch">
      <avue-crud :addBtn="false" :option="option" :table-loading="loading" :data="treeData" ref="crud"
        v-model:search="search" v-model:page="mypage" @current-change="currentChange" @size-change="sizeChange"
        @refresh-change="refreshChange" @on-load="onLoad" @tree-load="treeLoad" @row-click="rowClick">
      <template #search>
        <el-row :gutter="24">
          <el-col :span="6" class="search-data-flex">
@@ -28,16 +16,26 @@
          </el-col>
          <el-col :span="4" class="search-data-flex">
            <span class="search-data-title">零组件号:</span>
            <el-select v-model="searchTreeData.drawingNo" filterable remote reserve-keyword placeholder="零组件号" :remote-method="remoteMethod" :loading="searchLoading">
              <el-option v-for="item in drawingNoList" :key="item.value" :label="item.label" :value="item.value"/></el-select>
              <el-select v-model="searchTreeData.drawingNo" filterable remote reserve-keyword placeholder="零组件号"
                :remote-method="remoteMethod" :loading="searchLoading">
                <el-option v-for="item in drawingNoList" :key="item.value" :label="item.label"
                  :value="item.value" /></el-select>
          </el-col>
          <el-col :span="8" class="search-data-flex">
            <span class="search-data-title">时间范围:</span>
            <el-date-picker v-model="searchTreeData.createTime" type="daterange" start-placeholder="开始时间" end-placeholder="结束时间" :size="size" format="YYYY-MM-DD" value-format="YYYY-MM-DD"  @change="createTimeChange"/><!--:disabled-date="disabledDate" 不需要禁用日期-->
              <el-date-picker v-model="searchTreeData.createTime" type="daterange" start-placeholder="开始时间"
                end-placeholder="结束时间" :size="size" format="YYYY-MM-DD" value-format="YYYY-MM-DD"
                @change="createTimeChange" /><!--:disabled-date="disabledDate" 不需要禁用日期-->
          </el-col>
          <el-col :span="6" class="search-data-flex">
            <el-button type="primary" @click="searchTree" :loading="treeSearchLoad"><el-icon class="el-icon--right" style="margin-right: 6px;"><Search /></el-icon>搜索</el-button>
            <el-button :icon="Delete" @click="setClearTree"><el-icon class="el-icon--right" style="margin-right: 6px;"><Delete /></el-icon>清空</el-button>
              <el-button type="primary" @click="searchTree" :loading="treeSearchLoad"><el-icon class="el-icon--right"
                  style="margin-right: 6px;">
                  <Search />
                </el-icon>搜索</el-button>
              <el-button :icon="Delete" @click="setClearTree"><el-icon class="el-icon--right"
                  style="margin-right: 6px;">
                  <Delete />
                </el-icon>清空</el-button>
          </el-col>
        </el-row>
      </template>
@@ -56,9 +54,79 @@
        <!-- <el-button :size="size" text v-if="row.nodeType == 70" icon="el-icon-position" type="primary" @click="downsend(row)" placeholder="下发" title="下发"></el-button> -->
                    
        <!-- 替换  v-if="permission.auto_dispatch"-->
        <el-button :size="size" text v-if="row.nodeType == 60 && row.parentIds.indexOf('0,1,')>-1" icon="el-icon-switch" type="primary" @click="replacement(row)" placeholder="替换" title="替换"></el-button>
        <el-button :size="size" text v-if="permission.lock_button && row.nodeType == 60 && row.parentIds.indexOf('0,2')>-1 && row.isLocked != 1" icon="el-icon-lock" type="primary" @click="locked(row,true)" placeholder="锁定" title="锁定"></el-button>
        <el-button :size="size" text v-if="permission.lock_button && row.nodeType == 60 && row.parentIds.indexOf('0,2')>-1 && row.isLocked == 1" icon="el-icon-unlock" type="primary" @click="locked(row,false)" placeholder="解锁" title="解锁"></el-button>
          <el-button :size="size" text v-if="row.nodeType == 60 && row.parentIds.indexOf('0,1,') > -1"
            icon="el-icon-switch" type="primary" @click="replacement(row)" placeholder="替换" title="替换"></el-button>
          <el-button :size="size" text
            v-if="permission.lock_button && row.nodeType == 60 && row.parentIds.indexOf('0,2') > -1 && row.isLocked != 1"
            icon="el-icon-lock" type="primary" @click="locked(row, true)" placeholder="锁定" title="锁定"></el-button>
          <el-button :size="size" text
            v-if="permission.lock_button && row.nodeType == 60 && row.parentIds.indexOf('0,2') > -1 && row.isLocked == 1"
            icon="el-icon-unlock" type="primary" @click="locked(row, false)" placeholder="解锁" title="解锁"></el-button>
        </template>
      </avue-crud>
    </div>
    <div class="norightmenu" v-else>
      <avue-crud :addBtn="false" :option="option" :table-loading="loading" :data="treeData" ref="crud"
        v-model:search="search" v-model:page="mypage" @current-change="currentChange" @size-change="sizeChange"
        @refresh-change="refreshChange" @on-load="onLoad" @tree-load="treeLoad" @row-click="rowClick">
        <template #search>
          <el-row :gutter="24">
            <el-col :span="6" class="search-data-flex">
              <span class="search-data-title w68">程序状态:</span>
              <el-checkbox-group v-model="searchTreeData.programStatus" class="marginR12">
                <el-checkbox value="1" label="试切" />
                <el-checkbox value="2" label="固化" />
                <el-checkbox value="3" label="偏离" />
              </el-checkbox-group>
            </el-col>
            <el-col :span="4" class="search-data-flex">
              <span class="search-data-title">零组件号:</span>
              <el-select v-model="searchTreeData.drawingNo" filterable remote reserve-keyword placeholder="零组件号"
                :remote-method="remoteMethod" :loading="searchLoading">
                <el-option v-for="item in drawingNoList" :key="item.value" :label="item.label"
                  :value="item.value" /></el-select>
            </el-col>
            <el-col :span="8" class="search-data-flex">
              <span class="search-data-title">时间范围:</span>
              <el-date-picker v-model="searchTreeData.createTime" type="daterange" start-placeholder="开始时间"
                end-placeholder="结束时间" :size="size" format="YYYY-MM-DD" value-format="YYYY-MM-DD"
                @change="createTimeChange" /><!--:disabled-date="disabledDate" 不需要禁用日期-->
            </el-col>
            <el-col :span="6" class="search-data-flex">
              <el-button type="primary" @click="searchTree" :loading="treeSearchLoad"><el-icon class="el-icon--right"
                  style="margin-right: 6px;">
                  <Search />
                </el-icon>搜索</el-button>
              <el-button :icon="Delete" @click="setClearTree"><el-icon class="el-icon--right"
                  style="margin-right: 6px;">
                  <Delete />
                </el-icon>清空</el-button>
            </el-col>
          </el-row>
        </template>
        <!-- <template #menu-left>
        <el-button :size="size" type="primary" @click="showAdd()">新增根节点</el-button>
      </template> -->
        <template #name="{ row }">
          <span>{{ row.name }}</span>
          <!-- <el-button :size="size" text v-if="row.nodeType != 70" icon="el-icon-setting" type="primary" placeholder="修改" @click="showEdit(row)" title="修改"></el-button>
        <el-button :size="size" text v-if="row.nodeType != 10" icon="el-icon-delete" type="primary" @click="showDel(row)" placeholder="删除" title="删除"></el-button>
        <el-button :size="size" text v-if="row.nodeType != 60 && row.nodeType != 70" icon="el-icon-document-add" type="primary" @click="showAdd(row)" placeholder="新增子级" title="新增子级"></el-button>
        <el-button :size="size" text v-if="row.nodeType == 60 || row.nodeType == 50" icon="el-icon-upload" type="primary" @click="showUpload(row)" placeholder="文件上传" title="文件上传"></el-button> -->
          <!-- 涉密网才有 -->
          <!-- <el-button :size="size" text v-if="row.nodeType == 70" icon="el-icon-pie-chart" type="primary" @click="upgrade(row)" placeholder="升版" title="升版"></el-button> -->
          <!-- 工控网才有 -->
          <!-- <el-button :size="size" text v-if="row.nodeType == 70" icon="el-icon-position" type="primary" @click="downsend(row)" placeholder="下发" title="下发"></el-button> -->
          <!-- 替换  v-if="permission.auto_dispatch"-->
          <el-button :size="size" text v-if="row.nodeType == 60 && row.parentIds.indexOf('0,1,') > -1"
            icon="el-icon-switch" type="primary" @click="replacement(row)" placeholder="替换" title="替换"></el-button>
          <el-button :size="size" text
            v-if="permission.lock_button && row.nodeType == 60 && row.parentIds.indexOf('0,2') > -1 && row.isLocked != 1"
            icon="el-icon-lock" type="primary" @click="locked(row, true)" placeholder="锁定" title="锁定"></el-button>
          <el-button :size="size" text
            v-if="permission.lock_button && row.nodeType == 60 && row.parentIds.indexOf('0,2') > -1 && row.isLocked == 1"
            icon="el-icon-unlock" type="primary" @click="locked(row, false)" placeholder="解锁" title="解锁"></el-button>
      </template>
    </avue-crud>
  </div>
@@ -67,7 +135,8 @@
      <avue-form :option="modalOption" v-model="modalForm" @submit="modalSubmit" @reset-change="modalCancel"/>
    </el-dialog>
    <el-dialog title="上传文件" append-to-body v-model="uploadmodalBox">
      <avue-form :option="uploadmodalOption" v-model="uploadmodalForm" @submit="uploadmodalSubmit" @reset-change="uploadmodalCancel" :upload-before="uploadBefore" :upload-after="uploadAfter">
      <avue-form :option="uploadmodalOption" v-model="uploadmodalForm" @submit="uploadmodalSubmit"
        @reset-change="uploadmodalCancel" :upload-before="uploadBefore" :upload-after="uploadAfter">
        <template #fileList="{}" slot-scope="{ value }">
          <div v-for="(file, index) in fileList" :key="index" v-if="fileList.length != 0">
            {{ file.name }}
@@ -83,28 +152,33 @@
        <div v-html="convertToHtml(fileContent)" class="convertToHtml"></div>
    </template>
    <template v-else-if="tabsType == 'tab4'">
        <avue-crud :addBtn="false" :option="tabsFormOption4" :data="tabsForm4" ref="crud4" @selection-change="selectionChange">
      <avue-crud :addBtn="false" :option="tabsFormOption4" :data="tabsForm4" ref="crud4"
        @selection-change="selectionChange">
          <template #menu-left>
            <el-button :size="size" type="primary" @click="comparison" :disabled="selectionList.length != 2">对比</el-button>
          <el-button :size="size" type="primary" @click="comparison"
            :disabled="selectionList.length != 2">对比</el-button>
          </template>
        </avue-crud>
    </template>
    <el-dialog title="升版" append-to-body v-model="upgradeModal" width="500">
      <avue-form :option="upgradeModalOption" v-model="upgradeModalForm" @submit="upgradeSubmit" @reset-change="upgradeCancel"></avue-form>
      <avue-form :option="upgradeModalOption" v-model="upgradeModalForm" @submit="upgradeSubmit"
        @reset-change="upgradeCancel"></avue-form>
    </el-dialog>
  </basic-container>
  <!-- 文件对比 -->
  <el-drawer title="文件对比" append-to-body v-model="diffBox" size="100%" class="code-box">
      <div>
          <code-diff :old-string="this.content1" :new-string="this.content2" output-format="side-by-side" :hideStat="true" :filename="codeDiffFileName1" :newFilename="codeDiffFileName2"/>
      <code-diff :old-string="this.content1" :new-string="this.content2" output-format="side-by-side" :hideStat="true"
        :filename="codeDiffFileName1" :newFilename="codeDiffFileName2" />
      </div>
  </el-drawer>
  <!-- 替换 -->
  <el-drawer title="替换" append-to-body v-model="todolistModel" size="100%" class="code-box">
    <div class="approve-box">
        <div class="left">
            <TodolistLeft :row="row" :replaceDataId="replaceDataId" :drawingNo="drawingNo" :processNo="processNo" :processEdition="processEdition" @selection-change="todoSelectionChange" />
        <TodolistLeft :row="row" :replaceDataId="replaceDataId" :drawingNo="drawingNo" :processNo="processNo"
          :processEdition="processEdition" @selection-change="todoSelectionChange" />
        </div>
        <div class="right">
            <TodolistRightTop :row="row" :name="name" />
@@ -126,6 +200,7 @@
  data() {
    let rejectText = '驳回';//+this.row.categoryName;
    return {
      isSearch: false,
      treeSearchLoad: false,
      drawingNoList: [],
      searchLoading: false,
@@ -388,13 +463,16 @@
        ]
      },
      tabsForm4: {},
      defaultExpandedKeys: [],
      option: {
        highlightCurrentRow: true,
        rowKey: "id",
        treeProps: {
          children: "children",
          hasChildren: 'hasChildren',
          value: 'id',
          label: 'name'
        },
        defaultExpandedKeys: [],
        defaultExpandAll: false,
        lazy: true,
        rowKey: 'id',
@@ -804,20 +882,6 @@
    convertToHtml(text) {
        return text.replace(/\n/g, '<br>');
    },
    removeHasChildren(treeData) {  //查询时候使用,删掉hasChildren
      return treeData.map(node => {
        if (node.children && node.children.length > 0) {
          node.children = this.removeHasChildren(node.children);
        }
        if(node.children.length > 0) {
           const { hasChildren, ...rest } = node;
          return rest;
        } else {
          return node;
        }
        // 删除当前节点的 hasChildren 属性
      });
    },
     // 递归查找目标行(name="机床1")
    findTargetRow(data, targetName) {
      for (const item of data) {
@@ -838,11 +902,29 @@
        this.$refs.crud.setCurrentRow(this.targetRow); // 高亮目标行
      }
    },
    removeHasChildren(treeData) {  //查询时候使用,删掉hasChildren
      return treeData.map(node => {
        if (node.children && node.children.length > 0) {
          this.defaultExpandedKeys.push(node.id);
          console.log('>>>>>>>>', this.defaultExpandedKeys)
          node.children = this.removeHasChildren(node.children);
        }
        if (node.children.length > 0) {
          const { hasChildren, ...rest } = node;
          return Object.assign(rest, {});
        } else {
          return node;
        }
        // 删除当前节点的 hasChildren 属性
      });
    },
    searchTree() {
      if(this.searchTreeData.programStatus.length == 0) return;
      if(this.searchTreeData.drawingNo == "") return;
      this.treeSearchLoad = true;
      this.isSearch = true
      this.searchTreeData.status = this.searchTreeData.programStatus.join();
      this.treeData = []
      axios({
        url: '/blade-mdm/program/node/search-list2',
        method: 'get',
@@ -850,8 +932,12 @@
      }).then(res => {
        this.treeSearchLoad = false;
        if(res.data.data.length == 0) return;
        this.option.defaultExpandAll = true; 
        this.treeData = this.removeHasChildren(res.data.data);
        // this.option.defaultExpandAll = true;
        let treeData = this.removeHasChildren(res.data.data);
        console.log('treeData', treeData)
        this.option = Object.assign({},this.option,{defaultExpandedKeys: this.defaultExpandedKeys,lazy: true,defaultExpandAll: true});
        setTimeout(() => {
          this.treeData = treeData;
        this.$nextTick(() => {
          this.highlightTargetRow();  // 设置当前行高亮
          this.tabsForm = this.targetRow;  //tabs节点信息
@@ -865,7 +951,10 @@
        if(this.treeData.length == 0) {
          return;
        }
        }, 100);
      });
    },
    setClearTree() {
      this.option.defaultExpandAll = false;
@@ -1189,6 +1278,7 @@
      this.uploadmodalBox = false;
    },
    treeLoad (tree, treeNode, resolve) {
      console.log('tree', tree, treeNode, this.option)
      this.loading = true;
      var obj = {parentId: tree.id}
      axios({
@@ -1274,24 +1364,30 @@
.norightmenu .avue-crud .avue-crud__header {
            display: none !important;
      }
.delFile {
  color: red;
  margin-left: 12px;
  cursor: pointer;
}
.fileListStyle {
  margin-left: 10px;
  margin-top: 12px;
}
.highlight-row {
  background-color: #f0f7ff !important; /* 浅蓝色背景 */
  font-weight: bold; /* 加粗文字 */
  background-color: #f0f7ff !important;
  /* 浅蓝色背景 */
  font-weight: bold;
  /* 加粗文字 */
}
 
/* 如果需要悬停效果 */
.highlight-row:hover {
  background-color: #e6f0ff !important;
}
.approve-box {
  display: flex;
@@ -1307,6 +1403,7 @@
      flex: 1;
  }
}
.convertToHtml {
  background-color: #fffee1;
  padding: 6px 12px;
@@ -1317,22 +1414,27 @@
    background-color: #f0f7ff;
    font-weight: bold;
  }
  .code-box .el-drawer__header {
    margin-bottom: 0;
  }
  .search-data-title {
    font-size: 12px;
    margin-right: 8px;
    display: inline-block;
    width: 95px;
  }
  .search-data-flex {
    display: flex!important;
    align-items: center;
  }
  .w68 {
    width: 68px;
  }
  .marginR12 label {
    margin-right: 12px;
  }