feat: 分离前端列表
This commit is contained in:
@@ -93,8 +93,11 @@ class FrontTable extends Creator
|
||||
return Str::of(File::get($this->getTableStub()))->replace([
|
||||
$this->table, $this->search, $this->api, $this->paginate, $this->useList
|
||||
], [
|
||||
$this->getTableContent(), $this->getSearchContent(),
|
||||
"'{$this->apiString}'", $this->getPaginateStubContent(), $this->getUseList()
|
||||
$this->getTableContent(),
|
||||
$this->getSearchContent(),
|
||||
$this->apiString,
|
||||
$this->getPaginateStubContent(),
|
||||
$this->getUseList()
|
||||
])->toString();
|
||||
}
|
||||
|
||||
@@ -215,15 +218,7 @@ HTML;
|
||||
*/
|
||||
protected function getPaginateStubContent(): string
|
||||
{
|
||||
return $this->hasPaginate ?
|
||||
File::get(
|
||||
dirname(__DIR__).DIRECTORY_SEPARATOR
|
||||
|
||||
.'stubs'.DIRECTORY_SEPARATOR.'vue'.
|
||||
|
||||
DIRECTORY_SEPARATOR.'paginate.stub'
|
||||
)
|
||||
: '';
|
||||
return $this->hasPaginate ? '<Paginate />' : '';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -232,9 +227,7 @@ HTML;
|
||||
*/
|
||||
protected function getUseList(): string
|
||||
{
|
||||
return $this->hasPaginate ?
|
||||
'const { data, query, search, reset, changePage, changeLimit, loading } = useGetList(api)' :
|
||||
'const { data, query, search, reset, loading } = useGetList(api)';
|
||||
return 'const { data, query, search, reset, loading } = useGetList(api)';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,12 +0,0 @@
|
||||
<div class="pt-2 pb-2 flex justify-end">
|
||||
<el-pagination
|
||||
background
|
||||
layout="total,sizes,prev,pager,next"
|
||||
:current-page="query.page"
|
||||
:page-size="query.limit"
|
||||
@current-change="changePage"
|
||||
@size-change="changeLimit"
|
||||
:total="total"
|
||||
:page-sizes="[1, 10, 20, 30, 50]"
|
||||
/>
|
||||
</div>
|
@@ -1,24 +1,12 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="w-full min-h-0 bg-white dark:bg-regal-dark pl-5 pt-5 pr-5 rounded-lg">
|
||||
<el-form :inline="true">
|
||||
{search}
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="search()">
|
||||
<Icon name="magnifying-glass" class="w-4 mr-1 -ml-1" />
|
||||
搜索
|
||||
</el-button>
|
||||
<el-button @click="reset()">
|
||||
<Icon name="arrow-path" class="w-4 mr-1 -ml-1" />
|
||||
重置
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<Search :search="search" :reset="reset">
|
||||
<template v-slot:body>
|
||||
{search}
|
||||
</template>
|
||||
</Search>
|
||||
<div class="pl-2 pr-2 bg-white dark:bg-regal-dark rounded-lg mt-4">
|
||||
<div class="pt-5 pl-2">
|
||||
<Add @click="show(null)" />
|
||||
</div>
|
||||
<Operate :show="show" />
|
||||
<el-table :data="tableData" class="mt-3" v-loading="loading">
|
||||
{table}
|
||||
<el-table-column label="操作" width="200">
|
||||
@@ -28,8 +16,9 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
{paginate}
|
||||
<Paginate />
|
||||
</div>
|
||||
|
||||
<Dialog v-model="visible" :title="title" destroy-on-close>
|
||||
<Create @close="close" :primary="id" :api="api" />
|
||||
</Dialog>
|
||||
@@ -41,23 +30,18 @@ import { computed, onMounted, ref, watch } from 'vue'
|
||||
import Create from './create.vue'
|
||||
import { useGetList } from '/admin/composables/curd/useGetList'
|
||||
import { useDestroy } from '/admin/composables/curd/useDestroy'
|
||||
import { useEnabled } from '/admin/composables/curd/useEnabled'
|
||||
import { t } from '/admin/support/helper'
|
||||
|
||||
const visible = ref<boolean>(false)
|
||||
const id = ref(null)
|
||||
const api = {api}
|
||||
const title = ref<string>('');
|
||||
const api = '{api}'
|
||||
const title = ref<string>('')
|
||||
|
||||
// const { data, query, search, reset, loading } = useGetList(api)
|
||||
{useList}
|
||||
|
||||
const { destroy, isDeleted } = useDestroy()
|
||||
const { enabled } = useEnabled()
|
||||
|
||||
onMounted(() => search())
|
||||
const { destroy, deleted } = useDestroy()
|
||||
|
||||
const tableData = computed(() => data.value?.data)
|
||||
const total = computed(() => data.value?.total)
|
||||
|
||||
const close = () => {
|
||||
visible.value = false
|
||||
@@ -70,9 +54,9 @@ const show = primary => {
|
||||
visible.value = true
|
||||
}
|
||||
|
||||
watch(isDeleted, function (){
|
||||
// change origin status
|
||||
isDeleted.value = false
|
||||
reset();
|
||||
onMounted(() => {
|
||||
search()
|
||||
|
||||
deleted(reset)
|
||||
})
|
||||
</script>
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Permissions\Enums;
|
||||
|
||||
use Catch\Enums\Enum;
|
||||
|
44
modules/Permissions/Http/Controllers/JobsController.php
Normal file
44
modules/Permissions/Http/Controllers/JobsController.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Permissions\Http\Controllers;
|
||||
|
||||
use Catch\Base\CatchController as Controller;
|
||||
use Modules\Permissions\Models\JobsModel;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class JobsController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
protected readonly JobsModel $model
|
||||
){}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return mixed
|
||||
*/
|
||||
public function index(Request $request): mixed
|
||||
{
|
||||
return $this->model->getList();
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
return $this->model->storeBy($request->all());
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
return $this->model->firstBy($id);
|
||||
}
|
||||
|
||||
public function update($id, Request $request)
|
||||
{
|
||||
return $this->model->updateBy($id, $request->all());
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
return $this->model->deleteBy($id);
|
||||
}
|
||||
}
|
@@ -1,19 +1,19 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Permissions\Http\Controllers;
|
||||
|
||||
use Catch\Base\CatchController as Controller;
|
||||
use Modules\Permissions\Models\RolesModel;
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\Permissions\Http\Requests\RoleRequest;
|
||||
|
||||
|
||||
class RolesController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
protected readonly RolesModel $model
|
||||
){}
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
|
@@ -17,7 +17,7 @@ class RoleRequest extends FormRequest
|
||||
return [
|
||||
'role_name' => sprintf('required|unique:%s,%s,%s', RolesModel::class, 'role_name', $this->get('id')),
|
||||
|
||||
'identify' => sprintf('required|alpha|unique:%s,%s,%s', RolesModel::class, 'role_name', $this->get('id')),
|
||||
'identify' => sprintf('required|alpha|unique:%s,%s,%s', RolesModel::class, 'role_name', $this->get('id')),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -41,4 +41,4 @@ class RoleRequest extends FormRequest
|
||||
'identify.unique' => '角色标识已存在',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
45
modules/Permissions/Models/JobsModel.php
Normal file
45
modules/Permissions/Models/JobsModel.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Permissions\Models;
|
||||
|
||||
use Catch\Base\CatchModel as Model;
|
||||
|
||||
/**
|
||||
* @property $id
|
||||
* @property $job_name
|
||||
* @property $coding
|
||||
* @property $status
|
||||
* @property $sort
|
||||
* @property $description
|
||||
* @property $creator_id
|
||||
* @property $created_at
|
||||
* @property $updated_at
|
||||
* @property $deleted_at
|
||||
*/
|
||||
class JobsModel extends Model
|
||||
{
|
||||
protected $table = 'jobs';
|
||||
|
||||
protected $fillable = [ 'id', 'job_name', 'coding', 'status', 'sort', 'description', 'creator_id', 'created_at', 'updated_at', 'deleted_at' ];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected array $fieldsInList = ['id','job_name','coding','status','sort','description','created_at','updated_at'];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected array $form = ['job_name','coding','status','sort','description'];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public array $searchable = [
|
||||
'job_name' => 'like'
|
||||
];
|
||||
|
||||
|
||||
}
|
@@ -5,7 +5,6 @@ declare(strict_types=1);
|
||||
namespace Modules\Permissions\Models;
|
||||
|
||||
use Catch\Base\CatchModel as Model;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
|
||||
/**
|
||||
* @property $role_name
|
||||
@@ -22,7 +21,7 @@ class RolesModel extends Model
|
||||
{
|
||||
protected $table = 'roles';
|
||||
|
||||
protected $fillable = [ 'id', 'role_name', 'identify', 'parent_id', 'description', 'data_range', 'creator_id', 'created_at', 'updated_at', 'deleted_at' ];
|
||||
protected $fillable = ['id', 'role_name', 'identify', 'parent_id', 'description', 'data_range', 'creator_id', 'created_at', 'updated_at', 'deleted_at'];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
@@ -49,5 +48,4 @@ class RolesModel extends Model
|
||||
{
|
||||
return self::query()->select($this->fieldsInList)->quickSearch()->get()->toTree();
|
||||
}
|
||||
|
||||
}
|
||||
|
42
modules/Permissions/Providers/Installer.php
Normal file
42
modules/Permissions/Providers/Installer.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Permissions\Providers;
|
||||
|
||||
use Catch\Support\Module\Installer as ModuleInstaller;
|
||||
|
||||
class Installer extends ModuleInstaller
|
||||
{
|
||||
protected function info(): array
|
||||
{
|
||||
// TODO: Implement info() method.
|
||||
return [
|
||||
'name' => '权限管理',
|
||||
'path' => 'Permissions',
|
||||
'keywords' => '权限, 角色, 部门',
|
||||
'description' => '权限管理模块',
|
||||
'provider' => PermissionsServiceProvider::class
|
||||
];
|
||||
}
|
||||
|
||||
protected function migration(): string
|
||||
{
|
||||
// TODO: Implement migration() method.
|
||||
return '';
|
||||
}
|
||||
|
||||
protected function seeder(): string
|
||||
{
|
||||
// TODO: Implement seeder() method.
|
||||
return '';
|
||||
}
|
||||
|
||||
protected function requirePackages(): void
|
||||
{
|
||||
// TODO: Implement requirePackages() method.
|
||||
}
|
||||
|
||||
protected function removePackages(): void
|
||||
{
|
||||
// TODO: Implement removePackages() method.
|
||||
}
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('jobs', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('job_name', 50)->comment('岗位名称');
|
||||
$table->string('coding', 30)->nullable()->comment('创建人ID');
|
||||
$table->tinyInteger('status')->default('1')->comment('1 正常 2 停用');
|
||||
$table->integer('sort')->default('1')->comment('排序');
|
||||
$table->string('description', 1000)->nullable()->comment('岗位描述');
|
||||
$table->creatorId();
|
||||
$table->createdAt();
|
||||
$table->updatedAt();
|
||||
$table->deletedAt();
|
||||
|
||||
$table->engine='InnoDB';
|
||||
$table->comment('岗位表');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
}
|
||||
};
|
@@ -2,10 +2,12 @@
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\Permissions\Http\Controllers\RolesController;
|
||||
use Modules\Permissions\Http\Controllers\JobsController;
|
||||
|
||||
Route::prefix('permissions')->group(function () {
|
||||
Route::apiResource('roles', RolesController::class);
|
||||
|
||||
Route::apiResource('roles', RolesController::class);
|
||||
Route::apiResource('jobs', JobsController::class);
|
||||
//next
|
||||
});
|
||||
|
||||
|
62
modules/Permissions/views/jobs/create.vue
Normal file
62
modules/Permissions/views/jobs/create.vue
Normal file
@@ -0,0 +1,62 @@
|
||||
<template>
|
||||
<el-form :model="formData" label-width="120px" ref="form" v-loading="loading" class="pr-4">
|
||||
<el-form-item label="岗位名称" prop="job_name" :rules="[{ required: true, message: '岗位名称必须填写' }]">
|
||||
<el-input v-model="formData.job_name" name="job_name" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="岗位编码" prop="coding">
|
||||
<el-input v-model="formData.coding" name="coding" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-radio-group v-model="formData.status">
|
||||
<el-radio v-for="item in options" :key="item.value" :label="item.value" name="status">{{ item.label }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="sort">
|
||||
<el-input-number v-model="formData.sort" name="sort" :min="1" />
|
||||
</el-form-item>
|
||||
<el-form-item label="岗位描述" prop="description">
|
||||
<el-input v-model="formData.description" name="description" clearable type="textarea" />
|
||||
</el-form-item>
|
||||
<div class="flex justify-end">
|
||||
<el-button type="primary" @click="submitForm(form)">{{ $t('system.confirm') }}</el-button>
|
||||
</div>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useCreate } from '/admin/composables/curd/useCreate'
|
||||
import { useShow } from '/admin/composables/curd/useShow'
|
||||
|
||||
import { onMounted, watch } from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
primary: String | Number,
|
||||
api: String,
|
||||
})
|
||||
|
||||
const emit = defineEmits(['close'])
|
||||
|
||||
const { formData, form, loading, submitForm, isClose } = useCreate(props.api, props.primary)
|
||||
|
||||
formData.value.status = 1
|
||||
formData.value.sort = 1
|
||||
|
||||
watch(isClose, function (value) {
|
||||
if (value) {
|
||||
emit('close')
|
||||
}
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
if (props.primary) {
|
||||
useShow(props.api, props.primary).then(r => {
|
||||
formData.value = r.data
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const options = [
|
||||
{ label: '正常', value: 1 },
|
||||
{ label: '禁用', value: 2 },
|
||||
]
|
||||
</script>
|
68
modules/Permissions/views/jobs/index.vue
Normal file
68
modules/Permissions/views/jobs/index.vue
Normal file
@@ -0,0 +1,68 @@
|
||||
<template>
|
||||
<div>
|
||||
<Search :search="search" :reset="reset">
|
||||
<template v-slot:body>
|
||||
<el-form-item label="岗位名称" prop="job_name">
|
||||
<el-input v-model="query.job_name" name="job_name" clearable />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</Search>
|
||||
<div class="pl-2 pr-2 bg-white dark:bg-regal-dark rounded-lg mt-4">
|
||||
<Operate :show="show" />
|
||||
<el-table :data="tableData" class="mt-3" v-loading="loading">
|
||||
<el-table-column prop="job_name" label="岗位名称" />
|
||||
<el-table-column prop="coding" label="岗位编码" />
|
||||
<el-table-column prop="status" label="状态" />
|
||||
<el-table-column prop="sort" label="排序" />
|
||||
<el-table-column prop="description" label="岗位描述" />
|
||||
<el-table-column label="操作" width="200">
|
||||
<template #default="scope">
|
||||
<Update @click="show(scope.row.id)" />
|
||||
<Destroy @click="destroy(api, scope.row.id)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<Paginate />
|
||||
</div>
|
||||
|
||||
<Dialog v-model="visible" :title="title" destroy-on-close>
|
||||
<Create @close="close" :primary="id" :api="api" />
|
||||
</Dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, onMounted, ref, watch } from 'vue'
|
||||
import Create from './create.vue'
|
||||
import { useGetList } from '/admin/composables/curd/useGetList'
|
||||
import { useDestroy } from '/admin/composables/curd/useDestroy'
|
||||
import { t } from '/admin/support/helper'
|
||||
|
||||
const visible = ref<boolean>(false)
|
||||
const id = ref(null)
|
||||
const api = 'permissions/jobs'
|
||||
const title = ref<string>('')
|
||||
|
||||
// const { data, query, search, reset, loading } = useGetList(api)
|
||||
const { data, query, search, reset, loading } = useGetList(api)
|
||||
const { destroy, deleted } = useDestroy()
|
||||
|
||||
const tableData = computed(() => data.value?.data)
|
||||
|
||||
const close = () => {
|
||||
visible.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
const show = primary => {
|
||||
title.value = primary ? t('system.edit') : t('system.add')
|
||||
id.value = primary
|
||||
visible.value = true
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
search()
|
||||
|
||||
deleted(reset)
|
||||
})
|
||||
</script>
|
@@ -13,6 +13,12 @@ const router: RouteRecordRaw[] = [
|
||||
meta: { title: '角色管理', icon: 'home' },
|
||||
component: () => import('./roles/index.vue'),
|
||||
},
|
||||
{
|
||||
path: 'jobs',
|
||||
name: 'jobs',
|
||||
meta: { title: '岗位管理', icon: 'home' },
|
||||
component: () => import('./jobs/index.vue'),
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
|
@@ -81,6 +81,16 @@ class Users extends Model implements AuthenticatableContract, JWTSubject
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* is super admin
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isSuperAdmin(): bool
|
||||
{
|
||||
return $this->{$this->primaryKey} == config('catch.super_admin');
|
||||
}
|
||||
|
||||
/**
|
||||
* update
|
||||
* @param $id
|
||||
|
@@ -21,17 +21,17 @@ return new class () extends Migration {
|
||||
|
||||
$table->string('email')->comment('邮箱');
|
||||
|
||||
$table->string('avatar')->comment('头像');
|
||||
$table->string('avatar')->nullable()->comment('头像');
|
||||
|
||||
$table->string('remember_token', 1000)->comment('token');
|
||||
$table->string('remember_token', 1000)->nullable()->comment('token');
|
||||
|
||||
$table->integer('creator_id');
|
||||
$table->integer('creator_id')->default(0);
|
||||
|
||||
$table->status();
|
||||
|
||||
$table->string('login_ip')->comment('登录IP');
|
||||
$table->string('login_ip')->nullable()->comment('登录IP');
|
||||
|
||||
$table->integer('login_at')->comment('登录时间');
|
||||
$table->integer('login_at')->default(0)->comment('登录时间');
|
||||
|
||||
$table->createdAt();
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="w-full min-h-0 bg-white dark:bg-regal-dark pl-5 pt-5 pr-5 rounded-lg">
|
||||
<el-form :inline="true">
|
||||
<Search :search="search" :reset="reset">
|
||||
<template v-slot:body>
|
||||
<el-form-item label="用户名">
|
||||
<el-input v-model="query.username" clearable />
|
||||
</el-form-item>
|
||||
@@ -11,22 +11,10 @@
|
||||
<el-form-item label="状态">
|
||||
<Select v-model="query.status" clearable api="status" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="search()">
|
||||
<Icon name="magnifying-glass" class="w-4 mr-1 -ml-1" />
|
||||
搜索
|
||||
</el-button>
|
||||
<el-button @click="reset()">
|
||||
<Icon name="arrow-path" class="w-4 mr-1 -ml-1" />
|
||||
重置
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
</Search>
|
||||
<div class="pl-2 pr-2 bg-white dark:bg-regal-dark rounded-lg mt-4">
|
||||
<div class="pt-5 pl-2">
|
||||
<Add @click="show(null)" />
|
||||
</div>
|
||||
<Operate :show="show" />
|
||||
<el-table :data="tableData" class="mt-3" v-loading="loading">
|
||||
<el-table-column prop="username" label="用户名" width="180" />
|
||||
<el-table-column prop="avatar" label="头像" width="180" />
|
||||
@@ -45,18 +33,7 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pt-2 pb-2 flex justify-end">
|
||||
<el-pagination
|
||||
background
|
||||
layout="total,sizes,prev, pager,next"
|
||||
:current-page="query.page"
|
||||
:page-size="query.limit"
|
||||
@current-change="changePage"
|
||||
@size-change="changeLimit"
|
||||
:total="total"
|
||||
:page-sizes="[10, 20, 30, 50]"
|
||||
/>
|
||||
</div>
|
||||
<Paginate />
|
||||
</div>
|
||||
|
||||
<Dialog v-model="visible" :title="title" destroy-on-close>
|
||||
@@ -70,7 +47,6 @@ import { computed, onMounted, ref, watch } from 'vue'
|
||||
import Create from './create.vue'
|
||||
import { useGetList } from '/admin/composables/curd/useGetList'
|
||||
import { useDestroy } from '/admin/composables/curd/useDestroy'
|
||||
import { useEnabled } from '/admin/composables/curd/useEnabled'
|
||||
import { t } from '/admin/support/helper'
|
||||
|
||||
const visible = ref<boolean>(false)
|
||||
@@ -78,13 +54,10 @@ const id = ref(null)
|
||||
const api = 'users'
|
||||
const title = ref<string>('')
|
||||
|
||||
const { data, query, search, reset, changePage, changeLimit, loading } = useGetList(api)
|
||||
const { destroy, isDeleted } = useDestroy()
|
||||
|
||||
onMounted(() => search())
|
||||
const { data, query, search, reset, loading } = useGetList(api)
|
||||
const { destroy, deleted } = useDestroy()
|
||||
|
||||
const tableData = computed(() => data.value?.data)
|
||||
const total = computed(() => data.value?.total)
|
||||
|
||||
const close = () => {
|
||||
visible.value = false
|
||||
@@ -97,8 +70,9 @@ const show = primary => {
|
||||
visible.value = true
|
||||
}
|
||||
|
||||
watch(isDeleted, function () {
|
||||
isDeleted.value = false
|
||||
reset()
|
||||
onMounted(() => {
|
||||
search()
|
||||
|
||||
deleted(reset)
|
||||
})
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user