ludc
2025-01-16 986aa62ed00bee39363bab41b4eeb8259d446efd
Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/linkType/index.vue
@@ -2,32 +2,12 @@
  <el-container v-loading="createViewLoading">
    <el-aside>
      <basic-container>
        <div ref="TreeBox" style="height: calc(100vh - 144px);!important;">
          <div class="headerCon">
            <el-button icon="el-icon-plus" plain size="small" type="primary" @click="addClickHandler">创建
            </el-button>
            <el-button icon="el-icon-edit" plain size="small" type="primary">修改
            </el-button>
            <el-button icon="el-icon-delete" plain size="small" type="danger">删除
            </el-button>
            <el-button icon="el-icon-view" plain size="small" type="primary">查看
            </el-button>
            <el-button icon="el-icon-download" plain size="small" type="primary">导出
            </el-button>
            <el-button icon="el-icon-upload2" plain size="small" type="primary">导入
            </el-button>
            <el-button icon="el-icon-circle-plus-outline" plain size="small"
                       type="primary" @click="createViewClickHandler">创建视图
            </el-button>
            <el-button icon="el-icon-menu" plain size="small"
                       type="primary" @click="checkClickHandler">一致性检查
            </el-button>
          </div>
          <!-- 左侧树         -->
          <div style="height:  calc(100vh - 300px);">
        <div ref="TreeBox" style="height: calc(100vh - 154px);!important;">
          <!-- 左侧树 -->
          <div style="height:  calc(100vh - 190px);">
            <avue-tree :data="treeData" :option="treeOption" @node-click="nodeClick">
          <span slot-scope="{ node, data }" class="el-tree-node__label">
           <span style="font-size: 15px">
           <span>
              <i class="el-icon-s-promotion"></i>
                {{ (node || {}).label }}
            </span>
@@ -41,121 +21,144 @@
    <el-main>
      <basic-container>
        <div>
          <el-descriptions :column="2" border class="margin-top" size="medium">
            <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
                                  :labelStyle="descriptionOption.labelStyle">
              <template slot="label">
                <i :class="icons.id"></i>
                名称
              </template>
              {{ nodeRow.name }}
            </el-descriptions-item>
            <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
                                  :labelStyle="descriptionOption.labelStyle">
              <template slot="label">
                <i :class="icons.name"></i>
                标签
              </template>
              {{ nodeRow.tag }}
            </el-descriptions-item>
            <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
                                  :labelStyle="descriptionOption.labelStyle">
              <template slot="label">
                <i :class="icons.tableName"></i>
                实现类
              </template>
              {{ nodeRow.implClass }}
            </el-descriptions-item>
            <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
                                  :labelStyle="descriptionOption.labelStyle">
              <template slot="label">
                <i :class="icons.domain"></i>
                形状
              </template>
              <el-tag v-if="nodeRow.shape">
                {{ nodeRow.shape }}
              </el-tag>
            </el-descriptions-item>
            <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
                                  :labelStyle="descriptionOption.labelStyle">
              <template slot="label">
                <i :class="icons.desc"></i>
                描述
              </template>
              {{ nodeRow.description }}
            </el-descriptions-item>
          </el-descriptions>
          <el-descriptions :column="3" border class="margin-top" direction="vertical">
            <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
                                  :labelStyle="descriptionOption.labelStyle">
              <template slot="label">
                <i :class="icons.from"></i>
                From端类型
              </template>
              <span v-for="item in nodeRow.btmItemsFrom" style="margin-left:2px;">
              <el-tag effect="plain" style="margin-top: 2px;">
                  {{ item }}
              </el-tag>
            </span>
            </el-descriptions-item>
            <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
                                  :labelStyle="descriptionOption.labelStyle">
              <template slot="label">
                <i :class="icons.from"></i>
                Form端主类型
              </template>
              <el-tag v-if="nodeRow.primitivesFrom" effect="plain">
                {{ nodeRow.primitivesFrom === '请选择' ? nodeRow.btmItemsFrom[0] : nodeRow.primitivesFrom }}
              </el-tag>
            </el-descriptions-item>
            <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
                                  :labelStyle="descriptionOption.labelStyle">
              <template slot="label">
                <i :class="icons.from"></i>
                From端对应关系
              </template>
              <el-tag v-if="nodeRow.relationFrom" effect="plain">{{ nodeRow.relationFrom }}</el-tag>
            </el-descriptions-item>
          </el-descriptions>
          <el-descriptions :column="3" border class="margin-top" direction="vertical">
            <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
                                  :labelStyle="descriptionOption.labelStyle">
              <template slot="label">
                <i :class="icons.to"></i>
                To端类型
              </template>
              <span v-for="item in nodeRow.btmItemsTo" style="margin-left:2px;">
              <el-tag effect="plain" style="margin-top: 2px;">
                  {{ item }}
              </el-tag>
            </span>
            </el-descriptions-item>
            <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
                                  :labelStyle="descriptionOption.labelStyle">
              <template slot="label">
                <i :class="icons.to"></i>
                To端主类型
              </template>
              <el-tag v-if="nodeRow.primitivesTo" effect="plain">
                {{ nodeRow.primitivesTo === '请选择' ? nodeRow.btmItemsTo[0] : nodeRow.primitivesTo }}
              </el-tag>
            </el-descriptions-item>
            <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
                                  :labelStyle="descriptionOption.labelStyle">
              <template slot="label">
                <i :class="icons.to"></i>
                To端对应关系
              </template>
              <el-tag v-if="nodeRow.relationTo" effect="plain">{{ nodeRow.relationTo }}</el-tag>
            </el-descriptions-item>
          </el-descriptions>
          <el-button v-if="permissionList.addBtn" class="button-custom-icon" plain size="small" type="primary"
                     @click="addClickHandler">
            <icon-show :name="permissionList.addBtn.source"></icon-show>
            创建
          </el-button>
          <el-button v-if="permissionList.editBtn" class="button-custom-icon" plain size="small" type="primary" @click="editClickHandler">
            <icon-show :name="permissionList.editBtn.source"></icon-show>
            修改
          </el-button>
          <el-button v-if="permissionList.delBtn" class="button-custom-icon" plain size="small" type="danger" @click="deleteClickHandler">
            <icon-show :name="permissionList.delBtn.source"></icon-show>
            删除
          </el-button>
          <el-button v-if="permissionList.importBtn" class="button-custom-icon" plain size="small" type="primary" @click="upLoadClickHandler">
            <icon-show :name="permissionList.importBtn.source"></icon-show>
            导入
          </el-button>
          <el-button v-if="permissionList.exportBtn" class="button-custom-icon" plain size="small" type="primary" @click="exportClickHandler">
            <icon-show :name="permissionList.exportBtn.source"></icon-show>
            导出
          </el-button>
          <el-button v-if="permissionList.createViewBtn" class="button-custom-icon" plain size="small" type="primary" @click="createViewClickHandler">
            <icon-show :name="permissionList.createViewBtn.source"></icon-show>
            创建视图
          </el-button>
          <el-button v-if="permissionList.consistencyCheckBtn" class="button-custom-icon" plain size="small" type="primary" @click="checkClickHandler">
            <icon-show :name="permissionList.consistencyCheckBtn.source"></icon-show>
            一致性检查
          </el-button>
        </div>
        <div style="margin-top: 20px">
          <h3>属性池列表</h3>
        <el-descriptions style="margin: 10px 0 20px" :column="2" border class="margin-top" size="medium">
          <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
                                :labelStyle="descriptionOption.labelStyle">
            <template slot="label">
              <i :class="icons.id"></i>
              名称
            </template>
            {{ nodeRow.name }}
          </el-descriptions-item>
          <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
                                :labelStyle="descriptionOption.labelStyle">
            <template slot="label">
              <i :class="icons.name"></i>
              标签
            </template>
            {{ nodeRow.tag }}
          </el-descriptions-item>
          <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
                                :labelStyle="descriptionOption.labelStyle">
            <template slot="label">
              <i :class="icons.tableName"></i>
              实现类
            </template>
            <el-tooltip v-if="nodeRow.implClass" :content="nodeRow.implClass" class="item" effect="dark"
                        placement="top-start">
              <el-tag style="max-width: 100%;overflow: hidden;display: block">{{ nodeRow.implClass }}</el-tag>
            </el-tooltip>
          </el-descriptions-item>
          <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
                                :labelStyle="descriptionOption.labelStyle">
            <template slot="label">
              <i :class="icons.domain"></i>
              形状
            </template>
            <el-tag v-if="nodeRow.shape">
              {{ nodeRow.shape }}
            </el-tag>
          </el-descriptions-item>
          <el-descriptions-item :span="2" :contentStyle="descriptionOption.contentStyle"
                                :labelStyle="descriptionOption.labelStyle">
            <template slot="label">
              <i :class="icons.desc"></i>
              描述
            </template>
            {{ nodeRow.description }}
          </el-descriptions-item>
          <el-descriptions-item :span="2" contentStyle="word-break:break-all;"
                                :labelStyle="descriptionOption.labelStyle">
            <template slot="label">
              <i :class="icons.from"></i>From端类型
            </template>
            <span v-for="item in nodeRow.btmItemsFrom">
                <el-tag effect="plain" style="margin:2px 5px 2px 0;">
                    {{ item }}
                </el-tag>
              </span>
          </el-descriptions-item>
          <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
                                :labelStyle="descriptionOption.labelStyle">
            <template slot="label">
              <i :class="icons.from"></i>
              Form端主类型
            </template>
            <el-tag v-if="nodeRow.primitivesFrom" effect="plain">
              {{ nodeRow.primitivesFrom === '请选择' ? nodeRow.btmItemsFrom[0] : nodeRow.primitivesFrom }}
            </el-tag>
          </el-descriptions-item>
          <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
                                :labelStyle="descriptionOption.labelStyle">
            <template slot="label">
              <i :class="icons.from"></i>
              From端对应关系
            </template>
            <el-tag v-if="nodeRow.relationFrom" effect="plain">{{ nodeRow.relationFrom }}</el-tag>
          </el-descriptions-item>
          <el-descriptions-item :span="2" contentStyle="word-break:break-all;"
                                :labelStyle="descriptionOption.labelStyle">
            <template slot="label">
              <i :class="icons.to"></i>
              To端类型
            </template>
            <span v-for="item in nodeRow.btmItemsTo">
                 <el-tag effect="plain" style="margin:2px 5px 2px 0;">
                  {{ item }}
                 </el-tag>
              </span>
          </el-descriptions-item>
          <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
                                :labelStyle="descriptionOption.labelStyle">
            <template slot="label">
              <i :class="icons.to"></i>
              To端主类型
            </template>
            <el-tag v-if="nodeRow.primitivesTo" effect="plain">
              {{ nodeRow.primitivesTo === '请选择' ? nodeRow.btmItemsTo[0] : nodeRow.primitivesTo }}
            </el-tag>
          </el-descriptions-item>
          <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
                                :labelStyle="descriptionOption.labelStyle">
            <template slot="label">
              <i :class="icons.to"></i>
              To端对应关系
            </template>
            <el-tag v-if="nodeRow.relationTo" effect="plain">{{ nodeRow.relationTo }}</el-tag>
          </el-descriptions-item>
        </el-descriptions>
        <div style="position: relative">
          <h3 style="margin: 0;position: absolute;top:0;z-index: 1000;">属性列表</h3>
          <avue-crud
            :data="tableData"
            :option="tableOption"
@@ -164,83 +167,136 @@
      </basic-container>
    </el-main>
    <!-- 创建 && 编辑   -->
    <!-- 创建 && 编辑 -->
    <el-dialog
      v-dialogDrag
      :title="title === 'add' ? '创建' : '修改'"
      :visible.sync="visible"
      append-to-body="true"
      class="avue-dialog"
      title="创建"
      width="70%"
      @close="addDialogClose"
    >
      <el-form ref="form" :model="form" :rules="rules" label-width="90px">
      <el-form ref="form" :model="form" :rules="rules" label-width="85px" size="small">
        <div class="dialogForm">
          <div class="leftForm">
            <el-form-item label="名称:" prop="name">
              <el-input v-model="form.name"></el-input>
              <el-input v-model="form.name" :readOnly="title === 'edit'"></el-input>
            </el-form-item>
            <el-form-item label="标签:">
              <el-input v-model="form.tag"></el-input>
            </el-form-item>
            <el-form-item label="实现类:">
              <el-input v-model="form.impClass"></el-input>
              <el-input v-model="form.implClass"></el-input>
            </el-form-item>
            <el-form-item label="形状">
              <el-input v-model="form.shape"></el-input>
            </el-form-item>
            <el-form-item label="描述">
              <el-input v-model="form.description" :rows="2" type="textarea"></el-input>
              <el-input v-model="form.description" :rows="3" type="textarea"></el-input>
            </el-form-item>
          </div>
          <div class="centerForm">
            <el-form-item label="Form端类型:" label-width="110px">
              <el-input v-model="form.btmItemsFrom"></el-input>
            <el-form-item label-width="110px" style="margin-bottom: 5px;">
              <div slot="label">
                <span>Form端类型:</span>
                <el-button plain size="mini" style="margin-right: 10px" type="success"  @click="FormItemReferChange('form')">添加</el-button>
              </div>
              <div style="height: 190px;border: 1px solid #EBEEF5;overflow-y: auto">
                <el-table :data="bizFormData" :show-header="false" style="width: 100%" size="mini">
                  <el-table-column
                    align="center"
                    prop="name">
                  </el-table-column>
                  <el-table-column
                    label="操作"
                    width="60">
                    <template slot-scope="scope">
                      <el-button
                        size="mini"
                        style="color:#F56C6C;"
                        type="text"
                        @click.native.prevent="bizTypeDeleteRow('form',scope.$index)">
                        移除
                      </el-button>
                    </template>
                  </el-table-column>
                </el-table>
              </div>
            </el-form-item>
            <el-form-item label="对应关系:" label-width="110px">
              <el-select v-model="form.relationFrom">
                <el-option label="N" value="N"></el-option>
                <el-option label="1" value="1"></el-option>
              </el-select>
            <el-form-item label="对应关系:" label-width="110px" style="margin-bottom: 5px;">
              <el-radio v-model="form.relationFrom" label="N">N</el-radio>
              <el-radio v-model="form.relationFrom" label="1">1</el-radio>
            </el-form-item>
            <el-form-item label="主类型:" label-width="110px">
              <el-input v-model="form.primitivesFrom"></el-input>
              <el-select v-model="form.primitivesFrom">
                <el-option v-for="(item,index) in bizFormData" :key="index" :label="item.name"
                           :value="item.name"></el-option>
              </el-select>
            </el-form-item>
          </div>
          <div class="rightForm">
            <el-form-item label="To端类型:" label-width="110px">
              <el-input v-model="form.btmItemsTo"></el-input>
            <el-form-item label-width="100px" style="margin-bottom: 5px;">
              <div slot="label">
                <span>To端类型:</span>
                <el-button plain size="mini" style="margin-right: 10px" type="success"  @click="FormItemReferChange('to')">添加</el-button>
              </div>
              <div style="height: 190px;border: 1px solid #EBEEF5;overflow-y: auto">
                <el-table :data="bizToData" :show-header="false" style="width: 100%" size="mini">
                  <el-table-column
                    align="center"
                    prop="name">
                  </el-table-column>
                  <el-table-column
                    label="操作"
                    width="60">
                    <template slot-scope="scope">
                      <el-button
                        size="mini"
                        style="color:#F56C6C;"
                        type="text"
                        @click.native.prevent="bizTypeDeleteRow('to',scope.$index)">
                        移除
                      </el-button>
                    </template>
                  </el-table-column>
                </el-table>
              </div>
            </el-form-item>
            <el-form-item label="对应关系:" label-width="110px">
              <el-select v-model="form.relationTo">
                <el-option label="N" value="N"></el-option>
                <el-option label="1" value="1"></el-option>
              </el-select>
            <el-form-item label="对应关系:" label-width="110px" style="margin-bottom: 5px;">
              <el-radio v-model="form.relationTo" label="N">N</el-radio>
              <el-radio v-model="form.relationTo" label="1">1</el-radio>
            </el-form-item>
            <el-form-item label="主类型:" label-width="110px">
              <el-input v-model="form.primitivesTo"></el-input>
              <el-select v-model="form.primitivesTo">
                <el-option v-for="(item,index) in bizToData" :key="index" :label="item.name"
                           :value="item.name"></el-option>
              </el-select>
            </el-form-item>
          </div>
        </div>
      </el-form>
      <div class="bottomForm">
        <h3>属性池列表</h3>
      <div class="bottomForm" style="margin-top: 10px;">
        <avue-crud
          size="mini"
          :data="dialogBottomData"
          :option="dialogBottomOption"
          @row-del="dialogBottomAttrDel"
        >
          <template slot="menuLeft" slot-scope="scope">
            <el-button icon="el-icon-plus" plain size="small" type="primary" @click="dialogAddClickHandler">增 加
            <h3 style="display: inline-block;margin-right: 20px;margin-bottom: 10px;">属性池列表</h3>
            <el-button icon="el-icon-plus" plain size="mini" type="primary" @click="dialogAddClickHandler">增 加
            </el-button>
          </template>
        </avue-crud>
      </div>
      <span slot="footer" class="dialog-footer">
         <el-button>取 消</el-button>
         <el-button type="primary">确 定</el-button>
        </span>
         <el-button size="small" type="primary" @click="addDialogSavaHandler">确 定</el-button>
         <el-button size="small" @click="addDialogClose">取 消</el-button>
      </span>
      <!-- 属性池列表 -->
      <el-dialog
@@ -253,18 +309,23 @@
        @close="dialogAttrClose"
      >
        <avue-crud
          ref="dialogAttrCrud"
          :key="dialogAttrReload"
          ref="dialogAttrCrud"
          :data="dialogAttrData"
          :option="dialogAttrOption"
          :page.sync="attrPage"
          :table-loading="dialogAttrLoading"
          @selection-change="dialogAttrSelectChange"
          @row-click="dialogAttrRowClickHandler"
          @size-change="attrSizeChange"
          @current-change="attrCurrentChange"
          @search-change="attrHandleSearch"
          @search-reset="attrHandleReset"
        >
        </avue-crud>
        <span slot="footer" class="dialog-footer">
         <el-button @click="dialogAttrClose">取 消</el-button>
         <el-button type="primary">确 定</el-button>
         <el-button size="small" type="primary" @click="dialogAttrAddClickHandler">确 定</el-button>
         <el-button size="small" @click="dialogAttrClose">取 消</el-button>
        </span>
      </el-dialog>
    </el-dialog>
@@ -272,58 +333,210 @@
    <!-- 一致性检查 -->
    <el-dialog
      v-dialogDrag
      :visible.sync="checkVisible"
      :visible.sync="conCheckVisible"
      append-to-body="true"
      class="avue-dialog"
      title="一致性检查"
      width="60%"
    >
      <avue-crud
        :data="conCheckData"
        :option="conCheckOption"
        :table-loading="conCheckLoading">
      </avue-crud>
      <span slot="footer" class="dialog-footer">
         <el-button size="small" @click="conCheckVisible = false">取 消</el-button>
         <el-button size="small" type="primary" @click="repairClickHandler">修 复</el-button>
        </span>
    </el-dialog>
    <!-- form to 端类型对话框表格 -->
    <el-dialog
      v-dialogDrag
      :title="bizTypeTitle === 'form' ? 'Form端类型' : 'To端类型'"
      :visible.sync="bizTypeVisible"
      append-to-body="true"
      class="avue-dialog"
      width="70%"
    >
      <avue-crud
        :key="bizTypeReload"
        ref="bizTypeCrud"
        :data="bizTypeData"
        :option="bizTypeOption"
        :table-loading="bizTypeLoading"
        @search-change="bizTypeHandleSearch"
        @search-reset="bizTypeHandleReset"
        @selection-change="bizTypeSelection"
        @row-click="bizTypeRowClick">
      </avue-crud>
      <span slot="footer" class="dialog-footer">
         <el-button size="small" type="primary" @click="bizTypeAddHandler">确 定</el-button>
         <el-button size="small" @click="bizTypeVisible = false">取 消</el-button>
        </span>
    </el-dialog>
    <!-- 导入 -->
    <upload-file ref="upload" :fileType="upFileType" :fileUrl="fileUrl" :tipList="tipList" title="导入"
                 @updata="getTreeList"></upload-file>
  </el-container>
</template>
<script>
import {gridLink, getByAttributeNames, checkLinkType, createView} from "@/api/modeling/linkType/api";
import {
  gridLink,
  getByAttributeNames,
  checkLinkType,
  createView,
  getBizTypes,
  addAndEditLink,
  expData,
  repairTable,
  deleteLink
} from "@/api/modeling/linkType/api";
import basicOption from '@/util/basic-option'
import {gridAttribute} from "@/api/modeling/attributePool/api";
import func from "@/util/func";
import {mapGetters} from "vuex";
export default {
  name: "index",
  data() {
    return {
      tipList: [
        "导入链接名称不可为空且链接类型名称只能为英文字母",
        "导入的文件包括属性、业务类型、生命周期等文件",
        "上传的文件为压缩文件,且压缩格式仅能为zip格式"
      ],
      upFileType: ['zip'],
      fileUrl: 'api/linkTypeController/impData',
      title: '',
      bizTypeReload: null,
      bizToData: [],
      bizFormData: [],
      bizTypeList: [],
      bizTypeLoading: false,
      bizTypeData: [],
      bizTypeOption: {
        ...basicOption,
        menu: false,
        addBtn: false,
        index: false,
        refreshBtn: false,
        highlightCurrentRow: true,
        searchMenuSpan: 8,
        searchLabelWidth: 100,
        calcHeight: 30,
        header: false,
        column: [
          {
            label: '业务类型名',
            prop: 'name',
            sortable: true,
            search: true,
          },
          {
            label: '标签',
            prop: 'label',
            sortable: true,
          },
          {
            label: '父类',
            prop: 'fName',
            sortable: true,
          },
          {
            label: '版本规则',
            prop: 'revRuleName',
            sortable: true,
          },
          {
            label: '生命周期',
            prop: 'lifeCycle',
            sortable: true,
          },
        ]
      },
      bizTypeVisible: false,
      bizTypeTitle: "",
      conDefaultCheckData: [], // 保留上个接口返回的数据
      conCheckLoading: false,
      conCheckOption: {
        ...basicOption,
        menu: false,
        addBtn: false,
        index: false,
        selection: false,
        refreshBtn: false,
        header:false,
        column: [
          {
            label: '类型名',
            prop: 'id',
          },
          {
            label: '操作',
            prop: 'methods',
          },
          {
            label: '状态',
            prop: 'status',
          }
        ]
      },
      conCheckData: [],
      conCheckVisible: false,
      attrPage: {
        currentPage: 1,
        pageSize: 30,
        total: 0,
        pageSizes: [30, 50, 100, 200],
      },
      searchAttrParams: {},
      dialogAttrReload: Math.random(),
      dialogAttrSelectList: [],
      dialogAttrLoading: false,
      dialogAttrData: [], // 属性池新增表格
      dialogAttrData: [], // 属性池弹窗表格
      dialogAttrOption: {
        ...basicOption,
        calcHeight: -60,
        addBtn: false,
        menu: false,
        refreshBtn: false,
        index:false,
        index: false,
        highlightCurrentRow: true,
        height:450,
        height: 450,
        searchMenuSpan: 8,
        header:false,
        selectable:function(row){
          return row.selectable;
        },
        column: [
          {
            label: '属性名',
            prop: 'id',
            sortable: true,
            search: true,
            width:260,
          },
          {
            label: '属性类型',
            prop: 'attributeDataType',
            sortable: true,
            width:150,
          },
          {
            label: '初始值',
            prop: 'defaultValue',
            sortable: true,
            width:200,
          },
          {
            label: '说明',
            prop: 'description',
            sortable: true,
            overHidden:true
            overHidden: true
          }
        ]
      },
@@ -338,7 +551,7 @@
      form: {
        name: '', // 名称
        tag: '', // 标签
        impClass: '', // 实现类
        implClass: '', // 实现类
        shape: '', // 形状
        description: '', // 描述
        btmItemsFrom: '', // From端类型列表
@@ -346,36 +559,43 @@
        primitivesFrom: '', // form端主类型
        btmItemsTo: '', // to端类型列表
        relationTo: 'N', // to端对应关系
        primitivesTo: '', // to端主类型
        primitivesTo: '', // to端主类型,
        attributes: []
      },
      dialogBottomOption: {
        ...basicOption,
        editBtn: false,
        refreshBtn: false,
        selection: false,
        height: 300,
        height: 220,
        menuWidth:100,
        addBtn: false,
        delBtn: false,
        gridBtn:false,
        columnBtn:false,
        // index:false,
        column: [
          {
            label: '属性名',
            prop: 'id',
            sortable: true,
            width:260,
          },
          {
            label: '属性类型',
            prop: 'attributeDataType',
            sortable: true,
            width:150,
          },
          {
            label: '初始值',
            prop: 'defaultValue',
            sortable: true,
            width:200,
          },
          {
            label: '说明',
            prop: 'description',
            overHidden: true
          }
        ]
      },
@@ -402,32 +622,37 @@
        // index:false,
        addBtn: false,
        menu: false,
        calcHeight: -30,
        column: [
          {
            label: '属性名',
            prop: 'id',
            sortable: true,
            width:260,
          },
          {
            label: '属性类型',
            prop: 'attributeDataType',
            sortable: true,
            width:150,
          },
          {
            label: '初始值',
            prop: 'defaultValue',
            sortable: true,
            width:200,
          },
          {
            label: '说明',
            prop: 'description',
            overHidden: true
          }
        ]
      },
      nodeRow: {},
      descriptionOption: {
        labelStyle: 'text-align:center;width:120px',
        contentStyle: 'width:240px;text-align:center;word-break;break-all;'
        contentStyle: 'width:240px;text-align:center;word-break:break-all;'
      },
      icons: {
        id: 'el-icon-finished',
@@ -439,13 +664,26 @@
        main: 'el-icon-warning-outline',
        desc: 'el-icon-chat-line-square'
      },
      bizLastIndex: null,
      attrLastIndex: null
    }
  },
  created() {
    this.getTreeList();
  },
  mounted() {
  computed:{
    ...mapGetters(["permission"]),
    permissionList() {
      return {
        addBtn: this.vaildData(this.permission[this.$route.query.id].ADD, false),
        delBtn: this.vaildData(this.permission[this.$route.query.id].DELETE, false),
        editBtn: this.vaildData(this.permission[this.$route.query.id].EDIT, false),
        exportBtn: this.vaildData(this.permission[this.$route.query.id].EXPORT, false),
        importBtn: this.vaildData(this.permission[this.$route.query.id].IMPORT, false),
        consistencyCheckBtn: this.vaildData(this.permission[this.$route.query.id].USE, false),
        createViewBtn: this.vaildData(this.permission[this.$route.query.id].ADD2, false),
      };
    },
  },
  methods: {
    // 树onLoad请求
@@ -454,13 +692,17 @@
        const data = res.data.data;
        this.treeData = data;
        this.tableLoading = false;
      }).catch(err => {
        this.$message.error(err)
      });
      })
    },
    // 导入
    upLoadClickHandler() {
      this.$refs.upload.visible = true;
    },
    // 树点击事件
    nodeClick(row) {
      console.log(row);
      this.nodeRow = row;
      this.getAttrPollData(row); // 获取属性池列表
    },
@@ -475,18 +717,145 @@
      })
    },
    // 删除按钮
    deleteClickHandler() {
      if (func.isEmptyObject(this.nodeRow)) {
        this.$message.error('请至少选择一条数据');
        return;
      }
      ;
      this.$confirm('您确定要删除所选择的数据吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        deleteLink(this.nodeRow).then(res => {
          if (res.data.code === 200) {
            this.$message.success('删除成功');
            this.getTreeList();
          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    // 创建按钮
    addClickHandler() {
      this.visible = true;
      this.title = 'add';
    },
    // 编辑按钮
    editClickHandler() {
      this.title = 'edit';
      if (func.isEmptyObject(this.nodeRow)) {
        this.$message.error('请至少选择一条数据');
        return;
      }
      this.form = {...this.nodeRow}; // 浅拷贝 解决引用复制
      console.log(this.nodeRow);
      this.bizFormData = this.form.btmItemsFrom.length > 0 && this.form.btmItemsFrom.map(item => {
        return {
          name: item
        };
      });
      this.bizToData = this.form.btmItemsTo.length > 0 && this.form.btmItemsTo.map(item => {
        return {
          name: item
        };
      });
      if (this.form.attributes.length > 0) {
        let value = this.form.attributes.join(',');
        getByAttributeNames({attrNames: value}).then(res => {
          if (res.data.code === 200) {
            this.dialogBottomData = res.data.data;
          }
        })
      }
      this.visible = true;
    },
    // 一致性检查
    checkClickHandler() {
      this.checkVisible = true;
      checkLinkType().then(res => {
        if (res && res.data && res.data.data) {
          this.conCheckVisible = true;
          this.conCheckLoading = true;
          if (res.data.code === 200) {
            const data = res.data.data;
            this.conDefaultCheckData = data; // 保留一份原始数据
            this.conCheckLoading = false;
            const outputData = [];
            data.forEach(item => {
              Object.entries(item.btmCheckMap).forEach(([id, methodsArray]) => {
                methodsArray.forEach(methods => {
                  // 判断前缀
                  const action = methods.startsWith('F_') ? '移除form端业务类型' : '移除to端业务类型';
                  const detail = methods.split('_')[1]; // 获取 _ 后面的内容
                  outputData.push({
                    id: id,
                    methods: `${action}:${detail}`,
                    status: '未修复'
                  });
                });
              });
              // 处理 dbCheckMap
              Object.entries(item.dbCheckMap).forEach(([id, methods]) => {
                const splitMethods = methods.split('(');
                // 判断第一个符号前面的值
                if (splitMethods[0].startsWith('_ADD')) {
                  outputData.push({
                    id: id,
                    methods: '增加列(' + splitMethods[0].slice(0, -1) + ')', // 结束位置减去)的字符
                    status: '未修复'
                  });
                } else if (splitMethods[0].startsWith('_CREATE')) {
                  outputData.push({
                    id: id,
                    methods: '创建表(' + splitMethods[0].slice(0, -1) + ')',
                    status: '未修复'
                  });
                } else if (splitMethods[0].startsWith('_DROP')) {
                  outputData.push({
                    id: id,
                    methods: '移除列(' + splitMethods[0].slice(0, -1) + ')',
                    status: '未修复'
                  });
                } else {
                  this.$message.error("不支持的 dbCheckMap 类型: " + methods)
                }
              });
            });
            this.conCheckData = outputData;
          }
        } else {
          this.$message.success(res.data.msg);
        }
      }).catch(err => {
        this.$message.error(err)
        this.$message.error(err);
      })
    },
    // 修复一致性检查
    repairClickHandler() {
      const params = this.conDefaultCheckData[0];
      repairTable(params).then(res => {
        if (func.isEmptyObject(res.data.obj[0])) {
          this.$message.success('修复成功');
          this.conCheckData = [];
        } else {
          this.$message.error('修复失败,请重新尝试!');
        }
        this.conCheckVisible = false;
      })
    },
@@ -496,8 +865,10 @@
      createView().then(res => {
        if (res.data.code === 200) {
          this.createViewLoading = false;
          this.$message.success(res.data.obj)
          this.$message.success(res.data.obj);
        }
      }).catch(err => {
        this.createViewLoading = false;
      })
    },
@@ -506,12 +877,21 @@
      this.dialogAttrLoading = true;
      this.attrPollDialogVisible = true;
      this.dialogAttrReload = Math.random(); // 强制刷新表格 解决表格错行
      gridAttribute(1, -1, this.searchParams).then(res => {
        const data = res.data.data;
      this.getAttrDialogDta();
    },
    // 查询属性池列表数据
    getAttrDialogDta() {
      gridAttribute(this.attrPage.currentPage, this.attrPage.pageSize, this.searchAttrParams).then(res => {
        const data = res.data.data.map(item=>{
          item.selectable=!this.dialogBottomData.some(existingItem => existingItem.id === item.id);
          return item;
        });
        this.dialogAttrData = data;
        this.attrPage.total = res.data.total;
        this.dialogAttrLoading = false;
      }).catch(err => {
        this.$message.error(err)
        this.$message.error(err);
      });
    },
@@ -522,12 +902,250 @@
    // 添加属性池 行点击
    dialogAttrRowClickHandler(row) {
      this.$refs.dialogAttrCrud.toggleRowSelection(row);
      if(!row.selectable){
        return;
      }
      func.rowClickHandler(
        row,
        this.$refs.dialogAttrCrud,
        this.attrLastIndex,
        (newIndex) => {
          this.attrLastIndex = newIndex;
        },
        () => {
          this.dialogAttrSelectList = [row];
        }
      );
    },
    // 添加属性池 关闭对话框
    dialogAttrClose(){
    dialogAttrClose() {
      this.attrPollDialogVisible = false;
      this.searchAttrParams = {};
    },
    // 清空form表单
    resetForm() {
      const form = {
        name: '', // 名称
        tag: '', // 标签
        implClass: '', // 实现类
        shape: '', // 形状
        description: '', // 描述
        btmItemsFrom: '', // From端类型列表
        relationFrom: 'N', // form端对应关系
        primitivesFrom: '', // form端主类型
        btmItemsTo: '', // to端类型列表
        relationTo: 'N', // to端对应关系
        primitivesTo: '', // to端主类型
      };
      this.form = form;
      this.$refs.form.resetFields();
      this.bizFormData = [];
      this.bizToData = [];
      this.dialogBottomData = [];
    },
    // 添加属性池 保存
    dialogAttrAddClickHandler() {
      this.dialogAttrSelectList.forEach(item => {
        this.dialogBottomData.push({
          id: item.id,
          attributeDataType: item.attributeDataType,
          defaultValue: item.defaultValue,
          description: item.description
        });
      });
      this.attrPollDialogVisible = false;
    },
    //添加属性池 条数
    attrSizeChange(val) {
      this.attrPage.pageSize = val;
      this.getAttrDialogDta()
    },
    //添加属性池 页码
    attrCurrentChange(val) {
      this.attrPage.currentPage = val;
      this.getAttrDialogDta();
    },
    //添加属性池 搜索
    attrHandleSearch(params, done) {
      if (func.isEmptyObject(params)) {
        this.searchAttrParams = {};
      } else {
        this.searchAttrParams = {
          "conditionMap[id]": "*" + params.id + "*"
        };
      }
      this.getAttrDialogDta();
      done();
    },
    //添加属性池 清空搜索
    attrHandleReset() {
      this.searchAttrParams = {};
      this.getAttrDialogDta();
    },
    // 属性池删除
    dialogBottomAttrDel(form, index) {
      this.dialogBottomData.splice(index, 1);
    },
    // 创建 编辑 对话框关闭
    addDialogClose() {
      this.visible = false;
      this.dialogBottomData = [];
      this.resetForm();
    },
    // form to 类型blur参照对话框
    FormItemReferChange(val) {
      this.bizTypeTitle = val;
      this.bizTypeLoading = true;
      this.getBizTypeHandler();
      this.bizTypeVisible = true;
      this.bizTypeReload = Math.random(); // 强制刷新表格 解决表格错行
    },
    // form to 类型表格查询
    getBizTypeHandler(params) {
      getBizTypes(params).then(res => {
        if (res.data.code === 200) {
          const data = res.data.data;
          this.bizTypeData = data;
          this.bizTypeLoading = false;
        }
      })
    },
    // form to 类型选择框
    bizTypeSelection(row) {
      this.bizTypeList = row;
    },
    // form to 类型行点击
    bizTypeRowClick(row) {
      func.rowClickHandler(
        row,
        this.$refs.bizTypeCrud,
        this.bizLastIndex,
        (newIndex) => {
          this.bizLastIndex = newIndex;
        },
        () => {
          this.bizTypeList = [row];
        }
      );
    },
    // form to 类型保存
    bizTypeAddHandler() {
      if (this.bizTypeList.length === 0) {
        this.$message.error('请至少选择一条数据');
        return;
      }
      const data = this.bizTypeList.map(item => ({name: item.name}));
      const dataName = this.bizTypeTitle === 'form' ? 'bizFormData' : 'bizToData';
      let hasDuplicate = false;
      // 先创建一个临时数组来存储不重复的项
      const newItems = [];
      this.bizTypeList.forEach(item => {
        const exists = this[dataName].some(existingItem => existingItem.name === item.name);
        if (exists) {
          hasDuplicate = true;
          return;
        }
        // 如果没有重复项,则将该项添加到临时数组中
        newItems.push({
          name: item.name,
        });
      });
      if (hasDuplicate) {
        this.$message.error('请检查是否有添加重复项!');
      } else {
        // 如果没有重复项,将新项添加到 dialogBottomData
        this[dataName].push(...newItems);
        this.bizTypeVisible = false;
      }
    },
    // form to 类型搜索
    bizTypeHandleSearch(params, done) {
      console.log(params);
      let obj = {
        btmName: params.name
      };
      this.getBizTypeHandler(obj);
      done();
    },
    // form to 类型重置
    bizTypeHandleReset() {
      this.getBizTypeHandler();
    },
    // form to 端表格移除
    bizTypeDeleteRow(val, index) {
      const dataName = val === 'form' ? 'bizFormData' : 'bizToData';
      const primitivesName = val === 'form' ? 'primitivesFrom' : 'primitivesTo';
      this[dataName].splice(index, 1);
      if (this[dataName].length === 0) {
        this.form[primitivesName] = "";
      }
    },
    // 创建编辑 保存
    addDialogSavaHandler() {
      if (this.bizFormData.length <= 0 || this.bizToData.length <= 0) {
        this.$message.error('form端业务类型和to端类型均不能为空!')
        return;
      }
      this.$refs.form.validate((valid) => {
        if (valid) {
          this.form.btmItemsFrom = this.bizFormData.map(item => item.name);
          this.form.btmItemsTo = this.bizToData.map(item => item.name);
          this.form.attributes = this.dialogBottomData.map(item => item.id);
          let flag = this.title === 'add' ? true : false;
          addAndEditLink(flag, this.form).then(res => {
            if (res.data.code === 200) {
              this.visible = false;
              this.$message.success(res.data.msg);
              this.resetForm();
              this.getTreeList();
            }
          });
        } else {
          return false;
        }
      });
    },
    // 导出
    exportClickHandler() {
      if (func.isEmptyObject(this.nodeRow)) {
        this.$message.error('请至少选择一条数据');
        return;
      }
      let name = this.nodeRow.name;
      expData({name: name}).then(res => {
        func.downloadFileByBlobHandler(res);
        this.$message.success('导出成功');
      }).catch(err => {
        this.$message.error(err);
      });
    }
  }
}
@@ -542,39 +1160,32 @@
  .el-form-item .el-select {
    width: 100%;
  }
}
.headerCon {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 5px;
  .el-button + .el-button {
    margin-left: 5px;
  .el-tag{
    line-height:22px;
    height: 24px;
  }
  .el-button {
    margin-top: 5px;
  }
}
.headerCon > .el-button:nth-child(4) {
  margin-left: 0;
}
.headerCon > .el-button:nth-child(7) {
  margin-left: 0;
}
.dialogForm {
  display: flex;
  justify-content: space-around;
  justify-content: space-between;
}
.dialogForm > div {
  width: 28%;
  border: 1px solid #eee;
  padding: 25px 20px 5px 10px; /* 上 右 下 左 */
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2); /* 添加阴影效果 */
  width: 31%;
  border: 1px solid #EBEEF5;
  border-radius: 2px;
  padding: 15px 20px 0 10px; /* 上 右 下 左 */
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1); /* 添加阴影效果 */
}
.leftForm {
  width: 28% !important;
}
.smallBtn {
  width: 82px !important;
  text-align: center !important;
  padding-left: 0px !important;
}
</style>