数据管理的分组
This commit is contained in:
parent
17e6359662
commit
cafb32e802
|
@ -135,9 +135,9 @@ export const formSchema: FormSchema[] = [
|
|||
componentProps: {
|
||||
options: groupOptions, // 动态设置分组选项
|
||||
},
|
||||
//dynamicRules: ({ model, schema }) => {
|
||||
// return [{ required: true, message: '请选择分组!' }];
|
||||
//},
|
||||
dynamicRules: ({ model, schema }) => {
|
||||
return [{ required: true, message: '请选择分组!' }];
|
||||
},
|
||||
},
|
||||
//{
|
||||
// label: '使用次数',
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { BasicColumn } from '/@/components/Table';
|
||||
import { FormSchema } from '/@/components/Table';
|
||||
import { rules } from '/@/utils/helper/validator';
|
||||
import { ref, onMounted,reactive } from 'vue';
|
||||
import { ref,reactive } from 'vue';
|
||||
import { render } from '/@/utils/common/renderUtils';
|
||||
import {defHttp} from '/@/utils/http/axios';
|
||||
import { getOption } from 'showdown';
|
||||
|
@ -180,9 +180,9 @@ export const formSchema: FormSchema[] = [
|
|||
componentProps: {
|
||||
options: groupOptions, // 动态设置分组选项
|
||||
},
|
||||
//dynamicRules: ({ model, schema }) => {
|
||||
// return [{ required: true, message: '请选择分组!' }];
|
||||
//},
|
||||
dynamicRules: ({ model, schema }) => {
|
||||
return [{ required: true, message: '请选择分组!' }];
|
||||
},
|
||||
},
|
||||
//{
|
||||
// label: '使用次数',
|
||||
|
|
|
@ -11,7 +11,14 @@ enum Api {
|
|||
deleteBatch = '/org.jeecg.modules/ceesUser/deleteBatch',
|
||||
importExcel = '/org.jeecg.modules/ceesUser/importExcel',
|
||||
exportXls = '/org.jeecg.modules/ceesUser/exportXls',
|
||||
updateGroupUser = '/cees/ceesGroup/updateGroupUser',
|
||||
}
|
||||
|
||||
//获取分组
|
||||
export const getGroup = () =>
|
||||
defHttp.get({url: '/cees/ceesGroup/list'}).then((res) => {
|
||||
return res.records;
|
||||
});
|
||||
/**
|
||||
* 导出api
|
||||
* @param params
|
||||
|
@ -54,11 +61,22 @@ export const batchDelete = (params, handleSuccess) => {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
//更新分组中间表
|
||||
export const updateGroupUser = (params) => {
|
||||
return defHttp.post({url: Api.updateGroupUser, params});
|
||||
}
|
||||
/**
|
||||
* 保存或者更新
|
||||
* @param params
|
||||
*/
|
||||
export const saveOrUpdate = (params, isUpdate) => {
|
||||
let url = isUpdate ? Api.edit : Api.save;
|
||||
// 更新分组中间表
|
||||
const groupUserParams = {
|
||||
userId: params.userId,
|
||||
groupId: params.groupId
|
||||
}
|
||||
updateGroupUser(groupUserParams);
|
||||
return defHttp.post({url: url, params});
|
||||
}
|
||||
|
|
|
@ -2,6 +2,15 @@ import { BasicColumn } from '/@/components/Table';
|
|||
import { FormSchema } from '/@/components/Table';
|
||||
import { rules } from '/@/utils/helper/validator';
|
||||
import { render } from '/@/utils/common/renderUtils';
|
||||
import { reactive, ref } from "vue";
|
||||
|
||||
const groupOptions = ref();
|
||||
// 创建一个简单的事件总线
|
||||
export const updateGroupOptions = reactive({
|
||||
updateGroupOptions(newOptions: any) {
|
||||
groupOptions.value = newOptions;
|
||||
},
|
||||
});
|
||||
//列表数据
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
|
@ -32,7 +41,16 @@ export const columns: BasicColumn[] = [
|
|||
{
|
||||
title: '所属分组',
|
||||
align: 'center',
|
||||
dataIndex: 'groupId',
|
||||
customRender: ({ text }) => {
|
||||
if (!groupOptions.value) {
|
||||
return '加载中...'; // 如果未加载,显示加载中
|
||||
}
|
||||
const group = groupOptions.value.find(item => item.value === text.groupId);
|
||||
if (group) {
|
||||
return group.label;
|
||||
}
|
||||
return '未知分组';
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '工作量(点击单元格可编辑)',
|
||||
|
@ -100,13 +118,16 @@ export const formSchema: FormSchema[] = [
|
|||
},
|
||||
},
|
||||
{
|
||||
label: '所属组',
|
||||
label: '所属分组',
|
||||
field: 'groupId',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: groupOptions, // 动态设置分组选项
|
||||
},
|
||||
// TODO 此处需要动态获取组数据
|
||||
//dynamicRules: ({ model, schema }) => {
|
||||
// return [{ required: true, message: '请选择分组!' }];
|
||||
//},
|
||||
dynamicRules: ({ model, schema }) => {
|
||||
return [{ required: true, message: '请选择分组!' }];
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
|
|
|
@ -16,8 +16,7 @@
|
|||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
<a-button
|
||||
>批量操作
|
||||
<a-button>批量操作
|
||||
<Icon icon="mdi:chevron-down" />
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
|
@ -48,13 +47,13 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" name="org.jeecg.modules-ceesUser" setup>
|
||||
import { ref, reactive, computed, unref } from 'vue';
|
||||
import { ref, onMounted, reactive, computed, unref } from 'vue';
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import CeesUserModal from './components/CeesUserModal.vue';
|
||||
import { columns, searchFormSchema, superQuerySchema } from './CeesUser.data';
|
||||
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl, saveOrUpdate } from './CeesUser.api';
|
||||
import { columns, searchFormSchema, superQuerySchema, updateGroupOptions } from './CeesUser.data';
|
||||
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl, saveOrUpdate, getGroup } from './CeesUser.api';
|
||||
import { downloadFile } from '/@/utils/common/renderUtils';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
const queryParam = reactive<any>({});
|
||||
|
@ -95,6 +94,22 @@
|
|||
success: handleSuccess,
|
||||
},
|
||||
});
|
||||
|
||||
// 在组件加载时获取分组数据
|
||||
const groupOptions = ref<{ label: string; value: number }[]>([]);
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const res = await getGroup();
|
||||
groupOptions.value = res.map((group) => ({
|
||||
label: group.name, // 假设分组名称字段为 name
|
||||
value: group.id, // 假设分组 ID 字段为 id
|
||||
}));
|
||||
updateGroupOptions.updateGroupOptions(groupOptions.value);
|
||||
} catch (error) {
|
||||
console.error('获取分组数据失败:', error);
|
||||
}
|
||||
});
|
||||
const workloadSeen = ref(true);
|
||||
const handleWordLoadBlur = (record) => {
|
||||
console.log(record);
|
||||
|
|
Loading…
Reference in New Issue