<template>
|
<el-container>
|
|
<el-aside>
|
<basic-container>
|
<div ref="TreeBox" style="height: calc(100vh - 144px);!important;">
|
<!-- 左侧树 -->
|
<div style="height: calc(100vh - 220px);">
|
<div style="margin-bottom: 10px;display: flex;justify-content: center">
|
<el-radio v-model="treeRadio" label="0" @input="TreeRadioChange">业务类型树</el-radio>
|
<el-radio v-model="treeRadio" label="1" @input="TreeRadioChange">链接类型树</el-radio>
|
</div>
|
<avue-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">
|
<i class="el-icon-s-promotion"></i>
|
{{ (node || {}).label }}
|
</span>
|
</span>
|
</avue-tree>
|
</div>
|
</div>
|
</basic-container>
|
</el-aside>
|
|
<el-main>
|
<basic-container>
|
<avue-crud
|
v-if="!tableStatus"
|
:data="data"
|
:option="option"
|
:page.sync="page"
|
@size-change="sizeChange"
|
@current-change="currentChange">
|
<template slot="menuLeft">
|
<div style="display: flex; align-items: center;">
|
<span style="display: inline-block; margin-right: 10px;">
|
<el-radio v-model="tableRadio" label="0" @input="tableRadioChange">表单</el-radio>
|
<el-radio v-model="tableRadio" label="1" @input="tableRadioChange">表格<span style="color: red;">(先导入表单,再导入表格!)</span></el-radio>
|
</span>
|
<span style="display: flex;align-items: center; margin-right: 10px;">
|
<p style="display: flex; flex-shrink: 0;font-size: 14px">名称:</p>
|
<el-input v-model="input" placeholder="请输入内容" size="mini"></el-input>
|
</span>
|
<span style="display: flex; align-items: center;">
|
<p
|
style="display: flex; align-items: center; margin: 0 10px 0 0;flex-shrink: 0;font-size: 14px">克隆目标:</p>
|
<el-input v-model="input" placeholder="请输入内容" size="mini" style="margin-right: 10px;"></el-input>
|
<el-button plain size="mini" type="success">克隆目标</el-button>
|
</span>
|
</div>
|
</template>
|
<template slot="menu" slot-scope="scope">
|
<el-button icon="el-icon-edit" size="small" type="text" @click="editBtnClick(scope.row)">编辑
|
</el-button>
|
<el-button icon="el-icon-delete" size="small" type="text" @click="rowDeleteHandler(scope.row)">删除
|
</el-button>
|
</template>
|
</avue-crud>
|
<div v-if="!tableStatus" style="display: flex;justify-content: center;margin-top: 15px">
|
<el-button icon="el-icon-plus" plain size="small" type="primary" @click="addClickHandler">增加</el-button>
|
<el-button icon="el-icon-delete" plain size="small" type="danger">删除</el-button>
|
<el-button icon="el-icon-document-add" plain size="small" type="primary">克隆</el-button>
|
<el-button icon="el-icon-upload2" plain size="small" type="primary" @click="upLoadHandler">导入</el-button>
|
<el-button icon="el-icon-download" plain size="small" type="primary" @click="downLoadHandler">导出</el-button>
|
</div>
|
</basic-container>
|
</el-main>
|
<form-dialog ref="formDialog"></form-dialog>
|
<table-dialog ref="tableDialog"></table-dialog>
|
</el-container>
|
</template>
|
|
<script>
|
import basicOption from "@/util/basic-option";
|
import FormDialog from "@/views/modelingMenu/ui/formDefine/components/formDialog";
|
import TableDialog from "@/views/modelingMenu/ui/formDefine/components/tableDialog"
|
import {gridPortalVIDatas} from "@/api/UI/formDefine/api"
|
import {getBizTypes} from "@/api/modeling/businessType/api";
|
import {gridLink} from "@/api/modeling/linkType/api";
|
import func from "@/util/func";
|
|
export default {
|
name: "index",
|
components: {FormDialog, TableDialog},
|
data() {
|
return {
|
page: {
|
currentPage: 1,
|
pageSize: 10,
|
total: 0,
|
pageSizes: [10, 30, 50, 100],
|
},
|
nodeRow: {},
|
treeLoading: false,
|
option: {
|
...basicOption,
|
addBtn: false,
|
editBtn: false,
|
delBtn: false,
|
column: [
|
{
|
label: '业务名称',
|
prop: 'typeName',
|
},
|
{
|
label: '名称',
|
prop: 'viName',
|
sortable: true,
|
},
|
{
|
label: '类型',
|
prop: 'viTypeText',
|
},
|
]
|
},
|
data: [],
|
tableRadio: "",
|
treeRadio: "0",
|
treeData: [],
|
treeOption: {
|
addBtn: false
|
}
|
}
|
},
|
created() {
|
this.getTreeList();
|
},
|
computed: {
|
tableStatus() {
|
return func.isEmptyObject(this.nodeRow)
|
}
|
},
|
methods: {
|
// 右侧新增
|
addClickHandler() {
|
if (!this.tableRadio) {
|
this.$message.error('请在表格上方选择新增类型');
|
return;
|
}
|
|
this.tableRadio === "0" ? this.$refs.formDialog.visible = true : this.$refs.tableDialog.visible = true;
|
},
|
|
// 初始化树请求
|
getTreeList() {
|
this.treeLoading = true;
|
getBizTypes().then(res => {
|
const data = res.data.data.map(item => {
|
item.label = item.attributes.id;
|
return item;
|
});
|
this.treeData = data;
|
this.treeLoading = false;
|
})
|
},
|
|
// 左侧业务类型切换
|
TreeRadioChange(val) {
|
this.treeLoading = true;
|
this.resetTable();
|
if (val === "0") {
|
getBizTypes().then(res => {
|
const data = res.data.data.map(item => {
|
item.label = item.attributes.id;
|
return item;
|
});
|
this.treeData = data;
|
this.treeLoading = false;
|
})
|
} else {
|
gridLink().then(res => {
|
const data = res.data.data.map(item => {
|
item.label = item.name;
|
return item;
|
});
|
this.treeData = data;
|
this.treeLoading = false;
|
})
|
}
|
},
|
|
// 左侧树点击
|
nodeClick(row) {
|
console.log(row);
|
this.tableRadio = null;
|
this.nodeRow = row;
|
this.getRightPortalVIDatas(row);
|
},
|
|
// 重置表格展示信息 和 表格表单选项
|
resetTable() {
|
this.data = [];
|
this.tableRadio = null;
|
},
|
|
// 右侧 表格 表单 信息查询
|
getRightPortalVIDatas() {
|
const params = {
|
'conditionMap[typeName]': this.treeRadio === '0' ? this.nodeRow.attributes.id : this.nodeRow.name,
|
'conditionMap[viType]': this.tableRadio === '0' ? 'Form' : this.tableRadio === '1' ? 'Table' : '',
|
'conditionMap[viTypeFlag]': this.treeRadio === '0' ? 'BtmType' : this.treeRadio === '1' ? 'LinkType' : '',
|
}
|
gridPortalVIDatas(this.page.currentPage, this.page.pageSize, params).then(res => {
|
console.log(res);
|
if (res.data.code === 200) {
|
const data = res.data.data;
|
this.data = data;
|
this.page.total = res.data.total;
|
}
|
})
|
},
|
|
sizeChange(val) {
|
this.page.pageSize = val;
|
this.getRightPortalVIDatas();
|
},
|
|
// 页码
|
currentChange(val) {
|
this.page.currentPage = val;
|
this.getRightPortalVIDatas();
|
},
|
|
// 表格 表单切换
|
tableRadioChange() {
|
this.getRightPortalVIDatas();
|
},
|
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
::v-deep {
|
.el-scrollbar__wrap {
|
overflow: auto !important;
|
}
|
|
.headerCon {
|
.el-button {
|
width: 82px;
|
}
|
}
|
}
|
|
.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;
|
}
|
|
|
.smallBtn {
|
width: 82px;
|
text-align: center;
|
padding-left: 4.5px;
|
}
|
|
</style>
|