2024-04-26 21:54:49 +08:00

123 lines
4.3 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\consult_basic;
use app\common\model\auth\Admin;
use app\common\model\BaseModel;
use app\common\model\dept\Dept;
use app\common\model\dict\DictData;
use app\common\model\marketing\MarketingContract;
use app\common\model\marketing\MarketingCustom;
use think\model\concern\SoftDelete;
/**
* 基本信息模型
* Class ConsultProject
* @package app\common\model\consult_basic
*/
class ConsultProject extends BaseModel
{
use SoftDelete;
protected $name = 'consult_project';
protected $deleteTime = 'delete_time';
public function getIndustryTextAttr($value,$data){
$dict = DictData::where('type_value','supervision_project_industry')->column('name','value');
return !empty($data['industry']) ? $dict[$data['industry']] : '';
}
public function getNatureTextAttr($value,$data){
$dict = DictData::where('type_value','supervision_project_nature')->column('name','value');
return !empty($data['nature']) ? $dict[$data['nature']] : '';
}
public function getBuildAreaTextAttr($value,$data){
$dict = DictData::where('type_value','supervision_project_build_area')->column('name','value');
return !empty($data['build_area']) ? $dict[$data['build_area']] : '';
}
public function getProjectLevelTextAttr($value,$data){
$dict = DictData::where('type_value','supervision_project_level')->column('name','value');
return !empty($data['project_level']) ? $dict[$data['project_level']] : '';
}
public function getEngineeringStatusTextAttr($value,$data){
$dict = DictData::where('type_value','supervision_project_status')->column('name','value');
return !empty($data['engineering_status']) ? $dict[$data['engineering_status']] : '';
}
public function getConsultTypeTextAttr($value,$data){
$dict = DictData::where('type_value','consult_type')->column('name','value');
return !empty($data['consult_type']) ? $dict[$data['consult_type']] : '';
}
public function getCompanyNameTextAttr($value,$data){
if($data['company']>0){
return MarketingCustom::where('id',$data['company'])->value('name');
}else{
return 0;
}
}
public function getProjectManagerNameTextAttr($value,$data){
if($data['project_manager']>0){
return Admin::where('id',$data['project_manager'])->value('name');
}
return 0;
}
public function getContractNameTextAttr($value,$data){
if($data['contract']>0){
return MarketingContract::where('id',$data['contract'])->value('contract_name');
}else{
return 0;
}
}
public function getSupervisionDepartmentNameTextAttr($value,$data){
if($data['supervision_department']>0){
return Dept::where('id',$data['supervision_department'])->value('name');
}
return 0;
}
public function getImplementationDepartmentNameTextAttr($value,$data){
if($data['implementation_department']>0){
return Dept::where('id',$data['implementation_department'])->value('name');
}
return 0;
}
public function getProjectArchivingAttr($value){
return !empty($value) ? json_decode($value,true) : '';
}
public function getProjectArchivingTextAttr($value,$data): string
{
$dict = DictData::where('type_value','project_archiving')->whereIn('value',json_decode($data['project_archiving'],true))->column('name');
return !empty($data['project_archiving']) ? implode(',',$dict) : '';
}
public function getConsultStartDateAttr($value): string
{
return !empty($value) ? date('Y-m-d', $value) : '';
}
public function getConsultEndDateAttr($value): string
{
return !empty($value) ? date('Y-m-d', $value) : '';
}
public function getInitiationDateAttr($value): string
{
return !empty($value) ? date('Y-m-d', $value) : '';
}
}