@@ -3,17 +3,6 @@ using System.Data; | |||
using Learun.Application.TwoDevelopment.Ask; | |||
using System.Web.Mvc; | |||
using System.Collections.Generic; | |||
using Learun.Application.TwoDevelopment.EducationalAdministration; | |||
using Learun.Application.TwoDevelopment.LR_Desktop; | |||
using System.Threading.Tasks; | |||
using Learun.Application.Organization; | |||
using System.Linq; | |||
using System.Web; | |||
using Learun.Application.Base.AuthorizeModule; | |||
using Learun.Util.Operat; | |||
using System; | |||
using Newtonsoft.Json; | |||
using Learun.Application.OA; | |||
namespace Learun.Application.Web.Areas.Ask.Controllers | |||
{ | |||
@@ -21,21 +10,12 @@ namespace Learun.Application.Web.Areas.Ask.Controllers | |||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2023-09-28 14:30 | |||
/// 描 述:运动对集训安排 | |||
/// 日 期:2023-10-18 00:50 | |||
/// 描 述:队伍管理 | |||
/// </summary> | |||
public class Notice_Train_TeamsController : MvcControllerBase | |||
{ | |||
private Notice_Train_SportsIBLL notice_Train_TeamsIBLL = new Notice_Train_SportsBLL(); | |||
private Sys_InformationPushIBLL sys_InformationPushIBLL = new Sys_InformationPushBLL(); | |||
private MessageRindIBLL messageRindIBLL = new MessageRindBLL(); | |||
private WeChatConfigIBLL weChatConfigIbll = new WeChatConfigBLL(); | |||
private WeChatTempletIBLL weChatTempletIbll = new WeChatTempletBLL(); | |||
private UserIBLL userIbll = new UserBLL(); | |||
private UserRelationIBLL userRelationIBLL = new UserRelationBLL(); | |||
private Notice_Train_TeamsIBLL notice_Train_TeamsIBLL = new Notice_Train_TeamsBLL(); | |||
#region 视图功能 | |||
@@ -91,16 +71,11 @@ namespace Learun.Application.Web.Areas.Ask.Controllers | |||
[AjaxOnly] | |||
public ActionResult GetFormData(string keyValue) | |||
{ | |||
var data = notice_Train_TeamsIBLL.GetNotice_Train_SportsEntity(keyValue); | |||
data.T_Content = WebHelper.HtmlDecode(data.T_Content); | |||
return JsonResult(data); | |||
//var Notice_Train_TeamsData = notice_Train_TeamsIBLL.GetNotice_Train_SportsEntity( keyValue ); | |||
//var NoticeLog_Train_TeamsData = notice_Train_TeamsIBLL.GetNoticeLog_Train_TeamsEntity( Notice_Train_TeamsData.T_id ); | |||
//var jsonData = new { | |||
// Notice_Train_Teams = Notice_Train_TeamsData, | |||
// NoticeLog_Train_Teams = NoticeLog_Train_TeamsData, | |||
//}; | |||
//return Success(jsonData); | |||
var Notice_Train_TeamsData = notice_Train_TeamsIBLL.GetNotice_Train_TeamsEntity( keyValue ); | |||
var jsonData = new { | |||
Notice_Train_Teams = Notice_Train_TeamsData, | |||
}; | |||
return Success(jsonData); | |||
} | |||
#endregion | |||
@@ -127,154 +102,15 @@ namespace Learun.Application.Web.Areas.Ask.Controllers | |||
[HttpPost] | |||
[ValidateAntiForgeryToken] | |||
[AjaxOnly] | |||
public ActionResult SaveForm(string keyValue, string strEntity, string strnoticeLog_Train_TeamsEntity) | |||
public ActionResult SaveForm(string keyValue, string strEntity) | |||
{ | |||
Notice_Train_SportsEntity entity = strEntity.ToObject<Notice_Train_SportsEntity>(); | |||
//NoticeLog_Train_TeamsEntity noticeLog_Train_TeamsEntity = strnoticeLog_Train_TeamsEntity.ToObject<NoticeLog_Train_TeamsEntity>(); | |||
//notice_Train_TeamsIBLL.SaveEntity(keyValue,entity,noticeLog_Train_TeamsEntity); | |||
Notice_Train_TeamsEntity entity = strEntity.ToObject<Notice_Train_TeamsEntity>(); | |||
notice_Train_TeamsIBLL.SaveEntity(keyValue,entity); | |||
if (keyValue != null) | |||
{ | |||
} | |||
return Success("保存成功!"); | |||
} | |||
[HttpPost, ValidateAntiForgeryToken, AjaxOnly, ValidateInput(false)] | |||
public ActionResult SaveFormAndSubmit(string keyValue, Notice_Train_SportsEntity entity) | |||
{ | |||
entity.Type = "4"; | |||
entity.T_Content = WebHelper.HtmlEncode(entity.T_Content); | |||
notice_Train_TeamsIBLL.SaveEntity(keyValue, entity); | |||
//推送通知 | |||
//读取信息推送管理-通知公告推送(01)的配置 | |||
var informationPushEntity = sys_InformationPushIBLL.GetEntityByPushItem("01"); | |||
if (informationPushEntity != null && informationPushEntity.Status == true) | |||
{ | |||
//推送微信 | |||
Task.Run(async () => { await DoWeixinPush(entity); }); | |||
} | |||
return Success("保存成功!"); | |||
} | |||
Task DoWeixinPush(Notice_Train_SportsEntity entity) | |||
{ | |||
//微信推送 | |||
try | |||
{ | |||
var allteacherlist = userIbll.GetAllList().Where(m => | |||
m.F_DeleteMark != 1 && m.F_EnabledMark == 1 && m.F_Description == "教师"); | |||
var userralationlist = userRelationIBLL.GetUserIdList("2"); | |||
var needpostuserlist = new List<UserEntity>(); | |||
if (!string.IsNullOrEmpty(entity.Noticedept)) | |||
{ | |||
if (!entity.Noticedept.Contains(",")) | |||
{ | |||
var departteacherlist = allteacherlist.Where(m => entity.Noticedept == m.F_DepartmentId); | |||
needpostuserlist.AddRange(departteacherlist.ToList()); | |||
} | |||
else | |||
{ | |||
foreach (var senddeptid in entity.Noticedept.Split(',')) | |||
{ | |||
var departteacherlist = allteacherlist.Where(m => senddeptid == m.F_DepartmentId); | |||
needpostuserlist.AddRange(departteacherlist.ToList()); | |||
} | |||
} | |||
} | |||
PushWeixin(needpostuserlist, entity.T_title); | |||
//消息提醒表 | |||
PushMessageRemind(needpostuserlist, entity); | |||
return Task.CompletedTask; | |||
} | |||
catch (Exception e) | |||
{ | |||
return Task.FromException(e); | |||
} | |||
} | |||
public void PushWeixin(List<UserEntity> needpostuserlist, string title) | |||
{ | |||
var WeChatConfigentity = weChatConfigIbll.GetEnableEntity(); | |||
string appid = WeChatConfigentity.APPId; | |||
string secret = WeChatConfigentity.secret; | |||
var wechatemplete = weChatTempletIbll.GetWeChatTemplateEntityByCodeConfigId(WeChatConfigentity.ID, "task"); | |||
string weixintaskurl = wechatemplete.TUrl; | |||
string weixintasktempid = wechatemplete.TempId; | |||
var responsejson = Util.HttpMethods.HttpGet("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appid + "&secret=" + secret); | |||
OperateLogModel operateLogModel = new OperateLogModel(); | |||
operateLogModel.title = title; | |||
operateLogModel.type = OperationType.Other; | |||
operateLogModel.url = "NoticeController"; | |||
operateLogModel.sourceObjectId = "002"; | |||
operateLogModel.sourceContentJson = responsejson; | |||
OperatorHelper.Instance.WriteOperateLog(operateLogModel); | |||
foreach (UserEntity userinfo in needpostuserlist) | |||
{ | |||
if (userinfo != null && !string.IsNullOrEmpty(userinfo.OpenIdForWeixin)) | |||
{ | |||
//执行推送任务 | |||
if (!string.IsNullOrEmpty(appid) && !string.IsNullOrEmpty(secret) && !string.IsNullOrEmpty(weixintaskurl) && !string.IsNullOrEmpty(weixintasktempid)) | |||
{ | |||
if (!string.IsNullOrEmpty(responsejson)) | |||
{ | |||
var weixintokenobj = JsonConvert.DeserializeObject<dynamic>(responsejson); | |||
if (string.IsNullOrEmpty(weixintokenobj.errcode)) | |||
{ | |||
string access_token = weixintokenobj.access_token; | |||
string jsondata = "{\"touser\":\"" + userinfo.OpenIdForWeixin + "\"," + | |||
"\"template_id\":\"" + weixintasktempid + "\"," + | |||
"\"url\":\"" + weixintaskurl + "\"," + | |||
"\"data\":{" + | |||
"\"first\": {\"value\":\"您有新的未读通知公告\",\"color\":\"#173177\"}," + | |||
"\"keyword1\":{\"value\":\"未读通知公告\",\"color\":\"#173177\"}," + | |||
"\"keyword2\": {\"value\":\"" + title + "\",\"color\":\"#173177\"}," + | |||
"\"keyword3\": {\"value\":\"待查看\",\"color\":\"#173177\"}," + | |||
"\"keyword4\": {\"value\":\"您有新的未读通知公告【" + title + "】\",\"color\":\"#173177\"}" + | |||
"}" + | |||
"}"; | |||
string pushresult = Util.HttpMethods.HttpPost("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + access_token, jsondata); | |||
operateLogModel.title = title; | |||
operateLogModel.type = OperationType.Other; | |||
operateLogModel.url = "NoticeController"; | |||
operateLogModel.sourceObjectId = "002"; | |||
operateLogModel.sourceContentJson = pushresult; | |||
OperatorHelper.Instance.WriteOperateLog(operateLogModel); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 消息提醒 | |||
/// </summary> | |||
/// <param name="needpostuserlist"></param> | |||
/// <param name="title"></param> | |||
public void PushMessageRemind(List<UserEntity> needpostuserlist, Notice_Train_SportsEntity model) | |||
{ | |||
foreach (UserEntity userinfo in needpostuserlist) | |||
{ | |||
MessageRemindEntity entity = new MessageRemindEntity(); | |||
entity.ReceiptId = userinfo.F_UserId; | |||
entity.ReceiptName = userinfo.F_RealName; | |||
entity.SenderId = model.Creator; | |||
entity.SenderName = model.Creator; | |||
entity.TheTitle = "通知公告"; | |||
entity.TheContent = model.T_title; | |||
entity.InstanceId = model.T_id; | |||
entity.ConnectionUrl = "/Utility/ListContentIndex?id="; | |||
entity.SendTime = DateTime.Now; | |||
entity.ReadSigns = false; | |||
messageRindIBLL.SaveEntity("", entity); | |||
} | |||
} | |||
#endregion | |||
} | |||
@@ -3,6 +3,10 @@ | |||
Layout = "~/Views/Shared/_Form.cshtml"; | |||
} | |||
<div class="lr-form-wrap" id="form"> | |||
<div class="col-xs-12 lr-form-item" data-table="Notice_Train_Sum"> | |||
<div class="lr-form-item-title">队伍</div> | |||
<div id="Teamid"></div> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="Notice_Train_Sum"> | |||
<div class="lr-form-item-title">教练</div> | |||
<div id="Coachs"></div> | |||
@@ -21,6 +21,8 @@ var bootstrap = function ($, learun) { | |||
var ContentsUE = UE.getEditor('Contents'); | |||
$('#Coachs').lrUserSelect(1); | |||
$('#Peoples').lrUserSelect(1); | |||
//$('#Teamid').lrUserSelect(1); | |||
$('#Teamid').lrDataSourceSelect({ code: 'Trainteam', value: 'name', text: 'name' }); | |||
//$('#Peoples').lrDataItemSelect({ code: '' }); | |||
$('#Contents')[0].ue = ContentsUE; }, | |||
initData: function () { | |||
@@ -56,6 +56,7 @@ | |||
</div> | |||
<div class=" btn-group btn-group-sm"> | |||
<a id="lr_category" class="btn btn-default"><i class="fa fa-tags"></i> <span class="lrlt">项目分类</span></a> | |||
<a id="lr_team" class="btn btn-default"><i class="fa fa-tags"></i> <span class="lrlt">队伍管理</span></a> | |||
</div> | |||
</div> | |||
</div> | |||
@@ -189,6 +189,21 @@ var bootstrap = function ($, learun) { | |||
} | |||
}); | |||
}); | |||
/*分类管理*/ | |||
$('#lr_team').on('click', function () { | |||
learun.layerForm({ | |||
id: 'ClassifyIndex', | |||
title: '队伍管理', | |||
url: top.$.rootUrl + '/Ask/Notice_Train_Teams/Index', | |||
width: 800, | |||
height: 500, | |||
maxmin: true, | |||
btn: null, | |||
end: function () { | |||
location.reload(); | |||
} | |||
}); | |||
}); | |||
}, | |||
initTree: function () { | |||
$('#lr_left_tree').lrtree({ | |||
@@ -1,76 +1,15 @@ | |||
@{ | |||
ViewBag.Title = "运动对集训安排"; | |||
ViewBag.Title = "队伍管理"; | |||
Layout = "~/Views/Shared/_Form.cshtml"; | |||
} | |||
@*<div class="lr-form-wrap" id="form"> | |||
<div class="col-xs-12 lr-form-item" data-table="Notice_Train_Teams"> | |||
<div class="lr-form-item-title">标题<font face="宋体">*</font></div> | |||
<input id="T_title" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="Notice_Train_Teams"> | |||
<div class="lr-form-item-title">类别</div> | |||
<div id="T_type"></div> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="Notice_Train_Teams"> | |||
<div class="lr-form-item-title">发布时间<font face="宋体">*</font></div> | |||
<input id="Createtime" type="text" class="form-control lr-input-wdatepicker" onfocus="WdatePicker({ dateFmt:'yyyy-MM-dd',onpicked: function () { $('#Createtime').trigger('change'); } })" isvalid="yes" checkexpession="NotNull" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="Notice_Train_Teams"> | |||
<div class="lr-form-item-title">信息来源</div> | |||
<input id="Source" type="text" class="form-control" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="Notice_Train_Teams"> | |||
<div class="lr-form-item-title">来源地址</div> | |||
<input id="SourceUrl" type="text" class="form-control" /> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="Notice_Train_Teams"> | |||
<div class="lr-form-item-title">下发部门</div> | |||
<div id="Noticedept"></div> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="Notice_Train_Teams"> | |||
<div class="lr-form-item-title">附件上传</div> | |||
<div id="Files"></div> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="Notice_Train_Teams"> | |||
<div class="lr-form-item-title">内容<font face="宋体">*</font></div> | |||
<textarea id="T_Content" class="form-control" style="height:100px;" isvalid="yes" checkexpession="NotNull"></textarea> | |||
</div> | |||
</div>*@ | |||
<div class="lr-form-wrap" id="form"> | |||
<div class="col-xs-12 lr-form-item"> | |||
<div class="lr-form-item-title">公告标题<font face="宋体">*</font></div> | |||
<input id="T_title" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" placeholder="请输入标题" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item"> | |||
<div class="lr-form-item-title">公告类别<font face="宋体">*</font></div> | |||
<div id="T_typename" isvalid="yes" checkexpession="NotNull"></div> | |||
<input type="hidden" id="T_type" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item"> | |||
<div class="lr-form-item-title">发布时间<font face="宋体">*</font></div> | |||
<input id="Createtime" type="text" class="form-control lr-input-wdatepicker" onfocus="WdatePicker({ dateFmt: 'yyyy/MM/dd HH:mm' })" isvalid="yes" checkexpession="NotNull" value="@Learun.Util.Time.GetToday("yyyy/MM/dd HH:mm")" data-dateFmt="yyyy-MM-dd hh:mm:ss"/> | |||
</div> | |||
<div class="col-xs-6 lr-form-item"> | |||
<div class="lr-form-item-title">信息来源</div> | |||
<input id="Source" type="text" class="form-control" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item"> | |||
<div class="lr-form-item-title">来源地址</div> | |||
<input id="SourceUrl" type="text" class="form-control" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item"> | |||
<div class="lr-form-item-title">接收部门</div> | |||
<div id="Noticedept"></div> | |||
</div> | |||
<div class="col-xs-12 lr-form-item"> | |||
<div class="lr-form-item-title">附件上传</div> | |||
<div id="Files"></div> | |||
<div class="col-xs-12 lr-form-item" data-table="Notice_Train_Teams" > | |||
<div class="lr-form-item-title">队伍名称<font face="宋体">*</font></div> | |||
<input id="Name" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" /> | |||
</div> | |||
<div class="col-xs-12 lr-form-item"> | |||
<div class="lr-form-item-title">公告内容</div> | |||
<div id="editor" style="height:300px;"></div> | |||
@*<script id="editor" type="text/plain" style="height:270px;"> | |||
</script>*@ | |||
<div class="col-xs-12 lr-form-item" data-table="Notice_Train_Teams" > | |||
<div class="lr-form-item-title">下拉框<font face="宋体">*</font></div> | |||
<div id="Teamusers" isvalid="yes" checkexpession="NotNull" ></div> | |||
</div> | |||
</div> | |||
@Html.AppendJsFile("/Areas/Ask/Views/Notice_Train_Teams/Form.js") |
@@ -1,128 +1,52 @@ | |||
/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) | |||
* Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
* 创建人:超级管理员 | |||
* 日 期:2023-09-28 14:30 | |||
* 描 述:运动对集训安排 | |||
* 日 期:2023-10-18 00:50 | |||
* 描 述:队伍管理 | |||
*/ | |||
//var acceptClick; | |||
//var keyValue = request('keyValue'); | |||
//var bootstrap = function ($, learun) { | |||
// "use strict"; | |||
// var page = { | |||
// init: function () { | |||
// $('.lr-form-wrap').lrscroll(); | |||
// page.bind(); | |||
// page.initData(); | |||
// }, | |||
// bind: function () { | |||
// $('#T_type').lrRadioCheckbox({ | |||
// type: 'radio', | |||
// code: '', | |||
// }); | |||
// $('#Noticedept').lrRadioCheckbox({ | |||
// type: 'checkbox', | |||
// dataType: 'dataSource', | |||
// code: 'classdata', | |||
// value: 'id', | |||
// text: 'name', | |||
// }); | |||
// $('#Files').lrUploader(); | |||
// }, | |||
// initData: function () { | |||
// if (!!keyValue) { | |||
// $.lrSetForm(top.$.rootUrl + '/Ask/Notice_Train_Teams/GetFormData?keyValue=' + keyValue, function (data) { | |||
// for (var id in data) { | |||
// if (!!data[id].length && data[id].length > 0) { | |||
// $('#' + id ).jfGridSet('refreshdata', data[id]); | |||
// } | |||
// else { | |||
// $('[data-table="' + id + '"]').lrSetFormData(data[id]); | |||
// } | |||
// } | |||
// }); | |||
// } | |||
// } | |||
// }; | |||
// // 保存数据 | |||
// acceptClick = function (callBack) { | |||
// if (!$('body').lrValidform()) { | |||
// return false; | |||
// } | |||
// var postData = {}; | |||
// postData.strEntity = JSON.stringify($('[data-table="Notice_Train_Teams"]').lrGetFormData()); | |||
// postData.strnoticeLog_Train_TeamsEntity = JSON.stringify($('[data-table="NoticeLog_Train_Teams"]').lrGetFormData()); | |||
// $.lrSaveForm(top.$.rootUrl + '/Ask/Notice_Train_Teams/SaveForm?keyValue=' + keyValue, postData, function (res) { | |||
// // 保存成功后才回调 | |||
// if (!!callBack) { | |||
// callBack(); | |||
// } | |||
// }); | |||
// }; | |||
// page.init(); | |||
//} | |||
var acceptClick; | |||
var keyValue = request('keyValue'); | |||
var bootstrap = function ($, learun) { | |||
"use strict"; | |||
var ue; | |||
var page = { | |||
init: function () { | |||
$('.lr-form-wrap').lrscroll(); | |||
page.bind(); | |||
page.initData(); | |||
}, | |||
bind: function () { | |||
//公告类别 | |||
$('#T_typename').lrDataItemSelect({ | |||
code: 'Notice_Train_Teams', | |||
maxHeight: 230, | |||
select: function (item) { | |||
if (item != null && item != undefined) { | |||
$("#T_type").val(item.text); | |||
} | |||
} | |||
}); | |||
$('#Files').lrUploader(); | |||
$('#Noticedept').lrDepartmentSelect({ type: 'treemultiple' }); | |||
//内容编辑器 | |||
ue = UE.getEditor('editor'); | |||
$('#Teamusers').lrUserSelect(1); | |||
//$('#Teamusers').lrDataSourceSelect({ code: 'teacheruserdata',value: 'f_userid',text: 'f_userid' }); | |||
}, | |||
initData: function () { | |||
if (!!keyValue) { | |||
//$('#form').lrSetFormData(selectedRow); | |||
//$("#F_ReleaseTime").val(learun.formatDate(selectedRow.F_ReleaseTime, 'yyyy/MM/dd hh:mm')); | |||
$.lrSetForm(top.$.rootUrl + '/Ask/Notice_Train_Teams/GetFormData?keyValue=' + keyValue, function (data) { | |||
$('#form').lrSetFormData(data); | |||
setTimeout(function () { | |||
ue.setContent(data.T_Content); | |||
}, 100); | |||
for (var id in data) { | |||
if (!!data[id].length && data[id].length > 0) { | |||
$('#' + id ).jfGridSet('refreshdata', data[id]); | |||
} | |||
else { | |||
$('[data-table="' + id + '"]').lrSetFormData(data[id]); | |||
} | |||
} | |||
}); | |||
} | |||
} | |||
}; | |||
// 保存数据 | |||
acceptClick = function (callBack) { | |||
if (!$('#form').lrValidform()) { | |||
if (!$('body').lrValidform()) { | |||
return false; | |||
} | |||
learun.clientdata.getAsync('dataItem', { | |||
key: $("#T_typename").lrselectGet(), | |||
code: 'Notice_Train_Teams', | |||
callback: function (_data) { | |||
$("#T_type").val(_data.text); | |||
var postData = $('#form').lrGetFormData(keyValue); | |||
postData["T_Content"] = ue.getContent(null, null, true); | |||
//var postData = {}; | |||
//postData.strEntity = $('#form').lrGetFormData(keyValue); | |||
$.lrSaveForm(top.$.rootUrl + '/Ask/Notice_Train_Teams/SaveFormAndSubmit?keyValue=' + keyValue, postData, function (res) { | |||
// 保存成功后才回调 | |||
if (!!callBack) { | |||
callBack(); | |||
} | |||
}); | |||
var postData = { | |||
strEntity: JSON.stringify($('body').lrGetFormData()) | |||
}; | |||
$.lrSaveForm(top.$.rootUrl + '/Ask/Notice_Train_Teams/SaveForm?keyValue=' + keyValue, postData, function (res) { | |||
// 保存成功后才回调 | |||
if (!!callBack) { | |||
callBack(); | |||
} | |||
}); | |||
} | |||
}; | |||
page.init(); | |||
} |
@@ -1,5 +1,5 @@ | |||
@{ | |||
ViewBag.Title = "运动对集训安排"; | |||
ViewBag.Title = "队伍管理"; | |||
Layout = "~/Views/Shared/_Index.cshtml"; | |||
} | |||
<div class="lr-layout " > | |||
@@ -7,20 +7,14 @@ | |||
<div class="lr-layout-wrap lr-layout-wrap-notitle "> | |||
<div class="lr-layout-tool"> | |||
<div class="lr-layout-tool-left"> | |||
<div class="lr-layout-tool-item"> | |||
<input id="txt_Keyword" type="text" class="form-control" placeholder="请输入关键词" /> | |||
</div> | |||
<div class="lr-layout-tool-item"> | |||
<a id="btn_Search" class="btn btn-primary btn-sm"><i class="fa fa-search"></i> <span class="lrlt">查询</span></a> | |||
</div> | |||
</div> | |||
<div class="lr-layout-tool-right"> | |||
<div class=" btn-group btn-group-sm"> | |||
<a id="lr_refresh" class="btn btn-default"><i class="fa fa-refresh"></i></a> | |||
</div> | |||
<div class=" btn-group btn-group-sm" learun-authorize="yes"> | |||
<a id="lr_add" class="btn btn-default"><i class="fa fa-plus"></i> 新增</a> | |||
<a id="lr_edit" class="btn btn-default"><i class="fa fa-pencil-square-o"></i> 编辑</a> | |||
<div class=" btn-group btn-group-sm"> | |||
<a id="lr_add" class="btn btn-default"><i class="fa fa-plus"></i> 新增</a> | |||
<a id="lr_edit" class="btn btn-default"><i class="fa fa-pencil-square-o"></i> 编辑</a> | |||
<a id="lr_delete" class="btn btn-default"><i class="fa fa-trash-o"></i> 删除</a> | |||
</div> | |||
</div> | |||
@@ -1,8 +1,8 @@ | |||
/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) | |||
* Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
* 创建人:超级管理员 | |||
* 日 期:2023-09-28 14:30 | |||
* 描 述:运动对集训安排 | |||
* 日 期:2023-10-18 00:50 | |||
* 描 述:队伍管理 | |||
*/ | |||
var refreshGirdData; | |||
var bootstrap = function ($, learun) { | |||
@@ -13,11 +13,6 @@ var bootstrap = function ($, learun) { | |||
page.bind(); | |||
}, | |||
bind: function () { | |||
// 查询 | |||
$('#btn_Search').on('click', function () { | |||
var keyword = $('#txt_Keyword').val(); | |||
page.search({ keyword: keyword }); | |||
}); | |||
// 刷新 | |||
$('#lr_refresh').on('click', function () { | |||
location.reload(); | |||
@@ -28,8 +23,8 @@ var bootstrap = function ($, learun) { | |||
id: 'form', | |||
title: '新增', | |||
url: top.$.rootUrl + '/Ask/Notice_Train_Teams/Form', | |||
width: 1000, | |||
height: 650, | |||
width: 600, | |||
height: 400, | |||
callBack: function (id) { | |||
return top[id].acceptClick(refreshGirdData); | |||
} | |||
@@ -37,14 +32,14 @@ var bootstrap = function ($, learun) { | |||
}); | |||
// 编辑 | |||
$('#lr_edit').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('T_id'); | |||
var keyValue = $('#gridtable').jfGridValue('BelongId'); | |||
if (learun.checkrow(keyValue)) { | |||
learun.layerForm({ | |||
id: 'form', | |||
title: '编辑', | |||
url: top.$.rootUrl + '/Ask/Notice_Train_Teams/Form?keyValue=' + keyValue, | |||
width: 1000, | |||
height: 650, | |||
width: 600, | |||
height: 400, | |||
callBack: function (id) { | |||
return top[id].acceptClick(refreshGirdData); | |||
} | |||
@@ -53,7 +48,7 @@ var bootstrap = function ($, learun) { | |||
}); | |||
// 删除 | |||
$('#lr_delete').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('T_id'); | |||
var keyValue = $('#gridtable').jfGridValue('BelongId'); | |||
if (learun.checkrow(keyValue)) { | |||
learun.layerConfirm('是否确认删除该项!', function (res) { | |||
if (res) { | |||
@@ -70,40 +65,26 @@ var bootstrap = function ($, learun) { | |||
$('#gridtable').jfGrid({ | |||
url: top.$.rootUrl + '/Ask/Notice_Train_Teams/GetPageList', | |||
headData: [ | |||
{ label: "标题", name: "T_title", width: 100, align: "left"}, | |||
{ label: "类别", name: "T_type", width: 100, align: "left"}, | |||
{ label: "发布时间", name: "Createtime", width: 100, align: "left"}, | |||
{ label: "信息来源", name: "Source", width: 100, align: "left"}, | |||
{ label: "来源地址", name: "SourceUrl", width: 100, align: "left"}, | |||
{ label: "下发部门", name: "Noticedept", width: 100, align: "left", | |||
formatterAsync: function (callback, value, row, op, $cell) { | |||
if (value) { | |||
learun.clientdata.getsAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'classdata', | |||
key: value, | |||
keyId: 'id', | |||
textId: 'name', | |||
callback: function (text) { | |||
callback(text); | |||
} | |||
}); | |||
} | |||
{ label: "队伍名称", name: "Name", width: 100, align: "left"}, | |||
{ label: "下拉框", name: "Teamusers", width: 100, align: "left", | |||
formatterAsync: function (callback, value, row, op,$cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'teacheruserdata', | |||
key: value, | |||
keyId: 'f_userid', | |||
callback: function (_data) { | |||
callback(_data['f_userid']); | |||
} | |||
}); | |||
}}, | |||
//{ label: "附件上传", name: "Files", width: 100, align: "left"}, | |||
//{ label: "内容", name: "T_Content", width: 100, align: "left"}, | |||
], | |||
mainId: 'T_id', | |||
reloadSelected: true, | |||
isMultiselect: true, | |||
isPage: true, | |||
sidx: 'Createtime', | |||
sord: 'desc' | |||
mainId:'BelongId', | |||
isPage: true | |||
}); | |||
page.search(); | |||
}, | |||
search: function (param) { | |||
param = param || {}; | |||
param.Type = "4"; | |||
$('#gridtable').jfGridSet('reload',{ queryJson: JSON.stringify(param) }); | |||
} | |||
}; | |||
@@ -7,8 +7,8 @@ namespace Learun.Application.Mapping | |||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2023-09-28 14:30 | |||
/// 描 述:运动对集训安排 | |||
/// 日 期:2023-10-18 00:50 | |||
/// 描 述:队伍管理 | |||
/// </summary> | |||
public class Notice_Train_TeamsMap : EntityTypeConfiguration<Notice_Train_TeamsEntity> | |||
{ | |||
@@ -18,7 +18,7 @@ namespace Learun.Application.Mapping | |||
//表 | |||
this.ToTable("NOTICE_TRAIN_TEAMS"); | |||
//主键 | |||
this.HasKey(t => t.T_id); | |||
this.HasKey(t => t.Id); | |||
#endregion | |||
#region 配置关系 | |||
@@ -59,6 +59,11 @@ namespace Learun.Application.TwoDevelopment.Ask | |||
/// </summary> | |||
[Column("TYPENAME")] | |||
public string Typename { get; set; } | |||
/// <summary> | |||
/// Typename | |||
/// </summary> | |||
[Column("TEAMID")] | |||
public string Teamid { get; set; } | |||
#endregion | |||
#region 扩展操作 | |||
@@ -9,8 +9,8 @@ namespace Learun.Application.TwoDevelopment.Ask | |||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2023-09-28 14:30 | |||
/// 描 述:运动对集训安排 | |||
/// 日 期:2023-10-18 00:50 | |||
/// 描 述:队伍管理 | |||
/// </summary> | |||
public class Notice_Train_TeamsBLL : Notice_Train_TeamsIBLL | |||
{ | |||
@@ -67,30 +67,6 @@ namespace Learun.Application.TwoDevelopment.Ask | |||
} | |||
} | |||
/// <summary> | |||
/// 获取NoticeLog_Train_Teams表实体数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <returns></returns> | |||
public NoticeLog_Train_TeamsEntity GetNoticeLog_Train_TeamsEntity(string keyValue) | |||
{ | |||
try | |||
{ | |||
return notice_Train_TeamsService.GetNoticeLog_Train_TeamsEntity(keyValue); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
#region 提交数据 | |||
@@ -124,11 +100,11 @@ namespace Learun.Application.TwoDevelopment.Ask | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="entity">实体</param> | |||
/// <returns></returns> | |||
public void SaveEntity(string keyValue, Notice_Train_TeamsEntity entity,NoticeLog_Train_TeamsEntity noticeLog_Train_TeamsEntity) | |||
public void SaveEntity(string keyValue, Notice_Train_TeamsEntity entity) | |||
{ | |||
try | |||
{ | |||
notice_Train_TeamsService.SaveEntity(keyValue, entity,noticeLog_Train_TeamsEntity); | |||
notice_Train_TeamsService.SaveEntity(keyValue, entity); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -8,82 +8,37 @@ namespace Learun.Application.TwoDevelopment.Ask | |||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2023-09-28 14:30 | |||
/// 描 述:运动对集训安排 | |||
/// 日 期:2023-10-18 00:50 | |||
/// 描 述:队伍管理 | |||
/// </summary> | |||
public class Notice_Train_TeamsEntity | |||
{ | |||
#region 实体成员 | |||
/// <summary> | |||
/// T_id | |||
/// Id | |||
/// </summary> | |||
[Column("T_ID")] | |||
public string T_id { get; set; } | |||
[Column("ID")] | |||
public string Id { get; set; } | |||
/// <summary> | |||
/// T_type | |||
/// Name | |||
/// </summary> | |||
[Column("T_TYPE")] | |||
public string T_type { get; set; } | |||
[Column("NAME")] | |||
public string Name { get; set; } | |||
/// <summary> | |||
/// T_type | |||
/// Teamusers | |||
/// </summary> | |||
[Column("T_TYPENAME")] | |||
public string T_typename { get; set; } | |||
/// <summary> | |||
/// T_title | |||
/// </summary> | |||
[Column("T_TITLE")] | |||
public string T_title { get; set; } | |||
/// <summary> | |||
/// Source | |||
/// </summary> | |||
[Column("SOURCE")] | |||
public string Source { get; set; } | |||
/// <summary> | |||
/// SourceUrl | |||
/// </summary> | |||
[Column("SOURCEURL")] | |||
public string SourceUrl { get; set; } | |||
/// <summary> | |||
/// Files | |||
/// </summary> | |||
[Column("FILES")] | |||
public string Files { get; set; } | |||
/// <summary> | |||
/// T_Content | |||
/// </summary> | |||
[Column("T_CONTENT")] | |||
public string T_Content { get; set; } | |||
/// <summary> | |||
/// Noticedept | |||
/// </summary> | |||
[Column("NOTICEDEPT")] | |||
public string Noticedept { get; set; } | |||
/// <summary> | |||
/// Noticepeople | |||
/// </summary> | |||
[Column("NOTICEPEOPLE")] | |||
public string Noticepeople { get; set; } | |||
[Column("TEAMUSERS")] | |||
public string Teamusers { get; set; } | |||
/// <summary> | |||
/// Createtime | |||
/// </summary> | |||
[Column("CREATETIME")] | |||
public DateTime? Createtime { get; set; } | |||
/// <summary> | |||
/// Updatetime | |||
/// </summary> | |||
[Column("UPDATETIME")] | |||
public DateTime? Updatetime { get; set; } | |||
/// <summary> | |||
/// Creator | |||
/// </summary> | |||
[Column("CREATOR")] | |||
public string Creator { get; set; } | |||
/// <summary> | |||
/// Status | |||
/// </summary> | |||
[Column("STATUS")] | |||
public int? Status { get; set; } | |||
#endregion | |||
#region 扩展操作 | |||
@@ -92,16 +47,10 @@ namespace Learun.Application.TwoDevelopment.Ask | |||
/// </summary> | |||
public void Create() | |||
{ | |||
this.T_id = Guid.NewGuid().ToString(); | |||
//this.F_CreateDate = DateTime.Now; | |||
//this.F_ReleaseTime = DateTime.Now; | |||
//this.F_DeleteMark = 0; | |||
//this.F_EnabledMark = 0; | |||
//this.F_PV = 0; | |||
this.Id = Guid.NewGuid().ToString(); | |||
UserInfo userInfo = LoginUserInfo.Get(); | |||
this.Creator = userInfo.userId; | |||
//this.F_CreateUserName = userInfo.realName; | |||
this.Createtime = DateTime.Now; | |||
} | |||
/// <summary> | |||
/// 编辑调用 | |||
@@ -109,7 +58,10 @@ namespace Learun.Application.TwoDevelopment.Ask | |||
/// <param name="keyValue"></param> | |||
public void Modify(string keyValue) | |||
{ | |||
this.T_id = keyValue; | |||
this.Id = keyValue; | |||
this.Createtime = DateTime.Now; | |||
UserInfo userInfo = LoginUserInfo.Get(); | |||
this.Creator = userInfo.userId; | |||
} | |||
#endregion | |||
#region 扩展字段 | |||
@@ -8,8 +8,8 @@ namespace Learun.Application.TwoDevelopment.Ask | |||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2023-09-28 14:30 | |||
/// 描 述:运动对集训安排 | |||
/// 日 期:2023-10-18 00:50 | |||
/// 描 述:队伍管理 | |||
/// </summary> | |||
public interface Notice_Train_TeamsIBLL | |||
{ | |||
@@ -27,12 +27,6 @@ namespace Learun.Application.TwoDevelopment.Ask | |||
/// <param name="keyValue">主键</param> | |||
/// <returns></returns> | |||
Notice_Train_TeamsEntity GetNotice_Train_TeamsEntity(string keyValue); | |||
/// <summary> | |||
/// 获取NoticeLog_Train_Teams表实体数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <returns></returns> | |||
NoticeLog_Train_TeamsEntity GetNoticeLog_Train_TeamsEntity(string keyValue); | |||
#endregion | |||
#region 提交数据 | |||
@@ -47,7 +41,7 @@ namespace Learun.Application.TwoDevelopment.Ask | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="entity">实体</param> | |||
void SaveEntity(string keyValue, Notice_Train_TeamsEntity entity,NoticeLog_Train_TeamsEntity noticeLog_Train_TeamsEntity); | |||
void SaveEntity(string keyValue, Notice_Train_TeamsEntity entity); | |||
#endregion | |||
} | |||
@@ -12,8 +12,8 @@ namespace Learun.Application.TwoDevelopment.Ask | |||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2023-09-28 14:30 | |||
/// 描 述:运动对集训安排 | |||
/// 日 期:2023-10-18 00:50 | |||
/// 描 述:队伍管理 | |||
/// </summary> | |||
public class Notice_Train_TeamsService : RepositoryFactory | |||
{ | |||
@@ -31,8 +31,7 @@ namespace Learun.Application.TwoDevelopment.Ask | |||
{ | |||
var strSql = new StringBuilder(); | |||
strSql.Append("SELECT "); | |||
strSql.Append(@" | |||
t.* | |||
strSql.Append(@" * | |||
"); | |||
strSql.Append(" FROM Notice_Train_Teams t "); | |||
strSql.Append(" WHERE 1=1 "); | |||
@@ -63,31 +62,7 @@ namespace Learun.Application.TwoDevelopment.Ask | |||
{ | |||
try | |||
{ | |||
return this.BaseRepository("CollegeMIS").FindEntity<Notice_Train_TeamsEntity>(keyValue); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取NoticeLog_Train_Teams表实体数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <returns></returns> | |||
public NoticeLog_Train_TeamsEntity GetNoticeLog_Train_TeamsEntity(string keyValue) | |||
{ | |||
try | |||
{ | |||
return this.BaseRepository("CollegeMIS").FindEntity<NoticeLog_Train_TeamsEntity>(t=>t.N_id == keyValue); | |||
return this.BaseRepository("CollegeMIS").FindEntity<Notice_Train_TeamsEntity>(keyValue.ToInt()); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -112,17 +87,12 @@ namespace Learun.Application.TwoDevelopment.Ask | |||
/// <param name="keyValue">主键</param> | |||
public void DeleteEntity(string keyValue) | |||
{ | |||
var db = this.BaseRepository("CollegeMIS").BeginTrans(); | |||
try | |||
{ | |||
var notice_Train_TeamsEntity = GetNotice_Train_TeamsEntity(keyValue); | |||
db.Delete<Notice_Train_TeamsEntity>(t=>t.T_id == keyValue); | |||
//db.Delete<NoticeLog_Train_TeamsEntity>(t=>t.N_id == notice_Train_TeamsEntity.T_id); | |||
db.Commit(); | |||
this.BaseRepository("CollegeMIS").Delete<Notice_Train_TeamsEntity>(t=>t.Id == keyValue); | |||
} | |||
catch (Exception ex) | |||
{ | |||
db.Rollback(); | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
@@ -139,34 +109,23 @@ namespace Learun.Application.TwoDevelopment.Ask | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="entity">实体</param> | |||
public void SaveEntity(string keyValue, Notice_Train_TeamsEntity entity,NoticeLog_Train_TeamsEntity noticeLog_Train_TeamsEntity) | |||
public void SaveEntity(string keyValue, Notice_Train_TeamsEntity entity) | |||
{ | |||
var db = this.BaseRepository("CollegeMIS").BeginTrans(); | |||
try | |||
{ | |||
if (!string.IsNullOrEmpty(keyValue)) | |||
{ | |||
var notice_Train_TeamsEntityTmp = GetNotice_Train_TeamsEntity(keyValue); | |||
entity.Modify(keyValue); | |||
db.Update(entity); | |||
//db.Delete<NoticeLog_Train_TeamsEntity>(t=>t.N_id == notice_Train_TeamsEntityTmp.T_id); | |||
//noticeLog_Train_TeamsEntity.Create(); | |||
//noticeLog_Train_TeamsEntity.N_id = notice_Train_TeamsEntityTmp.T_id; | |||
//db.Insert(noticeLog_Train_TeamsEntity); | |||
this.BaseRepository("CollegeMIS").Update(entity); | |||
} | |||
else | |||
{ | |||
entity.Create(); | |||
db.Insert(entity); | |||
//noticeLog_Train_TeamsEntity.Create(); | |||
//noticeLog_Train_TeamsEntity.N_id = entity.T_id; | |||
//db.Insert(noticeLog_Train_TeamsEntity); | |||
this.BaseRepository("CollegeMIS").Insert(entity); | |||
} | |||
db.Commit(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
db.Rollback(); | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||