徐景良 2024-06-18 09:59:53 +08:00
commit f8efe3b391
12 changed files with 202 additions and 50 deletions

View File

@ -102,6 +102,17 @@
:pagination="false" :pagination="false"
v-if="node.formType == 1" v-if="node.formType == 1"
> >
<template #headerCell="{ column }">
<template v-if="column.dataIndex === 'required'">
<a-checkbox v-model:checked="requiredCheck" @change="handleChangeCheck('required',$event)">{{column.title}}</a-checkbox>
</template>
<template v-if="column.dataIndex === 'disabled'">
<a-checkbox v-model:checked="disabledCheck" @change="handleChangeCheck('disabled',$event)">{{column.title}}</a-checkbox>
</template>
<template v-if="column.dataIndex === 'ifShow'">
<a-checkbox v-model:checked="ifShowCheck" @change="handleChangeCheck('ifShow',$event)">{{column.title}}</a-checkbox>
</template>
</template>
<template #bodyCell="{ column, text, record }"> <template #bodyCell="{ column, text, record }">
<template v-if="['label', 'field'].includes(column.dataIndex)"> <template v-if="['label', 'field'].includes(column.dataIndex)">
<div> <div>
@ -191,6 +202,9 @@
const flowWfDataStore = flowStore(); const flowWfDataStore = flowStore();
const labelCol = { span: 7 }; const labelCol = { span: 7 };
const wrapperCol = { span: 17 }; const wrapperCol = { span: 17 };
const requiredCheck = ref(false)
const disabledCheck = ref(false)
const ifShowCheck = ref(false)
// //
const props = defineProps({ const props = defineProps({
disabled: { disabled: {
@ -421,6 +435,22 @@
function handleDeleteAuthField(key) { function handleDeleteAuthField(key) {
node.value.authFields = node.value.authFields.filter((item) => item.field !== key); node.value.authFields = node.value.authFields.filter((item) => item.field !== key);
} }
const handleChangeCheck = (type: string, data) => {
let checked = data.target.checked
node.value.authFields.forEach(item => {
switch (type) {
case 'required':
item.required = checked
break
case 'disabled':
item.disabled = checked
break
case 'ifShow':
item.ifShow = checked
break
}
})
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.site-space-compact-wrapper { .site-space-compact-wrapper {

View File

@ -246,6 +246,17 @@
:pagination="false" :pagination="false"
v-if="node.formType == 1" v-if="node.formType == 1"
> >
<template #headerCell="{ column }">
<template v-if="column.dataIndex === 'required'">
<a-checkbox v-model:checked="requiredCheck" @change="handleChangeCheck('required',$event)">{{column.title}}</a-checkbox>
</template>
<template v-if="column.dataIndex === 'disabled'">
<a-checkbox v-model:checked="disabledCheck" @change="handleChangeCheck('disabled',$event)">{{column.title}}</a-checkbox>
</template>
<template v-if="column.dataIndex === 'ifShow'">
<a-checkbox v-model:checked="ifShowCheck" @change="handleChangeCheck('ifShow',$event)">{{column.title}}</a-checkbox>
</template>
</template>
<template #bodyCell="{ column, text, record }"> <template #bodyCell="{ column, text, record }">
<template v-if="['label', 'fieldName'].includes(column.dataIndex)"> <template v-if="['label', 'fieldName'].includes(column.dataIndex)">
<div> <div>
@ -549,6 +560,9 @@
const activeKey = ref('1'); const activeKey = ref('1');
const nodeId = ref(''); const nodeId = ref('');
let node: any = ref({}); let node: any = ref({});
const requiredCheck = ref(false)
const disabledCheck = ref(false)
const ifShowCheck = ref(false)
const props = defineProps({ const props = defineProps({
element: { element: {
type: Object, type: Object,
@ -974,6 +988,22 @@
function handleDeleteAuthField(key) { function handleDeleteAuthField(key) {
node.value.authFields = node.value.authFields.filter((item) => item.field !== key); node.value.authFields = node.value.authFields.filter((item) => item.field !== key);
} }
const handleChangeCheck = (type: string, data) => {
let checked = data.target.checked
node.value.authFields.forEach(item => {
switch (type) {
case 'required':
item.required = checked
break
case 'disabled':
item.disabled = checked
break
case 'ifShow':
item.ifShow = checked
break
}
})
}
defineExpose({}); defineExpose({});
</script> </script>

View File

@ -70,6 +70,9 @@ export function useSplitMenu(splitType: Ref<MenuSplitTyeEnum>) {
genMenus(); genMenus();
}, },
); );
watch(() => permissionStore.getChangeMenu, () => {
genMenus();
})
// Handle left menu split // Handle left menu split
async function handleSplitLeftMenu(parentPath: string) { async function handleSplitLeftMenu(parentPath: string) {

View File

@ -26,6 +26,7 @@ import { PageEnum } from '@/enums/pageEnum';
import { router } from '@/router'; import { router } from '@/router';
import { LAYOUT } from '@/router/constant'; import { LAYOUT } from '@/router/constant';
import dayjs from 'dayjs';
interface PermissionState { interface PermissionState {
// Permission code list // Permission code list
@ -42,6 +43,7 @@ interface PermissionState {
backMenuList: Menu[]; backMenuList: Menu[];
// 菜单列表 // 菜单列表
frontMenuList: Menu[]; frontMenuList: Menu[];
changeMenu: number;
} }
export const usePermissionStore = defineStore({ export const usePermissionStore = defineStore({
@ -61,8 +63,12 @@ export const usePermissionStore = defineStore({
// menu List // menu List
// 菜单列表 // 菜单列表
frontMenuList: [], frontMenuList: [],
changeMenu: dayjs().valueOf()
}), }),
getters: { getters: {
getChangeMenu(state): number {
return state.changeMenu;
},
getPermCodeList(state): string[] | number[] { getPermCodeList(state): string[] | number[] {
return state.permCodeList; return state.permCodeList;
}, },
@ -89,6 +95,10 @@ export const usePermissionStore = defineStore({
list?.length > 0 && this.setLastBuildMenuTime(); list?.length > 0 && this.setLastBuildMenuTime();
}, },
setChangeMenu(){
this.changeMenu = dayjs().valueOf();
},
setFrontMenuList(list: Menu[]) { setFrontMenuList(list: Menu[]) {
this.frontMenuList = list; this.frontMenuList = list;
}, },

View File

@ -335,7 +335,11 @@
}); });
baseComponentCommonAttrs.forEach((item) => { baseComponentCommonAttrs.forEach((item) => {
if (formType_design.value != 2 || !['dataTable', 'fieldName'].includes(item.name)) { if (
(formType_design.value != 2 &&
!['Divider', 'Button'].includes(formConfig.value.currentItem?.component)) ||
!['dataTable', 'fieldName'].includes(item.name)
) {
item.category = 'input'; item.category = 'input';
if (item.includes) { if (item.includes) {
if (item.includes.includes(formConfig.value.currentItem!.component)) { if (item.includes.includes(formConfig.value.currentItem!.component)) {

View File

@ -32,7 +32,7 @@
</template> </template>
</BasicForm> </BasicForm>
<template v-for="(item, useIndex) in createOrModifyList[index]" :key="useIndex"> <template v-for="(item, useIndex) in createOrModifyList[index]" :key="useIndex">
<CreateOrModifyComponent :data="item" /> <CreateOrModifyComponent :data="item" :createOrModifyData="createOrModifyData" :isUpdate="isUpdate" :isDetail="isDetail"/>
</template> </template>
</a-tab-pane> </a-tab-pane>
</a-tabs> </a-tabs>
@ -117,7 +117,7 @@
<!-- todo 创建/修改 /时间 --> <!-- todo 创建/修改 /时间 -->
<template v-if="!(tabsColumns.length > 1)"> <template v-if="!(tabsColumns.length > 1)">
<template v-for="(item, index) in createOrModifyList" :key="index"> <template v-for="(item, index) in createOrModifyList" :key="index">
<CreateOrModifyComponent :data="item" /> <CreateOrModifyComponent :data="item" :createOrModifyData="createOrModifyData"/>
</template> </template>
</template> </template>
</BasicModal> </BasicModal>
@ -139,6 +139,7 @@
import { subTableStore } from '@/store/modules/subTable'; import { subTableStore } from '@/store/modules/subTable';
import { changeCardStructure, cardNestStructure } from '@/views/demo/onlineform/util.ts'; import { changeCardStructure, cardNestStructure } from '@/views/demo/onlineform/util.ts';
import CreateOrModifyComponent from '@/views/demo/onlineform/formCall/CreateOrModifyComponent/index.vue'; import CreateOrModifyComponent from '@/views/demo/onlineform/formCall/CreateOrModifyComponent/index.vue';
import dayjs from 'dayjs';
const subTableDataStore = subTableStore(); const subTableDataStore = subTableStore();
@ -171,6 +172,7 @@
const scrollValue = ref(); const scrollValue = ref();
const cardLayout = ref([]); const cardLayout = ref([]);
const createOrModifyList = ref([]); const createOrModifyList = ref([]);
const createOrModifyData = ref({})
// //
const buttonLayout = ref([]); const buttonLayout = ref([]);
// //
@ -408,6 +410,11 @@
} }
if (unref(isUpdate) && !unref(isDetail)) { if (unref(isUpdate) && !unref(isDetail)) {
getTitle.value = '编辑'; getTitle.value = '编辑';
Object.keys(data.infoUseMainTableData).forEach(itemKey => {
if(itemKey.indexOf('_time_') !== -1 || itemKey.indexOf('_user_') !== -1){
createOrModifyData.value[itemKey] = data.infoUseMainTableData[itemKey]
}
})
data.btnList.forEach((element) => { data.btnList.forEach((element) => {
if (element.prop === 'Edit' && element.isWFlow) { if (element.prop === 'Edit' && element.isWFlow) {
flowCode.value = element.wFlowCode; flowCode.value = element.wFlowCode;
@ -436,6 +443,11 @@
} }
if (!unref(isUpdate) && unref(isDetail)) { if (!unref(isUpdate) && unref(isDetail)) {
getTitle.value = '详情'; getTitle.value = '详情';
Object.keys(data.infoUseMainTableData).forEach(itemKey => {
if(itemKey.indexOf('_time_') !== -1 || itemKey.indexOf('_user_') !== -1){
createOrModifyData.value[itemKey] = data.infoUseMainTableData[itemKey]
}
})
let isTabs = false; let isTabs = false;
data.tab = changeCardStructure(data.tab); data.tab = changeCardStructure(data.tab);
data.tab.forEach((itemComponent) => { data.tab.forEach((itemComponent) => {
@ -592,11 +604,22 @@
async function ModalSureClick() { async function ModalSureClick() {
try { try {
let values = await validate(); let values = await validate();
//
values = {...values, ...createOrModifyData.value}
// //
let cardValueList = Object.values(cardValues.value); let cardValueList = Object.values(cardValues.value);
cardValueList.forEach((item) => { cardValueList.forEach((item) => {
values = { ...values, ...item }; values = { ...values, ...item };
}); });
Object.keys(values).forEach(itemKey => {
if(!isUpdate.value){
if(itemKey.indexOf('_time_') !== -1) values[itemKey] = dayjs().format('YYYY-MM-DD HH:mm:ss')
if(itemKey.indexOf('_user_') !== -1) values[itemKey] = localStorage.getItem('fireUserLoginName')
}else{
if(itemKey.indexOf('_modify_time') !== -1) values[itemKey] = dayjs().format('YYYY-MM-DD HH:mm:ss')
if(itemKey.indexOf('_modify_user') !== -1) values[itemKey] = localStorage.getItem('fireUserLoginName')
}
})
codeClickFunction('afterValidateForm', afterValidateForm.value); codeClickFunction('afterValidateForm', afterValidateForm.value);
console.log('values', values); console.log('values', values);
let query = values; let query = values;

View File

@ -24,14 +24,20 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, defineProps } from 'vue' import { ref, defineProps, onMounted } from 'vue'
import { UserOutlined, FieldTimeOutlined } from '@ant-design/icons-vue'; import { UserOutlined, FieldTimeOutlined } from '@ant-design/icons-vue';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
const props = defineProps(['data']) const props = defineProps(['data', 'createOrModifyData', 'isUpdate', 'isDetail'])
const show = props.data.display const show = props.data.display
const isTime = ['createtime', 'modifytime'].includes(props.data.type) const isTime = ['createtime', 'modifytime'].includes(props.data.type)
const nowTime = ref(dayjs().format('YYYY-MM-DD HH:mm:ss')) const nowTime = ref(dayjs().format('YYYY-MM-DD HH:mm:ss'))
const userName = localStorage.getItem('fireUserLoginName') const userName = ref(localStorage.getItem('fireUserLoginName'))
onMounted(() => {
if(props.isUpdate || props.isDetail){
nowTime.value = props.createOrModifyData[props.data.field]
userName.value = props.createOrModifyData[props.data.field]
}
})
</script> </script>
<style lang="scss" scoped></style> <style lang="scss" scoped></style>

View File

@ -61,7 +61,8 @@
// api // api
import { getMenuList } from '@/api/demo/system'; import { getMenuList } from '@/api/demo/system';
import { fun_GetPageList, fun_DeleteForm } from '@/api/demo/formModule'; import { fun_GetPageList, fun_DeleteForm } from '@/api/demo/formModule';
import { usePermissionStore } from '@/store/modules/permission';
const permissionStore = usePermissionStore();
defineOptions({ name: 'FormModule' }); defineOptions({ name: 'FormModule' });
const searchInfo = reactive<Recordable>({}); const searchInfo = reactive<Recordable>({});
const { createConfirm, createMessage } = useMessage(); const { createConfirm, createMessage } = useMessage();
@ -136,6 +137,8 @@
createMessage.warn('删除失败'); createMessage.warn('删除失败');
} }
reload(); reload();
await permissionStore.buildRoutesAction()
permissionStore.setChangeMenu()
}, },
}); });
} }
@ -173,9 +176,11 @@
} }
// - // -
function submitReload() { async function submitReload() {
clearSelectedRowKeys(); clearSelectedRowKeys();
reload(); reload();
await permissionStore.buildRoutesAction()
permissionStore.setChangeMenu()
} }
function onBtnClicked(domId) { function onBtnClicked(domId) {

View File

@ -38,7 +38,7 @@
<a-input <a-input
v-model:value="db.tableName" v-model:value="db.tableName"
:disabled="!isNewTable(db)" :disabled="!isNewTable(db)"
@change="changeTableName(db)" @change="if (!db.tableName) db.tableName = db.name;"
/> />
</a-col> </a-col>
<a-col class="gutter-row" :span="11"> <a-col class="gutter-row" :span="11">
@ -155,7 +155,7 @@
dataType: '', dataType: '',
length: 0, length: 0,
columnDescription: '', columnDescription: '',
isNullable: 0, isNullable: 1,
isIdentity: 0, isIdentity: 0,
isPrimarykey: 0, isPrimarykey: 0,
decimalDigits: 0, decimalDigits: 0,
@ -295,7 +295,7 @@
schemas = sch.schemas; schemas = sch.schemas;
schemas?.forEach((item: any, index: number) => { schemas?.forEach((item: any, index: number) => {
// 线 // 线
if (item.component && !item.component.includes(notComponentArray)) { if (item.component && !notComponentArray.includes(item.component)) {
// //
if (fieldArray.includes(item.field)) { if (fieldArray.includes(item.field)) {
db_temp.dbColumnInfoList.push({ db_temp.dbColumnInfoList.push({
@ -304,7 +304,7 @@
dataType: 'varchar', dataType: 'varchar',
length: 200, length: 200,
columnDescription: '图斑组件id', columnDescription: '图斑组件id',
isNullable: 0, isNullable: 1,
isIdentity: 0, isIdentity: 0,
isPrimarykey: 0, isPrimarykey: 0,
decimalDigits: 0, decimalDigits: 0,
@ -315,7 +315,7 @@
dataType: 'geometry(GEOMETRY)', dataType: 'geometry(GEOMETRY)',
length: 0, length: 0,
columnDescription: '图斑组件', columnDescription: '图斑组件',
isNullable: 0, isNullable: 1,
isIdentity: 0, isIdentity: 0,
isPrimarykey: 0, isPrimarykey: 0,
decimalDigits: 0, decimalDigits: 0,
@ -323,6 +323,7 @@
item.componentProps.dataTable = db_temp.tableName; item.componentProps.dataTable = db_temp.tableName;
item.componentProps.fieldName = 'gid'; item.componentProps.fieldName = 'gid';
item.csType = 'string';
} }
// - // -
else if (item.component == 'Grid' && item.type == 'subTable') { else if (item.component == 'Grid' && item.type == 'subTable') {
@ -338,6 +339,7 @@
); );
item.componentProps.dataTable = item.componentProps.dataTable =
res?.columns[0]?.children[0]?.componentProps?.dataTable; res?.columns[0]?.children[0]?.componentProps?.dataTable;
item.csType = 'string';
} }
// //
else if (gridArray.includes(item.component)) { else if (gridArray.includes(item.component)) {
@ -359,6 +361,7 @@
); );
ch.componentProps.dataTable = ch.componentProps.dataTable =
res?.columns[0]?.children[0]?.componentProps?.dataTable; res?.columns[0]?.children[0]?.componentProps?.dataTable;
ch.csType = 'string';
} }
// -/ // -/
else if (fieldArray.includes(ch.field) || gridArray.includes(ch.component)) { else if (fieldArray.includes(ch.field) || gridArray.includes(ch.component)) {
@ -392,6 +395,7 @@
// componentProps // componentProps
ch.componentProps.dataTable = temp.tableName; ch.componentProps.dataTable = temp.tableName;
ch.componentProps.fieldName = temp.dbColumnName; ch.componentProps.fieldName = temp.dbColumnName;
ch.csType = 'string';
db_temp.dbColumnInfoList.push(temp); db_temp.dbColumnInfoList.push(temp);
} }
@ -484,11 +488,12 @@
schemas = sch.children; schemas = sch.children;
schemas?.forEach((item: any, index: number) => { schemas?.forEach((item: any, index: number) => {
// 线 // 线
if (item.component && !item.component.includes(notComponentArray)) { if (item.component && !notComponentArray.includes(item.component)) {
if (fieldArray.includes(item.field)) { if (fieldArray.includes(item.field)) {
// - // -
item.componentProps.dataTable = db_temp.tableName; item.componentProps.dataTable = db_temp.tableName;
item.componentProps.fieldName = 'gid'; item.componentProps.fieldName = 'gid';
item.csType = 'string';
// item.componentProps.fieldName = 'geom'; // item.componentProps.fieldName = 'geom';
} else if (item.component == 'Grid' && item.type == 'subTable') { } else if (item.component == 'Grid' && item.type == 'subTable') {
// - // -
@ -504,6 +509,7 @@
); );
item.componentProps.dataTable = item.componentProps.dataTable =
res?.columns[0]?.children[0]?.componentProps?.dataTable; res?.columns[0]?.children[0]?.componentProps?.dataTable;
item.csType = 'string';
} else if (gridArray.includes(item.component)) { } else if (gridArray.includes(item.component)) {
// //
if (item.component == 'Tabs') { if (item.component == 'Tabs') {
@ -523,6 +529,7 @@
); );
ch.componentProps.dataTable = ch.componentProps.dataTable =
res?.columns[0]?.children[0]?.componentProps?.dataTable; res?.columns[0]?.children[0]?.componentProps?.dataTable;
ch.csType = 'string';
} }
// -/ // -/
else if (fieldArray.includes(ch.field) || gridArray.includes(ch.component)) { else if (fieldArray.includes(ch.field) || gridArray.includes(ch.component)) {
@ -548,6 +555,7 @@
// componentProps // componentProps
ch.componentProps.dataTable = temp.tableName; ch.componentProps.dataTable = temp.tableName;
ch.componentProps.fieldName = temp.dbColumnName; ch.componentProps.fieldName = temp.dbColumnName;
ch.csType = 'string';
db_temp.dbColumnInfoList.push(temp); db_temp.dbColumnInfoList.push(temp);
} }
@ -571,6 +579,7 @@
); );
ch.componentProps.dataTable = ch.componentProps.dataTable =
res?.columns[0]?.children[0]?.componentProps?.dataTable; res?.columns[0]?.children[0]?.componentProps?.dataTable;
ch.csType = 'string';
} }
// -/ // -/
else if (fieldArray.includes(ch.field) || gridArray.includes(ch.component)) { else if (fieldArray.includes(ch.field) || gridArray.includes(ch.component)) {
@ -596,6 +605,8 @@
// componentProps // componentProps
ch.componentProps.dataTable = temp.tableName; ch.componentProps.dataTable = temp.tableName;
ch.componentProps.fieldName = temp.dbColumnName; ch.componentProps.fieldName = temp.dbColumnName;
ch.csType = 'string';
db_temp.dbColumnInfoList.push(temp); db_temp.dbColumnInfoList.push(temp);
} }
}); });
@ -618,6 +629,7 @@
); );
ch.componentProps.dataTable = ch.componentProps.dataTable =
res?.columns[0]?.children[0]?.componentProps?.dataTable; res?.columns[0]?.children[0]?.componentProps?.dataTable;
ch.csType = 'string';
} }
// -/ // -/
else if (fieldArray.includes(ch.field) || gridArray.includes(ch.component)) { else if (fieldArray.includes(ch.field) || gridArray.includes(ch.component)) {
@ -643,6 +655,7 @@
// componentProps // componentProps
ch.componentProps.dataTable = temp.tableName; ch.componentProps.dataTable = temp.tableName;
ch.componentProps.fieldName = temp.dbColumnName; ch.componentProps.fieldName = temp.dbColumnName;
ch.csType = 'string';
db_temp.dbColumnInfoList.push(temp); db_temp.dbColumnInfoList.push(temp);
} }
}); });
@ -667,6 +680,7 @@
); );
ch.componentProps.dataTable = ch.componentProps.dataTable =
res?.columns[0]?.children[0]?.componentProps?.dataTable; res?.columns[0]?.children[0]?.componentProps?.dataTable;
ch.csType = 'string';
} }
// -/ // -/
else if (fieldArray.includes(ch.field) || gridArray.includes(ch.component)) { else if (fieldArray.includes(ch.field) || gridArray.includes(ch.component)) {
@ -692,6 +706,7 @@
// componentProps // componentProps
ch.componentProps.dataTable = temp.tableName; ch.componentProps.dataTable = temp.tableName;
ch.componentProps.fieldName = temp.dbColumnName; ch.componentProps.fieldName = temp.dbColumnName;
ch.csType = 'string';
db_temp.dbColumnInfoList.push(temp); db_temp.dbColumnInfoList.push(temp);
} }
@ -771,8 +786,28 @@
if (checkflag) { if (checkflag) {
return; return;
} }
//
db_list.value.forEach((db, db_index) => {
if (db.name != db.tableName) {
// scheme
let scheme_replace = saveFormDatas.scheme.scheme;
scheme_replace = replaceInJson(scheme_replace, db.name, db.tableName);
saveFormDatas.scheme.scheme = scheme_replace;
// db
// db.name = db.tableName;
db.dbColumnInfoList?.forEach((d, d_index) => {
d.tableName = db.tableName;
db.dbColumnInfoList[d_index] = d;
});
db_list.value[db_index] = db;
}
});
// relationField // relationField
getRelationField(); getRelationField();
if (props.isAddVisible) { if (props.isAddVisible) {
db_list.value.forEach(async (db) => { db_list.value.forEach(async (db) => {
// //
@ -796,7 +831,7 @@
if (!oldDbColumnArray.includes(dbColumn.dbColumnName)) { if (!oldDbColumnArray.includes(dbColumn.dbColumnName)) {
dbColumn.isNullable = 1; dbColumn.isNullable = 1;
let query: any = { let query: any = {
dbCode: forminfoDbCode, dbCode: forminfoDbCode || 'hcsystemdb',
dbColumn: dbColumn, dbColumn: dbColumn,
}; };
await AddColumn(query); await AddColumn(query);
@ -832,11 +867,13 @@
} }
// //
let query: any = { tableName: db.tableName }; if (db.tableName) {
let res = await CheckTableExist(query); let query: any = { tableName: db.tableName };
if (res) { let res = await CheckTableExist(query);
createMessage.warn('数据库已有表' + db.tableName); if (res) {
flag = true; createMessage.warn('数据库已有表' + db.tableName);
flag = true;
}
} }
if (!flag) { if (!flag) {
@ -859,16 +896,16 @@
} }
// //
if (!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(dbColumn.dbColumnName)) { if (dbColumn.dbColumnName && !/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(dbColumn.dbColumnName)) {
createMessage.warn('字段名不符合数据库字段名的命名规则!'); createMessage.warn('字段名不符合数据库字段名的命名规则!');
flag = true; flag = true;
} }
// //
if (!dbColumns.includes(dbColumn.dbColumnName)) { if (dbColumn.dbColumnName && !dbColumns.includes(dbColumn.dbColumnName)) {
dbColumns.push(dbColumn.dbColumnName); dbColumns.push(dbColumn.dbColumnName);
} else { } else {
createMessage.warn('字段名不能重复!'); createMessage.warn('同表内的字段名不能重复!');
flag = true; flag = true;
} }
}); });
@ -881,6 +918,17 @@
return results; return results;
} }
//
function replaceInJson(jsonString, itemToReplace, newItem) {
// 使
// itemToReplace
let escapedItem = itemToReplace.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
let regex = new RegExp(escapedItem, 'g');
let replacedJsonString = jsonString.replace(regex, newItem);
return replacedJsonString;
}
// relationField // relationField
function getRelationField() { function getRelationField() {
// primaryKey // primaryKey
@ -923,22 +971,6 @@
closeModalDeleteGrid(); closeModalDeleteGrid();
} }
//
function changeTableName(db) {
if (db.tableName) {
//
db.tableName = db.tableName.toLowerCase();
let scheme_replace = JSON.stringify(saveFormDatas.scheme.scheme);
scheme_replace = scheme_replace.replace(db.name, db.tableName);
saveFormDatas.scheme.scheme = JSON.parse(scheme_replace);
db.name = db.tableName;
db.dbColumnInfoList?.forEach((d) => {
d.tableName = db.tableName;
});
}
}
// //
function closeModalDeleteGrid() { function closeModalDeleteGrid() {
// //

View File

@ -11,7 +11,7 @@
</template> </template>
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.key === 'type'"> <template v-if="column.key === 'type'">
{{ record.type ? '空间类型' : '非空间类型' }} {{ record.type ? '空间表' : '普通表' }}
</template> </template>
<template v-if="column.key === 'action'"> <template v-if="column.key === 'action'">
<TableAction <TableAction

View File

@ -33,9 +33,10 @@
> >
<a-radio value="2">角色</a-radio> <a-radio value="2">角色</a-radio>
<a-radio value="1">用户</a-radio> <a-radio value="1">用户</a-radio>
<a-radio value="3">所有用户</a-radio>
</a-radio-group> </a-radio-group>
</a-form-item> </a-form-item>
<a-form-item ref="title" label="授权对象" name="objectId"> <a-form-item ref="title" label="授权对象" name="objectId" v-if="formData.objectType != '3'">
<a-select <a-select
v-if="formData.objectType == '2'" v-if="formData.objectType == '2'"
v-model:value="formData.objectId" v-model:value="formData.objectId"
@ -245,7 +246,7 @@
}); });
} }
function getCodeListData() { function getCodeListData() {
fun_GetPageList({page:1,limit:9999999}).then((res: Recordable) => { fun_GetPageList({ page: 1, limit: 9999999 }).then((res: Recordable) => {
const arr: any = []; const arr: any = [];
if (res.items) { if (res.items) {
res.items.forEach((item) => { res.items.forEach((item) => {
@ -317,7 +318,7 @@
const rules = reactive({ const rules = reactive({
code: [{ required: true, message: '请选择功能', trigger: 'blur' }], code: [{ required: true, message: '请选择功能', trigger: 'blur' }],
name: [{ required: true, message: '请输入名称', trigger: 'blur' }], name: [{ required: true, message: '请输入名称', trigger: 'blur' }],
objectId: [{ required: true, message: '请选择授权对象', trigger: 'blur' }], // objectId: [{ required: true, message: '', trigger: 'blur' }],
}); });
async function handleSubmit() { async function handleSubmit() {
@ -327,14 +328,18 @@
.validate() .validate()
.then(() => { .then(() => {
const params = formData.value; const params = formData.value;
if (formData.value.objectType == '1') { if (params.objectId) {
const objectObj = userOptions.value.filter((ele) => ele.value == params.objectId); if (formData.value.objectType == '1') {
console.log('objectObj', objectObj); const objectObj = userOptions.value.filter((ele) => ele.value == params.objectId);
params.objectName = objectObj[0].label; console.log('objectObj', objectObj);
params.objectName = objectObj[0].label;
} else {
const objectObj = roleOptions.value.filter((ele) => ele.value == params.objectId);
console.log('objectObj', objectObj);
params.objectName = objectObj[0].label;
}
} else { } else {
const objectObj = roleOptions.value.filter((ele) => ele.value == params.objectId); params.objectName = '所有用户';
console.log('objectObj', objectObj);
params.objectName = objectObj[0].label;
} }
const codeObj = codeOptions.value.filter((ele) => ele.value == params.code); const codeObj = codeOptions.value.filter((ele) => ele.value == params.code);

View File

@ -30,6 +30,10 @@ export const columns: BasicColumn[] = [
color = 'yellow'; color = 'yellow';
text = '用户'; text = '用户';
} }
if (formType == 3 || formType == '3') {
color = 'orange';
text = '所有用户';
}
return h(Tag, { color: color }, () => text); return h(Tag, { color: color }, () => text);
}, },
}, },