diff --git a/src/components/gis-map/index.js b/src/components/gis-map/index.js index a1932a9..4949d81 100644 --- a/src/components/gis-map/index.js +++ b/src/components/gis-map/index.js @@ -22,6 +22,16 @@ const ALL_CHANGED = ~(1 << 31); export default { components: { }, + watch: { + 'queryParams.deptId': { + handler: function () { + console.log(this.queryParams.deptId); + this.commitDept(this.queryParams.deptId); + }, + immediate: true, // 立即执行 + + } + }, data () { return { financeSummary: { @@ -79,6 +89,8 @@ export default { created () { }, mounted () { + // console.log('当前年份', this.centerYear); + this.commitYear(this.centerYear); // 获取geoserver的地址 this.getGeoServerUrl(); getInfo().then(res => { @@ -91,11 +103,22 @@ export default { }); }, methods: { + /** + * 提交dept + * @param {*} deptId + */ + commitDept (deptId) { + this.$store.commit('SET_DEPTID', deptId); + }, + commitYear (year) { + this.$store.commit('SET_YEAR', year); + }, //切换年份 yearDropdown (item) { this.queryParams.year = item; this.centerYear = item; this.getData(YEAR_CHANGED); + this.commitYear(item); }, // 绘制地图 drawMap (node, isLocated) { // isLocated 控制地图是否跳转 @@ -250,7 +273,6 @@ export default { } }); }, - getData (mask) { if (!mask) mask = ALL_CHANGED; @@ -307,14 +329,12 @@ export default { }); } }, - selectAddress (value, isLocated = true) { // isLocated 控制地图是否跳转 this.queryParams.deptId = value[value.length - 1]; this.getData(DEPT_CHANGED); let node = this.$refs["cascader2"].panel.getNodeByValue(value); this.drawMap(node, isLocated); }, - // 查找指定deptId的所有父节点id findParentNodeIds (tree, deptId, result) { for (let node of tree) { diff --git a/src/store/getters.js b/src/store/getters.js index 3146bad..2d4b3e5 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -1,5 +1,7 @@ const getters = { sidebar: state => state.app.sidebar, + year: state => state.user.year, + deptId: state => state.user.deptId, size: state => state.app.size, device: state => state.app.device, visitedViews: state => state.tagsView.visitedViews, @@ -9,7 +11,7 @@ const getters = { name: state => state.user.name, introduction: state => state.user.introduction, roles: state => state.user.roles, - userRoles:state => state.user.userRoles, + userRoles: state => state.user.userRoles, permissions: state => state.user.permissions, setUpModuleId: state => state.user.setUpModuleId, permission_routes: state => state.permission.routes, @@ -35,5 +37,5 @@ const getters = { bigscreenUrl: state => state.user.bigscreenUrl, //大数据指挥舱 globalLogo: state => state.user.globalLogo, //全局logo screenLogo: state => state.user.screenLogo, //大屏logo - } +} export default getters diff --git a/src/store/modules/user.js b/src/store/modules/user.js index c730755..f7c9cf6 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -4,6 +4,8 @@ import { getToken, setToken, removeToken } from '@/utils/auth' const user = { state: { + deptId: '', + year: '', token: getToken(), name: '', avatar: '', @@ -29,6 +31,9 @@ const user = { }, mutations: { + SET_YEAR: (state, payload) => { + state.year = payload + }, SET_TOKEN: (state, token) => { state.token = token }, diff --git a/src/views/capital/api/index.js b/src/views/capital/api/index.js new file mode 100644 index 0000000..df2b69c --- /dev/null +++ b/src/views/capital/api/index.js @@ -0,0 +1,14 @@ +import request from '@/utils/request' + +// 资金一张图-左上-货币资金分析 +export function lefttopMonetaryFundAnalysis (deptId, year) { + let query = { + deptId, + year + } + return request({ + url: 'api/home/xixia/finance/hbzjfx', + method: 'get', + params: query + }) +} \ No newline at end of file diff --git a/src/views/capital/comps/left/top/1/index.html b/src/views/capital/comps/left/top/1/index.html index 264b3b6..2ee7ad8 100644 --- a/src/views/capital/comps/left/top/1/index.html +++ b/src/views/capital/comps/left/top/1/index.html @@ -1,4 +1,9 @@ - +
diff --git a/src/views/capital/comps/left/top/1/index.js b/src/views/capital/comps/left/top/1/index.js index dd153d1..d17eb4c 100644 --- a/src/views/capital/comps/left/top/1/index.js +++ b/src/views/capital/comps/left/top/1/index.js @@ -1,13 +1,49 @@ import Pannel from '@/components/pannel/index.vue'; import Block from '@/components/block/index.vue'; import data from './data.js'; +import { mapGetters } from 'vuex'; +import { lefttopMonetaryFundAnalysis } from '../../../../api/index.js'; export default { components: { Block, Pannel }, + computed: { + ...mapGetters(['year', 'deptId']) + }, + watch: { + year: { + handler () { + this.getData(); + }, + immediate: true, // 立即执行 + }, + deptId: { + handler () { + this.getData(); + }, + immediate: true, // 立即执行 + } + }, + methods: { + getData () { + if (this.year, this.deptId) { + this.isLoad = false; + lefttopMonetaryFundAnalysis(this.deptId, this.year).then(res => { + + this.data[0][0].value = res.data.cke // 存款额 + this.data[0][1].value = res.data.ckzzs // 组织数 + + this.data[1][0].value = res.data.xje // 现金额(万元) + this.data[1][1].value = res.data.xjzzs + this.isLoad = true; + }) + } + } + }, data () { return { + isLoad: false, // 是否加载完成 data }; }