<template>
|
<el-container>
|
<el-header class="businessHeader" style="height: 40px;">
|
<el-button type="primary" @click="businessAdd" size="small">新增</el-button>
|
<el-button type="primary" @click="businessEdit" size="small">修改</el-button>
|
<el-button type="primary" @click="selectFromTable" size="small">从已有中获取</el-button>
|
</el-header>
|
<el-container>
|
<el-aside width="240px">
|
<basic-container class="businessTreeContainer">
|
<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>
|
{{ (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>
|
<el-tag size="small">
|
{{ obj.domainText }}
|
</el-tag>
|
</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>
|
<el-tag size="small">
|
{{ obj.viewText }}
|
</el-tag>
|
</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 class="attributeCrud" v-model="obj" :data="obj.attributes" :option="loadOption">
|
<template slot="attrDataType" slot-scope="{row}" >
|
<el-tag>{{row.attrDataType}}</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" size="small">
|
<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>
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="dialoghandelfalse">取 消</el-button>
|
<el-button type="primary" @click="dialoghandeltrue">确 定</el-button>
|
</span>
|
</el-dialog>
|
</el-container>
|
</el-container>
|
<business-add ref="btmAdd" :btmType="addOption.btmType" :domainOption="domainOptions" :icons="icons" @refreshTable="initTreeOnLoad">
|
</business-add>
|
</el-container>
|
</template>
|
<script>
|
import {
|
initTree,
|
refOnLoad,
|
getDomain,
|
saveFromTable,
|
getDetail
|
} from "@/api/omd/btmType"
|
export default {
|
name: "Business",
|
data() {
|
return {
|
//生命周期对话框状态
|
packageLifeBox: false,
|
//版本规则状态
|
rulesFalg: false,
|
obj: {},
|
selectionList: [],
|
treeData: [],
|
treeOption: {
|
defaultExpandAll: true,
|
title: '业务类型树',
|
props: {
|
labelText: '',
|
label: 'name',
|
value: 'oid',
|
children: 'childList',
|
}
|
},
|
addOption:{
|
btmType:{},
|
},
|
loadOption: {
|
border: true,
|
height: 466,
|
editBtn: false,
|
addBtn: false,
|
menu: false,
|
highlightCurrentRow: true,
|
refreshBtn:false,
|
columnBtn:false,
|
column: [
|
{
|
label: '英文名称',
|
prop: 'id',
|
align: 'center'
|
}, {
|
label: '中文名称',
|
prop: 'name',
|
align: 'center'
|
},
|
{
|
label: "类型",
|
prop: "attrDataType",
|
align: 'center',
|
slot: true
|
},
|
{
|
label: "默认值",
|
prop: "defaultValue",
|
align: 'center'
|
},
|
{
|
label: "说明",
|
prop: "description",
|
align: 'center'
|
}
|
]
|
},
|
domain: null,
|
domainOptions: [],
|
icons:{
|
key: 'el-icon-finished',
|
name: 'el-icon-info',
|
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,
|
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.initTreeOnLoad();
|
this.initDomainOption();
|
},
|
methods: {
|
nodeClick(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 => {
|
this.treeData = res.data.data;
|
});
|
},
|
initDomainOption() {
|
getDomain().then(res => {
|
this.domainOptions = res.data.data;
|
})
|
},
|
selectionChange(list) {
|
this.selectionList = list;
|
},
|
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;
|
this.ifRefreshBtmAddRefresh();
|
},
|
businessEdit(){
|
this.$refs.btmAdd.btmType = this.obj;
|
this.$refs.btmAdd.showSubmitDialog = true;
|
this.ifRefreshBtmAddRefresh();
|
},
|
ifRefreshBtmAddRefresh(){
|
// this.$refs.btmAdd.refreshAttrTable();
|
}
|
},
|
}
|
</script>
|
|
<style lang="scss">
|
#basic {
|
height: 770px;
|
border-radius: 10px;
|
}
|
|
.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{
|
display: none !important;
|
}
|
.businessTreeContainer > .el-card > .el-card__body {
|
height: 775px;
|
}
|
</style>
|