|
|
@ -88,6 +88,19 @@ class CustomerCheck extends Common
|
|
|
|
return $data;
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$indexField = $fieldModel->getIndexField('crm_customer', $user_id, 1) ?: array('name'); // 列表展示字段
|
|
|
|
|
|
|
|
$userField = $fieldModel->getFieldByFormType('crm_customer', 'user'); // 人员类型
|
|
|
|
|
|
|
|
$structureField = $fieldModel->getFieldByFormType('crm_customer', 'structure'); // 部门类型
|
|
|
|
|
|
|
|
# 处理人员和部门类型的排序报错问题(前端传来的是包含_name的别名字段)
|
|
|
|
|
|
|
|
$temporaryField = str_replace('_name', '', $order_field);
|
|
|
|
|
|
|
|
if (in_array($temporaryField, $userField) || in_array($temporaryField, $structureField)) {
|
|
|
|
|
|
|
|
$order_field = $temporaryField;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$customerField = '';
|
|
|
|
|
|
|
|
foreach ($indexField as $k => $v) {
|
|
|
|
|
|
|
|
$customerField += 'customer.' + $v;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$list = db('crm_customer_check')
|
|
|
|
$list = db('crm_customer_check')
|
|
|
|
->alias('customer_check')
|
|
|
|
->alias('customer_check')
|
|
|
|
->join('__CRM_CUSTOMER__ customer', 'customer_check.customer_id = customer.customer_id', 'LEFT')
|
|
|
|
->join('__CRM_CUSTOMER__ customer', 'customer_check.customer_id = customer.customer_id', 'LEFT')
|
|
|
@ -95,7 +108,7 @@ class CustomerCheck extends Common
|
|
|
|
->where($partMap)
|
|
|
|
->where($partMap)
|
|
|
|
->where($dealtWhere)
|
|
|
|
->where($dealtWhere)
|
|
|
|
->limit($request['offset'], $request['length'])
|
|
|
|
->limit($request['offset'], $request['length'])
|
|
|
|
->field('customer_check.*,customer.name as name')
|
|
|
|
->field('customer_check.*,customer.name as name'+$customerField)
|
|
|
|
->orderRaw($order)
|
|
|
|
->orderRaw($order)
|
|
|
|
->select();
|
|
|
|
->select();
|
|
|
|
|
|
|
|
|
|
|
|