@@ -137,9 +137,9 @@ namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers | |||
/// <returns></returns> | |||
[HttpPost] | |||
[AjaxOnly] | |||
public ActionResult DeleteForm(string keyValue) | |||
public ActionResult DeleteForm(string keyValue, string isTeacher) | |||
{ | |||
ass_FixAssetsIBLL.DeleteEntity(keyValue); | |||
ass_FixAssetsIBLL.DeleteEntity(keyValue, isTeacher); | |||
return Success("删除成功!"); | |||
} | |||
/// <summary> | |||
@@ -151,7 +151,7 @@ namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers | |||
[HttpPost] | |||
[ValidateAntiForgeryToken] | |||
[AjaxOnly] | |||
public ActionResult SaveForm(string keyValue, string strEntity) | |||
public ActionResult SaveForm(string keyValue, string strEntity, string isTeacher) | |||
{ | |||
Ass_FixAssetsEntity entity = strEntity.ToObject<Ass_FixAssetsEntity>(); | |||
var model = ass_FixAssetsIBLL.GetEntityByCode(entity.FACode); | |||
@@ -161,6 +161,14 @@ namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers | |||
{ | |||
return Fail("资产编号已存在!"); | |||
} | |||
if (!string.IsNullOrEmpty(isTeacher) && isTeacher == "1") | |||
{ | |||
entity.Status = 0; | |||
} | |||
else | |||
{ | |||
entity.Status = 4; | |||
} | |||
} | |||
else | |||
{ | |||
@@ -201,13 +209,17 @@ namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers | |||
/// 下载文件 | |||
/// </summary> | |||
/// <returns></returns> | |||
public ActionResult DownTemplate() | |||
public ActionResult DownTemplate(string isTeacher) | |||
{ | |||
FileStreamResult result = null; | |||
try | |||
{ | |||
var path = Server.MapPath("~/Content/excel/"); | |||
var pathoffull = path + "AssFixAssetsImport.xls"; | |||
if (!string.IsNullOrEmpty(isTeacher) && isTeacher == "1") | |||
{ | |||
pathoffull = path + "AssFixAssetsOfTeacherImport.xls"; | |||
} | |||
FileStream fsread = fsread = new FileStream(pathoffull, FileMode.OpenOrCreate, FileAccess.ReadWrite); | |||
result = File(fsread, "application/ms-excel", "固定资产导入模板.xls"); | |||
@@ -130,7 +130,7 @@ | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_FixAssets"> | |||
<div class="lr-form-item-title">存放地点</div> | |||
<div id="StorageId"></div> | |||
<input id="StorageId" type="text" class="form-control" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_FixAssets"> | |||
<div class="lr-form-item-title">销售商</div> | |||
@@ -6,6 +6,7 @@ | |||
*/ | |||
var acceptClick; | |||
var keyValue = request('keyValue'); | |||
var isTeacher = request('isTeacher'); | |||
// 设置权限 | |||
var setAuthorize; | |||
// 设置表单数据 | |||
@@ -16,6 +17,7 @@ var validForm; | |||
var save; | |||
var bootstrap = function ($, learun) { | |||
"use strict"; | |||
var loginInfo = top.learun.clientdata.get(['userinfo']); | |||
// 设置权限 | |||
setAuthorize = function (data) { | |||
if (!!data) { | |||
@@ -85,11 +87,19 @@ var bootstrap = function ($, learun) { | |||
$('#Unit').lrDataSourceSelect({ code: 'company', value: 'f_companyid', text: 'f_fullname' }); | |||
$('#CardStatus').lrDataItemSelect({ code: 'CardStatus' }); | |||
$('#DepreciationMothod').lrDataItemSelect({ code: 'DepreciationMothod' }); | |||
$('#StorageId').lrDataSourceSelect({ code: 'Ass_StorageData', value: 'sid', text: 'sname' }); | |||
$('#SupplierId').lrDataSourceSelect({ code: 'Ass_SupplierData', value: 'sid', text: 'sname' }); | |||
$('#DepreciationStatus').lrDataItemSelect({ code: 'DepreciationStatus' }); | |||
$('#MakePeople').val(loginInfo.realName); | |||
$('#MakeDate').val(getNowTime()); | |||
$('#Unit').lrselectSet(loginInfo.companyId); | |||
}, | |||
initData: function () { | |||
if (!!isTeacher && isTeacher == "1") { | |||
$('#UseDepartment').lrselectSet(loginInfo.departmentId); | |||
$('#UsePeople').lrselectSet(loginInfo.userId); | |||
$('#UseDepartment').attr("readonly", "readonly"); | |||
$('#UsePeople').attr("readonly", "readonly"); | |||
} | |||
if (!!keyValue) { | |||
$.lrSetForm(top.$.rootUrl + '/AssetManagementSystem/Ass_FixAssets/GetFormData?keyValue=' + keyValue, function (data) { | |||
for (var id in data) { | |||
@@ -229,7 +239,8 @@ var bootstrap = function ($, learun) { | |||
formData.ProcessId = processId; | |||
} | |||
var postData = { | |||
strEntity: JSON.stringify(formData) | |||
strEntity: JSON.stringify(formData), | |||
isTeacher: isTeacher | |||
}; | |||
$.lrSaveForm(top.$.rootUrl + '/AssetManagementSystem/Ass_FixAssets/SaveForm?keyValue=' + keyValue, postData, function (res) { | |||
// 保存成功后才回调 | |||
@@ -258,4 +269,9 @@ function getDistanceMonth(compareYear, compareMonth, compareDay) { | |||
} | |||
return yearToMonth + monthToMonth + dateToMonth; | |||
} | |||
//console.log(getDistanceMonth(2022, 1, 30)); | |||
//console.log(getDistanceMonth(2022, 1, 30)); | |||
function getNowTime() { | |||
let date = new Date(); | |||
return date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds(); | |||
} | |||
//console.log(getNowTime()); |
@@ -130,7 +130,7 @@ | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_FixAssets"> | |||
<div class="lr-form-item-title">存放地点</div> | |||
<div id="StorageId"></div> | |||
<input id="StorageId" type="text" class="form-control" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_FixAssets"> | |||
<div class="lr-form-item-title">销售商</div> | |||
@@ -85,7 +85,6 @@ var bootstrap = function ($, learun) { | |||
$('#Unit').lrDataSourceSelect({ code: 'company', value: 'f_companyid', text: 'f_fullname' }); | |||
$('#CardStatus').lrDataItemSelect({ code: 'CardStatus' }); | |||
$('#DepreciationMothod').lrDataItemSelect({ code: 'DepreciationMothod' }); | |||
$('#StorageId').lrDataSourceSelect({ code: 'Ass_StorageData', value: 'sid', text: 'sname' }); | |||
$('#SupplierId').lrDataSourceSelect({ code: 'Ass_SupplierData', value: 'sid', text: 'sname' }); | |||
$('#DepreciationStatus').lrDataItemSelect({ code: 'DepreciationStatus' }); | |||
}, | |||
@@ -6,6 +6,7 @@ | |||
* 描 述:导入固定资产信息 | |||
*/ | |||
var id = request('id'); | |||
var isTeacher = request('isTeacher');//老师页面 | |||
var keyVaule = ''; | |||
@@ -99,13 +100,14 @@ var bootstrap = function ($, learun) { | |||
// 触发合并文件碎片 | |||
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; | |||
param['isTeacher'] = isTeacher; | |||
learun.httpAsyncPost(top.$.rootUrl + "/LR_SystemModule/ExcelImport/Ass_FixAssetsImport", param, function (res) { | |||
var $fileItem = $('#lr_form_file_queue_list').find('#lr_filequeue_' + file.id); | |||
$fileItem.find('.lr-uploader-progress').remove(); | |||
@@ -116,8 +118,7 @@ var bootstrap = function ($, learun) { | |||
// 文件保存成功后 | |||
$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') | |||
{ | |||
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' }); | |||
} | |||
} | |||
@@ -143,7 +144,7 @@ var bootstrap = function ($, learun) { | |||
init: function () { | |||
/*模板下载*/ | |||
$('#lr_down_file_btn').on('click', function () { | |||
learun.download({ url: top.$.rootUrl + '/AssetManagementSystem/Ass_FixAssets/DownTemplate', param: { keyValue: id, __RequestVerificationToken: $.lrToken }, method: 'POST' }); | |||
learun.download({ url: top.$.rootUrl + '/AssetManagementSystem/Ass_FixAssets/DownTemplate', param: { isTeacher: isTeacher, keyValue: id, __RequestVerificationToken: $.lrToken }, method: 'POST' }); | |||
}); | |||
if (!WebUploader.Uploader.support()) { | |||
alert('Web Uploader 不支持您的浏览器!如果你使用的是IE浏览器,请尝试升级 flash 播放器'); | |||
@@ -44,7 +44,7 @@ | |||
</div> | |||
<div class="col-xs-6 lr-form-item"> | |||
<div class="lr-form-item-title">使用部门</div> | |||
<div id="UseDepartment"></div> | |||
<input id="UseDepartment" type="text" class="form-control" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item"> | |||
<div class="lr-form-item-title">管理部门</div> | |||
@@ -52,7 +52,7 @@ | |||
</div> | |||
<div class="col-xs-6 lr-form-item"> | |||
<div class="lr-form-item-title">使用人</div> | |||
<div id="UsePeople"></div> | |||
<input id="UsePeople" type="text" class="form-control" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item"> | |||
<div class="lr-form-item-title">卡片状态</div> | |||
@@ -64,7 +64,7 @@ | |||
</div> | |||
<div class="col-xs-6 lr-form-item"> | |||
<div class="lr-form-item-title">存放地点</div> | |||
<div id="StorageId"></div> | |||
<input id="StorageId" type="text" class="form-control" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item"> | |||
<div class="lr-form-item-title">折旧/摊销状态</div> | |||
@@ -87,13 +87,12 @@ | |||
<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 class=" btn-group btn-group-sm" learun-authorize="yes"> | |||
@*<div class=" btn-group btn-group-sm" learun-authorize="yes"> | |||
<a id="lr_check" class="btn btn-default"><i class="fa fa-lock"></i> 审核</a> | |||
<a id="lr_cancelCheck" class="btn btn-default"><i class="fa fa-unlock"></i> 取消审核</a> | |||
</div> | |||
</div>*@ | |||
<div class=" btn-group btn-group-sm" learun-authorize="yes"> | |||
<a id="lr_view" class="btn btn-default"><i class="fa fa-eye"></i> 查看</a> | |||
@*<a id="lr_submit" class="btn btn-default"><i class="fa fa-arrow-up"></i> 提交</a>*@ | |||
<a id="lr_import" class="btn btn-default"><i class="fa fa-trash-o"></i> 导入</a> | |||
</div> | |||
</div> | |||
@@ -4,7 +4,6 @@ | |||
* 日 期:2023-05-05 14:37 | |||
* 描 述:固定资产 | |||
*/ | |||
var refreshGirdData; | |||
var bootstrap = function ($, learun) { | |||
"use strict"; | |||
var processId = ''; | |||
@@ -37,28 +36,10 @@ var bootstrap = function ($, learun) { | |||
$('#ATId').lrselect({ allowSearch: true }); | |||
$('#GetWay').lrDataItemSelect({ code: 'GetWay' }); | |||
$('#UseCondition').lrDataItemSelect({ code: 'AssState' }); | |||
$('#UseDepartment').lrDepartmentSelect({ | |||
select: function (item) { | |||
$('#UsePeople').lrselectRefresh({ | |||
url: top.$.rootUrl + '/LR_OrganizationModule/User/GetList', | |||
param: { departmentId: item.value } | |||
}); | |||
} | |||
}); | |||
$('#ManageDepartment').lrDepartmentSelect(); | |||
$('#UsePeople').lrselect({ | |||
value: 'F_UserId', | |||
text: 'F_RealName', | |||
title: 'F_RealName', | |||
// 展开最大高度 | |||
maxHeight: 110, | |||
// 是否允许搜索 | |||
allowSearch: true | |||
}); | |||
$('#CardStatus').lrDataItemSelect({ code: 'CardStatus' }); | |||
$('#StorageId').lrDataSourceSelect({ code: 'Ass_StorageData', value: 'sid', text: 'sname' }); | |||
$('#DepreciationStatus').lrDataItemSelect({ code: 'DepreciationStatus' }); | |||
$('#Status').lrselect({ data: [{ id: "0", text: "未审核" }, { id: "2", text: "已审核" }] }); | |||
$('#Status').lrselect({ data: [{ id: "0", text: "草稿" }, { id: "1", text: "审核中" }, { id: "2", text: "审核通过" }, { id: "3", text: "审核作废" }, { id: "4", text: "已审核" }] }); | |||
// 刷新 | |||
$('#lr_refresh').on('click', function () { | |||
location.reload(); | |||
@@ -94,8 +75,8 @@ var bootstrap = function ($, learun) { | |||
return false; | |||
} | |||
var Status = $('#gridtable').jfGridValue('Status'); | |||
if (Status == 2) { | |||
learun.alert.warning("当前项目已审核不能编辑!"); | |||
if (Status != 2 && Status != 4) { | |||
learun.alert.warning("当前项目不能编辑!"); | |||
return; | |||
} | |||
learun.layerForm({ | |||
@@ -124,12 +105,8 @@ var bootstrap = function ($, learun) { | |||
var keyValue = $('#gridtable').jfGridValue('FAId'); | |||
if (learun.checkrow(keyValue)) { | |||
var Status = $('#gridtable').jfGridValue('Status'); | |||
//if (Status !== 0) { | |||
// learun.alert.warning("当前项目已提交不能删除!"); | |||
// return; | |||
//} | |||
if (Status.indexOf('2') != -1) { | |||
learun.alert.warning("选中记录中包含已审核项目,不能删除!"); | |||
if (Status.indexOf('1') != -1) { | |||
learun.alert.warning("选中记录中包含审核中项目,不能删除!"); | |||
return; | |||
} | |||
learun.layerConfirm('是否确认删除该项!', function (res) { | |||
@@ -142,41 +119,41 @@ var bootstrap = function ($, learun) { | |||
} | |||
}); | |||
//审核 | |||
$('#lr_check').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('FAId'); | |||
if (learun.checkrow(keyValue)) { | |||
var Status = $('#gridtable').jfGridValue('Status'); | |||
if (Status.indexOf('2') != -1) { | |||
learun.alert.warning("选中记录中包含已审核项目!"); | |||
return; | |||
} | |||
learun.layerConfirm('是否确认审核该项!', function (res) { | |||
if (res) { | |||
learun.postForm(top.$.rootUrl + '/AssetManagementSystem/Ass_FixAssets/Lock', { keyValue: keyValue, status: 2 }, function () { | |||
page.search(); | |||
}); | |||
} | |||
}); | |||
} | |||
}); | |||
//$('#lr_check').on('click', function () { | |||
// var keyValue = $('#gridtable').jfGridValue('FAId'); | |||
// if (learun.checkrow(keyValue)) { | |||
// var Status = $('#gridtable').jfGridValue('Status'); | |||
// if (Status.indexOf('2') != -1) { | |||
// learun.alert.warning("选中记录中包含已审核项目!"); | |||
// return; | |||
// } | |||
// learun.layerConfirm('是否确认审核该项!', function (res) { | |||
// if (res) { | |||
// learun.postForm(top.$.rootUrl + '/AssetManagementSystem/Ass_FixAssets/Lock', { keyValue: keyValue, status: 2 }, function () { | |||
// page.search(); | |||
// }); | |||
// } | |||
// }); | |||
// } | |||
//}); | |||
//取消审核 | |||
$('#lr_cancelCheck').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('FAId'); | |||
if (learun.checkrow(keyValue)) { | |||
var Status = $('#gridtable').jfGridValue('Status'); | |||
if (Status.indexOf('0') != -1) { | |||
learun.alert.warning("选中记录中包含未审核项目!"); | |||
return; | |||
} | |||
learun.layerConfirm('是否确认取消审核该项!', function (res) { | |||
if (res) { | |||
learun.postForm(top.$.rootUrl + '/AssetManagementSystem/Ass_FixAssets/Lock', { keyValue: keyValue, status: 0 }, function () { | |||
page.search(); | |||
}); | |||
} | |||
}); | |||
} | |||
}); | |||
//$('#lr_cancelCheck').on('click', function () { | |||
// var keyValue = $('#gridtable').jfGridValue('FAId'); | |||
// if (learun.checkrow(keyValue)) { | |||
// var Status = $('#gridtable').jfGridValue('Status'); | |||
// if (Status.indexOf('0') != -1) { | |||
// learun.alert.warning("选中记录中包含未审核项目!"); | |||
// return; | |||
// } | |||
// learun.layerConfirm('是否确认取消审核该项!', function (res) { | |||
// if (res) { | |||
// learun.postForm(top.$.rootUrl + '/AssetManagementSystem/Ass_FixAssets/Lock', { keyValue: keyValue, status: 0 }, function () { | |||
// page.search(); | |||
// }); | |||
// } | |||
// }); | |||
// } | |||
//}); | |||
// 查看 | |||
$('#lr_view').on('click', function () { | |||
@@ -196,27 +173,8 @@ var bootstrap = function ($, learun) { | |||
}); | |||
} | |||
}); | |||
// 提交 | |||
//$('#lr_submit').on('click', function () { | |||
// var keyValue = $('#gridtable').jfGridValue('FAId'); | |||
// if (learun.checkrow(keyValue)) { | |||
// var Status = $('#gridtable').jfGridValue('Status'); | |||
// if (Status !== 0) { | |||
// learun.alert.warning("当前项目已提交,请耐心等待审批!"); | |||
// return; | |||
// } | |||
// learun.layerConfirm('是否确认提交该项!', function (res) { | |||
// if (res) { | |||
// processId = learun.newGuid(); | |||
// learun.postForm(top.$.rootUrl + '/AssetManagementSystem/Ass_FixAssets/ChangeStatusById', { keyValue: keyValue, status: 1, processId: processId }, function (res) { | |||
// refreshGirdData(res, {}); | |||
// }); | |||
// } | |||
// }); | |||
// } | |||
//}); | |||
///上传 | |||
//上传 | |||
$('#lr_import').on('click', function () { | |||
learun.layerForm({ | |||
id: 'form', | |||
@@ -238,13 +196,15 @@ var bootstrap = function ($, learun) { | |||
label: "状态", name: "Status", width: 100, align: "left", | |||
formatter: function (cellvalue, row) { | |||
if (cellvalue === 1) { | |||
return '<span class=\"label label-warning\">已提交</span>'; | |||
return '<span class=\"label label-warning\">审核中</span>'; | |||
} else if (cellvalue === 2) { | |||
return '<span class=\"label label-success\">已审核</span>'; | |||
return '<span class=\"label label-success\">审核通过</span>'; | |||
} else if (cellvalue === 3) { | |||
return '<span class=\"label label-danger\">审核未通过</span>'; | |||
return '<span class=\"label label-danger\">审核作废</span>'; | |||
} else if (cellvalue === 4) { | |||
return '<span class=\"label label-success\">已审核</span>'; | |||
} else { | |||
return '<span class=\"label label-default\" >未审核</span>'; | |||
return '<span class=\"label label-default\" >草稿</span>'; | |||
} | |||
} | |||
}, | |||
@@ -409,17 +369,7 @@ var bootstrap = function ($, learun) { | |||
{ label: "品牌", name: "Brand", width: 100, align: "left" }, | |||
{ label: "规格型号", name: "SpecificationModel", width: 100, align: "left" }, | |||
{ | |||
label: "存放地点", name: "StorageId", width: 100, align: "left", | |||
formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_StorageData', | |||
key: value, | |||
keyId: 'sid', | |||
callback: function (_data) { | |||
callback(_data['sname']); | |||
} | |||
}); | |||
} | |||
label: "存放地点", name: "StorageId", width: 100, align: "left" | |||
}, | |||
{ | |||
label: "销售商", name: "SupplierId", width: 100, align: "left", | |||
@@ -464,21 +414,5 @@ var bootstrap = function ($, learun) { | |||
$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); | |||
} | |||
}; | |||
//refreshGirdData = function (res, postData) { | |||
// if (!!res) { | |||
// if (res.code == 200) { | |||
// // 发起流程 | |||
// var postData = { | |||
// schemeCode: 'Ass_FixAssets',// 填写流程对应模板编号 | |||
// processId: processId, | |||
// level: '1', | |||
// }; | |||
// learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) { | |||
// learun.loading(false); | |||
// }); | |||
// } | |||
// page.search(); | |||
// } | |||
//}; | |||
page.init(); | |||
} |
@@ -44,7 +44,7 @@ | |||
</div> | |||
<div class="col-xs-6 lr-form-item"> | |||
<div class="lr-form-item-title">使用部门</div> | |||
<div id="UseDepartment"></div> | |||
<input id="UseDepartment" type="text" class="form-control" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item"> | |||
<div class="lr-form-item-title">管理部门</div> | |||
@@ -52,7 +52,7 @@ | |||
</div> | |||
<div class="col-xs-6 lr-form-item"> | |||
<div class="lr-form-item-title">使用人</div> | |||
<div id="UsePeople"></div> | |||
<input id="UsePeople" type="text" class="form-control" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item"> | |||
<div class="lr-form-item-title">卡片状态</div> | |||
@@ -64,12 +64,16 @@ | |||
</div> | |||
<div class="col-xs-6 lr-form-item"> | |||
<div class="lr-form-item-title">存放地点</div> | |||
<div id="StorageId"></div> | |||
<input id="StorageId" type="text" class="form-control" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item"> | |||
<div class="lr-form-item-title">折旧/摊销状态</div> | |||
<div id="DepreciationStatus"></div> | |||
</div> | |||
<div class="col-xs-6 lr-form-item"> | |||
<div class="lr-form-item-title">状态</div> | |||
<div id="Status"></div> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
@@ -78,8 +82,15 @@ | |||
<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_submit" class="btn btn-default"><i class="fa fa-arrow-up"></i> 提交</a> | |||
</div> | |||
<div class=" btn-group btn-group-sm" learun-authorize="yes"> | |||
<a id="lr_view" class="btn btn-default"><i class="fa fa-eye"></i> 查看</a> | |||
<a id="lr_import" class="btn btn-default"><i class="fa fa-trash-o"></i> 导入</a> | |||
</div> | |||
</div> | |||
</div> | |||
@@ -4,6 +4,7 @@ | |||
* 日 期:2023-05-05 14:37 | |||
* 描 述:固定资产 | |||
*/ | |||
var refreshGirdData; | |||
var bootstrap = function ($, learun) { | |||
"use strict"; | |||
var processId = ''; | |||
@@ -36,31 +37,88 @@ var bootstrap = function ($, learun) { | |||
$('#ATId').lrselect({ allowSearch: true }); | |||
$('#GetWay').lrDataItemSelect({ code: 'GetWay' }); | |||
$('#UseCondition').lrDataItemSelect({ code: 'AssState' }); | |||
$('#UseDepartment').lrDepartmentSelect({ | |||
select: function (item) { | |||
$('#UsePeople').lrselectRefresh({ | |||
url: top.$.rootUrl + '/LR_OrganizationModule/User/GetList', | |||
param: { departmentId: item.value } | |||
}); | |||
} | |||
}); | |||
$('#ManageDepartment').lrDepartmentSelect(); | |||
$('#UsePeople').lrselect({ | |||
value: 'F_UserId', | |||
text: 'F_RealName', | |||
title: 'F_RealName', | |||
// 展开最大高度 | |||
maxHeight: 110, | |||
// 是否允许搜索 | |||
allowSearch: true | |||
}); | |||
$('#CardStatus').lrDataItemSelect({ code: 'CardStatus' }); | |||
$('#StorageId').lrDataSourceSelect({ code: 'Ass_StorageData', value: 'sid', text: 'sname' }); | |||
$('#DepreciationStatus').lrDataItemSelect({ code: 'DepreciationStatus' }); | |||
$('#Status').lrselect({ data: [{ id: "0", text: "草稿" }, { id: "1", text: "审核中" }, { id: "2", text: "审核通过" }, { id: "3", text: "审核作废" }, { id: "4", text: "已审核" }] }); | |||
// 刷新 | |||
$('#lr_refresh').on('click', function () { | |||
location.reload(); | |||
}); | |||
// 新增 | |||
$('#lr_add').on('click', function () { | |||
learun.layerForm({ | |||
id: 'form', | |||
title: '新增', | |||
url: top.$.rootUrl + '/AssetManagementSystem/Ass_FixAssets/Form?isTeacher=1', | |||
width: 1000, | |||
height: 800, | |||
callBack: function (id) { | |||
var res = false; | |||
// 验证数据 | |||
res = top[id].validForm(); | |||
// 保存数据 | |||
if (res) { | |||
res = top[id].save('', function () { | |||
page.search(); | |||
}); | |||
} | |||
return res; | |||
} | |||
}); | |||
}); | |||
// 编辑 | |||
$('#lr_edit').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('FAId'); | |||
if (learun.checkrow(keyValue)) { | |||
if (keyValue.indexOf(",") != -1) { | |||
learun.alert.warning("只能选择一条记录进行编辑!"); | |||
return false; | |||
} | |||
var Status = $('#gridtable').jfGridValue('Status'); | |||
if (Status != 0 && Status != 3) { | |||
learun.alert.warning("当前项目不能编辑!"); | |||
return; | |||
} | |||
learun.layerForm({ | |||
id: 'form', | |||
title: '编辑', | |||
url: top.$.rootUrl + '/AssetManagementSystem/Ass_FixAssets/Form?isTeacher=1&keyValue=' + keyValue, | |||
width: 1000, | |||
height: 800, | |||
callBack: function (id) { | |||
var res = false; | |||
// 验证数据 | |||
res = top[id].validForm(); | |||
// 保存数据 | |||
if (res) { | |||
res = top[id].save('', function () { | |||
page.search(); | |||
}); | |||
} | |||
return res; | |||
} | |||
}); | |||
} | |||
}); | |||
// 删除 | |||
$('#lr_delete').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('FAId'); | |||
if (learun.checkrow(keyValue)) { | |||
var Status = $('#gridtable').jfGridValue('Status'); | |||
if (Status != 0 && Status != 3) { | |||
learun.alert.warning("当前项目不能删除!"); | |||
return; | |||
} | |||
learun.layerConfirm('是否确认删除该项!', function (res) { | |||
if (res) { | |||
learun.deleteForm(top.$.rootUrl + '/AssetManagementSystem/Ass_FixAssets/DeleteForm', { keyValue: keyValue, isTeacher: "1" }, function () { | |||
page.search(); | |||
}); | |||
} | |||
}); | |||
} | |||
}); | |||
// 查看 | |||
$('#lr_view').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('FAId'); | |||
@@ -75,6 +133,37 @@ var bootstrap = function ($, learun) { | |||
}); | |||
} | |||
}); | |||
// 提交 | |||
$('#lr_submit').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('FAId'); | |||
if (learun.checkrow(keyValue)) { | |||
var Status = $('#gridtable').jfGridValue('Status'); | |||
if (Status !== 0 && Status !== 3) { | |||
learun.alert.warning("当前项目不能提交!"); | |||
return; | |||
} | |||
learun.layerConfirm('是否确认提交该项!', function (res) { | |||
if (res) { | |||
processId = learun.newGuid(); | |||
learun.postForm(top.$.rootUrl + '/AssetManagementSystem/Ass_FixAssets/ChangeStatusById', { keyValue: keyValue, status: 1, processId: processId }, function (res) { | |||
refreshGirdData(res, {}); | |||
}); | |||
} | |||
}); | |||
} | |||
}); | |||
//上传 | |||
$('#lr_import').on('click', function () { | |||
learun.layerForm({ | |||
id: 'form', | |||
title: '导入', | |||
url: top.$.rootUrl + '/AssetManagementSystem/Ass_FixAssets/ImportForm?isTeacher=1', | |||
width: 600, | |||
height: 400, | |||
btn: null, | |||
end: function () { page.search(); } | |||
}); | |||
}); | |||
}, | |||
// 初始化列表 | |||
initGird: function () { | |||
@@ -85,13 +174,15 @@ var bootstrap = function ($, learun) { | |||
label: "状态", name: "Status", width: 100, align: "left", | |||
formatter: function (cellvalue, row) { | |||
if (cellvalue === 1) { | |||
return '<span class=\"label label-warning\">已提交</span>'; | |||
return '<span class=\"label label-warning\">审核中</span>'; | |||
} else if (cellvalue === 2) { | |||
return '<span class=\"label label-success\">已审核</span>'; | |||
return '<span class=\"label label-success\">审核通过</span>'; | |||
} else if (cellvalue === 3) { | |||
return '<span class=\"label label-danger\">审核未通过</span>'; | |||
return '<span class=\"label label-danger\">审核作废</span>'; | |||
} else if (cellvalue === 4) { | |||
return '<span class=\"label label-success\">已审核</span>'; | |||
} else { | |||
return '<span class=\"label label-default\" >未审核</span>'; | |||
return '<span class=\"label label-default\" >草稿</span>'; | |||
} | |||
} | |||
}, | |||
@@ -256,17 +347,7 @@ var bootstrap = function ($, learun) { | |||
{ label: "品牌", name: "Brand", width: 100, align: "left" }, | |||
{ label: "规格型号", name: "SpecificationModel", width: 100, align: "left" }, | |||
{ | |||
label: "存放地点", name: "StorageId", width: 100, align: "left", | |||
formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_StorageData', | |||
key: value, | |||
keyId: 'sid', | |||
callback: function (_data) { | |||
callback(_data['sname']); | |||
} | |||
}); | |||
} | |||
label: "存放地点", name: "StorageId", width: 100, align: "left" | |||
}, | |||
{ | |||
label: "销售商", name: "SupplierId", width: 100, align: "left", | |||
@@ -308,10 +389,24 @@ var bootstrap = function ($, learun) { | |||
search: function (param) { | |||
param = param || {}; | |||
param.IsTeacher = "1";//控制老师查看的参数 | |||
param.Status = "2";//审核通过 | |||
$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); | |||
} | |||
}; | |||
refreshGirdData = function (res, postData) { | |||
if (!!res) { | |||
if (res.code == 200) { | |||
// 发起流程 | |||
var postData = { | |||
schemeCode: 'Ass_FixAssets',// 填写流程对应模板编号 | |||
processId: processId, | |||
level: '1', | |||
}; | |||
learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) { | |||
learun.loading(false); | |||
}); | |||
} | |||
page.search(); | |||
} | |||
}; | |||
page.init(); | |||
} |
@@ -333,14 +333,14 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers | |||
/// <returns></returns> | |||
[HttpPost] | |||
[ValidateAntiForgeryToken] | |||
public ActionResult Ass_FixAssetsImport(string fileId, int chunks, string ext) | |||
public ActionResult Ass_FixAssetsImport(string fileId, int chunks, string ext, string isTeacher) | |||
{ | |||
UserInfo userInfo = LoginUserInfo.Get(); | |||
string path = annexesFileIBLL.SaveAnnexes(fileId, fileId + "." + ext, chunks, userInfo); | |||
if (!string.IsNullOrEmpty(path)) | |||
{ | |||
DataTable dt = ExcelHelper.ExcelImport(path); | |||
string res = ass_FixAssetsIBLL.AssFixAssetsImport(dt, fileId); | |||
string res = ass_FixAssetsIBLL.AssFixAssetsImport(dt, fileId, isTeacher); | |||
var data = new | |||
{ | |||
Success = res.Split('|')[0], | |||
@@ -8295,6 +8295,7 @@ | |||
<Content Include="Areas\LogisticsManagement\Views\RepairReportStudent\EvaluateFormView.cshtml" /> | |||
<Content Include="Areas\Weixin\Views\web.config" /> | |||
<Content Include="Areas\Weixin\Views\VisitManage\Index.cshtml" /> | |||
<Content Include="Content\excel\AssFixAssetsOfTeacherImport.xls" /> | |||
<None Include="Properties\PublishProfiles\CustomProfile.pubxml" /> | |||
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" /> | |||
<Content Include="Views\Login\Default-beifen.cshtml" /> | |||
@@ -123,11 +123,11 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
/// 删除实体数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
public void DeleteEntity(string keyValue) | |||
public void DeleteEntity(string keyValue, string isTeacher) | |||
{ | |||
try | |||
{ | |||
ass_FixAssetsService.DeleteEntity(keyValue); | |||
ass_FixAssetsService.DeleteEntity(keyValue, isTeacher); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -223,11 +223,11 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
/// <param name="dt"></param> | |||
/// <param name="fileId"></param> | |||
/// <returns></returns> | |||
public string AssFixAssetsImport(DataTable dt, string fileId) | |||
public string AssFixAssetsImport(DataTable dt, string fileId, string isTeacher) | |||
{ | |||
try | |||
{ | |||
return ass_FixAssetsService.AssFixAssetsImport(dt, fileId); | |||
return ass_FixAssetsService.AssFixAssetsImport(dt, fileId, isTeacher); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -220,7 +220,7 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
[Column("SUBMITTIME")] | |||
public DateTime? SubmitTime { get; set; } | |||
/// <summary> | |||
/// 状态(0草稿,1已提交,2审核通过,3审核未通过) | |||
/// 状态(0草稿,1审核中,2审核通过,3审核作废,4已审核) | |||
/// </summary> | |||
[Column("STATUS")] | |||
public int? Status { get; set; } | |||
@@ -250,7 +250,6 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
this.FAId = Guid.NewGuid().ToString(); | |||
this.CreateTime = DateTime.Now; | |||
this.CreateUserId = LoginUserInfo.Get().userId; | |||
this.Status = 0; | |||
this.F_DeleteMark = 0; | |||
} | |||
/// <summary> | |||
@@ -49,7 +49,7 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
/// 删除实体数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
void DeleteEntity(string keyValue); | |||
void DeleteEntity(string keyValue, string isTeacher); | |||
/// <summary> | |||
/// 保存实体数据(新增、修改) | |||
/// </summary> | |||
@@ -82,7 +82,7 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
/// <param name="dt"></param> | |||
/// <param name="fileId"></param> | |||
/// <returns></returns> | |||
string AssFixAssetsImport(DataTable dt, string fileId); | |||
string AssFixAssetsImport(DataTable dt, string fileId, string isTeacher); | |||
#endregion | |||
} | |||
@@ -40,6 +40,8 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
var strSql = new StringBuilder(); | |||
strSql.Append("SELECT t.* "); | |||
strSql.Append(" FROM Ass_FixAssets t "); | |||
strSql.Append(" left join LR_Base_Department d on t.UseDepartment=d.F_DepartmentId "); | |||
strSql.Append(" left join LR_Base_User u on t.UsePeople=u.F_UserId "); | |||
strSql.Append(" WHERE 1=1 and (t.F_DeleteMark is null or t.F_DeleteMark != 1) "); | |||
var queryParam = queryJson.ToJObject(); | |||
// 虚拟参数 | |||
@@ -76,8 +78,8 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
} | |||
if (!queryParam["UseDepartment"].IsEmpty()) | |||
{ | |||
dp.Add("UseDepartment", queryParam["UseDepartment"].ToString(), DbType.String); | |||
strSql.Append(" AND t.UseDepartment = @UseDepartment "); | |||
dp.Add("UseDepartment", "%" + queryParam["UseDepartment"].ToString() + "%", DbType.String); | |||
strSql.Append(" AND d.F_FullName like @UseDepartment "); | |||
} | |||
if (!queryParam["ManageDepartment"].IsEmpty()) | |||
{ | |||
@@ -86,8 +88,8 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
} | |||
if (!queryParam["UsePeople"].IsEmpty()) | |||
{ | |||
dp.Add("UsePeople", queryParam["UsePeople"].ToString(), DbType.String); | |||
strSql.Append(" AND t.UsePeople = @UsePeople "); | |||
dp.Add("UsePeople", "%" + queryParam["UsePeople"].ToString() + "%", DbType.String); | |||
strSql.Append(" AND u.F_RealName like @UsePeople "); | |||
} | |||
if (!queryParam["CardStatus"].IsEmpty()) | |||
{ | |||
@@ -101,8 +103,8 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
} | |||
if (!queryParam["StorageId"].IsEmpty()) | |||
{ | |||
dp.Add("StorageId", queryParam["StorageId"].ToString(), DbType.String); | |||
strSql.Append(" AND t.StorageId = @StorageId "); | |||
dp.Add("StorageId", "%" + queryParam["StorageId"].ToString() + "%", DbType.String); | |||
strSql.Append(" AND t.StorageId like @StorageId "); | |||
} | |||
if (!queryParam["DepreciationStatus"].IsEmpty()) | |||
{ | |||
@@ -130,6 +132,10 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
strSql.Append($" AND t.UsePeople='{LoginUserInfo.Get().userId}' "); | |||
} | |||
} | |||
else | |||
{ | |||
strSql.Append(" AND t.Status in (1,2,4) "); | |||
} | |||
return this.BaseRepository().FindList<Ass_FixAssetsEntity>(strSql.ToString(), dp, pagination); | |||
} | |||
@@ -226,15 +232,20 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
/// 删除实体数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
public void DeleteEntity(string keyValue) | |||
public void DeleteEntity(string keyValue, string isTeacher) | |||
{ | |||
try | |||
{ | |||
//this.BaseRepository().Delete<Ass_FixAssetsEntity>(t => keyValue.Contains(t.FAId)); | |||
//改为逻辑删除 | |||
var kv = string.Join("','", keyValue.Split(',')); | |||
this.BaseRepository().ExecuteBySql($"update Ass_FixAssets set FACode=('delete_'+FACode),F_DeleteMark=1,ModifyTime='{DateTime.Now}',ModifyUserId='{LoginUserInfo.Get().userId}' where FAId in ('{kv}')", null); | |||
if (!string.IsNullOrEmpty(isTeacher) && isTeacher == "1") | |||
{ | |||
this.BaseRepository().Delete<Ass_FixAssetsEntity>(t => keyValue.Contains(t.FAId)); | |||
} | |||
else | |||
{ | |||
//改为逻辑删除 | |||
var kv = string.Join("','", keyValue.Split(',')); | |||
this.BaseRepository().ExecuteBySql($"update Ass_FixAssets set FACode=('delete_'+FACode),F_DeleteMark=1,ModifyTime='{DateTime.Now}',ModifyUserId='{LoginUserInfo.Get().userId}' where FAId in ('{kv}')", null); | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -352,8 +363,9 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
/// </summary> | |||
/// <param name="dt"></param> | |||
/// <param name="fileId"></param> | |||
/// <param name="isTeacher">1:老师页面</param> | |||
/// <returns></returns> | |||
public string AssFixAssetsImport(DataTable dt, string fileId) | |||
public string AssFixAssetsImport(DataTable dt, string fileId, string isTeacher) | |||
{ | |||
try | |||
{ | |||
@@ -398,15 +410,15 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
{ | |||
throw (new Exception("取得日期不能为空")); | |||
} | |||
if (dr["使用部门"].ToString().IsEmpty()) | |||
if (string.IsNullOrEmpty(isTeacher) && dr["使用部门"].ToString().IsEmpty()) | |||
{ | |||
throw (new Exception("使用部门不能为空")); | |||
} | |||
if (dr["管理部门"].ToString().IsEmpty()) | |||
{ | |||
throw (new Exception("使用人不能为空")); | |||
throw (new Exception("管理部门不能为空")); | |||
} | |||
if (dr["使用人"].ToString().IsEmpty()) | |||
if (string.IsNullOrEmpty(isTeacher) && dr["使用人"].ToString().IsEmpty()) | |||
{ | |||
throw (new Exception("使用人不能为空")); | |||
} | |||
@@ -443,9 +455,7 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
GetWay = FindDataItemValue(dataItemIBLL.GetDetailList("GetWay"), dr["取得方式"].ToString(), "取得方式", false), | |||
GetDate = Convert.ToDateTime(dr["取得日期"]), | |||
UseCondition = FindDataItemValue(dataItemIBLL.GetDetailList("AssState"), dr["使用状况"].ToString(), "使用状况", false), | |||
UseDepartment = dataSourceIBLL.GetKeyByValue("classdata", "name", dr["使用部门"].ToString(), "id"), | |||
ManageDepartment = dataSourceIBLL.GetKeyByValue("classdata", "name", dr["管理部门"].ToString(), "id"), | |||
UsePeople = dataSourceIBLL.GetKeyByValue("teacheruserdata", "f_realname", dr["使用人"].ToString(), "f_userid"), | |||
Amount = dr["数量"].ToInt(), | |||
MakePeople = dr["制单人"].ToString(), | |||
MakeDate = dr["制单时间"].ToString().IsEmpty() ? new Nullable<DateTime>() : Convert.ToDateTime(dr["制单时间"]), | |||
@@ -460,7 +470,7 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
PurchaseOrganizationForm = dr["采购组织形式"].ToString(), | |||
Brand = dr["品牌"].ToString(), | |||
SpecificationModel = dr["规格型号"].ToString(), | |||
StorageId = dataSourceIBLL.GetKeyByValue("Ass_StorageData", "sname", dr["存放地点"].ToString(), "sid"), | |||
StorageId = dr["存放地点"].ToString(), | |||
SupplierId = dataSourceIBLL.GetKeyByValue("Ass_SupplierData", "sname", dr["销售商"].ToString(), "sid"), | |||
UseArea = dr["使用权面积/建筑面积"].ToDecimal(), | |||
FinancialAppropriation = dr["财政拨款"].ToDecimal(), | |||
@@ -473,9 +483,20 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
CreateUserId = LoginUserInfo.Get().userId, | |||
ModifyTime = DateTime.Now, | |||
ModifyUserId = LoginUserInfo.Get().userId, | |||
Status = 0, | |||
ProcessId = Guid.NewGuid().ToString(), | |||
F_DeleteMark = 0, | |||
Status = 4 | |||
}; | |||
if (!string.IsNullOrEmpty(isTeacher) && isTeacher == "1") | |||
{ | |||
Ass_FixAssetsEntity.UseDepartment = LoginUserInfo.Get().departmentId; | |||
Ass_FixAssetsEntity.UsePeople = LoginUserInfo.Get().userId; | |||
Ass_FixAssetsEntity.Status = 0; | |||
} | |||
else | |||
{ | |||
Ass_FixAssetsEntity.UseDepartment = dataSourceIBLL.GetKeyByValue("classdata", "name", dr["使用部门"].ToString(), "id"); | |||
Ass_FixAssetsEntity.UsePeople = dataSourceIBLL.GetKeyByValue("teacheruserdata", "f_realname", dr["使用人"].ToString(), "f_userid"); | |||
} | |||
Ass_FixAssetsinsert.Add(Ass_FixAssetsEntity); | |||
var FACode = dr["资产编号"].ToString(); | |||
@@ -20,7 +20,7 @@ namespace Learun.Application.WorkFlow | |||
} | |||
else | |||
{ | |||
asset.ChangeStatusByProcessId(parameter.processId, 0); | |||
asset.ChangeStatusByProcessId(parameter.processId, 3); | |||
} | |||
} | |||
} | |||