ソースを参照

Merge branch 'master' of http://git.ycjcjy.com/zhiyuxing/pc-admin

许静 5 年 前
コミット
8f2122cfc2

+ 0
- 1
package.json ファイルの表示

@@ -22,7 +22,6 @@
22 22
     "tinymce": "^5.0.12",
23 23
     "vue": "^2.6.6",
24 24
     "vue-amap": "^0.5.9",
25
-    "vue-echarts": "^4.0.1",
26 25
     "vue-router": "^3.0.2",
27 26
     "vuex": "^3.1.0",
28 27
     "wangeditor": "^3.1.1"

+ 49
- 0
src/components/SelectBuilding.vue ファイルの表示

@@ -0,0 +1,49 @@
1
+<template>
2
+  <el-select v-model="val" filterable placeholder="请选择">
3
+    <el-option
4
+      v-for="item in buildings"
5
+      :key="item.buildingId"
6
+      :label="item.buildingName"
7
+      :value="item.buildingId">
8
+    </el-option>
9
+  </el-select>
10
+</template>
11
+
12
+<script>
13
+import { mapState, mapActions } from 'vuex'
14
+
15
+export default {
16
+  name: 'SelectBuilding',
17
+  props: [ 'value' ],
18
+  data () {
19
+    return {
20
+      cacheVal: null,
21
+    }
22
+  },
23
+  computed: {
24
+    ...mapState({
25
+      buildings: s => s.buildings || [],
26
+    }),
27
+    val: {
28
+      get() {
29
+        return this.value || this.cacheVal
30
+      },
31
+      set (nw) {
32
+        this.cacheVal = nw
33
+        this.$emit('input', nw)
34
+      }
35
+    },
36
+  },
37
+  created () {
38
+    if (!this.buildings || !this.buildings.length) {
39
+      this.getBuildings()
40
+    }
41
+  },
42
+  methods: {
43
+    ...mapActions([
44
+      'getBuildings',
45
+    ]),
46
+  },
47
+}
48
+</script>
49
+

+ 0
- 88
src/components/charts/VisitingDayLine.vue ファイルの表示

@@ -1,88 +0,0 @@
1
-<template>
2
-  <v-chart class="x-chart" :options="options" autoresize></v-chart>
3
-</template>
4
-
5
-<script>
6
-import 'echarts/lib/chart/line'
7
-import 'echarts/lib/component/title'
8
-import 'echarts/lib/component/dataZoom'
9
-import 'echarts/lib/component/tooltip'
10
-
11
-export default {
12
-  name: 'visiting-day-line',
13
-  components: {
14
-    // vChart: () => import('vue-echarts'),
15
-  },
16
-  props: [
17
-    'source',
18
-  ],
19
-  data () {
20
-    return {
21
-      opts: {
22
-        title: { text: '日访问量' },
23
-        tooltip: {
24
-          formatter: (params, ticket, callback) => {
25
-            const { visiteDate, amount } = params.data
26
-            const tip = `${visiteDate}: ${amount}`
27
-            callback(ticket, tip)
28
-            return tip
29
-          }
30
-        },
31
-        xAxis: { type: 'category' },
32
-        yAxis: { name: '人/日' },
33
-        series: [
34
-          {
35
-            type: 'line',
36
-            smooth: true,
37
-            encode: {
38
-              x: 'visiteDate',
39
-              y: 'amount',
40
-            },
41
-          },
42
-        ],
43
-        dataZoom: [
44
-          {
45
-            type: 'inside',
46
-            show: true,
47
-            start: 0,
48
-            end: 100,
49
-          },
50
-          // {
51
-          //   type: 'slider',
52
-          //   show: true,
53
-          //   start: 0,
54
-          //   end: 100,
55
-          // }
56
-        ],
57
-        dataset: {
58
-          sourceHeader: false,
59
-          dimensions: ['visiteDate', 'amount'],
60
-        },
61
-      }
62
-    }
63
-  },
64
-  computed: {
65
-    options () {
66
-      return {
67
-        ...this.opts,
68
-        title: {
69
-          ...this.opts.title,
70
-        },
71
-        dataset: {
72
-          ...this.opts.dataset,
73
-          source: this.source || [],
74
-        }
75
-      }
76
-    }
77
-  }
78
-}
79
-</script>
80
-
81
-<style lang="scss" scoped>
82
-.x-chart {
83
-  margin: 0 auto;
84
-  width: 100%;
85
-  height: 100%;
86
-}
87
-</style>
88
-

+ 0
- 93
src/components/charts/VisitingDayTable.vue ファイルの表示

@@ -1,93 +0,0 @@
1
-<template>
2
-  <div>
3
-    <h3 style="margin: 0">访客记录</h3>
4
-    <el-table
5
-      :data="dataSet"
6
-      stripe
7
-      style="width: 100%">
8
-      <el-table-column
9
-        label="日期"
10
-        width="180">
11
-        <template slot-scope="scope">
12
-          <span>{{formatDate(scope.row.visiteDate)}}</span>
13
-        </template>
14
-      </el-table-column>
15
-      <el-table-column
16
-        prop="name"
17
-        label="姓名"
18
-        width="180">
19
-      </el-table-column>
20
-      <el-table-column
21
-        prop="carStyle"
22
-        label="车辆">
23
-      </el-table-column>
24
-      <el-table-column
25
-        prop="deviceName"
26
-        label="采集设备">
27
-      </el-table-column>
28
-    </el-table>
29
-    <el-pagination
30
-      small
31
-      style="margin-top:10px;"
32
-      layout="prev, pager, next"
33
-      :page-size="pageNavi.size"
34
-      :total="pageNavi.total"
35
-      :current-page="pageNavi.current"
36
-      @current-change="changePage"
37
-    >
38
-    </el-pagination>
39
-  </div>
40
-</template>
41
-
42
-<script>
43
-import dayjs from 'dayjs'
44
-
45
-export default {
46
-  name: 'visiting-day-table',
47
-  props: [
48
-    'source',
49
-    'page',
50
-  ],
51
-  data() {
52
-    return {
53
-      sampleData: [
54
-        { visiteDate: '2019-02-15 17:00', name: '张一', carStyle: '奔驰', channel: '搜房' },
55
-        { visiteDate: '2019-02-15 16:40', name: '张二', carStyle: '奔驰', channel: '搜房' },
56
-        { visiteDate: '2019-02-15 16:30', name: '张三', carStyle: '奔驰', channel: '搜房' },
57
-        { visiteDate: '2019-02-15 15:50', name: '张四', carStyle: '奔驰', channel: '搜房' },
58
-        { visiteDate: '2019-02-15 15:40', name: '张五', carStyle: '奔驰', channel: '搜房' },
59
-        { visiteDate: '2019-02-15 15:20', name: '张六', carStyle: '奔驰', channel: '搜房' },
60
-        { visiteDate: '2019-02-15 15:10', name: '张七', carStyle: '奔驰', channel: '搜房' },
61
-        { visiteDate: '2019-02-15 15:00', name: '张八', carStyle: '奔驰', channel: '搜房' },
62
-      ],
63
-      defPage: {
64
-        current: 1,
65
-        size: 10,
66
-        total: 0,
67
-      }
68
-    }
69
-  },
70
-  computed: {
71
-    pageNavi () {
72
-      return {
73
-        ...this.defPage,
74
-        ...(this.page || {})
75
-      }
76
-    },
77
-    dataSet () {
78
-      return this.source || this.sampleData
79
-    }
80
-  },
81
-  methods: {
82
-    changePage (nwPg) {
83
-      this.$emit('page-change', nwPg)
84
-    },
85
-    formatDate(dt) {
86
-      if (!dt || dt.indexOf('0001-') > -1) return ''
87
-
88
-      return dayjs(dt).format('YYYY-MM-DD HH:mm')
89
-    }
90
-  }
91
-}
92
-</script>
93
-

+ 33
- 13
src/components/charts/XLine.vue ファイルの表示

@@ -1,11 +1,17 @@
1 1
 <template>
2
-   <div ref="thirdChart" ></div>
2
+  <div ref="echart" ></div>
3 3
 </template>
4 4
 <script>
5 5
 import Echarts from "echarts";
6
+
6 7
 export default {
7 8
   name: "XLine",
8
-  props: ["value"],
9
+  props: {
10
+    value: {
11
+      type: Object,
12
+      default: () => {},
13
+    },
14
+  },
9 15
   data() {
10 16
     return {
11 17
       chart: undefined,
@@ -50,23 +56,37 @@ export default {
50 56
     };
51 57
   },
52 58
   watch: {
53
-    value (val) {
54
-      this.renderChart(val)
59
+    value: {
60
+      handler(val) {
61
+        this.renderChart(val)
62
+      },
63
+      immediate: true,
64
+      deep: true,
55 65
     },
56 66
   },
57 67
   mounted() {
58
-    if (!this.chart) {
59
-      this.chart = Echarts.init(this.$refs.thirdChart);
60
-      this.renderChart(this.value)
61
-    }
68
+    this.renderChart(this.value || {})
62 69
   },
63 70
   methods: {
71
+    initChats () {
72
+      if (!this.chart && this.$refs.echart) {
73
+        this.chart = Echarts.init(this.$refs.echart);
74
+      }
75
+
76
+      if (this.chart) {
77
+        return Promise.resolve(this.chart)
78
+      } else {
79
+        return Promise.reject()
80
+      }
81
+    },
64 82
     renderChart(val) {
65
-      // 绘制图表
66
-      this.chart.setOption({
67
-        ...this.defaultOpts,
68
-        ...val
69
-      });
83
+      this.initChats().then((echart) => {
84
+        // 绘制图表
85
+        echart.setOption({
86
+          ...this.defaultOpts,
87
+          ...val
88
+        });
89
+      })
70 90
     }
71 91
   }
72 92
 };

+ 2
- 0
src/main.js ファイルの表示

@@ -5,6 +5,7 @@ import XMIcon from '@/components/XMIcon.vue'
5 5
 import XMRightLay from '@/components/XMRightLay.vue'
6 6
 import XMSearchForm from '@/components/XMSearchForm.vue'
7 7
 import RichEditor from '@/components/RichEditor.vue'
8
+import SelectBuilding from '@/components/SelectBuilding'
8 9
 
9 10
 import App from './App.vue'
10 11
 import router from './router'
@@ -27,6 +28,7 @@ Vue.component('xm-icon', XMIcon)
27 28
 Vue.component('xm-rtl', XMRightLay)
28 29
 Vue.component('xm-search', XMSearchForm)
29 30
 Vue.component('rich-editor', RichEditor)
31
+Vue.component('select-building', SelectBuilding)
30 32
 Vue.use(VueAMap)
31 33
 
32 34
 VueAMap.initAMapApiLoader({

+ 20
- 1
src/store/system.js ファイルの表示

@@ -10,6 +10,7 @@ export default {
10 10
     },
11 11
     menus: [],
12 12
     user: {},
13
+    buildings: [],
13 14
   },
14 15
   mutations: {
15 16
     updateUser(state, user) {
@@ -17,6 +18,9 @@ export default {
17 18
         ...state.user,
18 19
         ...user,
19 20
       }
21
+    },
22
+    updateBuildings(state, buildings) {
23
+      state.buildings = buildings || []
20 24
     }
21 25
   },
22 26
   actions: {
@@ -54,6 +58,21 @@ export default {
54 58
         localStorage.removeItem('x-token')
55 59
         commit('updateUser', {})
56 60
       })
57
-    }
61
+    },
62
+    getBuildings ({ commit }) {
63
+      return new Promise((resolve, reject) => {
64
+        request({
65
+          ...apis.building.list,
66
+          params: { pageSize: 999 },
67
+        }).then((data) => {
68
+          commit('updateBuildings',  data.records)
69
+          resolve(data)
70
+        }).catch(({ message }) => {
71
+          if (typeof message === 'string') {
72
+            reject(message)
73
+          }
74
+        })
75
+      })
76
+    },
58 77
   }
59 78
 }

+ 2
- 2
src/views/carouselFigure/advertisementEdit.vue ファイルの表示

@@ -25,11 +25,11 @@
25 25
       <el-form-item label="标题:">
26 26
         <el-input v-model="form.title"></el-input>
27 27
       </el-form-item>
28
-      <el-form-item label="发布位置:">
28
+      <!-- <el-form-item label="发布位置:">
29 29
         <el-select v-model="form.showPosition" placeholder="请选择">
30 30
           <el-option v-for="(item,i) in showPositionList" :key="i" :label="item.name" :value="item.value"></el-option>
31 31
         </el-select>
32
-      </el-form-item>
32
+      </el-form-item> -->
33 33
       <el-form-item label="类型:">
34 34
         <el-select v-model="form.contentType" placeholder="请选择">
35 35
           <el-option v-for="(t,i) in contentTypeList" :key="i" :label="t.name" :value="t.value"></el-option>

+ 1
- 0
src/views/indexEcharts/index.vue ファイルの表示

@@ -20,6 +20,7 @@
20 20
       </div>
21 21
     </el-col>
22 22
   </el-row>
23
+  <select-building></select-building>
23 24
   <p class="title under-line" @click="toUserSource()">用户来源</p>
24 25
   <span class="title-desc under-line" @click="toUserSource()">最近7天</span>
25 26
   <el-row :gutter="20" :style="{ height: '560px',margin:'20px 0',border:'1px solid #eee',borderRadius:'5px'}">

+ 1
- 1
vue.config.js ファイルの表示

@@ -4,7 +4,7 @@ module.exports = {
4 4
     port: 8080,
5 5
     proxy: {
6 6
       '/api': {
7
-        target: 'http://192.168.0.131:8080',
7
+        target: 'http://192.168.0.11:8080',
8 8
         // target: 'http://localhost:8080',
9 9
         changeOrigin: true,
10 10
         // pathRewrite: {