Your Name пре 5 година
родитељ
комит
2976ce23d0

+ 7
- 0
src/config/api.js Прегледај датотеку

@@ -459,6 +459,13 @@ const apis = {
459 459
       method: 'delete',
460 460
       url: `${commPrefix}/taCustomerTransfer/delete/:id`
461 461
     },
462
+  },
463
+
464
+  sysDict: {
465
+    list: {
466
+      method: 'get',
467
+      url: `${commPrefix}/sysDict`
468
+    },
462 469
   }
463 470
 
464 471
 }

+ 2
- 0
src/router.js Прегледај датотеку

@@ -78,6 +78,8 @@ router.beforeEach((to, from, next) => {
78 78
 
79 79
   // 尝试去获取人员
80 80
   store.dispatch('getUser').then(() => {
81
+    // 获取通用字典
82
+    store.dispatch('getSysDict')
81 83
 
82 84
     // 校验权限
83 85
     if (checkAuthority(store.state, to.name)) {

+ 1
- 0
src/store/modules/dailyRegistration.js Прегледај датотеку

@@ -1,4 +1,5 @@
1 1
 import lodash from 'lodash'
2
+import dayjs from 'dayjs'
2 3
 import { interact } from '../../utils'
3 4
 import apis from '../../config/api'
4 5
 

+ 12
- 0
src/store/modules/sysuser.js Прегледај датотеку

@@ -27,6 +27,18 @@ export default {
27 27
         label: '吧台人员',
28 28
         value: 'bar-usher',
29 29
       },
30
+      {
31
+        label: '置业经理',
32
+        value: 'consultant_manager',
33
+      },
34
+      {
35
+        label: '渠道经理',
36
+        value: 'channel_manager',
37
+      },
38
+      {
39
+        label: '营 销 总',
40
+        value: 'general_manager',
41
+      },
30 42
       {
31 43
         label: '其他',
32 44
         value: '',

+ 20
- 1
src/store/system.js Прегледај датотеку

@@ -12,6 +12,7 @@ export default {
12 12
     menus: [],
13 13
     user: {},
14 14
     userLoged: false,
15
+    sysDict: undefined,
15 16
   },
16 17
   mutations: {
17 18
     updateUser(state, user) {
@@ -92,6 +93,24 @@ export default {
92 93
       interact(api, payload).then(() => {
93 94
 
94 95
       })
95
-    }
96
+    },
97
+    getSysDict ({commit, state}, payload) {
98
+      if (state.sysDict) {
99
+        return
100
+      }
101
+
102
+      const api = apis.sysDict.list
103
+      interact(api).then((dt) => {
104
+        const sysDict = (dt || []).reduce((acc, item) => {
105
+          return {
106
+            ...acc,
107
+            [`${item.type}`]: (acc[item.type] || []).concat(item)
108
+          }
109
+        }, {})
110
+
111
+        commit('syncState', {sysDict})
112
+      })
113
+    },
114
+
96 115
   }
97 116
 }

+ 5
- 0
src/utils/index.js Прегледај датотеку

@@ -98,6 +98,11 @@ export const interact = request({
98 98
   }
99 99
 })
100 100
 
101
+export function mixinPhone(phone) {
102
+  if (!phone) return ''
103
+  return phone.replace(/(.{3})(.*)(.{4})/g, '$1****$3')
104
+}
105
+
101 106
 // 未定义的就使用默认值
102 107
 const ifUndifined = (val, def) => (val === undefined ? def : val)
103 108
 const withDefault = (val, def) => ({ ...def, ...ifUndifined(val, def) })

+ 55
- 45
src/views/dailyRegistration/index.vue Прегледај датотеку

@@ -25,10 +25,7 @@
25 25
        </el-form-item> 
26 26
       <el-form-item label="客户来源">
27 27
         <el-select v-model="formInline.customerSource " clearable placeholder="请选择">
28
-          <el-option label="自然" value="109" />
29
-          <el-option label="自拓" value="110"/>
30
-          <el-option label="自渠" value="111"/>
31
-          <el-option label="老客" value="112"/>
28
+          <el-option :label="item.label" :value="item.id" v-for="item in sysDict['customerSourceDict']" :key="item.id" />
32 29
         </el-select>
33 30
        </el-form-item> 
34 31
       <el-form-item label="姓名">
@@ -40,15 +37,14 @@
40 37
       <el-form-item label="接待人">
41 38
         <el-input v-model="formInline.receiver" placeholder="输入接待人"></el-input>
42 39
       </el-form-item>
43
-      </el-form-item>   
40
+      <el-form-item>   
44 41
         <el-button type="primary" @click="onSubmit">查询</el-button> 
45 42
         <el-button type="info" @click="clear">重置</el-button>
46 43
       </el-form-item>
44
+      <el-form-item style="float: right; margin-right: 50px;">  
45
+        <a style="text-decoration: none" :href="exportExcelUrl">导出</a>
46
+      </el-form-item>
47 47
     </el-form>
48
-    <div style="height:70px;line-height:70px">
49
-      <a href="excel/usherListExcel">导出</a>
50
-        <el-button type="primary" @click="outPut" style="float:right"></el-button> 
51
-    </div>
52 48
     <el-table
53 49
     :data="dailyList.records"
54 50
     border>
@@ -57,7 +53,7 @@
57 53
       label="客户类型"
58 54
       align='center'>
59 55
           <template slot-scope="scope">
60
-             <!-- <span>{{ scope.row.customerType =='channel'? '渠道客户':'自销客户' }}</span> -->
56
+            <span>{{ scope.row.customerType =='channel'? '渠道客户':'自销客户' }}</span>
61 57
           </template>
62 58
     </el-table-column>
63 59
     <el-table-column
@@ -69,11 +65,17 @@
69 65
       prop="phone"
70 66
       label="手机号"
71 67
       align='center'>
68
+        <template slot-scope="scope">
69
+            <span>{{ mixinPhone(scope.row.phone) }}</span>
70
+        </template>
72 71
     </el-table-column>
73 72
     <el-table-column
74 73
       prop="personNum"
75 74
       label="来访人数"
76 75
       align='center'>
76
+          <template slot-scope="scope">
77
+             <span>{{ filterPersonNum(scope.row.personNum) }}</span>
78
+          </template>
77 79
     </el-table-column>
78 80
     <el-table-column
79 81
     align='center'
@@ -89,7 +91,7 @@
89 91
       label="客户来源"
90 92
       align='center'>
91 93
           <template slot-scope="scope">
92
-             <span>{{ scope.row.customerSource |filterCustomerSource }}</span>
94
+             <span>{{ filterCustomerSource(scope.row.customerSource) }}</span>
93 95
           </template>
94 96
     </el-table-column>
95 97
     <el-table-column
@@ -109,20 +111,23 @@
109 111
     </el-table-column>
110 112
   </el-table>
111 113
     <el-pagination
112
-            style="margin-top:50px;float:right"
113
-            @size-change="handleSizeChange"
114
-            @current-change="handleCurrentChange"
115
-            :current-page="formInline.pageNum"
116
-            :page-sizes="[1,10, 20, 30, 40]"
117
-            :page-size="formInline.pageSize"
118
-            layout="total, sizes, prev, pager, next, jumper"
119
-            :total="dailyList.total || 0">
114
+      style="margin-top:50px;float:right"
115
+      @size-change="handleSizeChange"
116
+      @current-change="handleCurrentChange"
117
+      :current-page="formInline.pageNum"
118
+      :page-sizes="[1,10, 20, 30, 40]"
119
+      :page-size="formInline.pageSize"
120
+      layout="total, sizes, prev, pager, next, jumper"
121
+      :total="dailyList.total || 0">
120 122
     </el-pagination>
121 123
   </div>
122 124
 </template>
123 125
 
124 126
 <script>
127
+import dayjs from 'dayjs'
125 128
 import { createNamespacedHelpers } from 'vuex'
129
+import { mixinPhone } from '../../utils'
130
+
126 131
 const {mapState: mapDailyRegistrationState, mapActions: mapDailyRegistrationActions } = createNamespacedHelpers('dailyRegistration')
127 132
 
128 133
 export default {
@@ -130,8 +135,8 @@ export default {
130 135
   data() {
131 136
     return {
132 137
       formInline: {
133
-        startTime :'',
134
-        endTime :'',
138
+        startTime : dayjs().hour(0).minute(0).second(0).toDate(),
139
+        endTime : new Date(),
135 140
         personName: '',
136 141
         phone: '',
137 142
         customerType: '',
@@ -146,29 +151,29 @@ export default {
146 151
     ...mapDailyRegistrationState({
147 152
     dailyList: x => x.dailyList,
148 153
     excelList: x => x.excelList
149
-    })
154
+    }),
155
+    sysDict () {
156
+      return this.$store.state.sysDict
157
+    },
158
+    queryFitlers () {
159
+      return {
160
+        ...this.formInline,
161
+        startTime: dayjs(this.formInline.startTime).format('YYYY-MM-DDT00:00:00Z'),
162
+        endTime: dayjs(this.formInline.endTime).format('YYYY-MM-DDT23:59:59Z'),
163
+      }
164
+    },
165
+    exportExcelUrl() {
166
+      const queryString = Object.keys(this.queryFitlers).map((k) => {
167
+        return `${k}=${encodeURIComponent(this.queryFitlers[k])}`
168
+      }).join('&')
169
+
170
+      return `${window.location.origin}/api/excel/usherListExcel?${queryString}`
171
+      // return `http://127.0.0.1:8080/excel/usherListExcel?${queryString}`
172
+    },
150 173
   },
151 174
   created() {
152 175
     this.getPage()
153 176
   },
154
-  filters:{
155
-    filterCustomerSource(val){
156
-      if(val=='109'){
157
-        return  '自然'
158
-      }
159
-      else if(val=='110'){
160
-        return  '自拓'
161
-      }
162
-      else if(val=='111'){
163
-        return  '自渠'
164
-      }
165
-      else if(val=='112'){
166
-        return  '老客'
167
-      }else{
168
-        return
169
-      }
170
-    }
171
-  },
172 177
   methods: {
173 178
     ...mapDailyRegistrationActions([
174 179
       'getDailyRegistration',
@@ -179,12 +184,8 @@ export default {
179 184
       this.formInline.pageSize = 10
180 185
       this.getPage()
181 186
     },
182
-    outPut(){
183
-      this.getUsherListExcel(this.formInline)
184
-    },
185 187
     getPage() {
186
-      this.getDailyRegistration(this.formInline)
187
-   
188
+      this.getDailyRegistration(this.queryFitlers)
188 189
     },
189 190
     handleSizeChange(val) {
190 191
       // console.log(`每页 ${val} 条`)
@@ -203,6 +204,15 @@ export default {
203 204
         return ''
204 205
       }
205 206
     },
207
+    mixinPhone (phone) {
208
+      return mixinPhone(phone)
209
+    },
210
+    filterCustomerSource(val){
211
+      return (this.sysDict['customerSourceDict'].filter(x => x.id == val)[0] || {}).label
212
+    },
213
+    filterPersonNum(val) {
214
+      return (this.sysDict['NUMBER_OF_VISITORS'].filter(x => x.id == val)[0] || {}).label
215
+    },
206 216
     clear(){
207 217
       this.formInline.personName = ''
208 218
       this.formInline.phone = ''

+ 2
- 2
vue.config.js Прегледај датотеку

@@ -3,8 +3,8 @@ module.exports = {
3 3
   devServer: {
4 4
     proxy: {
5 5
       '/api': {
6
-        target: 'http://192.168.0.238:8080',
7
-        // target: 'http://127.0.0.1:8080',
6
+        // target: 'http://192.168.0.238:8080',
7
+        target: 'http://127.0.0.1:8080',
8 8
         changeOrigin: true,
9 9
         pathRewrite: {
10 10
           '^/api': '/'