Преглед на файлове

• 工资记录表加多条件查询

• 我的工资加导出
工资记录表开发导入功能
大厂分支
zhichao lei преди 4 години
родител
ревизия
1507946cd4
променени са 19 файла, в които са добавени 770 реда и са изтрити 11 реда
  1. +25
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Organization/User/UserBLL.cs
  2. +6
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Organization/User/UserIBLL.cs
  3. +34
    -10
      Learun.Framework.Ultimate V7/Learun.Application.Organization/User/UserService.cs
  4. +30
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/ExcelImportController.cs
  5. +1
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/ExcelExport/Index.js
  6. +52
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/Sal_UserSalaryController.cs
  7. +25
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/ImportForm.cshtml
  8. +136
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/ImportForm.css
  9. +242
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/ImportForm.js
  10. +14
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/Index.cshtml
  11. +49
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/Index.js
  12. +4
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/IndexOfMy.cshtml
  13. +30
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/IndexOfMy.js
  14. +3
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj
  15. +4
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/script/lr-clientdata.js
  16. +104
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Excel/Import/ExcelImportBLL.cs
  17. +1
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Excel/Import/ExcelImportIBLL.cs
  18. +4
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Excel/Learun.Application.Excel.csproj
  19. +6
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/Sal_UserSalary/Sal_UserSalaryService.cs

+ 25
- 0
Learun.Framework.Ultimate V7/Learun.Application.Organization/User/UserBLL.cs Целия файл

@@ -407,6 +407,31 @@ namespace Learun.Application.Organization
}
}
}
/// <summary>
/// 获取实体,通过用户名
/// </summary>
/// <param name="account">用户账号</param>
/// <returns></returns>
public UserEntity GetEntityByName(string name)
{
try
{
UserEntity userEntity;
userEntity = userService.GetEntityByName(name);
return userEntity;
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowBusinessException(ex);
}
}
}

public void UpdateIp(string ip, string id)
{


+ 6
- 0
Learun.Framework.Ultimate V7/Learun.Application.Organization/User/UserIBLL.cs Целия файл

@@ -76,6 +76,12 @@ namespace Learun.Application.Organization
/// <returns></returns>
UserEntity GetEntityByAccount(string account);
/// <summary>
/// 获取实体,通过用户名
/// </summary>
/// <param name="account">用户账号</param>
/// <returns></returns>
UserEntity GetEntityByName(string account);
/// <summary>
/// 获取用户数据
/// </summary>
/// <param name="userId">用户主键</param>


+ 34
- 10
Learun.Framework.Ultimate V7/Learun.Application.Organization/User/UserService.cs Целия файл

@@ -55,6 +55,30 @@ namespace Learun.Application.Organization
}
}
/// <summary>
/// 获取实体,通过用户账号
/// </summary>
/// <param name="account">用户账号</param>
/// <returns></returns>
public UserEntity GetEntityByName(string name)
{
try
{
return this.BaseRepository()
.FindEntity<UserEntity>(a => a.F_RealName.Equals(name) && a.F_DeleteMark == 0);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}
/// <summary>
/// 用户列表(根据公司主键)
/// </summary>
/// <param name="companyId">公司主键</param>
@@ -81,7 +105,7 @@ namespace Learun.Application.Organization
}
}
}
internal bool GetStuAny()
internal bool GetStuAny()
{
try
{
@@ -557,7 +581,7 @@ namespace Learun.Application.Organization
{
try
{
return this.BaseRepository().FindList<UserEntity>(a=>a.F_DepartmentId==departmentId).ToList();
return this.BaseRepository().FindList<UserEntity>(a => a.F_DepartmentId == departmentId).ToList();
}
catch (Exception ex)
{
@@ -576,7 +600,7 @@ namespace Learun.Application.Organization
try
{
var ids = departmentId.Split(',');
return this.BaseRepository().FindList<UserEntity>(a=> ids.Contains(a.F_DepartmentId)).ToList();
return this.BaseRepository().FindList<UserEntity>(a => ids.Contains(a.F_DepartmentId)).ToList();
}
catch (Exception ex)
{
@@ -590,7 +614,7 @@ namespace Learun.Application.Organization
}
}
}


/// <summary>
@@ -798,14 +822,14 @@ namespace Learun.Application.Organization
string path = "";
try
{
var userentity=BaseRepository().FindEntity<UserEntity>("select a.*,b.Photo from LR_Base_User a " +
"left join "+BaseRepository("CollegeMIS").getDbConnection().Database+
".dbo.empinfo b on a.F_Account=b.empno where a.F_UserId='"+userid+"'", null);
if (userentity!=null&&!string.IsNullOrEmpty(userentity.Photo))
var userentity = BaseRepository().FindEntity<UserEntity>("select a.*,b.Photo from LR_Base_User a " +
"left join " + BaseRepository("CollegeMIS").getDbConnection().Database +
".dbo.empinfo b on a.F_Account=b.empno where a.F_UserId='" + userid + "'", null);
if (userentity != null && !string.IsNullOrEmpty(userentity.Photo))
{
//获取图片
var LR_Base_AnnexesFile = BaseRepository().FindEntity<dynamic>("select * from LR_Base_AnnexesFile where F_FolderId='"+ userentity.Photo + "'", null);
if (LR_Base_AnnexesFile!=null)
var LR_Base_AnnexesFile = BaseRepository().FindEntity<dynamic>("select * from LR_Base_AnnexesFile where F_FolderId='" + userentity.Photo + "'", null);
if (LR_Base_AnnexesFile != null)
{
path = LR_Base_AnnexesFile.F_FilePath;
}


+ 30
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/ExcelImportController.cs Целия файл

@@ -226,6 +226,36 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers
return Fail("导入数据失败!");
}
}
/// <summary>
/// 工资导入
/// </summary>
/// <param name="templateId">模板Id</param>
/// <param name="fileId">文件主键</param>
/// <param name="chunks">分片数</param>
/// <param name="ext">文件扩展名</param>
/// <returns></returns>
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult ExecuteImportSaralExcel(string fileId, int chunks,string ext)
{
UserInfo userInfo = LoginUserInfo.Get();
string path = annexesFileIBLL.SaveAnnexes(fileId, fileId + "."+ ext, chunks, userInfo);
if (!string.IsNullOrEmpty(path))
{
DataTable dt = ExcelHelper.ExcelImport(path);
string res = excelImportIBLL.ImportSalaryInfo(dt,fileId);
var data = new
{
Success = res.Split('|')[0],
Fail = res.Split('|')[1]
};
return JsonResult(data);
}
else
{
return Fail("导入数据失败!");
}
}

/// <summary>
/// 下载文件(导入文件未被导入的数据)


+ 1
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/ExcelExport/Index.js Целия файл

@@ -24,6 +24,7 @@ var bootstrap = function ($, learun) {
}
else {
moduleId = item.id;
page.search();
}
$('#titleinfo').text(item.text);
}


+ 52
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/Sal_UserSalaryController.cs Целия файл

@@ -4,6 +4,7 @@ using System.Data;
using Learun.Application.TwoDevelopment.PersonnelManagement;
using System.Web.Mvc;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;

namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers
@@ -42,6 +43,15 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers
return View();
}
/// <summary>
/// 工资导入
/// <summary>
/// <returns></returns>
[HttpGet]
public ActionResult ImportForm()
{
return View();
}
/// <summary>
/// 表单页
/// <summary>
/// <returns></returns>
@@ -256,5 +266,47 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers
}
#endregion

#region 获取模板

/// <summary>
/// 下载工资导入模板
/// </summary>
[HttpPost]
[ValidateAntiForgeryToken]
public void DownTemplate()
{
//设置导出格式
ExcelConfig excelConfig=new ExcelConfig();
excelConfig.FileName = "工资导入模板.xls";
excelConfig.IsAllSizeColumn = true;
excelConfig.ColumnEntity=new List<ColumnModel>();
//获取工资列
var itemList = sal_UserSalaryIBLL.GetAllTemplateInfo();
//表头
DataTable dt=new DataTable();
excelConfig.ColumnEntity.Add(new ColumnModel()
{
Column = "姓名",
ExcelColumn = "姓名",
Alignment = "center",
Background = new Color()
});
dt.Columns.Add("姓名", typeof(string));
foreach (var item in itemList)
{
excelConfig.ColumnEntity.Add(new ColumnModel()
{
Column = item.STIName,
ExcelColumn = item.STIName,
Alignment = "center",
Background = new Color()
});
dt.Columns.Add(item.STIName, typeof(string));
}
ExcelHelper.ExcelDownload(dt, excelConfig);

}
#endregion

}
}

+ 25
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/ImportForm.cshtml Целия файл

@@ -0,0 +1,25 @@
@{
ViewBag.Title = "Form";
Layout = "~/Views/Shared/_Form.cshtml";
}
<link href="~/Content/webuploader/webuploader.css" rel="stylesheet" />
<script src="~/Content/webuploader/webuploader.nolog.min.js"></script>
@Html.AppendCssFile("/Areas/PersonnelManagement/Views/Sal_UserSalary/ImportForm.css")

<div class="lr-form-layout lr-form-layout-top-bottom">
<div class="lr-form-layout-header">
<div id="lr_add_file_btn"><i class="fa fa-cloud-upload"></i><span class="lrlt">上传文件</span></div>
<div class="webuploader-pick" id="lr_down_file_btn"><i class="fa fa-download"></i><span class="lrlt">下载模板</span></div>
</div>
<div class="lr-form-layout-body">
<div class="lr-form-file-queue-wrap" id="lr_form_file_queue">
<div class="lr-form-file-queue" id="lr_form_file_queue_list">

</div>
<div class="lr-form-file-queue-bg">
<h1><span class="lrlt">试试将电脑里的文件拖拽到此上传</span></h1>
</div>
</div>
</div>
</div>
@Html.AppendJsFile("/Areas/PersonnelManagement/Views/Sal_UserSalary/ImportForm.js")

+ 136
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/ImportForm.css Целия файл

@@ -0,0 +1,136 @@
.lr-form-layout-body {
padding:0 5px 5px 5px;
}
.lr-form-file-queue-wrap {
position:relative;
width:100%;
height:100%;
border:1px solid #ddd;
border-radius:4px;
}
.lr-form-file-queue {
position:relative;
}
.lr-form-file-queue {
position:relative;
}
.lr-form-file-queue-item {
position:relative;
width:100%;
height:50px;
border-bottom:1px solid #ddd;
padding-left:60px;

}
.lr-file-image {
position:absolute;
top:5px;
left:5px;
}
.lr-file-image img {
width:40px;
height:40px;
}
.lr-file-name{
line-height:50px;

}
.lr-msg {
position:absolute;
top:0;
right:5px;
font-size: 25px;
line-height:50px;
}
.lr-msg .fa-check-circle{
color: #5cb85c;
}
.lr-msg .fa-exclamation-circle {
color: #b94a48;
}
.lr-msg2 {
position:absolute;
top:0;
right:5px;
line-height:50px;
}
.lr-msg2 span {
color:#333;
font-size:14px;
margin-right:5px;
}

.lr-tool-bar {
position:absolute;
top:0;
right:35px;
font-size: 25px;
line-height:50px;
color:#666;
cursor:pointer;
}
.lr-tool-bar > i {
margin-left:8px;
}

.lr-tool-bar .fa-minus-circle {
color: #b94a48;
}
.lr-tool-bar .fa-cloud-download {
color: #3498db;
}

.lr-uploader-progress {
position:absolute;
bottom:2px;
left:60px;
height:4px;
width:500px;
width:calc(100% - 90px);
}
.lr-uploader-progress-bar {
position:relative;
height:100%;
background-color:#039cfd;
border-radius:4px;
}


.lr-form-file-queue-bg {
position:absolute;
top:50%;
left:50%;
width:300px;
height:30px;
line-height:30px;
margin:-15px 0 0 -150px;
}
.lr-form-file-queue-bg h1 {
color: #666;
font-size: 20px;
font-family: Microsoft Yahei;
padding-bottom: 2px;
margin: 0;
}
#lr_down_file_btn {
position:absolute;
right:5px;
background:#fff;
border:1px solid #ddd;
color:#333;
}
#lr_down_file_btn:hover {
color:#337ab7;
}
/*对百度插件的样式重写*/
.webuploader-container {
position:absolute;
}
.webuploader-pick {
padding:8px 15px;
background-color:#039cfd;
}
.webuploader-pick-hover {
background-color:#027dcb;
}

+ 242
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/ImportForm.js Целия файл

@@ -0,0 +1,242 @@
/*
* 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
* Copyright (c) 2013-2018 北京泉江科技有限公司
* 创建人:陈彬彬
* 日 期:2017.04.11
* 描 述:导入Excel
*/
var id = request('id');

var keyVaule = '';

var bootstrap = function ($, learun) {
"use strict";

var page1 = {
init: function () {
page.bind();
page.initData();
},
bind: function () {
$('#lr_add_format').on('click', function () {
currentColRow = null;
learun.layerForm({
id: 'FormatForm',
title: '添加',
url: top.$.rootUrl + '/LR_SystemModule/CodeRule/FormatForm',
width: 450,
height: 310,
callBack: function (id) {
return top[id].acceptClick(function (data) {
$('#gridtable').jfGridSet('addRow', { row: data });
});
}
});
});
$('#lr_edit_format').on('click', function () {
currentColRow = $('#gridtable').jfGridGet('rowdata');
var _id = currentColRow ? currentColRow.itemTypeName : '';
if (learun.checkrow(_id)) {
learun.layerForm({
id: 'FormatForm',
title: '修改',
url: top.$.rootUrl + '/LR_SystemModule/CodeRule/FormatForm',
width: 450,
height: 310,
callBack: function (id) {
return top[id].acceptClick(function (data) {
$('#gridtable').jfGridSet('updateRow', { row: data });
});
}
});
}

});
$('#lr_delete_format').on('click', function () {
currentColRow = null;
var row = $('#gridtable').jfGridGet('rowdata');
var _id = row ? row.itemTypeName : '';
if (learun.checkrow(_id)) {
learun.layerConfirm('是否确认删除该项!', function (res, index) {
if (res) {
$('#gridtable').jfGridSet('removeRow');
top.layer.close(index); //再执行关闭
}
});
}
});

$('#gridtable').jfGrid({
headData: [
{ label: "前缀", name: "itemTypeName", width: 120, align: "left" },
{ label: "格式", name: "formatStr", width: 120, align: "left" },
{ label: "步长", name: "stepValue", width: 100, align: "left" },
{ label: "初始值", name: "initValue", width: 120, align: "left" },
{ label: "说明", name: "description", width: 180, align: "left" }
]
});

/*检测重复项*/
$('#F_EnCode').on('blur', function () {
$.lrExistField(keyValue, 'F_EnCode', top.$.rootUrl + '/LR_SystemModule/CodeRule/ExistEnCode');
});
$('#F_FullName').on('blur', function () {
$.lrExistField(keyValue, 'F_FullName', top.$.rootUrl + '/LR_SystemModule/CodeRule/ExistFullName');
});
},
initData: function () {
if (!!selectedRow) {
keyValue = selectedRow.F_RuleId;
$('#form').lrSetFormData(selectedRow);
var formatdata = JSON.parse(selectedRow.F_RuleFormatJson);
$('#gridtable').jfGridSet('refreshdata', formatdata);
}
}
};

var fileInfo = {};

// 触发合并文件碎片
var mergeFileChunks = function (file) {

var param = {};
param['__RequestVerificationToken'] = $.lrToken;
param['fileId'] = fileInfo[file.id].fileGuid;
param['chunks'] = fileInfo[file.id].chunks;
param['ext'] = file.ext;
param['templateId'] = id;
learun.httpAsyncPost(top.$.rootUrl + "/LR_SystemModule/ExcelImport/ExecuteImportSaralExcel", param, function (res) {
var $fileItem = $('#lr_form_file_queue_list').find('#lr_filequeue_' + file.id);
$fileItem.find('.lr-uploader-progress').remove();
if (res.code == learun.httpCode.success) {
if (res.data.Success != '0') {
learun.alert.success('导入成功' + res.data.Success + '条');
}
// 文件保存成功后
$fileItem.append('<div class="lr-msg2"><span>' + res.data.Success + '</span><span>/</span><span style="color:#b94a48;" >' + res.data.Fail + '</span></div>');
// 如果有失败
if (res.data.Fail != '0')
{
learun.download({ url: top.$.rootUrl + '/LR_SystemModule/ExcelImport/DownImportErrorFile', param: { fileId: fileInfo[file.id].fileGuid, fileName: fileInfo[file.id].name, __RequestVerificationToken: $.lrToken }, method: 'POST' });
}
}
else {
$fileItem.append('<div class="lr-msg"><i class="fa fa-exclamation-circle"></i></div>');
}
});
}
// 触发清楚文件碎片
var reomveFileChunks = function (file) {
var param = {};
param['__RequestVerificationToken'] = $.lrToken;
param['fileGuid'] = fileInfo[file.id].fileGuid;
param['chunks'] = fileInfo[file.id].chunks;
learun.httpAsyncPost(top.$.rootUrl + "/LR_SystemModule/Annexes/MergeAnnexesFile", param, function (res) { });
var $fileItem = $('#lr_form_file_queue_list').find('#lr_filequeue_' + file.id);
$fileItem.find('.lr-uploader-progress').remove();
$fileItem.append('<div class="lr-msg"><i class="fa fa-exclamation-circle"></i></div>');
}

var page = {
uploader: null,
init: function () {
/*模板下载*/
$('#lr_down_file_btn').on('click', function () {
learun.download({ url: top.$.rootUrl + '/PersonnelManagement/Sal_UserSalary/DownTemplate', param: { keyValue: id, __RequestVerificationToken: $.lrToken }, method: 'POST' });
});


if (!WebUploader.Uploader.support()) {
alert('Web Uploader 不支持您的浏览器!如果你使用的是IE浏览器,请尝试升级 flash 播放器');
throw new Error('WebUploader does not support the browser you are using.');
}

page.uploader = WebUploader.create({
auto: true,
swf: top.$.rootUrl + '/Content/webuploader/Uploader.swf',
// 文件接收服务端。
server: top.$.rootUrl + "/LR_SystemModule/Annexes/UploadAnnexesFileChunk",
// 选择文件的按钮。可选。
// 内部根据当前运行是创建,可能是input元素,也可能是flash.
pick: '#lr_add_file_btn',
dnd: '#lr_form_file_queue',
paste: 'document.body',
disableGlobalDnd: true,
accept: {
extensions: "xls,xlsx"
},
multiple: true,
// 不压缩image, 默认如果是jpeg,文件上传前会压缩一把再上传!
resize: false,
// 文件分片上传
chunked: true,
chunkRetry: 3,
prepareNextFile: true,
chunkSize: '1048576',
// 上传参数
formData: {
__RequestVerificationToken: $.lrToken
}
});
page.uploader.on('fileQueued', page.fileQueued);
page.uploader.on('uploadStart', page.uploadStart);
page.uploader.on('uploadBeforeSend', page.uploadBeforeSend);
page.uploader.on('uploadProgress', page.uploadProgress);
page.uploader.on('uploadSuccess', page.uploadSuccess);
page.uploader.on('uploadError', page.uploadError);
page.uploader.on('uploadComplete', page.uploadComplete);
page.uploader.on('error', page.error);

$('#lr_form_file_queue').lrscroll();

},
fileQueued: function (file) {// 文件加载到队列
fileInfo[file.id] = { name: file.name };
$('#lr_form_file_queue .lr-form-file-queue-bg').hide();
// 添加一条文件记录
var $item = $('<div class="lr-form-file-queue-item" id="lr_filequeue_' + file.id + '" ></div>');
$item.append('<div class="lr-file-image"><img src="' + top.$.rootUrl + '/Content/images/filetype/' + file.ext + '.png"></div>');
$item.append('<span class="lr-file-name">' + file.name + '(' + learun.countFileSize(file.size) + ')</span>');

$('#lr_form_file_queue_list').append($item);
},
uploadStart: function (file) {
var $fileItem = $('#lr_form_file_queue_list').find('#lr_filequeue_' + file.id);
$fileItem.append('<div class="lr-uploader-progress"><div class="lr-uploader-progress-bar" style="width:0%;"></div></div>');
},
uploadBeforeSend: function (object, data, headers) {
data.chunk = data.chunk || 0;
data.chunks = data.chunks || 1;
fileInfo[data.id].fileGuid = fileInfo[data.id].fileGuid || WebUploader.Base.guid();
data.fileGuid = fileInfo[data.id].fileGuid;
fileInfo[data.id].chunks = data.chunks;
},
uploadProgress: function (file, percentage) {
var $fileItem = $('#lr_form_file_queue_list').find('#lr_filequeue_' + file.id);
$fileItem.find('.lr-uploader-progress-bar').css('width', (percentage * 100 + '%'));
},
uploadSuccess: function (file, res) {
if (res.code == 200) {// 上传成功
mergeFileChunks(file);
}
else {// 上传失败
reomveFileChunks(file);
}
},
uploadError: function (file, code) {
reomveFileChunks(file);
},
uploadComplete: function (file) {
},
error: function (type) {
switch (type) {
case 'Q_TYPE_DENIED':
learun.alert.error('当前文件类型不允许上传');
break;
};
}
};
page.init();

}

+ 14
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/Index.cshtml Целия файл

@@ -7,6 +7,19 @@
<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="datesearch"></div>
</div>
<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="F_UserId"></div>
</div>
</div>
</div>
</div>
</div>
<div class="lr-layout-tool-right">
<div class=" btn-group btn-group-sm">
@@ -17,6 +30,7 @@
<a id="lr_edit" class="btn btn-default"><i class="fa fa-pencil-square-o"></i>&nbsp;编辑</a>
<a id="lr_view" class="btn btn-default"><i class="fa fa-pencil-square-o"></i>&nbsp;查看</a>
<a id="lr_delete" class="btn btn-default"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
<a id="lr_import" class="btn btn-default"><i class="fa fa-trash-o"></i>&nbsp;导入</a>
</div>
</div>
</div>


+ 49
- 1
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/Index.js Целия файл

@@ -7,12 +7,48 @@
var refreshGirdData;
var bootstrap = function ($, learun) {
"use strict";
var startTime;
var endTime;
var page = {
init: function () {
page.initGird();
page.bind();
},
bind: function () {
// 时间搜索框
$('#datesearch').lrdate({
dfdata: [
{ name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
{ name: '近7天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'd', -6) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
{ name: '近1个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -1) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
{ name: '近3个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -3) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }
],
// 月
mShow: false,
premShow: false,
// 季度
jShow: false,
prejShow: false,
// 年
ysShow: false,
yxShow: false,
preyShow: false,
yShow: false,
// 默认
dfvalue: '1',
selectfn: function (begin, end) {
startTime = begin;
endTime = end;
page.search();
}
});

$('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
page.search(queryJson);
}, 220, 400);

$('#F_UserId').lrUserSelect(0);

// 刷新
$('#lr_refresh').on('click', function () {
location.reload();
@@ -46,6 +82,18 @@ var bootstrap = function ($, learun) {
});
}
});
$('#lr_import').on('click',function() {
learun.layerForm({
id: 'form',
title: '导入',
url: top.$.rootUrl + '/PersonnelManagement/Sal_UserSalary/ImportForm',
width: 400,
height: 300,
callBack: function (id) {
return top[id].acceptClick(refreshGirdData);
}
});
})
//查看
$('#lr_view').on('click', function () {
var keyValue = $('#gridtable').jfGridValue('USId');
@@ -87,7 +135,7 @@ var bootstrap = function ($, learun) {
{
label: "人员", name: "F_UserId", width: 100, align: "left",
formatterAsync: function (callback, value, row, op, $cell) {
learun.clientdata.getAsync('user', {
learun.clientdata.getAsyncReal('user', {
key: value,
callback: function (_data) {
callback(_data.name);


+ 4
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/IndexOfMy.cshtml Целия файл

@@ -7,6 +7,10 @@
<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="datesearch"></div>
</div>

</div>
<div class="lr-layout-tool-right">
<div class=" btn-group btn-group-sm">


+ 30
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/IndexOfMy.js Целия файл

@@ -7,12 +7,42 @@
var refreshGirdData;
var bootstrap = function ($, learun) {
"use strict";
var startTime;
var endTime;
var page = {
init: function () {
page.initGird();
page.bind();
},
bind: function () {
// 时间搜索框
$('#datesearch').lrdate({
dfdata: [
{ name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
{ name: '近7天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'd', -6) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
{ name: '近1个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -1) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
{ name: '近3个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -3) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }
],
// 月
mShow: false,
premShow: false,
// 季度
jShow: false,
prejShow: false,
// 年
ysShow: false,
yxShow: false,
preyShow: false,
yShow: false,
// 默认
dfvalue: '1',
selectfn: function (begin, end) {
startTime = begin;
endTime = end;
page.search();
}
});

// 刷新
$('#lr_refresh').on('click', function () {
location.reload();


+ 3
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj Целия файл

@@ -1323,6 +1323,8 @@
<Content Include="Areas\PersonnelManagement\Views\ContractManagement\FormRemove.js" />
<Content Include="Areas\PersonnelManagement\Views\ContractManagement\FormTerminate.js" />
<Content Include="Areas\PersonnelManagement\Views\ContractManagement\FormRenew.js" />
<Content Include="Areas\PersonnelManagement\Views\Sal_UserSalary\ImportForm.css" />
<Content Include="Areas\PersonnelManagement\Views\Sal_UserSalary\ImportForm.js" />
<Content Include="Areas\PersonnelManagement\Views\StuSaverecord\IndexForStudent.js" />
<Content Include="Areas\PersonnelManagement\Views\StuSaverecord\IndexForTeacher.js" />
<Content Include="Areas\StudentWork\Views\SW_Ask_Main\AnswerIndex.js" />
@@ -6836,6 +6838,7 @@
<Content Include="Areas\EducationalAdministration\Views\StuInfoFresh\StatisticClassIndex.cshtml" />
<Content Include="Areas\LR_Desktop\Views\WeChatDevelop\Form.cshtml" />
<Content Include="Areas\LR_Desktop\Views\WeChatDevelop\Index.cshtml" />
<Content Include="Areas\PersonnelManagement\Views\Sal_UserSalary\ImportForm.cshtml" />
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" />
<Content Include="Views\Login\Default-beifen.cshtml" />
<None Include="Properties\PublishProfiles\FolderProfile1.pubxml" />


+ 4
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/script/lr-clientdata.js Целия файл

@@ -99,6 +99,10 @@
},
update: function (name) {
clientAsyncData[name].update && clientAsyncData[name].update();
},
getAsyncReal:function(name, op) {
clientAsyncData[name].states = 1;
return clientAsyncData[name].get(op);
}
};



+ 104
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Excel/Import/ExcelImportBLL.cs Целия файл

@@ -8,7 +8,9 @@ using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using Learun.Application.Organization;
using Learun.Application.TwoDevelopment.LogisticsManagement;
using Learun.Application.TwoDevelopment.PersonnelManagement;


namespace Learun.Application.Excel
@@ -30,6 +32,9 @@ namespace Learun.Application.Excel
private DataItemIBLL dataItemIBLL = new DataItemBLL();
private StuEnrollIBLL stuEnrollIBLL = new StuEnrollBLL();
private DataSourceIBLL dataSourceIBLL = new DataSourceBLL();
private Sal_UserSalaryIBLL sal_UserSalaryIBLL = new Sal_UserSalaryBLL();
private Sal_UserSalaryItemIBLL sal_UserSalaryItemIBLL=new Sal_UserSalaryItemBLL();
private UserIBLL userIBLL = new UserBLL();

#region 缓存定义
private ICache cache = CacheFactory.CaChe();
@@ -668,6 +673,105 @@ namespace Learun.Application.Excel



}
// 写入缓存如果有未导入的数据
if (failDt.Rows.Count > 0)
{
string errordt = failDt.ToJson();

cache.Write<string>(cacheKey + fileId, errordt, CacheId.excel);
}

return snum + "|" + fnum;
}


/// <summary>
/// 导入工资条
/// </summary>
/// <param name="dt"></param>
/// <param name="fileId"></param>
/// <returns></returns>
public string ImportSalaryInfo(DataTable dt, string fileId)
{
int snum = 0;
int fnum = 0;
decimal stall = 0;
decimal stactual = 0;
// 创建一个datatable容器用于保存导入失败的数据
DataTable failDt = new DataTable();
dt.Columns.Add("导入错误", typeof(string));
foreach (DataColumn dc in dt.Columns)
{
failDt.Columns.Add(dc.ColumnName, dc.DataType);
}



var data = accommodationIBLL.GetAllList().ToList();
//获取工资条列
var templateItemList = sal_UserSalaryIBLL.GetAllTemplateInfo();
foreach (DataRow dr in dt.Rows)
{
try
{
//录入工资条信息
Sal_UserSalaryEntity sal_UserSalaryEntity = new Sal_UserSalaryEntity();
sal_UserSalaryEntity.Create();
sal_UserSalaryEntity.F_UserId = userIBLL.GetEntityByName(dr["姓名"].ToString())?.F_UserId;
sal_UserSalaryEntity.USDate = DateTime.Now;
stall = 0;//重置应发合计
stactual = 0;//重置实发合计
foreach (var templateItem in templateItemList)
{
var stiValue = Convert.ToDecimal(dr[templateItem.STIName].ToString());
//工资详细添加
Sal_UserSalaryItemEntity sal_UserSalaryItemEntity=new Sal_UserSalaryItemEntity
{
USIId = Guid.NewGuid().ToString(),
USId=sal_UserSalaryEntity.USId,
STIId=templateItem.STIId,
STIValue = Convert.ToDecimal(stiValue)
};
sal_UserSalaryItemIBLL.SaveEntity("", sal_UserSalaryItemEntity);

//计算应发合计和实发合计
if (templateItem.STIParticipation == "true")
{
if (templateItem.STIAdd == "true")
{
stactual += stiValue;
}
else
{
stactual -= stiValue;
}
}
if (templateItem.STIAdd == "true")
{
stall += stiValue;
}
else
{
stall -= stiValue;
}
}

sal_UserSalaryEntity.STAll = stall;
sal_UserSalaryEntity.STActual = stactual;
sal_UserSalaryIBLL.SaveEntity("",sal_UserSalaryEntity);
snum++;
}
catch (Exception e)
{
dr["导入错误"] = dr["姓名"] + "导入错误";
fnum++;
failDt.Rows.Add(dr.ItemArray);
continue;
}



}
// 写入缓存如果有未导入的数据
if (failDt.Rows.Count > 0)


+ 1
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Excel/Import/ExcelImportIBLL.cs Целия файл

@@ -72,6 +72,7 @@ namespace Learun.Application.Excel
/// <param name="dt">导入数据</param>
/// <returns></returns>
string ImportTable(string templateId, string fileId, DataTable dt);
string ImportSalaryInfo(DataTable dt, string fileId);
/// <summary>
/// 获取excel导入的错误数据
/// </summary>


+ 4
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Excel/Learun.Application.Excel.csproj Целия файл

@@ -80,6 +80,10 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Learun.Application.Organization\Learun.Application.Organization.csproj">
<Project>{E9877A25-801B-4605-AD35-E6306916513C}</Project>
<Name>Learun.Application.Organization</Name>
</ProjectReference>
<ProjectReference Include="..\..\Learun.Cache\Learun.Cache.Base\Learun.Cache.Base.csproj">
<Project>{975f2cb8-605c-4add-b365-b97bf844f0fe}</Project>
<Name>Learun.Cache.Base</Name>


+ 6
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/Sal_UserSalary/Sal_UserSalaryService.cs Целия файл

@@ -43,6 +43,12 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
var queryParam = queryJson.ToJObject();
// 虚拟参数
var dp = new DynamicParameters(new { });
if (!queryParam["StartTime"].IsEmpty() && !queryParam["EndTime"].IsEmpty())
{
dp.Add("startTime", queryParam["StartTime"].ToDate(), DbType.DateTime);
dp.Add("endTime", queryParam["EndTime"].ToDate(), DbType.DateTime);
strSql.Append(" AND ( t.USDate >= @startTime AND t.USDate <= @endTime ) ");
}
if (!queryParam["F_UserId"].IsEmpty())
{
dp.Add("F_UserId", queryParam["F_UserId"].ToString(), DbType.String);


Зареждане…
Отказ
Запис