魏熙美 5 лет назад
Родитель
Сommit
8d7f9e798a
4 измененных файлов: 115 добавлений и 0 удалений
  1. 10
    0
      src/config/api.js
  2. 25
    0
      src/store/modules/building.js
  3. 9
    0
      src/views/index.js
  4. 71
    0
      src/views/systemManagement/Intention.vue

+ 10
- 0
src/config/api.js Просмотреть файл

@@ -397,6 +397,16 @@ const apis = {
397 397
       method:'get',
398 398
       url: `${commPrefix}/taEventProperties`
399 399
     },
400
+  },
401
+  buildingIntention: { // 项目意向值
402
+    list: {
403
+      method: `get`,
404
+      url: `${commPrefix}/tdBizEventIntention`
405
+    },
406
+    saveOrUpdateBatch: {
407
+      method: `post`,
408
+      url: `${commPrefix}/taBuildingIntentionAddOrUpdate/:id`
409
+    }
400 410
   }
401 411
 }
402 412
 export default apis

+ 25
- 0
src/store/modules/building.js Просмотреть файл

@@ -117,6 +117,31 @@ export default {
117 117
           }
118 118
         })
119 119
       })
120
+    },
121
+    getBuildingIntention(_, payload) { // 获取意向值列表和意向值
122
+      return new Promise((resolve, reject) => {
123
+        request({
124
+          ...apis.buildingIntention.list,
125
+          params: payload
126
+        }).then((data) => {
127
+          resolve(data)
128
+        }).catch((err) => {
129
+          reject(err)
130
+        })
131
+      })
132
+    },
133
+    saveOrUpdateBatchBuildingIntention(_, payload) { // 批量更新意向值和列表
134
+      return new Promise((resolve, reject) => {
135
+        request({
136
+          ...apis.buildingIntention.saveOrUpdateBatch,
137
+          urlData: { id: payload.buildingId },
138
+          data: payload.list
139
+        }).then((data) => {
140
+          resolve(data)
141
+        }).catch((err) => {
142
+          reject(err)
143
+        })
144
+      })
120 145
     }
121 146
   }
122 147
 }

+ 9
- 0
src/views/index.js Просмотреть файл

@@ -329,6 +329,15 @@ const pages = [
329 329
           title: '报表数据',
330 330
         },
331 331
       },
332
+      {
333
+        path: 'intention',
334
+        name: 'intention',
335
+        component: () => import('./systemManagement/Intention.vue'),
336
+        meta: {
337
+          menuShow: true,
338
+          title: '意向值',
339
+        },
340
+      },
332 341
     ]
333 342
   },
334 343
   {

+ 71
- 0
src/views/systemManagement/Intention.vue Просмотреть файл

@@ -0,0 +1,71 @@
1
+<template>
2
+    <div id="root">
3
+        <select-building v-model="buildingId" @change="getBuildingIntentionList"></select-building>
4
+
5
+        <div class="intention-box">
6
+            <el-row class="marginTB">
7
+                <el-col :span="6">用户操作</el-col>
8
+                <el-col :span="12">意向值</el-col>
9
+            </el-row>
10
+            <el-row class="marginTB" v-for="(item, index) in  list" :key="item.eventId">
11
+                    <el-col :span="6"><el-checkbox v-model="item.checkbox">{{ item.eventName }}</el-checkbox></el-col>
12
+                    <el-col :span="12"><el-input v-model="list[index].intention" type="number"></el-input></el-col>
13
+            </el-row>
14
+            <el-button type="primary" @click="onSubmit">确定</el-button>
15
+        </div>
16
+    </div>
17
+</template>
18
+
19
+<script>
20
+    import { mapState, mapActions } from 'vuex'
21
+    export default {
22
+        name: "Intention",
23
+        data() {
24
+            return {
25
+                list: [],
26
+                buildingId: ''
27
+            }
28
+        },
29
+        mounted() {
30
+            // 默认选中的第一个项目
31
+            this.buildingId = this.buildings[0].buildingId
32
+            this.getBuildingIntentionList()
33
+        },
34
+        computed: {
35
+            ...mapState({
36
+                buildings: s => s.buildings || [],
37
+            }),
38
+        },
39
+        methods: {
40
+            getBuildingIntentionList() { // 获取意向列表和已经保存到意向值
41
+
42
+                this.$store.dispatch('building/getBuildingIntention', { pageNum: 1, pageSize: 9999, buildingId: this.buildingId }).then((res) => {
43
+                    this.list = res.records
44
+                }).catch((err) => {
45
+                    this.$notify.error(err.msg || err.message)
46
+                })
47
+            },
48
+            onSubmit() {
49
+                this.$store.dispatch('building/saveOrUpdateBatchBuildingIntention',{ list: this.list, buildingId: this.buildingId }).then((res) => {
50
+                    this.$notify.message("操作成功!")
51
+                }).catch((err) => {
52
+                    this.$notify.error(err.msg || err.message)
53
+                })
54
+            }
55
+        }
56
+    }
57
+</script>
58
+
59
+<style lang="scss" scoped>
60
+    .intention-box {
61
+        width: 60%;
62
+        min-width: 400px;
63
+        margin: 0 auto;
64
+    }
65
+
66
+    .marginTB {
67
+        & + .marginTB {
68
+            margin-top: 24px;
69
+        }
70
+    }
71
+</style>