Former-commit-id: 01293bfa3faf0d061763a20cfb39bd5668c73f93
Former-commit-id: 825c98dfd4121fc6020f7bf9de212ceb4f412dc4
TSXN
wanggang 5 years ago
parent 1233183148
commit 83f4fe8308

@ -82,6 +82,12 @@ namespace Infrastructure.Extensions
else
{
var modelType = metadata.IsNullableValueType ? metadata.ModelType.GenericTypeArguments[0] : metadata.ModelType;
var underlyingType = Nullable.GetUnderlyingType(modelType);
if (underlyingType != null)
{
json.nullable = true;
modelType = underlyingType;
}
if (modelType == typeof(string))
{
json.type = "string";
@ -108,6 +114,10 @@ namespace Infrastructure.Extensions
{
json.type = "boolean";
}
else if (modelType == typeof(Guid))
{
json.type = "guid";
}
else if (modelType == typeof(DateTime))
{
json.type = "string";

@ -21,6 +21,7 @@ namespace IoT.Shared.Areas.Admin.Controlls
{
}
[Obsolete("for test"), ApiExplorerSettings(IgnoreApi = true)]
public async Task<IActionResult> Valid(string name)
{
await Task.Delay(1000);

@ -25,6 +25,12 @@ namespace IoT.Shared.Areas.Admin.Controllers
this._permissionCategoryRepo = ajax;
}
public override IActionResult Index(PagedListModel<EditPermissionModel> model)
{
this.ToEditModel(null, model.Query);
return base.Index(model);
}
public override IQueryable<Permission> Include(IQueryable<Permission> query)
{
return query.Include(o => o.Category).ThenInclude(o => o.Parent);
@ -37,7 +43,7 @@ namespace IoT.Shared.Areas.Admin.Controllers
public override void ToEditModel(Permission entity, EditPermissionModel model)
{
this.ViewData.SelectList(o => model.CategoryId, () => this.GetPermissionCategorySelectList(model.CategoryId), model.CategoryId.HasValue);
this.ViewData.SelectList(o => model.CategoryId, () => this.GetPermissionCategorySelectList(model.CategoryId));
}
public override void ToDisplayModel(Permission entity, EditPermissionModel model)

@ -113,12 +113,14 @@ namespace IoTCenter.Api.Controllers
return Ok();
}
[HttpPost]
public IActionResult Stop([FromBody][Required(ErrorMessage = nameof(RequiredAttribute))] string number)
{
this._hub.ServerToClient(Methods.StopNode, "", number);
return Ok();
}
[HttpPost]
private ActionResult Power(string number, string command)
{
var devices = this._deviceRepo.ReadOnlyTable()

@ -29,6 +29,7 @@ namespace IoTCenter.Api.Controllers
this._userRepo = userRepo;
}
[HttpPost]
public IActionResult GetSite()
{
try

@ -1,6 +1,6 @@
<template>
<div>
<select class="form-control" :name="name" v-model="currentValue">
<select class="form-control" :name="currentName" v-model="currentValue">
<option :value="null">请选择</option>
<option v-for="item in list" :value="item.value">{{item.text}}</option>
</select>
@ -8,9 +8,10 @@
</template>
<script>
export default {
props: ['name', 'value', 'data'],
props: ['prefix', 'name', 'value', 'data'],
data: function () {
return {
currentName: this.prefix ? (this.prefix + '.' + this.name) : this.name,
currentValue: this.value
};
},
@ -22,11 +23,7 @@
},
computed: {
list: function () {
var key = this.name;
if (this.prefix) {
key = this.name.substring(this.prefix.length + 1);
}
return this.data[key + 'SelectList'];
return this.data[this.name + 'SelectList'];
}
}
};

@ -1,13 +1,14 @@
<template>
<div>
<input type="text" :name="name" class="form-control" v-model="currentValue" />
<input type="text" :name="currentName" class="form-control" v-model="currentValue" />
</div>
</template>
<script>
export default {
props: ['name', 'value', 'data'],
props: ['prefix', 'name', 'value', 'data'],
data: function () {
return {
currentName: this.prefix ? (this.prefix + '.' + this.name) : this.name,
currentValue: this.value
};
},

@ -12,7 +12,7 @@
<div class="form-group row">
<label class="col-sm-3 col-form-label" :for="key">{{value.title}}:</label>
<div class="col-sm-9">
<component :is="getQueryComponent(value)" :title="value.title" :name="'query.'+key" :value="data.model.query[key]" :data="data.data" :prefix="'query'" mode="query" v-if="data.model.query" />
<component :is="getQueryComponent(value)" :title="value.title" :name="key" :value="data.model.query[key]" :data="data.data" :prefix="'query'" mode="query" v-if="data.model.query" />
</div>
</div>
</div>
@ -67,7 +67,7 @@
</div>
</div>
<div class="card-footer">
<pagination :nav="load" :index="data.model.pageIndex" :size="data.model.pageSize" :total="data.model.totalCount" />
<pagination :index.sync="data.model.pageIndex" :size.sync="data.model.pageSize" :total="data.model.totalCount" />
</div>
</div>
</div>
@ -99,6 +99,14 @@
return '列表' + (this.data.schema ? this.data.schema.title : '');
},
},
watch: {
'data.model.pageIndex': function () {
this.load();
},
'data.model.pageSize': function () {
this.load(1);
}
},
mounted: function () {
this.load(this.data.model.pageIndex, this.data.model.pageSize);
},
@ -142,6 +150,7 @@
&& value.type !== 'object'
&& value.format !== 'imageurl'
&& key !== 'displayOrder'
&& key !== 'id'
&& (value.ui ? value.ui !== 'cron' : true);
},
showForList: function (key, value) {

@ -1,22 +1,22 @@
<template>
<div class="row">
<div class="col-sm-12 col-md-5">
<div class="dataTables_info">共{{total}}条 当前数据{{(index-1)*size+1}}-{{index*size>total?total:index*size}} 当前页{{index}}/{{getPageCount()}}</div>
<div class="dataTables_info">共{{total}}条 当前页{{index}}/{{getPageCount()}}</div>
</div>
<div class="col-sm-12 col-md-7">
<div class="dataTables_paginate paging_simple_numbers">
<ul class="pagination" style="justify-content:flex-end;">
<li :class="'paginate_button page-item previous'+(hasPrev()?'':' disabled')">
<a href="javascript:;" class="page-link" v-on:click="nav(index-1,size)">上一页</a>
<a href="javascript:;" class="page-link" v-on:click="nav(index-1)">上一页</a>
</li>
<li v-for="item in getPageList()" :class="'paginate_button page-item' + (item===index?' active':'')">
<a href="javascript:;" class="page-link" v-on:click="nav(item,size)">{{item}}</a>
<a href="javascript:;" class="page-link" v-on:click="nav(item)">{{item}}</a>
</li>
<li :class="'paginate_button page-item next'+(hasNext()?'':' disabled')">
<a href="javascript:;" class="page-link" v-on:click="nav(index+1,size)">下一页</a>
<a href="javascript:;" class="page-link" v-on:click="nav(index+1)">下一页</a>
</li>
<li class="paginate_button page-item">
<select class="form-control" v-model="size" v-on:change="nav(1,size)">
<select class="form-control" v-model="currentSize">
<option v-for="item in sizeList" v-bind:value="item">
{{ item }}
</option>
@ -44,14 +44,27 @@
},
sizeList: {
type: Array,
default: ()=>[20, 50, 100]
default: () => [20, 50, 100]
}
},
data: function () {
return {
currentIndex: this.index,
currentSize: this.size
};
},
watch: {
currentIndex: function (val) {
this.$emit('update:index', val);
},
nav: {
type: Function,
default: null
currentSize: function (val) {
this.$emit('update:size', val);
}
},
methods: {
nav: function (index) {
this.currentIndex = index;
},
getPageCount: function () {
return Math.ceil(this.total / this.size);
},

Loading…
Cancel
Save