|
@@ -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>
|