Your Name 5 年 前
コミット
2976ce23d0
共有8 個のファイルを変更した104 個の追加48 個の削除を含む
  1. 7
    0
      src/config/api.js
  2. 2
    0
      src/router.js
  3. 1
    0
      src/store/modules/dailyRegistration.js
  4. 12
    0
      src/store/modules/sysuser.js
  5. 20
    1
      src/store/system.js
  6. 5
    0
      src/utils/index.js
  7. 55
    45
      src/views/dailyRegistration/index.vue
  8. 2
    2
      vue.config.js

+ 7
- 0
src/config/api.js ファイルの表示

459
       method: 'delete',
459
       method: 'delete',
460
       url: `${commPrefix}/taCustomerTransfer/delete/:id`
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
 
78
 
79
   // 尝试去获取人员
79
   // 尝试去获取人员
80
   store.dispatch('getUser').then(() => {
80
   store.dispatch('getUser').then(() => {
81
+    // 获取通用字典
82
+    store.dispatch('getSysDict')
81
 
83
 
82
     // 校验权限
84
     // 校验权限
83
     if (checkAuthority(store.state, to.name)) {
85
     if (checkAuthority(store.state, to.name)) {

+ 1
- 0
src/store/modules/dailyRegistration.js ファイルの表示

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

+ 12
- 0
src/store/modules/sysuser.js ファイルの表示

27
         label: '吧台人员',
27
         label: '吧台人员',
28
         value: 'bar-usher',
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
         label: '其他',
43
         label: '其他',
32
         value: '',
44
         value: '',

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

12
     menus: [],
12
     menus: [],
13
     user: {},
13
     user: {},
14
     userLoged: false,
14
     userLoged: false,
15
+    sysDict: undefined,
15
   },
16
   },
16
   mutations: {
17
   mutations: {
17
     updateUser(state, user) {
18
     updateUser(state, user) {
92
       interact(api, payload).then(() => {
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
   }
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
 const ifUndifined = (val, def) => (val === undefined ? def : val)
107
 const ifUndifined = (val, def) => (val === undefined ? def : val)
103
 const withDefault = (val, def) => ({ ...def, ...ifUndifined(val, def) })
108
 const withDefault = (val, def) => ({ ...def, ...ifUndifined(val, def) })

+ 55
- 45
src/views/dailyRegistration/index.vue ファイルの表示

25
        </el-form-item> 
25
        </el-form-item> 
26
       <el-form-item label="客户来源">
26
       <el-form-item label="客户来源">
27
         <el-select v-model="formInline.customerSource " clearable placeholder="请选择">
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
         </el-select>
29
         </el-select>
33
        </el-form-item> 
30
        </el-form-item> 
34
       <el-form-item label="姓名">
31
       <el-form-item label="姓名">
40
       <el-form-item label="接待人">
37
       <el-form-item label="接待人">
41
         <el-input v-model="formInline.receiver" placeholder="输入接待人"></el-input>
38
         <el-input v-model="formInline.receiver" placeholder="输入接待人"></el-input>
42
       </el-form-item>
39
       </el-form-item>
43
-      </el-form-item>   
40
+      <el-form-item>   
44
         <el-button type="primary" @click="onSubmit">查询</el-button> 
41
         <el-button type="primary" @click="onSubmit">查询</el-button> 
45
         <el-button type="info" @click="clear">重置</el-button>
42
         <el-button type="info" @click="clear">重置</el-button>
46
       </el-form-item>
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
     </el-form>
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
     <el-table
48
     <el-table
53
     :data="dailyList.records"
49
     :data="dailyList.records"
54
     border>
50
     border>
57
       label="客户类型"
53
       label="客户类型"
58
       align='center'>
54
       align='center'>
59
           <template slot-scope="scope">
55
           <template slot-scope="scope">
60
-             <!-- <span>{{ scope.row.customerType =='channel'? '渠道客户':'自销客户' }}</span> -->
56
+            <span>{{ scope.row.customerType =='channel'? '渠道客户':'自销客户' }}</span>
61
           </template>
57
           </template>
62
     </el-table-column>
58
     </el-table-column>
63
     <el-table-column
59
     <el-table-column
69
       prop="phone"
65
       prop="phone"
70
       label="手机号"
66
       label="手机号"
71
       align='center'>
67
       align='center'>
68
+        <template slot-scope="scope">
69
+            <span>{{ mixinPhone(scope.row.phone) }}</span>
70
+        </template>
72
     </el-table-column>
71
     </el-table-column>
73
     <el-table-column
72
     <el-table-column
74
       prop="personNum"
73
       prop="personNum"
75
       label="来访人数"
74
       label="来访人数"
76
       align='center'>
75
       align='center'>
76
+          <template slot-scope="scope">
77
+             <span>{{ filterPersonNum(scope.row.personNum) }}</span>
78
+          </template>
77
     </el-table-column>
79
     </el-table-column>
78
     <el-table-column
80
     <el-table-column
79
     align='center'
81
     align='center'
89
       label="客户来源"
91
       label="客户来源"
90
       align='center'>
92
       align='center'>
91
           <template slot-scope="scope">
93
           <template slot-scope="scope">
92
-             <span>{{ scope.row.customerSource |filterCustomerSource }}</span>
94
+             <span>{{ filterCustomerSource(scope.row.customerSource) }}</span>
93
           </template>
95
           </template>
94
     </el-table-column>
96
     </el-table-column>
95
     <el-table-column
97
     <el-table-column
109
     </el-table-column>
111
     </el-table-column>
110
   </el-table>
112
   </el-table>
111
     <el-pagination
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
     </el-pagination>
122
     </el-pagination>
121
   </div>
123
   </div>
122
 </template>
124
 </template>
123
 
125
 
124
 <script>
126
 <script>
127
+import dayjs from 'dayjs'
125
 import { createNamespacedHelpers } from 'vuex'
128
 import { createNamespacedHelpers } from 'vuex'
129
+import { mixinPhone } from '../../utils'
130
+
126
 const {mapState: mapDailyRegistrationState, mapActions: mapDailyRegistrationActions } = createNamespacedHelpers('dailyRegistration')
131
 const {mapState: mapDailyRegistrationState, mapActions: mapDailyRegistrationActions } = createNamespacedHelpers('dailyRegistration')
127
 
132
 
128
 export default {
133
 export default {
130
   data() {
135
   data() {
131
     return {
136
     return {
132
       formInline: {
137
       formInline: {
133
-        startTime :'',
134
-        endTime :'',
138
+        startTime : dayjs().hour(0).minute(0).second(0).toDate(),
139
+        endTime : new Date(),
135
         personName: '',
140
         personName: '',
136
         phone: '',
141
         phone: '',
137
         customerType: '',
142
         customerType: '',
146
     ...mapDailyRegistrationState({
151
     ...mapDailyRegistrationState({
147
     dailyList: x => x.dailyList,
152
     dailyList: x => x.dailyList,
148
     excelList: x => x.excelList
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
   created() {
174
   created() {
152
     this.getPage()
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
   methods: {
177
   methods: {
173
     ...mapDailyRegistrationActions([
178
     ...mapDailyRegistrationActions([
174
       'getDailyRegistration',
179
       'getDailyRegistration',
179
       this.formInline.pageSize = 10
184
       this.formInline.pageSize = 10
180
       this.getPage()
185
       this.getPage()
181
     },
186
     },
182
-    outPut(){
183
-      this.getUsherListExcel(this.formInline)
184
-    },
185
     getPage() {
187
     getPage() {
186
-      this.getDailyRegistration(this.formInline)
187
-   
188
+      this.getDailyRegistration(this.queryFitlers)
188
     },
189
     },
189
     handleSizeChange(val) {
190
     handleSizeChange(val) {
190
       // console.log(`每页 ${val} 条`)
191
       // console.log(`每页 ${val} 条`)
203
         return ''
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
     clear(){
216
     clear(){
207
       this.formInline.personName = ''
217
       this.formInline.personName = ''
208
       this.formInline.phone = ''
218
       this.formInline.phone = ''

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

3
   devServer: {
3
   devServer: {
4
     proxy: {
4
     proxy: {
5
       '/api': {
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
         changeOrigin: true,
8
         changeOrigin: true,
9
         pathRewrite: {
9
         pathRewrite: {
10
           '^/api': '/'
10
           '^/api': '/'