wip
This commit is contained in:
parent
15c9d9e8d0
commit
09bf086724
|
|
@ -25,6 +25,13 @@ class AdminRoleController extends Controller
|
|||
return view('admin::pages.admin_roles.index', $data);
|
||||
}
|
||||
|
||||
public function edit(Request $request)
|
||||
{
|
||||
$data = [];
|
||||
|
||||
return view('admin::pages.admin_roles.edit', $data);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
return json_success('保存成功');
|
||||
|
|
|
|||
|
|
@ -12054,7 +12054,7 @@ textarea.form-control-lg {
|
|||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 1rem 1rem;
|
||||
border-bottom: 1px solid #f4f4f4;
|
||||
border-bottom: 1px solid #f1f1f1;
|
||||
border-top-left-radius: calc(0.3rem - 1px);
|
||||
border-top-right-radius: calc(0.3rem - 1px);
|
||||
}
|
||||
|
|
@ -12081,7 +12081,7 @@ textarea.form-control-lg {
|
|||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
padding: 0.75rem;
|
||||
border-top: 1px solid #f4f4f4;
|
||||
border-top: 1px solid #f1f1f1;
|
||||
border-bottom-right-radius: calc(0.3rem - 1px);
|
||||
border-bottom-left-radius: calc(0.3rem - 1px);
|
||||
}
|
||||
|
|
@ -13336,7 +13336,7 @@ textarea.form-control-lg {
|
|||
}
|
||||
|
||||
.border {
|
||||
border: 1px solid #f4f4f4 !important;
|
||||
border: 1px solid #f1f1f1 !important;
|
||||
}
|
||||
|
||||
.border-0 {
|
||||
|
|
@ -13344,7 +13344,7 @@ textarea.form-control-lg {
|
|||
}
|
||||
|
||||
.border-top {
|
||||
border-top: 1px solid #f4f4f4 !important;
|
||||
border-top: 1px solid #f1f1f1 !important;
|
||||
}
|
||||
|
||||
.border-top-0 {
|
||||
|
|
@ -13352,7 +13352,7 @@ textarea.form-control-lg {
|
|||
}
|
||||
|
||||
.border-end {
|
||||
border-right: 1px solid #f4f4f4 !important;
|
||||
border-right: 1px solid #f1f1f1 !important;
|
||||
}
|
||||
|
||||
.border-end-0 {
|
||||
|
|
@ -13360,7 +13360,7 @@ textarea.form-control-lg {
|
|||
}
|
||||
|
||||
.border-bottom {
|
||||
border-bottom: 1px solid #f4f4f4 !important;
|
||||
border-bottom: 1px solid #f1f1f1 !important;
|
||||
}
|
||||
|
||||
.border-bottom-0 {
|
||||
|
|
@ -13368,7 +13368,7 @@ textarea.form-control-lg {
|
|||
}
|
||||
|
||||
.border-start {
|
||||
border-left: 1px solid #f4f4f4 !important;
|
||||
border-left: 1px solid #f1f1f1 !important;
|
||||
}
|
||||
|
||||
.border-start-0 {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ $form-floating-padding-y: .9rem;
|
|||
$form-floating-height: 50px;
|
||||
$btn-focus-width: 0;
|
||||
$table-border-color: #e9ecef;
|
||||
$border-color: #f4f4f4;
|
||||
$border-color: #f1f1f1;
|
||||
$input-border-color: #e2e2e2;
|
||||
$badge-border-radius: 2px;
|
||||
$text-muted: #95aac9;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,139 @@
|
|||
@extends('admin::layouts.master')
|
||||
|
||||
@section('title', '角色管理')
|
||||
|
||||
@section('content')
|
||||
<div id="app" class="card" v-cloak>
|
||||
<div class="card-body h-min-600">
|
||||
<el-form ref="form" :rules="rules" :model="form" label-width="100px" class="w-max-700">
|
||||
<el-form-item label="角色名称" prop="title">
|
||||
<el-input v-model="form.title" placeholder="角色名称"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="form.description" placeholder="描述"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="权限" prop="roles">
|
||||
<div class="roles-wrap border">
|
||||
<div class="header-wrap px-2">
|
||||
<button class="btn btn-outline-dark btn-sm me-3" type="button">选中所有</button>
|
||||
<button class="btn btn-outline-dark btn-sm" type="button">取消选中</button>
|
||||
</div>
|
||||
<div v-for="role, index in form.roles" :key="index">
|
||||
<div class="bg-light px-2 d-flex">
|
||||
@{{ role.title }}
|
||||
<div class="row-update ms-2">[<span @click="updateState(true, index)" class="link-secondary">全选</span>/<span @click="updateState(false, index)" class="link-secondary">取消</span>]</div>
|
||||
</div>
|
||||
<div class="role.methods">
|
||||
<div class="d-flex px-3">
|
||||
<div v-for="method,index in role.methods" class="me-3">
|
||||
<el-checkbox class="text-dark" v-model="method.selected">@{{ method.name }}</el-checkbox>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item class="mt-5">
|
||||
<el-button type="primary" @click="addFormSubmit('form')">保存</el-button>
|
||||
<el-button @click="closeCustomersDialog('form')">取消</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('footer')
|
||||
<script>
|
||||
new Vue({
|
||||
el: '#app',
|
||||
|
||||
data: {
|
||||
form: {
|
||||
name: '',
|
||||
roles: [
|
||||
{
|
||||
title: '商品权限',
|
||||
methods: [
|
||||
{name:'列表', code: 'list', selected: false},
|
||||
{name:'创建', code: 'create', selected: false},
|
||||
{name:'查看', code: 'show', selected: false},
|
||||
{name:'编辑', code: 'update', selected: false},
|
||||
{name:'删除', code: 'destroy', selected: false},
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '订单权限',
|
||||
methods: [
|
||||
{name:'列表', code: 'list', selected: false},
|
||||
{name:'创建', code: 'create', selected: false},
|
||||
{name:'查看', code: 'show', selected: false},
|
||||
{name:'编辑', code: 'update', selected: false},
|
||||
{name:'删除', code: 'destroy', selected: false},
|
||||
]
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
source: {
|
||||
|
||||
},
|
||||
|
||||
rules: {
|
||||
title: [{required: true,message: '请输入角色名称',trigger: 'blur'}, ],
|
||||
description: [{required: true,message: '请输入描述',trigger: 'blur'}, ],
|
||||
}
|
||||
},
|
||||
|
||||
beforeMount() {
|
||||
// this.source.languages.forEach(e => {
|
||||
// this.$set(this.form.name, e.code, '')
|
||||
// this.$set(this.form.description, e.code, '')
|
||||
// })
|
||||
},
|
||||
|
||||
methods: {
|
||||
updateState(type, index) {
|
||||
this.form.roles[index].methods.map(e => e.selected = !!type)
|
||||
},
|
||||
|
||||
addFormSubmit(form) {
|
||||
const self = this;
|
||||
const type = this.type == 'add' ? 'post' : 'put';
|
||||
const url = this.type == 'add' ? 'roles' : 'roles/' + this.form.id;
|
||||
|
||||
this.$refs[form].validate((valid) => {
|
||||
if (!valid) {
|
||||
this.$message.error('请检查表单是否填写正确');
|
||||
return;
|
||||
}
|
||||
|
||||
// $http[type](url, this.form).then((res) => {
|
||||
// this.$message.success(res.message);
|
||||
// if (this.type == 'add') {
|
||||
// this.roles.push(res.data)
|
||||
// } else {
|
||||
// this.roles[this.index] = res.data
|
||||
// }
|
||||
|
||||
// this.show = false
|
||||
// })
|
||||
});
|
||||
},
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.roles-wrap .el-checkbox.text-dark .el-checkbox__label {
|
||||
font-size: 12px;
|
||||
padding-left: 6px;
|
||||
}
|
||||
|
||||
.row-update {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
@endpush
|
||||
|
|
@ -22,28 +22,26 @@
|
|||
<tr>
|
||||
<th>#</th>
|
||||
<th>名称</th>
|
||||
<th>描述</th>
|
||||
<th>创建时间</th>
|
||||
<th>修改时间</th>
|
||||
<th class="text-end">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="tax, index in admin_users" :key="index">
|
||||
<tr v-for="tax, index in roles" :key="index">
|
||||
<td>@{{ tax.id }}</td>
|
||||
<td>@{{ tax.name }}</td>
|
||||
<td>@{{ tax.email }}</td>
|
||||
<td>@{{ tax.created_at }}</td>
|
||||
<td>@{{ tax.updated_at }}</td>
|
||||
<td class="text-end">
|
||||
<button class="btn btn-outline-secondary btn-sm" @click="checkedCreate('edit', index)">编辑</button>
|
||||
<a href="{{ admin_route('admin_roles.edit', [0]) }}" class="btn btn-outline-secondary btn-sm">编辑</a>
|
||||
<button class="btn btn-outline-danger btn-sm ml-1" type="button" @click="deleteCustomer(tax.id, index)">删除</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{{-- {{ $admin_users->links('admin::vendor/pagination/bootstrap-4') }} --}}
|
||||
{{-- {{ $roles->links('admin::vendor/pagination/bootstrap-4') }} --}}
|
||||
</div>
|
||||
|
||||
<el-dialog title="创建税费" :visible.sync="dialog.show" width="700px"
|
||||
|
|
@ -104,7 +102,7 @@
|
|||
el: '#tax-classes-app',
|
||||
|
||||
data: {
|
||||
admin_users: @json($admin_users ?? []),
|
||||
roles: @json($roles ?? []),
|
||||
|
||||
source: {
|
||||
all_tax_rates: @json($all_tax_rates ?? []),
|
||||
|
|
@ -143,7 +141,7 @@
|
|||
this.dialog.index = index
|
||||
|
||||
if (type == 'edit') {
|
||||
let tax = this.admin_users[index];
|
||||
let tax = this.roles[index];
|
||||
|
||||
this.dialog.form = {
|
||||
id: tax.id,
|
||||
|
|
@ -168,7 +166,7 @@
|
|||
addFormSubmit(form) {
|
||||
const self = this;
|
||||
const type = this.dialog.type == 'add' ? 'post' : 'put';
|
||||
const url = this.dialog.type == 'add' ? 'admin_users' : 'admin_users/' + this.dialog.form.id;
|
||||
const url = this.dialog.type == 'add' ? 'roles' : 'roles/' + this.dialog.form.id;
|
||||
|
||||
this.$refs[form].validate((valid) => {
|
||||
if (!valid) {
|
||||
|
|
@ -179,9 +177,9 @@
|
|||
$http[type](url, this.dialog.form).then((res) => {
|
||||
this.$message.success(res.message);
|
||||
if (this.dialog.type == 'add') {
|
||||
this.admin_users.push(res.data)
|
||||
this.roles.push(res.data)
|
||||
} else {
|
||||
this.admin_users[this.dialog.index] = res.data
|
||||
this.roles[this.dialog.index] = res.data
|
||||
}
|
||||
|
||||
this.dialog.show = false
|
||||
|
|
@ -196,9 +194,9 @@
|
|||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
$http.delete('admin_users/' + id).then((res) => {
|
||||
$http.delete('roles/' + id).then((res) => {
|
||||
this.$message.success(res.message);
|
||||
self.admin_users.splice(index, 1)
|
||||
self.roles.splice(index, 1)
|
||||
})
|
||||
}).catch(()=>{})
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue