Browse Source
1) 修复工作流业务类型bug 2) 修复规则引擎选项表达式配置code和name替换的bug 3)修复日期工具类的 bug 4)增加工作流退回后原路提交给退回节点及其原处理人功能 前端核心发布: 8.2.128 1)main
43 changed files with 1098 additions and 615 deletions
@ -1,82 +1,199 @@ |
|||||
<template> |
<template> |
||||
<w-grid |
<div> |
||||
ref="userGridRef" |
<w-form |
||||
:title="$t('system.user.grid.title')" |
v-model="valueReactive" |
||||
:config-button="true" |
:cols-num="12" |
||||
selection="multiple" |
:fields="[ |
||||
db-click-operation="edit" |
{ |
||||
:checkbox-selection="true" |
colSpan: 2, |
||||
:data-url="Environment.apiContextPath('/api/system/user')" |
name: 'datasource', |
||||
:sort-by="['loginName']" |
label: $t('developer.backend.export.liquibase.datasource'), |
||||
:query-form-cols-num="3" |
type: 'w-select', |
||||
:query-form-fields="[ |
options: datasourceOptionsRef, |
||||
{ name: 'loginName', label: $t('loginName'), type: 'w-text' }, |
onUpdateValue: (args) => { |
||||
{ name: 'userName', label: $t('userName'), type: 'w-text' }, |
datasourceChanged(args.value); |
||||
{ name: 'enable', label: $t('isEnable'), type: 'w-select', options: Options.yesNo(), queryOperator: 'equals' }, |
}, |
||||
]" |
}, |
||||
:toolbar-configure="{ noIcon: false }" |
{ |
||||
:toolbar-actions="['query', 'refresh', 'separator', 'add', 'clone', 'edit', 'remove', 'separator', 'view', 'separator', 'export']" |
colSpan: 2, |
||||
:columns="[ |
name: 'catalog', |
||||
{ width: 200, name: 'loginName', label: $t('loginName') }, |
label: $t('developer.backend.export.liquibase.catalog'), |
||||
{ width: '100%', name: 'userName', label: $t('userName') }, |
type: 'w-select', |
||||
]" |
options: catalogOptionsRef, |
||||
:editor="{ |
onUpdateValue: (args) => { |
||||
dialog: { |
catalogChanged(valueReactive.datasource, args.value); |
||||
width: '800px', |
}, |
||||
}, |
}, |
||||
form: { |
{ |
||||
colsNum: 4, |
colSpan: 2, |
||||
fields: [ |
name: 'schema', |
||||
{ name: 'loginName', label: $t('loginName'), type: 'w-text', requiredIf: true, colSpan: 2 }, |
label: $t('developer.backend.export.liquibase.schema'), |
||||
{ name: 'userName', label: $t('userName'), type: 'w-text', requiredIf: true, colSpan: 2 }, |
type: 'w-select', |
||||
{ name: 'description', label: $t('description'), type: 'w-textarea', rows: 1, colSpan: 2 }, |
options: schemaOptionsRef, |
||||
{ name: 'password', label: $t('password'), type: 'w-password', colSpan: 2 }, |
onUpdateValue: (args) => { |
||||
{ name: 'mobile', label: $t('mobile'), type: 'w-text', colSpan: 2 }, |
schemaChanged(valueReactive.datasource, valueReactive.catalog, args.value); |
||||
{ name: 'phone', label: $t('phone'), type: 'w-text', colSpan: 2 }, |
}, |
||||
{ name: 'email', label: $t('email'), type: 'w-text', colSpan: 2 }, |
}, |
||||
{ name: 'weixin', label: $t('weixin'), type: 'w-text', colSpan: 2 }, |
{ |
||||
{ name: 'qq', label: $t('qq'), type: 'w-text', colSpan: 2 }, |
colSpan: 6, |
||||
|
name: 'tables', |
||||
{ name: 'enable', label: $t('enable'), type: 'w-checkbox', defaultValue: true, colsFirst: true }, |
label: $t('developer.backend.export.liquibase.tables'), |
||||
{ name: 'accountExpired', label: $t('accountExpired'), type: 'w-checkbox', defaultValue: false }, |
type: 'w-grid-select', |
||||
{ name: 'accountLocked', label: $t('accountLocked'), type: 'w-checkbox', defaultValue: false }, |
multiple: true, |
||||
{ name: 'credentialsExpired', label: $t('credentialsExpired'), type: 'w-checkbox', defaultValue: false }, |
displayValue: 'name', |
||||
], |
grid: { |
||||
}, |
denseBody: true, |
||||
}" |
hideBottom: true, |
||||
:viewer="{ |
configButton: true, |
||||
panel: { |
checkboxSelection: true, |
||||
columnNum: 1, |
primaryKey: 'name', |
||||
fields: [ |
dataUrl: Environment.apiContextPath( |
||||
{ name: 'id', label: $t('id') }, |
'/api/jdbc/metadata/getTables?datasource=' + |
||||
{ name: 'loginName', label: $t('loginName') }, |
(valueReactive.datasource || '') + |
||||
{ name: 'userName', label: $t('userName') }, |
'&catalog=' + |
||||
{ name: 'description', label: $t('description') }, |
(valueReactive.catalog || '') + |
||||
{ name: 'enable', label: $t('enable'), format: Formater.none() }, |
'&schema=' + |
||||
{ name: 'accountExpired', label: $t('accountExpired') }, |
(valueReactive.schema || ''), |
||||
{ name: 'accountLocked', label: $t('accountLocked') }, |
), |
||||
{ name: 'credentialsExpired', label: $t('credentialsExpired') }, |
pageable: false, |
||||
{ name: 'email', label: $t('email') }, |
sortBy: ['type', 'namec', '-lastModifyDate'], |
||||
{ name: 'phone', label: $t('phone') }, |
sortNo: true, |
||||
{ name: 'mobile', label: $t('mobile') }, |
toolbarConfigure: { noIcon: false }, |
||||
{ name: 'weixin', label: $t('weixin') }, |
toolbarActions: ['refresh'], |
||||
{ name: 'qq', label: $t('qq') }, |
columns: [ |
||||
{ name: 'dataComeFrom', label: $t('dataComeFrom') }, |
{ name: 'name', label: $t('name') }, |
||||
{ name: 'creator', label: $t('creator') }, |
{ name: 'remarks', label: $t('remarks') }, |
||||
{ 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' }, |
||||
], |
]" |
||||
}, |
> |
||||
}" |
</w-form> |
||||
></w-grid> |
<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 { ref } from 'vue'; |
import 'tailwindcss/utilities.css'; |
||||
import { Environment, SessionManager, axios, Options, Formater, EnumTools } from '@/platform'; |
import { ref, reactive, onMounted, onUpdated } from 'vue'; |
||||
import SelectUserGrid from './shared/SelectUserGrid.vue'; |
|
||||
import SelectMenuTreeGrid from './shared/SelectMenuTreeGrid.vue'; |
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({ |
||||
|
datasource: undefined, |
||||
|
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(); |
||||
|
}); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
const userGridRef = ref(); |
onMounted(() => { |
||||
|
loadDatasource(); |
||||
|
datasourceChanged(''); |
||||
|
}); |
||||
</script> |
</script> |
||||
|
@ -1,82 +1,199 @@ |
|||||
<template> |
<template> |
||||
<w-grid |
<div> |
||||
ref="userGridRef" |
<w-form |
||||
:title="$t('system.user.grid.title')" |
v-model="valueReactive" |
||||
:config-button="true" |
:cols-num="12" |
||||
selection="multiple" |
:fields="[ |
||||
db-click-operation="edit" |
{ |
||||
:checkbox-selection="true" |
colSpan: 2, |
||||
:data-url="Environment.apiContextPath('/api/system/user')" |
name: 'datasource', |
||||
:sort-by="['loginName']" |
label: $t('developer.backend.export.liquibase.datasource'), |
||||
:query-form-cols-num="3" |
type: 'w-select', |
||||
:query-form-fields="[ |
options: datasourceOptionsRef, |
||||
{ name: 'loginName', label: $t('loginName'), type: 'w-text' }, |
onUpdateValue: (args) => { |
||||
{ name: 'userName', label: $t('userName'), type: 'w-text' }, |
datasourceChanged(args.value); |
||||
{ name: 'enable', label: $t('isEnable'), type: 'w-select', options: Options.yesNo(), queryOperator: 'equals' }, |
}, |
||||
]" |
}, |
||||
:toolbar-configure="{ noIcon: false }" |
{ |
||||
:toolbar-actions="['query', 'refresh', 'separator', 'add', 'clone', 'edit', 'remove', 'separator', 'view', 'separator', 'export']" |
colSpan: 2, |
||||
:columns="[ |
name: 'catalog', |
||||
{ width: 200, name: 'loginName', label: $t('loginName') }, |
label: $t('developer.backend.export.liquibase.catalog'), |
||||
{ width: '100%', name: 'userName', label: $t('userName') }, |
type: 'w-select', |
||||
]" |
options: catalogOptionsRef, |
||||
:editor="{ |
onUpdateValue: (args) => { |
||||
dialog: { |
catalogChanged(valueReactive.datasource, args.value); |
||||
width: '800px', |
}, |
||||
}, |
}, |
||||
form: { |
{ |
||||
colsNum: 4, |
colSpan: 2, |
||||
fields: [ |
name: 'schema', |
||||
{ name: 'loginName', label: $t('loginName'), type: 'w-text', requiredIf: true, colSpan: 2 }, |
label: $t('developer.backend.export.liquibase.schema'), |
||||
{ name: 'userName', label: $t('userName'), type: 'w-text', requiredIf: true, colSpan: 2 }, |
type: 'w-select', |
||||
{ name: 'description', label: $t('description'), type: 'w-textarea', rows: 1, colSpan: 2 }, |
options: schemaOptionsRef, |
||||
{ name: 'password', label: $t('password'), type: 'w-password', colSpan: 2 }, |
onUpdateValue: (args) => { |
||||
{ name: 'mobile', label: $t('mobile'), type: 'w-text', colSpan: 2 }, |
schemaChanged(valueReactive.datasource, valueReactive.catalog, args.value); |
||||
{ name: 'phone', label: $t('phone'), type: 'w-text', colSpan: 2 }, |
}, |
||||
{ name: 'email', label: $t('email'), type: 'w-text', colSpan: 2 }, |
}, |
||||
{ name: 'weixin', label: $t('weixin'), type: 'w-text', colSpan: 2 }, |
{ |
||||
{ name: 'qq', label: $t('qq'), type: 'w-text', colSpan: 2 }, |
colSpan: 6, |
||||
|
name: 'tables', |
||||
{ name: 'enable', label: $t('enable'), type: 'w-checkbox', defaultValue: true, colsFirst: true }, |
label: $t('developer.backend.export.liquibase.tables'), |
||||
{ name: 'accountExpired', label: $t('accountExpired'), type: 'w-checkbox', defaultValue: false }, |
type: 'w-grid-select', |
||||
{ name: 'accountLocked', label: $t('accountLocked'), type: 'w-checkbox', defaultValue: false }, |
multiple: true, |
||||
{ name: 'credentialsExpired', label: $t('credentialsExpired'), type: 'w-checkbox', defaultValue: false }, |
displayValue: 'name', |
||||
], |
grid: { |
||||
}, |
denseBody: true, |
||||
}" |
hideBottom: true, |
||||
:viewer="{ |
configButton: true, |
||||
panel: { |
checkboxSelection: true, |
||||
columnNum: 1, |
primaryKey: 'name', |
||||
fields: [ |
dataUrl: Environment.apiContextPath( |
||||
{ name: 'id', label: $t('id') }, |
'/api/jdbc/metadata/getTables?datasource=' + |
||||
{ name: 'loginName', label: $t('loginName') }, |
(valueReactive.datasource || '') + |
||||
{ name: 'userName', label: $t('userName') }, |
'&catalog=' + |
||||
{ name: 'description', label: $t('description') }, |
(valueReactive.catalog || '') + |
||||
{ name: 'enable', label: $t('enable'), format: Formater.none() }, |
'&schema=' + |
||||
{ name: 'accountExpired', label: $t('accountExpired') }, |
(valueReactive.schema || ''), |
||||
{ name: 'accountLocked', label: $t('accountLocked') }, |
), |
||||
{ name: 'credentialsExpired', label: $t('credentialsExpired') }, |
pageable: false, |
||||
{ name: 'email', label: $t('email') }, |
sortBy: ['type', 'namec', '-lastModifyDate'], |
||||
{ name: 'phone', label: $t('phone') }, |
sortNo: true, |
||||
{ name: 'mobile', label: $t('mobile') }, |
toolbarConfigure: { noIcon: false }, |
||||
{ name: 'weixin', label: $t('weixin') }, |
toolbarActions: ['refresh'], |
||||
{ name: 'qq', label: $t('qq') }, |
columns: [ |
||||
{ name: 'dataComeFrom', label: $t('dataComeFrom') }, |
{ name: 'name', label: $t('name') }, |
||||
{ name: 'creator', label: $t('creator') }, |
{ name: 'remarks', label: $t('remarks') }, |
||||
{ 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' }, |
||||
], |
]" |
||||
}, |
> |
||||
}" |
</w-form> |
||||
></w-grid> |
<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 { ref } from 'vue'; |
import 'tailwindcss/utilities.css'; |
||||
import { Environment, SessionManager, axios, Options, Formater, EnumTools } from '@/platform'; |
import { ref, reactive, onMounted, onUpdated } from 'vue'; |
||||
import SelectUserGrid from './shared/SelectUserGrid.vue'; |
|
||||
import SelectMenuTreeGrid from './shared/SelectMenuTreeGrid.vue'; |
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({ |
||||
|
datasource: undefined, |
||||
|
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(); |
||||
|
}); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
const userGridRef = ref(); |
onMounted(() => { |
||||
|
loadDatasource(); |
||||
|
datasourceChanged(''); |
||||
|
}); |
||||
</script> |
</script> |
||||
|
@ -1,4 +0,0 @@ |
|||||
<template> |
|
||||
<div>XXX</div> |
|
||||
</template> |
|
||||
<script setup lang="ts"></script> |
|
@ -0,0 +1,245 @@ |
|||||
|
<template> |
||||
|
<div> |
||||
|
<div class="row py-1 q-col-gutter-sm"> |
||||
|
<div class="col-2"> |
||||
|
<q-select |
||||
|
v-model="valueReactive.datasource" |
||||
|
:label="$t('developer.backend.export.liquibase.datasource')" |
||||
|
outlined |
||||
|
dense |
||||
|
emit-value |
||||
|
map-options |
||||
|
:options="datasourceOptionsRef" |
||||
|
default-value="" |
||||
|
@update:model-value=" |
||||
|
(value) => { |
||||
|
datasourceChanged(value); |
||||
|
} |
||||
|
" |
||||
|
></q-select> |
||||
|
</div> |
||||
|
<div class="col-2"> |
||||
|
<q-select |
||||
|
v-model="valueReactive.catalog" |
||||
|
:label="$t('developer.backend.export.liquibase.catalog')" |
||||
|
outlined |
||||
|
dense |
||||
|
emit-value |
||||
|
map-options |
||||
|
:options="catalogOptionsRef" |
||||
|
@update:model-value=" |
||||
|
(value) => { |
||||
|
catalogChanged(valueReactive.datasource, value); |
||||
|
} |
||||
|
" |
||||
|
></q-select> |
||||
|
</div> |
||||
|
<div class="col-2"> |
||||
|
<q-select |
||||
|
v-model="valueReactive.schema" |
||||
|
:label="$t('developer.backend.export.liquibase.schema')" |
||||
|
outlined |
||||
|
dense |
||||
|
emit-value |
||||
|
map-options |
||||
|
:options="schemaOptionsRef" |
||||
|
@update:model-value=" |
||||
|
(value) => { |
||||
|
schemaChanged(valueReactive.datasource, valueReactive.catalog, value); |
||||
|
} |
||||
|
" |
||||
|
></q-select> |
||||
|
</div> |
||||
|
<div class="col-6"> |
||||
|
<q-select |
||||
|
v-model="valueReactive.tables" |
||||
|
:label="$t('developer.backend.export.liquibase.tables')" |
||||
|
outlined |
||||
|
dense |
||||
|
emit-value |
||||
|
map-options |
||||
|
multiple |
||||
|
use-chips |
||||
|
:options="tablesOptionsRef" |
||||
|
@update:model-value=" |
||||
|
(value) => { |
||||
|
if (value) { |
||||
|
if (value.length > 1) { |
||||
|
valueReactive.sql = 'select * from ${table}'; |
||||
|
} else { |
||||
|
valueReactive.sql = 'select * from ' + value; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
" |
||||
|
> |
||||
|
<template #append> |
||||
|
<q-btn |
||||
|
:title="$t('selectAll')" |
||||
|
icon="bi-check-square" |
||||
|
flat |
||||
|
dense |
||||
|
:disable="!(tablesOptionsRef?.length > 0)" |
||||
|
@click.stop.prevent=" |
||||
|
() => { |
||||
|
const selecteds = []; |
||||
|
if (tablesOptionsRef) { |
||||
|
for (const table of tablesOptionsRef) { |
||||
|
selecteds.push(table.value); |
||||
|
} |
||||
|
} |
||||
|
valueReactive.tables = selecteds; |
||||
|
} |
||||
|
" |
||||
|
/> |
||||
|
<q-btn |
||||
|
:title="$t('unSelectAll')" |
||||
|
icon="bi-square" |
||||
|
flat |
||||
|
dense |
||||
|
:disable="!(tablesOptionsRef?.length > 0)" |
||||
|
@click.stop.prevent=" |
||||
|
() => { |
||||
|
valueReactive.tables = []; |
||||
|
} |
||||
|
" |
||||
|
/> |
||||
|
</template> |
||||
|
</q-select> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="row py-1 q-col-gutter-sm"> |
||||
|
<div class="col-12"> |
||||
|
<w-code-mirror v-model="valueReactive.sql" label="SQL" :rows="5" lang="sql" :toolbar="false"></w-code-mirror> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<!-- |
||||
|
<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> |
||||
|
<script setup lang="ts"> |
||||
|
import 'tailwindcss/utilities.css'; |
||||
|
import { ref, reactive, onMounted, onUpdated } from 'vue'; |
||||
|
|
||||
|
import { t, axios, Environment, DialogManager, Downloader } from 'platform-core'; |
||||
|
|
||||
|
const progressBtnRef = ref(); |
||||
|
const datasourceOptionsRef = ref([]); |
||||
|
const catalogOptionsRef = ref([]); |
||||
|
const schemaOptionsRef = ref([]); |
||||
|
const tablesOptionsRef = ref([]); |
||||
|
|
||||
|
const valueReactive = reactive({ |
||||
|
datasource: undefined, |
||||
|
catalog: undefined, |
||||
|
schema: undefined, |
||||
|
tables: undefined, |
||||
|
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> |
@ -0,0 +1,13 @@ |
|||||
|
package io.sc.platform.jdbc.meta.support; |
||||
|
|
||||
|
public class Catalog { |
||||
|
private String name; |
||||
|
|
||||
|
public String getName() { |
||||
|
return name; |
||||
|
} |
||||
|
|
||||
|
public void setName(String name) { |
||||
|
this.name = name; |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue