Former-commit-id: 14a7403a9b3be5ee7e99ae743ea7aab5c050c0e3
Former-commit-id: f08abc32ffb6cb5606b4b236db2c1c21b3ee42de
TSXN
wanggang 5 years ago
parent 8e6df39788
commit cd3905ee26

@ -1,5 +1,6 @@
using Application.Domain.Entities; using Application.Domain.Entities;
using Application.Models; using Application.Models;
using Infrastructure.Application;
using Infrastructure.Data; using Infrastructure.Data;
using Infrastructure.Extensions; using Infrastructure.Extensions;
using Infrastructure.Web.Mvc; using Infrastructure.Web.Mvc;
@ -26,6 +27,16 @@ namespace IoT.Shared.Areas.Admin.Controlls
return query.Include(o => o.Category); return query.Include(o => o.Category);
} }
public override IQueryable<Product> Query(PagedListModel<EditProductModel> model, IQueryable<Product> query)
{
return base.Query(model, query)
.WhereIf(model.Query.CategoryId.HasValue, o => o.CategoryId == model.Query.CategoryId.Value)
.WhereIf(!string.IsNullOrEmpty(model.Query.Name), o => o.Name.Contains(model.Query.Name))
.WhereIf(!string.IsNullOrEmpty(model.Query.Number), o => o.Name.Contains(model.Query.Number))
.WhereIf(!string.IsNullOrEmpty(model.Query.Path), o => o.Name.Contains(model.Query.Path))
.WhereIf(!string.IsNullOrEmpty(model.Query.ApiJson), o => o.Name.Contains(model.Query.ApiJson));
}
public override void ToDisplayModel(Product entity, EditProductModel model) public override void ToDisplayModel(Product entity, EditProductModel model)
{ {
ViewData.Add(entity.CategoryId, entity.Category.Name); ViewData.Add(entity.CategoryId, entity.Category.Name);

@ -8,3 +8,8 @@ Vue.component('layout', function (resolve, reject) {
resolve(parseModel(response)); resolve(parseModel(response));
}); });
}); });
Vue.component('list', function (resolve, reject) {
axios.get("/router/shared/list.html").then(function (response) {
resolve(parseModel(response));
});
});

@ -1,7 +1,5 @@
<template> <template>
<layout v-bind:title="title"> <list parea="admin" pentity="Product" />
<h1>后台首页</h1>
</layout>
</template> </template>
<script> <script>
export default { export default {

@ -17,7 +17,7 @@
<div class="row"> <div class="row">
<div class="col-sm-2"></div> <div class="col-sm-2"></div>
<div class="col-sm-10"> <div class="col-sm-10">
<router-link :to="{path:'/router/shared/list.html',query:{entity:entity}}" class="btn btn-default" v-if="hasPermission('Read')">返回</router-link> <router-link :to="{path:'/router/shared/list.html',query:{area:area,entity:entity}}" class="btn btn-default" v-if="hasPermission('Read')">返回</router-link>
</div> </div>
</div> </div>
</div> </div>
@ -28,10 +28,10 @@
</template> </template>
<script> <script>
export default { export default {
props: ['parea', 'pentity', 'pid'],
name: 'details',
data: function () { data: function () {
return { return {
url: '/IoTCenter/Admin/' + this.$route.query.entity + '/Details?id=' + this.$route.query.id,
entity: this.$route.query.entity,
data: { data: {
schema: { schema: {
title: '' title: ''
@ -41,6 +41,26 @@
} }
} }
}, },
computed: {
area: function () {
return this.parea || this.$route.query.area || 'default';
},
entity: function () {
return this.pentity || this.$route.query.entity;
},
id: function () {
return this.pid || this.$route.query.id;
},
url: function () {
return '/IoTCenter/Admin/' + this.entity + '/Details?id=' + this.id;
},
name: function () {
return this.data.schema ? this.data.schema.title : '';
},
title: function () {
return this.name + '列表';
},
},
mounted: function () { mounted: function () {
this.load(); this.load();
}, },

@ -50,12 +50,10 @@
</template> </template>
<script> <script>
export default { export default {
name: 'page-edit', props: ['parea', 'pentity', 'pid'],
name: 'edit',
data: function () { data: function () {
return { return {
area: this.$route.query.area || 'default',
mode: this.$route.query.mode,
entity: this.$route.query.entity,
data: { data: {
errors: [], errors: [],
schema: null, schema: null,
@ -65,14 +63,26 @@
} }
}, },
computed: { computed: {
title: function () { area: function () {
return (this.mode === 'Add' ? '新建' : '编辑') + (this.data.schema ? this.data.schema.title : ''); return this.parea || this.$route.query.area || 'default';
},
entity: function () {
return this.pentity || this.$route.query.entity;
},
id: function () {
return this.pid || this.$route.query.id;
},
mode: function () {
return this.pmode || this.$route.query.mode;
}, },
url: function () { url: function () {
return '/IoTCenter/Admin/' + return '/IoTCenter/Admin/' + this.entity + '/' + this.mode + (this.mode === 'Add' ? '' : '?id=' + this.id);
this.$route.query.entity + '/' + },
this.$route.query.mode + name: function () {
(this.mode === 'Edit' ? ('?id=' + this.$route.query.id) : ''); return this.data.schema ? this.data.schema.title : '';
},
title: function () {
return this.name + '列表';
}, },
action: function () { action: function () {
return '/IoTCenter/Admin/' + this.$route.query.entity + '/' + this.$route.query.mode + 'Api'; return '/IoTCenter/Admin/' + this.$route.query.entity + '/' + this.$route.query.mode + 'Api';

@ -9,7 +9,7 @@
<li class="breadcrumb-item"> <li class="breadcrumb-item">
<router-link :to="{path:'/router/shared/list.html',query:{area:area,entity:entity}}" class="btn btn-default">列表</router-link> <router-link :to="{path:'/router/shared/list.html',query:{area:area,entity:entity}}" class="btn btn-default">列表</router-link>
</li> </li>
<li class="breadcrumb-item active">{{title}}</li> <li class="breadcrumb-item active">{{title}}{{this.$route.from}}</li>
</ol> </ol>
</div>--> </div>-->
</div> </div>
@ -88,12 +88,10 @@
</template> </template>
<script> <script>
export default { export default {
name: 'page-list', name: 'list',
props: ['parea', 'pentity'],
data: function () { data: function () {
return { return {
area: this.$route.query.area || 'default',
url: '/IoTCenter/Admin/' + this.$route.query.entity + '/Index',
entity: this.$route.query.entity,
data: { data: {
schema: { schema: {
title: '' title: ''
@ -108,12 +106,21 @@
} }
}, },
computed: { computed: {
area: function () {
return this.parea || this.$route.query.area || 'default';
},
entity: function () {
return this.pentity || this.$route.query.entity;
},
url: function () {
return '/IoTCenter/Admin/' + this.entity + '/Index';
},
name: function () { name: function () {
return this.data.schema ? this.data.schema.title : ''; return this.data.schema ? this.data.schema.title : '';
}, },
title: function () { title: function () {
return this.name + '列表'; return this.name + '列表';
}, }
}, },
watch: { watch: {
'data.model.pageIndex': function () { 'data.model.pageIndex': function () {

Loading…
Cancel
Save