系统全局配置,支持在页面可视化配置
continuous-integration/drone/push Build is passing Details

main
wangxiaoshuang 2026-08-10 15:56:52 +08:00
parent 2c9c6d45e5
commit 942529718b
10 changed files with 651 additions and 496 deletions

View File

@ -422,4 +422,19 @@ export function updateSystemEmailConfig(data) {
data
})
}
// 获取前端配置
export function getWebConfigInfo() {
return request({
url: `/DeployConfig/getWebConfigInfo`,
method: 'get'
})
}
// 更新前端配置
export function updateWebConfigInfo(data) {
return request({
url: `/DeployConfig/updateWebConfigInfo`,
method: 'put',
data
})
}

View File

@ -52,8 +52,8 @@ export default {
data() {
return {
currentUser: zzSessionStorage.getItem('userName'),
COMPANY: process.env.VUE_APP_COMPANY_NAME,
onlyOffice_url: process.env.VUE_APP_ONLYOFFICE_URL,
COMPANY: window.webConfig.VUE_APP_COMPANY_NAME,
onlyOffice_url: window.webConfig.VUE_APP_ONLYOFFICE_URL,
window,
}
},

View File

@ -20,7 +20,7 @@ export default {
title: null,
documentType: null,
currentUser: zzSessionStorage.getItem('userName'),
onlyOffice_url: process.env.VUE_APP_ONLYOFFICE_URL
onlyOffice_url: window.webConfig.VUE_APP_ONLYOFFICE_URL
};
},
methods: {

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,59 @@
<div ref="leftContainer" class="left" style="padding: 20px;">
<el-form :inline="true" :model="form" :rules="rules" ref="systemConfigForm"
style="display: flex;align-items: center;justify-content: space-between;flex-wrap: wrap;">
<h3>{{ $t("system:config:WebConfig") }}</h3>
<el-form-item :label="$t('system:config:VUE_APP_ONLYOFFICE_URL')" style="width: 45%;"
prop="WebConfigInfo.VUE_APP_ONLYOFFICE_URL">
<el-input v-model="form.WebConfigInfo.VUE_APP_ONLYOFFICE_URL" clearable />
</el-form-item>
<el-form-item :label="$t('system:config:VUE_APP_LOGIN_FOR_PERMISSION')" style="width: 45%;"
prop="WebConfigInfo.VUE_APP_LOGIN_FOR_PERMISSION">
<el-select v-model="form.WebConfigInfo.VUE_APP_LOGIN_FOR_PERMISSION" placeholder="">
<el-option v-for="item in $d.YesOrNo" :key="item.id" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item :label="$t('system:config:VUE_APP_LOCK_FOR_PERMISSION_MFA')" style="width: 45%;"
prop="WebConfigInfo.VUE_APP_LOCK_FOR_PERMISSION_MFA">
<el-select v-model="form.WebConfigInfo.VUE_APP_LOCK_FOR_PERMISSION_MFA" placeholder="">
<el-option v-for="item in $d.YesOrNo" :key="item.id" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item :label="$t('system:config:VUE_APP_LOCK_FOR_PERMISSION')" style="width: 45%;"
prop="WebConfigInfo.VUE_APP_LOCK_FOR_PERMISSION">
<el-select v-model="form.WebConfigInfo.VUE_APP_LOCK_FOR_PERMISSION" placeholder="">
<el-option v-for="item in $d.YesOrNo" :key="item.id" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item :label="$t('system:config:VUE_APP_LOCK_FOR_TIME')" style="width: 45%;"
prop="WebConfigInfo.VUE_APP_LOCK_FOR_TIME">
<el-input-number v-model="form.WebConfigInfo.VUE_APP_LOCK_FOR_TIME" clearable type="number" />
</el-form-item>
<el-form-item :label="$t('system:config:VUE_APP_LOGOUT_FOR_PERMISSION')" style="width: 45%;"
prop="WebConfigInfo.VUE_APP_LOGOUT_FOR_PERMISSION">
<el-select v-model="form.WebConfigInfo.VUE_APP_LOGOUT_FOR_PERMISSION" placeholder="">
<el-option v-for="item in $d.YesOrNo" :key="item.id" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item :label="$t('system:config:VUE_APP_LOGOUT_FOR_TIME')" style="width: 45%;"
prop="WebConfigInfo.VUE_APP_LOGOUT_FOR_TIME">
<el-input-number v-model="form.WebConfigInfo.VUE_APP_LOGOUT_FOR_TIME" clearable type="number" />
</el-form-item>
<el-form-item :label="$t('system:config:VUE_APP_PASSWORD_FOR_PERMISSION')" style="width: 45%;"
prop="WebConfigInfo.VUE_APP_PASSWORD_FOR_PERMISSION">
<el-select v-model="form.WebConfigInfo.VUE_APP_PASSWORD_FOR_PERMISSION" placeholder="">
<el-option v-for="item in $d.YesOrNo" :key="item.id" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<!-- <el-form-item :label="$t('system:config:VUE_APP_WORD_FOR_PERMISSION')" style="width: 45%;"
prop="WebConfigInfo.VUE_APP_WORD_FOR_PERMISSION">
<el-select v-model="form.WebConfigInfo.VUE_APP_WORD_FOR_PERMISSION" placeholder="">
<el-option v-for="item in $d.YesOrNo" :key="item.id" :label="item.label" :value="item.value" />
</el-select>
</el-form-item> -->
<el-form-item :label="$t('system:config:VUE_APP_COMPANY_NAME')" style="width: 45%;"
prop="WebConfigInfo.VUE_APP_COMPANY_NAME">
<el-input v-model="form.WebConfigInfo.VUE_APP_COMPANY_NAME" clearable />
</el-form-item>
<h3>{{ $t("system:config:BasicSystemConfig") }}</h3>
<el-form-item :label="$t('system:config:QcRiskControl')" style="width: 45%;">
<el-select v-model="form.BasicSystemConfig.QCRiskControl" placeholder="">
@ -84,7 +137,7 @@
<el-input v-model="form.SystemEmailSendConfig.Port" clearable type="number" />
</el-form-item>
<el-form-item :label="$t('system:config:Imap')" style="width: 45%;" prop="SystemEmailSendConfig.Imap">
<el-input v-model="form.SystemEmailSendConfig.Imap" clearable />
<el-input v-model="form.SystemEmailSendConfig.Imap" clearable />http://localhost:8080/trials/trials-list
</el-form-item>
<el-form-item :label="$t('system:config:ImapPort')" style="width: 45%;" prop="SystemEmailSendConfig.ImapPort">
<el-input v-model="form.SystemEmailSendConfig.ImapPort" clearable type="number" />
@ -157,7 +210,7 @@
</div>
</template>
<script>
import { getSystemBasicConfigInfo, getEmailConfigInfo, updateSystemBasicConfig, updateSystemEmailConfig } from '@/api/admin'
import { getSystemBasicConfigInfo, getEmailConfigInfo, updateSystemBasicConfig, updateSystemEmailConfig, getWebConfigInfo, updateWebConfigInfo } from '@/api/admin'
export default {
name: "systemConfig",
data() {
@ -255,8 +308,53 @@ export default {
'SystemEmailSendConfig.EmailRegexStr': [
{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' }
],
'WebConfigInfo.VUE_APP_ONLYOFFICE_URL': [
{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' }
],
'WebConfigInfo.VUE_APP_LOGIN_FOR_PERMISSION': [
{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' }
],
'WebConfigInfo.VUE_APP_LOCK_FOR_PERMISSION_MFA': [
{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' }
],
'WebConfigInfo.VUE_APP_LOCK_FOR_PERMISSION': [
{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' }
],
'WebConfigInfo.VUE_APP_LOCK_FOR_TIME': [
{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' },
{ type: 'number', message: this.$t('systemConfig:ruleMessage:mustNumber'), trigger: 'blur' },
],
'WebConfigInfo.VUE_APP_LOGOUT_FOR_PERMISSION': [
{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' }
],
'WebConfigInfo.VUE_APP_LOGOUT_FOR_TIME': [
{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' },
{ type: 'number', message: this.$t('systemConfig:ruleMessage:mustNumber'), trigger: 'blur' },
],
'WebConfigInfo.VUE_APP_PASSWORD_FOR_PERMISSION': [
{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' }
],
// 'WebConfigInfo.VUE_APP_WORD_FOR_PERMISSION': [
// { required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' }
// ],
'WebConfigInfo.VUE_APP_COMPANY_NAME': [
{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' }
],
},
form: {
WebConfigInfo: {
VUE_APP_ONLYOFFICE_URL: '', // onlyoffice
VUE_APP_LOGIN_FOR_PERMISSION: false, //
VUE_APP_LOCK_FOR_PERMISSION_MFA: false,// MFA
VUE_APP_LOCK_FOR_PERMISSION: false, //
VUE_APP_LOCK_FOR_TIME: 900, //
VUE_APP_LOGOUT_FOR_PERMISSION: false,//
VUE_APP_LOGOUT_FOR_TIME: 1800, //
VUE_APP_PASSWORD_FOR_PERMISSION: false, //
// VUE_APP_WORD_FOR_PERMISSION: false, // ,
VUE_APP_COMPANY_NAME: '', //
},
"BasicSystemConfig": {
//
"QCRiskControl": true,
@ -340,14 +438,14 @@ export default {
methods: {
handleSave() {
this.loading = true
Promise.all([this.updateSystemBasicConfig(), this.updateSystemEmailConfig()]).then(res => {
Promise.all([this.updateSystemBasicConfig(), this.updateSystemEmailConfig(), this.updateWebConfigInfo()]).then(res => {
this.loading = false
this.getInfo()
// this.getInfo()
})
},
getInfo() {
this.loading = true
Promise.all([this.getSystemBasicConfigInfo(), this.getEmailConfigInfo()]).then(res => {
Promise.all([this.getSystemBasicConfigInfo(), this.getEmailConfigInfo(), this.getWebConfigInfo()]).then(res => {
this.loading = false
})
},
@ -383,6 +481,38 @@ export default {
console.log(err)
}
},
async updateWebConfigInfo() {
try {
let validate = await this.$refs.systemConfigForm.validate()
if (!validate) return false
let data = {}
Object.keys(this.form.WebConfigInfo).forEach(key => {
data[key] = this.form.WebConfigInfo[key]
})
let res = await updateWebConfigInfo({
configStr: JSON.stringify(data)
})
if (res.IsSuccess) {
}
} catch (err) {
console.log(err)
}
},
async getWebConfigInfo() {
try {
let res = await getWebConfigInfo()
if (res.IsSuccess) {
let data = res.Result ? JSON.parse(res.Result) : {}
Object.keys(this.form.WebConfigInfo).forEach(key => {
this.form.WebConfigInfo[key] = data[key] ? data[key] : this.form.WebConfigInfo[key]
})
}
} catch (err) {
this.loading = false
console.log(err)
}
},
async getSystemBasicConfigInfo() {
try {
let res = await getSystemBasicConfigInfo()

View File

@ -217,7 +217,7 @@ export default {
moment,
loading: false,
currentUser: zzSessionStorage.getItem('userName'),
COMPANY:process.env.VUE_APP_COMPANY_NAME
COMPANY:window.webConfig.VUE_APP_COMPANY_NAME
}
},
mounted() {

View File

@ -46,7 +46,7 @@ export default {
fileList: [],
loading: false,
currentUser: zzSessionStorage.getItem('userName'),
COMPANY: process.env.VUE_APP_COMPANY_NAME
COMPANY: window.webConfig.VUE_APP_COMPANY_NAME
}
},
mounted() {

View File

@ -46,7 +46,7 @@ export default {
fileList: [],
loading: false,
currentUser: zzSessionStorage.getItem('userName'),
COMPANY: process.env.VUE_APP_COMPANY_NAME
COMPANY: window.webConfig.VUE_APP_COMPANY_NAME
}
},
mounted() {

View File

@ -33,7 +33,7 @@ export default {
data() {
return {
currentUser: zzSessionStorage.getItem('userName'),
COMPANY:process.env.VUE_APP_COMPANY_NAME
COMPANY:window.webConfig.VUE_APP_COMPANY_NAME
}
},
methods: {

View File

@ -46,7 +46,7 @@ export default {
fileList: [],
loading: false,
currentUser: zzSessionStorage.getItem('userName'),
COMPANY: process.env.VUE_APP_COMPANY_NAME
COMPANY: window.webConfig.VUE_APP_COMPANY_NAME
}
},
mounted() {