feat(pwlProject): 更新项目管理功能并优化表格展示- 增加了项目统计和导入功能

-优化了项目列表页面的展示结构和字段显示- 调整了编辑弹窗的宽度以适应更多内容
- 添加了highlight.js依赖以支持代码高亮
- 更新了表格列配置,增加了嵌套表头和固定列- 改进了用户、底稿、签字等信息的展示方式
-优化了状态标签和时间格式的显示- 增加了页面标题和返回功能
- 更新了API参数类型定义,增加type和itemYear字段
This commit is contained in:
2025-10-27 11:13:38 +08:00
parent 645d2203d3
commit 8c711e066b
8 changed files with 1381 additions and 1068 deletions

View File

@@ -73,6 +73,7 @@
"eslint-define-config": "^1.7.0", "eslint-define-config": "^1.7.0",
"eslint-plugin-prettier": "^4.2.1", "eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-vue": "^9.4.0", "eslint-plugin-vue": "^9.4.0",
"highlight.js": "^11.11.1",
"less": "^4.1.3", "less": "^4.1.3",
"postcss": "^8.4.39", "postcss": "^8.4.39",
"prettier": "^2.7.1", "prettier": "^2.7.1",

3
pnpm-lock.yaml generated
View File

@@ -186,6 +186,9 @@ importers:
eslint-plugin-vue: eslint-plugin-vue:
specifier: ^9.4.0 specifier: ^9.4.0
version: 9.33.0(eslint@8.57.1) version: 9.33.0(eslint@8.57.1)
highlight.js:
specifier: ^11.11.1
version: 11.11.1
less: less:
specifier: ^4.1.3 specifier: ^4.1.3
version: 4.4.2 version: 4.4.2

View File

@@ -104,3 +104,28 @@ export async function getPwlProject(id: number) {
} }
return Promise.reject(new Error(res.data.message)); return Promise.reject(new Error(res.data.message));
} }
export async function pwlProjectCount() {
const res = await request.get('/pwl/pwl-project/');
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 文章批量导入
*/
export async function importPwlProject(file: File) {
const formData = new FormData();
formData.append('file', file);
const res = await request.post<ApiResult<unknown>>(
MODULES_API_URL + '/pwl/pwl-project/import',
formData
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}

View File

@@ -105,5 +105,7 @@ export interface PwlProject {
*/ */
export interface PwlProjectParam extends PageParam { export interface PwlProjectParam extends PageParam {
id?: number; id?: number;
type?: string;
itemYear?: string;
keywords?: string; keywords?: string;
} }

File diff suppressed because it is too large Load Diff

View File

@@ -3,40 +3,229 @@
<a-space :size="10" style="flex-wrap: wrap"> <a-space :size="10" style="flex-wrap: wrap">
<a-button type="primary" class="ele-btn-icon" @click="add"> <a-button type="primary" class="ele-btn-icon" @click="add">
<template #icon> <template #icon>
<PlusOutlined /> <PlusOutlined/>
</template> </template>
<span>添加</span> <span>添加</span>
</a-button> </a-button>
<a-button
danger
v-if="hasRole('superAdmin')"
type="primary"
class="ele-btn-icon"
:disabled="selection?.length === 0"
@click="removeBatch"
>
<template #icon>
<DeleteOutlined/>
</template>
<span>批量删除</span>
</a-button>
<DictSelect
dict-code="Type"
:width="200"
:show-search="true"
placeholder="项目类型"
v-model:value="where.type"
@done="chooseType"
/>
<a-date-picker v-model:value="where.itemYear" value-format="YYYY" picker="year" @change="onYear" />
<a-input-search
allow-clear
placeholder="请输入关键词"
v-model:value="where.keywords"
@pressEnter="search"
@search="search"
/>
<a-button @click="reset">重置</a-button>
<a-button type="text" v-if="hasRole('superAdmin')" @click="handleExport">导出xls</a-button>
<a-button type="text" v-if="hasRole('superAdmin')" @click="openImport">导入xls</a-button>
</a-space> </a-space>
<!-- 导入弹窗 -->
<Import v-model:visible="showImport" @done="search"/>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { PlusOutlined } from '@ant-design/icons-vue'; import {DeleteOutlined, PlusOutlined} from '@ant-design/icons-vue';
import type { GradeParam } from '@/api/user/grade/model'; import type {GradeParam} from '@/api/user/grade/model';
import { watch } from 'vue'; import {watch, ref} from 'vue';
import {hasRole} from "@/utils/permission";
import dayjs from 'dayjs';
import {message} from 'ant-design-vue';
import {utils, writeFile} from 'xlsx';
import {PwlProject, PwlProjectParam} from "@/api/pwl/pwlProject/model";
import useSearch from "@/utils/use-search";
import {listPwlProject} from "@/api/pwl/pwlProject";
import Import from "./Import.vue";
import DictSelect from "@/components/DictSelect/index.vue";
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
// 选中的角色 // 选中的角色
selection?: []; selection?: [];
}>(), }>(),
{} {}
); );
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'search', where?: GradeParam): void; (e: 'search', where?: GradeParam): void;
(e: 'add'): void; (e: 'add'): void;
(e: 'remove'): void; (e: 'remove'): void;
(e: 'batchMove'): void; (e: 'batchMove'): void;
}>(); }>();
// 新增 // 新增
const add = () => { const add = () => {
emit('add'); emit('add');
}; };
// 日期范围选择
const dateRange = ref<[string, string]>(['', '']);
const loading = ref(false);
const projectList = ref<PwlProject[]>([]);
const xlsFileName = ref<string>();
// 是否显示用户导入弹窗
const showImport = ref(false);
// 表单数据
const {where,resetFields} = useSearch<PwlProjectParam>({
id: undefined,
type: undefined,
itemYear: undefined,
keywords: undefined
});
watch( /* 打开编辑弹窗 */
() => props.selection, const openImport = () => {
() => {} showImport.value = true;
); };
const chooseType = (e) => {
console.log(e,'yyyy')
where.type = e.label;
search();
}
// 批量删除
const removeBatch = () => {
emit('remove');
};
const onYear = (date: any, dateString: string) => {
where.itemYear = dateString;
search();
};
/* 搜索 */
const search = () => {
const [d1, d2] = dateRange.value ?? [];
emit('search', {
...where,
createTimeStart: d1 ? d1 + ' 00:00:00' : '',
createTimeEnd: d2 ? d2 + ' 23:59:59' : ''
});
};
/* 重置 */
const reset = () => {
resetFields();
search();
};
// 导出
const handleExport = async () => {
loading.value = true;
const array: (string | number)[][] = [
[
'报告时间',
'审计单位',
'报告编号',
'项目信息-开票单位/汇款人',
'项目信息-所属年度',
'项目信息-类型',
'项目信息-审计意见',
'年末资产总额(万元)',
'合同金额',
'实收金额',
'到账信息-银行',
'到账信息-日期',
'到账信息-金额',
'开票信息-日期',
'开票信息-金额',
'开票信息-发票类型',
'报告份数',
'底稿人员',
'参与人员',
'签字注会',
'展业人员',
'底稿情况'
]
];
// 按搜索结果导出
where.sceneType = 'Content';
await listPwlProject(where)
.then((list) => {
projectList.value = list;
list?.forEach((d: PwlProject) => {
array.push([
`${d.expirationTime || ''}`,
`${d.name || ''}`,
`${d.code || ''}`,
`${d.itemName || ''}`,
`${d.itemYear || ''}`,
`${d.itemType || ''}`,
`${d.itemOpinion || ''}`,
`${d.totalAssets || ''}`,
// `${d.comments || ''}`,
`${d.contractPrice || ''}`,
`${d.payPrice || ''}`,
`${d.bankName || ''}`,
`${d.bankPayTime || ''}`,
`${d.bankPrice || ''}`,
`${d.invoiceTime || ''}`,
`${d.invoicePrice || ''}`,
`${d.invoiceType || ''}`,
`${d.reportNum || ''}`,
`${d.draftUser ? JSON.parse(d.draftUser).join(',') : ''}`,
`${d.users ? JSON.parse(d.users).join(',') : ''}`,
`${d.signUser ? JSON.parse(d.signUser).join(',') : ''}`,
`${d.saleUser ? JSON.parse(d.saleUser).join(',') : ''}`,
`${d.files || ''}`,
]);
});
const sheetName = `导出项目列表${dayjs(new Date()).format('YYYYMMDD')}`;
const workbook = {
SheetNames: [sheetName],
Sheets: {}
};
const sheet = utils.aoa_to_sheet(array);
workbook.Sheets[sheetName] = sheet;
// 设置列宽
sheet['!cols'] = [
];
message.loading('正在导出...');
setTimeout(() => {
writeFile(
workbook,
`${
where.createTimeEnd ? xlsFileName.value + '_' : ''
}${sheetName}.xlsx`
);
loading.value = false;
}, 1000);
})
.catch((msg) => {
message.error(msg);
loading.value = false;
})
.finally(() => {
});
};
watch(
() => props.selection,
() => {
}
);
</script> </script>

View File

@@ -1,479 +1,457 @@
<template> <template>
<div class="page"> <a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
<div class="ele-body"> <template #extra>
<a-card :bordered="false" :body-style="{ padding: '16px' }"> <Extra/>
<ele-pro-table </template>
ref="tableRef" <a-card :bordered="false" :body-style="{ padding: '16px' }">
row-key="pwlProjectId" <ele-pro-table
:columns="columns" ref="tableRef"
:datasource="datasource" row-key="id"
:customRow="customRow" :columns="columns"
tool-class="ele-toolbar-form" :datasource="datasource"
class="sys-org-table" :customRow="customRow"
> :scroll="{ x: 4000 }"
<template #toolbar> tool-class="ele-toolbar-form"
<search class="sys-org-table"
@search="reload" bordered
:selection="selection" >
@add="openEdit" <template #toolbar>
@remove="removeBatch" <search
@batchMove="openMove" @search="reload"
/> :selection="selection"
@add="openEdit"
@remove="removeBatch"
@batchMove="openMove"
/>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'image'">
<a-image v-if="record.image" :src="record.image" :width="50"/>
</template> </template>
<template #bodyCell="{ column, record }"> <template v-if="column.key === 'status'">
<template v-if="column.key === 'image'"> <a-tag v-if="record.status === 0" color="green">已完成</a-tag>
<a-image :src="record.image" :width="50" /> <a-tag v-if="record.status === 1" color="red">未完成</a-tag>
</template> </template>
<template v-if="column.key === 'status'"> <template v-if="column.key === 'draftUser'">
<a-tag v-if="record.status === 0" color="green">显示</a-tag> <a-space direction="vertical" v-if="record.draftUser">
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag> <a-tag v-for="(item,index) in JSON.parse(record.draftUser)" :key="index">{{ item }}</a-tag>
</template> </a-space>
<template v-if="column.key === 'action'"> </template>
<template v-if="column.key === 'users'">
<a-space direction="vertical" v-if="record.users">
<a-tag v-for="(item,index) in JSON.parse(record.users)" :key="index">{{ item }}</a-tag>
</a-space>
</template>
<template v-if="column.key === 'signUser'">
<a-space direction="vertical" v-if="record.signUser">
<a-tag v-for="(item,index) in JSON.parse(record.signUser)" :key="index">{{ item }}</a-tag>
</a-space>
</template>
<template v-if="column.key === 'saleUser'">
<a-space direction="vertical" v-if="record.saleUser">
<a-tag v-for="(item,index) in JSON.parse(record.saleUser)" :key="index">{{ item }}</a-tag>
</a-space>
</template>
<template v-if="column.key === 'electron'">
<span>电子</span>
<a-tag v-if="record.electron === 0" color="green">已完成</a-tag>
<a-tag v-else color="red">未完成</a-tag>
<span>纸质</span>
<a-tag v-if="record.paper === 0" color="green">已完成</a-tag>
<a-tag v-else color="red">未完成</a-tag>
</template>
<template v-if="column.key === 'createTime'">
<a-tooltip :title="`创建于:${record.createTime}`" class="flex flex-col">
<a-space> <a-space>
<a @click="openEdit(record)">修改</a> <span>{{ record.createTime }}</span>
<a-divider type="vertical" /> <a-avatar :src="record.avatar" size="small" />
<a-popconfirm
title="确定要删除此记录吗?"
@confirm="remove(record)"
>
<a class="ele-text-danger">删除</a>
</a-popconfirm>
</a-space> </a-space>
</template> </a-tooltip>
</template> </template>
</ele-pro-table> <template v-if="column.key === 'action'">
</a-card> <a-space>
<a @click="openEdit(record)">修改</a>
<a-divider type="vertical"/>
<a-popconfirm
title="确定要删除此记录吗?"
@confirm="remove(record)"
>
<a class="ele-text-danger">删除</a>
</a-popconfirm>
</a-space>
</template>
</template>
</ele-pro-table>
</a-card>
<!-- 编辑弹窗 --> <!-- 编辑弹窗 -->
<PwlProjectEdit v-model:visible="showEdit" :data="current" @done="reload" /> <PwlProjectEdit v-model:visible="showEdit" :data="current" @done="reload"/>
</div> </a-page-header>
</div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { createVNode, ref } from 'vue'; import {createVNode, ref} from 'vue';
import { message, Modal } from 'ant-design-vue'; import {message, Modal} from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'; import {ExclamationCircleOutlined} from '@ant-design/icons-vue';
import type { EleProTable } from 'ele-admin-pro'; import type {EleProTable} from 'ele-admin-pro';
import { toDateString } from 'ele-admin-pro'; import {toDateString} from 'ele-admin-pro';
import type { import type {
DatasourceFunction, DatasourceFunction,
ColumnItem ColumnItem
} from 'ele-admin-pro/es/ele-pro-table/types'; } from 'ele-admin-pro/es/ele-pro-table/types';
import Search from './components/search.vue'; import Search from './components/search.vue';
import PwlProjectEdit from './components/pwlProjectEdit.vue'; import PwlProjectEdit from './components/pwlProjectEdit.vue';
import { pagePwlProject, removePwlProject, removeBatchPwlProject } from '@/api/pwl/pwlProject'; import {pagePwlProject, removePwlProject, removeBatchPwlProject} from '@/api/pwl/pwlProject';
import type { PwlProject, PwlProjectParam } from '@/api/pwl/pwlProject/model'; import type {PwlProject, PwlProjectParam} from '@/api/pwl/pwlProject/model';
import {getPageTitle} from "@/utils/common";
import Extra from "./components/extra.vue";
// 表格实例 // 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null); const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
// 表格选中数据 // 表格选中数据
const selection = ref<PwlProject[]>([]); const selection = ref<PwlProject[]>([]);
// 当前编辑数据 // 当前编辑数据
const current = ref<PwlProject | null>(null); const current = ref<PwlProject | null>(null);
// 是否显示编辑弹窗 // 是否显示编辑弹窗
const showEdit = ref(false); const showEdit = ref(false);
// 是否显示批量移动弹窗 // 是否显示批量移动弹窗
const showMove = ref(false); const showMove = ref(false);
// 加载状态 // const draftUser = ref<string[]>([]);
const loading = ref(true); // const users = ref<string[]>([]);
// const signUser = ref<string[]>([]);
// const saleUser = ref<string[]>([]);
// 加载状态
const loading = ref(true);
// 表格数据源 // 表格数据源
const datasource: DatasourceFunction = ({ const datasource: DatasourceFunction = ({
page,
limit,
where,
orders
}) => {
return pagePwlProject({
...where,
...orders,
page, page,
limit, limit
where, });
orders, };
filters
}) => {
if (filters) {
where.status = filters.status;
}
return pagePwlProject({
...where,
...orders,
page,
limit
});
};
// 表格列配置 // 表格列配置
const columns = ref<ColumnItem[]>([ const columns = ref<ColumnItem[]>([
{ {
title: 'ID', title: '序号',
dataIndex: 'id', key: 'index',
key: 'id', width: 48,
align: 'center', fixed: 'left',
width: 90, align: 'center',
}, customRender: ({ index }) => index + (tableRef.value?.tableIndex ?? 0)
{ },
title: '审计单位', {
dataIndex: 'name', title: '被审计单位',
key: 'name', dataIndex: 'name',
align: 'center', key: 'name',
}, width: 240,
{ fixed: 'left',
title: '报告编号', align: 'center',
dataIndex: 'code', },
key: 'code', {
align: 'center', title: '报告编号',
}, dataIndex: 'code',
{ key: 'code',
title: '上级id, 0是顶级', width: 240,
dataIndex: 'parentId', sorter: true,
key: 'parentId', align: 'center',
align: 'center', },
}, {
{ title: '项目完成进度',
title: '项目类型', dataIndex: 'status',
dataIndex: 'type', key: 'status',
key: 'type', width: 120,
align: 'center', align: 'center'
}, },
{ {
title: '项目图标', title: '报告时间',
dataIndex: 'image', dataIndex: 'expirationTime',
key: 'image', key: 'expirationTime',
align: 'center', align: 'center',
}, width: 120
{ },
title: '二维码', // {
dataIndex: 'qrcode', // title: '类型',
key: 'qrcode', // dataIndex: 'type',
align: 'center', // key: 'type',
}, // align: 'center',
{ // customRender: ({text}) => ['审字', '专审', '验证', '咨询'][text]
title: '链接地址', // },
dataIndex: 'url', {
key: 'url', title: '项目信息',
align: 'center', dataIndex: 'itemName',
}, key: 'itemName',
{ align: 'center',
title: '应用截图', children: [
dataIndex: 'images', {
key: 'images', title: '开票单位/汇款人',
align: 'center', dataIndex: 'itemName',
}, key: 'itemName',
{ align: 'center',
title: '底稿情况', width: 180
dataIndex: 'files',
key: 'files',
align: 'center',
},
{
title: '应用介绍',
dataIndex: 'content',
key: 'content',
align: 'center',
},
{
title: '年末资产总额(万元)',
dataIndex: 'totalAssets',
key: 'totalAssets',
align: 'center',
},
{
title: '合同金额',
dataIndex: 'contractPrice',
key: 'contractPrice',
align: 'center',
},
{
title: '实收金额',
dataIndex: 'payPrice',
key: 'payPrice',
align: 'center',
},
{
title: '软件定价',
dataIndex: 'price',
key: 'price',
align: 'center',
},
{
title: '是否推荐',
dataIndex: 'recommend',
key: 'recommend',
align: 'center',
},
{
title: '到期时间',
dataIndex: 'expirationTime',
key: 'expirationTime',
align: 'center',
},
{
title: '项目信息-开票单位/汇款人',
dataIndex: 'itemName',
key: 'itemName',
align: 'center',
},
{
title: '项目信息-年度',
dataIndex: 'itemYear',
key: 'itemYear',
align: 'center',
},
{
title: '项目信息-类型',
dataIndex: 'itemType',
key: 'itemType',
align: 'center',
},
{
title: '项目信息-审计意见',
dataIndex: 'itemOpinion',
key: 'itemOpinion',
align: 'center',
},
{
title: '到账信息-银行名称',
dataIndex: 'bankName',
key: 'bankName',
align: 'center',
},
{
title: '到账日期',
dataIndex: 'bankPayTime',
key: 'bankPayTime',
align: 'center',
},
{
title: '到账金额',
dataIndex: 'bankPrice',
key: 'bankPrice',
align: 'center',
},
{
title: '发票类型',
dataIndex: 'invoiceType',
key: 'invoiceType',
align: 'center',
},
{
title: '开票日期',
dataIndex: 'invoiceTime',
key: 'invoiceTime',
align: 'center',
},
{
title: '开票金额',
dataIndex: 'invoicePrice',
key: 'invoicePrice',
align: 'center',
},
{
title: '报告份数',
dataIndex: 'reportNum',
key: 'reportNum',
align: 'center',
},
{
title: '底稿人员',
dataIndex: 'draftUserId',
key: 'draftUserId',
align: 'center',
},
{
title: '底稿人员',
dataIndex: 'draftUser',
key: 'draftUser',
align: 'center',
},
{
title: '参与成员',
dataIndex: 'userIds',
key: 'userIds',
align: 'center',
},
{
title: '参与成员',
dataIndex: 'users',
key: 'users',
align: 'center',
},
{
title: '签字注会',
dataIndex: 'signUserId',
key: 'signUserId',
align: 'center',
},
{
title: '签字注会',
dataIndex: 'signUser',
key: 'signUser',
align: 'center',
},
{
title: '展业人员',
dataIndex: 'saleUserId',
key: 'saleUserId',
align: 'center',
},
{
title: '展业人员',
dataIndex: 'saleUser',
key: 'saleUser',
align: 'center',
},
{
title: '纸质底稿完成情况',
dataIndex: 'paper',
key: 'paper',
align: 'center',
},
{
title: '电子底稿完成情况',
dataIndex: 'electron',
key: 'electron',
align: 'center',
},
{
title: '备注',
dataIndex: 'comments',
key: 'comments',
align: 'center',
},
{
title: '排序(数字越小越靠前)',
dataIndex: 'sortNumber',
key: 'sortNumber',
align: 'center',
},
{
title: '状态, 0正常, 1冻结',
dataIndex: 'status',
key: 'status',
align: 'center',
},
{
title: '是否删除, 0否, 1是',
dataIndex: 'deleted',
key: 'deleted',
align: 'center',
},
{
title: '客户ID',
dataIndex: 'userId',
key: 'userId',
align: 'center',
},
{
title: '创建时间',
dataIndex: 'createTime',
key: 'createTime',
align: 'center',
sorter: true,
ellipsis: true,
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd')
},
{
title: '修改时间',
dataIndex: 'updateTime',
key: 'updateTime',
align: 'center',
},
{
title: '知识库ID',
dataIndex: 'kbId',
key: 'kbId',
align: 'center',
},
{
title: '操作',
key: 'action',
width: 180,
fixed: 'right',
align: 'center',
hideInSetting: true
}
]);
/* 搜索 */
const reload = (where?: PwlProjectParam) => {
selection.value = [];
tableRef?.value?.reload({ where: where });
};
/* 打开编辑弹窗 */
const openEdit = (row?: PwlProject) => {
current.value = row ?? null;
showEdit.value = true;
};
/* 打开批量移动弹窗 */
const openMove = () => {
showMove.value = true;
};
/* 删除单个 */
const remove = (row: PwlProject) => {
const hide = message.loading('请求中..', 0);
removePwlProject(row.pwlProjectId)
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
};
/* 批量删除 */
const removeBatch = () => {
if (!selection.value.length) {
message.error('请至少选择一条数据');
return;
}
Modal.confirm({
title: '提示',
content: '确定要删除选中的记录吗?',
icon: createVNode(ExclamationCircleOutlined),
maskClosable: true,
onOk: () => {
const hide = message.loading('请求中..', 0);
removeBatchPwlProject(selection.value.map((d) => d.pwlProjectId))
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
}
});
};
/* 查询 */
const query = () => {
loading.value = true;
};
/* 自定义行属性 */
const customRow = (record: PwlProject) => {
return {
// 行点击事件
onClick: () => {
// console.log(record);
}, },
// 行双击事件 {
onDblclick: () => { title: '所属年度',
openEdit(record); dataIndex: 'itemYear',
} key: 'itemYear',
}; align: 'center',
},
{
title: '类型',
dataIndex: 'itemType',
key: 'itemType',
align: 'center',
},
{
title: '审计意见',
dataIndex: 'itemOpinion',
key: 'itemOpinion',
align: 'center',
},
]
},
{
title: '年末资产总额(万元)',
dataIndex: 'totalAssets',
key: 'totalAssets',
align: 'center',
width: 170
},
{
title: '合同金额',
dataIndex: 'contractPrice',
key: 'contractPrice',
align: 'center',
},
{
title: '实收金额',
dataIndex: 'payPrice',
key: 'payPrice',
align: 'center',
width: 120
},
{
title: '到账信息',
dataIndex: 'itemName',
key: 'itemName',
align: 'center',
children: [
{
title: '银行',
dataIndex: 'bankName',
key: 'bankName',
align: 'center',
width: 120,
},
{
title: '日期',
dataIndex: 'bankPayTime',
key: 'bankPayTime',
align: 'center',
width: 120
},
{
title: '金额',
dataIndex: 'bankPrice',
key: 'bankPrice',
align: 'center',
width: 120,
},
],
},
{
title: '开票信息',
dataIndex: 'invoice',
key: 'invoice',
align: 'center',
children: [
{
title: '日期',
dataIndex: 'invoiceTime',
key: 'invoiceTime',
align: 'center',
width: 120
},
{
title: '金额',
dataIndex: 'invoicePrice',
key: 'invoicePrice',
align: 'center',
width: 120,
},
{
title: '发票类型',
dataIndex: 'invoiceTypeName',
key: 'invoiceTypeName',
align: 'center',
width: 120,
},
],
},
{
title: '报告份数',
dataIndex: 'reportNum',
key: 'reportNum',
align: 'center',
width: 90,
},
{
title: '底稿人员',
dataIndex: 'draftUser',
key: 'draftUser',
align: 'center',
width: 90
},
{
title: '参与成员',
dataIndex: 'users',
key: 'users',
align: 'center',
width: 180
},
{
title: '签字注会',
dataIndex: 'signUser',
key: 'signUser',
align: 'center',
width: 90,
},
{
title: '展业人员',
dataIndex: 'saleUser',
key: 'saleUser',
align: 'center',
width: 90
},
{
title: '底稿完成情况',
dataIndex: 'electron',
key: 'electron',
align: 'center',
width: 120,
},
{
title: '备注',
dataIndex: 'comments',
key: 'comments',
align: 'center',
width: 180,
},
{
title: '创建时间',
dataIndex: 'createTime',
key: 'createTime',
align: 'center',
sorter: true,
width: 180,
ellipsis: true,
customRender: ({text}) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
},
{
title: '操作',
key: 'action',
width: 180,
fixed: 'right',
align: 'center',
hideInSetting: true
}
]);
/* 搜索 */
const reload = (where?: PwlProjectParam) => {
selection.value = [];
tableRef?.value?.reload({where: where});
};
/* 打开编辑弹窗 */
const openEdit = (row?: PwlProject) => {
current.value = row ?? null;
showEdit.value = true;
};
/* 打开批量移动弹窗 */
const openMove = () => {
showMove.value = true;
};
/* 删除单个 */
const remove = (row: PwlProject) => {
const hide = message.loading('请求中..', 0);
removePwlProject(row.id)
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
};
/* 批量删除 */
const removeBatch = () => {
if (!selection.value.length) {
message.error('请至少选择一条数据');
return;
}
Modal.confirm({
title: '提示',
content: '确定要删除选中的记录吗?',
icon: createVNode(ExclamationCircleOutlined),
maskClosable: true,
onOk: () => {
const hide = message.loading('请求中..', 0);
removeBatchPwlProject(selection.value.map((d) => d.id))
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
}
});
};
/* 查询 */
const query = () => {
loading.value = true;
};
/* 自定义行属性 */
const customRow = (record: PwlProject) => {
return {
// 行点击事件
onClick: () => {
// console.log(record);
},
// 行双击事件
onDblclick: () => {
openEdit(record);
}
}; };
query(); };
query();
</script> </script>
<script lang="ts"> <script lang="ts">
export default { export default {
name: 'PwlProject' name: 'PwlProject'
}; };
</script> </script>
<style lang="less" scoped></style> <style lang="less" scoped></style>

View File

@@ -69,187 +69,167 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, reactive, watch } from 'vue'; import { ref, reactive, watch } from 'vue';
import { Form, message } from 'ant-design-vue'; import { Form, message } from 'ant-design-vue';
import { assignObject } from 'ele-admin-pro'; import { assignObject } from 'ele-admin-pro';
import { import {
addBatchChatMessage, addBatchChatMessage,
addChatMessage, addChatMessage,
updateChatMessage updateChatMessage
} from '@/api/system/chatMessage'; } from '@/api/system/chatMessage';
import { ChatMessage } from '@/api/system/chatMessage/model'; import { ChatMessage } from '@/api/system/chatMessage/model';
import { useThemeStore } from '@/store/modules/theme'; import { useThemeStore } from '@/store/modules/theme';
import { storeToRefs } from 'pinia'; import { storeToRefs } from 'pinia';
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types'; import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
import { FormInstance, RuleObject } from 'ant-design-vue/es/form'; import { FormInstance, RuleObject } from 'ant-design-vue/es/form';
import 'bytemd/dist/index.min.css'; import 'bytemd/dist/index.min.css';
import 'github-markdown-css/github-markdown-light.css'; import 'github-markdown-css/github-markdown-light.css';
// // 链接、删除线、复选框、表格等的插件 // // 链接、删除线、复选框、表格等的插件
import gfm from '@bytemd/plugin-gfm'; import gfm from '@bytemd/plugin-gfm';
// // 插件的中文语言文件 // // 插件的中文语言文件
import zh_HansGfm from '@bytemd/plugin-gfm/locales/zh_Hans.json'; import zh_HansGfm from '@bytemd/plugin-gfm/locales/zh_Hans.json';
// 中文语言文件 // 中文语言文件
import zh_Hans from 'bytemd/locales/zh_Hans.json'; import zh_Hans from 'bytemd/locales/zh_Hans.json';
import 'bytemd/dist/index.min.css'; import 'bytemd/dist/index.min.css';
import highlight from '@bytemd/plugin-highlight-ssr'; import highlight from '@bytemd/plugin-highlight-ssr';
import 'highlight.js/styles/default.css'; import 'highlight.js/styles/default.css';
import { User } from '@/api/system/user/model'; import { ShopMerchantAccount } from '@/api/shop/shopMerchantAccount/model';
import { User } from '@/api/system/user/model';
// 是否是修改 // 是否是修改
const isUpdate = ref(false); const isUpdate = ref(false);
const useForm = Form.useForm; const useForm = Form.useForm;
// 是否开启响应式布局 // 是否开启响应式布局
const themeStore = useThemeStore(); const themeStore = useThemeStore();
const { styleResponsive } = storeToRefs(themeStore); const { styleResponsive } = storeToRefs(themeStore);
const props = defineProps<{ const props = defineProps<{
// 弹窗是否打开 // 弹窗是否打开
visible: boolean; visible: boolean;
// 修改回显的数据 // 修改回显的数据
data?: ChatMessage | null; data?: ChatMessage | null;
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'done'): void; (e: 'done'): void;
(e: 'update:visible', visible: boolean): void; (e: 'update:visible', visible: boolean): void;
}>(); }>();
// 提交状态 // 提交状态
const loading = ref(false); const loading = ref(false);
// 是否显示最大化切换按钮 // 是否显示最大化切换按钮
const maxable = ref(true); const maxable = ref(true);
const content = ref(''); const content = ref('');
// 表格选中数据 // 表格选中数据
const formRef = ref<FormInstance | null>(null); const formRef = ref<FormInstance | null>(null);
const images = ref<ItemType[]>([]); const images = ref<ItemType[]>([]);
const merchantAccount = ref<any[]>([]); const merchantAccount = ref<ShopMerchantAccount[]>([]);
const formDataBatch = ref<ChatMessage[]>([]); const formDataBatch = ref<ChatMessage[]>([]);
// 用户信息 // 用户信息
const form = reactive<ChatMessage>({ const form = reactive<ChatMessage>({
formUserId: undefined, formUserId: undefined,
toUserId: undefined, toUserId: undefined,
toUserIds: undefined, toUserIds: undefined,
type: 'text', type: 'text',
content: '', content: '',
sideTo: undefined, sideTo: undefined,
sideFrom: undefined, sideFrom: undefined,
withdraw: undefined, withdraw: undefined,
fileInfo: undefined, fileInfo: undefined,
hasContact: undefined, hasContact: undefined,
status: 0, status: 0,
formUserName: '', formUserName: '',
createTime: '' createTime: ''
}); });
/* 更新visible */ /* 更新visible */
const updateVisible = (value: boolean) => { const updateVisible = (value: boolean) => {
emit('update:visible', value); emit('update:visible', value);
}; };
// 表单验证规则 // 表单验证规则
const rules = reactive({ const rules = reactive({
toUserIds: [ toUserIds: [
{ {
required: true, required: true,
type: 'any', type: 'any',
message: '请选择用户', message: '请选择用户',
trigger: 'blur' trigger: 'blur'
}
],
type: [
{
required: true,
type: 'string',
message: '请选择消息类型',
trigger: 'blur'
}
],
content: [
{
required: true,
type: 'string',
message: '请填写消息内容',
trigger: 'blur',
validator: async (_rule: RuleObject, value: string) => {
if (content.value == '') {
return Promise.reject('请填写消息内容');
}
return Promise.resolve();
}
}
]
});
// 插件
const plugins = ref([
gfm({
locale: zh_HansGfm
}),
highlight()
]);
const onToUser = (item: User) => {
form.toUserIds = [item.phone];
form.toUserName = [item.phone];
console.log(form);
// form.toUserId = item.userId;
// form.toUserName = item.nickname;
};
const chooseType = (item: any) => {
form.type = 'text';
};
const { resetFields } = useForm(form, rules);
/* 保存编辑 */
const save = () => {
if (!formRef.value) {
return;
} }
formRef.value ],
.validate() type: [
.then(() => { {
loading.value = true; required: true,
if (!isUpdate.value) { type: 'string',
merchantAccount.value.map((d) => { message: '请选择消息类型',
formDataBatch.value.push({ trigger: 'blur'
toUserId: d.userId, }
type: form.type, ],
content: content.value content: [
}); {
}); required: true,
addBatchChatMessage(formDataBatch.value) type: 'string',
.then((msg) => { message: '请填写消息内容',
loading.value = false; trigger: 'blur',
form.toUserIds = []; validator: async (_rule: RuleObject, value: string) => {
formDataBatch.value = []; if (content.value == '') {
merchantAccount.value = []; return Promise.reject('请填写消息内容');
form.toUserName = undefined;
message.success(msg);
updateVisible(false);
emit('done');
})
.catch((e) => {
loading.value = false;
message.error(e.message);
});
return;
} }
const formData = { return Promise.resolve();
...form, }
status: isUpdate.value ? 1 : 0, }
content: content.value ]
}; });
const saveOrUpdate = isUpdate.value
? updateChatMessage // 插件
: addChatMessage; const plugins = ref([
saveOrUpdate(formData) gfm({
.then(() => { locale: zh_HansGfm
}),
highlight()
]);
const onToUser = (item: User) => {
form.toUserIds = [item.phone];
form.toUserName = [item.phone];
console.log(form);
// form.toUserId = item.userId;
// form.toUserName = item.nickname;
};
const chooseType = (item: any) => {
form.type = 'text';
};
const { resetFields } = useForm(form, rules);
/* 保存编辑 */
const save = () => {
if (!formRef.value) {
return;
}
formRef.value
.validate()
.then(() => {
loading.value = true;
if (!isUpdate.value) {
merchantAccount.value.map((d) => {
formDataBatch.value.push({
toUserId: d.userId,
type: form.type,
content: content.value
});
});
addBatchChatMessage(formDataBatch.value)
.then((msg) => {
loading.value = false; loading.value = false;
form.toUserIds = [];
formDataBatch.value = [];
merchantAccount.value = [];
form.toUserName = undefined; form.toUserName = undefined;
message.success(msg);
updateVisible(false); updateVisible(false);
emit('done'); emit('done');
}) })
@@ -257,42 +237,63 @@
loading.value = false; loading.value = false;
message.error(e.message); message.error(e.message);
}); });
}) return;
.catch(() => {});
};
watch(
() => props.visible,
(visible) => {
if (visible) {
images.value = [];
content.value = '';
if (props.data) {
assignObject(form, props.data);
// 标记已读
updateChatMessage({ id: props.data.id, status: 1 });
emit('done');
isUpdate.value = true;
} else {
isUpdate.value = false;
}
} else {
resetFields();
} }
}, const formData = {
{ immediate: true } ...form,
); status: isUpdate.value ? 1 : 0,
content: content.value
};
const saveOrUpdate = isUpdate.value
? updateChatMessage
: addChatMessage;
saveOrUpdate(formData)
.then(() => {
loading.value = false;
form.toUserName = undefined;
updateVisible(false);
emit('done');
})
.catch((e) => {
loading.value = false;
message.error(e.message);
});
})
.catch(() => {});
};
watch(
() => props.visible,
(visible) => {
if (visible) {
images.value = [];
content.value = '';
if (props.data) {
assignObject(form, props.data);
// 标记已读
updateChatMessage({ id: props.data.id, status: 1 });
emit('done');
isUpdate.value = true;
} else {
isUpdate.value = false;
}
} else {
resetFields();
}
},
{ immediate: true }
);
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.user-content { .user-content {
max-width: 100%; max-width: 100%;
border-radius: 8px !important; border-radius: 8px !important;
background-color: #a2ec71; background-color: #a2ec71;
border: none; border: none;
} }
.admin-content { .admin-content {
border-radius: 8px !important; border-radius: 8px !important;
border: 3px solid #f1f1f1; border: 3px solid #f1f1f1;
} }
</style> </style>