From 03f97376ff9d57e4529b1389328d077bce6fe840 Mon Sep 17 00:00:00 2001 From: wangqing Date: Tue, 8 Jun 2021 18:43:52 +0800 Subject: [PATCH] fix --- src/components/HandleProcess/index.vue | 65 ++++ src/components/HandleProcess/process.js | 19 + src/main.js | 3 +- .../statistics/chart.vue} | 164 +++----- src/views/form/statistics/index.vue | 335 +---------------- src/views/form/statistics/list.vue | 350 ++++++++++++++++++ src/views/home/HomeView.vue | 2 +- src/views/official/index.vue | 15 +- src/views/test.vue | 13 +- 9 files changed, 536 insertions(+), 430 deletions(-) create mode 100644 src/components/HandleProcess/index.vue create mode 100644 src/components/HandleProcess/process.js rename src/views/{home/dashboard.vue => form/statistics/chart.vue} (72%) create mode 100644 src/views/form/statistics/list.vue diff --git a/src/components/HandleProcess/index.vue b/src/components/HandleProcess/index.vue new file mode 100644 index 0000000..ceab6f4 --- /dev/null +++ b/src/components/HandleProcess/index.vue @@ -0,0 +1,65 @@ + + + + diff --git a/src/components/HandleProcess/process.js b/src/components/HandleProcess/process.js new file mode 100644 index 0000000..d273aec --- /dev/null +++ b/src/components/HandleProcess/process.js @@ -0,0 +1,19 @@ +// 参考文章 +// https://www.jianshu.com/p/514122716e38 +// https://www.cnblogs.com/shandou/p/13812538.html +import Vue from 'vue' // 引入 Vue 是因为要用到 Vue.extend() 这个方法 +import process from './index.vue' // 引入刚才的 toast 组件 + +let processConstructor = Vue.extend(process) +let instance + +const Process = function(options = {}) { + instance = new processConstructor({ + data: options // 这里的 data 会传到 message.vue 组件中的 data 中,当然也可以写在 props 里 + }) + document.body.appendChild(instance.$mount().$el) // 挂载到 body 下 + Vue.nextTick(() => { + instance.visible = true + }) +} +export default Process diff --git a/src/main.js b/src/main.js index e524e35..bc8cd91 100644 --- a/src/main.js +++ b/src/main.js @@ -15,6 +15,7 @@ import '@/utils/plugins' // 全局组件自动注册 import '@/components/autoRegister' import VueClipboard from 'vue-clipboard2' +import Process from '@/components/HandleProcess/process' Vue.prototype.$api = api Vue.prototype.$dayjs = dayjs Vue.prototype.$store = store @@ -31,7 +32,7 @@ Vue.prototype.msgWarning = function(msg) { Vue.prototype.msgInfo = function(msg) { this.$message.info(msg) } - +Vue.prototype.$process = Process Vue.use(VueClipboard) Vue.use(meta) Vue.use(Element, {size: 'small', zIndex: 3000}) diff --git a/src/views/home/dashboard.vue b/src/views/form/statistics/chart.vue similarity index 72% rename from src/views/home/dashboard.vue rename to src/views/form/statistics/chart.vue index b27401a..39f76ad 100644 --- a/src/views/home/dashboard.vue +++ b/src/views/form/statistics/chart.vue @@ -1,85 +1,55 @@ @@ -89,10 +59,10 @@ import LineChart from '@/components/echarts/LineChart' import MapChart from '@/components/echarts/MapChart' import CountTo from '@/components/CountTo' import BarChart from '@/components/echarts/BarChart' -import {timeFormat} from '@/utils/index' +import {timeFormat} from '@/utils' export default { - name: 'HomeDashboard', + name: 'StatisticsChart', components: { CountTo, MapChart, @@ -186,14 +156,13 @@ export default { name: '提交数', type: 'map', mapType: 'china', - zoom: 1.2, + zoom: 1.4, roam: false, label: { show: false, color: 'rgb(0,0,0)' }, - data: [ - ] + data: [] } ] }, @@ -273,13 +242,9 @@ export default { } }, created() { - this.$api.get('/user/project/list', {params: {status: 2}}).then(res => { - this.projectListData = res.data - if (res.data && res.data[0]) { - this.activeProjectKey = res.data[0].key - this.projectChangeHandle() - } - }) + this.activeProjectKey = this.$route.query.key + this.projectChangeHandle() + }, methods: { projectChangeHandle() { this.getProjectStats() @@ -370,35 +335,24 @@ export default { } - diff --git a/src/views/form/statistics/index.vue b/src/views/form/statistics/index.vue index a082b39..af54659 100644 --- a/src/views/form/statistics/index.vue +++ b/src/views/form/statistics/index.vue @@ -1,339 +1,44 @@ diff --git a/src/views/form/statistics/list.vue b/src/views/form/statistics/list.vue new file mode 100644 index 0000000..5a6d074 --- /dev/null +++ b/src/views/form/statistics/list.vue @@ -0,0 +1,350 @@ + + + + + diff --git a/src/views/home/HomeView.vue b/src/views/home/HomeView.vue index a664401..5bf24c0 100644 --- a/src/views/home/HomeView.vue +++ b/src/views/home/HomeView.vue @@ -19,7 +19,7 @@