优化安装;修复已知BUG;

pull/1/head
gengxiaoxu 2 years ago
parent 3ed3b3bb27
commit cc2cd4a346

@ -0,0 +1,633 @@
<?php
// +----------------------------------------------------------------------
// | Description: 审批流程
// +----------------------------------------------------------------------
// | Author: zjf
// +----------------------------------------------------------------------
namespace app\admin\controller;
use think\Hook;
use think\Request;
use think\Db;
class Examine extends ApiCommon
{
/**
* 用于判断权限
* @permission 无限制
* @allow 登录用户可访问
* @other 其他根据系统设置
**/
public function _initialize()
{
$action = [
'permission'=>[],
'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;
}
}

@ -742,7 +742,7 @@ class Field extends ApiCommon
$userInfo = $this->userInfo; $userInfo = $this->userInfo;
$userFieldModel = model('UserField'); $userFieldModel = model('UserField');
$width = $param['width'] > 10 ? $param['width'] : ''; $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']) { switch ($param['field']) {
case 'status_id_info' : $param['field'] = 'status_id'; case 'status_id_info' : $param['field'] = 'status_id';
break; break;

@ -68,7 +68,7 @@ class Index extends ApiCommon
if ($value['field'] == 'collection_object') $field_arr[$key]['form_type'] = 'text'; 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'])){ 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); $field_arr=array_merge($field_arr,$field);
} }
// if($param['types'] == 'jxc_product'){ // if($param['types'] == 'jxc_product'){

@ -8,6 +8,7 @@
namespace app\admin\controller; namespace app\admin\controller;
use think\Controller; use think\Controller;
use think\Exception;
use think\Request; use think\Request;
use think\Db; use think\Db;
use Env; use Env;
@ -170,10 +171,10 @@ class Install extends Controller
if (!$resCheckData) { if (!$resCheckData) {
return resultArray(['error' => '序列号错误!']); return resultArray(['error' => '序列号错误!']);
} }
$resData = object_to_array(json_decode($resCheckData)); // $resData = object_to_array(json_decode($resCheckData));
if ($resData['date'] != date('Y-m-d')) { // if ($resData['date'] != date('Y-m-d')) {
return resultArray(['error' => '序列号已失效,请前往悟空官网个人中心获取最新数据!']); // return resultArray(['error' => '序列号已失效,请前往悟空官网个人中心获取最新数据!']);
} // }
if (empty($password)) { if (empty($password)) {
return resultArray(['error' => '请填写管理员密码!']); return resultArray(['error' => '请填写管理员密码!']);
} }
@ -186,7 +187,7 @@ class Install extends Controller
try{ try{
$ret = $connect->execute('select version()'); $ret = $connect->execute('select version()');
}catch(\Exception $e){ }catch(\Exception $e){
return resultArray(['error' => '数据库连接失败,请检查数据库配置!']); return resultArray(['error' => '数据库连接失败,请检查数据库配置4']);
} }
$check = $connect->execute("SELECT * FROM information_schema.schemata WHERE schema_name='".$database."'"); $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 ")) { if (!$check && !$connect->execute("CREATE DATABASE IF NOT EXISTS `".$database."` default collate utf8_general_ci ")) {
@ -196,7 +197,44 @@ class Install extends Controller
self::mkDatabase($db_config); self::mkDatabase($db_config);
self::mkLicense($wkcode); self::mkLicense($wkcode);
$C_Patch = substr($_SERVER['SCRIPT_FILENAME'],0,-10); $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);
$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文件']);
}
}
}
// $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']]); $sqlList = parse_sql($sql, 0, ['5kcrm_' => $db_config['prefix']]);
if ($sqlList) { if ($sqlList) {
$sqlList = array_filter($sqlList); $sqlList = array_filter($sqlList);
@ -214,15 +252,147 @@ class Install extends Controller
} }
} }
} }
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); $salt = substr(md5(time()),0,4);
$password = user_md5(trim($password), $salt, $username); $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']."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 )"); 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"); touch(CONF_PATH . "install.lock");
return resultArray(['data'=>'安装成功']); 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()]);
}
}
/** /**
* 安装成功界面 * 安装成功界面
* *

@ -87,15 +87,22 @@ class Rules extends ApiCommon
$data = ['0' => ['name' => '系统管理角色','pid' => 1],'1' => ['name' => '办公管理角色','pid' => 6],'2' => ['name' => '客户管理角色','pid' => 2],'3' => ['name' => '项目管理角色','pid' => '9']]; $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(); $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'); $authList = db('admin_group_auth')->where('group_id', $param['group_id'])->column('auth_group_id');
foreach ($data as $key => $value) { foreach ($data as $key => $value) {
foreach ($list as $k => $v) { foreach ($list as $k => $v) {
$v['is_true'] = in_array($v['id'], $authList) ? 1 : 0; $v['is_true'] = in_array($v['id'], $authList) ? 1 : 0;
if($v['pid'] == $value['pid']){ if($v['pid'] == $value['pid']){
if($v['id']==1){
continue;
}elseif($v['id']==2){
continue;
}else{
$data[$key]['item'][] = $v; $data[$key]['item'][] = $v;
} }
}
} }
} }
@ -179,9 +186,16 @@ class Rules extends ApiCommon
$item = []; $item = [];
foreach ($list as $k => $v) { foreach ($list as $k => $v) {
if($v['pid'] == $value['pid']){ if($v['pid'] == $value['pid']){
if($v['pid'] == $value['pid']){
if($userId!=1 && $v['id']==1){
continue;
}else{
$item[] = $v; $item[] = $v;
} }
} }
}
}
$items = []; $items = [];
if(!empty($item)){ if(!empty($item)){
$items = [ $items = [
@ -198,10 +212,14 @@ class Rules extends ApiCommon
foreach ($data as $key => $value) { foreach ($data as $key => $value) {
foreach ($list as $k => $v) { foreach ($list as $k => $v) {
if($v['pid'] == $value['pid']){ if($v['pid'] == $value['pid']){
if($v['id']==1){
continue;
}else{
$data[$key]['list'][] = $v; $data[$key]['list'][] = $v;
} }
} }
} }
}
return resultArray(['data' => $data]); return resultArray(['data' => $data]);
} }
} }

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

@ -265,7 +265,7 @@ class FieldGrantLogic
# 固定字段 # 固定字段
$content = [ $content = [
['field' => 'name', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '线索名称'], ['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' => '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' => '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' => '电话'], ['field' => 'telephone', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '电话'],

@ -67,11 +67,15 @@ class Admin extends Common
} }
} }
if (!$user_ids) $user_ids = getSubUserId(true,0, $apiCommon->userInfo['id']); if (!$user_ids) $user_ids = getSubUserId(true,0, $apiCommon->userInfo['id']);
$perUserIds = $perUserIds ? : getSubUserId(); //权限范围内userIds // $perUserIds = $perUserIds ? : getSubUserId(); //权限范围内userIds
$userIds = []; $userIds = [];
if($perUserIds){
if ($user_ids) { if ($user_ids) {
$userIds = $perUserIds ? array_intersect($user_ids, $perUserIds) : $perUserIds; //数组交集 $userIds = $perUserIds ? array_intersect($user_ids, $perUserIds) : $perUserIds; //数组交集
} }
}else{
$userIds = $user_ids; //数组交集
}
$where['userIds'] = array_map('intval', $userIds); $where['userIds'] = array_map('intval', $userIds);
if ($param['type']) { if ($param['type']) {
$between_time = getTimeByType($param['type'], $is_last); $between_time = getTimeByType($param['type'], $is_last);

@ -0,0 +1,150 @@
<?php
// +----------------------------------------------------------------------
// | Description: 审批流程
// +----------------------------------------------------------------------
// | Author: zjf
// +----------------------------------------------------------------------
namespace app\admin\model;
use app\admin\controller\ApiCommon;
use think\Db;
use app\admin\model\Common;
use think\Request;
use think\Validate;
class Examine extends Common
{
/**
* 为了数据库的整洁同时又不影响Model和Controller的名称
* 我们约定每个模块的数据表都加上相同的前缀比如CRM模块用crm作为数据表前缀
*/
protected $name = 'examine';
protected $createTime = 'create_time';
protected $updateTime = 'update_time';
protected $autoWriteTimestamp = true;
protected $typesArr = ['crm_contract', 'crm_receivables', 'crm_invoice', 'oa_examine', 'jxc_purchase', 'jxc_retreat', 'jxc_sale', 'jxc_salereturn', 'jxc_payment', 'jxc_collection', 'jxc_allocation', 'jxc_inventory'];
/**
* [getDataList 审批流程list]
* @author zjf
* @param [string] $map [查询条件]
* @param [number] $page [当前页数]
* @param [number] $limit [每页数量]
* @return [array] [description]
*/
public function getDataList($request)
{
$request = $this->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;
}
}

@ -984,7 +984,8 @@ class Excel extends Common
} }
} else { } else {
if ($types == 'crm_customer' && !empty($param['pool_id'])) { 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 = array_merge($data, $default_data);
$data['excel'] = 1; $data['excel'] = 1;
if (!$resData = $dataModel->createData($data)) { if (!$resData = $dataModel->createData($data)) {

@ -773,6 +773,7 @@ class Field extends Model
unset($data['yaxis']); unset($data['yaxis']);
unset($data['maxNumRestrict']); unset($data['maxNumRestrict']);
unset($data['minNumRestrict']); unset($data['minNumRestrict']);
unset($data['stting']);
// 设置明细表格类型的默认值为空防止为null的报错。 // 设置明细表格类型的默认值为空防止为null的报错。
if ($data['form_type'] == 'detail_table') { if ($data['form_type'] == 'detail_table') {
$data['default_value'] = ''; $data['default_value'] = '';
@ -1124,6 +1125,9 @@ class Field extends Model
'fieldName' => 'owner_user_structure_name' 'fieldName' => 'owner_user_structure_name'
]; ];
foreach ($field_list as $k => $v) { 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; $field_list[$k]['writeStatus'] = 1;
if (!$userLevel && $param['module'] == 'crm' && !empty($grantData[$param['types']])) { 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]['maskType'] = $status['maskType'];
# 编辑权限 # 编辑权限
$field_list[$k]['writeStatus'] = $status['write']; $field_list[$k]['writeStatus'] = $status['write'];
} }
} }
if ($param['types'] == 'crm_invoice') { if ($param['types'] == 'crm_invoice') {
@ -1854,7 +1859,7 @@ class Field extends Model
} }
$fieldArr = $this $fieldArr = $this
->where($where) ->where($where)
->field(['field', 'name', 'form_type', 'is_hidden']) ->field(['field', 'name', 'form_type', 'is_hidden','setting'])
->order('order_id', 'asc') ->order('order_id', 'asc')
->select(); ->select();
@ -1908,6 +1913,15 @@ class Field extends Model
'is_hidden' => 0 'is_hidden' => 0
]; ];
} }
if ($types == 'jxc_product') {
$res[] = [
'field' => 'product_picture',
'name' => '产品图片',
'form_type' => 'pic',
'is_hidden' => 0
];
}
return array_column($res, null, 'field'); return array_column($res, null, 'field');
} }
@ -2433,6 +2447,7 @@ class Field extends Model
$field = $prefix ? $prefix . '.' . $field : $field; $field = $prefix ? $prefix . '.' . $field : $field;
switch ($form_type) { switch ($form_type) {
case 'textarea' : case 'textarea' :
case 'text' :
case 'radio' : case 'radio' :
case 'select' : case 'select' :
case 'checkbox' : case 'checkbox' :
@ -2645,4 +2660,70 @@ class Field extends Model
return false; 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 ?: [];
}
} }

@ -31,8 +31,10 @@ class Group extends Common
{ {
$ruleModel = new \app\admin\model\Rule(); $ruleModel = new \app\admin\model\Rule();
$map = []; $map = [];
if ($param['tree'] == 1) { if ($param['tree'] == 1) {
$list = $this->getTypeList(); $list = $this->getTypeList();
foreach ($list as $k=>$v) { foreach ($list as $k=>$v) {
$where = []; $where = [];
$where = $this->getNewGroupPid($v['pid']); $where = $this->getNewGroupPid($v['pid']);
@ -47,7 +49,11 @@ class Group extends Common
} else { } else {
$where = $this->getNewGroupPid($param['pid']); $where = $this->getNewGroupPid($param['pid']);
} }
if($param['pid']==1){
$where['id']=['<>',1];
}
$list = db('admin_group')->where($where)->select() ? : []; $list = db('admin_group')->where($where)->select() ? : [];
if ($param['rules'] == 1) { if ($param['rules'] == 1) {
//角色权限分类关系 //角色权限分类关系
$ruleTypes = $ruleModel->groupsToRules($param['pid']); $ruleTypes = $ruleModel->groupsToRules($param['pid']);
@ -165,7 +171,7 @@ class Group extends Common
*/ */
public function getTypeList() 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 ? : []; return $list ? : [];
} }

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

@ -292,10 +292,6 @@ class User extends Common
} }
} }
$param['structure_id'] = $pid; $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'); $nameData = db('admin_user')->where('realname', 'like', '%' . $param['realname'] . '%')->column('realname');
if (in_array($param['realname'], $nameData)) { if (in_array($param['realname'], $nameData)) {
@ -328,6 +324,10 @@ class User extends Common
$this->error = $validate->getError(); $this->error = $validate->getError();
return false; return false;
} }
if (db('admin_user')->where('username', $param['username'])->find()) {
$this->error = '手机号已存在';
return false;
}
$syncModel = new \app\admin\model\Sync(); $syncModel = new \app\admin\model\Sync();
$this->startTrans(); $this->startTrans();
try { try {
@ -449,10 +449,10 @@ class User extends Common
} }
} else { } else {
// 不能操作超级管理员 // 不能操作超级管理员
// if ($id == 1) { if ($id == 1) {
// $this->error = '非法操作'; $this->error = '非法操作,不能编辑超级管理员';
// return false; return false;
// } }
$checkData = $this->get($id); $checkData = $this->get($id);
$userInfo = $checkData->data; $userInfo = $checkData->data;
if (!$checkData) { if (!$checkData) {
@ -718,6 +718,10 @@ class User extends Common
{ {
$syncModel = new \app\admin\model\Sync(); $syncModel = new \app\admin\model\Sync();
$flag = true; $flag = true;
if($param['user_id']!=1 && empty(!in_array(1,$param['id']))){
$this->error = '修改失败,无修改超级管理员权限';
return false;
}
foreach ($param['id'] as $value) { foreach ($param['id'] as $value) {
$password = ''; $password = '';
$userInfo = db('admin_user')->where(['id' => $value])->find(); $userInfo = db('admin_user')->where(['id' => $value])->find();
@ -852,10 +856,10 @@ class User extends Common
$authList['oa']['calendar'] = (object)[]; $authList['oa']['calendar'] = (object)[];
} }
# 进销存 # 进销存
if (in_array('jxc', $adminConfig)) { // if (in_array('jxc', $adminConfig)) {
$authList['jxc']['field'] = (object)[]; // $authList['jxc']['field'] = (object)[];
$authList['jxc']['params'] = (object)[]; // $authList['jxc']['params'] = (object)[];
} // }
# 公海权限 # 公海权限
$structureId = db('admin_user')->where('id', $u_id)->value('structure_id'); $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) { $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['hrm'] = (object)[];
// $authList['jxc'] = (object)[]; // $authList['jxc'] = (object)[];
# jxc # jxc
$authList['manage']['jxc']['field'] = true; // $authList['manage']['jxc']['field'] = true;
$authList['manage']['jxc']['params'] = true; // $authList['manage']['jxc']['params'] = true;
$authList['knowledge'] = (object)[]; $authList['knowledge'] = (object)[];
@ -1416,7 +1420,10 @@ class User extends Common
$userIds = !empty($param['user_id']) ? $param['user_id'] : []; $userIds = !empty($param['user_id']) ? $param['user_id'] : [];
$structureIds = !empty($param['structure_id']) ? $param['structure_id'] : []; $structureIds = !empty($param['structure_id']) ? $param['structure_id'] : [];
$groupIds = !empty($param['group_id']) ? $param['group_id'] : []; $groupIds = !empty($param['group_id']) ? $param['group_id'] : [];
if($param['userId']!=1 && empty(!in_array(1,$userIds))){
$this->error = '修改失败,无复制超级管理员权限';
return false;
}
# 员工与角色关联数据 # 员工与角色关联数据
$userGroup = []; $userGroup = [];
@ -1475,13 +1482,13 @@ class User extends Common
$this->error = '参数错误'; $this->error = '参数错误';
return false; return false;
} }
$data=[];
foreach ($ids as $v) { foreach ($ids as $v) {
$data['id'] = $v; $res['id'] = $v;
$data['structure_id'] = $param['structure_id']; $res['structure_id'] = $param['structure_id'];
$flag=$this->isUpdate(true)->save($data); $data[] = $res;
// $flag = foreachData('', $data);
// p(Db::name('AdminUser')->getLastSql());
} }
$flag=$this->isUpdate(true)->saveAll($data);
if ($flag!==false) { if ($flag!==false) {
return 1; return 1;
} else { } else {

@ -39,7 +39,7 @@ trait FieldVerificationTrait
if (empty($status['read']) || (empty($dataId) && empty($status['write']))) continue; 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'] . '字段不能为空!'; $error = $value['name'] . '字段不能为空!';
break; break;

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

@ -377,7 +377,6 @@ class Customer extends Common
function getSortByCount($whereArr) 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(); $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; return $count;
} }

@ -358,7 +358,7 @@ function advancedQuery($param, $m = '', $c = '', $a = '')
if ($key == 'business_id' && !is_array($value)) $result['business.' . $key] = $value; 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['condition'] = 'is';
$value['form_type'] = 'user'; $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 = []; return $rest ?: [];
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 ?: []; * @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;
} }

@ -121,26 +121,26 @@ class PoolCommand extends Command
* @version 1.0 版本号 * @version 1.0 版本号
* @since 2021/6/3 0003 10:38 * @since 2021/6/3 0003 10:38
*/ */
// private function updateInfo($ruleList, $customerWhere) private function updateInfo($ruleList, $customerWhere)
// { {
// foreach ($ruleList as $k => $v) { foreach ($ruleList as $k => $v) {
// $levels = json_decode($v['level'], true); $levels = json_decode($v['level'], true);
// foreach ($levels as $k1 => $v1) { foreach ($levels as $k1 => $v1) {
// if (!empty($v1['limit_day'])) { if (!empty($v1['limit_day'])) {
// $time = $v1['limit_day']; $time = $v1['limit_day'];
// } else { } else {
// $time = $this->getMinDay($levels); $time = $this->getMinDay($levels);
// } }
// } }
// foreach ($customerWhere as $val) { foreach ($customerWhere as $val) {
// if ($v['type'] == 1) updateActionLog(0, 'crm_customer', $val, '', '', '超过' . $time . '天无新建跟进记录自动进入公海'); if ($v['type'] == 1) updateActionLog(0, 'crm_customer', $val, '', '', '超过' . $time . '天无新建跟进记录自动进入公海');
// if ($v['type'] == 2) 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 . '天未成交自动进入公海'); if ($v['type'] == 3) updateActionLog(0, 'crm_customer', $val, '', '', '超过' . $time . '天未成交自动进入公海');
//
// } }
// } }
// } }
//
protected function execute(Input $input, Output $output) protected function execute(Input $input, Output $output)

@ -209,3 +209,102 @@ function decrypt($data, $key = '72-crm')
} }
return $str; 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;
}

@ -280,6 +280,11 @@ class Activity extends ApiCommon
$name = '所属客户'; $name = '所属客户';
break; break;
} }
$record_type = db('crm_config')->where(['name' => 'record_type'])->find();
if ($record_type) {
$arr = json_decode($record_type['value']);
}
$fields = [ $fields = [
'0' => [ '0' => [
'name' => '跟进内容', 'name' => '跟进内容',
@ -302,15 +307,7 @@ class Activity extends ApiCommon
'name' => '跟进方式', 'name' => '跟进方式',
'field' => 'category', 'field' => 'category',
'form_type' => 'select', 'form_type' => 'select',
'setting' => 'setting' =>$arr
array
(
0 => "见面拜访",
1 => "电话",
2 => "短信",
3 => "邮件",
4 => "微信"
)
], ],
]; ];
// 导入的字段列表 // 导入的字段列表

@ -223,11 +223,15 @@ class Business extends ApiCommon
$list = cache($key); $list = cache($key);
if (!$list) { if (!$list) {
$userInfo = $this->userInfo; $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') $list = db('crm_business_type')
->field(['name', 'status', 'structure_id', 'type_id']) ->field(['name', 'status', 'structure_id', 'type_id'])
->where(['structure_id' => ['like', '%,' . $userInfo['structure_id'] . ',%'], 'status' => 1]) ->where($authMap)
->where('is_display', 1)
->whereOr('structure_id', '')
->select(); ->select();
foreach ($list as $k => $v) { foreach ($list as $k => $v) {
$list[$k]['statusList'] = $businessStatusModel->getDataList($v['type_id']); $list[$k]['statusList'] = $businessStatusModel->getDataList($v['type_id']);

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

@ -23,7 +23,10 @@ class Preview extends Controller
$data = db('admin_printing_data')->field(['type', 'content'])->where('key', $key)->find(); $data = db('admin_printing_data')->field(['type', 'content'])->where('key', $key)->find();
$contentArray = json_decode($data['content'], true); $contentArray = json_decode($data['content'], true);
$content = $contentArray['data']; $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.'config'.DS.'tcpdf_config.php');
require_once(EXTEND_PATH.'tcpdf'.DS.'tcpdf.php'); require_once(EXTEND_PATH.'tcpdf'.DS.'tcpdf.php');
@ -33,6 +36,8 @@ class Preview extends Controller
// 设置PDF页面边距LEFTTOPRIGHT // 设置PDF页面边距LEFTTOPRIGHT
$tcpdf->SetMargins(10, 10, 10); $tcpdf->SetMargins(10, 10, 10);
// 设置默认等宽字体
$tcpdf->SetDefaultMonospacedFont('courier');
// 设置字体,防止中文乱码 // 设置字体,防止中文乱码
$tcpdf->SetFont('simsun', '', 10); $tcpdf->SetFont('simsun', '', 10);
@ -41,6 +46,8 @@ class Preview extends Controller
// $tcpdf->SetAuthor(TITLE_NAME); // $tcpdf->SetAuthor(TITLE_NAME);
$tcpdf->SetTitle("打印内容预览"); $tcpdf->SetTitle("打印内容预览");
// 删除预定义的打印 页眉/页尾 // 删除预定义的打印 页眉/页尾
$tcpdf->setPrintHeader(false); $tcpdf->setPrintHeader(false);
@ -58,8 +65,9 @@ class Preview extends Controller
$tcpdf->AddPage(); $tcpdf->AddPage();
$html = $content; $html = $content;
$tcpdf->writeHTML($html, true, false, true, true, ''); $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'); $tcpdf->Output(ROOT_PATH.DS.'public'.DS.'temp'.DS.'pdf'.DS.'print.pdf','I');
exit($this->fetch('preview', ['key' => $key])); exit($this->fetch('preview', ['key' => $key]));

@ -170,43 +170,43 @@ class VisitLogic extends Common
# 系统字段 负责人部门 zjf 20210726 # 系统字段 负责人部门 zjf 20210726
$list[$k]['owner_user_structure_name'] = $list[$k]['owner_user_id_info']['structure_name']; $list[$k]['owner_user_structure_name'] = $list[$k]['owner_user_id_info']['structure_name'];
foreach ($userField as $key => $val) { foreach ($userField as $k => $val) {
$usernameField = !empty($v[$val]) ? db('admin_user')->whereIn('id', stringToArray($v[$val]))->column('realname') : []; $usernameField = !empty($v[$val]) ? db('admin_user')->whereIn('id', stringToArray($v[$val]))->column('realname') : [];
$list[$k][$val.'_name'] = implode($usernameField, ','); $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') : []; $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; $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'; $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; $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; $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; $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]; $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; $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; $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; $list[$k][$val] = $v[$val]!='0.00' ? (string)$v[$val] : null;
} }
//掩码相关类型字段 //掩码相关类型字段

@ -98,23 +98,22 @@ class Business extends Common
unset($sceneMap['type_id']); unset($sceneMap['type_id']);
} }
$partMap = []; $partMap = [];
//优先级:普通筛选>高级筛选>场景 $teamMap=$requestMap['team_id'];
if ($requestMap['team_id']) { //团队成员 高级筛选
//相关团队查询 if($teamMap){
$map = $requestMap; $partMap= advancedQueryFormatForTeam($teamMap,'business','');
$partMap= advancedQueryFormatForTeam($requestMap,'crm_business','business_id'); unset($requestMap['team_id']);
unset($map['team_id']); $map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap;
} else { } else {
$map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap; $map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap;
} }
//高级筛选 //高级筛选
$map = advancedQuery($map, 'crm', 'business', 'index'); $map = advancedQuery($map, 'crm', 'business', 'index');
$authMap = []; $authMap = [];
if (!$partMap) {
$a = 'index'; $a = 'index';
if ($is_excel) $a = 'excelExport'; if ($is_excel) $a = 'excelExport';
$auth_user_ids = $userModel->getUserByPer('crm', 'business', $a); $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])) { if (!is_array($map['business.owner_user_id'][1])) {
$map['business.owner_user_id'][1] = [$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'] . ',%')); ->whereOr('business.rw_user_id', array('like', '%,' . $authMapData['user_id'] . ',%'));
}; };
} }
}
//联系人商机 //联系人商机
if ($contacts_id) { if ($contacts_id) {
$business_id = Db::name('crm_contacts_business')->where(['contacts_id' => $contacts_id])->column('business_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'); //人员类型 $userField = $fieldModel->getFieldByFormType('crm_business', 'user'); //人员类型
$structureField = $fieldModel->getFieldByFormType('crm_business', 'structure'); //部门类型 $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(); // $fieldGrant = db('admin_field_mask')->where('types', 'business')->select();
# 处理人员和部门类型的排序报错问题(前端传来的是包含_name的别名字段) # 处理人员和部门类型的排序报错问题(前端传来的是包含_name的别名字段)
$temporaryField = str_replace('_name', '', $order_field); $temporaryField = str_replace('_name', '', $order_field);
@ -222,21 +214,8 @@ class Business extends Common
$endStatus = ['1' => '赢单', '2' => '输单', '3' => '无效']; $endStatus = ['1' => '赢单', '2' => '输单', '3' => '无效'];
# 扩展数据 # 扩展数据
$extraData = []; $extraData = [];
$business_id_list = !empty($list) ? array_column($list, 'business_id') : [];
$extraList = db('crm_business_data')->whereIn('business_id', $business_id_list)->select(); $list=getFieldData($list,'crm_business',$user_id);
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'];
}
}
}
foreach ($list as $k => $v) { foreach ($list as $k => $v) {
$list[$k]['customer_id_info']['customer_id'] = $v['customer_id']; $list[$k]['customer_id_info']['customer_id'] = $v['customer_id'];
$list[$k]['customer_id_info']['name'] = $v['customer_name']; $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]['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]['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'] : ''; $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 = []; $statusInfo = [];
$status_count = 0; $status_count = 0;
if (!$v['is_end']) { if (!$v['is_end']) {

@ -75,23 +75,24 @@ class Contacts extends Common
} }
$partMap = []; $partMap = [];
//优先级:普通筛选>高级筛选>场景 //优先级:普通筛选>高级筛选>场景
if ($requestMap['team_id']) { $teamMap=$requestMap['team_id'];
//相关团队查询 //团队成员 高级筛选
$map = $requestMap; if($teamMap){
$partMap= advancedQueryFormatForTeam($requestMap,'crm_contacts','contacts_id'); $partMap= advancedQueryFormatForTeam($teamMap,'contacts','contacts_id');
unset($map['team_id']); unset($requestMap['team_id']);
$map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap;
} else { } else {
$map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap; $map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap;
} }
//高级筛选 //高级筛选
$map = advancedQuery($map, 'crm', 'contacts', 'index'); $map = advancedQuery($map, 'crm', 'contacts', 'index');
//权限 //权限
if (!$partMap) {
$a = 'index'; $a = 'index';
if ($is_excel) $a = 'excelExport'; if ($is_excel) $a = 'excelExport';
$authMap = []; $authMap = [];
$auth_user_ids = $userModel->getUserByPer('crm', 'contacts', $a); $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])) { if (!is_array($map['contacts.owner_user_id'][1])) {
$map['contacts.owner_user_id'][1] = [$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'] . ',%')); ->whereOr('contacts.rw_user_id', array('like', '%,' . $authMapData['user_id'] . ',%'));
}; };
} }
}
//联系人商机 //联系人商机

@ -93,12 +93,12 @@ class Contract extends Common
}; };
} }
$partMap = []; $partMap = [];
//优先级:普通筛选>高级筛选>场景 $teamMap=$requestMap['team_id'];
if ($requestMap['team_id']) { //团队成员 高级筛选
//相关团队查询 if($teamMap){
$map = $requestMap; $partMap= advancedQueryFormatForTeam($teamMap,'contract','contract_id');
$partMap= advancedQueryFormatForTeam($requestMap,'crm_contract','contract_id'); unset($requestMap['team_id']);
unset($map['team_id']); $map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap;
} else { } else {
$map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap; $map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap;
} }
@ -106,11 +106,11 @@ class Contract extends Common
$map = advancedQuery($map, 'crm', 'contract', 'index'); $map = advancedQuery($map, 'crm', 'contract', 'index');
$order = ['contract.update_time desc']; $order = ['contract.update_time desc'];
$authMap = []; $authMap = [];
if (!$partMap) {
$a = 'index'; $a = 'index';
if ($is_excel) $a = 'excelExport'; if ($is_excel) $a = 'excelExport';
$auth_user_ids = $userModel->getUserByPer('crm', 'contract', $a); $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])) { if (!is_array($map['contract.owner_user_id'][1])) {
$map['contract.owner_user_id'][1] = [$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判断 //合同签约人 | 与高级筛选冲突加一个is_array判断
if ($map['contract.order_user_id'] && !is_array($map['contract.order_user_id'][1])) { 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].',%']; $map['contract.order_user_id'] = ['like','%,'.$map['contract.order_user_id'][1].',%'];

@ -59,7 +59,6 @@ class Customer extends Common
$getCount = $request['getCount']; $getCount = $request['getCount'];
$otherMap = $request['otherMap']; $otherMap = $request['otherMap'];
$overdue = $request['overdue']; // 待办事项下需联系客户(逾期) $overdue = $request['overdue']; // 待办事项下需联系客户(逾期)
# 需要过滤的参数 # 需要过滤的参数
$unsetRequest = ['scene_id','search','user_id','is_excel','action','order_field','order_type','is_remind','getCount','type','otherMap','poolId','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) { foreach ($unsetRequest as $v) {
@ -98,10 +97,12 @@ class Customer extends Common
# 优先级:普通筛选 > 高级筛选 > 场景 # 优先级:普通筛选 > 高级筛选 > 场景
$map = []; $map = [];
$partMap = []; $partMap = [];
$teamMap=$requestMap['team_id'];
//团队成员 高级筛选 //团队成员 高级筛选
if($requestMap['team_id']){ if($teamMap){
$partMap= advancedQueryFormatForTeam($requestMap,'crm_customer','customer_id'); $partMap= advancedQueryFormatForTeam($teamMap,'customer','');
unset($map['team_id']); unset($requestMap['team_id']);
$map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap;
}else{ }else{
$map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap; $map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap;
@ -123,12 +124,11 @@ class Customer extends Common
# 权限 # 权限
$authMap = []; $authMap = [];
if (!$partMap) {
$a = 'index'; $a = 'index';
if ($is_excel) $a = 'excelExport'; if ($is_excel) $a = 'excelExport';
$auth_user_ids = $userModel->getUserByPer('crm', 'customer', $a); $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])) { if (!is_array($map['customer.owner_user_id'][1])) {
$map['customer.owner_user_id'][1] = [$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'); // 列表展示字段 $indexField = $fieldModel->getIndexField('crm_customer', $user_id, 1) ? : array('name'); // 列表展示字段
$userField = $fieldModel->getFieldByFormType('crm_customer', 'user'); // 人员类型 $userField = $fieldModel->getFieldByFormType('crm_customer', 'user'); // 人员类型
$structureField = $fieldModel->getFieldByFormType('crm_customer', 'structure'); // 部门类型 $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的别名字段) # 处理人员和部门类型的排序报错问题(前端传来的是包含_name的别名字段)
$temporaryField = str_replace('_name', '', $order_field); $temporaryField = str_replace('_name', '', $order_field);
if (in_array($temporaryField, $userField) || in_array($temporaryField, $structureField)) { if (in_array($temporaryField, $userField) || in_array($temporaryField, $structureField)) {
@ -232,9 +224,7 @@ class Customer extends Common
->limit($request['offset'], $request['length']) ->limit($request['offset'], $request['length'])
->field($indexField) ->field($indexField)
->orderRaw($order) ->orderRaw($order)
// ->fetchSql()
->select(); ->select();
$readAuthIds = $userModel->getUserByPer('crm', 'customer', 'read'); $readAuthIds = $userModel->getUserByPer('crm', 'customer', 'read');
$updateAuthIds = $userModel->getUserByPer('crm', 'customer', 'update'); $updateAuthIds = $userModel->getUserByPer('crm', 'customer', 'update');
$deleteAuthIds = $userModel->getUserByPer('crm', 'customer', 'delete'); $deleteAuthIds = $userModel->getUserByPer('crm', 'customer', 'delete');
@ -255,24 +245,10 @@ class Customer extends Common
$field_list = $fieldModel->getIndexFieldConfig('crm_customer', $user_id); $field_list = $fieldModel->getIndexFieldConfig('crm_customer', $user_id);
$field_list = array_column($field_list, 'field'); $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); $poolDays = $this->getPoolDay($customer_id_list);
# 处理数据
$list=getFieldData($list,'crm_customer',$user_id);
# 整理数据 # 整理数据
foreach ($list AS $k => $v) { 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]['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'] : ''; $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; $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; 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; $pool_id = !empty($param['pool_id']) ? $param['pool_id'] : 0;

@ -86,12 +86,12 @@ class Receivables extends Common
} }
$partMap = []; $partMap = [];
//优先级:普通筛选>高级筛选>场景 //优先级:普通筛选>高级筛选>场景
//优先级:普通筛选>高级筛选>场景 $teamMap=$requestMap['team_id'];
if ($requestMap['team_id']) { //团队成员 高级筛选
//相关团队查询 if($teamMap){
$map = $requestMap; $partMap= advancedQueryFormatForTeam($teamMap,'receivables','');
$partMap= advancedQueryFormatForTeam($requestMap,'crm_receivables','receivables_id'); unset($requestMap['team_id']);
unset($map['team_id']); $map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap;
} else { } else {
$map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap; $map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap;
} }
@ -100,9 +100,9 @@ class Receivables extends Common
//权限 //权限
$authMap = []; $authMap = [];
if (!$partMap) {
$auth_user_ids = $userModel->getUserByPer('crm', 'receivables', 'index'); $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])) { if (!is_array($map['receivables.owner_user_id'][1])) {
$map['receivables.owner_user_id'][1] = [$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'); $indexField = $fieldModel->getIndexField('crm_receivables', $user_id, 1) ?: array('number');
//人员类型 //人员类型

@ -16,6 +16,7 @@ use think\Validate;
class ReceivablesPlan extends Common class ReceivablesPlan extends Common
{ {
use FieldVerificationTrait;
/** /**
* 为了数据库的整洁同时又不影响Model和Controller的名称 * 为了数据库的整洁同时又不影响Model和Controller的名称
* 我们约定每个模块的数据表都加上相同的前缀比如CRM模块用crm作为数据表前缀 * 我们约定每个模块的数据表都加上相同的前缀比如CRM模块用crm作为数据表前缀
@ -162,19 +163,20 @@ class ReceivablesPlan extends Common
->join('__CRM_CUSTOMER__ customer', 'receivables_plan.customer_id = customer.customer_id', 'LEFT') ->join('__CRM_CUSTOMER__ customer', 'receivables_plan.customer_id = customer.customer_id', 'LEFT')
->join('__CRM_RECEIVABLES__ receivables', 'receivables_plan.plan_id = receivables.plan_id', 'LEFT') ->join('__CRM_RECEIVABLES__ receivables', 'receivables_plan.plan_id = receivables.plan_id', 'LEFT')
->limit($request['offset'], $request['length']) ->limit($request['offset'], $request['length'])
->field(array_merge($indexField, [ // ->field(array_merge($indexField, [
'customer.name' => 'customer_name', // 'customer.name' => 'customer_name',
'receivables.receivables_id' => 'receivables_id', // 'receivables.receivables_id' => 'receivables_id',
'receivables.check_status' => 'check_status', // 'receivables.check_status' => 'check_status',
'contract.num ' => 'contract_name', // 'contract.num ' => 'contract_name',
'ifnull(SUM(receivables_plan.money), 0)' => 'done_money',//计划回款总金额 // 'ifnull(SUM(receivables_plan.money), 0)' => 'done_money',//计划回款总金额
'(ifnull(SUM(receivables.money), 0)-SUM( real_money))' => 'un_money',//未回款总金额 // '(ifnull(SUM(receivables.money), 0)-SUM( real_money))' => 'un_money',//未回款总金额
'SUM(real_money) AS real_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($map)
->where($sceneMap) ->where($sceneMap)
->where($whereData) ->where($whereData)
->group('receivables_plan.contract_id') // ->group('receivables_plan.contract_id')
->orderRaw($order) ->orderRaw($order)
->select(); ->select();
$grantData = getFieldGrantData($user_id); $grantData = getFieldGrantData($user_id);

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

@ -15,6 +15,10 @@ return [
'admin/install/step2' => ['admin/install/step2', ['method' => 'GET']], 'admin/install/step2' => ['admin/install/step2', ['method' => 'GET']],
'admin/install/step3' => ['admin/install/step3', ['method' => 'GET']], 'admin/install/step3' => ['admin/install/step3', ['method' => 'GET']],
'admin/install/step4' => ['admin/install/step4', ['method' => 'POST|AJAX']], '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/step5' => ['admin/install/step5', ['method' => 'GET']],
'admin/install/step6' => ['admin/install/step6', ['method' => 'GET']], 'admin/install/step6' => ['admin/install/step6', ['method' => 'GET']],
'admin/install/progress' => ['admin/install/progress', ['method' => 'POST']], 'admin/install/progress' => ['admin/install/progress', ['method' => 'POST']],
@ -367,6 +371,18 @@ return [
'admin/market/getField' => ['admin/market/getField', ['method' => 'POST']], 'admin/market/getField' => ['admin/market/getField', ['method' => 'POST']],
//【市场活动】市场活动自定义字段表单 //【市场活动】市场活动自定义字段表单
'admin/market/updateFields' => ['admin/market/updateFields', ['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路由
'__miss__' => 'admin/base/miss', '__miss__' => 'admin/base/miss',
]; ];

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

@ -521,6 +521,23 @@ CREATE TABLE `5kcrm_admin_login_record` (
-- Records of 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 -- Table structure for 5kcrm_admin_menu
-- ---------------------------- -- ----------------------------

@ -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 '部门ID0为全部',
`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;

File diff suppressed because one or more lines are too long

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

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

File diff suppressed because it is too large Load Diff

@ -49,7 +49,7 @@ var rules = {
wkcode: { wkcode: {
required: false, required: false,
regexp: null, regexp: null,
label: '序列号' label: ''
}, },
}; };
@ -84,14 +84,52 @@ $('.next').click(function () {
async: true, async: true,
timeout: 120000, timeout: 120000,
success: function (result) { 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') { if (result.code == '200') {
Promise.all([step7,step8,step10,step11]).then(res=>{
const [step7Res,step8Res,step10Res,step11Res] =res
})
localStorage.clear(); localStorage.clear();
window.location = 'step5.html'; window.location = 'step5.html';
} else if (result.code == '400') { } else if (result.code == '400') {
// alert(result.error); alert(result.error);
window.location.href = 'step6.html'; window.location.href = 'step6.html';
} else { } else {
// alert(result.error); alert(result.error);
window.location.href = 'step6.html'; window.location.href = 'step6.html';
} }
}, },
@ -99,6 +137,7 @@ $('.next').click(function () {
window.location.href = 'step6.html'; window.location.href = 'step6.html';
} }
}); });
}) })
} }
}); });

Loading…
Cancel
Save