lihang
2023-05-10 10eaf1b0dde35fb03795ae52d926171fb73eeb5f
业务类型页面修改
已修改1个文件
621 ■■■■■ 文件已修改
Source/UBCS-WEB/src/views/modeling/Business.vue 621 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/views/modeling/Business.vue
@@ -1,74 +1,141 @@
<template>
  <el-container>
    <el-aside width="240px">
      <basic-container>
        <avue-tree id="basic" :data="treeData" :option="treeOption" @node-click="nodeClick">
        </avue-tree>
      </basic-container>
    </el-aside>
    <el-main>
      <!--        基本信息-->
      <basic-container>
        <p style="margin-top: 10px;font-weight: 570;font-size: 19px">基本信息</p>
        <avue-crud
          v-model="objs"
          :data="basicData"
          :option="basicOption"
          @row-save="basicSave"
        >
          <!--           版本规则-->
          <template slot="rulesForm" slot-scope="{disabled,size}">
            <div>
              <el-input v-if="rulesFalg==false" v-model="objs.tex" :size="size" placeholder="请输入版本号规则"
                        style="width: 290px"></el-input>
              <el-select v-if="rulesFalg" v-model="objs.select" placeholder="请选择版本号规则" style="max-width: 300px">
                <el-option label="测试1" value="1"></el-option>
                <el-option label="测试2" value="2"></el-option>
                <el-option label="测试3" value="3"></el-option>
              </el-select>
              <el-button style="margin-bottom: 5px;margin-left: 10px" type="primary" @click="handelRules">
                {{ rulesFalg == false ? "选择版本号规则" : "手动输入" }}
              </el-button>
            </div>
          </template>
          <!--            生命周期-->
          <template slot="lifeCycleForm">
            <el-select v-model="objs.select" placeholder="请选择生命周期" style="max-width: 300px">
              <el-option label="测试1" value="1"></el-option>
              <el-option label="测试2" value="2"></el-option>
              <el-option label="测试3" value="3"></el-option>
            </el-select>
            <el-button style="margin-bottom: 5px;display: inline-block;margin-left: 10px" type="primary"
                       @click="handelLife">生命周期列表
            </el-button>
          </template>
        </avue-crud>
        <el-dialog :visible.sync="packageLifeBox"
                   append-to-body
                   title="查看使用范围"
                   width="1000px">
          <Businpackage></Businpackage>
    <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>
    <el-container>
      <el-aside width="240px">
        <basic-container>
          <avue-tree id="basic" :data="treeData" :option="treeOption" @node-click="nodeClick">
            <span class="el-tree-node__label" slot-scope="{ node, data }">
              <span>
                <i class="el-icon-star-on"></i>
                {{ (node || {}).label }}
              </span>
            </span>
          </avue-tree>
        </basic-container>
      </el-aside>
      <el-container>
        <el-main>
          <!--基本信息-->
          <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>
                <template slot="label">
                  <i class="el-icon-finished"></i>
                  英文名称
                </template>
                {{ obj.id }}
              </el-descriptions-item>
              <el-descriptions-item>
                <template slot="label">
                  <i class="el-icon-info"></i>
                  中文名称
                </template>
                {{ obj.name }}
              </el-descriptions-item>
              <el-descriptions-item>
                <template slot="label">
                  <i class="el-icon-date"></i>
                  数据库表名
                </template>
                {{ obj.tableName }}
              </el-descriptions-item>
              <el-descriptions-item>
                <template slot="label">
                  <i class="el-icon-folder-opened"></i>
                  所属领域
                </template>
                {{ obj.domain }}
              </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>
                <template slot="label">
                  <i class="el-icon-s-check"></i>
                  版本规则
                </template>
                {{ obj.versionRule }}
              </el-descriptions-item>
              <el-descriptions-item>
                <template slot="label">
                  <i class="el-icon-refresh-right"></i>
                  生命周期
                </template>
                {{ obj.lifeCycleId }}
              </el-descriptions-item>
              <el-descriptions-item>
                <template slot="label">
                  <i class="el-icon-view"></i>
                  视图
                </template>
                {{ obj.viewFlag }}
              </el-descriptions-item>
              <!-- <el-descriptions-item>
            <template slot="label">
              <i class="el-icon-arrow-down"></i>
              实现类
            </template>
            {{ obj.implClass }}
          </el-descriptions-item> -->
              <el-descriptions-item>
                <template slot="label">
                  <i class="el-icon-chat-line-square"></i>
                  描述
                </template>
                {{ obj.description }}
              </el-descriptions-item>
            </el-descriptions>
          </basic-container>
          <!-- 属性列表-->
          <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>
          </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-option>
          </el-select>
          <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>
            <el-button type="primary" @click="dialoghandeltrue">确 定</el-button>
  </span>
          </span>
        </el-dialog>
      </basic-container>
      <!--        属性列表-->
      <basic-container>
        <p style="margin-top: 10px;font-weight: 570;font-size: 19px">属性列表</p>
        <avue-crud
          v-model="obj"
          :data="loadData"
          :option="loadOption"
          @row-save="loadSave"
        ></avue-crud>
      </basic-container>
    </el-main>
      </el-container>
    </el-container>
    <business-add ref="btmAdd" :btmType="addOption.btmType" :domainOption="domainOptions">
  </business-add>
  </el-container>
</template>
<script>
import {
  initTree,
  refOnLoad,
  getDomain,
  saveFromTable,
  getDetail
} from "@/api/omd/btmType"
export default {
  name: "Business",
  data() {
@@ -78,282 +145,99 @@
      //版本规则状态
      rulesFalg: false,
      obj: {},
      treeData: [{
        value: 0,
        label: '业务类型树',
        children: [
          {
            value: 1,
            label: 'A',
          },
          {
            value: 2,
            label: 'B',
          },
          {
            value: 3,
            label: 'C',
          },
          {
            value: 4,
            label: 'D',
          },
          {
            value: 5,
            label: 'E',
          }
        ]
      }],
      selectionList: [],
      treeData: [],
      treeOption: {
        defaultExpandAll: true,
        title: '业务类型树',
        props: {
          labelText: '',
          label: 'name',
          value: 'oid',
          children: 'childList',
        }
      },
      loadData: [],
      loadData1: [
        {
          name: '张三',
          business: '测试',
          attrType: "测试",
          default: "测试",
          explain: "测试说明"
        },
        {
          name: '李四',
          business: '测试',
          attrType: "测试",
          default: "测试",
          explain: "测试说明"
        }
      ],
      loadData2: [
        {
          name: '王五',
          business: '测试',
          attrType: "测试",
          default: "测试",
          explain: "测试说明"
        },
        {
          name: '宋六',
          business: '测试',
          attrType: "测试",
          default: "测试",
          explain: "测试说明"
        }
      ],
      addOption:{
        btmType:{},
      },
      loadOption: {
        border: true,
        height: 422,
        height: 466,
        editBtn: false,
        addBtn: false,
        menu: false,
        highlightCurrentRow: true,
        refreshBtn:false,
        columnBtn:false,
        column: [
          {
            label: '属性名',
            prop: 'name'
          },
          {
            label: '业务类型',
            prop: 'business'
            label: '属性英文名称',
            prop: 'id',
            align: 'center'
          }, {
            label: '属性中文名称',
            prop: 'name',
            align: 'center'
          },
          {
            label: "属性类型",
            prop: "attrType"
            prop: "attrDataType",
            align: 'center'
          },
          {
            label: "默认值",
            prop: "default",
            prop: "defaultValue",
            align: 'center'
          },
          {
            label: "说明",
            prop: "explain"
            prop: "description",
            align: 'center'
          }
        ]
      },
      //基本信息
      objs: {
        tex: "",
        select: "",
        lifeTex: ""
      },
      basicData: [],
      basicData1: [
        {
          typeName: "测试1",
          tag: "客户",
          inherit: "测试",
          implement: "测试",
          lifeCycle: "周期",
          desc: "这是一个描述"
        }
      ],
      basicData2: [
        {
          typeName: "测试2",
          tag: "客户",
          inherit: "测试",
          implement: "测试",
          lifeCycle: "周期",
          desc: "这是一个描述"
        }
      ],
      basicOption: {
        border: true,
        height: 88,
        tabs: true,
        column: [
          {
            label: "类型名称",
            prop: "typeName",
            display: false
          },
          {
            label: "标签",
            prop: "tag",
            display: false
          },
          {
            label: "继承自",
            prop: "inherit",
            display: false
          },
          {
            label: "实现类",
            prop: "implement",
            display: false
          },
          {
            label: "描述",
            prop: "desc",
            display: false
          }
        ],
        group: [
          {
            label: "基本信息",
            column: [
              {
                label: "类型名称",
                prop: "typeName"
              },
              {
                label: "标签",
                prop: "tag"
              },
              {
                label: "继承自",
                prop: "inherit"
              },
              {
                label: "是否实例化",
                prop: "case",
                type: "switch",
                align: "center",
                hide: true,
                labelWidth: 90,
                dicData: [
                  {
                    label: "否",
                    value: 0
                  },
                  {
                    label: "是",
                    value: 1
                  }
                ],
              },
              {
                label: "描述",
                prop: "desc",
                type: "textarea"
              },
              {
                label: "实现类",
                prop: "implement"
              },
            ]
          },
          {
            label: "版本规则",
            column: [
              {
                label: '版本规则',
                prop: 'radio',
                type: 'radio',
                button: true,
                change: this.radioChange,
                value: 0,
                dicData: [{
                  label: '不可修订',
                  value: 0
                }, {
                  label: '采用一级版本管理',
                  value: 1
                }, {
                  label: '采用二级版本管理',
                  value: 2
                }]
              },
              {
                label: "版本号规则",
                prop: "rules",
                display: true,
                formslot: true,
              },
              {
                label: "分隔符",
                prop: "interval",
                type: "select",
                display: true,
                dicData: [
                  {
                    label: ".",
                    value: 0
                  },
                  {
                    label: "-",
                    value: 1
                  },
                  {
                    label: " ",
                    value: 2
                  }
                ]
              },
              {
                label: '版次号规则',
                prop: 'radioRules',
                type: 'radio',
                display: true,
                dicData: [{
                  label: '1.2.3...',
                  value: 0
                }, {
                  label: 'a.b.c...',
                  value: 1
                }, {
                  label: '0.1.2...',
                  value: 2
                }]
              },
            ]
          },
          {
            label: "生命周期",
            column: [
              {
                label: "生命周期",
                prop: "lifeCycle"
              }
            ]
          }
        ]
      },
      domain: null,
      domainOptions: [],
      ref: {
        // 从表中选择dialog状态
        visible: false,
        form: {},
        option: {
          height: "550px",
          selection: true,
          headerAlign: 'center',
          border: true,
          index: true,
          rowKey: 'id',
          tabs: true,
          addBtn: false,
          menu: false,
          highlightCurrentRow: true,
          column: [
            {
              label: '表名',
              prop: 'tableName',
              align: 'center',
              display: false
            },
            {
              label: '描述',
              prop: 'description',
              align: 'center',
              display: false
            }
          ]
        },
        data: [{
          tableName: '1',
          description: '2'
        }]
      }
    }
  },
  created() {
    this.loadData = this.loadData1;
    this.basicData = this.basicData1
    this.initTreeOnLoad();
    this.initDomainOption();
  },
  methods: {
    //生命周期对话框取消点击事件
@@ -389,40 +273,80 @@
      }
    },
    nodeClick(data) {
      if (data.value == 1) {
        this.loadData = this.loadData1;
        this.basicData = this.basicData1
      } else if (data.value == 2) {
        this.loadData = this.loadData2;
        this.basicData = this.basicData2
      }
      this.$message.success(JSON.stringify(data))
      getDetail(data.oid).then(res => {
        this.obj = res.data.data;
      })
    },
    //  基本信息添加
    basicSave(row, done, loading) {
      add(Object.assign({
        createUser: this.userInfo.name
      }, row)).then(() => {
        this.$message.success('新增成功')
        done();
        this.getList();
      }).catch(() => {
        loading()
      })
    },
    //属性添加
    loadSave(row, done, loading) {
      add(Object.assign({
        createUser: this.userInfo.name
      }, row)).then(() => {
        this.$message.success('新增成功')
        done();
        this.getList();
      }).catch(() => {
        loading()
      })
    },
    selectFromTable() {
      console.log('获取');
      this.ref.visible = true;
    },
    refOnLoad(domain) {
      refOnLoad(domain).then(res => {
        this.ref.data = res.data.data;
      })
    },
    initTreeOnLoad() {
      initTree().then(res => {
        console.log('123');
        this.treeData = res.data.data;
      });
    },
    initDomainOption() {
      getDomain().then(res => {
        this.domainOptions = res.data.data;
      })
    },
    selectionChange(list) {
      this.selectionList = list;
      console.log(this.selectionList);
    },
    dialoghandelfalse() {
      this.ref.visible = false;
      this.selectionList = [];
      this.domain = null;
    },
    dialoghandeltrue() {
      saveFromTable(this.selectionList, this.domain).then(res => {
        this.$message.success('保存成功');
        this.dialoghandelfalse();
        this.initTreeOnLoad();
      })
    },
    businessAdd(){
      this.$refs.btmAdd.showSubmitDialog = true;
      console.log('添加');
    },
    businessEdit(){
      this.addOption.btmType = this.obj;
      this.$refs.addOption.showSubmitDialog = true;
      console.log('编辑');
    }
  },
//  基本信息添加
  basicSave(row, done, loading) {
    add(Object.assign({
      createUser: this.userInfo.name
    }, row)).then(() => {
      this.$message.success('新增成功')
      done();
      this.getList();
    }).catch(() => {
      loading()
    })
  },
  //属性添加
  loadSave(row, done, loading) {
    add(Object.assign({
      createUser: this.userInfo.name
    }, row)).then(() => {
      this.$message.success('新增成功')
      done();
      this.getList();
    }).catch(() => {
      loading()
    })
  }
}
</script>
@@ -432,4 +356,7 @@
  border-radius: 10px;
}
.businessCrud > .el-card > .el-card__body > .avue-crud_menu{
        display: none!important;
    }
</style>