|
@@ -5,20 +5,25 @@
|
|
<span>配置信息</span>
|
|
<span>配置信息</span>
|
|
</div>
|
|
</div>
|
|
<div class="text item">
|
|
<div class="text item">
|
|
- <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="120px">
|
|
|
|
|
|
+ <el-form
|
|
|
|
+ ref="ruleForm"
|
|
|
|
+ :model="ruleForm"
|
|
|
|
+ :rules="rules"
|
|
|
|
+ label-width="120px"
|
|
|
|
+ >
|
|
<el-form-item label="系统名称:" prop="name">
|
|
<el-form-item label="系统名称:" prop="name">
|
|
<el-input v-model="ruleForm.name" />
|
|
<el-input v-model="ruleForm.name" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="系统Logo:" prop="logo">
|
|
<el-form-item label="系统Logo:" prop="logo">
|
|
<el-upload
|
|
<el-upload
|
|
class="avatar-uploader"
|
|
class="avatar-uploader"
|
|
- :action="url"
|
|
|
|
- :data="{type:'1'}"
|
|
|
|
|
|
+ :action="ossUploadUrl"
|
|
|
|
+ :data="dataObj"
|
|
:show-file-list="false"
|
|
:show-file-list="false"
|
|
:on-success="handleAvatarSuccess"
|
|
:on-success="handleAvatarSuccess"
|
|
:before-upload="beforeAvatarUpload"
|
|
:before-upload="beforeAvatarUpload"
|
|
>
|
|
>
|
|
- <img v-if="ruleForm.logo" :src="ruleForm.logo" class="avatar">
|
|
|
|
|
|
+ <img v-if="ruleForm.logo" :src="ruleForm.logo" class="avatar" />
|
|
<i v-else class="el-icon-plus avatar-uploader-icon" />
|
|
<i v-else class="el-icon-plus avatar-uploader-icon" />
|
|
</el-upload>
|
|
</el-upload>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -27,7 +32,12 @@
|
|
<el-radio v-model="ruleForm.is_ldap" :label="false">否</el-radio>
|
|
<el-radio v-model="ruleForm.is_ldap" :label="false">否</el-radio>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item style="margin-bottom: 0">
|
|
<el-form-item style="margin-bottom: 0">
|
|
- <el-button v-permisaction="['system:settings:index:config']" type="primary" @click="submitForm('ruleForm', 1)">确定</el-button>
|
|
|
|
|
|
+ <el-button
|
|
|
|
+ v-permisaction="['system:settings:index:config']"
|
|
|
|
+ type="primary"
|
|
|
|
+ @click="submitForm('ruleForm', 1)"
|
|
|
|
+ >确定</el-button
|
|
|
|
+ >
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
</div>
|
|
</div>
|
|
@@ -42,11 +52,7 @@
|
|
type="info"
|
|
type="info"
|
|
style="margin-bottom: 10px"
|
|
style="margin-bottom: 10px"
|
|
/>
|
|
/>
|
|
- <el-table
|
|
|
|
- :data="tableData"
|
|
|
|
- border
|
|
|
|
- style="width: 100%"
|
|
|
|
- >
|
|
|
|
|
|
+ <el-table :data="tableData" border style="width: 100%">
|
|
<el-table-column
|
|
<el-table-column
|
|
prop="local_field_name"
|
|
prop="local_field_name"
|
|
label="字段名称"
|
|
label="字段名称"
|
|
@@ -57,20 +63,41 @@
|
|
label="字段昵称"
|
|
label="字段昵称"
|
|
width="150"
|
|
width="150"
|
|
/>
|
|
/>
|
|
- <el-table-column
|
|
|
|
- prop="ldap_field_name"
|
|
|
|
- label="Ldap字段"
|
|
|
|
- >
|
|
|
|
- <template slot-scope="{row, $index}">
|
|
|
|
- <div style="width: 100%; min-height: 24px;" @click="{{ chengenum($index, true) }}" @dblclick="{{ chengenum($index, false) }}">
|
|
|
|
- <el-input v-if="editable[$index]" v-model="row.ldap_field_name" />
|
|
|
|
|
|
+ <el-table-column prop="ldap_field_name" label="Ldap字段">
|
|
|
|
+ <template slot-scope="{ row, $index }">
|
|
|
|
+ <div
|
|
|
|
+ style="width: 100%; min-height: 24px;"
|
|
|
|
+ @click="
|
|
|
|
+ {
|
|
|
|
+ {
|
|
|
|
+ chengenum($index, true);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ "
|
|
|
|
+ @dblclick="
|
|
|
|
+ {
|
|
|
|
+ {
|
|
|
|
+ chengenum($index, false);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ "
|
|
|
|
+ >
|
|
|
|
+ <el-input
|
|
|
|
+ v-if="editable[$index]"
|
|
|
|
+ v-model="row.ldap_field_name"
|
|
|
|
+ />
|
|
<span v-else>{{ row.ldap_field_name }}</span>
|
|
<span v-else>{{ row.ldap_field_name }}</span>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
<div style="margin-top: 20px">
|
|
<div style="margin-top: 20px">
|
|
- <el-button v-permisaction="['system:settings:index:ldap']" type="primary" @click="submitForm('ruleForm', 2)">确定</el-button>
|
|
|
|
|
|
+ <el-button
|
|
|
|
+ v-permisaction="['system:settings:index:ldap']"
|
|
|
|
+ type="primary"
|
|
|
|
+ @click="submitForm('ruleForm', 2)"
|
|
|
|
+ >确定</el-button
|
|
|
|
+ >
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</el-card>
|
|
</el-card>
|
|
@@ -78,34 +105,40 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import { setSettings, getSettings } from '@/api/system/settings'
|
|
|
|
|
|
+import { setSettings, getSettings } from "@/api/system/settings";
|
|
|
|
+import { policy } from "@/api/user";
|
|
export default {
|
|
export default {
|
|
- components: {
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
|
|
+ components: {},
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
- url: process.env.VUE_APP_BASE_API + '/api/v1/public/uploadFile',
|
|
|
|
|
|
+ // url: process.env.VUE_APP_BASE_API + "/api/v1/public/uploadFile",
|
|
editable: [],
|
|
editable: [],
|
|
ruleForm: {
|
|
ruleForm: {
|
|
- name: '',
|
|
|
|
- logo: '',
|
|
|
|
|
|
+ name: "",
|
|
|
|
+ logo: "",
|
|
is_ldap: false
|
|
is_ldap: false
|
|
},
|
|
},
|
|
rules: {
|
|
rules: {
|
|
name: [
|
|
name: [
|
|
- { required: true, message: '请输入系统名称', trigger: 'blur' },
|
|
|
|
- { min: 3, max: 15, message: '长度在 3 到 15 个字符', trigger: 'blur' }
|
|
|
|
|
|
+ { required: true, message: "请输入系统名称", trigger: "blur" },
|
|
|
|
+ { min: 3, max: 15, message: "长度在 3 到 15 个字符", trigger: "blur" }
|
|
],
|
|
],
|
|
- logo: [
|
|
|
|
- { required: true, message: '请设置Logo', trigger: 'blur' }
|
|
|
|
- ]
|
|
|
|
|
|
+ logo: [{ required: true, message: "请设置Logo", trigger: "blur" }]
|
|
},
|
|
},
|
|
- tableData: []
|
|
|
|
- }
|
|
|
|
|
|
+ tableData: [],
|
|
|
|
+ ossUploadUrl: "https://ks3-cn-beijing.ksyuncs.com/daya",
|
|
|
|
+ dataObj: {
|
|
|
|
+ policy: "",
|
|
|
|
+ signature: "",
|
|
|
|
+ key: "",
|
|
|
|
+ KSSAccessKeyId: "",
|
|
|
|
+ acl: "public-read",
|
|
|
|
+ name: ""
|
|
|
|
+ }
|
|
|
|
+ };
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
- this.getSettingsInfo()
|
|
|
|
|
|
+ this.getSettingsInfo();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
getSettingsInfo() {
|
|
getSettingsInfo() {
|
|
@@ -114,96 +147,130 @@ export default {
|
|
if (v.classify === 1) {
|
|
if (v.classify === 1) {
|
|
if (v.content === undefined || v.content === null) {
|
|
if (v.content === undefined || v.content === null) {
|
|
this.ruleForm = {
|
|
this.ruleForm = {
|
|
- name: '',
|
|
|
|
- logo: '',
|
|
|
|
|
|
+ name: "",
|
|
|
|
+ logo: "",
|
|
is_ldap: false
|
|
is_ldap: false
|
|
- }
|
|
|
|
|
|
+ };
|
|
} else {
|
|
} else {
|
|
- if (v.content.is_ldap === undefined || v.content.is_ldap === null) {
|
|
|
|
- v.content.is_ldap = false
|
|
|
|
|
|
+ if (
|
|
|
|
+ v.content.is_ldap === undefined ||
|
|
|
|
+ v.content.is_ldap === null
|
|
|
|
+ ) {
|
|
|
|
+ v.content.is_ldap = false;
|
|
}
|
|
}
|
|
- this.ruleForm = v.content
|
|
|
|
|
|
+ this.ruleForm = v.content;
|
|
}
|
|
}
|
|
} else if (v.classify === 2) {
|
|
} else if (v.classify === 2) {
|
|
if (v.content === undefined || v.content === null) {
|
|
if (v.content === undefined || v.content === null) {
|
|
- this.tableData = []
|
|
|
|
|
|
+ this.tableData = [];
|
|
} else {
|
|
} else {
|
|
- this.tableData = v.content
|
|
|
|
|
|
+ this.tableData = v.content;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- })
|
|
|
|
|
|
+ });
|
|
},
|
|
},
|
|
// 提交配置信息
|
|
// 提交配置信息
|
|
submitForm(formName, classify) {
|
|
submitForm(formName, classify) {
|
|
- var requestStatus = false
|
|
|
|
|
|
+ var requestStatus = false;
|
|
var jsonValue = {
|
|
var jsonValue = {
|
|
classify: classify
|
|
classify: classify
|
|
- }
|
|
|
|
|
|
+ };
|
|
if (classify === 1) {
|
|
if (classify === 1) {
|
|
- this.$refs[formName].validate((valid) => {
|
|
|
|
|
|
+ this.$refs[formName].validate(valid => {
|
|
if (valid) {
|
|
if (valid) {
|
|
- jsonValue.content = this.ruleForm
|
|
|
|
- requestStatus = true
|
|
|
|
|
|
+ jsonValue.content = this.ruleForm;
|
|
|
|
+ requestStatus = true;
|
|
}
|
|
}
|
|
- })
|
|
|
|
|
|
+ });
|
|
} else if (classify === 2) {
|
|
} else if (classify === 2) {
|
|
- jsonValue.content = this.tableData
|
|
|
|
- requestStatus = true
|
|
|
|
|
|
+ jsonValue.content = this.tableData;
|
|
|
|
+ requestStatus = true;
|
|
}
|
|
}
|
|
if (requestStatus) {
|
|
if (requestStatus) {
|
|
setSettings(jsonValue).then(response => {
|
|
setSettings(jsonValue).then(response => {
|
|
- this.$store.dispatch('settings/getSystemSettings')
|
|
|
|
|
|
+ this.$store.dispatch("settings/getSystemSettings");
|
|
this.$message({
|
|
this.$message({
|
|
- message: '设置成功',
|
|
|
|
- type: 'success'
|
|
|
|
- })
|
|
|
|
- })
|
|
|
|
|
|
+ message: "设置成功",
|
|
|
|
+ type: "success"
|
|
|
|
+ });
|
|
|
|
+ });
|
|
}
|
|
}
|
|
},
|
|
},
|
|
resetForm(formName) {
|
|
resetForm(formName) {
|
|
- this.$refs[formName].resetFields()
|
|
|
|
|
|
+ this.$refs[formName].resetFields();
|
|
},
|
|
},
|
|
handleAvatarSuccess(res, file) {
|
|
handleAvatarSuccess(res, file) {
|
|
- this.ruleForm.logo = res.data
|
|
|
|
|
|
+ let url = this.ossUploadUrl + "/" + this.dataObj.key;
|
|
|
|
+ this.ruleForm.logo = url;
|
|
},
|
|
},
|
|
- beforeAvatarUpload(file) {
|
|
|
|
- const isLt2M = file.size / 1024 / 1024 < 2
|
|
|
|
|
|
+ async beforeAvatarUpload(file) {
|
|
|
|
+ const isLt2M = file.size / 1024 / 1024 < 2;
|
|
if (!isLt2M) {
|
|
if (!isLt2M) {
|
|
- this.$message.error('上传头像图片大小不能超过 2MB!')
|
|
|
|
|
|
+ this.$message.error("上传头像图片大小不能超过 2MB!");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ let filename = file.name.replaceAll(" ", "_");
|
|
|
|
+ let key = new Date().getTime() + filename;
|
|
|
|
+ let obj = {
|
|
|
|
+ filename,
|
|
|
|
+ bucketName: "daya",
|
|
|
|
+ postData: {
|
|
|
|
+ filename,
|
|
|
|
+ acl: "public-read",
|
|
|
|
+ key,
|
|
|
|
+ unknowValueField: []
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ const res = await policy(obj);
|
|
|
|
+ this.dataObj = {
|
|
|
|
+ policy: res.data.policy,
|
|
|
|
+ signature: res.data.signature,
|
|
|
|
+ key,
|
|
|
|
+ KSSAccessKeyId: res.data.kssAccessKeyId,
|
|
|
|
+ acl: "public-read",
|
|
|
|
+ name: filename
|
|
|
|
+ };
|
|
|
|
+ console.log(res, "policy", this.dataObj);
|
|
|
|
+
|
|
|
|
+ return isLt2M;
|
|
|
|
+ } catch {
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
- return isLt2M
|
|
|
|
},
|
|
},
|
|
- chengenum(row, status) { // 我的方法
|
|
|
|
- this.editable[row] = status
|
|
|
|
- this.$set(this.editable, row, status)
|
|
|
|
|
|
+ chengenum(row, status) {
|
|
|
|
+ // 我的方法
|
|
|
|
+ this.editable[row] = status;
|
|
|
|
+ this.$set(this.editable, row, status);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+};
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style>
|
|
<style>
|
|
- .avatar-uploader .el-upload {
|
|
|
|
- border: 1px dashed #d9d9d9;
|
|
|
|
- border-radius: 6px;
|
|
|
|
- cursor: pointer;
|
|
|
|
- position: relative;
|
|
|
|
- overflow: hidden;
|
|
|
|
- }
|
|
|
|
- .avatar-uploader .el-upload:hover {
|
|
|
|
- border-color: #409EFF;
|
|
|
|
- }
|
|
|
|
- .avatar-uploader-icon {
|
|
|
|
- font-size: 28px;
|
|
|
|
- color: #8c939d;
|
|
|
|
- width: 178px;
|
|
|
|
- height: 178px;
|
|
|
|
- line-height: 178px;
|
|
|
|
- text-align: center;
|
|
|
|
- }
|
|
|
|
- .avatar {
|
|
|
|
- width: 178px;
|
|
|
|
- height: 178px;
|
|
|
|
- display: block;
|
|
|
|
- }
|
|
|
|
|
|
+.avatar-uploader .el-upload {
|
|
|
|
+ border: 1px dashed #d9d9d9;
|
|
|
|
+ border-radius: 6px;
|
|
|
|
+ cursor: pointer;
|
|
|
|
+ position: relative;
|
|
|
|
+ overflow: hidden;
|
|
|
|
+}
|
|
|
|
+.avatar-uploader .el-upload:hover {
|
|
|
|
+ border-color: #409eff;
|
|
|
|
+}
|
|
|
|
+.avatar-uploader-icon {
|
|
|
|
+ font-size: 28px;
|
|
|
|
+ color: #8c939d;
|
|
|
|
+ width: 178px;
|
|
|
|
+ height: 178px;
|
|
|
|
+ line-height: 178px;
|
|
|
|
+ text-align: center;
|
|
|
|
+}
|
|
|
|
+.avatar {
|
|
|
|
+ width: 178px;
|
|
|
|
+ height: 178px;
|
|
|
|
+ display: block;
|
|
|
|
+}
|
|
</style>
|
|
</style>
|