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.Models;
using Infrastructure.Application;
using Infrastructure.Data;
using Infrastructure.Extensions;
using Infrastructure.Web.Mvc;
@ -26,6 +27,16 @@ namespace IoT.Shared.Areas.Admin.Controlls
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)
{
ViewData.Add(entity.CategoryId, entity.Category.Name);

@ -7,4 +7,9 @@ Vue.component('layout', function (resolve, reject) {
axios.get("/router/shared/layout.html").then(function (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>
<layout v-bind:title="title">
<h1>后台首页</h1>
</layout>
<list parea="admin" pentity="Product" />
</template>
<script>
export default {

@ -17,7 +17,7 @@
<div class="row">
<div class="col-sm-2"></div>
<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>
@ -28,10 +28,10 @@
</template>
<script>
export default {
props: ['parea', 'pentity', 'pid'],
name: 'details',
data: function () {
return {
url: '/IoTCenter/Admin/' + this.$route.query.entity + '/Details?id=' + this.$route.query.id,
entity: this.$route.query.entity,
data: {
schema: {
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 () {
this.load();
},

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

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

Loading…
Cancel
Save