ソースを参照

优化安装;修复已知BUG;

gengxiaoxu 3 年 前
コミット
cc2cd4a346
共有41 個のファイルを変更した4744 個の追加431 個の削除を含む
  1. 633
    0
      application/admin/controller/Examine.php
  2. 1
    1
      application/admin/controller/Field.php
  3. 1
    1
      application/admin/controller/Index.php
  4. 245
    75
      application/admin/controller/Install.php
  5. 23
    5
      application/admin/controller/Rules.php
  6. 3
    0
      application/admin/controller/Users.php
  7. 1
    1
      application/admin/logic/FieldGrantLogic.php
  8. 7
    3
      application/admin/model/Admin.php
  9. 150
    0
      application/admin/model/Examine.php
  10. 2
    1
      application/admin/model/Excel.php
  11. 82
    1
      application/admin/model/Field.php
  12. 9
    3
      application/admin/model/Group.php
  13. 1
    1
      application/admin/model/LoginRecord.php
  14. 28
    21
      application/admin/model/User.php
  15. 1
    1
      application/admin/traits/FieldVerificationTrait.php
  16. 3
    3
      application/admin/view/install/step2.html
  17. 0
    1
      application/bi/model/Customer.php
  18. 85
    32
      application/common.php
  19. 20
    20
      application/common/command/PoolCommand.php
  20. 99
    0
      application/crm/common.php
  21. 6
    9
      application/crm/controller/Activity.php
  22. 8
    4
      application/crm/controller/Business.php
  23. 1
    1
      application/crm/controller/Index.php
  24. 9
    1
      application/crm/controller/Preview.php
  25. 13
    13
      application/crm/logic/VisitLogic.php
  26. 12
    88
      application/crm/model/Business.php
  27. 9
    8
      application/crm/model/Contacts.php
  28. 9
    9
      application/crm/model/Contract.php
  29. 12
    100
      application/crm/model/Customer.php
  30. 9
    9
      application/crm/model/Receivables.php
  31. 12
    10
      application/crm/model/ReceivablesPlan.php
  32. 1
    1
      config/config.php
  33. 16
    0
      config/route_admin.php
  34. 2
    2
      config/version.php
  35. 17
    0
      public/sql/5kcrm.sql
  36. 497
    0
      public/sql/5kcrm1.sql
  37. 576
    0
      public/sql/5kcrm2.sql
  38. 471
    0
      public/sql/5kcrm3.sql
  39. 498
    0
      public/sql/5kcrm4.sql
  40. 1127
    0
      public/sql/5kcrm5.sql
  41. 45
    6
      public/static/js/step2.js

+ 633
- 0
application/admin/controller/Examine.php ファイルの表示

@@ -0,0 +1,633 @@
1
+<?php
2
+// +----------------------------------------------------------------------
3
+// | Description: 审批流程
4
+// +----------------------------------------------------------------------
5
+// | Author: zjf
6
+// +----------------------------------------------------------------------
7
+
8
+namespace app\admin\controller;
9
+
10
+use think\Hook;
11
+use think\Request;
12
+use think\Db;
13
+
14
+class Examine extends ApiCommon
15
+{
16
+    /**
17
+     * 用于判断权限
18
+     * @permission 无限制
19
+     * @allow 登录用户可访问
20
+     * @other 其他根据系统设置
21
+    **/    
22
+    public function _initialize()
23
+    {
24
+        $action = [
25
+            'permission'=>[],
26
+            'allow'=>['index','save','update','read','delete','enables','steplist','userlist','recordlist']            
27
+        ];
28
+        Hook::listen('check_auth',$action);
29
+        $request = Request::instance();
30
+        $a = strtolower($request->action());        
31
+        if (!in_array($a, $action['permission'])) {
32
+            parent::_initialize();
33
+        }
34
+        //权限判断
35
+        $unAction = ['steplist','userlist','recordlist'];
36
+        if (!in_array($a, $unAction) && !checkPerByAction('admin', 'examine_flow', 'index')) {
37
+            header('Content-Type:application/json; charset=utf-8');
38
+            exit(json_encode(['code'=>102,'error'=>'无权操作']));
39
+        }        
40
+    } 
41
+
42
+    /**
43
+     * 审批流程列表
44
+     * @author zjf
45
+     * @return 
46
+     */
47
+    public function index()
48
+    {
49
+        $examinewModel = model('Examine');
50
+        $param = $this->param;
51
+        //过滤审批类型中关联的审批流
52
+        // $param['types'] = ['neq','oa_examine'];
53
+        $data = $examinewModel->getDataList($param);
54
+        return resultArray(['data' => $data]);
55
+    }
56
+
57
+    /**
58
+     * 审批流程详情
59
+     * @author zjf
60
+     * @param 
61
+     * @return
62
+     */
63
+    public function read()
64
+    {
65
+        $examineModel = model('Examine');
66
+        $param = $this->param;
67
+        $res = $examineModel->getDataById($param['id']);
68
+        if (!$res) {
69
+            return resultArray(['error' => $examineFlowModel->getError()]);
70
+        }
71
+        return resultArray(['data' => $res]); 
72
+    }
73
+
74
+    /**
75
+     * 添加审批流程
76
+     *
77
+     * @return \think\response\Json
78
+     * @throws \think\Exception
79
+     * @throws \think\exception\PDOException
80
+     */
81
+    public function save()
82
+    {
83
+        $examineModel = model('Examine');
84
+        $param = $this->param;
85
+        $userInfo = $this->userInfo;
86
+$a = '{"examineName":"合同审批流程","label":1,"recheckType":1,"managerList":[14019],"remarks":"说明","dataList":[{"examineType":1,"name":"审批人0","examineErrorHandling":2,"roleId":null,"type":2,"userList":[32646,14019],"chooseType":null,"rangeType":null,"parentLevel":null},{"examineType":0,"name":"","conditionList":[{"conditionName":"条件1","sort":1,"conditionDataList":[{"name":"发起人","fieldName":"","type":0,"fieldId":0,"conditionType":8,"values":{"deptList":[],"roleList":[173447,173448,173449],"userList":[14019]}},{"name":"合同金额","fieldName":"money","type":6,"fieldId":1055246,"conditionType":6,"values":[1,1,1,2000]}],"examineDataList":[{"examineType":2,"name":"审批人1","examineErrorHandling":2,"roleId":null,"type":1,"userList":[14019],"chooseType":null,"rangeType":null,"parentLevel":3}]},{"conditionName":"条件2","sort":2,"conditionDataList":[{"name":"合同金额","fieldName":"money","type":6,"fieldId":1055246,"conditionType":2,"values":["2000"]}],"examineDataList":[{"examineType":0,"name":"","conditionList":[{"conditionName":"条件2-1","sort":1,"conditionDataList":[{"name":"合同金额","fieldName":"money","type":6,"fieldId":1055246,"conditionType":3,"values":["5000"]}],"examineDataList":[]},{"conditionName":"条件2-2","sort":2,"conditionDataList":[{"name":"合同金额","fieldName":"money","type":6,"fieldId":1055246,"conditionType":2,"values":["5000"]}],"examineDataList":[{"examineType":3,"name":"审批人2-2-1","examineErrorHandling":2,"roleId":173448,"type":2,"userList":[32646],"chooseType":null,"rangeType":null,"parentLevel":null}]}]},{"examineType":2,"name":"审批人2","examineErrorHandling":2,"roleId":null,"type":1,"userList":[14019],"chooseType":null,"rangeType":null,"parentLevel":3}]}]},{"examineType":2,"name":"业务审批1052","examineErrorHandling":2,"roleId":"","type":1,"userList":[],"chooseType":1,"rangeType":null,"parentLevel":3}],"examineId":1378287}';
87
+$param = object_to_array(json_decode($a));
88
+$param['examineId'] = 2;
89
+
90
+        // 主表 审批表 信息
91
+        db('examine')->where(['examine_id' => $param['examineId']])->update(['examine_name'=>$param['examineName'], 'label'=>$param['label'], 'remarks'=>$param['remarks'], 'recheck_type'=>$param['recheckType']]);
92
+        
93
+        // 删除 相关表数据
94
+        $flow_ids = db('examine_flow')->where(['examine_id' => $param['examineId']])->column('flow_id');
95
+        db('examine_flow')->where(['flow_id' => ['in', $flow_ids]])->delete();
96
+        db('examine_condition')->where(['flow_id' => ['in', $flow_ids]])->delete();
97
+        db('examine_condition_data')->where(['flow_id' => ['in', $flow_ids]])->delete();
98
+
99
+        db('examine_flow_continuous_superior')->where(['flow_id' => ['in', $flow_ids]])->delete();
100
+        db('examine_flow_member')->where(['flow_id' => ['in', $flow_ids]])->delete();
101
+        db('examine_flow_optional')->where(['flow_id' => ['in', $flow_ids]])->delete();
102
+        db('examine_flow_role')->where(['flow_id' => ['in', $flow_ids]])->delete();
103
+        db('examine_flow_superior')->where(['flow_id' => ['in', $flow_ids]])->delete();
104
+        
105
+        // 审批管理员
106
+        db('examine_manager_user')->where(['examine_id' => $param['examineId']])->delete();
107
+        $managerUser = [];
108
+        foreach ($param['managerList'] as $key => $value) {
109
+            $arr['examine_id'] = $param['examineId'];
110
+            $arr['user_id'] = $value;
111
+            $arr['sort'] = $key;
112
+            $managerUser[] = $arr;
113
+        }
114
+        db('examine_manager_user')->insertAll($managerUser);
115
+
116
+        $create_time = date('Y-m-d H:i:s');
117
+        $userId = $userInfo['id'];
118
+        // 审批流程
119
+        foreach ($param['dataList'] as $k => $v) {
120
+            $condition_id = 0;
121
+            // 处理流程   0 条件 1 指定成员 2 主管 3 角色 4 发起人自选 5 连续多级主管 7 发起人
122
+            $flow = [];
123
+            $flow['name'] = $v['name'];
124
+            $flow['examine_id'] = $param['examineId'];
125
+            $flow['examine_type'] = $v['examineType'];
126
+            $flow['examine_error_handling'] = $v['examineErrorHandling'] ? : 1;
127
+            $flow['condition_id'] = $condition_id;
128
+            $flow['sort'] = $k;
129
+            $flow['create_time'] = $create_time;
130
+            $flow['create_user_id'] = $userId;
131
+            $flowId = db('examine_flow')->insertGetId($flow);
132
+
133
+            // 1 指定成员 2 主管 3 角色 4 发起人自选 5 连续多级主管 7 发起人
134
+            $examine_flow = [];
135
+            switch ($v['examineType']) {
136
+                case '1' :
137
+                    foreach ($v['userList'] as $key => $value) {
138
+                        $examine_flow[$key]['sort'] = $key;
139
+                        $examine_flow[$key]['type'] = $v['type'];
140
+                        $examine_flow[$key]['user_id'] = $value;
141
+                        $examine_flow[$key]['flow_id'] = $flowId;
142
+                    }
143
+                    db('examine_flow_member')->insertAll($examine_flow);
144
+                    break;
145
+                case '2' :
146
+                    $examine_flow['flow_id'] = $flowId;
147
+                    $examine_flow['parent_level'] = $v['parentLevel'];
148
+                    $examine_flow['type'] = $v['type'];
149
+                    db('examine_flow_superior')->insert($examine_flow);
150
+                    break;
151
+                case '3' :
152
+                    $examine_flow['flow_id'] = $flowId;
153
+                    $examine_flow['role_id'] = $v['roleId'];
154
+                    $examine_flow['type'] = $v['type'];
155
+                    db('examine_flow_role')->insert($examine_flow);
156
+                    break;
157
+                case '4' :
158
+                    foreach ($v['userList'] as $key => $value) {
159
+                        $examine_flow[$key]['sort'] = $key;
160
+                        $examine_flow[$key]['type'] = $v['type'];
161
+                        $examine_flow[$key]['user_id'] = $value;
162
+                        $examine_flow[$key]['flow_id'] = $flowId;
163
+                        $examine_flow[$key]['role_id'] = $v['roleId'];
164
+                        $examine_flow[$key]['choose_type'] = $v['chooseType'];
165
+                        $examine_flow[$key]['range_type'] = $v['rangeType'];
166
+                    }
167
+                    db('examine_flow_optional')->insertAll($examine_flow);
168
+                    break;
169
+                case '5' :
170
+                    $examine_flow['flow_id'] = $flowId;
171
+                    $examine_flow['role_id'] = $v['roleId'];
172
+                    $examine_flow['max_level'] = $v['parentLevel'];
173
+                    $examine_flow['type'] = $v['type'];
174
+                    db('examine_flow_continuous_superior')->insert($examine_flow);
175
+                    break;
176
+                // case '7' :
177
+                //     break;
178
+            }
179
+            
180
+            foreach ($v['conditionList'] as $k1 => $v1) {
181
+                // 处理条件
182
+                $condition['condition_name'] = $v1['conditionName'];
183
+                $condition['priority'] = $v1['sort'];
184
+                $condition['create_time'] = $create_time;
185
+                $condition['create_user_id'] = $userId;
186
+                $condition['flow_id'] = $flowId;
187
+                $condition_id = db('examine_condition')->insertGetId($condition);
188
+                
189
+                // 处理条件 扩展
190
+                foreach ($v1['conditionDataList'] as $kc => $vc) {
191
+                    $conditionDate = [];
192
+                    $conditionDate['field_id'] = $vc['fieldId'];
193
+                    $conditionDate['field_name'] = $vc['fieldName'] ? : '';
194
+                    $conditionDate['condition_type'] = $vc['conditionType'];
195
+                    $conditionDate['value'] = json_encode($vc['values']);
196
+                    $conditionDate['name'] = $vc['name'];
197
+                    $conditionDate['type'] = $vc['type'];
198
+                    $conditionDate['condition_id'] = $condition_id;
199
+                    $conditionDate['flow_id'] = $flowId;
200
+                    $condition_data_id = db('examine_condition_data')->insertGetId($conditionDate);
201
+                }
202
+                if(!empty($v1['examineDataList'])){
203
+                    $this->recursion($v1['examineDataList'], $userId, $condition_id, $param['examineId'], $create_time);
204
+                }
205
+            }
206
+        }
207
+        return resultArray(['data' => $param]); 
208
+    }
209
+
210
+
211
+    public function recursion ($conditionList, $userId, $condition_id, $examineId, $create_time)
212
+    {
213
+        foreach ($conditionList as $k => $v) {
214
+            // 处理流程   0 条件 1 指定成员 2 主管 3 角色 4 发起人自选 5 连续多级主管 7 发起人
215
+            $flow = [];
216
+            $flow['name'] = $v['name'];
217
+            $flow['examine_id'] = $examineId;
218
+            $flow['examine_type'] = $v['examineType'];
219
+            $flow['examine_error_handling'] = $v['examineErrorHandling'] ? : 1;
220
+            $flow['condition_id'] = $condition_id;
221
+            $flow['sort'] = $k;
222
+            $flow['create_time'] = $create_time;
223
+            $flow['create_user_id'] = $userId;
224
+            $flowId = db('examine_flow')->insertGetId($flow);
225
+            
226
+            // 1 指定成员 2 主管 3 角色 4 发起人自选 5 连续多级主管 7 发起人
227
+            $examine_flow = [];
228
+            switch ($v['examineType']) {
229
+                case '1' :
230
+                    foreach ($v['userList'] as $key => $value) {
231
+                        $examine_flow[$key]['sort'] = $key;
232
+                        $examine_flow[$key]['type'] = $v['type'];
233
+                        $examine_flow[$key]['user_id'] = $value;
234
+                        $examine_flow[$key]['flow_id'] = $flowId;
235
+                    }
236
+                    db('examine_flow_member')->insertAll($examine_flow);
237
+                    break;
238
+                case '2' :
239
+                    $examine_flow['flow_id'] = $flowId;
240
+                    $examine_flow['parent_level'] = $v['parentLevel'];
241
+                    $examine_flow['type'] = $v['type'];
242
+                    db('examine_flow_superior')->insert($examine_flow);
243
+                    break;
244
+                case '3' :
245
+                    $examine_flow['flow_id'] = $flowId;
246
+                    $examine_flow['role_id'] = $v['roleId'];
247
+                    $examine_flow['type'] = $v['type'];
248
+                    db('examine_flow_role')->insert($examine_flow);
249
+                    break;
250
+                case '4' :
251
+                    foreach ($v['userList'] as $key => $value) {
252
+                        $examine_flow[$key]['sort'] = $key;
253
+                        $examine_flow[$key]['type'] = $v['type'];
254
+                        $examine_flow[$key]['user_id'] = $value;
255
+                        $examine_flow[$key]['flow_id'] = $flowId;
256
+                        $examine_flow[$key]['role_id'] = $v['roleId'];
257
+                        $examine_flow[$key]['choose_type'] = $v['chooseType'];
258
+                        $examine_flow[$key]['range_type'] = $v['rangeType'];
259
+                    }
260
+                    db('examine_flow_optional')->insertAll($examine_flow);
261
+                    break;
262
+                case '5' :
263
+                    $examine_flow['flow_id'] = $flowId;
264
+                    $examine_flow['role_id'] = $v['roleId'];
265
+                    $examine_flow['max_level'] = $v['parentLevel'];
266
+                    $examine_flow['type'] = $v['type'];
267
+                    db('examine_flow_continuous_superior')->insert($examine_flow);
268
+                    break;
269
+                // case '7' :
270
+                //     break;
271
+            }
272
+
273
+            foreach ($v['conditionList'] as $k1 => $v1) {
274
+                // 处理条件
275
+                $condition['condition_name'] = $v1['conditionName'];
276
+                $condition['priority'] = $v1['sort'];
277
+                $condition['create_time'] = $create_time;
278
+                $condition['create_user_id'] = $userId;
279
+                $condition['flow_id'] = $flowId;
280
+                $condition_id1 = db('examine_condition')->insertGetId($condition);
281
+                
282
+                // 处理条件 扩展
283
+                foreach ($v1['conditionDataList'] as $kc => $vc) {
284
+                    $conditionDate = [];
285
+                    $conditionDate['field_id'] = $vc['fieldId'];
286
+                    $conditionDate['field_name'] = $vc['fieldName'] ? : '';
287
+                    $conditionDate['condition_type'] = $vc['conditionType'];
288
+                    $conditionDate['value'] = json_encode($vc['values']);
289
+                    $conditionDate['name'] = $vc['name'];
290
+                    $conditionDate['type'] = $vc['type'];
291
+                    $conditionDate['condition_id'] = $condition_id1;
292
+                    $conditionDate['flow_id'] = $flowId;
293
+                    $condition_data_id = db('examine_condition_data')->insertGetId($conditionDate);
294
+                }
295
+                if(!empty($v1['examineDataList'])){
296
+                    $this->recursion($v1['examineDataList'], $userId, $condition_id1, $examineId, $create_time);
297
+                }
298
+            }
299
+        }
300
+    }
301
+
302
+    /**
303
+     * 预览审批条件
304
+     * @return [type] [description]
305
+     */
306
+    public function previewFiledName()
307
+    {
308
+        $param = $this->param;
309
+        $flow_id = db('examine_flow')
310
+                    ->where(['examine_id' => $param['id']])
311
+                    ->where(['examine_type' => 0])
312
+                    ->where(['condition_id' => 0])
313
+                    ->min('flow_id');
314
+        
315
+        $condition_data = db('examine_condition_data')->where('flow_id', $flow_id)->where('field_name', 'money')->select();
316
+        return resultArray(['data' => $condition_data]); 
317
+    }
318
+
319
+    /**
320
+     * 预览检查流
321
+     * @return [type] [description]
322
+     */
323
+    public function previewExamineFlow()
324
+    {
325
+        $userInfo = $this->userInfo;
326
+        $param = $this->param;
327
+$param['dataMap']['money'] = 10000;
328
+
329
+        $examine_flow = db('examine_flow')
330
+                    ->where(['examine_id' => $param['id']])
331
+                    ->where(['condition_id' => 0])
332
+                    ->select();
333
+        $data = [];
334
+
335
+        foreach ($examine_flow as $key => $value) {
336
+            if($value['examine_type'] == 0){
337
+                $condition = db('examine_condition')
338
+                    ->where('flow_id', $value['flow_id'])
339
+                    ->select();
340
+                foreach ($condition as $ka => $va) {
341
+                    // 处理审批条件 是否符合  符合去找流程  不符合 找下一个流程
342
+                    $condition_data = db('examine_condition_data')->where('condition_id', $va['condition_id'])->select();
343
+                    foreach ($condition_data as $kb => $vb) {
344
+                        $jump_out = 1;
345
+                        // 1 等于 2 大于 3 小于 4 大于等于 5 小于等于 6 两者之间 7 包含 8 员工 9 部门 10 角色',
346
+                        switch ($vb['condition_type']) {
347
+                            case '1' :
348
+                                if($param['dataMap']['money'] != json_decode($vb['value'])[0]){
349
+                                    $jump_out = 2;
350
+                                }
351
+                                break;
352
+                            case '2' :
353
+                                if($param['dataMap']['money'] <= json_decode($vb['value'])[0]){
354
+                                    $jump_out = 2;
355
+                                }
356
+                                break;
357
+                            case '3' :
358
+                                if($param['dataMap']['money'] >= json_decode($vb['value'])[0]){
359
+                                    $jump_out = 2;
360
+                                }
361
+                                break;
362
+                            case '4' :
363
+                                if($param['dataMap']['money'] < json_decode($vb['value'])[0]){
364
+                                    $jump_out = 2;
365
+                                }
366
+                                break;
367
+                            case '5' :
368
+                                if($param['dataMap']['money'] > json_decode($vb['value'])[0]){
369
+                                    $jump_out = 2;
370
+                                }
371
+                                break;
372
+                            case '6' :
373
+                                if(json_decode($vb['value'])[1] == 1){
374
+                                    if(json_decode($vb['value'])[0] < $param['dataMap']['money']){
375
+                                        $jump_out = 1;
376
+                                    }else{
377
+                                        $jump_out = 2;
378
+                                    }
379
+                                }else{
380
+                                    if(json_decode($vb['value'])[0] <= $param['dataMap']['money']){
381
+                                        $jump_out = 1;
382
+                                    }else{
383
+                                        $jump_out = 2;
384
+                                    }
385
+                                }
386
+
387
+                                if(json_decode($vb['value'])[2] == 1){
388
+                                    if(json_decode($vb['value'])[3] > $param['dataMap']['money']){
389
+                                        $jump_out = 1;
390
+                                    }else{
391
+                                        $jump_out = 2;
392
+                                    }
393
+                                }else{
394
+                                    if(json_decode($vb['value'])[3] >= $param['dataMap']['money']){
395
+                                        $jump_out = 1;
396
+                                    }else{
397
+                                        $jump_out = 2;
398
+                                    }
399
+                                }
400
+                                break;
401
+                            case '7' :
402
+                                break;
403
+                            case '8' :
404
+                                $group_id = db('admin_access')->where('user_id', $userInfo['id'])->column('group_id');
405
+                                $userList = json_decode($vb['value'])->userList;
406
+                                $deptList = json_decode($vb['value'])->deptList;
407
+                                $roleList = json_decode($vb['value'])->roleList;
408
+
409
+                                if(!is_array($userInfo['id'], $userList) && !in_array($userInfo['structure_id'], $deptList) && count(array_intersect($group_id, $roleList)) <= 0){
410
+                                    $jump_out = 2;
411
+                                }
412
+                        }
413
+                        // 该条件不符合 跳过本条件  继续下一个条件
414
+                        if($jump_out == 2){
415
+                            break;
416
+                        }
417
+                    }
418
+
419
+                    // 符合条件  不需要继续走下一个条件  开始找流程   并跳出整个循环  
420
+                    if($jump_out == 1){
421
+                        $flowList = db('examine_flow')
422
+                                        ->where(['examine_id' => $param['id']])
423
+                                        ->where(['condition_id' => $va['condition_id']])
424
+                                        ->select();
425
+
426
+                        $data = $this->conditionalRecursion($flowList, $userInfo, $data, $param);
427
+                        break;
428
+                    }
429
+                }
430
+            }else{
431
+                $where = [];
432
+                switch ($value['examine_type']) {
433
+                    case '1' :
434
+                        $where['a.flow_id'] = $value['flow_id'];
435
+                        $userList = db('examine_flow_member')
436
+                                        ->alias('a')
437
+                                        ->join('admin_user b','b.id = a.user_id', 'left')
438
+                                        ->where($where)
439
+                                        ->field('b.realname, b.img, a.user_id')
440
+                                        ->select();
441
+                        break;
442
+                    case '2' :
443
+                        $where['flow_id'] = $value['flow_id'];
444
+                        $superior = db('examine_flow_superior')->where($where)->find();
445
+                        $owner_user_id = getUserSuperior($userInfo['structure_id'], $superior['parent_level']);
446
+                        
447
+                        // 找不到主管 先是 上级主管代签 没有上级主管管理员代签(多个管理员 或签)
448
+                        if(!$owner_user_id){
449
+                            $owner_user_ids = db('examine_manager_user')->where('examine_id', $param['id'])->column('user_id');
450
+                            $userList = db('admin_user')->field('realname, img, id as user_id')->where(['id'=>['in', $owner_user_ids]])->select();
451
+                        }else{
452
+                            $userList = db('admin_user')->field('realname, img, id as user_id')->where(['id'=>['eq', $owner_user_id]])->select();
453
+                        }
454
+                        break;
455
+                    case '3' :
456
+                        $where['a.flow_id'] = $value['flow_id'];
457
+                        $userList = db('examine_flow_role')
458
+                                        ->alias('a')
459
+                                        ->join('admin_access b','b.group_id = a.role_id', 'left')
460
+                                        ->join('admin_user c','b.user_id = c.id', 'left')
461
+                                        ->where($where)
462
+                                        ->field('c.realname, c.img, b.user_id')
463
+                                        ->select();
464
+                        break;
465
+                     case '4' :
466
+                        
467
+                        // db('examine_flow_optional')->insertAll($examine_flow);
468
+                        break;
469
+                    case '5' :
470
+                        
471
+                        // db('examine_flow_continuous_superior')->insert($examine_flow);
472
+                        break;
473
+                    // case '7' :
474
+                    //     break;
475
+                }
476
+                $value['userList'] = $userList;
477
+                $data[] = $value;
478
+            }
479
+        }
480
+        return resultArray(['data' => $data]); 
481
+    }
482
+
483
+
484
+    public function conditionalRecursion ($examine_flow, $userInfo, $data, $param)
485
+    {
486
+        foreach ($examine_flow as $key => $value) {
487
+            if($value['examine_type'] == 0){
488
+                $condition = db('examine_condition')
489
+                    ->where('flow_id', $value['flow_id'])
490
+                    ->select();
491
+                foreach ($condition as $ka => $va) {
492
+                    // 处理审批条件 是否符合  符合去找流程  不符合 找下一个流程
493
+                    $condition_data = db('examine_condition_data')->where('condition_id', $va['condition_id'])->select();
494
+                    foreach ($condition_data as $kb => $vb) {
495
+                        $jump_out = 1;
496
+                        // 1 等于 2 大于 3 小于 4 大于等于 5 小于等于 6 两者之间 7 包含 8 员工 9 部门 10 角色',
497
+                        switch ($vb['condition_type']) {
498
+                            case '1' :
499
+                                if($param['dataMap']['money'] != json_decode($vb['value'])[0]){
500
+                                    $jump_out = 2;
501
+                                }
502
+                                break;
503
+                            case '2' :
504
+                                if($param['dataMap']['money'] <= json_decode($vb['value'])[0]){
505
+                                    $jump_out = 2;
506
+                                }
507
+                                break;
508
+                            case '3' :
509
+
510
+                                if($param['dataMap']['money'] >= json_decode($vb['value'])[0]){
511
+                                    $jump_out = 2;
512
+                                }
513
+                                break;
514
+                            case '4' :
515
+                                if($param['dataMap']['money'] < json_decode($vb['value'])[0]){
516
+                                    $jump_out = 2;
517
+                                }
518
+                                break;
519
+                            case '5' :
520
+                                if($param['dataMap']['money'] > json_decode($vb['value'])[0]){
521
+                                    $jump_out = 2;
522
+                                }
523
+                                break;
524
+                            case '6' :
525
+                                if(json_decode($vb['value'])[1] == 1){
526
+                                    if(json_decode($vb['value'])[0] < $param['dataMap']['money']){
527
+                                        $jump_out = 1;
528
+                                    }else{
529
+                                        $jump_out = 2;
530
+                                    }
531
+                                }else{
532
+                                    if(json_decode($vb['value'])[0] <= $param['dataMap']['money']){
533
+                                        $jump_out = 1;
534
+                                    }else{
535
+                                        $jump_out = 2;
536
+                                    }
537
+                                }
538
+
539
+                                if(json_decode($vb['value'])[2] == 1){
540
+                                    if(json_decode($vb['value'])[3] > $param['dataMap']['money']){
541
+                                        $jump_out = 1;
542
+                                    }else{
543
+                                        $jump_out = 2;
544
+                                    }
545
+                                }else{
546
+                                    if(json_decode($vb['value'])[3] >= $param['dataMap']['money']){
547
+                                        $jump_out = 1;
548
+                                    }else{
549
+                                        $jump_out = 2;
550
+                                    }
551
+                                }
552
+                                break;
553
+                            case '7' :
554
+                                break;
555
+                            case '8' :
556
+                                $group_id = db('admin_access')->where('user_id', $userInfo['id'])->column('group_id');
557
+                                $userList = json_decode($vb['value'])->userList;
558
+                                $deptList = json_decode($vb['value'])->deptList;
559
+                                $roleList = json_decode($vb['value'])->roleList;
560
+
561
+                                if(!is_array($userInfo['id'], $userList) && !in_array($userInfo['structure_id'], $deptList) && count(array_intersect($group_id, $roleList)) <= 0){
562
+                                    $jump_out = 2;
563
+                                }
564
+                        }
565
+                        // 该条件不符合 跳过本条件  继续下一个条件
566
+                        if($jump_out == 2){
567
+                            break;
568
+                        }
569
+                    }
570
+
571
+                    // 符合条件  不需要继续走下一个条件  开始找流程   并跳出整个循环  
572
+                    if($jump_out == 1){
573
+                        $flowList = db('examine_flow')
574
+                                        ->where(['examine_id' => $param['id']])
575
+                                        ->where(['condition_id' => $va['condition_id']])
576
+                                        ->select();
577
+                        $data = $this->conditionalRecursion($flowList, $userInfo, $data, $param);
578
+                        break;
579
+                    }
580
+                }
581
+            }else{
582
+                $where = [];
583
+                switch ($value['examine_type']) {
584
+                    case '1' :
585
+                        $where['a.flow_id'] = $value['flow_id'];
586
+                        $userList = db('examine_flow_member')
587
+                                        ->alias('a')
588
+                                        ->join('admin_user b','b.id = a.user_id', 'left')
589
+                                        ->where($where)
590
+                                        ->field('b.realname, b.img, a.user_id')
591
+                                        ->select();
592
+                        break;
593
+                    case '2' :
594
+                        $where['flow_id'] = $value['flow_id'];
595
+                        $superior = db('examine_flow_superior')->where($where)->find();
596
+                        $owner_user_id = getUserSuperior($userInfo['structure_id'], $superior['parent_level']);
597
+                        
598
+                        // 找不到主管 先是 上级主管代签 没有上级主管管理员代签(多个管理员 或签)
599
+                        if(!$owner_user_id){
600
+                            $owner_user_ids = db('examine_manager_user')->where('examine_id', $param['id'])->column('user_id');
601
+                            $userList = db('admin_user')->field('realname, img, id as user_id')->where(['id'=>['in', $owner_user_ids]])->select();
602
+                        }else{
603
+                            $userList = db('admin_user')->field('realname, img, id as user_id')->where(['id'=>['eq', $owner_user_id]])->select();
604
+                        }
605
+                        break;
606
+                    case '3' :
607
+                        $where['a.flow_id'] = $value['flow_id'];
608
+                        $userList = db('examine_flow_role')
609
+                                        ->alias('a')
610
+                                        ->join('admin_access b','b.group_id = a.role_id', 'left')
611
+                                        ->join('admin_user c','b.user_id = c.id', 'left')
612
+                                        ->where($where)
613
+                                        ->field('c.realname, c.img, b.user_id')
614
+                                        ->select();
615
+                        break;
616
+                     case '4' :
617
+                        
618
+                        // db('examine_flow_optional')->insertAll($examine_flow);
619
+                        break;
620
+                    case '5' :
621
+                        
622
+                        // db('examine_flow_continuous_superior')->insert($examine_flow);
623
+                        break;
624
+                    // case '7' :
625
+                    //     break;
626
+                }
627
+                $value['userList'] = $userList;
628
+                $data[] = $value;
629
+            }
630
+        }
631
+        return $data;
632
+    }
633
+}

+ 1
- 1
application/admin/controller/Field.php ファイルの表示

@@ -742,7 +742,7 @@ class Field extends ApiCommon
742 742
         $userInfo = $this->userInfo;
743 743
         $userFieldModel = model('UserField');
744 744
         $width = $param['width'] > 10 ? $param['width'] : '';
745
-        $unField = array('pool_day','owner_user_name','is_lock','create_user_name');
745
+        $unField = array('pool_day','owner_user_name','is_lock','create_user_name','owner_user_structure_name');
746 746
         switch ($param['field']) {
747 747
         	case 'status_id_info' : $param['field'] = 'status_id';
748 748
         		break;

+ 1
- 1
application/admin/controller/Index.php ファイルの表示

@@ -68,7 +68,7 @@ class Index extends ApiCommon
68 68
             if ($value['field'] == 'collection_object') $field_arr[$key]['form_type'] = 'text';
69 69
         }
70 70
         if(in_array($param['types'],['crm_customer','crm_customer_pool','crm_contacts','crm_business','crm_contract','crm_receivables'])){
71
-            $field=[['field'=>'team_id','name'=>'相关团队','form_type'=>'text','setting'=>[]]];
71
+            $field=[['field'=>'team_id','name'=>'相关团队','form_type'=>'user','setting'=>[]]];
72 72
             $field_arr=array_merge($field_arr,$field);
73 73
         }
74 74
         // if($param['types'] == 'jxc_product'){

+ 245
- 75
application/admin/controller/Install.php ファイルの表示

@@ -8,6 +8,7 @@
8 8
 namespace app\admin\controller;
9 9
 
10 10
 use think\Controller;
11
+use think\Exception;
11 12
 use think\Request;
12 13
 use think\Db;
13 14
 use Env;
@@ -19,12 +20,12 @@ class Install extends Controller
19 20
 
20 21
     public function _initialize()
21 22
     {
22
-        /*防止跨域*/      
23
+        /*防止跨域*/
23 24
         header('Access-Control-Allow-Origin: '.$_SERVER['HTTP_ORIGIN']);
24 25
         header('Access-Control-Allow-Credentials: true');
25 26
         header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS');
26 27
         header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, authKey, sessionId");
27
-        $param = Request::instance()->param();          
28
+        $param = Request::instance()->param();
28 29
         $this->param = $param;
29 30
 
30 31
 //        $request = request();
@@ -42,9 +43,9 @@ class Install extends Controller
42 43
 
43 44
     /**
44 45
      * [index 安装步骤]
45
-     * @author Michael_xu 
46
-     * @param  
47
-     */    
46
+     * @author Michael_xu
47
+     * @param
48
+     */
48 49
     public function index()
49 50
     {
50 51
         $protocol = strpos(strtolower($_SERVER['HTTP_REFERER']), 'https') === false ? 'http' : 'https';
@@ -56,12 +57,12 @@ class Install extends Controller
56 57
 
57 58
         if (file_exists(CONF_PATH . "install.lock")) {
58 59
             echo "<meta http-equiv='content-type' content='text/html; charset=UTF-8'> <script>alert('请勿重复安装!');location.href='".$protocol."://".$_SERVER["HTTP_HOST"]."';</script>";
59
-            die();     
60
+            die();
60 61
         }
61 62
 
62 63
         if (!file_exists(getcwd() . "/public/sql/5kcrm.sql")) {
63 64
             echo "<meta http-equiv='content-type' content='text/html; charset=UTF-8'> <script>alert('缺少必要的数据库文件!');location.href='".$protocol."://".$_SERVER["HTTP_HOST"]."';</script>";
64
-            die();     
65
+            die();
65 66
         }
66 67
 
67 68
         return $this->fetch('index');
@@ -87,14 +88,14 @@ class Install extends Controller
87 88
     //版本
88 89
     public function version()
89 90
     {
90
-        $res = include(CONF_PATH.'version.php'); 
91
-        return $res ? : array('VERSION' => '11.0.0','RELEASE' => '20210219'); 
92
-    }    
91
+        $res = include(CONF_PATH.'version.php');
92
+        return $res ? : array('VERSION' => '11.0.0','RELEASE' => '20210219');
93
+    }
93 94
 
94 95
     public function step2(){
95 96
 		if (session('install_error')){
96 97
             echo "<meta http-equiv='content-type' content='text/html; charset=UTF-8'> <script>alert('环境检测未通过,不能进行下一步操作!');location.href='".$_SERVER["HTTP_REFERER"]."';</script>";
97
-            die(); 
98
+            die();
98 99
         }
99 100
         if (strpos(request()->url(), "index.php") === false) {
100 101
             $protocol = strpos(strtolower($_SERVER['HTTP_REFERER']), 'https') === false ? 'http' : 'https';
@@ -107,21 +108,21 @@ class Install extends Controller
107 108
         $this->assign('envir_data',$data);
108 109
         return $this->fetch();
109 110
     }
110
-	
111
+
111 112
     public function step3(){
112 113
         return $this->fetch();
113 114
     }
114 115
 
115 116
     public function step4(){
116 117
         if (session('install_error')){
117
-            return resultArray(['error' => '环境检测未通过,不能进行下一步操作!']);    
118
-        } 
118
+            return resultArray(['error' => '环境检测未通过,不能进行下一步操作!']);
119
+        }
119 120
         if (file_exists(CONF_PATH . "install.lock")) {
120
-            return resultArray(['error' => '请勿重复安装!']);       
121
-        } 
121
+            return resultArray(['error' => '请勿重复安装!']);
122
+        }
122 123
         if (!file_exists(getcwd() . "/public/sql/5kcrm.sql")) {
123
-            return resultArray(['error' => '缺少必要的数据库文件!']);      
124
-        } 
124
+            return resultArray(['error' => '缺少必要的数据库文件!']);
125
+        }
125 126
         $temp = $this->param;
126 127
         $param = $temp['form'];
127 128
         $db_config['type'] = 'mysql';
@@ -129,7 +130,7 @@ class Install extends Controller
129 130
         $db_config['hostport'] = $param['databasePort'];
130 131
         $db_config['database'] = $param['databaseName'];
131 132
         $db_config['username'] = $param['databaseUser'];
132
-        $db_config['password'] = $param['databasePwd'];        
133
+        $db_config['password'] = $param['databasePwd'];
133 134
         $db_config['prefix'] = '5kcrm_';
134 135
 //        $db_config['prefix'] = $param['databaseTable'];
135 136
 
@@ -138,7 +139,7 @@ class Install extends Controller
138 139
         $wkcode = $param['wkcode'];
139 140
         if (empty($db_config['hostname'])) {
140 141
             return resultArray(['error' => '请填写数据库主机!']);
141
-        }           
142
+        }
142 143
         if (empty($db_config['hostport'])) {
143 144
             return resultArray(['error' => '请填写数据库端口!']);
144 145
         }
@@ -153,7 +154,7 @@ class Install extends Controller
153 154
         }
154 155
         if (empty($db_config['password'])) {
155 156
             return resultArray(['error' => '请填写数据库密码!']);
156
-        }        
157
+        }
157 158
         if (empty($db_config['prefix'])) {
158 159
             return resultArray(['error' => '请填写表前缀!']);
159 160
         }
@@ -170,10 +171,10 @@ class Install extends Controller
170 171
         if (!$resCheckData) {
171 172
             return resultArray(['error' => '序列号错误!']);
172 173
         }
173
-        $resData = object_to_array(json_decode($resCheckData));
174
-        if ($resData['date'] != date('Y-m-d')) {
175
-            return resultArray(['error' => '序列号已失效,请前往悟空官网个人中心获取最新数据!']);
176
-        }
174
+//        $resData = object_to_array(json_decode($resCheckData));
175
+//        if ($resData['date'] != date('Y-m-d')) {
176
+//            return resultArray(['error' => '序列号已失效,请前往悟空官网个人中心获取最新数据!']);
177
+//        }
177 178
         if (empty($password)) {
178 179
             return resultArray(['error' => '请填写管理员密码!']);
179 180
         }
@@ -186,7 +187,7 @@ class Install extends Controller
186 187
         try{
187 188
             $ret = $connect->execute('select version()');
188 189
         }catch(\Exception $e){
189
-            return resultArray(['error' => '数据库连接失败,请检查数据库配置!']);
190
+            return resultArray(['error' => '数据库连接失败,请检查数据库配置4!']);
190 191
         }
191 192
         $check = $connect->execute("SELECT * FROM information_schema.schemata WHERE schema_name='".$database."'");
192 193
         if (!$check && !$connect->execute("CREATE DATABASE IF NOT EXISTS `".$database."` default collate utf8_general_ci ")) {
@@ -196,7 +197,7 @@ class Install extends Controller
196 197
         self::mkDatabase($db_config);
197 198
         self::mkLicense($wkcode);
198 199
         $C_Patch = substr($_SERVER['SCRIPT_FILENAME'],0,-10);
199
-        $sql = file_get_contents( $C_Patch.'/public/sql/5kcrm.sql');
200
+        $sql = file_get_contents( $C_Patch.'/public/sql/5kcrm1.sql');
200 201
         $sqlList = parse_sql($sql, 0, ['5kcrm_' => $db_config['prefix']]);
201 202
         if ($sqlList) {
202 203
             $sqlList = array_filter($sqlList);
@@ -213,16 +214,185 @@ class Install extends Controller
213 214
                     return resultArray(['error' => '数据库sql安装出错,请操作数据库手动导入sql文件']);
214 215
                 }
215 216
             }
216
-        } 
217
+        }
218
+//        $salt = substr(md5(time()),0,4);
219
+//        $password = user_md5(trim($password), $salt, $username);
220
+//		//插入信息
221
+//        Db::connect($db_config)->query("insert into ".$db_config['prefix']."admin_user (username, password, salt, img, thumb_img, realname, create_time, num, email, mobile, sex, status, structure_id, post, parent_id, type, authkey, authkey_time ) values ( '".$username."', '".$password."', '".$salt."', '', '', '管理员', ".time().", '', '', '".$username."', '', 1, 1, 'CEO', 0, 1, '', 0 )");
222
+//        Db::connect($db_config)->query("insert into ".$db_config['prefix']."hrm_user_det (user_id, join_time, type, status, userstatus, create_time, update_time, mobile, sex, age, job_num, idtype, idnum, birth_time, nation, internship, done_time, parroll_id, email, political, location, leave_time ) values ( 1, ".time().", 1, 1, 2, ".time().", ".time().", '".$username."', '', 0, '', 0, '', '', 0, 0, 0, 0, '', '', '', 0 )");
223
+//        touch(CONF_PATH . "install.lock");
224
+        return resultArray(['data'=>'安装成功']);
225
+    }
226
+    public function step7(){
227
+        $temp = $this->param;
228
+        $param = $temp['form'];
229
+        $db_config['type'] = 'mysql';
230
+        $db_config['hostname'] = $param['databaseUrl'];
231
+        $db_config['hostport'] = $param['databasePort'];
232
+        $db_config['database'] = $param['databaseName'];
233
+        $db_config['username'] = $param['databaseUser'];
234
+        $db_config['password'] = $param['databasePwd'];
235
+        $db_config['prefix'] = '5kcrm_';
236
+        $C_Patch = substr($_SERVER['SCRIPT_FILENAME'],0,-10);
237
+        $sql = file_get_contents( $C_Patch.'/public/sql/5kcrm2.sql');
238
+        $sqlList = parse_sql($sql, 0, ['5kcrm_' => $db_config['prefix']]);
239
+        if ($sqlList) {
240
+            $sqlList = array_filter($sqlList);
241
+            $install_count = count($sqlList);
242
+            session('install_count',$install_count);
243
+            foreach ($sqlList as $k=>$v) {
244
+                $install_now = $k+1;
245
+                session('install_now',$install_now);
246
+                try {
247
+                    $temp_sql = $v.';';
248
+                    Db::connect($db_config)->query($temp_sql);
249
+                } catch(\Exception $e) {
250
+                    // return resultArray(['error' => '请启用InnoDB数据引擎,并检查数据库是否有DROP和CREATE权限']);
251
+                    return resultArray(['error' => '数据库sql安装出错,请操作数据库手动导入sql文件']);
252
+                }
253
+            }
254
+        }
255
+    return resultArray(['data'=>'安装成功']);
256
+    }
257
+
258
+    public function step8(){
259
+        $temp = $this->param;
260
+        $param = $temp['form'];
261
+        $db_config['type'] = 'mysql';
262
+        $db_config['hostname'] = $param['databaseUrl'];
263
+        $db_config['hostport'] = $param['databasePort'];
264
+        $db_config['database'] = $param['databaseName'];
265
+        $db_config['username'] = $param['databaseUser'];
266
+        $db_config['password'] = $param['databasePwd'];
267
+        $db_config['prefix'] = '5kcrm_';
268
+        $C_Patch = substr($_SERVER['SCRIPT_FILENAME'],0,-10);
269
+        $sql = file_get_contents( $C_Patch.'/public/sql/5kcrm3.sql');
270
+        $sqlList = parse_sql($sql, 0, ['5kcrm_' => $db_config['prefix']]);
271
+        if ($sqlList) {
272
+            $sqlList = array_filter($sqlList);
273
+            $install_count = count($sqlList);
274
+            session('install_count',$install_count);
275
+            foreach ($sqlList as $k=>$v) {
276
+                $install_now = $k+1;
277
+                session('install_now',$install_now);
278
+                try {
279
+                    $temp_sql = $v.';';
280
+                    Db::connect($db_config)->query($temp_sql);
281
+                } catch(\Exception $e) {
282
+                    // return resultArray(['error' => '请启用InnoDB数据引擎,并检查数据库是否有DROP和CREATE权限']);
283
+                    return resultArray(['error' => '数据库sql安装出错,请操作数据库手动导入sql文件']);
284
+                }
285
+            }
286
+        }
287
+        $username = $param['root'];
288
+        $password = $param['pwd'];
217 289
         $salt = substr(md5(time()),0,4);
218 290
         $password = user_md5(trim($password), $salt, $username);
219
-		//插入信息
291
+//		//插入信息
220 292
         Db::connect($db_config)->query("insert into ".$db_config['prefix']."admin_user (username, password, salt, img, thumb_img, realname, create_time, num, email, mobile, sex, status, structure_id, post, parent_id, type, authkey, authkey_time ) values ( '".$username."', '".$password."', '".$salt."', '', '', '管理员', ".time().", '', '', '".$username."', '', 1, 1, 'CEO', 0, 1, '', 0 )");
221 293
         Db::connect($db_config)->query("insert into ".$db_config['prefix']."hrm_user_det (user_id, join_time, type, status, userstatus, create_time, update_time, mobile, sex, age, job_num, idtype, idnum, birth_time, nation, internship, done_time, parroll_id, email, political, location, leave_time ) values ( 1, ".time().", 1, 1, 2, ".time().", ".time().", '".$username."', '', 0, '', 0, '', '', 0, 0, 0, 0, '', '', '', 0 )");
222 294
         touch(CONF_PATH . "install.lock");
223 295
         return resultArray(['data'=>'安装成功']);
224 296
     }
225 297
 
298
+    public function step10(){
299
+        $temp = $this->param;
300
+        $param = $temp['form'];
301
+        $db_config['type'] = 'mysql';
302
+        $db_config['hostname'] = $param['databaseUrl'];
303
+        $db_config['hostport'] = $param['databasePort'];
304
+        $db_config['database'] = $param['databaseName'];
305
+        $db_config['username'] = $param['databaseUser'];
306
+        $db_config['password'] = $param['databasePwd'];
307
+        $db_config['prefix'] = '5kcrm_';
308
+        $C_Patch = substr($_SERVER['SCRIPT_FILENAME'],0,-10);
309
+        $sql = file_get_contents( $C_Patch.'/public/sql/5kcrm4.sql');
310
+        $sqlList = parse_sql($sql, 0, ['5kcrm_' => $db_config['prefix']]);
311
+        if ($sqlList) {
312
+            $sqlList = array_filter($sqlList);
313
+            $install_count = count($sqlList);
314
+            session('install_count',$install_count);
315
+            foreach ($sqlList as $k=>$v) {
316
+                $install_now = $k+1;
317
+                session('install_now',$install_now);
318
+                try {
319
+                    $temp_sql = $v.';';
320
+                    Db::connect($db_config)->query($temp_sql);
321
+                } catch(\Exception $e) {
322
+                    // return resultArray(['error' => '请启用InnoDB数据引擎,并检查数据库是否有DROP和CREATE权限']);
323
+                    return resultArray(['error' => '数据库sql安装出错,请操作数据库手动导入sql文件']);
324
+                }
325
+            }
326
+        }
327
+        return resultArray(['data'=>'安装成功']);
328
+    }
329
+
330
+    public function step11(){
331
+        $temp = $this->param;
332
+        $param = $temp['form'];
333
+        $db_config['type'] = 'mysql';
334
+        $db_config['hostname'] = $param['databaseUrl'];
335
+        $db_config['hostport'] = $param['databasePort'];
336
+        $db_config['database'] = $param['databaseName'];
337
+        $db_config['username'] = $param['databaseUser'];
338
+        $db_config['password'] = $param['databasePwd'];
339
+        $db_config['prefix'] = '5kcrm_';
340
+        $C_Patch = substr($_SERVER['SCRIPT_FILENAME'],0,-10);
341
+        $sql = file_get_contents( $C_Patch.'/public/sql/5kcrm5.sql');
342
+
343
+        $sqlList = parse_sql($sql, 0, ['5kcrm_' => $db_config['prefix']]);
344
+        if ($sqlList) {
345
+            $sqlList = array_filter($sqlList);
346
+            $install_count = count($sqlList);
347
+            session('install_count',$install_count);
348
+            foreach ($sqlList as $k=>$v) {
349
+                $install_now = $k+1;
350
+                session('install_now',$install_now);
351
+                try {
352
+                    $temp_sql = $v.';';
353
+                    Db::connect($db_config)->query($temp_sql);
354
+                } catch(\Exception $e) {
355
+                    // return resultArray(['error' => '请启用InnoDB数据引擎,并检查数据库是否有DROP和CREATE权限']);
356
+                    return resultArray(['error' => '数据库sql安装出错,请操作数据库手动导入sql文件']);
357
+                }
358
+            }
359
+        }
360
+
361
+        return resultArray(['data'=>'安装成功']);
362
+    }
363
+
364
+    /**
365
+     * sql多文件执行
366
+     * @param $sqlList
367
+     * @param $db_config
368
+     * @return \think\response\Json
369
+     */
370
+    public function sqlData($sqlList,$db_config){
371
+        try {
372
+            $install_count = count($sqlList);
373
+            session('install_count',$install_count);
374
+            $res_count=ceil($install_count);
375
+            for($i=0;$i<=$res_count;$i++){
376
+                $page = $i>0?$i*100+1 :1;
377
+                $excelData = array_slice($sqlList, $page ,100);
378
+                if($excelData){
379
+                    foreach($excelData as $k=>$v){
380
+                        $install_now = $k+1;
381
+                        session('install_now',$install_now);
382
+                            $temp_sql = $v.';';
383
+                            Db::connect($db_config)->query($temp_sql);
384
+                            // return resultArray(['error' => '请启用InnoDB数据引擎,并检查数据库是否有DROP和CREATE权限']);
385
+                            return resultArray(['error' => '数据库sql安装出错,请操作数据库手动导入sql文件']);
386
+                    }
387
+                }
388
+            }
389
+            Db::commit();
390
+        }catch (\Exception $e){
391
+            Db::rollback();
392
+            return resultArray(['error'=>$e->getMessage()]);
393
+        }
394
+    }
395
+
226 396
     /**
227 397
      * 安装成功界面
228 398
      *
@@ -246,7 +416,7 @@ class Install extends Controller
246 416
     {
247 417
         return $this->fetch();
248 418
     }
249
-	
419
+
250 420
 	//ajax 进度条
251 421
     public function progress()
252 422
     {
@@ -310,50 +480,50 @@ INFO;
310 480
     }
311 481
 
312 482
     //检查目录权限
313
-    public function check_dir_iswritable($dir_path){ 
314
-        $dir_path=str_replace( '\\','/',$dir_path); 
315
-        $is_writale=1; 
316
-        if (!is_dir($dir_path)) { 
317
-            $is_writale=0; 
318
-            return $is_writale; 
319
-        } else { 
320
-            $file_hd=@fopen($dir_path.'/test.txt','w'); 
321
-            if (!$file_hd) { 
322
-                @fclose($file_hd); 
323
-                @unlink($dir_path.'/test.txt'); 
324
-                $is_writale=0; 
325
-                return $is_writale; 
326
-            } 
327
-            $dir_hd = opendir($dir_path); 
328
-            while (false !== ($file=readdir($dir_hd))) { 
329
-                if ($file != "." && $file != "..") { 
330
-                    if (is_file($dir_path.'/'.$file)) { 
483
+    public function check_dir_iswritable($dir_path){
484
+        $dir_path=str_replace( '\\','/',$dir_path);
485
+        $is_writale=1;
486
+        if (!is_dir($dir_path)) {
487
+            $is_writale=0;
488
+            return $is_writale;
489
+        } else {
490
+            $file_hd=@fopen($dir_path.'/test.txt','w');
491
+            if (!$file_hd) {
492
+                @fclose($file_hd);
493
+                @unlink($dir_path.'/test.txt');
494
+                $is_writale=0;
495
+                return $is_writale;
496
+            }
497
+            $dir_hd = opendir($dir_path);
498
+            while (false !== ($file=readdir($dir_hd))) {
499
+                if ($file != "." && $file != "..") {
500
+                    if (is_file($dir_path.'/'.$file)) {
331 501
                         //文件不可写,直接返回 
332
-                        if (!is_writable($dir_path.'/'.$file)) { 
333
-                            return 0; 
334
-                        }  
335
-                    } else { 
336
-                        $file_hd2=@fopen($dir_path.'/'.$file.'/test.txt','w'); 
337
-                        if (!$file_hd2) { 
338
-                            @fclose($file_hd2); 
339
-                            @unlink($dir_path.'/'.$file.'/test.txt'); 
340
-                            $is_writale=0; 
341
-                            return $is_writale; 
342
-                        } 
502
+                        if (!is_writable($dir_path.'/'.$file)) {
503
+                            return 0;
504
+                        }
505
+                    } else {
506
+                        $file_hd2=@fopen($dir_path.'/'.$file.'/test.txt','w');
507
+                        if (!$file_hd2) {
508
+                            @fclose($file_hd2);
509
+                            @unlink($dir_path.'/'.$file.'/test.txt');
510
+                            $is_writale=0;
511
+                            return $is_writale;
512
+                        }
343 513
                         //递归 
344
-                        $is_writale=check_dir_iswritable($dir_path.'/'.$file); 
345
-                    } 
346
-                } 
347
-            } 
348
-        } 
349
-        return $is_writale; 
350
-    } 
514
+                        $is_writale=check_dir_iswritable($dir_path.'/'.$file);
515
+                    }
516
+                }
517
+            }
518
+        }
519
+        return $is_writale;
520
+    }
351 521
 
352 522
     /**
353 523
      * [checkVersion 检查升级]
354
-     * @author Michael_xu 
355
-     * @param  
356
-     */     
524
+     * @author Michael_xu
525
+     * @param
526
+     */
357 527
     public function checkVersion(){
358 528
         $version = Config::load('version');
359 529
         $info = sendRequest($this->upgrade_site.'index.php?m=version&a=checkVersion', $version['VERSION']);
@@ -362,7 +532,7 @@ INFO;
362 532
         } else {
363 533
             return resultArray(['error' => '检查新版本出错!']);
364 534
         }
365
-    }    
535
+    }
366 536
 
367 537
     /**
368 538
      * 环境检测
@@ -386,7 +556,7 @@ INFO;
386 556
             $items['php'][3] = 'error';
387 557
             session('install_error', true);
388 558
         }
389
-        
559
+
390 560
         if (!extension_loaded('gd')) {
391 561
             $items['gd'][1] = '未开启';
392 562
             $items['gd'][3] = 'error';
@@ -411,7 +581,7 @@ INFO;
411 581
         }
412 582
         return $items;
413 583
     }
414
-    
584
+
415 585
     /**
416 586
      * 目录权限检查
417 587
      * @return array
@@ -450,9 +620,9 @@ INFO;
450 620
 
451 621
     /**
452 622
      * 验证序列号
453
-     * @param 
623
+     * @param
454 624
      * @return
455
-     */        
625
+     */
456 626
     public function checkCodeOld($username) {
457 627
         $encryption = md5($username);
458 628
         $substr = substr($username, strlen($username)-6);
@@ -474,5 +644,5 @@ INFO;
474 644
         //     return resultArray(['error' => 'license配置写入失败!']);
475 645
         // }
476 646
         return true;
477
-    }    
647
+    }
478 648
 }

+ 23
- 5
application/admin/controller/Rules.php ファイルの表示

@@ -87,14 +87,21 @@ class Rules extends ApiCommon
87 87
 
88 88
         $data = ['0' => ['name' => '系统管理角色','pid' => 1],'1' => ['name' => '办公管理角色','pid' => 6],'2' => ['name' => '客户管理角色','pid' => 2],'3' => ['name' => '项目管理角色','pid' => '9']];
89 89
         $list = db('admin_group')->field('id, pid, title')->select();
90
-        
90
+//        $userInfo=$this->userInfo;
91 91
         $authList = db('admin_group_auth')->where('group_id', $param['group_id'])->column('auth_group_id');
92 92
         foreach ($data as $key => $value) {
93 93
             foreach ($list as $k => $v) {
94 94
                 $v['is_true'] = in_array($v['id'], $authList) ? 1 : 0;
95 95
 
96 96
                 if($v['pid'] == $value['pid']){
97
-                    $data[$key]['item'][] = $v;
97
+                    if($v['id']==1){
98
+                        continue;
99
+                    }elseif($v['id']==2){
100
+                        continue;
101
+                    }else{
102
+                        $data[$key]['item'][] = $v;
103
+                    }
104
+
98 105
                 }
99 106
             }
100 107
         }
@@ -158,7 +165,7 @@ class Rules extends ApiCommon
158 165
 
159 166
         $groupIds = db('admin_access')->where('user_id', $userId)->column('group_id');
160 167
         $rules = db('admin_group')->where('id', 'in', $groupIds)->column('rules');
161
-        
168
+
162 169
         $arr = [];
163 170
         foreach ($rules as $key => $value) {
164 171
             if($arr){
@@ -179,7 +186,14 @@ class Rules extends ApiCommon
179 186
                 $item = [];
180 187
                 foreach ($list as $k => $v) {
181 188
                     if($v['pid'] == $value['pid']){
182
-                        $item[] = $v;
189
+
190
+                        if($v['pid'] == $value['pid']){
191
+                            if($userId!=1 && $v['id']==1){
192
+                                continue;
193
+                            }else{
194
+                                $item[] = $v;
195
+                            }
196
+                        }
183 197
                     }
184 198
                 }
185 199
                 $items = [];
@@ -198,7 +212,11 @@ class Rules extends ApiCommon
198 212
             foreach ($data as $key => $value) {
199 213
                 foreach ($list as $k => $v) {
200 214
                     if($v['pid'] == $value['pid']){
201
-                        $data[$key]['list'][] = $v;
215
+                        if($v['id']==1){
216
+                            continue;
217
+                        }else{
218
+                            $data[$key]['list'][] = $v;
219
+                        }
202 220
                     }
203 221
                 }
204 222
             }

+ 3
- 0
application/admin/controller/Users.php ファイルの表示

@@ -193,6 +193,7 @@ class Users extends ApiCommon
193 193
         $param = $this->param;
194 194
         $userInfo = $this->userInfo;
195 195
         $userData = db('admin_user')->where(['id' => $param['id']])->find();
196
+
196 197
         if (!$param['id']) {
197 198
             //修改个人信息
198 199
             $param['user_id'] = $userInfo['id'];
@@ -846,8 +847,10 @@ class Users extends ApiCommon
846 847
         if (false === UserModel::checkUserGroup([1, 2, 3])) {
847 848
             return resultArray(['error' => '没有该权限']);
848 849
         }
850
+        $userId = $this->userInfo['id'];
849 851
         $userModel = model('User');
850 852
         $param = $this->param;
853
+        $param['user_id']=$userId;
851 854
         if (!is_array($param['id'])) {
852 855
             $ids[] = $param['id'];
853 856
         } else {

+ 1
- 1
application/admin/logic/FieldGrantLogic.php ファイルの表示

@@ -265,7 +265,7 @@ class FieldGrantLogic
265 265
         # 固定字段
266 266
         $content = [
267 267
             ['field' => 'name', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '线索名称'],
268
-            ['field' => 'email', 'maskType' => 0, 'form_type'=>'email', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '邮箱'],
268
+            ['field' => 'email', 'maskType' => 1, 'form_type'=>'email', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '邮箱'],
269 269
             ['field' => 'source', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '线索来源'],
270 270
             ['field' => 'mobile', 'maskType' => 0, 'read' => 1,'form_type'=>'mobile', 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '手机'],
271 271
             ['field' => 'telephone', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '电话'],

+ 7
- 3
application/admin/model/Admin.php ファイルの表示

@@ -67,10 +67,14 @@ class Admin extends Common
67 67
             }
68 68
         }
69 69
         if (!$user_ids) $user_ids = getSubUserId(true,0, $apiCommon->userInfo['id']);
70
-        $perUserIds = $perUserIds ? : getSubUserId(); //权限范围内userIds
70
+        // $perUserIds = $perUserIds ? : getSubUserId(); //权限范围内userIds
71 71
         $userIds = [];
72
-        if ($user_ids) {
73
-            $userIds = $perUserIds ? array_intersect($user_ids, $perUserIds) : $perUserIds; //数组交集
72
+        if($perUserIds){
73
+            if ($user_ids) {
74
+                $userIds = $perUserIds ? array_intersect($user_ids, $perUserIds) : $perUserIds; //数组交集
75
+            }
76
+        }else{
77
+            $userIds = $user_ids; //数组交集
74 78
         }
75 79
         $where['userIds'] = array_map('intval', $userIds);
76 80
         if ($param['type']) {

+ 150
- 0
application/admin/model/Examine.php ファイルの表示

@@ -0,0 +1,150 @@
1
+<?php
2
+// +----------------------------------------------------------------------
3
+// | Description: 审批流程
4
+// +----------------------------------------------------------------------
5
+// | Author: zjf
6
+// +----------------------------------------------------------------------
7
+namespace app\admin\model;
8
+
9
+use app\admin\controller\ApiCommon;
10
+use think\Db;
11
+use app\admin\model\Common;
12
+use think\Request;
13
+use think\Validate;
14
+
15
+class Examine extends Common
16
+{
17
+	/**
18
+     * 为了数据库的整洁,同时又不影响Model和Controller的名称
19
+     * 我们约定每个模块的数据表都加上相同的前缀,比如CRM模块用crm作为数据表前缀
20
+     */
21
+	protected $name = 'examine';
22
+    protected $createTime = 'create_time';
23
+    protected $updateTime = 'update_time';
24
+	protected $autoWriteTimestamp = true;
25
+	protected $typesArr = ['crm_contract', 'crm_receivables', 'crm_invoice', 'oa_examine', 'jxc_purchase', 'jxc_retreat', 'jxc_sale', 'jxc_salereturn', 'jxc_payment', 'jxc_collection', 'jxc_allocation', 'jxc_inventory'];
26
+
27
+	/**
28
+     * [getDataList 审批流程list]
29
+     * @author zjf
30
+     * @param     [string]                   $map [查询条件]
31
+     * @param     [number]                   $page     [当前页数]
32
+     * @param     [number]                   $limit    [每页数量]
33
+     * @return    [array]                    [description]
34
+     */		
35
+	public function getDataList($request)
36
+    {  
37
+        $request = $this->fmtRequest( $request );
38
+        $map = $request['map'] ? : [];
39
+        if (isset($map['search'])) {
40
+            //普通筛选
41
+            $map['a.examine_name'] = ['like', '%'.$map['search'].'%'];
42
+            unset($map['search']);
43
+        }
44
+        $map['a.status'] = ['neq', 3];
45
+        $list = db('examine')
46
+                ->alias('a')
47
+                // ->join('examine_manager_user b','a.examine_id = b.examine_id', 'left')
48
+                ->join('admin_user c','a.update_user_id = c.id', 'left')
49
+                ->page($request['page'], $request['limit'])
50
+                ->field('a.*, c.realname as update_realname, c.thumb_img as update_thumb_img')
51
+                ->where($map)
52
+                ->order('a.status desc,a.update_time desc')
53
+                ->select(); 
54
+        foreach ($list as $k=>$v) {
55
+            $list[$k]['status'] = $v['status']==1 ? '启用' : '停用';
56
+            $list[$k]['recheck_type'] = $v['recheck_type']==1 ? '从第一层开始' : '从拒绝的层级开始';
57
+            // 1 合同 2 回款 3发票 4薪资 5 采购审核 6采购退货审核 7销售审核 8 销售退货审核 9付款单审核10 回款单审核11盘点审核12调拨审核',
58
+            switch ($v['label']) {
59
+                case '1' : $label = '合同'; break;
60
+                case '2' : $label = '回款'; break;
61
+                case '3' : $label = '发票'; break;
62
+                case '4' : $label = '薪资'; break;
63
+                case '5' : $label = '采购审核'; break;
64
+                case '6' : $label = '采购退货审核'; break;
65
+                case '7' : $label = '销售审核'; break;
66
+                case '8' : $label = '销售退货审核'; break;
67
+                case '9' : $label = '付款单审核'; break;
68
+                case '10' : $label = '回款单审核1'; break;
69
+                case '11' : $label = '盘点审核'; break;
70
+                case '12' : $label = '调拨审核'; break;
71
+                default : $label = ''; break;
72
+            }
73
+
74
+            // 审批流管理员
75
+            $manager_user = db('examine_manager_user')
76
+                ->alias('a')
77
+                ->join('admin_user b','a.user_id = b.id')
78
+                ->field('a.user_id, b.realname')
79
+                ->where('examine_id', $v['examine_id'])
80
+                ->column('user_id');
81
+            $list[$k]['managerList'] = $manager_user;
82
+
83
+            $list[$k]['label'] = $label;
84
+        }
85
+        $dataCount = db('examine')
86
+                ->alias('a')
87
+                ->join('examine_manager_user b','a.examine_id = b.examine_id', 'left')
88
+                ->join('admin_user c','a.update_user_id = c.id', 'left')
89
+                ->where($map)
90
+                ->count('a.examine_id');
91
+
92
+        $data = [];
93
+        $data['list'] = $list;
94
+        $data['dataCount'] = $dataCount ? : 0;
95
+
96
+        return $data;
97
+    }
98
+
99
+    /**
100
+     * 审批流程详情
101
+     * @author zjf
102
+     * @param  
103
+     * @return                            
104
+     */ 
105
+    public function getDataById($examine_id = '')
106
+    {
107
+        $userModel = new \app\admin\model\User();
108
+        $dataInfo = $this->get($examine_id);
109
+        if (!$dataInfo) {
110
+            $this->error = '数据不存在或已删除';
111
+            return false;
112
+        }
113
+
114
+        //审批步骤
115
+        $flowList = db('examine_flow')->where(['examine_id' => $examine_id])->where('condition_id', 0)->select();
116
+        foreach ($flowList as $k=>$v) {
117
+            if($v['examine_type'] == 0){
118
+                $conditionList = db('examine_condition')->where(['flow_id' => $v['flow_id']])->select();
119
+                foreach ($conditionList as $key => $value) {
120
+                    $conditionList[$key]['conditionDataList'] = db('examine_condition_data')->where(['condition_id' => $value['condition_id']])->select();
121
+                    $examineDataList = $this->recursion($value['condition_id']);
122
+                    $conditionList[$key]['examineDataList'] = $examineDataList;
123
+                }
124
+                $flowList[$k]['conditionList'] = $conditionList;
125
+
126
+
127
+                
128
+            }    
129
+        }
130
+        return $flowList;
131
+    }
132
+
133
+    public function recursion($condition_id = '')
134
+    {
135
+        //审批步骤
136
+        $flowList = db('examine_flow')->where(['condition_id' => $condition_id])->select();
137
+        foreach ($flowList as $k=>$v) {
138
+            if($v['examine_type'] == 0){
139
+                $conditionList = db('examine_condition')->where(['flow_id' => $v['flow_id']])->select();
140
+                foreach ($conditionList as $key => $value) {
141
+                    $conditionList[$key]['conditionDataList'] = db('examine_condition_data')->where(['condition_id' => $value['condition_id']])->select();
142
+                    $examineDataList = $this->recursion($value['condition_id']);
143
+                    $conditionList[$key]['examineDataList'] = $examineDataList;
144
+                }
145
+                $flowList[$k]['conditionList'] = $conditionList;
146
+            }  
147
+        }
148
+        return $flowList;
149
+    }
150
+}

+ 2
- 1
application/admin/model/Excel.php ファイルの表示

@@ -984,7 +984,8 @@ class Excel extends Common
984 984
                         }
985 985
                     } else {
986 986
                         if ($types == 'crm_customer' && !empty($param['pool_id'])) {
987
-                            if (in_array($param['create_user_id'], stringToArray($owner)) || $param['create_user_id'] == 1) {
987
+                            $userLevel = isSuperAdministrators($param['create_user_id']);
988
+                            if (in_array($param['create_user_id'], stringToArray($owner)) || $param['create_user_id'] == 1 || $userLevel == 1) {
988 989
                                 $data = array_merge($data, $default_data);
989 990
                                 $data['excel'] = 1;
990 991
                                 if (!$resData = $dataModel->createData($data)) {

+ 82
- 1
application/admin/model/Field.php ファイルの表示

@@ -773,6 +773,7 @@ class Field extends Model
773 773
             unset($data['yaxis']);
774 774
             unset($data['maxNumRestrict']);
775 775
             unset($data['minNumRestrict']);
776
+            unset($data['stting']);
776 777
             // 设置明细表格类型的默认值为空,防止为null的报错。
777 778
             if ($data['form_type'] == 'detail_table') {
778 779
                 $data['default_value'] = '';
@@ -1124,6 +1125,9 @@ class Field extends Model
1124 1125
                 'fieldName' => 'owner_user_structure_name'
1125 1126
             ];
1126 1127
             foreach ($field_list as $k => $v) {
1128
+                if($v['field']=='invoice_type'){
1129
+                    $field_list[$k]['setting']=$v['setting']?explode(chr(10), $v['setting']):[];
1130
+                }
1127 1131
                 # 处理字段授权
1128 1132
                 $field_list[$k]['writeStatus'] = 1;
1129 1133
                 if (!$userLevel && $param['module'] == 'crm' && !empty($grantData[$param['types']])) {
@@ -1136,6 +1140,7 @@ class Field extends Model
1136 1140
                     $field_list[$k]['maskType'] = $status['maskType'];
1137 1141
                     # 编辑权限
1138 1142
                     $field_list[$k]['writeStatus'] = $status['write'];
1143
+
1139 1144
                 }
1140 1145
             }
1141 1146
             if ($param['types'] == 'crm_invoice') {
@@ -1854,7 +1859,7 @@ class Field extends Model
1854 1859
         }
1855 1860
         $fieldArr = $this
1856 1861
             ->where($where)
1857
-            ->field(['field', 'name', 'form_type', 'is_hidden'])
1862
+            ->field(['field', 'name', 'form_type', 'is_hidden','setting'])
1858 1863
             ->order('order_id', 'asc')
1859 1864
             ->select();
1860 1865
 
@@ -1908,6 +1913,15 @@ class Field extends Model
1908 1913
                 'is_hidden' => 0
1909 1914
             ];
1910 1915
         }
1916
+
1917
+        if ($types == 'jxc_product') {
1918
+            $res[] = [
1919
+                'field'     => 'product_picture',
1920
+                'name'      => '产品图片',
1921
+                'form_type' => 'pic',
1922
+                'is_hidden' => 0
1923
+            ];
1924
+        }
1911 1925
         return array_column($res, null, 'field');
1912 1926
     }
1913 1927
 
@@ -2433,6 +2447,7 @@ class Field extends Model
2433 2447
         $field = $prefix ? $prefix . '.' . $field : $field;
2434 2448
         switch ($form_type) {
2435 2449
             case 'textarea' :
2450
+            case 'text' :
2436 2451
             case 'radio' :
2437 2452
             case 'select' :
2438 2453
             case 'checkbox' :
@@ -2645,4 +2660,70 @@ class Field extends Model
2645 2660
 
2646 2661
         return false;
2647 2662
     }
2663
+
2664
+    /**
2665
+     * [getFieldByFormType 获取字段类型数组]
2666
+     * @param types 分类
2667
+     * @author Michael_xu
2668
+     */
2669
+    public function getFieldTypesArray($types, $form_type)
2670
+    {
2671
+        $fieldArr = db('admin_field')->where(['types' => $types, 'form_type' => ['in', $form_type]])->field(['field','name', 'form_type'])->select();
2672
+        $fieldList = [];
2673
+        $userField = []; // 人员类型
2674
+        $structureField = []; // 部门类型
2675
+        $datetimeField = []; // 日期时间类型
2676
+        $booleanField = []; // 布尔值类型字段
2677
+        $dateIntervalField = []; // 日期区间类型字段
2678
+        $positionField = []; // 地址类型字段
2679
+        $handwritingField = []; // 手写签名类型字段
2680
+        $locationField = []; // 定位类型字段
2681
+        $boxField = []; // 多选类型字段
2682
+        $floatField = []; // 货币类型字段
2683
+
2684
+        foreach ($fieldArr as $key => $value) {
2685
+            switch ($value['form_type']) {
2686
+                case 'user' :
2687
+                    $fieldList['userField'][] = $value['field'];
2688
+                    break;
2689
+                case 'structure' :
2690
+                    $fieldList['structureField'][] = $value['field'];
2691
+                    break;
2692
+                case 'datetime' :
2693
+                    $fieldList['datetimeField'][] = $value['field'];
2694
+                    break;
2695
+                case 'boolean_value' :
2696
+                    $fieldList['booleanField'][] = $value['field'];
2697
+                    break;
2698
+                case 'date_interval' :
2699
+                    $fieldList['dateIntervalField'][] = $value['field'];
2700
+                    break;
2701
+                case 'position' :
2702
+                    $fieldList['positionField'][] = $value['field'];
2703
+                    break;
2704
+                case 'handwriting_sign' :
2705
+                    $fieldList['handwritingField'][] = $value['field'];
2706
+                    break;
2707
+                case 'location' :
2708
+                    $fieldList['locationField'][] = $value['field'];
2709
+                    break;
2710
+                case 'checkbox' :
2711
+                    $fieldList['boxField'][] = $value['field'];
2712
+                    break;
2713
+                case 'floatnumber' :
2714
+                    $fieldList['floatField'][] = $value['field'];
2715
+                    break;
2716
+                case 'pic' :
2717
+                    $fieldList['picField'][] = $value['field'];
2718
+                    break;
2719
+                case 'detail_table' :
2720
+                    $fieldList['detailTableField'][] = $value['field'];
2721
+                    break;
2722
+                case 'date' :
2723
+                    $fieldList['dateField'][] = $value['field'];
2724
+                    break;
2725
+            }
2726
+        }
2727
+        return $fieldList ?: [];
2728
+    }
2648 2729
 }

+ 9
- 3
application/admin/model/Group.php ファイルの表示

@@ -30,9 +30,11 @@ class Group extends Common
30 30
 	public function getDataList($param)
31 31
 	{
32 32
 		$ruleModel = new \app\admin\model\Rule();
33
-		$map = [];	
33
+		$map = [];
34
+
34 35
 		if ($param['tree'] == 1) {
35 36
 			$list = $this->getTypeList();
37
+
36 38
 			foreach ($list as $k=>$v) {
37 39
 				$where = [];
38 40
 				$where = $this->getNewGroupPid($v['pid']);
@@ -47,7 +49,11 @@ class Group extends Common
47 49
 			} else {
48 50
 				$where = $this->getNewGroupPid($param['pid']);
49 51
 			}
50
-			$list = db('admin_group')->where($where)->select() ? : [];		
52
+            if($param['pid']==1){
53
+                $where['id']=['<>',1];
54
+            }
55
+			$list = db('admin_group')->where($where)->select() ? : [];
56
+
51 57
 			if ($param['rules'] == 1) {
52 58
 				//角色权限分类关系
53 59
 				$ruleTypes = $ruleModel->groupsToRules($param['pid']);
@@ -165,7 +171,7 @@ class Group extends Common
165 171
 	 */
166 172
 	public function getTypeList()
167 173
 	{
168
-		$list = ['0' => ['name' => '系统管理角色','pid' => 1],'1' => ['name' => '办公管理角色','pid' => 6],'2' => ['name' => '客户管理角色','pid' => 2],'3' => ['name' => '项目管理角色','pid' => '9']];
174
+		$list = ['0' => ['name' => '系统管理角色','pid' => 1],'1' => ['name' => '办公管理角色','pid' => 6],'2' => ['name' => '客户管理角色','pid' => 2],'3' => ['name' => '项目管理角色','pid' => '9'],'4' => ['name' => '进销存管理角色','pid' => '10']];
169 175
 		return $list ? : [];
170 176
 	}
171 177
 

+ 1
- 1
application/admin/model/LoginRecord.php ファイルの表示

@@ -74,7 +74,7 @@ class LoginRecord extends Common
74 74
         $data['address'] = $ip_address['country'];
75 75
 
76 76
         // 效果图有这个备注字段,不知道存啥,就把UA记录了一下
77
-//        $data['remark'] = $_SERVER['HTTP_USER_AGENT'];
77
+        $data['remark'] = '';
78 78
 
79 79
         $this->save($data);
80 80
     }

+ 28
- 21
application/admin/model/User.php ファイルの表示

@@ -292,11 +292,7 @@ class User extends Common
292 292
                     }
293 293
             }
294 294
             $param['structure_id'] = $pid;
295
-            if (db('admin_user')->where('username', $param['username'])->find()) {
296
-                $this->error = '手机号已存在';
297
-                return false;
298
-            }
299
-            
295
+
300 296
             $nameData = db('admin_user')->where('realname', 'like', '%' . $param['realname'] . '%')->column('realname');
301 297
             if (in_array($param['realname'], $nameData)) {
302 298
                 for ($j = 1; $j < 100; $j++) {
@@ -328,6 +324,10 @@ class User extends Common
328 324
             $this->error = $validate->getError();
329 325
             return false;
330 326
         }
327
+        if (db('admin_user')->where('username', $param['username'])->find()) {
328
+            $this->error = '手机号已存在';
329
+            return false;
330
+        }
331 331
         $syncModel = new \app\admin\model\Sync();
332 332
         $this->startTrans();
333 333
         try {
@@ -449,10 +449,10 @@ class User extends Common
449 449
             }
450 450
         } else {
451 451
             // 不能操作超级管理员
452
-            // if ($id == 1) {
453
-            // 	$this->error = '非法操作';
454
-            // 	return false;
455
-            // }
452
+             if ($id == 1) {
453
+             	$this->error = '非法操作,不能编辑超级管理员';
454
+             	return false;
455
+             }
456 456
             $checkData = $this->get($id);
457 457
             $userInfo = $checkData->data;
458 458
             if (!$checkData) {
@@ -718,6 +718,10 @@ class User extends Common
718 718
     {
719 719
         $syncModel = new \app\admin\model\Sync();
720 720
         $flag = true;
721
+        if($param['user_id']!=1 && empty(!in_array(1,$param['id']))){
722
+            $this->error = '修改失败,无修改超级管理员权限';
723
+            return false;
724
+        }
721 725
         foreach ($param['id'] as $value) {
722 726
             $password = '';
723 727
             $userInfo = db('admin_user')->where(['id' => $value])->find();
@@ -852,10 +856,10 @@ class User extends Common
852 856
             $authList['oa']['calendar'] = (object)[];
853 857
         }
854 858
         # 进销存
855
-        if (in_array('jxc', $adminConfig)) {
856
-            $authList['jxc']['field'] = (object)[];
857
-            $authList['jxc']['params'] = (object)[];
858
-        }
859
+//        if (in_array('jxc', $adminConfig)) {
860
+//            $authList['jxc']['field'] = (object)[];
861
+//            $authList['jxc']['params'] = (object)[];
862
+//        }
859 863
         # 公海权限
860 864
         $structureId = db('admin_user')->where('id', $u_id)->value('structure_id');
861 865
         $poolStatus = db('crm_customer_pool')->where('status', 1)->where(function ($requery) use ($u_id, $structureId, $adminTypes) {
@@ -1030,8 +1034,8 @@ class User extends Common
1030 1034
         $authList['hrm'] = (object)[];
1031 1035
         // $authList['jxc'] = (object)[];
1032 1036
         # jxc
1033
-        $authList['manage']['jxc']['field'] = true;
1034
-        $authList['manage']['jxc']['params'] = true;
1037
+//        $authList['manage']['jxc']['field'] = true;
1038
+//        $authList['manage']['jxc']['params'] = true;
1035 1039
         
1036 1040
         $authList['knowledge'] = (object)[];
1037 1041
         
@@ -1416,7 +1420,10 @@ class User extends Common
1416 1420
         $userIds = !empty($param['user_id']) ? $param['user_id'] : [];
1417 1421
         $structureIds = !empty($param['structure_id']) ? $param['structure_id'] : [];
1418 1422
         $groupIds = !empty($param['group_id']) ? $param['group_id'] : [];
1419
-        
1423
+        if($param['userId']!=1 && empty(!in_array(1,$userIds))){
1424
+            $this->error = '修改失败,无复制超级管理员权限';
1425
+            return false;
1426
+        }
1420 1427
         # 员工与角色关联数据
1421 1428
         $userGroup = [];
1422 1429
         
@@ -1475,13 +1482,13 @@ class User extends Common
1475 1482
             $this->error = '参数错误';
1476 1483
             return false;
1477 1484
         }
1485
+        $data=[];
1478 1486
         foreach ($ids as $v) {
1479
-            $data['id'] = $v;
1480
-            $data['structure_id'] = $param['structure_id'];
1481
-            $flag=$this->isUpdate(true)->save($data);
1482
-//            $flag = foreachData('', $data);
1483
-//            p(Db::name('AdminUser')->getLastSql());
1487
+            $res['id'] = $v;
1488
+            $res['structure_id'] = $param['structure_id'];
1489
+            $data[] = $res;
1484 1490
         }
1491
+        $flag=$this->isUpdate(true)->saveAll($data);
1485 1492
         if ($flag!==false) {
1486 1493
             return  1;
1487 1494
         } else {

+ 1
- 1
application/admin/traits/FieldVerificationTrait.php ファイルの表示

@@ -39,7 +39,7 @@ trait FieldVerificationTrait
39 39
                 if (empty($status['read']) || (empty($dataId) && empty($status['write']))) continue;
40 40
             }
41 41
             # 验证非明细表格字段数据
42
-            if ($value['form_type'] != 'detail_table' && !empty($value['is_null']) && !in_array($value['form_type'], ['detail_table', 'boolean_value']) && (isset($param[$value['field']]) && empty($param[$value['field']]))) {
42
+            if ($value['form_type'] != 'detail_table' && !empty($value['is_null']) && !in_array($value['form_type'], ['detail_table', 'boolean_value','floatnumber']) && (isset($param[$value['field']]) && empty($param[$value['field']]))) {
43 43
 
44 44
                 $error = $value['name'] . '字段不能为空!';
45 45
                 break;

+ 3
- 3
application/admin/view/install/step2.html ファイルの表示

@@ -85,9 +85,9 @@
85 85
                     <div class="form-item">
86 86
                         <div class="form-label">安装序列号:</div>
87 87
                         <textarea name="wkcode" class="wkform" rows="6" placeholder="请输入您的序列号"></textarea>
88
-                        <div class="remind">
89
-                            <span class="title">您需要通过手机号来<a class="base-a" target="_blank" href="https://www.72crm.com/login">注册悟空ID</a>,该手机号将作为您登录系统的管理员账号。您需要进入【悟空个人中心】,点击【开源版下载】<a class="base-a" target="_blank" href="https://www.72crm.com/login">获取您的序列号</a>,如您已经注册悟空ID,您只需要点击<a class="base-a" target="_blank" href="https://www.72crm.com/login">登录个人中心</a>即可查看您的序列号</span>
90
-                        </div>
88
+<!--                        <div class="remind">-->
89
+<!--                            <span class="title">您需要通过手机号来<a class="base-a" target="_blank" href="https://www.72crm.com/login">注册悟空ID</a>,该手机号将作为您登录系统的管理员账号。您需要进入【悟空个人中心】,点击【开源版下载】<a class="base-a" target="_blank" href="https://www.72crm.com/login">获取您的序列号</a>,如您已经注册悟空ID,您只需要点击<a class="base-a" target="_blank" href="https://www.72crm.com/login">登录个人中心</a>即可查看您的序列号</span>-->
90
+<!--                        </div>-->
91 91
                     </div>
92 92
 
93 93
                     <div class="form-sec-title">请填写管理员信息</div>

+ 0
- 1
application/bi/model/Customer.php ファイルの表示

@@ -377,7 +377,6 @@ class Customer extends Common
377 377
     function getSortByCount($whereArr)
378 378
     {
379 379
         $count = db('crm_customer')->group('owner_user_id')->field('owner_user_id,count(customer_id) as count')->order('count desc')->where($whereArr)->select();
380
-        echo db('crm_customer')->getLastSql();die();
381 380
         return $count;
382 381
     }
383 382
 

+ 85
- 32
application/common.php ファイルの表示

@@ -358,7 +358,7 @@ function advancedQuery($param, $m = '', $c = '', $a = '')
358 358
         if ($key == 'business_id' && !is_array($value)) $result['business.' . $key] = $value;
359 359
 
360 360
         // 仪表盘参数
361
-        if (!empty($value['value'][0]) && empty($value['condition'])) {
361
+        if (!empty($value['value']) && empty($value['condition'])) {
362 362
             $value['condition'] = 'is';
363 363
             $value['form_type'] = 'user';
364 364
         }
@@ -3287,39 +3287,92 @@ if (!function_exists('getPrimaryKeyName')) {
3287 3287
     }
3288 3288
 
3289 3289
 }
3290
-function advancedQueryFormatForTeam($requestMap, $db, $db_id)
3290
+function advancedQueryFormatForTeam($requestMap, $c, $db_id)
3291 3291
 {
3292
-    // 处理查询条件
3293
-    foreach ($requestMap['team_id']['value'] as $v) {
3294
-        if ($requestMap['team_id']['condition'] == 'contains') {
3295
-            $date = function ($query) use ($v) {
3296
-                $query->where('FIND_IN_SET("' . $v . '", ro_user_id)')
3297
-                    ->whereOr('FIND_IN_SET("' . $v . '", rw_user_id)');
3298
-            };
3299
-        } elseif ($requestMap['team_id']['condition'] == 'notContains') {
3300
-            $date = function ($query) use ($v) {
3301
-                $query->where('FIND_IN_SET("' . $v . '", ro_user_id)')
3302
-                    ->where('FIND_IN_SET("' . $v . '", rw_user_id)');
3303
-            };
3304
-        } elseif ($requestMap['team_id']['condition'] == 'isNull') {
3305
-            $date = function ($query) {
3306
-                $query->where('ro_user_id', ['eq', ''])
3307
-                    ->whereOr('rw_user_id', 'null');
3308
-            };
3309
-        } elseif ($requestMap['team_id']['condition'] == 'isNotNull') {
3310
-            $date = function ($query) {
3311
-                $query->where('ro_user_id', ['neq', ''])
3312
-                    ->where('rw_user_id', ['not null']);
3313
-            };
3314 3292
 
3293
+    $prefix = $c . '.';
3294
+    $result = [];
3295
+//    foreach ($requestMap as $k=>$v) {
3296
+//        $r2=$v['value'];
3297
+//        $c = $prefix;
3298
+//        //团队成员
3299
+//        if (isset($v['form_type']) && in_array($v['form_type'], ['user']) && !in_array($k, ['create_user_id', 'owner_user_id']) ) {
3300
+//            $result[$c . 'ro_user_id'] = advancedQueryFormatForPersonnel($v['value'], $v['condition']);
3301
+//            $result[$c . 'rw_user_id'] = advancedQueryFormatForPersonnel($v['value'], $v['condition']);
3302
+//        }
3303
+//    }
3304
+    $date=[];
3305
+    $date2=[];
3306
+    $condition=$requestMap['condition'];
3307
+    $z='';
3308
+
3309
+    foreach ($requestMap['value'] as $val){
3310
+
3311
+        if($condition=='contains'){
3312
+            $z='like';
3313
+            $val="'".'%,'.$val.',%'."'";
3314
+        }elseif($condition=='notContains'){
3315
+            $z='NOT LIKE';
3316
+            $val="'".'%,'.$val.',%'."'";
3317
+        }
3318
+        $date[]=$prefix.'ro_user_id '.$z.$val;
3319
+        $date2[]=$prefix.'rw_user_id '.$z.$val;
3320
+    }
3321
+    if($condition =='isNull'){
3322
+        $z='IS NULL';
3323
+        $date[]=$prefix.'ro_user_id '.'= '."''";
3324
+        $date2[]=$prefix.'rw_user_id '.'= '."''";
3325
+    }elseif($condition =='isNotNull'){
3326
+        $z='IS NOT NULL';
3327
+        $date[]=$prefix.'ro_user_id '.'<> '."''";
3328
+        $date2[]=$prefix.'rw_user_id '.'<> '."''";
3329
+    }
3330
+
3331
+    if($date && $date2){
3332
+        $rest='';
3333
+        $date=implode('OR ', $date);
3334
+        $date2=implode('OR ', $date2);
3335
+        $type='';
3336
+        switch ($z){
3337
+            case 'like':
3338
+                $rest='('.$date.')'.'OR'.'('.$date2.')';
3339
+                break;
3340
+            case 'NOT LIKE':
3341
+                $rest='('.$date.')'.'AND'.'('.$date2.')';
3342
+                break;
3343
+            case 'IS NULL':
3344
+                $rest='('.$date.')'.'OR'.'('.$date2.')';
3345
+                break;
3346
+            case 'IS NOT NULL':
3347
+                $rest='('.$date.')'.'AND'.'('.$date2.')';
3348
+                break;
3349
+            default:
3350
+                break;
3315 3351
         }
3316
-        $part[] = db($db)->where($date)->column($db_id);
3317 3352
     }
3318
-    $result = [];
3319
-    array_walk_recursive($part, function ($value) use (&$result) {
3320
-        array_push($result, $value);
3321
-    });
3322
-    $result = array_unique($result);
3323
-    $partMap['customer.customer_id'] = ['in', trim(arrayToString($result), ',')];
3324
-    return $partMap ?: [];
3353
+    return $rest ?: [];
3354
+}
3355
+
3356
+/**
3357
+ * 根据用户获取第 几级 上级
3358
+ *
3359
+ * @param string $level 获取到第几级
3360
+ * @return string
3361
+ * @since 2021-05-18
3362
+ * @author fanqi
3363
+ */
3364
+function getUserSuperior($structure_id, $level = 0)
3365
+{
3366
+    if($level == 0){
3367
+        $owner_user_id = db('admin_structure')->where('id', $structure_id)->value('owner_user_id');
3368
+        if($owner_user_id == 0){
3369
+            $pid = db('admin_structure')->where('id', $structure_id)->value('pid');
3370
+            $owner_user_id = db('admin_structure')->where('id', $pid)->value('owner_user_id');
3371
+        }
3372
+    }else{
3373
+        $pid = db('admin_structure')->where('id', $structure_id)->value('pid');
3374
+        return getUserSuperior($pid, $level-1);
3375
+    }
3376
+
3377
+    return $owner_user_id;
3325 3378
 }

+ 20
- 20
application/common/command/PoolCommand.php ファイルの表示

@@ -121,26 +121,26 @@ class PoolCommand extends Command
121 121
      * @version     1.0 版本号
122 122
      * @since       2021/6/3 0003 10:38
123 123
      */
124
-//    private function updateInfo($ruleList, $customerWhere)
125
-//    {
126
-//        foreach ($ruleList as $k => $v) {
127
-//            $levels = json_decode($v['level'], true);
128
-//            foreach ($levels as $k1 => $v1) {
129
-//                if (!empty($v1['limit_day'])) {
130
-//                    $time = $v1['limit_day'];
131
-//                } else {
132
-//                    $time = $this->getMinDay($levels);
133
-//                }
134
-//            }
135
-//            foreach ($customerWhere as $val) {
136
-//                if ($v['type'] == 1) updateActionLog(0, 'crm_customer', $val, '', '', '超过' . $time . '天无新建跟进记录自动进入公海');
137
-//                if ($v['type'] == 2) updateActionLog(0, 'crm_customer', $val, '', '', '超过' . $time . '天无新建商机自动进入公海');
138
-//                if ($v['type'] == 3) updateActionLog(0, 'crm_customer', $val, '', '', '超过' . $time . '天未成交自动进入公海');
139
-//
140
-//            }
141
-//        }
142
-//    }
143
-//
124
+    private function updateInfo($ruleList, $customerWhere)
125
+    {
126
+        foreach ($ruleList as $k => $v) {
127
+            $levels = json_decode($v['level'], true);
128
+            foreach ($levels as $k1 => $v1) {
129
+                if (!empty($v1['limit_day'])) {
130
+                    $time = $v1['limit_day'];
131
+                } else {
132
+                    $time = $this->getMinDay($levels);
133
+                }
134
+            }
135
+            foreach ($customerWhere as $val) {
136
+                if ($v['type'] == 1) updateActionLog(0, 'crm_customer', $val, '', '', '超过' . $time . '天无新建跟进记录自动进入公海');
137
+                if ($v['type'] == 2) updateActionLog(0, 'crm_customer', $val, '', '', '超过' . $time . '天无新建商机自动进入公海');
138
+                if ($v['type'] == 3) updateActionLog(0, 'crm_customer', $val, '', '', '超过' . $time . '天未成交自动进入公海');
139
+                
140
+            }
141
+        }
142
+    }
143
+    
144 144
     
145 145
     
146 146
     protected function execute(Input $input, Output $output)

+ 99
- 0
application/crm/common.php ファイルの表示

@@ -209,3 +209,102 @@ function decrypt($data, $key = '72-crm')
209 209
     }
210 210
     return $str;
211 211
 }
212
+
213
+function getFieldData($list,$types,$user_id){
214
+    $fieldModel  = new \app\admin\model\Field();
215
+    $indexField = $fieldModel->getIndexField($types, $user_id, 1) ? : array('name'); // 列表展示字段
216
+    $userField = $fieldModel->getFieldByFormType($types, 'user'); // 人员类型
217
+    $structureField = $fieldModel->getFieldByFormType($types, 'structure'); // 部门类型
218
+    $datetimeField = $fieldModel->getFieldByFormType($types, 'datetime'); // 日期时间类型
219
+    $booleanField = $fieldModel->getFieldByFormType($types, 'boolean_value'); // 布尔值类型字段
220
+    $dateIntervalField = $fieldModel->getFieldByFormType($types, 'date_interval'); // 日期区间类型字段
221
+    $positionField = $fieldModel->getFieldByFormType($types, 'position'); // 地址类型字段
222
+    $handwritingField = $fieldModel->getFieldByFormType($types, 'handwriting_sign'); // 手写签名类型字段
223
+    $locationField = $fieldModel->getFieldByFormType($types, 'location'); // 定位类型字段
224
+    $boxField = $fieldModel->getFieldByFormType($types, 'checkbox'); // 多选类型字段
225
+    $floatField = $fieldModel->getFieldByFormType($types, 'floatnumber'); // 货币类型字段
226
+    $db_id=substr($types,strripos($types,"_")+1).'_id';;
227
+    $extraData = [];
228
+    $business_id_list = !empty($list) ? array_column($list, $db_id) : [];
229
+    $extraList = db($types.'_data')->whereIn($db_id, $business_id_list)->select();
230
+    foreach ($extraList AS $key => $value) {
231
+        $extraData[$value[$db_id]][$value['field']] = $value['content'];
232
+    }
233
+    $grantData = getFieldGrantData($user_id);
234
+    foreach ($grantData[$types] as $key => $value) {
235
+        foreach ($value as $ke => $va) {
236
+            if($va['maskType']!=0){
237
+                $fieldGrant[$ke]['maskType'] = $va['maskType'];
238
+                $fieldGrant[$ke]['form_type'] = $va['form_type'];
239
+                $fieldGrant[$ke]['field'] = $va['field'];
240
+            }
241
+        }
242
+    }
243
+    foreach ($list AS $k => $v) {
244
+        # 用户类型字段
245
+        foreach ($userField as $key => $val) {
246
+            if (in_array($val, $indexField)) {
247
+                $usernameField = !empty($v[$val]) ? db('admin_user')->whereIn('id', stringToArray($v[$val]))->column('realname') : [];
248
+                $list[$k][$val] = implode($usernameField, ',');
249
+            }
250
+        }
251
+        # 部门类型字段
252
+        foreach ($structureField as $key => $val) {
253
+            if (in_array($val, $indexField)) {
254
+                $structureNameField = !empty($v[$val]) ? db('admin_structure')->whereIn('id', stringToArray($v[$val]))->column('name') : [];
255
+                $list[$k][$val] = implode($structureNameField, ',');
256
+            }
257
+        }
258
+        # 日期时间类型字段
259
+        foreach ($datetimeField as $key => $val) {
260
+            $list[$k][$val] = !empty($v[$val]) ? date('Y-m-d H:i:s', $v[$val]) : null;
261
+        }
262
+        // 布尔值类型字段
263
+        foreach ($booleanField as $key => $val) {
264
+            $list[$k][$val] = !empty($v[$val]) ? (string)$v[$val] : '0';
265
+        }
266
+        // 处理日期区间类型字段的格式
267
+        foreach ($dateIntervalField as $key => $val) {
268
+            $list[$k][$val] = !empty($extraData[$v['customer_id']][$val]) ? json_decode($extraData[$v['customer_id']][$val], true) : null;
269
+        }
270
+        // 处理地址类型字段的格式
271
+        foreach ($positionField as $key => $val) {
272
+            $list[$k][$val] = !empty($extraData[$v['customer_id']][$val]) ? json_decode($extraData[$v['customer_id']][$val], true) : null;
273
+        }
274
+        // 手写签名类型字段
275
+        foreach ($handwritingField as $key => $val) {
276
+            $handwritingData = !empty($v[$val]) ? db('admin_file')->where('file_id', $v[$val])->value('file_path') : null;
277
+            $list[$k][$val] = ['url' => !empty($handwritingData) ? getFullPath($handwritingData) : null];
278
+        }
279
+        // 定位类型字段
280
+        foreach ($locationField as $key => $val) {
281
+            $list[$k][$val] = !empty($extraData[$v['customer_id']][$val]) ? json_decode($extraData[$v['customer_id']][$val], true) : null;
282
+        }
283
+        // 多选框类型字段
284
+        foreach ($boxField as $key => $val) {
285
+            $list[$k][$val] = !empty($v[$val]) ? trim($v[$val], ',') : null;
286
+        }
287
+        // 货币类型字段
288
+        foreach ($floatField as $key => $val) {
289
+            $list[$k][$val] = $v[$val] != '0.00' ? (string)$v[$val] : null;
290
+        }
291
+        //掩码相关类型字段
292
+                foreach ($fieldGrant AS $key => $val){
293
+                    //掩码相关类型字段
294
+                    if ($val['maskType']!=0 && $val['form_type'] == 'mobile') {
295
+                        $pattern = "/(1[3458]{1}[0-9])[0-9]{4}([0-9]{4})/i";
296
+                        $rs = preg_replace($pattern, "$1****$2", $v[$val['field']]);
297
+                        $list[$k][$val['field']] = !empty($v[$val['field']]) ? (string)$rs : null;
298
+                    } elseif ($val['maskType']!=0 && $val['form_type'] == 'email') {
299
+                        $email_array = explode("@", $v[$val['field']]);
300
+                        $prevfix = (strlen($email_array[0]) < 4) ? "" : substr($v[$val['field']], 0, 2); //邮箱前缀
301
+                        $str = preg_replace('/([\d\w+_-]{0,100})@/', "***@", $v[$val['field']], -1, $count);
302
+                        $rs = $prevfix . $str;
303
+                        $list[$k][$val['field']] = !empty($v[$val['field']]) ?$rs: null;
304
+                    } elseif ($val['maskType']!=0 && in_array($val['form_type'],['position','floatnumber'])) {
305
+                        $list[$k][$val['field']] = !empty($v[$val['field']]) ? (string)substr_replace($v[$val['field']], '*****',0,strlen($v[$val['field']])) : null;
306
+                    }
307
+                }
308
+    }
309
+    return $list;
310
+}

+ 6
- 9
application/crm/controller/Activity.php ファイルの表示

@@ -280,6 +280,11 @@ class Activity extends ApiCommon
280 280
                 $name = '所属客户';
281 281
                 break;
282 282
         }
283
+
284
+        $record_type = db('crm_config')->where(['name' => 'record_type'])->find();
285
+        if ($record_type) {
286
+            $arr = json_decode($record_type['value']);
287
+        }
283 288
         $fields = [
284 289
             '0' => [
285 290
                 'name' => '跟进内容',
@@ -302,15 +307,7 @@ class Activity extends ApiCommon
302 307
                 'name' => '跟进方式',
303 308
                 'field' => 'category',
304 309
                 'form_type' => 'select',
305
-                'setting' =>
306
-                    array
307
-                    (
308
-                        0 => "见面拜访",
309
-                        1 => "电话",
310
-                        2 => "短信",
311
-                        3 => "邮件",
312
-                        4 => "微信"
313
-                    )
310
+                'setting' =>$arr
314 311
             ],
315 312
         ];
316 313
         // 导入的字段列表

+ 8
- 4
application/crm/controller/Business.php ファイルの表示

@@ -223,11 +223,15 @@ class Business extends ApiCommon
223 223
         $list = cache($key);
224 224
         if (!$list) {
225 225
             $userInfo = $this->userInfo;
226
+            $authMap = function($query) use ($userInfo){
227
+                $query->where(['structure_id' =>  ['like', '%,' . $userInfo['structure_id'] . ',%'],'is_display'=> 1,'status'=> 1])
228
+                    ->whereOr(function ($query) use ($userInfo) {
229
+                        $query->where(['structure_id' => ''])->where(['is_display'=> 1,'status'=> 1]);
230
+                    });
231
+            };
226 232
             $list = db('crm_business_type')
227 233
                 ->field(['name', 'status', 'structure_id', 'type_id'])
228
-                ->where(['structure_id' => ['like', '%,' . $userInfo['structure_id'] . ',%'], 'status' => 1])
229
-                ->where('is_display', 1)
230
-                ->whereOr('structure_id', '')
234
+                ->where($authMap)
231 235
                 ->select();
232 236
             foreach ($list as $k => $v) {
233 237
                 $list[$k]['statusList'] = $businessStatusModel->getDataList($v['type_id']);
@@ -236,7 +240,7 @@ class Business extends ApiCommon
236 240
         }else{
237 241
             cache($key, NULL);
238 242
         }
239
-        
243
+
240 244
         return resultArray(['data' => $list]);
241 245
     }
242 246
     

+ 1
- 1
application/crm/controller/Index.php ファイルの表示

@@ -598,7 +598,7 @@ class Index extends ApiCommon
598 598
         $auth_user_ids = $auth_user_ids ? array_intersect($userIds, $auth_user_ids) : []; //取交集
599 599
 
600 600
         if ($c != 'activity') {
601
-            $where['owner_user_id']['value'] = $userIds;
601
+            $where['owner_user_id']['value'] = $auth_user_ids;
602 602
             if($types=='crm_contract' || $types=='crm_receivables'){
603 603
                 $where['check_status']=2;
604 604
             }

+ 9
- 1
application/crm/controller/Preview.php ファイルの表示

@@ -23,7 +23,10 @@ class Preview extends Controller
23 23
         $data = db('admin_printing_data')->field(['type', 'content'])->where('key', $key)->find();
24 24
 
25 25
         $contentArray = json_decode($data['content'], true);
26
+
26 27
         $content      = $contentArray['data'];
28
+        $content = str_replace('\n', '', $content);
29
+        $content = str_replace('\\', '', $content);
27 30
 
28 31
         require_once(EXTEND_PATH.'tcpdf'.DS.'config'.DS.'tcpdf_config.php');
29 32
         require_once(EXTEND_PATH.'tcpdf'.DS.'tcpdf.php');
@@ -33,6 +36,8 @@ class Preview extends Controller
33 36
         // 设置PDF页面边距:LEFT,TOP,RIGHT
34 37
         $tcpdf->SetMargins(10, 10, 10);
35 38
 
39
+        // 设置默认等宽字体
40
+        $tcpdf->SetDefaultMonospacedFont('courier');
36 41
         // 设置字体,防止中文乱码
37 42
         $tcpdf->SetFont('simsun', '', 10);
38 43
 
@@ -41,6 +46,8 @@ class Preview extends Controller
41 46
 //        $tcpdf->SetAuthor(TITLE_NAME);
42 47
         $tcpdf->SetTitle("打印内容预览");
43 48
 
49
+
50
+
44 51
         // 删除预定义的打印 页眉/页尾
45 52
         $tcpdf->setPrintHeader(false);
46 53
 
@@ -58,8 +65,9 @@ class Preview extends Controller
58 65
         $tcpdf->AddPage();
59 66
         $html = $content;
60 67
         $tcpdf->writeHTML($html, true, false, true, true, '');
61
-        $tcpdf->lastPage();
62 68
 
69
+
70
+        $tcpdf->lastPage();
63 71
         $tcpdf->Output(ROOT_PATH.DS.'public'.DS.'temp'.DS.'pdf'.DS.'print.pdf','I');
64 72
 
65 73
         exit($this->fetch('preview', ['key' => $key]));

+ 13
- 13
application/crm/logic/VisitLogic.php ファイルの表示

@@ -170,43 +170,43 @@ class VisitLogic extends Common
170 170
             # 系统字段  负责人部门   zjf  20210726
171 171
             $list[$k]['owner_user_structure_name'] = $list[$k]['owner_user_id_info']['structure_name'];
172 172
 
173
-            foreach ($userField as $key => $val) {
174
-                $usernameField = !empty($v[$val]) ? db('admin_user')->whereIn('id', stringToArray($v[$val]))->column('realname') : [];
175
-                $list[$k][$val.'_name'] = implode($usernameField, ',');
173
+            foreach ($userField as $k => $val) {
174
+                $usernameField  = !empty($v[$val]) ? db('admin_user')->whereIn('id', stringToArray($v[$val]))->column('realname') : [];
175
+                $list[$k][$val] = implode($usernameField, ',');
176 176
             }
177
-            foreach ($structureField as $key => $val) {
177
+            foreach ($structureField as $k => $val) {
178 178
                 $structureNameField = !empty($v[$val]) ? db('admin_structure')->whereIn('id', stringToArray($v[$val]))->column('name') : [];
179
-                $list[$k][$val.'_name'] = implode($structureNameField, ',');
179
+                $list[$k][$val] = implode($structureNameField, ',');
180 180
             }
181
-            foreach ($datetimeField as $key => $val) {
181
+            foreach ($datetimeField as $k => $val) {
182 182
                 $list[$k][$val] = !empty($v[$val]) ? date('Y-m-d H:i:s', $v[$val]) : null;
183 183
             }
184
-            foreach ($booleanField as $key => $val) {
184
+            foreach ($booleanField as $k => $val) {
185 185
                 $list[$k][$val] = !empty($v[$val]) ? (string)$v[$val] : '0';
186 186
             }
187 187
             // 处理日期区间类型字段的格式
188
-            foreach ($dateIntervalField AS $key => $val) {
188
+            foreach ($dateIntervalField AS $k => $val) {
189 189
                 $list[$k][$val] = !empty($extraData[$v['visit_id']][$val]) ? json_decode($extraData[$v['visit_id']][$val], true) : null;
190 190
             }
191 191
             // 处理地址类型字段的格式
192
-            foreach ($positionField AS $key => $val) {
192
+            foreach ($positionField AS $k => $val) {
193 193
                 $list[$k][$val] = !empty($extraData[$v['visit_id']][$val]) ? json_decode($extraData[$v['visit_id']][$val], true) : null;
194 194
             }
195 195
             // 手写签名类型字段
196
-            foreach ($handwritingField AS $key => $val) {
196
+            foreach ($handwritingField AS $k => $val) {
197 197
                 $handwritingData = !empty($v[$val]) ? db('admin_file')->where('file_id', $v[$val])->value('file_path') : null;
198 198
                 $list[$k][$val] = ['url' => !empty($handwritingData) ? getFullPath($handwritingData) : null];
199 199
             }
200 200
             // 定位类型字段
201
-            foreach ($locationField AS $key => $val) {
201
+            foreach ($locationField AS $k => $val) {
202 202
                 $list[$k][$val] = !empty($extraData[$v['visit_id']][$val]) ? json_decode($extraData[$v['visit_id']][$val], true) : null;
203 203
             }
204 204
             // 多选框类型字段
205
-            foreach ($boxField AS $key => $val) {
205
+            foreach ($boxField AS $k => $val) {
206 206
                 $list[$k][$val] = !empty($v[$val]) ? trim($v[$val], ',') : null;
207 207
             }
208 208
             // 货币类型字段
209
-            foreach ($floatField AS $key => $val) {
209
+            foreach ($floatField AS $k => $val) {
210 210
                 $list[$k][$val] = $v[$val]!='0.00' ? (string)$v[$val] : null;
211 211
             }
212 212
             //掩码相关类型字段

+ 12
- 88
application/crm/model/Business.php ファイルの表示

@@ -98,23 +98,22 @@ class Business extends Common
98 98
             unset($sceneMap['type_id']);
99 99
         }
100 100
         $partMap = [];
101
-        //优先级:普通筛选>高级筛选>场景
102
-        if ($requestMap['team_id']) {
103
-            //相关团队查询
104
-            $map = $requestMap;
105
-            $partMap= advancedQueryFormatForTeam($requestMap,'crm_business','business_id');
106
-            unset($map['team_id']);
101
+        $teamMap=$requestMap['team_id'];
102
+        //团队成员 高级筛选
103
+        if($teamMap){
104
+            $partMap= advancedQueryFormatForTeam($teamMap,'business','');
105
+            unset($requestMap['team_id']);
106
+            $map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap;
107 107
         } else {
108 108
             $map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap;
109 109
         }
110 110
         //高级筛选
111 111
         $map = advancedQuery($map, 'crm', 'business', 'index');
112 112
         $authMap = [];
113
-        if (!$partMap) {
114 113
             $a = 'index';
115 114
             if ($is_excel) $a = 'excelExport';
116 115
             $auth_user_ids = $userModel->getUserByPer('crm', 'business', $a);
117
-            if (isset($map['business.owner_user_id']) && $map['business.owner_user_id'][0] != 'like') {
116
+            if (isset($map['business.owner_user_id'])) {
118 117
                 if (!is_array($map['business.owner_user_id'][1])) {
119 118
                     $map['business.owner_user_id'][1] = [$map['business.owner_user_id'][1]];
120 119
                 }
@@ -136,7 +135,7 @@ class Business extends Common
136 135
                         ->whereOr('business.rw_user_id', array('like', '%,' . $authMapData['user_id'] . ',%'));
137 136
                 };
138 137
             }
139
-        }
138
+
140 139
         //联系人商机
141 140
         if ($contacts_id) {
142 141
             $business_id = Db::name('crm_contacts_business')->where(['contacts_id' => $contacts_id])->column('business_id');
@@ -155,14 +154,7 @@ class Business extends Common
155 154
         }
156 155
         $userField = $fieldModel->getFieldByFormType('crm_business', 'user'); //人员类型
157 156
         $structureField = $fieldModel->getFieldByFormType('crm_business', 'structure');  //部门类型
158
-        $datetimeField = $fieldModel->getFieldByFormType('crm_business', 'datetime'); //日期时间类型
159
-        $booleanField = $fieldModel->getFieldByFormType('crm_business', 'boolean_value'); //布尔值
160
-        $dateIntervalField = $fieldModel->getFieldByFormType('crm_business', 'date_interval'); // 日期区间类型字段
161
-        $positionField = $fieldModel->getFieldByFormType('crm_business', 'position'); // 地址类型字段
162
-        $handwritingField = $fieldModel->getFieldByFormType('crm_business', 'handwriting_sign'); // 手写签名类型字段
163
-        $locationField = $fieldModel->getFieldByFormType('crm_business', 'location'); // 定位类型字段
164
-        $boxField = $fieldModel->getFieldByFormType('crm_business', 'checkbox'); // 多选类型字段
165
-        $floatField = $fieldModel->getFieldByFormType('crm_business', 'floatnumber'); // 货币类型字段
157
+
166 158
 //        $fieldGrant = db('admin_field_mask')->where('types', 'business')->select();
167 159
         # 处理人员和部门类型的排序报错问题(前端传来的是包含_name的别名字段)
168 160
         $temporaryField = str_replace('_name', '', $order_field);
@@ -222,21 +214,8 @@ class Business extends Common
222 214
         $endStatus = ['1' => '赢单', '2' => '输单', '3' => '无效'];
223 215
         # 扩展数据
224 216
         $extraData = [];
225
-        $business_id_list = !empty($list) ? array_column($list, 'business_id') : [];
226
-        $extraList = db('crm_business_data')->whereIn('business_id', $business_id_list)->select();
227
-        foreach ($extraList AS $key => $value) {
228
-            $extraData[$value['business_id']][$value['field']] = $value['content'];
229
-        }
230
-        $grantData = getFieldGrantData($user_id);
231
-        foreach ($grantData['crm_business'] as $key => $value) {
232
-            foreach ($value as $ke => $va) {
233
-                if($va['maskType']!=0){
234
-                    $fieldGrant[$ke]['maskType'] = $va['maskType'];
235
-                    $fieldGrant[$ke]['form_type'] = $va['form_type'];
236
-                    $fieldGrant[$ke]['field'] = $va['field'];
237
-                }
238
-            }
239
-        }
217
+
218
+        $list=getFieldData($list,'crm_business',$user_id);
240 219
         foreach ($list as $k => $v) {
241 220
             $list[$k]['customer_id_info']['customer_id'] = $v['customer_id'];
242 221
             $list[$k]['customer_id_info']['name'] = $v['customer_name'];
@@ -244,62 +223,7 @@ class Business extends Common
244 223
             $list[$k]['owner_user_id_info'] = isset($v['owner_user_id']) ? $userModel->getUserById($v['owner_user_id']) : [];
245 224
             $list[$k]['create_user_name'] = !empty($list[$k]['create_user_id_info']['realname']) ? $list[$k]['create_user_id_info']['realname'] : '';
246 225
             $list[$k]['owner_user_name'] = !empty($list[$k]['owner_user_id_info']['realname']) ? $list[$k]['owner_user_id_info']['realname'] : '';
247
-            foreach ($userField as $key => $val) {
248
-                $usernameField  = !empty($v[$val]) ? db('admin_user')->whereIn('id', stringToArray($v[$val]))->column('realname') : [];
249
-                $list[$k][$val] = implode($usernameField, ',');
250
-            }
251
-            foreach ($structureField as $key => $val) {
252
-                $structureNameField = !empty($v[$val]) ? db('admin_structure')->whereIn('id', stringToArray($v[$val]))->column('name') : [];
253
-                $list[$k][$val] = implode($structureNameField, ',');
254
-            }
255
-            foreach ($datetimeField as $key => $val) {
256
-                $list[$k][$val] = !empty($v[$val]) ? date('Y-m-d H:i:s', $v[$val]) : null;
257
-            }
258
-            foreach ($booleanField as $key => $val) {
259
-                $list[$k][$val] = !empty($v[$val]) ? (string)$v[$val] : '0';
260
-            }
261
-            // 处理日期区间类型字段的格式
262
-            foreach ($dateIntervalField AS $key => $val) {
263
-                $list[$k][$val] = !empty($extraData[$v['business_id']][$val]) ? json_decode($extraData[$v['business_id']][$val], true) : null;
264
-            }
265
-            // 处理地址类型字段的格式
266
-            foreach ($positionField AS $key => $val) {
267
-                $list[$k][$val] = !empty($extraData[$v['business_id']][$val]) ? json_decode($extraData[$v['business_id']][$val], true) : null;
268
-            }
269
-            // 手写签名类型字段
270
-            foreach ($handwritingField AS $key => $val) {
271
-                $handwritingData = !empty($v[$val]) ? db('admin_file')->where('file_id', $v[$val])->value('file_path') : null;
272
-                $list[$k][$val] = ['url' => !empty($handwritingData) ? getFullPath($handwritingData) : null];
273
-            }
274
-            // 定位类型字段
275
-            foreach ($locationField AS $key => $val) {
276
-                $list[$k][$val] = !empty($extraData[$v['business_id']][$val]) ? json_decode($extraData[$v['business_id']][$val], true) : null;
277
-            }
278
-            // 多选框类型字段
279
-            foreach ($boxField AS $key => $val) {
280
-                $list[$k][$val] = !empty($v[$val]) ? trim($v[$val], ',') : null;
281
-            }
282
-            // 货币类型字段
283
-            foreach ($floatField AS $key => $val) {
284
-                $list[$k][$val] = $v[$val]!='0.00' ? (string)$v[$val] : null;
285
-            }
286
-            //掩码相关类型字段
287
-            foreach ($fieldGrant AS $key => $val){
288
-                //掩码相关类型字段
289
-                if ($val['maskType']!=0 && $val['form_type'] == 'mobile') {
290
-                    $pattern = "/(1[3458]{1}[0-9])[0-9]{4}([0-9]{4})/i";
291
-                    $rs = preg_replace($pattern, "$1****$2", $v[$val['field']]);
292
-                    $list[$k][$val['field']] = !empty($v[$val['field']]) ? (string)$rs : null;
293
-                } elseif ($val['maskType']!=0 && $val['form_type'] == 'email') {
294
-                    $email_array = explode("@", $v[$val['field']]);
295
-                    $prevfix = (strlen($email_array[0]) < 4) ? "" : substr($v[$val['field']], 0, 2); //邮箱前缀
296
-                    $str = preg_replace('/([\d\w+_-]{0,100})@/', "***@", $v[$val['field']], -1, $count);
297
-                    $rs = $prevfix . $str;
298
-                    $list[$k][$val['field']] = !empty($v[$val['field']]) ?$rs: null;
299
-                } elseif ($val['maskType']!=0 && in_array($val['form_type'],['position','floatnumber'])) {
300
-                    $list[$k][$val['field']] = !empty($v[$val['field']]) ? (string)substr_replace($v[$val['field']], '*****',0,strlen($v[$val['field']])) : null;
301
-                }
302
-            }
226
+
303 227
             $statusInfo = [];
304 228
             $status_count = 0;
305 229
             if (!$v['is_end']) {

+ 9
- 8
application/crm/model/Contacts.php ファイルの表示

@@ -75,23 +75,24 @@ class Contacts extends Common
75 75
         }
76 76
         $partMap = [];
77 77
         //优先级:普通筛选>高级筛选>场景
78
-        if ($requestMap['team_id']) {
79
-            //相关团队查询
80
-            $map = $requestMap;
81
-            $partMap= advancedQueryFormatForTeam($requestMap,'crm_contacts','contacts_id');
82
-            unset($map['team_id']);
78
+        $teamMap=$requestMap['team_id'];
79
+        //团队成员 高级筛选
80
+        if($teamMap){
81
+            $partMap= advancedQueryFormatForTeam($teamMap,'contacts','contacts_id');
82
+            unset($requestMap['team_id']);
83
+            $map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap;
83 84
         } else {
84 85
             $map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap;
85 86
         }
86 87
         //高级筛选
87 88
         $map = advancedQuery($map, 'crm', 'contacts', 'index');
88 89
         //权限
89
-        if (!$partMap) {
90
+
90 91
             $a = 'index';
91 92
             if ($is_excel) $a = 'excelExport';
92 93
             $authMap = [];
93 94
             $auth_user_ids = $userModel->getUserByPer('crm', 'contacts', $a);
94
-            if (isset($map['contacts.owner_user_id']) && $map['contacts.owner_user_id'][0] != 'like') {
95
+            if (isset($map['contacts.owner_user_id'])) {
95 96
                 if (!is_array($map['contacts.owner_user_id'][1])) {
96 97
                     $map['contacts.owner_user_id'][1] = [$map['contacts.owner_user_id'][1]];
97 98
                 }
@@ -114,7 +115,7 @@ class Contacts extends Common
114 115
                         ->whereOr('contacts.rw_user_id', array('like', '%,' . $authMapData['user_id'] . ',%'));
115 116
                 };
116 117
             }
117
-        }
118
+
118 119
         
119 120
         
120 121
         //联系人商机

+ 9
- 9
application/crm/model/Contract.php ファイルの表示

@@ -93,12 +93,12 @@ class Contract extends Common
93 93
             };
94 94
 		}
95 95
 		$partMap = [];
96
-		//优先级:普通筛选>高级筛选>场景
97
-        if ($requestMap['team_id']) {
98
-            //相关团队查询
99
-            $map = $requestMap;
100
-            $partMap= advancedQueryFormatForTeam($requestMap,'crm_contract','contract_id');
101
-            unset($map['team_id']);
96
+        $teamMap=$requestMap['team_id'];
97
+        //团队成员 高级筛选
98
+        if($teamMap){
99
+            $partMap= advancedQueryFormatForTeam($teamMap,'contract','contract_id');
100
+            unset($requestMap['team_id']);
101
+            $map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap;
102 102
         } else {
103 103
             $map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap;
104 104
         }
@@ -106,11 +106,11 @@ class Contract extends Common
106 106
 		$map = advancedQuery($map, 'crm', 'contract', 'index');
107 107
 		$order = ['contract.update_time desc'];	
108 108
 		$authMap = [];
109
-		if (!$partMap) {
109
+
110 110
 			$a = 'index';
111 111
 			if ($is_excel) $a = 'excelExport';
112 112
 			$auth_user_ids = $userModel->getUserByPer('crm', 'contract', $a);
113
-			if (isset($map['contract.owner_user_id']) && $map['contract.owner_user_id'][0] != 'like') {
113
+			if (isset($map['contract.owner_user_id'])) {
114 114
 				if (!is_array($map['contract.owner_user_id'][1])) {
115 115
 					$map['contract.owner_user_id'][1] = [$map['contract.owner_user_id'][1]];
116 116
 				}				
@@ -135,7 +135,7 @@ class Contract extends Common
135 135
                     };
136 136
                 }
137 137
 		    }
138
-		}
138
+
139 139
 		//合同签约人 | 与高级筛选冲突,加一个is_array判断
140 140
 		if ($map['contract.order_user_id'] && !is_array($map['contract.order_user_id'][1])) {
141 141
 			$map['contract.order_user_id'] = ['like','%,'.$map['contract.order_user_id'][1].',%'];

+ 12
- 100
application/crm/model/Customer.php ファイルの表示

@@ -59,7 +59,6 @@ class Customer extends Common
59 59
     	$getCount    = $request['getCount'];
60 60
     	$otherMap    = $request['otherMap'];
61 61
         $overdue = $request['overdue']; // 待办事项下需联系客户(逾期)
62
-
63 62
     	# 需要过滤的参数
64 63
     	$unsetRequest = ['scene_id','search','user_id','is_excel','action','order_field','order_type','is_remind','getCount','type','otherMap','poolId','overdue'];
65 64
     	foreach ($unsetRequest as $v) {
@@ -98,10 +97,12 @@ class Customer extends Common
98 97
 		# 优先级:普通筛选 > 高级筛选 > 场景
99 98
         $map = [];
100 99
         $partMap = [];
100
+        $teamMap=$requestMap['team_id'];
101 101
         //团队成员 高级筛选
102
-        if($requestMap['team_id']){
103
-            $partMap= advancedQueryFormatForTeam($requestMap,'crm_customer','customer_id');
104
-            unset($map['team_id']);
102
+        if($teamMap){
103
+            $partMap= advancedQueryFormatForTeam($teamMap,'customer','');
104
+            unset($requestMap['team_id']);
105
+            $map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap;
105 106
         }else{
106 107
             $map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap;
107 108
           
@@ -123,12 +124,11 @@ class Customer extends Common
123 124
 
124 125
         # 权限
125 126
         $authMap = [];
126
-        if (!$partMap) {
127 127
             $a = 'index';
128 128
             if ($is_excel) $a = 'excelExport';
129 129
             $auth_user_ids = $userModel->getUserByPer('crm', 'customer', $a);
130 130
             //过滤权限
131
-            if (isset($map['customer.owner_user_id']) && $map['customer.owner_user_id'][0] != 'like') {
131
+            if (isset($map['customer.owner_user_id']) ) {
132 132
                 if (!is_array($map['customer.owner_user_id'][1])) {
133 133
                     $map['customer.owner_user_id'][1] = [$map['customer.owner_user_id'][1]];
134 134
                 }
@@ -155,7 +155,7 @@ class Customer extends Common
155 155
                         });
156 156
                 };
157 157
             }
158
-        }
158
+
159 159
 
160 160
 
161 161
         # 代办事项 - 待进入公海
@@ -198,14 +198,6 @@ class Customer extends Common
198 198
 		$indexField = $fieldModel->getIndexField('crm_customer', $user_id, 1) ? : array('name'); // 列表展示字段
199 199
 		$userField = $fieldModel->getFieldByFormType('crm_customer', 'user'); // 人员类型
200 200
 		$structureField = $fieldModel->getFieldByFormType('crm_customer', 'structure'); // 部门类型
201
-        $datetimeField = $fieldModel->getFieldByFormType('crm_customer', 'datetime'); // 日期时间类型
202
-        $booleanField = $fieldModel->getFieldByFormType('crm_customer', 'boolean_value'); // 布尔值类型字段
203
-        $dateIntervalField = $fieldModel->getFieldByFormType('crm_customer', 'date_interval'); // 日期区间类型字段
204
-        $positionField = $fieldModel->getFieldByFormType('crm_customer', 'position'); // 地址类型字段
205
-        $handwritingField = $fieldModel->getFieldByFormType('crm_customer', 'handwriting_sign'); // 手写签名类型字段
206
-        $locationField = $fieldModel->getFieldByFormType('crm_customer', 'location'); // 定位类型字段
207
-        $boxField = $fieldModel->getFieldByFormType('crm_customer', 'checkbox'); // 多选类型字段
208
-        $floatField = $fieldModel->getFieldByFormType('crm_customer', 'floatnumber'); // 货币类型字段
209 201
         # 处理人员和部门类型的排序报错问题(前端传来的是包含_name的别名字段)
210 202
         $temporaryField = str_replace('_name', '', $order_field);
211 203
         if (in_array($temporaryField, $userField) || in_array($temporaryField, $structureField)) {
@@ -232,9 +224,7 @@ class Customer extends Common
232 224
         		->limit($request['offset'], $request['length'])
233 225
         		->field($indexField)
234 226
         		->orderRaw($order)
235
-                // ->fetchSql()
236 227
 				->select();
237
-
238 228
         $readAuthIds = $userModel->getUserByPer('crm', 'customer', 'read');
239 229
         $updateAuthIds = $userModel->getUserByPer('crm', 'customer', 'update');
240 230
 		$deleteAuthIds = $userModel->getUserByPer('crm', 'customer', 'delete');
@@ -250,29 +240,15 @@ class Customer extends Common
250 240
 				])
251 241
 				->group('customer_id')
252 242
 				->select();
253
-    
243
+
254 244
 			$business_count = array_column($business_count, null, 'customer_id');
255 245
 			$field_list = $fieldModel->getIndexFieldConfig('crm_customer', $user_id);
256 246
 			$field_list = array_column($field_list, 'field');
257
-   
258
-			# 扩展数据
259
-            $extraData = [];
260
-            $extraList = db('crm_customer_data')->whereIn('customer_id', $customer_id_list)->select();
261
-            foreach ($extraList AS $key => $value) {
262
-                $extraData[$value['customer_id']][$value['field']] = $value['content'];
263
-            }
264
-            $grantData = getFieldGrantData($user_id);
265
-            foreach ($grantData['crm_customer'] as $key => $value) {
266
-                foreach ($value as $ke => $va) {
267
-                    if($va['maskType']!=0){
268
-                        $fieldGrant[$ke]['maskType'] = $va['maskType'];
269
-                        $fieldGrant[$ke]['form_type'] = $va['form_type'];
270
-                        $fieldGrant[$ke]['field'] = $va['field'];
271
-                    }
272
-                }
273
-            }
247
+
274 248
             # 获取进入公海天数
275 249
             $poolDays = $this->getPoolDay($customer_id_list);
250
+            # 处理数据
251
+            $list=getFieldData($list,'crm_customer',$user_id);
276 252
             # 整理数据
277 253
 			foreach ($list AS $k => $v) {
278 254
           
@@ -281,70 +257,7 @@ class Customer extends Common
281 257
 				$list[$k]['create_user_name'] = !empty($list[$k]['create_user_id_info']['realname']) ? $list[$k]['create_user_id_info']['realname'] : '';
282 258
                 $list[$k]['owner_user_name']  = !empty($list[$k]['owner_user_id_info']['realname'])  ? $list[$k]['owner_user_id_info']['realname']  : '';
283 259
                
284
-                # 用户类型字段
285
-				foreach ($userField AS $key => $val) {
286
-					if (in_array($val, $indexField)) {
287
-                        $usernameField  = !empty($v[$val]) ? db('admin_user')->whereIn('id', stringToArray($v[$val]))->column('realname') : [];
288
-                        $list[$k][$val] = implode($usernameField, ',');
289
-					}
290
-	        	}
291
-				# 部门类型字段
292
-				foreach ($structureField AS $key => $val) {
293
-					if (in_array($val, $indexField)) {
294
-                        $structureNameField = !empty($v[$val]) ? db('admin_structure')->whereIn('id', stringToArray($v[$val]))->column('name') : [];
295
-                        $list[$k][$val] = implode($structureNameField, ',');
296
-					}
297
-				}
298
-				# 日期时间类型字段
299
-                foreach ($datetimeField AS $key => $val) {
300
-                    $list[$k][$val] = !empty($v[$val]) ? date('Y-m-d H:i:s', $v[$val]) : null;
301
-                }
302
-                // 布尔值类型字段
303
-                foreach ($booleanField AS $key => $val) {
304
-                    $list[$k][$val] = !empty($v[$val]) ? (string)$v[$val] : '0';
305
-                }
306
-                // 处理日期区间类型字段的格式
307
-                foreach ($dateIntervalField AS $key => $val) {
308
-                    $list[$k][$val] = !empty($extraData[$v['customer_id']][$val]) ? json_decode($extraData[$v['customer_id']][$val], true) : null;
309
-                }
310
-                // 处理地址类型字段的格式
311
-                foreach ($positionField AS $key => $val) {
312
-                    $list[$k][$val] = !empty($extraData[$v['customer_id']][$val]) ? json_decode($extraData[$v['customer_id']][$val], true) : null;
313
-                }
314
-                // 手写签名类型字段
315
-                foreach ($handwritingField AS $key => $val) {
316
-                    $handwritingData = !empty($v[$val]) ? db('admin_file')->where('file_id', $v[$val])->value('file_path') : null;
317
-                    $list[$k][$val] = ['url' => !empty($handwritingData) ? getFullPath($handwritingData) : null];
318
-                }
319
-                // 定位类型字段
320
-                foreach ($locationField AS $key => $val) {
321
-                    $list[$k][$val] = !empty($extraData[$v['customer_id']][$val]) ? json_decode($extraData[$v['customer_id']][$val], true) : null;
322
-                }
323
-                // 多选框类型字段
324
-                foreach ($boxField AS $key => $val) {
325
-                    $list[$k][$val] = !empty($v[$val]) ? trim($v[$val], ',') : null;
326
-                }
327
-                // 货币类型字段
328
-                foreach ($floatField AS $key => $val) {
329
-                    $list[$k][$val] = $v[$val]!='0.00' ? (string)$v[$val] : null;
330
-                }
331
-                //掩码相关类型字段
332
-                foreach ($fieldGrant AS $key => $val){
333
-                    //掩码相关类型字段
334
-                    if ($val['maskType']!=0 && $val['form_type'] == 'mobile') {
335
-                        $pattern = "/(1[3458]{1}[0-9])[0-9]{4}([0-9]{4})/i";
336
-                        $rs = preg_replace($pattern, "$1****$2", $v[$val['field']]);
337
-                        $list[$k][$val['field']] = !empty($v[$val['field']]) ? (string)$rs : null;
338
-                    } elseif ($val['maskType']!=0 && $val['form_type'] == 'email') {
339
-                        $email_array = explode("@", $v[$val['field']]);
340
-                        $prevfix = (strlen($email_array[0]) < 4) ? "" : substr($v[$val['field']], 0, 2); //邮箱前缀
341
-                        $str = preg_replace('/([\d\w+_-]{0,100})@/', "***@", $v[$val['field']], -1, $count);
342
-                        $rs = $prevfix . $str;
343
-                        $list[$k][$val['field']] = !empty($v[$val['field']]) ?$rs: null;
344
-                    } elseif ($val['maskType']!=0 && in_array($val['form_type'],['position','floatnumber'])) {
345
-                        $list[$k][$val['field']] = !empty($v[$val['field']]) ? (string)substr_replace($v[$val['field']], '*****',0,strlen($v[$val['field']])) : null;
346
-                    }
347
-                }
260
+
348 261
 				# 商机数
349 262
 				$list[$k]['business_count'] = $business_count[$v['customer_id']]['count'] ?: 0;
350 263
 	        	# 权限
@@ -551,7 +464,6 @@ class Customer extends Common
551 464
                 }
552 465
             }
553 466
         }
554
-//        p($customerData);
555 467
         # 设置今日需联系客户
556 468
         if (!empty($param['next_time']) && $param['next_time'] >= strtotime(date('Y-m-d 00:00:00'))) $param['is_dealt'] = 0;
557 469
         $pool_id = !empty($param['pool_id']) ? $param['pool_id'] : 0;

+ 9
- 9
application/crm/model/Receivables.php ファイルの表示

@@ -86,12 +86,12 @@ class Receivables extends Common
86 86
         }
87 87
         $partMap = [];
88 88
         //优先级:普通筛选>高级筛选>场景
89
-        //优先级:普通筛选>高级筛选>场景
90
-        if ($requestMap['team_id']) {
91
-            //相关团队查询
92
-            $map = $requestMap;
93
-            $partMap= advancedQueryFormatForTeam($requestMap,'crm_receivables','receivables_id');
94
-            unset($map['team_id']);
89
+        $teamMap=$requestMap['team_id'];
90
+        //团队成员 高级筛选
91
+        if($teamMap){
92
+            $partMap= advancedQueryFormatForTeam($teamMap,'receivables','');
93
+            unset($requestMap['team_id']);
94
+            $map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap;
95 95
         } else {
96 96
             $map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap;
97 97
         }
@@ -100,9 +100,9 @@ class Receivables extends Common
100 100
 
101 101
         //权限
102 102
         $authMap = [];
103
-        if (!$partMap) {
103
+
104 104
             $auth_user_ids = $userModel->getUserByPer('crm', 'receivables', 'index');
105
-            if (isset($map['receivables.owner_user_id']) && $map['receivables.owner_user_id'][0] != 'like') {
105
+            if (isset($map['receivables.owner_user_id'])) {
106 106
                 if (!is_array($map['receivables.owner_user_id'][1])) {
107 107
                     $map['receivables.owner_user_id'][1] = [$map['receivables.owner_user_id'][1]];
108 108
                 }
@@ -128,7 +128,7 @@ class Receivables extends Common
128 128
                     };
129 129
                 }
130 130
             }
131
-        }
131
+
132 132
         //列表展示字段
133 133
         $indexField = $fieldModel->getIndexField('crm_receivables', $user_id, 1) ?: array('number');
134 134
         //人员类型

+ 12
- 10
application/crm/model/ReceivablesPlan.php ファイルの表示

@@ -16,6 +16,7 @@ use think\Validate;
16 16
 
17 17
 class ReceivablesPlan extends Common
18 18
 {
19
+    use FieldVerificationTrait;
19 20
 	/**
20 21
      * 为了数据库的整洁,同时又不影响Model和Controller的名称
21 22
      * 我们约定每个模块的数据表都加上相同的前缀,比如CRM模块用crm作为数据表前缀
@@ -162,19 +163,20 @@ class ReceivablesPlan extends Common
162 163
             ->join('__CRM_CUSTOMER__ customer', 'receivables_plan.customer_id = customer.customer_id', 'LEFT')
163 164
             ->join('__CRM_RECEIVABLES__ receivables', 'receivables_plan.plan_id = receivables.plan_id', 'LEFT')
164 165
             ->limit($request['offset'], $request['length'])
165
-            ->field(array_merge($indexField, [
166
-                'customer.name' => 'customer_name',
167
-                'receivables.receivables_id' => 'receivables_id',
168
-                'receivables.check_status' => 'check_status',
169
-                'contract.num ' => 'contract_name',
170
-                'ifnull(SUM(receivables_plan.money), 0)' => 'done_money',//计划回款总金额
171
-                '(ifnull(SUM(receivables.money), 0)-SUM( real_money))' => 'un_money',//未回款总金额
172
-                'SUM(real_money) AS real_money'//实际回款总金额
173
-            ]))
166
+//            ->field(array_merge($indexField, [
167
+//                'customer.name' => 'customer_name',
168
+//                'receivables.receivables_id' => 'receivables_id',
169
+//                'receivables.check_status' => 'check_status',
170
+//                'contract.num ' => 'contract_name',
171
+//                'ifnull(SUM(receivables_plan.money), 0)' => 'done_money',//计划回款总金额
172
+//                '(ifnull(SUM(receivables.money), 0)-SUM( real_money))' => 'un_money',//未回款总金额
173
+//                'SUM(real_money) AS real_money'//实际回款总金额
174
+//            ]))
175
+            ->field('receivables_plan.*,customer.name as customer_name,contract.num as contract_name,receivables.receivables_id,receivables.check_status')
174 176
             ->where($map)
175 177
             ->where($sceneMap)
176 178
             ->where($whereData)
177
-            ->group('receivables_plan.contract_id')
179
+//            ->group('receivables_plan.contract_id')
178 180
             ->orderRaw($order)
179 181
             ->select();
180 182
         $grantData = getFieldGrantData($user_id);

+ 1
- 1
config/config.php ファイルの表示

@@ -187,7 +187,7 @@ return [
187 187
         // 端口
188 188
         'port' => 6379,
189 189
         // 密码
190
-        'password' => '',
190
+        'password' => '123456',
191 191
         // 缓存前缀
192 192
         'prefix' => '',
193 193
         // 缓存有效期 0表示永久缓存

+ 16
- 0
config/route_admin.php ファイルの表示

@@ -15,6 +15,10 @@ return [
15 15
     'admin/install/step2' => ['admin/install/step2', ['method' => 'GET']],
16 16
     'admin/install/step3' => ['admin/install/step3', ['method' => 'GET']],
17 17
  	'admin/install/step4' => ['admin/install/step4', ['method' => 'POST|AJAX']],
18
+ 	'admin/install/step7' => ['admin/install/step7', ['method' => 'POST|AJAX']],
19
+ 	'admin/install/step8' => ['admin/install/step8', ['method' => 'POST|AJAX']],
20
+ 	'admin/install/step10' => ['admin/install/step10', ['method' => 'POST|AJAX']],
21
+ 	'admin/install/step11' => ['admin/install/step11', ['method' => 'POST|AJAX']],
18 22
     'admin/install/step5' => ['admin/install/step5', ['method' => 'GET']],
19 23
     'admin/install/step6' => ['admin/install/step6', ['method' => 'GET']],
20 24
  	'admin/install/progress' => ['admin/install/progress', ['method' => 'POST']],
@@ -367,6 +371,18 @@ return [
367 371
     'admin/market/getField' => ['admin/market/getField', ['method' => 'POST']],
368 372
     //【市场活动】市场活动自定义字段表单
369 373
     'admin/market/updateFields' => ['admin/market/updateFields', ['method' => 'POST']],
374
+
375
+    //【审批流】业务审批流
376
+    'admin/examine/index' => ['admin/examine/index', ['method' => 'POST']],
377
+    //【审批流】业务审批流详情
378
+    'admin/examine/read' => ['admin/examine/read', ['method' => 'POST']],
379
+    //【审批流】业务审批流添加
380
+    'admin/examine/save' => ['admin/examine/save', ['method' => 'POST']],
381
+    //【审批流】预览审批条件
382
+    'admin/examine/previewFiledName' => ['admin/examine/previewFiledName', ['method' => 'POST']],
383
+    //【审批流】预览检查流
384
+    'admin/examine/previewExamineFlow' => ['admin/examine/previewExamineFlow', ['method' => 'POST']],
385
+    
370 386
 	// MISS路由
371 387
 	'__miss__'  => 'admin/base/miss',
372 388
 ];

+ 2
- 2
config/version.php ファイルの表示

@@ -1,5 +1,5 @@
1 1
 <?php
2 2
 return array(
3
-'VERSION'=>'11.1.1',
4
-'RELEASE'=>'20210903',
3
+'VERSION'=>'11.1.2',
4
+'RELEASE'=>'20220715',
5 5
 );

+ 17
- 0
public/sql/5kcrm.sql ファイルの表示

@@ -521,6 +521,23 @@ CREATE TABLE `5kcrm_admin_login_record`  (
521 521
 -- Records of 5kcrm_admin_login_record
522 522
 -- ----------------------------
523 523
 
524
+-- ----------------------------
525
+-- Records of 5kcrm_admin_market
526
+-- ----------------------------
527
+DROP TABLE IF EXISTS `5kcrm_admin_market`;
528
+CREATE TABLE `5kcrm_admin_market`  (
529
+    `market_field_id` int(11) NOT NULL AUTO_INCREMENT,
530
+    `status` tinyint(2) NOT NULL DEFAULT 1 COMMENT '0 停用 1启用',
531
+    `update_user_id` int(11) NULL DEFAULT NULL COMMENT '最后修改人',
532
+    `create_time` int(11) NOT NULL COMMENT '创建时间',
533
+    `update_time` int(11) NOT NULL COMMENT '修改时间',
534
+    `title` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '表单名称',
535
+    PRIMARY KEY (`market_field_id`) USING BTREE
536
+) ENGINE = InnoDB AUTO_INCREMENT = 63 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '系统设置 活动表单' ROW_FORMAT = Dynamic;
537
+-- ----------------------------
538
+-- Table structure for 5kcrm_admin_market
539
+-- ----------------------------
540
+
524 541
 -- ----------------------------
525 542
 -- Table structure for 5kcrm_admin_menu
526 543
 -- ----------------------------

+ 497
- 0
public/sql/5kcrm1.sql ファイルの表示

@@ -0,0 +1,497 @@
1
+/*
2
+ Navicat Premium Data Transfer
3
+
4
+ Source Server         : localhost
5
+ Source Server Type    : MySQL
6
+ Source Server Version : 50726
7
+ Source Host           : localhost:3306
8
+ Source Schema         : multi_field
9
+
10
+ Target Server Type    : MySQL
11
+ Target Server Version : 50726
12
+ File Encoding         : 65001
13
+
14
+ Date: 23/06/2021 17:58:30
15
+*/
16
+
17
+SET NAMES utf8mb4;
18
+SET FOREIGN_KEY_CHECKS = 0;
19
+
20
+-- ----------------------------
21
+-- Table structure for 5kcrm_admin_access
22
+-- ----------------------------
23
+DROP TABLE IF EXISTS `5kcrm_admin_access`;
24
+CREATE TABLE `5kcrm_admin_access`  (
25
+  `user_id` int(11) NOT NULL,
26
+  `group_id` int(11) NOT NULL
27
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
28
+
29
+-- ----------------------------
30
+-- Records of 5kcrm_admin_access
31
+-- ----------------------------
32
+INSERT INTO `5kcrm_admin_access` VALUES (1, 1);
33
+
34
+-- ----------------------------
35
+-- Table structure for 5kcrm_admin_action_log
36
+-- ----------------------------
37
+DROP TABLE IF EXISTS `5kcrm_admin_action_log`;
38
+CREATE TABLE `5kcrm_admin_action_log`  (
39
+  `log_id` int(11) NOT NULL AUTO_INCREMENT,
40
+  `user_id` int(10) NOT NULL COMMENT '操作人ID',
41
+  `module_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '模块',
42
+  `controller_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '控制器',
43
+  `action_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '方法',
44
+  `action_id` int(10) NOT NULL COMMENT '操作ID',
45
+  `target_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '被操作对象的名称',
46
+  `action_delete` tinyint(1) NOT NULL DEFAULT 0 COMMENT '1为删除操作',
47
+  `content` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '操作内容',
48
+  `create_time` int(11) NOT NULL COMMENT '操作时间',
49
+  `join_user_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '抄送人IDs',
50
+  `structure_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '抄送部门IDs',
51
+  `client_ip` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
52
+  PRIMARY KEY (`log_id`) USING BTREE
53
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '操作记录表' ROW_FORMAT = DYNAMIC;
54
+
55
+-- ----------------------------
56
+-- Records of 5kcrm_admin_action_log
57
+-- ----------------------------
58
+
59
+-- ----------------------------
60
+-- Table structure for 5kcrm_admin_action_record
61
+-- ----------------------------
62
+DROP TABLE IF EXISTS `5kcrm_admin_action_record`;
63
+CREATE TABLE `5kcrm_admin_action_record`  (
64
+  `id` int(11) NOT NULL AUTO_INCREMENT,
65
+  `user_id` int(10) NOT NULL COMMENT '用户ID',
66
+  `create_time` int(11) NOT NULL COMMENT '创建时间',
67
+  `types` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '类型',
68
+  `action_id` int(11) NOT NULL COMMENT '操作ID',
69
+  `content` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '内容',
70
+  PRIMARY KEY (`id`) USING BTREE
71
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '字段操作记录表' ROW_FORMAT = DYNAMIC;
72
+
73
+-- ----------------------------
74
+-- Records of 5kcrm_admin_action_record
75
+-- ----------------------------
76
+
77
+-- ----------------------------
78
+-- Table structure for 5kcrm_admin_comment
79
+-- ----------------------------
80
+DROP TABLE IF EXISTS `5kcrm_admin_comment`;
81
+CREATE TABLE `5kcrm_admin_comment`  (
82
+  `comment_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '评论表',
83
+  `user_id` int(11) NOT NULL COMMENT '评论人ID',
84
+  `content` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '内容(答案)',
85
+  `reply_content` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '回复内容(问题)',
86
+  `create_time` int(11) NOT NULL COMMENT '新建时间',
87
+  `isreply` tinyint(2) NULL DEFAULT 0 COMMENT '是否是回复 1 是 0 否',
88
+  `reply_user_id` int(11) NOT NULL DEFAULT 0,
89
+  `reply_id` int(11) NULL DEFAULT 0 COMMENT '回复对象ID',
90
+  `status` tinyint(2) NULL DEFAULT 1 COMMENT '状态 ',
91
+  `type_id` int(11) NULL DEFAULT 0 COMMENT '评论项目任务ID 或评论其他模块ID',
92
+  `favour` int(7) NULL DEFAULT 0 COMMENT '赞',
93
+  `type` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '分类 ',
94
+  `reply_fid` int(11) NOT NULL DEFAULT 0 COMMENT '回复最上级ID',
95
+  PRIMARY KEY (`comment_id`) USING BTREE
96
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '任务评论表' ROW_FORMAT = DYNAMIC;
97
+
98
+-- ----------------------------
99
+-- Records of 5kcrm_admin_comment
100
+-- ----------------------------
101
+
102
+-- ----------------------------
103
+-- Table structure for 5kcrm_admin_config
104
+-- ----------------------------
105
+DROP TABLE IF EXISTS `5kcrm_admin_config`;
106
+CREATE TABLE `5kcrm_admin_config`  (
107
+  `id` int(11) NOT NULL AUTO_INCREMENT,
108
+  `name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '名字',
109
+  `status` tinyint(2) NOT NULL COMMENT '状态',
110
+  `module` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '模型',
111
+  `controller` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '控制器',
112
+  `type` tinyint(2) NOT NULL COMMENT '类型:1已发布,2未发布,3增值',
113
+  `pid` tinyint(4) NOT NULL COMMENT '父级ID',
114
+  PRIMARY KEY (`id`) USING BTREE
115
+) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
116
+
117
+-- ----------------------------
118
+-- Records of 5kcrm_admin_config
119
+-- ----------------------------
120
+INSERT INTO `5kcrm_admin_config` VALUES (1, '任务审批', 1, 'taskExamine', '', 1, 0);
121
+INSERT INTO `5kcrm_admin_config` VALUES (2, '客户管理', 1, 'crm', '', 1, 0);
122
+INSERT INTO `5kcrm_admin_config` VALUES (3, '项目管理', 1, 'work', '', 1, 0);
123
+INSERT INTO `5kcrm_admin_config` VALUES (4, '人力资源管理', 1, 'hrm', '', 2, 0);
124
+INSERT INTO `5kcrm_admin_config` VALUES (5, '进销存管理', 1, 'jxc', '', 2, 0);
125
+INSERT INTO `5kcrm_admin_config` VALUES (6, '呼叫中心功能', 1, 'call', '', 3, 0);
126
+INSERT INTO `5kcrm_admin_config` VALUES (7, '日志', 1, 'log', '', 1, 0);
127
+INSERT INTO `5kcrm_admin_config` VALUES (8, '通讯录', 1, 'book', '', 1, 0);
128
+INSERT INTO `5kcrm_admin_config` VALUES (9, '日历', 1, 'calendar', '', 1, 0);
129
+INSERT INTO `5kcrm_admin_config` VALUES (10, '邮箱', 1, 'email', '', 2, 0);
130
+INSERT INTO `5kcrm_admin_config` VALUES (11, '知识库', 1, 'knowledge', '', 2, 0);
131
+
132
+-- ----------------------------
133
+-- Table structure for 5kcrm_admin_examine_flow
134
+-- ----------------------------
135
+DROP TABLE IF EXISTS `5kcrm_admin_examine_flow`;
136
+CREATE TABLE `5kcrm_admin_examine_flow`  (
137
+  `flow_id` int(11) NOT NULL AUTO_INCREMENT,
138
+  `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '审批流名称',
139
+  `config` tinyint(4) NOT NULL COMMENT '1固定审批0授权审批',
140
+  `types` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '关联对象',
141
+  `types_id` tinyint(4) NOT NULL DEFAULT 0 COMMENT '对象ID(如审批类型ID)',
142
+  `structure_ids` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '部门ID(0为全部)',
143
+  `user_ids` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '员工ID',
144
+  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '流程说明',
145
+  `update_user_id` int(11) NOT NULL COMMENT '修改人ID',
146
+  `create_time` int(11) NOT NULL COMMENT '创建时间',
147
+  `update_time` int(11) NOT NULL COMMENT '更新时间',
148
+  `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '状态 1启用,0禁用',
149
+  `is_deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '状态 1删除',
150
+  `delete_time` int(11) NOT NULL DEFAULT 0 COMMENT '删除时间',
151
+  `delete_user_id` int(11) NOT NULL DEFAULT 0 COMMENT '删除人ID',
152
+  PRIMARY KEY (`flow_id`) USING BTREE
153
+) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '审批流程表' ROW_FORMAT = DYNAMIC;
154
+
155
+-- ----------------------------
156
+-- Records of 5kcrm_admin_examine_flow
157
+-- ----------------------------
158
+INSERT INTO `5kcrm_admin_examine_flow` VALUES (1, '普通审批流程', 0, 'oa_examine', 1, '', '', '', 1, 1548835446, 1548835446, 1, 0, 0, 0);
159
+INSERT INTO `5kcrm_admin_examine_flow` VALUES (2, '请假审批流程', 0, 'oa_examine', 2, '', '', '', 1, 1548835717, 1548835717, 1, 0, 0, 0);
160
+INSERT INTO `5kcrm_admin_examine_flow` VALUES (3, '出差审批流程', 0, 'oa_examine', 3, '', '', '', 1, 1549959653, 1549959653, 1, 0, 0, 0);
161
+INSERT INTO `5kcrm_admin_examine_flow` VALUES (4, '加班审批流程', 0, 'oa_examine', 4, '', '', '', 1, 1549959653, 1549959653, 1, 0, 0, 0);
162
+INSERT INTO `5kcrm_admin_examine_flow` VALUES (5, '差旅审批流程', 0, 'oa_examine', 5, '', '', '', 1, 1549959653, 1549959653, 1, 0, 0, 0);
163
+INSERT INTO `5kcrm_admin_examine_flow` VALUES (6, '借款审批流程', 0, 'oa_examine', 6, '', '', '', 1, 1549959653, 1549959653, 1, 0, 0, 0);
164
+INSERT INTO `5kcrm_admin_examine_flow` VALUES (10, '发票审批流程', 0, 'crm_invoice', 0, '', '', '', 1, 1620610740, 1620610740, 1, 0, 0, 0);
165
+INSERT INTO `5kcrm_admin_examine_flow` VALUES (11, '合同审批流程', 0, 'crm_contract', 0, '', '', '', 1, 1620610745, 1620610745, 1, 0, 0, 0);
166
+INSERT INTO `5kcrm_admin_examine_flow` VALUES (12, '回款审批流程', 0, 'crm_receivables', 0, '', '', '', 1, 1620610748, 1620610748, 1, 0, 0, 0);
167
+
168
+-- ----------------------------
169
+-- Table structure for 5kcrm_admin_examine_record
170
+-- ----------------------------
171
+DROP TABLE IF EXISTS `5kcrm_admin_examine_record`;
172
+CREATE TABLE `5kcrm_admin_examine_record`  (
173
+  `record_id` int(11) NOT NULL AUTO_INCREMENT,
174
+  `types` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '类型',
175
+  `types_id` int(11) NOT NULL DEFAULT 0 COMMENT '类型ID',
176
+  `flow_id` int(11) NOT NULL DEFAULT 0 COMMENT '审批流程ID',
177
+  `order_id` int(11) NOT NULL DEFAULT 0 COMMENT '审批排序ID',
178
+  `check_user_id` int(11) NOT NULL DEFAULT 0 COMMENT '审批人ID',
179
+  `check_time` int(11) NOT NULL COMMENT '审批时间',
180
+  `status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '1审核通过0审核失败2撤销',
181
+  `content` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '审核意见',
182
+  `is_end` tinyint(1) NOT NULL DEFAULT 0 COMMENT '审批失效(1标记为无效)',
183
+  PRIMARY KEY (`record_id`) USING BTREE
184
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '审批记录表' ROW_FORMAT = DYNAMIC;
185
+
186
+-- ----------------------------
187
+-- Records of 5kcrm_admin_examine_record
188
+-- ----------------------------
189
+
190
+-- ----------------------------
191
+-- Table structure for 5kcrm_admin_examine_step
192
+-- ----------------------------
193
+DROP TABLE IF EXISTS `5kcrm_admin_examine_step`;
194
+CREATE TABLE `5kcrm_admin_examine_step`  (
195
+  `step_id` int(11) NOT NULL AUTO_INCREMENT,
196
+  `flow_id` int(11) NOT NULL COMMENT '审批流程ID',
197
+  `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '1负责人主管,2指定用户(任意一人),3指定用户(多人会签),4上一级审批人主管',
198
+  `user_id` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '审批人ID (使用逗号隔开) ,1,2,',
199
+  `order_id` tinyint(4) NOT NULL DEFAULT 1 COMMENT '排序ID',
200
+  `relation` tinyint(1) NOT NULL DEFAULT 1 COMMENT '审批流程关系(1并2或)',
201
+  `create_time` int(11) NOT NULL COMMENT '创建时间',
202
+  PRIMARY KEY (`step_id`) USING BTREE
203
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '审批步骤表' ROW_FORMAT = DYNAMIC;
204
+
205
+-- ----------------------------
206
+-- Records of 5kcrm_admin_examine_step
207
+-- ----------------------------
208
+
209
+-- ----------------------------
210
+-- Table structure for 5kcrm_admin_field
211
+-- ----------------------------
212
+DROP TABLE IF EXISTS `5kcrm_admin_field`;
213
+CREATE TABLE `5kcrm_admin_field`  (
214
+  `field_id` int(11) NOT NULL AUTO_INCREMENT,
215
+  `types` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '分类',
216
+  `types_id` int(11) NOT NULL DEFAULT 0 COMMENT '分类ID(审批等)',
217
+  `field` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段名',
218
+  `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '标识名',
219
+  `form_type` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段类型',
220
+  `default_value` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '默认值',
221
+  `max_length` int(4) NOT NULL DEFAULT 0 COMMENT ' 字数上限',
222
+  `is_unique` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否唯一(1是,0否)',
223
+  `is_null` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否必填(1是,0否)',
224
+  `input_tips` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '输入提示',
225
+  `setting` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '设置',
226
+  `order_id` int(4) NOT NULL DEFAULT 0 COMMENT '排序ID',
227
+  `operating` int(10) NOT NULL DEFAULT 0 COMMENT '0改删,1改,2删,3无',
228
+  `create_time` int(11) NOT NULL COMMENT '创建时间',
229
+  `update_time` int(11) NOT NULL COMMENT '更新时间',
230
+  `type` int(2) NOT NULL DEFAULT 0 COMMENT '薪资管理 1固定 2增加 3减少',
231
+  `relevant` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '相关字段名',
232
+  `is_hidden` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否隐藏:1隐藏;0不隐藏',
233
+  `style_percent` tinyint(4) UNSIGNED NOT NULL DEFAULT 100 COMMENT '字段宽度百分比:25、50、75、100',
234
+  `form_position` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '坐标,第一个数字表示坐标x,第二个数字表示坐标y',
235
+  `precisions` tinyint(4) UNSIGNED NULL DEFAULT NULL COMMENT '1、小数的精度,允许的最大小数位数,默认为null,表示不启用小数。2、也包含其他数据选项,如:明细表格的显示方式',
236
+  `max_num_restrict` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '数字类字段的最大数,所填写的数字不能大于这个字段的值,默认为null',
237
+  `min_num_restrict` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '数字类字段的最小数,所填写的数字不能小于这个字段的值,默认为null',
238
+  `remark` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '字段说明',
239
+  `options` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '如果类型是选项,此处不能为空,多个选项以,隔开,此处的数据是用于控制其他字段是否显示的逻辑表单',
240
+  `formAssistId` int(10) NULL DEFAULT NULL COMMENT '逻辑表单相关,由前端生成',
241
+  PRIMARY KEY (`field_id`) USING BTREE
242
+) ENGINE = InnoDB AUTO_INCREMENT = 950 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '自定义字段表' ROW_FORMAT = DYNAMIC;
243
+
244
+-- ----------------------------
245
+-- Records of 5kcrm_admin_field
246
+-- ----------------------------
247
+INSERT INTO `5kcrm_admin_field` VALUES (1, '', 0, 'create_user_id', '创建人', 'user', '', 0, 0, 0, '', '', 99, 0, 1553788800, 1553788800, 0, NULL, 0, 100, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
248
+INSERT INTO `5kcrm_admin_field` VALUES (2, '', 0, 'update_time', '更新时间', 'datetime', '', 0, 0, 0, '', '', 100, 0, 1553788800, 1553788800, 0, NULL, 0, 100, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
249
+INSERT INTO `5kcrm_admin_field` VALUES (3, '', 0, 'create_time', '创建时间', 'datetime', '', 0, 0, 0, '', '', 101, 0, 1553788800, 1553788800, 0, NULL, 0, 100, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
250
+INSERT INTO `5kcrm_admin_field` VALUES (4, '', 0, 'owner_user_id', '负责人', 'user', '', 0, 0, 0, '', '', 102, 0, 1553788800, 1553788800, 0, NULL, 0, 100, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
251
+INSERT INTO `5kcrm_admin_field` VALUES (5, 'crm_leads', 0, 'name', '线索名称', 'text', '', 0, 1, 1, '', '', 1, 189, 1553788800, 1624438964, 1, '', 0, 100, '0,0', 0, '', '', '', '', 0);
252
+INSERT INTO `5kcrm_admin_field` VALUES (6, 'crm_leads', 0, 'source', '线索来源', 'select', '', 0, 0, 0, '', '促销活动\n搜索引擎\n广告\n转介绍\n线上注册\n线上询价\n预约上门\n陌拜\n招商资源\n公司资源\n展会资源\n个人资源\n电话咨询\n邮件咨询', 4, 191, 1553788800, 1624438964, 3, '', 0, 50, '2,0', 2, '', '', '', '促销活动,搜索引擎,广告,转介绍,线上注册,线上询价,预约上门,陌拜,招商资源,公司资源,展会资源,个人资源,电话咨询,邮件咨询', 1001);
253
+INSERT INTO `5kcrm_admin_field` VALUES (7, 'crm_leads', 0, 'telephone', '电话', 'text', '', 0, 0, 0, '', '', 6, 191, 1553788800, 1624438964, 1, '', 0, 50, '3,0', 0, '', '', '', '', 1004);
254
+INSERT INTO `5kcrm_admin_field` VALUES (8, 'crm_leads', 0, 'mobile', '手机', 'mobile', '', 0, 1, 0, '', '', 7, 191, 1553788800, 1624438964, 7, '', 0, 50, '3,1', 0, '', '', '', '', 1005);
255
+INSERT INTO `5kcrm_admin_field` VALUES (9, 'crm_leads', 0, 'industry', '客户行业', 'select', '', 0, 0, 0, '', 'IT/通信/电子/互联网\n金融业\n房地产\n商业服务\n贸易\n生产\n运输/物流\n服务业\n文化传媒\n政府', 2, 191, 1553788800, 1624438964, 3, '', 0, 50, '1,0', 2, '', '', 'options_type', '{\"IT/通信/电子/互联网\":[],\"金融业\":[],\"房地产\":[],\"商业服务\":[],\"贸易\":[],\"生产\":[],\"运输/物流\":[],\"服务业\":[],\"文化传媒\":[],\"政府\":[]}', 1002);
256
+INSERT INTO `5kcrm_admin_field` VALUES (10, 'crm_leads', 0, 'level', '客户级别', 'select', '', 0, 0, 0, '', 'A(重点客户)\nB(普通客户)\nC(非优先客户)\n其他', 3, 191, 1553788800, 1624438964, 3, '', 0, 50, '1,1', 2, '', '', '', 'A(重点客户),B(普通客户),C(非优先客户),其他', 1003);
257
+INSERT INTO `5kcrm_admin_field` VALUES (11, 'crm_leads', 0, 'detail_address', '地址', 'text', '', 0, 0, 0, '', '', 9, 191, 1553788800, 1624438964, 1, '', 0, 50, '4,1', 0, '', '', '', '', 1007);
258
+INSERT INTO `5kcrm_admin_field` VALUES (12, 'crm_leads', 0, 'next_time', '下次联系时间', 'datetime', '', 0, 0, 0, '', '', 5, 63, 1553788800, 1624438964, 13, '', 0, 50, '2,1', 0, '', '', '', '', 1008);
259
+INSERT INTO `5kcrm_admin_field` VALUES (13, 'crm_leads', 0, 'remark', '备注', 'textarea', '', 0, 0, 0, '', '', 10, 191, 1553788800, 1624438964, 2, '', 0, 100, '5,0', 0, '', '', '', '', 1009);
260
+INSERT INTO `5kcrm_admin_field` VALUES (14, 'crm_customer', 0, 'name', '客户名称', 'text', '', 0, 1, 1, '', '', 1, 189, 1553788800, 1624439031, 1, '', 0, 50, '0,0', 0, '', '', '', '', 0);
261
+INSERT INTO `5kcrm_admin_field` VALUES (15, 'crm_customer', 0, 'level', '客户级别', 'select', '', 0, 0, 0, '', 'A(重点客户)\nB(普通客户)\nC(非优先客户)', 3, 191, 1553788800, 1624439032, 3, '', 0, 50, '1,0', 2, '', '', '', 'A(重点客户),B(普通客户),C(非优先客户)', 0);
262
+INSERT INTO `5kcrm_admin_field` VALUES (16, 'crm_customer', 0, 'industry', '客户行业', 'select', '', 0, 0, 0, '', 'IT/通信/电子/互联网\n金融业\n房地产\n商业服务\n贸易\n生产\n运输/物流\n服务业\n文化传媒\n政府', 2, 191, 1553788800, 1624439031, 3, '', 0, 50, '0,1', 2, '', '', '', 'IT/通信/电子/互联网,金融业,房地产,商业服务,贸易,生产,运输/物流,服务业,文化传媒,政府', 1025);
263
+INSERT INTO `5kcrm_admin_field` VALUES (17, 'crm_customer', 0, 'source', '客户来源', 'select', '', 0, 0, 0, '', '促销活动\n搜索引擎\n广告\n转介绍\n线上注册\n线上询价\n预约上门\n陌拜\n招商资源\n公司资源\n展会资源\n个人资源\n电话咨询\n邮件咨询', 4, 191, 1553788800, 1624439032, 3, '', 0, 50, '1,1', 2, '', '', '', '促销活动,搜索引擎,广告,转介绍,线上注册,线上询价,预约上门,陌拜,招商资源,公司资源,展会资源,个人资源,电话咨询,邮件咨询', 1026);
264
+INSERT INTO `5kcrm_admin_field` VALUES (18, 'crm_customer', 0, 'deal_status', '成交状态', 'select', '未成交', 0, 0, 1, '', '未成交\n已成交', 0, 191, 1553788800, 1553788800, 0, NULL, 0, 100, '', NULL, NULL, NULL, NULL, NULL, NULL);
265
+INSERT INTO `5kcrm_admin_field` VALUES (19, 'crm_customer', 0, 'telephone', '电话', 'text', '', 0, 0, 0, '', '', 5, 191, 1553788800, 1624439032, 1, '', 0, 50, '2,0', 0, '', '', '', '', 1027);
266
+INSERT INTO `5kcrm_admin_field` VALUES (20, 'crm_customer', 0, 'website', '网址', 'text', '', 0, 0, 0, '', '', 8, 191, 1553788800, 1624439032, 1, '', 0, 50, '3,1', 0, '', '', '', '', 1028);
267
+INSERT INTO `5kcrm_admin_field` VALUES (21, 'crm_customer', 0, 'next_time', '下次联系时间', 'datetime', '', 0, 0, 0, '', '', 9, 63, 1553788800, 1624439032, 13, '', 0, 50, '4,0', 0, '', '', '', '', 1029);
268
+INSERT INTO `5kcrm_admin_field` VALUES (22, 'crm_customer', 0, 'remark', '备注', 'textarea', '', 0, 0, 0, '', '', 10, 191, 1553788800, 1624439032, 2, '', 0, 50, '4,1', 0, '', '', '', '', 1030);
269
+INSERT INTO `5kcrm_admin_field` VALUES (23, 'crm_contacts', 0, 'name', '姓名', 'text', '', 0, 1, 1, '', '', 1, 181, 1553788800, 1624439123, 1, '', 0, 50, '0,0', 0, '', '', '', '', 1001);
270
+INSERT INTO `5kcrm_admin_field` VALUES (24, 'crm_contacts', 0, 'customer_id', '客户名称', 'customer', '', 0, 0, 1, '', '', 2, 191, 1553788800, 1624439123, 15, '', 0, 50, '0,1', 0, '', '', '', '', 1002);
271
+INSERT INTO `5kcrm_admin_field` VALUES (25, 'crm_contacts', 0, 'mobile', '手机', 'mobile', '', 0, 0, 0, '', '', 3, 191, 1553788800, 1624439123, 7, '', 0, 50, '1,0', 0, '', '', '', '', 1003);
272
+INSERT INTO `5kcrm_admin_field` VALUES (26, 'crm_contacts', 0, 'telephone', '电话', 'text', '', 0, 0, 0, '', '', 4, 191, 1553788800, 1624439123, 1, '', 0, 50, '1,1', 0, '', '', '', '', 1004);
273
+INSERT INTO `5kcrm_admin_field` VALUES (27, 'crm_contacts', 0, 'email', '电子邮箱', 'email', '', 0, 0, 0, '', '', 7, 191, 1553788800, 1624439123, 14, '', 0, 50, '3,0', 0, '', '', '', '', 1007);
274
+INSERT INTO `5kcrm_admin_field` VALUES (28, 'crm_contacts', 0, 'decision', '是否关键决策人', 'select', '', 0, 0, 0, '', '是\n否', 5, 190, 1553788800, 1624439123, 3, '', 0, 50, '2,0', 2, '', '', '', '\"\"', 1005);
275
+INSERT INTO `5kcrm_admin_field` VALUES (29, 'crm_contacts', 0, 'post', '职务', 'text', '', 0, 0, 0, '', '', 6, 191, 1553788800, 1624439123, 1, '', 0, 50, '2,1', 0, '', '', '', '', 1006);
276
+INSERT INTO `5kcrm_admin_field` VALUES (30, 'crm_contacts', 0, 'sex', '性别', 'select', '', 0, 0, 0, '', '男\n女', 9, 191, 1553788800, 1624439123, 3, '', 0, 50, '4,0', 2, '', '', '', '\"\"', 1009);
277
+INSERT INTO `5kcrm_admin_field` VALUES (31, 'crm_contacts', 0, 'detail_address', '地址', 'text', '', 0, 0, 0, '', '', 8, 191, 1553788800, 1624439123, 1, '', 0, 50, '3,1', 0, '', '', '', '', 1008);
278
+INSERT INTO `5kcrm_admin_field` VALUES (32, 'crm_contacts', 0, 'next_time', '下次联系时间', 'datetime', '', 0, 0, 0, '', '', 10, 191, 1553788800, 1624439123, 13, '', 0, 50, '4,1', 0, '', '', '', '', 1010);
279
+INSERT INTO `5kcrm_admin_field` VALUES (33, 'crm_contacts', 0, 'remark', '备注', 'textarea', '', 0, 0, 0, '', '', 11, 191, 1553788800, 1624439123, 2, '', 0, 100, '5,0', 0, '', '', '', '', 1011);
280
+INSERT INTO `5kcrm_admin_field` VALUES (34, 'crm_business', 0, 'name', '商机名称', 'text', '', 0, 0, 1, '', '', 1, 181, 1553788800, 1624439203, 1, '', 0, 50, '0,0', 0, '', '', '', '', 1001);
281
+INSERT INTO `5kcrm_admin_field` VALUES (35, 'crm_business', 0, 'customer_id', '客户名称', 'customer', '', 0, 0, 1, '', '', 2, 181, 1553788800, 1624439203, 15, '', 0, 50, '0,1', 0, '', '', '', '', 1002);
282
+INSERT INTO `5kcrm_admin_field` VALUES (36, 'crm_business', 0, 'type_id', '商机状态组', 'business_type', '', 0, 0, 1, '', '', 3, 19, 1553788800, 1624439203, 0, '', 0, 50, '1,0', 0, '', '', '', '', 1003);
283
+INSERT INTO `5kcrm_admin_field` VALUES (37, 'crm_business', 0, 'status_id', '商机阶段', 'business_status', '', 0, 0, 1, '', '', 4, 19, 1553788800, 1624439203, 0, '', 0, 50, '1,1', 0, '', '', '', '', 1004);
284
+INSERT INTO `5kcrm_admin_field` VALUES (38, 'crm_business', 0, 'money', '商机金额', 'floatnumber', '', 0, 0, 0, '元', '', 5, 189, 1553788800, 1624439203, 6, '', 0, 50, '2,0', 0, '', '', '', '', 1005);
285
+INSERT INTO `5kcrm_admin_field` VALUES (39, 'crm_business', 0, 'deal_date', '预计成交日期', 'date', '', 0, 0, 1, '', '', 6, 191, 1553788800, 1624439203, 4, '', 0, 50, '2,1', 0, '', '', '', '', 1006);
286
+INSERT INTO `5kcrm_admin_field` VALUES (40, 'crm_business', 0, 'remark', '备注', 'textarea', '', 0, 0, 0, '', '', 7, 191, 1553788800, 1624439203, 2, '', 0, 100, '3,0', 0, '', '', '', '', 1007);
287
+INSERT INTO `5kcrm_admin_field` VALUES (41, 'crm_contract', 0, 'num', '合同编号', 'text', '', 0, 1, 1, '', '', 1, 177, 1553788800, 1624439278, 1, '', 0, 50, '0,0', 0, '', '', '', '', 1001);
288
+INSERT INTO `5kcrm_admin_field` VALUES (42, 'crm_contract', 0, 'name', '合同名称', 'text', '', 0, 0, 1, '', '', 2, 191, 1553788800, 1624439278, 1, '', 0, 50, '0,1', 0, '', '', '', '', 1002);
289
+INSERT INTO `5kcrm_admin_field` VALUES (43, 'crm_contract', 0, 'customer_id', '客户名称', 'customer', '', 0, 0, 1, '', '', 3, 149, 1553788800, 1624439278, 15, '', 0, 50, '1,0', 0, '', '', '', '', 1003);
290
+INSERT INTO `5kcrm_admin_field` VALUES (44, 'crm_contract', 0, 'business_id', '商机名称', 'business', '', 0, 0, 0, '', '', 4, 159, 1553788800, 1624439278, 16, '', 0, 50, '1,1', 0, '', '', '', '', 1004);
291
+INSERT INTO `5kcrm_admin_field` VALUES (45, 'crm_contract', 0, 'order_date', '下单时间', 'date', '', 0, 0, 0, '', '', 5, 181, 1553788800, 1624439278, 4, '', 0, 50, '2,0', 0, '', '', '', '', 1005);
292
+INSERT INTO `5kcrm_admin_field` VALUES (46, 'crm_contract', 0, 'money', '合同金额', 'floatnumber', '', 0, 0, 1, '元', '', 6, 189, 1553788800, 1624439278, 6, '', 0, 50, '2,1', 0, '', '', '', '', 1006);
293
+INSERT INTO `5kcrm_admin_field` VALUES (47, 'crm_contract', 0, 'start_time', '合同开始时间', 'date', '', 0, 0, 0, '', '', 7, 191, 1553788800, 1624439278, 4, '', 0, 50, '3,0', 0, '', '', '', '', 1007);
294
+INSERT INTO `5kcrm_admin_field` VALUES (48, 'crm_contract', 0, 'end_time', '合同到期时间', 'date', '', 0, 0, 0, '', '', 8, 191, 1553788800, 1624439278, 4, '', 0, 50, '3,1', 0, '', '', '', '', 1008);
295
+INSERT INTO `5kcrm_admin_field` VALUES (49, 'crm_contract', 0, 'contacts_id', '客户签约人', 'contacts', '', 0, 0, 0, '', '', 9, 159, 1553788800, 1624439279, 17, '', 0, 50, '4,0', 0, '', '', '', '', 1009);
296
+INSERT INTO `5kcrm_admin_field` VALUES (50, 'crm_contract', 0, 'order_user_id', '公司签约人', 'user', '', 0, 0, 0, '', '', 10, 159, 1553788800, 1624439279, 10, '', 0, 50, '4,1', 0, '', '', '', '', 1010);
297
+INSERT INTO `5kcrm_admin_field` VALUES (51, 'crm_contract', 0, 'remark', '备注', 'textarea', '', 0, 0, 0, '', '', 11, 191, 1553788800, 1624439279, 2, '', 0, 100, '5,0', 0, '', '', '', '', 1011);
298
+INSERT INTO `5kcrm_admin_field` VALUES (52, 'crm_receivables', 0, 'number', '回款编号', 'text', '', 0, 1, 1, '', '', 1, 177, 1553788800, 1624439355, 1, '', 0, 50, '0,0', 0, '', '', '', '', 1001);
299
+INSERT INTO `5kcrm_admin_field` VALUES (53, 'crm_receivables', 0, 'customer_id', '客户名称', 'customer', '', 0, 0, 1, '', '', 2, 153, 1553788800, 1624439355, 15, '', 0, 50, '0,1', 0, '', '', '', '', 1002);
300
+INSERT INTO `5kcrm_admin_field` VALUES (54, 'crm_receivables', 0, 'contract_id', '合同编号', 'contract', '', 0, 0, 1, '', '', 3, 159, 1553788800, 1624439355, 20, '', 0, 50, '1,0', 0, '', '', '', '', 1003);
301
+INSERT INTO `5kcrm_admin_field` VALUES (55, 'crm_receivables', 0, 'return_time', '回款日期', 'date', '', 0, 0, 1, '', '', 4, 181, 1553788800, 1624439355, 4, '', 0, 50, '1,1', 0, '', '', '', '', 1004);
302
+INSERT INTO `5kcrm_admin_field` VALUES (56, 'crm_receivables', 0, 'return_type', '回款方式', 'select', '', 0, 0, 1, '', '支票\n现金\n邮政汇款\n电汇\n网上转账\n支付宝\n微信支付\n其他', 5, 191, 1553788800, 1624439355, 3, '', 0, 50, '2,0', 2, '', '', '', '\"\"', 1005);
303
+INSERT INTO `5kcrm_admin_field` VALUES (57, 'crm_receivables', 0, 'money', '回款金额', 'floatnumber', '', 0, 0, 1, '元', '', 6, 181, 1553788800, 1624439355, 6, '', 0, 50, '2,1', 0, '', '', '', '', 1006);
304
+INSERT INTO `5kcrm_admin_field` VALUES (58, 'crm_receivables', 0, 'plan_id', '期数', 'receivables_plan', '', 0, 0, 0, '', '', 7, 191, 1553788800, 1624439355, 21, '', 0, 50, '3,0', 0, '', '', '', '', 1007);
305
+INSERT INTO `5kcrm_admin_field` VALUES (59, 'crm_receivables', 0, 'remark', '备注', 'textarea', '', 0, 0, 0, '', '', 8, 191, 1553788800, 1624439355, 2, '', 0, 50, '3,1', 0, '', '', '', '', 1008);
306
+INSERT INTO `5kcrm_admin_field` VALUES (60, 'crm_product', 0, 'name', '产品名称', 'text', '', 0, 0, 1, '', '', 1, 177, 1553788800, 1624440436, 1, '', 0, 50, '0,0', 0, '', '', '', '', 1001);
307
+INSERT INTO `5kcrm_admin_field` VALUES (61, 'crm_product', 0, 'category_id', '产品类别', 'category', '', 0, 0, 1, '', '', 2, 191, 1553788800, 1624440436, 19, '', 0, 50, '0,1', 0, '', '', '', '', 1002);
308
+INSERT INTO `5kcrm_admin_field` VALUES (62, 'crm_product', 0, 'num', '产品编码', 'text', '', 0, 0, 1, '', '', 3, 191, 1553788800, 1624440436, 1, '', 0, 50, '1,0', 0, '', '', '', '', 1003);
309
+INSERT INTO `5kcrm_admin_field` VALUES (63, 'crm_product', 0, 'status', '是否上架', 'select', '上架', 0, 0, 1, '', '上架\n下架', 4, 144, 1553788800, 1624440436, 3, '', 0, 50, '1,1', 2, '', '', '', '\"\"', 1004);
310
+INSERT INTO `5kcrm_admin_field` VALUES (64, 'crm_product', 0, 'unit', '单位', 'select', '', 0, 0, 1, '', '个\n块\n只\n把\n枚\n瓶\n盒\n台\n吨\n千克\n米\n箱', 5, 191, 1553788800, 1624440436, 3, '', 0, 50, '2,0', 2, '', '', '', '\"\"', 1005);
311
+INSERT INTO `5kcrm_admin_field` VALUES (65, 'crm_product', 0, 'price', '标准价格', 'floatnumber', '', 0, 0, 1, '元', '', 6, 181, 1553788800, 1624440436, 6, '', 0, 50, '2,1', 0, '', '', '', '', 1006);
312
+INSERT INTO `5kcrm_admin_field` VALUES (66, 'crm_product', 0, 'description', '产品描述', 'text', '', 0, 0, 0, '', '', 7, 191, 1553788800, 1624440436, 1, '', 0, 100, '3,0', 0, '', '', '', '', 1007);
313
+INSERT INTO `5kcrm_admin_field` VALUES (67, 'oa_examine', 1, 'content', '审批内容', 'text', '', 0, 0, 1, '', '', 0, 3, 1553788800, 1553788800, 0, NULL, 0, 100, '0,1', NULL, NULL, NULL, NULL, NULL, NULL);
314
+INSERT INTO `5kcrm_admin_field` VALUES (68, 'oa_examine', 1, 'remark', '备注', 'textarea', '', 0, 0, 0, '', '', 0, 3, 1553788800, 1553788800, 0, NULL, 0, 100, '0,2', NULL, NULL, NULL, NULL, NULL, NULL);
315
+INSERT INTO `5kcrm_admin_field` VALUES (69, 'oa_examine', 2, 'type_id', '请假类型', 'select', '', 0, 0, 1, '', '年假\n事假\n病假\n产假\n调休\n婚假\n丧假\n其他', 0, 3, 1553788800, 1553788800, 0, NULL, 0, 100, '0,1', NULL, NULL, NULL, NULL, NULL, NULL);
316
+INSERT INTO `5kcrm_admin_field` VALUES (70, 'oa_examine', 2, 'content', '审批内容', 'text', '', 0, 0, 1, '', '', 0, 3, 1553788800, 1553788800, 0, NULL, 0, 100, '0,2', NULL, NULL, NULL, NULL, NULL, NULL);
317
+INSERT INTO `5kcrm_admin_field` VALUES (71, 'oa_examine', 2, 'start_time', '开始时间', 'datetime', '', 0, 0, 1, '', '', 0, 3, 1553788800, 1553788800, 0, NULL, 0, 100, '0,3', NULL, NULL, NULL, NULL, NULL, NULL);
318
+INSERT INTO `5kcrm_admin_field` VALUES (72, 'oa_examine', 2, 'end_time', '结束时间', 'datetime', '', 0, 0, 1, '', '', 0, 3, 1553788800, 1553788800, 0, NULL, 0, 100, '0,4', NULL, NULL, NULL, NULL, NULL, NULL);
319
+INSERT INTO `5kcrm_admin_field` VALUES (73, 'oa_examine', 2, 'duration', '时长(天)', 'floatnumber', '', 0, 0, 1, '', '', 0, 3, 1553788800, 1553788800, 0, NULL, 0, 100, '0,5', NULL, NULL, NULL, NULL, NULL, NULL);
320
+INSERT INTO `5kcrm_admin_field` VALUES (74, 'oa_examine', 2, 'remark', '备注', 'textarea', '', 0, 0, 0, '', '', 0, 3, 1553788800, 1553788800, 0, NULL, 0, 100, '0,6', NULL, NULL, NULL, NULL, NULL, NULL);
321
+INSERT INTO `5kcrm_admin_field` VALUES (75, 'oa_examine', 3, 'content', '出差事由', 'text', '', 0, 0, 1, '', '', 0, 3, 1553788800, 1553788800, 0, NULL, 0, 100, '0,0', NULL, NULL, NULL, NULL, NULL, NULL);
322
+INSERT INTO `5kcrm_admin_field` VALUES (76, 'oa_examine', 3, 'remark', '备注', 'textarea', '', 0, 0, 0, '', '', 0, 3, 1553788800, 1553788800, 0, NULL, 0, 100, '1,0', NULL, NULL, NULL, NULL, NULL, NULL);
323
+INSERT INTO `5kcrm_admin_field` VALUES (77, 'oa_examine', 3, 'cause', '行程明细', 'business_cause', '', 0, 0, 1, '', '', 0, 3, 1553788800, 1553788800, 0, NULL, 0, 100, '2,0', NULL, NULL, NULL, NULL, NULL, NULL);
324
+INSERT INTO `5kcrm_admin_field` VALUES (78, 'oa_examine', 3, 'duration', '出差总天数', 'floatnumber', '', 0, 0, 1, '', '', 0, 3, 1553788800, 1553788800, 0, NULL, 0, 100, '3,0', NULL, NULL, NULL, NULL, NULL, NULL);
325
+INSERT INTO `5kcrm_admin_field` VALUES (79, 'oa_examine', 4, 'content', '加班原因', 'text', '', 0, 0, 1, '', '', 0, 3, 1553788800, 1553788800, 0, NULL, 0, 100, '0,1', NULL, NULL, NULL, NULL, NULL, NULL);
326
+INSERT INTO `5kcrm_admin_field` VALUES (80, 'oa_examine', 4, 'start_time', '开始时间', 'datetime', '', 0, 0, 1, '', '', 0, 3, 1553788800, 1553788800, 0, NULL, 0, 100, '0,2', NULL, NULL, NULL, NULL, NULL, NULL);
327
+INSERT INTO `5kcrm_admin_field` VALUES (81, 'oa_examine', 4, 'end_time', '结束时间', 'datetime', '', 0, 0, 1, '', '', 0, 3, 1553788800, 1553788800, 0, NULL, 0, 100, '0,3', NULL, NULL, NULL, NULL, NULL, NULL);
328
+INSERT INTO `5kcrm_admin_field` VALUES (82, 'oa_examine', 4, 'duration', '加班总天数', 'floatnumber', '', 0, 0, 1, '', '', 0, 3, 1553788800, 1553788800, 0, NULL, 0, 100, '0,4', NULL, NULL, NULL, NULL, NULL, NULL);
329
+INSERT INTO `5kcrm_admin_field` VALUES (83, 'oa_examine', 4, 'remark', '备注', 'textarea', '', 0, 0, 0, '', '', 0, 3, 1553788800, 1553788800, 0, NULL, 0, 100, '0,5', NULL, NULL, NULL, NULL, NULL, NULL);
330
+INSERT INTO `5kcrm_admin_field` VALUES (84, 'oa_examine', 5, 'content', '差旅事由', 'text', '', 0, 0, 1, '', '', 0, 3, 1553788800, 1553788800, 0, NULL, 0, 100, '0,1', NULL, NULL, NULL, NULL, NULL, NULL);
331
+INSERT INTO `5kcrm_admin_field` VALUES (85, 'oa_examine', 5, 'cause', '费用明细', 'examine_cause', '', 0, 0, 1, '', '', 0, 3, 1553788800, 1553788800, 0, NULL, 0, 100, '0,2', NULL, NULL, NULL, NULL, NULL, NULL);
332
+INSERT INTO `5kcrm_admin_field` VALUES (86, 'oa_examine', 5, 'money', '报销总金额', 'floatnumber', '', 0, 0, 1, '', '', 0, 3, 1553788800, 1553788800, 0, NULL, 0, 100, '0,3', NULL, NULL, NULL, NULL, NULL, NULL);
333
+INSERT INTO `5kcrm_admin_field` VALUES (87, 'oa_examine', 5, 'remark', '备注', 'textarea', '', 0, 0, 0, '', '', 0, 3, 1553788800, 1553788800, 0, NULL, 0, 100, '0,4', NULL, NULL, NULL, NULL, NULL, NULL);
334
+INSERT INTO `5kcrm_admin_field` VALUES (88, 'oa_examine', 6, 'content', '借款事由', 'text', '', 0, 0, 1, '', '', 0, 3, 1553788800, 1553788800, 0, NULL, 0, 100, '0,1', NULL, NULL, NULL, NULL, NULL, NULL);
335
+INSERT INTO `5kcrm_admin_field` VALUES (89, 'oa_examine', 6, 'money', '借款金额(元)', 'floatnumber', '', 0, 0, 1, '', '', 0, 3, 1553788800, 1553788800, 0, NULL, 0, 100, '0,2', NULL, NULL, NULL, NULL, NULL, NULL);
336
+INSERT INTO `5kcrm_admin_field` VALUES (90, 'oa_examine', 6, 'remark', '备注', 'textarea', '', 0, 0, 0, '', '', 0, 3, 1553788800, 1553788800, 0, NULL, 0, 100, '0,3', NULL, NULL, NULL, NULL, NULL, NULL);
337
+INSERT INTO `5kcrm_admin_field` VALUES (91, 'crm_receivables_plan', 0, 'customer_id', '客户名称', 'customer', '', 0, 0, 1, '', '', 1, 181, 1553788800, 1624439466, 0, NULL, 0, 50, '0,0', NULL, NULL, NULL, NULL, '', 1001);
338
+INSERT INTO `5kcrm_admin_field` VALUES (92, 'crm_receivables_plan', 0, 'contract_id', '合同编号', 'contract', '', 0, 0, 1, '', '', 2, 181, 1553788800, 1624439466, 0, NULL, 0, 50, '0,1', NULL, NULL, NULL, NULL, '', 1002);
339
+INSERT INTO `5kcrm_admin_field` VALUES (93, 'crm_receivables_plan', 0, 'money', '计划回款金额', 'floatnumber', '', 0, 0, 1, '', '', 3, 181, 1553788800, 1624439466, 6, NULL, 0, 50, '1,0', NULL, NULL, NULL, NULL, '', 1003);
340
+INSERT INTO `5kcrm_admin_field` VALUES (94, 'crm_receivables_plan', 0, 'return_date', '计划回款日期', 'date', '', 0, 0, 1, '', '', 4, 183, 1553788800, 1624439466, 4, NULL, 0, 50, '1,1', NULL, NULL, NULL, NULL, '', 1004);
341
+INSERT INTO `5kcrm_admin_field` VALUES (95, 'crm_receivables_plan', 0, 'return_type', '计划回款方式', 'select', '', 0, 0, 1, '', '支票\n现金\n邮政汇款\n电汇\n网上转账\n支付宝\n微信支付\n其他\n在线支付\n线下支付\n预存款\n返利\n预存款+返利', 5, 191, 1553788800, 1624439466, 3, NULL, 0, 50, '2,0', 2, NULL, NULL, NULL, '支票\n现金\n邮政汇款\n电汇\n网上转账\n支付宝\n微信支付\n其他\n在线支付\n线下支付\n预存款\n返利\n预存款+返利', 1005);
342
+INSERT INTO `5kcrm_admin_field` VALUES (96, 'crm_receivables_plan', 0, 'remind', '提前几日提醒', 'number', '', 0, 0, 0, '', '', 6, 191, 1553788800, 1624439466, 5, NULL, 0, 50, '2,1', NULL, NULL, NULL, NULL, '', 1006);
343
+INSERT INTO `5kcrm_admin_field` VALUES (97, 'crm_receivables_plan', 0, 'remark', '备注', 'textarea', '', 0, 0, 0, '', '', 7, 191, 1553788800, 1624439466, 2, NULL, 0, 100, '3,0', NULL, NULL, NULL, NULL, '', 1007);
344
+INSERT INTO `5kcrm_admin_field` VALUES (99, 'crm_customer', 0, 'mobile', '手机', 'mobile', '', 0, 0, 0, '', '', 6, 191, 1553788800, 1624439032, 7, '', 0, 50, '2,1', 0, '', '', '', '', 1031);
345
+INSERT INTO `5kcrm_admin_field` VALUES (100, 'crm_customer', 0, 'email', '邮箱', 'email', '', 0, 0, 0, '', '', 7, 191, 1553788800, 1624439032, 14, '', 0, 50, '3,0', 0, '', '', '', '', 1032);
346
+INSERT INTO `5kcrm_admin_field` VALUES (101, 'crm_visit', 0, 'number', '回访编号', 'text', '', 0, 0, 1, '', NULL, 1, 177, 1553788800, 1624439600, 1, '', 0, 50, '0,0', 0, '', '', '', NULL, 1001);
347
+INSERT INTO `5kcrm_admin_field` VALUES (102, 'crm_visit', 0, 'visit_time', '回访时间', 'date', '', 0, 0, 1, '', '', 2, 181, 1553788800, 1624439600, 4, '', 0, 50, '0,1', 0, '', '', '', '', 1002);
348
+INSERT INTO `5kcrm_admin_field` VALUES (103, 'crm_visit', 0, 'owner_user_id', '回访人', 'single_user', '', 0, 0, 1, '', '', 3, 149, 1553788800, 1624439600, 28, '', 0, 50, '1,0', 0, '', '', '', '', 1003);
349
+INSERT INTO `5kcrm_admin_field` VALUES (104, 'crm_visit', 0, 'shape', '回访形式', 'select', '', 0, 0, 0, '', '见面拜访\r\n电话\r\n短信\r\n邮件\r\n微信', 4, 191, 1553788800, 1624439600, 3, '', 0, 50, '1,1', 2, '', '', '', '\"\"', 1004);
350
+INSERT INTO `5kcrm_admin_field` VALUES (105, 'crm_visit', 0, 'customer_id', '客户名称', 'customer', '', 0, 0, 1, '', '', 5, 149, 1553788800, 1624439600, 15, '', 0, 50, '2,0', 0, '', '', '', '', 1005);
351
+INSERT INTO `5kcrm_admin_field` VALUES (106, 'crm_visit', 0, 'contacts_id', '联系人', 'contacts', '', 0, 0, 0, '', '', 6, 159, 1553788800, 1624439600, 17, '', 0, 50, '2,1', 0, '', '', '', '', 1006);
352
+INSERT INTO `5kcrm_admin_field` VALUES (107, 'crm_visit', 0, 'contract_id', '合同编号', 'contract', '', 0, 0, 1, '', '', 7, 159, 1553788800, 1624439600, 20, '', 0, 50, '3,0', 0, '', '', '', '', 1007);
353
+INSERT INTO `5kcrm_admin_field` VALUES (108, 'crm_visit', 0, 'satisfaction', '客户满意度', 'select', '', 0, 0, 0, '', '很满意\r\n满意\r\n一般\r\n不满意\r\n很不满意', 8, 191, 1553788800, 1624439600, 3, '', 0, 50, '3,1', 2, '', '', '', '\"\"', 1008);
354
+INSERT INTO `5kcrm_admin_field` VALUES (109, 'crm_visit', 0, 'feedback', '客户反馈', 'textarea', '', 0, 0, 0, '', '', 9, 191, 1553788800, 1624439600, 2, '', 0, 100, '4,0', 0, '', '', '', '', 1009);
355
+INSERT INTO `5kcrm_admin_field` VALUES (110, 'crm_leads', 0, 'email', '电子邮箱', 'email', '', 0, 0, 0, '', NULL, 8, 191, 1616464748, 1624438964, 14, '', 0, 50, '4,0', 0, '', '', '', NULL, 1006);
356
+INSERT INTO `5kcrm_admin_field` VALUES (111, 'crm_invoice', 0, 'invoice_apple_number', '发票申请编号', 'text', '', 0, 0, 0, '', '', 1, 177, 1553788800, 1624439529, 1, '', 0, 50, '0,0', 0, '', '', '', '', 0);
357
+INSERT INTO `5kcrm_admin_field` VALUES (112, 'crm_invoice', 0, 'customer_id', '客户名称', 'customer', '', 0, 0, 1, '', '', 2, 149, 1553788800, 1624439529, 0, '', 0, 50, '0,1', 0, '', '', '', '', 1001);
358
+INSERT INTO `5kcrm_admin_field` VALUES (113, 'crm_invoice', 0, 'contract_id', '合同编号', 'contract', '', 0, 0, 1, '', '', 3, 149, 1553788800, 1624439529, 0, '', 0, 50, '1,0', 0, '', '', '', '', 1002);
359
+INSERT INTO `5kcrm_admin_field` VALUES (114, 'crm_invoice', 0, 'contract_money', '合同金额', 'floatnumber', '', 0, 0, 1, '元', '', 4, 145, 1553788800, 1624439529, 6, '', 0, 50, '1,1', 0, '', '', '', '', 1003);
360
+INSERT INTO `5kcrm_admin_field` VALUES (115, 'crm_invoice', 0, 'invoice_date', '开票日期', 'date', '', 0, 0, 0, '', '', 5, 191, 1553788800, 1624439529, 4, '', 0, 50, '2,0', 0, '', '', '', '', 0);
361
+INSERT INTO `5kcrm_admin_field` VALUES (116, 'crm_invoice', 0, 'invoice_money', '开票金额', 'floatnumber', '', 0, 0, 1, '元', '', 6, 149, 1553788800, 1624439529, 6, '', 0, 50, '2,1', 0, '', '', '', '', 0);
362
+INSERT INTO `5kcrm_admin_field` VALUES (117, 'crm_invoice', 0, 'invoice_type', '开票类型', 'select', '', 0, 0, 1, '', '增值税专用发票\n增值税普通发票\n国税通用机打发票\n地税通用机打发票\n收据', 7, 159, 1553788800, 1624439529, 3, '', 0, 50, '3,0', 2, '', '', '', '增值税专用发票\n增值税普通发票\n国税通用机打发票\n地税通用机打发票\n收据', 0);
363
+INSERT INTO `5kcrm_admin_field` VALUES (118, 'crm_invoice', 0, 'remark', '备注', 'textarea', '', 0, 0, 0, '', NULL, 8, 191, 1620874670, 1624439529, 2, '', 0, 50, '3,1', 0, '', '', '', NULL, 0);
364
+
365
+-- ----------------------------
366
+-- Table structure for 5kcrm_admin_field_extend
367
+-- ----------------------------
368
+DROP TABLE IF EXISTS `5kcrm_admin_field_extend`;
369
+CREATE TABLE `5kcrm_admin_field_extend`  (
370
+  `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
371
+  `types` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '模块:crm_leads、crm_customer、crm_contacts、crm_business、crm_contract、crm_receivables、crm_product、crm_receivables_plan、crm_visit、oa_examine',
372
+  `field` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段名称',
373
+  `content` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '详细内容',
374
+  `create_time` int(10) UNSIGNED NOT NULL COMMENT '生成时间',
375
+  PRIMARY KEY (`id`) USING BTREE,
376
+  UNIQUE INDEX `field_types`(`field`, `types`) USING BTREE,
377
+  UNIQUE INDEX `field`(`field`) USING BTREE
378
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '自定义字段扩展表' ROW_FORMAT = DYNAMIC;
379
+
380
+-- ----------------------------
381
+-- Records of 5kcrm_admin_field_extend
382
+-- ----------------------------
383
+
384
+-- ----------------------------
385
+-- Table structure for 5kcrm_admin_field_grant
386
+-- ----------------------------
387
+DROP TABLE IF EXISTS `5kcrm_admin_field_grant`;
388
+CREATE TABLE `5kcrm_admin_field_grant`  (
389
+  `grant_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
390
+  `role_id` int(10) NOT NULL COMMENT '角色ID',
391
+  `module` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '模块:crm、oa、bi等',
392
+  `column` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '栏目:leads、customer、contacts等',
393
+  `content` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '授权内容',
394
+  `update_time` int(10) NOT NULL COMMENT '修改日期',
395
+  `create_time` int(10) NOT NULL COMMENT '创建日期',
396
+  PRIMARY KEY (`grant_id`) USING BTREE
397
+) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色权限管理-字段授权' ROW_FORMAT = DYNAMIC;
398
+
399
+-- ----------------------------
400
+-- Records of 5kcrm_admin_field_grant
401
+-- ----------------------------
402
+INSERT INTO `5kcrm_admin_field_grant` VALUES (1, 10, 'crm', 'leads', 'a:16:{i:0;a:7:{s:5:\"field\";s:4:\"name\";s:4:\"read\";i:1;s:14:\"read_operation\";i:0;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"线索名称\";}i:1;a:7:{s:5:\"field\";s:5:\"email\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:6:\"邮箱\";}i:2;a:7:{s:5:\"field\";s:6:\"source\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"线索来源\";}i:3;a:7:{s:5:\"field\";s:6:\"mobile\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:6:\"手机\";}i:4;a:7:{s:5:\"field\";s:9:\"telephone\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:6:\"电话\";}i:5;a:7:{s:5:\"field\";s:14:\"detail_address\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:6:\"地址\";}i:6;a:7:{s:5:\"field\";s:8:\"industry\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"客户行业\";}i:7;a:7:{s:5:\"field\";s:5:\"level\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"客户级别\";}i:8;a:7:{s:5:\"field\";s:9:\"next_time\";s:4:\"read\";i:1;s:14:\"read_operation\";i:0;s:5:\"write\";i:1;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:18:\"下次联系时间\";}i:9;a:7:{s:5:\"field\";s:6:\"remark\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:6:\"备注\";}i:10;a:7:{s:5:\"field\";s:13:\"owner_user_id\";s:4:\"read\";i:1;s:14:\"read_operation\";i:0;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:9:\"负责人\";}i:11;a:7:{s:5:\"field\";s:11:\"last_record\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:18:\"最后跟进记录\";}i:12;a:7:{s:5:\"field\";s:14:\"create_user_id\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:9:\"创建人\";}i:13;a:7:{s:5:\"field\";s:11:\"create_time\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"创建时间\";}i:14;a:7:{s:5:\"field\";s:11:\"update_time\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"跟新时间\";}i:15;a:7:{s:5:\"field\";s:9:\"last_time\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:18:\"最后跟进时间\";}}', 1617340207, 1617340207);
403
+INSERT INTO `5kcrm_admin_field_grant` VALUES (2, 10, 'crm', 'customer', 'a:20:{i:0;a:7:{s:5:\"field\";s:4:\"name\";s:4:\"read\";i:1;s:14:\"read_operation\";i:0;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"客户名称\";}i:1;a:7:{s:5:\"field\";s:6:\"source\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"客户来源\";}i:2;a:7:{s:5:\"field\";s:6:\"mobile\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:6:\"手机\";}i:3;a:7:{s:5:\"field\";s:9:\"telephone\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:6:\"电话\";}i:4;a:7:{s:5:\"field\";s:7:\"website\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:6:\"网址\";}i:5;a:7:{s:5:\"field\";s:8:\"industry\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"客户行业\";}i:6;a:7:{s:5:\"field\";s:5:\"level\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"客户级别\";}i:7;a:7:{s:5:\"field\";s:9:\"next_time\";s:4:\"read\";i:1;s:14:\"read_operation\";i:0;s:5:\"write\";i:1;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:18:\"下次联系时间\";}i:8;a:7:{s:5:\"field\";s:6:\"remark\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:6:\"备注\";}i:9;a:7:{s:5:\"field\";s:5:\"email\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:6:\"邮箱\";}i:10;a:7:{s:5:\"field\";s:13:\"owner_user_id\";s:4:\"read\";i:1;s:14:\"read_operation\";i:0;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:9:\"负责人\";}i:11;a:7:{s:5:\"field\";s:11:\"last_record\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:18:\"最后跟进记录\";}i:12;a:7:{s:5:\"field\";s:14:\"create_user_id\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:9:\"创建人\";}i:13;a:7:{s:5:\"field\";s:11:\"create_time\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"创建时间\";}i:14;a:7:{s:5:\"field\";s:11:\"update_time\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"更新时间\";}i:15;a:7:{s:5:\"field\";s:9:\"last_time\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:18:\"最后跟进时间\";}i:16;a:7:{s:5:\"field\";s:11:\"obtain_time\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:27:\"负责人获取客户时间\";}i:17;a:7:{s:5:\"field\";s:11:\"deal_status\";s:4:\"read\";i:1;s:14:\"read_operation\";i:0;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"成交状态\";}i:18;a:7:{s:5:\"field\";s:7:\"is_lock\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"锁定状态\";}i:19;a:7:{s:5:\"field\";s:8:\"pool_day\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:21:\"距进入公海天数\";}}', 1617340207, 1617340207);
404
+INSERT INTO `5kcrm_admin_field_grant` VALUES (3, 10, 'crm', 'contacts', 'a:17:{i:0;a:7:{s:5:\"field\";s:4:\"name\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:6:\"姓名\";}i:1;a:7:{s:5:\"field\";s:11:\"customer_id\";s:4:\"read\";i:1;s:14:\"read_operation\";i:0;s:5:\"write\";i:1;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"客户名称\";}i:2;a:7:{s:5:\"field\";s:6:\"mobile\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:6:\"手机\";}i:3;a:7:{s:5:\"field\";s:9:\"telephone\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:6:\"电话\";}i:4;a:7:{s:5:\"field\";s:5:\"email\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:6:\"邮箱\";}i:5;a:7:{s:5:\"field\";s:4:\"post\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:6:\"职务\";}i:6;a:7:{s:5:\"field\";s:8:\"decision\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:21:\"是否关键决策人\";}i:7;a:7:{s:5:\"field\";s:14:\"detail_address\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:6:\"地址\";}i:8;a:7:{s:5:\"field\";s:9:\"next_time\";s:4:\"read\";i:1;s:14:\"read_operation\";i:0;s:5:\"write\";i:1;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:18:\"下次联系时间\";}i:9;a:7:{s:5:\"field\";s:6:\"remark\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:6:\"备注\";}i:10;a:7:{s:5:\"field\";s:3:\"sex\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:6:\"性别\";}i:11;a:7:{s:5:\"field\";s:13:\"owner_user_id\";s:4:\"read\";i:1;s:14:\"read_operation\";i:0;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:9:\"负责人\";}i:12;a:7:{s:5:\"field\";s:14:\"create_user_id\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:9:\"创建人\";}i:13;a:7:{s:5:\"field\";s:11:\"create_time\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"创建时间\";}i:14;a:7:{s:5:\"field\";s:11:\"update_time\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"更新时间\";}i:15;a:7:{s:5:\"field\";s:9:\"last_time\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:18:\"最后跟进时间\";}i:16;a:7:{s:5:\"field\";s:11:\"last_record\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:18:\"最后跟进记录\";}}', 1617340207, 1617340207);
405
+INSERT INTO `5kcrm_admin_field_grant` VALUES (4, 10, 'crm', 'business', 'a:13:{i:0;a:7:{s:5:\"field\";s:4:\"name\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"商机名称\";}i:1;a:7:{s:5:\"field\";s:11:\"customer_id\";s:4:\"read\";i:1;s:14:\"read_operation\";i:0;s:5:\"write\";i:1;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"客户名称\";}i:2;a:7:{s:5:\"field\";s:5:\"money\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"商机金额\";}i:3;a:7:{s:5:\"field\";s:9:\"deal_date\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:18:\"预计成交日期\";}i:4;a:7:{s:5:\"field\";s:6:\"remark\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:6:\"备注\";}i:5;a:7:{s:5:\"field\";s:9:\"status_id\";s:4:\"read\";i:1;s:14:\"read_operation\";i:0;s:5:\"write\";i:1;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"商机阶段\";}i:6;a:7:{s:5:\"field\";s:7:\"type_id\";s:4:\"read\";i:1;s:14:\"read_operation\";i:0;s:5:\"write\";i:1;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:15:\"商机状态组\";}i:7;a:7:{s:5:\"field\";s:13:\"owner_user_id\";s:4:\"read\";i:1;s:14:\"read_operation\";i:0;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:9:\"负责人\";}i:8;a:7:{s:5:\"field\";s:14:\"create_user_id\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:9:\"创建人\";}i:9;a:7:{s:5:\"field\";s:11:\"create_time\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"创建时间\";}i:10;a:7:{s:5:\"field\";s:11:\"update_time\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"更新时间\";}i:11;a:7:{s:5:\"field\";s:9:\"last_time\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:18:\"最后跟进时间\";}i:12;a:7:{s:5:\"field\";s:11:\"last_record\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:18:\"最后跟进记录\";}}', 1617340207, 1617340207);
406
+INSERT INTO `5kcrm_admin_field_grant` VALUES (5, 10, 'crm', 'contract', 'a:20:{i:0;a:7:{s:5:\"field\";s:4:\"name\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"合同名称\";}i:1;a:7:{s:5:\"field\";s:3:\"num\";s:4:\"read\";i:1;s:14:\"read_operation\";i:0;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"合同编号\";}i:2;a:7:{s:5:\"field\";s:11:\"customer_id\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"客户名称\";}i:3;a:7:{s:5:\"field\";s:11:\"business_id\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"商机名称\";}i:4;a:7:{s:5:\"field\";s:5:\"money\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"合同金额\";}i:5;a:7:{s:5:\"field\";s:10:\"order_date\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"下单时间\";}i:6;a:7:{s:5:\"field\";s:10:\"start_time\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:18:\"合同开始时间\";}i:7;a:7:{s:5:\"field\";s:8:\"end_time\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:18:\"合同结束时间\";}i:8;a:7:{s:5:\"field\";s:11:\"contacts_id\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:15:\"客户签约人\";}i:9;a:7:{s:5:\"field\";s:13:\"order_user_id\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:15:\"公司签约人\";}i:10;a:7:{s:5:\"field\";s:6:\"remark\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:6:\"备注\";}i:11;a:7:{s:5:\"field\";s:13:\"owner_user_id\";s:4:\"read\";i:1;s:14:\"read_operation\";i:0;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:9:\"负责人\";}i:12;a:7:{s:5:\"field\";s:14:\"create_user_id\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:9:\"创建人\";}i:13;a:7:{s:5:\"field\";s:11:\"create_time\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"创建时间\";}i:14;a:7:{s:5:\"field\";s:11:\"update_time\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"更新时间\";}i:15;a:7:{s:5:\"field\";s:9:\"last_time\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:18:\"最后跟进时间\";}i:16;a:7:{s:5:\"field\";s:11:\"last_record\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:18:\"最后跟进记录\";}i:17;a:7:{s:5:\"field\";s:10:\"done_money\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:15:\"已收款金额\";}i:18;a:7:{s:5:\"field\";s:8:\"un_money\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:15:\"未收款金额\";}i:19;a:7:{s:5:\"field\";s:12:\"check_status\";s:4:\"read\";i:1;s:14:\"read_operation\";i:0;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"审核状态\";}}', 1617340207, 1617340207);
407
+INSERT INTO `5kcrm_admin_field_grant` VALUES (6, 10, 'crm', 'receivables', 'a:16:{i:0;a:7:{s:5:\"field\";s:6:\"number\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"回款编号\";}i:1;a:7:{s:5:\"field\";s:11:\"customer_id\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"客户名称\";}i:2;a:7:{s:5:\"field\";s:11:\"contract_id\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"合同编号\";}i:3;a:7:{s:5:\"field\";s:7:\"plan_id\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:6:\"期数\";}i:4;a:7:{s:5:\"field\";s:11:\"return_time\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"回款日期\";}i:5;a:7:{s:5:\"field\";s:5:\"money\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"回款金额\";}i:6;a:7:{s:5:\"field\";s:11:\"return_type\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"回款方式\";}i:7;a:7:{s:5:\"field\";s:6:\"remark\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:6:\"备注\";}i:8;a:7:{s:5:\"field\";s:14:\"contract_money\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"合同金额\";}i:9;a:7:{s:5:\"field\";s:13:\"owner_user_id\";s:4:\"read\";i:1;s:14:\"read_operation\";i:0;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:9:\"负责人\";}i:10;a:7:{s:5:\"field\";s:14:\"create_user_id\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:9:\"创建人\";}i:11;a:7:{s:5:\"field\";s:11:\"create_time\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"创建时间\";}i:12;a:7:{s:5:\"field\";s:11:\"update_time\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"更新时间\";}i:13;a:7:{s:5:\"field\";s:12:\"check_status\";s:4:\"read\";i:1;s:14:\"read_operation\";i:0;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"审核状态\";}i:14;a:7:{s:4:\"name\";s:18:\"计划回款日期\";s:5:\"field\";s:11:\"return_date\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:1;}i:15;a:7:{s:4:\"name\";s:18:\"提前几日提醒\";s:5:\"field\";s:6:\"remind\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:1;}}', 1617340207, 1617340207);
408
+INSERT INTO `5kcrm_admin_field_grant` VALUES (7, 10, 'crm', 'product', 'a:11:{i:0;a:7:{s:5:\"field\";s:4:\"name\";s:4:\"read\";i:1;s:14:\"read_operation\";i:0;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"产品名称\";}i:1;a:7:{s:5:\"field\";s:11:\"category_id\";s:4:\"read\";i:1;s:14:\"read_operation\";i:0;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"产品类型\";}i:2;a:7:{s:5:\"field\";s:4:\"unit\";s:4:\"read\";i:1;s:14:\"read_operation\";i:0;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"产品单位\";}i:3;a:7:{s:5:\"field\";s:3:\"num\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"产品编码\";}i:4;a:7:{s:5:\"field\";s:5:\"price\";s:4:\"read\";i:1;s:14:\"read_operation\";i:0;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:6:\"价格\";}i:5;a:7:{s:5:\"field\";s:11:\"description\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"产品描述\";}i:6;a:7:{s:5:\"field\";s:6:\"status\";s:4:\"read\";i:1;s:14:\"read_operation\";i:0;s:5:\"write\";i:1;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:15:\"是否上下架\";}i:7;a:7:{s:5:\"field\";s:13:\"owner_user_id\";s:4:\"read\";i:1;s:14:\"read_operation\";i:0;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:9:\"负责人\";}i:8;a:7:{s:5:\"field\";s:14:\"create_user_id\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:9:\"创建人\";}i:9;a:7:{s:5:\"field\";s:11:\"create_time\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"创建时间\";}i:10;a:7:{s:5:\"field\";s:11:\"update_time\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"更新时间\";}}', 1617340207, 1617340207);
409
+INSERT INTO `5kcrm_admin_field_grant` VALUES (8, 10, 'crm', 'visit', 'a:12:{i:0;a:7:{s:5:\"field\";s:6:\"number\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"回访编号\";}i:1;a:7:{s:5:\"field\";s:10:\"visit_time\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"回访时间\";}i:2;a:7:{s:5:\"field\";s:13:\"owner_user_id\";s:4:\"read\";i:1;s:14:\"read_operation\";i:0;s:5:\"write\";i:1;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:9:\"回访人\";}i:3;a:7:{s:5:\"field\";s:5:\"shape\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"回访形式\";}i:4;a:7:{s:5:\"field\";s:11:\"customer_id\";s:4:\"read\";i:1;s:14:\"read_operation\";i:0;s:5:\"write\";i:1;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"客户名称\";}i:5;a:7:{s:5:\"field\";s:11:\"contacts_id\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:9:\"联系人\";}i:6;a:7:{s:5:\"field\";s:11:\"contract_id\";s:4:\"read\";i:1;s:14:\"read_operation\";i:0;s:5:\"write\";i:1;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"合同编号\";}i:7;a:7:{s:5:\"field\";s:12:\"satisfaction\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:15:\"客户满意度\";}i:8;a:7:{s:5:\"field\";s:8:\"feedback\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:1;s:15:\"write_operation\";i:1;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"客户反馈\";}i:9;a:7:{s:5:\"field\";s:14:\"create_user_id\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:9:\"创建人\";}i:10;a:7:{s:5:\"field\";s:11:\"create_time\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"创建时间\";}i:11;a:7:{s:5:\"field\";s:11:\"update_time\";s:4:\"read\";i:1;s:14:\"read_operation\";i:1;s:5:\"write\";i:0;s:15:\"write_operation\";i:0;s:6:\"is_diy\";i:0;s:4:\"name\";s:12:\"更新时间\";}}', 1617340207, 1617340207);
410
+INSERT INTO `5kcrm_admin_field_grant` VALUES (9, 10, 'crm', 'invoice', 'a:8:{i:0;a:7:{s:5:"field";s:20:"invoice_apple_number";s:4:"read";i:1;s:14:"read_operation";i:1;s:5:"write";i:1;s:15:"write_operation";i:1;s:6:"is_diy";i:0;s:4:"name";s:18:"发票申请编号";}i:1;a:7:{s:5:"field";s:11:"customer_id";s:4:"read";i:1;s:14:"read_operation";i:0;s:5:"write";i:1;s:15:"write_operation";i:0;s:6:"is_diy";i:0;s:4:"name";s:12:"客户名称";}i:2;a:7:{s:5:"field";s:11:"contract_id";s:4:"read";i:1;s:14:"read_operation";i:0;s:5:"write";i:1;s:15:"write_operation";i:0;s:6:"is_diy";i:0;s:4:"name";s:12:"合同编号";}i:3;a:7:{s:5:"field";s:14:"contract_money";s:4:"read";i:1;s:14:"read_operation";i:0;s:5:"write";i:1;s:15:"write_operation";i:0;s:6:"is_diy";i:0;s:4:"name";s:12:"合同金额";}i:4;a:7:{s:5:"field";s:13:"invoice_money";s:4:"read";i:1;s:14:"read_operation";i:1;s:5:"write";i:1;s:15:"write_operation";i:1;s:6:"is_diy";i:0;s:4:"name";s:12:"开票金额";}i:5;a:7:{s:5:"field";s:12:"invoice_date";s:4:"read";i:1;s:14:"read_operation";i:1;s:5:"write";i:1;s:15:"write_operation";i:1;s:6:"is_diy";i:0;s:4:"name";s:12:"开票日期";}i:6;a:7:{s:5:"field";s:12:"invoice_type";s:4:"read";i:1;s:14:"read_operation";i:1;s:5:"write";i:1;s:15:"write_operation";i:1;s:6:"is_diy";i:0;s:4:"name";s:12:"开票类型";}i:7;a:7:{s:5:"field";s:6:"remark";s:4:"read";i:1;s:14:"read_operation";i:1;s:5:"write";i:1;s:15:"write_operation";i:1;s:6:"is_diy";i:0;s:4:"name";s:6:"备注";}}', 1617340207, 1617340207);
411
+
412
+-- ----------------------------
413
+-- Table structure for 5kcrm_admin_file
414
+-- ----------------------------
415
+DROP TABLE IF EXISTS `5kcrm_admin_file`;
416
+CREATE TABLE `5kcrm_admin_file`  (
417
+  `file_id` int(11) NOT NULL AUTO_INCREMENT,
418
+  `types` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '类型(file、img)',
419
+  `name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '附件名称',
420
+  `save_name` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '保存路径名称',
421
+  `size` int(10) NOT NULL COMMENT '附件大小(字节)',
422
+  `create_user_id` int(10) NOT NULL COMMENT '创建人ID',
423
+  `create_time` int(11) NOT NULL COMMENT '创建时间',
424
+  `file_path` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '文件路径',
425
+  `file_path_thumb` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '文件路径(图片缩略图)',
426
+  PRIMARY KEY (`file_id`) USING BTREE
427
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '附件表' ROW_FORMAT = DYNAMIC;
428
+
429
+-- ----------------------------
430
+-- Records of 5kcrm_admin_file
431
+-- ----------------------------
432
+
433
+-- ----------------------------
434
+-- Table structure for 5kcrm_admin_group
435
+-- ----------------------------
436
+DROP TABLE IF EXISTS `5kcrm_admin_group`;
437
+CREATE TABLE `5kcrm_admin_group`  (
438
+  `id` int(11) NOT NULL AUTO_INCREMENT,
439
+  `pid` tinyint(4) NOT NULL COMMENT '分类:0客户自定义角色,1系统默认管理角色,2客户管理角色,3人力资源管理角色,4财务管理角色,5项目管理角色,6办公管理角色',
440
+  `title` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '名称',
441
+  `rules` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '规则',
442
+  `remark` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '备注',
443
+  `status` tinyint(3) NULL DEFAULT 1 COMMENT '1启用0禁用',
444
+  `type` tinyint(1) NOT NULL DEFAULT 1 COMMENT '1本人,2本人及下属,3本部门,4本部门及下属部门,5全部 ',
445
+  `types` tinyint(4) NOT NULL DEFAULT 0 COMMENT '1超级管理员2系统设置管理员3部门与员工管理员4审批流管理员5工作台管理员6客户管理员7项目管理员8公告管理员',
446
+  `system` tinyint(4) NOT NULL DEFAULT 0 COMMENT '系统角色',
447
+  PRIMARY KEY (`id`) USING BTREE
448
+) ENGINE = InnoDB AUTO_INCREMENT = 16 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色表' ROW_FORMAT = DYNAMIC;
449
+
450
+-- ----------------------------
451
+-- Records of 5kcrm_admin_group
452
+-- ----------------------------
453
+INSERT INTO `5kcrm_admin_group` VALUES (1, 1, '超级管理员角色', '', '超级管理员角色', 1, 1, 1, 0);
454
+INSERT INTO `5kcrm_admin_group` VALUES (2, 1, '系统设置管理员', ',105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,159,138,139,208,209,220,151,221,222,', '系统设置管理员', 1, 0, 2, 0);
455
+INSERT INTO `5kcrm_admin_group` VALUES (3, 1, '部门与员工管理员', ',112,113,114,115,116,117,118,119,105,', '部门与员工管理员', 1, 1, 3, 0);
456
+INSERT INTO `5kcrm_admin_group` VALUES (4, 1, '审批流管理员', ',124,125,105,', '审批流管理员', 1, 1, 4, 0);
457
+INSERT INTO `5kcrm_admin_group` VALUES (5, 1, '工作台管理员', ',122,123,105,', '工作台管理员', 1, 1, 5, 0);
458
+INSERT INTO `5kcrm_admin_group` VALUES (6, 1, '客户管理员', ',126,127,128,129,130,105,', '客户管理员', 1, 1, 6, 0);
459
+INSERT INTO `5kcrm_admin_group` VALUES (7, 1, '公告管理员', '', '公告管理员', 1, 1, 8, 0);
460
+INSERT INTO `5kcrm_admin_group` VALUES (10, 2, '销售经理角色', ',1,2,3,4,5,6,7,8,9,73,74,160,10,11,12,13,14,15,16,17,18,19,20,21,104,161,164,22,23,24,25,26,27,28,81,82,162,230,34,35,36,37,38,39,40,41,146,163,210,42,43,44,45,46,47,48,49,147,148,211,50,51,52,53,54,55,153,212,213,229,56,57,58,59,60,61,83,84,149,214,165,166,167,168,169,170,171,172,173,231,174,175,176,177,178,179,224,225,215,216,217,218,219,226,233,234,235,236,237,238,239,62,63,64,65,66,69,70,71,72,75,76,77,78,79,80,', '', 1, 2, 0, 0);
461
+INSERT INTO `5kcrm_admin_group` VALUES (11, 1, '项目管理员', ',141,142,143,', '项目管理员', 1, 1, 7, 0);
462
+INSERT INTO `5kcrm_admin_group` VALUES (12, 5, '编辑', ',0,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,223', '成员初始加入时默认享有的权限:默认只有新建任务,查看任务权限', 1, 0, 7, 1);
463
+INSERT INTO `5kcrm_admin_group` VALUES (13, 5, '只读', '', '项目只读角色', 1, 0, 0, 0);
464
+INSERT INTO `5kcrm_admin_group` VALUES (14, 6, '办公管理员', '', '', 1, 1, 0, 0);
465
+INSERT INTO `5kcrm_admin_group` VALUES (15, 9, '管理项目', ',141,142,143,', '', 1, 0, 0, 0);
466
+
467
+-- ----------------------------
468
+-- Table structure for 5kcrm_admin_group_auth
469
+-- ----------------------------
470
+DROP TABLE IF EXISTS `5kcrm_admin_group_auth`;
471
+CREATE TABLE `5kcrm_admin_group_auth`  (
472
+  `id` int(11) NOT NULL AUTO_INCREMENT,
473
+  `group_id` int(11) NOT NULL COMMENT '角色id',
474
+  `auth_group_id` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '角色授权的 角色id',
475
+  PRIMARY KEY (`id`) USING BTREE
476
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色权限查看配置表' ROW_FORMAT = DYNAMIC;
477
+
478
+-- ----------------------------
479
+-- Records of 5kcrm_admin_group_auth
480
+-- ----------------------------
481
+
482
+-- ----------------------------
483
+-- Table structure for 5kcrm_admin_import_record
484
+-- ----------------------------
485
+DROP TABLE IF EXISTS `5kcrm_admin_import_record`;
486
+CREATE TABLE `5kcrm_admin_import_record`  (
487
+  `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
488
+  `type` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '导入模块',
489
+  `total` int(10) NOT NULL DEFAULT 0 COMMENT '总数',
490
+  `done` int(10) NOT NULL DEFAULT 0 COMMENT '已导入数',
491
+  `cover` int(10) NOT NULL DEFAULT 0 COMMENT '覆盖数',
492
+  `error` int(10) NOT NULL DEFAULT 0 COMMENT '错误数',
493
+  `error_data_file_path` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '错误数据文件路径',
494
+  `create_time` int(10) NOT NULL DEFAULT 0,
495
+  `user_id` int(10) NULL DEFAULT NULL,
496
+  PRIMARY KEY (`id`) USING BTREE
497
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '导入数据记录表' ROW_FORMAT = DYNAMIC;

+ 576
- 0
public/sql/5kcrm2.sql
ファイル差分が大きすぎるため省略します
ファイルの表示


+ 471
- 0
public/sql/5kcrm3.sql ファイルの表示

@@ -0,0 +1,471 @@
1
+/*
2
+ Navicat Premium Data Transfer
3
+
4
+ Source Server         : localhost
5
+ Source Server Type    : MySQL
6
+ Source Server Version : 50726
7
+ Source Host           : localhost:3306
8
+ Source Schema         : multi_field
9
+
10
+ Target Server Type    : MySQL
11
+ Target Server Version : 50726
12
+ File Encoding         : 65001
13
+
14
+ Date: 23/06/2021 17:58:30
15
+*/
16
+
17
+SET NAMES utf8mb4;
18
+SET FOREIGN_KEY_CHECKS = 0;
19
+
20
+
21
+-- ----------------------------
22
+-- Table structure for 5kcrm_admin_scene_default
23
+-- ----------------------------
24
+DROP TABLE IF EXISTS `5kcrm_admin_scene_default`;
25
+CREATE TABLE `5kcrm_admin_scene_default`  (
26
+  `default_id` int(11) NOT NULL AUTO_INCREMENT,
27
+  `types` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '类型',
28
+  `user_id` int(11) NOT NULL COMMENT '人员ID',
29
+  `scene_id` int(11) NOT NULL COMMENT '场景ID',
30
+  UNIQUE INDEX `default_id`(`default_id`) USING BTREE
31
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '场景默认关系表' ROW_FORMAT = DYNAMIC;
32
+
33
+-- ----------------------------
34
+-- Records of 5kcrm_admin_scene_default
35
+-- ----------------------------
36
+
37
+-- ----------------------------
38
+-- Table structure for 5kcrm_admin_sort
39
+-- ----------------------------
40
+DROP TABLE IF EXISTS `5kcrm_admin_sort`;
41
+CREATE TABLE `5kcrm_admin_sort`  (
42
+  `sort_id` int(11) NOT NULL AUTO_INCREMENT,
43
+  `user_id` int(11) NOT NULL,
44
+  `value` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '排序内容',
45
+  PRIMARY KEY (`sort_id`) USING BTREE
46
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '顶部导航栏' ROW_FORMAT = DYNAMIC;
47
+
48
+-- ----------------------------
49
+-- Records of 5kcrm_admin_sort
50
+-- ----------------------------
51
+
52
+-- ----------------------------
53
+-- Table structure for 5kcrm_admin_structure
54
+-- ----------------------------
55
+DROP TABLE IF EXISTS `5kcrm_admin_structure`;
56
+CREATE TABLE `5kcrm_admin_structure`  (
57
+  `id` int(11) NOT NULL AUTO_INCREMENT,
58
+  `name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
59
+  `pid` int(11) NULL DEFAULT 0,
60
+  `owner_user_id` int(5) UNSIGNED NULL DEFAULT 0 COMMENT '当前部门负责人',
61
+  PRIMARY KEY (`id`) USING BTREE
62
+) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '部门表' ROW_FORMAT = DYNAMIC;
63
+
64
+-- ----------------------------
65
+-- Records of 5kcrm_admin_structure
66
+-- ----------------------------
67
+INSERT INTO `5kcrm_admin_structure` VALUES (1, '办公室', 0, 0);
68
+
69
+-- ----------------------------
70
+-- Table structure for 5kcrm_admin_system
71
+-- ----------------------------
72
+DROP TABLE IF EXISTS `5kcrm_admin_system`;
73
+CREATE TABLE `5kcrm_admin_system`  (
74
+  `id` int(11) NOT NULL AUTO_INCREMENT,
75
+  `name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
76
+  `value` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
77
+  `description` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
78
+  PRIMARY KEY (`id`) USING BTREE
79
+) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
80
+
81
+-- ----------------------------
82
+-- Records of 5kcrm_admin_system
83
+-- ----------------------------
84
+INSERT INTO `5kcrm_admin_system` VALUES (1, 'name', '悟空CRM', '网站名称');
85
+INSERT INTO `5kcrm_admin_system` VALUES (2, 'logo', '', '企业logo');
86
+
87
+-- ----------------------------
88
+-- Table structure for 5kcrm_admin_system_log
89
+-- ----------------------------
90
+DROP TABLE IF EXISTS `5kcrm_admin_system_log`;
91
+CREATE TABLE `5kcrm_admin_system_log`  (
92
+  `log_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
93
+  `target_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '被操作对象的名称',
94
+  `user_id` int(10) UNSIGNED NOT NULL COMMENT '用户ID',
95
+  `client_ip` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户IP',
96
+  `module_name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '模块名',
97
+  `controller_name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '控制器',
98
+  `action_name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '方法',
99
+  `action_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '操作ID',
100
+  `action_delete` tinyint(1) NOT NULL DEFAULT 0 COMMENT '1为删除操作',
101
+  `content` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '内容',
102
+  `create_time` int(10) NOT NULL COMMENT '时间',
103
+  PRIMARY KEY (`log_id`) USING BTREE
104
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '系统操作日志表' ROW_FORMAT = DYNAMIC;
105
+
106
+-- ----------------------------
107
+-- Records of 5kcrm_admin_system_log
108
+-- ----------------------------
109
+
110
+-- ----------------------------
111
+-- Table structure for 5kcrm_admin_upgrade_record
112
+-- ----------------------------
113
+DROP TABLE IF EXISTS `5kcrm_admin_upgrade_record`;
114
+CREATE TABLE `5kcrm_admin_upgrade_record`  (
115
+  `version` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '版本号',
116
+  UNIQUE INDEX `version`(`version`) USING BTREE
117
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '升级记录,用于防止重复执行升级SQL。' ROW_FORMAT = DYNAMIC;
118
+
119
+-- ----------------------------
120
+-- Records of 5kcrm_admin_upgrade_record
121
+-- ----------------------------
122
+INSERT INTO `5kcrm_admin_upgrade_record` VALUES (1103);
123
+INSERT INTO `5kcrm_admin_upgrade_record` VALUES (1104);
124
+
125
+-- ----------------------------
126
+-- Table structure for 5kcrm_admin_user
127
+-- ----------------------------
128
+DROP TABLE IF EXISTS `5kcrm_admin_user`;
129
+CREATE TABLE `5kcrm_admin_user`  (
130
+  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
131
+  `username` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '管理后台账号',
132
+  `password` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '管理后台密码',
133
+  `salt` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '安全符',
134
+  `img` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '头像',
135
+  `thumb_img` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '头像缩略图',
136
+  `create_time` int(11) NOT NULL,
137
+  `realname` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '真实姓名',
138
+  `num` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '员工编号',
139
+  `email` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '邮箱',
140
+  `mobile` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '手机号码',
141
+  `sex` varchar(5) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '男、女',
142
+  `structure_id` int(11) NOT NULL DEFAULT 0 COMMENT '部门',
143
+  `post` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '岗位',
144
+  `status` tinyint(3) NOT NULL DEFAULT 2 COMMENT '状态,0禁用,1启用,2未激活',
145
+  `parent_id` int(10) NOT NULL DEFAULT 0 COMMENT '直属上级ID',
146
+  `authkey` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '验证信息',
147
+  `authkey_time` int(11) NOT NULL DEFAULT 0 COMMENT '验证失效时间',
148
+  `type` tinyint(2) NOT NULL COMMENT '1系统用户 0非系统用户',
149
+  `is_read_notice` tinyint(1) NOT NULL DEFAULT 0 COMMENT '用户是否已读升级公告:1已读;0未读',
150
+  PRIMARY KEY (`id`) USING BTREE
151
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户表' ROW_FORMAT = DYNAMIC;
152
+
153
+
154
+-- ----------------------------
155
+-- Table structure for 5kcrm_admin_user_field
156
+-- ----------------------------
157
+DROP TABLE IF EXISTS `5kcrm_admin_user_field`;
158
+CREATE TABLE `5kcrm_admin_user_field`  (
159
+  `id` int(11) NOT NULL AUTO_INCREMENT,
160
+  `user_id` int(11) NOT NULL,
161
+  `types` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '分类',
162
+  `datas` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '属性值',
163
+  `create_time` int(11) NOT NULL COMMENT '创建时间',
164
+  `update_time` int(11) NOT NULL COMMENT '更新时间',
165
+  PRIMARY KEY (`id`) USING BTREE
166
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '自定义字段展示排序关系表' ROW_FORMAT = DYNAMIC;
167
+
168
+-- ----------------------------
169
+-- Records of 5kcrm_admin_user_field
170
+-- ----------------------------
171
+
172
+-- ----------------------------
173
+-- Table structure for 5kcrm_admin_user_threeparty
174
+-- ----------------------------
175
+DROP TABLE IF EXISTS `5kcrm_admin_user_threeparty`;
176
+CREATE TABLE `5kcrm_admin_user_threeparty`  (
177
+  `id` int(10) NOT NULL AUTO_INCREMENT COMMENT '主键',
178
+  `user_id` int(10) NOT NULL COMMENT '用户ID',
179
+  `key` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '关联模块',
180
+  `value` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '关联内容',
181
+  PRIMARY KEY (`id`) USING BTREE
182
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '关联第三方' ROW_FORMAT = DYNAMIC;
183
+
184
+-- ----------------------------
185
+-- Records of 5kcrm_admin_user_threeparty
186
+-- ----------------------------
187
+
188
+-- ----------------------------
189
+-- Table structure for 5kcrm_crm_achievement
190
+-- ----------------------------
191
+DROP TABLE IF EXISTS `5kcrm_crm_achievement`;
192
+CREATE TABLE `5kcrm_crm_achievement`  (
193
+  `achievement_id` int(11) NOT NULL AUTO_INCREMENT,
194
+  `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '名字',
195
+  `obj_id` int(11) NOT NULL DEFAULT 0 COMMENT '对象ID',
196
+  `type` tinyint(2) NOT NULL DEFAULT 0 COMMENT '1公司2部门3员工',
197
+  `year` int(8) NOT NULL COMMENT '年',
198
+  `january` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '一月',
199
+  `february` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '二月',
200
+  `march` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '三月',
201
+  `april` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '四月',
202
+  `may` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '五月',
203
+  `june` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '六月',
204
+  `july` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '七月',
205
+  `august` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '八月',
206
+  `september` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '九月',
207
+  `october` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '十月',
208
+  `november` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '十一月',
209
+  `december` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '十二月',
210
+  `status` tinyint(2) NOT NULL DEFAULT 0 COMMENT '1销售(目标)2回款(目标)',
211
+  `yeartarget` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '年目标',
212
+  PRIMARY KEY (`achievement_id`) USING BTREE
213
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
214
+
215
+-- ----------------------------
216
+-- Records of 5kcrm_crm_achievement
217
+-- ----------------------------
218
+
219
+-- ----------------------------
220
+-- Table structure for 5kcrm_crm_activity
221
+-- ----------------------------
222
+DROP TABLE IF EXISTS `5kcrm_crm_activity`;
223
+CREATE TABLE `5kcrm_crm_activity`  (
224
+  `activity_id` int(11) NOT NULL AUTO_INCREMENT,
225
+  `types` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '关联类型',
226
+  `activity_type_id` int(11) NOT NULL COMMENT '类型ID',
227
+  `type` int(1) NULL DEFAULT 1 COMMENT '活动类型 1 跟进记录 2 创建记录 3 商机阶段变更 4 外勤签到',
228
+  `status` int(2) NULL DEFAULT 1 COMMENT '0 删除 1 未删除',
229
+  `lng` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '经度',
230
+  `lat` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '纬度',
231
+  `address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '签到地址',
232
+  `customer_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '关联客户',
233
+  `contract_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '关联合同',
234
+  `leads_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '关联线索',
235
+  `activity_type` int(1) NOT NULL COMMENT '活动类型 1 线索 2 客户 3 联系人 4 产品 5 商机 6 合同 7回款 8日志 9审批 10日程 11任务 12 发邮件',
236
+  `content` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '跟进内容',
237
+  `category` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '跟进类型',
238
+  `next_time` int(11) NULL DEFAULT 0 COMMENT '下次联系时间',
239
+  `business_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '商机ID',
240
+  `contacts_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '联系人ID',
241
+  `create_time` int(11) NOT NULL COMMENT '创建时间',
242
+  `update_time` int(11) NOT NULL COMMENT '更新时间',
243
+  `create_user_id` int(11) NOT NULL COMMENT '创建人ID',
244
+  UNIQUE INDEX `activity_id`(`activity_id`) USING BTREE,
245
+  INDEX `create_time`(`create_time`) USING BTREE
246
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '跟进记录' ROW_FORMAT = DYNAMIC;
247
+
248
+-- ----------------------------
249
+-- Records of 5kcrm_crm_activity
250
+-- ----------------------------
251
+
252
+-- ----------------------------
253
+-- Table structure for 5kcrm_crm_activity_file
254
+-- ----------------------------
255
+DROP TABLE IF EXISTS `5kcrm_crm_activity_file`;
256
+CREATE TABLE `5kcrm_crm_activity_file`  (
257
+  `r_id` int(11) NOT NULL AUTO_INCREMENT,
258
+  `activity_id` int(11) NOT NULL COMMENT '活动ID',
259
+  `file_id` int(11) NOT NULL COMMENT '附件ID',
260
+  PRIMARY KEY (`r_id`) USING BTREE
261
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '跟进记录附件关系表' ROW_FORMAT = DYNAMIC;
262
+
263
+-- ----------------------------
264
+-- Records of 5kcrm_crm_activity_file
265
+-- ----------------------------
266
+
267
+-- ----------------------------
268
+-- Table structure for 5kcrm_crm_business
269
+-- ----------------------------
270
+DROP TABLE IF EXISTS `5kcrm_crm_business`;
271
+CREATE TABLE `5kcrm_crm_business`  (
272
+  `business_id` int(11) NOT NULL AUTO_INCREMENT,
273
+  `customer_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户名称',
274
+  `type_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '商机状态组',
275
+  `status_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '商机阶段',
276
+  `status_time` int(11) NOT NULL DEFAULT 0 COMMENT '阶段推进时间',
277
+  `is_end` tinyint(4) NOT NULL DEFAULT 0 COMMENT '1赢单2输单3无效',
278
+  `next_time` int(11) NOT NULL DEFAULT 0 COMMENT '下次联系时间',
279
+  `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '商机名称',
280
+  `money` decimal(18, 2) NULL DEFAULT 0.00 COMMENT '商机金额',
281
+  `total_price` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '产品总金额',
282
+  `deal_date` date NULL DEFAULT NULL COMMENT '预计成交日期',
283
+  `discount_rate` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '整单折扣',
284
+  `remark` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '备注',
285
+  `create_user_id` int(10) NOT NULL COMMENT '创建人ID',
286
+  `owner_user_id` int(10) NOT NULL COMMENT '负责人ID',
287
+  `ro_user_id` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '只读权限',
288
+  `rw_user_id` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '读写权限',
289
+  `create_time` int(11) NOT NULL COMMENT '创建时间',
290
+  `update_time` int(11) NOT NULL COMMENT '更新时间',
291
+  `is_dealt` tinyint(1) NOT NULL DEFAULT 1 COMMENT '是否已经处理(待办事项):1已处理;0未处理;',
292
+  `expire_remind` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否提醒合同到期:1提醒;0提醒',
293
+  `last_time` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '最后跟进时间',
294
+  `last_record` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '最后跟进记录',
295
+  `contacts_id` int(10) NULL DEFAULT NULL,
296
+  PRIMARY KEY (`business_id`) USING BTREE,
297
+  INDEX `bi_analysis`(`create_time`, `is_end`, `owner_user_id`) USING BTREE
298
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商机表' ROW_FORMAT = DYNAMIC;
299
+
300
+-- ----------------------------
301
+-- Records of 5kcrm_crm_business
302
+-- ----------------------------
303
+
304
+-- ----------------------------
305
+-- Table structure for 5kcrm_crm_business_data
306
+-- ----------------------------
307
+DROP TABLE IF EXISTS `5kcrm_crm_business_data`;
308
+CREATE TABLE `5kcrm_crm_business_data`  (
309
+  `business_id` int(10) UNSIGNED NOT NULL COMMENT '商机表ID',
310
+  `field` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段名',
311
+  `content` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '字段内容',
312
+  `create_time` int(10) UNSIGNED NOT NULL COMMENT '创建时间'
313
+) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商机表扩展字段数据' ROW_FORMAT = Dynamic;
314
+
315
+-- ----------------------------
316
+-- Records of 5kcrm_crm_business_data
317
+-- ----------------------------
318
+
319
+-- ----------------------------
320
+-- Table structure for 5kcrm_crm_business_file
321
+-- ----------------------------
322
+DROP TABLE IF EXISTS `5kcrm_crm_business_file`;
323
+CREATE TABLE `5kcrm_crm_business_file`  (
324
+  `r_id` int(11) NOT NULL AUTO_INCREMENT,
325
+  `business_id` int(11) NOT NULL COMMENT '商机ID',
326
+  `file_id` int(11) NOT NULL COMMENT '附件ID',
327
+  PRIMARY KEY (`r_id`) USING BTREE
328
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商机附件关系表' ROW_FORMAT = DYNAMIC;
329
+
330
+-- ----------------------------
331
+-- Records of 5kcrm_crm_business_file
332
+-- ----------------------------
333
+
334
+-- ----------------------------
335
+-- Table structure for 5kcrm_crm_business_log
336
+-- ----------------------------
337
+DROP TABLE IF EXISTS `5kcrm_crm_business_log`;
338
+CREATE TABLE `5kcrm_crm_business_log`  (
339
+  `id` int(11) NOT NULL AUTO_INCREMENT,
340
+  `business_id` int(11) NOT NULL COMMENT '商机id',
341
+  `status_id` int(11) NOT NULL COMMENT '状态id',
342
+  `is_end` tinyint(4) NOT NULL COMMENT '1赢单2输单3无效',
343
+  `create_time` int(11) NOT NULL COMMENT '创建时间',
344
+  `owner_user_id` int(11) NOT NULL COMMENT '负责人',
345
+  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '备注',
346
+  PRIMARY KEY (`id`) USING BTREE
347
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商机推进日志' ROW_FORMAT = DYNAMIC;
348
+
349
+-- ----------------------------
350
+-- Records of 5kcrm_crm_business_log
351
+-- ----------------------------
352
+
353
+-- ----------------------------
354
+-- Table structure for 5kcrm_crm_business_product
355
+-- ----------------------------
356
+DROP TABLE IF EXISTS `5kcrm_crm_business_product`;
357
+CREATE TABLE `5kcrm_crm_business_product`  (
358
+  `r_id` int(11) NOT NULL AUTO_INCREMENT,
359
+  `business_id` int(11) NOT NULL COMMENT '商机ID',
360
+  `product_id` int(11) NOT NULL COMMENT '产品ID',
361
+  `price` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '产品单价',
362
+  `sales_price` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '销售价格',
363
+  `num` decimal(12, 2) NOT NULL DEFAULT 0.00 COMMENT '数量',
364
+  `discount` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '折扣',
365
+  `subtotal` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '小计(折扣后价格)',
366
+  `unit` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '单位',
367
+  PRIMARY KEY (`r_id`) USING BTREE
368
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商机产品关系表' ROW_FORMAT = DYNAMIC;
369
+
370
+-- ----------------------------
371
+-- Records of 5kcrm_crm_business_product
372
+-- ----------------------------
373
+
374
+-- ----------------------------
375
+-- Table structure for 5kcrm_crm_business_status
376
+-- ----------------------------
377
+DROP TABLE IF EXISTS `5kcrm_crm_business_status`;
378
+CREATE TABLE `5kcrm_crm_business_status`  (
379
+  `status_id` int(11) NOT NULL AUTO_INCREMENT,
380
+  `type_id` int(11) NOT NULL COMMENT '商机状态类别ID',
381
+  `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '标识',
382
+  `rate` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '赢单率',
383
+  `order_id` tinyint(4) NOT NULL DEFAULT 0 COMMENT '排序',
384
+  PRIMARY KEY (`status_id`) USING BTREE
385
+) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商机状态' ROW_FORMAT = DYNAMIC;
386
+
387
+-- ----------------------------
388
+-- Records of 5kcrm_crm_business_status
389
+-- ----------------------------
390
+INSERT INTO `5kcrm_crm_business_status` VALUES (1, 0, '赢单', '100', 99);
391
+INSERT INTO `5kcrm_crm_business_status` VALUES (2, 0, '输单', '0', 100);
392
+INSERT INTO `5kcrm_crm_business_status` VALUES (3, 0, '无效', '0', 101);
393
+INSERT INTO `5kcrm_crm_business_status` VALUES (4, 1, '验证客户', '20', 1);
394
+INSERT INTO `5kcrm_crm_business_status` VALUES (5, 1, '需求分析', '15', 2);
395
+INSERT INTO `5kcrm_crm_business_status` VALUES (6, 1, '方案/报价', '30', 3);
396
+INSERT INTO `5kcrm_crm_business_status` VALUES (7, 1, '谈判审核', '30', 4);
397
+
398
+-- ----------------------------
399
+-- Table structure for 5kcrm_crm_business_type
400
+-- ----------------------------
401
+DROP TABLE IF EXISTS `5kcrm_crm_business_type`;
402
+CREATE TABLE `5kcrm_crm_business_type`  (
403
+  `type_id` int(11) NOT NULL AUTO_INCREMENT,
404
+  `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '标识',
405
+  `structure_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '部门ID',
406
+  `create_user_id` int(11) NOT NULL COMMENT '创建人ID',
407
+  `create_time` int(11) NOT NULL COMMENT '创建时间',
408
+  `update_time` int(11) NOT NULL COMMENT '更新时间',
409
+  `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '1启用0禁用',
410
+  `is_display` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '软删除:1显示0不显示',
411
+  PRIMARY KEY (`type_id`) USING BTREE
412
+) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商机状态组类别' ROW_FORMAT = DYNAMIC;
413
+
414
+-- ----------------------------
415
+-- Records of 5kcrm_crm_business_type
416
+-- ----------------------------
417
+INSERT INTO `5kcrm_crm_business_type` VALUES (1, '系统默认', '', 1, 1540973371, 1540973371, 1, 1);
418
+
419
+-- ----------------------------
420
+-- Table structure for 5kcrm_crm_config
421
+-- ----------------------------
422
+DROP TABLE IF EXISTS `5kcrm_crm_config`;
423
+CREATE TABLE `5kcrm_crm_config`  (
424
+  `id` int(11) NOT NULL AUTO_INCREMENT,
425
+  `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '标识',
426
+  `value` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '值',
427
+  `description` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '描述',
428
+  PRIMARY KEY (`id`) USING BTREE
429
+) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = 'CRM管理相关配置' ROW_FORMAT = DYNAMIC;
430
+
431
+-- ----------------------------
432
+-- Records of 5kcrm_crm_config
433
+-- ----------------------------
434
+INSERT INTO `5kcrm_crm_config` VALUES (1, 'follow_day', '7', '距跟进天数');
435
+INSERT INTO `5kcrm_crm_config` VALUES (2, 'deal_day', '30', '距成交天数');
436
+INSERT INTO `5kcrm_crm_config` VALUES (3, 'config', '0', '1启用规则');
437
+INSERT INTO `5kcrm_crm_config` VALUES (4, 'contract_day', '15', '合同到期提醒天数');
438
+INSERT INTO `5kcrm_crm_config` VALUES (5, 'record_type', '[\"\\u6253\\u7535\\u8bdd\",\"\\u53d1\\u90ae\\u4ef6\",\"\\u53d1\\u77ed\\u4fe1\",\"\\u89c1\\u9762\\u62dc\\u8bbf\",\"\\u6d3b\\u52a8\"]', '跟进记录类型');
439
+INSERT INTO `5kcrm_crm_config` VALUES (6, 'contract_config', '1', '1开启');
440
+INSERT INTO `5kcrm_crm_config` VALUES (9, 'activity_phrase', 'a:4:{i:0;s:18:\"电话无人接听\";i:1;s:15:\"客户无意向\";i:2;s:42:\"客户意向度适中,后续继续跟进\";i:3;s:42:\"客户意向度较强,成交几率较大\";}', '跟进记录常用语');
441
+INSERT INTO `5kcrm_crm_config` VALUES (10, 'visit_config', '1', '是否开启回访提醒:1开启;0不开启');
442
+INSERT INTO `5kcrm_crm_config` VALUES (11, 'visit_day', '10', '客户回访提醒天数');
443
+
444
+-- ----------------------------
445
+-- Table structure for 5kcrm_crm_contacts
446
+-- ----------------------------
447
+DROP TABLE IF EXISTS `5kcrm_crm_contacts`;
448
+CREATE TABLE `5kcrm_crm_contacts`  (
449
+  `contacts_id` int(11) NOT NULL AUTO_INCREMENT,
450
+  `customer_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户名称',
451
+  `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '姓名',
452
+  `mobile` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '手机',
453
+  `telephone` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '电话',
454
+  `email` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '电子邮箱',
455
+  `decision` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否关键决策人',
456
+  `post` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '职务',
457
+  `sex` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '性别',
458
+  `detail_address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '地址',
459
+  `remark` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '备注',
460
+  `ro_user_id` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '只读权限',
461
+  `rw_user_id` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '读写权限',
462
+  `create_user_id` int(11) NOT NULL COMMENT '创建人ID',
463
+  `owner_user_id` int(11) NOT NULL COMMENT '负责人ID',
464
+  `next_time` int(11) NULL DEFAULT NULL COMMENT '下次联系时间',
465
+  `primary` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否是首要联系人:1是;0不是',
466
+  `create_time` int(11) NOT NULL COMMENT '创建时间',
467
+  `update_time` int(11) NOT NULL COMMENT '更新时间',
468
+  `last_time` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '最后跟进时间',
469
+  `last_record` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '最后跟进记录',
470
+  PRIMARY KEY (`contacts_id`) USING BTREE
471
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '联系人表' ROW_FORMAT = DYNAMIC;

+ 498
- 0
public/sql/5kcrm4.sql ファイルの表示

@@ -0,0 +1,498 @@
1
+/*
2
+ Navicat Premium Data Transfer
3
+
4
+ Source Server         : localhost
5
+ Source Server Type    : MySQL
6
+ Source Server Version : 50726
7
+ Source Host           : localhost:3306
8
+ Source Schema         : multi_field
9
+
10
+ Target Server Type    : MySQL
11
+ Target Server Version : 50726
12
+ File Encoding         : 65001
13
+
14
+ Date: 23/06/2021 17:58:30
15
+*/
16
+
17
+SET NAMES utf8mb4;
18
+SET FOREIGN_KEY_CHECKS = 0;
19
+
20
+-- ----------------------------
21
+-- Records of 5kcrm_crm_contacts
22
+-- ----------------------------
23
+
24
+-- ----------------------------
25
+-- Table structure for 5kcrm_crm_contacts_business
26
+-- ----------------------------
27
+DROP TABLE IF EXISTS `5kcrm_crm_contacts_business`;
28
+CREATE TABLE `5kcrm_crm_contacts_business`  (
29
+  `id` int(10) NOT NULL AUTO_INCREMENT,
30
+  `contacts_id` int(10) NOT NULL,
31
+  `business_id` int(10) NOT NULL,
32
+  PRIMARY KEY (`id`) USING BTREE
33
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
34
+
35
+-- ----------------------------
36
+-- Records of 5kcrm_crm_contacts_business
37
+-- ----------------------------
38
+
39
+-- ----------------------------
40
+-- Table structure for 5kcrm_crm_contacts_data
41
+-- ----------------------------
42
+DROP TABLE IF EXISTS `5kcrm_crm_contacts_data`;
43
+CREATE TABLE `5kcrm_crm_contacts_data`  (
44
+  `contacts_id` int(10) UNSIGNED NOT NULL COMMENT '联系人表ID',
45
+  `field` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段名',
46
+  `content` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '字段内容',
47
+  `create_time` int(10) UNSIGNED NOT NULL COMMENT '创建时间'
48
+) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '联系人表扩展字段数据' ROW_FORMAT = Dynamic;
49
+
50
+-- ----------------------------
51
+-- Records of 5kcrm_crm_contacts_data
52
+-- ----------------------------
53
+
54
+-- ----------------------------
55
+-- Table structure for 5kcrm_crm_contacts_file
56
+-- ----------------------------
57
+DROP TABLE IF EXISTS `5kcrm_crm_contacts_file`;
58
+CREATE TABLE `5kcrm_crm_contacts_file`  (
59
+  `r_id` int(11) NOT NULL AUTO_INCREMENT,
60
+  `contacts_id` int(11) NOT NULL COMMENT '联系人ID',
61
+  `file_id` int(11) NOT NULL COMMENT '附件ID',
62
+  PRIMARY KEY (`r_id`) USING BTREE
63
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '联系人附件关系表' ROW_FORMAT = DYNAMIC;
64
+
65
+-- ----------------------------
66
+-- Records of 5kcrm_crm_contacts_file
67
+-- ----------------------------
68
+
69
+-- ----------------------------
70
+-- Table structure for 5kcrm_crm_contract
71
+-- ----------------------------
72
+DROP TABLE IF EXISTS `5kcrm_crm_contract`;
73
+CREATE TABLE `5kcrm_crm_contract`  (
74
+  `contract_id` int(11) NOT NULL AUTO_INCREMENT,
75
+  `customer_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户名称',
76
+  `business_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '商机名称',
77
+  `contacts_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户签约人',
78
+  `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '合同名称',
79
+  `num` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '合同编号',
80
+  `order_date` date NULL DEFAULT NULL COMMENT '下单时间',
81
+  `money` decimal(18, 2) NULL DEFAULT 0.00 COMMENT '合同金额',
82
+  `total_price` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '产品总金额',
83
+  `discount_rate` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '整单折扣',
84
+  `check_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '0待审核、1审核中、2审核通过、3审核未通过、4撤销、5草稿(未提交)',
85
+  `flow_id` int(11) NOT NULL DEFAULT 0 COMMENT '审核流程ID',
86
+  `order_id` int(11) NOT NULL DEFAULT 0 COMMENT '审核步骤排序ID',
87
+  `check_user_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '审批人IDs',
88
+  `flow_user_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '流程审批人ID',
89
+  `start_time` date NULL DEFAULT NULL COMMENT '合同开始时间',
90
+  `end_time` date NULL DEFAULT NULL COMMENT '合同到期时间',
91
+  `order_user_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '公司签约人',
92
+  `remark` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '备注',
93
+  `create_user_id` int(10) NOT NULL COMMENT '创建人ID',
94
+  `owner_user_id` int(10) NOT NULL COMMENT '负责人ID',
95
+  `ro_user_id` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '只读权限',
96
+  `rw_user_id` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '读写权限',
97
+  `next_time` int(11) NOT NULL DEFAULT 0 COMMENT '下次联系时间',
98
+  `create_time` int(11) NOT NULL COMMENT '创建时间',
99
+  `update_time` int(11) NOT NULL COMMENT '更新时间',
100
+  `is_visit` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否已回访:1已回访;2未回访',
101
+  `expire_remind` tinyint(1) NOT NULL DEFAULT 1 COMMENT '是否提醒合同到期:1提醒;0提醒',
102
+  `last_time` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '最后跟进时间',
103
+  `last_record` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '最后跟进记录',
104
+  PRIMARY KEY (`contract_id`) USING BTREE,
105
+  INDEX `bi_analysis`(`check_status`, `customer_id`, `order_date`) USING BTREE
106
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '合同表' ROW_FORMAT = DYNAMIC;
107
+
108
+-- ----------------------------
109
+-- Records of 5kcrm_crm_contract
110
+-- ----------------------------
111
+
112
+-- ----------------------------
113
+-- Table structure for 5kcrm_crm_contract_data
114
+-- ----------------------------
115
+DROP TABLE IF EXISTS `5kcrm_crm_contract_data`;
116
+CREATE TABLE `5kcrm_crm_contract_data`  (
117
+  `contract_id` int(10) UNSIGNED NOT NULL COMMENT '合同表ID',
118
+  `field` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段名',
119
+  `content` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '字段内容',
120
+  `create_time` int(10) UNSIGNED NOT NULL COMMENT '创建时间'
121
+) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '合同表扩展字段数据' ROW_FORMAT = Dynamic;
122
+
123
+-- ----------------------------
124
+-- Records of 5kcrm_crm_contract_data
125
+-- ----------------------------
126
+
127
+-- ----------------------------
128
+-- Table structure for 5kcrm_crm_contract_file
129
+-- ----------------------------
130
+DROP TABLE IF EXISTS `5kcrm_crm_contract_file`;
131
+CREATE TABLE `5kcrm_crm_contract_file`  (
132
+  `r_id` int(11) NOT NULL AUTO_INCREMENT,
133
+  `contract_id` int(11) NOT NULL COMMENT '合同ID',
134
+  `file_id` int(11) NOT NULL COMMENT '附件ID',
135
+  PRIMARY KEY (`r_id`) USING BTREE
136
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '合同附件关系表' ROW_FORMAT = DYNAMIC;
137
+
138
+-- ----------------------------
139
+-- Records of 5kcrm_crm_contract_file
140
+-- ----------------------------
141
+
142
+-- ----------------------------
143
+-- Table structure for 5kcrm_crm_contract_product
144
+-- ----------------------------
145
+DROP TABLE IF EXISTS `5kcrm_crm_contract_product`;
146
+CREATE TABLE `5kcrm_crm_contract_product`  (
147
+  `r_id` int(11) NOT NULL AUTO_INCREMENT,
148
+  `contract_id` int(11) NOT NULL COMMENT '合同ID',
149
+  `product_id` int(11) NOT NULL COMMENT '产品ID',
150
+  `price` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '产品单价',
151
+  `sales_price` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '销售价格',
152
+  `num` decimal(12, 2) NOT NULL DEFAULT 0.00 COMMENT '数量',
153
+  `discount` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '折扣',
154
+  `subtotal` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '小计(折扣后价格)',
155
+  `unit` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '单位',
156
+  PRIMARY KEY (`r_id`) USING BTREE
157
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '合同产品关系表' ROW_FORMAT = DYNAMIC;
158
+
159
+-- ----------------------------
160
+-- Records of 5kcrm_crm_contract_product
161
+-- ----------------------------
162
+
163
+-- ----------------------------
164
+-- Table structure for 5kcrm_crm_customer
165
+-- ----------------------------
166
+DROP TABLE IF EXISTS `5kcrm_crm_customer`;
167
+CREATE TABLE `5kcrm_crm_customer`  (
168
+  `customer_id` int(11) NOT NULL AUTO_INCREMENT,
169
+  `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户名称',
170
+  `is_lock` tinyint(1) NOT NULL DEFAULT 0 COMMENT '1锁定',
171
+  `deal_time` int(11) NOT NULL COMMENT '领取,分配,创建时间',
172
+  `level` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户级别',
173
+  `industry` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户行业',
174
+  `source` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户来源',
175
+  `telephone` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '电话',
176
+  `mobile` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '手机',
177
+  `website` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '网址',
178
+  `remark` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '备注',
179
+  `create_user_id` int(11) NOT NULL COMMENT '创建人ID',
180
+  `owner_user_id` int(11) NOT NULL COMMENT '负责人ID',
181
+  `ro_user_id` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '只读权限',
182
+  `rw_user_id` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '读写权限',
183
+  `address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '省市区',
184
+  `location` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '定位信息',
185
+  `detail_address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '详细地址',
186
+  `lng` double(14, 11) NULL DEFAULT NULL COMMENT '地理位置经度',
187
+  `lat` double(14, 11) NULL DEFAULT NULL COMMENT '地理位置维度',
188
+  `next_time` int(11) NULL DEFAULT NULL COMMENT '下次联系时间',
189
+  `follow` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '跟进',
190
+  `obtain_time` int(10) NOT NULL DEFAULT 0 COMMENT '负责人获取客户时间',
191
+  `create_time` int(11) NOT NULL COMMENT '创建时间',
192
+  `update_time` int(11) NOT NULL COMMENT '更新时间',
193
+  `is_dealt` tinyint(1) NOT NULL DEFAULT 1 COMMENT '是否已经处理(待办事项):1已处理;0未处理;',
194
+  `is_allocation` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否是分配给我的客户:1是;0不是',
195
+  `last_time` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '最后跟进时间',
196
+  `last_record` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '最后跟进记录',
197
+  `email` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '邮箱',
198
+  `before_owner_user_id` int(10) UNSIGNED NULL DEFAULT 0 COMMENT '前负责人',
199
+  `into_pool_time` int(10) UNSIGNED NULL DEFAULT 0 COMMENT '进入公海时间',
200
+  `pool_remain` tinyint(1) NOT NULL DEFAULT 0 COMMENT '代办事项待进入公海:1已处理,0未处理',
201
+  `deal_status` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '未成交' COMMENT '成交状态',
202
+  PRIMARY KEY (`customer_id`) USING BTREE,
203
+  INDEX `bi_analysis`(`create_time`, `owner_user_id`) USING BTREE
204
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '客户表' ROW_FORMAT = DYNAMIC;
205
+
206
+-- ----------------------------
207
+-- Records of 5kcrm_crm_customer
208
+-- ----------------------------
209
+
210
+-- ----------------------------
211
+-- Table structure for 5kcrm_crm_customer_config
212
+-- ----------------------------
213
+DROP TABLE IF EXISTS `5kcrm_crm_customer_config`;
214
+CREATE TABLE `5kcrm_crm_customer_config`  (
215
+  `id` int(11) NOT NULL AUTO_INCREMENT,
216
+  `user_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '员工',
217
+  `structure_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '部门',
218
+  `types` tinyint(4) NOT NULL DEFAULT 1 COMMENT '1拥有客户上限2锁定客户上限',
219
+  `value` int(10) NOT NULL COMMENT '数值',
220
+  `is_deal` tinyint(4) NOT NULL COMMENT '1成交客户',
221
+  `create_time` int(11) NOT NULL COMMENT '创建时间',
222
+  `update_time` int(11) NOT NULL COMMENT '更新时间',
223
+  PRIMARY KEY (`id`) USING BTREE
224
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '客户配置表(锁定、拥有)' ROW_FORMAT = DYNAMIC;
225
+
226
+-- ----------------------------
227
+-- Records of 5kcrm_crm_customer_config
228
+-- ----------------------------
229
+
230
+-- ----------------------------
231
+-- Table structure for 5kcrm_crm_customer_data
232
+-- ----------------------------
233
+DROP TABLE IF EXISTS `5kcrm_crm_customer_data`;
234
+CREATE TABLE `5kcrm_crm_customer_data`  (
235
+  `customer_id` int(10) UNSIGNED NOT NULL COMMENT '客户表ID',
236
+  `field` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段名',
237
+  `content` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '字段内容',
238
+  `create_time` int(10) UNSIGNED NOT NULL COMMENT '创建时间'
239
+) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '客户表扩展字段数据' ROW_FORMAT = Dynamic;
240
+
241
+-- ----------------------------
242
+-- Records of 5kcrm_crm_customer_data
243
+-- ----------------------------
244
+
245
+-- ----------------------------
246
+-- Table structure for 5kcrm_crm_customer_file
247
+-- ----------------------------
248
+DROP TABLE IF EXISTS `5kcrm_crm_customer_file`;
249
+CREATE TABLE `5kcrm_crm_customer_file`  (
250
+  `r_id` int(11) NOT NULL AUTO_INCREMENT,
251
+  `customer_id` int(11) NOT NULL COMMENT '客户ID',
252
+  `file_id` int(11) NOT NULL COMMENT '附件ID',
253
+  PRIMARY KEY (`r_id`) USING BTREE
254
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '客户附件关系表' ROW_FORMAT = DYNAMIC;
255
+
256
+-- ----------------------------
257
+-- Records of 5kcrm_crm_customer_file
258
+-- ----------------------------
259
+
260
+-- ----------------------------
261
+-- Table structure for 5kcrm_crm_customer_pool
262
+-- ----------------------------
263
+DROP TABLE IF EXISTS `5kcrm_crm_customer_pool`;
264
+CREATE TABLE `5kcrm_crm_customer_pool`  (
265
+  `pool_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
266
+  `pool_name` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '名称',
267
+  `admin_user_ids` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '管理员IDS',
268
+  `user_ids` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '成员IDS',
269
+  `department_ids` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '部门IDS',
270
+  `status` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态:1启用,0停用',
271
+  `before_owner_conf` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '前负责人领取规则:1限制,0不限制',
272
+  `before_owner_day` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '前负责人领取规则限制天数',
273
+  `receive_conf` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '领取频率规则:1限制,0不限制',
274
+  `receive_count` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '领取频率个数',
275
+  `remind_conf` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '提醒规则:1开启,0不开启',
276
+  `remain_day` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '提前几天提醒',
277
+  `recycle_conf` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '自动回收规则:1自动回收,0不自动回收',
278
+  `create_user_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建人',
279
+  `create_time` int(10) UNSIGNED NOT NULL COMMENT '创建时间',
280
+  PRIMARY KEY (`pool_id`) USING BTREE
281
+) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '公海表' ROW_FORMAT = DYNAMIC;
282
+
283
+-- ----------------------------
284
+-- Records of 5kcrm_crm_customer_pool
285
+-- ----------------------------
286
+INSERT INTO `5kcrm_crm_customer_pool` VALUES (1, '系统默认公海', ',1,', ',1,2,3,4,', '', 1, 0, 0, 0, 0, 0, 0, 1, 1, 1624437604);
287
+
288
+-- ----------------------------
289
+-- Table structure for 5kcrm_crm_customer_pool_field_setting
290
+-- ----------------------------
291
+DROP TABLE IF EXISTS `5kcrm_crm_customer_pool_field_setting`;
292
+CREATE TABLE `5kcrm_crm_customer_pool_field_setting`  (
293
+  `setting_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
294
+  `pool_id` int(10) UNSIGNED NOT NULL COMMENT '公海ID',
295
+  `name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段中文名',
296
+  `field_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段英文名',
297
+  `form_type` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段类型,与5kcrm_admin_field表的form_type类型一致',
298
+  `is_hidden` tinyint(1) UNSIGNED NOT NULL COMMENT '是否隐藏:1隐藏,0不隐藏',
299
+  `is_null` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否必填:1必填,0不是必填',
300
+  `is_unique` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否唯一:1唯一,0不唯一',
301
+  PRIMARY KEY (`setting_id`) USING BTREE
302
+) ENGINE = InnoDB AUTO_INCREMENT = 42 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '公海字段表' ROW_FORMAT = DYNAMIC;
303
+
304
+-- ----------------------------
305
+-- Records of 5kcrm_crm_customer_pool_field_setting
306
+-- ----------------------------
307
+INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (1, 1, '客户名称', 'name', 'text', 0, 1, 1);
308
+INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (2, 1, '客户级别', 'level', 'select', 0, 0, 0);
309
+INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (3, 1, '客户行业', 'industry', 'select', 0, 0, 0);
310
+INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (4, 1, '客户来源', 'source', 'select', 0, 0, 0);
311
+INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (5, 1, '电话', 'telephone', 'text', 0, 0, 0);
312
+INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (6, 1, '网址', 'website', 'text', 0, 0, 0);
313
+INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (7, 1, '下次联系时间', 'next_time', 'datetime', 0, 0, 0);
314
+INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (8, 1, '备注', 'remark', 'textarea', 0, 0, 0);
315
+INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (9, 1, '手机', 'mobile', 'mobile', 0, 0, 0);
316
+INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (10, 1, '邮箱', 'email', 'email', 0, 0, 0);
317
+INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (33, 1, '省、市、区/县', 'address', 'customer_address', 0, 0, 0);
318
+INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (34, 1, '详细地址', 'detail_address', 'text', 0, 0, 0);
319
+INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (35, 1, '最后跟进记录', 'last_record', 'text', 0, 0, 0);
320
+INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (36, 1, '最后跟进时间', 'last_time', 'datetime', 0, 0, 0);
321
+INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (37, 1, '前负责人', 'before_owner_user_id', 'user', 0, 0, 0);
322
+INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (38, 1, '进入公海时间', 'into_pool_time', 'datetime', 0, 0, 0);
323
+INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (39, 1, '创建时间', 'create_time', 'datetime', 0, 0, 0);
324
+INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (40, 1, '更新时间', 'update_time', 'datetime', 0, 0, 0);
325
+INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (41, 1, '创建人', 'create_user_id', 'user', 0, 0, 0);
326
+
327
+-- ----------------------------
328
+-- Table structure for 5kcrm_crm_customer_pool_field_style
329
+-- ----------------------------
330
+DROP TABLE IF EXISTS `5kcrm_crm_customer_pool_field_style`;
331
+CREATE TABLE `5kcrm_crm_customer_pool_field_style`  (
332
+  `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
333
+  `user_id` int(10) UNSIGNED NOT NULL COMMENT '用户ID',
334
+  `pool_id` int(10) UNSIGNED NOT NULL COMMENT '公海ID',
335
+  `content` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '字段内容',
336
+  `create_time` int(10) NOT NULL COMMENT '创建时间',
337
+  `update_time` int(10) NOT NULL COMMENT '更新时间',
338
+  PRIMARY KEY (`id`) USING BTREE
339
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '公海字段样式表' ROW_FORMAT = DYNAMIC;
340
+
341
+-- ----------------------------
342
+-- Records of 5kcrm_crm_customer_pool_field_style
343
+-- ----------------------------
344
+
345
+-- ----------------------------
346
+-- Table structure for 5kcrm_crm_customer_pool_record
347
+-- ----------------------------
348
+DROP TABLE IF EXISTS `5kcrm_crm_customer_pool_record`;
349
+CREATE TABLE `5kcrm_crm_customer_pool_record`  (
350
+  `record_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
351
+  `customer_id` int(10) UNSIGNED NOT NULL COMMENT '客户ID',
352
+  `user_id` int(10) UNSIGNED NOT NULL COMMENT '员工ID',
353
+  `pool_id` int(10) UNSIGNED NOT NULL COMMENT '公海ID',
354
+  `type` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '类型:1领取公海客户;2将客户放入公海',
355
+  `create_time` int(10) UNSIGNED NOT NULL COMMENT '创建时间',
356
+  PRIMARY KEY (`record_id`) USING BTREE
357
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '公海操作记录(领取公海客户、将客户放入公海)' ROW_FORMAT = DYNAMIC;
358
+
359
+-- ----------------------------
360
+-- Records of 5kcrm_crm_customer_pool_record
361
+-- ----------------------------
362
+
363
+-- ----------------------------
364
+-- Table structure for 5kcrm_crm_customer_pool_relation
365
+-- ----------------------------
366
+DROP TABLE IF EXISTS `5kcrm_crm_customer_pool_relation`;
367
+CREATE TABLE `5kcrm_crm_customer_pool_relation`  (
368
+  `relation_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
369
+  `pool_id` int(10) UNSIGNED NOT NULL COMMENT '公海ID',
370
+  `customer_id` int(10) UNSIGNED NOT NULL COMMENT '客户ID',
371
+  PRIMARY KEY (`relation_id`) USING BTREE
372
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '公海与客户关联表' ROW_FORMAT = DYNAMIC;
373
+
374
+-- ----------------------------
375
+-- Records of 5kcrm_crm_customer_pool_relation
376
+-- ----------------------------
377
+
378
+-- ----------------------------
379
+-- Table structure for 5kcrm_crm_customer_pool_rule
380
+-- ----------------------------
381
+DROP TABLE IF EXISTS `5kcrm_crm_customer_pool_rule`;
382
+CREATE TABLE `5kcrm_crm_customer_pool_rule`  (
383
+  `rule_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
384
+  `pool_id` int(10) UNSIGNED NOT NULL COMMENT '公海ID',
385
+  `type` tinyint(1) UNSIGNED NOT NULL COMMENT '收回规则类型:1跟进记录;2商机;3成交状态',
386
+  `deal_handle` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '选择不进入公海客户(成交客户):1已选,0未选',
387
+  `business_handle` tinyint(1) UNSIGNED NOT NULL COMMENT '选择不进入公海客户(有商机客户):1已选,0不选',
388
+  `level_conf` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '客户级别设置:1全部,2根据客户级别设置',
389
+  `level` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '客户级别的设置数据',
390
+  `limit_day` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '公海规则限制天数',
391
+  PRIMARY KEY (`rule_id`) USING BTREE
392
+) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '公海规则表' ROW_FORMAT = DYNAMIC;
393
+
394
+-- ----------------------------
395
+-- Records of 5kcrm_crm_customer_pool_rule
396
+-- ----------------------------
397
+INSERT INTO `5kcrm_crm_customer_pool_rule` VALUES (1, 1, 1, 0, 0, 1, '[{\"level\":\"\\u6240\\u6709\\u5ba2\\u6237\",\"limit_day\":30}]', 0);
398
+
399
+-- ----------------------------
400
+-- Table structure for 5kcrm_crm_dashboard
401
+-- ----------------------------
402
+DROP TABLE IF EXISTS `5kcrm_crm_dashboard`;
403
+CREATE TABLE `5kcrm_crm_dashboard`  (
404
+  `id` int(11) NOT NULL AUTO_INCREMENT,
405
+  `dashboard` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
406
+  `user_id` int(4) NOT NULL COMMENT '创建人 、修改人',
407
+  PRIMARY KEY (`id`) USING BTREE
408
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '仪表盘样式' ROW_FORMAT = DYNAMIC;
409
+
410
+-- ----------------------------
411
+-- Records of 5kcrm_crm_dashboard
412
+-- ----------------------------
413
+
414
+-- ----------------------------
415
+-- Table structure for 5kcrm_crm_dealt_relation
416
+-- ----------------------------
417
+DROP TABLE IF EXISTS `5kcrm_crm_dealt_relation`;
418
+CREATE TABLE `5kcrm_crm_dealt_relation`  (
419
+  `dealt_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
420
+  `types` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '类型:crm_contract;crm_invoice;crm_receivables',
421
+  `types_id` int(10) UNSIGNED NOT NULL COMMENT '类型ID',
422
+  `user_id` int(10) UNSIGNED NOT NULL COMMENT '用户ID',
423
+  PRIMARY KEY (`dealt_id`) USING BTREE
424
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '待办事项关联表' ROW_FORMAT = DYNAMIC;
425
+
426
+-- ----------------------------
427
+-- Records of 5kcrm_crm_dealt_relation
428
+-- ----------------------------
429
+
430
+-- ----------------------------
431
+-- Table structure for 5kcrm_crm_invoice
432
+-- ----------------------------
433
+DROP TABLE IF EXISTS `5kcrm_crm_invoice`;
434
+CREATE TABLE `5kcrm_crm_invoice`  (
435
+  `invoice_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
436
+  `invoice_apple_number` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '发票申请编号',
437
+  `customer_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户名称',
438
+  `contract_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '合同编号',
439
+  `invoice_money` decimal(18, 2) NULL DEFAULT 0.00 COMMENT '开票金额',
440
+  `invoice_date` date NULL DEFAULT NULL COMMENT '开票日期',
441
+  `invoice_type` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '开票类型',
442
+  `remark` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '备注',
443
+  `title_type` tinyint(1) NOT NULL COMMENT '抬头类型:1企业;2个人',
444
+  `invoice_title` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '开票抬头',
445
+  `tax_number` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '纳税人识别号',
446
+  `deposit_account` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '开户账号',
447
+  `deposit_address` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '开票地址',
448
+  `phone` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '电话',
449
+  `contacts_name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '联系人',
450
+  `contacts_mobile` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '联系方式',
451
+  `contacts_address` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '联系地址',
452
+  `real_invoice_date` date NULL DEFAULT NULL COMMENT '实际开票日期',
453
+  `invoice_number` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '发票号码',
454
+  `logistics_number` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '物流单号',
455
+  `create_user_id` int(10) UNSIGNED NOT NULL COMMENT '创建人ID',
456
+  `owner_user_id` int(10) NOT NULL COMMENT '负责人ID',
457
+  `check_status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0待审核;1审核中;2审核通过;3审核未通过;4撤回',
458
+  `flow_id` int(10) NULL DEFAULT 0 COMMENT '审核流程ID',
459
+  `order_id` int(10) NULL DEFAULT 0 COMMENT '审核步骤排序ID',
460
+  `check_user_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '审批人IDs',
461
+  `flow_user_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '流程审批人ID',
462
+  `invoice_status` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '发票状态:0未开票;1已开票',
463
+  `update_time` int(10) NOT NULL COMMENT '修改日期',
464
+  `create_time` int(10) NOT NULL COMMENT '创建日期',
465
+  `deposit_bank` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '开户行',
466
+  `contract_money` decimal(18, 2) NULL DEFAULT 0.00 COMMENT '合同金额',
467
+  PRIMARY KEY (`invoice_id`) USING BTREE
468
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
469
+
470
+-- ----------------------------
471
+-- Records of 5kcrm_crm_invoice
472
+-- ----------------------------
473
+
474
+-- ----------------------------
475
+-- Table structure for 5kcrm_crm_invoice_data
476
+-- ----------------------------
477
+DROP TABLE IF EXISTS `5kcrm_crm_invoice_data`;
478
+CREATE TABLE `5kcrm_crm_invoice_data`  (
479
+  `invoice_id` int(10) UNSIGNED NOT NULL COMMENT '发票表ID',
480
+  `field` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段名',
481
+  `content` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '字段内容',
482
+  `create_time` int(10) UNSIGNED NOT NULL COMMENT '创建时间'
483
+) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '发票表扩展字段数据' ROW_FORMAT = Dynamic;
484
+
485
+-- ----------------------------
486
+-- Records of 5kcrm_crm_invoice_data
487
+-- ----------------------------
488
+
489
+-- ----------------------------
490
+-- Table structure for 5kcrm_crm_invoice_file
491
+-- ----------------------------
492
+DROP TABLE IF EXISTS `5kcrm_crm_invoice_file`;
493
+CREATE TABLE `5kcrm_crm_invoice_file`  (
494
+  `r_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
495
+  `invoice_id` int(10) UNSIGNED NOT NULL COMMENT '发票ID',
496
+  `file_id` int(10) NOT NULL COMMENT '附件ID',
497
+  PRIMARY KEY (`r_id`) USING BTREE
498
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '发票附件关联表' ROW_FORMAT = DYNAMIC;

+ 1127
- 0
public/sql/5kcrm5.sql
ファイル差分が大きすぎるため省略します
ファイルの表示


+ 45
- 6
public/static/js/step2.js ファイルの表示

@@ -49,8 +49,8 @@ var rules = {
49 49
   wkcode: {
50 50
     required: false,
51 51
     regexp: null,
52
-    label: '序列号'
53
-  },  
52
+    label: ''
53
+  },
54 54
 };
55 55
 
56 56
 var timer = null;
@@ -84,22 +84,61 @@ $('.next').click(function () {
84 84
         async: true,
85 85
         timeout: 120000,
86 86
         success: function (result) {
87
+          const step7 = $.ajax({
88
+            url:'./step7',
89
+            dataType:'json',
90
+            type: "POST",
91
+            data: {
92
+              form: forms
93
+            },
94
+          })
95
+          const step8 = $.ajax({
96
+            url:'./step8',
97
+            dataType:'json',
98
+            type: "POST",
99
+            data: {
100
+              form: forms
101
+            },
102
+          })
103
+          const step10 = $.ajax({
104
+            url:'./step10',
105
+            dataType:'json',
106
+            type: "POST",
107
+            data: {
108
+              form: forms
109
+            },
110
+
111
+          })
112
+          const step11 = $.ajax({
113
+            url:'./step11',
114
+            dataType:'json',
115
+            type: "POST",
116
+            data: {
117
+              form: forms
118
+            },
119
+          })
120
+
87 121
           if (result.code == '200') {
122
+
123
+            Promise.all([step7,step8,step10,step11]).then(res=>{
124
+              const [step7Res,step8Res,step10Res,step11Res] =res
125
+            })
88 126
             localStorage.clear();
89 127
             window.location = 'step5.html';
90 128
           } else if (result.code == '400') {
91
-            // alert(result.error);
129
+            alert(result.error);
92 130
             window.location.href = 'step6.html';
93 131
           } else {
94
-            // alert(result.error);
132
+            alert(result.error);
95 133
             window.location.href = 'step6.html';
96 134
           }
97 135
         },
98 136
         error: function (xhr) {
99 137
           window.location.href = 'step6.html';
100 138
         }
101
-      }); 
102
-    })   
139
+      });
140
+
141
+    })
103 142
   }
104 143
 });
105 144