更新
This commit is contained in:
parent
b8f62a12c2
commit
99e9ed7e8b
@ -51,6 +51,7 @@ class TaskSchedulingController extends BaseAdminController
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
return $this->fail('暂未开放');
|
||||
$params = (new TaskSchedulingValidate())->post()->goCheck('add');
|
||||
$params['create_user_id']=$this->adminId;
|
||||
$result = TaskSchedulingLogic::add($params);
|
||||
@ -69,6 +70,7 @@ class TaskSchedulingController extends BaseAdminController
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
return $this->fail('暂未开放');
|
||||
$params = (new TaskSchedulingValidate())->post()->goCheck('edit');
|
||||
$result = TaskSchedulingLogic::edit($params);
|
||||
if (true === $result) {
|
||||
|
@ -18,7 +18,8 @@ namespace app\adminapi\lists\task_scheduling;
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\task_scheduling\TaskScheduling;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\Company;
|
||||
|
||||
/**
|
||||
* 任务公司排期列表
|
||||
@ -38,7 +39,7 @@ class TaskSchedulingLists extends BaseAdminDataLists implements ListsSearchInter
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['create_user_id', 'template_id', 'company_id', 'type', 'status'],
|
||||
'=' => ['create_user_id', 'template_id', 'company_id', 'company_type', 'status'],
|
||||
];
|
||||
}
|
||||
|
||||
@ -54,9 +55,21 @@ class TaskSchedulingLists extends BaseAdminDataLists implements ListsSearchInter
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
if(isset($params['company_id']) && $params['company_id']!=''){
|
||||
$arr= Company::where('company_name','like','%'.$params['company_id'].'%')->column('id');
|
||||
if($arr){
|
||||
$where[]=['party_a|party_b','in',$arr];
|
||||
}
|
||||
}
|
||||
if(isset($params['area_manager']) && $params['area_manager']!=''){
|
||||
$arr= Admin::where('name','like','%'.$params['area_manager'].'%')->column('id');
|
||||
if($arr){
|
||||
$where[]=['area_manager','in',$arr];
|
||||
}
|
||||
}
|
||||
return TaskScheduling::where($this->searchWhere)
|
||||
->with(['admin','data_type','template','company'])
|
||||
->field(['id', 'create_user_id', 'template_id', 'company_id', 'type', 'status'])
|
||||
->with(['admin','company','company_type_name'])
|
||||
->field(['id', 'create_user_id', 'template_id', 'company_id', 'company_type', 'status'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
|
@ -25,6 +25,7 @@ use think\facade\Db;
|
||||
use app\adminapi\validate\CompanyValidate;
|
||||
use app\api\controller\JunziqianController;
|
||||
use app\api\logic\SmsLogic;
|
||||
use app\common\model\task_scheduling\TaskScheduling;
|
||||
use app\common\service\FileService;
|
||||
use think\facade\Config;
|
||||
|
||||
@ -78,7 +79,7 @@ class CompanyLogic extends BaseLogic
|
||||
$defaultAvatar = config('project.default_image.admin_avatar');
|
||||
$admin=$arr;
|
||||
$admin['id_card']=$params['id_card'];
|
||||
$admin['area_manager']=$params['area_manager'];
|
||||
$admin['area_manager']=$params['area_manager'] ?? 0;
|
||||
$admin['sex']=$params['sex'];
|
||||
$admin['name']=$params['master_name'];
|
||||
$admin['account']=$params['master_phone'];
|
||||
@ -98,6 +99,13 @@ class CompanyLogic extends BaseLogic
|
||||
$admin['phone']=$params['master_phone'];
|
||||
$user_id=User::strict(false)->insertGetId($admin);
|
||||
Company::where('id',$data['id'])->update(['admin_id'=>$admin_id,'user_id'=>$user_id]);
|
||||
|
||||
$scheduling=[
|
||||
'create_user_id'=>$params['area_manager'] ?? 0,
|
||||
'company_id'=>$data['id'],
|
||||
'company_type'=>$params['company_type'],
|
||||
];
|
||||
TaskScheduling::create($scheduling);
|
||||
// if ($level_one > 0) {
|
||||
// $contractId = self::contract($data['id'], $params);
|
||||
// }
|
||||
|
@ -38,7 +38,7 @@ class TaskSchedulingLogic extends BaseLogic
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
TaskScheduling::where('company_id', $params['company_id'])
|
||||
try {
|
||||
TaskScheduling::create([
|
||||
'create_user_id' => $params['create_user_id'],
|
||||
|
@ -37,9 +37,9 @@ class TaskScheduling extends BaseModel
|
||||
{
|
||||
return $this->hasOne(Admin::class, 'id', 'create_user_id')->bind(['admin_name'=>'name']);
|
||||
}
|
||||
public function dataType()
|
||||
public function companyTypeName()
|
||||
{
|
||||
return $this->hasOne(DictData::class, 'id', 'type')->bind(['type_name'=>'name']);
|
||||
return $this->hasOne(DictData::class, 'id', 'company_type')->bind(['company_type'=>'name']);
|
||||
}
|
||||
public function template()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user