update
This commit is contained in:
parent
6ea7d4469b
commit
80202c29f6
@ -43,7 +43,7 @@
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'=' => ['business_nature', 'industry_nature', 'fund_sources', 'const_area', 'status'],
|
'=' => ['business_nature', 'industry_nature', 'fund_sources', 'const_area', 'status'],
|
||||||
'%like%' => ['contract_name', 'contract_num', 'part_a', 'part_b'],
|
'%like%' => ['contract_name', 'contract_code', 'part_a', 'part_b'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,15 +15,13 @@
|
|||||||
namespace app\adminapi\logic\cost_project;
|
namespace app\adminapi\logic\cost_project;
|
||||||
|
|
||||||
|
|
||||||
use app\common\model\ApprovalIssuanceAchievementDocuments;
|
|
||||||
use app\common\model\cost_project\CostProject;
|
|
||||||
use app\common\logic\BaseLogic;
|
use app\common\logic\BaseLogic;
|
||||||
use app\common\model\auth\Admin;
|
use app\common\model\ApprovalIssuanceAchievementDocuments;
|
||||||
use app\common\model\cost_project\CostApprovedProject;
|
use app\common\model\cost_project\CostApprovedProject;
|
||||||
|
use app\common\model\cost_project\CostProject;
|
||||||
use app\common\model\cost_project\CostProjectPerson;
|
use app\common\model\cost_project\CostProjectPerson;
|
||||||
use app\common\model\DataReception;
|
use app\common\model\DataReception;
|
||||||
use app\common\model\dept\Dept;
|
use app\common\model\dept\Dept;
|
||||||
use app\common\model\dept\Orgs;
|
|
||||||
use app\common\model\GeoCity;
|
use app\common\model\GeoCity;
|
||||||
use app\common\model\GeoProvince;
|
use app\common\model\GeoProvince;
|
||||||
use app\common\model\project_process_management\ApplyWithSeal;
|
use app\common\model\project_process_management\ApplyWithSeal;
|
||||||
@ -71,7 +69,6 @@ class CostProjectLogic extends BaseLogic
|
|||||||
'starting' => !empty($params['starting']) ? strtotime($params['starting']) : 0,
|
'starting' => !empty($params['starting']) ? strtotime($params['starting']) : 0,
|
||||||
'endtime' => !empty($params['endtime']) ? strtotime($params['endtime']) : 0,
|
'endtime' => !empty($params['endtime']) ? strtotime($params['endtime']) : 0,
|
||||||
'jhgq' => $params['jhgq'],
|
'jhgq' => $params['jhgq'],
|
||||||
'org_id' => $params['org_id'],
|
|
||||||
'depar' => $params['depar'],
|
'depar' => $params['depar'],
|
||||||
'principal' => $params['principal'],
|
'principal' => $params['principal'],
|
||||||
'person' => $params['person'] ? json_encode($params['person']) : null,
|
'person' => $params['person'] ? json_encode($params['person']) : null,
|
||||||
@ -125,7 +122,6 @@ class CostProjectLogic extends BaseLogic
|
|||||||
'starting' => !empty($params['starting']) ? strtotime($params['starting']) : 0,
|
'starting' => !empty($params['starting']) ? strtotime($params['starting']) : 0,
|
||||||
'endtime' => !empty($params['endtime']) ? strtotime($params['endtime']) : 0,
|
'endtime' => !empty($params['endtime']) ? strtotime($params['endtime']) : 0,
|
||||||
'jhgq' => $params['jhgq'],
|
'jhgq' => $params['jhgq'],
|
||||||
'org_id' => $params['org_id'],
|
|
||||||
'depar' => $params['depar'],
|
'depar' => $params['depar'],
|
||||||
'principal' => $params['principal'],
|
'principal' => $params['principal'],
|
||||||
'person' => $params['person'] ? json_encode($params['person']) : null,
|
'person' => $params['person'] ? json_encode($params['person']) : null,
|
||||||
@ -152,6 +148,90 @@ class CostProjectLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 获取造价项目台账详情
|
||||||
|
* @param $params
|
||||||
|
* @return array
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2024/02/21 09:23
|
||||||
|
*/
|
||||||
|
public static function detail($params): array
|
||||||
|
{
|
||||||
|
$res = CostProject::with(['contract'])->findOrEmpty($params['id']);
|
||||||
|
$res['person_text'] = $res->person_text;
|
||||||
|
$res['types_text'] = $res->types_text;
|
||||||
|
$res['industry_nature_text'] = $res['contract']->industry_nature_text;
|
||||||
|
$province = GeoProvince::field('province_name')->where('province_code', $res['province'])->findOrEmpty();
|
||||||
|
$city = GeoCity::field('city_name')->where('city_code', $res['city'])->findOrEmpty();
|
||||||
|
$dept = Dept::field('name')->where('id', $res['depar'])->findOrEmpty();
|
||||||
|
$res['province_name'] = $province['province_name'];
|
||||||
|
$res['city_name'] = $city['city_name'];
|
||||||
|
$res['dept_name'] = $dept['name'];
|
||||||
|
return $res->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function datas($name)
|
||||||
|
{
|
||||||
|
$datas = CostProject::where(function ($query) use ($name) {
|
||||||
|
if ($name) {
|
||||||
|
$query->where('project_name', 'like', '%' . $name . '%');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->field(['id', 'project_num', 'project_name'])
|
||||||
|
->order(['id' => 'desc'])
|
||||||
|
->select()
|
||||||
|
->toArray();
|
||||||
|
foreach ($datas as &$item) {
|
||||||
|
$item['projectinfo'] = 'ID:' . $item['id'] . ' / 名称:' . $item['project_name'];
|
||||||
|
}
|
||||||
|
return $datas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function createProject($data)
|
||||||
|
{
|
||||||
|
Db::startTrans();
|
||||||
|
try {
|
||||||
|
$res = CostProject::create([
|
||||||
|
'project_num' => generate_sn(CostProject::class, 'project_num'),
|
||||||
|
'project_name' => $data['project_name'],
|
||||||
|
'contract_id' => $data['contract_id'],
|
||||||
|
'types' => $data['types'],
|
||||||
|
'industry' => $data['industry'],
|
||||||
|
'province' => $data['province'],
|
||||||
|
'city' => $data['city'],
|
||||||
|
'address' => $data['address'],
|
||||||
|
'starting' => $data['starting'],
|
||||||
|
'endtime' => $data['endtime'],
|
||||||
|
'jhgq' => $data['jhgq'],
|
||||||
|
'depar' => $data['depar'],
|
||||||
|
'principal' => $data['principal'],
|
||||||
|
'invest' => $data['invest'],
|
||||||
|
'budget' => $data['budget'],
|
||||||
|
'cost' => $data['cost'],
|
||||||
|
'approval' => $data['approval'],
|
||||||
|
'aunit' => $data['aunit'],
|
||||||
|
'Acontact' => $data['Acontact'],
|
||||||
|
'acontactnum' => $data['acontactnum'],
|
||||||
|
'date' => $data['date'],
|
||||||
|
'generalize' => $data['generalize'],
|
||||||
|
'note' => $data['note'],
|
||||||
|
'remark' => $data['remark'],
|
||||||
|
'annex' => $data['annex']
|
||||||
|
]);
|
||||||
|
if ($data['person_id']) {
|
||||||
|
$arr = [];
|
||||||
|
$person_id = explode(',', $data['person_id']);
|
||||||
|
(new CostProjectPerson)->delete($person_id);
|
||||||
|
foreach ($person_id as $k => $v) {
|
||||||
|
$arr[] = ['cost_project_id' => $data->id, $v];
|
||||||
|
}
|
||||||
|
$arr ?? (new CostProjectPerson)->saveAll($arr);
|
||||||
|
}
|
||||||
|
return $res;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notes 删除造价项目台账
|
* @notes 删除造价项目台账
|
||||||
@ -236,92 +316,4 @@ class CostProjectLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
return CostProject::destroy($params['id']);
|
return CostProject::destroy($params['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @notes 获取造价项目台账详情
|
|
||||||
* @param $params
|
|
||||||
* @return array
|
|
||||||
* @author likeadmin
|
|
||||||
* @date 2024/02/21 09:23
|
|
||||||
*/
|
|
||||||
public static function detail($params): array
|
|
||||||
{
|
|
||||||
$res= CostProject::with(['contract'])->findOrEmpty($params['id']);
|
|
||||||
$res['person_text'] = $res->person_text;
|
|
||||||
$res['types_text'] = $res->types_text;
|
|
||||||
$res['industry_nature_text'] = $res['contract']->industry_nature_text;
|
|
||||||
$province = GeoProvince::field('province_name')->where('province_code',$res['province'])->findOrEmpty();
|
|
||||||
$city = GeoCity::field('city_name')->where('city_code',$res['city'])->findOrEmpty();
|
|
||||||
$org = Orgs::field('name')->where('id',$res['org_id'])->findOrEmpty();
|
|
||||||
$dept = Dept::field('name')->where('id',$res['depar'])->findOrEmpty();
|
|
||||||
$res['province_name'] = $province['province_name'];
|
|
||||||
$res['city_name'] = $city['city_name'];
|
|
||||||
$res['org_name'] = $org['name'];
|
|
||||||
$res['dept_name'] = $dept['name'];
|
|
||||||
return $res->toArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function datas($name)
|
|
||||||
{
|
|
||||||
$datas = CostProject::where(function ($query) use ($name) {
|
|
||||||
if ($name) {
|
|
||||||
$query->where('project_name', 'like', '%' . $name . '%');
|
|
||||||
}
|
|
||||||
})
|
|
||||||
->field(['id', 'project_num', 'project_name'])
|
|
||||||
->order(['id' => 'desc'])
|
|
||||||
->select()
|
|
||||||
->toArray();
|
|
||||||
foreach ($datas as &$item) {
|
|
||||||
$item['projectinfo'] = 'ID:' . $item['id'] . ' / 名称:' . $item['project_name'];
|
|
||||||
}
|
|
||||||
return $datas;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function createProject($data)
|
|
||||||
{
|
|
||||||
Db::startTrans();
|
|
||||||
try {
|
|
||||||
$res = CostProject::create([
|
|
||||||
'project_num' => generate_sn(CostProject::class, 'project_num'),
|
|
||||||
'project_name' => $data['project_name'],
|
|
||||||
'contract_id' => $data['contract_id'],
|
|
||||||
'types' => $data['types'],
|
|
||||||
'industry' => $data['industry'],
|
|
||||||
'province' => $data['province'],
|
|
||||||
'city' => $data['city'],
|
|
||||||
'address' => $data['address'],
|
|
||||||
'starting' => $data['starting'],
|
|
||||||
'endtime' => $data['endtime'],
|
|
||||||
'jhgq' => $data['jhgq'],
|
|
||||||
'depar' => $data['depar'],
|
|
||||||
'principal' => $data['principal'],
|
|
||||||
'invest' => $data['invest'],
|
|
||||||
'budget' => $data['budget'],
|
|
||||||
'cost' => $data['cost'],
|
|
||||||
'approval' => $data['approval'],
|
|
||||||
'aunit' => $data['aunit'],
|
|
||||||
'Acontact' => $data['Acontact'],
|
|
||||||
'acontactnum' => $data['acontactnum'],
|
|
||||||
'date' => $data['date'],
|
|
||||||
'generalize' => $data['generalize'],
|
|
||||||
'note' => $data['note'],
|
|
||||||
'remark' => $data['remark'],
|
|
||||||
'annex' => $data['annex']
|
|
||||||
]);
|
|
||||||
if ($data['person_id']) {
|
|
||||||
$arr = [];
|
|
||||||
$person_id = explode(',', $data['person_id']);
|
|
||||||
(new CostProjectPerson)->delete($person_id);
|
|
||||||
foreach ($person_id as $k => $v) {
|
|
||||||
$arr[] = ['cost_project_id' => $data->id, $v];
|
|
||||||
}
|
|
||||||
$arr ?? (new CostProjectPerson)->saveAll($arr);
|
|
||||||
}
|
|
||||||
return $res;
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ namespace app\common\model\cost_project;
|
|||||||
use app\common\model\auth\Admin;
|
use app\common\model\auth\Admin;
|
||||||
use app\common\model\BaseModel;
|
use app\common\model\BaseModel;
|
||||||
use app\common\model\dict\DictData;
|
use app\common\model\dict\DictData;
|
||||||
|
use app\common\model\marketing\MarketingContract;
|
||||||
use think\model\concern\SoftDelete;
|
use think\model\concern\SoftDelete;
|
||||||
|
|
||||||
|
|
||||||
@ -29,37 +30,43 @@ use think\model\concern\SoftDelete;
|
|||||||
class CostProject extends BaseModel
|
class CostProject extends BaseModel
|
||||||
{
|
{
|
||||||
use SoftDelete;
|
use SoftDelete;
|
||||||
|
|
||||||
protected $name = 'cost_project';
|
protected $name = 'cost_project';
|
||||||
protected $deleteTime = 'delete_time';
|
protected $deleteTime = 'delete_time';
|
||||||
|
|
||||||
public function contract()
|
public function contract()
|
||||||
{
|
{
|
||||||
return $this->hasOne(CostApprovedProject::class, 'id','contract_id');
|
return $this->hasOne(MarketingContract::class, 'id', 'contract_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function CostProjectContract()
|
public function CostProjectContract()
|
||||||
{
|
{
|
||||||
return $this->hasOne(CostProjectContract::class, 'id','contract_id');
|
return $this->hasOne(MarketingContract::class, 'id', 'contract_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTypesTextAttr($value,$data){
|
public function getTypesTextAttr($value, $data)
|
||||||
|
{
|
||||||
$dict = DictData::where('type_value', 'consultation_type')->column('name', 'value');
|
$dict = DictData::where('type_value', 'consultation_type')->column('name', 'value');
|
||||||
return !empty($data['types']) ? $dict[$data['types']] : '';
|
return !empty($data['types']) ? $dict[$data['types']] : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPersonAttr($value){
|
public function getPersonAttr($value)
|
||||||
|
{
|
||||||
return !empty($value) ? json_decode($value, true) : '';
|
return !empty($value) ? json_decode($value, true) : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getStartingAttr($value){
|
public function getStartingAttr($value)
|
||||||
|
{
|
||||||
return !empty($value) ? date('Y-m-d', $value) : '';
|
return !empty($value) ? date('Y-m-d', $value) : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getEndtimeAttr($value){
|
public function getEndtimeAttr($value)
|
||||||
|
{
|
||||||
return !empty($value) ? date('Y-m-d', $value) : '';
|
return !empty($value) ? date('Y-m-d', $value) : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDateAttr($value){
|
public function getDateAttr($value)
|
||||||
|
{
|
||||||
return !empty($value) ? date('Y-m-d', $value) : '';
|
return !empty($value) ? date('Y-m-d', $value) : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user