|
@@ -56,8 +56,8 @@
|
|
|
/>
|
|
|
</PageWrapper>
|
|
|
</template>
|
|
|
-<script lang="ts">
|
|
|
- import { defineComponent, h, ref } from 'vue';
|
|
|
+<script lang="ts" setup>
|
|
|
+ import { ref } from 'vue';
|
|
|
|
|
|
import { BasicTable, useTable, TableAction, BasicColumn, FormSchema } from '/@/components/Table';
|
|
|
|
|
@@ -75,7 +75,7 @@
|
|
|
} from '/@/api/system/department';
|
|
|
import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
const { t } = useI18n();
|
|
|
- export const columns: BasicColumn[] = [
|
|
|
+ const columns: BasicColumn[] = [
|
|
|
{
|
|
|
title: t('组织名称'),
|
|
|
dataIndex: 'name',
|
|
@@ -125,7 +125,7 @@
|
|
|
},
|
|
|
];
|
|
|
|
|
|
- export const searchFormSchema: FormSchema[] = [
|
|
|
+ const searchFormSchema: FormSchema[] = [
|
|
|
{
|
|
|
field: 'name',
|
|
|
label: t('组织名称'),
|
|
@@ -152,106 +152,86 @@
|
|
|
},
|
|
|
];
|
|
|
|
|
|
- export default defineComponent({
|
|
|
- name: 'DeptManagement',
|
|
|
- components: { BasicTable, TableAction, DeptDrawer, PageWrapper, SelectMember },
|
|
|
- setup() {
|
|
|
- const { notification } = useMessage();
|
|
|
- const [registerDrawer, { openModal }] = useModal();
|
|
|
- const [registerTable, { reload }] = useTable({
|
|
|
- title: t('组织列表'),
|
|
|
- api: getDepartmentEnabledTree,
|
|
|
- columns,
|
|
|
- formConfig: {
|
|
|
- rowProps: {
|
|
|
- gutter: 16,
|
|
|
- },
|
|
|
- schemas: searchFormSchema,
|
|
|
- actionColOptions: { span: 16 },
|
|
|
- },
|
|
|
- beforeFetch: (params) => {
|
|
|
- return {
|
|
|
- ...params,
|
|
|
- isOrg: 1,
|
|
|
- };
|
|
|
- },
|
|
|
- pagination: {
|
|
|
- pageSize: 20,
|
|
|
- },
|
|
|
- striped: false,
|
|
|
- useSearchForm: true,
|
|
|
- showTableSetting: true,
|
|
|
- showIndexColumn: false,
|
|
|
- actionColumn: {
|
|
|
- width: 100,
|
|
|
- title: t('操作'),
|
|
|
- dataIndex: 'action',
|
|
|
- slots: { customRender: 'action' },
|
|
|
- },
|
|
|
- });
|
|
|
-
|
|
|
- const visible = ref<boolean>(false);
|
|
|
- const selectedUserIds = ref<string[]>([]);
|
|
|
- const deptId = ref('');
|
|
|
+ const { notification } = useMessage();
|
|
|
+ const [registerDrawer, { openModal }] = useModal();
|
|
|
+ const [registerTable, { reload }] = useTable({
|
|
|
+ title: t('组织列表'),
|
|
|
+ api: getDepartmentEnabledTree,
|
|
|
+ columns,
|
|
|
+ formConfig: {
|
|
|
+ rowProps: {
|
|
|
+ gutter: 16,
|
|
|
+ },
|
|
|
+ schemas: searchFormSchema,
|
|
|
+ actionColOptions: { span: 16 },
|
|
|
+ },
|
|
|
+ beforeFetch: (params) => {
|
|
|
+ return {
|
|
|
+ ...params,
|
|
|
+ isOrg: 1,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ pagination: {
|
|
|
+ pageSize: 20,
|
|
|
+ },
|
|
|
+ striped: false,
|
|
|
+ useSearchForm: true,
|
|
|
+ showTableSetting: true,
|
|
|
+ showIndexColumn: false,
|
|
|
+ actionColumn: {
|
|
|
+ width: 100,
|
|
|
+ title: t('操作'),
|
|
|
+ dataIndex: 'action',
|
|
|
+ slots: { customRender: 'action' },
|
|
|
+ },
|
|
|
+ });
|
|
|
|
|
|
- function handleCreate() {
|
|
|
- openModal(true, {
|
|
|
- isUpdate: false,
|
|
|
- });
|
|
|
- }
|
|
|
+ const visible = ref<boolean>(false);
|
|
|
+ const selectedUserIds = ref<string[]>([]);
|
|
|
+ const deptId = ref('');
|
|
|
|
|
|
- function handleEdit(record: Recordable) {
|
|
|
- openModal(true, {
|
|
|
- record,
|
|
|
- isUpdate: true,
|
|
|
- });
|
|
|
- }
|
|
|
+ function handleCreate() {
|
|
|
+ openModal(true, {
|
|
|
+ isUpdate: false,
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- function handleDelete(record: Recordable) {
|
|
|
- deleteDepartment([record.id]).then((_) => {
|
|
|
- reload();
|
|
|
- notification.success({
|
|
|
- message: t('提示'),
|
|
|
- description: t('删除成功'),
|
|
|
- }); //提示消息
|
|
|
- });
|
|
|
- }
|
|
|
- function handleAddUser(record: Recordable) {
|
|
|
- deptId.value = record.id;
|
|
|
- getDepartmentUserList({ id: record.id }).then((res) => {
|
|
|
- selectedUserIds.value = res.map((it) => {
|
|
|
- return it.id;
|
|
|
- });
|
|
|
- visible.value = true;
|
|
|
- });
|
|
|
- }
|
|
|
+ function handleEdit(record: Recordable) {
|
|
|
+ openModal(true, {
|
|
|
+ record,
|
|
|
+ isUpdate: true,
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- function handleDeptUser(v) {
|
|
|
- updateDepartmentUser({ id: deptId.value, userIds: v }).then(() => {
|
|
|
- notification.success({
|
|
|
- message: '添加人员',
|
|
|
- description: t('成功'),
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
+ function handleDelete(record: Recordable) {
|
|
|
+ deleteDepartment([record.id]).then((_) => {
|
|
|
+ reload();
|
|
|
+ notification.success({
|
|
|
+ message: t('提示'),
|
|
|
+ description: t('删除成功'),
|
|
|
+ }); //提示消息
|
|
|
+ });
|
|
|
+ }
|
|
|
+ function handleAddUser(record: Recordable) {
|
|
|
+ deptId.value = record.id;
|
|
|
+ getDepartmentUserList({ id: record.id }).then((res) => {
|
|
|
+ selectedUserIds.value = res.map((it) => {
|
|
|
+ return it.id;
|
|
|
+ });
|
|
|
+ visible.value = true;
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- function handleSuccess() {
|
|
|
- reload();
|
|
|
- }
|
|
|
+ function handleDeptUser(v) {
|
|
|
+ updateDepartmentUser({ id: deptId.value, userIds: v }).then(() => {
|
|
|
+ notification.success({
|
|
|
+ message: '添加人员',
|
|
|
+ description: t('成功'),
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- return {
|
|
|
- registerTable,
|
|
|
- registerDrawer,
|
|
|
- handleCreate,
|
|
|
- handleEdit,
|
|
|
- handleDelete,
|
|
|
- handleAddUser,
|
|
|
- handleDeptUser,
|
|
|
- handleSuccess,
|
|
|
- visible,
|
|
|
- selectedUserIds,
|
|
|
- t,
|
|
|
- };
|
|
|
- },
|
|
|
- });
|
|
|
+ function handleSuccess() {
|
|
|
+ reload();
|
|
|
+ }
|
|
|
</script>
|