Browse Source
1. 规则引擎将枚举变量替换为枚举值返回给客户端。 2. 决策引擎增加血缘关系查询 前端核心发布: 8.2.135 1. 修改错误处理机制 2. 决策引擎增加血缘关系查询main
20 changed files with 140 additions and 227 deletions
@ -1,199 +1,112 @@ |
|||||
<template> |
<template> |
||||
<div> |
<w-grid |
||||
<w-form |
ref="i18nGridRef" |
||||
v-model="valueReactive" |
:title="$t('system.i18n.grid.title')" |
||||
:cols-num="12" |
:config-button="true" |
||||
:fields="[ |
db-click-operation="edit" |
||||
|
selection="multiple" |
||||
|
:checkbox-selection="true" |
||||
|
:data-url="Environment.apiContextPath('/api/system/i18n')" |
||||
|
:query-form-fields="[ |
||||
|
{ name: 'code', label: $t('code'), type: 'w-text' }, |
||||
|
{ name: 'message', label: $t('i18nMessage'), type: 'w-text' }, |
||||
|
{ name: 'lang', label: $t('language'), type: 'w-select', options: Options.enum(LanguageEnum), queryOperator: 'equals' }, |
||||
|
]" |
||||
|
:toolbar-configure="{ noIcon: false }" |
||||
|
:toolbar-actions="[ |
||||
|
'query', |
||||
|
'refresh', |
||||
|
'separator', |
||||
|
'add', |
||||
|
'clone', |
||||
|
'edit', |
||||
|
'remove', |
||||
{ |
{ |
||||
colSpan: 2, |
name: 'deleteAll', |
||||
name: 'datasource', |
label: $t('deleteAll'), |
||||
label: $t('developer.backend.export.liquibase.datasource'), |
icon: 'bi-trash3', |
||||
type: 'w-select', |
click: () => { |
||||
options: datasourceOptionsRef, |
DialogManager.confirm($t('system.i18n.grid.toolbar.removeAll.tip'), () => { |
||||
onUpdateValue: (args) => { |
axios.post(Environment.apiContextPath('/api/system/i18n/removeMessages'), {}, { loading: true }).then(() => { |
||||
datasourceChanged(args.value); |
NotifyManager.info($t('operationSuccess')); |
||||
|
i18nGridRef.refresh(); |
||||
|
}); |
||||
|
}); |
||||
}, |
}, |
||||
}, |
}, |
||||
|
'separator', |
||||
{ |
{ |
||||
colSpan: 2, |
name: 'importAll', |
||||
name: 'catalog', |
label: $t('import'), |
||||
label: $t('developer.backend.export.liquibase.catalog'), |
icon: 'bi-arrow-right-circle', |
||||
type: 'w-select', |
click: () => { |
||||
options: catalogOptionsRef, |
DialogManager.confirm($t('system.i18n.grid.toolbar.importAll.tip'), () => { |
||||
onUpdateValue: (args) => { |
axios.post(Environment.apiContextPath('/api/system/i18n/importMessages'), {}, { loading: true }).then(() => { |
||||
catalogChanged(valueReactive.datasource, args.value); |
NotifyManager.info($t('operationSuccess')); |
||||
|
i18nGridRef.refresh(); |
||||
|
}); |
||||
|
}); |
||||
}, |
}, |
||||
}, |
}, |
||||
|
'separator', |
||||
{ |
{ |
||||
colSpan: 2, |
name: 'reload', |
||||
name: 'schema', |
label: $t('reload'), |
||||
label: $t('developer.backend.export.liquibase.schema'), |
icon: 'bi-arrow-repeat', |
||||
type: 'w-select', |
click: (args) => { |
||||
options: schemaOptionsRef, |
axios.post(Environment.apiContextPath('/api/system/i18n/reload')).then(() => { |
||||
onUpdateValue: (args) => { |
NotifyManager.info($t('operationSuccess')); |
||||
schemaChanged(valueReactive.datasource, valueReactive.catalog, args.value); |
}); |
||||
}, |
}, |
||||
}, |
}, |
||||
{ |
'separator', |
||||
colSpan: 6, |
'view', |
||||
name: 'tables', |
'separator', |
||||
label: $t('developer.backend.export.liquibase.tables'), |
'export', |
||||
type: 'w-grid-select', |
]" |
||||
multiple: true, |
:columns="[ |
||||
displayValue: 'name', |
{ width: 500, name: 'code', label: $t('code') }, |
||||
grid: { |
{ width: 100, name: 'lang', label: $t('language'), format: Formater.enum(LanguageEnum) }, |
||||
denseBody: true, |
{ width: '100%', name: 'message', label: $t('i18nMessage') }, |
||||
hideBottom: true, |
]" |
||||
configButton: true, |
:editor="{ |
||||
checkboxSelection: true, |
dialog: { |
||||
primaryKey: 'name', |
width: '600px', |
||||
dataUrl: Environment.apiContextPath( |
}, |
||||
'/api/jdbc/metadata/getTables?datasource=' + |
form: { |
||||
(valueReactive.datasource || '') + |
colsNum: 1, |
||||
'&catalog=' + |
fields: [ |
||||
(valueReactive.catalog || '') + |
{ name: 'code', label: $t('code'), type: 'w-text', requiredIf: true }, |
||||
'&schema=' + |
{ name: 'lang', label: $t('language'), type: 'w-select', requiredIf: true, options: Options.enum(LanguageEnum) }, |
||||
(valueReactive.schema || ''), |
{ name: 'message', label: $t('i18nMessage'), type: 'w-text', requiredIf: true }, |
||||
), |
|
||||
pageable: false, |
|
||||
sortBy: ['type', 'namec', '-lastModifyDate'], |
|
||||
sortNo: true, |
|
||||
toolbarConfigure: { noIcon: false }, |
|
||||
toolbarActions: ['refresh'], |
|
||||
columns: [ |
|
||||
{ name: 'name', label: $t('name') }, |
|
||||
{ name: 'remarks', label: $t('remarks') }, |
|
||||
], |
], |
||||
}, |
}, |
||||
|
}" |
||||
|
:viewer="{ |
||||
|
panel: { |
||||
|
columnNum: 1, |
||||
|
fields: [ |
||||
|
{ name: 'id', label: $t('id') }, |
||||
|
{ name: 'code', label: $t('code') }, |
||||
|
{ name: 'lang', label: $t('language'), format: Formater.none() }, |
||||
|
{ name: 'message', label: $t('i18nMessage') }, |
||||
|
{ name: 'dataComeFrom', label: $t('dataComeFrom') }, |
||||
|
{ name: 'creator', label: $t('creator') }, |
||||
|
{ name: 'createDate', label: $t('createDate') }, |
||||
|
{ name: 'lastModifier', label: $t('lastModifier') }, |
||||
|
{ name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.none() }, |
||||
|
{ name: 'corporationCode', label: $t('corporationCode') }, |
||||
|
], |
||||
}, |
}, |
||||
{ colSpan: 12, name: 'sql', label: $t('SQL'), type: 'w-code-mirror', toolbar: false, lang: 'sql' }, |
}" |
||||
]" |
@row-click="(evt, row, index) => {}" |
||||
> |
></w-grid> |
||||
</w-form> |
|
||||
<div class="row justify-center q-gutter-md py-2"> |
|
||||
<w-progress-btn |
|
||||
ref="progressBtnRef" |
|
||||
icon="bi-database-down" |
|
||||
:label="$t('export')" |
|
||||
data-url="/api/jdbc/data/traceExporterExecuteProgress" |
|
||||
@click="exportData" |
|
||||
@success=" |
|
||||
(progressInfo) => { |
|
||||
Downloader.get(Environment.apiContextPath('/api/mvc/download?filePath=' + encodeURIComponent(progressInfo.result))); |
|
||||
} |
|
||||
" |
|
||||
></w-progress-btn> |
|
||||
</div> |
|
||||
</div> |
|
||||
</template> |
</template> |
||||
<script setup lang="ts"> |
<script setup lang="ts"> |
||||
import 'tailwindcss/utilities.css'; |
import 'tailwindcss/utilities.css'; |
||||
import { ref, reactive, onMounted, onUpdated } from 'vue'; |
import { ref } from 'vue'; |
||||
|
import { axios, Environment, EnumTools, Formater, Options, DialogManager, NotifyManager } from '@/platform'; |
||||
import { t, axios, Environment, DialogManager, Downloader } from '@/platform'; |
|
||||
|
|
||||
const progressBtnRef = ref(); |
|
||||
const datasourceOptionsRef = ref([]); |
|
||||
const catalogOptionsRef = ref([]); |
|
||||
const schemaOptionsRef = ref([]); |
|
||||
const tablesOptionsRef = ref([]); |
|
||||
|
|
||||
const valueReactive = reactive({ |
const i18nGridRef = ref(); |
||||
datasource: undefined, |
const LanguageEnum = await EnumTools.fetch('io.sc.platform.core.enums.Language'); |
||||
catalog: undefined, |
|
||||
schema: undefined, |
|
||||
tables: [], |
|
||||
sql: undefined, |
|
||||
}); |
|
||||
|
|
||||
const loadDatasource = () => { |
|
||||
axios.get(Environment.apiContextPath('/api/system/datasource?pageable=false&sortBy=name')).then((response) => { |
|
||||
const data = response?.data.content; |
|
||||
const datasourceOptions = [{ label: t('default'), value: '' }]; |
|
||||
if (data && data.length > 0) { |
|
||||
for (let item of data) { |
|
||||
datasourceOptions.push({ label: item.name, value: item.name }); |
|
||||
} |
|
||||
} |
|
||||
datasourceOptionsRef.value = datasourceOptions; |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
const datasourceChanged = (datasource: string) => { |
|
||||
datasource = datasource || ''; |
|
||||
axios.get(Environment.apiContextPath('/api/jdbc/metadata/getCatalogs?datasource=' + datasource)).then((response) => { |
|
||||
const data = response?.data; |
|
||||
const catalogOptions = []; |
|
||||
if (data && data.length > 0) { |
|
||||
for (let item of data) { |
|
||||
catalogOptions.push({ label: item.name, value: item.name }); |
|
||||
} |
|
||||
} |
|
||||
catalogOptionsRef.value = catalogOptions; |
|
||||
schemaOptionsRef.value = []; |
|
||||
tablesOptionsRef.value = []; |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
const catalogChanged = (datasource: string, catalog: string) => { |
|
||||
datasource = datasource || ''; |
|
||||
axios.get(Environment.apiContextPath('/api/jdbc/metadata/getSchemas?datasource=' + datasource + '&catalog=' + catalog)).then((response) => { |
|
||||
const data = response?.data; |
|
||||
const schemaOptions = []; |
|
||||
if (data && data.length > 0) { |
|
||||
for (let item of data) { |
|
||||
schemaOptions.push({ label: item.name, value: item.name }); |
|
||||
} |
|
||||
} |
|
||||
schemaOptionsRef.value = schemaOptions; |
|
||||
tablesOptionsRef.value = []; |
|
||||
if (schemaOptions.length === 0) { |
|
||||
schemaChanged(datasource, catalog, ''); |
|
||||
} else if (schemaOptions.length === 1) { |
|
||||
schemaChanged(datasource, catalog, schemaOptions[0]); |
|
||||
} |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
const schemaChanged = (datasource: string, catalog: string, schema: string) => { |
|
||||
datasource = datasource || ''; |
|
||||
catalog = catalog || ''; |
|
||||
schema = schema || ''; |
|
||||
axios |
|
||||
.get(Environment.apiContextPath('/api/jdbc/metadata/getTables?datasource=' + datasource + '&catalog=' + catalog + '&schema=' + schema)) |
|
||||
.then((response) => { |
|
||||
const data = response?.data; |
|
||||
const tablesOptions = []; |
|
||||
if (data && data.length > 0) { |
|
||||
for (let item of data) { |
|
||||
tablesOptions.push({ label: item.name + ' - ' + item.remarks, value: item.name }); |
|
||||
} |
|
||||
} |
|
||||
tablesOptionsRef.value = tablesOptions; |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
const exportData = (e) => { |
|
||||
DialogManager.confirm(t('developer.backend.export.liquibase.export.tip'), () => { |
|
||||
const data = valueReactive; |
|
||||
const config = { |
|
||||
datasource: data.datasource, |
|
||||
schema: data.schema, |
|
||||
tables: [], |
|
||||
}; |
|
||||
const length = data.tables.length; |
|
||||
const sql = length === 1 ? data.sql : ''; |
|
||||
for (let i = 0; i < length; i++) { |
|
||||
config.tables[i] = { name: data.tables[i], sql: sql ? sql : 'select * from ' + data.tables[i] }; |
|
||||
} |
|
||||
axios.post(Environment.apiContextPath('/api/jdbc/data/exportData'), config).then((response) => { |
|
||||
progressBtnRef.value.start(); |
|
||||
}); |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
onMounted(() => { |
|
||||
loadDatasource(); |
|
||||
datasourceChanged(''); |
|
||||
}); |
|
||||
</script> |
</script> |
||||
|
|||||
Loading…
Reference in new issue