Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -47,6 +47,8 @@ export const handleColumnPermission = async (func: Function, crudOptions: any,ex
|
||||
continue
|
||||
} else if(item.field_name === col) {
|
||||
columns[col].column.show = item['is_query']
|
||||
// 如果列表不可见,则禁止在列设置中选择
|
||||
if(!item['is_query'])columns[col].column.columnSetDisabled = true
|
||||
columns[col].addForm = {
|
||||
show: item['is_create']
|
||||
}
|
||||
|
||||
@@ -39,3 +39,12 @@ export function DelObj(id: DelReq) {
|
||||
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 {auth} from '/@/utils/authFunction'
|
||||
import {request} from '/@/utils/service';
|
||||
import { successNotification } from '/@/utils/message';
|
||||
import { ElMessage } from 'element-plus';
|
||||
//此处为crudOptions配置
|
||||
export const createCrudOptions = function ({crudExpose, context}: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const pageRequest = async () => {
|
||||
@@ -40,6 +42,22 @@ export const createCrudOptions = function ({crudExpose, context}: CreateCrudOpti
|
||||
add: {
|
||||
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: {
|
||||
|
||||
@@ -4,8 +4,15 @@
|
||||
<div v-show="props.model">
|
||||
<el-tag>已选择:{{ props.model }}</el-tag>
|
||||
</div>
|
||||
<!-- 搜索输入框 -->
|
||||
<el-input
|
||||
v-model="searchQuery"
|
||||
placeholder="搜索模型..."
|
||||
style="margin-bottom: 10px;"
|
||||
></el-input>
|
||||
<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)">
|
||||
{{ item.app + '--' + item.title + '(' + item.key + ')' }}
|
||||
</el-text>
|
||||
@@ -29,7 +36,7 @@
|
||||
</template>
|
||||
|
||||
<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 {createCrudOptions} from './crud';
|
||||
import {getModelList} from './api'
|
||||
@@ -55,6 +62,26 @@ const onModelChecked = (row, index) => {
|
||||
props.model = row.key
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user