|
|
@@ -1,6 +1,7 @@
|
|
|
<script>
|
|
|
import '@/scss/iconfont/iconfont.css'
|
|
|
|
|
|
+import { mapGetters } from 'vuex'
|
|
|
import { getProgram } from '@/api/program'
|
|
|
import {
|
|
|
State,
|
|
|
@@ -19,6 +20,10 @@ export default {
|
|
|
next(false)
|
|
|
},
|
|
|
props: {
|
|
|
+ type: {
|
|
|
+ type: String,
|
|
|
+ default: 'view'
|
|
|
+ },
|
|
|
id: {
|
|
|
type: String,
|
|
|
default: null
|
|
|
@@ -32,6 +37,9 @@ export default {
|
|
|
activeComponent: null
|
|
|
}
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ ...mapGetters(['tenant', 'userId'])
|
|
|
+ },
|
|
|
watch: {
|
|
|
id: {
|
|
|
handler () {
|
|
|
@@ -47,16 +55,20 @@ export default {
|
|
|
getProgram(this.id, { custom: true }).then(
|
|
|
({ data }) => {
|
|
|
try {
|
|
|
- const { id, status, name, resolutionRatio, itemJsonStr } = data
|
|
|
+ const { tenant, createBy, id, status, name, resolutionRatio, itemJsonStr } = data
|
|
|
+ if (tenant !== this.tenant) {
|
|
|
+ this.showMessage('warning', '无权限')
|
|
|
+ return
|
|
|
+ }
|
|
|
const [width, height] = resolutionRatio.split('x')
|
|
|
if (!width || !height) {
|
|
|
this.showMessage('error', '布局分辨率异常,请联系管理员')
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- if (status === State.SUBMITTED || status === State.RESOLVED) {
|
|
|
+ if (this.type !== 'design' || status === State.SUBMITTED || status === State.RESOLVED) {
|
|
|
this.activeComponent = 'Viewer'
|
|
|
- } else if (this.accessSet.has(Access.MANAGE_CALENDAR)) {
|
|
|
+ } else if (this.accessSet.has(Access.MANAGE_CALENDAR) && createBy === this.userId) {
|
|
|
this.activeComponent = 'Designer'
|
|
|
} else {
|
|
|
this.showMessage('warning', '暂无编辑权限,请联系管理员')
|