接口对接

sship
Chengliang 1 year ago
parent 3d79a9d199
commit 3221110525

@ -27,6 +27,21 @@ export function selectVirtualPerson(params){
}) })
} }
//维度
export function selectVirtualTop(){ export function selectVirtualTop(){
return request.get('/sship/organization/chart/virtual-top') return request.get('/sship/organization/chart/virtual-top')
} }
//根节点
export function selectRootTop(params){
return request.get('/sship/organization/chart/virtual-top-two',{
params
})
}
//层级
export function selectLevelTop(params){
return request.get('/sship/organization/chart/virtual-top-three',{
params
})
}

@ -62,7 +62,7 @@
import { ElSwitch, ElButton, ElMessage,ElSelect,ElTreeSelect } from 'element-plus' import { ElSwitch, ElButton, ElMessage,ElSelect,ElTreeSelect } from 'element-plus'
import html2pdf from 'html2pdf.js' import html2pdf from 'html2pdf.js'
import domToImage from 'dom-to-image'; 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 ViewDialog from '@/components/ViewDialog.vue'
import { ref } from 'vue' import { ref } from 'vue'
@ -94,8 +94,8 @@ export default {
defineMenus:[], defineMenus:[],
params:{ params:{
virtualType:'', virtualType:'',
level:0, level:'',
root:'1' root:''
}, },
style: { style: {
background: "#fff", background: "#fff",
@ -103,100 +103,14 @@ export default {
fontWeight: "500" fontWeight: "500"
}, },
options: [], options: [],
levelOptions:[ levelOptions:[],
{ rootData: []
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',
},
],
},
],
},
]
}; };
}, },
async created() { async created() {
await this.virtualTop(); await this.virtualTop();
this.organizationChart(); this.organizationChart();
this.handleRootTop(this.params.virtualType);
}, },
methods: { methods: {
exportImage() { exportImage() {
@ -232,7 +146,6 @@ export default {
ElMessage.error(err.msg); ElMessage.error(err.msg);
}) })
}); });
}, },
organizationChart() { organizationChart() {
selectOrganizationChart(this.params).then(res=>{ selectOrganizationChart(this.params).then(res=>{
@ -243,8 +156,34 @@ export default {
ElMessage.error(err.msg); 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) { handleSelectChange(value) {
this.params.virtualType = value; this.params.virtualType = value;
this.params.root = '';
this.params.level = '';
this.handleRootTop(value);
this.organizationChart(); this.organizationChart();
}, },
handleLevelChange(value) { handleLevelChange(value) {
@ -253,6 +192,8 @@ export default {
}, },
handleRootChange(value) { handleRootChange(value) {
this.params.root = value; this.params.root = value;
this.params.level = '';
this.handleLevelTop(value);
this.organizationChart(); this.organizationChart();
}, },
onExpand(e, data) { onExpand(e, data) {

Loading…
Cancel
Save