修复已知问题

This commit is contained in:
2024-10-10 21:04:39 +08:00
parent 1b430ef7a0
commit 1d8f8e8a7d
8 changed files with 182 additions and 66 deletions
+5
View File
@@ -6,7 +6,12 @@ import type { PageParam } from '@/api';
export interface FormRecord {
formRecordId?: number;
formId?: number;
type?: string;
name?: string;
phone?: string;
age?: number;
extra?: string;
dateTime?: string;
formData?: string;
formObj?: Object;
userId?: number;
+2 -2
View File
@@ -47,9 +47,9 @@ export interface PageParam {
// 搜素关键词
keywords?: string;
// 起始时间
createTimeStart?: number;
createTimeStart?: string;
// 结束时间
createTimeEnd?: number;
createTimeEnd?: string;
timeStart?: number;
timeEnd?: number;
isExpireTime?: number;
+2 -2
View File
@@ -5,7 +5,7 @@ import type {
WebsiteField,
WebsiteFieldParam
} from '@/api/cms/website/field/model';
import { SERVER_API_URL } from '@/config/setting';
import { MODULES_API_URL, SERVER_API_URL } from "@/config/setting";
/**
* 分页查询项目参数
@@ -134,7 +134,7 @@ export async function checkExistence(
*/
export async function configWebsiteField(params?: WebsiteFieldParam) {
const res = await request.get<ApiResult<Config>>(
SERVER_API_URL + '/cms/cms-website-field/config',
MODULES_API_URL + '/cms/website-field/config',
{
params
}
+11 -1
View File
@@ -66,9 +66,15 @@ export function openUrl(url: string, params?: any): void {
* @param id 128
* @param d 项目数据
* 拼接规则: {域名}{path}?spm=c.{用户ID}.{租户ID}.{栏目ID}.{商品ID}.{timestamp}&token={token}
* @param onlyUrl
* @return https:///websoft.top/product/detail/128.html?spm=c.5.3057.10005.undefined&token=DDkr1PpE9DouIVMjLEMt9733QsgG7oNV
*/
export function openSpmUrl(path?: string, d?: any, id = 0): void {
export function openSpmUrl(
path?: string,
d?: any,
id = 0,
onlyUrl?: boolean
): any {
// const domain = getSiteDomain();
const domain = localStorage.getItem('Domain');
const spm = ref<string>('');
@@ -104,6 +110,10 @@ export function openSpmUrl(path?: string, d?: any, id = 0): void {
return;
}
if (onlyUrl == true) {
return `https://${domain}${path}${spm.value}`;
}
// TODO 开发环境
if (import.meta.env.DEV) {
console.log('开发环境');
+92 -11
View File
@@ -1,6 +1,30 @@
<!-- 搜索表单 -->
<template>
<a-space :size="10" style="flex-wrap: wrap">
<a-button
danger
type="primary"
class="ele-btn-icon"
:disabled="selection?.length === 0"
@click="removeBatch"
>
<template #icon>
<DeleteOutlined />
</template>
<span>批量删除</span>
</a-button>
<FormSelect
v-model:value="where.formId"
:placeholder="`选择表单名称`"
style="width: 220px"
@change="chooseFormName"
/>
<a-range-picker
v-model:value="dateRange"
@change="search"
value-format="YYYY-MM-DD"
class="ele-fluid"
/>
<a-input-search
allow-clear
placeholder="请输入关键词"
@@ -8,30 +32,28 @@
@pressEnter="search"
@search="search"
/>
<FormSelect
v-model:value="where.formId"
:placeholder="`选择表单名称`"
style="width: 220px"
@change="chooseFormName"
/>
<a-button @click="reset">重置</a-button>
<a-button type="primary" class="ele-btn-icon">
<a-button type="primary" class="ele-btn-icon" @click="handleExport">
<span>导出xls</span>
</a-button>
</a-space>
</template>
<script lang="ts" setup>
import { watch } from 'vue';
import { ref, watch } from 'vue';
import useSearch from '@/utils/use-search';
import { FormRecordParam } from '@/api/cms/form-record/model';
import { FormRecord, FormRecordParam } from '@/api/cms/form-record/model';
import { Form } from '@/api/cms/form/model';
import {assignObject} from "ele-admin-pro";
import { toDateString } from 'ele-admin-pro';
import { DeleteOutlined } from '@ant-design/icons-vue';
import { BookingOrder } from '@/api/booking/bookingOrder/model';
import { utils, writeFile } from 'xlsx';
import { message } from 'ant-design-vue';
const props = withDefaults(
defineProps<{
// 选中的角色
selection?: [];
selection?: FormRecord[];
data?: Form;
}>(),
{}
@@ -52,21 +74,80 @@
keywords: undefined
});
// 请求状态
const loading = ref(false);
// 日期范围选择
const dateRange = ref<[string, string]>(['', '']);
const orders = ref<BookingOrder[] | any[]>();
const xlsFileName = ref<string>();
const chooseFormName = (id: number) => {
where.formId = id;
emit('search', where);
};
const search = () => {
const [d1, d2] = dateRange.value ?? [];
xlsFileName.value = `${d1}至${d2}`;
where.createTimeStart = d1 ? d1 + ' 00:00:00' : '';
where.createTimeEnd = d2 ? d2 + ' 23:59:59' : '';
emit('search', where);
};
// 批量删除
const removeBatch = () => {
emit('remove');
};
/* 重置 */
const reset = () => {
resetFields();
dateRange.value = ['', ''];
search();
};
// 导出
const handleExport = async () => {
loading.value = true;
const array: (string | number)[][] = [
['姓名', '电话', '年龄', '类型', '预定信息', '预约日期']
];
orders.value = props.selection?.map((d) => {
array.push([
`${d.name}`,
`${d.phone}`,
`${d.age}`,
`${d.type}`,
`${d.extra}`,
`${d.dateTime}`,
]);
});
const sheetName = `预约记录导出`;
const workbook = {
SheetNames: [sheetName],
Sheets: {}
};
const sheet = utils.aoa_to_sheet(array);
workbook.Sheets[sheetName] = sheet;
// 设置列宽
sheet['!cols'] = [
{ wch: 10 },
{ wch: 10 },
{ wch: 10 },
{ wch: 10 },
{ wch: 10 },
{ wch: 10 }
];
message.loading('正在导出...');
setTimeout(() => {
writeFile(
workbook,
`${where.createTimeEnd ? xlsFileName.value + '_' : ''}${sheetName}.xlsx`
);
loading.value = false;
}, 2000);
};
watch(
() => props.selection,
() => {}
+39 -14
View File
@@ -8,6 +8,7 @@
:columns="columns"
:datasource="datasource"
:customRow="customRow"
v-model:selection="selection"
tool-class="ele-toolbar-form"
class="sys-org-table"
>
@@ -137,27 +138,51 @@
// 表格列配置
const columns = ref<ColumnItem[]>([
{
title: 'ID',
width: 90,
dataIndex: 'formRecordId'
},
{
title: '手机号码',
dataIndex: 'phone',
width: 180,
key: 'phone'
},
// {
// title: 'ID',
// width: 90,
// dataIndex: 'formRecordId'
// },
{
title: '姓名',
dataIndex: 'name',
key: 'name'
},
{
title: '其他数据',
dataIndex: 'component',
key: 'component'
title: '手机号码',
dataIndex: 'phone',
key: 'phone'
},
{
title: '类型',
dataIndex: 'type',
key: 'type'
},
{
title: '年龄',
dataIndex: 'age',
key: 'age'
},
{
title: '本次接种的剂次',
dataIndex: 'extra',
key: 'extra'
},
{
title: '备注信息',
dataIndex: 'comments',
key: 'comments'
},
{
title: '预约时间',
dataIndex: 'dateTime',
key: 'dateTime'
},
// {
// title: '其他数据',
// dataIndex: 'component',
// key: 'component'
// },
// {
// title: '状态',
// dataIndex: 'status',
+29 -34
View File
@@ -21,9 +21,11 @@
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'name'">
<span @click="openPreview('/form/' + record.formId)">{{
record.name
}}</span>
<span
class="cursor-pointer"
@click="openSpmUrl('/form', record, record.formId, true)"
>{{ record.name }}</span
>
</template>
<template v-if="column.key === 'path'">
<span class="ele-text-placeholder">{{ record.path }}</span>
@@ -31,7 +33,7 @@
<template v-if="column.key === 'component'">
<span class="ele-text-placeholder">{{ record.component }}</span>
</template>
<template v-if="column.key === 'formData'"> </template>
<template v-if="column.key === 'formData'"></template>
<template v-if="column.key === 'status'">
<a-badge
v-if="record.status === 0"
@@ -48,15 +50,21 @@
</template>
<template v-if="column.key === 'action'">
<a-space>
<a @click="openUrl('/cms/form-record?id=' + record.formId)"
><SolutionOutlined />表单数据</a
<a @click="openUrl('/cms/form-record?id=' + record.formId)">
<SolutionOutlined />
表单数据</a
>
<a-divider type="vertical" />
<a-popover>
<template #content>
<div class="ele-cell">
<ele-qr-code
:value="`${domain}/form/${record.formId}`"
:value="`${openSpmUrl(
'/form',
record,
record.formId,
true
)}`"
:size="160"
level="M"
:margin="1"
@@ -64,7 +72,10 @@
手机扫一扫
</div>
</template>
<a @click="onShare"><QrcodeOutlined />分享</a>
<a @click="onShare">
<QrcodeOutlined />
分享</a
>
</a-popover>
<a-divider type="vertical" />
<a @click="openEdit(record)">设计</a>
@@ -120,10 +131,11 @@
} from '@/api/cms/form';
import type { Form, FormParam } from '@/api/cms/form/model';
import { useRouter } from 'vue-router';
import { openPreview, openUrl } from '@/utils/common';
import { openPreview, openSpmUrl, openUrl } from '@/utils/common';
import { useTenantStore } from '@/store/modules/tenant';
import { storeToRefs } from 'pinia';
import { getSiteInfo } from '@/api/layout';
const { push } = useRouter();
const { currentRoute } = useRouter();
// 表格实例
@@ -135,19 +147,16 @@
const current = ref<Form | null>(null);
// 是否显示编辑弹窗
const showEdit = ref(false);
// 是否显示批量移动弹窗
const showMove = ref(false);
// 二维码
const showQrCode = ref(false);
// 加载状态
const loading = ref(true);
// 网站域名
const domain = ref('');
const domain = ref(localStorage.getItem('Domain'));
getSiteInfo().then((data) => {
// tenantId.value = data.tenantId;
domain.value = String(data.domain);
});
// getSiteInfo().then((data) => {
// domain.value = String(data.domain);
// });
// 表格数据源
const datasource: DatasourceFunction = ({
@@ -225,22 +234,6 @@
});
};
const onOpen = (e) => {
console.log(e);
};
const openForm = (row?: Form) => {
push({
path: '/cms/form/detail',
query: { id: row?.formId }
});
};
/* 打开批量移动弹窗 */
const openMove = () => {
showMove.value = true;
};
/* 删除单个 */
const remove = (row: Form) => {
const hide = message.loading('请求中..', 0);
@@ -298,8 +291,8 @@
},
// 行双击事件
onDblclick: () => {
openUrl('/cms/form-record?id=' + record.formId);
// openEdit(record);
// openUrl('/cms/form-record?id=' + record.formId);
openEdit(record);
}
};
};
@@ -329,6 +322,7 @@
padding: 0 4px;
margin-bottom: 0;
}
.design-item {
margin: auto;
display: flex;
@@ -341,6 +335,7 @@
border-radius: 70px;
background: url('data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20version%3D%221.1%22%3E%3Cdefs%3E%3ClinearGradient%20id%3D%221%22%20x1%3D%220%22%20x2%3D%221%22%20y1%3D%220%22%20y2%3D%220%22%20gradientTransform%3D%22matrix(6.123233995736766e-17%2C%201%2C%20-0.024693877551020406%2C%206.123233995736766e-17%2C%200.5%2C%200)%22%3E%3Cstop%20stop-color%3D%22%230a060d%22%20stop-opacity%3D%221%22%20offset%3D%220%22%3E%3C%2Fstop%3E%3Cstop%20stop-color%3D%22%23660061%22%20stop-opacity%3D%221%22%20offset%3D%220.95%22%3E%3C%2Fstop%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3Crect%20width%3D%22100%25%22%20height%3D%22100%25%22%20fill%3D%22url(%231)%22%3E%3C%2Frect%3E%3C%2Fsvg%3E');
}
.ele-cell {
display: flex;
flex-direction: column;