Files
zszq-trs/YLErpWeb/Views/client/ClientFilesEditPopInner.cshtml
T
2024-05-09 14:06:26 +08:00

318 lines
14 KiB
Plaintext

@model ClientFileResult
@{
ViewBag.Title = "客户文件";
Layout = null;
List<string> protocolTypes = new List<string>() { "MainProtocol", "EnhanceProtocol", "DateMargin", "AllographProduct" };
bool backGround = true;
bool HasSentDrop = false;
List<string> protocolsAndNames = new List<string>();
}
<style>
#tbodyEditClientFiles .innerInputTr th input {
min-width: 62px !important;
min-height: 28px !important;
background: #e0eaf1 !important;
border: 1px solid #ff6462 !important;
color: #ff6462 !important;
border-radius: 5px !important;
text-shadow: none !important;
}
#tbodyEditClientFiles .innerInputTr {
background: #e0eaf1;
min-height: 100px;
}
#tbodyEditClientFiles .innerInputTr_2 {
background: #efefff;
min-height: 100px;
}
table th {
color: #17A2B8;
}
.edittablepop {
background: #e0eaf1;
}
.dropline:before {
content: "";
position: absolute;
width: 85%;
height: 2px;
background-color: black;
display: block;
margin-top: 10px;
margin-left: 25px;
}
</style>
<script type="text/javascript">
function DeleteClientFile(clientId, fileName,protocol,NeedBatchDelete) {
if (NeedBatchDelete == 'True') {
var alert = "删除该主协议,将同时删除和其关联的废弃已报送协议文件。";
if (protocol) {
alert += "(协议文件删除将重新审批)"
}
main.confirm(alert, function () {
main.post("/client/DeleteFile", { clientId: clientId, fileName: fileName, protocolNumber: protocol }).done(function (res) {
if ("@ViewBag.ClientType" == "clientEdit") {
if (protocol) {
window.parent.reloadclient();
} else {
window.location.href = "/client/clientEdit?enid=" + clientId + "&tabId=5";
}
}
if ("@ViewBag.ClientType" == "clientView") {
window.location.href = "/client/clientView?enid=" + clientId + "&tabId=5";
}
});
});
} else {
var alert = "确定删除吗?";
if (protocol) {
alert += "(协议文件删除将重新审批)"
}
main.confirm(alert, function () {
main.post("/client/DeleteFile", { clientId: clientId, fileName: fileName, protocolNumber: protocol }).done(function (res) {
if ("@ViewBag.ClientType" == "clientEdit") {
if (protocol) {
window.parent.reloadclient();
} else {
window.location.href = "/client/clientEdit?enid=" + clientId + "&tabId=5";
}
}
if ("@ViewBag.ClientType" == "clientView") {
window.location.href = "/client/clientView?enid=" + clientId + "&tabId=5";
}
});
});
}
}
function AbandonClientFile(clientId, protocolNumber) {
var alert = "警告:一但废止文件被报送后将无法解除废止,是否仍要废止?";
if (protocolNumber) {
alert += "(协议文件废止将重新审批)"
}
main.confirm(alert, function () {
main.post("/client/AbandonFile", { clientId: clientId, protocolNumber: protocolNumber}).done(function (res) {
if ("@ViewBag.ClientType" =="clientEdit") {
if (protocolNumber) {
window.parent.reloadclient();
} else {
window.location.href = "/client/clientEdit?enid=" + clientId + "&tabId=5";
}
}
if ("@ViewBag.ClientType" =="clientView") {
window.location.href = "/client/clientView?enid=" + clientId + "&tabId=5";
}
});
});
}
function DeabandonClientFile(clientId, protocolNumber) {
var alert = "确认解除废止?";
if (protocolNumber) {
alert += "(协议文件解除废止将重新审批)"
}
main.confirm(alert, function () {
main.post("/client/DeabandonFile", { clientId: clientId, protocolNumber: protocolNumber}).done(function (res) {
if ("@ViewBag.ClientType" =="clientEdit") {
if (protocolNumber) {
window.parent.reloadclient();
} else {
window.location.href = "/client/clientEdit?enid=" + clientId + "&tabId=5";
}
}
if ("@ViewBag.ClientType" =="clientView") {
window.location.href = "/client/clientView?enid=" + clientId + "&tabId=5";
}
});
});
}
function RecoverClientFile(clientId, fileName, protocolNumber) {
var alert = "还原文件将无法回到现在的状态,确认还原?";
if (protocolNumber) {
alert += "(协议文件还原将重新审批)"
}
main.confirm(alert, function () {
main.post("/client/RecoverFile", { clientId: clientId,fileName:fileName, protocolNumber: protocolNumber}).done(function (res) {
if ("@ViewBag.ClientType" =="clientEdit") {
if (protocolNumber) {
window.parent.reloadclient();
} else {
window.location.href = "/client/clientEdit?enid=" + clientId + "&tabId=5";
}
}
if ("@ViewBag.ClientType" =="clientView") {
window.location.href = "/client/clientView?enid=" + clientId + "&tabId=5";
}
});
});
}
function DownloadClientFile(clientId, fileName) {
main.post("/client/DownloadClientFile", { clientId: clientId, fileName: fileName }).done(function (res) {
res += (res.lastIndexOf('?') > 0 ? "&" : "?") + "t=" + new Date().getTime();
window.open(res);
});
}
</script>
<div style="margin-top: 10px;"></div>
<form id="formEditClientFiles">
<table class="table edittablepop">
<tr>
<th>文件类型</th>
<th>文件名</th>
<th>签署时间</th>
<th>协议编号</th>
<th>文件说明</th>
<th>日期</th>
<th>操作</th>
</tr>
<tbody id="tbodyEditClientFiles">
@if (Model.FilesDic != null && Model.FilesDic.Count > 0)
{
foreach (var clientFileRets in Model.FilesDic)
{
backGround = !backGround;
List<string> mainProtocols = clientFileRets.Value.Where(o => !string.IsNullOrWhiteSpace(o.file.MainProtocolNumber)).Select(o => o.file.MainProtocolNumber).Distinct().ToList();
foreach (var clientFileRet in clientFileRets.Value)
{
var clientFile = clientFileRet.file;
HasSentDrop = clientFile.HasSent && clientFile.OptState == ConsReport.OptFlagsEnum.D;
<tr class="@(backGround?"innerInputTr":"innerInputTr_2")">
@if (!string.IsNullOrWhiteSpace(clientFile.FileName))
{
string[] names = clientFile.FileName.Split('-');
if (names != null && names.Length > 0)
{
<td class="@(HasSentDrop?"dropline":"")">
@clientFile.FileTypeName
</td>
<td style="display:none" name="fileName"> @clientFile.FileName</td>
<td>
@if (clientFile.FileDesc == null)
{
@clientFile.FileName.Substring(clientFile.FileName.IndexOf('-') + 1, clientFile.FileName.IndexOf('.') - clientFile.FileName.IndexOf('-') - 1)
}
else
{
@clientFile.FileName.Substring(0, clientFile.FileName.IndexOf('.'))
}
@if (clientFile.FileTypeName == ConsGlobal.ClientFileType.MainProtocol)
{
<i class="fa fa-link" title="签署版本: @clientFile.SignType &#10 @clientFile.ReportorRole 填报" />
}
@if (!string.IsNullOrWhiteSpace(clientFile.MainProtocolNumber))
{
<i class="fa fa-link" title="关联协议: @clientFile.MainProtocolNumber" />
}
</td>
<td>
@if (clientFile.SignDate != null && clientFile.SignDate != DateTime.MinValue)
{
@clientFile.SignDate.Value.ToString("yyyy-MM-dd");
}
</td>
<td name="protocolNumber">
@if (!string.IsNullOrWhiteSpace(clientFile.ProtocolNumber))
{
@clientFile.ProtocolNumber;
}
</td>
<td>
@*@fileName.Split(new string[] { "-" }, StringSplitOptions.RemoveEmptyEntries)[0]*@
@if (clientFile.FileDesc != null)
{
@clientFile.FileDesc
}
else if (names.Count() > 1 && names[0] != null && names[0].Length > 0)
{
@names[0]
}
</td>
<td>
@if (clientFile.BookTime != null && clientFile.BookTime != DateTime.MinValue)
{
@clientFile.BookTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
}
else
{
@clientFile.OptDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
}
</td>
}
else
{
<td></td>
<td></td>
<td></td>
<td></td>
}
}
else
{
<td></td>
<td></td>
<td></td>
<td></td>
}
<td>
@MyControls.Btn("下载", string.Format("DownloadClientFile('{0}', '{1}')", Model.EncryptId, clientFile.FileName))
@if (ViewBag.ClientType == "clientEdit")
{
if (clientFileRet.CanDrop)
{
@MyControls.Btn("废止", string.Format("AbandonClientFile('{0}', '{1}')", Model.EncryptId, clientFile.ProtocolNumber))
}
if (clientFileRet.CanDelete)
{
var needBatchDelete = (mainProtocols.Contains(clientFileRet.file.ProtocolNumber) && clientFileRet.file.HasSent);
@MyControls.Btn("删除", string.Format("DeleteClientFile('{0}','{1}','{2}','{3}')", Model.EncryptId, clientFile.FileName, clientFile.ProtocolNumber, needBatchDelete))
}
if (clientFileRet.CanBack)
{
if (clientFileRet.file.OptState == ConsReport.OptFlagsEnum.D)
{
@MyControls.Btn("解除废弃", string.Format("RecoverClientFile('{0}','{1}','{2}')", Model.EncryptId, clientFile.FileName, clientFile.ProtocolNumber))
}
else
{
@MyControls.Btn("还原", string.Format("RecoverClientFile('{0}','{1}','{2}')", Model.EncryptId, clientFile.FileName, clientFile.ProtocolNumber))
}
}
}
</td>
</tr>
}
}
}
</tbody>
</table>
<input type="hidden" />
<input type="hidden" id="dataCount" name="dataCount" value="@Model.FileNames.Count" />
</form>