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,22 +47,22 @@
|
||||||
</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>({});
|
||||||
const checkedKeys = ref<Array<string | number>>([]);
|
const checkedKeys = ref<Array<string | number>>([]);
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
//注册model
|
//注册model
|
||||||
const [registerModal, { openModal }] = useModal();
|
const [registerModal, { openModal }] = useModal();
|
||||||
//注册table数据
|
//注册table数据
|
||||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||||
tableProps: {
|
tableProps: {
|
||||||
title: 'CEES用户表',
|
title: 'CEES用户表',
|
||||||
api: list,
|
api: list,
|
||||||
|
@ -94,95 +93,111 @@
|
||||||
url: getImportUrl,
|
url: getImportUrl,
|
||||||
success: handleSuccess,
|
success: handleSuccess,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const workloadSeen = ref(true);
|
|
||||||
const handleWordLoadBlur = (record) => {
|
// 在组件加载时获取分组数据
|
||||||
|
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);
|
console.log(record);
|
||||||
saveOrUpdate(record, true);
|
saveOrUpdate(record, true);
|
||||||
record.seen = false;
|
record.seen = false;
|
||||||
//workloadSeen.value = true;
|
//workloadSeen.value = true;
|
||||||
};
|
};
|
||||||
const handleWordloadClick = (record) => {
|
const handleWordloadClick = (record) => {
|
||||||
//workloadSeen.value = false;
|
//workloadSeen.value = false;
|
||||||
record.seen = true;
|
record.seen = true;
|
||||||
console.log(111);
|
console.log(111);
|
||||||
};
|
};
|
||||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||||
|
|
||||||
// 高级查询配置
|
// 高级查询配置
|
||||||
const superQueryConfig = reactive(superQuerySchema);
|
const superQueryConfig = reactive(superQuerySchema);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 高级查询事件
|
* 高级查询事件
|
||||||
*/
|
*/
|
||||||
function handleSuperQuery(params) {
|
function handleSuperQuery(params) {
|
||||||
Object.keys(params).map((k) => {
|
Object.keys(params).map((k) => {
|
||||||
queryParam[k] = params[k];
|
queryParam[k] = params[k];
|
||||||
});
|
});
|
||||||
reload();
|
reload();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 新增事件
|
* 新增事件
|
||||||
*/
|
*/
|
||||||
function handleAdd() {
|
function handleAdd() {
|
||||||
openModal(true, {
|
openModal(true, {
|
||||||
isUpdate: false,
|
isUpdate: false,
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 编辑事件
|
* 编辑事件
|
||||||
*/
|
*/
|
||||||
function handleEdit(record: Recordable) {
|
function handleEdit(record: Recordable) {
|
||||||
openModal(true, {
|
openModal(true, {
|
||||||
record,
|
record,
|
||||||
isUpdate: true,
|
isUpdate: true,
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 详情
|
* 详情
|
||||||
*/
|
*/
|
||||||
function handleDetail(record: Recordable) {
|
function handleDetail(record: Recordable) {
|
||||||
openModal(true, {
|
openModal(true, {
|
||||||
record,
|
record,
|
||||||
isUpdate: true,
|
isUpdate: true,
|
||||||
showFooter: false,
|
showFooter: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 删除事件
|
* 删除事件
|
||||||
*/
|
*/
|
||||||
async function handleDelete(record) {
|
async function handleDelete(record) {
|
||||||
await deleteOne({ id: record.id }, handleSuccess);
|
await deleteOne({ id: record.id }, handleSuccess);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 批量删除事件
|
* 批量删除事件
|
||||||
*/
|
*/
|
||||||
async function batchHandleDelete() {
|
async function batchHandleDelete() {
|
||||||
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 成功回调
|
* 成功回调
|
||||||
*/
|
*/
|
||||||
function handleSuccess() {
|
function handleSuccess() {
|
||||||
(selectedRowKeys.value = []) && reload();
|
(selectedRowKeys.value = []) && reload();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 操作栏
|
* 操作栏
|
||||||
*/
|
*/
|
||||||
function getTableAction(record) {
|
function getTableAction(record) {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
label: '编辑',
|
label: '编辑',
|
||||||
onClick: handleEdit.bind(null, record),
|
onClick: handleEdit.bind(null, record),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 下拉操作栏
|
* 下拉操作栏
|
||||||
*/
|
*/
|
||||||
function getDropDownAction(record) {
|
function getDropDownAction(record) {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
label: '详情',
|
label: '详情',
|
||||||
|
@ -197,7 +212,7 @@
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|
Loading…
Reference in New Issue