@@ -63,6 +63,17 @@ namespace Learun.Application.Web.Areas.CustomFunction.Controllers | |||||
return Success(jsonData); | return Success(jsonData); | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 获取页面显示列表数据 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
[HttpGet] | |||||
[AjaxOnly] | |||||
public ActionResult GetList() | |||||
{ | |||||
var data = sRProjectBasicIBLL.GetList(); | |||||
return Success(data); | |||||
} | |||||
/// <summary> | |||||
/// 获取表单数据 | /// 获取表单数据 | ||||
/// </summary> | /// </summary> | ||||
/// <param name="keyValue">主键</param> | /// <param name="keyValue">主键</param> | ||||
@@ -0,0 +1,117 @@ | |||||
using Learun.Util; | |||||
using System.Data; | |||||
using Learun.Application.TwoDevelopment.CustomFunction; | |||||
using System.Web.Mvc; | |||||
using System.Collections.Generic; | |||||
namespace Learun.Application.Web.Areas.CustomFunction.Controllers | |||||
{ | |||||
/// <summary> | |||||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||||
/// 创 建:超级管理员 | |||||
/// 日 期:2021-09-15 17:10 | |||||
/// 描 述:项目人员管理 | |||||
/// </summary> | |||||
public class SRProjectPeopleController : MvcControllerBase | |||||
{ | |||||
private SRProjectPeopleIBLL sRProjectPeopleIBLL = new SRProjectPeopleBLL(); | |||||
#region 视图功能 | |||||
/// <summary> | |||||
/// 主页面 | |||||
/// <summary> | |||||
/// <returns></returns> | |||||
[HttpGet] | |||||
public ActionResult Index() | |||||
{ | |||||
return View(); | |||||
} | |||||
/// <summary> | |||||
/// 表单页 | |||||
/// <summary> | |||||
/// <returns></returns> | |||||
[HttpGet] | |||||
public ActionResult Form() | |||||
{ | |||||
return View(); | |||||
} | |||||
#endregion | |||||
#region 获取数据 | |||||
/// <summary> | |||||
/// 获取页面显示列表数据 | |||||
/// </summary> | |||||
/// <param name="pagination">分页参数</param> | |||||
/// <param name="queryJson">查询参数</param> | |||||
/// <returns></returns> | |||||
[HttpGet] | |||||
[AjaxOnly] | |||||
public ActionResult GetPageList(string pagination, string queryJson) | |||||
{ | |||||
Pagination paginationobj = pagination.ToObject<Pagination>(); | |||||
var data = sRProjectPeopleIBLL.GetPageList(paginationobj, queryJson); | |||||
var jsonData = new | |||||
{ | |||||
rows = data, | |||||
total = paginationobj.total, | |||||
page = paginationobj.page, | |||||
records = paginationobj.records | |||||
}; | |||||
return Success(jsonData); | |||||
} | |||||
/// <summary> | |||||
/// 获取表单数据 | |||||
/// </summary> | |||||
/// <param name="keyValue">主键</param> | |||||
/// <returns></returns> | |||||
[HttpGet] | |||||
[AjaxOnly] | |||||
public ActionResult GetFormData(string keyValue) | |||||
{ | |||||
var SRProjectPeopleData = sRProjectPeopleIBLL.GetSRProjectPeopleEntity( keyValue ); | |||||
var jsonData = new { | |||||
SRProjectPeople = SRProjectPeopleData, | |||||
}; | |||||
return Success(jsonData); | |||||
} | |||||
#endregion | |||||
#region 提交数据 | |||||
/// <summary> | |||||
/// 删除实体数据 | |||||
/// </summary> | |||||
/// <param name="keyValue">主键</param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
[AjaxOnly] | |||||
public ActionResult DeleteForm(string keyValue) | |||||
{ | |||||
sRProjectPeopleIBLL.DeleteEntity(keyValue); | |||||
return Success("删除成功!"); | |||||
} | |||||
/// <summary> | |||||
/// 保存实体数据(新增、修改) | |||||
/// </summary> | |||||
/// <param name="keyValue">主键</param> | |||||
/// <param name="strEntity">实体</param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
[ValidateAntiForgeryToken] | |||||
[AjaxOnly] | |||||
public ActionResult SaveForm(string keyValue, string strEntity) | |||||
{ | |||||
SRProjectPeopleEntity entity = strEntity.ToObject<SRProjectPeopleEntity>(); | |||||
sRProjectPeopleIBLL.SaveEntity(keyValue,entity); | |||||
if (string.IsNullOrEmpty(keyValue)) | |||||
{ | |||||
} | |||||
return Success("保存成功!"); | |||||
} | |||||
#endregion | |||||
} | |||||
} |
@@ -0,0 +1,19 @@ | |||||
@{ | |||||
ViewBag.Title = "项目人员管理"; | |||||
Layout = "~/Views/Shared/_Form.cshtml"; | |||||
} | |||||
<div class="lr-form-wrap" id="form"> | |||||
<div class="col-xs-12 lr-form-item" data-table="SRProjectPeople" > | |||||
<div class="lr-form-item-title">项目编号<font face="宋体">*</font></div> | |||||
<div id="SRProjectBasicId" isvalid="yes" checkexpession="NotNull" ></div> | |||||
</div> | |||||
<div class="col-xs-12 lr-form-item" data-table="SRProjectPeople" > | |||||
<div class="lr-form-item-title">项目负责人</div> | |||||
<div id="ManageName" ></div> | |||||
</div> | |||||
<div class="col-xs-12 lr-form-item" data-table="SRProjectPeople" > | |||||
<div class="lr-form-item-title">项目成员<font face="宋体">*</font></div> | |||||
<div id="Players" isvalid="yes" checkexpession="NotNull" ></div> | |||||
</div> | |||||
</div> | |||||
@Html.AppendJsFile("/Areas/CustomFunction/Views/SRProjectPeople/Form.js") |
@@ -0,0 +1,53 @@ | |||||
/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) | |||||
* Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||||
* 创建人:超级管理员 | |||||
* 日 期:2021-09-15 17:10 | |||||
* 描 述:项目人员管理 | |||||
*/ | |||||
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 () { | |||||
$('#SRProjectBasicId').lrDataItemSelect({ code: 'NoticeCategory' }); | |||||
$('#ManageName').lrDataSourceSelect({ code: 'EmpInfo',value: 'empid',text: 'empname' }); | |||||
$('#Players').lrDataSourceSelect({ code: 'EmpInfo',value: 'empid',text: 'empname' }); | |||||
}, | |||||
initData: function () { | |||||
if (!!keyValue) { | |||||
$.lrSetForm(top.$.rootUrl + '/CustomFunction/SRProjectPeople/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 = { | |||||
strEntity: JSON.stringify($('body').lrGetFormData()) | |||||
}; | |||||
$.lrSaveForm(top.$.rootUrl + '/CustomFunction/SRProjectPeople/SaveForm?keyValue=' + keyValue, postData, function (res) { | |||||
// 保存成功后才回调 | |||||
if (!!callBack) { | |||||
callBack(); | |||||
} | |||||
}); | |||||
}; | |||||
page.init(); | |||||
} |
@@ -0,0 +1,41 @@ | |||||
@{ | |||||
ViewBag.Title = "项目人员管理"; | |||||
Layout = "~/Views/Shared/_Index.cshtml"; | |||||
} | |||||
<div class="lr-layout " > | |||||
<div class="lr-layout-center"> | |||||
<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"> | |||||
<div id="multiple_condition_query"> | |||||
<div class="lr-query-formcontent"> | |||||
<div class="col-xs-12 lr-form-item"> | |||||
<div class="lr-form-item-title">项目编号</div> | |||||
<div id="SRProjectBasicId"></div> | |||||
</div> | |||||
<div class="col-xs-12 lr-form-item"> | |||||
<div class="lr-form-item-title">项目负责人</div> | |||||
<div id="ManageName"></div> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
</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> | |||||
<a id="lr_delete" class="btn btn-default"><i class="fa fa-trash-o"></i> 删除</a> | |||||
<a id="lr_print" class="btn btn-default"><i class="fa fa-print"></i> 打印</a> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
<div class="lr-layout-body" id="gridtable"></div> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
@Html.AppendJsFile("/Areas/CustomFunction/Views/SRProjectPeople/Index.js") |
@@ -0,0 +1,124 @@ | |||||
/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) | |||||
* Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||||
* 创建人:超级管理员 | |||||
* 日 期:2021-09-15 17:10 | |||||
* 描 述:项目人员管理 | |||||
*/ | |||||
var refreshGirdData; | |||||
var bootstrap = function ($, learun) { | |||||
"use strict"; | |||||
var page = { | |||||
init: function () { | |||||
page.initGird(); | |||||
page.bind(); | |||||
}, | |||||
bind: function () { | |||||
$('#multiple_condition_query').lrMultipleQuery(function (queryJson) { | |||||
page.search(queryJson); | |||||
}, 220, 400); | |||||
$('#SRProjectBasicId').lrDataItemSelect({ code: 'NoticeCategory' }); | |||||
$('#ManageName').lrDataSourceSelect({ code: 'EmpInfo',value: 'empid',text: 'empname' }); | |||||
// 刷新 | |||||
$('#lr_refresh').on('click', function () { | |||||
location.reload(); | |||||
}); | |||||
// 新增 | |||||
$('#lr_add').on('click', function () { | |||||
learun.layerForm({ | |||||
id: 'form', | |||||
title: '新增', | |||||
url: top.$.rootUrl + '/CustomFunction/SRProjectPeople/Form', | |||||
width: 600, | |||||
height: 400, | |||||
callBack: function (id) { | |||||
return top[id].acceptClick(refreshGirdData); | |||||
} | |||||
}); | |||||
}); | |||||
// 编辑 | |||||
$('#lr_edit').on('click', function () { | |||||
var keyValue = $('#gridtable').jfGridValue('ID'); | |||||
if (learun.checkrow(keyValue)) { | |||||
learun.layerForm({ | |||||
id: 'form', | |||||
title: '编辑', | |||||
url: top.$.rootUrl + '/CustomFunction/SRProjectPeople/Form?keyValue=' + keyValue, | |||||
width: 600, | |||||
height: 400, | |||||
callBack: function (id) { | |||||
return top[id].acceptClick(refreshGirdData); | |||||
} | |||||
}); | |||||
} | |||||
}); | |||||
// 删除 | |||||
$('#lr_delete').on('click', function () { | |||||
var keyValue = $('#gridtable').jfGridValue('ID'); | |||||
if (learun.checkrow(keyValue)) { | |||||
learun.layerConfirm('是否确认删除该项!', function (res) { | |||||
if (res) { | |||||
learun.deleteForm(top.$.rootUrl + '/CustomFunction/SRProjectPeople/DeleteForm', { keyValue: keyValue}, function () { | |||||
refreshGirdData(); | |||||
}); | |||||
} | |||||
}); | |||||
} | |||||
}); | |||||
// 打印 | |||||
$('#lr_print').on('click', function () { | |||||
$('#gridtable').jqprintTable(); | |||||
}); | |||||
}, | |||||
// 初始化列表 | |||||
initGird: function () { | |||||
$('#gridtable').lrAuthorizeJfGrid({ | |||||
url: top.$.rootUrl + '/CustomFunction/SRProjectPeople/GetPageList', | |||||
headData: [ | |||||
{ label: "项目编号", name: "SRProjectBasicId", width: 100, align: "left", | |||||
formatterAsync: function (callback, value, row, op,$cell) { | |||||
learun.clientdata.getAsync('dataItem', { | |||||
key: value, | |||||
code: 'NoticeCategory', | |||||
callback: function (_data) { | |||||
callback(_data.text); | |||||
} | |||||
}); | |||||
}}, | |||||
{ label: "项目负责人", name: "ManageName", width: 100, align: "left", | |||||
formatterAsync: function (callback, value, row, op,$cell) { | |||||
learun.clientdata.getAsync('custmerData', { | |||||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'EmpInfo', | |||||
key: value, | |||||
keyId: 'empid', | |||||
callback: function (_data) { | |||||
callback(_data['empname']); | |||||
} | |||||
}); | |||||
}}, | |||||
{ label: "项目成员", name: "Players", width: 100, align: "left", | |||||
formatterAsync: function (callback, value, row, op,$cell) { | |||||
learun.clientdata.getAsync('custmerData', { | |||||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'EmpInfo', | |||||
key: value, | |||||
keyId: 'empid', | |||||
callback: function (_data) { | |||||
callback(_data['empname']); | |||||
} | |||||
}); | |||||
}}, | |||||
], | |||||
mainId:'ID', | |||||
isPage: true | |||||
}); | |||||
page.search(); | |||||
}, | |||||
search: function (param) { | |||||
param = param || {}; | |||||
$('#gridtable').jfGridSet('reload',{ queryJson: JSON.stringify(param) }); | |||||
} | |||||
}; | |||||
refreshGirdData = function () { | |||||
$('#gridtable').jfGridSet('reload'); | |||||
}; | |||||
page.init(); | |||||
} |
@@ -827,6 +827,7 @@ | |||||
<Compile Include="Areas\EducationalAdministration\Controllers\StuSubsideManageController.cs" /> | <Compile Include="Areas\EducationalAdministration\Controllers\StuSubsideManageController.cs" /> | ||||
<Compile Include="Areas\EducationalAdministration\Controllers\DispatchAuditController.cs" /> | <Compile Include="Areas\EducationalAdministration\Controllers\DispatchAuditController.cs" /> | ||||
<Compile Include="Areas\CustomFunction\Controllers\SRProjectBasicController.cs" /> | <Compile Include="Areas\CustomFunction\Controllers\SRProjectBasicController.cs" /> | ||||
<Compile Include="Areas\CustomFunction\Controllers\SRProjectPeopleController.cs" /> | |||||
</ItemGroup> | </ItemGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
<Content Include="Areas\AdmissionsPlatform\Views\AP_OnlineUserInfo\DropOutIndex.js" /> | <Content Include="Areas\AdmissionsPlatform\Views\AP_OnlineUserInfo\DropOutIndex.js" /> | ||||
@@ -6472,6 +6473,10 @@ | |||||
<Content Include="Areas\CustomFunction\Views\SRProjectBasic\Index.js" /> | <Content Include="Areas\CustomFunction\Views\SRProjectBasic\Index.js" /> | ||||
<Content Include="Areas\CustomFunction\Views\SRProjectBasic\Form.cshtml" /> | <Content Include="Areas\CustomFunction\Views\SRProjectBasic\Form.cshtml" /> | ||||
<Content Include="Areas\CustomFunction\Views\SRProjectBasic\Form.js" /> | <Content Include="Areas\CustomFunction\Views\SRProjectBasic\Form.js" /> | ||||
<Content Include="Areas\CustomFunction\Views\SRProjectPeople\Index.cshtml" /> | |||||
<Content Include="Areas\CustomFunction\Views\SRProjectPeople\Index.js" /> | |||||
<Content Include="Areas\CustomFunction\Views\SRProjectPeople\Form.cshtml" /> | |||||
<Content Include="Areas\CustomFunction\Views\SRProjectPeople\Form.js" /> | |||||
</ItemGroup> | </ItemGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
<Folder Include="Areas\LR_Desktop\Models\" /> | <Folder Include="Areas\LR_Desktop\Models\" /> | ||||
@@ -14,7 +14,10 @@ | |||||
var clientAsyncData = {}; | var clientAsyncData = {}; | ||||
var clientData = {}; | var clientData = {}; | ||||
var data1 = {}; | |||||
var desktopData = {}; | |||||
var sourceData = {}; | |||||
var userData = {}; | |||||
var dataItemData = {}; | |||||
function initLoad(callback) { | function initLoad(callback) { | ||||
var res = loadSate.yes; | var res = loadSate.yes; | ||||
@@ -278,13 +281,19 @@ | |||||
init: function () { | init: function () { | ||||
if (clientAsyncData.user.states == loadSate.no) { | if (clientAsyncData.user.states == loadSate.no) { | ||||
clientAsyncData.user.states = loadSate.ing; | clientAsyncData.user.states = loadSate.ing; | ||||
var ver = storage.get("userData").ver || ""; | |||||
//var ver = storage.get("userData").ver || ""; | |||||
var ver = ""; | |||||
if (userData) { | |||||
ver = userData.ver || ""; | |||||
} | |||||
learun.httpAsync('GET', top.$.rootUrl + '/LR_OrganizationModule/User/GetMap', { ver: ver }, function (data) { | learun.httpAsync('GET', top.$.rootUrl + '/LR_OrganizationModule/User/GetMap', { ver: ver }, function (data) { | ||||
if (!data) { | if (!data) { | ||||
clientAsyncData.user.states = loadSate.fail; | clientAsyncData.user.states = loadSate.fail; | ||||
} else { | } else { | ||||
if (data.ver) { | if (data.ver) { | ||||
storage.set("userData", data); | |||||
userData = data; | |||||
//storage.set("userData", data); | |||||
} | } | ||||
clientAsyncData.user.states = loadSate.yes; | clientAsyncData.user.states = loadSate.yes; | ||||
clientAsyncData.dataItem.init(); | clientAsyncData.dataItem.init(); | ||||
@@ -300,7 +309,8 @@ | |||||
}, 100);// 如果还在加载100ms后再检测 | }, 100);// 如果还在加载100ms后再检测 | ||||
} | } | ||||
else { | else { | ||||
var data = storage.get("userData").data || {}; | |||||
//var data = storage.get("userData").data || {}; | |||||
var data = userData.data || {}; | |||||
var keys = (op.key || '').split(','); | var keys = (op.key || '').split(','); | ||||
var array = new Array(); | var array = new Array(); | ||||
if (keys.length > 1) { | if (keys.length > 1) { | ||||
@@ -325,7 +335,8 @@ | |||||
}, 100);// 如果还在加载100ms后再检测 | }, 100);// 如果还在加载100ms后再检测 | ||||
} | } | ||||
else { | else { | ||||
var data = storage.get("userData").data || {}; | |||||
//var data = storage.get("userData").data || {}; | |||||
var data = userData.data || {}; | |||||
op.callback(data, op); | op.callback(data, op); | ||||
} | } | ||||
} | } | ||||
@@ -336,13 +347,17 @@ | |||||
init: function () { | init: function () { | ||||
if (clientAsyncData.dataItem.states == loadSate.no) { | if (clientAsyncData.dataItem.states == loadSate.no) { | ||||
clientAsyncData.dataItem.states = loadSate.ing; | clientAsyncData.dataItem.states = loadSate.ing; | ||||
var ver = storage.get("dataItemData").ver || ""; | |||||
var ver = "";// storage.get("dataItemData").ver || ""; | |||||
if (dataItemData) { | |||||
ver = dataItemData.ver || ""; | |||||
} | |||||
learun.httpAsync('GET', top.$.rootUrl + '/LR_SystemModule/DataItem/GetMap', { ver: ver }, function (data) { | learun.httpAsync('GET', top.$.rootUrl + '/LR_SystemModule/DataItem/GetMap', { ver: ver }, function (data) { | ||||
if (!data) { | if (!data) { | ||||
clientAsyncData.dataItem.states = loadSate.fail; | clientAsyncData.dataItem.states = loadSate.fail; | ||||
} else { | } else { | ||||
if (data.ver) { | if (data.ver) { | ||||
storage.set("dataItemData", data); | |||||
dataItemData = data; | |||||
//storage.set("dataItemData", data); | |||||
} | } | ||||
clientAsyncData.dataItem.states = loadSate.yes; | clientAsyncData.dataItem.states = loadSate.yes; | ||||
clientAsyncData.db.init(); | clientAsyncData.db.init(); | ||||
@@ -358,7 +373,7 @@ | |||||
}, 100);// 如果还在加载100ms后再检测 | }, 100);// 如果还在加载100ms后再检测 | ||||
} | } | ||||
else { | else { | ||||
var data = storage.get("dataItemData").data || {}; | |||||
var data = dataItemData.data || {};// storage.get("dataItemData").data || {}; | |||||
// 数据字典翻译 | // 数据字典翻译 | ||||
var _item = clientAsyncData.dataItem.find(op.key, data[op.code] || {}); | var _item = clientAsyncData.dataItem.find(op.key, data[op.code] || {}); | ||||
@@ -381,7 +396,7 @@ | |||||
}, 100);// 如果还在加载100ms后再检测 | }, 100);// 如果还在加载100ms后再检测 | ||||
} | } | ||||
else { | else { | ||||
var data = storage.get("dataItemData").data || {}; | |||||
var data = dataItemData.data || {};//storage.get("dataItemData").data || {}; | |||||
var res = {}; | var res = {}; | ||||
$.each(data[op.code] || {}, function (_index, _item) { | $.each(data[op.code] || {}, function (_index, _item) { | ||||
_item.text = top.learun.language.getSyn(_item.text); | _item.text = top.learun.language.getSyn(_item.text); | ||||
@@ -398,7 +413,7 @@ | |||||
}, 100);// 如果还在加载100ms后再检测 | }, 100);// 如果还在加载100ms后再检测 | ||||
} | } | ||||
else { | else { | ||||
var data = storage.get("dataItemData").data || {}; | |||||
var data = dataItemData || {};//storage.get("dataItemData").data || {}; | |||||
var keyList = (op.key || "").split(','); | var keyList = (op.key || "").split(','); | ||||
var _text = [] | var _text = [] | ||||
@@ -487,8 +502,9 @@ | |||||
}, 100);// 如果还在加载100ms后再检测 | }, 100);// 如果还在加载100ms后再检测 | ||||
} | } | ||||
else { | else { | ||||
var data = storage.get("sourceData_" + op.code).data || []; | |||||
var data = sourceData["sourceData_" + code] || [];// storage.get("sourceData_" + op.code).data || []; | |||||
if (!!data) { | if (!!data) { | ||||
//op.callback(sourceData["sourceData_" + code].find(op.key, op.keyId, data) || {}, op); | |||||
op.callback(clientAsyncData.sourceData.find(op.key, op.keyId, data) || {}, op); | op.callback(clientAsyncData.sourceData.find(op.key, op.keyId, data) || {}, op); | ||||
} else { | } else { | ||||
op.callback({}, op); | op.callback({}, op); | ||||
@@ -507,7 +523,8 @@ | |||||
}, 100);// 如果还在加载100ms后再检测 | }, 100);// 如果还在加载100ms后再检测 | ||||
} | } | ||||
else if (clientAsyncData.sourceData.states[op.code] == loadSate.yes) { | else if (clientAsyncData.sourceData.states[op.code] == loadSate.yes) { | ||||
var data = storage.get("sourceData_" + op.code).data || []; | |||||
//var data = storage.get("sourceData_" + op.code).data || []; | |||||
var data = sourceData["sourceData_" + op.code].data || []; | |||||
if (!!data) { | if (!!data) { | ||||
op.callback(data, op); | op.callback(data, op); | ||||
@@ -517,13 +534,19 @@ | |||||
} | } | ||||
}, | }, | ||||
load: function (code) { | load: function (code) { | ||||
var ver = storage.get("sourceData_" + code).ver || ""; | |||||
// var ver = storage.get("sourceData_" + code).ver || ""; | |||||
var ver = ""; | |||||
if (sourceData["sourceData_" + code]) { | |||||
ver = sourceData["sourceData_" + code].ver || ""; | |||||
} | |||||
//var ver = sourceData["sourceData_" + code].ver || "";//storage.get("sourceData_" + code).ver || ""; | |||||
learun.httpAsync('GET', top.$.rootUrl + '/LR_SystemModule/DataSource/GetMap', { code: code, ver: ver }, function (data) { | learun.httpAsync('GET', top.$.rootUrl + '/LR_SystemModule/DataSource/GetMap', { code: code, ver: ver }, function (data) { | ||||
if (!data) { | if (!data) { | ||||
clientAsyncData.sourceData.states[code] = loadSate.fail; | clientAsyncData.sourceData.states[code] = loadSate.fail; | ||||
} else { | } else { | ||||
if (data.ver) { | if (data.ver) { | ||||
storage.set("sourceData_" + code, data); | |||||
sourceData["sourceData_" + code] = data; | |||||
//storage.set("sourceData_" + code, data); | |||||
} | } | ||||
clientAsyncData.sourceData.states[code] = loadSate.yes; | clientAsyncData.sourceData.states[code] = loadSate.yes; | ||||
} | } | ||||
@@ -661,7 +684,7 @@ | |||||
clientAsyncData.desktop.states = loadSate.fail; | clientAsyncData.desktop.states = loadSate.fail; | ||||
} else { | } else { | ||||
if (k.ver) { | if (k.ver) { | ||||
data1 = k; | |||||
desktopData = k; | |||||
//storage.set("desktopData", k); | //storage.set("desktopData", k); | ||||
} | } | ||||
clientAsyncData.desktop.states = loadSate.yes; | clientAsyncData.desktop.states = loadSate.yes; | ||||
@@ -676,7 +699,7 @@ | |||||
clientAsyncData.desktop.get(k); | clientAsyncData.desktop.get(k); | ||||
}, 100) | }, 100) | ||||
} else { | } else { | ||||
var j = data1 || {};//storage.get("desktopData").data || {}; | |||||
var j = desktopData;//storage.get("desktopData").data || {}; | |||||
k.callback(j || {}, k); | k.callback(j || {}, k); | ||||
} | } | ||||
} | } | ||||
@@ -0,0 +1,684 @@ | |||||
| |||||
(function ($, learun) { | |||||
"use strict"; | |||||
var loadSate = { | |||||
no: -1, // 还未加载 | |||||
yes: 1, // 已经加载成功 | |||||
ing: 0, // 正在加载中 | |||||
fail: 2 // 加载失败 | |||||
}; | |||||
var clientDataFn = {}; | |||||
var clientAsyncData = {}; | |||||
var clientData = {}; | |||||
var data1 = {}; | |||||
function initLoad(callback) { | |||||
var res = loadSate.yes; | |||||
for (var id in clientDataFn) { | |||||
var _fn = clientDataFn[id]; | |||||
if (_fn.state == loadSate.fail) { | |||||
res = loadSate.fail; | |||||
break; | |||||
} | |||||
else if (_fn.state == loadSate.no) { | |||||
res = loadSate.ing; | |||||
_fn.init(); | |||||
} | |||||
else if (_fn.state == loadSate.ing) { | |||||
res = loadSate.ing; | |||||
} | |||||
} | |||||
if (res == loadSate.yes) { | |||||
callback(true); | |||||
} else if (res == loadSate.fail) { | |||||
callback(false); | |||||
} | |||||
else { | |||||
setTimeout(function () { | |||||
initLoad(callback); | |||||
}, 100); | |||||
} | |||||
} | |||||
function get(key, data) { | |||||
var res = ""; | |||||
var len = data.length; | |||||
if (len == undefined) { | |||||
res = data[key]; | |||||
} | |||||
else { | |||||
for (var i = 0; i < len; i++) { | |||||
if (key(data[i])) { | |||||
res = data[i]; | |||||
break; | |||||
} | |||||
} | |||||
} | |||||
return res; | |||||
} | |||||
learun.clientdata = { | |||||
init: function (callback) { | |||||
initLoad(function (res) { | |||||
callback(res); | |||||
if (res) {// 开始异步加载数据 | |||||
clientAsyncData.company.init(); | |||||
} | |||||
}); | |||||
}, | |||||
get: function (nameArray) {//[key,function (v) { return v.key == value }] | |||||
var res = ""; | |||||
if (!nameArray) { | |||||
return res; | |||||
} | |||||
var len = nameArray.length; | |||||
var data = clientData; | |||||
for (var i = 0; i < len; i++) { | |||||
res = get(nameArray[i], data); | |||||
if (res != "" && res != undefined) { | |||||
data = res; | |||||
} | |||||
else { | |||||
break; | |||||
} | |||||
} | |||||
res = res || ""; | |||||
return res; | |||||
}, | |||||
getAsync: function (name, op) {// | |||||
return clientAsyncData[name].get(op); | |||||
}, | |||||
getAllAsync: function (name, op) {// | |||||
return clientAsyncData[name].getAll(op); | |||||
}, | |||||
getsAsync: function (name, op) {// | |||||
return clientAsyncData[name].gets(op); | |||||
}, | |||||
update: function (name) { | |||||
clientAsyncData[name].update && clientAsyncData[name].update(); | |||||
}, | |||||
getAsyncReal: function (name, op) { | |||||
clientAsyncData[name].states = 1; | |||||
return clientAsyncData[name].get(op); | |||||
} | |||||
}; | |||||
/*******************登录后数据***********************/ | |||||
// 注册数据的加载方法 | |||||
// 功能模块数据 | |||||
clientDataFn.modules = { | |||||
state: loadSate.no, | |||||
init: function () { | |||||
//初始化加载数据 | |||||
clientDataFn.modules.state = loadSate.ing; | |||||
learun.httpAsyncGet($.rootUrl + '/LR_SystemModule/Module/GetModuleList', function (res) { | |||||
if (res.code == learun.httpCode.success) { | |||||
clientData.modules = res.data; | |||||
clientDataFn.modules.toMap(); | |||||
clientDataFn.modules.state = loadSate.yes; | |||||
} | |||||
else { | |||||
clientData.modules = []; | |||||
clientDataFn.modules.toMap(); | |||||
clientDataFn.modules.state = loadSate.fail; | |||||
} | |||||
}); | |||||
}, | |||||
toMap: function () { | |||||
//转化成树结构 和 转化成字典结构 | |||||
var modulesTree = {}; | |||||
var modulesMap = {}; | |||||
var _len = clientData.modules.length; | |||||
for (var i = 0; i < _len; i++) { | |||||
var _item = clientData.modules[i]; | |||||
if (_item.F_EnabledMark == 1) { | |||||
modulesTree[_item.F_ParentId] = modulesTree[_item.F_ParentId] || []; | |||||
modulesTree[_item.F_ParentId].push(_item); | |||||
modulesMap[_item.F_ModuleId] = _item; | |||||
} | |||||
} | |||||
clientData.modulesTree = modulesTree; | |||||
clientData.modulesMap = modulesMap; | |||||
} | |||||
}; | |||||
// 登录用户信息 | |||||
clientDataFn.userinfo = { | |||||
state: loadSate.no, | |||||
init: function () { | |||||
//初始化加载数据 | |||||
clientDataFn.userinfo.state = loadSate.ing; | |||||
learun.httpAsyncGet($.rootUrl + '/Login/GetUserInfo', function (res) { | |||||
if (res.code == learun.httpCode.success) { | |||||
clientData.userinfo = res.data; | |||||
clientDataFn.userinfo.state = loadSate.yes; | |||||
} | |||||
else { | |||||
clientDataFn.userinfo.state = loadSate.fail; | |||||
} | |||||
}); | |||||
} | |||||
}; | |||||
/*******************使用时异步获取*******************/ | |||||
var storage = { | |||||
get: function (name) { | |||||
if (localStorage) { | |||||
return JSON.parse(localStorage.getItem(name)) || {}; | |||||
} | |||||
else { | |||||
return clientData[name] || {}; | |||||
} | |||||
}, | |||||
set: function (name, data) { | |||||
if (localStorage) { | |||||
localStorage.setItem(name, JSON.stringify(data)); | |||||
} | |||||
else { | |||||
clientData[name] = data; | |||||
} | |||||
} | |||||
}; | |||||
// 公司信息 | |||||
clientAsyncData.company = { | |||||
states: loadSate.no, | |||||
init: function () { | |||||
if (clientAsyncData.company.states == loadSate.no) { | |||||
clientAsyncData.company.states = loadSate.ing; | |||||
var ver = storage.get("companyData").ver || ""; | |||||
learun.httpAsync('GET', top.$.rootUrl + '/LR_OrganizationModule/Company/GetMap', { ver: ver }, function (data) { | |||||
if (!data) { | |||||
clientAsyncData.company.states = loadSate.fail; | |||||
} else { | |||||
if (data.ver) { | |||||
storage.set("companyData", data); | |||||
} | |||||
clientAsyncData.company.states = loadSate.yes; | |||||
clientAsyncData.department.init(); | |||||
} | |||||
}); | |||||
} | |||||
}, | |||||
get: function (op) { | |||||
clientAsyncData.company.init(); | |||||
if (clientAsyncData.company.states == loadSate.ing) { | |||||
setTimeout(function () { | |||||
clientAsyncData.company.get(op); | |||||
}, 100);// 如果还在加载100ms后再检测 | |||||
} | |||||
else { | |||||
var data = storage.get("companyData").data || {}; | |||||
op.callback(data[op.key] || {}, op); | |||||
} | |||||
}, | |||||
getAll: function (op) { | |||||
clientAsyncData.company.init(); | |||||
if (clientAsyncData.company.states == loadSate.ing) { | |||||
setTimeout(function () { | |||||
clientAsyncData.company.getAll(op); | |||||
}, 100);// 如果还在加载100ms后再检测 | |||||
} | |||||
else { | |||||
var data = storage.get("companyData").data || {}; | |||||
op.callback(data, op); | |||||
} | |||||
} | |||||
}; | |||||
// 部门信息 | |||||
clientAsyncData.department = { | |||||
states: loadSate.no, | |||||
init: function () { | |||||
if (clientAsyncData.department.states == loadSate.no) { | |||||
clientAsyncData.department.states = loadSate.ing; | |||||
var ver = storage.get("departmentData").ver || ""; | |||||
learun.httpAsync('GET', top.$.rootUrl + '/LR_OrganizationModule/Department/GetMap', { ver: ver }, function (data) { | |||||
if (!data) { | |||||
clientAsyncData.department.states = loadSate.fail; | |||||
} else { | |||||
if (data.ver) { | |||||
storage.set("departmentData", data); | |||||
} | |||||
clientAsyncData.department.states = loadSate.yes; | |||||
clientAsyncData.user.init(); | |||||
} | |||||
}); | |||||
} | |||||
}, | |||||
get: function (op) { | |||||
clientAsyncData.department.init(); | |||||
if (clientAsyncData.department.states == loadSate.ing) { | |||||
setTimeout(function () { | |||||
clientAsyncData.department.get(op); | |||||
}, 100);// 如果还在加载100ms后再检测 | |||||
} | |||||
else { | |||||
var data = storage.get("departmentData").data || {}; | |||||
op.callback(data[op.key] || {}, op); | |||||
} | |||||
}, | |||||
getAll: function (op) { | |||||
clientAsyncData.department.init(); | |||||
if (clientAsyncData.department.states == loadSate.ing) { | |||||
setTimeout(function () { | |||||
clientAsyncData.department.getAll(op); | |||||
}, 100);// 如果还在加载100ms后再检测 | |||||
} | |||||
else { | |||||
var data = storage.get("departmentData").data || {}; | |||||
op.callback(data, op); | |||||
} | |||||
} | |||||
}; | |||||
// 人员信息 | |||||
clientAsyncData.user = { | |||||
states: loadSate.no, | |||||
init: function () { | |||||
if (clientAsyncData.user.states == loadSate.no) { | |||||
clientAsyncData.user.states = loadSate.ing; | |||||
var ver = storage.get("userData").ver || ""; | |||||
learun.httpAsync('GET', top.$.rootUrl + '/LR_OrganizationModule/User/GetMap', { ver: ver }, function (data) { | |||||
if (!data) { | |||||
clientAsyncData.user.states = loadSate.fail; | |||||
} else { | |||||
if (data.ver) { | |||||
storage.set("userData", data); | |||||
} | |||||
clientAsyncData.user.states = loadSate.yes; | |||||
clientAsyncData.dataItem.init(); | |||||
} | |||||
}); | |||||
} | |||||
}, | |||||
get: function (op) { | |||||
clientAsyncData.user.init(); | |||||
if (clientAsyncData.user.states == loadSate.ing) { | |||||
setTimeout(function () { | |||||
clientAsyncData.user.get(op); | |||||
}, 100);// 如果还在加载100ms后再检测 | |||||
} | |||||
else { | |||||
var data = storage.get("userData").data || {}; | |||||
var keys = (op.key || '').split(','); | |||||
var array = new Array(); | |||||
if (keys.length > 1) { | |||||
$.each(keys, | |||||
function (i, item) { | |||||
array.push(data[item]); | |||||
}) | |||||
op.callback(array || {}, op); | |||||
} else { | |||||
op.callback(data[op.key] || {}, op); | |||||
} | |||||
} | |||||
}, | |||||
getAll: function (op) { | |||||
clientAsyncData.user.init(); | |||||
if (clientAsyncData.user.states == loadSate.ing) { | |||||
setTimeout(function () { | |||||
clientAsyncData.user.getAll(op); | |||||
}, 100);// 如果还在加载100ms后再检测 | |||||
} | |||||
else { | |||||
var data = storage.get("userData").data || {}; | |||||
op.callback(data, op); | |||||
} | |||||
} | |||||
}; | |||||
// 数据字典 | |||||
clientAsyncData.dataItem = { | |||||
states: loadSate.no, | |||||
init: function () { | |||||
if (clientAsyncData.dataItem.states == loadSate.no) { | |||||
clientAsyncData.dataItem.states = loadSate.ing; | |||||
var ver = storage.get("dataItemData").ver || ""; | |||||
learun.httpAsync('GET', top.$.rootUrl + '/LR_SystemModule/DataItem/GetMap', { ver: ver }, function (data) { | |||||
if (!data) { | |||||
clientAsyncData.dataItem.states = loadSate.fail; | |||||
} else { | |||||
if (data.ver) { | |||||
storage.set("dataItemData", data); | |||||
} | |||||
clientAsyncData.dataItem.states = loadSate.yes; | |||||
clientAsyncData.db.init(); | |||||
} | |||||
}); | |||||
} | |||||
}, | |||||
get: function (op) { | |||||
clientAsyncData.dataItem.init(); | |||||
if (clientAsyncData.dataItem.states == loadSate.ing) { | |||||
setTimeout(function () { | |||||
clientAsyncData.dataItem.get(op); | |||||
}, 100);// 如果还在加载100ms后再检测 | |||||
} | |||||
else { | |||||
var data = storage.get("dataItemData").data || {}; | |||||
// 数据字典翻译 | |||||
var _item = clientAsyncData.dataItem.find(op.key, data[op.code] || {}); | |||||
if (_item) { | |||||
top.learun.language.get(_item.text, function (text) { | |||||
_item.text = text; | |||||
op.callback(_item, op); | |||||
}); | |||||
} | |||||
else { | |||||
op.callback({}, op); | |||||
} | |||||
} | |||||
}, | |||||
getAll: function (op) { | |||||
clientAsyncData.dataItem.init(); | |||||
if (clientAsyncData.dataItem.states == loadSate.ing) { | |||||
setTimeout(function () { | |||||
clientAsyncData.dataItem.getAll(op); | |||||
}, 100);// 如果还在加载100ms后再检测 | |||||
} | |||||
else { | |||||
var data = storage.get("dataItemData").data || {}; | |||||
var res = {}; | |||||
$.each(data[op.code] || {}, function (_index, _item) { | |||||
_item.text = top.learun.language.getSyn(_item.text); | |||||
res[_index] = _item; | |||||
}); | |||||
op.callback(res, op); | |||||
} | |||||
}, | |||||
gets: function (op) { | |||||
clientAsyncData.dataItem.init(); | |||||
if (clientAsyncData.dataItem.states == loadSate.ing) { | |||||
setTimeout(function () { | |||||
clientAsyncData.dataItem.get(op); | |||||
}, 100);// 如果还在加载100ms后再检测 | |||||
} | |||||
else { | |||||
var data = storage.get("dataItemData").data || {}; | |||||
var keyList = (op.key || "").split(','); | |||||
var _text = [] | |||||
$.each(keyList, function (_index, _item) { | |||||
var _item = clientAsyncData.dataItem.find(_item, data[op.code] || {}); | |||||
top.learun.language.get(_item.text, function (text) { | |||||
_text.push(text); | |||||
}); | |||||
}); | |||||
op.callback(String(_text), op); | |||||
} | |||||
}, | |||||
find: function (key, data) { | |||||
var res = {}; | |||||
for (var id in data) { | |||||
if (data[id].value == key) { | |||||
res = data[id]; | |||||
break; | |||||
} | |||||
} | |||||
return res; | |||||
}, | |||||
update: function () { | |||||
clientAsyncData.dataItem.states = loadSate.no; | |||||
clientAsyncData.dataItem.init(); | |||||
} | |||||
}; | |||||
// 数据库连接数据 | |||||
clientAsyncData.db = { | |||||
states: loadSate.no, | |||||
init: function () { | |||||
if (clientAsyncData.db.states == loadSate.no) { | |||||
clientAsyncData.db.states = loadSate.ing; | |||||
var ver = storage.get("dbData").ver || ""; | |||||
learun.httpAsync('GET', top.$.rootUrl + '/LR_SystemModule/DatabaseLink/GetMap', { ver: ver }, function (data) { | |||||
if (!data) { | |||||
clientAsyncData.db.states = loadSate.fail; | |||||
} else { | |||||
if (data.ver) { | |||||
storage.set("dbData", data); | |||||
} | |||||
clientAsyncData.db.states = loadSate.yes; | |||||
} | |||||
}); | |||||
} | |||||
}, | |||||
get: function (op) { | |||||
clientAsyncData.db.init(); | |||||
if (clientAsyncData.db.states == loadSate.ing) { | |||||
setTimeout(function () { | |||||
clientAsyncData.db.get(op); | |||||
}, 100);// 如果还在加载100ms后再检测 | |||||
} | |||||
else { | |||||
var data = storage.get("dbData").data || {}; | |||||
op.callback(data[op.key] || {}, op); | |||||
} | |||||
}, | |||||
getAll: function (op) { | |||||
clientAsyncData.db.init(); | |||||
if (clientAsyncData.db.states == loadSate.ing) { | |||||
setTimeout(function () { | |||||
clientAsyncData.db.getAll(op); | |||||
}, 100);// 如果还在加载100ms后再检测 | |||||
} | |||||
else { | |||||
var data = storage.get("dbData").data || {}; | |||||
op.callback(data, op); | |||||
} | |||||
} | |||||
}; | |||||
// 数据源数据 | |||||
clientAsyncData.sourceData = { | |||||
states: {}, | |||||
get: function (op) { | |||||
if (clientAsyncData.sourceData.states[op.code] == undefined || clientAsyncData.sourceData.states[op.code] == loadSate.no) { | |||||
clientAsyncData.sourceData.states[op.code] = loadSate.ing; | |||||
clientAsyncData.sourceData.load(op.code); | |||||
} | |||||
if (clientAsyncData.sourceData.states[op.code] == loadSate.ing) { | |||||
setTimeout(function () { | |||||
clientAsyncData.sourceData.get(op); | |||||
}, 100);// 如果还在加载100ms后再检测 | |||||
} | |||||
else { | |||||
var data = storage.get("sourceData_" + op.code).data || []; | |||||
if (!!data) { | |||||
op.callback(clientAsyncData.sourceData.find(op.key, op.keyId, data) || {}, op); | |||||
} else { | |||||
op.callback({}, op); | |||||
} | |||||
} | |||||
}, | |||||
getAll: function (op) { | |||||
if (clientAsyncData.sourceData.states[op.code] == undefined || clientAsyncData.sourceData.states[op.code] == loadSate.no) { | |||||
clientAsyncData.sourceData.states[op.code] = loadSate.ing; | |||||
clientAsyncData.sourceData.load(op.code); | |||||
} | |||||
if (clientAsyncData.sourceData.states[op.code] == loadSate.ing) { | |||||
setTimeout(function () { | |||||
clientAsyncData.sourceData.getAll(op); | |||||
}, 100);// 如果还在加载100ms后再检测 | |||||
} | |||||
else if (clientAsyncData.sourceData.states[op.code] == loadSate.yes) { | |||||
var data = storage.get("sourceData_" + op.code).data || []; | |||||
if (!!data) { | |||||
op.callback(data, op); | |||||
} else { | |||||
op.callback({}, op); | |||||
} | |||||
} | |||||
}, | |||||
load: function (code) { | |||||
var ver = storage.get("sourceData_" + code).ver || ""; | |||||
learun.httpAsync('GET', top.$.rootUrl + '/LR_SystemModule/DataSource/GetMap', { code: code, ver: ver }, function (data) { | |||||
if (!data) { | |||||
clientAsyncData.sourceData.states[code] = loadSate.fail; | |||||
} else { | |||||
if (data.ver) { | |||||
storage.set("sourceData_" + code, data); | |||||
} | |||||
clientAsyncData.sourceData.states[code] = loadSate.yes; | |||||
} | |||||
}); | |||||
}, | |||||
find: function (key, keyId, data) { | |||||
var res = {}; | |||||
for (var i = 0, l = data.length; i < l; i++) { | |||||
if (data[i][keyId] == key) { | |||||
res = data[i]; | |||||
break; | |||||
} | |||||
} | |||||
return res; | |||||
} | |||||
}; | |||||
// 获取自定义数据 url key valueId | |||||
clientAsyncData.custmerData = { | |||||
states: {}, | |||||
get: function (op) { | |||||
if (clientAsyncData.custmerData.states[op.url] == undefined || clientAsyncData.custmerData.states[op.url] == loadSate.no || op.sync == true) { | |||||
clientAsyncData.custmerData.states[op.url] = loadSate.ing; | |||||
if (!!op.sync) { | |||||
clientAsyncData.custmerData.loadsync(op.url, op); | |||||
} else { | |||||
clientAsyncData.custmerData.load(op.url); | |||||
} | |||||
} | |||||
if (clientAsyncData.custmerData.states[op.url] == loadSate.ing) { | |||||
setTimeout(function () { | |||||
clientAsyncData.custmerData.get(op); | |||||
}, 100);// 如果还在加载100ms后再检测 | |||||
} | |||||
else { | |||||
var data = clientData[op.url] || []; | |||||
if (!!data) { | |||||
op.callback(clientAsyncData.custmerData.find(op.key, op.keyId, data) || {}, op); | |||||
} else { | |||||
op.callback({}, op); | |||||
} | |||||
} | |||||
}, | |||||
gets: function (op) { | |||||
if (clientAsyncData.custmerData.states[op.url] == undefined || clientAsyncData.custmerData.states[op.url] == loadSate.no) { | |||||
clientAsyncData.custmerData.states[op.url] = loadSate.ing; | |||||
clientAsyncData.custmerData.load(op.url); | |||||
} | |||||
if (clientAsyncData.custmerData.states[op.url] == loadSate.ing) { | |||||
setTimeout(function () { | |||||
clientAsyncData.custmerData.get(op); | |||||
}, 100);// 如果还在加载100ms后再检测 | |||||
} | |||||
else { | |||||
var data = clientData[op.url] || []; | |||||
if (!!data) { | |||||
var keyList = op.key.split(','); | |||||
var _text = [] | |||||
$.each(keyList, function (_index, _item) { | |||||
var _item = clientAsyncData.custmerData.find(op.key, op.keyId, data) || {}; | |||||
if (_item[op.textId]) { | |||||
_text.push(_item[op.textId]); | |||||
} | |||||
}); | |||||
op.callback(String(_text), op); | |||||
} else { | |||||
op.callback('', op); | |||||
} | |||||
} | |||||
}, | |||||
getAll: function (op) { | |||||
if (clientAsyncData.custmerData.states[op.url] == undefined || clientAsyncData.custmerData.states[op.url] == loadSate.no) { | |||||
clientAsyncData.custmerData.states[op.url] = loadSate.ing; | |||||
clientAsyncData.custmerData.load(op.url); | |||||
} | |||||
if (clientAsyncData.custmerData.states[op.url] == loadSate.ing) { | |||||
setTimeout(function () { | |||||
clientAsyncData.custmerData.get(op); | |||||
}, 100);// 如果还在加载100ms后再检测 | |||||
} | |||||
else { | |||||
var data = clientData[op.url] || []; | |||||
if (!!data) { | |||||
op.callback(data, op); | |||||
} else { | |||||
op.callback([], op); | |||||
} | |||||
} | |||||
}, | |||||
load: function (url) { | |||||
learun.httpAsync('GET', top.$.rootUrl + url, {}, function (data) { | |||||
if (!!data) { | |||||
clientData[url] = data; | |||||
} | |||||
clientAsyncData.custmerData.states[url] = loadSate.yes; | |||||
}); | |||||
}, | |||||
loadsync: function (url, op) { | |||||
learun.httpSync('GET', top.$.rootUrl + url, {}, function (data) { | |||||
if (!!data) { | |||||
clientAsyncData.custmerData.states[url] = loadSate.yes; | |||||
clientData[url] = data; | |||||
op.callback(clientAsyncData.custmerData.find(op.key, op.keyId, data) || {}, op); | |||||
} else { | |||||
op.callback({}, op); | |||||
} | |||||
}); | |||||
}, | |||||
find: function (key, keyId, data) { | |||||
var res = {}; | |||||
for (var i = 0, l = data.length; i < l; i++) { | |||||
if (data[i][keyId] == key) { | |||||
res = data[i]; | |||||
break; | |||||
} | |||||
} | |||||
return res; | |||||
} | |||||
}; | |||||
//桌面 | |||||
clientAsyncData.desktop = { | |||||
states: loadSate.no, | |||||
init: function () { | |||||
if (clientAsyncData.desktop.states == loadSate.no) { | |||||
clientAsyncData.desktop.states = loadSate.ing; | |||||
var j = "";//storage.get("desktopData").ver || ""; | |||||
learun.httpAsync("GET", | |||||
top.$.rootUrl + "/LR_Desktop/DTTarget/GetMap", | |||||
{ | |||||
ver: j | |||||
}, | |||||
function (k) { | |||||
if (!k) { | |||||
clientAsyncData.desktop.states = loadSate.fail; | |||||
} else { | |||||
if (k.ver) { | |||||
data1 = k; | |||||
//storage.set("desktopData", k); | |||||
} | |||||
clientAsyncData.desktop.states = loadSate.yes; | |||||
clientAsyncData.department.init(); | |||||
} | |||||
}); | |||||
} | |||||
}, get: function (k) { | |||||
clientAsyncData.desktop.init(); | |||||
if (clientAsyncData.desktop.states == loadSate.ing) { | |||||
setTimeout(function () { | |||||
clientAsyncData.desktop.get(k); | |||||
}, 100) | |||||
} else { | |||||
var j = data1 || {};//storage.get("desktopData").data || {}; | |||||
k.callback(j || {}, k); | |||||
} | |||||
} | |||||
} | |||||
})(window.jQuery, top.learun); |
@@ -0,0 +1,29 @@ | |||||
using Learun.Application.TwoDevelopment.CustomFunction; | |||||
using System.Data.Entity.ModelConfiguration; | |||||
namespace Learun.Application.Mapping | |||||
{ | |||||
/// <summary> | |||||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||||
/// 创 建:超级管理员 | |||||
/// 日 期:2021-09-15 17:10 | |||||
/// 描 述:项目人员管理 | |||||
/// </summary> | |||||
public class SRProjectPeopleMap : EntityTypeConfiguration<SRProjectPeopleEntity> | |||||
{ | |||||
public SRProjectPeopleMap() | |||||
{ | |||||
#region 表、主键 | |||||
//表 | |||||
this.ToTable("SRPROJECTPEOPLE"); | |||||
//主键 | |||||
this.HasKey(t => t.ID); | |||||
#endregion | |||||
#region 配置关系 | |||||
#endregion | |||||
} | |||||
} | |||||
} | |||||
@@ -583,6 +583,7 @@ | |||||
<Compile Include="EducationalAdministration\StuSubsideManageMap.cs" /> | <Compile Include="EducationalAdministration\StuSubsideManageMap.cs" /> | ||||
<Compile Include="EducationalAdministration\DispatchAuditMap.cs" /> | <Compile Include="EducationalAdministration\DispatchAuditMap.cs" /> | ||||
<Compile Include="CustomFunction\SRProjectBasicMap.cs" /> | <Compile Include="CustomFunction\SRProjectBasicMap.cs" /> | ||||
<Compile Include="CustomFunction\SRProjectPeopleMap.cs" /> | |||||
</ItemGroup> | </ItemGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
<ProjectReference Include="..\..\..\Learun.Application.Organization\Learun.Application.Organization.csproj"> | <ProjectReference Include="..\..\..\Learun.Application.Organization\Learun.Application.Organization.csproj"> | ||||
@@ -42,7 +42,29 @@ namespace Learun.Application.TwoDevelopment.CustomFunction | |||||
} | } | ||||
} | } | ||||
} | } | ||||
/// <summary> | |||||
/// 获取页面显示列表数据 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
public IEnumerable<SRProjectBasicEntity> GetList() | |||||
{ | |||||
try | |||||
{ | |||||
return sRProjectBasicService.GetList(); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowBusinessException(ex); | |||||
} | |||||
} | |||||
} | |||||
/// <summary> | /// <summary> | ||||
/// 获取SRProjectBasic表实体数据 | /// 获取SRProjectBasic表实体数据 | ||||
/// </summary> | /// </summary> | ||||
@@ -21,6 +21,7 @@ namespace Learun.Application.TwoDevelopment.CustomFunction | |||||
/// <param name="queryJson">查询参数</param> | /// <param name="queryJson">查询参数</param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
IEnumerable<SRProjectBasicEntity> GetPageList(Pagination pagination, string queryJson); | IEnumerable<SRProjectBasicEntity> GetPageList(Pagination pagination, string queryJson); | ||||
IEnumerable<SRProjectBasicEntity> GetList(); | |||||
/// <summary> | /// <summary> | ||||
/// 获取SRProjectBasic表实体数据 | /// 获取SRProjectBasic表实体数据 | ||||
/// </summary> | /// </summary> | ||||
@@ -89,6 +89,29 @@ namespace Learun.Application.TwoDevelopment.CustomFunction | |||||
} | } | ||||
} | } | ||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
public IEnumerable<SRProjectBasicEntity> GetList() | |||||
{ | |||||
try | |||||
{ | |||||
return this.BaseRepository("CollegeMIS").FindList<SRProjectBasicEntity>(); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowServiceException(ex); | |||||
} | |||||
} | |||||
} | |||||
/// <summary> | /// <summary> | ||||
/// 获取SRProjectBasic表实体数据 | /// 获取SRProjectBasic表实体数据 | ||||
/// </summary> | /// </summary> | ||||
@@ -0,0 +1,125 @@ | |||||
using Learun.Util; | |||||
using System; | |||||
using System.Data; | |||||
using System.Collections.Generic; | |||||
namespace Learun.Application.TwoDevelopment.CustomFunction | |||||
{ | |||||
/// <summary> | |||||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||||
/// 创 建:超级管理员 | |||||
/// 日 期:2021-09-15 17:10 | |||||
/// 描 述:项目人员管理 | |||||
/// </summary> | |||||
public class SRProjectPeopleBLL : SRProjectPeopleIBLL | |||||
{ | |||||
private SRProjectPeopleService sRProjectPeopleService = new SRProjectPeopleService(); | |||||
#region 获取数据 | |||||
/// <summary> | |||||
/// 获取页面显示列表数据 | |||||
/// </summary> | |||||
/// <param name="pagination">分页参数</param> | |||||
/// <param name="queryJson">查询参数</param> | |||||
/// <returns></returns> | |||||
public IEnumerable<SRProjectPeopleEntity> GetPageList(Pagination pagination, string queryJson) | |||||
{ | |||||
try | |||||
{ | |||||
return sRProjectPeopleService.GetPageList(pagination, queryJson); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowBusinessException(ex); | |||||
} | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 获取SRProjectPeople表实体数据 | |||||
/// </summary> | |||||
/// <param name="keyValue">主键</param> | |||||
/// <returns></returns> | |||||
public SRProjectPeopleEntity GetSRProjectPeopleEntity(string keyValue) | |||||
{ | |||||
try | |||||
{ | |||||
return sRProjectPeopleService.GetSRProjectPeopleEntity(keyValue); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowBusinessException(ex); | |||||
} | |||||
} | |||||
} | |||||
#endregion | |||||
#region 提交数据 | |||||
/// <summary> | |||||
/// 删除实体数据 | |||||
/// </summary> | |||||
/// <param name="keyValue">主键</param> | |||||
public void DeleteEntity(string keyValue) | |||||
{ | |||||
try | |||||
{ | |||||
sRProjectPeopleService.DeleteEntity(keyValue); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowBusinessException(ex); | |||||
} | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 保存实体数据(新增、修改) | |||||
/// </summary> | |||||
/// <param name="keyValue">主键</param> | |||||
/// <param name="entity">实体</param> | |||||
/// <returns></returns> | |||||
public void SaveEntity(string keyValue, SRProjectPeopleEntity entity) | |||||
{ | |||||
try | |||||
{ | |||||
sRProjectPeopleService.SaveEntity(keyValue, entity); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowBusinessException(ex); | |||||
} | |||||
} | |||||
} | |||||
#endregion | |||||
} | |||||
} |
@@ -0,0 +1,75 @@ | |||||
using Learun.Util; | |||||
using System; | |||||
using System.ComponentModel.DataAnnotations.Schema; | |||||
namespace Learun.Application.TwoDevelopment.CustomFunction | |||||
{ | |||||
/// <summary> | |||||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||||
/// 创 建:超级管理员 | |||||
/// 日 期:2021-09-15 17:10 | |||||
/// 描 述:项目人员管理 | |||||
/// </summary> | |||||
public class SRProjectPeopleEntity | |||||
{ | |||||
#region 实体成员 | |||||
/// <summary> | |||||
/// ID | |||||
/// </summary> | |||||
[Column("ID")] | |||||
public string ID { get; set; } | |||||
/// <summary> | |||||
/// 项目基本信息Id | |||||
/// </summary> | |||||
[Column("SRPROJECTBASICID")] | |||||
public string SRProjectBasicId { get; set; } | |||||
/// <summary> | |||||
/// 项目负责人 | |||||
/// </summary> | |||||
[Column("MANAGENAME")] | |||||
public string ManageName { get; set; } | |||||
/// <summary> | |||||
/// 项目成员 | |||||
/// </summary> | |||||
[Column("PLAYERS")] | |||||
public string Players { get; set; } | |||||
/// <summary> | |||||
/// 创建人 | |||||
/// </summary> | |||||
[Column("CREATEUSERID")] | |||||
public string CreateUserId { get; set; } | |||||
/// <summary> | |||||
/// 创建人 | |||||
/// </summary> | |||||
[Column("CREATEUSERNAME")] | |||||
public string CreateUserName { get; set; } | |||||
/// <summary> | |||||
/// CreateTime | |||||
/// </summary> | |||||
[Column("CREATETIME")] | |||||
public DateTime? CreateTime { get; set; } | |||||
#endregion | |||||
#region 扩展操作 | |||||
/// <summary> | |||||
/// 新增调用 | |||||
/// </summary> | |||||
public void Create() | |||||
{ | |||||
this.ID = Guid.NewGuid().ToString(); | |||||
} | |||||
/// <summary> | |||||
/// 编辑调用 | |||||
/// </summary> | |||||
/// <param name="keyValue"></param> | |||||
public void Modify(string keyValue) | |||||
{ | |||||
this.ID = keyValue; | |||||
} | |||||
#endregion | |||||
#region 扩展字段 | |||||
#endregion | |||||
} | |||||
} | |||||
@@ -0,0 +1,48 @@ | |||||
using Learun.Util; | |||||
using System.Data; | |||||
using System.Collections.Generic; | |||||
namespace Learun.Application.TwoDevelopment.CustomFunction | |||||
{ | |||||
/// <summary> | |||||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||||
/// 创 建:超级管理员 | |||||
/// 日 期:2021-09-15 17:10 | |||||
/// 描 述:项目人员管理 | |||||
/// </summary> | |||||
public interface SRProjectPeopleIBLL | |||||
{ | |||||
#region 获取数据 | |||||
/// <summary> | |||||
/// 获取页面显示列表数据 | |||||
/// </summary> | |||||
/// <param name="queryJson">查询参数</param> | |||||
/// <returns></returns> | |||||
IEnumerable<SRProjectPeopleEntity> GetPageList(Pagination pagination, string queryJson); | |||||
/// <summary> | |||||
/// 获取SRProjectPeople表实体数据 | |||||
/// </summary> | |||||
/// <param name="keyValue">主键</param> | |||||
/// <returns></returns> | |||||
SRProjectPeopleEntity GetSRProjectPeopleEntity(string keyValue); | |||||
#endregion | |||||
#region 提交数据 | |||||
/// <summary> | |||||
/// 删除实体数据 | |||||
/// </summary> | |||||
/// <param name="keyValue">主键</param> | |||||
void DeleteEntity(string keyValue); | |||||
/// <summary> | |||||
/// 保存实体数据(新增、修改) | |||||
/// </summary> | |||||
/// <param name="keyValue">主键</param> | |||||
/// <param name="entity">实体</param> | |||||
void SaveEntity(string keyValue, SRProjectPeopleEntity entity); | |||||
#endregion | |||||
} | |||||
} |
@@ -0,0 +1,157 @@ | |||||
using Dapper; | |||||
using Learun.DataBase.Repository; | |||||
using Learun.Util; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Data; | |||||
using System.Text; | |||||
namespace Learun.Application.TwoDevelopment.CustomFunction | |||||
{ | |||||
/// <summary> | |||||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||||
/// 创 建:超级管理员 | |||||
/// 日 期:2021-09-15 17:10 | |||||
/// 描 述:项目人员管理 | |||||
/// </summary> | |||||
public class SRProjectPeopleService : RepositoryFactory | |||||
{ | |||||
#region 获取数据 | |||||
/// <summary> | |||||
/// 获取页面显示列表数据 | |||||
/// </summary> | |||||
/// <param name="pagination">查询参数</param> | |||||
/// <param name="queryJson">查询参数</param> | |||||
/// <returns></returns> | |||||
public IEnumerable<SRProjectPeopleEntity> GetPageList(Pagination pagination, string queryJson) | |||||
{ | |||||
try | |||||
{ | |||||
var strSql = new StringBuilder(); | |||||
strSql.Append("SELECT "); | |||||
strSql.Append(@" | |||||
t.ID, | |||||
t.SRProjectBasicId, | |||||
t.ManageName, | |||||
t.Players | |||||
"); | |||||
strSql.Append(" FROM SRProjectPeople t "); | |||||
strSql.Append(" WHERE 1=1 "); | |||||
var queryParam = queryJson.ToJObject(); | |||||
// 虚拟参数 | |||||
var dp = new DynamicParameters(new { }); | |||||
if (!queryParam["SRProjectBasicId"].IsEmpty()) | |||||
{ | |||||
dp.Add("SRProjectBasicId",queryParam["SRProjectBasicId"].ToString(), DbType.String); | |||||
strSql.Append(" AND t.SRProjectBasicId = @SRProjectBasicId "); | |||||
} | |||||
if (!queryParam["ManageName"].IsEmpty()) | |||||
{ | |||||
dp.Add("ManageName",queryParam["ManageName"].ToString(), DbType.String); | |||||
strSql.Append(" AND t.ManageName = @ManageName "); | |||||
} | |||||
return this.BaseRepository("CollegeMIS").FindList<SRProjectPeopleEntity>(strSql.ToString(),dp, pagination); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowServiceException(ex); | |||||
} | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 获取SRProjectPeople表实体数据 | |||||
/// </summary> | |||||
/// <param name="keyValue">主键</param> | |||||
/// <returns></returns> | |||||
public SRProjectPeopleEntity GetSRProjectPeopleEntity(string keyValue) | |||||
{ | |||||
try | |||||
{ | |||||
return this.BaseRepository("CollegeMIS").FindEntity<SRProjectPeopleEntity>(keyValue); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowServiceException(ex); | |||||
} | |||||
} | |||||
} | |||||
#endregion | |||||
#region 提交数据 | |||||
/// <summary> | |||||
/// 删除实体数据 | |||||
/// </summary> | |||||
/// <param name="keyValue">主键</param> | |||||
public void DeleteEntity(string keyValue) | |||||
{ | |||||
try | |||||
{ | |||||
this.BaseRepository("CollegeMIS").Delete<SRProjectPeopleEntity>(t=>t.ID == keyValue); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowServiceException(ex); | |||||
} | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 保存实体数据(新增、修改) | |||||
/// </summary> | |||||
/// <param name="keyValue">主键</param> | |||||
/// <param name="entity">实体</param> | |||||
public void SaveEntity(string keyValue, SRProjectPeopleEntity entity) | |||||
{ | |||||
try | |||||
{ | |||||
if (!string.IsNullOrEmpty(keyValue)) | |||||
{ | |||||
entity.Modify(keyValue); | |||||
this.BaseRepository("CollegeMIS").Update(entity); | |||||
} | |||||
else | |||||
{ | |||||
entity.Create(); | |||||
this.BaseRepository("CollegeMIS").Insert(entity); | |||||
} | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowServiceException(ex); | |||||
} | |||||
} | |||||
} | |||||
#endregion | |||||
} | |||||
} |
@@ -1746,6 +1746,10 @@ | |||||
<Compile Include="CustomFunction\SRProjectBasic\SRProjectBasicService.cs" /> | <Compile Include="CustomFunction\SRProjectBasic\SRProjectBasicService.cs" /> | ||||
<Compile Include="CustomFunction\SRProjectBasic\SRProjectBasicBLL.cs" /> | <Compile Include="CustomFunction\SRProjectBasic\SRProjectBasicBLL.cs" /> | ||||
<Compile Include="CustomFunction\SRProjectBasic\SRProjectBasicIBLL.cs" /> | <Compile Include="CustomFunction\SRProjectBasic\SRProjectBasicIBLL.cs" /> | ||||
<Compile Include="CustomFunction\SRProjectPeople\SRProjectPeopleEntity.cs" /> | |||||
<Compile Include="CustomFunction\SRProjectPeople\SRProjectPeopleService.cs" /> | |||||
<Compile Include="CustomFunction\SRProjectPeople\SRProjectPeopleBLL.cs" /> | |||||
<Compile Include="CustomFunction\SRProjectPeople\SRProjectPeopleIBLL.cs" /> | |||||
</ItemGroup> | </ItemGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
<ProjectReference Include="..\..\..\Learun.Application.Organization\Learun.Application.Organization.csproj"> | <ProjectReference Include="..\..\..\Learun.Application.Organization\Learun.Application.Organization.csproj"> | ||||