lihang
2023-06-15 2ad5ca0811c67728b8958174fbeb8f0010ee0e6a
Source/UBCS-WEB/src/views/modeling/Business.vue
@@ -1,14 +1,18 @@
<template>
  <el-container>
    <el-header>
      <el-button type="primary" @click="businessAdd">新增</el-button>
      <el-button type="primary" @click="businessEdit">修改</el-button>
      <el-button type="primary" @click="selectFromTable">从已有中获取</el-button>
    <el-header class="businessHeader" style="height: 40px;">
      <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-container>
      <el-aside width="240px">
        <basic-container>
          <avue-tree id="basic" :data="treeData" :option="treeOption" @node-click="nodeClick">
        <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 }">
              <span>
                <i class="el-icon-star-on"></i>
@@ -24,33 +28,39 @@
          <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>
              <el-descriptions-item :labelStyle="descriptionOption.labelStyle"
                :contentStyle="descriptionOption.contentStyle">
                <template slot="label">
                  <i class="el-icon-finished"></i>
                  <i :class="icons.key"></i>
                  英文名称
                </template>
                {{ obj.id }}
              </el-descriptions-item>
              <el-descriptions-item>
              <el-descriptions-item :labelStyle="descriptionOption.labelStyle"
                :contentStyle="descriptionOption.contentStyle">
                <template slot="label">
                  <i class="el-icon-info"></i>
                  <i :class="icons.name"></i>
                  中文名称
                </template>
                {{ obj.name }}
              </el-descriptions-item>
              <el-descriptions-item>
                <template slot="label">
                  <i class="el-icon-date"></i>
                <template slot="label" :labelStyle="descriptionOption.labelStyle"
                  :contentStyle="descriptionOption.contentStyle">
                  <i :class="icons.tableName"></i>
                  数据库表名
                </template>
                {{ obj.tableName }}
              </el-descriptions-item>
              <el-descriptions-item>
              <el-descriptions-item :labelStyle="descriptionOption.labelStyle"
                :contentStyle="descriptionOption.contentStyle">
                <template slot="label">
                  <i class="el-icon-folder-opened"></i>
                  <i :class="icons.domain"></i>
                  所属领域
                </template>
                {{ obj.domain }}
                <el-tag size="small">
                  {{ obj.domainText }}
                </el-tag>
              </el-descriptions-item>
              <!-- <el-descriptions-item>
            <template slot="label">
@@ -66,26 +76,31 @@
            </template>
            {{ obj.sss }}
          </el-descriptions-item> -->
              <el-descriptions-item>
              <el-descriptions-item :labelStyle="descriptionOption.labelStyle"
                :contentStyle="descriptionOption.contentStyle">
                <template slot="label">
                  <i class="el-icon-s-check"></i>
                  <i :class="icons.revisionRule"></i>
                  版本规则
                </template>
                {{ obj.versionRule }}
              </el-descriptions-item>
              <el-descriptions-item>
              <el-descriptions-item :labelStyle="descriptionOption.labelStyle"
                :contentStyle="descriptionOption.contentStyle">
                <template slot="label">
                  <i class="el-icon-refresh-right"></i>
                  <i :class="icons.lifeCycle"></i>
                  生命周期
                </template>
                {{ obj.lifeCycleId }}
              </el-descriptions-item>
              <el-descriptions-item>
              <el-descriptions-item :labelStyle="descriptionOption.labelStyle"
                :contentStyle="descriptionOption.contentStyle">
                <template slot="label">
                  <i class="el-icon-view"></i>
                  <i :class="icons.view"></i>
                  视图
                </template>
                {{ obj.viewFlag }}
                <el-tag size="small">
                  {{ obj.viewText }}
                </el-tag>
              </el-descriptions-item>
              <!-- <el-descriptions-item>
            <template slot="label">
@@ -94,9 +109,10 @@
            </template>
            {{ obj.implClass }}
          </el-descriptions-item> -->
              <el-descriptions-item>
              <el-descriptions-item :labelStyle="descriptionOption.labelStyle"
                :contentStyle="descriptionOption.contentStyle">
                <template slot="label">
                  <i class="el-icon-chat-line-square"></i>
                  <i :class="icons.desc"></i>
                  描述
                </template>
                {{ obj.description }}
@@ -106,16 +122,24 @@
          <!-- 属性列表-->
          <basic-container>
            <p style="margin-top: 10px;font-weight: 570;font-size: 19px">属性列表</p>
            <avue-crud v-model="obj" :data="obj.attributes" :option="loadOption" @row-save="loadSave"></avue-crud>
            <avue-crud class="attributeCrud" v-model="obj" :data="obj.attributes" :option="loadOption">
              <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-select v-model="domain" placeholder="请选择" @change="refOnLoad">
            <el-option v-for="item in domainOptions" :key="item" :label="item" :value="item">
          <el-select v-model="domain" placeholder="请选择" @change="refOnLoad" size="small">
            <el-option v-for="item in domainOptions" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
          </el-select>
          <avue-crud class="businessCrud" v-model="ref.form" :option="ref.option" :data="ref.data" @selection-change="selectionChange">
          <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>
          <span slot="footer" class="dialog-footer">
            <el-button @click="dialoghandelfalse">取 消</el-button>
@@ -124,8 +148,9 @@
        </el-dialog>
      </el-container>
    </el-container>
    <business-add ref="btmAdd" :btmType="addOption.btmType" :domainOption="domainOptions">
  </business-add>
    <business-add ref="btmAdd" :btmType="addOption.btmType" :domainOption="domainOptions" :icons="icons"
      @refreshTable="initTreeOnLoad">
    </business-add>
  </el-container>
</template>
<script>
@@ -150,15 +175,16 @@
      treeOption: {
        defaultExpandAll: true,
        title: '业务类型树',
        addBtn: false,
        props: {
          labelText: '',
          label: 'name',
          label: 'label',
          value: 'oid',
          children: 'childList',
        }
      },
      addOption:{
        btmType:{},
      addOption: {
        btmType: {},
      },
      loadOption: {
        border: true,
@@ -167,22 +193,23 @@
        addBtn: false,
        menu: false,
        highlightCurrentRow: true,
        refreshBtn:false,
        columnBtn:false,
        refreshBtn: false,
        columnBtn: false,
        column: [
          {
            label: '属性英文名称',
            label: '英文名称',
            prop: 'id',
            align: 'center'
          }, {
            label: '属性中文名称',
            label: '中文名称',
            prop: 'name',
            align: 'center'
          },
          {
            label: "属性类型",
            prop: "attrDataType",
            align: 'center'
            label: "类型",
            prop: "attrDataTypeText",
            align: 'center',
            slot: true
          },
          {
            label: "默认值",
@@ -196,8 +223,22 @@
          }
        ]
      },
      descriptionOption: {
        labelStyle: 'text-align:center;width:120px',
        contentStyle: 'width:240px;text-align:center;word-break;break-all;'
      },
      domain: null,
      domainOptions: [],
      icons: {
        key: 'el-icon-finished',
        name: 'el-icon-tickets',
        tableName: 'el-icon-date',
        domain: 'el-icon-folder-opened',
        revisionRule: 'el-icon-s-check',
        lifeCycle: 'el-icon-refresh-right',
        view: 'el-icon-view',
        desc: 'el-icon-chat-line-square'
      },
      ref: {
        // 从表中选择dialog状态
        visible: false,
@@ -228,10 +269,7 @@
            }
          ]
        },
        data: [{
          tableName: '1',
          description: '2'
        }]
        data: [],
      }
    }
  },
@@ -240,42 +278,14 @@
    this.initDomainOption();
  },
  methods: {
    //生命周期对话框取消点击事件
    dialoghandelfalse() {
      this.packageLifeBox = false
    },
    //生命周期对话框确定点击事件
    dialoghandeltrue() {
      this.packageLifeBox = false
    },
    //选择生命周期对话框
    handelLife() {
      this.packageLifeBox = true
    },
    //版本规则手动输入和选择框的状态取反
    handelRules() {
      this.rulesFalg = !this.rulesFalg
    },
    //版本规则三个按钮的显示隐藏
    radioChange(val) {
      if (val.value == 0) {
        this.basicOption.group[1].column[1].display = false;
        this.basicOption.group[1].column[2].display = false;
        this.basicOption.group[1].column[3].display = false;
      } else if (val.value == 1) {
        this.basicOption.group[1].column[1].display = true;
        this.basicOption.group[1].column[2].display = true;
        this.basicOption.group[1].column[3].display = false;
      } else if (val.value == 2) {
        this.basicOption.group[1].column[1].display = true;
        this.basicOption.group[1].column[2].display = true;
        this.basicOption.group[1].column[3].display = true;
      }
    },
    nodeClick(data) {
      getDetail(data.oid).then(res => {
        this.obj = res.data.data;
      })
      if (data.oid) {
        getDetail(data.oid).then(res => {
          this.obj = res.data.data;
        })
      }else{
        this.$message.warning('请点击子节点');
      }
    },
    //  基本信息添加
    basicSave(row, done, loading) {
@@ -312,7 +322,6 @@
    },
    initTreeOnLoad() {
      initTree().then(res => {
        console.log('123');
        this.treeData = res.data.data;
      });
    },
@@ -323,7 +332,6 @@
    },
    selectionChange(list) {
      this.selectionList = list;
      console.log(this.selectionList);
    },
    dialoghandelfalse() {
      this.ref.visible = false;
@@ -337,14 +345,18 @@
        this.initTreeOnLoad();
      })
    },
    businessAdd(){
    businessAdd() {
      this.$refs.btmAdd.showSubmitDialog = true;
      console.log('添加');
      this.ifRefreshBtmAddRefresh();
    },
    businessEdit(){
      this.addOption.btmType = this.obj;
      this.$refs.addOption.showSubmitDialog = true;
      console.log('编辑');
    businessEdit() {
      var json = JSON.stringify(this.obj);
      this.$refs.btmAdd.btmType = JSON.parse(json);
      this.$refs.btmAdd.showSubmitDialog = true;
      this.ifRefreshBtmAddRefresh();
    },
    ifRefreshBtmAddRefresh() {
      // this.$refs.btmAdd.refreshAttrTable();
    }
  },
}
@@ -356,7 +368,14 @@
  border-radius: 10px;
}
.businessCrud > .el-card > .el-card__body > .avue-crud_menu{
  display: none!important;
.businessCrud>.el-card:nth-of-type(2)>.el-card__body>.avue-crud__menu {
  display: none !important;
}
</style>
.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>