|
|
|
@ -62,7 +62,7 @@
|
|
|
|
|
import { ElSwitch, ElButton, ElMessage,ElSelect,ElTreeSelect } from 'element-plus'
|
|
|
|
|
import html2pdf from 'html2pdf.js'
|
|
|
|
|
import domToImage from 'dom-to-image';
|
|
|
|
|
import {selectOrganizationChart,selectVirtualTop} from '@/api/chart'
|
|
|
|
|
import {selectOrganizationChart,selectVirtualTop,selectRootTop,selectLevelTop} from '@/api/chart'
|
|
|
|
|
import ViewDialog from '@/components/ViewDialog.vue'
|
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
|
|
|
|
@ -94,8 +94,8 @@ export default {
|
|
|
|
|
defineMenus:[],
|
|
|
|
|
params:{
|
|
|
|
|
virtualType:'',
|
|
|
|
|
level:0,
|
|
|
|
|
root:'1'
|
|
|
|
|
level:'',
|
|
|
|
|
root:''
|
|
|
|
|
},
|
|
|
|
|
style: {
|
|
|
|
|
background: "#fff",
|
|
|
|
@ -103,100 +103,14 @@ export default {
|
|
|
|
|
fontWeight: "500"
|
|
|
|
|
},
|
|
|
|
|
options: [],
|
|
|
|
|
levelOptions:[
|
|
|
|
|
{
|
|
|
|
|
value:1,
|
|
|
|
|
label:"一级"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value:2,
|
|
|
|
|
label:"二级"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value:3,
|
|
|
|
|
label:"三级"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value:0,
|
|
|
|
|
label:"全部"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
rootData: [
|
|
|
|
|
{
|
|
|
|
|
value: '1',
|
|
|
|
|
label: 'Level one 1',
|
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
value: '1-1',
|
|
|
|
|
label: 'Level two 1-1',
|
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
value: '1-1-1',
|
|
|
|
|
label: 'Level three 1-1-1',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: '2',
|
|
|
|
|
label: 'Level one 2',
|
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
value: '2-1',
|
|
|
|
|
label: 'Level two 2-1',
|
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
value: '2-1-1',
|
|
|
|
|
label: 'Level three 2-1-1',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: '2-2',
|
|
|
|
|
label: 'Level two 2-2',
|
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
value: '2-2-1',
|
|
|
|
|
label: 'Level three 2-2-1',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: '3',
|
|
|
|
|
label: 'Level one 3',
|
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
value: '3-1',
|
|
|
|
|
label: 'Level two 3-1',
|
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
value: '3-1-1',
|
|
|
|
|
label: 'Level three 3-1-1',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: '3-2',
|
|
|
|
|
label: 'Level two 3-2',
|
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
value: '3-2-1',
|
|
|
|
|
label: 'Level three 3-2-1',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
levelOptions:[],
|
|
|
|
|
rootData: []
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
async created() {
|
|
|
|
|
await this.virtualTop();
|
|
|
|
|
this.organizationChart();
|
|
|
|
|
this.handleRootTop(this.params.virtualType);
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
exportImage() {
|
|
|
|
@ -232,7 +146,6 @@ export default {
|
|
|
|
|
ElMessage.error(err.msg);
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
organizationChart() {
|
|
|
|
|
selectOrganizationChart(this.params).then(res=>{
|
|
|
|
@ -243,8 +156,34 @@ export default {
|
|
|
|
|
ElMessage.error(err.msg);
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
handleRootTop(value) {
|
|
|
|
|
const params = {
|
|
|
|
|
"virtualType":value
|
|
|
|
|
}
|
|
|
|
|
selectRootTop(params).then(res=>{
|
|
|
|
|
this.rootData = res.data.data;
|
|
|
|
|
})
|
|
|
|
|
.catch(err=>{
|
|
|
|
|
ElMessage.error(err.msg);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
handleLevelTop(value) {
|
|
|
|
|
const params = {
|
|
|
|
|
"virtualType":this.params.virtualType,
|
|
|
|
|
"id":value
|
|
|
|
|
}
|
|
|
|
|
selectLevelTop(params).then(res=>{
|
|
|
|
|
this.levelOptions = res.data.data;
|
|
|
|
|
})
|
|
|
|
|
.catch(err=>{
|
|
|
|
|
ElMessage.error(err.msg);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
handleSelectChange(value) {
|
|
|
|
|
this.params.virtualType = value;
|
|
|
|
|
this.params.root = '';
|
|
|
|
|
this.params.level = '';
|
|
|
|
|
this.handleRootTop(value);
|
|
|
|
|
this.organizationChart();
|
|
|
|
|
},
|
|
|
|
|
handleLevelChange(value) {
|
|
|
|
@ -253,6 +192,8 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
handleRootChange(value) {
|
|
|
|
|
this.params.root = value;
|
|
|
|
|
this.params.level = '';
|
|
|
|
|
this.handleLevelTop(value);
|
|
|
|
|
this.organizationChart();
|
|
|
|
|
},
|
|
|
|
|
onExpand(e, data) {
|
|
|
|
|