Commit d6f59107 authored by LiXuyang's avatar LiXuyang

Merge remote-tracking branch 'origin/master'

parents 847bd345 59679b5f
This diff is collapsed.
<template> <template>
<BasicModal width="40%" v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit"> <BasicModal
width="40%"
v-bind="$attrs"
@register="registerModal"
:title="getTitle"
@ok="handleSubmit"
>
<BasicForm @register="registerForm" /> <BasicForm @register="registerForm" />
</BasicModal> </BasicModal>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import {ref, computed, unref, reactive} from 'vue'; import { ref, computed, unref, reactive } from 'vue';
import { BasicModal, useModalInner } from '@/components/Modal'; import { BasicModal, useModalInner } from '@/components/Modal';
import { BasicForm, useForm } from '@/components/Form'; import { BasicForm, useForm } from '@/components/Form';
import { accountFormSchema } from './institution.data'; import { accountFormSchema } from './institution.data';
import { getDeptList } from '@/api/system/dept/dept'; import { getDeptList } from '@/api/system/dept/dept';
import {addUserApi,UserDetailApi,UserUpdataApi} from '@/api/system/user/user' import { addUserApi, UserDetailApi, UserUpdataApi } from '@/api/system/user/user';
import { encryptTwo } from '../../../../src/utils/jsencrypt.js' import { encryptTwo } from '../../../../src/utils/jsencrypt.js';
import { useMessage } from '@/hooks/web/useMessage'; import { useMessage } from '@/hooks/web/useMessage';
import {TreeData} from "@/views/dataSharingAndExchange/catalogingManagement/institutionData"; import { TreeData } from '@/views/dataSharingAndExchange/catalogingManagement/institutionData';
defineOptions({ name: 'AccountModal' }); defineOptions({ name: 'AccountModal' });
const emit = defineEmits(['success', 'register']); const emit = defineEmits(['success', 'register']);
...@@ -36,6 +43,7 @@ import {ref, computed, unref, reactive} from 'vue'; ...@@ -36,6 +43,7 @@ import {ref, computed, unref, reactive} from 'vue';
resetFields(); resetFields();
setModalProps({ confirmLoading: false }); setModalProps({ confirmLoading: false });
isUpdate.value = !!data?.isUpdate; isUpdate.value = !!data?.isUpdate;
isMove.value = !!data?.isMove; isMove.value = !!data?.isMove;
if (unref(isUpdate)) { if (unref(isUpdate)) {
// 获取行数据的id // 获取行数据的id
...@@ -46,13 +54,12 @@ import {ref, computed, unref, reactive} from 'vue'; ...@@ -46,13 +54,12 @@ import {ref, computed, unref, reactive} from 'vue';
}); });
} }
const treeList = handleTree(TreeData, 'businessId', undefined, undefined, undefined);
const treeList = handleTree(TreeData, 'businessId',undefined,undefined,undefined)
updateSchema([ updateSchema([
{ {
field: 'institutionId', field: 'institutionId',
componentProps: { componentProps: {
treeData: treeList treeData: treeList,
}, },
}, },
]); ]);
...@@ -61,51 +68,65 @@ import {ref, computed, unref, reactive} from 'vue'; ...@@ -61,51 +68,65 @@ import {ref, computed, unref, reactive} from 'vue';
const getTitle = computed(() => (!unref(isUpdate) ? '新增账号' : '编辑账号')); const getTitle = computed(() => (!unref(isUpdate) ? '新增账号' : '编辑账号'));
function handleTree(data, id, parentId, children, rootId) { function handleTree(data, id, parentId, children, rootId) {
id = id || 'id' id = id || 'id';
parentId = parentId || 'parentId' parentId = parentId || 'parentId';
children = children || 'children' children = children || 'children';
rootId = rootId || Math.min.apply(Math, data.map(item => { return item[parentId] })) || 0 rootId =
rootId ||
Math.min.apply(
Math,
data.map((item) => {
return item[parentId];
}),
) ||
0;
// 对源数据深度克隆 // 对源数据深度克隆
const cloneData = JSON.parse(JSON.stringify(data)) const cloneData = JSON.parse(JSON.stringify(data));
// 循环所有项 // 循环所有项
const treeData = cloneData.filter(father => { const treeData = cloneData.filter((father) => {
const branchArr = cloneData.filter(child => { const branchArr = cloneData.filter((child) => {
// 返回每一项的子级数组 // 返回每一项的子级数组
return father[id] === child[parentId] return father[id] === child[parentId];
}) });
branchArr.length > 0 ? father.children = branchArr : '' branchArr.length > 0 ? (father.children = branchArr) : '';
// 返回第一层 // 返回第一层
return father[parentId] === rootId return father[parentId] === rootId;
}) });
return treeData !== '' ? treeData : data return treeData !== '' ? treeData : data;
} }
/**确定按钮*/ /**确定按钮*/
async function handleSubmit() { async function handleSubmit() {
try { try {
//拿到表单内容 // 拿到表单内容
const values = await validate(); const values = await validate();
//通过表单获取的institutionId去查找相同TreeData中的institutionId的institutionName //通过表单获取的institutionId去查找相同TreeData中的institutionId的institutionName
const institutionName = TreeData.find(item => item.businessId === values.institutionId).institutionName // const institutionName = TreeData.find(
values.institutionName = institutionName // (item) => item.businessId === values.institutionId,
// ).institutionName;
// values.institutionName = institutionName;
setModalProps({ confirmLoading: true }); setModalProps({ confirmLoading: true });
// 编辑 // 编辑
if(unref(isUpdate)) { if (unref(isUpdate)) {
values.businessId = rowId.value values.businessId = rowId.value;
//修改列表值 //修改列表值
emit('success', { isUpdate: unref(isUpdate), values: { ...values, id: rowId.value } }); emit('success', { isUpdate: unref(isUpdate), values: { ...values, id: rowId.value } });
createMessage.success('编辑成功'); createMessage.success('编辑成功');
closeModal(); closeModal();
}else { } else {
//根据institutionId去查找相同TreeData中的institutionId的institutionName //根据institutionId去查找相同TreeData中的institutionId的institutionName
const institutionName = TreeData.find(item => item.businessId === values.institutionId).institutionName // const institutionName = TreeData.find(
// (item) => item.businessId === values.institutionId,
// ).institutionName;
const paramsAdd = { const paramsAdd = {
username: values.username, username: values.username,
name: values.name, name: values.name,
institutionId: values.institutionId, institutionId: values.institutionId,
institutionName: institutionName, project: values.project,
createDate: formatDate(new Date()) describe: values.describe,
} // institutionName: institutionName,
createDate: formatDate(new Date()),
};
emit('success', { isUpdate: unref(isUpdate), values: { ...paramsAdd } }); emit('success', { isUpdate: unref(isUpdate), values: { ...paramsAdd } });
createMessage.success('新增成功'); createMessage.success('新增成功');
closeModal(); closeModal();
...@@ -115,8 +136,8 @@ import {ref, computed, unref, reactive} from 'vue'; ...@@ -115,8 +136,8 @@ import {ref, computed, unref, reactive} from 'vue';
} }
} }
// 格式化日期 // 格式化日期
function formatDate(date) { function formatDate(date) {
const year = date.getFullYear(); const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,需要加1 const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,需要加1
const day = String(date.getDate()).padStart(2, '0'); const day = String(date.getDate()).padStart(2, '0');
...@@ -125,5 +146,5 @@ function formatDate(date) { ...@@ -125,5 +146,5 @@ function formatDate(date) {
const seconds = String(date.getSeconds()).padStart(2, '0'); const seconds = String(date.getSeconds()).padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
} }
</script> </script>
...@@ -12,12 +12,12 @@ ...@@ -12,12 +12,12 @@
/> />
<Icon <Icon
@click="handleGoBack" @click="handleGoBack"
icon="ph:building-apartment-bold" icon="dashicons:images-alt2"
class="header_icon" class="header_icon"
size="40px" size="40px"
/> />
<div> <div>
<div class="header_title">人力资源信息</div> <div class="header_title">轮播图详情</div>
</div> </div>
</div> </div>
<div class="right_section"> <div class="right_section">
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
:data="permissionsData" :data="permissionsData"
:schema="permissionsInfo" :schema="permissionsInfo"
/> />
<div class="mianBodyEditContainer"> <!-- <div class="mianBodyEditContainer">
<Tabs v-model:activeKey="page" size="large" class="mianBodyEditContainerTabs"> <Tabs v-model:activeKey="page" size="large" class="mianBodyEditContainerTabs">
<a-tab-pane key="1" tab="采样数据"> <a-tab-pane key="1" tab="采样数据">
<div v-if="page === '1'"> <div v-if="page === '1'">
...@@ -213,7 +213,7 @@ ...@@ -213,7 +213,7 @@
</div> </div>
</a-tab-pane> </a-tab-pane>
</Tabs> </Tabs>
</div> </div> -->
<StorageManageModal @register="registerStorageManageModal" /> <StorageManageModal @register="registerStorageManageModal" />
<AccountModal @register="registerEditModal" @success="handleSuccess" /> <AccountModal @register="registerEditModal" @success="handleSuccess" />
</PageWrapper> </PageWrapper>
...@@ -248,7 +248,6 @@ ...@@ -248,7 +248,6 @@
const { createMessage } = useMessage(); const { createMessage } = useMessage();
const page = ref('1'); const page = ref('1');
const tableData = ref([]); const tableData = ref([]);
const samplingTableData = ref([]); const samplingTableData = ref([]);
const associationData = ref([]); const associationData = ref([]);
......
...@@ -24,8 +24,13 @@ ...@@ -24,8 +24,13 @@
</template> </template>
<BasicTable @register="registerTable" :searchInfo="searchInfo"> <BasicTable @register="registerTable" :searchInfo="searchInfo">
<template #toolbar> <template #toolbar>
<a-button type="primary">新增轮播图</a-button> <a-button type="primary" @click="handleAdd">新增轮播图</a-button>
<a-button type="primary">批量删除</a-button> <a-button
type="error"
@click="handleDeleteBatch"
:disabled="getRowSelection().selectedRowKeys <= 0"
>批量删除</a-button
>
</template> </template>
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'"> <template v-if="column.key === 'action'">
...@@ -41,8 +46,20 @@ ...@@ -41,8 +46,20 @@
{ {
icon: 'dashicons:edit-large', icon: 'dashicons:edit-large',
tooltip: '编辑', tooltip: '编辑',
onClick: handleEdit.bind(null, record),
// onClick: handleDetails.bind(null, record), // onClick: handleDetails.bind(null, record),
}, },
// 删除按钮
{
icon: 'ant-design:delete-outlined',
color: 'error',
tooltip: '删除',
popConfirm: {
title: '是否确认删除',
placement: 'left',
confirm: handleDelete.bind(null, record),
},
},
]" ]"
/> />
</template> </template>
...@@ -188,12 +205,14 @@ ...@@ -188,12 +205,14 @@
openModal(true, { openModal(true, {
record, record,
isAdd: true, isAdd: true,
isUpdate: false,
}); });
} }
/** 编辑按钮*/ /** 编辑按钮*/
function handleEdit(record: Recordable) { function handleEdit(record: Recordable) {
openModal(true, { openModal(true, {
record, record,
isAdd: false,
isUpdate: true, isUpdate: true,
}); });
} /** 详情按钮*/ } /** 详情按钮*/
...@@ -216,7 +235,17 @@ ...@@ -216,7 +235,17 @@
createMessage.success('删除成功!'); createMessage.success('删除成功!');
reload(); reload();
} }
function handleDeleteBatch(record: Recordable) {
createConfirm({
iconType: 'warning',
title: '确认删除',
content: '确认批量删除选中数据吗?',
onOk() {
createMessage.success('删除成功!');
reload();
},
});
}
/** 导入成功*/ /** 导入成功*/
function handleImportSuccess() { function handleImportSuccess() {
reload(); reload();
......
...@@ -86,7 +86,7 @@ export const columns: BasicColumn[] = [ ...@@ -86,7 +86,7 @@ export const columns: BasicColumn[] = [
}, },
{ {
title: '轮播图描述', title: '轮播图描述',
dataIndex: 'ownerInstitution', dataIndex: 'describe',
width: 150, width: 150,
}, },
{ {
...@@ -135,7 +135,7 @@ export const searchFormSchema: FormSchema[] = [ ...@@ -135,7 +135,7 @@ export const searchFormSchema: FormSchema[] = [
colProps: { span: 4 }, colProps: { span: 4 },
}, },
{ {
field: 'ownerInstitution', field: 'describe',
label: ' ', label: ' ',
component: 'Input', component: 'Input',
componentProps: { componentProps: {
...@@ -167,67 +167,79 @@ export const accountFormSchema: any[] = [ ...@@ -167,67 +167,79 @@ export const accountFormSchema: any[] = [
rules: [ rules: [
{ {
required: true, required: true,
message: '请输入姓名', message: '请输入名称',
}, },
], ],
}, },
{ {
field: 'describe', field: 'project',
label: '描述', label: '轮播图文件名',
component: 'Input', component: 'Input',
colProps: { lg: 24, md: 24 }, colProps: { lg: 24, md: 24 },
rules: [ rules: [
{ {
required: true, required: true,
message: '请输入描述', message: '请输入文件名',
},
],
},
{
field: 'visibleRange',
label: '可见范围',
component: 'Select',
componentProps: {
options: [
{ label: '所有人', value: '所有人' },
{ label: '用户1', value: '用户1' },
{ label: '用户2', value: '用户2' },
],
},
colProps: { lg: 24, md: 24 },
rules: [
{
required: true,
message: '请输入登录名',
}, },
], ],
}, },
{ {
field: 'resourceNum', field: 'describe',
label: '可见资源数', label: '轮播图描述',
component: 'InputNumber', component: 'Input',
colProps: { lg: 24, md: 24 }, colProps: { lg: 24, md: 24 },
rules: [ rules: [
{ {
required: true, required: true,
message: '请输入', message: '请输入描述',
}, },
], ],
}, },
{ // {
field: 'institutionId', // field: 'visibleRange',
label: '所属编目', // label: '可见范围',
component: 'TreeSelect', // component: 'Select',
colProps: { lg: 24, md: 24 }, // componentProps: {
componentProps: { // options: [
fieldNames: { // { label: '所有人', value: '所有人' },
label: 'institutionName', // { label: '用户1', value: '用户1' },
value: 'businessId', // { label: '用户2', value: '用户2' },
}, // ],
getPopupContainer: () => document.body, // },
}, // colProps: { lg: 24, md: 24 },
required: true, // rules: [
}, // {
// required: true,
// message: '请输入登录名',
// },
// ],
// },
// {
// field: 'resourceNum',
// label: '可见资源数',
// component: 'InputNumber',
// colProps: { lg: 24, md: 24 },
// rules: [
// {
// required: true,
// message: '请输入',
// },
// ],
// },
// {
// field: 'institutionId',
// label: '所属编目',
// component: 'TreeSelect',
// colProps: { lg: 24, md: 24 },
// componentProps: {
// fieldNames: {
// label: 'institutionName',
// value: 'businessId',
// },
// getPopupContainer: () => document.body,
// },
// required: true,
// },
]; ];
export const EditFormSchema: any[] = [ export const EditFormSchema: any[] = [
{ {
......
...@@ -286,7 +286,7 @@ export const tableDataForIndex: any[] = [ ...@@ -286,7 +286,7 @@ export const tableDataForIndex: any[] = [
name: '一级资源', name: '一级资源',
project: '一级编目', project: '一级编目',
releaseStatus: '已发布', releaseStatus: '已发布',
ownerInstitution: 'test1', describe: 'test1',
resourceNum: 3, resourceNum: 3,
institutionId: 101, institutionId: 101,
createDate: '2024-10-24 10:04:04', createDate: '2024-10-24 10:04:04',
...@@ -303,7 +303,7 @@ export const tableDataForIndex: any[] = [ ...@@ -303,7 +303,7 @@ export const tableDataForIndex: any[] = [
releaser: 'duck', releaser: 'duck',
name: '二级资源', name: '二级资源',
project: '公共安全', project: '公共安全',
ownerInstitution: 'test2', describe: 'test2',
releaseStatus: '已发布', releaseStatus: '已发布',
resourceNum: 4, resourceNum: 4,
institutionId: 102, institutionId: 102,
...@@ -322,7 +322,7 @@ export const tableDataForIndex: any[] = [ ...@@ -322,7 +322,7 @@ export const tableDataForIndex: any[] = [
name: '三级资源', name: '三级资源',
project: '卫生健康', project: '卫生健康',
releaseStatus: '已发布', releaseStatus: '已发布',
ownerInstitution: 'test1', describe: 'test1',
resourceNum: 5, resourceNum: 5,
institutionId: 103, institutionId: 103,
createDate: '2024-10-24 10:04:04', createDate: '2024-10-24 10:04:04',
...@@ -340,7 +340,7 @@ export const tableDataForIndex: any[] = [ ...@@ -340,7 +340,7 @@ export const tableDataForIndex: any[] = [
name: '四级资源', name: '四级资源',
project: '文化休闲', project: '文化休闲',
releaseStatus: '已发布', releaseStatus: '已发布',
ownerInstitution: 'test3', describe: 'test3',
resourceNum: 6, resourceNum: 6,
institutionId: 104, institutionId: 104,
createDate: '2024-10-24 10:04:04', createDate: '2024-10-24 10:04:04',
...@@ -358,7 +358,7 @@ export const tableDataForIndex: any[] = [ ...@@ -358,7 +358,7 @@ export const tableDataForIndex: any[] = [
name: '五级资源', name: '五级资源',
project: '经济建设', project: '经济建设',
releaseStatus: '已发布', releaseStatus: '已发布',
ownerInstitution: 'test1', describe: 'test1',
resourceNum: 7, resourceNum: 7,
institutionId: 105, institutionId: 105,
createDate: '2024-10-24 10:04:04', createDate: '2024-10-24 10:04:04',
...@@ -376,7 +376,7 @@ export const tableDataForIndex: any[] = [ ...@@ -376,7 +376,7 @@ export const tableDataForIndex: any[] = [
name: '特级资源', name: '特级资源',
project: '科技教育', project: '科技教育',
releaseStatus: '未发布', releaseStatus: '未发布',
ownerInstitution: 'test4', describe: 'test4',
resourceNum: 8, resourceNum: 8,
createDate: '2024-10-24 10:04:04', createDate: '2024-10-24 10:04:04',
releaseDate: '2024-10-25 10:04:04', releaseDate: '2024-10-25 10:04:04',
......
...@@ -312,6 +312,6 @@ ...@@ -312,6 +312,6 @@
} }
.headerForm { .headerForm {
margin-top: 30px; margin-bottom: 30px;
} }
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment