diff --git a/application/admin/controller/Examine.php b/application/admin/controller/Examine.php new file mode 100644 index 0000000..69ebd16 --- /dev/null +++ b/application/admin/controller/Examine.php @@ -0,0 +1,633 @@ +[], + 'allow'=>['index','save','update','read','delete','enables','steplist','userlist','recordlist'] + ]; + Hook::listen('check_auth',$action); + $request = Request::instance(); + $a = strtolower($request->action()); + if (!in_array($a, $action['permission'])) { + parent::_initialize(); + } + //权限判断 + $unAction = ['steplist','userlist','recordlist']; + if (!in_array($a, $unAction) && !checkPerByAction('admin', 'examine_flow', 'index')) { + header('Content-Type:application/json; charset=utf-8'); + exit(json_encode(['code'=>102,'error'=>'无权操作'])); + } + } + + /** + * 审批流程列表 + * @author zjf + * @return + */ + public function index() + { + $examinewModel = model('Examine'); + $param = $this->param; + //过滤审批类型中关联的审批流 + // $param['types'] = ['neq','oa_examine']; + $data = $examinewModel->getDataList($param); + return resultArray(['data' => $data]); + } + + /** + * 审批流程详情 + * @author zjf + * @param + * @return + */ + public function read() + { + $examineModel = model('Examine'); + $param = $this->param; + $res = $examineModel->getDataById($param['id']); + if (!$res) { + return resultArray(['error' => $examineFlowModel->getError()]); + } + return resultArray(['data' => $res]); + } + + /** + * 添加审批流程 + * + * @return \think\response\Json + * @throws \think\Exception + * @throws \think\exception\PDOException + */ + public function save() + { + $examineModel = model('Examine'); + $param = $this->param; + $userInfo = $this->userInfo; +$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}'; +$param = object_to_array(json_decode($a)); +$param['examineId'] = 2; + + // 主表 审批表 信息 + db('examine')->where(['examine_id' => $param['examineId']])->update(['examine_name'=>$param['examineName'], 'label'=>$param['label'], 'remarks'=>$param['remarks'], 'recheck_type'=>$param['recheckType']]); + + // 删除 相关表数据 + $flow_ids = db('examine_flow')->where(['examine_id' => $param['examineId']])->column('flow_id'); + db('examine_flow')->where(['flow_id' => ['in', $flow_ids]])->delete(); + db('examine_condition')->where(['flow_id' => ['in', $flow_ids]])->delete(); + db('examine_condition_data')->where(['flow_id' => ['in', $flow_ids]])->delete(); + + db('examine_flow_continuous_superior')->where(['flow_id' => ['in', $flow_ids]])->delete(); + db('examine_flow_member')->where(['flow_id' => ['in', $flow_ids]])->delete(); + db('examine_flow_optional')->where(['flow_id' => ['in', $flow_ids]])->delete(); + db('examine_flow_role')->where(['flow_id' => ['in', $flow_ids]])->delete(); + db('examine_flow_superior')->where(['flow_id' => ['in', $flow_ids]])->delete(); + + // 审批管理员 + db('examine_manager_user')->where(['examine_id' => $param['examineId']])->delete(); + $managerUser = []; + foreach ($param['managerList'] as $key => $value) { + $arr['examine_id'] = $param['examineId']; + $arr['user_id'] = $value; + $arr['sort'] = $key; + $managerUser[] = $arr; + } + db('examine_manager_user')->insertAll($managerUser); + + $create_time = date('Y-m-d H:i:s'); + $userId = $userInfo['id']; + // 审批流程 + foreach ($param['dataList'] as $k => $v) { + $condition_id = 0; + // 处理流程 0 条件 1 指定成员 2 主管 3 角色 4 发起人自选 5 连续多级主管 7 发起人 + $flow = []; + $flow['name'] = $v['name']; + $flow['examine_id'] = $param['examineId']; + $flow['examine_type'] = $v['examineType']; + $flow['examine_error_handling'] = $v['examineErrorHandling'] ? : 1; + $flow['condition_id'] = $condition_id; + $flow['sort'] = $k; + $flow['create_time'] = $create_time; + $flow['create_user_id'] = $userId; + $flowId = db('examine_flow')->insertGetId($flow); + + // 1 指定成员 2 主管 3 角色 4 发起人自选 5 连续多级主管 7 发起人 + $examine_flow = []; + switch ($v['examineType']) { + case '1' : + foreach ($v['userList'] as $key => $value) { + $examine_flow[$key]['sort'] = $key; + $examine_flow[$key]['type'] = $v['type']; + $examine_flow[$key]['user_id'] = $value; + $examine_flow[$key]['flow_id'] = $flowId; + } + db('examine_flow_member')->insertAll($examine_flow); + break; + case '2' : + $examine_flow['flow_id'] = $flowId; + $examine_flow['parent_level'] = $v['parentLevel']; + $examine_flow['type'] = $v['type']; + db('examine_flow_superior')->insert($examine_flow); + break; + case '3' : + $examine_flow['flow_id'] = $flowId; + $examine_flow['role_id'] = $v['roleId']; + $examine_flow['type'] = $v['type']; + db('examine_flow_role')->insert($examine_flow); + break; + case '4' : + foreach ($v['userList'] as $key => $value) { + $examine_flow[$key]['sort'] = $key; + $examine_flow[$key]['type'] = $v['type']; + $examine_flow[$key]['user_id'] = $value; + $examine_flow[$key]['flow_id'] = $flowId; + $examine_flow[$key]['role_id'] = $v['roleId']; + $examine_flow[$key]['choose_type'] = $v['chooseType']; + $examine_flow[$key]['range_type'] = $v['rangeType']; + } + db('examine_flow_optional')->insertAll($examine_flow); + break; + case '5' : + $examine_flow['flow_id'] = $flowId; + $examine_flow['role_id'] = $v['roleId']; + $examine_flow['max_level'] = $v['parentLevel']; + $examine_flow['type'] = $v['type']; + db('examine_flow_continuous_superior')->insert($examine_flow); + break; + // case '7' : + // break; + } + + foreach ($v['conditionList'] as $k1 => $v1) { + // 处理条件 + $condition['condition_name'] = $v1['conditionName']; + $condition['priority'] = $v1['sort']; + $condition['create_time'] = $create_time; + $condition['create_user_id'] = $userId; + $condition['flow_id'] = $flowId; + $condition_id = db('examine_condition')->insertGetId($condition); + + // 处理条件 扩展 + foreach ($v1['conditionDataList'] as $kc => $vc) { + $conditionDate = []; + $conditionDate['field_id'] = $vc['fieldId']; + $conditionDate['field_name'] = $vc['fieldName'] ? : ''; + $conditionDate['condition_type'] = $vc['conditionType']; + $conditionDate['value'] = json_encode($vc['values']); + $conditionDate['name'] = $vc['name']; + $conditionDate['type'] = $vc['type']; + $conditionDate['condition_id'] = $condition_id; + $conditionDate['flow_id'] = $flowId; + $condition_data_id = db('examine_condition_data')->insertGetId($conditionDate); + } + if(!empty($v1['examineDataList'])){ + $this->recursion($v1['examineDataList'], $userId, $condition_id, $param['examineId'], $create_time); + } + } + } + return resultArray(['data' => $param]); + } + + + public function recursion ($conditionList, $userId, $condition_id, $examineId, $create_time) + { + foreach ($conditionList as $k => $v) { + // 处理流程 0 条件 1 指定成员 2 主管 3 角色 4 发起人自选 5 连续多级主管 7 发起人 + $flow = []; + $flow['name'] = $v['name']; + $flow['examine_id'] = $examineId; + $flow['examine_type'] = $v['examineType']; + $flow['examine_error_handling'] = $v['examineErrorHandling'] ? : 1; + $flow['condition_id'] = $condition_id; + $flow['sort'] = $k; + $flow['create_time'] = $create_time; + $flow['create_user_id'] = $userId; + $flowId = db('examine_flow')->insertGetId($flow); + + // 1 指定成员 2 主管 3 角色 4 发起人自选 5 连续多级主管 7 发起人 + $examine_flow = []; + switch ($v['examineType']) { + case '1' : + foreach ($v['userList'] as $key => $value) { + $examine_flow[$key]['sort'] = $key; + $examine_flow[$key]['type'] = $v['type']; + $examine_flow[$key]['user_id'] = $value; + $examine_flow[$key]['flow_id'] = $flowId; + } + db('examine_flow_member')->insertAll($examine_flow); + break; + case '2' : + $examine_flow['flow_id'] = $flowId; + $examine_flow['parent_level'] = $v['parentLevel']; + $examine_flow['type'] = $v['type']; + db('examine_flow_superior')->insert($examine_flow); + break; + case '3' : + $examine_flow['flow_id'] = $flowId; + $examine_flow['role_id'] = $v['roleId']; + $examine_flow['type'] = $v['type']; + db('examine_flow_role')->insert($examine_flow); + break; + case '4' : + foreach ($v['userList'] as $key => $value) { + $examine_flow[$key]['sort'] = $key; + $examine_flow[$key]['type'] = $v['type']; + $examine_flow[$key]['user_id'] = $value; + $examine_flow[$key]['flow_id'] = $flowId; + $examine_flow[$key]['role_id'] = $v['roleId']; + $examine_flow[$key]['choose_type'] = $v['chooseType']; + $examine_flow[$key]['range_type'] = $v['rangeType']; + } + db('examine_flow_optional')->insertAll($examine_flow); + break; + case '5' : + $examine_flow['flow_id'] = $flowId; + $examine_flow['role_id'] = $v['roleId']; + $examine_flow['max_level'] = $v['parentLevel']; + $examine_flow['type'] = $v['type']; + db('examine_flow_continuous_superior')->insert($examine_flow); + break; + // case '7' : + // break; + } + + foreach ($v['conditionList'] as $k1 => $v1) { + // 处理条件 + $condition['condition_name'] = $v1['conditionName']; + $condition['priority'] = $v1['sort']; + $condition['create_time'] = $create_time; + $condition['create_user_id'] = $userId; + $condition['flow_id'] = $flowId; + $condition_id1 = db('examine_condition')->insertGetId($condition); + + // 处理条件 扩展 + foreach ($v1['conditionDataList'] as $kc => $vc) { + $conditionDate = []; + $conditionDate['field_id'] = $vc['fieldId']; + $conditionDate['field_name'] = $vc['fieldName'] ? : ''; + $conditionDate['condition_type'] = $vc['conditionType']; + $conditionDate['value'] = json_encode($vc['values']); + $conditionDate['name'] = $vc['name']; + $conditionDate['type'] = $vc['type']; + $conditionDate['condition_id'] = $condition_id1; + $conditionDate['flow_id'] = $flowId; + $condition_data_id = db('examine_condition_data')->insertGetId($conditionDate); + } + if(!empty($v1['examineDataList'])){ + $this->recursion($v1['examineDataList'], $userId, $condition_id1, $examineId, $create_time); + } + } + } + } + + /** + * 预览审批条件 + * @return [type] [description] + */ + public function previewFiledName() + { + $param = $this->param; + $flow_id = db('examine_flow') + ->where(['examine_id' => $param['id']]) + ->where(['examine_type' => 0]) + ->where(['condition_id' => 0]) + ->min('flow_id'); + + $condition_data = db('examine_condition_data')->where('flow_id', $flow_id)->where('field_name', 'money')->select(); + return resultArray(['data' => $condition_data]); + } + + /** + * 预览检查流 + * @return [type] [description] + */ + public function previewExamineFlow() + { + $userInfo = $this->userInfo; + $param = $this->param; +$param['dataMap']['money'] = 10000; + + $examine_flow = db('examine_flow') + ->where(['examine_id' => $param['id']]) + ->where(['condition_id' => 0]) + ->select(); + $data = []; + + foreach ($examine_flow as $key => $value) { + if($value['examine_type'] == 0){ + $condition = db('examine_condition') + ->where('flow_id', $value['flow_id']) + ->select(); + foreach ($condition as $ka => $va) { + // 处理审批条件 是否符合 符合去找流程 不符合 找下一个流程 + $condition_data = db('examine_condition_data')->where('condition_id', $va['condition_id'])->select(); + foreach ($condition_data as $kb => $vb) { + $jump_out = 1; + // 1 等于 2 大于 3 小于 4 大于等于 5 小于等于 6 两者之间 7 包含 8 员工 9 部门 10 角色', + switch ($vb['condition_type']) { + case '1' : + if($param['dataMap']['money'] != json_decode($vb['value'])[0]){ + $jump_out = 2; + } + break; + case '2' : + if($param['dataMap']['money'] <= json_decode($vb['value'])[0]){ + $jump_out = 2; + } + break; + case '3' : + if($param['dataMap']['money'] >= json_decode($vb['value'])[0]){ + $jump_out = 2; + } + break; + case '4' : + if($param['dataMap']['money'] < json_decode($vb['value'])[0]){ + $jump_out = 2; + } + break; + case '5' : + if($param['dataMap']['money'] > json_decode($vb['value'])[0]){ + $jump_out = 2; + } + break; + case '6' : + if(json_decode($vb['value'])[1] == 1){ + if(json_decode($vb['value'])[0] < $param['dataMap']['money']){ + $jump_out = 1; + }else{ + $jump_out = 2; + } + }else{ + if(json_decode($vb['value'])[0] <= $param['dataMap']['money']){ + $jump_out = 1; + }else{ + $jump_out = 2; + } + } + + if(json_decode($vb['value'])[2] == 1){ + if(json_decode($vb['value'])[3] > $param['dataMap']['money']){ + $jump_out = 1; + }else{ + $jump_out = 2; + } + }else{ + if(json_decode($vb['value'])[3] >= $param['dataMap']['money']){ + $jump_out = 1; + }else{ + $jump_out = 2; + } + } + break; + case '7' : + break; + case '8' : + $group_id = db('admin_access')->where('user_id', $userInfo['id'])->column('group_id'); + $userList = json_decode($vb['value'])->userList; + $deptList = json_decode($vb['value'])->deptList; + $roleList = json_decode($vb['value'])->roleList; + + if(!is_array($userInfo['id'], $userList) && !in_array($userInfo['structure_id'], $deptList) && count(array_intersect($group_id, $roleList)) <= 0){ + $jump_out = 2; + } + } + // 该条件不符合 跳过本条件 继续下一个条件 + if($jump_out == 2){ + break; + } + } + + // 符合条件 不需要继续走下一个条件 开始找流程 并跳出整个循环 + if($jump_out == 1){ + $flowList = db('examine_flow') + ->where(['examine_id' => $param['id']]) + ->where(['condition_id' => $va['condition_id']]) + ->select(); + + $data = $this->conditionalRecursion($flowList, $userInfo, $data, $param); + break; + } + } + }else{ + $where = []; + switch ($value['examine_type']) { + case '1' : + $where['a.flow_id'] = $value['flow_id']; + $userList = db('examine_flow_member') + ->alias('a') + ->join('admin_user b','b.id = a.user_id', 'left') + ->where($where) + ->field('b.realname, b.img, a.user_id') + ->select(); + break; + case '2' : + $where['flow_id'] = $value['flow_id']; + $superior = db('examine_flow_superior')->where($where)->find(); + $owner_user_id = getUserSuperior($userInfo['structure_id'], $superior['parent_level']); + + // 找不到主管 先是 上级主管代签 没有上级主管管理员代签(多个管理员 或签) + if(!$owner_user_id){ + $owner_user_ids = db('examine_manager_user')->where('examine_id', $param['id'])->column('user_id'); + $userList = db('admin_user')->field('realname, img, id as user_id')->where(['id'=>['in', $owner_user_ids]])->select(); + }else{ + $userList = db('admin_user')->field('realname, img, id as user_id')->where(['id'=>['eq', $owner_user_id]])->select(); + } + break; + case '3' : + $where['a.flow_id'] = $value['flow_id']; + $userList = db('examine_flow_role') + ->alias('a') + ->join('admin_access b','b.group_id = a.role_id', 'left') + ->join('admin_user c','b.user_id = c.id', 'left') + ->where($where) + ->field('c.realname, c.img, b.user_id') + ->select(); + break; + case '4' : + + // db('examine_flow_optional')->insertAll($examine_flow); + break; + case '5' : + + // db('examine_flow_continuous_superior')->insert($examine_flow); + break; + // case '7' : + // break; + } + $value['userList'] = $userList; + $data[] = $value; + } + } + return resultArray(['data' => $data]); + } + + + public function conditionalRecursion ($examine_flow, $userInfo, $data, $param) + { + foreach ($examine_flow as $key => $value) { + if($value['examine_type'] == 0){ + $condition = db('examine_condition') + ->where('flow_id', $value['flow_id']) + ->select(); + foreach ($condition as $ka => $va) { + // 处理审批条件 是否符合 符合去找流程 不符合 找下一个流程 + $condition_data = db('examine_condition_data')->where('condition_id', $va['condition_id'])->select(); + foreach ($condition_data as $kb => $vb) { + $jump_out = 1; + // 1 等于 2 大于 3 小于 4 大于等于 5 小于等于 6 两者之间 7 包含 8 员工 9 部门 10 角色', + switch ($vb['condition_type']) { + case '1' : + if($param['dataMap']['money'] != json_decode($vb['value'])[0]){ + $jump_out = 2; + } + break; + case '2' : + if($param['dataMap']['money'] <= json_decode($vb['value'])[0]){ + $jump_out = 2; + } + break; + case '3' : + + if($param['dataMap']['money'] >= json_decode($vb['value'])[0]){ + $jump_out = 2; + } + break; + case '4' : + if($param['dataMap']['money'] < json_decode($vb['value'])[0]){ + $jump_out = 2; + } + break; + case '5' : + if($param['dataMap']['money'] > json_decode($vb['value'])[0]){ + $jump_out = 2; + } + break; + case '6' : + if(json_decode($vb['value'])[1] == 1){ + if(json_decode($vb['value'])[0] < $param['dataMap']['money']){ + $jump_out = 1; + }else{ + $jump_out = 2; + } + }else{ + if(json_decode($vb['value'])[0] <= $param['dataMap']['money']){ + $jump_out = 1; + }else{ + $jump_out = 2; + } + } + + if(json_decode($vb['value'])[2] == 1){ + if(json_decode($vb['value'])[3] > $param['dataMap']['money']){ + $jump_out = 1; + }else{ + $jump_out = 2; + } + }else{ + if(json_decode($vb['value'])[3] >= $param['dataMap']['money']){ + $jump_out = 1; + }else{ + $jump_out = 2; + } + } + break; + case '7' : + break; + case '8' : + $group_id = db('admin_access')->where('user_id', $userInfo['id'])->column('group_id'); + $userList = json_decode($vb['value'])->userList; + $deptList = json_decode($vb['value'])->deptList; + $roleList = json_decode($vb['value'])->roleList; + + if(!is_array($userInfo['id'], $userList) && !in_array($userInfo['structure_id'], $deptList) && count(array_intersect($group_id, $roleList)) <= 0){ + $jump_out = 2; + } + } + // 该条件不符合 跳过本条件 继续下一个条件 + if($jump_out == 2){ + break; + } + } + + // 符合条件 不需要继续走下一个条件 开始找流程 并跳出整个循环 + if($jump_out == 1){ + $flowList = db('examine_flow') + ->where(['examine_id' => $param['id']]) + ->where(['condition_id' => $va['condition_id']]) + ->select(); + $data = $this->conditionalRecursion($flowList, $userInfo, $data, $param); + break; + } + } + }else{ + $where = []; + switch ($value['examine_type']) { + case '1' : + $where['a.flow_id'] = $value['flow_id']; + $userList = db('examine_flow_member') + ->alias('a') + ->join('admin_user b','b.id = a.user_id', 'left') + ->where($where) + ->field('b.realname, b.img, a.user_id') + ->select(); + break; + case '2' : + $where['flow_id'] = $value['flow_id']; + $superior = db('examine_flow_superior')->where($where)->find(); + $owner_user_id = getUserSuperior($userInfo['structure_id'], $superior['parent_level']); + + // 找不到主管 先是 上级主管代签 没有上级主管管理员代签(多个管理员 或签) + if(!$owner_user_id){ + $owner_user_ids = db('examine_manager_user')->where('examine_id', $param['id'])->column('user_id'); + $userList = db('admin_user')->field('realname, img, id as user_id')->where(['id'=>['in', $owner_user_ids]])->select(); + }else{ + $userList = db('admin_user')->field('realname, img, id as user_id')->where(['id'=>['eq', $owner_user_id]])->select(); + } + break; + case '3' : + $where['a.flow_id'] = $value['flow_id']; + $userList = db('examine_flow_role') + ->alias('a') + ->join('admin_access b','b.group_id = a.role_id', 'left') + ->join('admin_user c','b.user_id = c.id', 'left') + ->where($where) + ->field('c.realname, c.img, b.user_id') + ->select(); + break; + case '4' : + + // db('examine_flow_optional')->insertAll($examine_flow); + break; + case '5' : + + // db('examine_flow_continuous_superior')->insert($examine_flow); + break; + // case '7' : + // break; + } + $value['userList'] = $userList; + $data[] = $value; + } + } + return $data; + } +} \ No newline at end of file diff --git a/application/admin/controller/Field.php b/application/admin/controller/Field.php index 3556805..8a158ef 100644 --- a/application/admin/controller/Field.php +++ b/application/admin/controller/Field.php @@ -742,7 +742,7 @@ class Field extends ApiCommon $userInfo = $this->userInfo; $userFieldModel = model('UserField'); $width = $param['width'] > 10 ? $param['width'] : ''; - $unField = array('pool_day','owner_user_name','is_lock','create_user_name'); + $unField = array('pool_day','owner_user_name','is_lock','create_user_name','owner_user_structure_name'); switch ($param['field']) { case 'status_id_info' : $param['field'] = 'status_id'; break; diff --git a/application/admin/controller/Index.php b/application/admin/controller/Index.php index 5cb41af..b8cc329 100644 --- a/application/admin/controller/Index.php +++ b/application/admin/controller/Index.php @@ -68,7 +68,7 @@ class Index extends ApiCommon if ($value['field'] == 'collection_object') $field_arr[$key]['form_type'] = 'text'; } if(in_array($param['types'],['crm_customer','crm_customer_pool','crm_contacts','crm_business','crm_contract','crm_receivables'])){ - $field=[['field'=>'team_id','name'=>'相关团队','form_type'=>'text','setting'=>[]]]; + $field=[['field'=>'team_id','name'=>'相关团队','form_type'=>'user','setting'=>[]]]; $field_arr=array_merge($field_arr,$field); } // if($param['types'] == 'jxc_product'){ diff --git a/application/admin/controller/Install.php b/application/admin/controller/Install.php index 402f1cf..5425a7b 100644 --- a/application/admin/controller/Install.php +++ b/application/admin/controller/Install.php @@ -8,6 +8,7 @@ namespace app\admin\controller; use think\Controller; +use think\Exception; use think\Request; use think\Db; use Env; @@ -19,12 +20,12 @@ class Install extends Controller public function _initialize() { - /*防止跨域*/ + /*防止跨域*/ header('Access-Control-Allow-Origin: '.$_SERVER['HTTP_ORIGIN']); header('Access-Control-Allow-Credentials: true'); header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS'); header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, authKey, sessionId"); - $param = Request::instance()->param(); + $param = Request::instance()->param(); $this->param = $param; // $request = request(); @@ -42,9 +43,9 @@ class Install extends Controller /** * [index 安装步骤] - * @author Michael_xu - * @param - */ + * @author Michael_xu + * @param + */ public function index() { $protocol = strpos(strtolower($_SERVER['HTTP_REFERER']), 'https') === false ? 'http' : 'https'; @@ -56,12 +57,12 @@ class Install extends Controller if (file_exists(CONF_PATH . "install.lock")) { echo " "; - die(); + die(); } if (!file_exists(getcwd() . "/public/sql/5kcrm.sql")) { echo " "; - die(); + die(); } return $this->fetch('index'); @@ -87,14 +88,14 @@ class Install extends Controller //版本 public function version() { - $res = include(CONF_PATH.'version.php'); - return $res ? : array('VERSION' => '11.0.0','RELEASE' => '20210219'); - } + $res = include(CONF_PATH.'version.php'); + return $res ? : array('VERSION' => '11.0.0','RELEASE' => '20210219'); + } public function step2(){ if (session('install_error')){ echo " "; - die(); + die(); } if (strpos(request()->url(), "index.php") === false) { $protocol = strpos(strtolower($_SERVER['HTTP_REFERER']), 'https') === false ? 'http' : 'https'; @@ -107,21 +108,21 @@ class Install extends Controller $this->assign('envir_data',$data); return $this->fetch(); } - + public function step3(){ return $this->fetch(); } public function step4(){ if (session('install_error')){ - return resultArray(['error' => '环境检测未通过,不能进行下一步操作!']); - } + return resultArray(['error' => '环境检测未通过,不能进行下一步操作!']); + } if (file_exists(CONF_PATH . "install.lock")) { - return resultArray(['error' => '请勿重复安装!']); - } + return resultArray(['error' => '请勿重复安装!']); + } if (!file_exists(getcwd() . "/public/sql/5kcrm.sql")) { - return resultArray(['error' => '缺少必要的数据库文件!']); - } + return resultArray(['error' => '缺少必要的数据库文件!']); + } $temp = $this->param; $param = $temp['form']; $db_config['type'] = 'mysql'; @@ -129,7 +130,7 @@ class Install extends Controller $db_config['hostport'] = $param['databasePort']; $db_config['database'] = $param['databaseName']; $db_config['username'] = $param['databaseUser']; - $db_config['password'] = $param['databasePwd']; + $db_config['password'] = $param['databasePwd']; $db_config['prefix'] = '5kcrm_'; // $db_config['prefix'] = $param['databaseTable']; @@ -138,7 +139,7 @@ class Install extends Controller $wkcode = $param['wkcode']; if (empty($db_config['hostname'])) { return resultArray(['error' => '请填写数据库主机!']); - } + } if (empty($db_config['hostport'])) { return resultArray(['error' => '请填写数据库端口!']); } @@ -153,7 +154,7 @@ class Install extends Controller } if (empty($db_config['password'])) { return resultArray(['error' => '请填写数据库密码!']); - } + } if (empty($db_config['prefix'])) { return resultArray(['error' => '请填写表前缀!']); } @@ -170,10 +171,10 @@ class Install extends Controller if (!$resCheckData) { return resultArray(['error' => '序列号错误!']); } - $resData = object_to_array(json_decode($resCheckData)); - if ($resData['date'] != date('Y-m-d')) { - return resultArray(['error' => '序列号已失效,请前往悟空官网个人中心获取最新数据!']); - } +// $resData = object_to_array(json_decode($resCheckData)); +// if ($resData['date'] != date('Y-m-d')) { +// return resultArray(['error' => '序列号已失效,请前往悟空官网个人中心获取最新数据!']); +// } if (empty($password)) { return resultArray(['error' => '请填写管理员密码!']); } @@ -186,7 +187,7 @@ class Install extends Controller try{ $ret = $connect->execute('select version()'); }catch(\Exception $e){ - return resultArray(['error' => '数据库连接失败,请检查数据库配置!']); + return resultArray(['error' => '数据库连接失败,请检查数据库配置4!']); } $check = $connect->execute("SELECT * FROM information_schema.schemata WHERE schema_name='".$database."'"); if (!$check && !$connect->execute("CREATE DATABASE IF NOT EXISTS `".$database."` default collate utf8_general_ci ")) { @@ -196,7 +197,7 @@ class Install extends Controller self::mkDatabase($db_config); self::mkLicense($wkcode); $C_Patch = substr($_SERVER['SCRIPT_FILENAME'],0,-10); - $sql = file_get_contents( $C_Patch.'/public/sql/5kcrm.sql'); + $sql = file_get_contents( $C_Patch.'/public/sql/5kcrm1.sql'); $sqlList = parse_sql($sql, 0, ['5kcrm_' => $db_config['prefix']]); if ($sqlList) { $sqlList = array_filter($sqlList); @@ -213,16 +214,185 @@ class Install extends Controller return resultArray(['error' => '数据库sql安装出错,请操作数据库手动导入sql文件']); } } - } + } +// $salt = substr(md5(time()),0,4); +// $password = user_md5(trim($password), $salt, $username); +// //插入信息 +// 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 )"); +// 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 )"); +// touch(CONF_PATH . "install.lock"); + return resultArray(['data'=>'安装成功']); + } + public function step7(){ + $temp = $this->param; + $param = $temp['form']; + $db_config['type'] = 'mysql'; + $db_config['hostname'] = $param['databaseUrl']; + $db_config['hostport'] = $param['databasePort']; + $db_config['database'] = $param['databaseName']; + $db_config['username'] = $param['databaseUser']; + $db_config['password'] = $param['databasePwd']; + $db_config['prefix'] = '5kcrm_'; + $C_Patch = substr($_SERVER['SCRIPT_FILENAME'],0,-10); + $sql = file_get_contents( $C_Patch.'/public/sql/5kcrm2.sql'); + $sqlList = parse_sql($sql, 0, ['5kcrm_' => $db_config['prefix']]); + if ($sqlList) { + $sqlList = array_filter($sqlList); + $install_count = count($sqlList); + session('install_count',$install_count); + foreach ($sqlList as $k=>$v) { + $install_now = $k+1; + session('install_now',$install_now); + try { + $temp_sql = $v.';'; + Db::connect($db_config)->query($temp_sql); + } catch(\Exception $e) { + // return resultArray(['error' => '请启用InnoDB数据引擎,并检查数据库是否有DROP和CREATE权限']); + return resultArray(['error' => '数据库sql安装出错,请操作数据库手动导入sql文件']); + } + } + } + return resultArray(['data'=>'安装成功']); + } + + public function step8(){ + $temp = $this->param; + $param = $temp['form']; + $db_config['type'] = 'mysql'; + $db_config['hostname'] = $param['databaseUrl']; + $db_config['hostport'] = $param['databasePort']; + $db_config['database'] = $param['databaseName']; + $db_config['username'] = $param['databaseUser']; + $db_config['password'] = $param['databasePwd']; + $db_config['prefix'] = '5kcrm_'; + $C_Patch = substr($_SERVER['SCRIPT_FILENAME'],0,-10); + $sql = file_get_contents( $C_Patch.'/public/sql/5kcrm3.sql'); + $sqlList = parse_sql($sql, 0, ['5kcrm_' => $db_config['prefix']]); + if ($sqlList) { + $sqlList = array_filter($sqlList); + $install_count = count($sqlList); + session('install_count',$install_count); + foreach ($sqlList as $k=>$v) { + $install_now = $k+1; + session('install_now',$install_now); + try { + $temp_sql = $v.';'; + Db::connect($db_config)->query($temp_sql); + } catch(\Exception $e) { + // return resultArray(['error' => '请启用InnoDB数据引擎,并检查数据库是否有DROP和CREATE权限']); + return resultArray(['error' => '数据库sql安装出错,请操作数据库手动导入sql文件']); + } + } + } + $username = $param['root']; + $password = $param['pwd']; $salt = substr(md5(time()),0,4); $password = user_md5(trim($password), $salt, $username); - //插入信息 +// //插入信息 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 )"); 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 )"); touch(CONF_PATH . "install.lock"); return resultArray(['data'=>'安装成功']); } + public function step10(){ + $temp = $this->param; + $param = $temp['form']; + $db_config['type'] = 'mysql'; + $db_config['hostname'] = $param['databaseUrl']; + $db_config['hostport'] = $param['databasePort']; + $db_config['database'] = $param['databaseName']; + $db_config['username'] = $param['databaseUser']; + $db_config['password'] = $param['databasePwd']; + $db_config['prefix'] = '5kcrm_'; + $C_Patch = substr($_SERVER['SCRIPT_FILENAME'],0,-10); + $sql = file_get_contents( $C_Patch.'/public/sql/5kcrm4.sql'); + $sqlList = parse_sql($sql, 0, ['5kcrm_' => $db_config['prefix']]); + if ($sqlList) { + $sqlList = array_filter($sqlList); + $install_count = count($sqlList); + session('install_count',$install_count); + foreach ($sqlList as $k=>$v) { + $install_now = $k+1; + session('install_now',$install_now); + try { + $temp_sql = $v.';'; + Db::connect($db_config)->query($temp_sql); + } catch(\Exception $e) { + // return resultArray(['error' => '请启用InnoDB数据引擎,并检查数据库是否有DROP和CREATE权限']); + return resultArray(['error' => '数据库sql安装出错,请操作数据库手动导入sql文件']); + } + } + } + return resultArray(['data'=>'安装成功']); + } + + public function step11(){ + $temp = $this->param; + $param = $temp['form']; + $db_config['type'] = 'mysql'; + $db_config['hostname'] = $param['databaseUrl']; + $db_config['hostport'] = $param['databasePort']; + $db_config['database'] = $param['databaseName']; + $db_config['username'] = $param['databaseUser']; + $db_config['password'] = $param['databasePwd']; + $db_config['prefix'] = '5kcrm_'; + $C_Patch = substr($_SERVER['SCRIPT_FILENAME'],0,-10); + $sql = file_get_contents( $C_Patch.'/public/sql/5kcrm5.sql'); + + $sqlList = parse_sql($sql, 0, ['5kcrm_' => $db_config['prefix']]); + if ($sqlList) { + $sqlList = array_filter($sqlList); + $install_count = count($sqlList); + session('install_count',$install_count); + foreach ($sqlList as $k=>$v) { + $install_now = $k+1; + session('install_now',$install_now); + try { + $temp_sql = $v.';'; + Db::connect($db_config)->query($temp_sql); + } catch(\Exception $e) { + // return resultArray(['error' => '请启用InnoDB数据引擎,并检查数据库是否有DROP和CREATE权限']); + return resultArray(['error' => '数据库sql安装出错,请操作数据库手动导入sql文件']); + } + } + } + + return resultArray(['data'=>'安装成功']); + } + + /** + * sql多文件执行 + * @param $sqlList + * @param $db_config + * @return \think\response\Json + */ + public function sqlData($sqlList,$db_config){ + try { + $install_count = count($sqlList); + session('install_count',$install_count); + $res_count=ceil($install_count); + for($i=0;$i<=$res_count;$i++){ + $page = $i>0?$i*100+1 :1; + $excelData = array_slice($sqlList, $page ,100); + if($excelData){ + foreach($excelData as $k=>$v){ + $install_now = $k+1; + session('install_now',$install_now); + $temp_sql = $v.';'; + Db::connect($db_config)->query($temp_sql); + // return resultArray(['error' => '请启用InnoDB数据引擎,并检查数据库是否有DROP和CREATE权限']); + return resultArray(['error' => '数据库sql安装出错,请操作数据库手动导入sql文件']); + } + } + } + Db::commit(); + }catch (\Exception $e){ + Db::rollback(); + return resultArray(['error'=>$e->getMessage()]); + } + } + /** * 安装成功界面 * @@ -246,7 +416,7 @@ class Install extends Controller { return $this->fetch(); } - + //ajax 进度条 public function progress() { @@ -310,50 +480,50 @@ INFO; } //检查目录权限 - public function check_dir_iswritable($dir_path){ - $dir_path=str_replace( '\\','/',$dir_path); - $is_writale=1; - if (!is_dir($dir_path)) { - $is_writale=0; - return $is_writale; - } else { - $file_hd=@fopen($dir_path.'/test.txt','w'); - if (!$file_hd) { - @fclose($file_hd); - @unlink($dir_path.'/test.txt'); - $is_writale=0; - return $is_writale; - } - $dir_hd = opendir($dir_path); - while (false !== ($file=readdir($dir_hd))) { - if ($file != "." && $file != "..") { - if (is_file($dir_path.'/'.$file)) { + public function check_dir_iswritable($dir_path){ + $dir_path=str_replace( '\\','/',$dir_path); + $is_writale=1; + if (!is_dir($dir_path)) { + $is_writale=0; + return $is_writale; + } else { + $file_hd=@fopen($dir_path.'/test.txt','w'); + if (!$file_hd) { + @fclose($file_hd); + @unlink($dir_path.'/test.txt'); + $is_writale=0; + return $is_writale; + } + $dir_hd = opendir($dir_path); + while (false !== ($file=readdir($dir_hd))) { + if ($file != "." && $file != "..") { + if (is_file($dir_path.'/'.$file)) { //文件不可写,直接返回 - if (!is_writable($dir_path.'/'.$file)) { - return 0; - } - } else { - $file_hd2=@fopen($dir_path.'/'.$file.'/test.txt','w'); - if (!$file_hd2) { - @fclose($file_hd2); - @unlink($dir_path.'/'.$file.'/test.txt'); - $is_writale=0; - return $is_writale; - } + if (!is_writable($dir_path.'/'.$file)) { + return 0; + } + } else { + $file_hd2=@fopen($dir_path.'/'.$file.'/test.txt','w'); + if (!$file_hd2) { + @fclose($file_hd2); + @unlink($dir_path.'/'.$file.'/test.txt'); + $is_writale=0; + return $is_writale; + } //递归 - $is_writale=check_dir_iswritable($dir_path.'/'.$file); - } - } - } - } - return $is_writale; - } + $is_writale=check_dir_iswritable($dir_path.'/'.$file); + } + } + } + } + return $is_writale; + } /** * [checkVersion 检查升级] - * @author Michael_xu - * @param - */ + * @author Michael_xu + * @param + */ public function checkVersion(){ $version = Config::load('version'); $info = sendRequest($this->upgrade_site.'index.php?m=version&a=checkVersion', $version['VERSION']); @@ -362,7 +532,7 @@ INFO; } else { return resultArray(['error' => '检查新版本出错!']); } - } + } /** * 环境检测 @@ -386,7 +556,7 @@ INFO; $items['php'][3] = 'error'; session('install_error', true); } - + if (!extension_loaded('gd')) { $items['gd'][1] = '未开启'; $items['gd'][3] = 'error'; @@ -411,7 +581,7 @@ INFO; } return $items; } - + /** * 目录权限检查 * @return array @@ -450,9 +620,9 @@ INFO; /** * 验证序列号 - * @param + * @param * @return - */ + */ public function checkCodeOld($username) { $encryption = md5($username); $substr = substr($username, strlen($username)-6); @@ -474,5 +644,5 @@ INFO; // return resultArray(['error' => 'license配置写入失败!']); // } return true; - } + } } \ No newline at end of file diff --git a/application/admin/controller/Rules.php b/application/admin/controller/Rules.php index 061e527..c8ca805 100644 --- a/application/admin/controller/Rules.php +++ b/application/admin/controller/Rules.php @@ -87,14 +87,21 @@ class Rules extends ApiCommon $data = ['0' => ['name' => '系统管理角色','pid' => 1],'1' => ['name' => '办公管理角色','pid' => 6],'2' => ['name' => '客户管理角色','pid' => 2],'3' => ['name' => '项目管理角色','pid' => '9']]; $list = db('admin_group')->field('id, pid, title')->select(); - +// $userInfo=$this->userInfo; $authList = db('admin_group_auth')->where('group_id', $param['group_id'])->column('auth_group_id'); foreach ($data as $key => $value) { foreach ($list as $k => $v) { $v['is_true'] = in_array($v['id'], $authList) ? 1 : 0; if($v['pid'] == $value['pid']){ - $data[$key]['item'][] = $v; + if($v['id']==1){ + continue; + }elseif($v['id']==2){ + continue; + }else{ + $data[$key]['item'][] = $v; + } + } } } @@ -158,7 +165,7 @@ class Rules extends ApiCommon $groupIds = db('admin_access')->where('user_id', $userId)->column('group_id'); $rules = db('admin_group')->where('id', 'in', $groupIds)->column('rules'); - + $arr = []; foreach ($rules as $key => $value) { if($arr){ @@ -179,7 +186,14 @@ class Rules extends ApiCommon $item = []; foreach ($list as $k => $v) { if($v['pid'] == $value['pid']){ - $item[] = $v; + + if($v['pid'] == $value['pid']){ + if($userId!=1 && $v['id']==1){ + continue; + }else{ + $item[] = $v; + } + } } } $items = []; @@ -198,7 +212,11 @@ class Rules extends ApiCommon foreach ($data as $key => $value) { foreach ($list as $k => $v) { if($v['pid'] == $value['pid']){ - $data[$key]['list'][] = $v; + if($v['id']==1){ + continue; + }else{ + $data[$key]['list'][] = $v; + } } } } diff --git a/application/admin/controller/Users.php b/application/admin/controller/Users.php index 48ef8f3..fe8902a 100644 --- a/application/admin/controller/Users.php +++ b/application/admin/controller/Users.php @@ -193,6 +193,7 @@ class Users extends ApiCommon $param = $this->param; $userInfo = $this->userInfo; $userData = db('admin_user')->where(['id' => $param['id']])->find(); + if (!$param['id']) { //修改个人信息 $param['user_id'] = $userInfo['id']; @@ -846,8 +847,10 @@ class Users extends ApiCommon if (false === UserModel::checkUserGroup([1, 2, 3])) { return resultArray(['error' => '没有该权限']); } + $userId = $this->userInfo['id']; $userModel = model('User'); $param = $this->param; + $param['user_id']=$userId; if (!is_array($param['id'])) { $ids[] = $param['id']; } else { diff --git a/application/admin/logic/FieldGrantLogic.php b/application/admin/logic/FieldGrantLogic.php index db36990..5b2daaa 100644 --- a/application/admin/logic/FieldGrantLogic.php +++ b/application/admin/logic/FieldGrantLogic.php @@ -265,7 +265,7 @@ class FieldGrantLogic # 固定字段 $content = [ ['field' => 'name', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '线索名称'], - ['field' => 'email', 'maskType' => 0, 'form_type'=>'email', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '邮箱'], + ['field' => 'email', 'maskType' => 1, 'form_type'=>'email', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '邮箱'], ['field' => 'source', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '线索来源'], ['field' => 'mobile', 'maskType' => 0, 'read' => 1,'form_type'=>'mobile', 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '手机'], ['field' => 'telephone', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '电话'], diff --git a/application/admin/model/Admin.php b/application/admin/model/Admin.php index 14b4f66..76a364b 100644 --- a/application/admin/model/Admin.php +++ b/application/admin/model/Admin.php @@ -67,10 +67,14 @@ class Admin extends Common } } if (!$user_ids) $user_ids = getSubUserId(true,0, $apiCommon->userInfo['id']); - $perUserIds = $perUserIds ? : getSubUserId(); //权限范围内userIds + // $perUserIds = $perUserIds ? : getSubUserId(); //权限范围内userIds $userIds = []; - if ($user_ids) { - $userIds = $perUserIds ? array_intersect($user_ids, $perUserIds) : $perUserIds; //数组交集 + if($perUserIds){ + if ($user_ids) { + $userIds = $perUserIds ? array_intersect($user_ids, $perUserIds) : $perUserIds; //数组交集 + } + }else{ + $userIds = $user_ids; //数组交集 } $where['userIds'] = array_map('intval', $userIds); if ($param['type']) { diff --git a/application/admin/model/Examine.php b/application/admin/model/Examine.php new file mode 100644 index 0000000..006ba98 --- /dev/null +++ b/application/admin/model/Examine.php @@ -0,0 +1,150 @@ +fmtRequest( $request ); + $map = $request['map'] ? : []; + if (isset($map['search'])) { + //普通筛选 + $map['a.examine_name'] = ['like', '%'.$map['search'].'%']; + unset($map['search']); + } + $map['a.status'] = ['neq', 3]; + $list = db('examine') + ->alias('a') + // ->join('examine_manager_user b','a.examine_id = b.examine_id', 'left') + ->join('admin_user c','a.update_user_id = c.id', 'left') + ->page($request['page'], $request['limit']) + ->field('a.*, c.realname as update_realname, c.thumb_img as update_thumb_img') + ->where($map) + ->order('a.status desc,a.update_time desc') + ->select(); + foreach ($list as $k=>$v) { + $list[$k]['status'] = $v['status']==1 ? '启用' : '停用'; + $list[$k]['recheck_type'] = $v['recheck_type']==1 ? '从第一层开始' : '从拒绝的层级开始'; + // 1 合同 2 回款 3发票 4薪资 5 采购审核 6采购退货审核 7销售审核 8 销售退货审核 9付款单审核10 回款单审核11盘点审核12调拨审核', + switch ($v['label']) { + case '1' : $label = '合同'; break; + case '2' : $label = '回款'; break; + case '3' : $label = '发票'; break; + case '4' : $label = '薪资'; break; + case '5' : $label = '采购审核'; break; + case '6' : $label = '采购退货审核'; break; + case '7' : $label = '销售审核'; break; + case '8' : $label = '销售退货审核'; break; + case '9' : $label = '付款单审核'; break; + case '10' : $label = '回款单审核1'; break; + case '11' : $label = '盘点审核'; break; + case '12' : $label = '调拨审核'; break; + default : $label = ''; break; + } + + // 审批流管理员 + $manager_user = db('examine_manager_user') + ->alias('a') + ->join('admin_user b','a.user_id = b.id') + ->field('a.user_id, b.realname') + ->where('examine_id', $v['examine_id']) + ->column('user_id'); + $list[$k]['managerList'] = $manager_user; + + $list[$k]['label'] = $label; + } + $dataCount = db('examine') + ->alias('a') + ->join('examine_manager_user b','a.examine_id = b.examine_id', 'left') + ->join('admin_user c','a.update_user_id = c.id', 'left') + ->where($map) + ->count('a.examine_id'); + + $data = []; + $data['list'] = $list; + $data['dataCount'] = $dataCount ? : 0; + + return $data; + } + + /** + * 审批流程详情 + * @author zjf + * @param + * @return + */ + public function getDataById($examine_id = '') + { + $userModel = new \app\admin\model\User(); + $dataInfo = $this->get($examine_id); + if (!$dataInfo) { + $this->error = '数据不存在或已删除'; + return false; + } + + //审批步骤 + $flowList = db('examine_flow')->where(['examine_id' => $examine_id])->where('condition_id', 0)->select(); + foreach ($flowList as $k=>$v) { + if($v['examine_type'] == 0){ + $conditionList = db('examine_condition')->where(['flow_id' => $v['flow_id']])->select(); + foreach ($conditionList as $key => $value) { + $conditionList[$key]['conditionDataList'] = db('examine_condition_data')->where(['condition_id' => $value['condition_id']])->select(); + $examineDataList = $this->recursion($value['condition_id']); + $conditionList[$key]['examineDataList'] = $examineDataList; + } + $flowList[$k]['conditionList'] = $conditionList; + + + + } + } + return $flowList; + } + + public function recursion($condition_id = '') + { + //审批步骤 + $flowList = db('examine_flow')->where(['condition_id' => $condition_id])->select(); + foreach ($flowList as $k=>$v) { + if($v['examine_type'] == 0){ + $conditionList = db('examine_condition')->where(['flow_id' => $v['flow_id']])->select(); + foreach ($conditionList as $key => $value) { + $conditionList[$key]['conditionDataList'] = db('examine_condition_data')->where(['condition_id' => $value['condition_id']])->select(); + $examineDataList = $this->recursion($value['condition_id']); + $conditionList[$key]['examineDataList'] = $examineDataList; + } + $flowList[$k]['conditionList'] = $conditionList; + } + } + return $flowList; + } +} \ No newline at end of file diff --git a/application/admin/model/Excel.php b/application/admin/model/Excel.php index dfbcdde..40f0d4d 100644 --- a/application/admin/model/Excel.php +++ b/application/admin/model/Excel.php @@ -984,7 +984,8 @@ class Excel extends Common } } else { if ($types == 'crm_customer' && !empty($param['pool_id'])) { - if (in_array($param['create_user_id'], stringToArray($owner)) || $param['create_user_id'] == 1) { + $userLevel = isSuperAdministrators($param['create_user_id']); + if (in_array($param['create_user_id'], stringToArray($owner)) || $param['create_user_id'] == 1 || $userLevel == 1) { $data = array_merge($data, $default_data); $data['excel'] = 1; if (!$resData = $dataModel->createData($data)) { diff --git a/application/admin/model/Field.php b/application/admin/model/Field.php index f54009e..6daf83c 100644 --- a/application/admin/model/Field.php +++ b/application/admin/model/Field.php @@ -773,6 +773,7 @@ class Field extends Model unset($data['yaxis']); unset($data['maxNumRestrict']); unset($data['minNumRestrict']); + unset($data['stting']); // 设置明细表格类型的默认值为空,防止为null的报错。 if ($data['form_type'] == 'detail_table') { $data['default_value'] = ''; @@ -1124,6 +1125,9 @@ class Field extends Model 'fieldName' => 'owner_user_structure_name' ]; foreach ($field_list as $k => $v) { + if($v['field']=='invoice_type'){ + $field_list[$k]['setting']=$v['setting']?explode(chr(10), $v['setting']):[]; + } # 处理字段授权 $field_list[$k]['writeStatus'] = 1; if (!$userLevel && $param['module'] == 'crm' && !empty($grantData[$param['types']])) { @@ -1136,6 +1140,7 @@ class Field extends Model $field_list[$k]['maskType'] = $status['maskType']; # 编辑权限 $field_list[$k]['writeStatus'] = $status['write']; + } } if ($param['types'] == 'crm_invoice') { @@ -1854,7 +1859,7 @@ class Field extends Model } $fieldArr = $this ->where($where) - ->field(['field', 'name', 'form_type', 'is_hidden']) + ->field(['field', 'name', 'form_type', 'is_hidden','setting']) ->order('order_id', 'asc') ->select(); @@ -1908,6 +1913,15 @@ class Field extends Model 'is_hidden' => 0 ]; } + + if ($types == 'jxc_product') { + $res[] = [ + 'field' => 'product_picture', + 'name' => '产品图片', + 'form_type' => 'pic', + 'is_hidden' => 0 + ]; + } return array_column($res, null, 'field'); } @@ -2433,6 +2447,7 @@ class Field extends Model $field = $prefix ? $prefix . '.' . $field : $field; switch ($form_type) { case 'textarea' : + case 'text' : case 'radio' : case 'select' : case 'checkbox' : @@ -2645,4 +2660,70 @@ class Field extends Model return false; } + + /** + * [getFieldByFormType 获取字段类型数组] + * @param types 分类 + * @author Michael_xu + */ + public function getFieldTypesArray($types, $form_type) + { + $fieldArr = db('admin_field')->where(['types' => $types, 'form_type' => ['in', $form_type]])->field(['field','name', 'form_type'])->select(); + $fieldList = []; + $userField = []; // 人员类型 + $structureField = []; // 部门类型 + $datetimeField = []; // 日期时间类型 + $booleanField = []; // 布尔值类型字段 + $dateIntervalField = []; // 日期区间类型字段 + $positionField = []; // 地址类型字段 + $handwritingField = []; // 手写签名类型字段 + $locationField = []; // 定位类型字段 + $boxField = []; // 多选类型字段 + $floatField = []; // 货币类型字段 + + foreach ($fieldArr as $key => $value) { + switch ($value['form_type']) { + case 'user' : + $fieldList['userField'][] = $value['field']; + break; + case 'structure' : + $fieldList['structureField'][] = $value['field']; + break; + case 'datetime' : + $fieldList['datetimeField'][] = $value['field']; + break; + case 'boolean_value' : + $fieldList['booleanField'][] = $value['field']; + break; + case 'date_interval' : + $fieldList['dateIntervalField'][] = $value['field']; + break; + case 'position' : + $fieldList['positionField'][] = $value['field']; + break; + case 'handwriting_sign' : + $fieldList['handwritingField'][] = $value['field']; + break; + case 'location' : + $fieldList['locationField'][] = $value['field']; + break; + case 'checkbox' : + $fieldList['boxField'][] = $value['field']; + break; + case 'floatnumber' : + $fieldList['floatField'][] = $value['field']; + break; + case 'pic' : + $fieldList['picField'][] = $value['field']; + break; + case 'detail_table' : + $fieldList['detailTableField'][] = $value['field']; + break; + case 'date' : + $fieldList['dateField'][] = $value['field']; + break; + } + } + return $fieldList ?: []; + } } \ No newline at end of file diff --git a/application/admin/model/Group.php b/application/admin/model/Group.php index 7019241..6d846f0 100644 --- a/application/admin/model/Group.php +++ b/application/admin/model/Group.php @@ -30,9 +30,11 @@ class Group extends Common public function getDataList($param) { $ruleModel = new \app\admin\model\Rule(); - $map = []; + $map = []; + if ($param['tree'] == 1) { $list = $this->getTypeList(); + foreach ($list as $k=>$v) { $where = []; $where = $this->getNewGroupPid($v['pid']); @@ -47,7 +49,11 @@ class Group extends Common } else { $where = $this->getNewGroupPid($param['pid']); } - $list = db('admin_group')->where($where)->select() ? : []; + if($param['pid']==1){ + $where['id']=['<>',1]; + } + $list = db('admin_group')->where($where)->select() ? : []; + if ($param['rules'] == 1) { //角色权限分类关系 $ruleTypes = $ruleModel->groupsToRules($param['pid']); @@ -165,7 +171,7 @@ class Group extends Common */ public function getTypeList() { - $list = ['0' => ['name' => '系统管理角色','pid' => 1],'1' => ['name' => '办公管理角色','pid' => 6],'2' => ['name' => '客户管理角色','pid' => 2],'3' => ['name' => '项目管理角色','pid' => '9']]; + $list = ['0' => ['name' => '系统管理角色','pid' => 1],'1' => ['name' => '办公管理角色','pid' => 6],'2' => ['name' => '客户管理角色','pid' => 2],'3' => ['name' => '项目管理角色','pid' => '9'],'4' => ['name' => '进销存管理角色','pid' => '10']]; return $list ? : []; } diff --git a/application/admin/model/LoginRecord.php b/application/admin/model/LoginRecord.php index 39f2dda..14fb6f4 100644 --- a/application/admin/model/LoginRecord.php +++ b/application/admin/model/LoginRecord.php @@ -74,7 +74,7 @@ class LoginRecord extends Common $data['address'] = $ip_address['country']; // 效果图有这个备注字段,不知道存啥,就把UA记录了一下 -// $data['remark'] = $_SERVER['HTTP_USER_AGENT']; + $data['remark'] = ''; $this->save($data); } diff --git a/application/admin/model/User.php b/application/admin/model/User.php index 3a85191..e471d72 100644 --- a/application/admin/model/User.php +++ b/application/admin/model/User.php @@ -292,11 +292,7 @@ class User extends Common } } $param['structure_id'] = $pid; - if (db('admin_user')->where('username', $param['username'])->find()) { - $this->error = '手机号已存在'; - return false; - } - + $nameData = db('admin_user')->where('realname', 'like', '%' . $param['realname'] . '%')->column('realname'); if (in_array($param['realname'], $nameData)) { for ($j = 1; $j < 100; $j++) { @@ -328,6 +324,10 @@ class User extends Common $this->error = $validate->getError(); return false; } + if (db('admin_user')->where('username', $param['username'])->find()) { + $this->error = '手机号已存在'; + return false; + } $syncModel = new \app\admin\model\Sync(); $this->startTrans(); try { @@ -449,10 +449,10 @@ class User extends Common } } else { // 不能操作超级管理员 - // if ($id == 1) { - // $this->error = '非法操作'; - // return false; - // } + if ($id == 1) { + $this->error = '非法操作,不能编辑超级管理员'; + return false; + } $checkData = $this->get($id); $userInfo = $checkData->data; if (!$checkData) { @@ -718,6 +718,10 @@ class User extends Common { $syncModel = new \app\admin\model\Sync(); $flag = true; + if($param['user_id']!=1 && empty(!in_array(1,$param['id']))){ + $this->error = '修改失败,无修改超级管理员权限'; + return false; + } foreach ($param['id'] as $value) { $password = ''; $userInfo = db('admin_user')->where(['id' => $value])->find(); @@ -852,10 +856,10 @@ class User extends Common $authList['oa']['calendar'] = (object)[]; } # 进销存 - if (in_array('jxc', $adminConfig)) { - $authList['jxc']['field'] = (object)[]; - $authList['jxc']['params'] = (object)[]; - } +// if (in_array('jxc', $adminConfig)) { +// $authList['jxc']['field'] = (object)[]; +// $authList['jxc']['params'] = (object)[]; +// } # 公海权限 $structureId = db('admin_user')->where('id', $u_id)->value('structure_id'); $poolStatus = db('crm_customer_pool')->where('status', 1)->where(function ($requery) use ($u_id, $structureId, $adminTypes) { @@ -1030,8 +1034,8 @@ class User extends Common $authList['hrm'] = (object)[]; // $authList['jxc'] = (object)[]; # jxc - $authList['manage']['jxc']['field'] = true; - $authList['manage']['jxc']['params'] = true; +// $authList['manage']['jxc']['field'] = true; +// $authList['manage']['jxc']['params'] = true; $authList['knowledge'] = (object)[]; @@ -1416,7 +1420,10 @@ class User extends Common $userIds = !empty($param['user_id']) ? $param['user_id'] : []; $structureIds = !empty($param['structure_id']) ? $param['structure_id'] : []; $groupIds = !empty($param['group_id']) ? $param['group_id'] : []; - + if($param['userId']!=1 && empty(!in_array(1,$userIds))){ + $this->error = '修改失败,无复制超级管理员权限'; + return false; + } # 员工与角色关联数据 $userGroup = []; @@ -1475,13 +1482,13 @@ class User extends Common $this->error = '参数错误'; return false; } + $data=[]; foreach ($ids as $v) { - $data['id'] = $v; - $data['structure_id'] = $param['structure_id']; - $flag=$this->isUpdate(true)->save($data); -// $flag = foreachData('', $data); -// p(Db::name('AdminUser')->getLastSql()); + $res['id'] = $v; + $res['structure_id'] = $param['structure_id']; + $data[] = $res; } + $flag=$this->isUpdate(true)->saveAll($data); if ($flag!==false) { return 1; } else { diff --git a/application/admin/traits/FieldVerificationTrait.php b/application/admin/traits/FieldVerificationTrait.php index c69457b..90b1a21 100644 --- a/application/admin/traits/FieldVerificationTrait.php +++ b/application/admin/traits/FieldVerificationTrait.php @@ -39,7 +39,7 @@ trait FieldVerificationTrait if (empty($status['read']) || (empty($dataId) && empty($status['write']))) continue; } # 验证非明细表格字段数据 - 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']]))) { + 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']]))) { $error = $value['name'] . '字段不能为空!'; break; diff --git a/application/admin/view/install/step2.html b/application/admin/view/install/step2.html index e32c962..82b100d 100644 --- a/application/admin/view/install/step2.html +++ b/application/admin/view/install/step2.html @@ -85,9 +85,9 @@
安装序列号:
-
- 您需要通过手机号来注册悟空ID,该手机号将作为您登录系统的管理员账号。您需要进入【悟空个人中心】,点击【开源版下载】获取您的序列号,如您已经注册悟空ID,您只需要点击登录个人中心即可查看您的序列号 -
+ + +
请填写管理员信息
diff --git a/application/bi/model/Customer.php b/application/bi/model/Customer.php index 40330f6..2fee9de 100644 --- a/application/bi/model/Customer.php +++ b/application/bi/model/Customer.php @@ -377,7 +377,6 @@ class Customer extends Common function getSortByCount($whereArr) { $count = db('crm_customer')->group('owner_user_id')->field('owner_user_id,count(customer_id) as count')->order('count desc')->where($whereArr)->select(); - echo db('crm_customer')->getLastSql();die(); return $count; } diff --git a/application/common.php b/application/common.php index 914017f..610bd81 100644 --- a/application/common.php +++ b/application/common.php @@ -358,7 +358,7 @@ function advancedQuery($param, $m = '', $c = '', $a = '') if ($key == 'business_id' && !is_array($value)) $result['business.' . $key] = $value; // 仪表盘参数 - if (!empty($value['value'][0]) && empty($value['condition'])) { + if (!empty($value['value']) && empty($value['condition'])) { $value['condition'] = 'is'; $value['form_type'] = 'user'; } @@ -3287,39 +3287,92 @@ if (!function_exists('getPrimaryKeyName')) { } } -function advancedQueryFormatForTeam($requestMap, $db, $db_id) +function advancedQueryFormatForTeam($requestMap, $c, $db_id) { - // 处理查询条件 - foreach ($requestMap['team_id']['value'] as $v) { - if ($requestMap['team_id']['condition'] == 'contains') { - $date = function ($query) use ($v) { - $query->where('FIND_IN_SET("' . $v . '", ro_user_id)') - ->whereOr('FIND_IN_SET("' . $v . '", rw_user_id)'); - }; - } elseif ($requestMap['team_id']['condition'] == 'notContains') { - $date = function ($query) use ($v) { - $query->where('FIND_IN_SET("' . $v . '", ro_user_id)') - ->where('FIND_IN_SET("' . $v . '", rw_user_id)'); - }; - } elseif ($requestMap['team_id']['condition'] == 'isNull') { - $date = function ($query) { - $query->where('ro_user_id', ['eq', '']) - ->whereOr('rw_user_id', 'null'); - }; - } elseif ($requestMap['team_id']['condition'] == 'isNotNull') { - $date = function ($query) { - $query->where('ro_user_id', ['neq', '']) - ->where('rw_user_id', ['not null']); - }; + $prefix = $c . '.'; + $result = []; +// foreach ($requestMap as $k=>$v) { +// $r2=$v['value']; +// $c = $prefix; +// //团队成员 +// if (isset($v['form_type']) && in_array($v['form_type'], ['user']) && !in_array($k, ['create_user_id', 'owner_user_id']) ) { +// $result[$c . 'ro_user_id'] = advancedQueryFormatForPersonnel($v['value'], $v['condition']); +// $result[$c . 'rw_user_id'] = advancedQueryFormatForPersonnel($v['value'], $v['condition']); +// } +// } + $date=[]; + $date2=[]; + $condition=$requestMap['condition']; + $z=''; + + foreach ($requestMap['value'] as $val){ + + if($condition=='contains'){ + $z='like'; + $val="'".'%,'.$val.',%'."'"; + }elseif($condition=='notContains'){ + $z='NOT LIKE'; + $val="'".'%,'.$val.',%'."'"; + } + $date[]=$prefix.'ro_user_id '.$z.$val; + $date2[]=$prefix.'rw_user_id '.$z.$val; + } + if($condition =='isNull'){ + $z='IS NULL'; + $date[]=$prefix.'ro_user_id '.'= '."''"; + $date2[]=$prefix.'rw_user_id '.'= '."''"; + }elseif($condition =='isNotNull'){ + $z='IS NOT NULL'; + $date[]=$prefix.'ro_user_id '.'<> '."''"; + $date2[]=$prefix.'rw_user_id '.'<> '."''"; + } + + if($date && $date2){ + $rest=''; + $date=implode('OR ', $date); + $date2=implode('OR ', $date2); + $type=''; + switch ($z){ + case 'like': + $rest='('.$date.')'.'OR'.'('.$date2.')'; + break; + case 'NOT LIKE': + $rest='('.$date.')'.'AND'.'('.$date2.')'; + break; + case 'IS NULL': + $rest='('.$date.')'.'OR'.'('.$date2.')'; + break; + case 'IS NOT NULL': + $rest='('.$date.')'.'AND'.'('.$date2.')'; + break; + default: + break; } - $part[] = db($db)->where($date)->column($db_id); } - $result = []; - array_walk_recursive($part, function ($value) use (&$result) { - array_push($result, $value); - }); - $result = array_unique($result); - $partMap['customer.customer_id'] = ['in', trim(arrayToString($result), ',')]; - return $partMap ?: []; + return $rest ?: []; +} + +/** + * 根据用户获取第 几级 上级 + * + * @param string $level 获取到第几级 + * @return string + * @since 2021-05-18 + * @author fanqi + */ +function getUserSuperior($structure_id, $level = 0) +{ + if($level == 0){ + $owner_user_id = db('admin_structure')->where('id', $structure_id)->value('owner_user_id'); + if($owner_user_id == 0){ + $pid = db('admin_structure')->where('id', $structure_id)->value('pid'); + $owner_user_id = db('admin_structure')->where('id', $pid)->value('owner_user_id'); + } + }else{ + $pid = db('admin_structure')->where('id', $structure_id)->value('pid'); + return getUserSuperior($pid, $level-1); + } + + return $owner_user_id; } diff --git a/application/common/command/PoolCommand.php b/application/common/command/PoolCommand.php index e27975e..9b503ab 100644 --- a/application/common/command/PoolCommand.php +++ b/application/common/command/PoolCommand.php @@ -121,26 +121,26 @@ class PoolCommand extends Command * @version 1.0 版本号 * @since 2021/6/3 0003 10:38 */ -// private function updateInfo($ruleList, $customerWhere) -// { -// foreach ($ruleList as $k => $v) { -// $levels = json_decode($v['level'], true); -// foreach ($levels as $k1 => $v1) { -// if (!empty($v1['limit_day'])) { -// $time = $v1['limit_day']; -// } else { -// $time = $this->getMinDay($levels); -// } -// } -// foreach ($customerWhere as $val) { -// if ($v['type'] == 1) updateActionLog(0, 'crm_customer', $val, '', '', '超过' . $time . '天无新建跟进记录自动进入公海'); -// if ($v['type'] == 2) updateActionLog(0, 'crm_customer', $val, '', '', '超过' . $time . '天无新建商机自动进入公海'); -// if ($v['type'] == 3) updateActionLog(0, 'crm_customer', $val, '', '', '超过' . $time . '天未成交自动进入公海'); -// -// } -// } -// } -// + private function updateInfo($ruleList, $customerWhere) + { + foreach ($ruleList as $k => $v) { + $levels = json_decode($v['level'], true); + foreach ($levels as $k1 => $v1) { + if (!empty($v1['limit_day'])) { + $time = $v1['limit_day']; + } else { + $time = $this->getMinDay($levels); + } + } + foreach ($customerWhere as $val) { + if ($v['type'] == 1) updateActionLog(0, 'crm_customer', $val, '', '', '超过' . $time . '天无新建跟进记录自动进入公海'); + if ($v['type'] == 2) updateActionLog(0, 'crm_customer', $val, '', '', '超过' . $time . '天无新建商机自动进入公海'); + if ($v['type'] == 3) updateActionLog(0, 'crm_customer', $val, '', '', '超过' . $time . '天未成交自动进入公海'); + + } + } + } + protected function execute(Input $input, Output $output) diff --git a/application/crm/common.php b/application/crm/common.php index dfb7eae..1751f28 100644 --- a/application/crm/common.php +++ b/application/crm/common.php @@ -209,3 +209,102 @@ function decrypt($data, $key = '72-crm') } return $str; } + +function getFieldData($list,$types,$user_id){ + $fieldModel = new \app\admin\model\Field(); + $indexField = $fieldModel->getIndexField($types, $user_id, 1) ? : array('name'); // 列表展示字段 + $userField = $fieldModel->getFieldByFormType($types, 'user'); // 人员类型 + $structureField = $fieldModel->getFieldByFormType($types, 'structure'); // 部门类型 + $datetimeField = $fieldModel->getFieldByFormType($types, 'datetime'); // 日期时间类型 + $booleanField = $fieldModel->getFieldByFormType($types, 'boolean_value'); // 布尔值类型字段 + $dateIntervalField = $fieldModel->getFieldByFormType($types, 'date_interval'); // 日期区间类型字段 + $positionField = $fieldModel->getFieldByFormType($types, 'position'); // 地址类型字段 + $handwritingField = $fieldModel->getFieldByFormType($types, 'handwriting_sign'); // 手写签名类型字段 + $locationField = $fieldModel->getFieldByFormType($types, 'location'); // 定位类型字段 + $boxField = $fieldModel->getFieldByFormType($types, 'checkbox'); // 多选类型字段 + $floatField = $fieldModel->getFieldByFormType($types, 'floatnumber'); // 货币类型字段 + $db_id=substr($types,strripos($types,"_")+1).'_id';; + $extraData = []; + $business_id_list = !empty($list) ? array_column($list, $db_id) : []; + $extraList = db($types.'_data')->whereIn($db_id, $business_id_list)->select(); + foreach ($extraList AS $key => $value) { + $extraData[$value[$db_id]][$value['field']] = $value['content']; + } + $grantData = getFieldGrantData($user_id); + foreach ($grantData[$types] as $key => $value) { + foreach ($value as $ke => $va) { + if($va['maskType']!=0){ + $fieldGrant[$ke]['maskType'] = $va['maskType']; + $fieldGrant[$ke]['form_type'] = $va['form_type']; + $fieldGrant[$ke]['field'] = $va['field']; + } + } + } + foreach ($list AS $k => $v) { + # 用户类型字段 + foreach ($userField as $key => $val) { + if (in_array($val, $indexField)) { + $usernameField = !empty($v[$val]) ? db('admin_user')->whereIn('id', stringToArray($v[$val]))->column('realname') : []; + $list[$k][$val] = implode($usernameField, ','); + } + } + # 部门类型字段 + foreach ($structureField as $key => $val) { + if (in_array($val, $indexField)) { + $structureNameField = !empty($v[$val]) ? db('admin_structure')->whereIn('id', stringToArray($v[$val]))->column('name') : []; + $list[$k][$val] = implode($structureNameField, ','); + } + } + # 日期时间类型字段 + foreach ($datetimeField as $key => $val) { + $list[$k][$val] = !empty($v[$val]) ? date('Y-m-d H:i:s', $v[$val]) : null; + } + // 布尔值类型字段 + foreach ($booleanField as $key => $val) { + $list[$k][$val] = !empty($v[$val]) ? (string)$v[$val] : '0'; + } + // 处理日期区间类型字段的格式 + foreach ($dateIntervalField as $key => $val) { + $list[$k][$val] = !empty($extraData[$v['customer_id']][$val]) ? json_decode($extraData[$v['customer_id']][$val], true) : null; + } + // 处理地址类型字段的格式 + foreach ($positionField as $key => $val) { + $list[$k][$val] = !empty($extraData[$v['customer_id']][$val]) ? json_decode($extraData[$v['customer_id']][$val], true) : null; + } + // 手写签名类型字段 + foreach ($handwritingField as $key => $val) { + $handwritingData = !empty($v[$val]) ? db('admin_file')->where('file_id', $v[$val])->value('file_path') : null; + $list[$k][$val] = ['url' => !empty($handwritingData) ? getFullPath($handwritingData) : null]; + } + // 定位类型字段 + foreach ($locationField as $key => $val) { + $list[$k][$val] = !empty($extraData[$v['customer_id']][$val]) ? json_decode($extraData[$v['customer_id']][$val], true) : null; + } + // 多选框类型字段 + foreach ($boxField as $key => $val) { + $list[$k][$val] = !empty($v[$val]) ? trim($v[$val], ',') : null; + } + // 货币类型字段 + foreach ($floatField as $key => $val) { + $list[$k][$val] = $v[$val] != '0.00' ? (string)$v[$val] : null; + } + //掩码相关类型字段 + foreach ($fieldGrant AS $key => $val){ + //掩码相关类型字段 + if ($val['maskType']!=0 && $val['form_type'] == 'mobile') { + $pattern = "/(1[3458]{1}[0-9])[0-9]{4}([0-9]{4})/i"; + $rs = preg_replace($pattern, "$1****$2", $v[$val['field']]); + $list[$k][$val['field']] = !empty($v[$val['field']]) ? (string)$rs : null; + } elseif ($val['maskType']!=0 && $val['form_type'] == 'email') { + $email_array = explode("@", $v[$val['field']]); + $prevfix = (strlen($email_array[0]) < 4) ? "" : substr($v[$val['field']], 0, 2); //邮箱前缀 + $str = preg_replace('/([\d\w+_-]{0,100})@/', "***@", $v[$val['field']], -1, $count); + $rs = $prevfix . $str; + $list[$k][$val['field']] = !empty($v[$val['field']]) ?$rs: null; + } elseif ($val['maskType']!=0 && in_array($val['form_type'],['position','floatnumber'])) { + $list[$k][$val['field']] = !empty($v[$val['field']]) ? (string)substr_replace($v[$val['field']], '*****',0,strlen($v[$val['field']])) : null; + } + } + } + return $list; +} \ No newline at end of file diff --git a/application/crm/controller/Activity.php b/application/crm/controller/Activity.php index 943a884..39bfe61 100644 --- a/application/crm/controller/Activity.php +++ b/application/crm/controller/Activity.php @@ -280,6 +280,11 @@ class Activity extends ApiCommon $name = '所属客户'; break; } + + $record_type = db('crm_config')->where(['name' => 'record_type'])->find(); + if ($record_type) { + $arr = json_decode($record_type['value']); + } $fields = [ '0' => [ 'name' => '跟进内容', @@ -302,15 +307,7 @@ class Activity extends ApiCommon 'name' => '跟进方式', 'field' => 'category', 'form_type' => 'select', - 'setting' => - array - ( - 0 => "见面拜访", - 1 => "电话", - 2 => "短信", - 3 => "邮件", - 4 => "微信" - ) + 'setting' =>$arr ], ]; // 导入的字段列表 diff --git a/application/crm/controller/Business.php b/application/crm/controller/Business.php index 4849445..0e93081 100644 --- a/application/crm/controller/Business.php +++ b/application/crm/controller/Business.php @@ -223,11 +223,15 @@ class Business extends ApiCommon $list = cache($key); if (!$list) { $userInfo = $this->userInfo; + $authMap = function($query) use ($userInfo){ + $query->where(['structure_id' => ['like', '%,' . $userInfo['structure_id'] . ',%'],'is_display'=> 1,'status'=> 1]) + ->whereOr(function ($query) use ($userInfo) { + $query->where(['structure_id' => ''])->where(['is_display'=> 1,'status'=> 1]); + }); + }; $list = db('crm_business_type') ->field(['name', 'status', 'structure_id', 'type_id']) - ->where(['structure_id' => ['like', '%,' . $userInfo['structure_id'] . ',%'], 'status' => 1]) - ->where('is_display', 1) - ->whereOr('structure_id', '') + ->where($authMap) ->select(); foreach ($list as $k => $v) { $list[$k]['statusList'] = $businessStatusModel->getDataList($v['type_id']); @@ -236,7 +240,7 @@ class Business extends ApiCommon }else{ cache($key, NULL); } - + return resultArray(['data' => $list]); } diff --git a/application/crm/controller/Index.php b/application/crm/controller/Index.php index aeafaaa..a176772 100644 --- a/application/crm/controller/Index.php +++ b/application/crm/controller/Index.php @@ -598,7 +598,7 @@ class Index extends ApiCommon $auth_user_ids = $auth_user_ids ? array_intersect($userIds, $auth_user_ids) : []; //取交集 if ($c != 'activity') { - $where['owner_user_id']['value'] = $userIds; + $where['owner_user_id']['value'] = $auth_user_ids; if($types=='crm_contract' || $types=='crm_receivables'){ $where['check_status']=2; } diff --git a/application/crm/controller/Preview.php b/application/crm/controller/Preview.php index 938b954..ec6b69c 100644 --- a/application/crm/controller/Preview.php +++ b/application/crm/controller/Preview.php @@ -23,7 +23,10 @@ class Preview extends Controller $data = db('admin_printing_data')->field(['type', 'content'])->where('key', $key)->find(); $contentArray = json_decode($data['content'], true); + $content = $contentArray['data']; + $content = str_replace('\n', '', $content); + $content = str_replace('\\', '', $content); require_once(EXTEND_PATH.'tcpdf'.DS.'config'.DS.'tcpdf_config.php'); require_once(EXTEND_PATH.'tcpdf'.DS.'tcpdf.php'); @@ -33,6 +36,8 @@ class Preview extends Controller // 设置PDF页面边距:LEFT,TOP,RIGHT $tcpdf->SetMargins(10, 10, 10); + // 设置默认等宽字体 + $tcpdf->SetDefaultMonospacedFont('courier'); // 设置字体,防止中文乱码 $tcpdf->SetFont('simsun', '', 10); @@ -41,6 +46,8 @@ class Preview extends Controller // $tcpdf->SetAuthor(TITLE_NAME); $tcpdf->SetTitle("打印内容预览"); + + // 删除预定义的打印 页眉/页尾 $tcpdf->setPrintHeader(false); @@ -58,8 +65,9 @@ class Preview extends Controller $tcpdf->AddPage(); $html = $content; $tcpdf->writeHTML($html, true, false, true, true, ''); - $tcpdf->lastPage(); + + $tcpdf->lastPage(); $tcpdf->Output(ROOT_PATH.DS.'public'.DS.'temp'.DS.'pdf'.DS.'print.pdf','I'); exit($this->fetch('preview', ['key' => $key])); diff --git a/application/crm/logic/VisitLogic.php b/application/crm/logic/VisitLogic.php index 77f418c..beb157d 100644 --- a/application/crm/logic/VisitLogic.php +++ b/application/crm/logic/VisitLogic.php @@ -170,43 +170,43 @@ class VisitLogic extends Common # 系统字段 负责人部门 zjf 20210726 $list[$k]['owner_user_structure_name'] = $list[$k]['owner_user_id_info']['structure_name']; - foreach ($userField as $key => $val) { - $usernameField = !empty($v[$val]) ? db('admin_user')->whereIn('id', stringToArray($v[$val]))->column('realname') : []; - $list[$k][$val.'_name'] = implode($usernameField, ','); + foreach ($userField as $k => $val) { + $usernameField = !empty($v[$val]) ? db('admin_user')->whereIn('id', stringToArray($v[$val]))->column('realname') : []; + $list[$k][$val] = implode($usernameField, ','); } - foreach ($structureField as $key => $val) { + foreach ($structureField as $k => $val) { $structureNameField = !empty($v[$val]) ? db('admin_structure')->whereIn('id', stringToArray($v[$val]))->column('name') : []; - $list[$k][$val.'_name'] = implode($structureNameField, ','); + $list[$k][$val] = implode($structureNameField, ','); } - foreach ($datetimeField as $key => $val) { + foreach ($datetimeField as $k => $val) { $list[$k][$val] = !empty($v[$val]) ? date('Y-m-d H:i:s', $v[$val]) : null; } - foreach ($booleanField as $key => $val) { + foreach ($booleanField as $k => $val) { $list[$k][$val] = !empty($v[$val]) ? (string)$v[$val] : '0'; } // 处理日期区间类型字段的格式 - foreach ($dateIntervalField AS $key => $val) { + foreach ($dateIntervalField AS $k => $val) { $list[$k][$val] = !empty($extraData[$v['visit_id']][$val]) ? json_decode($extraData[$v['visit_id']][$val], true) : null; } // 处理地址类型字段的格式 - foreach ($positionField AS $key => $val) { + foreach ($positionField AS $k => $val) { $list[$k][$val] = !empty($extraData[$v['visit_id']][$val]) ? json_decode($extraData[$v['visit_id']][$val], true) : null; } // 手写签名类型字段 - foreach ($handwritingField AS $key => $val) { + foreach ($handwritingField AS $k => $val) { $handwritingData = !empty($v[$val]) ? db('admin_file')->where('file_id', $v[$val])->value('file_path') : null; $list[$k][$val] = ['url' => !empty($handwritingData) ? getFullPath($handwritingData) : null]; } // 定位类型字段 - foreach ($locationField AS $key => $val) { + foreach ($locationField AS $k => $val) { $list[$k][$val] = !empty($extraData[$v['visit_id']][$val]) ? json_decode($extraData[$v['visit_id']][$val], true) : null; } // 多选框类型字段 - foreach ($boxField AS $key => $val) { + foreach ($boxField AS $k => $val) { $list[$k][$val] = !empty($v[$val]) ? trim($v[$val], ',') : null; } // 货币类型字段 - foreach ($floatField AS $key => $val) { + foreach ($floatField AS $k => $val) { $list[$k][$val] = $v[$val]!='0.00' ? (string)$v[$val] : null; } //掩码相关类型字段 diff --git a/application/crm/model/Business.php b/application/crm/model/Business.php index ed99917..692e5b6 100644 --- a/application/crm/model/Business.php +++ b/application/crm/model/Business.php @@ -98,23 +98,22 @@ class Business extends Common unset($sceneMap['type_id']); } $partMap = []; - //优先级:普通筛选>高级筛选>场景 - if ($requestMap['team_id']) { - //相关团队查询 - $map = $requestMap; - $partMap= advancedQueryFormatForTeam($requestMap,'crm_business','business_id'); - unset($map['team_id']); + $teamMap=$requestMap['team_id']; + //团队成员 高级筛选 + if($teamMap){ + $partMap= advancedQueryFormatForTeam($teamMap,'business',''); + unset($requestMap['team_id']); + $map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap; } else { $map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap; } //高级筛选 $map = advancedQuery($map, 'crm', 'business', 'index'); $authMap = []; - if (!$partMap) { $a = 'index'; if ($is_excel) $a = 'excelExport'; $auth_user_ids = $userModel->getUserByPer('crm', 'business', $a); - if (isset($map['business.owner_user_id']) && $map['business.owner_user_id'][0] != 'like') { + if (isset($map['business.owner_user_id'])) { if (!is_array($map['business.owner_user_id'][1])) { $map['business.owner_user_id'][1] = [$map['business.owner_user_id'][1]]; } @@ -136,7 +135,7 @@ class Business extends Common ->whereOr('business.rw_user_id', array('like', '%,' . $authMapData['user_id'] . ',%')); }; } - } + //联系人商机 if ($contacts_id) { $business_id = Db::name('crm_contacts_business')->where(['contacts_id' => $contacts_id])->column('business_id'); @@ -155,14 +154,7 @@ class Business extends Common } $userField = $fieldModel->getFieldByFormType('crm_business', 'user'); //人员类型 $structureField = $fieldModel->getFieldByFormType('crm_business', 'structure'); //部门类型 - $datetimeField = $fieldModel->getFieldByFormType('crm_business', 'datetime'); //日期时间类型 - $booleanField = $fieldModel->getFieldByFormType('crm_business', 'boolean_value'); //布尔值 - $dateIntervalField = $fieldModel->getFieldByFormType('crm_business', 'date_interval'); // 日期区间类型字段 - $positionField = $fieldModel->getFieldByFormType('crm_business', 'position'); // 地址类型字段 - $handwritingField = $fieldModel->getFieldByFormType('crm_business', 'handwriting_sign'); // 手写签名类型字段 - $locationField = $fieldModel->getFieldByFormType('crm_business', 'location'); // 定位类型字段 - $boxField = $fieldModel->getFieldByFormType('crm_business', 'checkbox'); // 多选类型字段 - $floatField = $fieldModel->getFieldByFormType('crm_business', 'floatnumber'); // 货币类型字段 + // $fieldGrant = db('admin_field_mask')->where('types', 'business')->select(); # 处理人员和部门类型的排序报错问题(前端传来的是包含_name的别名字段) $temporaryField = str_replace('_name', '', $order_field); @@ -222,21 +214,8 @@ class Business extends Common $endStatus = ['1' => '赢单', '2' => '输单', '3' => '无效']; # 扩展数据 $extraData = []; - $business_id_list = !empty($list) ? array_column($list, 'business_id') : []; - $extraList = db('crm_business_data')->whereIn('business_id', $business_id_list)->select(); - foreach ($extraList AS $key => $value) { - $extraData[$value['business_id']][$value['field']] = $value['content']; - } - $grantData = getFieldGrantData($user_id); - foreach ($grantData['crm_business'] as $key => $value) { - foreach ($value as $ke => $va) { - if($va['maskType']!=0){ - $fieldGrant[$ke]['maskType'] = $va['maskType']; - $fieldGrant[$ke]['form_type'] = $va['form_type']; - $fieldGrant[$ke]['field'] = $va['field']; - } - } - } + + $list=getFieldData($list,'crm_business',$user_id); foreach ($list as $k => $v) { $list[$k]['customer_id_info']['customer_id'] = $v['customer_id']; $list[$k]['customer_id_info']['name'] = $v['customer_name']; @@ -244,62 +223,7 @@ class Business extends Common $list[$k]['owner_user_id_info'] = isset($v['owner_user_id']) ? $userModel->getUserById($v['owner_user_id']) : []; $list[$k]['create_user_name'] = !empty($list[$k]['create_user_id_info']['realname']) ? $list[$k]['create_user_id_info']['realname'] : ''; $list[$k]['owner_user_name'] = !empty($list[$k]['owner_user_id_info']['realname']) ? $list[$k]['owner_user_id_info']['realname'] : ''; - foreach ($userField as $key => $val) { - $usernameField = !empty($v[$val]) ? db('admin_user')->whereIn('id', stringToArray($v[$val]))->column('realname') : []; - $list[$k][$val] = implode($usernameField, ','); - } - foreach ($structureField as $key => $val) { - $structureNameField = !empty($v[$val]) ? db('admin_structure')->whereIn('id', stringToArray($v[$val]))->column('name') : []; - $list[$k][$val] = implode($structureNameField, ','); - } - foreach ($datetimeField as $key => $val) { - $list[$k][$val] = !empty($v[$val]) ? date('Y-m-d H:i:s', $v[$val]) : null; - } - foreach ($booleanField as $key => $val) { - $list[$k][$val] = !empty($v[$val]) ? (string)$v[$val] : '0'; - } - // 处理日期区间类型字段的格式 - foreach ($dateIntervalField AS $key => $val) { - $list[$k][$val] = !empty($extraData[$v['business_id']][$val]) ? json_decode($extraData[$v['business_id']][$val], true) : null; - } - // 处理地址类型字段的格式 - foreach ($positionField AS $key => $val) { - $list[$k][$val] = !empty($extraData[$v['business_id']][$val]) ? json_decode($extraData[$v['business_id']][$val], true) : null; - } - // 手写签名类型字段 - foreach ($handwritingField AS $key => $val) { - $handwritingData = !empty($v[$val]) ? db('admin_file')->where('file_id', $v[$val])->value('file_path') : null; - $list[$k][$val] = ['url' => !empty($handwritingData) ? getFullPath($handwritingData) : null]; - } - // 定位类型字段 - foreach ($locationField AS $key => $val) { - $list[$k][$val] = !empty($extraData[$v['business_id']][$val]) ? json_decode($extraData[$v['business_id']][$val], true) : null; - } - // 多选框类型字段 - foreach ($boxField AS $key => $val) { - $list[$k][$val] = !empty($v[$val]) ? trim($v[$val], ',') : null; - } - // 货币类型字段 - foreach ($floatField AS $key => $val) { - $list[$k][$val] = $v[$val]!='0.00' ? (string)$v[$val] : null; - } - //掩码相关类型字段 - foreach ($fieldGrant AS $key => $val){ - //掩码相关类型字段 - if ($val['maskType']!=0 && $val['form_type'] == 'mobile') { - $pattern = "/(1[3458]{1}[0-9])[0-9]{4}([0-9]{4})/i"; - $rs = preg_replace($pattern, "$1****$2", $v[$val['field']]); - $list[$k][$val['field']] = !empty($v[$val['field']]) ? (string)$rs : null; - } elseif ($val['maskType']!=0 && $val['form_type'] == 'email') { - $email_array = explode("@", $v[$val['field']]); - $prevfix = (strlen($email_array[0]) < 4) ? "" : substr($v[$val['field']], 0, 2); //邮箱前缀 - $str = preg_replace('/([\d\w+_-]{0,100})@/', "***@", $v[$val['field']], -1, $count); - $rs = $prevfix . $str; - $list[$k][$val['field']] = !empty($v[$val['field']]) ?$rs: null; - } elseif ($val['maskType']!=0 && in_array($val['form_type'],['position','floatnumber'])) { - $list[$k][$val['field']] = !empty($v[$val['field']]) ? (string)substr_replace($v[$val['field']], '*****',0,strlen($v[$val['field']])) : null; - } - } + $statusInfo = []; $status_count = 0; if (!$v['is_end']) { diff --git a/application/crm/model/Contacts.php b/application/crm/model/Contacts.php index ad82d98..0f0e9b5 100644 --- a/application/crm/model/Contacts.php +++ b/application/crm/model/Contacts.php @@ -75,23 +75,24 @@ class Contacts extends Common } $partMap = []; //优先级:普通筛选>高级筛选>场景 - if ($requestMap['team_id']) { - //相关团队查询 - $map = $requestMap; - $partMap= advancedQueryFormatForTeam($requestMap,'crm_contacts','contacts_id'); - unset($map['team_id']); + $teamMap=$requestMap['team_id']; + //团队成员 高级筛选 + if($teamMap){ + $partMap= advancedQueryFormatForTeam($teamMap,'contacts','contacts_id'); + unset($requestMap['team_id']); + $map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap; } else { $map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap; } //高级筛选 $map = advancedQuery($map, 'crm', 'contacts', 'index'); //权限 - if (!$partMap) { + $a = 'index'; if ($is_excel) $a = 'excelExport'; $authMap = []; $auth_user_ids = $userModel->getUserByPer('crm', 'contacts', $a); - if (isset($map['contacts.owner_user_id']) && $map['contacts.owner_user_id'][0] != 'like') { + if (isset($map['contacts.owner_user_id'])) { if (!is_array($map['contacts.owner_user_id'][1])) { $map['contacts.owner_user_id'][1] = [$map['contacts.owner_user_id'][1]]; } @@ -114,7 +115,7 @@ class Contacts extends Common ->whereOr('contacts.rw_user_id', array('like', '%,' . $authMapData['user_id'] . ',%')); }; } - } + //联系人商机 diff --git a/application/crm/model/Contract.php b/application/crm/model/Contract.php index 52f611d..b939ec1 100644 --- a/application/crm/model/Contract.php +++ b/application/crm/model/Contract.php @@ -93,12 +93,12 @@ class Contract extends Common }; } $partMap = []; - //优先级:普通筛选>高级筛选>场景 - if ($requestMap['team_id']) { - //相关团队查询 - $map = $requestMap; - $partMap= advancedQueryFormatForTeam($requestMap,'crm_contract','contract_id'); - unset($map['team_id']); + $teamMap=$requestMap['team_id']; + //团队成员 高级筛选 + if($teamMap){ + $partMap= advancedQueryFormatForTeam($teamMap,'contract','contract_id'); + unset($requestMap['team_id']); + $map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap; } else { $map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap; } @@ -106,11 +106,11 @@ class Contract extends Common $map = advancedQuery($map, 'crm', 'contract', 'index'); $order = ['contract.update_time desc']; $authMap = []; - if (!$partMap) { + $a = 'index'; if ($is_excel) $a = 'excelExport'; $auth_user_ids = $userModel->getUserByPer('crm', 'contract', $a); - if (isset($map['contract.owner_user_id']) && $map['contract.owner_user_id'][0] != 'like') { + if (isset($map['contract.owner_user_id'])) { if (!is_array($map['contract.owner_user_id'][1])) { $map['contract.owner_user_id'][1] = [$map['contract.owner_user_id'][1]]; } @@ -135,7 +135,7 @@ class Contract extends Common }; } } - } + //合同签约人 | 与高级筛选冲突,加一个is_array判断 if ($map['contract.order_user_id'] && !is_array($map['contract.order_user_id'][1])) { $map['contract.order_user_id'] = ['like','%,'.$map['contract.order_user_id'][1].',%']; diff --git a/application/crm/model/Customer.php b/application/crm/model/Customer.php index 238a85a..72e652b 100644 --- a/application/crm/model/Customer.php +++ b/application/crm/model/Customer.php @@ -59,7 +59,6 @@ class Customer extends Common $getCount = $request['getCount']; $otherMap = $request['otherMap']; $overdue = $request['overdue']; // 待办事项下需联系客户(逾期) - # 需要过滤的参数 $unsetRequest = ['scene_id','search','user_id','is_excel','action','order_field','order_type','is_remind','getCount','type','otherMap','poolId','overdue']; foreach ($unsetRequest as $v) { @@ -98,10 +97,12 @@ class Customer extends Common # 优先级:普通筛选 > 高级筛选 > 场景 $map = []; $partMap = []; + $teamMap=$requestMap['team_id']; //团队成员 高级筛选 - if($requestMap['team_id']){ - $partMap= advancedQueryFormatForTeam($requestMap,'crm_customer','customer_id'); - unset($map['team_id']); + if($teamMap){ + $partMap= advancedQueryFormatForTeam($teamMap,'customer',''); + unset($requestMap['team_id']); + $map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap; }else{ $map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap; @@ -123,12 +124,11 @@ class Customer extends Common # 权限 $authMap = []; - if (!$partMap) { $a = 'index'; if ($is_excel) $a = 'excelExport'; $auth_user_ids = $userModel->getUserByPer('crm', 'customer', $a); //过滤权限 - if (isset($map['customer.owner_user_id']) && $map['customer.owner_user_id'][0] != 'like') { + if (isset($map['customer.owner_user_id']) ) { if (!is_array($map['customer.owner_user_id'][1])) { $map['customer.owner_user_id'][1] = [$map['customer.owner_user_id'][1]]; } @@ -155,7 +155,7 @@ class Customer extends Common }); }; } - } + # 代办事项 - 待进入公海 @@ -198,14 +198,6 @@ class Customer extends Common $indexField = $fieldModel->getIndexField('crm_customer', $user_id, 1) ? : array('name'); // 列表展示字段 $userField = $fieldModel->getFieldByFormType('crm_customer', 'user'); // 人员类型 $structureField = $fieldModel->getFieldByFormType('crm_customer', 'structure'); // 部门类型 - $datetimeField = $fieldModel->getFieldByFormType('crm_customer', 'datetime'); // 日期时间类型 - $booleanField = $fieldModel->getFieldByFormType('crm_customer', 'boolean_value'); // 布尔值类型字段 - $dateIntervalField = $fieldModel->getFieldByFormType('crm_customer', 'date_interval'); // 日期区间类型字段 - $positionField = $fieldModel->getFieldByFormType('crm_customer', 'position'); // 地址类型字段 - $handwritingField = $fieldModel->getFieldByFormType('crm_customer', 'handwriting_sign'); // 手写签名类型字段 - $locationField = $fieldModel->getFieldByFormType('crm_customer', 'location'); // 定位类型字段 - $boxField = $fieldModel->getFieldByFormType('crm_customer', 'checkbox'); // 多选类型字段 - $floatField = $fieldModel->getFieldByFormType('crm_customer', 'floatnumber'); // 货币类型字段 # 处理人员和部门类型的排序报错问题(前端传来的是包含_name的别名字段) $temporaryField = str_replace('_name', '', $order_field); if (in_array($temporaryField, $userField) || in_array($temporaryField, $structureField)) { @@ -232,9 +224,7 @@ class Customer extends Common ->limit($request['offset'], $request['length']) ->field($indexField) ->orderRaw($order) - // ->fetchSql() ->select(); - $readAuthIds = $userModel->getUserByPer('crm', 'customer', 'read'); $updateAuthIds = $userModel->getUserByPer('crm', 'customer', 'update'); $deleteAuthIds = $userModel->getUserByPer('crm', 'customer', 'delete'); @@ -250,29 +240,15 @@ class Customer extends Common ]) ->group('customer_id') ->select(); - + $business_count = array_column($business_count, null, 'customer_id'); $field_list = $fieldModel->getIndexFieldConfig('crm_customer', $user_id); $field_list = array_column($field_list, 'field'); - - # 扩展数据 - $extraData = []; - $extraList = db('crm_customer_data')->whereIn('customer_id', $customer_id_list)->select(); - foreach ($extraList AS $key => $value) { - $extraData[$value['customer_id']][$value['field']] = $value['content']; - } - $grantData = getFieldGrantData($user_id); - foreach ($grantData['crm_customer'] as $key => $value) { - foreach ($value as $ke => $va) { - if($va['maskType']!=0){ - $fieldGrant[$ke]['maskType'] = $va['maskType']; - $fieldGrant[$ke]['form_type'] = $va['form_type']; - $fieldGrant[$ke]['field'] = $va['field']; - } - } - } + # 获取进入公海天数 $poolDays = $this->getPoolDay($customer_id_list); + # 处理数据 + $list=getFieldData($list,'crm_customer',$user_id); # 整理数据 foreach ($list AS $k => $v) { @@ -281,70 +257,7 @@ class Customer extends Common $list[$k]['create_user_name'] = !empty($list[$k]['create_user_id_info']['realname']) ? $list[$k]['create_user_id_info']['realname'] : ''; $list[$k]['owner_user_name'] = !empty($list[$k]['owner_user_id_info']['realname']) ? $list[$k]['owner_user_id_info']['realname'] : ''; - # 用户类型字段 - foreach ($userField AS $key => $val) { - if (in_array($val, $indexField)) { - $usernameField = !empty($v[$val]) ? db('admin_user')->whereIn('id', stringToArray($v[$val]))->column('realname') : []; - $list[$k][$val] = implode($usernameField, ','); - } - } - # 部门类型字段 - foreach ($structureField AS $key => $val) { - if (in_array($val, $indexField)) { - $structureNameField = !empty($v[$val]) ? db('admin_structure')->whereIn('id', stringToArray($v[$val]))->column('name') : []; - $list[$k][$val] = implode($structureNameField, ','); - } - } - # 日期时间类型字段 - foreach ($datetimeField AS $key => $val) { - $list[$k][$val] = !empty($v[$val]) ? date('Y-m-d H:i:s', $v[$val]) : null; - } - // 布尔值类型字段 - foreach ($booleanField AS $key => $val) { - $list[$k][$val] = !empty($v[$val]) ? (string)$v[$val] : '0'; - } - // 处理日期区间类型字段的格式 - foreach ($dateIntervalField AS $key => $val) { - $list[$k][$val] = !empty($extraData[$v['customer_id']][$val]) ? json_decode($extraData[$v['customer_id']][$val], true) : null; - } - // 处理地址类型字段的格式 - foreach ($positionField AS $key => $val) { - $list[$k][$val] = !empty($extraData[$v['customer_id']][$val]) ? json_decode($extraData[$v['customer_id']][$val], true) : null; - } - // 手写签名类型字段 - foreach ($handwritingField AS $key => $val) { - $handwritingData = !empty($v[$val]) ? db('admin_file')->where('file_id', $v[$val])->value('file_path') : null; - $list[$k][$val] = ['url' => !empty($handwritingData) ? getFullPath($handwritingData) : null]; - } - // 定位类型字段 - foreach ($locationField AS $key => $val) { - $list[$k][$val] = !empty($extraData[$v['customer_id']][$val]) ? json_decode($extraData[$v['customer_id']][$val], true) : null; - } - // 多选框类型字段 - foreach ($boxField AS $key => $val) { - $list[$k][$val] = !empty($v[$val]) ? trim($v[$val], ',') : null; - } - // 货币类型字段 - foreach ($floatField AS $key => $val) { - $list[$k][$val] = $v[$val]!='0.00' ? (string)$v[$val] : null; - } - //掩码相关类型字段 - foreach ($fieldGrant AS $key => $val){ - //掩码相关类型字段 - if ($val['maskType']!=0 && $val['form_type'] == 'mobile') { - $pattern = "/(1[3458]{1}[0-9])[0-9]{4}([0-9]{4})/i"; - $rs = preg_replace($pattern, "$1****$2", $v[$val['field']]); - $list[$k][$val['field']] = !empty($v[$val['field']]) ? (string)$rs : null; - } elseif ($val['maskType']!=0 && $val['form_type'] == 'email') { - $email_array = explode("@", $v[$val['field']]); - $prevfix = (strlen($email_array[0]) < 4) ? "" : substr($v[$val['field']], 0, 2); //邮箱前缀 - $str = preg_replace('/([\d\w+_-]{0,100})@/', "***@", $v[$val['field']], -1, $count); - $rs = $prevfix . $str; - $list[$k][$val['field']] = !empty($v[$val['field']]) ?$rs: null; - } elseif ($val['maskType']!=0 && in_array($val['form_type'],['position','floatnumber'])) { - $list[$k][$val['field']] = !empty($v[$val['field']]) ? (string)substr_replace($v[$val['field']], '*****',0,strlen($v[$val['field']])) : null; - } - } + # 商机数 $list[$k]['business_count'] = $business_count[$v['customer_id']]['count'] ?: 0; # 权限 @@ -551,7 +464,6 @@ class Customer extends Common } } } -// p($customerData); # 设置今日需联系客户 if (!empty($param['next_time']) && $param['next_time'] >= strtotime(date('Y-m-d 00:00:00'))) $param['is_dealt'] = 0; $pool_id = !empty($param['pool_id']) ? $param['pool_id'] : 0; diff --git a/application/crm/model/Receivables.php b/application/crm/model/Receivables.php index 7a9dc4d..a996350 100644 --- a/application/crm/model/Receivables.php +++ b/application/crm/model/Receivables.php @@ -86,12 +86,12 @@ class Receivables extends Common } $partMap = []; //优先级:普通筛选>高级筛选>场景 - //优先级:普通筛选>高级筛选>场景 - if ($requestMap['team_id']) { - //相关团队查询 - $map = $requestMap; - $partMap= advancedQueryFormatForTeam($requestMap,'crm_receivables','receivables_id'); - unset($map['team_id']); + $teamMap=$requestMap['team_id']; + //团队成员 高级筛选 + if($teamMap){ + $partMap= advancedQueryFormatForTeam($teamMap,'receivables',''); + unset($requestMap['team_id']); + $map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap; } else { $map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap; } @@ -100,9 +100,9 @@ class Receivables extends Common //权限 $authMap = []; - if (!$partMap) { + $auth_user_ids = $userModel->getUserByPer('crm', 'receivables', 'index'); - if (isset($map['receivables.owner_user_id']) && $map['receivables.owner_user_id'][0] != 'like') { + if (isset($map['receivables.owner_user_id'])) { if (!is_array($map['receivables.owner_user_id'][1])) { $map['receivables.owner_user_id'][1] = [$map['receivables.owner_user_id'][1]]; } @@ -128,7 +128,7 @@ class Receivables extends Common }; } } - } + //列表展示字段 $indexField = $fieldModel->getIndexField('crm_receivables', $user_id, 1) ?: array('number'); //人员类型 diff --git a/application/crm/model/ReceivablesPlan.php b/application/crm/model/ReceivablesPlan.php index cc5c443..b7cd456 100644 --- a/application/crm/model/ReceivablesPlan.php +++ b/application/crm/model/ReceivablesPlan.php @@ -16,6 +16,7 @@ use think\Validate; class ReceivablesPlan extends Common { + use FieldVerificationTrait; /** * 为了数据库的整洁,同时又不影响Model和Controller的名称 * 我们约定每个模块的数据表都加上相同的前缀,比如CRM模块用crm作为数据表前缀 @@ -162,19 +163,20 @@ class ReceivablesPlan extends Common ->join('__CRM_CUSTOMER__ customer', 'receivables_plan.customer_id = customer.customer_id', 'LEFT') ->join('__CRM_RECEIVABLES__ receivables', 'receivables_plan.plan_id = receivables.plan_id', 'LEFT') ->limit($request['offset'], $request['length']) - ->field(array_merge($indexField, [ - 'customer.name' => 'customer_name', - 'receivables.receivables_id' => 'receivables_id', - 'receivables.check_status' => 'check_status', - 'contract.num ' => 'contract_name', - 'ifnull(SUM(receivables_plan.money), 0)' => 'done_money',//计划回款总金额 - '(ifnull(SUM(receivables.money), 0)-SUM( real_money))' => 'un_money',//未回款总金额 - 'SUM(real_money) AS real_money'//实际回款总金额 - ])) +// ->field(array_merge($indexField, [ +// 'customer.name' => 'customer_name', +// 'receivables.receivables_id' => 'receivables_id', +// 'receivables.check_status' => 'check_status', +// 'contract.num ' => 'contract_name', +// 'ifnull(SUM(receivables_plan.money), 0)' => 'done_money',//计划回款总金额 +// '(ifnull(SUM(receivables.money), 0)-SUM( real_money))' => 'un_money',//未回款总金额 +// 'SUM(real_money) AS real_money'//实际回款总金额 +// ])) + ->field('receivables_plan.*,customer.name as customer_name,contract.num as contract_name,receivables.receivables_id,receivables.check_status') ->where($map) ->where($sceneMap) ->where($whereData) - ->group('receivables_plan.contract_id') +// ->group('receivables_plan.contract_id') ->orderRaw($order) ->select(); $grantData = getFieldGrantData($user_id); diff --git a/config/config.php b/config/config.php index 86051c5..8477356 100644 --- a/config/config.php +++ b/config/config.php @@ -187,7 +187,7 @@ return [ // 端口 'port' => 6379, // 密码 - 'password' => '', + 'password' => '123456', // 缓存前缀 'prefix' => '', // 缓存有效期 0表示永久缓存 diff --git a/config/route_admin.php b/config/route_admin.php index 25b2bde..4dbe101 100644 --- a/config/route_admin.php +++ b/config/route_admin.php @@ -15,6 +15,10 @@ return [ 'admin/install/step2' => ['admin/install/step2', ['method' => 'GET']], 'admin/install/step3' => ['admin/install/step3', ['method' => 'GET']], 'admin/install/step4' => ['admin/install/step4', ['method' => 'POST|AJAX']], + 'admin/install/step7' => ['admin/install/step7', ['method' => 'POST|AJAX']], + 'admin/install/step8' => ['admin/install/step8', ['method' => 'POST|AJAX']], + 'admin/install/step10' => ['admin/install/step10', ['method' => 'POST|AJAX']], + 'admin/install/step11' => ['admin/install/step11', ['method' => 'POST|AJAX']], 'admin/install/step5' => ['admin/install/step5', ['method' => 'GET']], 'admin/install/step6' => ['admin/install/step6', ['method' => 'GET']], 'admin/install/progress' => ['admin/install/progress', ['method' => 'POST']], @@ -367,6 +371,18 @@ return [ 'admin/market/getField' => ['admin/market/getField', ['method' => 'POST']], //【市场活动】市场活动自定义字段表单 'admin/market/updateFields' => ['admin/market/updateFields', ['method' => 'POST']], + + //【审批流】业务审批流 + 'admin/examine/index' => ['admin/examine/index', ['method' => 'POST']], + //【审批流】业务审批流详情 + 'admin/examine/read' => ['admin/examine/read', ['method' => 'POST']], + //【审批流】业务审批流添加 + 'admin/examine/save' => ['admin/examine/save', ['method' => 'POST']], + //【审批流】预览审批条件 + 'admin/examine/previewFiledName' => ['admin/examine/previewFiledName', ['method' => 'POST']], + //【审批流】预览检查流 + 'admin/examine/previewExamineFlow' => ['admin/examine/previewExamineFlow', ['method' => 'POST']], + // MISS路由 '__miss__' => 'admin/base/miss', ]; \ No newline at end of file diff --git a/config/version.php b/config/version.php index b879501..1a5bc8b 100644 --- a/config/version.php +++ b/config/version.php @@ -1,5 +1,5 @@ '11.1.1', -'RELEASE'=>'20210903', +'VERSION'=>'11.1.2', +'RELEASE'=>'20220715', ); \ No newline at end of file diff --git a/public/sql/5kcrm.sql b/public/sql/5kcrm.sql index 17ec8c7..d082695 100644 --- a/public/sql/5kcrm.sql +++ b/public/sql/5kcrm.sql @@ -521,6 +521,23 @@ CREATE TABLE `5kcrm_admin_login_record` ( -- Records of 5kcrm_admin_login_record -- ---------------------------- +-- ---------------------------- +-- Records of 5kcrm_admin_market +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_market`; +CREATE TABLE `5kcrm_admin_market` ( + `market_field_id` int(11) NOT NULL AUTO_INCREMENT, + `status` tinyint(2) NOT NULL DEFAULT 1 COMMENT '0 停用 1启用', + `update_user_id` int(11) NULL DEFAULT NULL COMMENT '最后修改人', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `update_time` int(11) NOT NULL COMMENT '修改时间', + `title` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '表单名称', + PRIMARY KEY (`market_field_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 63 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '系统设置 活动表单' ROW_FORMAT = Dynamic; +-- ---------------------------- +-- Table structure for 5kcrm_admin_market +-- ---------------------------- + -- ---------------------------- -- Table structure for 5kcrm_admin_menu -- ---------------------------- diff --git a/public/sql/5kcrm1.sql b/public/sql/5kcrm1.sql new file mode 100644 index 0000000..f1735fd --- /dev/null +++ b/public/sql/5kcrm1.sql @@ -0,0 +1,497 @@ +/* + Navicat Premium Data Transfer + + Source Server : localhost + Source Server Type : MySQL + Source Server Version : 50726 + Source Host : localhost:3306 + Source Schema : multi_field + + Target Server Type : MySQL + Target Server Version : 50726 + File Encoding : 65001 + + Date: 23/06/2021 17:58:30 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for 5kcrm_admin_access +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_access`; +CREATE TABLE `5kcrm_admin_access` ( + `user_id` int(11) NOT NULL, + `group_id` int(11) NOT NULL +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_access +-- ---------------------------- +INSERT INTO `5kcrm_admin_access` VALUES (1, 1); + +-- ---------------------------- +-- Table structure for 5kcrm_admin_action_log +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_action_log`; +CREATE TABLE `5kcrm_admin_action_log` ( + `log_id` int(11) NOT NULL AUTO_INCREMENT, + `user_id` int(10) NOT NULL COMMENT '操作人ID', + `module_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '模块', + `controller_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '控制器', + `action_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '方法', + `action_id` int(10) NOT NULL COMMENT '操作ID', + `target_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '被操作对象的名称', + `action_delete` tinyint(1) NOT NULL DEFAULT 0 COMMENT '1为删除操作', + `content` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '操作内容', + `create_time` int(11) NOT NULL COMMENT '操作时间', + `join_user_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '抄送人IDs', + `structure_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '抄送部门IDs', + `client_ip` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + PRIMARY KEY (`log_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '操作记录表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_action_log +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_admin_action_record +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_action_record`; +CREATE TABLE `5kcrm_admin_action_record` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `user_id` int(10) NOT NULL COMMENT '用户ID', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `types` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '类型', + `action_id` int(11) NOT NULL COMMENT '操作ID', + `content` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '内容', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '字段操作记录表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_action_record +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_admin_comment +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_comment`; +CREATE TABLE `5kcrm_admin_comment` ( + `comment_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '评论表', + `user_id` int(11) NOT NULL COMMENT '评论人ID', + `content` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '内容(答案)', + `reply_content` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '回复内容(问题)', + `create_time` int(11) NOT NULL COMMENT '新建时间', + `isreply` tinyint(2) NULL DEFAULT 0 COMMENT '是否是回复 1 是 0 否', + `reply_user_id` int(11) NOT NULL DEFAULT 0, + `reply_id` int(11) NULL DEFAULT 0 COMMENT '回复对象ID', + `status` tinyint(2) NULL DEFAULT 1 COMMENT '状态 ', + `type_id` int(11) NULL DEFAULT 0 COMMENT '评论项目任务ID 或评论其他模块ID', + `favour` int(7) NULL DEFAULT 0 COMMENT '赞', + `type` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '分类 ', + `reply_fid` int(11) NOT NULL DEFAULT 0 COMMENT '回复最上级ID', + PRIMARY KEY (`comment_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '任务评论表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_comment +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_admin_config +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_config`; +CREATE TABLE `5kcrm_admin_config` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '名字', + `status` tinyint(2) NOT NULL COMMENT '状态', + `module` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '模型', + `controller` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '控制器', + `type` tinyint(2) NOT NULL COMMENT '类型:1已发布,2未发布,3增值', + `pid` tinyint(4) NOT NULL COMMENT '父级ID', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_config +-- ---------------------------- +INSERT INTO `5kcrm_admin_config` VALUES (1, '任务审批', 1, 'taskExamine', '', 1, 0); +INSERT INTO `5kcrm_admin_config` VALUES (2, '客户管理', 1, 'crm', '', 1, 0); +INSERT INTO `5kcrm_admin_config` VALUES (3, '项目管理', 1, 'work', '', 1, 0); +INSERT INTO `5kcrm_admin_config` VALUES (4, '人力资源管理', 1, 'hrm', '', 2, 0); +INSERT INTO `5kcrm_admin_config` VALUES (5, '进销存管理', 1, 'jxc', '', 2, 0); +INSERT INTO `5kcrm_admin_config` VALUES (6, '呼叫中心功能', 1, 'call', '', 3, 0); +INSERT INTO `5kcrm_admin_config` VALUES (7, '日志', 1, 'log', '', 1, 0); +INSERT INTO `5kcrm_admin_config` VALUES (8, '通讯录', 1, 'book', '', 1, 0); +INSERT INTO `5kcrm_admin_config` VALUES (9, '日历', 1, 'calendar', '', 1, 0); +INSERT INTO `5kcrm_admin_config` VALUES (10, '邮箱', 1, 'email', '', 2, 0); +INSERT INTO `5kcrm_admin_config` VALUES (11, '知识库', 1, 'knowledge', '', 2, 0); + +-- ---------------------------- +-- Table structure for 5kcrm_admin_examine_flow +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_examine_flow`; +CREATE TABLE `5kcrm_admin_examine_flow` ( + `flow_id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '审批流名称', + `config` tinyint(4) NOT NULL COMMENT '1固定审批0授权审批', + `types` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '关联对象', + `types_id` tinyint(4) NOT NULL DEFAULT 0 COMMENT '对象ID(如审批类型ID)', + `structure_ids` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '部门ID(0为全部)', + `user_ids` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '员工ID', + `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '流程说明', + `update_user_id` int(11) NOT NULL COMMENT '修改人ID', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `update_time` int(11) NOT NULL COMMENT '更新时间', + `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '状态 1启用,0禁用', + `is_deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '状态 1删除', + `delete_time` int(11) NOT NULL DEFAULT 0 COMMENT '删除时间', + `delete_user_id` int(11) NOT NULL DEFAULT 0 COMMENT '删除人ID', + PRIMARY KEY (`flow_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '审批流程表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_examine_flow +-- ---------------------------- +INSERT INTO `5kcrm_admin_examine_flow` VALUES (1, '普通审批流程', 0, 'oa_examine', 1, '', '', '', 1, 1548835446, 1548835446, 1, 0, 0, 0); +INSERT INTO `5kcrm_admin_examine_flow` VALUES (2, '请假审批流程', 0, 'oa_examine', 2, '', '', '', 1, 1548835717, 1548835717, 1, 0, 0, 0); +INSERT INTO `5kcrm_admin_examine_flow` VALUES (3, '出差审批流程', 0, 'oa_examine', 3, '', '', '', 1, 1549959653, 1549959653, 1, 0, 0, 0); +INSERT INTO `5kcrm_admin_examine_flow` VALUES (4, '加班审批流程', 0, 'oa_examine', 4, '', '', '', 1, 1549959653, 1549959653, 1, 0, 0, 0); +INSERT INTO `5kcrm_admin_examine_flow` VALUES (5, '差旅审批流程', 0, 'oa_examine', 5, '', '', '', 1, 1549959653, 1549959653, 1, 0, 0, 0); +INSERT INTO `5kcrm_admin_examine_flow` VALUES (6, '借款审批流程', 0, 'oa_examine', 6, '', '', '', 1, 1549959653, 1549959653, 1, 0, 0, 0); +INSERT INTO `5kcrm_admin_examine_flow` VALUES (10, '发票审批流程', 0, 'crm_invoice', 0, '', '', '', 1, 1620610740, 1620610740, 1, 0, 0, 0); +INSERT INTO `5kcrm_admin_examine_flow` VALUES (11, '合同审批流程', 0, 'crm_contract', 0, '', '', '', 1, 1620610745, 1620610745, 1, 0, 0, 0); +INSERT INTO `5kcrm_admin_examine_flow` VALUES (12, '回款审批流程', 0, 'crm_receivables', 0, '', '', '', 1, 1620610748, 1620610748, 1, 0, 0, 0); + +-- ---------------------------- +-- Table structure for 5kcrm_admin_examine_record +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_examine_record`; +CREATE TABLE `5kcrm_admin_examine_record` ( + `record_id` int(11) NOT NULL AUTO_INCREMENT, + `types` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '类型', + `types_id` int(11) NOT NULL DEFAULT 0 COMMENT '类型ID', + `flow_id` int(11) NOT NULL DEFAULT 0 COMMENT '审批流程ID', + `order_id` int(11) NOT NULL DEFAULT 0 COMMENT '审批排序ID', + `check_user_id` int(11) NOT NULL DEFAULT 0 COMMENT '审批人ID', + `check_time` int(11) NOT NULL COMMENT '审批时间', + `status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '1审核通过0审核失败2撤销', + `content` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '审核意见', + `is_end` tinyint(1) NOT NULL DEFAULT 0 COMMENT '审批失效(1标记为无效)', + PRIMARY KEY (`record_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '审批记录表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_examine_record +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_admin_examine_step +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_examine_step`; +CREATE TABLE `5kcrm_admin_examine_step` ( + `step_id` int(11) NOT NULL AUTO_INCREMENT, + `flow_id` int(11) NOT NULL COMMENT '审批流程ID', + `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '1负责人主管,2指定用户(任意一人),3指定用户(多人会签),4上一级审批人主管', + `user_id` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '审批人ID (使用逗号隔开) ,1,2,', + `order_id` tinyint(4) NOT NULL DEFAULT 1 COMMENT '排序ID', + `relation` tinyint(1) NOT NULL DEFAULT 1 COMMENT '审批流程关系(1并2或)', + `create_time` int(11) NOT NULL COMMENT '创建时间', + PRIMARY KEY (`step_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '审批步骤表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_examine_step +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_admin_field +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_field`; +CREATE TABLE `5kcrm_admin_field` ( + `field_id` int(11) NOT NULL AUTO_INCREMENT, + `types` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '分类', + `types_id` int(11) NOT NULL DEFAULT 0 COMMENT '分类ID(审批等)', + `field` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段名', + `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '标识名', + `form_type` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段类型', + `default_value` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '默认值', + `max_length` int(4) NOT NULL DEFAULT 0 COMMENT ' 字数上限', + `is_unique` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否唯一(1是,0否)', + `is_null` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否必填(1是,0否)', + `input_tips` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '输入提示', + `setting` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '设置', + `order_id` int(4) NOT NULL DEFAULT 0 COMMENT '排序ID', + `operating` int(10) NOT NULL DEFAULT 0 COMMENT '0改删,1改,2删,3无', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `update_time` int(11) NOT NULL COMMENT '更新时间', + `type` int(2) NOT NULL DEFAULT 0 COMMENT '薪资管理 1固定 2增加 3减少', + `relevant` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '相关字段名', + `is_hidden` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否隐藏:1隐藏;0不隐藏', + `style_percent` tinyint(4) UNSIGNED NOT NULL DEFAULT 100 COMMENT '字段宽度百分比:25、50、75、100', + `form_position` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '坐标,第一个数字表示坐标x,第二个数字表示坐标y', + `precisions` tinyint(4) UNSIGNED NULL DEFAULT NULL COMMENT '1、小数的精度,允许的最大小数位数,默认为null,表示不启用小数。2、也包含其他数据选项,如:明细表格的显示方式', + `max_num_restrict` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '数字类字段的最大数,所填写的数字不能大于这个字段的值,默认为null', + `min_num_restrict` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '数字类字段的最小数,所填写的数字不能小于这个字段的值,默认为null', + `remark` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '字段说明', + `options` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '如果类型是选项,此处不能为空,多个选项以,隔开,此处的数据是用于控制其他字段是否显示的逻辑表单', + `formAssistId` int(10) NULL DEFAULT NULL COMMENT '逻辑表单相关,由前端生成', + PRIMARY KEY (`field_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 950 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '自定义字段表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_field +-- ---------------------------- +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); +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); + +-- ---------------------------- +-- Table structure for 5kcrm_admin_field_extend +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_field_extend`; +CREATE TABLE `5kcrm_admin_field_extend` ( + `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `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', + `field` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段名称', + `content` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '详细内容', + `create_time` int(10) UNSIGNED NOT NULL COMMENT '生成时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `field_types`(`field`, `types`) USING BTREE, + UNIQUE INDEX `field`(`field`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '自定义字段扩展表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_field_extend +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_admin_field_grant +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_field_grant`; +CREATE TABLE `5kcrm_admin_field_grant` ( + `grant_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `role_id` int(10) NOT NULL COMMENT '角色ID', + `module` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '模块:crm、oa、bi等', + `column` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '栏目:leads、customer、contacts等', + `content` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '授权内容', + `update_time` int(10) NOT NULL COMMENT '修改日期', + `create_time` int(10) NOT NULL COMMENT '创建日期', + PRIMARY KEY (`grant_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色权限管理-字段授权' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_field_grant +-- ---------------------------- +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); +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); +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); +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); +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); +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); +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); +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); +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); + +-- ---------------------------- +-- Table structure for 5kcrm_admin_file +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_file`; +CREATE TABLE `5kcrm_admin_file` ( + `file_id` int(11) NOT NULL AUTO_INCREMENT, + `types` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '类型(file、img)', + `name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '附件名称', + `save_name` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '保存路径名称', + `size` int(10) NOT NULL COMMENT '附件大小(字节)', + `create_user_id` int(10) NOT NULL COMMENT '创建人ID', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `file_path` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '文件路径', + `file_path_thumb` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '文件路径(图片缩略图)', + PRIMARY KEY (`file_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '附件表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_file +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_admin_group +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_group`; +CREATE TABLE `5kcrm_admin_group` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `pid` tinyint(4) NOT NULL COMMENT '分类:0客户自定义角色,1系统默认管理角色,2客户管理角色,3人力资源管理角色,4财务管理角色,5项目管理角色,6办公管理角色', + `title` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '名称', + `rules` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '规则', + `remark` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '备注', + `status` tinyint(3) NULL DEFAULT 1 COMMENT '1启用0禁用', + `type` tinyint(1) NOT NULL DEFAULT 1 COMMENT '1本人,2本人及下属,3本部门,4本部门及下属部门,5全部 ', + `types` tinyint(4) NOT NULL DEFAULT 0 COMMENT '1超级管理员2系统设置管理员3部门与员工管理员4审批流管理员5工作台管理员6客户管理员7项目管理员8公告管理员', + `system` tinyint(4) NOT NULL DEFAULT 0 COMMENT '系统角色', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 16 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_group +-- ---------------------------- +INSERT INTO `5kcrm_admin_group` VALUES (1, 1, '超级管理员角色', '', '超级管理员角色', 1, 1, 1, 0); +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); +INSERT INTO `5kcrm_admin_group` VALUES (3, 1, '部门与员工管理员', ',112,113,114,115,116,117,118,119,105,', '部门与员工管理员', 1, 1, 3, 0); +INSERT INTO `5kcrm_admin_group` VALUES (4, 1, '审批流管理员', ',124,125,105,', '审批流管理员', 1, 1, 4, 0); +INSERT INTO `5kcrm_admin_group` VALUES (5, 1, '工作台管理员', ',122,123,105,', '工作台管理员', 1, 1, 5, 0); +INSERT INTO `5kcrm_admin_group` VALUES (6, 1, '客户管理员', ',126,127,128,129,130,105,', '客户管理员', 1, 1, 6, 0); +INSERT INTO `5kcrm_admin_group` VALUES (7, 1, '公告管理员', '', '公告管理员', 1, 1, 8, 0); +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); +INSERT INTO `5kcrm_admin_group` VALUES (11, 1, '项目管理员', ',141,142,143,', '项目管理员', 1, 1, 7, 0); +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); +INSERT INTO `5kcrm_admin_group` VALUES (13, 5, '只读', '', '项目只读角色', 1, 0, 0, 0); +INSERT INTO `5kcrm_admin_group` VALUES (14, 6, '办公管理员', '', '', 1, 1, 0, 0); +INSERT INTO `5kcrm_admin_group` VALUES (15, 9, '管理项目', ',141,142,143,', '', 1, 0, 0, 0); + +-- ---------------------------- +-- Table structure for 5kcrm_admin_group_auth +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_group_auth`; +CREATE TABLE `5kcrm_admin_group_auth` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `group_id` int(11) NOT NULL COMMENT '角色id', + `auth_group_id` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '角色授权的 角色id', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色权限查看配置表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_group_auth +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_admin_import_record +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_import_record`; +CREATE TABLE `5kcrm_admin_import_record` ( + `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `type` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '导入模块', + `total` int(10) NOT NULL DEFAULT 0 COMMENT '总数', + `done` int(10) NOT NULL DEFAULT 0 COMMENT '已导入数', + `cover` int(10) NOT NULL DEFAULT 0 COMMENT '覆盖数', + `error` int(10) NOT NULL DEFAULT 0 COMMENT '错误数', + `error_data_file_path` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '错误数据文件路径', + `create_time` int(10) NOT NULL DEFAULT 0, + `user_id` int(10) NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '导入数据记录表' ROW_FORMAT = DYNAMIC; diff --git a/public/sql/5kcrm2.sql b/public/sql/5kcrm2.sql new file mode 100644 index 0000000..76132a5 --- /dev/null +++ b/public/sql/5kcrm2.sql @@ -0,0 +1,576 @@ +/* + Navicat Premium Data Transfer + + Source Server : localhost + Source Server Type : MySQL + Source Server Version : 50726 + Source Host : localhost:3306 + Source Schema : multi_field + + Target Server Type : MySQL + Target Server Version : 50726 + File Encoding : 65001 + + Date: 23/06/2021 17:58:30 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + + +-- ---------------------------- +-- Records of 5kcrm_admin_import_record +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_admin_login_record +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_login_record`; +CREATE TABLE `5kcrm_admin_login_record` ( + `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `type` tinyint(1) NOT NULL DEFAULT 0 COMMENT '登录成功与否:0成功;1密码错误;2账号禁用', + `create_user_id` int(10) NOT NULL DEFAULT 0 COMMENT '员工ID', + `create_time` int(10) NOT NULL DEFAULT 0 COMMENT '登录时间', + `ip` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '登录IP,IPv6是46 凑整64位', + `address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '登录地址', + `browser` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '浏览器', + `os` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '操作系统', + `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '说明 - 暂时记录user-agent', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_login_record +-- ---------------------------- + +-- ---------------------------- +-- Records of 5kcrm_admin_market +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_market`; +CREATE TABLE `5kcrm_admin_market` ( + `market_field_id` int(11) NOT NULL AUTO_INCREMENT, + `status` tinyint(2) NOT NULL DEFAULT 1 COMMENT '0 停用 1启用', + `update_user_id` int(11) NULL DEFAULT NULL COMMENT '最后修改人', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `update_time` int(11) NOT NULL COMMENT '修改时间', + `title` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '表单名称', + PRIMARY KEY (`market_field_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 63 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '系统设置 活动表单' ROW_FORMAT = Dynamic; +-- ---------------------------- +-- Table structure for 5kcrm_admin_market +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_admin_menu +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_menu`; +CREATE TABLE `5kcrm_admin_menu` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '菜单ID', + `pid` int(11) NULL DEFAULT 0 COMMENT '上级菜单ID', + `title` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '菜单名称', + `url` varchar(127) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '链接地址', + `icon` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '图标', + `menu_type` tinyint(4) NOT NULL COMMENT '菜单类型', + `sort` tinyint(4) NULL DEFAULT 0 COMMENT '排序(同级有效)', + `status` tinyint(4) NULL DEFAULT 1 COMMENT '状态', + `rule_id` int(11) NOT NULL COMMENT '权限id', + `module` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '后台菜单表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_menu +-- ---------------------------- +INSERT INTO `5kcrm_admin_menu` VALUES (1, 0, 'CRM模块', '', '', 0, 0, 1, 1, 'crm'); +INSERT INTO `5kcrm_admin_menu` VALUES (2, 1, '线索', '', '', 0, 0, 1, 2, 'leads'); +INSERT INTO `5kcrm_admin_menu` VALUES (3, 1, '客户', '', '', 0, 0, 1, 10, 'customer'); +INSERT INTO `5kcrm_admin_menu` VALUES (4, 1, '联系人', '', '', 0, 0, 1, 22, 'contacts'); +INSERT INTO `5kcrm_admin_menu` VALUES (5, 1, '公海', '', '', 0, 0, 1, 29, 'pool'); +INSERT INTO `5kcrm_admin_menu` VALUES (6, 1, '商机', '', '', 0, 0, 1, 34, 'business'); +INSERT INTO `5kcrm_admin_menu` VALUES (7, 1, '合同', '', '', 0, 0, 1, 42, 'contract'); +INSERT INTO `5kcrm_admin_menu` VALUES (8, 1, '回款', '', '', 0, 0, 1, 50, 'receivables'); +INSERT INTO `5kcrm_admin_menu` VALUES (9, 1, '产品', '', '', 0, 0, 1, 56, 'product'); + +-- ---------------------------- +-- Table structure for 5kcrm_admin_message +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_message`; +CREATE TABLE `5kcrm_admin_message` ( + `message_id` int(11) NOT NULL AUTO_INCREMENT, + `type` tinyint(2) NOT NULL DEFAULT 0 COMMENT '消息类型,用于前端拼接消息', + `to_user_id` int(10) NOT NULL COMMENT '接收人ID', + `from_user_id` int(10) NOT NULL COMMENT '发送人ID', + `content` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '发送内容', + `send_time` int(11) NOT NULL COMMENT '发送时间', + `read_time` int(11) NOT NULL COMMENT '阅读时间', + `module_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '模块', + `controller_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '控制器', + `action_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '方法', + `action_id` int(11) NOT NULL COMMENT '操作ID', + `advance_time` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '提前时间', + `is_delete` tinyint(4) NOT NULL DEFAULT 1 COMMENT '状态1未删除2已删除', + `title` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + PRIMARY KEY (`message_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '站内信' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_message +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_admin_oa_schedule +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_oa_schedule`; +CREATE TABLE `5kcrm_admin_oa_schedule` ( + `schedule_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, + `name` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '日程类型', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `update_time` int(11) NULL DEFAULT NULL COMMENT '修改时间', + `color` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '类型颜色', + `type` tinyint(1) NOT NULL DEFAULT 2 COMMENT '类型 1系统类型2 自定义类型', + `is_select` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '显示状态:1显示,0不显示', + PRIMARY KEY (`schedule_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '日程自定义类型' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_oa_schedule +-- ---------------------------- +INSERT INTO `5kcrm_admin_oa_schedule` VALUES (1, '分配的任务', 0, NULL, '1', 1, 0); +INSERT INTO `5kcrm_admin_oa_schedule` VALUES (2, '需联系的客户', 0, NULL, '2', 1, 0); +INSERT INTO `5kcrm_admin_oa_schedule` VALUES (3, '即将到期的合同', 0, NULL, '3', 1, 0); +INSERT INTO `5kcrm_admin_oa_schedule` VALUES (4, '计划回款', 0, NULL, '4', 1, 0); +INSERT INTO `5kcrm_admin_oa_schedule` VALUES (5, '需联系的线索', 0, NULL, '5', 1, 0); +INSERT INTO `5kcrm_admin_oa_schedule` VALUES (6, '需联系的商机', 0, NULL, '6', 1, 0); +INSERT INTO `5kcrm_admin_oa_schedule` VALUES (7, '预计成交的商机', 0, NULL, '7', 1, 0); + +-- ---------------------------- +-- Table structure for 5kcrm_admin_oa_schedule_relation +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_oa_schedule_relation`; +CREATE TABLE `5kcrm_admin_oa_schedule_relation` ( + `schedule_relation_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, + `type` tinyint(1) NOT NULL COMMENT '日程类型状态 0隐藏1 显示', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `update_time` int(11) NULL DEFAULT NULL COMMENT '修改时间', + `schedule_id` int(10) NOT NULL DEFAULT 2 COMMENT '类型id', + `user_id` int(10) NOT NULL COMMENT '负责人', + PRIMARY KEY (`schedule_relation_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '日程自定义类型显示状态' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_oa_schedule_relation +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_admin_oalog_rule +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_oalog_rule`; +CREATE TABLE `5kcrm_admin_oalog_rule` ( + `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `type` tinyint(1) UNSIGNED NOT NULL COMMENT '类型:1日报;2周报;3月报;4欢迎语', + `userIds` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户ID串', + `effective_day` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '需要统计的日志,针对日报', + `start_time` char(5) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '日报提交的开始时间', + `end_time` char(5) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '日报提交的结束时间', + `status` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '状态:1启用;2禁用', + `mark` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '类型为欢迎语使用的字段', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '日报规则表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_oalog_rule +-- ---------------------------- +INSERT INTO `5kcrm_admin_oalog_rule` VALUES (1, 4, NULL, NULL, NULL, NULL, 1, 'a:3:{i:0;s:27:\"每一天都是崭新的!\";i:1;s:63:\"蓝天是宁静的,空气是清新的,阳光是明媚的!\";i:2;s:93:\"以下内容为系统默认欢迎语,在日志随机展示,可自定义更改欢迎语。\";}'); +INSERT INTO `5kcrm_admin_oalog_rule` VALUES (2, 1, '3,4,10', '1,2,3,4,5,7,6', '08:00', '21:00', 1, NULL); +INSERT INTO `5kcrm_admin_oalog_rule` VALUES (3, 2, '3,4', NULL, '1', '3', 1, NULL); +INSERT INTO `5kcrm_admin_oalog_rule` VALUES (4, 3, '3', NULL, '3', '8', 1, NULL); + +-- ---------------------------- +-- Table structure for 5kcrm_admin_operation_log +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_operation_log`; +CREATE TABLE `5kcrm_admin_operation_log` ( + `log_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `target_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '被操作对象', + `user_id` int(10) UNSIGNED NOT NULL COMMENT '员工ID', + `client_ip` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '客户的IP', + `module` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '模块', + `action_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '操作ID', + `content` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '内容', + `create_time` int(10) UNSIGNED NOT NULL COMMENT '时间', + `action_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '操作', + PRIMARY KEY (`log_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '数据操作日志' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_operation_log +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_admin_printing +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_printing`; +CREATE TABLE `5kcrm_admin_printing` ( + `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `user_id` int(10) NOT NULL COMMENT '预留字段:用户ID', + `user_name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '显示字段:用户名称', + `name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '打印模板名称', + `type` tinyint(1) NOT NULL COMMENT '打印类型:1商机;2合同;3回款', + `content` mediumtext CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '打印内容', + `update_time` int(10) NOT NULL COMMENT '更新时间', + `create_time` int(10) NOT NULL COMMENT '创建时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '打印模板表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_printing +-- ---------------------------- +INSERT INTO `5kcrm_admin_printing` VALUES (1, 1, '超级管理员', '合同条款打印模板', 6, '{\"data\":\"

***\\u6709\\u9650\\u516c\\u53f8<\\/span><\\/p>\\n

\\u9500\\u552e\\u5408\\u540c<\\/span><\\/p>\\n

\\u5408\\u540c\\u7f16\\u53f7\\uff1a{\\u5408\\u540c\\u7f16\\u53f7}<\\/span><\\/span><\\/p>\\n

\\u7532\\u65b9\\uff1a{\\u5ba2\\u6237\\u540d\\u79f0}<\\/span><\\/p>\\n

\\u4e59\\u65b9\\uff1a\\u90d1\\u5dde\\u5361\\u5361\\u7f57\\u7279\\u8f6f\\u4ef6\\u79d1\\u6280\\u6709\\u9650\\u516c\\u53f8<\\/span><\\/p>\\n

 <\\/p>\\n

\\u7532\\u4e59\\u53cc\\u65b9\\u672c\\u7740\\u76f8\\u4e92\\u4fe1\\u4efb\\uff0c\\u771f\\u8bda\\u5408\\u4f5c\\u7684\\u539f\\u5219\\uff0c\\u7ecf\\u53cc\\u65b9\\u53cb\\u597d\\u534f\\u5546\\uff0c\\u5c31\\u4e59\\u65b9\\u4e3a\\u7532\\u65b9\\u63d0\\u4f9b\\u7279\\u5b9a\\u670d\\u52a1\\u8fbe\\u6210\\u4e00\\u81f4\\u610f\\u89c1\\uff0c\\u7279\\u7b7e\\u8ba2\\u672c\\u5408\\u540c\\u3002<\\/span><\\/p>\\n

\\u4e00\\u3001\\u670d\\u52a1\\u5185\\u5bb9<\\/strong><\\/span><\\/p>\\n

1\\u3001\\u4e59\\u65b9\\u540c\\u610f\\u5411\\u7532\\u65b9\\u63d0\\u4f9b\\u7684\\u7279\\u5b9a\\u670d\\u52a1\\u3002\\u670d\\u52a1\\u7684\\u5185\\u5bb9\\u7684\\u6807\\u51c6\\u89c1\\u9644\\u4ef6A\\u3002<\\/span><\\/p>\\n

2\\u3001\\u5982\\u679c\\u4e59\\u65b9\\u5728\\u5de5\\u4f5c\\u4e2d\\u56e0\\u81ea\\u8eab\\u8fc7\\u9519\\u800c\\u53d1\\u751f\\u4efb\\u4f55\\u9519\\u8bef\\u6216\\u9057\\u6f0f\\uff0c\\u4e59\\u65b9\\u5e94\\u65e0\\u6761\\u4ef6\\u66f4\\u6b63\\uff0c\\u800c\\u4e0d\\u53e6\\u5916\\u6536\\u8d39\\uff0c\\u5e76\\u5bf9\\u56e0\\u6b64\\u800c\\u5bf9\\u7532\\u65b9\\u9020\\u6210\\u7684\\u635f\\u5931\\u627f\\u62c5\\u8d54\\u507f\\u8d23\\u4efb\\uff0c\\u8d54\\u507f\\u4ee5\\u9644\\u4ef6A\\u6240\\u8f7d\\u660e\\u7684\\u8be5\\u9879\\u670d\\u52a1\\u5185\\u5bb9\\u5bf9\\u5e94\\u4e4b\\u670d\\u52a1\\u8d39\\u4e3a\\u9650\\u3002\\u82e5\\u56e0\\u7532\\u65b9\\u539f\\u56e0\\u9020\\u6210\\u5de5\\u4f5c\\u7684\\u5ef6\\u8bef\\uff0c\\u5c06\\u7531\\u7532\\u65b9\\u627f\\u62c5\\u76f8\\u5e94\\u7684\\u635f\\u5931\\u3002<\\/span><\\/p>\\n

3\\u3001\\u4e59\\u65b9\\u7684\\u670d\\u52a1\\u627f\\u8bfa\\uff1a<\\/span><\\/p>\\n

    1\\uff09\\u4e59\\u65b9\\u63a5\\u5230\\u7532\\u65b9\\u901a\\u8fc7\\u7535\\u8bdd\\u3001\\u4fe1\\u51fd\\u4f20\\u771f\\u3001\\u7535\\u5b50\\u90ae\\u4ef6\\u3001\\u7f51\\u4e0a\\u63d0\\u4ea4\\u7b49\\u65b9\\u5f0f\\u63d0\\u51fa\\u5173\\u4e8e\\u9644\\u4ef6A\\u6240\\u5217\\u670d\\u52a1\\u7684\\u8bf7\\u6c42\\u540e\\uff0c\\u5728\\u4e24\\u4e2a\\u6709\\u6548\\u5de5\\u4f5c\\u65e5\\u5185\\u7ed9\\u4e88\\u54cd\\u5e94\\u5e76\\u63d0\\u4f9b\\u670d\\u52a1\\u3002<\\/span><\\/p>\\n

    2\\uff09\\u4e59\\u65b9\\u63d0\\u4f9b\\u7ed9\\u7532\\u65b9\\u7684\\u670d\\u52a1\\uff0c\\u5fc5\\u987b\\u6309\\u7167\\u5408\\u540c\\u9644\\u4ef6A\\u89c4\\u5b9a\\u7684\\u6807\\u51c6\\u8fdb\\u884c\\u3002<\\/span><\\/p>\\n

4\\u3001\\u4ea7\\u54c1\\u660e\\u7ec6\\uff1a<\\/span><\\/p>\\n\\n\\n\\n\\n
\\u4ea7\\u54c1\\u540d\\u79f0<\\/td>\\n\\u4ea7\\u54c1\\u7c7b\\u522b<\\/td>\\n\\u5355\\u4f4d<\\/td>\\n\\u6807\\u51c6\\u4ef7\\u683c<\\/td>\\n\\u552e\\u4ef7<\\/td>\\n\\u6570\\u91cf<\\/td>\\n\\u6298\\u6263<\\/td>\\n\\u5408\\u8ba1<\\/td>\\n<\\/tr>\\n
{\\u4ea7\\u54c1\\u540d\\u79f0}<\\/span><\\/td>\\n{\\u4ea7\\u54c1\\u7c7b\\u522b}<\\/span><\\/td>\\n{\\u5355\\u4f4d}<\\/span><\\/td>\\n{\\u6807\\u51c6\\u4ef7\\u683c}<\\/span><\\/td>\\n{\\u552e\\u4ef7}<\\/span><\\/td>\\n{\\u6570\\u91cf}<\\/span><\\/td>\\n{\\u6298\\u6263}<\\/span><\\/td>\\n{\\u5408\\u8ba1}<\\/span><\\/td>\\n<\\/tr>\\n<\\/tbody>\\n<\\/table>\\n

\\u6574\\u5355\\u6298\\u6263\\uff1a{\\u6574\\u5355\\u6298\\u6263}<\\/span>    \\u4ea7\\u54c1\\u603b\\u91d1\\u989d\\uff1a{\\u4ea7\\u54c1\\u603b\\u91d1\\u989d}<\\/span><\\/p>\\n

\\u4e8c\\u3001\\u670d\\u52a1\\u8d39\\u7684\\u652f\\u4ed8<\\/strong><\\/span><\\/p>\\n

1\\u3001\\u670d\\u52a1\\u8d39\\u603b\\u91d1\\u989d\\u4e3a    {\\u5408\\u540c\\u91d1\\u989d}<\\/span>    <\\/span><\\/span>\\u5143\\u4eba\\u6c11\\u5e01(\\u4eba\\u6c11\\u5e01\\u5927\\u5199\\uff1a              <\\/span> \\u5143\\u6574)\\u3002
<\\/span><\\/span><\\/p>\\n

2\\u3001\\u672c\\u8d39\\u7528\\u7ed3\\u6784\\u4ec5\\u9650\\u65bc\\u9644\\u4ef6A\\u4e2d\\u5217\\u660e\\u7684\\u5de5\\u4f5c\\u3002\\u5982\\u679c\\u7532\\u65b9\\u8981\\u6c42\\u6269\\u5927\\u9879\\u76ee\\u8303\\u56f4\\uff0c\\u6216\\u56e0\\u7532\\u65b9\\u6539\\u53d8\\u5df2\\u7ecf\\u8bae\\u5b9a\\u7684\\u9879\\u76ee\\u5185\\u5bb9\\u5bfc\\u81f4\\u4e59\\u65b9\\u9700\\u91cd\\u590d\\u8fdb\\u884c\\u9879\\u76ee\\u6b65\\u9aa4\\uff0c\\u4e59\\u65b9\\u5c06\\u9700\\u8981\\u91cd\\u65b0\\u8bc4\\u4f30\\u4e0a\\u8ff0\\u8d39\\u7528\\u7ed3\\u6784\\u3002<\\/span><\\/p>\\n

3\\u3001\\u7532\\u4e59\\u53cc\\u65b9\\u4e00\\u81f4\\u540c\\u610f\\u9879\\u76ee\\u670d\\u52a1\\u8d39\\u6309\\u4e00\\u6b21\\u6027\\u4ee5\\u4eba\\u6c11\\u5e01\\u5f62\\u5f0f\\u652f\\u4ed8\\u3002\\u670d\\u52a1\\u5b8c\\u6210\\u540e\\uff0c\\u7532\\u65b9\\u5c06\\u5728\\u9a8c\\u6536\\u786e\\u8ba4\\u670d\\u52a1\\u5b8c\\u6210\\u5408\\u683c\\uff0c\\u5e76\\u4e14\\u4e59\\u65b9\\u53d1\\u51fa\\u8be5\\u9636\\u6bb5\\u5de5\\u4f5c\\u7684\\u8d39\\u7528\\u8d26\\u5355\\u53ca\\u6b63\\u5f0f\\u6709\\u6548\\u7684\\u7a0e\\u52a1\\u53d1\\u7968\\u540e3\\u4e2a\\u5de5\\u4f5c\\u65e5\\u5185\\uff0c\\u5411\\u4e59\\u65b9\\u652f\\u4ed8\\u7ea6\\u5b9a\\u7684\\u8d39\\u7528\\u3002<\\/span><\\/p>\\n

4\\u3001\\u6709\\u5173\\u53d1\\u7968\\u65b9\\u9762\\u7684\\u4efb\\u4f55\\u95ee\\u9898\\uff0c\\u7532\\u65b9\\u5e94\\u5728\\u6536\\u5230\\u53d1\\u7968\\u540e\\u53ca\\u65f6\\u4e66\\u9762\\u901a\\u77e5\\u4e59\\u65b9\\uff0c\\u4fbf\\u4e59\\u65b9\\u53ca\\u65f6\\u4f5c\\u51fa\\u89e3\\u91ca\\u6216\\u89e3\\u51b3\\u95ee\\u9898\\uff0c\\u4ee5\\u4f7f\\u7532\\u65b9\\u80fd\\u6309\\u65f6\\u4ed8\\u6b3e\\u3002<\\/span><\\/p>\\n

5\\u3001\\u4e59\\u65b9\\u5c06\\u81ea\\u884c\\u627f\\u62c5\\u9879\\u76ee\\u5b9e\\u65bd\\u8303\\u56f4\\u5185\\u5408\\u7406\\u7684\\u5dee\\u65c5\\u8d39\\u7528\\u3002<\\/span><\\/p>\\n

6\\u3001\\u4e59\\u65b9\\u540c\\u610f\\u514d\\u9664\\u9879\\u76ee\\u6742\\u8d39\\u3002<\\/span><\\/p>\\n

7\\u3001\\u672c\\u534f\\u8bae\\u6709\\u6548\\u671f\\u4e3a\\uff1a    {\\u5408\\u540c\\u5f00\\u59cb\\u65f6\\u95f4}<\\/span><\\/span>     <\\/span>  <\\/span>\\u8d77    <\\/span>{\\u5408\\u540c\\u5230\\u671f\\u65f6\\u95f4}<\\/span>     <\\/span> \\u6b62<\\/p>\\n

\\u4e09\\u3001\\u670d\\u52a1\\u7684\\u53d8\\u66f4<\\/strong><\\/span><\\/p>\\n

\\u7532\\u65b9\\u53ef\\u4ee5\\u63d0\\u524d\\u4e2a\\u5de5\\u4f5c\\u65e5\\u4ee5\\u4e66\\u9762\\u5f62\\u5f0f\\u8981\\u6c42\\u53d8\\u66f4\\u6216\\u589e\\u52a0\\u6240\\u63d0\\u4f9b\\u7684\\u670d\\u52a1\\u3002\\u8be5\\u7b49\\u53d8\\u66f4\\u6700\\u7ec8\\u5e94\\u7531\\u53cc\\u65b9\\u4e92\\u76f8\\u5546\\u5b9a\\u8ba4\\u53ef\\uff0c\\u5176\\u4e2d\\u5305\\u62ec\\u4e0e\\u8be5\\u7b49\\u53d8\\u66f4\\u6709\\u5173\\u7684\\u4efb\\u4f55\\u8d39\\u7528\\u8c03\\u6574\\u3002<\\/span><\\/p>\\n

\\u56db\\u3001\\u4e89\\u8bae\\u5904\\u7406<\\/strong><\\/span><\\/p>\\n

\\u7532\\u4e59\\u53cc\\u65b9\\u5982\\u5bf9\\u534f\\u8bae\\u6761\\u6b3e\\u89c4\\u5b9a\\u7684\\u7406\\u89e3\\u6709\\u5f02\\u8bae\\uff0c\\u6216\\u8005\\u5bf9\\u4e0e\\u534f\\u8bae\\u6709\\u5173\\u7684\\u4e8b\\u9879\\u53d1\\u751f\\u4e89\\u8bae\\uff0c\\u53cc\\u65b9\\u5e94\\u672c\\u7740\\u53cb\\u597d\\u5408\\u4f5c\\u7684\\u7cbe\\u795e\\u8fdb\\u884c\\u534f\\u5546\\u3002\\u534f\\u5546\\u4e0d\\u80fd\\u89e3\\u51b3\\u7684\\uff0c\\u4efb\\u4f55\\u4e00\\u65b9\\u53ef\\u5411\\u4ef2\\u88c1\\u59d4\\u5458\\u4f1a\\u63d0\\u8d77\\u4ef2\\u88c1\\u3002<\\/span><\\/p>\\n

\\u4e94\\u3001\\u5176\\u4ed6<\\/strong><\\/span><\\/p>\\n

1\\u3001\\u672c\\u5408\\u540c\\u4e2d\\u6240\\u7528\\u7684\\u6807\\u9898\\u4ec5\\u4e3a\\u65b9\\u4fbf\\u800c\\u8bbe\\uff0c\\u800c\\u4e0d\\u5f71\\u54cd\\u5bf9\\u672c\\u5408\\u540c\\u7684\\u89e3\\u91ca\\u3002<\\/span><\\/p>\\n

2\\u3001\\u9644\\u4ef6A\\u662f\\u672c\\u5408\\u540c\\u4e0d\\u53ef\\u5206\\u5272\\u7684\\u7ec4\\u6210\\u90e8\\u5206\\uff0c\\u4e0e\\u672c\\u5408\\u540c\\u5177\\u6709\\u540c\\u7b49\\u6cd5\\u5f8b\\u6548\\u529b\\u3002<\\/span><\\/p>\\n

3\\u3001\\u672c\\u5408\\u540c\\u672a\\u5c3d\\u4e8b\\u5b9c\\uff0c\\u7531\\u7532\\u4e59\\u53cc\\u65b9\\u534f\\u5546\\u540e\\u4ea7\\u751f\\u4e66\\u9762\\u6587\\u4ef6\\uff0c\\u4f5c\\u4e3a\\u672c\\u5408\\u540c\\u7684\\u8865\\u5145\\u6761\\u6b3e\\uff0c\\u5177\\u5907\\u4e0e\\u672c\\u5408\\u540c\\u540c\\u7b49\\u6cd5\\u5f8b\\u6548\\u529b\\u3002<\\/span><\\/p>\\n

4\\u3001\\u5bf9\\u672c\\u5408\\u540c\\u5185\\u5bb9\\u7684\\u4efb\\u4f55\\u4fee\\u6539\\u548c\\u53d8\\u66f4\\u9700\\u8981\\uff0c\\u7528\\u4e66\\u9762\\u5f62\\u5f0f\\uff0c\\u5e76\\u7ecf\\u53cc\\u65b9\\u786e\\u8ba4\\u540e\\u751f\\u6548\\u3002<\\/span><\\/p>\\n

(\\u4ee5\\u4e0b\\u65e0\\u6b63\\u6587)<\\/span><\\/p>\\n

 <\\/p>\\n

\\u7532\\u65b9\\uff08\\u7b7e\\u7ae0\\uff09                                        \\u4e59\\u65b9\\uff08\\u7b7e\\u7ae0\\uff09<\\/span><\\/p>\\n

\\u4ee3\\u8868\\u7b7e\\u5b57\\uff1a                                           \\u4ee3\\u8868\\u7b7e\\u5b57\\uff1a<\\/span><\\/p>\\n

\\u65e5\\u671f\\uff1a                                               \\u65e5\\u671f\\uff1a<\\/span><\\/p>\"}', 1617868741, 1617868741); +INSERT INTO `5kcrm_admin_printing` VALUES (2, 1, '超级管理员', '合同订单打印模板', 6, '{\"data\":\"

\\u5408\\u540c\\u8ba2\\u5355<\\/span><\\/p>\\n

\\u5408\\u540c\\u7f16\\u53f7\\uff1a{\\u5408\\u540c\\u7f16\\u53f7}<\\/span><\\/p>\\n\\n\\n\\n\\n\\n\\n\\n
\\u5408\\u540c\\u540d\\u79f0\\uff1a{\\u5408\\u540c\\u540d\\u79f0}<\\/span><\\/td>\\n\\u5ba2\\u6237\\u540d\\u79f0\\uff1a{\\u5ba2\\u6237\\u540d\\u79f0}<\\/span><\\/td>\\n<\\/tr>\\n
\\u5408\\u540c\\u603b\\u91d1\\u989d\\uff1a{\\u5408\\u540c\\u91d1\\u989d}<\\/span><\\/td>\\n\\u8d1f\\u8d23\\u4eba\\uff1a{\\u8d1f\\u8d23\\u4eba}<\\/span><\\/td>\\n<\\/tr>\\n
\\u76f8\\u5173\\u5546\\u673a\\uff1a{\\u5546\\u673a\\u540d\\u79f0}<\\/span><\\/td>\\n\\u7b7e\\u8ba2\\u65f6\\u95f4\\uff1a{\\u4e0b\\u5355\\u65f6\\u95f4}<\\/span><\\/td>\\n<\\/tr>\\n
\\u5f00\\u59cb\\u65f6\\u95f4\\uff1a{\\u5408\\u540c\\u5f00\\u59cb\\u65f6\\u95f4}<\\/span><\\/td>\\n\\u7ed3\\u675f\\u65f6\\u95f4\\uff1a{\\u5408\\u540c\\u5230\\u671f\\u65f6\\u95f4}<\\/span><\\/td>\\n<\\/tr>\\n
\\u5907\\u6ce8\\uff1a{\\u5907\\u6ce8}<\\/span><\\/td>\\n <\\/td>\\n<\\/tr>\\n<\\/tbody>\\n<\\/table>\\n

 <\\/p>\\n

 <\\/p>\\n

\\u4ea7\\u54c1\\u660e\\u7ec6\\uff1a<\\/p>\\n\\n\\n\\n\\n
\\u4ea7\\u54c1\\u540d\\u79f0<\\/td>\\n\\u4ea7\\u54c1\\u7c7b\\u522b<\\/td>\\n\\u5355\\u4f4d<\\/td>\\n\\u6807\\u51c6\\u4ef7\\u683c<\\/td>\\n\\u552e\\u4ef7<\\/td>\\n\\u6570\\u91cf<\\/td>\\n\\u6298\\u6263<\\/td>\\n\\u5408\\u8ba1<\\/td>\\n<\\/tr>\\n
{\\u4ea7\\u54c1\\u540d\\u79f0}<\\/span><\\/td>\\n{\\u4ea7\\u54c1\\u7c7b\\u522b}<\\/span><\\/td>\\n{\\u5355\\u4f4d}<\\/span><\\/td>\\n{\\u6807\\u51c6\\u4ef7\\u683c}<\\/span><\\/td>\\n{\\u552e\\u4ef7}<\\/span><\\/td>\\n{\\u6570\\u91cf}<\\/span><\\/td>\\n{\\u6298\\u6263}<\\/span><\\/td>\\n{\\u5408\\u8ba1}<\\/span><\\/td>\\n<\\/tr>\\n<\\/tbody>\\n<\\/table>\\n

\\u4ea7\\u54c1\\u603b\\u91d1\\u989d\\uff1a{\\u4ea7\\u54c1\\u603b\\u91d1\\u989d}<\\/span><\\/p>\\n

 <\\/p>\\n

 <\\/p>\\n

 <\\/p>\\n

 <\\/p>\\n

 <\\/p>\\n

 <\\/p>\\n

 <\\/p>\"}', 1617869167, 1617869167); +INSERT INTO `5kcrm_admin_printing` VALUES (3, 1, '超级管理员', '商机打印模板', 5, '{\"data\":\"

***\\u6709\\u9650\\u516c\\u53f8<\\/span><\\/p>\\n

\\u5546\\u673a<\\/span><\\/p>\\n\\n\\n\\n\\n\\n\\n
\\u5546\\u673a\\u540d\\u79f0\\uff1a{\\u5546\\u673a\\u540d\\u79f0}<\\/span><\\/td>\\n\\u5ba2\\u6237\\u540d\\u79f0\\uff1a{\\u5ba2\\u6237\\u540d\\u79f0}<\\/span><\\/td>\\n<\\/tr>\\n
\\u5546\\u673a\\u72b6\\u6001\\u7ec4\\uff1a{\\u5546\\u673a\\u72b6\\u6001\\u7ec4}<\\/span><\\/td>\\n\\u5546\\u673a\\u9636\\u6bb5\\uff1a{\\u5546\\u673a\\u9636\\u6bb5}<\\/span><\\/td>\\n<\\/tr>\\n
\\u9884\\u8ba1\\u6210\\u4ea4\\u65f6\\u95f4\\uff1a{\\u9884\\u8ba1\\u6210\\u4ea4\\u65e5\\u671f}<\\/span><\\/td>\\n\\u5546\\u673a\\u91d1\\u989d\\uff08\\u5143\\uff09\\uff1a{\\u5546\\u673a\\u91d1\\u989d}<\\/span><\\/td>\\n<\\/tr>\\n
\\u8d1f\\u8d23\\u4eba\\uff1a{\\u8d1f\\u8d23\\u4eba}<\\/span><\\/td>\\n <\\/td>\\n<\\/tr>\\n<\\/tbody>\\n<\\/table>\\n

 <\\/p>\\n

 <\\/p>\\n

\\u4ea7\\u54c1\\u660e\\u7ec6\\uff1a<\\/p>\\n\\n\\n\\n\\n
\\u4ea7\\u54c1\\u540d\\u79f0<\\/td>\\n\\u4ea7\\u54c1\\u7c7b\\u522b<\\/td>\\n\\u5355\\u4f4d<\\/td>\\n\\u6807\\u51c6\\u4ef7\\u683c<\\/td>\\n\\u552e\\u4ef7<\\/td>\\n\\u6570\\u91cf<\\/td>\\n\\u6298\\u6263<\\/td>\\n\\u5408\\u8ba1<\\/td>\\n<\\/tr>\\n
{\\u4ea7\\u54c1\\u540d\\u79f0}<\\/span><\\/td>\\n{\\u4ea7\\u54c1\\u7c7b\\u522b}<\\/span><\\/td>\\n{\\u5355\\u4f4d}<\\/span><\\/td>\\n{\\u6807\\u51c6\\u4ef7\\u683c}<\\/span><\\/td>\\n{\\u552e\\u4ef7}<\\/span><\\/td>\\n{\\u6570\\u91cf}<\\/span><\\/td>\\n{\\u6298\\u6263}<\\/span><\\/td>\\n{\\u5408\\u8ba1}<\\/span><\\/td>\\n<\\/tr>\\n<\\/tbody>\\n<\\/table>\\n

\\u6574\\u70b9\\u6298\\u6263\\uff1a{\\u6574\\u5355\\u6298\\u6263}<\\/span>      \\u4ea7\\u54c1\\u603b\\u91d1\\u989d\\uff08\\u5143\\uff09\\uff1a{\\u4ea7\\u54c1\\u603b\\u91d1\\u989d}<\\/span><\\/p>\\n

 <\\/p>\"}', 1617869397, 1617869397); +INSERT INTO `5kcrm_admin_printing` VALUES (4, 1, '超级管理员', '回款打印模板', 7, '{\"data\":\"

***\\u6709\\u9650\\u516c\\u53f8<\\/span><\\/p>\\n

\\u56de\\u6b3e\\u5355<\\/span><\\/p>\\n\\n\\n\\n\\n\\n\\n\\n
\\u5ba2\\u6237\\u540d\\u79f0\\uff1a{\\u5ba2\\u6237\\u540d\\u79f0}<\\/span><\\/td>\\n\\u56de\\u6b3e\\u7f16\\u53f7\\uff1a{\\u56de\\u6b3e\\u7f16\\u53f7}<\\/span><\\/td>\\n<\\/tr>\\n
\\u56de\\u6b3e\\u65e5\\u671f\\uff1a{\\u56de\\u6b3e\\u65e5\\u671f}<\\/span><\\/td>\\n\\u56de\\u6b3e\\u65b9\\u5f0f\\uff1a{\\u56de\\u6b3e\\u65b9\\u5f0f}<\\/span><\\/td>\\n<\\/tr>\\n
\\u56de\\u6b3e\\u671f\\u6570\\uff1a{\\u671f\\u6570}<\\/span><\\/td>\\n\\u56de\\u6b3e\\u91d1\\u989d\\uff08\\u5143\\uff09\\uff1a{\\u56de\\u6b3e\\u91d1\\u989d}<\\/span><\\/td>\\n<\\/tr>\\n
\\u8d1f\\u8d23\\u4eba\\uff1a{\\u8d1f\\u8d23\\u4eba}<\\/span><\\/td>\\n <\\/td>\\n<\\/tr>\\n
\\u5907\\u6ce8\\uff1a{\\u5907\\u6ce8}<\\/span><\\/td>\\n<\\/tr>\\n<\\/tbody>\\n<\\/table>\\n

 <\\/p>\"}', 1617869632, 1617869632); + +-- ---------------------------- +-- Table structure for 5kcrm_admin_printing_data +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_printing_data`; +CREATE TABLE `5kcrm_admin_printing_data` ( + `data_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `key` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '文件key', + `content` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '文件内容', + `user_id` int(10) UNSIGNED NOT NULL COMMENT '用户ID', + `type` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '类型:word、pdf', + `create_time` int(10) UNSIGNED NOT NULL COMMENT '创建时间', + PRIMARY KEY (`data_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '打印文件表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_printing_data +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_admin_rule +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_rule`; +CREATE TABLE `5kcrm_admin_rule` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `types` tinyint(2) NOT NULL DEFAULT 0 COMMENT '0系统设置1工作台2客户管理3项目管理4人力资源5财务管理6商业智能(客戶)7商业智能(办公)', + `title` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '名称', + `name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '定义', + `level` tinyint(5) NOT NULL DEFAULT 0 COMMENT '级别。1模块,2控制器,3操作', + `pid` int(11) NULL DEFAULT 0 COMMENT '父id,默认0', + `status` tinyint(3) NULL DEFAULT 1 COMMENT '状态,1启用,0禁用', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 240 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '权限规则表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_rule +-- ---------------------------- +INSERT INTO `5kcrm_admin_rule` VALUES (1, 2, '全部', 'crm', 1, 0, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (2, 2, '线索管理', 'leads', 2, 1, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (3, 2, '新建', 'save', 3, 2, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (4, 2, '编辑', 'update', 3, 2, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (5, 2, '查看列表', 'index', 3, 2, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (6, 2, '查看详情', 'read', 3, 2, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (7, 2, '导入', 'excelImport', 3, 2, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (8, 2, '导出', 'excelExport', 3, 2, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (9, 2, '刪除', 'delete', 3, 2, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (10, 2, '客户管理', 'customer', 2, 1, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (11, 2, '新建', 'save', 3, 10, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (12, 2, '编辑', 'update', 3, 10, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (13, 2, '查看列表', 'index', 3, 10, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (14, 2, '查看详情', 'read', 3, 10, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (15, 2, '导入', 'excelImport', 3, 10, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (16, 2, '导出', 'excelExport', 3, 10, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (17, 2, '刪除', 'delete', 3, 10, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (18, 2, '转移', 'transfer', 3, 10, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (19, 2, '放入公海', 'putInPool', 3, 10, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (20, 2, '锁定/解锁', 'lock', 3, 10, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (21, 2, '编辑团队成员', 'teamSave', 3, 10, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (22, 2, '联系人管理', 'contacts', 2, 1, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (23, 2, '新建', 'save', 3, 22, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (24, 2, '编辑', 'update', 3, 22, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (25, 2, '查看列表', 'index', 3, 22, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (26, 2, '查看详情', 'read', 3, 22, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (27, 2, '刪除', 'delete', 3, 22, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (28, 2, '转移', 'transfer', 3, 22, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (34, 2, '商机管理', 'business', 2, 1, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (35, 2, '新建', 'save', 3, 34, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (36, 2, '编辑', 'update', 3, 34, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (37, 2, '查看列表', 'index', 3, 34, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (38, 2, '查看详情', 'read', 3, 34, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (39, 2, '刪除', 'delete', 3, 34, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (40, 2, '转移', 'transfer', 3, 34, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (41, 2, '编辑团队成员', 'teamSave', 3, 34, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (42, 2, '合同管理', 'contract', 2, 1, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (43, 2, '新建', 'save', 3, 42, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (44, 2, '编辑', 'update', 3, 42, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (45, 2, '查看列表', 'index', 3, 42, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (46, 2, '查看详情', 'read', 3, 42, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (47, 2, '刪除', 'delete', 3, 42, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (48, 2, '转移', 'transfer', 3, 42, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (49, 2, '编辑团队成员', 'teamSave', 3, 42, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (50, 2, '回款管理', 'receivables', 2, 1, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (51, 2, '新建', 'save', 3, 50, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (52, 2, '编辑', 'update', 3, 50, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (53, 2, '查看列表', 'index', 3, 50, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (54, 2, '查看详情', 'read', 3, 50, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (55, 2, '刪除', 'delete', 3, 50, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (56, 2, '产品管理', 'product', 2, 1, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (57, 2, '新建', 'save', 3, 56, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (58, 2, '编辑', 'update', 3, 56, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (59, 2, '查看列表', 'index', 3, 56, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (60, 2, '查看详情', 'read', 3, 56, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (61, 2, '上架/下架', 'status', 3, 56, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (62, 6, '商业智能', 'bi', 1, 0, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (63, 6, '员工客户分析', 'customer', 2, 62, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (64, 6, '查看', 'read', 3, 63, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (65, 6, '销售漏斗分析', 'business', 2, 62, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (66, 6, '查看', 'read', 3, 65, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (67, 6, '回款统计', 'receivables', 2, 62, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (68, 6, '查看', 'read', 3, 67, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (69, 6, '产品分析', 'product', 2, 62, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (70, 6, '查看', 'read', 3, 69, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (71, 6, '业绩目标完成情况', 'achievement', 2, 62, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (72, 6, '查看', 'read', 3, 71, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (73, 2, '转移', 'transfer', 3, 2, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (74, 2, '转化', 'transform', 3, 2, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (75, 6, '员工业绩分析', 'contract', 2, 62, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (76, 6, '查看', 'read', 3, 75, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (77, 6, '客户画像分析', 'portrait', 2, 62, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (78, 6, '查看', 'read', 3, 77, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (79, 6, '排行榜', 'ranking', 2, 62, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (80, 6, '查看', 'read', 3, 79, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (81, 2, '导入', 'excelImport', 3, 22, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (82, 2, '导出', 'excelExport', 3, 22, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (83, 2, '导入', 'excelImport', 3, 56, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (84, 2, '导出', 'excelExport', 3, 56, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (86, 3, '项目管理', 'work', 1, 0, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (87, 3, '项目', 'work', 2, 86, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (88, 3, '任务', 'task', 2, 86, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (89, 3, '项目设置', 'update', 3, 87, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (90, 3, '任务列表', 'taskClass', 2, 86, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (91, 3, '新建任务列表', 'save', 3, 90, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (92, 3, '编辑任务列表', 'update', 3, 90, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (93, 3, '删除任务列表', 'delete', 3, 90, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (94, 3, '创建', 'save', 3, 88, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (95, 7, '办公分析', 'oa', 2, 140, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (96, 7, '查看', 'read', 3, 95, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (104, 2, '成交状态', 'deal_status', 3, 10, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (105, 0, '全部', 'admin', 1, 0, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (106, 0, '企业首页', 'system', 2, 105, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (107, 0, '查看', 'index', 3, 106, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (108, 0, '编辑', 'save', 3, 106, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (109, 0, '应用管理', 'configset', 2, 105, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (110, 0, '查看', 'index', 3, 109, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (111, 0, '停用/启用', 'update', 3, 109, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (112, 0, '员工与部门管理', 'users', 2, 105, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (113, 0, '部门/员工查看', 'index', 3, 112, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (114, 0, '员工新建', 'save', 3, 112, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (115, 0, '员工禁用/激活', 'enables', 3, 112, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (116, 0, '员工操作', 'update', 3, 112, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (117, 0, '部门新建', 'structures_save', 3, 112, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (118, 0, '部门编辑', 'structures_update', 3, 112, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (119, 0, '部门删除', 'structures_delete', 3, 112, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (120, 0, '角色权限管理', 'groups', 2, 105, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (121, 0, '角色权限设置', 'update', 3, 120, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (122, 0, '工作台设置', 'oa', 2, 105, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (123, 0, '办公审批管理', 'examine', 3, 122, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (124, 0, '审批流程管理', 'examine_flow', 2, 105, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (125, 0, '审批流程管理', 'index', 3, 124, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (126, 0, '客户管理设置', 'crm', 2, 105, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (127, 0, '自定义字段设置', 'field', 3, 126, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (128, 0, '客户公海规则', 'pool', 3, 126, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (129, 0, '业务参数设置', 'setting', 3, 126, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (130, 0, '业绩目标设置', 'achievement', 3, 126, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (131, 1, '全部', 'oa', 1, 0, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (132, 1, '通讯录', 'addresslist', 2, 131, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (133, 1, '查看列表', 'index', 3, 132, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (134, 1, '公告', 'announcement', 2, 131, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (135, 1, '新建', 'save', 3, 134, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (136, 1, '编辑', 'update', 3, 134, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (137, 1, '删除', 'delete', 3, 134, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (138, 0, '项目管理设置', 'work', 2, 105, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (139, 0, '项目管理', 'work', 3, 138, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (140, 7, '商业智能', 'bi', 1, 0, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (141, 9, '全部', 'work', 1, 0, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (142, 9, '项目管理', 'work', 2, 141, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (143, 9, '项目创建', 'save', 3, 142, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (145, 2, '查看列表', 'index', 3, 144, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (146, 2, '导出', 'excelExport', 3, 34, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (147, 2, '导出', 'excelExport', 3, 42, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (148, 2, '合同作废', 'cancel', 3, 42, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (149, 2, '删除', 'delete', 3, 56, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (151, 0, '登录日志', 'loginLog', 3, 220, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (153, 2, '转移', 'transfer', 3, 50, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (154, 0, '其他设置', 'other_rule', 2, 105, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (155, 0, '日志欢迎语', 'welcome', 3, 154, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (156, 0, '设置欢迎语', 'setWelcome', 3, 154, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (157, 0, '日志规则', 'workLogRule', 3, 154, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (158, 0, '设置日志规则', 'setWorkLogRule', 3, 154, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (159, 0, '自定义打印模板', 'printing', 3, 126, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (160, 2, '关注', 'star', 3, 2, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (161, 2, '关注', 'star', 3, 10, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (162, 2, '关注', 'star', 3, 22, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (163, 2, '关注', 'star', 3, 34, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (164, 2, '附近客户', 'nearby', 3, 10, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (165, 2, '发票管理', 'invoice', 2, 1, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (166, 2, '列表', 'index', 3, 165, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (167, 2, '创建', 'save', 3, 165, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (168, 2, '详情', 'read', 3, 165, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (169, 2, '编辑', 'update', 3, 165, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (170, 2, '删除', 'delete', 3, 165, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (171, 2, '转移', 'transfer', 3, 165, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (172, 2, '开票', 'setInvoice', 3, 165, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (173, 2, '重置开票状态', 'resetInvoiceStatus', 3, 165, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (174, 2, '跟进记录', 'activity', 2, 1, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (175, 2, '列表', 'index', 3, 174, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (176, 2, '详情', 'read', 3, 174, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (177, 2, '创建', 'save', 3, 174, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (178, 2, '编辑', 'update', 3, 174, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (179, 2, '删除', 'delete', 3, 174, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (180, 3, '项目设置', 'setWork', 4, 86, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (181, 3, '项目导出', 'excelExport', 4, 86, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (182, 3, '新建任务列表', 'saveTaskClass', 4, 86, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (183, 3, '编辑任务列表', 'updateTaskClass', 4, 86, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (184, 3, '移动任务列表', 'updateClassOrder', 4, 86, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (185, 3, '删除任务列表', 'deleteTaskClass', 4, 86, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (186, 3, '新建任务', 'saveTask', 4, 86, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (187, 3, '完成任务', 'setTaskStatus', 4, 86, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (188, 3, '编辑任务标题', 'setTaskTitle', 4, 86, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (189, 3, '编辑任务描述', 'setTaskDescription', 4, 86, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (190, 3, '分配任务', 'setTaskMainUser', 4, 86, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (191, 3, '设置任务时间', 'setTaskTime', 4, 86, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (192, 3, '设置任务标签', 'setTaskLabel', 4, 86, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (193, 3, '添加任务参与人', 'setTaskOwnerUser', 4, 86, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (194, 3, '设置任务优先级', 'setTaskPriority', 4, 86, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (195, 3, '移动任务', 'setTaskOrder', 4, 86, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (196, 3, '归档任务', 'archiveTask', 4, 86, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (197, 3, '删除任务', 'deleteTask', 4, 86, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (198, 3, '彻底删除任务', 'cleanTask', 4, 86, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (199, 3, '任务添加附件', 'uploadTaskFile', 4, 86, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (200, 3, '任务删除附件', 'deleteTaskFile', 4, 86, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (201, 3, '项目导入', 'excelImport', 4, 86, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (202, 3, '新建子任务', 'addChildTask', 4, 86, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (203, 3, '编辑子任务', 'updateChildTask', 4, 86, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (204, 3, '删除子任务', 'deleteChildTask', 4, 86, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (205, 3, '恢复任务', 'restoreTask', 4, 86, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (206, 3, '关联业务', 'saveTaskRelation', 4, 86, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (207, 3, '完成子任务', 'setChildTaskStatus', 4, 86, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (208, 0, '初始化', 'initialize', 2, 105, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (209, 0, '初始化数据', 'update', 3, 208, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (210, 2, '打印', 'print', 3, 34, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (211, 2, '打印', 'print', 3, 42, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (212, 2, '打印', 'print', 3, 50, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (213, 2, '导出', 'excelexport', 3, 50, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (214, 2, '转移', 'transfer', 3, 56, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (215, 2, '回访管理', 'visit', 2, 1, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (216, 2, '新建', 'save', 3, 215, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (217, 2, '编辑', 'update', 3, 215, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (218, 2, '查看列表', 'index', 3, 215, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (219, 2, '查看详情', 'read', 3, 215, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (220, 0, '系统日志', 'adminLog', 2, 105, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (221, 0, '数据操作日志', 'actionRecord', 3, 220, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (222, 0, '系统操作日志', 'systemLog', 3, 220, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (223, 3, '管理参与人权限', 'manageTaskOwnerUser', 4, 86, 0); +INSERT INTO `5kcrm_admin_rule` VALUES (224, 2, '导入', 'excelImport', 3, 174, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (225, 2, '导出', 'excelExport', 3, 174, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (226, 2, '删除', 'delete', 3, 215, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (228, 0, '角色权限查看', 'ruleList', 3, 112, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (229, 2, '编辑团队成员', 'teamSave', 3, 50, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (230, 2, '编辑团队成员', 'teamSave', 3, 22, 1); +INSERT INTO `5kcrm_admin_rule` VALUES (231, 2, '导出', 'excelExport', 3, 165, 1); + +-- ---------------------------- +-- Table structure for 5kcrm_admin_scene +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_scene`; +CREATE TABLE `5kcrm_admin_scene` ( + `scene_id` int(10) NOT NULL AUTO_INCREMENT, + `types` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '分类', + `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '场景名称', + `user_id` int(10) NOT NULL COMMENT '用户ID', + `order_id` int(10) NOT NULL DEFAULT 1 COMMENT '排序ID', + `data` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '属性值', + `is_hide` tinyint(1) NOT NULL DEFAULT 0 COMMENT '1隐藏', + `type` tinyint(1) NOT NULL DEFAULT 0 COMMENT '1系统0自定义', + `bydata` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '系统参数', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `update_time` int(11) NOT NULL COMMENT '更新时间', + PRIMARY KEY (`scene_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 40 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '场景' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_scene +-- ---------------------------- +INSERT INTO `5kcrm_admin_scene` VALUES (1, 'crm_customer', '我负责的客户', 0, 0, '', 0, 1, 'me', 1546272000, 1546272000); +INSERT INTO `5kcrm_admin_scene` VALUES (3, 'crm_customer', '下属负责的客户', 0, 0, '', 0, 1, 'sub', 1546272000, 1546272000); +INSERT INTO `5kcrm_admin_scene` VALUES (4, 'crm_customer', '全部客户', 0, 0, '', 0, 1, 'all', 1546272000, 1546272000); +INSERT INTO `5kcrm_admin_scene` VALUES (5, 'crm_leads', '我负责的线索', 0, 0, '', 0, 1, 'me', 1546272000, 1546272000); +INSERT INTO `5kcrm_admin_scene` VALUES (6, 'crm_leads', '下属的线索', 0, 0, '', 0, 1, 'sub', 1546272000, 1546272000); +INSERT INTO `5kcrm_admin_scene` VALUES (7, 'crm_leads', '全部线索', 0, 0, '', 0, 1, 'all', 1546272000, 1546272000); +INSERT INTO `5kcrm_admin_scene` VALUES (8, 'crm_contacts', '我负责的联系人', 0, 0, '', 0, 1, 'me', 1546272000, 1546272000); +INSERT INTO `5kcrm_admin_scene` VALUES (9, 'crm_contacts', '下属负责的联系人', 0, 0, '', 0, 1, 'sub', 1546272000, 1546272000); +INSERT INTO `5kcrm_admin_scene` VALUES (10, 'crm_contacts', '全部联系人', 0, 0, '', 0, 1, 'all', 1546272000, 1546272000); +INSERT INTO `5kcrm_admin_scene` VALUES (11, 'crm_business', '我负责的商机', 0, 0, '', 0, 1, 'me', 1546272000, 1546272000); +INSERT INTO `5kcrm_admin_scene` VALUES (13, 'crm_business', '下属负责的商机', 0, 0, '', 0, 1, 'sub', 1546272000, 1546272000); +INSERT INTO `5kcrm_admin_scene` VALUES (14, 'crm_business', '全部商机', 0, 0, '', 0, 1, 'all', 1546272000, 1546272000); +INSERT INTO `5kcrm_admin_scene` VALUES (15, 'crm_contract', '我负责的合同', 0, 0, '', 0, 1, 'me', 1546272000, 1546272000); +INSERT INTO `5kcrm_admin_scene` VALUES (17, 'crm_contract', '下属负责的合同', 0, 0, '', 0, 1, 'sub', 1546272000, 1546272000); +INSERT INTO `5kcrm_admin_scene` VALUES (18, 'crm_contract', '全部合同', 0, 0, '', 0, 1, 'all', 1546272000, 1546272000); +INSERT INTO `5kcrm_admin_scene` VALUES (19, 'crm_receivables', '我负责的回款', 0, 0, '', 0, 1, 'me', 1546272000, 1551515457); +INSERT INTO `5kcrm_admin_scene` VALUES (20, 'crm_receivables', '下属负责的回款', 0, 1, '', 0, 1, 'sub', 1546272000, 1551515457); +INSERT INTO `5kcrm_admin_scene` VALUES (21, 'crm_receivables', '全部回款', 0, 2, '', 0, 1, 'all', 1546272000, 1551515457); +INSERT INTO `5kcrm_admin_scene` VALUES (22, 'crm_product', '全部产品', 0, 0, '', 0, 1, 'all', 1546272000, 1546272000); +INSERT INTO `5kcrm_admin_scene` VALUES (23, 'crm_leads', '已转化线索', 0, 0, '', 0, 1, 'is_transform', 1546272000, 1546272000); +INSERT INTO `5kcrm_admin_scene` VALUES (24, 'crm_customer_pool', '今日进入公海的客户', 0, 0, '', 0, 1, 'pool', 1566748800, 1566748800); +INSERT INTO `5kcrm_admin_scene` VALUES (25, 'crm_business', '赢单商机', 0, 0, NULL, 0, 1, 'win_business', 1607072044, 1607072044); +INSERT INTO `5kcrm_admin_scene` VALUES (26, 'crm_business', '输单商机', 0, 0, NULL, 0, 1, 'fail_business', 1607072044, 1607072044); +INSERT INTO `5kcrm_admin_scene` VALUES (27, 'crm_leads', '我关注的线索', 0, 0, NULL, 0, 1, 'star', 1607158834, 1607158834); +INSERT INTO `5kcrm_admin_scene` VALUES (28, 'crm_customer', '我关注的客户', 0, 0, NULL, 0, 1, 'star', 1607158834, 1607158834); +INSERT INTO `5kcrm_admin_scene` VALUES (29, 'crm_contacts', '我关注的联系人', 0, 0, NULL, 0, 1, 'star', 1607158834, 1607158834); +INSERT INTO `5kcrm_admin_scene` VALUES (30, 'crm_business', '我关注的商机', 0, 0, NULL, 0, 1, 'star', 1607158834, 1607158834); +INSERT INTO `5kcrm_admin_scene` VALUES (31, 'crm_visit', '全部回访', 0, 0, '', 0, 1, 'all', 1546272000, 1546272000); +INSERT INTO `5kcrm_admin_scene` VALUES (32, 'crm_visit', '我负责的回访', 0, 0, '', 0, 1, 'me', 1546272000, 1551515457); +INSERT INTO `5kcrm_admin_scene` VALUES (33, 'crm_visit', '下属负责的回访', 0, 1, '', 0, 1, 'sub', 1546272000, 1551515457); +INSERT INTO `5kcrm_admin_scene` VALUES (34, 'crm_business', '进行中的商机', 0, 0, NULL, 0, 1, 'go_business', 1546272000, 1546272000); +INSERT INTO `5kcrm_admin_scene` VALUES (35, 'crm_invoice', '全部发票', 0, 0, '', 0, 1, 'all', 1546272000, 1546272000); +INSERT INTO `5kcrm_admin_scene` VALUES (36, 'crm_invoice', '我负责的发票', 0, 0, '', 0, 1, 'me', 1546272000, 1546272000); +INSERT INTO `5kcrm_admin_scene` VALUES (37, 'crm_invoice', '下属负责的发票', 0, 0, '', 0, 1, 'sub', 1546272000, 1546272000); +INSERT INTO `5kcrm_admin_scene` VALUES (38, 'crm_product', '上架的产品', 0, 0, NULL, 0, 1, 'put_on_shelves', 1623240292, 1623240292); +INSERT INTO `5kcrm_admin_scene` VALUES (39, 'crm_product', '下架的产品', 0, 0, NULL, 0, 1, 'pull_off_shelves', 1623240292, 1623240292); +-- ---------------------------- +-- Table structure for 5kcrm_hrm_user_det +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_hrm_user_det`; +CREATE TABLE `5kcrm_hrm_user_det` ( + `userdet_id` int(9) NOT NULL AUTO_INCREMENT, + `user_id` int(11) NOT NULL COMMENT '员工id', + `join_time` int(11) NOT NULL DEFAULT 0 COMMENT '入职时间', + `type` tinyint(2) NOT NULL DEFAULT 0 COMMENT '工作性质:1全职 2兼职 3实习', + `status` tinyint(2) NOT NULL DEFAULT 0 COMMENT '用户类型:1非系统用户 2系统用户 3待离职 4离职 ', + `userstatus` tinyint(2) NOT NULL DEFAULT 1 COMMENT '员工状态:1试用 2正式', + `mobile` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '手机号', + `sex` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '性别', + `age` int(3) NOT NULL DEFAULT 0 COMMENT '年龄', + `job_num` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '工号', + `idtype` tinyint(2) NOT NULL DEFAULT 0 COMMENT '证件类型', + `idnum` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '证件号码', + `birth_time` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '出生日期', + `nation` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '民族', + `internship` tinyint(2) NOT NULL DEFAULT 0 COMMENT '试用期(月)', + `done_time` int(11) NOT NULL DEFAULT 0 COMMENT '转正时间', + `parroll_id` int(11) NOT NULL DEFAULT 0 COMMENT '工资信息表ID', + `create_time` int(11) NOT NULL COMMENT '添加时间', + `update_time` int(11) NOT NULL DEFAULT 0 COMMENT '编辑时间', + `email` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '邮箱', + `political` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '政治面貌', + `location` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '户籍地址', + `leave_time` int(11) NOT NULL DEFAULT 0 COMMENT '离职时间', + PRIMARY KEY (`userdet_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '员工档案表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_hrm_user_det +-- ---------------------------- +INSERT INTO `5kcrm_hrm_user_det` VALUES (1, 1, 1621234018, 1, 1, 2, '18888888888', '', 0, '', 0, '', '', '0', 0, 0, 0, 1621234018, 1621234018, '', '', '', 0); diff --git a/public/sql/5kcrm3.sql b/public/sql/5kcrm3.sql new file mode 100644 index 0000000..9a0b478 --- /dev/null +++ b/public/sql/5kcrm3.sql @@ -0,0 +1,471 @@ +/* + Navicat Premium Data Transfer + + Source Server : localhost + Source Server Type : MySQL + Source Server Version : 50726 + Source Host : localhost:3306 + Source Schema : multi_field + + Target Server Type : MySQL + Target Server Version : 50726 + File Encoding : 65001 + + Date: 23/06/2021 17:58:30 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + + +-- ---------------------------- +-- Table structure for 5kcrm_admin_scene_default +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_scene_default`; +CREATE TABLE `5kcrm_admin_scene_default` ( + `default_id` int(11) NOT NULL AUTO_INCREMENT, + `types` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '类型', + `user_id` int(11) NOT NULL COMMENT '人员ID', + `scene_id` int(11) NOT NULL COMMENT '场景ID', + UNIQUE INDEX `default_id`(`default_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '场景默认关系表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_scene_default +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_admin_sort +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_sort`; +CREATE TABLE `5kcrm_admin_sort` ( + `sort_id` int(11) NOT NULL AUTO_INCREMENT, + `user_id` int(11) NOT NULL, + `value` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '排序内容', + PRIMARY KEY (`sort_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '顶部导航栏' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_sort +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_admin_structure +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_structure`; +CREATE TABLE `5kcrm_admin_structure` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', + `pid` int(11) NULL DEFAULT 0, + `owner_user_id` int(5) UNSIGNED NULL DEFAULT 0 COMMENT '当前部门负责人', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '部门表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_structure +-- ---------------------------- +INSERT INTO `5kcrm_admin_structure` VALUES (1, '办公室', 0, 0); + +-- ---------------------------- +-- Table structure for 5kcrm_admin_system +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_system`; +CREATE TABLE `5kcrm_admin_system` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `value` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', + `description` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_system +-- ---------------------------- +INSERT INTO `5kcrm_admin_system` VALUES (1, 'name', '悟空CRM', '网站名称'); +INSERT INTO `5kcrm_admin_system` VALUES (2, 'logo', '', '企业logo'); + +-- ---------------------------- +-- Table structure for 5kcrm_admin_system_log +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_system_log`; +CREATE TABLE `5kcrm_admin_system_log` ( + `log_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `target_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '被操作对象的名称', + `user_id` int(10) UNSIGNED NOT NULL COMMENT '用户ID', + `client_ip` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户IP', + `module_name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '模块名', + `controller_name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '控制器', + `action_name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '方法', + `action_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '操作ID', + `action_delete` tinyint(1) NOT NULL DEFAULT 0 COMMENT '1为删除操作', + `content` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '内容', + `create_time` int(10) NOT NULL COMMENT '时间', + PRIMARY KEY (`log_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '系统操作日志表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_system_log +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_admin_upgrade_record +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_upgrade_record`; +CREATE TABLE `5kcrm_admin_upgrade_record` ( + `version` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '版本号', + UNIQUE INDEX `version`(`version`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '升级记录,用于防止重复执行升级SQL。' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_upgrade_record +-- ---------------------------- +INSERT INTO `5kcrm_admin_upgrade_record` VALUES (1103); +INSERT INTO `5kcrm_admin_upgrade_record` VALUES (1104); + +-- ---------------------------- +-- Table structure for 5kcrm_admin_user +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_user`; +CREATE TABLE `5kcrm_admin_user` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', + `username` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '管理后台账号', + `password` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '管理后台密码', + `salt` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '安全符', + `img` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '头像', + `thumb_img` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '头像缩略图', + `create_time` int(11) NOT NULL, + `realname` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '真实姓名', + `num` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '员工编号', + `email` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '邮箱', + `mobile` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '手机号码', + `sex` varchar(5) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '男、女', + `structure_id` int(11) NOT NULL DEFAULT 0 COMMENT '部门', + `post` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '岗位', + `status` tinyint(3) NOT NULL DEFAULT 2 COMMENT '状态,0禁用,1启用,2未激活', + `parent_id` int(10) NOT NULL DEFAULT 0 COMMENT '直属上级ID', + `authkey` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '验证信息', + `authkey_time` int(11) NOT NULL DEFAULT 0 COMMENT '验证失效时间', + `type` tinyint(2) NOT NULL COMMENT '1系统用户 0非系统用户', + `is_read_notice` tinyint(1) NOT NULL DEFAULT 0 COMMENT '用户是否已读升级公告:1已读;0未读', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户表' ROW_FORMAT = DYNAMIC; + + +-- ---------------------------- +-- Table structure for 5kcrm_admin_user_field +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_user_field`; +CREATE TABLE `5kcrm_admin_user_field` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `user_id` int(11) NOT NULL, + `types` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '分类', + `datas` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '属性值', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `update_time` int(11) NOT NULL COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '自定义字段展示排序关系表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_user_field +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_admin_user_threeparty +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_admin_user_threeparty`; +CREATE TABLE `5kcrm_admin_user_threeparty` ( + `id` int(10) NOT NULL AUTO_INCREMENT COMMENT '主键', + `user_id` int(10) NOT NULL COMMENT '用户ID', + `key` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '关联模块', + `value` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '关联内容', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '关联第三方' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_admin_user_threeparty +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_achievement +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_achievement`; +CREATE TABLE `5kcrm_crm_achievement` ( + `achievement_id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '名字', + `obj_id` int(11) NOT NULL DEFAULT 0 COMMENT '对象ID', + `type` tinyint(2) NOT NULL DEFAULT 0 COMMENT '1公司2部门3员工', + `year` int(8) NOT NULL COMMENT '年', + `january` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '一月', + `february` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '二月', + `march` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '三月', + `april` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '四月', + `may` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '五月', + `june` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '六月', + `july` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '七月', + `august` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '八月', + `september` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '九月', + `october` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '十月', + `november` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '十一月', + `december` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '十二月', + `status` tinyint(2) NOT NULL DEFAULT 0 COMMENT '1销售(目标)2回款(目标)', + `yeartarget` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '年目标', + PRIMARY KEY (`achievement_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_achievement +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_activity +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_activity`; +CREATE TABLE `5kcrm_crm_activity` ( + `activity_id` int(11) NOT NULL AUTO_INCREMENT, + `types` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '关联类型', + `activity_type_id` int(11) NOT NULL COMMENT '类型ID', + `type` int(1) NULL DEFAULT 1 COMMENT '活动类型 1 跟进记录 2 创建记录 3 商机阶段变更 4 外勤签到', + `status` int(2) NULL DEFAULT 1 COMMENT '0 删除 1 未删除', + `lng` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '经度', + `lat` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '纬度', + `address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '签到地址', + `customer_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '关联客户', + `contract_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '关联合同', + `leads_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '关联线索', + `activity_type` int(1) NOT NULL COMMENT '活动类型 1 线索 2 客户 3 联系人 4 产品 5 商机 6 合同 7回款 8日志 9审批 10日程 11任务 12 发邮件', + `content` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '跟进内容', + `category` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '跟进类型', + `next_time` int(11) NULL DEFAULT 0 COMMENT '下次联系时间', + `business_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '商机ID', + `contacts_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '联系人ID', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `update_time` int(11) NOT NULL COMMENT '更新时间', + `create_user_id` int(11) NOT NULL COMMENT '创建人ID', + UNIQUE INDEX `activity_id`(`activity_id`) USING BTREE, + INDEX `create_time`(`create_time`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '跟进记录' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_activity +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_activity_file +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_activity_file`; +CREATE TABLE `5kcrm_crm_activity_file` ( + `r_id` int(11) NOT NULL AUTO_INCREMENT, + `activity_id` int(11) NOT NULL COMMENT '活动ID', + `file_id` int(11) NOT NULL COMMENT '附件ID', + PRIMARY KEY (`r_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '跟进记录附件关系表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_activity_file +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_business +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_business`; +CREATE TABLE `5kcrm_crm_business` ( + `business_id` int(11) NOT NULL AUTO_INCREMENT, + `customer_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户名称', + `type_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '商机状态组', + `status_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '商机阶段', + `status_time` int(11) NOT NULL DEFAULT 0 COMMENT '阶段推进时间', + `is_end` tinyint(4) NOT NULL DEFAULT 0 COMMENT '1赢单2输单3无效', + `next_time` int(11) NOT NULL DEFAULT 0 COMMENT '下次联系时间', + `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '商机名称', + `money` decimal(18, 2) NULL DEFAULT 0.00 COMMENT '商机金额', + `total_price` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '产品总金额', + `deal_date` date NULL DEFAULT NULL COMMENT '预计成交日期', + `discount_rate` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '整单折扣', + `remark` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '备注', + `create_user_id` int(10) NOT NULL COMMENT '创建人ID', + `owner_user_id` int(10) NOT NULL COMMENT '负责人ID', + `ro_user_id` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '只读权限', + `rw_user_id` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '读写权限', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `update_time` int(11) NOT NULL COMMENT '更新时间', + `is_dealt` tinyint(1) NOT NULL DEFAULT 1 COMMENT '是否已经处理(待办事项):1已处理;0未处理;', + `expire_remind` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否提醒合同到期:1提醒;0提醒', + `last_time` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '最后跟进时间', + `last_record` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '最后跟进记录', + `contacts_id` int(10) NULL DEFAULT NULL, + PRIMARY KEY (`business_id`) USING BTREE, + INDEX `bi_analysis`(`create_time`, `is_end`, `owner_user_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商机表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_business +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_business_data +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_business_data`; +CREATE TABLE `5kcrm_crm_business_data` ( + `business_id` int(10) UNSIGNED NOT NULL COMMENT '商机表ID', + `field` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段名', + `content` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '字段内容', + `create_time` int(10) UNSIGNED NOT NULL COMMENT '创建时间' +) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商机表扩展字段数据' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of 5kcrm_crm_business_data +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_business_file +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_business_file`; +CREATE TABLE `5kcrm_crm_business_file` ( + `r_id` int(11) NOT NULL AUTO_INCREMENT, + `business_id` int(11) NOT NULL COMMENT '商机ID', + `file_id` int(11) NOT NULL COMMENT '附件ID', + PRIMARY KEY (`r_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商机附件关系表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_business_file +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_business_log +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_business_log`; +CREATE TABLE `5kcrm_crm_business_log` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `business_id` int(11) NOT NULL COMMENT '商机id', + `status_id` int(11) NOT NULL COMMENT '状态id', + `is_end` tinyint(4) NOT NULL COMMENT '1赢单2输单3无效', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `owner_user_id` int(11) NOT NULL COMMENT '负责人', + `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '备注', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商机推进日志' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_business_log +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_business_product +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_business_product`; +CREATE TABLE `5kcrm_crm_business_product` ( + `r_id` int(11) NOT NULL AUTO_INCREMENT, + `business_id` int(11) NOT NULL COMMENT '商机ID', + `product_id` int(11) NOT NULL COMMENT '产品ID', + `price` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '产品单价', + `sales_price` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '销售价格', + `num` decimal(12, 2) NOT NULL DEFAULT 0.00 COMMENT '数量', + `discount` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '折扣', + `subtotal` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '小计(折扣后价格)', + `unit` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '单位', + PRIMARY KEY (`r_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商机产品关系表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_business_product +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_business_status +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_business_status`; +CREATE TABLE `5kcrm_crm_business_status` ( + `status_id` int(11) NOT NULL AUTO_INCREMENT, + `type_id` int(11) NOT NULL COMMENT '商机状态类别ID', + `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '标识', + `rate` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '赢单率', + `order_id` tinyint(4) NOT NULL DEFAULT 0 COMMENT '排序', + PRIMARY KEY (`status_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商机状态' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_business_status +-- ---------------------------- +INSERT INTO `5kcrm_crm_business_status` VALUES (1, 0, '赢单', '100', 99); +INSERT INTO `5kcrm_crm_business_status` VALUES (2, 0, '输单', '0', 100); +INSERT INTO `5kcrm_crm_business_status` VALUES (3, 0, '无效', '0', 101); +INSERT INTO `5kcrm_crm_business_status` VALUES (4, 1, '验证客户', '20', 1); +INSERT INTO `5kcrm_crm_business_status` VALUES (5, 1, '需求分析', '15', 2); +INSERT INTO `5kcrm_crm_business_status` VALUES (6, 1, '方案/报价', '30', 3); +INSERT INTO `5kcrm_crm_business_status` VALUES (7, 1, '谈判审核', '30', 4); + +-- ---------------------------- +-- Table structure for 5kcrm_crm_business_type +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_business_type`; +CREATE TABLE `5kcrm_crm_business_type` ( + `type_id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '标识', + `structure_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '部门ID', + `create_user_id` int(11) NOT NULL COMMENT '创建人ID', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `update_time` int(11) NOT NULL COMMENT '更新时间', + `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '1启用0禁用', + `is_display` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '软删除:1显示0不显示', + PRIMARY KEY (`type_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商机状态组类别' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_business_type +-- ---------------------------- +INSERT INTO `5kcrm_crm_business_type` VALUES (1, '系统默认', '', 1, 1540973371, 1540973371, 1, 1); + +-- ---------------------------- +-- Table structure for 5kcrm_crm_config +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_config`; +CREATE TABLE `5kcrm_crm_config` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '标识', + `value` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '值', + `description` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '描述', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = 'CRM管理相关配置' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_config +-- ---------------------------- +INSERT INTO `5kcrm_crm_config` VALUES (1, 'follow_day', '7', '距跟进天数'); +INSERT INTO `5kcrm_crm_config` VALUES (2, 'deal_day', '30', '距成交天数'); +INSERT INTO `5kcrm_crm_config` VALUES (3, 'config', '0', '1启用规则'); +INSERT INTO `5kcrm_crm_config` VALUES (4, 'contract_day', '15', '合同到期提醒天数'); +INSERT INTO `5kcrm_crm_config` VALUES (5, 'record_type', '[\"\\u6253\\u7535\\u8bdd\",\"\\u53d1\\u90ae\\u4ef6\",\"\\u53d1\\u77ed\\u4fe1\",\"\\u89c1\\u9762\\u62dc\\u8bbf\",\"\\u6d3b\\u52a8\"]', '跟进记录类型'); +INSERT INTO `5kcrm_crm_config` VALUES (6, 'contract_config', '1', '1开启'); +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:\"客户意向度较强,成交几率较大\";}', '跟进记录常用语'); +INSERT INTO `5kcrm_crm_config` VALUES (10, 'visit_config', '1', '是否开启回访提醒:1开启;0不开启'); +INSERT INTO `5kcrm_crm_config` VALUES (11, 'visit_day', '10', '客户回访提醒天数'); + +-- ---------------------------- +-- Table structure for 5kcrm_crm_contacts +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_contacts`; +CREATE TABLE `5kcrm_crm_contacts` ( + `contacts_id` int(11) NOT NULL AUTO_INCREMENT, + `customer_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户名称', + `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '姓名', + `mobile` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '手机', + `telephone` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '电话', + `email` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '电子邮箱', + `decision` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否关键决策人', + `post` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '职务', + `sex` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '性别', + `detail_address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '地址', + `remark` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '备注', + `ro_user_id` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '只读权限', + `rw_user_id` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '读写权限', + `create_user_id` int(11) NOT NULL COMMENT '创建人ID', + `owner_user_id` int(11) NOT NULL COMMENT '负责人ID', + `next_time` int(11) NULL DEFAULT NULL COMMENT '下次联系时间', + `primary` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否是首要联系人:1是;0不是', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `update_time` int(11) NOT NULL COMMENT '更新时间', + `last_time` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '最后跟进时间', + `last_record` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '最后跟进记录', + PRIMARY KEY (`contacts_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '联系人表' ROW_FORMAT = DYNAMIC; diff --git a/public/sql/5kcrm4.sql b/public/sql/5kcrm4.sql new file mode 100644 index 0000000..f773a60 --- /dev/null +++ b/public/sql/5kcrm4.sql @@ -0,0 +1,498 @@ +/* + Navicat Premium Data Transfer + + Source Server : localhost + Source Server Type : MySQL + Source Server Version : 50726 + Source Host : localhost:3306 + Source Schema : multi_field + + Target Server Type : MySQL + Target Server Version : 50726 + File Encoding : 65001 + + Date: 23/06/2021 17:58:30 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Records of 5kcrm_crm_contacts +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_contacts_business +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_contacts_business`; +CREATE TABLE `5kcrm_crm_contacts_business` ( + `id` int(10) NOT NULL AUTO_INCREMENT, + `contacts_id` int(10) NOT NULL, + `business_id` int(10) NOT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_contacts_business +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_contacts_data +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_contacts_data`; +CREATE TABLE `5kcrm_crm_contacts_data` ( + `contacts_id` int(10) UNSIGNED NOT NULL COMMENT '联系人表ID', + `field` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段名', + `content` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '字段内容', + `create_time` int(10) UNSIGNED NOT NULL COMMENT '创建时间' +) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '联系人表扩展字段数据' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of 5kcrm_crm_contacts_data +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_contacts_file +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_contacts_file`; +CREATE TABLE `5kcrm_crm_contacts_file` ( + `r_id` int(11) NOT NULL AUTO_INCREMENT, + `contacts_id` int(11) NOT NULL COMMENT '联系人ID', + `file_id` int(11) NOT NULL COMMENT '附件ID', + PRIMARY KEY (`r_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '联系人附件关系表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_contacts_file +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_contract +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_contract`; +CREATE TABLE `5kcrm_crm_contract` ( + `contract_id` int(11) NOT NULL AUTO_INCREMENT, + `customer_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户名称', + `business_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '商机名称', + `contacts_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户签约人', + `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '合同名称', + `num` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '合同编号', + `order_date` date NULL DEFAULT NULL COMMENT '下单时间', + `money` decimal(18, 2) NULL DEFAULT 0.00 COMMENT '合同金额', + `total_price` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '产品总金额', + `discount_rate` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '整单折扣', + `check_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '0待审核、1审核中、2审核通过、3审核未通过、4撤销、5草稿(未提交)', + `flow_id` int(11) NOT NULL DEFAULT 0 COMMENT '审核流程ID', + `order_id` int(11) NOT NULL DEFAULT 0 COMMENT '审核步骤排序ID', + `check_user_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '审批人IDs', + `flow_user_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '流程审批人ID', + `start_time` date NULL DEFAULT NULL COMMENT '合同开始时间', + `end_time` date NULL DEFAULT NULL COMMENT '合同到期时间', + `order_user_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '公司签约人', + `remark` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '备注', + `create_user_id` int(10) NOT NULL COMMENT '创建人ID', + `owner_user_id` int(10) NOT NULL COMMENT '负责人ID', + `ro_user_id` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '只读权限', + `rw_user_id` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '读写权限', + `next_time` int(11) NOT NULL DEFAULT 0 COMMENT '下次联系时间', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `update_time` int(11) NOT NULL COMMENT '更新时间', + `is_visit` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否已回访:1已回访;2未回访', + `expire_remind` tinyint(1) NOT NULL DEFAULT 1 COMMENT '是否提醒合同到期:1提醒;0提醒', + `last_time` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '最后跟进时间', + `last_record` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '最后跟进记录', + PRIMARY KEY (`contract_id`) USING BTREE, + INDEX `bi_analysis`(`check_status`, `customer_id`, `order_date`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '合同表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_contract +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_contract_data +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_contract_data`; +CREATE TABLE `5kcrm_crm_contract_data` ( + `contract_id` int(10) UNSIGNED NOT NULL COMMENT '合同表ID', + `field` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段名', + `content` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '字段内容', + `create_time` int(10) UNSIGNED NOT NULL COMMENT '创建时间' +) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '合同表扩展字段数据' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of 5kcrm_crm_contract_data +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_contract_file +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_contract_file`; +CREATE TABLE `5kcrm_crm_contract_file` ( + `r_id` int(11) NOT NULL AUTO_INCREMENT, + `contract_id` int(11) NOT NULL COMMENT '合同ID', + `file_id` int(11) NOT NULL COMMENT '附件ID', + PRIMARY KEY (`r_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '合同附件关系表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_contract_file +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_contract_product +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_contract_product`; +CREATE TABLE `5kcrm_crm_contract_product` ( + `r_id` int(11) NOT NULL AUTO_INCREMENT, + `contract_id` int(11) NOT NULL COMMENT '合同ID', + `product_id` int(11) NOT NULL COMMENT '产品ID', + `price` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '产品单价', + `sales_price` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '销售价格', + `num` decimal(12, 2) NOT NULL DEFAULT 0.00 COMMENT '数量', + `discount` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '折扣', + `subtotal` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '小计(折扣后价格)', + `unit` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '单位', + PRIMARY KEY (`r_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '合同产品关系表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_contract_product +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_customer +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_customer`; +CREATE TABLE `5kcrm_crm_customer` ( + `customer_id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户名称', + `is_lock` tinyint(1) NOT NULL DEFAULT 0 COMMENT '1锁定', + `deal_time` int(11) NOT NULL COMMENT '领取,分配,创建时间', + `level` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户级别', + `industry` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户行业', + `source` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户来源', + `telephone` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '电话', + `mobile` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '手机', + `website` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '网址', + `remark` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '备注', + `create_user_id` int(11) NOT NULL COMMENT '创建人ID', + `owner_user_id` int(11) NOT NULL COMMENT '负责人ID', + `ro_user_id` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '只读权限', + `rw_user_id` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '读写权限', + `address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '省市区', + `location` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '定位信息', + `detail_address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '详细地址', + `lng` double(14, 11) NULL DEFAULT NULL COMMENT '地理位置经度', + `lat` double(14, 11) NULL DEFAULT NULL COMMENT '地理位置维度', + `next_time` int(11) NULL DEFAULT NULL COMMENT '下次联系时间', + `follow` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '跟进', + `obtain_time` int(10) NOT NULL DEFAULT 0 COMMENT '负责人获取客户时间', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `update_time` int(11) NOT NULL COMMENT '更新时间', + `is_dealt` tinyint(1) NOT NULL DEFAULT 1 COMMENT '是否已经处理(待办事项):1已处理;0未处理;', + `is_allocation` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否是分配给我的客户:1是;0不是', + `last_time` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '最后跟进时间', + `last_record` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '最后跟进记录', + `email` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '邮箱', + `before_owner_user_id` int(10) UNSIGNED NULL DEFAULT 0 COMMENT '前负责人', + `into_pool_time` int(10) UNSIGNED NULL DEFAULT 0 COMMENT '进入公海时间', + `pool_remain` tinyint(1) NOT NULL DEFAULT 0 COMMENT '代办事项待进入公海:1已处理,0未处理', + `deal_status` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '未成交' COMMENT '成交状态', + PRIMARY KEY (`customer_id`) USING BTREE, + INDEX `bi_analysis`(`create_time`, `owner_user_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '客户表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_customer +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_customer_config +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_customer_config`; +CREATE TABLE `5kcrm_crm_customer_config` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `user_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '员工', + `structure_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '部门', + `types` tinyint(4) NOT NULL DEFAULT 1 COMMENT '1拥有客户上限2锁定客户上限', + `value` int(10) NOT NULL COMMENT '数值', + `is_deal` tinyint(4) NOT NULL COMMENT '1成交客户', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `update_time` int(11) NOT NULL COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '客户配置表(锁定、拥有)' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_customer_config +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_customer_data +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_customer_data`; +CREATE TABLE `5kcrm_crm_customer_data` ( + `customer_id` int(10) UNSIGNED NOT NULL COMMENT '客户表ID', + `field` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段名', + `content` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '字段内容', + `create_time` int(10) UNSIGNED NOT NULL COMMENT '创建时间' +) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '客户表扩展字段数据' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of 5kcrm_crm_customer_data +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_customer_file +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_customer_file`; +CREATE TABLE `5kcrm_crm_customer_file` ( + `r_id` int(11) NOT NULL AUTO_INCREMENT, + `customer_id` int(11) NOT NULL COMMENT '客户ID', + `file_id` int(11) NOT NULL COMMENT '附件ID', + PRIMARY KEY (`r_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '客户附件关系表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_customer_file +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_customer_pool +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_customer_pool`; +CREATE TABLE `5kcrm_crm_customer_pool` ( + `pool_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `pool_name` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '名称', + `admin_user_ids` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '管理员IDS', + `user_ids` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '成员IDS', + `department_ids` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '部门IDS', + `status` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态:1启用,0停用', + `before_owner_conf` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '前负责人领取规则:1限制,0不限制', + `before_owner_day` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '前负责人领取规则限制天数', + `receive_conf` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '领取频率规则:1限制,0不限制', + `receive_count` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '领取频率个数', + `remind_conf` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '提醒规则:1开启,0不开启', + `remain_day` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '提前几天提醒', + `recycle_conf` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '自动回收规则:1自动回收,0不自动回收', + `create_user_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建人', + `create_time` int(10) UNSIGNED NOT NULL COMMENT '创建时间', + PRIMARY KEY (`pool_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '公海表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_customer_pool +-- ---------------------------- +INSERT INTO `5kcrm_crm_customer_pool` VALUES (1, '系统默认公海', ',1,', ',1,2,3,4,', '', 1, 0, 0, 0, 0, 0, 0, 1, 1, 1624437604); + +-- ---------------------------- +-- Table structure for 5kcrm_crm_customer_pool_field_setting +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_customer_pool_field_setting`; +CREATE TABLE `5kcrm_crm_customer_pool_field_setting` ( + `setting_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `pool_id` int(10) UNSIGNED NOT NULL COMMENT '公海ID', + `name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段中文名', + `field_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段英文名', + `form_type` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段类型,与5kcrm_admin_field表的form_type类型一致', + `is_hidden` tinyint(1) UNSIGNED NOT NULL COMMENT '是否隐藏:1隐藏,0不隐藏', + `is_null` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否必填:1必填,0不是必填', + `is_unique` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否唯一:1唯一,0不唯一', + PRIMARY KEY (`setting_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 42 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '公海字段表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_customer_pool_field_setting +-- ---------------------------- +INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (1, 1, '客户名称', 'name', 'text', 0, 1, 1); +INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (2, 1, '客户级别', 'level', 'select', 0, 0, 0); +INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (3, 1, '客户行业', 'industry', 'select', 0, 0, 0); +INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (4, 1, '客户来源', 'source', 'select', 0, 0, 0); +INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (5, 1, '电话', 'telephone', 'text', 0, 0, 0); +INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (6, 1, '网址', 'website', 'text', 0, 0, 0); +INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (7, 1, '下次联系时间', 'next_time', 'datetime', 0, 0, 0); +INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (8, 1, '备注', 'remark', 'textarea', 0, 0, 0); +INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (9, 1, '手机', 'mobile', 'mobile', 0, 0, 0); +INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (10, 1, '邮箱', 'email', 'email', 0, 0, 0); +INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (33, 1, '省、市、区/县', 'address', 'customer_address', 0, 0, 0); +INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (34, 1, '详细地址', 'detail_address', 'text', 0, 0, 0); +INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (35, 1, '最后跟进记录', 'last_record', 'text', 0, 0, 0); +INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (36, 1, '最后跟进时间', 'last_time', 'datetime', 0, 0, 0); +INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (37, 1, '前负责人', 'before_owner_user_id', 'user', 0, 0, 0); +INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (38, 1, '进入公海时间', 'into_pool_time', 'datetime', 0, 0, 0); +INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (39, 1, '创建时间', 'create_time', 'datetime', 0, 0, 0); +INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (40, 1, '更新时间', 'update_time', 'datetime', 0, 0, 0); +INSERT INTO `5kcrm_crm_customer_pool_field_setting` VALUES (41, 1, '创建人', 'create_user_id', 'user', 0, 0, 0); + +-- ---------------------------- +-- Table structure for 5kcrm_crm_customer_pool_field_style +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_customer_pool_field_style`; +CREATE TABLE `5kcrm_crm_customer_pool_field_style` ( + `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `user_id` int(10) UNSIGNED NOT NULL COMMENT '用户ID', + `pool_id` int(10) UNSIGNED NOT NULL COMMENT '公海ID', + `content` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '字段内容', + `create_time` int(10) NOT NULL COMMENT '创建时间', + `update_time` int(10) NOT NULL COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '公海字段样式表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_customer_pool_field_style +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_customer_pool_record +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_customer_pool_record`; +CREATE TABLE `5kcrm_crm_customer_pool_record` ( + `record_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `customer_id` int(10) UNSIGNED NOT NULL COMMENT '客户ID', + `user_id` int(10) UNSIGNED NOT NULL COMMENT '员工ID', + `pool_id` int(10) UNSIGNED NOT NULL COMMENT '公海ID', + `type` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '类型:1领取公海客户;2将客户放入公海', + `create_time` int(10) UNSIGNED NOT NULL COMMENT '创建时间', + PRIMARY KEY (`record_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '公海操作记录(领取公海客户、将客户放入公海)' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_customer_pool_record +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_customer_pool_relation +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_customer_pool_relation`; +CREATE TABLE `5kcrm_crm_customer_pool_relation` ( + `relation_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `pool_id` int(10) UNSIGNED NOT NULL COMMENT '公海ID', + `customer_id` int(10) UNSIGNED NOT NULL COMMENT '客户ID', + PRIMARY KEY (`relation_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '公海与客户关联表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_customer_pool_relation +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_customer_pool_rule +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_customer_pool_rule`; +CREATE TABLE `5kcrm_crm_customer_pool_rule` ( + `rule_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `pool_id` int(10) UNSIGNED NOT NULL COMMENT '公海ID', + `type` tinyint(1) UNSIGNED NOT NULL COMMENT '收回规则类型:1跟进记录;2商机;3成交状态', + `deal_handle` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '选择不进入公海客户(成交客户):1已选,0未选', + `business_handle` tinyint(1) UNSIGNED NOT NULL COMMENT '选择不进入公海客户(有商机客户):1已选,0不选', + `level_conf` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '客户级别设置:1全部,2根据客户级别设置', + `level` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '客户级别的设置数据', + `limit_day` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '公海规则限制天数', + PRIMARY KEY (`rule_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '公海规则表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_customer_pool_rule +-- ---------------------------- +INSERT INTO `5kcrm_crm_customer_pool_rule` VALUES (1, 1, 1, 0, 0, 1, '[{\"level\":\"\\u6240\\u6709\\u5ba2\\u6237\",\"limit_day\":30}]', 0); + +-- ---------------------------- +-- Table structure for 5kcrm_crm_dashboard +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_dashboard`; +CREATE TABLE `5kcrm_crm_dashboard` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `dashboard` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `user_id` int(4) NOT NULL COMMENT '创建人 、修改人', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '仪表盘样式' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_dashboard +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_dealt_relation +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_dealt_relation`; +CREATE TABLE `5kcrm_crm_dealt_relation` ( + `dealt_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `types` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '类型:crm_contract;crm_invoice;crm_receivables', + `types_id` int(10) UNSIGNED NOT NULL COMMENT '类型ID', + `user_id` int(10) UNSIGNED NOT NULL COMMENT '用户ID', + PRIMARY KEY (`dealt_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '待办事项关联表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_dealt_relation +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_invoice +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_invoice`; +CREATE TABLE `5kcrm_crm_invoice` ( + `invoice_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `invoice_apple_number` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '发票申请编号', + `customer_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户名称', + `contract_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '合同编号', + `invoice_money` decimal(18, 2) NULL DEFAULT 0.00 COMMENT '开票金额', + `invoice_date` date NULL DEFAULT NULL COMMENT '开票日期', + `invoice_type` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '开票类型', + `remark` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '备注', + `title_type` tinyint(1) NOT NULL COMMENT '抬头类型:1企业;2个人', + `invoice_title` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '开票抬头', + `tax_number` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '纳税人识别号', + `deposit_account` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '开户账号', + `deposit_address` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '开票地址', + `phone` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '电话', + `contacts_name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '联系人', + `contacts_mobile` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '联系方式', + `contacts_address` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '联系地址', + `real_invoice_date` date NULL DEFAULT NULL COMMENT '实际开票日期', + `invoice_number` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '发票号码', + `logistics_number` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '物流单号', + `create_user_id` int(10) UNSIGNED NOT NULL COMMENT '创建人ID', + `owner_user_id` int(10) NOT NULL COMMENT '负责人ID', + `check_status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0待审核;1审核中;2审核通过;3审核未通过;4撤回', + `flow_id` int(10) NULL DEFAULT 0 COMMENT '审核流程ID', + `order_id` int(10) NULL DEFAULT 0 COMMENT '审核步骤排序ID', + `check_user_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '审批人IDs', + `flow_user_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '流程审批人ID', + `invoice_status` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '发票状态:0未开票;1已开票', + `update_time` int(10) NOT NULL COMMENT '修改日期', + `create_time` int(10) NOT NULL COMMENT '创建日期', + `deposit_bank` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '开户行', + `contract_money` decimal(18, 2) NULL DEFAULT 0.00 COMMENT '合同金额', + PRIMARY KEY (`invoice_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_invoice +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_invoice_data +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_invoice_data`; +CREATE TABLE `5kcrm_crm_invoice_data` ( + `invoice_id` int(10) UNSIGNED NOT NULL COMMENT '发票表ID', + `field` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段名', + `content` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '字段内容', + `create_time` int(10) UNSIGNED NOT NULL COMMENT '创建时间' +) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '发票表扩展字段数据' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of 5kcrm_crm_invoice_data +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_invoice_file +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_invoice_file`; +CREATE TABLE `5kcrm_crm_invoice_file` ( + `r_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `invoice_id` int(10) UNSIGNED NOT NULL COMMENT '发票ID', + `file_id` int(10) NOT NULL COMMENT '附件ID', + PRIMARY KEY (`r_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '发票附件关联表' ROW_FORMAT = DYNAMIC; diff --git a/public/sql/5kcrm5.sql b/public/sql/5kcrm5.sql new file mode 100644 index 0000000..4395e63 --- /dev/null +++ b/public/sql/5kcrm5.sql @@ -0,0 +1,1127 @@ +/* + Navicat Premium Data Transfer + + Source Server : localhost + Source Server Type : MySQL + Source Server Version : 50726 + Source Host : localhost:3306 + Source Schema : multi_field + + Target Server Type : MySQL + Target Server Version : 50726 + File Encoding : 65001 + + Date: 23/06/2021 17:58:30 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Records of 5kcrm_crm_invoice_file +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_invoice_info +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_invoice_info`; +CREATE TABLE `5kcrm_crm_invoice_info` ( + `info_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `customer_id` int(10) NOT NULL COMMENT '客户ID', + `title_type` tinyint(1) NULL DEFAULT NULL COMMENT '抬头类型:1企业;2个人', + `invoice_title` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '开票抬头', + `tax_number` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '纳税人识别号', + `deposit_bank` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '开户行', + `deposit_account` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '开户账号', + `deposit_address` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '开票地址', + `phone` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '电话', + `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', + `create_user_id` int(10) NOT NULL COMMENT '创建人ID', + `create_time` int(10) NOT NULL COMMENT '创建时间', + `update_time` int(10) NOT NULL COMMENT '编辑时间', + PRIMARY KEY (`info_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '发票开户行信息' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_invoice_info +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_leads +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_leads`; +CREATE TABLE `5kcrm_crm_leads` ( + `leads_id` int(11) NOT NULL AUTO_INCREMENT, + `customer_id` int(11) NOT NULL DEFAULT 0 COMMENT '线索转化为客户ID', + `is_transform` tinyint(1) NOT NULL DEFAULT 0 COMMENT '1已转化', + `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '线索名称', + `source` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '线索来源', + `telephone` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '电话', + `mobile` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '手机', + `industry` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户行业', + `level` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户级别', + `detail_address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '地址', + `email` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '电子邮箱', + `remark` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '备注', + `create_user_id` int(10) NOT NULL COMMENT '创建人ID', + `owner_user_id` int(10) NOT NULL COMMENT '负责人ID', + `next_time` int(11) NULL DEFAULT NULL COMMENT '下次联系时间', + `follow` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '跟进', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `update_time` int(11) NOT NULL COMMENT '更新时间', + `is_dealt` tinyint(1) NOT NULL DEFAULT 1 COMMENT '是否已经处理(待办事项):1已处理;0未处理;', + `is_allocation` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否是分配给我的线索:1是;0不是', + `last_time` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '最后跟进时间', + `last_record` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '最后跟进记录', + `ro_user_id` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '只读权限', + `rw_user_id` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '读写权限', + PRIMARY KEY (`leads_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '线索表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_leads +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_leads_data +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_leads_data`; +CREATE TABLE `5kcrm_crm_leads_data` ( + `leads_id` int(10) UNSIGNED NOT NULL COMMENT '线索表ID', + `field` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段名', + `content` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '字段内容', + `create_time` int(10) UNSIGNED NOT NULL COMMENT '创建时间' +) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '线索表扩展字段数据' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of 5kcrm_crm_leads_data +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_leads_file +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_leads_file`; +CREATE TABLE `5kcrm_crm_leads_file` ( + `r_id` int(11) NOT NULL AUTO_INCREMENT, + `leads_id` int(11) NOT NULL COMMENT '线索ID', + `file_id` int(11) NOT NULL COMMENT '附件ID', + PRIMARY KEY (`r_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '线索附件关系表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_leads_file +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_market +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_market`; +CREATE TABLE `5kcrm_crm_market` ( + `market_id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '活动名称', + `admin_market_id` int(11) NOT NULL COMMENT '关联对象 自定义字段', + `main_user_id` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '参与人', + `market_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '活动类型', + `start_time` int(11) NOT NULL COMMENT '开始时间', + `end_time` int(11) NOT NULL COMMENT '截止时间', + `browse_number` int(11) NULL DEFAULT NULL COMMENT '浏览数', + `submit_number` int(11) NULL DEFAULT NULL COMMENT '提交数', + `budget_money` decimal(10, 0) NULL DEFAULT NULL COMMENT '活动预算', + `address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '活动地址', + `profiles` varchar(800) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '简介', + `cover_images` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '活动图片', + `details_images` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '活动详情图片', + `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '状态 0停用', + `create_user_id` int(11) NOT NULL COMMENT '创建人', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `update_time` int(11) NOT NULL COMMENT '更新时间', + `market_field_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '表单自定义字段id', + `second` tinyint(2) NULL DEFAULT 1 COMMENT '用户提交次数', + PRIMARY KEY (`market_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_market +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_market_field +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_market_field`; +CREATE TABLE `5kcrm_crm_market_field` ( + `field_id` int(11) NOT NULL AUTO_INCREMENT, + `admin_market_id` int(30) NOT NULL COMMENT '分类', + `field` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段名', + `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '标识名', + `form_type` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段类型', + `default_value` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '默认值', + `max_length` int(4) NOT NULL DEFAULT 0 COMMENT ' 字数上限', + `is_unique` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否唯一(1是,0否)', + `is_null` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否必填(1是,0否)', + `input_tips` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '输入提示', + `setting` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '设置', + `order_id` int(4) NOT NULL DEFAULT 0 COMMENT '排序ID', + `operating` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0改删,1改,2删,3无', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `update_time` int(11) NOT NULL COMMENT '更新时间', + `relevant` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '相关字段名', + `is_hidden` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否隐藏:1隐藏;0不隐藏', + PRIMARY KEY (`field_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '自定义字段表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_market_field +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_market_form +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_market_form`; +CREATE TABLE `5kcrm_crm_market_form` ( + `r_id` int(11) NOT NULL AUTO_INCREMENT, + `market_id` int(11) NOT NULL COMMENT '活动关联', + `synchro_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '同步状态 0未同步 1同步成功 2同步失败', + `market_form` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '表单数据', + `user_id` int(11) NULL DEFAULT NULL COMMENT '提交人', + PRIMARY KEY (`r_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '活动表单提交数据' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_market_form +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_number_sequence +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_number_sequence`; +CREATE TABLE `5kcrm_crm_number_sequence` ( + `number_sequence_id` int(10) NOT NULL AUTO_INCREMENT, + `sort` int(2) NOT NULL COMMENT '编号顺序', + `type` int(2) NOT NULL COMMENT '编号类型 1文本 2日期 3数字', + `value` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '文本内容或日期格式或起始编号', + `increase_number` int(2) NULL DEFAULT NULL COMMENT '递增数', + `reset` int(10) NULL DEFAULT 0 COMMENT '重置编号 0 从不,1 天,2 月, 3 年,', + `last_number` int(10) NULL DEFAULT NULL COMMENT '上次生成的编号', + `last_date` int(11) NULL DEFAULT NULL COMMENT '上次生成的时间', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `create_user_id` bigint(20) NULL DEFAULT NULL COMMENT '创建人id', + `company_id` bigint(20) NULL DEFAULT NULL COMMENT '公司id', + `status` int(2) NOT NULL DEFAULT 0 COMMENT '默认开启使用自动编号 1不使用', + `number_type` int(11) NULL DEFAULT NULL COMMENT '编号规则类型', + PRIMARY KEY (`number_sequence_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '编号规则' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_number_sequence +-- ---------------------------- +INSERT INTO `5kcrm_crm_number_sequence` VALUES (1, 1, 1, 'HT', NULL, NULL, NULL, NULL, 1624437606, 1, NULL, 0, 1); +INSERT INTO `5kcrm_crm_number_sequence` VALUES (2, 2, 2, 'yyyyMMdd', NULL, NULL, NULL, NULL, 1624437606, 1, NULL, 0, 1); +INSERT INTO `5kcrm_crm_number_sequence` VALUES (3, 3, 3, '1', 1, 1, 1, 1624437606, 1624437606, 1, NULL, 0, 1); +INSERT INTO `5kcrm_crm_number_sequence` VALUES (4, 1, 1, 'HK', NULL, NULL, NULL, NULL, 1624437606, 1, NULL, 0, 2); +INSERT INTO `5kcrm_crm_number_sequence` VALUES (5, 2, 2, 'yyyyMMdd', NULL, NULL, NULL, NULL, 1624437606, 1, NULL, 0, 2); +INSERT INTO `5kcrm_crm_number_sequence` VALUES (6, 3, 3, '1', 1, 1, 1, 1624437606, 1624437606, 1, NULL, 0, 2); +INSERT INTO `5kcrm_crm_number_sequence` VALUES (7, 1, 1, 'HF', NULL, NULL, NULL, NULL, 1624437606, 1, NULL, 0, 3); +INSERT INTO `5kcrm_crm_number_sequence` VALUES (8, 2, 2, 'yyyyMMdd', NULL, NULL, NULL, NULL, 1624437606, 1, NULL, 0, 3); +INSERT INTO `5kcrm_crm_number_sequence` VALUES (9, 3, 3, '1', 1, 1, 1, 1624437606, 1624437606, 1, NULL, 0, 3); +INSERT INTO `5kcrm_crm_number_sequence` VALUES (10, 1, 2, 'yyyyMMdd', NULL, NULL, NULL, NULL, 1624437606, 1, NULL, 0, 4); +INSERT INTO `5kcrm_crm_number_sequence` VALUES (11, 2, 1, 'FP', NULL, NULL, NULL, NULL, 1624437606, 1, NULL, 0, 4); +INSERT INTO `5kcrm_crm_number_sequence` VALUES (12, 3, 3, '1', 1, 1, 1, 1624437606, 1624437606, 1, NULL, 0, 4); + +-- ---------------------------- +-- Table structure for 5kcrm_crm_printing_record +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_printing_record`; +CREATE TABLE `5kcrm_crm_printing_record` ( + `printing_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `user_id` int(10) UNSIGNED NOT NULL COMMENT '用户ID', + `type` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '模块:1商机、2合同;3回款', + `action_id` int(10) UNSIGNED NOT NULL COMMENT '操作ID', + `template_id` int(10) UNSIGNED NOT NULL COMMENT '模板ID', + `content` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '打印内容', + `create_time` int(10) UNSIGNED NOT NULL COMMENT '创建时间', + `update_time` int(10) UNSIGNED NOT NULL COMMENT '编辑时间', + PRIMARY KEY (`printing_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '打印记录' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_printing_record +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_product +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_product`; +CREATE TABLE `5kcrm_crm_product` ( + `product_id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品名称', + `num` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品编码', + `unit` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '单位', + `price` decimal(18, 2) NULL DEFAULT 0.00 COMMENT '标准价格', + `status` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '上架' COMMENT '是否上架', + `category_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品类别', + `category_str` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '产品分类id(层级)', + `description` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品描述', + `create_user_id` int(10) NOT NULL COMMENT '创建人ID', + `owner_user_id` int(10) NOT NULL COMMENT '负责人ID', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `update_time` int(11) NOT NULL COMMENT '更新时间', + `delete_user_id` int(10) NOT NULL DEFAULT 0 COMMENT '删除人', + `delete_time` int(10) NULL DEFAULT NULL COMMENT '删除时间', + `cover_images` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '角色组ID', + `details_images` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '封面图片', + PRIMARY KEY (`product_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '产品表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_product +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_product_category +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_product_category`; +CREATE TABLE `5kcrm_crm_product_category` ( + `category_id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', + `pid` int(11) NULL DEFAULT 0, + PRIMARY KEY (`category_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '产品分类表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_product_category +-- ---------------------------- +INSERT INTO `5kcrm_crm_product_category` VALUES (1, '默认', 0); + +-- ---------------------------- +-- Table structure for 5kcrm_crm_product_data +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_product_data`; +CREATE TABLE `5kcrm_crm_product_data` ( + `product_id` int(10) UNSIGNED NOT NULL COMMENT '产品表ID', + `field` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段名', + `content` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '字段内容', + `create_time` int(10) UNSIGNED NOT NULL COMMENT '创建时间' +) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '产品表扩展字段数据' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of 5kcrm_crm_product_data +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_product_file +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_product_file`; +CREATE TABLE `5kcrm_crm_product_file` ( + `r_id` int(11) NOT NULL AUTO_INCREMENT, + `product_id` int(11) NOT NULL COMMENT '产品ID', + `file_id` int(11) NOT NULL COMMENT '附件ID', + PRIMARY KEY (`r_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '产品附件关系表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_product_file +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_receivables +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_receivables`; +CREATE TABLE `5kcrm_crm_receivables` ( + `receivables_id` int(11) NOT NULL AUTO_INCREMENT, + `plan_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '期数', + `number` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '回款编号', + `customer_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户名称', + `contract_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '合同编号', + `return_time` date NULL DEFAULT NULL COMMENT '回款日期', + `return_type` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '回款方式', + `money` decimal(18, 2) NULL DEFAULT 0.00 COMMENT '回款金额', + `check_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '0待审核、1审核中、2审核通过、3审核未通过、4撤销、5草稿(未提交)', + `flow_id` int(11) NOT NULL DEFAULT 0 COMMENT '审核流程ID', + `order_id` int(11) NOT NULL DEFAULT 0 COMMENT '审核步骤排序ID', + `check_user_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '审批人IDs', + `flow_user_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '流程审批人ID', + `remark` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '备注', + `create_user_id` int(10) NOT NULL COMMENT '创建人ID', + `owner_user_id` int(10) NOT NULL COMMENT '负责人ID', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `update_time` int(11) NOT NULL COMMENT '更新时间', + `ro_user_id` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '只读权限', + `rw_user_id` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '读写权限', + PRIMARY KEY (`receivables_id`) USING BTREE, + INDEX `bi_analysis`(`check_status`, `return_time`, `owner_user_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '回款表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_receivables +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_receivables_data +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_receivables_data`; +CREATE TABLE `5kcrm_crm_receivables_data` ( + `receivables_id` int(10) UNSIGNED NOT NULL COMMENT '回款表ID', + `field` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段名', + `content` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '字段内容', + `create_time` int(10) UNSIGNED NOT NULL COMMENT '创建时间' +) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '回款表扩展字段数据' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of 5kcrm_crm_receivables_data +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_receivables_file +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_receivables_file`; +CREATE TABLE `5kcrm_crm_receivables_file` ( + `r_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `receivables_id` int(10) UNSIGNED NOT NULL, + `file_id` int(10) UNSIGNED NOT NULL, + PRIMARY KEY (`r_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '回款附件表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_receivables_file +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_receivables_plan +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_receivables_plan`; +CREATE TABLE `5kcrm_crm_receivables_plan` ( + `plan_id` int(11) NOT NULL AUTO_INCREMENT, + `num` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '期数', + `receivables_id` int(11) NOT NULL DEFAULT 0 COMMENT '回款ID', + `status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '1完成', + `contract_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '合同编号', + `customer_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户名称', + `money` decimal(18, 2) NULL DEFAULT 0.00 COMMENT '计划回款金额', + `return_date` date NULL DEFAULT NULL COMMENT '计划回款日期', + `return_type` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '计划回款方式', + `remind` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '提前几日提醒', + `remind_date` date NULL DEFAULT NULL COMMENT '提醒日期', + `remark` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '备注', + `create_user_id` int(11) NOT NULL COMMENT '创建人ID', + `owner_user_id` int(11) NOT NULL COMMENT '负责人ID', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `update_time` int(11) NOT NULL COMMENT '更新时间', + `file` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '附件', + `is_dealt` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否已经处理(待办事项):1已处理;0未处理;', + `real_money` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '实际回款金额', + `real_data` date DEFAULT NULL COMMENT '实际回款日期', + `un_money` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '未回金额', + PRIMARY KEY (`plan_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '回款计划表' ROW_FORMAT = DYNAMIC; + + +-- ---------------------------- +-- Records of 5kcrm_crm_receivables_plan +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_receivables_plan_data +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_receivables_plan_data`; +CREATE TABLE `5kcrm_crm_receivables_plan_data` ( + `plan_id` int(10) UNSIGNED NOT NULL COMMENT '发票表ID', + `field` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段名', + `content` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '字段内容', + `create_time` int(10) UNSIGNED NOT NULL COMMENT '创建时间' +) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '回款计划表扩展字段数据' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of 5kcrm_crm_receivables_plan_data +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_star +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_star`; +CREATE TABLE `5kcrm_crm_star` ( + `star_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `user_id` int(10) UNSIGNED NOT NULL COMMENT '员工ID', + `target_id` int(10) NOT NULL COMMENT '目标ID:客户、商机、线索、联系人', + `type` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '类型:crm_leads线索;crm_customer客户;crm_contacts联系人;crm_business商机;', + PRIMARY KEY (`star_id`) USING BTREE, + UNIQUE INDEX `user_target_type`(`user_id`, `target_id`, `type`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '我关注的' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_star +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_team +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_team`; +CREATE TABLE `5kcrm_crm_team` ( + `team_id` int(11) NOT NULL AUTO_INCREMENT, + `types` tinyint(4) NOT NULL COMMENT '模块 1 客户 2联系人 3商机 4合同 5回款 ', + `target_id` int(11) NOT NULL COMMENT '团队成员所属对象id', + `target_time` int(11) NULL DEFAULT NULL COMMENT '截止到期时间', + `team_user_id` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '团队用户id', + `auth` tinyint(2) NOT NULL COMMENT '1 只读权限 2读写权限', + PRIMARY KEY (`team_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '团队成员截止时间' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_team +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_top +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_top`; +CREATE TABLE `5kcrm_crm_top` ( + `top_id` int(10) NOT NULL AUTO_INCREMENT, + `module_id` int(10) NOT NULL COMMENT '相关模块ID', + `set_top` tinyint(1) NOT NULL DEFAULT 1 COMMENT '1置顶', + `top_time` int(10) NOT NULL COMMENT '置顶时间', + `create_role_id` int(10) NOT NULL COMMENT '创建人ID', + `module` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'business' COMMENT '置顶模块', + PRIMARY KEY (`top_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '置顶表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_top +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_visit +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_visit`; +CREATE TABLE `5kcrm_crm_visit` ( + `visit_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '回访id', + `owner_user_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '回访人', + `create_user_id` int(11) NOT NULL COMMENT '创建人id', + `customer_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户名称', + `contract_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '合同编号', + `contacts_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系人', + `number` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '回访编号', + `shape` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '回访形式', + `status` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '处理状态', + `satisfaction` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户满意度', + `feedback` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '客户反馈', + `remark` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '备注', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `update_time` int(11) NULL DEFAULT NULL COMMENT '更新时间', + `deleted_state` int(2) NOT NULL DEFAULT 0 COMMENT '删除状态0 正常1回收站', + `ro_user_id` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '只读权限', + `rw_user_id` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '读写权限', + `visit_time` date NULL DEFAULT NULL COMMENT '回访时间', + `num` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '合同编号', + PRIMARY KEY (`visit_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_visit +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_visit_data +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_visit_data`; +CREATE TABLE `5kcrm_crm_visit_data` ( + `visit_id` int(10) UNSIGNED NOT NULL COMMENT '回访表ID', + `field` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段名', + `content` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '字段内容', + `create_time` int(10) UNSIGNED NOT NULL COMMENT '创建时间' +) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '回访表扩展字段数据' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of 5kcrm_crm_visit_data +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_crm_visit_file +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_crm_visit_file`; +CREATE TABLE `5kcrm_crm_visit_file` ( + `r_id` int(11) NOT NULL AUTO_INCREMENT, + `visit_id` int(11) NOT NULL COMMENT '回访ID', + `file_id` int(11) NOT NULL COMMENT '附件ID', + PRIMARY KEY (`r_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '回访客户附件关系表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_crm_visit_file +-- ---------------------------- + + +-- ---------------------------- +-- Table structure for 5kcrm_oa_announcement +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_oa_announcement`; +CREATE TABLE `5kcrm_oa_announcement` ( + `announcement_id` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '标题', + `content` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '内容', + `create_user_id` int(10) NOT NULL COMMENT '创建人ID', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `update_time` int(11) NOT NULL COMMENT '更新时间', + `start_time` int(11) NOT NULL COMMENT '开始时间', + `end_time` int(11) NOT NULL COMMENT '结束时间', + `structure_ids` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '通知部门', + `owner_user_ids` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '通知人', + `read_user_ids` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '阅读人', + `is_read` tinyint(2) NOT NULL DEFAULT 0 COMMENT '1表示已读 0表示未读', + PRIMARY KEY (`announcement_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '公告表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_oa_announcement +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_oa_event +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_oa_event`; +CREATE TABLE `5kcrm_oa_event` ( + `event_id` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '日程标题', + `start_time` int(11) NOT NULL COMMENT '开始时间', + `end_time` int(11) NOT NULL COMMENT '结束时间', + `create_user_id` int(10) NOT NULL COMMENT '创建人ID', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `update_time` int(11) NOT NULL COMMENT '更新时间', + `owner_user_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '参与人', + `schedule_id` int(10) UNSIGNED NULL DEFAULT NULL COMMENT 'admin_oa_schedule表的主键ID', + PRIMARY KEY (`event_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '日程表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_oa_event +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_oa_event_notice +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_oa_event_notice`; +CREATE TABLE `5kcrm_oa_event_notice` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `event_id` int(11) NOT NULL COMMENT '日程ID', + `noticetype` tinyint(4) UNSIGNED NULL DEFAULT NULL COMMENT '1分 2时 3天', + `start_time` int(11) NOT NULL COMMENT '开始时间', + `stop_time` int(11) NOT NULL COMMENT '介绍时间', + `number` tinyint(4) NOT NULL DEFAULT 0 COMMENT '根据noticetype来决定提前多久提醒', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '日程提醒设置表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_oa_event_notice +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_oa_event_relation +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_oa_event_relation`; +CREATE TABLE `5kcrm_oa_event_relation` ( + `eventrelation_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '日程关联业务表', + `event_id` int(11) NOT NULL COMMENT '日程ID', + `customer_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '客户IDs', + `contacts_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '联系人IDs', + `business_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '商机IDs', + `contract_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '合同IDs', + `status` tinyint(2) NULL DEFAULT 0 COMMENT '状态1可用', + `create_time` int(11) NOT NULL COMMENT '创建时间', + PRIMARY KEY (`eventrelation_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '日程关联业务表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_oa_event_relation +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_oa_examine +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_oa_examine`; +CREATE TABLE `5kcrm_oa_examine` ( + `examine_id` int(11) NOT NULL AUTO_INCREMENT, + `category_id` int(11) NOT NULL DEFAULT 1 COMMENT '审批类型', + `content` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '内容', + `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '备注', + `money` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '差旅、报销总金额', + `start_time` int(11) NOT NULL DEFAULT 0 COMMENT '开始时间', + `end_time` int(11) NOT NULL DEFAULT 0 COMMENT '结束时间', + `duration` decimal(10, 1) NOT NULL DEFAULT 0.0 COMMENT '时长', + `create_user_id` int(10) NOT NULL COMMENT '创建人ID', + `check_user_id` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '审批人ID', + `flow_user_id` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '流程审批人ID', + `check_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '状态(0待审、1审批中、2通过、3失败、4撤销)', + `flow_id` int(11) NOT NULL DEFAULT 0 COMMENT '审批流程ID', + `order_id` int(10) NOT NULL DEFAULT 0 COMMENT '审批流程排序ID', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `update_time` int(11) NOT NULL COMMENT '更新时间', + `last_user_id` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '上一审批人', + PRIMARY KEY (`examine_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '审批表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_oa_examine +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_oa_examine_category +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_oa_examine_category`; +CREATE TABLE `5kcrm_oa_examine_category` ( + `category_id` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '名称', + `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '描述', + `create_user_id` int(10) NOT NULL COMMENT '创建人ID', + `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '1启用,0禁用', + `is_sys` tinyint(1) NOT NULL DEFAULT 0 COMMENT '1为系统类型,不能删除', + `user_ids` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '可见范围(员工)', + `structure_ids` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '可见范围(部门)', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `update_time` int(11) NOT NULL COMMENT '更新时间', + `is_deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '1已删除', + `delete_time` int(11) NOT NULL DEFAULT 0 COMMENT '删除时间', + `delete_user_id` int(11) NOT NULL DEFAULT 0 COMMENT '删除人ID', + `flow_id` int(11) NOT NULL DEFAULT 0 COMMENT '审批流ID', + `icon` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '类型图标和颜色', + PRIMARY KEY (`category_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '审批类型表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_oa_examine_category +-- ---------------------------- +INSERT INTO `5kcrm_oa_examine_category` VALUES (1, '普通审批', '普通审批', 1, 1, 1, '', '', 1612576450, 1612576450, 0, 0, 0, 1, 'wk wk-leave,#00CAAB'); +INSERT INTO `5kcrm_oa_examine_category` VALUES (2, '请假审批', '请假审批', 1, 1, 1, '', '', 1612518097, 1612518097, 0, 0, 0, 2, 'wk wk-l-record,#3ABCFB'); +INSERT INTO `5kcrm_oa_examine_category` VALUES (3, '出差审批', '出差审批', 1, 1, 1, '', '', 1548911542, 1548911542, 0, 0, 0, 3, 'wk wk-trip,#3ABCFB'); +INSERT INTO `5kcrm_oa_examine_category` VALUES (4, '加班审批', '加班审批', 1, 1, 1, '', '', 1548911542, 1548911542, 0, 0, 0, 4, 'wk wk-overtime,#FAAD14'); +INSERT INTO `5kcrm_oa_examine_category` VALUES (5, '差旅报销', '差旅报销', 1, 1, 1, '', '', 1548911542, 1548911542, 0, 0, 0, 5, 'wk wk-reimbursement,#3ABCFB'); +INSERT INTO `5kcrm_oa_examine_category` VALUES (6, '借款申请', '借款申请', 1, 1, 1, '', '', 1548911542, 1548911542, 0, 0, 0, 6, 'wk wk-go-out,#FF6033'); + +-- ---------------------------- +-- Table structure for 5kcrm_oa_examine_data +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_oa_examine_data`; +CREATE TABLE `5kcrm_oa_examine_data` ( + `data_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, + `examine_id` int(11) NOT NULL COMMENT '审批ID', + `field` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段名', + `value` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '字段内容', + PRIMARY KEY (`data_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '审批数据扩展表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_oa_examine_data +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_oa_examine_file +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_oa_examine_file`; +CREATE TABLE `5kcrm_oa_examine_file` ( + `r_id` int(11) NOT NULL AUTO_INCREMENT, + `examine_id` int(11) NOT NULL COMMENT '审批ID', + `file_id` int(11) NOT NULL COMMENT '附件ID', + PRIMARY KEY (`r_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '审批附件关系表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_oa_examine_file +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_oa_examine_order +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_oa_examine_order`; +CREATE TABLE `5kcrm_oa_examine_order` ( + `order_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `work_id` int(10) UNSIGNED NOT NULL, + `user_id` int(10) UNSIGNED NOT NULL, + `order` int(10) UNSIGNED NOT NULL DEFAULT 1, + PRIMARY KEY (`order_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '办公审批流排序表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_oa_examine_order +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_oa_examine_relation +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_oa_examine_relation`; +CREATE TABLE `5kcrm_oa_examine_relation` ( + `r_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '审批关联业务表', + `examine_id` int(11) NOT NULL COMMENT '审批ID', + `customer_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '客户IDs', + `contacts_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '联系人IDs', + `business_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '商机IDs', + `contract_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '合同IDs', + `status` tinyint(2) NOT NULL DEFAULT 1 COMMENT '状态1可用', + `create_time` int(11) NOT NULL COMMENT '创建时间', + PRIMARY KEY (`r_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '审批关联业务表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_oa_examine_relation +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_oa_examine_travel +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_oa_examine_travel`; +CREATE TABLE `5kcrm_oa_examine_travel` ( + `travel_id` int(11) NOT NULL AUTO_INCREMENT, + `examine_id` int(11) NOT NULL COMMENT '审批ID', + `start_address` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '出发地', + `start_time` int(11) NOT NULL COMMENT '出发时间', + `end_address` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '目的地', + `end_time` int(11) NOT NULL COMMENT '到达时间', + `traffic` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '交通费', + `stay` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '住宿费', + `diet` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '餐饮费', + `other` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '其他费用', + `money` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '金额', + `vehicle` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '交通工具', + `trip` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '单程往返(单程、往返)', + `duration` decimal(10, 1) NOT NULL DEFAULT 0.0 COMMENT '时长', + `description` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '备注', + PRIMARY KEY (`travel_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '差旅行程表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_oa_examine_travel +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_oa_examine_travel_file +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_oa_examine_travel_file`; +CREATE TABLE `5kcrm_oa_examine_travel_file` ( + `r_id` int(11) NOT NULL AUTO_INCREMENT, + `travel_id` int(11) NOT NULL COMMENT '差旅id', + `file_id` int(11) NOT NULL COMMENT '附件ID', + PRIMARY KEY (`r_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '差旅附件关系表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_oa_examine_travel_file +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_oa_log +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_oa_log`; +CREATE TABLE `5kcrm_oa_log` ( + `log_id` int(11) NOT NULL AUTO_INCREMENT, + `category_id` tinyint(2) NOT NULL DEFAULT 1 COMMENT '日志类型(1日报,2周报,3月报)', + `title` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '日志标题', + `content` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '日志内容', + `tomorrow` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '明日工作内容', + `question` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '遇到问题', + `create_user_id` int(10) NOT NULL COMMENT '创建人ID', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `update_time` int(11) NOT NULL COMMENT '更新时间', + `send_user_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '通知人', + `send_structure_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '通知部门', + `read_user_ids` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '已读ids', + `is_relation` tinyint(2) NOT NULL DEFAULT 1 COMMENT '0不关联1关联', + `save_customer` int(10) NOT NULL DEFAULT 0 COMMENT '每日新增客户数量', + `save_business` int(10) NOT NULL DEFAULT 0 COMMENT '每日新增商机', + `save_contract` int(10) NOT NULL DEFAULT 0 COMMENT '每日新增合同', + `save_receivables` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '每日新增回款', + `save_activity` int(10) NOT NULL DEFAULT 0 COMMENT '新增跟进记录', + PRIMARY KEY (`log_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '工作日志表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_oa_log +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_oa_log_favour +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_oa_log_favour`; +CREATE TABLE `5kcrm_oa_log_favour` ( + `favour_id` int(11) NOT NULL AUTO_INCREMENT, + `log_id` int(11) NOT NULL, + `user_id` int(11) NULL DEFAULT NULL COMMENT '点赞人id', + `status` tinyint(2) NOT NULL DEFAULT 1 COMMENT '状态 0禁用 1显示', + PRIMARY KEY (`favour_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '点赞记录表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_oa_log_favour +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_oa_log_file +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_oa_log_file`; +CREATE TABLE `5kcrm_oa_log_file` ( + `r_id` int(11) NOT NULL AUTO_INCREMENT, + `log_id` int(11) NOT NULL COMMENT '日志ID', + `file_id` int(11) NOT NULL COMMENT '附件ID', + PRIMARY KEY (`r_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '日志附件关系表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_oa_log_file +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_oa_log_relation +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_oa_log_relation`; +CREATE TABLE `5kcrm_oa_log_relation` ( + `r_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '日志关联业务表', + `log_id` int(11) NOT NULL COMMENT '日志ID', + `customer_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '客户IDs', + `contacts_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '联系人IDs', + `business_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '商机IDs', + `contract_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '合同IDs', + `status` tinyint(2) NOT NULL COMMENT '状态1可用', + `create_time` int(11) NOT NULL COMMENT '创建时间', + PRIMARY KEY (`r_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '日志关联业务表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_oa_log_relation +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_task +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_task`; +CREATE TABLE `5kcrm_task` ( + `task_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '任务表', + `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '任务名称', + `create_user_id` int(11) NOT NULL COMMENT '创建人ID', + `main_user_id` int(11) NOT NULL COMMENT '负责人ID', + `owner_user_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '团队成员ID', + `structure_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '部门IDs', + `create_time` int(11) NOT NULL COMMENT '新建时间', + `update_time` int(11) NOT NULL COMMENT '更新时间', + `status` tinyint(2) NOT NULL DEFAULT 1 COMMENT '完成状态 1正在进行,2延期,5结束', + `class_id` int(5) NOT NULL DEFAULT 0 COMMENT '分类 要做 在做 待定', + `lable_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '标签 ,号拼接', + `description` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '描述', + `pid` int(11) NULL DEFAULT 0 COMMENT '上级ID', + `start_time` int(11) NOT NULL DEFAULT 0 COMMENT '开始时间', + `stop_time` int(11) NOT NULL DEFAULT 0 COMMENT '结束时间', + `priority` tinyint(2) NOT NULL DEFAULT 0 COMMENT '优先级 从大到小', + `work_id` int(11) NULL DEFAULT 0 COMMENT '项目ID', + `is_top` tinyint(2) NULL DEFAULT 0 COMMENT '工作台展示 0收件箱 1,2,3', + `is_open` tinyint(2) NULL DEFAULT 1 COMMENT '是否公开', + `order_id` tinyint(4) NOT NULL DEFAULT 0 COMMENT '排序ID', + `top_order_id` tinyint(4) NOT NULL DEFAULT 0 COMMENT '我的任务排序ID', + `is_archive` tinyint(1) NOT NULL DEFAULT 0 COMMENT '1归档', + `archive_time` int(11) NOT NULL DEFAULT 0 COMMENT '归档时间', + `ishidden` tinyint(2) NULL DEFAULT 0 COMMENT '是否删除', + `hidden_time` int(11) NOT NULL DEFAULT 0 COMMENT '删除时间', + PRIMARY KEY (`task_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '任务表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_task +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_task_relation +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_task_relation`; +CREATE TABLE `5kcrm_task_relation` ( + `r_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '任务关联业务表', + `task_id` int(11) NOT NULL COMMENT '任务ID', + `customer_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '客户IDs', + `contacts_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '联系人IDs', + `business_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '商机IDs', + `contract_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '合同IDs', + `status` tinyint(2) NOT NULL DEFAULT 1 COMMENT '状态1可用', + `create_time` int(11) NOT NULL COMMENT '创建时间', + PRIMARY KEY (`r_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '任务关联业务表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_task_relation +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_work +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_work`; +CREATE TABLE `5kcrm_work` ( + `work_id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '项目名字', + `status` tinyint(2) NULL DEFAULT 0 COMMENT '状态 1启用 0归档', + `create_time` int(11) NOT NULL, + `create_user_id` int(11) NOT NULL COMMENT '创建人ID', + `description` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '描述', + `color` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '颜色', + `is_open` tinyint(2) NULL DEFAULT 0 COMMENT '是否所有人可见 1可见', + `owner_user_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '项目成员', + `ishidden` tinyint(2) NULL DEFAULT 0 COMMENT '是否删除', + `archive_time` int(11) NOT NULL DEFAULT 0 COMMENT '归档时间', + `group_id` tinyint(1) NOT NULL DEFAULT 0 COMMENT '角色组ID', + `cover_url` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '封面图片', + `update_time` int(10) NOT NULL COMMENT '更新时间', + `is_system_cover` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '是否是系统封面:1是;0不是', + `is_follow` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '关注:1关注', + PRIMARY KEY (`work_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '项目表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_work +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_work_lable_order +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_work_lable_order`; +CREATE TABLE `5kcrm_work_lable_order` ( + `order_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `lable_id` int(10) UNSIGNED NOT NULL COMMENT '标签ID', + `user_id` int(10) UNSIGNED NOT NULL COMMENT '用户ID', + `order` int(10) UNSIGNED NOT NULL COMMENT '排序', + PRIMARY KEY (`order_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '标签排序表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_work_lable_order +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_work_order +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_work_order`; +CREATE TABLE `5kcrm_work_order` ( + `order_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `work_id` int(10) UNSIGNED NOT NULL, + `user_id` int(10) UNSIGNED NOT NULL, + `order` int(10) UNSIGNED NOT NULL DEFAULT 1, + PRIMARY KEY (`order_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '项目排序表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_work_order +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_work_relation +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_work_relation`; +CREATE TABLE `5kcrm_work_relation` ( + `r_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '日志关联业务表', + `work_id` int(11) NOT NULL COMMENT '项目ID', + `customer_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '客户IDs', + `contacts_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '联系人IDs', + `business_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '商机IDs', + `contract_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '合同IDs', + `status` tinyint(2) NOT NULL DEFAULT 1 COMMENT '状态1可用', + `create_time` int(11) NOT NULL COMMENT '创建时间', + PRIMARY KEY (`r_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '项目关联业务表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_work_relation +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_work_task_class +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_work_task_class`; +CREATE TABLE `5kcrm_work_task_class` ( + `class_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '任务分类表', + `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '分类名', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `create_user_id` int(11) NOT NULL COMMENT '创建人ID', + `status` tinyint(2) NULL DEFAULT 0 COMMENT '状态1正常', + `work_id` int(11) NOT NULL COMMENT '项目ID', + `order_id` tinyint(4) NOT NULL DEFAULT 0 COMMENT '排序', + PRIMARY KEY (`class_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '任务分类表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_work_task_class +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_work_task_file +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_work_task_file`; +CREATE TABLE `5kcrm_work_task_file` ( + `r_id` int(11) NOT NULL AUTO_INCREMENT, + `file_id` int(11) NOT NULL COMMENT '文件ID', + `task_id` int(11) NOT NULL COMMENT '任务ID', + PRIMARY KEY (`r_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_work_task_file +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_work_task_lable +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_work_task_lable`; +CREATE TABLE `5kcrm_work_task_lable` ( + `lable_id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '标签名', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `create_user_id` int(11) NOT NULL COMMENT '创建人ID', + `status` tinyint(2) NULL DEFAULT 0 COMMENT '状态', + `color` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '颜色', + PRIMARY KEY (`lable_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '任务标签表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_work_task_lable +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_work_task_log +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_work_task_log`; +CREATE TABLE `5kcrm_work_task_log` ( + `log_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '项目日志表', + `user_id` int(11) NOT NULL COMMENT '操作人ID', + `content` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '内容', + `create_time` int(11) NOT NULL COMMENT '创建时间', + `status` tinyint(2) NULL DEFAULT 0 COMMENT '状态 4删除', + `task_id` int(11) NULL DEFAULT 0 COMMENT '任务ID', + `work_id` int(11) NULL DEFAULT 0 COMMENT '项目ID', + PRIMARY KEY (`log_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '任务日志表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_work_task_log +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_work_user +-- ---------------------------- +DROP TABLE IF EXISTS `5kcrm_work_user`; +CREATE TABLE `5kcrm_work_user` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `work_id` int(11) NOT NULL COMMENT '项目ID', + `user_id` int(11) NOT NULL COMMENT '成员ID', + `types` tinyint(1) NOT NULL DEFAULT 0 COMMENT '1管理员,0初始权限', + `group_id` int(11) NOT NULL COMMENT '角色ID', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '项目成员表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of 5kcrm_work_user +-- ---------------------------- + +-- ---------------------------- +-- Table structure for 5kcrm_app_navigation +-- ---------------------------- + +CREATE TABLE `5kcrm_app_navigation` ( + `p_id` int(11) NOT NULL AUTO_INCREMENT, + `data` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '数据集', + `create_user_id` int(11) NOT NULL COMMENT '创建人', + PRIMARY KEY (`p_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '手机端导航数据表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of 5kcrm_app_navigation +-- ---------------------------- + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/public/static/js/step2.js b/public/static/js/step2.js index b2d8b73..b66af0a 100644 --- a/public/static/js/step2.js +++ b/public/static/js/step2.js @@ -49,8 +49,8 @@ var rules = { wkcode: { required: false, regexp: null, - label: '序列号' - }, + label: '' + }, }; var timer = null; @@ -84,22 +84,61 @@ $('.next').click(function () { async: true, timeout: 120000, success: function (result) { + const step7 = $.ajax({ + url:'./step7', + dataType:'json', + type: "POST", + data: { + form: forms + }, + }) + const step8 = $.ajax({ + url:'./step8', + dataType:'json', + type: "POST", + data: { + form: forms + }, + }) + const step10 = $.ajax({ + url:'./step10', + dataType:'json', + type: "POST", + data: { + form: forms + }, + + }) + const step11 = $.ajax({ + url:'./step11', + dataType:'json', + type: "POST", + data: { + form: forms + }, + }) + if (result.code == '200') { + + Promise.all([step7,step8,step10,step11]).then(res=>{ + const [step7Res,step8Res,step10Res,step11Res] =res + }) localStorage.clear(); window.location = 'step5.html'; } else if (result.code == '400') { - // alert(result.error); + alert(result.error); window.location.href = 'step6.html'; } else { - // alert(result.error); + alert(result.error); window.location.href = 'step6.html'; } }, error: function (xhr) { window.location.href = 'step6.html'; } - }); - }) + }); + + }) } });