fix(接口测试): 修复后置sql打开数据源数据没刷新的缺陷
This commit is contained in:
parent
17cb9cc57b
commit
4afdfcf3f4
|
@ -38,6 +38,7 @@
|
|||
import type { MsTableColumn } from '@/components/pure/ms-table/type';
|
||||
import useTable from '@/components/pure/ms-table/useTable';
|
||||
|
||||
import { getEnvironment } from '@/api/modules/api-test/common';
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
|
||||
import { EnvConfig } from '@/models/projectManagement/environmental';
|
||||
|
@ -109,14 +110,24 @@
|
|||
watch(
|
||||
() => currentEnvConfig?.value,
|
||||
(config) => {
|
||||
if (config) {
|
||||
propsRes.value.data = cloneDeep(config.dataSources) as any[];
|
||||
if (config && config.id) {
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
initEnvironment(config.id);
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
}
|
||||
);
|
||||
async function initEnvironment(envId: string) {
|
||||
try {
|
||||
const res = await getEnvironment(envId);
|
||||
propsRes.value.data = cloneDeep(res.dataSources) as any[];
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
function searchDataSource() {
|
||||
if (keyword.value.trim() !== '') {
|
||||
|
|
|
@ -33,7 +33,13 @@
|
|||
:placeholder="t('project.environmental.database.namePlaceholder')"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item field="driver" asterisk-position="end" :label="t('project.environmental.database.driver')">
|
||||
<a-form-item
|
||||
field="driver"
|
||||
required
|
||||
asterisk-position="end"
|
||||
:label="t('project.environmental.database.driver')"
|
||||
:rules="[{ required: true, message: t('project.environmental.database.urlIsRequire') }]"
|
||||
>
|
||||
<a-select v-model="form.driverId" :options="driverOption" />
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
|
|
|
@ -87,6 +87,7 @@ export default {
|
|||
'project.environmental.host.ipNotRepeat': 'IP address cannot be repeated',
|
||||
'project.environmental.host.hostName': 'Host Name',
|
||||
'project.environmental.host.hostNameIsRequire': 'Host name cannot be empty',
|
||||
'project.environmental.database.driverIsRequire': 'Driver is required',
|
||||
'project.environmental.host.hostNamePlaceholder': 'Please enter the host name',
|
||||
'project.environmental.host.desc': 'Description',
|
||||
'project.environmental.host.descPlaceholder': 'Please enter the description',
|
||||
|
|
|
@ -88,6 +88,7 @@ export default {
|
|||
'project.environmental.database.url': '数据库连接 URL',
|
||||
'project.environmental.database.urlExtra': '执行多条 SQL 语句需配置 allowMultiQueries=true',
|
||||
'project.environmental.database.urlIsRequire': '数据库连接 URL 必填',
|
||||
'project.environmental.database.driverIsRequire': '驱动必填',
|
||||
'project.environmental.database.testConnection': '测试连接',
|
||||
'project.environmental.database.testConnectionSuccess': '连接成功',
|
||||
'project.environmental.host.config': 'Host 配置',
|
||||
|
|
Loading…
Reference in New Issue