Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -47,7 +47,7 @@
|
|||||||
|
|
||||||
- 密码:admin123456
|
- 密码:admin123456
|
||||||
|
|
||||||
👩👦👦文档地址:[coding](https://dvadmin-private.coding.net/share/km/cec69f3d-30fe-47d5-bd97-e9e851f0b776/K-2)
|
👩👦👦文档地址:[DVAdmin官网](https://www.django-vue-admin.com)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -81,3 +81,28 @@ class MenuButtonViewSet(CustomModelViewSet):
|
|||||||
role_id = request.user.role.values_list('id', flat=True)
|
role_id = request.user.role.values_list('id', flat=True)
|
||||||
queryset = RoleMenuButtonPermission.objects.filter(role__in=role_id).values_list('menu_button__value',flat=True).distinct()
|
queryset = RoleMenuButtonPermission.objects.filter(role__in=role_id).values_list('menu_button__value',flat=True).distinct()
|
||||||
return DetailResponse(data=queryset)
|
return DetailResponse(data=queryset)
|
||||||
|
|
||||||
|
@action(methods=['post'], detail=False, permission_classes=[IsAuthenticated])
|
||||||
|
def batch_create(self, request, *args, **kwargs):
|
||||||
|
"""
|
||||||
|
批量创建菜单“增删改查查”权限
|
||||||
|
创建的数据来源于菜单,需要规范创建菜单参数
|
||||||
|
value:菜单的component_name:method
|
||||||
|
api:菜单的web_path增加'/api'前缀,并根据method增加{id}
|
||||||
|
"""
|
||||||
|
menu_obj = Menu.objects.filter(id=request.data['menu']).first()
|
||||||
|
result_list = [
|
||||||
|
{'menu': menu_obj.id, 'name': '新增', 'value': f'{menu_obj.component_name}:Create', 'api': f'/api{menu_obj.web_path}/',
|
||||||
|
'method': 1},
|
||||||
|
{'menu': menu_obj.id, 'name': '删除', 'value': f'{menu_obj.component_name}:Delete', 'api': f'/api{menu_obj.web_path}/{{id}}/',
|
||||||
|
'method': 3},
|
||||||
|
{'menu': menu_obj.id, 'name': '修改', 'value': f'{menu_obj.component_name}:Update', 'api': f'/api{menu_obj.web_path}/{{id}}/',
|
||||||
|
'method': 2},
|
||||||
|
{'menu': menu_obj.id, 'name': '查询', 'value': f'{menu_obj.component_name}:Search', 'api': f'/api{menu_obj.web_path}/',
|
||||||
|
'method': 0},
|
||||||
|
{'menu': menu_obj.id, 'name': '详情', 'value': f'{menu_obj.component_name}:Retrieve', 'api': f'/api{menu_obj.web_path}/{{id}}/',
|
||||||
|
'method': 0}]
|
||||||
|
serializer = self.get_serializer(data=result_list, many=True)
|
||||||
|
serializer.is_valid(raise_exception=True)
|
||||||
|
serializer.save()
|
||||||
|
return SuccessResponse(serializer.data, msg="批量创建成功")
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM node:16.19-alpine
|
FROM node:16.19-alpine
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
COPY ./web/package.json .
|
COPY ./web/package.json .
|
||||||
RUN yarn install --registry=https://registry.npm.taobao.org
|
RUN yarn install --registry=https://registry.npmmirror.com
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ export const handleColumnPermission = async (func: Function, crudOptions: any,ex
|
|||||||
continue
|
continue
|
||||||
} else if(item.field_name === col) {
|
} else if(item.field_name === col) {
|
||||||
columns[col].column.show = item['is_query']
|
columns[col].column.show = item['is_query']
|
||||||
|
// 如果列表不可见,则禁止在列设置中选择
|
||||||
|
if(!item['is_query'])columns[col].column.columnSetDisabled = true
|
||||||
columns[col].addForm = {
|
columns[col].addForm = {
|
||||||
show: item['is_create']
|
show: item['is_create']
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,3 +39,12 @@ export function DelObj(id: DelReq) {
|
|||||||
data: { id },
|
data: { id },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function BatchAdd(obj: AddReq) {
|
||||||
|
return request({
|
||||||
|
url: apiPrefix + 'batch_create/',
|
||||||
|
method: 'post',
|
||||||
|
data: obj,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ import {AddReq, DelReq, EditReq, dict, CreateCrudOptionsRet, CreateCrudOptionsPr
|
|||||||
import * as api from './api';
|
import * as api from './api';
|
||||||
import {auth} from '/@/utils/authFunction'
|
import {auth} from '/@/utils/authFunction'
|
||||||
import {request} from '/@/utils/service';
|
import {request} from '/@/utils/service';
|
||||||
|
import { successNotification } from '/@/utils/message';
|
||||||
|
import { ElMessage } from 'element-plus';
|
||||||
//此处为crudOptions配置
|
//此处为crudOptions配置
|
||||||
export const createCrudOptions = function ({crudExpose, context}: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
export const createCrudOptions = function ({crudExpose, context}: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||||
const pageRequest = async () => {
|
const pageRequest = async () => {
|
||||||
@@ -40,6 +42,22 @@ export const createCrudOptions = function ({crudExpose, context}: CreateCrudOpti
|
|||||||
add: {
|
add: {
|
||||||
show: auth('btn:Create')
|
show: auth('btn:Create')
|
||||||
},
|
},
|
||||||
|
batchAdd: {
|
||||||
|
show: true,
|
||||||
|
type: 'primary',
|
||||||
|
text: '批量生成',
|
||||||
|
click: async () => {
|
||||||
|
if (context!.selectOptions.value.id == undefined) {
|
||||||
|
ElMessage.error('请选择菜单');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const result = await api.BatchAdd({ menu: context!.selectOptions.value.id });
|
||||||
|
if (result.code == 2000) {
|
||||||
|
successNotification(result.msg);
|
||||||
|
crudExpose.doRefresh();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
rowHandle: {
|
rowHandle: {
|
||||||
|
|||||||
@@ -4,8 +4,15 @@
|
|||||||
<div v-show="props.model">
|
<div v-show="props.model">
|
||||||
<el-tag>已选择:{{ props.model }}</el-tag>
|
<el-tag>已选择:{{ props.model }}</el-tag>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- 搜索输入框 -->
|
||||||
|
<el-input
|
||||||
|
v-model="searchQuery"
|
||||||
|
placeholder="搜索模型..."
|
||||||
|
style="margin-bottom: 10px;"
|
||||||
|
></el-input>
|
||||||
<div class="model-card">
|
<div class="model-card">
|
||||||
<div v-for="(item,index) in allModelData" :value="item.key" :key="index">
|
<!--注释编号:django-vue3-admin-index483211: 对请求回来的allModelData进行computed计算,返加搜索框匹配到的内容-->
|
||||||
|
<div v-for="(item,index) in filteredModelData" :value="item.key" :key="index">
|
||||||
<el-text :type="modelCheckIndex===index?'primary':''" @click="onModelChecked(item,index)">
|
<el-text :type="modelCheckIndex===index?'primary':''" @click="onModelChecked(item,index)">
|
||||||
{{ item.app + '--' + item.title + '(' + item.key + ')' }}
|
{{ item.app + '--' + item.title + '(' + item.key + ')' }}
|
||||||
</el-text>
|
</el-text>
|
||||||
@@ -29,7 +36,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import {ref, onMounted, reactive} from 'vue';
|
import {ref, onMounted, reactive, computed } from 'vue';
|
||||||
import {useFs} from '@fast-crud/fast-crud';
|
import {useFs} from '@fast-crud/fast-crud';
|
||||||
import {createCrudOptions} from './crud';
|
import {createCrudOptions} from './crud';
|
||||||
import {getModelList} from './api'
|
import {getModelList} from './api'
|
||||||
@@ -55,6 +62,26 @@ const onModelChecked = (row, index) => {
|
|||||||
props.model = row.key
|
props.model = row.key
|
||||||
props.app = row.app
|
props.app = row.app
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 注释编号:django-vue3-admin-index083311:代码开始行
|
||||||
|
// 功能说明:搭配搜索的处理,返回搜索结果
|
||||||
|
const searchQuery = ref('');
|
||||||
|
|
||||||
|
const filteredModelData = computed(() => {
|
||||||
|
if (!searchQuery.value) {
|
||||||
|
return allModelData.value;
|
||||||
|
}
|
||||||
|
const query = searchQuery.value.toLowerCase();
|
||||||
|
return allModelData.value.filter(item =>
|
||||||
|
item.app.toLowerCase().includes(query) ||
|
||||||
|
item.title.toLowerCase().includes(query) ||
|
||||||
|
item.key.toLowerCase().includes(query)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
// 注释编号:django-vue3-admin-index083311:代码结束行
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜单选中时,加载表格数据
|
* 菜单选中时,加载表格数据
|
||||||
* @param record
|
* @param record
|
||||||
|
|||||||
Reference in New Issue
Block a user