Compare commits
2 Commits
1b71e351de
...
ea8e4c842f
Author | SHA1 | Date |
---|---|---|
|
ea8e4c842f | |
|
cafb32e802 |
|
@ -135,9 +135,9 @@ export const formSchema: FormSchema[] = [
|
||||||
componentProps: {
|
componentProps: {
|
||||||
options: groupOptions, // 动态设置分组选项
|
options: groupOptions, // 动态设置分组选项
|
||||||
},
|
},
|
||||||
//dynamicRules: ({ model, schema }) => {
|
dynamicRules: ({ model, schema }) => {
|
||||||
// return [{ required: true, message: '请选择分组!' }];
|
return [{ required: true, message: '请选择分组!' }];
|
||||||
//},
|
},
|
||||||
},
|
},
|
||||||
//{
|
//{
|
||||||
// label: '使用次数',
|
// label: '使用次数',
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { BasicColumn } from '/@/components/Table';
|
import { BasicColumn } from '/@/components/Table';
|
||||||
import { FormSchema } from '/@/components/Table';
|
import { FormSchema } from '/@/components/Table';
|
||||||
import { rules } from '/@/utils/helper/validator';
|
import { rules } from '/@/utils/helper/validator';
|
||||||
import { ref, onMounted,reactive } from 'vue';
|
import { ref,reactive } from 'vue';
|
||||||
import { render } from '/@/utils/common/renderUtils';
|
import { render } from '/@/utils/common/renderUtils';
|
||||||
import {defHttp} from '/@/utils/http/axios';
|
import {defHttp} from '/@/utils/http/axios';
|
||||||
import { getOption } from 'showdown';
|
import { getOption } from 'showdown';
|
||||||
|
@ -180,9 +180,9 @@ export const formSchema: FormSchema[] = [
|
||||||
componentProps: {
|
componentProps: {
|
||||||
options: groupOptions, // 动态设置分组选项
|
options: groupOptions, // 动态设置分组选项
|
||||||
},
|
},
|
||||||
//dynamicRules: ({ model, schema }) => {
|
dynamicRules: ({ model, schema }) => {
|
||||||
// return [{ required: true, message: '请选择分组!' }];
|
return [{ required: true, message: '请选择分组!' }];
|
||||||
//},
|
},
|
||||||
},
|
},
|
||||||
//{
|
//{
|
||||||
// label: '使用次数',
|
// label: '使用次数',
|
||||||
|
|
|
@ -11,7 +11,14 @@ enum Api {
|
||||||
deleteBatch = '/org.jeecg.modules/ceesUser/deleteBatch',
|
deleteBatch = '/org.jeecg.modules/ceesUser/deleteBatch',
|
||||||
importExcel = '/org.jeecg.modules/ceesUser/importExcel',
|
importExcel = '/org.jeecg.modules/ceesUser/importExcel',
|
||||||
exportXls = '/org.jeecg.modules/ceesUser/exportXls',
|
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
|
* 导出api
|
||||||
* @param params
|
* @param params
|
||||||
|
@ -54,11 +61,22 @@ export const batchDelete = (params, handleSuccess) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//更新分组中间表
|
||||||
|
export const updateGroupUser = (params) => {
|
||||||
|
return defHttp.post({url: Api.updateGroupUser, params});
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 保存或者更新
|
* 保存或者更新
|
||||||
* @param params
|
* @param params
|
||||||
*/
|
*/
|
||||||
export const saveOrUpdate = (params, isUpdate) => {
|
export const saveOrUpdate = (params, isUpdate) => {
|
||||||
let url = isUpdate ? Api.edit : Api.save;
|
let url = isUpdate ? Api.edit : Api.save;
|
||||||
|
// 更新分组中间表
|
||||||
|
const groupUserParams = {
|
||||||
|
userId: params.userId,
|
||||||
|
groupId: params.groupId
|
||||||
|
}
|
||||||
|
updateGroupUser(groupUserParams);
|
||||||
return defHttp.post({url: url, params});
|
return defHttp.post({url: url, params});
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,15 @@ import { BasicColumn } from '/@/components/Table';
|
||||||
import { FormSchema } from '/@/components/Table';
|
import { FormSchema } from '/@/components/Table';
|
||||||
import { rules } from '/@/utils/helper/validator';
|
import { rules } from '/@/utils/helper/validator';
|
||||||
import { render } from '/@/utils/common/renderUtils';
|
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[] = [
|
export const columns: BasicColumn[] = [
|
||||||
{
|
{
|
||||||
|
@ -32,7 +41,16 @@ export const columns: BasicColumn[] = [
|
||||||
{
|
{
|
||||||
title: '所属分组',
|
title: '所属分组',
|
||||||
align: 'center',
|
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: '工作量(点击单元格可编辑)',
|
title: '工作量(点击单元格可编辑)',
|
||||||
|
@ -100,13 +118,16 @@ export const formSchema: FormSchema[] = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '所属组',
|
label: '所属分组',
|
||||||
field: 'groupId',
|
field: 'groupId',
|
||||||
component: 'Select',
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
options: groupOptions, // 动态设置分组选项
|
||||||
|
},
|
||||||
// TODO 此处需要动态获取组数据
|
// TODO 此处需要动态获取组数据
|
||||||
//dynamicRules: ({ model, schema }) => {
|
dynamicRules: ({ model, schema }) => {
|
||||||
// return [{ required: true, message: '请选择分组!' }];
|
return [{ required: true, message: '请选择分组!' }];
|
||||||
//},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,8 +16,7 @@
|
||||||
</a-menu-item>
|
</a-menu-item>
|
||||||
</a-menu>
|
</a-menu>
|
||||||
</template>
|
</template>
|
||||||
<a-button
|
<a-button>批量操作
|
||||||
>批量操作
|
|
||||||
<Icon icon="mdi:chevron-down" />
|
<Icon icon="mdi:chevron-down" />
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-dropdown>
|
</a-dropdown>
|
||||||
|
@ -48,13 +47,13 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" name="org.jeecg.modules-ceesUser" setup>
|
<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 { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||||
import { useModal } from '/@/components/Modal';
|
import { useModal } from '/@/components/Modal';
|
||||||
import { useListPage } from '/@/hooks/system/useListPage';
|
import { useListPage } from '/@/hooks/system/useListPage';
|
||||||
import CeesUserModal from './components/CeesUserModal.vue';
|
import CeesUserModal from './components/CeesUserModal.vue';
|
||||||
import { columns, searchFormSchema, superQuerySchema } from './CeesUser.data';
|
import { columns, searchFormSchema, superQuerySchema, updateGroupOptions } from './CeesUser.data';
|
||||||
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl, saveOrUpdate } from './CeesUser.api';
|
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl, saveOrUpdate, getGroup } from './CeesUser.api';
|
||||||
import { downloadFile } from '/@/utils/common/renderUtils';
|
import { downloadFile } from '/@/utils/common/renderUtils';
|
||||||
import { useUserStore } from '/@/store/modules/user';
|
import { useUserStore } from '/@/store/modules/user';
|
||||||
const queryParam = reactive<any>({});
|
const queryParam = reactive<any>({});
|
||||||
|
@ -95,6 +94,22 @@
|
||||||
success: handleSuccess,
|
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 workloadSeen = ref(true);
|
||||||
const handleWordLoadBlur = (record) => {
|
const handleWordLoadBlur = (record) => {
|
||||||
console.log(record);
|
console.log(record);
|
||||||
|
|
Loading…
Reference in New Issue