修改
This commit is contained in:
69
web-vue/packages/biz/api/biz/listItem.ts
Normal file
69
web-vue/packages/biz/api/biz/listItem.ts
Normal file
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
*/
|
||||
import { defHttp } from '@jeesite/core/utils/http/axios';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { BasicModel, Page } from '@jeesite/core/api/model/baseModel';
|
||||
import { UploadApiResult } from '@jeesite/core/api/sys/upload';
|
||||
import { UploadFileParams } from '@jeesite/types/axios';
|
||||
import { AxiosProgressEvent } from 'axios';
|
||||
|
||||
const { ctxPath, adminPath } = useGlobSetting();
|
||||
|
||||
export interface BizListItem extends BasicModel<BizListItem> {
|
||||
createTime?: string; // 创建时间
|
||||
avatar?: string; // 头像图标
|
||||
title: string; // 通知标题
|
||||
titleDelete?: string; // 是否删除
|
||||
datetime?: string; // 发送时间
|
||||
type: string; // 类型标识
|
||||
readFlag?: string; // 是否已读
|
||||
description: string; // 描述信息
|
||||
clickClose?: string; // 是否关闭
|
||||
extra?: string; // 待办状态
|
||||
color?: string; // 颜色值
|
||||
updateTime: string; // 更新时间
|
||||
ftenantId?: string; // 租户id
|
||||
fflowId?: string; // 流程id
|
||||
fflowTaskId?: string; // 流程任务主键
|
||||
fflowState?: number; // 流程任务状态
|
||||
}
|
||||
|
||||
export interface TabItem {
|
||||
key: string;
|
||||
name: string;
|
||||
count: number;
|
||||
list: BizListItem[];
|
||||
}
|
||||
|
||||
export const tabListDataAll = () =>
|
||||
defHttp.get<TabItem[]>({ url: adminPath + '/biz/listItem/getTabListData'});
|
||||
|
||||
export const bizListItemList = (params?: BizListItem | any) =>
|
||||
defHttp.get<BizListItem>({ url: adminPath + '/biz/listItem/list', params });
|
||||
|
||||
export const bizListItemListData = (params?: BizListItem | any) =>
|
||||
defHttp.post<Page<BizListItem>>({ url: adminPath + '/biz/listItem/listData', params });
|
||||
|
||||
export const bizListItemForm = (params?: BizListItem | any) =>
|
||||
defHttp.get<BizListItem>({ url: adminPath + '/biz/listItem/form', params });
|
||||
|
||||
export const bizListItemSave = (params?: any, data?: BizListItem | any) =>
|
||||
defHttp.postJson<BizListItem>({ url: adminPath + '/biz/listItem/save', params, data });
|
||||
|
||||
export const bizListItemImportData = (
|
||||
params: UploadFileParams,
|
||||
onUploadProgress: (progressEvent: AxiosProgressEvent) => void,
|
||||
) =>
|
||||
defHttp.uploadFile<UploadApiResult>(
|
||||
{
|
||||
url: ctxPath + adminPath + '/biz/listItem/importData',
|
||||
onUploadProgress,
|
||||
},
|
||||
params,
|
||||
);
|
||||
|
||||
export const bizListItemDelete = (params?: BizListItem | any) =>
|
||||
defHttp.get<BizListItem>({ url: adminPath + '/biz/listItem/delete', params });
|
||||
180
web-vue/packages/biz/views/biz/listItem/form.vue
Normal file
180
web-vue/packages/biz/views/biz/listItem/form.vue
Normal file
@@ -0,0 +1,180 @@
|
||||
<!--
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
-->
|
||||
<template>
|
||||
<BasicDrawer
|
||||
v-bind="$attrs"
|
||||
:showFooter="true"
|
||||
:okAuth="'biz:listItem:edit'"
|
||||
@register="registerDrawer"
|
||||
@ok="handleSubmit"
|
||||
width="70%"
|
||||
>
|
||||
<template #title>
|
||||
<Icon :icon="getTitle.icon" class="m-1 pr-1" />
|
||||
<span> {{ getTitle.value }} </span>
|
||||
</template>
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicDrawer>
|
||||
</template>
|
||||
<script lang="ts" setup name="ViewsBizListItemForm">
|
||||
import { ref, unref, computed } from 'vue';
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { router } from '@jeesite/core/router';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { BasicForm, FormSchema, useForm } from '@jeesite/core/components/Form';
|
||||
import { BasicDrawer, useDrawerInner } from '@jeesite/core/components/Drawer';
|
||||
import { BizListItem, bizListItemSave, bizListItemForm } from '@jeesite/biz/api/biz/listItem';
|
||||
|
||||
const emit = defineEmits(['success', 'register']);
|
||||
|
||||
const { t } = useI18n('biz.listItem');
|
||||
const { showMessage } = useMessage();
|
||||
const { meta } = unref(router.currentRoute);
|
||||
const record = ref<BizListItem>({} as BizListItem);
|
||||
|
||||
const getTitle = computed(() => ({
|
||||
icon: meta.icon || 'i-ant-design:book-outlined',
|
||||
value: record.value.isNewRecord ? t('新增通知列表项表') : t('编辑通知列表项表'),
|
||||
}));
|
||||
|
||||
const inputFormSchemas: FormSchema<BizListItem>[] = [
|
||||
{
|
||||
label: t('头像图标'),
|
||||
field: 'avatar',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 255,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('通知标题'),
|
||||
field: 'title',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 512,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('是否删除'),
|
||||
field: 'titleDelete',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: '',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('发送时间'),
|
||||
field: 'datetime',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD',
|
||||
showTime: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('类型标识'),
|
||||
field: 'type',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: '',
|
||||
allowClear: true,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('是否已读'),
|
||||
field: 'readFlag',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: '',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('描述信息'),
|
||||
field: 'description',
|
||||
component: 'InputTextArea',
|
||||
required: true,
|
||||
colProps: { md: 24, lg: 24 },
|
||||
},
|
||||
{
|
||||
label: t('是否关闭'),
|
||||
field: 'clickClose',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 12,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('待办状态'),
|
||||
field: 'extra',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 64,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('颜色值'),
|
||||
field: 'color',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 32,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('更新时间'),
|
||||
field: 'updateTime',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD HH:mm',
|
||||
showTime: { format: 'HH:mm' },
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
];
|
||||
|
||||
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm<BizListItem>({
|
||||
labelWidth: 120,
|
||||
schemas: inputFormSchemas,
|
||||
baseColProps: { md: 24, lg: 12 },
|
||||
});
|
||||
|
||||
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
|
||||
setDrawerProps({ loading: true });
|
||||
await resetFields();
|
||||
const res = await bizListItemForm(data);
|
||||
record.value = (res.bizListItem || {}) as BizListItem;
|
||||
record.value.__t = new Date().getTime();
|
||||
await setFieldsValue(record.value);
|
||||
setDrawerProps({ loading: false });
|
||||
});
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const data = await validate();
|
||||
setDrawerProps({ confirmLoading: true });
|
||||
const params: any = {
|
||||
isNewRecord: record.value.isNewRecord,
|
||||
id: record.value.id || data.id,
|
||||
};
|
||||
// console.log('submit', params, data, record);
|
||||
const res = await bizListItemSave(params, data);
|
||||
showMessage(res.message);
|
||||
setTimeout(closeDrawer);
|
||||
emit('success', data);
|
||||
} catch (error: any) {
|
||||
if (error && error.errorFields) {
|
||||
showMessage(error.message || t('common.validateError'));
|
||||
}
|
||||
console.log('error', error);
|
||||
} finally {
|
||||
setDrawerProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
103
web-vue/packages/biz/views/biz/listItem/formImport.vue
Normal file
103
web-vue/packages/biz/views/biz/listItem/formImport.vue
Normal file
@@ -0,0 +1,103 @@
|
||||
<!--
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
-->
|
||||
<template>
|
||||
<BasicModal
|
||||
v-bind="$attrs"
|
||||
:title="t('导入通知列表项表')"
|
||||
:okText="t('导入')"
|
||||
@register="registerModal"
|
||||
@ok="handleSubmit"
|
||||
:minHeight="120"
|
||||
:width="400"
|
||||
>
|
||||
<Upload accept=".xls,.xlsx" :file-list="fileList" :before-upload="beforeUpload" @remove="handleRemove">
|
||||
<a-button> <Icon icon="ant-design:upload-outlined" /> {{ t('选择文件') }} </a-button>
|
||||
<span class="ml-4">{{ uploadInfo }}</span>
|
||||
</Upload>
|
||||
<div class="ml-4 mt-4">
|
||||
{{ t('提示:仅允许导入“xls”或“xlsx”格式文件!') }}
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<a-button @click="handleDownloadTemplate()" type="text">
|
||||
<Icon icon="i-fa:file-excel-o" />
|
||||
{{ t('下载模板') }}
|
||||
</a-button>
|
||||
</div>
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { Upload } from 'ant-design-vue';
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { downloadByUrl } from '@jeesite/core/utils/file/download';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { BasicModal, useModalInner } from '@jeesite/core/components/Modal';
|
||||
import { bizListItemImportData } from '@jeesite/biz/api/biz/listItem';
|
||||
import { FileType } from 'ant-design-vue/es/upload/interface';
|
||||
import { AxiosProgressEvent } from 'axios';
|
||||
|
||||
const emit = defineEmits(['success', 'register']);
|
||||
|
||||
const { t } = useI18n('biz.listItem');
|
||||
const { showMessage, showMessageModal } = useMessage();
|
||||
|
||||
const fileList = ref<FileType[]>([]);
|
||||
const uploadInfo = ref('');
|
||||
|
||||
const beforeUpload = (file: FileType) => {
|
||||
fileList.value = [file];
|
||||
return false;
|
||||
};
|
||||
|
||||
const handleRemove = () => {
|
||||
fileList.value = [];
|
||||
};
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(() => {
|
||||
fileList.value = [];
|
||||
uploadInfo.value = '';
|
||||
});
|
||||
|
||||
async function handleDownloadTemplate() {
|
||||
const { ctxAdminPath } = useGlobSetting();
|
||||
downloadByUrl({ url: ctxAdminPath + '/biz/listItem/importTemplate' });
|
||||
}
|
||||
|
||||
function onUploadProgress(progressEvent: AxiosProgressEvent) {
|
||||
const complete = ((progressEvent.loaded / (progressEvent.total || 1)) * 100) | 0;
|
||||
if (complete != 100) {
|
||||
uploadInfo.value = t('正在导入,请稍候') + ' ' + complete + '%...';
|
||||
} else {
|
||||
uploadInfo.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
if (fileList.value.length == 0) {
|
||||
showMessage(t('请选择要导入的数据文件'));
|
||||
return;
|
||||
}
|
||||
setModalProps({ confirmLoading: true });
|
||||
const params = {
|
||||
file: fileList.value[0],
|
||||
};
|
||||
const { data } = await bizListItemImportData(params, onUploadProgress);
|
||||
showMessageModal({ content: data.message });
|
||||
setTimeout(closeModal);
|
||||
emit('success');
|
||||
} catch (error: any) {
|
||||
if (error && error.errorFields) {
|
||||
showMessage(error.message || t('common.validateError'));
|
||||
}
|
||||
console.log('error', error);
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
296
web-vue/packages/biz/views/biz/listItem/list.vue
Normal file
296
web-vue/packages/biz/views/biz/listItem/list.vue
Normal file
@@ -0,0 +1,296 @@
|
||||
<!--
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
-->
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable">
|
||||
<template #tableTitle>
|
||||
<Icon :icon="getTitle.icon" class="m-1 pr-1" />
|
||||
<span> {{ getTitle.value }} </span>
|
||||
</template>
|
||||
<template #toolbar>
|
||||
<a-button type="default" :loading="loading" @click="handleExport()">
|
||||
<Icon icon="i-ant-design:download-outlined" /> {{ t('导出') }}
|
||||
</a-button>
|
||||
<a-button type="default" @click="handleImport()">
|
||||
<Icon icon="i-ant-design:import-outlined" /> {{ t('导入') }}
|
||||
</a-button>
|
||||
<a-button type="primary" @click="handleForm({})" v-auth="'biz:listItem:edit'">
|
||||
<Icon icon="i-fluent:add-12-filled" /> {{ t('新增') }}
|
||||
</a-button>
|
||||
</template>
|
||||
<template #firstColumn="{ record }">
|
||||
<a @click="handleForm({ id: record.id })" :title="record.createTime">
|
||||
{{ record.createTime }}
|
||||
</a>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<InputForm @register="registerDrawer" @success="handleSuccess" />
|
||||
<FormImport @register="registerImportModal" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup name="ViewsBizListItemList">
|
||||
import { onMounted, ref, unref } from 'vue';
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { downloadByUrl } from '@jeesite/core/utils/file/download';
|
||||
import { router } from '@jeesite/core/router';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { BasicTable, BasicColumn, useTable } from '@jeesite/core/components/Table';
|
||||
import { BizListItem, bizListItemList } from '@jeesite/biz/api/biz/listItem';
|
||||
import { bizListItemDelete, bizListItemListData } from '@jeesite/biz/api/biz/listItem';
|
||||
import { useDrawer } from '@jeesite/core/components/Drawer';
|
||||
import { useModal } from '@jeesite/core/components/Modal';
|
||||
import { FormProps } from '@jeesite/core/components/Form';
|
||||
import InputForm from './form.vue';
|
||||
import FormImport from './formImport.vue';
|
||||
|
||||
const { t } = useI18n('biz.listItem');
|
||||
const { showMessage } = useMessage();
|
||||
const { meta } = unref(router.currentRoute);
|
||||
const record = ref<BizListItem>({} as BizListItem);
|
||||
|
||||
const getTitle = {
|
||||
icon: meta.icon || 'i-ant-design:book-outlined',
|
||||
value: meta.title || t('通知列表项表管理'),
|
||||
};
|
||||
const loading = ref(false);
|
||||
|
||||
const searchForm: FormProps<BizListItem> = {
|
||||
baseColProps: { md: 8, lg: 6 },
|
||||
labelWidth: 90,
|
||||
schemas: [
|
||||
{
|
||||
label: t('创建时间起'),
|
||||
field: 'createTime_gte',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD HH:mm',
|
||||
showTime: { format: 'HH:mm' },
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('创建时间止'),
|
||||
field: 'createTime_lte',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD HH:mm',
|
||||
showTime: { format: 'HH:mm' },
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('通知标题'),
|
||||
field: 'title',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('类型标识'),
|
||||
field: 'type',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: '',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('是否已读'),
|
||||
field: 'readFlag',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: '',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('是否关闭'),
|
||||
field: 'clickClose',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('待办状态'),
|
||||
field: 'extra',
|
||||
component: 'Input',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const tableColumns: BasicColumn<BizListItem>[] = [
|
||||
{
|
||||
title: t('创建时间'),
|
||||
dataIndex: 'createTime',
|
||||
key: 'a.create_time',
|
||||
sorter: true,
|
||||
width: 230,
|
||||
align: 'left',
|
||||
slot: 'firstColumn',
|
||||
},
|
||||
{
|
||||
title: t('头像图标'),
|
||||
dataIndex: 'avatar',
|
||||
key: 'a.avatar',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('通知标题'),
|
||||
dataIndex: 'title',
|
||||
key: 'a.title',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('是否删除'),
|
||||
dataIndex: 'titleDelete',
|
||||
key: 'a.title_delete',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
dictType: '',
|
||||
},
|
||||
{
|
||||
title: t('发送时间'),
|
||||
dataIndex: 'datetime',
|
||||
key: 'a.datetime',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('类型标识'),
|
||||
dataIndex: 'type',
|
||||
key: 'a.type',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
dictType: '',
|
||||
},
|
||||
{
|
||||
title: t('是否已读'),
|
||||
dataIndex: 'readFlag',
|
||||
key: 'a.read_flag',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
dictType: '',
|
||||
},
|
||||
{
|
||||
title: t('描述信息'),
|
||||
dataIndex: 'description',
|
||||
key: 'a.description',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('是否关闭'),
|
||||
dataIndex: 'clickClose',
|
||||
key: 'a.click_close',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('待办状态'),
|
||||
dataIndex: 'extra',
|
||||
key: 'a.extra',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('颜色值'),
|
||||
dataIndex: 'color',
|
||||
key: 'a.color',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('更新时间'),
|
||||
dataIndex: 'updateTime',
|
||||
key: 'a.update_time',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'center',
|
||||
},
|
||||
];
|
||||
|
||||
const actionColumn: BasicColumn<BizListItem> = {
|
||||
width: 160,
|
||||
actions: (record: BizListItem) => [
|
||||
{
|
||||
icon: 'i-clarity:note-edit-line',
|
||||
title: t('编辑通知列表项表'),
|
||||
onClick: handleForm.bind(this, { id: record.id }),
|
||||
auth: 'biz:listItem:edit',
|
||||
},
|
||||
{
|
||||
icon: 'i-ant-design:delete-outlined',
|
||||
color: 'error',
|
||||
title: t('删除通知列表项表'),
|
||||
popConfirm: {
|
||||
title: t('是否确认删除通知列表项表'),
|
||||
confirm: handleDelete.bind(this, record),
|
||||
},
|
||||
auth: 'biz:listItem:edit',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const [registerTable, { reload, getForm }] = useTable<BizListItem>({
|
||||
api: bizListItemListData,
|
||||
beforeFetch: (params) => {
|
||||
return params;
|
||||
},
|
||||
columns: tableColumns,
|
||||
actionColumn: actionColumn,
|
||||
formConfig: searchForm,
|
||||
showTableSetting: true,
|
||||
useSearchForm: true,
|
||||
canResize: true,
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
const res = await bizListItemList();
|
||||
record.value = (res.bizListItem || {}) as BizListItem;
|
||||
await getForm().setFieldsValue(record.value);
|
||||
});
|
||||
|
||||
const [registerDrawer, { openDrawer }] = useDrawer();
|
||||
|
||||
function handleForm(record: Recordable) {
|
||||
openDrawer(true, record);
|
||||
}
|
||||
|
||||
async function handleExport() {
|
||||
loading.value = true;
|
||||
const { ctxAdminPath } = useGlobSetting();
|
||||
await downloadByUrl({
|
||||
url: ctxAdminPath + '/biz/listItem/exportData',
|
||||
params: getForm().getFieldsValue(),
|
||||
});
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
const [registerImportModal, { openModal: importModal }] = useModal();
|
||||
|
||||
function handleImport() {
|
||||
importModal(true, {});
|
||||
}
|
||||
|
||||
async function handleDelete(record: Recordable) {
|
||||
const params = { id: record.id };
|
||||
const res = await bizListItemDelete(params);
|
||||
showMessage(res.message);
|
||||
await handleSuccess(record);
|
||||
}
|
||||
|
||||
async function handleSuccess(record: Recordable) {
|
||||
await reload({ record });
|
||||
}
|
||||
</script>
|
||||
189
web-vue/packages/biz/views/biz/listItem/select.ts
Normal file
189
web-vue/packages/biz/views/biz/listItem/select.ts
Normal file
@@ -0,0 +1,189 @@
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { BasicColumn, BasicTableProps, FormProps } from '@jeesite/core/components/Table';
|
||||
import { bizListItemListData } from '@jeesite/biz/api/biz/listItem';
|
||||
|
||||
const { t } = useI18n('biz.listItem');
|
||||
|
||||
const modalProps = {
|
||||
title: t('通知列表项表选择'),
|
||||
};
|
||||
|
||||
const searchForm: FormProps<BizListItem> = {
|
||||
baseColProps: { md: 8, lg: 6 },
|
||||
labelWidth: 90,
|
||||
schemas: [
|
||||
{
|
||||
label: t('创建时间起'),
|
||||
field: 'createTime_gte',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD HH:mm',
|
||||
showTime: { format: 'HH:mm' },
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('创建时间止'),
|
||||
field: 'createTime_lte',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD HH:mm',
|
||||
showTime: { format: 'HH:mm' },
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('通知标题'),
|
||||
field: 'title',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('类型标识'),
|
||||
field: 'type',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: '',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('是否已读'),
|
||||
field: 'readFlag',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: '',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('是否关闭'),
|
||||
field: 'clickClose',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('待办状态'),
|
||||
field: 'extra',
|
||||
component: 'Input',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const tableColumns: BasicColumn<BizListItem>[] = [
|
||||
{
|
||||
title: t('创建时间'),
|
||||
dataIndex: 'createTime',
|
||||
key: 'a.create_time',
|
||||
sorter: true,
|
||||
width: 230,
|
||||
align: 'left',
|
||||
slot: 'firstColumn',
|
||||
},
|
||||
{
|
||||
title: t('头像图标'),
|
||||
dataIndex: 'avatar',
|
||||
key: 'a.avatar',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('通知标题'),
|
||||
dataIndex: 'title',
|
||||
key: 'a.title',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('是否删除'),
|
||||
dataIndex: 'titleDelete',
|
||||
key: 'a.title_delete',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
dictType: '',
|
||||
},
|
||||
{
|
||||
title: t('发送时间'),
|
||||
dataIndex: 'datetime',
|
||||
key: 'a.datetime',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('类型标识'),
|
||||
dataIndex: 'type',
|
||||
key: 'a.type',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
dictType: '',
|
||||
},
|
||||
{
|
||||
title: t('是否已读'),
|
||||
dataIndex: 'readFlag',
|
||||
key: 'a.read_flag',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
dictType: '',
|
||||
},
|
||||
{
|
||||
title: t('描述信息'),
|
||||
dataIndex: 'description',
|
||||
key: 'a.description',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('是否关闭'),
|
||||
dataIndex: 'clickClose',
|
||||
key: 'a.click_close',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('待办状态'),
|
||||
dataIndex: 'extra',
|
||||
key: 'a.extra',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('颜色值'),
|
||||
dataIndex: 'color',
|
||||
key: 'a.color',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('更新时间'),
|
||||
dataIndex: 'updateTime',
|
||||
key: 'a.update_time',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'center',
|
||||
},
|
||||
];
|
||||
|
||||
const tableProps: BasicTableProps = {
|
||||
api: bizListItemListData,
|
||||
beforeFetch: (params) => {
|
||||
params['isAll'] = true;
|
||||
return params;
|
||||
},
|
||||
columns: tableColumns,
|
||||
formConfig: searchForm,
|
||||
rowKey: 'id',
|
||||
};
|
||||
|
||||
export default {
|
||||
modalProps,
|
||||
tableProps,
|
||||
itemCode: 'id',
|
||||
itemName: 'id',
|
||||
isShowCode: false,
|
||||
};
|
||||
@@ -55,7 +55,7 @@
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { computed, defineComponent, PropType, ref, watch, unref } from 'vue';
|
||||
import { ListItem } from './data';
|
||||
import { BizListItem } from '@jeesite/biz/api/biz/listItem';
|
||||
import { useDesign } from '@jeesite/core/hooks/web/useDesign';
|
||||
import { List, Avatar, Tag, Typography } from 'ant-design-vue';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
@@ -73,7 +73,7 @@
|
||||
},
|
||||
props: {
|
||||
list: {
|
||||
type: Array as PropType<ListItem[]>,
|
||||
type: Array as PropType<BizListItem[]>,
|
||||
default: () => [],
|
||||
},
|
||||
pageSize: {
|
||||
@@ -100,7 +100,7 @@
|
||||
setup(props, { emit }) {
|
||||
const { prefixCls } = useDesign('header-notify-list');
|
||||
const current = ref(props.currentPage || 1);
|
||||
const getData = computed<ListItem[]>(() => {
|
||||
const getData = computed<BizListItem[]>(() => {
|
||||
const { pageSize, list } = props;
|
||||
if (pageSize === false) return [];
|
||||
let size = isNumber(pageSize) ? pageSize : 5;
|
||||
@@ -131,7 +131,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
function handleTitleClick(item: ListItem) {
|
||||
function handleTitleClick(item: BizListItem) {
|
||||
props.onTitleClick && props.onTitleClick(item);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
<span v-if="item.list.length !== 0">({{ item.list.length }})</span>
|
||||
</template>
|
||||
<!-- 绑定title-click事件的通知列表中标题是“可点击”的-->
|
||||
<NoticeList :list="item.list" v-if="item.key === '1'" @title-click="onNoticeClick" />
|
||||
<NoticeList :list="item.list" v-else />
|
||||
<NoticeList :list="item.list" @title-click="onNoticeClick" />
|
||||
</TabPane>
|
||||
</template>
|
||||
</Tabs>
|
||||
@@ -23,33 +22,36 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { computed, defineComponent, ref } from 'vue';
|
||||
import { computed, defineComponent, onMounted, ref } from 'vue';
|
||||
import { Popover, Tabs, Badge } from 'ant-design-vue';
|
||||
import { BellOutlined } from '@ant-design/icons-vue';
|
||||
import { tabListData, ListItem } from './data';
|
||||
import NoticeList from './NoticeList.vue';
|
||||
import { useDesign } from '@jeesite/core/hooks/web/useDesign';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { tabListDataAll, TabItem, BizListItem } from '@jeesite/biz/api/biz/listItem';
|
||||
|
||||
export default defineComponent({
|
||||
components: { Popover, BellOutlined, Tabs, TabPane: Tabs.TabPane, Badge, NoticeList },
|
||||
setup() {
|
||||
const { prefixCls } = useDesign('header-notify');
|
||||
const { createMessage } = useMessage();
|
||||
const listData = ref(tabListData);
|
||||
|
||||
const count = computed(() => {
|
||||
const listData = ref<TabItem[]>([]);
|
||||
|
||||
onMounted(async () => {
|
||||
const response = await tabListDataAll();
|
||||
listData.value = response;
|
||||
});
|
||||
|
||||
const count = computed(() => {
|
||||
let count = 0;
|
||||
for (let i = 0; i < tabListData.length; i++) {
|
||||
count += tabListData[i].list.length;
|
||||
for (let i = 0; i < listData.value.length; i++) {
|
||||
count += listData.value[i].list.length;
|
||||
}
|
||||
return count;
|
||||
});
|
||||
|
||||
function onNoticeClick(record: ListItem) {
|
||||
function onNoticeClick(record: BizListItem) {
|
||||
createMessage.success('你点击了通知,ID=' + record.id);
|
||||
// 可以直接将其标记为已读(为标题添加删除线),此处演示的代码会切换删除线状态
|
||||
record.titleDelete = !record.titleDelete;
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<template>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
Reference in New Issue
Block a user