Compare commits
2 Commits
1b71e351de
...
ea8e4c842f
Author | SHA1 | Date |
---|---|---|
|
ea8e4c842f | |
|
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,156 +47,172 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" name="org.jeecg.modules-ceesUser" setup>
|
||||
import { ref, 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 { downloadFile } from '/@/utils/common/renderUtils';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
const queryParam = reactive<any>({});
|
||||
const checkedKeys = ref<Array<string | number>>([]);
|
||||
const userStore = useUserStore();
|
||||
//注册model
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: 'CEES用户表',
|
||||
api: list,
|
||||
columns,
|
||||
canResize: false,
|
||||
formConfig: {
|
||||
//labelWidth: 120,
|
||||
schemas: searchFormSchema,
|
||||
autoSubmitOnEnter: true,
|
||||
showAdvancedButton: true,
|
||||
fieldMapToNumber: [],
|
||||
fieldMapToTime: [],
|
||||
},
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
fixed: 'right',
|
||||
},
|
||||
beforeFetch: (params) => {
|
||||
return Object.assign(params, queryParam);
|
||||
},
|
||||
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, 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>({});
|
||||
const checkedKeys = ref<Array<string | number>>([]);
|
||||
const userStore = useUserStore();
|
||||
//注册model
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: 'CEES用户表',
|
||||
api: list,
|
||||
columns,
|
||||
canResize: false,
|
||||
formConfig: {
|
||||
//labelWidth: 120,
|
||||
schemas: searchFormSchema,
|
||||
autoSubmitOnEnter: true,
|
||||
showAdvancedButton: true,
|
||||
fieldMapToNumber: [],
|
||||
fieldMapToTime: [],
|
||||
},
|
||||
exportConfig: {
|
||||
name: 'CEES用户表',
|
||||
url: getExportUrl,
|
||||
params: queryParam,
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
fixed: 'right',
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: handleSuccess,
|
||||
beforeFetch: (params) => {
|
||||
return Object.assign(params, queryParam);
|
||||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name: 'CEES用户表',
|
||||
url: getExportUrl,
|
||||
params: queryParam,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
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);
|
||||
saveOrUpdate(record, true);
|
||||
record.seen = false;
|
||||
//workloadSeen.value = true;
|
||||
};
|
||||
const handleWordloadClick = (record) => {
|
||||
//workloadSeen.value = false;
|
||||
record.seen = true;
|
||||
console.log(111);
|
||||
};
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
// 高级查询配置
|
||||
const superQueryConfig = reactive(superQuerySchema);
|
||||
|
||||
/**
|
||||
* 高级查询事件
|
||||
*/
|
||||
function handleSuperQuery(params) {
|
||||
Object.keys(params).map((k) => {
|
||||
queryParam[k] = params[k];
|
||||
});
|
||||
const workloadSeen = ref(true);
|
||||
const handleWordLoadBlur = (record) => {
|
||||
console.log(record);
|
||||
saveOrUpdate(record, true);
|
||||
record.seen = false;
|
||||
//workloadSeen.value = true;
|
||||
};
|
||||
const handleWordloadClick = (record) => {
|
||||
//workloadSeen.value = false;
|
||||
record.seen = true;
|
||||
console.log(111);
|
||||
};
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
// 高级查询配置
|
||||
const superQueryConfig = reactive(superQuerySchema);
|
||||
|
||||
/**
|
||||
* 高级查询事件
|
||||
*/
|
||||
function handleSuperQuery(params) {
|
||||
Object.keys(params).map((k) => {
|
||||
queryParam[k] = params[k];
|
||||
});
|
||||
reload();
|
||||
}
|
||||
/**
|
||||
* 新增事件
|
||||
*/
|
||||
function handleAdd() {
|
||||
openModal(true, {
|
||||
isUpdate: false,
|
||||
showFooter: true,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 编辑事件
|
||||
*/
|
||||
function handleEdit(record: Recordable) {
|
||||
openModal(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
showFooter: true,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
function handleDetail(record: Recordable) {
|
||||
openModal(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
showFooter: false,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 删除事件
|
||||
*/
|
||||
async function handleDelete(record) {
|
||||
await deleteOne({ id: record.id }, handleSuccess);
|
||||
}
|
||||
/**
|
||||
* 批量删除事件
|
||||
*/
|
||||
async function batchHandleDelete() {
|
||||
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
||||
}
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
(selectedRowKeys.value = []) && reload();
|
||||
}
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
reload();
|
||||
}
|
||||
/**
|
||||
* 新增事件
|
||||
*/
|
||||
function handleAdd() {
|
||||
openModal(true, {
|
||||
isUpdate: false,
|
||||
showFooter: true,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 编辑事件
|
||||
*/
|
||||
function handleEdit(record: Recordable) {
|
||||
openModal(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
showFooter: true,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
function handleDetail(record: Recordable) {
|
||||
openModal(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
showFooter: false,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 删除事件
|
||||
*/
|
||||
async function handleDelete(record) {
|
||||
await deleteOne({ id: record.id }, handleSuccess);
|
||||
}
|
||||
/**
|
||||
* 批量删除事件
|
||||
*/
|
||||
async function batchHandleDelete() {
|
||||
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
||||
}
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
(selectedRowKeys.value = []) && reload();
|
||||
}
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
},
|
||||
];
|
||||
}
|
||||
/**
|
||||
* 下拉操作栏
|
||||
*/
|
||||
function getDropDownAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '是否确认删除',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
placement: 'topLeft',
|
||||
},
|
||||
];
|
||||
}
|
||||
/**
|
||||
* 下拉操作栏
|
||||
*/
|
||||
function getDropDownAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '是否确认删除',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
placement: 'topLeft',
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
|
Loading…
Reference in New Issue