|
@@ -801,6 +801,7 @@ class Contract extends Base {
|
|
|
if (isset($ids)) {
|
|
if (isset($ids)) {
|
|
|
$wheres['id'] = array('in', $ids);
|
|
$wheres['id'] = array('in', $ids);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
//导出全部
|
|
//导出全部
|
|
|
if (isset($isall)) {
|
|
if (isset($isall)) {
|
|
|
if ($isall == 3) {
|
|
if ($isall == 3) {
|
|
@@ -810,6 +811,7 @@ class Contract extends Base {
|
|
|
//0:全部 1:我负责的 2:下属负责的 3:今日待跟进 4:今日已跟进 5:从未跟进的
|
|
//0:全部 1:我负责的 2:下属负责的 3:今日待跟进 4:今日已跟进 5:从未跟进的
|
|
|
$type = input('type',0);
|
|
$type = input('type',0);
|
|
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
|
|
|
|
+
|
|
|
switch($type){
|
|
switch($type){
|
|
|
case 1:
|
|
case 1:
|
|
|
$staff = Staff::info();
|
|
$staff = Staff::info();
|
|
@@ -861,22 +863,29 @@ class Contract extends Base {
|
|
|
$wheres['owner_staff_id'] = $staff->id;
|
|
$wheres['owner_staff_id'] = $staff->id;
|
|
|
break;
|
|
break;
|
|
|
default:
|
|
default:
|
|
|
- $wheres['owner_staff_id'] = array('in',Staff::getMyStaffIds());
|
|
|
|
|
|
|
+ if(empty($wheres)){
|
|
|
|
|
+ $wheres['owner_staff_id'] = array('in',Staff::getMyStaffIds());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ unset($wheres['owner_staff_id']);
|
|
|
$list = $this->model->with([
|
|
$list = $this->model->with([
|
|
|
- 'customer',
|
|
|
|
|
|
|
+ 'CustomerInfo',
|
|
|
'orderStaff',
|
|
'orderStaff',
|
|
|
'contacts',
|
|
'contacts',
|
|
|
'ownerStaff','contractOther',
|
|
'ownerStaff','contractOther',
|
|
|
])->where($where)->where($wheres)->order($sort, $order)->select();
|
|
])->where($where)->where($wheres)->order($sort, $order)->select();
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
$list = collection($list)->toArray();
|
|
$list = collection($list)->toArray();
|
|
|
|
|
+// dump($list);die;
|
|
|
|
|
|
|
|
if (!$list) {
|
|
if (!$list) {
|
|
|
$this->error('无导出数据');
|
|
$this->error('无导出数据');
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
$title = [
|
|
$title = [
|
|
|
'序号',
|
|
'序号',
|
|
|
'客户名称',
|
|
'客户名称',
|
|
@@ -892,20 +901,35 @@ class Contract extends Base {
|
|
|
foreach ($dataValue as $val) {
|
|
foreach ($dataValue as $val) {
|
|
|
$title[] = $val['config']['label'];
|
|
$title[] = $val['config']['label'];
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
foreach ($list as $k => $v) {
|
|
foreach ($list as $k => $v) {
|
|
|
if($v['contract_other']){//其他客户
|
|
if($v['contract_other']){//其他客户
|
|
|
$other=$v['contract_other']['otherdata'];
|
|
$other=$v['contract_other']['otherdata'];
|
|
|
$other=json_decode($other,true);
|
|
$other=json_decode($other,true);
|
|
|
$v = array_merge($v, $other);
|
|
$v = array_merge($v, $other);
|
|
|
}
|
|
}
|
|
|
|
|
+ $customer_name = Db::name('qingdong_customer')->where('id', $v['customer_id'])->value('name');
|
|
|
|
|
+ $contacts_name = Db::name('qingdong_contacts')->where('id', $v['contacts_id'])->value('name');
|
|
|
|
|
+ $contacts_name = Db::name('qingdong_contacts')->where('id', $v['contacts_id'])->value('name');
|
|
|
|
|
+ $owner_staffs_list = Db::name('qingdong_staff')->where( 'id in ('.$v['owner_staff_id'].")")->field('name')->select();
|
|
|
|
|
+ $owner_staffs_arr = array_column($owner_staffs_list,'name');
|
|
|
|
|
+ $owner_staffs_str = implode('/',$owner_staffs_arr);
|
|
|
$field = array(
|
|
$field = array(
|
|
|
$v['id'],
|
|
$v['id'],
|
|
|
- $v['customer']['name'],
|
|
|
|
|
- $v['contacts']['name']??'',
|
|
|
|
|
|
|
+ $customer_name,
|
|
|
|
|
+ $contacts_name,
|
|
|
$v['order_staff']['name']??'',
|
|
$v['order_staff']['name']??'',
|
|
|
- $v['owner_staff']['name']??'',
|
|
|
|
|
- $v['createtime'],
|
|
|
|
|
|
|
+ $owner_staffs_str,
|
|
|
|
|
+ date('Y-m-d H:i:s',$v['createtime']),
|
|
|
);
|
|
);
|
|
|
|
|
+// $field = array(
|
|
|
|
|
+// $v['id'],
|
|
|
|
|
+// $v['customer']['name'],
|
|
|
|
|
+// $v['contacts']['name']??'',
|
|
|
|
|
+// $v['order_staff']['name']??'',
|
|
|
|
|
+// $v['owner_staff']['name']??'',
|
|
|
|
|
+// date('Y-m-d H:i:s',$v['createtime']),
|
|
|
|
|
+// );
|
|
|
foreach ($dataValue as $val) {
|
|
foreach ($dataValue as $val) {
|
|
|
if ($val['component'] == 'uploadImage' || $val['component'] == 'uploadFile') {
|
|
if ($val['component'] == 'uploadImage' || $val['component'] == 'uploadFile') {
|
|
|
$field[] = $v[$val['id'] . '_str'] ?? '';
|
|
$field[] = $v[$val['id'] . '_str'] ?? '';
|