diff --git a/package.json b/package.json index ff684a3..0ee7564 100644 --- a/package.json +++ b/package.json @@ -65,10 +65,7 @@ "not ie <= 8" ], "lint-staged": { - "src/**/*.{js,vue}": [ - "eslint --fix", - "git add" - ] + }, "husky": { "hooks": { diff --git a/src/api/index.js b/src/api/index.js index fbd387d..ea1922a 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -32,7 +32,9 @@ api.interceptors.request.use( * 以下代码为示例,在登录状态下,分别对 post 和 get 请求加上 token 参数 */ if (store.getters['user/isLogin']) { - request.headers.token = store.state.user.token + request.headers.token = store.state.user.token + // request.headers.token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJhcHAiOiJnb3YiLCJjbGllbnQiOiJ3ZWIiLCJleHAiOjE2MzI5NjYwODEsInVzZXJJZCI6Ijg0ODg3ZDQzMjEzN2EzMGI3YWJhYWM1MDY5ODZkNDYxIiwiaWF0IjoxNjMyMzYxMjgxfQ.CDYJNfuF7gRRDwwmB9dJQjVOj_t_3xdrgwMqxHNAleZuQHkPMu9fI32at2aPjprhN4yBc_KT_3_Yhh30SF7YzA' + // request.headers.Authorization = store.state.user.token } signRequest(request) return request diff --git a/src/views/form/statistics/analysis.vue b/src/views/form/statistics/analysis.vue index 6270f6a..f9efd9b 100644 --- a/src/views/form/statistics/analysis.vue +++ b/src/views/form/statistics/analysis.vue @@ -4,9 +4,9 @@
- Q:{{ item.label }}({{ item.type }}) + Q{{ index + 1 }} :{{ item.label }}({{ item.type }}) -
+
- + /> --> +
+ 共收集 {{ item.detail.collectionTotal }} 条, + 有效 {{ item.detail.validTotal }} 条 + ,总计 {{ item.detail.sumTotal }} + ,开 {{ item.detail.openTotal }} 条,关 {{ item.detail.closedTotal }} 条 +
+ +
+
+
{{ n.label }}
+
+
+ +
+
+ {{ computedPercent(n.currentCount, item.detail.totalCount).toFixed(2) }}% +
+
{{ n.currentCount }}次
+
+
+
- + @@ -108,9 +129,11 @@ export default { }, methods: { getData() { + // `${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/report/analysis` + // params: { projectKey: this.$route.query.key } this.$api - .get('/user/project/report/analysis', { - params: { projectKey: this.$route.query.key } + .post('/data/aggregator/questionnaire/analysisreport', { + projectKey: this.$route.query.key }) .then(res => { this.list = res.data @@ -185,6 +208,13 @@ export default { // config.series[0].data = data.map } return config + }, + computedCount(type) { + const arr = ['PROVINCE_CITY', 'NUMBER_INPUT', 'SWITCH', 'INPUT', 'TEXTAREA', 'INPUT_MAP', 'TIME', 'DATE_RANGE', 'DATE', 'TIME_RANGE'] + return arr.includes(type) + }, + computedPercent(num, count) { + return ((num * 100) / count) } } } @@ -199,7 +229,7 @@ export default { width: 100%; .title { font-size: 14px; - padding: 0 30px; + // padding: 0 30px; height: 54px; line-height: 54px; width: 100%; @@ -211,4 +241,51 @@ export default { } } } - \ No newline at end of file + + + + diff --git a/src/views/form/statistics/chart.vue b/src/views/form/statistics/chart.vue index d8cc329..107ba1d 100644 --- a/src/views/form/statistics/chart.vue +++ b/src/views/form/statistics/chart.vue @@ -252,7 +252,7 @@ export default { this.getProjectSubmitSource() }, getProjectStats() { - this.$api.get('/user/project/report/stats', {params: {projectKey: this.activeProjectKey}}).then(res => { + this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/report/stats`, {params: {projectKey: this.activeProjectKey}}).then(res => { this.projectStats = res.data if (this.projectStats.completeCount) { let rate = this.projectStats.completeCount / this.projectStats.viewCount @@ -265,7 +265,7 @@ export default { }) }, getProjectSituation() { - this.$api.get('/user/project/report/situation', {params: {projectKey: this.activeProjectKey}}).then(res => { + this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/report/situation`, {params: {projectKey: this.activeProjectKey}}).then(res => { this.lineChartOptionData.xAxis.data = res.data.map(item => { return item.createdTime }) @@ -282,7 +282,7 @@ export default { }, // 项目提交地址 getProjectSubmitPosition() { - this.$api.get('/user/project/report/position', {params: {projectKey: this.activeProjectKey}}).then(res => { + this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/report/position`, {params: {projectKey: this.activeProjectKey}}).then(res => { this.mapChartOptionData.series = [ { name: '提交数', @@ -302,7 +302,7 @@ export default { }) }, getProjectSubmitSource() { - this.$api.get('/user/project/report/source', {params: {projectKey: this.activeProjectKey}}).then(res => { + this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/report/source`, {params: {projectKey: this.activeProjectKey}}).then(res => { if (res.data && res.data.length) { this.barChartOptionData.yAxis.data = res.data.map(item => { return item.browserName ? item.browserName : '其他' @@ -321,7 +321,7 @@ export default { }) }, getProjectSubmitDevice() { - this.$api.get('/user/project/report/device', {params: {projectKey: this.activeProjectKey}}).then(res => { + this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/report/device`, {params: {projectKey: this.activeProjectKey}}).then(res => { if (res.data && res.data.length) { this.pieChartOptionData.series[0].data = res.data.map(item => { return {value: item.count, name: item.osName ? item.osName : '其他'} diff --git a/src/views/form/statistics/index.vue b/src/views/form/statistics/index.vue index 71d0d6e..60600bf 100644 --- a/src/views/form/statistics/index.vue +++ b/src/views/form/statistics/index.vue @@ -4,9 +4,9 @@ - + diff --git a/src/views/form/statistics/list.vue b/src/views/form/statistics/list.vue index dc46c0b..8d8561f 100644 --- a/src/views/form/statistics/list.vue +++ b/src/views/form/statistics/list.vue @@ -48,6 +48,11 @@ + + + + + - + @@ -90,7 +95,7 @@

{{ item.label }}

- @@ -213,7 +218,8 @@ export default { this.queryProjectResult() this.queryProjectItems() this.queryProject() - }, methods: { + }, + methods: { renderHeader() { return ( { + this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/${this.projectKey}`).then(res => { this.projectData = res.data }) }, @@ -238,7 +244,7 @@ export default { this.queryProjectResult() }, queryProjectResult() { - this.$api.get('/user/project/result/page', {params: this.queryConditions}).then(res => { + this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/result/page`, {params: this.queryConditions}).then(res => { let {records, total, size} = res.data this.projectResultList = records this.total = total @@ -280,7 +286,7 @@ export default { this.$message.error('无附件,无法导出') return } - this.$api.get('/user/project/result/download/file', { + this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/result/download/file`, { params: this.queryConditions }).then(res => { this.$process({ @@ -294,7 +300,7 @@ export default { this.$message.error('无表单有效反馈结果,无法导出') return } - this.$api.get('user/project/result/export', { + this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/result/export`, { params: this.queryConditions, responseType: 'blob' }).then(res => { @@ -310,7 +316,7 @@ export default { }) }, queryProjectItems() { - this.$api.get('/user/project/item/list', {params: {key: this.projectKey, displayType: false}}).then(res => { + this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/item/list`, {params: {key: this.projectKey, displayType: false}}).then(res => { if (res.data) { res.data.map(item => { _.set(this.projectItemColumns, `field${item.formItemId}`, item.label) diff --git a/vue.config.js b/vue.config.js index b90e258..c86d0f6 100644 --- a/vue.config.js +++ b/vue.config.js @@ -15,6 +15,10 @@ module.exports = { open: true, port: 8888, // 开发环境默认开启反向代理,如果不需要请自行注释 + // "src/**/*.{js,vue}": [ 校验提交 + // "eslint --fix", + // "git add" + // ] // proxy: { // '/tduck-api': { // //target: 'http://localhost:8080/api/',