+
+
+
+
+
+
+ 加载动力主轴
+
+
-
@@ -34,14 +51,13 @@ import CDialog from '@c/CDialog'
import kernelhouseholdTable from './kernelhouseholdTable'
import { requestPost } from "@/js/dai/request";
import { mapGetters } from 'vuex'
-import { Loading } from 'element-ui' // 引入Loading服务
-
-let loading // 加载动画
export default {
data () {
return {
+ agencytree: [], // 所属组织
+ agencyId: '',
filterText: '',
- treeLoading: true,
+ treeLoading: false,
treeData: [],
defaultProps: {
children: 'children',
@@ -53,37 +69,42 @@ export default {
}
},
async mounted () {
- this.treeLoading = true
- await this.loadTree()
- this.treeLoading = false
+ // this.treeLoading = true
+ // await this.loadTree()
+ await this.getAgencyTree()
+ // this.treeLoading = false
},
computed: {
rowHeight () {
- return this.$store.state.inIframe ? this.clientHeight - 120 + this.iframeHeight + 'px' : this.clientHeight - 120 + 'px'
+ return this.$store.state.inIframe ? this.clientHeight - 230 + this.iframeHeight + 'px' : this.clientHeight - 230 + 'px'
},
treeHeight () {
- return this.$store.state.inIframe ? this.clientHeight - 200 + this.iframeHeight + 'px' : this.clientHeight - 200 + 'px'
+ return this.$store.state.inIframe ? this.clientHeight - 310 + this.iframeHeight + 'px' : this.clientHeight - 310 + 'px'
},
- ...mapGetters(['clientHeight', 'iframeHeight'])
+ ...mapGetters(['clientHeight', 'iframeHeight']),
+
+ dataRule () {
+ return {
+ deptName:[
+ { required: true, message: "请选择", trigger: "blur" }
+ ]
+ }
+ }
},
methods: {
- async loadTree (isRefresh) {
+ async loadTree () {
+ if (this.agencyId.length === 0 || !this.agencyId) {
+ return this.$message.error('请选择所属组织')
+ }
+ this.treeLoading = true
const url = "/pli/power/data/axis/structTree"
let params = {
- agencyId: '1495655378069753857'
+ agencyId: this.agencyId[this.agencyId.length-1]
}
const { data, code, msg } = await requestPost(url, params)
+ this.treeLoading = false
if (code === 0) {
this.treeData = data
- if (!isRefresh && data.length > 0) {
- this.selTreeObj = data[0]
- if (!this.selTreeObj.latitude) {
- this.selTreeObj.latitude = this.centerPoint[0]
- }
- if (!this.selTreeObj.longitude) {
- this.selTreeObj.longitude = this.centerPoint[1]
- }
- }
} else {
this.$message.error(msg)
}
@@ -95,20 +116,55 @@ export default {
if (!value) return true;
return data.name.indexOf(value) !== -1;
},
- // 开启加载动画
- startLoading () {
- loading = Loading.service({
- lock: true, // 是否锁定
- text: '正在加载……', // 加载中需要显示的文字
- background: 'rgba(0,0,0,.7)' // 背景颜色
- })
+ // 获取组织列表
+ async getAgencyTree(){
+ const url = '/data/aggregator/org/agencytree'
+
+ let params = {
+ agencyId:this.agencyId,
+ client:'gov'
+ }
+
+ const { data, code, msg } = await requestPost(url,params)
+
+ if (code === 0) {
+ let _data
+ if (data) {
+ _data = this.removeByOrgType(data, 'agency')
+ if (_data) {
+ this.agencytree = this.removeEmptySubOrgList(_data)
+ }
+ }
+ } else {
+ this.$message.error(msg)
+ }
},
- // 结束加载动画
- endLoading () {
- // clearTimeout(timer);
- if (loading) {
- loading.close()
- }
+ removeByOrgType (orgArray, orgType) {
+ if (orgArray && orgArray.length > 0) {
+ for (let p = orgArray.length - 1; p >= 0; p--) {
+ let orgInfo = orgArray[p]
+ if (orgInfo) {
+ if (orgInfo.orgType !== orgType) {
+ orgArray.splice(p, 1)
+ } else {
+ this.removeByOrgType(orgInfo.subOrgList, orgType)
+ }
+ }
+ }
+ }
+ return orgArray
+ },
+ removeEmptySubOrgList (orgArray) {
+ orgArray.forEach((orgInfo) => {
+ if (orgInfo && orgInfo.subOrgList) {
+ if (orgInfo.subOrgList.length === 0) {
+ orgInfo.subOrgList = undefined
+ } else {
+ this.removeEmptySubOrgList(orgInfo.subOrgList)
+ }
+ }
+ })
+ return orgArray;
}
},
watch: {
@@ -122,7 +178,15 @@ export default {
}