xiejun
2023-12-07 05d45bd440ffc92e14e6c8728ac8956a0488c0ab
Source/UBCS-WEB/src/views/modeling/Business.vue
@@ -1,25 +1,33 @@
<template>
  <el-container>
    <el-header class="businessHeader" style="height: 40px;padding:0 8px">
      <el-button-group>
        <el-button type="primary" @click="businessAdd" size="small"> <i class="el-icon-plus"></i>&nbsp; 新增</el-button>
        <el-button type="primary" @click="businessEdit" size="small"><i class="el-icon-edit"></i>&nbsp; 修改</el-button>
        <el-button type="primary" @click="selectFromTable" size="small"><i class="el-icon-thumb"></i>&nbsp;
          从已有中获取</el-button>
      </el-button-group>
    </el-header>
<!--    <el-header class="businessHeader" style="height: 40px;padding:0 8px">-->
<!--    </el-header>-->
    <el-container>
      <el-aside width="240px">
      <el-aside style="width: 20%">
        <basic-container class="businessTreeContainer">
          <p style="margin-top: 10px;font-weight: 570;font-size: 19px">{{ treeOption.title }}</p>
          <avue-tree id="basic" :data="treeData" :option="treeOption" @node-click="nodeClick" class="businessTree">
            <span class="el-tree-node__label" slot-scope="{ node, data }">
          <div class="app">
            <div style="display: flex;margin-bottom: 10px;justify-content: space-around;">
              <el-button v-if="permissionList.addBtn"  size="mini" type="primary" @click="businessAdd" plain style="width: 60px">
                新增
              </el-button>
              <el-button v-if="permissionList.editBtn"  size="mini" type="primary" @click="businessEdit" plain style="width: 60px">
                修改
              </el-button>
              <el-button v-if="permissionList.table"  size="mini" type="primary"
                         @click="selectFromTable" plain> 从已有中获取
              </el-button>
            </div>
            <avue-tree :data="treeData" :option="treeOption" class="businessTree" @node-click="nodeClick" style="width: fit-content;">
            <template slot-scope="{ node, data }" class="el-tree-node__label">
              <span>
                <i :class="(node || {}).level === 2 ? 'el-icon-star-off' : 'el-icon-folder-opened'"></i>
                {{ (node || {}).label }}
              </span>
            </span>
          </avue-tree>
            </template>
            </avue-tree>
          </div>
        </basic-container>
      </el-aside>
      <el-container>
@@ -27,17 +35,17 @@
          <!--基本信息-->
          <basic-container>
            <p style="margin-top: 10px;font-weight: 570;font-size: 19px">基本信息</p>
            <el-descriptions class="margin-top" :column="3" :size="size" border>
              <el-descriptions-item :labelStyle="descriptionOption.labelStyle"
                :contentStyle="descriptionOption.contentStyle">
            <el-descriptions :column="3" :size="size" border class="margin-top">
              <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
                                    :labelStyle="descriptionOption.labelStyle">
                <template slot="label">
                  <i :class="icons.key"></i>
                  英文名称
                </template>
                {{ obj.id }}
              </el-descriptions-item>
              <el-descriptions-item :labelStyle="descriptionOption.labelStyle"
                :contentStyle="descriptionOption.contentStyle">
              <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
                                    :labelStyle="descriptionOption.labelStyle">
                <template slot="label">
                  <i :class="icons.name"></i>
                  中文名称
@@ -45,15 +53,15 @@
                {{ obj.name }}
              </el-descriptions-item>
              <el-descriptions-item>
                <template slot="label" :labelStyle="descriptionOption.labelStyle"
                  :contentStyle="descriptionOption.contentStyle">
                <template slot="label" :contentStyle="descriptionOption.contentStyle"
                          :labelStyle="descriptionOption.labelStyle">
                  <i :class="icons.tableName"></i>
                  数据库表名
                </template>
                {{ obj.tableName }}
              </el-descriptions-item>
              <el-descriptions-item :labelStyle="descriptionOption.labelStyle"
                :contentStyle="descriptionOption.contentStyle">
              <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
                                    :labelStyle="descriptionOption.labelStyle">
                <template slot="label">
                  <i :class="icons.domain"></i>
                  所属领域
@@ -63,47 +71,33 @@
                </el-tag>
                <span v-else></span>
              </el-descriptions-item>
              <!-- <el-descriptions-item>
            <template slot="label">
              <i class="el-icon-s-ticket"></i>
              标签
            </template>
            {{obj.hashtag}}
          </el-descriptions-item> -->
              <!-- <el-descriptions-item>
            <template slot="label">
              <i class="el-icon-arrow-up"></i>
              继承自
            </template>
            {{ obj.sss }}
          </el-descriptions-item> -->
              <el-descriptions-item :labelStyle="descriptionOption.labelStyle"
                :contentStyle="descriptionOption.contentStyle">
              <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
                                    :labelStyle="descriptionOption.labelStyle">
                <template slot="label">
                  <i :class="icons.revisionRule"></i>
                  版本规则
                </template>
                {{ obj.revisionRuleName ? obj.revisionRuleName+ '(' + obj.revisionRuleId + ')' : ''}}
                {{ obj.revisionRuleName ? obj.revisionRuleName + '(' + obj.revisionRuleId + ')' : '' }}
              </el-descriptions-item>
              <el-descriptions-item :labelStyle="descriptionOption.labelStyle"
                :contentStyle="descriptionOption.contentStyle">
              <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
                                    :labelStyle="descriptionOption.labelStyle">
                <template slot="label">
                  <i :class="icons.lifeCycle"></i>
                  生命周期
                </template>
                {{ obj.lifeCycleName ? obj.lifeCycleName + '(' + obj.lifeCycleId + ')' : ''}}
                {{ obj.lifeCycleName ? obj.lifeCycleName + '(' + obj.lifeCycleId + ')' : '' }}
              </el-descriptions-item>
              <el-descriptions-item :labelStyle="descriptionOption.labelStyle"
                :contentStyle="descriptionOption.contentStyle">
                <template slot="label">
                  <i :class="icons.view"></i>
                  视图
                </template>
                <el-tag v-if="obj.viewText" size="small">
                  {{ obj.viewText }}
                </el-tag>
                <span v-else></span>
              </el-descriptions-item>
<!--              <el-descriptions-item :contentStyle="descriptionOption.contentStyle"-->
<!--                                    :labelStyle="descriptionOption.labelStyle">-->
<!--                <template slot="label">-->
<!--                  <i :class="icons.view"></i>-->
<!--                  视图-->
<!--                </template>-->
<!--                <el-tag v-if="obj.viewText" size="small">-->
<!--                  {{ obj.viewText }}-->
<!--                </el-tag>-->
<!--                <span v-else></span>-->
<!--              </el-descriptions-item>-->
              <!-- <el-descriptions-item>
            <template slot="label">
              <i class="el-icon-arrow-down"></i>
@@ -111,8 +105,8 @@
            </template>
            {{ obj.implClass }}
          </el-descriptions-item> -->
              <el-descriptions-item :labelStyle="descriptionOption.labelStyle"
                :contentStyle="descriptionOption.contentStyle">
              <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
                                    :labelStyle="descriptionOption.labelStyle">
                <template slot="label">
                  <i :class="icons.desc"></i>
                  描述
@@ -124,24 +118,24 @@
          <!-- 属性列表-->
          <basic-container>
            <p style="margin-top: 10px;font-weight: 570;font-size: 19px">属性列表</p>
            <avue-crud class="attributeCrud" v-model="obj" :data="obj.attributes" :option="loadOption">
            <avue-crud v-model="obj" :data="obj.attributes" :option="loadOption" class="attributeCrud">
              <template slot="attrDataTypeText" slot-scope="{row}">
                <el-tag>{{ row.attrDataTypeText }}</el-tag>
              </template>
            </avue-crud>
          </basic-container>
        </el-main>
        <el-dialog :visible="ref.visible" title="从数据库中添加" width="700px" append-to-body @close="dialoghandelfalse">
        <el-dialog :visible="ref.visible" append-to-body title="从数据库中添加" width="700px" @close="dialoghandelfalse" top="9vh">
          选择领域:
          <el-select v-model="domain" placeholder="请选择" @change="refOnLoad" size="small">
          <el-select v-model="domain" placeholder="请选择" size="small" @change="refOnLoad">
            <el-option v-for="item in domainOptions" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
          </el-select>
          <div class="sep" style="height:7px">
          </div>
          <avue-crud class="businessCrud" v-model="ref.form" :option="ref.option" :data="ref.data"
            @selection-change="selectionChange">
          <avue-crud ref="businessCrud" v-model="ref.form" :data="ref.data" :option="ref.option" class="businessCrud"
                     @selection-change="selectionChange">
          </avue-crud>
          <span slot="footer" class="dialog-footer">
            <el-button @click="dialoghandelfalse">取 消</el-button>
@@ -151,7 +145,7 @@
      </el-container>
    </el-container>
    <business-add ref="btmAdd" :btmType="addOption.btmType" :domainOption="domainOptions" :icons="icons"
      @refreshTable="initTreeOnLoad">
                  @refreshTable="initTreeOnLoad">
    </business-add>
  </el-container>
</template>
@@ -163,6 +157,8 @@
  saveFromTable,
  getDetail
} from "@/api/omd/btmType"
import {mapGetters} from "vuex";
export default {
  name: "Business",
  data() {
@@ -175,10 +171,10 @@
      selectionList: [],
      treeData: [],
      treeOption: {
        defaultExpandAll: true,
        defaultExpandAll: false,
        title: '业务类型树',
        addBtn: false,
        menu:false,
        menu: false,
        props: {
          labelText: '',
          label: 'label',
@@ -190,8 +186,8 @@
        btmType: {},
      },
      loadOption: {
        height:'auto',
        border: true,
        height: 478,
        editBtn: false,
        addBtn: false,
        menu: false,
@@ -277,17 +273,27 @@
      }
    }
  },
  computed: {
    ...mapGetters(["permission"]),
    permissionList() {
      return {
        addBtn: this.vaildData(this.permission.modeling_Business.Business_add, false),
        table: this.vaildData(this.permission.modeling_Business.Business_table, false),
        editBtn: this.vaildData(this.permission.modeling_Business.Business_edit, false),
      }
    }
  },
  created() {
    this.initTreeOnLoad();
    this.initDomainOption();
  },
  methods: {
    nodeClick(data,node,leaf) {
    nodeClick(data, node, leaf) {
      if (data.oid) {
        getDetail(data.oid).then(res => {
          this.obj = res.data.data;
        })
      }else{
      } else {
        this.$message.warning('请点击子节点');
      }
    },
@@ -316,7 +322,6 @@
      })
    },
    selectFromTable() {
      console.log('获取');
      this.ref.visible = true;
    },
    refOnLoad(domain) {
@@ -339,10 +344,15 @@
    },
    dialoghandelfalse() {
      this.ref.visible = false;
      this.$refs.businessCrud.toggleSelection()
      this.selectionList = [];
      this.domain = null;
    },
    dialoghandeltrue() {
      if (this.selectionList.length < 1) {
        this.$message.warning('请选择数据');
        return false;
      }
      saveFromTable(this.selectionList, this.domain).then(res => {
        this.$message.success('保存成功');
        this.dialoghandelfalse();
@@ -355,12 +365,12 @@
      this.ifRefreshBtmAddRefresh();
    },
    businessEdit() {
      if (!this.obj.oid){
      if (!this.obj.oid) {
        this.$message.warning("请选择一条叶子节点的业务类型");
        return;
      }
      const json = JSON.stringify(this.obj);
      this.$refs.btmAdd.btmType =JSON.parse(json);
      this.$refs.btmAdd.btmType = JSON.parse(json);
      this.$refs.btmAdd.showSubmitDialog = true;
      this.ifRefreshBtmAddRefresh();
    },
@@ -371,20 +381,38 @@
}
</script>
<style lang="scss">
#basic {
  height: 770px;
  border-radius: 10px;
}
<style lang="scss" scoped>
.businessCrud>.el-card:nth-of-type(2)>.el-card__body>.avue-crud__menu {
.businessCrud > .el-card:nth-of-type(2) > .el-card__body > .avue-crud__menu {
  display: none !important;
}
.attributeCrud>.el-card:nth-of-type(2)>.el-card__body>.avue-crud__menu {
.attributeCrud > .el-card:nth-of-type(2) > .el-card__body > .avue-crud__menu {
  display: none !important;
}
.businessTreeContainer>.el-card>.el-card__body {
  height: 775px;
}</style>
.app {
  overflow: auto;
  height: 84.3vh;
}
.app::-webkit-scrollbar {
  height: 15px; // 纵向滚动条 必写
  background: white;
  border: white;
  width: 10px;
}
// 滚动条的滑块
.app::-webkit-scrollbar-thumb {
  width: 10px;
  height: 10px;
  background-color: #ececec;
  border-radius: 20px;
  border: #ececec;
}
</style>