1
0
Fork 0
master
panliang 2023-08-30 13:45:45 +08:00
parent 9f4372c581
commit 87a073b070
7 changed files with 45 additions and 13 deletions

View File

@ -4,6 +4,7 @@ namespace App\Admin;
use Slowlyo\OwlAdmin\Renderers\BaseRenderer;
use Slowlyo\OwlAdmin\Renderers\WangEditor;
use Slowlyo\OwlAdmin\Models\AdminUser;
class Components extends BaseRenderer
{
@ -119,14 +120,13 @@ class Components extends BaseRenderer
return amisMake()->SwitchControl();
}
public function enableControl($name = 'is_enable', $label = '状态', $mode = 'horizontal')
public function adminUserSelectControl()
{
return amisMake()
->SwitchControl()
->name($name)
->label($label)
->mode($mode)
->onText(__('admin.extensions.status_map.enabled'))
->offText(__('admin.extensions.status_map.disabled'));
$options = AdminUser::get();
return amisMake()->SelectControl()
->options($options)
->searchable()
->valueField('id')
->labelField('name');
}
}

View File

@ -49,7 +49,7 @@ class HomeController extends AdminController
return $this->response()->success($page);
}
protected function upload($type = 'file')
{
$file = request()->file('file');

View File

@ -42,7 +42,7 @@ class BaseService extends AdminService
$query->filter(request()->input(), $filter);
}
return $query->orderByDesc($model->getUpdatedAtColumn() ?? $model->getKeyName());
return $query->orderByDesc($model->getKeyName());
}
public function list()
@ -89,6 +89,17 @@ class BaseService extends AdminService
return $model->update($data);
}
public function delete(string $ids): mixed
{
$id = explode(',', $ids);
$result = $this->preDelete($id);
if ($result !== true) {
$this->setError($validate);
return false;
}
return $this->query()->whereIn($this->primaryKey(), $id)->delete();
}
/**
* 处理表单数据
*
@ -111,4 +122,15 @@ class BaseService extends AdminService
{
return true;
}
/**
* 删除的前置方法
*
* @param array $ids 主键id
* @return mixed true: 继续后续操作, string: 中断操作, 返回错误提示
*/
public function preDelete(array $ids)
{
return true;
}
}

View File

@ -24,8 +24,15 @@ Route::group([
], function (Router $router) {
$router->get('keywords/tree-list', '\App\Admin\Controllers\KeywordsController@getTreeList')->name('api.keywords.tree-list');
$router->get('keywords/list', '\App\Admin\Controllers\KeywordsController@getList')->name('api.keywords.get_list');
$router->get('category/content', '\App\Admin\Controllers\CategoryController@getContent')->name('api.category.content');
});
// 字典表
$router->resource('keywords', \App\Admin\Controllers\KeywordsController::class)->names('admin.keywords');
// 分类管理
$router->resource('category', \App\Admin\Controllers\CategoryController::class)->names('admin.category');
// 病人管理
$router->resource('patient', \App\Admin\Controllers\PatientController::class)->names('admin.patient');
// 病历管理
$router->resource('record', \App\Admin\Controllers\PatientRecordController::class)->names('admin.patient_record');
});

View File

@ -109,7 +109,7 @@ return [
|
*/
'faker_locale' => 'en_US',
'faker_locale' => 'zh_CN',
/*
|--------------------------------------------------------------------------

View File

@ -19,7 +19,10 @@ class AdminMenuSeeder extends Seeder
// 图标: https://iconpark.oceanengine.com/official
$menus = [
['title' => '主页', 'icon' => 'icon-park:home-two', 'url' => '/dashboard', 'is_home' => 1, 'order' => 1],
['title' => '系统管理', 'icon' => 'icon-park:setting', 'url' => '/system', 'order' => 7, 'children' => [
['title' => '分类管理', 'icon' => 'icon-park:all-application', 'url' => '/category', 'order' => 2],
['title' => '病人管理', 'icon' => 'icon-park:peoples-two', 'url' => '/patient', 'order' => 3],
['title' => '病历管理', 'icon' => 'icon-park:newspaper-folding', 'url' => '/record', 'order' => 4],
['title' => '系统管理', 'icon' => 'icon-park:setting', 'url' => '/system', 'order' => 5, 'children' => [
['title' => '用户管理', 'icon' => 'icon-park:people-plus', 'url' => '/system/admin_users', 'order' => 1],
['title' => '角色管理', 'icon' => 'icon-park:people-plus-one', 'url' => '/system/admin_roles', 'order' => 2],
['title' => '权限管理', 'icon' => 'icon-park:key-one', 'url' => '/system/admin_permissions', 'order' => 3],

View File

@ -19,7 +19,7 @@ class KeywordSeeder extends Seeder
Keyword::truncate();
$list = [
['key' => 'treat_type', 'name' => '诊疗类别', 'children' => [
['key' => 'treat_head', 'name' => '头疗', 'content' => '<p>按摩意见:</p><p>服务意见:</p><p>效果意见:</p>'],
['key' => 'treat_head', 'name' => '头疗', 'content' => '按摩意见:服务意见:效果意见:'],
['key' => 'treat_normal', 'name' => '看病', 'content' => ''],
]]
];