style: lint格式化文件

This commit is contained in:
2025-10-21 18:04:02 +08:00
parent f9ca969fec
commit 7629120548
1092 changed files with 148218 additions and 157907 deletions

View File

@ -1,160 +1,142 @@
<template>
<div style="display:flex;background-color:white;height: 100%">
<div
class="w-1/3 xl:w-1/4 overflow-hidden bg-white h-full"
:style="{ 'border-right': '1px solid #e5e7eb' }"
>
<BasicTree
:title="t('生成器类型')"
:clickRowToExpand="true"
:treeData="treeData"
:fieldNames="{ key: 'id', title: 'name' }"
@select="handleSelect"
/>
<div style="display: flex; background-color: white; height: 100%">
<div class="w-1/3 xl:w-1/4 overflow-hidden bg-white h-full" :style="{ 'border-right': '1px solid #e5e7eb' }">
<BasicTree :title="t('生成器类型')" :clickRowToExpand="true" :treeData="treeData" :fieldNames="{ key: 'id', title: 'name' }" @select="handleSelect" />
</div>
<BasicTable @register="registerTable" class="w-2/3 xl:w-3/4">
<template #toolbar>
<div class="toolbar-defined">
<a-button @click="previewForm" v-auth="'form-design:previewForm'">{{
t('预览表单')
}}</a-button>
<a-button @click="queryHistory">{{ t('历史记录') }}</a-button>
</div>
</template>
<template #action="{ record }">
<TableAction
:actions="[
{
icon: 'clarity:note-edit-line',
auth: 'form-design:edit',
onClick: handleEdit.bind(null, record,0),
}
]"
/>
</template>
<template #toolbar>
<div class="toolbar-defined">
<a-button @click="previewForm" v-auth="'form-design:previewForm'">{{ t('预览表单') }}</a-button>
<a-button @click="queryHistory">{{ t('历史记录') }}</a-button>
</div>
</template>
<template #action="{ record }">
<TableAction
:actions="[
{
icon: 'clarity:note-edit-line',
auth: 'form-design:edit',
onClick: handleEdit.bind(null, record, 0)
}
]"
/>
</template>
</BasicTable>
</div>
</template>
<script lang="ts" setup>
import { h, onMounted, ref, createVNode, reactive, computed,provide,inject } from 'vue';
import { h, onMounted, ref, createVNode, reactive, computed, provide, inject } from 'vue';
import { BasicTable, useTable, TableAction, FormSchema, BasicColumn } from '/@/components/Table';
import {
getFormTemplatePage,
deleteFormTemplate,
updateFormTemplateStatus,
getFormTemplate,
} from '/@/api/form/design';
import { getFormTemplatePage, deleteFormTemplate, updateFormTemplateStatus, getFormTemplate } from '/@/api/form/design';
import { FormTypeEnum } from '/@/enums/formtypeEnum';
import { BasicTree, TreeItem } from '/@/components/Tree';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
const { notification } = useMessage();
const { t } = useI18n();
const treeData = ref<TreeItem[]>([
{ "id":'0',name:'数据优先模板'},
{ "id":'1',name:'界面优先模板'},
{ "id":'2',name:'简易模板'}
{ id: '0', name: '数据优先模板' },
{ id: '1', name: '界面优先模板' },
{ id: '2', name: '简易模板' }
]);
const selectId = ref('');
const selectedKeys = ref<string[]>([]);
const searchFormSchema: FormSchema[] = [
{
field: 'keyword',
label: t('关键字'),
component: 'Input',
componentProps: {
placeholder: t('请输入关键字'),
},
},
field: 'keyword',
label: t('关键字'),
component: 'Input',
componentProps: {
placeholder: t('请输入关键字')
}
}
];
const columns: BasicColumn[] = [
{
dataIndex: 'name',
title: t('名称'),
align: 'left',
dataIndex: 'name',
title: t('名称'),
align: 'left'
},
{
dataIndex: 'formDesignType',
title: t('模板类型'),
width: 120,
align: 'left',
customRender: ({ record }) => {
if(record.formDesignType==0){
return "数据优先模板";
}else if(record.formDesignType==1){
return "界面优先模板";
}else if(record.formDesignType==2){
return "简易模板";
}else{
return '';
dataIndex: 'formDesignType',
title: t('模板类型'),
width: 120,
align: 'left',
customRender: ({ record }) => {
if (record.formDesignType == 0) {
return '数据优先模板';
} else if (record.formDesignType == 1) {
return '界面优先模板';
} else if (record.formDesignType == 2) {
return '简易模板';
} else {
return '';
}
}
},
},
{
dataIndex: 'createUserName',
title: t('创建人'),
align: 'left',
dataIndex: 'createUserName',
title: t('创建人'),
align: 'left'
},
{
dataIndex: 'createDate',
title: t('创建时间'),
align: 'left',
dataIndex: 'createDate',
title: t('创建时间'),
align: 'left'
},
{
dataIndex: 'remark',
align: 'left',
title: t('备注'),
},
dataIndex: 'remark',
align: 'left',
title: t('备注')
}
];
const formConfig = {
rowProps: {
gutter: 16,
gutter: 16
},
schemas: searchFormSchema,
fieldMapToTime: [],
showResetButton: false,
showResetButton: false
};
const [registerTable, { reload:reload, setSelectedRowKeys:setSelectedRowKeys}] = useTable({
const [registerTable, { reload: reload, setSelectedRowKeys: setSelectedRowKeys }] = useTable({
api: getFormTemplatePage,
rowKey: 'id',
title: '表单列表',
columns:columns,
columns: columns,
formConfig,
beforeFetch: (params) => {
//发送请求默认新增 左边树结构所选id
return { ...params, category: selectId.value, type: FormTypeEnum.SYSTEM_FORM };
//发送请求默认新增 左边树结构所选id
return { ...params, category: selectId.value, type: FormTypeEnum.SYSTEM_FORM };
},
useSearchForm: true,
showTableSetting: true,
striped: false,
actionColumn: {
width: 80,
title: t('操作'),
dataIndex: 'action',
slots: { customRender: 'action' },
width: 80,
title: t('操作'),
dataIndex: 'action',
slots: { customRender: 'action' }
},
rowSelection: {
onChange: onSelectChange,
onChange: onSelectChange
},
customRow,
tableSetting: {
size: false,
setting: false,
},
size: false,
setting: false
}
});
const formId = computed(() => {
return selectedKeys.value && selectedKeys.value.length
? selectedKeys.value[selectedKeys.value.length - 1]
: '';
return selectedKeys.value && selectedKeys.value.length ? selectedKeys.value[selectedKeys.value.length - 1] : '';
});
const openDesignModal = inject('openDesignModal');
@ -169,87 +151,83 @@
const noticeInfo = inject('noticeInfo');
function onSelectChange(rowKeys: string[]) {
selectedKeys.value = rowKeys;
setSelectedRowKeys(selectedKeys.value);
selectedKeys.value = rowKeys;
setSelectedRowKeys(selectedKeys.value);
}
function customRow(record: Recordable) {
return {
onClick: () => {
let selectedRowKeys = [...selectedKeys.value];
if (selectedRowKeys.indexOf(record.id) >= 0) {
let index = selectedRowKeys.indexOf(record.id);
selectedRowKeys.splice(index, 1);
} else {
selectedRowKeys.push(record.id);
}
selectedKeys.value = selectedRowKeys;
setSelectedRowKeys(selectedRowKeys);
},
};
return {
onClick: () => {
let selectedRowKeys = [...selectedKeys.value];
if (selectedRowKeys.indexOf(record.id) >= 0) {
let index = selectedRowKeys.indexOf(record.id);
selectedRowKeys.splice(index, 1);
} else {
selectedRowKeys.push(record.id);
}
selectedKeys.value = selectedRowKeys;
setSelectedRowKeys(selectedRowKeys);
}
};
}
function handleEdit(record: Recordable,fType:number) {
formType.value=fType;
switch (record.formDesignType) {
case 0:
openDataFirstModal(true, {
id: record.id,
isUpdate: true,
});
break;
case 1:
openCodeFirstModal(true, {
id: record.id,
isUpdate: true,
});
break;
case 2:
openSimpleTemplateModal(true, {
id: record.id,
isUpdate: true,
});
break;
default:
notification.error({
message: t('提示'),
description: '该表单缺少模板类型',
});
}
function handleEdit(record: Recordable, fType: number) {
formType.value = fType;
switch (record.formDesignType) {
case 0:
openDataFirstModal(true, {
id: record.id,
isUpdate: true
});
break;
case 1:
openCodeFirstModal(true, {
id: record.id,
isUpdate: true
});
break;
case 2:
openSimpleTemplateModal(true, {
id: record.id,
isUpdate: true
});
break;
default:
notification.error({
message: t('提示'),
description: '该表单缺少模板类型'
});
}
}
function handleSelect(selectIds) {
selectId.value = selectIds[0];
reload({ searchInfo: { category: selectIds[0] } });
selectId.value = selectIds[0];
reload({ searchInfo: { category: selectIds[0] } });
}
async function previewForm() {
if (!formId.value) {
noticeInfo('预览');
return;
}
const templateJson = await getFormTemplate(formId.value);
openPreviewModal(true, { title: t('预览'), formJson: templateJson.formJson });
if (!formId.value) {
noticeInfo('预览');
return;
}
const templateJson = await getFormTemplate(formId.value);
openPreviewModal(true, { title: t('预览'), formJson: templateJson.formJson });
}
async function queryHistory() {
if (!formId.value) {
notification.warning({
message: t('提示'),
description: t(`请先选中一行后再查看当前表单历史记录!`),
});
return;
}
openHistoryModal(true, { title: t('历史记录'), formId: formId.value });
if (!formId.value) {
notification.warning({
message: t('提示'),
description: t(`请先选中一行后再查看当前表单历史记录!`)
});
return;
}
openHistoryModal(true, { title: t('历史记录'), formId: formId.value });
}
defineExpose({
reload
});
</script>
<style lang="less" scoped>
</style>
<style lang="less" scoped></style>

View File

@ -1,69 +1,47 @@
<template>
<div style="display:flex;background-color:white;height: 100%">
<div
class="w-1/3 xl:w-1/4 overflow-hidden bg-white h-full"
:style="{ 'border-right': '1px solid #e5e7eb' }"
>
<BasicTree
:title="t('表单分类')"
:clickRowToExpand="true"
:treeData="treeData"
:fieldNames="{ key: 'id', title: 'name' }"
@select="handleSelect"
/>
<div style="display: flex; background-color: white; height: 100%">
<div class="w-1/3 xl:w-1/4 overflow-hidden bg-white h-full" :style="{ 'border-right': '1px solid #e5e7eb' }">
<BasicTree :title="t('表单分类')" :clickRowToExpand="true" :treeData="treeData" :fieldNames="{ key: 'id', title: 'name' }" @select="handleSelect" />
</div>
<BasicTable @register="registerTable" class="w-2/3 xl:w-3/4">
<template #toolbar>
<div class="toolbar-defined">
<a-button type="primary" @click="handleCreate" v-auth="'form-design:add'">
<template #icon><PlusOutlined /></template>
{{ t('新增') }}
</a-button>
<a-button @click="handleDelete" v-auth="'form-design:batchDelete'">{{
t('批量删除')
}}</a-button>
<a-button @click="previewForm" v-auth="'form-design:previewForm'">{{
t('预览表单')
}}</a-button>
<a-button @click="queryHistory">{{ t('历史记录') }}</a-button>
<a-button @click="handleCategory" v-auth="'form-design:classifyMGT'">{{
t('分类管理')
}}</a-button>
<a-button @click="handleCodeGenerator" v-auth="'form-design:generatedCode'">{{
t('生成代码')
}}</a-button>
</div>
</template>
<template #action="{ record }">
<TableAction
:actions="[
{
icon: 'clarity:note-edit-line',
auth: 'form-design:edit',
onClick: handleEdit.bind(null, record,1),
},
{
icon: 'ant-design:delete-outlined',
auth: 'form-design:delete',
color: 'error',
onClick: handleDelete.bind(null, record),
},
]"
/>
</template>
<template #toolbar>
<div class="toolbar-defined">
<a-button type="primary" @click="handleCreate" v-auth="'form-design:add'">
<template #icon><PlusOutlined /></template>
{{ t('新增') }}
</a-button>
<a-button @click="handleDelete" v-auth="'form-design:batchDelete'">{{ t('批量删除') }}</a-button>
<a-button @click="previewForm" v-auth="'form-design:previewForm'">{{ t('预览表单') }}</a-button>
<a-button @click="queryHistory">{{ t('历史记录') }}</a-button>
<a-button @click="handleCategory" v-auth="'form-design:classifyMGT'">{{ t('分类管理') }}</a-button>
<a-button @click="handleCodeGenerator" v-auth="'form-design:generatedCode'">{{ t('生成代码') }}</a-button>
</div>
</template>
<template #action="{ record }">
<TableAction
:actions="[
{
icon: 'clarity:note-edit-line',
auth: 'form-design:edit',
onClick: handleEdit.bind(null, record, 1)
},
{
icon: 'ant-design:delete-outlined',
auth: 'form-design:delete',
color: 'error',
onClick: handleDelete.bind(null, record)
}
]"
/>
</template>
</BasicTable>
</div>
</template>
<script lang="ts" setup>
import { h, onMounted, ref, createVNode, reactive, computed,provide,inject } from 'vue';
import { h, onMounted, ref, createVNode, reactive, computed, provide, inject } from 'vue';
import { BasicTable, useTable, TableAction, FormSchema, BasicColumn } from '/@/components/Table';
import {
getFormTemplatePage,
deleteFormTemplate,
updateFormTemplateStatus,
getFormTemplate,
} from '/@/api/form/design';
import { getFormTemplatePage, deleteFormTemplate, updateFormTemplateStatus, getFormTemplate } from '/@/api/form/design';
import { BasicTree, TreeItem } from '/@/components/Tree';
import { FormTypeEnum } from '/@/enums/formtypeEnum';
import { useMessage } from '/@/hooks/web/useMessage';
@ -71,136 +49,131 @@
import { Switch, Modal } from 'ant-design-vue';
import { useI18n } from '/@/hooks/web/useI18n';
const props = defineProps({
dicId:String
})
dicId: String
});
const { notification } = useMessage();
const { t } = useI18n();
const treeData = ref<TreeItem[]>([]);
const selectId = ref('');
const selectedKeys = ref<string[]>([]);
const searchFormSchema: FormSchema[] = [
{
field: 'keyword',
label: t('关键字'),
component: 'Input',
componentProps: {
placeholder: t('请输入关键字'),
},
},
{
field: 'keyword',
label: t('关键字'),
component: 'Input',
componentProps: {
placeholder: t('请输入关键字')
}
}
];
const columns: BasicColumn[] = [
{
dataIndex: 'name',
title: t('名称'),
align: 'left',
},
{
dataIndex: 'categoryName',
title: t('分类'),
align: 'left',
},
{
dataIndex: 'enabledMark',
title: t('状态'),
width: 120,
align: 'left',
customRender: ({ record }) => {
if (!Reflect.has(record, 'pendingStatus')) {
record.pendingStatus = false;
}
return h(Switch, {
checked: record.enabledMark === 1,
checkedChildren: t('已启用'),
unCheckedChildren: t('已禁用'),
loading: record.pendingStatus,
onChange(checked: boolean) {
record.pendingStatus = true;
const newStatus = checked ? 1 : 0;
const { createMessage } = useMessage();
updateFormTemplateStatus(record.id, newStatus)
.then(() => {
record.enabledMark = newStatus;
createMessage.success(t('已成功修改状态'));
})
.catch(() => {
createMessage.error(t('修改状态失败'));
})
.finally(() => {
record.pendingStatus = false;
});
},
});
{
dataIndex: 'name',
title: t('名称'),
align: 'left'
},
},
{
dataIndex: 'createUserName',
title: t('创建人'),
align: 'left',
},
{
dataIndex: 'createDate',
title: t('创建时间'),
align: 'left',
},
{
dataIndex: 'remark',
align: 'left',
title: t('备注'),
},
{
dataIndex: 'categoryName',
title: t('分类'),
align: 'left'
},
{
dataIndex: 'enabledMark',
title: t('状态'),
width: 120,
align: 'left',
customRender: ({ record }) => {
if (!Reflect.has(record, 'pendingStatus')) {
record.pendingStatus = false;
}
return h(Switch, {
checked: record.enabledMark === 1,
checkedChildren: t('已启用'),
unCheckedChildren: t('已禁用'),
loading: record.pendingStatus,
onChange(checked: boolean) {
record.pendingStatus = true;
const newStatus = checked ? 1 : 0;
const { createMessage } = useMessage();
updateFormTemplateStatus(record.id, newStatus)
.then(() => {
record.enabledMark = newStatus;
createMessage.success(t('已成功修改状态'));
})
.catch(() => {
createMessage.error(t('修改状态失败'));
})
.finally(() => {
record.pendingStatus = false;
});
}
});
}
},
{
dataIndex: 'createUserName',
title: t('创建人'),
align: 'left'
},
{
dataIndex: 'createDate',
title: t('创建时间'),
align: 'left'
},
{
dataIndex: 'remark',
align: 'left',
title: t('备注')
}
];
const formConfig = {
rowProps: {
gutter: 16,
},
schemas: searchFormSchema,
fieldMapToTime: [],
showResetButton: false,
rowProps: {
gutter: 16
},
schemas: searchFormSchema,
fieldMapToTime: [],
showResetButton: false
};
const [registerTable, { reload, setSelectedRowKeys }] = useTable({
api: getFormTemplatePage,
rowKey: 'id',
title: '表单列表',
columns,
formConfig,
beforeFetch: (params) => {
//发送请求默认新增 左边树结构所选id
return { ...params, category: selectId.value, type: FormTypeEnum.CUSTOM_FORM };
},
useSearchForm: true,
showTableSetting: true,
striped: false,
actionColumn: {
width: 80,
title: t('操作'),
dataIndex: 'action',
slots: { customRender: 'action' },
},
rowSelection: {
onChange: onSelectChange,
},
customRow,
tableSetting: {
size: false,
setting: false,
},
api: getFormTemplatePage,
rowKey: 'id',
title: '表单列表',
columns,
formConfig,
beforeFetch: (params) => {
//发送请求默认新增 左边树结构所选id
return { ...params, category: selectId.value, type: FormTypeEnum.CUSTOM_FORM };
},
useSearchForm: true,
showTableSetting: true,
striped: false,
actionColumn: {
width: 80,
title: t('操作'),
dataIndex: 'action',
slots: { customRender: 'action' }
},
rowSelection: {
onChange: onSelectChange
},
customRow,
tableSetting: {
size: false,
setting: false
}
});
const formId = computed(() => {
return selectedKeys.value && selectedKeys.value.length
? selectedKeys.value[selectedKeys.value.length - 1]
: '';
return selectedKeys.value && selectedKeys.value.length ? selectedKeys.value[selectedKeys.value.length - 1] : '';
});
const openDesignModal = inject('openDesignModal');
@ -213,92 +186,91 @@
const openCodeGeneratorModal = inject('openCodeGeneratorModal');
const formType = inject('formType');
const noticeInfo = inject('noticeInfo');
function onSelectChange(rowKeys: string[]) {
selectedKeys.value = rowKeys;
setSelectedRowKeys(selectedKeys.value);
selectedKeys.value = rowKeys;
setSelectedRowKeys(selectedKeys.value);
}
function customRow(record: Recordable) {
return {
onClick: () => {
let selectedRowKeys = [...selectedKeys.value];
if (selectedRowKeys.indexOf(record.id) >= 0) {
let index = selectedRowKeys.indexOf(record.id);
selectedRowKeys.splice(index, 1);
} else {
selectedRowKeys.push(record.id);
}
selectedKeys.value = selectedRowKeys;
setSelectedRowKeys(selectedRowKeys);
},
};
return {
onClick: () => {
let selectedRowKeys = [...selectedKeys.value];
if (selectedRowKeys.indexOf(record.id) >= 0) {
let index = selectedRowKeys.indexOf(record.id);
selectedRowKeys.splice(index, 1);
} else {
selectedRowKeys.push(record.id);
}
selectedKeys.value = selectedRowKeys;
setSelectedRowKeys(selectedRowKeys);
}
};
}
function handleCreate() {
openDesignModal(true, {
title: t('添加表单'),
});
openDesignModal(true, {
title: t('添加表单')
});
}
function handleEdit(record: Recordable,fType:number) {
formType.value=fType;
switch (record.formDesignType) {
case 0:
openDataFirstModal(true, {
id: record.id,
isUpdate: true,
});
break;
case 1:
openCodeFirstModal(true, {
id: record.id,
isUpdate: true,
});
break;
case 2:
openSimpleTemplateModal(true, {
id: record.id,
isUpdate: true,
});
break;
default:
notification.error({
message: t('提示'),
description: '该表单缺少模板类型',
});
}
function handleEdit(record: Recordable, fType: number) {
formType.value = fType;
switch (record.formDesignType) {
case 0:
openDataFirstModal(true, {
id: record.id,
isUpdate: true
});
break;
case 1:
openCodeFirstModal(true, {
id: record.id,
isUpdate: true
});
break;
case 2:
openSimpleTemplateModal(true, {
id: record.id,
isUpdate: true
});
break;
default:
notification.error({
message: t('提示'),
description: '该表单缺少模板类型'
});
}
}
function handleDelete(record: Recordable = {}) {
const ids = record.id ? [record.id] : selectedKeys.value;
if (!ids.length) {
noticeInfo('删除');
return;
}
Modal.confirm({
title: t('提示'),
icon: createVNode(ExclamationCircleOutlined),
content: t('确定要删除所选项吗?'),
onOk() {
deleteFormTemplate(ids).then(() => {
reload();
notification.success({
message: t('提示'),
description: t('删除成功'),
});
});
},
onCancel() {},
okText: t('确认'),
cancelText: t('取消'),
});
const ids = record.id ? [record.id] : selectedKeys.value;
if (!ids.length) {
noticeInfo('删除');
return;
}
Modal.confirm({
title: t('提示'),
icon: createVNode(ExclamationCircleOutlined),
content: t('确定要删除所选项吗?'),
onOk() {
deleteFormTemplate(ids).then(() => {
reload();
notification.success({
message: t('提示'),
description: t('删除成功')
});
});
},
onCancel() {},
okText: t('确认'),
cancelText: t('取消')
});
}
function handleSelect(selectIds) {
selectId.value = selectIds[0];
reload({ searchInfo: { category: selectIds[0] } });
selectId.value = selectIds[0];
reload({ searchInfo: { category: selectIds[0] } });
}
function handleCodeGenerator() {
@ -308,39 +280,37 @@
}
openCodeGeneratorModal(true, { formId: formId.value });
}
async function previewForm() {
if (!formId.value) {
noticeInfo('预览');
return;
}
const templateJson = await getFormTemplate(formId.value);
openPreviewModal(true, { title: t('预览'), formJson: templateJson.formJson });
if (!formId.value) {
noticeInfo('预览');
return;
}
const templateJson = await getFormTemplate(formId.value);
openPreviewModal(true, { title: t('预览'), formJson: templateJson.formJson });
}
async function queryHistory() {
if (!formId.value) {
notification.warning({
message: t('提示'),
description: t(`请先选中一行后再查看当前表单历史记录!`),
});
return;
}
openHistoryModal(true, { title: t('历史记录'), formId: formId.value });
if (!formId.value) {
notification.warning({
message: t('提示'),
description: t(`请先选中一行后再查看当前表单历史记录!`)
});
return;
}
openHistoryModal(true, { title: t('历史记录'), formId: formId.value });
}
async function fetch() {
treeData.value = (await getDicDetailList({
itemId: props.dicId,
})) as unknown as TreeItem[];
treeData.value = (await getDicDetailList({
itemId: props.dicId
})) as unknown as TreeItem[];
}
function handleCategory() {
openCategoryModal(true, { title: t('表单分类管理') });
}
onMounted(() => {
fetch();
});
@ -350,7 +320,4 @@
});
</script>
<style lang="less" scoped>
</style>
<style lang="less" scoped></style>