编辑角色格式调整

main
limu 1 year ago
parent 1a9a6e8f3a
commit 902b7c9bc4
  1. 10
      app/common/repositories/user/UserPartnerRepository.php
  2. 2
      app/controller/admin/user/User.php

@ -73,10 +73,16 @@ class UserPartnerRepository extends BaseRepository
public function changePartnerForm($uid) public function changePartnerForm($uid)
{ {
/** @var UserLabelRepository $make */ /** @var UserLabelRepository $make */
$list = $this->dao->getAll($uid)->column('partner_id'); $list = $this->dao->getAll($uid)->column('partner_id') ?? [];
$data = ['partner_id' => $list];
return Elm::createForm(Route::buildUrl('systemUserChangePartner', compact('uid'))->build(), [
Elm::selectMultiple('partner_id', '用户合作人角色')->options(function () {
$partnerForm = new PartnerDao(); $partnerForm = new PartnerDao();
$option = $partnerForm->getAll(); $option = $partnerForm->getAll();
return compact('list', 'option'); return $option;
}),
])->setTitle('编辑合作人角色')->formData($data);
//return compact('list', 'option');
} }
public function editPartner(int $uid, array $partner_id = []) public function editPartner(int $uid, array $partner_id = [])

@ -605,7 +605,7 @@ class User extends BaseController
{ {
if (!$this->repository->exists($id)) if (!$this->repository->exists($id))
return app('json')->fail('数据不存在'); return app('json')->fail('数据不存在');
return app('json')->success($partnerRepository->changePartnerForm($id)); return app('json')->success(formToData($partnerRepository->changePartnerForm($id)));
} }
public function changePartner(PartnerRepository $partnerRepository,UserPartnerRepository $userPartnerRepository) public function changePartner(PartnerRepository $partnerRepository,UserPartnerRepository $userPartnerRepository)

Loading…
Cancel
Save