17 changed files with 635 additions and 23 deletions
@ -0,0 +1,65 @@ |
|||
using Coldairarrow.Business.HuiYan; |
|||
using Coldairarrow.Entity.HuiYan; |
|||
using Coldairarrow.Util; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Coldairarrow.Api.Controllers.HuiYan |
|||
{ |
|||
[Route("/HuiYan/[controller]/[action]")]
|
|||
public class teamcattimeController : BaseApiController |
|||
{ |
|||
#region DI
|
|||
|
|||
public teamcattimeController(IteamcattimeBusiness teamcattimeBus) |
|||
{ |
|||
_teamcattimeBus = teamcattimeBus; |
|||
} |
|||
|
|||
IteamcattimeBusiness _teamcattimeBus { get; } |
|||
|
|||
#endregion
|
|||
|
|||
#region 获取
|
|||
|
|||
[HttpPost] |
|||
public async Task<PageResult<teamcattime>> GetDataList(PageInput<ConditionDTO> input) |
|||
{ |
|||
return await _teamcattimeBus.GetDataListAsync(input); |
|||
} |
|||
|
|||
[HttpPost] |
|||
public async Task<teamcattime> GetTheData(IdInputDTO input) |
|||
{ |
|||
return await _teamcattimeBus.GetTheDataAsync(input.id); |
|||
} |
|||
|
|||
#endregion
|
|||
|
|||
#region 提交
|
|||
|
|||
[HttpPost] |
|||
public async Task SaveData(teamcattime data) |
|||
{ |
|||
if (data.Id.IsNullOrEmpty()) |
|||
{ |
|||
InitEntity(data); |
|||
|
|||
await _teamcattimeBus.AddDataAsync(data); |
|||
} |
|||
else |
|||
{ |
|||
await _teamcattimeBus.UpdateDataAsync(data); |
|||
} |
|||
} |
|||
|
|||
[HttpPost] |
|||
public async Task DeleteData(List<string> ids) |
|||
{ |
|||
await _teamcattimeBus.DeleteDataAsync(ids); |
|||
} |
|||
|
|||
#endregion
|
|||
} |
|||
} |
@ -0,0 +1,65 @@ |
|||
using Coldairarrow.Entity.HuiYan; |
|||
using Coldairarrow.Util; |
|||
using EFCore.Sharding; |
|||
using LinqKit; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Linq.Dynamic.Core; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Coldairarrow.Business.HuiYan |
|||
{ |
|||
public class teamcattimeBusiness : BaseBusiness<teamcattime>, IteamcattimeBusiness, ITransientDependency |
|||
{ |
|||
public teamcattimeBusiness(IDbAccessor db) |
|||
: base(db) |
|||
{ |
|||
} |
|||
|
|||
#region 外部接口
|
|||
|
|||
public async Task<PageResult<teamcattime>> GetDataListAsync(PageInput<ConditionDTO> input) |
|||
{ |
|||
var q = GetIQueryable(); |
|||
var where = LinqHelper.True<teamcattime>(); |
|||
var search = input.Search; |
|||
|
|||
//筛选
|
|||
if (!search.Condition.IsNullOrEmpty() && !search.Keyword.IsNullOrEmpty()) |
|||
{ |
|||
var newWhere = DynamicExpressionParser.ParseLambda<teamcattime, bool>( |
|||
ParsingConfig.Default, false, $@"{search.Condition}.Contains(@0)", search.Keyword); |
|||
where = where.And(newWhere); |
|||
} |
|||
|
|||
return await q.Where(where).GetPageResultAsync(input); |
|||
} |
|||
|
|||
public async Task<teamcattime> GetTheDataAsync(string id) |
|||
{ |
|||
return await GetEntityAsync(id); |
|||
} |
|||
|
|||
public async Task AddDataAsync(teamcattime data) |
|||
{ |
|||
await InsertAsync(data); |
|||
} |
|||
|
|||
public async Task UpdateDataAsync(teamcattime data) |
|||
{ |
|||
await UpdateAsync(data); |
|||
} |
|||
|
|||
public async Task DeleteDataAsync(List<string> ids) |
|||
{ |
|||
await DeleteAsync(ids); |
|||
} |
|||
|
|||
#endregion
|
|||
|
|||
#region 私有成员
|
|||
|
|||
#endregion
|
|||
} |
|||
} |
@ -0,0 +1,27 @@ |
|||
using Coldairarrow.Entity.HuiYan; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Coldairarrow.Entity.DTO |
|||
{ |
|||
public class TeamCatTimeDto:cats |
|||
{ |
|||
/// <summary>
|
|||
/// 最后一次打开淘宝时间
|
|||
/// </summary>
|
|||
public DateTime? LastTeamShowTBTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 最后一次打开京东时间
|
|||
/// </summary>
|
|||
public DateTime? LastTeamShowJDTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 最后一次打开拼多多时间
|
|||
/// </summary>
|
|||
public DateTime? LastTeamShowPddTime { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,61 @@ |
|||
using System; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.ComponentModel.DataAnnotations.Schema; |
|||
|
|||
namespace Coldairarrow.Entity.HuiYan |
|||
{ |
|||
/// <summary>
|
|||
/// teamcattime
|
|||
/// </summary>
|
|||
[Table("teamcattime")] |
|||
public class teamcattime |
|||
{ |
|||
|
|||
/// <summary>
|
|||
/// 主键
|
|||
/// </summary>
|
|||
[Key, Column(Order = 1)] |
|||
public String Id { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 创建时间
|
|||
/// </summary>
|
|||
public DateTime CreateTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 创建人Id
|
|||
/// </summary>
|
|||
public String CreatorId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 否已删除
|
|||
/// </summary>
|
|||
public Boolean Deleted { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 团队ID
|
|||
/// </summary>
|
|||
public String TeamId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// catId
|
|||
/// </summary>
|
|||
public String CatId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 最后一次淘宝查看
|
|||
/// </summary>
|
|||
public DateTime? LastShowTBTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 最后一次京东查看
|
|||
/// </summary>
|
|||
public DateTime? LastShowJDTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 最后一次拼多多查看
|
|||
/// </summary>
|
|||
public DateTime? LastShowPddTime { get; set; } |
|||
|
|||
} |
|||
} |
@ -0,0 +1,16 @@ |
|||
using Coldairarrow.Entity.HuiYan; |
|||
using Coldairarrow.Util; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Coldairarrow.Business.HuiYan |
|||
{ |
|||
public interface IteamcattimeBusiness |
|||
{ |
|||
Task<PageResult<teamcattime>> GetDataListAsync(PageInput<ConditionDTO> input); |
|||
Task<teamcattime> GetTheDataAsync(string id); |
|||
Task AddDataAsync(teamcattime data); |
|||
Task UpdateDataAsync(teamcattime data); |
|||
Task DeleteDataAsync(List<string> ids); |
|||
} |
|||
} |
@ -0,0 +1,92 @@ |
|||
<template> |
|||
<a-modal |
|||
:title="title" |
|||
width="40%" |
|||
:visible="visible" |
|||
:confirmLoading="loading" |
|||
@ok="handleSubmit" |
|||
@cancel="()=>{this.visible=false}" |
|||
> |
|||
<a-spin :spinning="loading"> |
|||
<a-form-model ref="form" :model="entity" :rules="rules" v-bind="layout"> |
|||
<a-form-model-item label="团队ID" prop="TeamId"> |
|||
<a-input v-model="entity.TeamId" autocomplete="off" /> |
|||
</a-form-model-item> |
|||
<a-form-model-item label="catId" prop="CatId"> |
|||
<a-input v-model="entity.CatId" autocomplete="off" /> |
|||
</a-form-model-item> |
|||
<a-form-model-item label="最后一次淘宝查看" prop="LastShowTBTime"> |
|||
<a-input v-model="entity.LastShowTBTime" autocomplete="off" /> |
|||
</a-form-model-item> |
|||
<a-form-model-item label="最后一次京东查看" prop="LastShowJDTime"> |
|||
<a-input v-model="entity.LastShowJDTime" autocomplete="off" /> |
|||
</a-form-model-item> |
|||
<a-form-model-item label="最后一次拼多多查看" prop="LastShowPddTime"> |
|||
<a-input v-model="entity.LastShowPddTime" autocomplete="off" /> |
|||
</a-form-model-item> |
|||
</a-form-model> |
|||
</a-spin> |
|||
</a-modal> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
props: { |
|||
parentObj: Object |
|||
}, |
|||
data() { |
|||
return { |
|||
layout: { |
|||
labelCol: { span: 5 }, |
|||
wrapperCol: { span: 18 } |
|||
}, |
|||
visible: false, |
|||
loading: false, |
|||
entity: {}, |
|||
rules: {}, |
|||
title: '' |
|||
} |
|||
}, |
|||
methods: { |
|||
init() { |
|||
this.visible = true |
|||
this.entity = {} |
|||
this.$nextTick(() => { |
|||
this.$refs['form'].clearValidate() |
|||
}) |
|||
}, |
|||
openForm(id, title) { |
|||
this.init() |
|||
|
|||
if (id) { |
|||
this.loading = true |
|||
this.$http.post('/HuiYan/teamcattime/GetTheData', { id: id }).then(resJson => { |
|||
this.loading = false |
|||
|
|||
this.entity = resJson.Data |
|||
}) |
|||
} |
|||
}, |
|||
handleSubmit() { |
|||
this.$refs['form'].validate(valid => { |
|||
if (!valid) { |
|||
return |
|||
} |
|||
this.loading = true |
|||
this.$http.post('/HuiYan/teamcattime/SaveData', this.entity).then(resJson => { |
|||
this.loading = false |
|||
|
|||
if (resJson.Success) { |
|||
this.$message.success('操作成功!') |
|||
this.visible = false |
|||
|
|||
this.parentObj.getDataList() |
|||
} else { |
|||
this.$message.error(resJson.Msg) |
|||
} |
|||
}) |
|||
}) |
|||
} |
|||
} |
|||
} |
|||
</script> |
@ -0,0 +1,162 @@ |
|||
<template> |
|||
<a-card :bordered="false"> |
|||
<div class="table-operator"> |
|||
<a-button type="primary" icon="plus" @click="hanldleAdd()">新建</a-button> |
|||
<a-button |
|||
type="primary" |
|||
icon="minus" |
|||
@click="handleDelete(selectedRowKeys)" |
|||
:disabled="!hasSelected()" |
|||
:loading="loading" |
|||
>删除</a-button> |
|||
<a-button type="primary" icon="redo" @click="getDataList()">刷新</a-button> |
|||
</div> |
|||
|
|||
<div class="table-page-search-wrapper"> |
|||
<a-form layout="inline"> |
|||
<a-row :gutter="10"> |
|||
<a-col :md="4" :sm="24"> |
|||
<a-form-item label="查询类别"> |
|||
<a-select allowClear v-model="queryParam.condition"> |
|||
<a-select-option key="TeamId">团队ID</a-select-option> |
|||
<a-select-option key="CatId">catId</a-select-option> |
|||
</a-select> |
|||
</a-form-item> |
|||
</a-col> |
|||
<a-col :md="4" :sm="24"> |
|||
<a-form-item> |
|||
<a-input v-model="queryParam.keyword" placeholder="关键字" /> |
|||
</a-form-item> |
|||
</a-col> |
|||
<a-col :md="6" :sm="24"> |
|||
<a-button type="primary" @click="() => {this.pagination.current = 1; this.getDataList()}">查询</a-button> |
|||
<a-button style="margin-left: 8px" @click="() => (queryParam = {})">重置</a-button> |
|||
</a-col> |
|||
</a-row> |
|||
</a-form> |
|||
</div> |
|||
|
|||
<a-table |
|||
ref="table" |
|||
:columns="columns" |
|||
:rowKey="row => row.Id" |
|||
:dataSource="data" |
|||
:pagination="pagination" |
|||
:loading="loading" |
|||
@change="handleTableChange" |
|||
:rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" |
|||
:bordered="true" |
|||
size="small" |
|||
> |
|||
<span slot="action" slot-scope="text, record"> |
|||
<template> |
|||
<a @click="handleEdit(record.Id)">编辑</a> |
|||
<a-divider type="vertical" /> |
|||
<a @click="handleDelete([record.Id])">删除</a> |
|||
</template> |
|||
</span> |
|||
</a-table> |
|||
|
|||
<edit-form ref="editForm" :parentObj="this"></edit-form> |
|||
</a-card> |
|||
</template> |
|||
|
|||
<script> |
|||
import EditForm from './EditForm' |
|||
|
|||
const columns = [ |
|||
{ title: '团队ID', dataIndex: 'TeamId', width: '10%' }, |
|||
{ title: 'catId', dataIndex: 'CatId', width: '10%' }, |
|||
{ title: '最后一次淘宝查看', dataIndex: 'LastShowTBTime', width: '10%' }, |
|||
{ title: '最后一次京东查看', dataIndex: 'LastShowJDTime', width: '10%' }, |
|||
{ title: '最后一次拼多多查看', dataIndex: 'LastShowPddTime', width: '10%' }, |
|||
{ title: '操作', dataIndex: 'action', scopedSlots: { customRender: 'action' } } |
|||
] |
|||
|
|||
export default { |
|||
components: { |
|||
EditForm |
|||
}, |
|||
mounted() { |
|||
this.getDataList() |
|||
}, |
|||
data() { |
|||
return { |
|||
data: [], |
|||
pagination: { |
|||
current: 1, |
|||
pageSize: 10, |
|||
showTotal: (total, range) => `总数:${total} 当前:${range[0]}-${range[1]}` |
|||
}, |
|||
filters: {}, |
|||
sorter: { field: 'Id', order: 'asc' }, |
|||
loading: false, |
|||
columns, |
|||
queryParam: {}, |
|||
selectedRowKeys: [] |
|||
} |
|||
}, |
|||
methods: { |
|||
handleTableChange(pagination, filters, sorter) { |
|||
this.pagination = { ...pagination } |
|||
this.filters = { ...filters } |
|||
this.sorter = { ...sorter } |
|||
this.getDataList() |
|||
}, |
|||
getDataList() { |
|||
this.selectedRowKeys = [] |
|||
|
|||
this.loading = true |
|||
this.$http |
|||
.post('/HuiYan/teamcattime/GetDataList', { |
|||
PageIndex: this.pagination.current, |
|||
PageRows: this.pagination.pageSize, |
|||
SortField: this.sorter.field || 'Id', |
|||
SortType: this.sorter.order, |
|||
Search: this.queryParam, |
|||
...this.filters |
|||
}) |
|||
.then(resJson => { |
|||
this.loading = false |
|||
this.data = resJson.Data |
|||
const pagination = { ...this.pagination } |
|||
pagination.total = resJson.Total |
|||
this.pagination = pagination |
|||
}) |
|||
}, |
|||
onSelectChange(selectedRowKeys) { |
|||
this.selectedRowKeys = selectedRowKeys |
|||
}, |
|||
hasSelected() { |
|||
return this.selectedRowKeys.length > 0 |
|||
}, |
|||
hanldleAdd() { |
|||
this.$refs.editForm.openForm() |
|||
}, |
|||
handleEdit(id) { |
|||
this.$refs.editForm.openForm(id) |
|||
}, |
|||
handleDelete(ids) { |
|||
var thisObj = this |
|||
this.$confirm({ |
|||
title: '确认删除吗?', |
|||
onOk() { |
|||
return new Promise((resolve, reject) => { |
|||
thisObj.$http.post('/HuiYan/teamcattime/DeleteData', ids).then(resJson => { |
|||
resolve() |
|||
|
|||
if (resJson.Success) { |
|||
thisObj.$message.success('操作成功!') |
|||
|
|||
thisObj.getDataList() |
|||
} else { |
|||
thisObj.$message.error(resJson.Msg) |
|||
} |
|||
}) |
|||
}) |
|||
} |
|||
}) |
|||
} |
|||
} |
|||
} |
|||
</script> |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue