| | |
| | | * @Author: lzhe lzhe@example.com |
| | | * @Date: 2024-03-26 10:28:33 |
| | | * @LastEditors: lzhe lzhe@example.com |
| | | * @LastEditTime: 2024-03-29 18:27:53 |
| | | * @LastEditTime: 2024-05-06 16:26:56 |
| | | * @FilePath: /smart-web/src/views/master/person/main/index.vue |
| | | * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE |
| | | --> |
| | |
| | | <el-tabs tab-position="left" style="height: 800px" class="demo-tabs"> |
| | | <el-tab-pane label="文件存储"> |
| | | <div class="tabTitle">文件存储</div> |
| | | <el-form :model="ossForm" ref="ossForm" label-width="120px"> |
| | | <el-form :model="ossForm" label-width="120px"> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-form-item label="endpoint" prop="endpoint"> |
| | | <el-form-item label="endpoint"> |
| | | <el-input v-model="ossForm.endpoint" clearable></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label="acceskey" prop="acceskey"> |
| | | <el-input v-model="ossForm.acceskey" clearable></el-input> |
| | | <el-form-item label="acceskey"> |
| | | <el-input v-model="ossForm.accessKey" clearable></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label="secretkey" prop="secretkey"> |
| | | <el-input v-model="ossForm.secretkey" clearable></el-input> |
| | | <el-form-item label="secretkey"> |
| | | <el-input v-model="ossForm.secretKey" clearable></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | |
| | | </el-row> |
| | | </el-form> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="企业LOGO"> |
| | | <div class="tabTitle">企业LOGO</div> |
| | | <span class="logotitle">上传logo</span> |
| | | <div class="logo1"> |
| | | <el-upload |
| | | class="avatar-uploader" |
| | | :headers="authorization" |
| | | action="/api/blade-resource/oss/endpoint/put-file" |
| | | :show-file-list="false" |
| | | :on-success="handleAvatarSuccess1" |
| | | :before-upload="beforeAvatarUpload" |
| | | type="0" |
| | | > |
| | | <img v-if="imageUrl1" :src="imageUrl1" class="avatar" /> |
| | | <el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon> |
| | | </el-upload> |
| | | <span>建议无底色、大小180*40px</span> |
| | | </div> |
| | | <div class="logo2"> |
| | | <el-upload |
| | | class="avatar-uploader" |
| | | :headers="authorization" |
| | | action="/api/blade-resource/oss/endpoint/put-file" |
| | | :show-file-list="false" |
| | | :on-success="handleAvatarSuccess2" |
| | | :before-upload="beforeAvatarUpload" |
| | | type="1" |
| | | > |
| | | <img v-if="imageUrl2" :src="imageUrl2" class="avatar" /> |
| | | <el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon> |
| | | </el-upload> |
| | | <span>建议无底色、大小180*40px</span> |
| | | </div> |
| | | |
| | | </el-tab-pane> |
| | | <el-tab-pane label="应用设置"> |
| | | <div class="tabTitle">应用设置</div> |
| | | <ul class="show-list"> |
| | | <li class="active"> |
| | | <div class="edit">编辑</div> |
| | | <li :class="{active: active.isA}" @click="changeLi('isA')"> |
| | | <div class="edit" @click="editBtn('isA')">编辑</div> |
| | | <div class="logo"> |
| | | <img src="http://116.63.155.153:83/api/static/images/cps.png"> |
| | | </div> |
| | |
| | | <div class="domain">http://192.168.1.199</div> |
| | | </div> |
| | | </li> |
| | | <li> |
| | | <div class="edit">编辑</div> |
| | | <li :class="{active: active.isB}" @click="changeLi('isB')"> |
| | | <div class="edit" @click="editBtn('isB')">编辑</div> |
| | | <div class="logo"> |
| | | <img src="http://116.63.155.153:83/api/static/images/vision.png"> |
| | | </div> |
| | |
| | | <div class="domain">http://192.168.1.199:31005</div> |
| | | </div> |
| | | </li> |
| | | <li> |
| | | <div class="edit">编辑</div> |
| | | <li :class="{active: active.isC}" @click="changeLi('isC')"> |
| | | <div class="edit" @click="editBtn('isC')">编辑</div> |
| | | <div class="logo"> |
| | | <img src="http://116.63.155.153:83/api/static/images/hmi.png"> |
| | | </div> |
| | |
| | | <el-card class="system-content"> |
| | | <template #header> |
| | | <div class="card-header"> |
| | | <span>应用详情</span> |
| | | <span v-if="!isEdit">应用详情</span> |
| | | <span v-if="isEdit">编辑应用</span> |
| | | <div v-if="isEdit"> |
| | | <el-button @click="cencelBtn" >取 消</el-button> |
| | | <el-button type="primary" :loading="isSaveing" @click="sysSubmit">保 存</el-button> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | <el-form :model="searchData" abel-width="120px"> |
| | | <el-form-item label="系统展示"> |
| | | <el-switch v-model="searchData.value1" /> |
| | | <el-form-item label="系统展示" v-if="!isEdit"> |
| | | <el-switch v-model="searchData.isShow" disabled/> |
| | | </el-form-item> |
| | | <el-form-item label="应用名称"> |
| | | <div>{{searchData.value2}}</div> |
| | | <el-form-item label="系统展示" v-if="isEdit"> |
| | | <el-switch v-model="searchData.isShow"/> |
| | | </el-form-item> |
| | | <el-form-item label="应用名称" v-if="!isEdit"> |
| | | <div>{{searchData.name}}</div> |
| | | </el-form-item> |
| | | <el-form-item label="应用名称" v-if="isEdit"> |
| | | <el-input v-model="searchData.name" placeholder="应用名称" clearable></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="应用标识"> |
| | | <div>{{searchData.value2}}</div> |
| | | <div>{{searchData.code}}</div> |
| | | </el-form-item> |
| | | <el-form-item label="网页地址"> |
| | | <div>{{searchData.value2}}</div> |
| | | <el-form-item label="网页地址" v-if="!isEdit"> |
| | | <div>{{searchData.domain}}</div> |
| | | </el-form-item> |
| | | <el-form-item label="网页地址" v-if="isEdit"> |
| | | <el-input v-model="searchData.domain" placeholder="网页地址" clearable></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="上传图标"> |
| | | <div> |
| | | <img src="http://116.63.155.153:83/api/static/images/hmi.png" style="width:66px;height:66px;"> |
| | | <img :src="searchData.logo" style="width:66px;height:66px;"> |
| | | </div> |
| | | </el-form-item> |
| | | </el-form> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import * as ElementPlusIconsVue from '@element-plus/icons-vue' |
| | | let icons = [] |
| | | for (const [key, component] of Object.entries(ElementPlusIconsVue)) { |
| | | icons.push(key) |
| | | } |
| | | export default { |
| | | name: "oss-main", |
| | | data(){ |
| | | return { |
| | | uploadData: {}, |
| | | logoType: "0", |
| | | authorization: {Authorization: "Basic c2FiZXI6c2FiZXJfc2VjcmV0"}, |
| | | imageUrl1: "", |
| | | imageUrl2: "", |
| | | isSaveing: false, |
| | | isEdit: false, |
| | | active: { |
| | | isA: true, |
| | | isB: false, |
| | | isC: false |
| | | }, |
| | | searchData: { |
| | | value1: false, |
| | | value2: "HMI" |
| | | isShow: true, |
| | | name: "", |
| | | code: "", |
| | | domain: "", |
| | | logo: "", |
| | | backgroundUrl: "" |
| | | }, |
| | | ossForm: { |
| | | endpoint: "", |
| | | acceskey: "", |
| | | secretkey: "" |
| | | } |
| | | accessKey: "", |
| | | secretKey: "" |
| | | }, |
| | | temData: [] |
| | | } |
| | | }, |
| | | components: {}, |
| | | components: {...ElementPlusIconsVue}, |
| | | created(){ |
| | | |
| | | }, |
| | | mounted(){ |
| | | |
| | | this.getOssUpdata(); //文件存储 |
| | | this.setting(); //应用设置 |
| | | this.getFile(); //企业logo |
| | | }, |
| | | methods: { |
| | | ossUpdata(){ |
| | | |
| | | } |
| | | getFile() { |
| | | this.$HTTP.get("/api/blade-cps/enterprise/get").then(res=> { |
| | | if(res.code == 200) { |
| | | this.uploadData = res.data; |
| | | this.imageUrl1 = res.data.list[0].link; |
| | | this.imageUrl2 = res.data.list[1].link; |
| | | } |
| | | }) |
| | | }, |
| | | handleAvatarSuccess1(resp, file) { |
| | | this.getFile(); |
| | | this.logoType = "0"; |
| | | if(this.imageUrl1) { |
| | | resp.uploadMethod = "edit"; |
| | | }else { |
| | | resp.uploadMethod = "add"; |
| | | } |
| | | this.handleAvatarSuccess(resp); |
| | | }, |
| | | handleAvatarSuccess2(resp, file) { |
| | | this.getFile(); |
| | | this.logoType = "1"; |
| | | if(this.imageUrl2) { |
| | | resp.uploadMethod = "edit"; |
| | | }else { |
| | | resp.uploadMethod = "add"; |
| | | } |
| | | this.handleAvatarSuccess(resp); |
| | | }, |
| | | handleAvatarSuccess(resp) { |
| | | var that = this; |
| | | this.$HTTP.get("/api/blade-cps/enterprise/get").then(res=> { |
| | | if(res.code == 200) { |
| | | // 先赋值 |
| | | that.uploadData = res.data; |
| | | that.imageUrl1 = res.data.list[0].link; |
| | | that.imageUrl2 = res.data.list[1].link; |
| | | //添加接口 |
| | | var url = "/api/blade-cps/enterprise/add"; |
| | | if(that.logoType == "0") { |
| | | Object.assign({},res.data.list[0]); |
| | | obj.type = "0"; |
| | | } |
| | | if(that.logoType == "1") { |
| | | obj.type = "1"; |
| | | } |
| | | if(resp.uploadMethod == "edit") { |
| | | url = "/api/blade-cps/enterprise/edit"; |
| | | } |
| | | that.$HTTP.post(url,resp.data).then(resJ=> { |
| | | if(resJ.code == 200) { |
| | | that.$message.success("操作成功"); |
| | | }else { |
| | | that.$alert(resJ.message, "提示", {type: 'error'}); |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | beforeAvatarUpload(file) { |
| | | var isJPG = file.type === 'image/jpeg'; |
| | | if (!isJPG) { |
| | | this.$message.error('格式错误,请重新上传!'); |
| | | } |
| | | return isJPG; |
| | | }, |
| | | cencelBtn() { |
| | | this.isEdit=false; |
| | | this.isSaveing = false; |
| | | }, |
| | | sysSubmit() { |
| | | this.isSaveing = true; |
| | | var obj = {...this.searchData}; |
| | | if(obj.isShow == true) { |
| | | obj.isShow = "1"; |
| | | }else { |
| | | obj.isShow = "0"; |
| | | } |
| | | this.$HTTP.put("/api/blade-system/application/update",obj).then(res=> { |
| | | if(res.code == 200) { |
| | | this.$message({ |
| | | message: "操作成功", |
| | | type: "success" |
| | | }) |
| | | this.cencelBtn(); |
| | | } |
| | | }) |
| | | }, |
| | | editBtn(name) { |
| | | this.isEdit = true; |
| | | }, |
| | | setting() { |
| | | this.$HTTP.get("/api/blade-system/application/list").then(res=> { |
| | | if(res.code == 200) { |
| | | res.data.forEach(item=> { |
| | | if(item.isShow == "1") { |
| | | item.isShow = true; |
| | | }else { |
| | | item.isShow = false; |
| | | } |
| | | }) |
| | | this.temData = res.data; |
| | | this.searchData = this.temData[0]; |
| | | } |
| | | }) |
| | | }, |
| | | changeLi(name) { |
| | | for(var key in this.active) { |
| | | if(key === name) { |
| | | this.active[name] = true; |
| | | }else { |
| | | this.active[key] = false; |
| | | } |
| | | switch(name) { |
| | | case "isA": |
| | | this.searchData = this.temData[0]; |
| | | break; |
| | | case "isB": |
| | | this.searchData = this.temData[1]; |
| | | break; |
| | | case "isC": |
| | | this.searchData = this.temData[2]; |
| | | break; |
| | | } |
| | | } |
| | | }, |
| | | ossUpdata() { |
| | | this.$HTTP.post("/api/blade-resource/oss/update",this.ossForm).then(res=> { |
| | | if(res.code == 200) { |
| | | this.$message({ |
| | | message: "更新成功", |
| | | type: "success" |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | getOssUpdata(){ |
| | | this.$HTTP.get("/api/blade-resource/oss/detail").then(res=> { |
| | | if(res.code == 200) { |
| | | this.ossForm = res.data; |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | |
| | | } |
| | | .system-content .card-header{ |
| | | border-bottom: 1px solid #ebeef5; |
| | | padding: 6px 18px!important; |
| | | padding: 12px 18px!important; |
| | | position: relative; |
| | | } |
| | | .system-content .card-header span{ |
| | | font-size:13px; |
| | | font-weight: 400px; |
| | | } |
| | | .system-content .card-header > div { |
| | | position: absolute; |
| | | top: 6px; |
| | | right: 22px; |
| | | } |
| | | .logotitle { |
| | | font-weight: 400; |
| | | font-size: 16px; |
| | | width: 140px; |
| | | text-align: center; |
| | | display: inline-block; |
| | | vertical-align: top; |
| | | } |
| | | .logo1,.logo2 { |
| | | display: inline-block; |
| | | margin-right: 20px; |
| | | } |
| | | .avatar-uploader /deep/ .el-upload { |
| | | border: 1px dashed #d9d9d9; |
| | | border-radius: 6px; |
| | | cursor: pointer; |
| | | position: relative; |
| | | overflow: hidden; |
| | | } |
| | | .avatar-uploader /deep/ .el-upload:hover { |
| | | border-color: #409EFF; |
| | | } |
| | | .avatar-uploader-icon { |
| | | font-size: 28px; |
| | | color: #8c939d; |
| | | text-align: center; |
| | | } |
| | | .logo1 /deep/ .avatar-uploader-icon { |
| | | width: 178px; |
| | | height: 178px; |
| | | line-height: 178px; |
| | | } |
| | | .logo2 /deep/ .avatar-uploader-icon { |
| | | width: 92px; |
| | | height: 92px; |
| | | line-height: 92px; |
| | | } |
| | | .logo1 .avatar { |
| | | width: 178px; |
| | | height: 178px; |
| | | display: block; |
| | | } |
| | | .logo2 .avatar { |
| | | width: 92px; |
| | | height: 92px; |
| | | display: block; |
| | | } |
| | | </style> |