okrtree改成cdn加载

This commit is contained in:
aixianling
2022-08-22 18:03:06 +08:00
parent 8312807917
commit 37e37540f8
3 changed files with 925 additions and 899 deletions

View File

@@ -17,22 +17,21 @@
</el-tree> </el-tree>
</div> </div>
</div> </div>
<div class="middle" :class="[girdLevel == '2' ? 'middle-active' : '']" ref="container" v-loading="isLoading" element-loading-background="rgba(0, 0, 0, 0.5)"> <div class="middle" :class="[girdLevel == '2' ? 'middle-active' : '']" ref="container" v-loading="isLoading"
element-loading-background="rgba(0, 0, 0, 0.5)">
<div <div
ref="middleTree" ref="middleTree"
id="tree" id="tree"
class="tree" class="tree"
:style="{left: x, top: y, transform: `scale(${scale}) translate(-50%, -50%) `, 'transform-origin': `${0} ${0}`}"> :style="{left: x, top: y, transform: `scale(${scale}) translate(-50%, -50%) `, 'transform-origin': `${0} ${0}`}">
<VueOkrTree <ai-okr-tree ref="VueOkrTree" v-if="chartData.length"
ref="VueOkrTree"
:data="chartData" :data="chartData"
node-key="id" node-key="id"
show-collapsable show-collapsable
aniamte aniamte
animate-name="okr-fade-in-linear" animate-name="okr-fade-in-linear"
:render-content="renderContent" :render-content="renderContent"
default-expand-all> default-expand-all/>
</VueOkrTree>
</div> </div>
</div> </div>
<div class="right"> <div class="right">
@@ -72,7 +71,6 @@
<span>{{ residentInfo.currentAreaName }}</span> <span>{{ residentInfo.currentAreaName }}</span>
</div> </div>
<ai-table <ai-table
v-if="tableData.length"
style="width: 558px" style="width: 558px"
:tableData="tableData" :tableData="tableData"
:col-configs="colConfigs" :col-configs="colConfigs"
@@ -90,14 +88,13 @@
<script> <script>
import pieChart from 'dvcp-dv-ui/components/AiEchart/template/pie/pieChart2' import pieChart from 'dvcp-dv-ui/components/AiEchart/template/pie/pieChart2'
import barChart1 from 'dvcp-dv-ui/components/AiEchart/template/bar/barChart1' import barChart1 from 'dvcp-dv-ui/components/AiEchart/template/bar/barChart1'
import { VueOkrTree } from 'vue-okr-tree' import AiOkrTree from "dvcp-dv-ui/components/AiOkrTree"
import 'vue-okr-tree/dist/vue-okr-tree.css'
export default { export default {
name: 'AppGridDV', name: 'AppGridDV',
label: '网格数据大屏', label: '网格数据大屏',
components: {AiOkrTree},
props: { props: {
instance: Function, instance: Function,
dict: Object, dict: Object,
@@ -136,7 +133,13 @@
}, },
formart: v => this.dict.getLabel('householdRelation', v) formart: v => this.dict.getLabel('householdRelation', v)
}, },
{ prop: 'idNumber', label: '身份证号', align: 'center', width: 220, formart: v => v ? v.replace(/^(\d{10})\d{4}(.{4}$)/g, `$1${Array(5).join('*')}$2`) : '-' }, {
prop: 'idNumber',
label: '身份证号',
align: 'center',
width: 220,
formart: v => v ? v.replace(/^(\d{10})\d{4}(.{4}$)/g, `$1${Array(5).join('*')}$2`) : '-'
},
{prop: 'phone', label: '联系方式', align: 'center'} {prop: 'phone', label: '联系方式', align: 'center'}
], ],
girdId: '', girdId: '',
@@ -153,10 +156,6 @@
} }
}, },
components: {
VueOkrTree
},
created() { created() {
this.dict.load('householdRelation') this.dict.load('householdRelation')
this.getTreeList() this.getTreeList()
@@ -233,7 +232,6 @@
handleNodeClick(e) { handleNodeClick(e) {
this.girdLevel = e.girdLevel this.girdLevel = e.girdLevel
this.isLoading = true this.isLoading = true
console.log(e)
this.getGirdInfo(e.id, e.girdLevel) this.getGirdInfo(e.id, e.girdLevel)
this.getStatisticsInfo(e.id) this.getStatisticsInfo(e.id)
}, },
@@ -346,7 +344,6 @@
this.instance.post(`/app/appgirdinfo/listAllGirdAndMemberByTop?id=${id || ''}`).then((res) => { this.instance.post(`/app/appgirdinfo/listAllGirdAndMemberByTop?id=${id || ''}`).then((res) => {
if (res.code == 0) { if (res.code == 0) {
const chartData = this.formatList([res.data]) const chartData = this.formatList([res.data])
console.log(chartData)
this.chartData = chartData this.chartData = chartData
this.$nextTick(() => { this.$nextTick(() => {
@@ -501,6 +498,7 @@
.grid-info { .grid-info {
width: 100%; width: 100%;
.grid-info__title { .grid-info__title {
display: flex; display: flex;
align-items: center; align-items: center;
@@ -640,9 +638,11 @@
font-size: 12px; font-size: 12px;
margin-bottom: 4px; margin-bottom: 4px;
} }
span { span {
line-height: 14px; line-height: 14px;
} }
img { img {
width: 40px; width: 40px;
height: 56px; height: 56px;

View File

@@ -1,33 +1,19 @@
<template> <template>
<div class="partyDvOrg" ref="container"> <div class="partyDvOrg" ref="container">
<div <div class="partyDvOrg-wrapper" ref="tree" id="tree"
class="partyDvOrg-wrapper"
ref="tree"
id="tree"
:style="{left: x, top: y, transform: `scale(${scale}) translate(-50%, -50%) `, 'transform-origin': `${0} ${0}`}"> :style="{left: x, top: y, transform: `scale(${scale}) translate(-50%, -50%) `, 'transform-origin': `${0} ${0}`}">
<VueOkrTree <ai-okr-tree :props="props" node-key="id" :data="treeData"/>
:props="props"
node-key="id"
ref="VueOkrTree"
:data="treeData">
</VueOkrTree>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { VueOkrTree } from 'vue-okr-tree' import AiOkrTree from "./AiOkrTree";
import 'vue-okr-tree/dist/vue-okr-tree.css'
export default { export default {
name: 'AiDvPartyOrg', name: 'AiDvPartyOrg',
components: {AiOkrTree},
props: ['instance'], props: ['instance'],
components: {
VueOkrTree
},
data() { data() {
return { return {
scale: 1, scale: 1,

View File

@@ -0,0 +1,40 @@
<template>
<section class="AiOkrTree">
<component v-if="okrTreeLoaded" v-bind="$attrs" :is="ot" :data="data"/>
</section>
</template>
<script>
import Vue from "vue"
export default {
name: "AiOkrTree",
props: {
data: {default: () => []}
},
computed: {
okrTreeLoaded: v => !!v.ot
},
data() {
return {
ot: null
}
},
created() {
this.$injectCss("https://cdn.cunwuyun.cn/vot/vue-okr-tree.css")
this.$injectLib("https://cdn.cunwuyun.cn/vot/vue-okr-tree.umd.min.js", () => {
const {VueOkrTree} = (window?.["vue-okr-tree"] || {})
this.ot = Vue.extend({
...VueOkrTree, data() {
return {...this.$attrs}
}
})
})
}
}
</script>
<style lang="scss" scoped>
.AiOkrTree {
}
</style>