Delete frontend/src/views/system/SysParam directory

This commit is contained in:
dataeaseShu 2022-10-18 16:49:20 +08:00 committed by GitHub
parent a126033df9
commit 5d8a140687
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 0 additions and 1922 deletions

View File

@ -1,472 +0,0 @@
<template>
<div>
<operater title="system_parameter_setting.basic_setting">
<deBtn
v-if="showEdit"
type="primary"
@click="edit"
>{{
$t("commons.edit")
}}</deBtn>
<deBtn
v-if="showCancel"
secondary
@click="cancel"
>{{
$t("commons.cancel")
}}</deBtn>
<deBtn
v-if="showSave"
type="primary"
:disabled="disabledSave"
size="small"
@click="save('formInline')"
>
{{ $t("commons.save") }}
</deBtn>
</operater>
<!--基础配置表单-->
<el-form
ref="formInline"
v-loading="loading"
:model="formInline"
:rules="rules"
class="demo-form-inline de-form-item"
:disabled="show"
label-width="80px"
label-position="right"
size="small"
>
<el-form-item prop="frontTimeOut">
<template slot="label">
{{ $t('system_parameter_setting.request_timeout') }}
<el-tooltip
class="item"
effect="dark"
:content="$t('system_parameter_setting.front_time_out')"
placement="top"
>
<i class="el-icon-warning-outline tips" />
</el-tooltip>
</template>
<el-input
v-model="formInline.frontTimeOut"
:placeholder="$t('system_parameter_setting.empty_front')"
><template
slot="append"
>{{ $t("panel.second") }}</template></el-input>
</el-form-item>
<el-form-item
:label="$t('system_parameter_setting.message_retention_time')"
prop="msgTimeOut"
>
<el-input
v-model="formInline.msgTimeOut"
:placeholder="$t('system_parameter_setting.empty_msg')"
><template
slot="append"
>{{ $t('components.day') }}</template></el-input>
</el-form-item>
<el-form-item :label="$t('system_parameter_setting.ds_check_time')">
<el-form
:inline="true"
:disabled="show"
class="demo-form-inline-ds"
>
<el-form-item>
<el-input
v-model="formInline.dsCheckInterval"
size="mini"
type="number"
min="1"
@change="onSimpleCronChange()"
/>
</el-form-item>
<el-form-item class="form-item">
<el-select
v-model="formInline.dsCheckIntervalType"
filterable
size="mini"
@change="onSimpleCronChange()"
>
<el-option
:label="$t('cron.minute_default')"
value="minute"
/>
<el-option
:label="$t('cron.hour_default')"
value="hour"
/>
</el-select>
</el-form-item>
<el-form-item
class="form-item"
:label="$t('cron.every_exec')"
/>
</el-form>
</el-form-item>
<el-form-item
v-if="loginTypes.length > 1"
:label="$t('system_parameter_setting.login_type')"
prop="loginType"
>
<el-radio-group v-model="formInline.loginType">
<el-radio
:label="0"
size="mini"
>{{
$t("login.default_login")
}}</el-radio>
<el-radio
v-if="loginTypes.includes(1)"
:label="1"
size="mini"
>LDAP</el-radio>
<el-radio
v-if="loginTypes.includes(2)"
:label="2"
size="mini"
>OIDC</el-radio>
<el-radio
v-if="loginTypes.includes(3)"
:label="3"
size="mini"
>CAS</el-radio>
</el-radio-group>
</el-form-item>
<plugin-com
v-if="isPluginLoaded"
ref="LoginLimitSetting"
:form="formInline"
component-name="LoginLimitSetting"
/>
<el-form-item
:label="
$t('commons.yes') + $t('commons.no') + $t('display.openMarketPage')
"
>
<el-radio-group v-model="formInline.openMarketPage">
<el-radio
label="true"
size="mini"
>{{ $t("commons.yes") }}</el-radio>
<el-radio
label="false"
size="mini"
>{{ $t("commons.no") }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
:label="
$t('commons.yes') + $t('commons.no') + $t('display.openHomePage')
"
prop="openHomePage"
>
<el-radio-group v-model="formInline.openHomePage">
<el-radio
label="true"
size="mini"
>{{ $t("commons.yes") }}</el-radio>
<el-radio
label="false"
size="mini"
>{{ $t("commons.no") }}</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
</div>
</template>
<script>
import { basicInfo, updateInfo } from '@/api/system/basic'
import { ldapStatus, oidcStatus, casStatus } from '@/api/user'
import bus from '@/utils/bus'
import operater from './Operater'
import msgCfm from '@/components/msgCfm'
import PluginCom from '@/views/system/plugin/PluginCom'
export default {
name: 'EmailSetting',
components: {
operater,
PluginCom
},
mixins: [msgCfm],
props: {
isPluginLoaded: {
type: Boolean,
default: false
}
},
data() {
return {
formInline: {},
showEdit: true,
showSave: false,
showCancel: false,
show: true,
disabledSave: false,
loading: false,
loginTypes: [0],
rules: {
frontTimeOut: [
{
pattern: '^([0-9]|\\b[1-9]\\d\\b|\\b[1-2]\\d\\d\\b|\\b300\\b)$',
message: this.$t('system_parameter_setting.front_error'),
trigger: 'blur'
}
],
msgTimeOut: [
{
pattern: '^([1-9]|[1-9][0-9]|[1-2][0-9][0-9]|3[0-5][0-9]|36[0-5])$',
message: this.$t('system_parameter_setting.msg_error'),
trigger: 'blur'
}
],
limitTimes: [
{ validator: this.validateNumber, trigger: 'blur' }
],
relieveTimes: [
{ validator: this.validateNumber, trigger: 'blur' }
]
},
originLoginType: null
}
},
computed: {},
beforeCreate() {
ldapStatus().then((res) => {
if (res.success && res.data) {
this.loginTypes.push(1)
}
})
oidcStatus().then((res) => {
if (res.success && res.data) {
this.loginTypes.push(2)
}
})
casStatus().then((res) => {
if (res.success && res.data) {
this.loginTypes.push(3)
}
})
},
created() {
this.query()
},
methods: {
validateNumber(rule, value, callback) {
if (value != null && value !== '') {
const reg = new RegExp('^([1-9]|[1-9]\\d|100)$')
if (!reg.test(value)) {
const msg = this.$t('system_parameter_setting.relieve_times_error')
callback(new Error(msg))
return
}
}
callback()
},
query() {
basicInfo().then((response) => {
this.formInline = response.data
if (this.formInline && !this.formInline.loginType) {
this.formInline.loginType = 0
}
if (!this.originLoginType) {
this.originLoginType = this.formInline.loginType
}
this.formInline.open = (this.formInline.open && this.formInline.open === 'true')
this.$nextTick(() => {
this.$refs.formInline.clearValidate()
})
})
},
edit() {
this.showEdit = false
this.showSave = true
this.showCancel = true
this.show = false
},
save(formInline) {
const param = [
{
paramKey: 'basic.frontTimeOut',
paramValue: this.formInline.frontTimeOut,
type: 'text',
sort: 1
},
{
paramKey: 'basic.msgTimeOut',
paramValue: this.formInline.msgTimeOut,
type: 'text',
sort: 2
},
{
paramKey: 'basic.loginType',
paramValue: this.formInline.loginType,
type: 'text',
sort: 3
},
{
paramKey: 'basic.dsCheckInterval',
paramValue: this.formInline.dsCheckInterval,
type: 'text',
sort: 4
},
{
paramKey: 'basic.dsCheckIntervalType',
paramValue: this.formInline.dsCheckIntervalType,
type: 'text',
sort: 5
},
{
paramKey: 'ui.openHomePage',
paramValue: this.formInline.openHomePage,
type: 'text',
sort: 13
},
{
paramKey: 'ui.openMarketPage',
paramValue: this.formInline.openMarketPage,
type: 'text',
sort: 14
},
{
paramKey: 'loginlimit.limitTimes',
paramValue: this.formInline.limitTimes,
type: 'text',
sort: 1
},
{
paramKey: 'loginlimit.relieveTimes',
paramValue: this.formInline.relieveTimes,
type: 'text',
sort: 2
},
{
paramKey: 'loginlimit.open',
paramValue: this.formInline.open,
type: 'text',
sort: 3
}
]
this.$refs[formInline].validate((valid) => {
if (valid) {
const needWarn =
this.formInline.loginType === 3 && this.originLoginType !== 3
if (needWarn) {
this.$confirm(
this.$t('system_parameter_setting.cas_selected_warn'),
'',
{
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}
)
.then(() => {
this.saveHandler(param)
})
return
}
this.saveHandler(param)
}
})
},
saveHandler(param) {
updateInfo(param).then((response) => {
const flag = response.success
if (flag) {
if (response.data && response.data.needLogout) {
const casEnable = response.data.casEnable
bus.$emit('sys-logout', { casEnable })
return
}
this.openMessageSuccess('commons.save_success')
this.showEdit = true
this.showCancel = false
this.showSave = false
this.show = true
window.location.reload()
} else {
this.openMessageSuccess('commons.save_failed', 'error')
}
})
},
cancel() {
this.showEdit = true
this.showCancel = false
this.showSave = false
this.show = true
this.query()
},
onSimpleCronChange() {
if (this.formInline.dsCheckIntervalType === 'minute') {
const pattern = '^([1-9]|[1-5][0-9])$'
if (!new RegExp(pattern).test(this.formInline.dsCheckInterval)) {
this.$message({ message: this.$t('cron.minute_limit'), type: 'warning', showClose: true })
this.formInline.dsCheckInterval = 1
}
return
}
if (this.formInline.dsCheckIntervalType === 'hour') {
const pattern = '^([1-9]|[1-2][0-3])$'
if (!new RegExp(pattern).test(this.formInline.dsCheckInterval)) {
this.$message({ message: this.$t('cron.hour_limit'), type: 'warning', showClose: true })
this.formInline.dsCheckInterval = 1
}
return
}
}
}
}
</script>
<style lang="scss" scoped>
.demo-form-inline {
.tips {
margin-left: 2px;
position: relative;
z-index: 10;
}
.el-radio:not(:last-child) {
margin-right: 0;
width: 156px;
}
}
.demo-form-inline-ds {
.el-form-item {
margin-bottom: 0px !important;
}
}
</style>
<style lang="scss">
.de-i118 {
.el-form-item__label::after {
display: none;
}
.is-require::after {
content: "*";
color: #f54a45;
margin-left: 2px;
}
}
</style>

View File

@ -1,461 +0,0 @@
<template>
<div>
<operater title="system_parameter_setting.engine_mode_setting">
<deBtn
v-if="showCancel"
secondary
@click="cancel"
>
{{ $t("commons.cancel") }}
</deBtn>
<deBtn
secondary
@click="validaDatasource"
>
{{ $t("commons.validate") }}
</deBtn>
<deBtn
v-if="showEdit"
type="primary"
@click="edit"
>
{{ $t("commons.edit") }}
</deBtn>
<deBtn
v-if="showSave"
type="primary"
@click="save"
>
{{ $t("commons.save") }}
</deBtn>
</operater>
<el-form
ref="form"
v-loading="loading"
:model="form"
:rules="rules"
class="de-form-item"
:disabled="show"
label-width="180px"
label-position="top"
size="small"
>
<el-form-item
:label="$t('datasource.doris_host')"
prop="configuration.host"
>
<el-input v-model="form.configuration.host" />
</el-form-item>
<el-form-item
:label="$t('datasource.data_base')"
prop="configuration.dataBase"
>
<el-input v-model="form.configuration.dataBase" />
</el-form-item>
<el-form-item :label="$t('datasource.user_name')">
<el-input v-model="form.configuration.username" />
</el-form-item>
<el-form-item :label="$t('datasource.password')">
<dePwd v-model="form.configuration.password" />
</el-form-item>
<el-form-item
:label="$t('datasource.query_port')"
prop="configuration.port"
>
<el-input-number
v-model="form.configuration.port"
controls-position="right"
autocomplete="off"
type="number"
min="0"
/>
</el-form-item>
<el-form-item
:label="$t('datasource.http_port')"
prop="configuration.httpPort"
>
<el-input-number
v-model="form.configuration.httpPort"
controls-position="right"
autocomplete="off"
type="number"
min="0"
/>
</el-form-item>
<span
class="de-expand"
@click="showPriority = !showPriority"
>{{ $t("datasource.priority")
}}<i
v-if="showPriority"
class="el-icon-arrow-up"
/>
<i
v-else
class="el-icon-arrow-down"
/></span>
<template v-if="showPriority">
<el-row :gutter="24">
<el-col :span="12">
<el-form-item
:label="$t('datasource.replication_num')"
prop="configuration.replicationNum"
>
<el-input-number
v-model="form.configuration.replicationNum"
controls-position="right"
autocomplete="off"
type="number"
min="1"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
:label="$t('datasource.bucket_num')"
prop="configuration.bucketNum"
>
<el-input-number
v-model="form.configuration.bucketNum"
controls-position="right"
autocomplete="off"
type="number"
min="1"
/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="12">
<el-form-item
:label="$t('datasource.initial_pool_size')"
prop="configuration.initialPoolSize"
>
<el-input-number
v-model="form.configuration.initialPoolSize"
controls-position="right"
autocomplete="off"
type="number"
min="0"
size="small"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
:label="$t('datasource.min_pool_size')"
prop="configuration.minPoolSize"
>
<el-input-number
v-model="form.configuration.minPoolSize"
controls-position="right"
autocomplete="off"
type="number"
min="0"
/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="12">
<el-form-item
:label="$t('datasource.max_pool_size')"
prop="configuration.maxPoolSize"
>
<el-input-number
v-model="form.configuration.maxPoolSize"
controls-position="right"
autocomplete="off"
type="number"
min="0"
/>
</el-form-item>
</el-col>
</el-row>
</template>
</el-form>
</div>
</template>
<script>
import { engineInfo, validate, save } from '@/api/system/engine'
import i18n from '@/lang'
import operater from './Operater'
import msgCfm from '@/components/msgCfm'
import dePwd from '@/components/deCustomCm/dePwd.vue'
export default {
name: 'ClusterMode',
components: {
operater,
dePwd
},
mixins: [msgCfm],
data() {
return {
showPriority: false,
form: {
type: 'engine_doris',
configuration: {
host: '',
dataBase: '',
username: '',
password: '',
port: '',
httpPort: 8030,
extraParams:
'characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true&zeroDateTimeBehavior=convertToNull',
replicationNum: 1,
bucketNum: 10,
minPoolSize: 5,
maxPoolSize: 50,
initialPoolSize: 5
}
},
originConfiguration: {
host: '',
dataBase: '',
username: '',
password: '',
port: '',
httpPort: 8030,
extraParams:
'characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true&zeroDateTimeBehavior=convertToNull',
replicationNum: 1,
bucketNum: 10,
minPoolSize: 5,
maxPoolSize: 50,
initialPoolSize: 5
},
input: '',
visible: true,
showEdit: true,
showSave: false,
showCancel: false,
show: true,
disabledConnection: false,
disabledSave: false,
loading: false,
rules: {
'configuration.host': [
{
required: true,
message: this.$t('datasource.please_input_host'),
trigger: ['change', 'blur']
}
],
'configuration.port': [
{
required: true,
message: this.$t('datasource.please_input_port'),
trigger: ['change', 'blur']
}
],
'configuration.httpPort': [
{
required: true,
message: this.$t('datasource.please_input_port'),
trigger: ['change', 'blur']
}
],
'configuration.dataBase': [
{
required: true,
message: this.$t('datasource.please_input_data_base'),
trigger: ['change', 'blur']
}
],
'configuration.replicationNum': [
{
required: true,
message: this.$t('datasource.please_input_replication_num'),
trigger: ['change', 'blur']
}
],
'configuration.bucketNum': [
{
required: true,
message: this.$t('datasource.please_input_bucket_num'),
trigger: ['change', 'blur']
}
],
'configuration.minPoolSize': [
{
required: true,
message: this.$t('datasource.commons.cannot_be_null'),
trigger: ['change', 'blur']
}
],
'configuration.initialPoolSize': [
{
required: true,
message: this.$t('commons.cannot_be_null'),
trigger: ['change', 'blur']
}
],
'configuration.maxPoolSize': [
{
required: true,
message: this.$t('datasource.commons.cannot_be_null'),
trigger: ['change', 'blur']
}
]
},
allTypes: [
{
name: 'engine_mysql',
label: 'MySQL',
type: 'jdbc',
extraParams:
'characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true'
}
]
}
},
created() {
this.query()
},
methods: {
query() {
engineInfo().then((response) => {
if (response.data.id) {
this.form = JSON.parse(JSON.stringify(response.data))
this.form.configuration = JSON.parse(this.form.configuration)
this.originConfiguration = JSON.parse(
JSON.stringify(this.form.configuration)
)
}
this.$nextTick(() => {
this.$refs.form.clearValidate()
})
})
},
edit() {
this.showEdit = false
this.showSave = true
this.showCancel = true
this.show = false
},
save() {
if (
this.form.configuration.dataSourceType === 'jdbc' &&
(this.form.configuration.port <= 0 ||
this.form.configuration.httpPort <= 0)
) {
this.$message.error(i18n.t('datasource.port_no_less_then_0'))
return
}
if (
this.form.configuration.initialPoolSize < 0 ||
this.form.configuration.minPoolSize < 0 ||
this.form.configuration.maxPoolSize < 0
) {
this.$message.error(i18n.t('datasource.no_less_then_0'))
return
}
this.$refs.form.validate((valid) => {
if (!valid) {
return false
}
const form = JSON.parse(JSON.stringify(this.form))
form.configuration = JSON.stringify(form.configuration)
save(form).then((res) => {
this.showEdit = true
this.showCancel = false
this.showSave = false
this.show = true
this.originConfiguration = JSON.parse(
JSON.stringify(this.form.configuration)
)
this.openMessageSuccess('commons.save_success')
})
})
},
cancel() {
this.showEdit = true
this.showCancel = false
this.showSave = false
this.show = true
this.form.configuration = JSON.parse(
JSON.stringify(this.originConfiguration)
)
},
changeType() {
for (let i = 0; i < this.allTypes.length; i++) {
if (this.allTypes[i].name === this.form.type) {
this.form.configuration.dataSourceType = this.allTypes[i].type
this.form.configuration.extraParams = this.allTypes[i].extraParams
}
}
},
validaDatasource() {
if (!this.form.configuration.schema && this.form.type === 'oracle') {
this.$message.error(i18n.t('datasource.please_choose_schema'))
return
}
if (
this.form.configuration.dataSourceType === 'jdbc' &&
(this.form.configuration.port <= 0 ||
this.form.configuration.httpPort <= 0)
) {
this.$message.error(i18n.t('datasource.port_no_less_then_0'))
return
}
this.$refs.form.validate((valid) => {
if (valid) {
const data = JSON.parse(JSON.stringify(this.form))
data.configuration = JSON.stringify(data.configuration)
validate(data).then((res) => {
if (res.success) {
this.openMessageSuccess('datasource.validate_success')
} else {
if (res.message.length < 2500) {
this.$error(res.message)
} else {
this.$error(res.message.substring(0, 2500) + '......')
}
}
})
} else {
return false
}
})
}
}
}
</script>
<style lang="scss" scoped>
.de-expand {
font-family: PingFang SC;
font-size: 14px;
font-weight: 400;
line-height: 22px;
color: #3370ff;
cursor: pointer;
margin: 12px 0 16px 0;
display: inline-block;
}
.el-input-number {
width: 100%;
::v-deep .el-input__inner {
text-align: left;
}
::v-deep.el-input-number__decrease,
::v-deep.el-input-number__increase {
background: transparent;
}
&.is-disabled {
.el-input-number__decrease {
border-right-color: #e4e7ed;
}
.el-input-number__increase {
border-bottom-color: #e4e7ed;
}
}
}
</style>

View File

@ -1,305 +0,0 @@
<template>
<div>
<operater title="system_parameter_setting.mailbox_service_settings">
<deBtn
v-if="showCancel"
secondary
@click="cancel"
>{{
$t("commons.cancel")
}}</deBtn>
<deBtn
secondary
:disabled="disabledConnection"
@click="testConnection('formInline')"
>
{{ $t("system_parameter_setting.test_connection") }}
</deBtn>
<deBtn
v-if="showEdit"
type="primary"
@click="edit"
>{{
$t("commons.edit")
}}</deBtn>
<deBtn
v-if="showSave"
type="primary"
:disabled="disabledSave"
@click="save('formInline')"
>
{{ $t("commons.save") }}
</deBtn>
</operater>
<!--邮件表单-->
<el-form
ref="formInline"
v-loading="loading"
:model="formInline"
:rules="rules"
class="demo-form-inline de-form-item"
:disabled="show"
size="small"
>
<el-form-item
:label="$t('system_parameter_setting.SMTP_host')"
prop="host"
>
<el-input
v-model="formInline.host"
:placeholder="$t('system_parameter_setting.SMTP_host')"
@input="change()"
/>
</el-form-item>
<el-form-item
:label="$t('system_parameter_setting.SMTP_port')"
prop="port"
>
<el-input
v-model="formInline.port"
:placeholder="$t('system_parameter_setting.SMTP_port')"
@input="change()"
/>
</el-form-item>
<el-form-item
:label="$t('system_parameter_setting.SMTP_account')"
prop="account"
>
<el-input
v-model="formInline.account"
:placeholder="$t('system_parameter_setting.SMTP_account')"
@input="change()"
/>
</el-form-item>
<el-form-item
:label="$t('system_parameter_setting.SMTP_password')"
prop="password"
>
<dePwd
v-model="formInline.password"
:placeholder="$t('system_parameter_setting.SMTP_password')"
/>
</el-form-item>
<el-form-item :label="$t('system_parameter_setting.test_recipients')">
<template slot="label">
{{ $t("system_parameter_setting.test_recipients") }}
<el-tooltip
class="item"
effect="dark"
:content="$t('system_parameter_setting.test_mail_recipient')"
placement="top"
>
<i class="el-icon-warning-outline tips-not-absolute" />
</el-tooltip>
</template>
<dePwd
v-model="formInline.recipient"
:placeholder="$t('system_parameter_setting.test_recipients')"
/>
</el-form-item>
<el-form-item label="邮箱服务器配置">
<el-checkbox v-model="formInline.ssl">{{ $t('chart.open') }}SSL
<el-tooltip
class="item"
effect="dark"
:content="$t('system_parameter_setting.to_enable_ssl')"
placement="top"
>
<i class="el-icon-warning-outline tips-not-absolute" />
</el-tooltip>
</el-checkbox>
<el-checkbox v-model="formInline.tls">
{{ $t('chart.open') }}TSL
<el-tooltip
class="item"
effect="dark"
:content="$t('system_parameter_setting.to_enable_tsl')"
placement="top"
>
<i class="el-icon-warning-outline tips-not-absolute" />
</el-tooltip>
</el-checkbox>
</el-form-item>
<template #footer />
</el-form>
</div>
</template>
<script>
import { emailInfo, updateInfo, validate } from '@/api/system/email'
import operater from './Operater'
import msgCfm from '@/components/msgCfm'
import dePwd from '@/components/deCustomCm/dePwd.vue'
export default {
name: 'EmailSetting',
components: {
operater,
dePwd
},
mixins: [msgCfm],
data() {
return {
formInline: {},
input: '',
visible: true,
showEdit: true,
showSave: false,
showCancel: false,
show: true,
disabledConnection: false,
disabledSave: false,
loading: false,
rules: {
host: [
{
required: true,
message: this.$t('system_parameter_setting.host'),
trigger: ['change', 'blur']
}
],
port: [
{
required: true,
message: this.$t('system_parameter_setting.port'),
trigger: ['change', 'blur']
}
],
account: [
{
required: true,
message: this.$t('system_parameter_setting.account'),
trigger: ['change', 'blur']
}
]
}
}
},
created() {
this.query()
},
methods: {
query() {
emailInfo().then((response) => {
this.formInline = response.data
this.formInline.ssl = this.formInline.ssl === 'true'
this.formInline.tls = this.formInline.tls === 'true'
this.$nextTick(() => {
this.$refs.formInline.clearValidate()
})
})
},
change() {
if (
!this.formInline.host ||
!this.formInline.port ||
!this.formInline.account
) {
this.disabledConnection = true
this.disabledSave = true
} else {
this.disabledConnection = false
this.disabledSave = false
}
},
testConnection(formInline) {
const param = {
'smtp.host': this.formInline.host,
'smtp.port': this.formInline.port,
'smtp.account': this.formInline.account,
'smtp.password': this.formInline.password,
'smtp.ssl': this.formInline.ssl,
'smtp.tls': this.formInline.tls,
'smtp.recipient': this.formInline.recipient
}
this.$refs[formInline].validate((valid) => {
if (valid) {
validate(param).then((response) => {
this.openMessageSuccess('commons.connection_successful')
})
} else {
return false
}
})
},
edit() {
this.showEdit = false
this.showSave = true
this.showCancel = true
this.show = false
},
save(formInline) {
this.showEdit = true
this.showCancel = false
this.showSave = false
this.show = true
const param = [
{
paramKey: 'smtp.host',
paramValue: this.formInline.host,
type: 'text',
sort: 1
},
{
paramKey: 'smtp.port',
paramValue: this.formInline.port,
type: 'text',
sort: 2
},
{
paramKey: 'smtp.account',
paramValue: this.formInline.account,
type: 'text',
sort: 3
},
{
paramKey: 'smtp.password',
paramValue: this.formInline.password,
type: 'password',
sort: 4
},
{
paramKey: 'smtp.ssl',
paramValue: this.formInline.ssl,
type: 'text',
sort: 5
},
{
paramKey: 'smtp.tls',
paramValue: this.formInline.tls,
type: 'text',
sort: 6
},
{
paramKey: 'smtp.recipient',
paramValue: this.formInline.recipient,
type: 'text',
sort: 8
}
]
this.$refs[formInline].validate((valid) => {
if (valid) {
updateInfo(param).then((response) => {
const flag = response.success
if (flag) {
this.openMessageSuccess('commons.save_success')
} else {
this.$message.error(this.$t('commons.save_failed'))
}
})
}
})
},
cancel() {
this.showEdit = true
this.showCancel = false
this.showSave = false
this.show = true
this.query()
}
}
}
</script>

View File

@ -1,385 +0,0 @@
<template>
<div>
<!--基础配置表单-->
<el-form
v-if="status !== 'empty' && status !== 'read-only'"
ref="formInline"
v-loading="loading"
:model="formInline"
:rules="rules"
class="demo-form-inline"
size="small"
>
<el-input
v-show="false"
v-model="formInline.pLevel"
/>
<el-row>
<el-row>
<el-col>
<el-form-item
:label="$t('map_setting.parent_area')"
prop="pCode"
>
<el-tree-select
v-if="treeShow"
ref="deSelectTree"
v-model="formInline.pCode"
:popper-append-to-body="true"
popover-class="map-class-wrap"
:data="treeDatas"
:select-params="selectParams"
:tree-params="treeParams"
:filter-node-method="_filterFun"
:tree-render-fun="_renderFun"
@searchFun="_searchFun"
@node-click="changeNode"
@select-clear="selectClear"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item
:label="$t('map_setting.area_code')"
prop="code"
>
<el-input
v-model="formInline.code"
:placeholder="$t('map_setting.please_input')"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item
:label="$t('map_setting.area_name')"
prop="name"
>
<el-input
v-model="formInline.name"
maxlength="30"
show-word-limit
:placeholder="$t('map_setting.please_input')"
/>
</el-form-item>
</el-col>
</el-row>
</el-row>
<el-row>
<el-col>
<el-form-item :label="$t('map_setting.geo_json')">
<el-upload
style="float: right;margin-left: 10px"
class="upload-demo"
action=""
accept=".json"
:on-exceed="handleExceed"
:before-upload="uploadValidate"
:on-error="handleError"
:show-file-list="false"
:file-list="filesTmp"
:http-request="uploadMapFile"
>
<el-button
style="display: inline-block"
size="mini"
type="success"
plain
>
{{ $t('commons.upload') }}
</el-button>
</el-upload>
<el-button
style="float:right;margin-top: 3px"
size="mini"
type="danger"
plain
@click="removeFile"
>
{{ $t('commons.clear') }}
</el-button>
<el-input
v-model="formInline.fileName"
:disabled="true"
/>
</el-form-item>
</el-col>
</el-row>
<div>
<el-button
type="success"
size="small"
@click="save('formInline')"
>
{{ $t('commons.save') }}
</el-button>
</div>
</el-form>
<el-descriptions
v-else-if="status === 'read-only'"
title="区域信息"
:column="1"
>
<el-descriptions-item :label="$t('map_setting.area_code')">{{ nodeInfo.code }}</el-descriptions-item>
<el-descriptions-item :label="$t('map_setting.area_name')">{{ nodeInfo.name }}</el-descriptions-item>
<el-descriptions-item :label="$t('map_setting.parent_name')">{{ nodeInfo.pname }}</el-descriptions-item>
<el-descriptions-item :label="$t('map_setting.geo_json')">
<json-view :data="json" />
</el-descriptions-item>
</el-descriptions>
<el-empty
v-else-if="status === 'empty'"
description="请在左侧选择区域"
/>
</div>
</template>
<script>
import jsonView from 'vue-json-views'
import { geoJson, saveMap } from '@/api/map/map'
import ElTreeSelect from '@/components/ElTreeSelect'
import msgCfm from '@/components/msgCfm'
export default {
name: 'MapSettingRight',
components: { jsonView, ElTreeSelect },
mixins: [msgCfm],
props: {
status: {
type: String,
default: 'empty'
},
treeDatas: {
type: Array,
default: () => []
}
},
data() {
return {
formInline: { pCode: '', fileName: '' },
loading: false,
rules: {
pCode: [
{ required: true, message: this.$t('map_setting.parent_name') + this.$t('commons.cannot_be_null'), trigger: 'change' }
],
code: [
{ required: true, message: this.$t('map_setting.area_code') + this.$t('commons.cannot_be_null'), trigger: ['change', 'blur'] },
{ pattern: /^\d{9}$/, message: this.$t('map_setting.area_code_tip'), trigger: ['change', 'blur'] }
],
name: [
{ required: true, message: this.$t('map_setting.area_name') + this.$t('commons.cannot_be_null'), trigger: ['change', 'blur'] }
],
fileName: [
{ required: true, message: this.$t('map_setting.geo_json') + this.$t('commons.cannot_be_null'), trigger: 'change' }
]
},
levelOptions: [
{ value: 1, label: '国家' },
{ value: 2, label: '一级行政区划(省)' },
{ value: 3, label: '二级行政区划(市)' },
{ value: 4, label: '三级行政区划(区县)' },
{ value: 5, label: '四级行政区划(乡镇)' }
],
suffixes: new Set(['json']),
errList: [],
filesTmp: [],
nodeInfo: {
code: -1,
name: '',
level: -1,
pcode: -1,
pname: ''
},
noGsoJson: { success: false, message: 'no json file' },
json: {},
selectParams: {
clearable: true,
placeholder: this.$t('commons.please_select') + this.$t('map_setting.parent_name')
},
treeParams: {
showParent: true,
clickParent: true,
filterable: true,
//
leafOnly: false,
includeHalfChecked: false,
'check-strictly': false,
'default-expand-all': false,
'expand-on-click-node': false,
'render-content': this._renderFun,
data: [],
props: {
children: 'children',
label: 'name',
rootId: '000000000',
disabled: 'disabled',
parentId: 'pcode',
value: 'code'
}
},
treeShow: true
}
},
watch: {
treeDatas: function(val) {
this.treeParams.data = val
}
},
methods: {
handleExceed(files, fileList) {
this.$warning(this.$t('test_track.case.import.upload_limit_count'))
},
handleError() {
this.$warning(this.$t('test_track.case.import.upload_limit_count'))
},
uploadValidate(file) {
const suffix = file.name.substring(file.name.lastIndexOf('.') + 1)
if (!this.suffixes.has(suffix)) {
this.$warning(this.$t('test_track.case.import.upload_limit_format'))
return false
}
if (file.size / 1024 / 1024 > 30) {
this.$warning(this.$t('test_track.case.import.upload_limit_size'))
return false
}
this.errList = []
return true
},
uploadMapFile(file) {
this.$set(this.formInline, 'fileName', file.file.name)
this.formInline.file = file.file
},
removeFile() {
this.formInline.fileName = null
this.formInline.file = null
},
buildFormData(file, files, param) {
const formData = new FormData()
if (file) {
formData.append('file', file)
}
if (files) {
files.forEach(f => {
formData.append('files', f)
})
}
formData.append('request', new Blob([JSON.stringify(param)], { type: 'application/json' }))
return formData
},
save(formInline) {
const param = {
code: this.formInline.code,
name: this.formInline.name,
pcode: this.formInline.pCode,
plevel: this.formInline.pLevel
}
this.$refs[formInline].validate(valid => {
if (valid) {
this.saveHandler(param)
}
})
},
saveHandler(param) {
const formData = this.buildFormData(this.formInline.file, null, param)
saveMap(formData).then(response => {
const flag = response.success
if (flag) {
this.$emit('refresh-tree', param)
this.openMessageSuccess('commons.save_success')
} else {
this.$message.error(this.$t('commons.save_failed'))
}
})
},
emitAdd(form) {
this.formInline = JSON.parse(JSON.stringify(form))
this.treeShow = false
this.$nextTick(() => {
this.treeShow = true
})
},
loadForm(form) {
if (form && form.code) {
this.nodeInfo = JSON.parse(JSON.stringify(form))
this.setGeoJson()
}
},
setGeoJson() {
if (!this.nodeInfo || !this.nodeInfo.code) {
this.json = JSON.parse(JSON.stringify(this.noGsoJson))
return
}
const cCode = this.nodeInfo.code
if (this.$store.getters.geoMap[cCode]) {
const json = this.$store.getters.geoMap[cCode]
this.json = JSON.parse(JSON.stringify(json))
return
}
geoJson(cCode).then(res => {
this.$store.dispatch('map/setGeo', {
key: cCode,
value: res
}).then(() => {
this.json = JSON.parse(JSON.stringify(res))
})
})
},
_filterFun(value, data, node) {
if (!value) return true
return data.id.toString().indexOf(value.toString()) !== -1
},
//
_nodeClickFun(data, node, vm) {
},
//
_searchFun(value) {
this.$refs.deSelectTree.filterFun(value)
},
// render
_renderFun(h, { node, data, store }) {
const { props, clickParent } = this.treeParams
return (
<span class={['custom-tree-node', !clickParent && data[props.children] && data[props.children].length ? 'disabled' : null]}>
<span>{node.label}</span>
</span>
)
},
changeNode(data, node) {
if (node.level > 4) {
this.$error('不支持4级行政级别')
this.formInline.pLevel = null
this.formInline.pCode = null
return
}
this.formInline.pLevel = node.level
}
}
}
</script>
<style lang="scss" scoped>
.map-class-wrap{
top: 65px !important;
left: 0px !important;
}
</style>

View File

@ -1,299 +0,0 @@
<template>
<div>
<el-form
ref="form"
v-loading="loading"
:model="form"
:rules="rules"
class="demo-form-inline"
:disabled="show"
label-width="180px"
label-position="top"
size="small"
>
<el-row>
<el-col>
<el-form-item
:label="$t('datasource.type')"
prop="type"
>
<el-select
v-model="form.type"
:placeholder="$t('datasource.please_choose_type')"
filterable
@change="changeType()"
>
<el-option
v-for="item in allTypes"
:key="item.name"
:label="item.label"
:value="item.name"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item
:label="$t('datasource.host')"
prop="configuration.host"
>
<el-input v-model="form.configuration.host" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item
:label="$t('datasource.data_base')"
prop="configuration.dataBase"
>
<el-input v-model="form.configuration.dataBase" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item :label="$t('datasource.user_name')">
<el-input v-model="form.configuration.username" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item :label="$t('datasource.password')">
<el-input
v-model="form.configuration.password"
show-password
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item
:label="$t('datasource.port')"
prop="configuration.port"
>
<el-input
v-model="form.configuration.port"
autocomplete="off"
type="number"
min="0"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item :label="$t('datasource.extra_params')">
<el-input v-model="form.configuration.extraParams" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div>
<el-button
type="primary"
size="small"
@click="validaDatasource"
>
{{ $t('commons.validate') }}
</el-button>
<el-button
v-if="showEdit"
size="small"
@click="edit"
>
{{ $t('commons.edit') }}
</el-button>
<el-button
v-if="showSave"
type="success"
size="small"
@click="save"
>
{{ $t('commons.save') }}
</el-button>
<el-button
v-if="showCancel"
type="info"
size="small"
@click="cancel"
>
{{ $t('commons.cancel') }}
</el-button>
</div>
</div>
</template>
<script>
import { engineInfo, validate, save } from '@/api/system/engine'
import i18n from '@/lang'
import msgCfm from '@/components/msgCfm'
export default {
name: 'SimpleMode',
mixins: [msgCfm],
data() {
return {
form:
{
type: 'engine_mysql',
configuration: {
host: '',
dataBase: '',
username: '',
password: '',
port: '',
extraParams: 'characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true&zeroDateTimeBehavior=convertToNull'
}
},
originConfiguration: {
host: '',
dataBase: '',
username: '',
password: '',
port: '',
extraParams: 'characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true&zeroDateTimeBehavior=convertToNull'
},
input: '',
visible: true,
showEdit: true,
showSave: false,
showCancel: false,
show: true,
disabledConnection: false,
disabledSave: false,
loading: false,
rules: {
'configuration.host': [
{
required: true,
message: this.$t('datasource.please_input_host'),
trigger: ['change', 'blur']
}
],
'configuration.port': [
{
required: true,
message: this.$t('datasource.please_input_port'),
trigger: ['change', 'blur']
}
],
'configuration.dataBase': [
{
required: true,
message: this.$t('datasource.please_input_data_base'),
trigger: ['change', 'blur']
}
]
},
allTypes: [
{
name: 'engine_mysql',
label: 'MySQL',
type: 'jdbc',
extraParams: 'characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true'
}
]
}
},
created() {
this.query()
},
methods: {
query() {
engineInfo().then(response => {
if (response.data.id) {
this.form = JSON.parse(JSON.stringify(response.data))
this.form.configuration = JSON.parse(this.form.configuration)
this.originConfiguration = JSON.parse(JSON.stringify(this.form.configuration))
}
this.$nextTick(() => {
this.$refs.form.clearValidate()
})
})
},
edit() {
this.showEdit = false
this.showSave = true
this.showCancel = true
this.show = false
},
save() {
if (this.form.configuration.dataSourceType === 'jdbc' && this.form.configuration.port <= 0) {
this.$message.error(i18n.t('datasource.port_no_less_then_0'))
return
}
if (this.form.configuration.initialPoolSize < 0 || this.form.configuration.minPoolSize < 0 || this.form.configuration.maxPoolSize < 0) {
this.$message.error(i18n.t('datasource.no_less_then_0'))
return
}
this.$refs.form.validate(valid => {
if (!valid) {
return false
}
const form = JSON.parse(JSON.stringify(this.form))
form.configuration = JSON.stringify(form.configuration)
save(form).then(res => {
this.showEdit = true
this.showCancel = false
this.showSave = false
this.show = true
this.originConfiguration = JSON.parse(JSON.stringify(this.form.configuration))
this.openMessageSuccess('commons.save_success')
})
})
},
cancel() {
this.showEdit = true
this.showCancel = false
this.showSave = false
this.show = true
this.form.configuration = JSON.parse(JSON.stringify(this.originConfiguration))
},
changeType() {
for (let i = 0; i < this.allTypes.length; i++) {
if (this.allTypes[i].name === this.form.type) {
this.form.configuration.dataSourceType = this.allTypes[i].type
this.form.configuration.extraParams = this.allTypes[i].extraParams
}
}
},
validaDatasource() {
if (!this.form.configuration.schema && this.form.type === 'oracle') {
this.$message.error(i18n.t('datasource.please_choose_schema'))
return
}
if (this.form.configuration.dataSourceType === 'jdbc' && this.form.configuration.port <= 0) {
this.$message.error(i18n.t('datasource.port_no_less_then_0'))
return
}
this.$refs.form.validate(valid => {
if (valid) {
const data = JSON.parse(JSON.stringify(this.form))
data.configuration = JSON.stringify(data.configuration)
validate(data).then(res => {
if (res.success) {
this.openMessageSuccess('datasource.validate_success')
} else {
if (res.message.length < 2500) {
this.$error(res.message)
} else {
this.$error(res.message.substring(0, 2500) + '......')
}
}
})
} else {
return false
}
})
}
}
}
</script>