This commit is contained in:
Raod 2021-07-01 16:06:28 +08:00
parent 5962efa0a6
commit 6a73637cf9
3 changed files with 64 additions and 24 deletions

View File

@ -162,8 +162,8 @@
:xl="7">
<el-form-item label="数据源编码"
prop="sourceCode"
:disabled="updataDisabled">
<el-input v-model.trim="dialogForm.sourceCode" />
>
<el-input :disabled="updataDisabled" v-model.trim="dialogForm.sourceCode" />
</el-form-item>
</el-col>
<el-col :xs="24"

View File

@ -176,7 +176,7 @@
:xl="12">
<el-form-item label="报表编码"
prop="reportCode">
<el-input v-model="dialogForm.reportCode" />
<el-input :disabled="reportCodeDisable" v-model="dialogForm.reportCode" />
</el-form-item>
</el-col>
</el-row>
@ -206,6 +206,20 @@
show-word-limit />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="缩略图">
<el-upload
class="avatar-uploader"
:action="requestUrl"
:headers="headers"
:show-file-list="false"
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload">
<img v-if="dialogForm.reportImage" :src="dialogForm.reportImage == null ? require('../../../assets/images/charts.jpg') : dialogForm.reportImage " class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</el-form-item>
</el-col>
</el-form>
<div slot="footer"
class="dialog-footer">
@ -219,6 +233,7 @@
<script>
import { dataDictionary } from '@/api/common'
import { getToken } from "@/utils/auth";
import { reportPageList, addReport, editReport, delReport } from '@/api/report'
import Dictionary from '@/components/Dictionary/index'
var typeData
@ -258,6 +273,7 @@ export default {
// reportType: '',
// reportGroup: '',
reportDesc: '',
reportImage: '',
},
basicDialog: false,
listLoading: true,
@ -267,6 +283,11 @@ export default {
dictionaryTypeOptions: [], //
dictionaryGroupOptions: [], //
rules: {},
reportCodeDisable: false,
requestUrl: process.env.BASE_API + "/file/upload",
headers: {
Authorization: getToken()
},
}
},
@ -277,16 +298,6 @@ export default {
typeData = this
},
created () {
// this.$nextTick(() => {
// dataDictionary('REPORT_GROUP').then((res) => {
// this.dictionaryGroupOptions = res.data
// this.dialogForm.reportGroup = this.dictionaryGroupOptions[0].text
// })
// dataDictionary('REPORT_TYPE').then((res) => {
// this.dictionaryTypeOptions = res.data;
// this.dialogForm.reportType = this.dictionaryTypeOptions[0].text
// })
// })
this.queryByPage()
},
@ -318,38 +329,40 @@ export default {
this.listLoading = false
},
handleAvatarSuccess(res) {
this.dialogForm.reportImage = res.data.urlPath
},
beforeAvatarUpload(file) {
const isJPG = file.type === 'image/jpeg';
const isLt2M = file.size / 1024 / 1024 < 2;
return true;
},
//
showAddReportModel (val) {
this.basicDialog = true
if (val === undefined) {
this.reportCodeDisable = false
this.dialogForm = {
reportName: '',
reportCode: '',
// reportType: '',
reportDesc: '',
reportImage: ''
}
} else {
this.dialogForm = val
this.reportCodeDisable = true
}
},
//
preview (val) {
// if (val.reportType === 'report_excel') {
// var routeUrl = this.$router.resolve({ path: '/report/excelreport/viewer', query: { reportCode: val.reportCode } })
// window.open(routeUrl.href, '_blank')
// } else {
// eslint-disable-next-line no-redeclare
var routeUrl = this.$router.resolve({ path: '/bigscreen/viewer', query: { reportCode: val.reportCode } })
window.open(routeUrl.href, '_blank')
// }
},
//
design (val) {
// if (val.reportType === 'report_excel') {
// var routeUrl = this.$router.resolve({ path: '/report/excelreport/designer', query: { reportCode: val.reportCode, reportId: val.id, accessKey: val.accessKey } })
// window.open(routeUrl.href, '_blank')
// } else {
// eslint-disable-next-line no-redeclare
var routeUrl = this.$router.resolve({ path: '/bigscreen/designer', query: { reportCode: val.reportCode, reportId: val.id, accessKey: val.accessKey } })
window.open(routeUrl.href, '_blank')
// }
@ -392,6 +405,7 @@ export default {
},
//
UserConfirm () {
debugger
this.$refs.form.validate(async (valid, obj) => {
if (valid) {
if (this.dialogForm.id == undefined) {
@ -410,3 +424,29 @@ export default {
},
}
</script>
<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: 30%;
height: 30%;
display: block;
}
</style>

View File

@ -155,7 +155,7 @@
:xl="8">
<el-form-item label="数据集编码"
prop="setCode">
<el-input v-model.trim="formData.setCode"
<el-input :disabled="updataDisabled" v-model.trim="formData.setCode"
size="mini" />
</el-form-item>
</el-col>