😎格式化代码
This commit is contained in:
parent
81ce1a5328
commit
402125b814
@ -29,8 +29,4 @@
|
||||
<ProjectReference Include="..\Plugins\Admin.NET.Plugin.GoView\Admin.NET.Plugin.GoView.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Entity\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@ -45,7 +45,7 @@
|
||||
<PackageReference Include="SqlSugarCore" Version="5.1.4.170" />
|
||||
<PackageReference Include="SSH.NET" Version="2024.1.0" />
|
||||
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.4.7" />
|
||||
<PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1113" />
|
||||
<PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1114" />
|
||||
<PackageReference Include="UAParser" Version="3.1.47" />
|
||||
<PackageReference Include="Yitter.IdGenerator" Version="1.0.14" />
|
||||
</ItemGroup>
|
||||
|
||||
@ -71,7 +71,7 @@
|
||||
"vue-router": "^4.4.5",
|
||||
"vue-signature-pad": "^3.0.2",
|
||||
"vue3-tree-org": "^4.2.2",
|
||||
"vxe-pc-ui": "^4.2.34",
|
||||
"vxe-pc-ui": "^4.2.35",
|
||||
"vxe-table": "^4.7.59",
|
||||
"vxe-table-plugin-element": "^4.0.4",
|
||||
"vxe-table-plugin-export-xlsx": "^4.0.7",
|
||||
|
||||
2
Web/src/types/mitt.d.ts
vendored
2
Web/src/types/mitt.d.ts
vendored
@ -24,7 +24,7 @@ declare type MittType<T = any> = {
|
||||
openShareTagsView?: string;
|
||||
onTagsViewRefreshRouterView?: T;
|
||||
onCurrentContextmenuClick?: T;
|
||||
submitRefreshFk?:T
|
||||
submitRefreshFk?: T;
|
||||
};
|
||||
|
||||
// mitt 参数类型定义
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
<template>
|
||||
<div class="sys-codeGenConfig-container">
|
||||
<vxe-modal v-model="state.isShowDialog" title="生成配置" :width="800" :height="350" show-footer show-zoom resize fullscreen
|
||||
@close="cancel">
|
||||
<vxe-modal v-model="state.isShowDialog" title="生成配置" :width="800" :height="350" show-footer show-zoom resize fullscreen @close="cancel">
|
||||
<template #default>
|
||||
<vxe-grid ref="xGrid" class="xGrid-table-style" v-bind="options">
|
||||
<template #drag_default="{}">
|
||||
@ -10,21 +9,17 @@
|
||||
</span>
|
||||
</template>
|
||||
<template #effectType="{ row, $index }">
|
||||
<vxe-select v-model="row.effectType" class="m-2" style="width: 70%" placeholder="Select" transfer
|
||||
:disabled="judgeColumns(row)" @change="effectTypeChange(row, $index)" filterable>
|
||||
<vxe-option v-for="item in state.effectTypeList" :key="item.code" :label="item.value"
|
||||
:value="item.code" />
|
||||
<vxe-select v-model="row.effectType" class="m-2" style="width: 70%" placeholder="Select" transfer :disabled="judgeColumns(row)" @change="effectTypeChange(row, $index)" filterable>
|
||||
<vxe-option v-for="item in state.effectTypeList" :key="item.code" :label="item.value" :value="item.code" />
|
||||
</vxe-select>
|
||||
<vxe-button v-if="row.effectType === 'ApiTreeSelect' || row.effectType === 'fk'" style="width: 30%"
|
||||
icon="vxe-icon-edit" @click="effectTypeChange(row, $index)">修改</vxe-button>
|
||||
<vxe-button v-if="row.effectType === 'ApiTreeSelect' || row.effectType === 'fk'" style="width: 30%" icon="vxe-icon-edit" @click="effectTypeChange(row, $index)">修改</vxe-button>
|
||||
</template>
|
||||
<template #columnComment="{ row }">
|
||||
<vxe-input v-model="row.columnComment" autocomplete="off" />
|
||||
</template>
|
||||
<template #dictType="{ row }">
|
||||
<vxe-select v-model="row.dictTypeCode" class="m-2" :disabled="effectTypeEnable(row)" filterable transfer>
|
||||
<vxe-option v-for="item in state.dictTypeCodeList" :key="item.code" :label="item.name"
|
||||
:value="item.code" />
|
||||
<vxe-option v-for="item in state.dictTypeCodeList" :key="item.code" :label="item.name" :value="item.code" />
|
||||
</vxe-select>
|
||||
</template>
|
||||
<template #whetherTable="{ row }">
|
||||
@ -41,18 +36,15 @@
|
||||
<vxe-tag v-else status="info">否</vxe-tag>
|
||||
</template>
|
||||
<template #queryWhether="{ row }">
|
||||
<vxe-switch readonly v-model="row.queryWhether" open-label="是" close-label="否" :openValue="true"
|
||||
:closeValue="false"></vxe-switch>
|
||||
<vxe-switch readonly v-model="row.queryWhether" open-label="是" close-label="否" :openValue="true" :closeValue="false"></vxe-switch>
|
||||
</template>
|
||||
<template #queryType="{ row }">
|
||||
<vxe-select v-model="row.queryType" class="m-2" placeholder="Select" :disabled="!row.queryWhether"
|
||||
filterable transfer>
|
||||
<vxe-select v-model="row.queryType" class="m-2" placeholder="Select" :disabled="!row.queryWhether" filterable transfer>
|
||||
<vxe-option v-for="item in state.queryTypeList" :key="item.code" :label="item.value" :value="item.code" />
|
||||
</vxe-select>
|
||||
</template>
|
||||
<template #verification="{ row }">
|
||||
<vxe-button status="primary" plain v-if="row.columnKey === 'False' && !row.whetherCommon"
|
||||
@click="openVerifyDialog(row)">校验规则{{ row.ruleCount }}</vxe-button>
|
||||
<vxe-button status="primary" plain v-if="row.columnKey === 'False' && !row.whetherCommon" @click="openVerifyDialog(row)">校验规则{{ row.ruleCount }}</vxe-button>
|
||||
<span v-else></span>
|
||||
</template>
|
||||
</vxe-grid>
|
||||
@ -67,26 +59,28 @@
|
||||
<treeDialog ref="treeDialogRef" @submitRefreshFk="submitRefreshFk" />
|
||||
<verifyDialog ref="verifyDialogRef" @submitVerify="submitVerifyOk" />
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="sysCodeGenConfig">
|
||||
import { nextTick, onMounted, onUnmounted, reactive, ref } from 'vue';
|
||||
import mittBus from '/@/utils/mitt';
|
||||
import fkDialog from '/@/views/system/codeGen/component/fkDialog.vue';
|
||||
import treeDialog from '/@/views/system/codeGen/component/treeDialog.vue';
|
||||
import verifyDialog from '/@/views/system/codeGen/component/verifyDialog.vue';
|
||||
<script lang="ts" setup name="sysCodeGenConfig">
|
||||
import { nextTick, onMounted, onUnmounted, reactive, ref } from 'vue';
|
||||
import mittBus from '/@/utils/mitt';
|
||||
import Sortable from 'sortablejs';
|
||||
import { VxeGridInstance, VxeGridProps } from 'vxe-pc-ui';
|
||||
|
||||
import { getAPI } from '/@/utils/axios-utils';
|
||||
import { SysCodeGenConfigApi, SysConstApi, SysDictDataApi, SysDictTypeApi, SysEnumApi } from '/@/api-services/api';
|
||||
import { VxeGridInstance, VxeGridProps } from 'vxe-pc-ui';
|
||||
import Sortable from 'sortablejs';
|
||||
// import { CodeGenConfig } from '/@/api-services/models/code-gen-config';
|
||||
const xGrid = ref<VxeGridInstance<any>>();
|
||||
const emits = defineEmits(['handleQuery']);
|
||||
const fkDialogRef = ref();
|
||||
const treeDialogRef = ref();
|
||||
const verifyDialogRef = ref();
|
||||
const state = reactive({
|
||||
import fkDialog from '/@/views/system/codeGen/component/fkDialog.vue';
|
||||
import treeDialog from '/@/views/system/codeGen/component/treeDialog.vue';
|
||||
import verifyDialog from '/@/views/system/codeGen/component/verifyDialog.vue';
|
||||
|
||||
import { getAPI } from '/@/utils/axios-utils';
|
||||
import { SysCodeGenConfigApi, SysConstApi, SysDictDataApi, SysDictTypeApi, SysEnumApi } from '/@/api-services/api';
|
||||
// import { CodeGenConfig } from '/@/api-services/models/code-gen-config';
|
||||
|
||||
const xGrid = ref<VxeGridInstance<any>>();
|
||||
const emits = defineEmits(['handleQuery']);
|
||||
const fkDialogRef = ref();
|
||||
const treeDialogRef = ref();
|
||||
const verifyDialogRef = ref();
|
||||
const state = reactive({
|
||||
isShowDialog: false,
|
||||
loading: false,
|
||||
dbData: [] as any,
|
||||
@ -97,9 +91,10 @@
|
||||
allConstSelector: [] as any,
|
||||
allEnumSelector: [] as any,
|
||||
sortable: undefined as any,
|
||||
});
|
||||
// 表格参数配置
|
||||
const options = reactive<VxeGridProps>({
|
||||
});
|
||||
|
||||
// 表格参数配置
|
||||
const options = reactive<VxeGridProps>({
|
||||
id: 'genConfigDialog',
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
@ -225,9 +220,9 @@
|
||||
},
|
||||
],
|
||||
editConfig: { trigger: 'click', mode: 'row', showStatus: true },
|
||||
});
|
||||
});
|
||||
|
||||
const rowDrop = () => {
|
||||
const rowDrop = () => {
|
||||
const el = document.querySelector('.xGrid-table-style .vxe-table--body tbody') as HTMLElement;
|
||||
state.sortable = Sortable.create(el, {
|
||||
animation: 300,
|
||||
@ -261,10 +256,10 @@
|
||||
xGrid.value?.updateData();
|
||||
},
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
// 页面初始化
|
||||
onMounted(async () => {
|
||||
// 页面初始化
|
||||
onMounted(async () => {
|
||||
// 从后端获取字典列表数据,并保存到本地状态管理中
|
||||
var res = await getAPI(SysDictDataApi).apiSysDictDataDataListCodeGet('code_gen_effect_type');
|
||||
state.effectTypeList = res.data.result;
|
||||
@ -291,22 +286,23 @@
|
||||
tableData[data.index] = data;
|
||||
xGrid.value?.loadData(tableData);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// 更新主键
|
||||
const submitRefreshFk = (data: any) => {
|
||||
// 更新主键
|
||||
const submitRefreshFk = (data: any) => {
|
||||
let tableData = xGrid.value?.getData() || [];
|
||||
tableData[data.index] = data;
|
||||
xGrid.value?.reloadData(tableData);
|
||||
};
|
||||
};
|
||||
|
||||
onUnmounted(() => {
|
||||
// 页面初始化
|
||||
onUnmounted(() => {
|
||||
// mittBus.off('submitRefresh', () => {});
|
||||
mittBus.off('submitRefreshFk', () => { });
|
||||
});
|
||||
mittBus.off('submitRefreshFk', () => {});
|
||||
});
|
||||
|
||||
// 控件类型改变
|
||||
const effectTypeChange = (data: any, index: number) => {
|
||||
// 控件类型改变
|
||||
const effectTypeChange = (data: any, index: number) => {
|
||||
let value = data.effectType;
|
||||
if (value === 'fk') {
|
||||
openFkDialog(data, index);
|
||||
@ -322,10 +318,10 @@
|
||||
data.dictTypeCode = '';
|
||||
state.dictTypeCodeList = state.allEnumSelector;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// 查询操作
|
||||
const handleQuery = async (row: any) => {
|
||||
// 查询操作
|
||||
const handleQuery = async (row: any) => {
|
||||
state.loading = true;
|
||||
var res = await getAPI(SysCodeGenConfigApi).apiSysCodeGenConfigListGet(undefined, row.id);
|
||||
var data = res.data.result ?? [];
|
||||
@ -348,54 +344,54 @@
|
||||
});
|
||||
xGrid.value?.loadData(data);
|
||||
state.loading = false;
|
||||
};
|
||||
};
|
||||
|
||||
// 判断是否(用于是否能选择或输入等)
|
||||
function judgeColumns(data: any) {
|
||||
// 判断是否(用于是否能选择或输入等)
|
||||
function judgeColumns(data: any) {
|
||||
return data.whetherCommon == true || data.columnKey === 'True';
|
||||
}
|
||||
}
|
||||
|
||||
function effectTypeEnable(data: any) {
|
||||
function effectTypeEnable(data: any) {
|
||||
var lst = ['Radio', 'Select', 'Checkbox', 'ConstSelector', 'EnumSelector'];
|
||||
return lst.indexOf(data.effectType) === -1;
|
||||
}
|
||||
}
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = async (addRow: any) => {
|
||||
// 打开弹窗
|
||||
const openDialog = async (addRow: any) => {
|
||||
state.isShowDialog = true;
|
||||
|
||||
nextTick(async () => {
|
||||
await handleQuery(addRow);
|
||||
rowDrop();
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
// 打开外键弹窗
|
||||
const openFkDialog = (addRow: any, index: number) => {
|
||||
// 打开外键弹窗
|
||||
const openFkDialog = (addRow: any, index: number) => {
|
||||
addRow.index = index;
|
||||
fkDialogRef.value.openDialog(addRow);
|
||||
};
|
||||
};
|
||||
|
||||
const openTreeDialog = (addRow: any, index: number) => {
|
||||
const openTreeDialog = (addRow: any, index: number) => {
|
||||
addRow.index = index;
|
||||
treeDialogRef.value.openDialog(addRow);
|
||||
};
|
||||
};
|
||||
|
||||
// 打开校验弹窗
|
||||
const openVerifyDialog = (row: any) => {
|
||||
// 打开校验弹窗
|
||||
const openVerifyDialog = (row: any) => {
|
||||
// handleQuery(addRow);
|
||||
// state.isShowDialog = true;
|
||||
verifyDialogRef.value.openDialog(row);
|
||||
};
|
||||
};
|
||||
|
||||
// 验证提交回调
|
||||
const submitVerifyOk = (data: any) => {
|
||||
// 验证提交回调
|
||||
const submitVerifyOk = (data: any) => {
|
||||
let tableData = xGrid.value?.getData() || [];
|
||||
for (let i = 0; i < tableData.length; i++) {
|
||||
if (tableData[i].id == data.id) {
|
||||
tableData[i].rules = data.rules;
|
||||
tableData[i].ruleCount = data.ruleCount;
|
||||
//更新必填项
|
||||
// 更新必填项
|
||||
let rules = new Array();
|
||||
if (data.rules != '' && data.rules !== null) {
|
||||
rules = JSON.parse(data.rules);
|
||||
@ -410,28 +406,27 @@
|
||||
}
|
||||
}
|
||||
xGrid.value?.reloadData(tableData);
|
||||
};
|
||||
};
|
||||
|
||||
// 关闭弹窗
|
||||
const closeDialog = () => {
|
||||
// 关闭弹窗
|
||||
const closeDialog = () => {
|
||||
emits('handleQuery');
|
||||
cancel();
|
||||
};
|
||||
};
|
||||
|
||||
// 取消
|
||||
const cancel = () => {
|
||||
// 取消
|
||||
const cancel = () => {
|
||||
xGrid.value?.loadData([]);
|
||||
state.isShowDialog = false;
|
||||
if (state.sortable) {
|
||||
state.sortable.destroy();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// 提交
|
||||
const submit = async () => {
|
||||
// 提交
|
||||
const submit = async () => {
|
||||
state.loading = true;
|
||||
let lst = xGrid.value?.getData() || [];
|
||||
// console.log(lst);
|
||||
let ignoreFields = ['remoteVerify', 'anyRule', 'columnKey'];
|
||||
lst.forEach((item: any) => {
|
||||
// 必填那一项转换
|
||||
@ -447,15 +442,15 @@
|
||||
await getAPI(SysCodeGenConfigApi).apiSysCodeGenConfigUpdatePost(lst);
|
||||
state.loading = false;
|
||||
closeDialog();
|
||||
};
|
||||
};
|
||||
|
||||
// 导出对象
|
||||
defineExpose({ openDialog });
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.xGrid-table-style .drag-btn {
|
||||
// 导出对象
|
||||
defineExpose({ openDialog });
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.xGrid-table-style .drag-btn {
|
||||
cursor: move;
|
||||
font-size: 20px;
|
||||
}
|
||||
</style>
|
||||
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -1,20 +1,17 @@
|
||||
<template>
|
||||
<div class="sys-dbTable-container">
|
||||
<vxe-modal v-model="state.visible" title="增加表" :width="800" :height="350" resize show-footer show-confirm-button
|
||||
show-cancel-button show-zoom fullscreen @close="cancel">
|
||||
<vxe-modal v-model="state.visible" title="增加表" :width="800" :height="350" resize show-footer show-confirm-button show-cancel-button show-zoom fullscreen @close="cancel">
|
||||
<template #default>
|
||||
<el-divider content-position="left" style="margin: 10px 0 18px 0">数据表信息</el-divider>
|
||||
<el-form :model="state.ruleForm" ref="ruleFormRef" label-width="auto">
|
||||
<el-row>
|
||||
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
||||
<el-form-item label="表名称" prop="tableName"
|
||||
:rules="[{ required: true, message: '名称不能为空', trigger: 'blur' }]">
|
||||
<el-form-item label="表名称" prop="tableName" :rules="[{ required: true, message: '名称不能为空', trigger: 'blur' }]">
|
||||
<el-input v-model.lazy.trim="state.ruleForm.tableName" placeholder="表名称" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
||||
<el-form-item label="描述" prop="description"
|
||||
:rules="[{ required: true, message: '描述不能为空', trigger: 'blur' }]">
|
||||
<el-form-item label="描述" prop="description" :rules="[{ required: true, message: '描述不能为空', trigger: 'blur' }]">
|
||||
<el-input v-model.lazy.trim="state.ruleForm.description" placeholder="描述" clearable type="textarea" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -40,16 +37,13 @@
|
||||
</span>
|
||||
</template>
|
||||
<template #isPrimarykey="{ row }">
|
||||
<vxe-switch readonly v-model="row.isPrimarykey" open-label="是" close-label="否" :openValue="1"
|
||||
:closeValue="0"></vxe-switch>
|
||||
<vxe-switch readonly v-model="row.isPrimarykey" open-label="是" close-label="否" :openValue="1" :closeValue="0"></vxe-switch>
|
||||
</template>
|
||||
<template #isIdentity="{ row }">
|
||||
<vxe-switch readonly v-model="row.isIdentity" open-label="是" close-label="否" :openValue="1"
|
||||
:closeValue="0"></vxe-switch>
|
||||
<vxe-switch readonly v-model="row.isIdentity" open-label="是" close-label="否" :openValue="1" :closeValue="0"></vxe-switch>
|
||||
</template>
|
||||
<template #isNullable="{ row }">
|
||||
<vxe-switch readonly v-model="row.isNullable" open-label="是" close-label="否" :openValue="1"
|
||||
:closeValue="0"></vxe-switch>
|
||||
<vxe-switch readonly v-model="row.isNullable" open-label="是" close-label="否" :openValue="1" :closeValue="0"></vxe-switch>
|
||||
</template>
|
||||
<template #operate="{ row }">
|
||||
<vxe-button mode="text" status="error" icon="vxe-icon-delete" @click="deleteRow(row)" />
|
||||
@ -63,32 +57,31 @@
|
||||
</template>
|
||||
</vxe-modal>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<script lang="tsx" setup name="sysAddTable">
|
||||
import { nextTick, reactive, ref } from 'vue';
|
||||
import { ElMessage, dayjs } from 'element-plus';
|
||||
import { VxeGridInstance, VxeGridProps } from 'vxe-table';
|
||||
import { Rank } from '@element-plus/icons-vue';
|
||||
import Sortable from 'sortablejs';
|
||||
import { dataTypeList } from '../database';
|
||||
<script lang="tsx" setup name="sysAddTable">
|
||||
import { nextTick, reactive, ref } from 'vue';
|
||||
import { ElMessage, dayjs } from 'element-plus';
|
||||
import { VxeGridInstance, VxeGridProps } from 'vxe-table';
|
||||
import Sortable from 'sortablejs';
|
||||
import { dataTypeList } from '../database';
|
||||
|
||||
import { getAPI } from '/@/utils/axios-utils';
|
||||
import { SysDatabaseApi } from '/@/api-services/api';
|
||||
import { UpdateDbTableInput } from '/@/api-services/models';
|
||||
import { getAPI } from '/@/utils/axios-utils';
|
||||
import { SysDatabaseApi } from '/@/api-services/api';
|
||||
import { UpdateDbTableInput } from '/@/api-services/models';
|
||||
|
||||
const xGrid = ref<VxeGridInstance>();
|
||||
let initTime: any;
|
||||
const emits = defineEmits(['addTableSubmitted']);
|
||||
const ruleFormRef = ref();
|
||||
const state = reactive({
|
||||
const xGrid = ref<VxeGridInstance>();
|
||||
let initTime: any;
|
||||
const emits = defineEmits(['addTableSubmitted']);
|
||||
const ruleFormRef = ref();
|
||||
const state = reactive({
|
||||
visible: false,
|
||||
ruleForm: {} as UpdateDbTableInput,
|
||||
sortable: undefined as any,
|
||||
});
|
||||
});
|
||||
|
||||
// 表格参数配置
|
||||
const options = reactive<VxeGridProps>({
|
||||
// 表格参数配置
|
||||
const options = reactive<VxeGridProps>({
|
||||
id: 'sysAddTable',
|
||||
height: 'auto',
|
||||
autoResize: true,
|
||||
@ -137,7 +130,7 @@
|
||||
minWidth: 100,
|
||||
editRender: { name: '$switch', props: { openValue: 1, closeValue: 0, openLabel: '是', closeLabel: '否', immediate: true } },
|
||||
slots: {
|
||||
default: "isPrimarykey"
|
||||
default: 'isPrimarykey',
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -146,7 +139,7 @@
|
||||
minWidth: 100,
|
||||
editRender: { name: '$switch', props: { openValue: 1, closeValue: 0, openLabel: '是', closeLabel: '否' } },
|
||||
slots: {
|
||||
default: "isIdentity"
|
||||
default: 'isIdentity',
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -166,7 +159,7 @@
|
||||
minWidth: 100,
|
||||
editRender: { name: '$switch', props: { openValue: 1, closeValue: 0, openLabel: '是', closeLabel: '否' } },
|
||||
slots: {
|
||||
default: "isNullable"
|
||||
default: 'isNullable',
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -189,7 +182,7 @@
|
||||
showOverflow: true,
|
||||
fixed: 'right',
|
||||
slots: {
|
||||
default: "operate",
|
||||
default: 'operate',
|
||||
},
|
||||
},
|
||||
],
|
||||
@ -213,35 +206,35 @@
|
||||
},
|
||||
editConfig: { trigger: 'click', mode: 'row', showStatus: true },
|
||||
exportConfig: {
|
||||
remote: false, //设置使用服务端导出
|
||||
remote: false, // 设置使用服务端导出
|
||||
filename: `数据列信息导出_${dayjs().format('YYMMDDHHmmss')}`,
|
||||
exportMethod: ({ options }) => handleExport(options), //服务器导出方法
|
||||
exportMethod: ({ options }) => handleExport(options), // 服务器导出方法
|
||||
},
|
||||
printConfig: { sheetName: '' },
|
||||
proxyConfig: {
|
||||
props: {
|
||||
list: 'data.result.items', //不分页时
|
||||
// result: 'data.result.items', //分页时
|
||||
list: 'data.result.items', // 不分页时
|
||||
// result: 'data.result.items', // 分页时
|
||||
total: 'data.result.total',
|
||||
message: 'data.message',
|
||||
},
|
||||
ajax: {
|
||||
query: () => Promise.resolve(), //不加会报错
|
||||
query: () => Promise.resolve(), // 不加会报错
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (row: any) => {
|
||||
// 打开弹窗
|
||||
const openDialog = (row: any) => {
|
||||
state.ruleForm = row;
|
||||
state.visible = true;
|
||||
ruleFormRef.value?.resetFields();
|
||||
nextTick(() => {
|
||||
rowDrop();
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
const rowDrop = () => {
|
||||
const rowDrop = () => {
|
||||
const el = document.querySelector('.xGrid-table-style .vxe-table--body tbody') as HTMLElement;
|
||||
state.sortable = Sortable.create(el, {
|
||||
animation: 300,
|
||||
@ -270,36 +263,36 @@
|
||||
xGrid.value?.updateData();
|
||||
},
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
// 关闭弹窗
|
||||
const closeDialog = () => {
|
||||
// 关闭弹窗
|
||||
const closeDialog = () => {
|
||||
emits('addTableSubmitted', state.ruleForm.tableName ?? '');
|
||||
cancel();
|
||||
};
|
||||
};
|
||||
|
||||
// 取消
|
||||
const cancel = () => {
|
||||
// 取消
|
||||
const cancel = () => {
|
||||
xGrid.value?.loadData([]);
|
||||
state.visible = false;
|
||||
clearTimeout(initTime);
|
||||
if (state.sortable) {
|
||||
state.sortable.destroy();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// 导出日志(服务端导出)
|
||||
const handleExport = async (opts: any) => {
|
||||
// 导出日志(服务端导出)
|
||||
const handleExport = async (opts: any) => {
|
||||
console.log(opts);
|
||||
options.loading = true;
|
||||
// var res = await getAPI(SysLogExApi).apiSysLogExExportPost(state.queryParams as any, { responseType: 'blob' });
|
||||
options.loading = false;
|
||||
// VXETable.saveFile({ filename: getFileName(res.headers), type: 'xlsx', content: res.data as any });
|
||||
return Promise.resolve();
|
||||
};
|
||||
};
|
||||
|
||||
// 提交
|
||||
const submit = () => {
|
||||
// 提交
|
||||
const submit = () => {
|
||||
ruleFormRef.value.validate(async (valid: boolean) => {
|
||||
if (!valid) return;
|
||||
const tableData = xGrid.value?.getTableData().fullData ?? [];
|
||||
@ -319,10 +312,10 @@
|
||||
await getAPI(SysDatabaseApi).apiSysDatabaseAddTablePost(params);
|
||||
closeDialog();
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
// 增加主键列
|
||||
const addPrimaryColumn = async () => {
|
||||
// 增加主键列
|
||||
const addPrimaryColumn = async () => {
|
||||
const fullData = xGrid.value?.getTableData().fullData;
|
||||
const colIndex = (fullData?.length ?? 0) + 1;
|
||||
const temp = await xGrid.value?.insertAt(
|
||||
@ -342,10 +335,10 @@
|
||||
-1
|
||||
);
|
||||
if (temp && temp.row) await xGrid.value?.setEditCell(temp?.row, 'dbColumnName');
|
||||
};
|
||||
};
|
||||
|
||||
// 增加普通列
|
||||
const addColumn = async () => {
|
||||
// 增加普通列
|
||||
const addColumn = async () => {
|
||||
const fullData = xGrid.value?.getTableData().fullData;
|
||||
const colIndex = (fullData?.length ?? 0) + 1;
|
||||
const temp = await xGrid.value?.insertAt(
|
||||
@ -365,10 +358,10 @@
|
||||
-1
|
||||
);
|
||||
if (temp && temp.row) await xGrid.value?.setEditCell(temp?.row, 'dbColumnName');
|
||||
};
|
||||
};
|
||||
|
||||
// 增加租户列
|
||||
const addTenantColumn = async () => {
|
||||
// 增加租户列
|
||||
const addTenantColumn = async () => {
|
||||
const fullData = xGrid.value?.getTableData().fullData;
|
||||
const colIndex = (fullData?.length ?? 0) + 1;
|
||||
const temp = await xGrid.value?.insertAt(
|
||||
@ -388,10 +381,10 @@
|
||||
-1
|
||||
);
|
||||
if (temp && temp.row) await xGrid.value?.setEditCell(temp?.row, 'dbColumnName');
|
||||
};
|
||||
};
|
||||
|
||||
// 增加通用基础列
|
||||
const addBaseColumn = async () => {
|
||||
// 增加通用基础列
|
||||
const addBaseColumn = async () => {
|
||||
const fileds = [
|
||||
{ dataType: 'varchar', name: 'Code', desc: '编码', length: 64 },
|
||||
{ dataType: 'varchar', name: 'Name', desc: '名称', length: 64 },
|
||||
@ -429,17 +422,17 @@
|
||||
colIndex++;
|
||||
}
|
||||
if (temp && temp.row) await xGrid.value?.setEditCell(temp?.row, 'dbColumnName');
|
||||
};
|
||||
};
|
||||
|
||||
// 删除行
|
||||
const deleteRow = (row: any) => {
|
||||
// 删除行
|
||||
const deleteRow = (row: any) => {
|
||||
const fullData = xGrid.value?.getTableData().fullData;
|
||||
fullData?.filter((e: any) => e.orderNo > row.orderNo)?.forEach((e: any) => (e.orderNo = e.orderNo - 1));
|
||||
xGrid.value?.remove(row);
|
||||
};
|
||||
};
|
||||
|
||||
// 删除选中行
|
||||
const deleteSelected = () => {
|
||||
// 删除选中行
|
||||
const deleteSelected = () => {
|
||||
const selected = xGrid.value?.getCheckboxRecords();
|
||||
const fullData = xGrid.value?.getTableData().fullData;
|
||||
// 更新序号
|
||||
@ -448,23 +441,23 @@
|
||||
}
|
||||
// 移除选中
|
||||
xGrid.value?.removeCheckboxRow();
|
||||
};
|
||||
};
|
||||
|
||||
// 导出对象
|
||||
defineExpose({ openDialog });
|
||||
</script>
|
||||
// 导出对象
|
||||
defineExpose({ openDialog });
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.sys-dbTable-container :deep(.el-dialog__body) {}
|
||||
<style lang="scss" scoped>
|
||||
.sys-dbTable-container :deep(.el-dialog__body) {
|
||||
}
|
||||
|
||||
.xGrid-table-style .drag-btn {
|
||||
.xGrid-table-style .drag-btn {
|
||||
cursor: move;
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.xGrid-table-style .vxe-body--row.sortable-ghost,
|
||||
.xGrid-table-style .vxe-body--row.sortable-chosen {
|
||||
.xGrid-table-style .vxe-body--row.sortable-ghost,
|
||||
.xGrid-table-style .vxe-body--row.sortable-chosen {
|
||||
background-color: #e40000 !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
}
|
||||
</style>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user