This commit is contained in:
weiz 2024-03-26 18:03:35 +08:00
parent 8fbcb27651
commit 1133e73ec2
2 changed files with 33 additions and 22 deletions

View File

@ -16,6 +16,7 @@
use app\common\logic\BaseLogic; use app\common\logic\BaseLogic;
use app\common\model\dept\Dept;
use app\common\model\financial\FinancialBudgetDocDetail; use app\common\model\financial\FinancialBudgetDocDetail;
use think\facade\Db; use think\facade\Db;
@ -108,6 +109,10 @@
*/ */
public static function detail($params): array public static function detail($params): array
{ {
return FinancialBudgetDocDetail::withoutField('create_time,update_time,delete_time')->findOrEmpty($params['id'])->toArray(); $data = FinancialBudgetDocDetail::withoutField('create_time,update_time,delete_time')->findOrEmpty($params['id']);
$dept = Dept::field('name')->where('id', $data['dept_id'])->findOrEmpty();
$data['dept_name'] = $dept['name'];
$data['type_text'] = $data->type_text;
return $data->toArray();
} }
} }

View File

@ -16,6 +16,7 @@ namespace app\common\model\financial;
use app\common\model\BaseModel; use app\common\model\BaseModel;
use app\common\model\dict\DictData;
use think\model\concern\SoftDelete; use think\model\concern\SoftDelete;
@ -27,8 +28,13 @@ use think\model\concern\SoftDelete;
class FinancialBudgetDocDetail extends BaseModel class FinancialBudgetDocDetail extends BaseModel
{ {
use SoftDelete; use SoftDelete;
protected $name = 'financial_budget_doc_detail'; protected $name = 'financial_budget_doc_detail';
protected $deleteTime = 'delete_time'; protected $deleteTime = 'delete_time';
public function getTypeTextAttr($value, $data)
{
$dict = DictData::where('type_value', 'budget_share_method')->column('name', 'value');
return !empty($data['type']) ? $dict[$data['type']] : '';
}
} }