|
|
|
@ -1,11 +1,16 @@
|
|
|
|
|
<template>
|
|
|
|
|
<layout v-bind:title="data.schema.title">
|
|
|
|
|
<h1>{{data.schema.title}}<span v-if="mode==='Edit'">编辑页</span><span v-else>新建页</span></h1>
|
|
|
|
|
<layout v-bind:title="title">
|
|
|
|
|
<h1>{{title}}</h1>
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col-12">
|
|
|
|
|
<div class="card">
|
|
|
|
|
<div class="card-body" v-if="hasPermission('Edit')">
|
|
|
|
|
<form ref="form" class="form-horizontal query" v-if="hasPermission('Read')" :action="url" @submit.prevent="onSubmit">
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<div class="form-group row" v-if="!hasPermission()">
|
|
|
|
|
<div class="el-col-sm-offset-2 col-sm-10 ">
|
|
|
|
|
<div style="color:red;">权限不足</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<form v-else-if="data.schema" ref="form" class="form-horizontal query" :action="url" @submit.prevent="onSubmit">
|
|
|
|
|
<input type="hidden" name="id" :value="data.model.id" />
|
|
|
|
|
<div class="form-group row" v-for="(value,key,index) in data.schema.properties" v-if="show(key,value)">
|
|
|
|
|
<label class="col-sm-2 col-form-label" :for="key">{{value.title}}:</label>
|
|
|
|
@ -27,8 +32,8 @@
|
|
|
|
|
<div class="col-sm-2">
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-sm-10">
|
|
|
|
|
<a href="javascript:;" class="btn btn-primary" v-if="hasPermission('Edit')" v-on:click="onSubmit()">确定</a>
|
|
|
|
|
<router-link :to="{path:'/router/shared/list.html',query:{entity:entity}}" class="btn btn-default" v-if="hasPermission('Read')">返回</router-link>
|
|
|
|
|
<a href="javascript:;" class="btn btn-primary" v-on:click="onSubmit()">确定</a>
|
|
|
|
|
<router-link :to="{path:'/router/shared/list.html',query:{entity:entity}}" class="btn btn-default">返回</router-link>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
@ -45,15 +50,15 @@
|
|
|
|
|
mode: this.$route.query.mode,
|
|
|
|
|
entity: this.$route.query.entity,
|
|
|
|
|
data: {
|
|
|
|
|
schema: {
|
|
|
|
|
title: ''
|
|
|
|
|
},
|
|
|
|
|
model: {},
|
|
|
|
|
data: {}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
title: function () {
|
|
|
|
|
return (this.mode === 'Add' ? '新建' : '编辑') + (this.data.schema ? this.data.schema.title : '');
|
|
|
|
|
},
|
|
|
|
|
url: function () {
|
|
|
|
|
return '/IoTCenter/Admin/' +
|
|
|
|
|
this.$route.query.entity + '/' +
|
|
|
|
@ -77,8 +82,8 @@
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
hasPermission: function (cmd) {
|
|
|
|
|
var permission = cmd + '-' + this.entity;
|
|
|
|
|
hasPermission: function () {
|
|
|
|
|
var permission = this.mode + '-' + this.entity;
|
|
|
|
|
return Enumerable.from(store.state.permissions).any(o => o === permission);
|
|
|
|
|
},
|
|
|
|
|
getEditComponent: function (key) {
|
|
|
|
|