wangting
2024-11-04 1f8e24520ed07be80f2190656fd35bf24a0cd14f
Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/businessType/index.vue
@@ -2,38 +2,10 @@
  <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" @click="editClickHandler">修改
            </el-button>
            <el-button icon="el-icon-delete" plain size="small" type="danger" @click="deleteClickHandler">删除
            </el-button>
            <el-button icon="el-icon-download" plain size="small" type="primary" @click="exportClickHandler">导出
            </el-button>
            <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="upLoadClickHandler">导入
            </el-button>
            <el-button class="miniBtn" icon="el-icon-circle-plus-outline" plain size="small"
                       type="primary" @click="createViewClickHandler">创建视图
            </el-button>
            <el-button class="miniBtn" icon="el-icon-circle-plus-outline" plain size="small"
                       type="primary" @click="indexClickHandler">创建索引
            </el-button>
            <el-button icon="el-icon-menu" plain size="small" style="width: 82px;text-align: center;padding-left: 1px"
                       type="primary" @click="checkClickHandler">一致性检查
            </el-button>
            <el-button class="miniBtn" icon="el-icon-delete" plain size="small"
                       type="danger" @click="checkClickHandler">删除数据
            </el-button>
            <el-button class="smallBtn" plain size="small"
                       type="danger" @click="checkClickHandler">删除全部类型
            </el-button>
            <el-button class="smallBtn" plain size="small" type="primary" @click="checkViewClickHandler">查看使用范围
            </el-button>
          </div>
        <div ref="TreeBox" style="height: calc(100vh - 154px);!important;">
          <!-- 左侧树 -->
          <div style="height:  calc(100vh - 330px);">
          <div style="height:  calc(100vh - 190px);">
            <avue-tree ref="tree" v-loading="treeLoading" :data="treeData" :option="treeOption" @node-click="nodeClick">
          <span slot-scope="{ node, data }" class="el-tree-node__label">
           <span style="font-size: 15px">
@@ -48,8 +20,21 @@
    </el-aside>
    <el-main>
      <basic-container>
        <div style="display: flex;justify-content: center; height: 230px">
          <div class="descBox" style="max-height: 100px">
        <div>
          <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" @click="editClickHandler">修改</el-button>
          <el-button icon="el-icon-delete" plain size="small" type="danger" @click="deleteClickHandler">删除</el-button>
          <el-button icon="el-icon-download" plain size="small" type="primary" @click="exportClickHandler">导出</el-button>
          <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="upLoadClickHandler">导入</el-button>
          <el-button icon="el-icon-circle-plus-outline" plain size="small" type="primary" @click="createViewClickHandler">创建视图</el-button>
          <el-button icon="el-icon-circle-plus-outline" plain size="small" type="primary" @click="indexClickHandler">创建索引</el-button>
          <el-button icon="el-icon-menu" plain size="small" type="primary" @click="checkClickHandler">一致性检查</el-button>
          <el-button icon="el-icon-delete" plain size="small" type="danger" @click="checkClickHandler">删除数据</el-button>
          <el-button icon="el-icon-delete" plain size="small" type="danger" @click="checkClickHandler">删除全部类型</el-button>
          <el-button icon="el-icon-view" plain size="small" type="primary" @click="checkViewClickHandler">查看使用范围</el-button>
        </div>
        <div style="display: flex;justify-content:left;margin-top: 15px;">
          <div class="descBox" style="width: 40%">
            <el-descriptions :column="1" border class="margin-top" size="medium" title="属性信息">
              <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
                                    :labelStyle="descriptionOption.labelStyle">
@@ -72,8 +57,7 @@
                </template>
                <el-tooltip v-if="nodeRow.implClass" :content="nodeRow.implClass" class="item" effect="dark"
                            placement="top-start">
                  <el-tag style="max-width: 250px;overflow: hidden">{{ nodeRow.implClass }}
                  </el-tag>
                  <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"
@@ -85,7 +69,7 @@
              </el-descriptions-item>
            </el-descriptions>
          </div>
          <div class="descBox">
          <div class="descBox" style="width: 25%;">
            <el-descriptions :column="1" border class="margin-top" size="medium" title="版本规则">
              <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
                                    :labelStyle="descriptionOption.labelStyle">
@@ -137,7 +121,7 @@
            </el-descriptions>
          </div>
          <div class="descBox">
          <div class="descBox" style="width: calc(35% - 40px);margin-right: 0">
            <el-descriptions :column="1" border class="margin-top" size="medium" title="生命周期">
              <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
                                    :labelStyle="descriptionOption.labelStyle">
@@ -149,8 +133,8 @@
            </el-descriptions>
          </div>
        </div>
        <div style="margin-top: 30px">
          <h3>属性列表</h3>
        <div style="margin-top: 25px;position: relative">
          <h3 style="margin: 0;position: absolute;top:0;z-index: 1000;">属性列表</h3>
          <avue-crud
            :data="attrData"
            :option="attrOption">
@@ -168,9 +152,9 @@
      class="avue-dialog"
      width="75%"
      @close="addDialogClose">
      <el-form ref="form" :model="form" :rules="rules" label-width="95px">
      <el-form ref="form" :model="form" :rules="rules" label-width="95px" size="small">
        <div class="dialogForm">
          <div class="leftForm">
          <div class="leftForm" style="width: 40%">
            <el-form-item label="类型名称:" prop="id">
              <el-input v-model="form.id" :readOnly="title === 'edit'"></el-input>
            </el-form-item>
@@ -178,13 +162,11 @@
              <el-input v-model="form.name"></el-input>
            </el-form-item>
            <el-form-item label="继承自:">
              <div style="display: flex;gap: 5px;align-items: center">
                <el-input v-model="form.fName" :readOnly="true"></el-input>
                <el-button :disabled="title === 'add'" plain size="small" style="margin-left: 5px;height: 30px"
                           type="success"
                           @click="inheritClickHandler">选择
                </el-button>
              </div>
              <avue-input-tree :disabled="title === 'add'"
                               v-model="form.fName"
                               placeholder="请选择业务类型"
                               :props="{label: 'id', value: 'id',children: 'children'}"
                               :dic="inheritTreeData"></avue-input-tree>
            </el-form-item>
            <el-form-item label="实现类:">
              <el-input v-model="form.implClass"></el-input>
@@ -193,7 +175,7 @@
              <el-input v-model="form.description" :rows="2" type="textarea"></el-input>
            </el-form-item>
          </div>
          <div class="centerForm">
          <div class="centerForm" style="width: 24%">
            <el-form-item label="版本规则:" label-width="110px" prop="revLevel">
              <el-select v-model="form.revLevel" @change="revLevelChange">
                <el-option label="不可修订" value="0"></el-option>
@@ -202,19 +184,18 @@
              </el-select>
            </el-form-item>
            <el-form-item v-if="form.revLevel !== '0'" label="版本号规则:" label-width="110px" prop="revisionRuleId">
              <div style="display: flex;gap: 5px;align-items: center">
                <el-input v-model="form.revisionRuleId" :readOnly="true"></el-input>
                <el-button :disabled="form.inputRevisionFlag" plain size="small" style="margin-left: 5px;height: 30px"
                           type="success"
                           @click="versionAddHandler">添加
                </el-button>
                <el-switch
                  v-model="form.inputRevisionFlag"
                  active-text="手工输入"
                  style="width: 300px"
                  @change="form.revisionRuleId = ''">
                </el-switch>
              </div>
              <avue-select v-model="form.revisionRuleId"
                           :disabled="form.inputRevisionFlag"
                           placeholder="请选择版本号规则"
                           :filterable="true"
                           :props="{label: 'id', value: 'id'}"
                           :dic="versionData"></avue-select>
              <el-switch
                v-model="form.inputRevisionFlag"
                active-text="手工输入"
                style="width: 300px"
                @change="form.revisionRuleId = ''">
              </el-switch>
            </el-form-item>
            <el-form-item v-if="form.revLevel !== '0'" label="分隔符:" label-width="110px" prop="delimiter">
              <el-select v-model="form.delimiter" clearable>
@@ -231,14 +212,13 @@
              </el-select>
            </el-form-item>
          </div>
          <div class="rightForm">
          <div class="rightForm" style="width: 26%">
            <el-form-item label="生命周期:" label-width="138px" prop="lifeCycleId">
              <div style="display: flex;gap: 5px;align-items: center">
                <el-input v-model="form.lifeCycleId" :readOnly="true"></el-input>
                <el-button plain size="small" style="margin-left: 5px;height: 30px" type="success"
                           @click="lifeAddHandler('input')">添加
                </el-button>
              </div>
              <avue-select v-model="form.lifeCycleId"
                           placeholder="请选择生命周期"
                           :filterable="true"
                           :props="{label: 'id', value: 'id'}"
                           :dic="dialogLifeData"></avue-select>
            </el-form-item>
            <el-form-item label="备选生命周期列表:" label-width="138px">
@@ -279,7 +259,7 @@
        </div>
      </el-form>
      <div class="bottomForm">
        <h3>属性池列表</h3>
        <h3 style="margin-bottom: 10px;">属性池列表</h3>
        <avue-crud
          :data="dialogAttrData"
          :option="dialogAttrOption"
@@ -289,9 +269,9 @@
          </template>
        </avue-crud>
      </div>
      <span slot="footer" class="dialog-footer">
         <el-button @click="addDialogClose">取 消</el-button>
      <span slot="footer" class="dialog-footer avue-dialog__footer">
         <el-button type="primary" @click="addDialogSavaHandler">确 定</el-button>
         <el-button @click="addDialogClose">取 消</el-button>
        </span>
    </el-dialog>
@@ -326,35 +306,6 @@
        </span>
    </el-dialog>
    <!-- 版本号规则选择 -->
    <el-dialog
      v-dialogDrag
      :visible.sync="dialogVersionVisible"
      append-to-body="true"
      class="avue-dialog"
      title="版本号规则"
      width="60%"
    >
      <avue-crud
        :key="dialogVersionKey"
        ref="dialogAttrCrud"
        :data="dialogVersionData"
        :option="dialogVersionOption"
        :table-loading="dialogVersionLoading"
        @row-click="dialogVersionRowClick"
        @search-change="versionHandleSearch"
        @search-reset="versionHandleReset"
      >
      </avue-crud>
      <span slot="footer" class="dialog-footer">
         <el-button @click="dialogVersionVisible = false">取 消</el-button>
         <el-button type="primary" @click="dialogVersionAddClickHandler">确 定</el-button>
        </span>
    </el-dialog>
    <!-- 生命周期 -->
    <el-dialog
      v-dialogDrag
@@ -369,7 +320,6 @@
        ref="dialogAttrCrud"
        :data="dialogLifeData"
        :option="dialogLifeOption"
        :table-loading="dialogLifeLoading"
        @row-click="dialogLifeRowClick"
        @search-change="lifeHandleSearch"
        @search-reset="lifeHandleReset"
@@ -380,31 +330,6 @@
         <el-button type="primary" @click="dialogLifeAddClickHandler">确 定</el-button>
        </span>
    </el-dialog>
    <!-- 继承自 -->
    <el-dialog
      v-dialogDrag
      :visible.sync="dialogInheritVisible"
      append-to-body="true"
      class="avue-dialog"
      title="继承业务类型"
      width="30%"
      @close="inheritClose"
    >
      <avue-tree ref="inheritTree" v-model="treeForm" :data="inheritTreeData" :option="inheritTreeOption"
                 @node-click="inheritNodeClick">
         <span slot-scope="{ node, data }" class="el-tree-node__label">
           <span style="font-size: 15px">
              <i class="el-icon-s-promotion"></i>
                {{ (node || {}).label }}
            </span>
          </span>
      </avue-tree>
      <span slot="footer" class="dialog-footer">
         <el-button @click="inheritClose">取 消</el-button>
         <el-button type="primary" @click="inheritSaveClickHandler">确 定</el-button>
        </span>
    </el-dialog>
    <!-- 导入 -->
@@ -446,8 +371,8 @@
        :table-loading="conCheckLoading">
      </avue-crud>
      <span slot="footer" class="dialog-footer">
         <el-button @click="conCheckVisible = false">取 消</el-button>
         <el-button type="primary" @click="repairClickHandler">修 复</el-button>
         <el-button @click="conCheckVisible = false">取 消</el-button>
        </span>
    </el-dialog>
@@ -506,13 +431,13 @@
          :option="indexAttrOption"
          @row-click="indexAttrRowClick"></avue-crud>
        <span slot="footer" class="dialog-footer">
         <el-button @click="indexAttrVisible = false">取 消</el-button>
         <el-button type="primary" @click="indexAttrClickAddHandler">确 定</el-button>
         <el-button @click="indexAttrVisible = false">取 消</el-button>
        </span>
      </el-dialog>
      <span slot="footer" class="dialog-footer">
         <el-button @click="indexDialogClose">取 消</el-button>
         <el-button type="primary" @click="indexClickAddHandler">保 存</el-button>
         <el-button @click="indexDialogClose">取 消</el-button>
        </span>
    </el-dialog>
@@ -655,6 +580,7 @@
        searchMenuSpan: 8,
        refreshBtn: false,
        selection: false,
        header:false,
        column: [
          {
            label: '名称',
@@ -682,21 +608,7 @@
      fileUrl: 'api/linkTypeController/impData',
      createViewLoading: false, // 创建视图
      versionAddFlag: false,
      treeForm: {},
      inheritNodeRow: {},
      inheritTreeOption: {
        height: 'auto',
        defaultExpandAll: false,
        menu: false,
        addBtn: false,
        props: {
          label: 'id',
          value: 'id',
          children: 'children'
        }
      },
      inheritTreeData: [],
      dialogInheritVisible: false,
      dialogLifeDefalutData: [], // 查询重置默认数据
      lifeType: '',
      dialogLifeTable: [],
@@ -723,32 +635,7 @@
      },
      dialogLifeLoading: false,
      dialogLfeVisible: false,
      dialogVersionDefalutData: [], // 查询重置默认数据
      dialogSwitchValue: false,
      dialogVersionSaveRow: {},
      dialogVersionVisible: false,
      dialogVersionKey: Math.random(),
      dialogVersionData: [],
      dialogVersionOption: {
        ...basicOption,
        addBtn: false,
        selection: false,
        refreshBtn: false,
        menu: false,
        height: 450,
        searchMenuSpan: 8,
        highlightCurrentRow: true,
        // calcHeight: 100,
        column: [
          {
            label: '版本号规则',
            prop: 'id',
            searchLabelWidth: 110,
            search: true
          }
        ]
      },
      dialogVersionLoading: false,
      versionData: [],//版本规则数据
      dialogAttrSelectList: [],
      searchAttrParams: {},
      dialogAttrLoading: false,
@@ -768,6 +655,7 @@
        highlightCurrentRow: true,
        height: 450,
        searchMenuSpan: 8,
        header: false,
        column: [
          {
            label: '属性名',
@@ -779,6 +667,7 @@
            label: '属性类型',
            prop: 'attributeDataType',
            sortable: true,
            width:150,
          },
          {
            label: '初始值',
@@ -815,6 +704,7 @@
        selection: false,
        height: 210,
        addBtn: false,
        menuWidth:100,
        // index:false,
        column: [
          {
@@ -832,11 +722,13 @@
            label: '属性类型',
            prop: 'attributeDataType',
            sortable: true,
            width:150,
          },
          {
            label: '初始值',
            prop: 'defaultValue',
            sortable: true,
            width:150,
          },
          {
            label: '说明',
@@ -908,7 +800,8 @@
        props: {
          label: 'TreeName',
          value: 'id',
          children: 'children'
          children: 'children',
          name: 'name'
        }
      },
      treeData: [
@@ -927,11 +820,13 @@
        name: 'el-icon-tickets',
        desc: 'el-icon-chat-line-square'
      },
      treeLoading:false
      treeLoading: false
    }
  },
  created() {
    this.getTreeList();
    this.getVersionList();
    this.getLifeCycle();
  },
  mounted() {
  },
@@ -967,7 +862,19 @@
      this.attrData = row.attributes ? JSON.parse(row.attributes) : [];
      this.nodeRow = row;
    },
    //获取版本规则数据
    getVersionList(){
      getVersionRuleAllList().then(res => {
        this.versionData = res.data.data;
      });
    },
    //获取生命周期数据
    getLifeCycle(){
      gridLifeCycle().then(res => {
        this.dialogLifeData = res.data.data;
        this.dialogLifeDefalutData = res.data.data;
      });
    },
    // 创建按钮
    addClickHandler() {
      if (func.isEmptyObject(this.nodeRow)) {
@@ -976,31 +883,8 @@
      }
      this.title = 'add';
      this.form.fName = this.nodeRow.id === 'topNode' ? "" : this.nodeRow.id;
      console.log(this.nodeRow);
      this.form.inputRevisionFlag = JSON.parse(this.form.inputRevisionFlag); // 字符串false转换为布尔值
      this.visible = true;
    },
    // 关闭继承对话框
    inheritClose() {
      this.dialogInheritVisible = false;
      this.$refs.inheritTree.setCurrentKey(null); // 取消当前选中的节点
    },
    // 继承按钮
    inheritClickHandler() {
      this.dialogInheritVisible = true;
    },
    // 继承树行点击
    inheritNodeClick(row) {
      this.inheritNodeRow = row;
    },
    // 继承树保存
    inheritSaveClickHandler() {
      this.form.fName = this.inheritNodeRow.id;
      this.dialogInheritVisible = false;
    },
    // 对话框 属性池列表增加按钮
@@ -1120,81 +1004,12 @@
      this.dialogAttrData.splice(index, 1);
    },
    // 版本规则管理添加
    versionAddHandler() {
      this.dialogVersionVisible = true;
      this.dialogVersionKey = Math.random(); // 打开时刷新表格避免表格错行
      this.dialogVersionLoading = true;
      getVersionRuleAllList().then(res => {
        const data = res.data.data.map(item => {
          return {
            id: item.id
          }
        });
        this.dialogVersionData = data;
        this.dialogVersionDefalutData = data;
        this.dialogVersionLoading = false;
      }).catch(err => {
        this.$message.error(err)
      });
    },
    // 版本规则行点击
    dialogVersionRowClick(row) {
      this.dialogVersionSaveRow = row;
    },
    // 版本规则搜索
    versionHandleSearch(params, done) {
      const {id} = params;
      if (!params.id) {
        this.dialogVersionData = this.dialogVersionDefalutData;
        return done();
      }
      ;
      this.dialogVersionData = this.dialogVersionDefalutData.filter(item => {
        return item.id && item.id.includes(id);
      });
      done();
    },
    // 版本管理置空
    versionHandleReset() {
      this.dialogVersionData = this.dialogVersionDefalutData;
    },
    // 版本号规则保存
    dialogVersionAddClickHandler() {
      if (func.isEmptyObject(this.dialogVersionSaveRow)) {
        this.$message.error('请至少选择一条数据');
        return;
      }
      this.form.revisionRuleId = this.dialogVersionSaveRow.id;
      this.dialogVersionVisible = false;
    },
    // 生命周期新增
    lifeAddHandler(val) {
      this.dialogLfeVisible = true;
      this.dialogLifeKey = Math.random(); // 打开时刷新表格避免表格错行
      this.dialogLifeLoading = true;
      this.lifeType = val;
      gridLifeCycle().then(res => {
        const data = res.data.data.map(item => {
          return {
            id: item.id
          }
        });
        this.dialogLifeData = data;
        this.dialogLifeDefalutData = data;
        this.dialogLifeLoading = false
      }).catch(err => {
        this.$message.error(err)
      });
    },
    // 生命周期行点击
@@ -1301,7 +1116,7 @@
    // 新增编辑保存
    addDialogSavaHandler() {
      if (!this.form.inputRevisionFlag && (!this.form.revisionRuleId || this.form.revisionRuleId === "")) {
      if (this.form.revLevel !== '0' &&!this.form.inputRevisionFlag && (!this.form.revisionRuleId || this.form.revisionRuleId === "")) {
        this.$message.error('请检查版本号规则不能为空');
        return;
      }
@@ -1359,9 +1174,31 @@
        ? this.nodeRow.lifeCycleIds.split(',').map(item => ({id: item.trim()}))
        : [];
      this.dialogAttrData = this.nodeRow.attributes ? JSON.parse(this.nodeRow.attributes) : [];
      function  processChildren(item,fName) {
        if (item.children && item.children.length > 0) {
          item.children = item.children.map(child => {
            processChildren(child,fName); // 递归处理每个子节点
            if(fName==child.id){
              child.disabled=true;
            }else {
              child.disabled=false;
            }
            return child;
          });
        }
      };
      const inheritTreeData=this.inheritTreeData.map(item => {
        processChildren(item,this.form.id); // 处理每个节点
        if(this.form.id==item.id){
          item.disabled=true;
        }else {
          item.disabled=false;
        }
        return item;
      });
      this.inheritTreeData=inheritTreeData
      this.title = 'edit';
      this.visible = true;
      console.log(this.form);
    },
    // 删除按钮
@@ -1671,66 +1508,26 @@
    width: 100%;
  }
  .headerCon {
    .el-button {
      width: 82px;
    }
  .el-tag{
    line-height:22px;
    height: 24px;
  }
}
.headerCon {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 5px;
  .el-button + .el-button {
    margin-left: 5px;
  }
  .el-button {
    margin-top: 5px;
  }
}
.headerCon > .el-button:nth-child(4) {
  margin-left: 0;
}
.headerCon > .el-button:nth-child(7) {
  margin-left: 0;
}
.headerCon > .el-button:nth-child(10) {
  margin-left: 0;
}
.miniBtn {
  width: 82px;
  text-align: center;
  padding-left: 7px;
}
.smallBtn {
  width: 82px;
  text-align: center;
  padding-left: 4.5px;
}
.descBox {
  width: 32%;
  margin-left: 20px;
  margin-right: 20px;
}
.dialogForm {
  display: flex;
  justify-content: space-around;
  justify-content: space-between;
}
.dialogForm > div {
  width: 29%;
  border: 1px solid #eee;
  border: 1px solid #EBEEF5;
  border-radius: 2px;
  padding: 25px 20px 5px 10px; /* 上 右 下 左 */
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2); /* 添加阴影效果 */
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1); /* 添加阴影效果 */
}