341 lines
16 KiB
Plaintext
341 lines
16 KiB
Plaintext
@{
|
|
ViewBag.Title = "客户报告发送";
|
|
Layout = "~/Views/Shared/_InfoLayout.cshtml";
|
|
}
|
|
@section CSS{
|
|
<style>
|
|
.btn { border: 1px solid #fff !important; min-width: 70px !important; }
|
|
|
|
.btn-primary, .btn-primary:focus { border-color: #fff; }
|
|
|
|
.col-md-12 { padding-left: 0; margin-top: 20px; margin-bottom: 20px; }
|
|
|
|
input[type=text] { width: 98%; }
|
|
|
|
.check-input { margin: 0 50px 0 10px !important; }
|
|
|
|
#listdiv > div:first-child > h3:nth-child(n+2) { margin-top: 15px; }
|
|
|
|
#addTemplate { width: 152px; }
|
|
</style>
|
|
}
|
|
@section JS{
|
|
<script type="text/javascript" src="/Scripts/ueditor/ueditor.config.js?v=@(HtmlUtil.JsVersion)"></script>
|
|
<script type="text/javascript" src="/Scripts/ueditor/ueditor.all.min.js?v=@(HtmlUtil.JsVersion)"></script>
|
|
<script type="text/javascript">
|
|
var ContractTypeCtrl;
|
|
$(function () {
|
|
var ue = makeUeEditor('container');
|
|
|
|
var m_ue = makeUeEditor('margin_container');
|
|
changeOperate();
|
|
changeTemplate();
|
|
ContractTypeCtrl = new ContractTypeCtrl(document.getElementById('ContractTypeCtrl'));
|
|
});
|
|
|
|
function makeUeEditor(id) {
|
|
UE.delEditor(id);
|
|
var ue = UE.getEditor(id, {
|
|
autoHeight: false,
|
|
wordCount: false,
|
|
});
|
|
return ue;
|
|
}
|
|
|
|
var vue = new Vue({
|
|
el: "#listdiv",
|
|
data: {
|
|
Model: { ClientId: 0, From: "", To: "", Detail: "", Title: "", FileTypes: [{ type: "PDF", checked: false }, { type: "EXCEL", checked: true }] }
|
|
},
|
|
mounted: function () {
|
|
var thisObj = this;
|
|
// debugger;
|
|
var pData = window.parent.screenData();
|
|
$.extend(thisObj.Model, pData);
|
|
},
|
|
methods: {
|
|
saveLuoKuan: function () {
|
|
var ue = UE.getEditor('container');
|
|
var m_ue = UE.getEditor('margin_container');
|
|
var selectcontent = [];
|
|
$("input[name='sendcontent']").each(function (i, d) {
|
|
if (d.checked) {
|
|
selectcontent.push(d.value);
|
|
}
|
|
});
|
|
if (selectcontent.length == 0 && !isShenWan) {
|
|
main.message("报告内容不能设置为空");
|
|
return false;
|
|
}
|
|
|
|
var template = $("#setTemplate").val();
|
|
if ($("#operate:checked").val() == "AddNew") {
|
|
if (!$("#addTemplate").val()) {
|
|
main.message("模板名为空,无法新增");
|
|
return;
|
|
}
|
|
template = $("#addTemplate").val();
|
|
}
|
|
|
|
if ($("#operate:checked").val() == "Remove") {
|
|
main.confirm("目前勾选删除,确认要删除该模板?", function () {
|
|
main.post("/clientbalance/removeTemplate", { template: template }).done(function (res) {
|
|
})
|
|
});
|
|
return;
|
|
}
|
|
|
|
if (!vue.Model.Title) {
|
|
main.message("报告标题不能设置为空");
|
|
return false;
|
|
}
|
|
var ccemail = $("#CCEmail").val();
|
|
if (template) {
|
|
main.post("/clientbalance/saveLuokuan", { title: vue.Model.Title, luokuan: ue.getContent(), marginluokuan: m_ue.getContent(), sheets: selectcontent.join(','), ccemail: ccemail, template: template });
|
|
} else {
|
|
main.post("/clientbalance/saveLuokuan", { title: vue.Model.Title, luokuan: ue.getContent(), marginluokuan: m_ue.getContent(), sheets: selectcontent.join(','), ccemail: ccemail });
|
|
}
|
|
|
|
},
|
|
downloadFile: function () {
|
|
var thisObj = this;
|
|
thisObj.Model.PayableMargin = @ViewBag.PayableMargin;
|
|
thisObj.Model.PayableFund = @ViewBag.PayableFund;
|
|
thisObj.Model.ReportType = "@ViewBag.ReportType";
|
|
thisObj.Model.ParentFlag= "@ViewBag.ParentFlag";
|
|
var selectcontent = [];
|
|
$("input[name='sendcontent']").each(function (i, d) {
|
|
if (d.checked) {
|
|
selectcontent.push(d.value);
|
|
}
|
|
});
|
|
thisObj.Model.SendContent = selectcontent;
|
|
if (selectcontent.length == 0) {
|
|
main.message("报告内容不能设置为空");
|
|
return false;
|
|
}
|
|
|
|
var template = $("#setTemplate").val();
|
|
|
|
$.each(thisObj.Model.FileTypes, function (i, d) {
|
|
if (d.checked == true) {
|
|
thisObj.Model.TargetFileType = d.type;
|
|
main.post("/clientbalance/ViewTradeMarketFile", { emailData: thisObj.Model, template: template }).done(function (res) {
|
|
window.open(res.obj);
|
|
});
|
|
}
|
|
});
|
|
},
|
|
sendEmail: function () {
|
|
var clientIds = this.Model.ClientId;
|
|
ContractTypeCtrl.changeContractType(clientIds);
|
|
$("#modalChooseContractType").modal('show');
|
|
},
|
|
sendReport: function () {
|
|
var thisObj = this;
|
|
//thisObj.saveLuoKuan();
|
|
var hasCheck = false;
|
|
$.each(thisObj.Model.FileTypes, function (i, d) {
|
|
if (d.checked == true) {
|
|
hasCheck = true;
|
|
}
|
|
});
|
|
if (!hasCheck) {
|
|
main.message("请至少选择一种文件格式");
|
|
return false;
|
|
}
|
|
|
|
if (!thisObj.Model.Title) {
|
|
main.message("请输入邮件标题");
|
|
return false;
|
|
}
|
|
|
|
var selectcontent = [];
|
|
$("input[name='sendcontent']").each(function (i, d) {
|
|
if (d.checked) {
|
|
selectcontent.push(d.value);
|
|
}
|
|
});
|
|
if (selectcontent.length == 0) {
|
|
main.message("请选择报告内容");
|
|
return false;
|
|
}
|
|
thisObj.Model.SendContent = selectcontent;
|
|
|
|
var ue = UE.getEditor('container');
|
|
var m_ue = UE.getEditor('margin_container');
|
|
thisObj.Model.Detail = ue.getContent();
|
|
thisObj.Model.MarginDetail = m_ue.getContent();
|
|
thisObj.Model.PayableMargin = @ViewBag.PayableMargin;
|
|
thisObj.Model.PayableFund = @ViewBag.PayableFund;
|
|
thisObj.Model.ReportType = "@ViewBag.ReportType";
|
|
thisObj.Model.ParentFlag = "@ViewBag.ParentFlag";
|
|
thisObj.Model.CCEmail = $("#CCEmail").val();
|
|
|
|
var template = $("#setTemplate").val();
|
|
|
|
var doneFunc = function (res) {
|
|
if (!res || !res.obj) {
|
|
return;
|
|
}
|
|
var htmlContent = `<div style="padding:10px">${res.obj.message}</div>`;
|
|
if (res.obj.type == "追保") {
|
|
var layerIndex = main.open2("提示",
|
|
htmlContent,
|
|
{
|
|
area: ["430px", "175px"],
|
|
btn: ['使用', '不使用',"取消"],
|
|
yes: function (index, layero) {
|
|
main.post("/clientbalance/GenerateTradeMarketBill2", { emailData: thisObj.Model, skipOrNot: "Not", template: template})
|
|
.done(function () {
|
|
layer.close(layerIndex);
|
|
});
|
|
},
|
|
btn2: function (index, layero) {
|
|
main.post("/clientbalance/GenerateTradeMarketBill2", { emailData: thisObj.Model, skipOrNot: "Skip", template: template })
|
|
.done(function () {
|
|
layer.close(layerIndex);
|
|
});
|
|
},
|
|
btn3: function (index, layero) {
|
|
layer.close(layerIndex);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
main.post("/clientbalance/GenerateTradeMarketBill2", { emailData: thisObj.Model, skipOrNot: "", template: template }).done(doneFunc);
|
|
},
|
|
close: function () {
|
|
parent.layer.closeAll();
|
|
},
|
|
toggleCheck: function () {
|
|
var thisObj = this;
|
|
var checked = $("#selectall").prop("checked");
|
|
$.each(thisObj.Model.FileTypes, function (i, d) {
|
|
d.checked = checked;
|
|
});
|
|
}
|
|
}
|
|
})
|
|
|
|
function changeOperate() {
|
|
switch ($("#operate:checked").val()) {
|
|
case "AddNew": $("#selectTemplate").hide(); $("#newTemplate").show(); break;
|
|
case "Update": $("#selectTemplate").show(); $("#newTemplate").hide(); break;
|
|
case "Remove": $("#selectTemplate").show(); $("#newTemplate").hide(); break;
|
|
};
|
|
}
|
|
|
|
function changeTemplate() {
|
|
template = $("#setTemplate").val();
|
|
main.post("/clientbalance/GetClientBalanceTemplate", { template: template }).done(function (res) {
|
|
if (res) {
|
|
setTemplate(res.Title, res.TradeMarketSheets, res.LuoKuanDesc, res.MarginLuoKuanDesc, res.CCEmail)
|
|
}
|
|
});
|
|
}
|
|
|
|
function setTemplate(title, sheets, luokuan, marginLuokuan,ccemail) {
|
|
vue.Model.Title = title;
|
|
!sheets && (sheets = '');
|
|
$("[name=sendcontent]").each(function () {
|
|
let val = $(this).val();
|
|
val !== '账户状况' && $(this).prop('checked', sheets.indexOf(val) >= 0);
|
|
});
|
|
var ue = UE.getEditor('container');
|
|
var m_ue = UE.getEditor('margin_container');
|
|
if(luokuan==null){
|
|
luokuan="";
|
|
}
|
|
ue.ready(function () {//编辑器初始化完成再赋值
|
|
let html = main.decodeHtmlEntity(luokuan);
|
|
ue.setContent(html); //赋值给UEditor
|
|
});
|
|
if(marginLuokuan==null){
|
|
marginLuokuan="";
|
|
}
|
|
m_ue.ready(function () {//编辑器初始化完成再赋值
|
|
let html = main.decodeHtmlEntity(marginLuokuan);
|
|
m_ue.setContent(html); //赋值给UEditor
|
|
});
|
|
$("#CCEmail").val(ccemail);
|
|
}
|
|
|
|
function toWildcard() {
|
|
main.open("结算报告通配符", "/Wildcard/ClientBalanceReportWildcard", {area:['600px','800px']})
|
|
}
|
|
|
|
</script>
|
|
}
|
|
<div id="listdiv" class="yc-panel" style="padding-bottom:30px;">
|
|
<div>
|
|
<h3>模板:</h3>
|
|
@Html.RadioButton("operate", "AddNew", new { onclick = "changeOperate()" }) 新增
|
|
@Html.RadioButton("operate", "Update", true, new { onclick = "changeOperate()" }) 修改
|
|
@Html.RadioButton("operate", "Remove", new { onclick = "changeOperate()" }) 删除
|
|
<div id="selectTemplate">
|
|
@Html.MyAceDropdownInput2("setTemplate", "模板名: ", YLErp.Web.Controllers.clientbalanceController.GetAllClientBalanceTemplate(), false, "默认", true, new { onchange = "changeTemplate()" })
|
|
</div>
|
|
<div id="newTemplate">
|
|
@Html.ShortInput("addTemplate", "模板名: ")
|
|
</div>
|
|
<h3>收件人:</h3>
|
|
<span style="word-wrap:break-word;">@(string.Join(",", ViewBag.emails))</span>
|
|
<h3>
|
|
邮件主题:<span style="font-size: 80%;">(必填)</span>
|
|
<input type="button" class="wentiEdit" value="通配符" title="通配符示例" onclick="toWildcard()" style="float:right;height:25px;margin-right:2%" />
|
|
</h3>
|
|
<input type="text" class="text" v-model="Model.Title" />
|
|
<h3>邮件正文:</h3>
|
|
<div style="width: 98%">
|
|
<script id="container" type="text/plain">
|
|
</script>
|
|
</div>
|
|
<h3>追保邮件正文:</h3>
|
|
<div style="width: 98%;margin-bottom:5px">
|
|
<script id="margin_container" type="text/plain">
|
|
</script>
|
|
</div>
|
|
<div class="form-group">
|
|
邮件CC地址: <input type="text" id="CCEmail" style="width: 300px;" />
|
|
</div>
|
|
@if (PS.Config.Company != CompanyEnum.中金)
|
|
{
|
|
<h3>报告内容:</h3>
|
|
<div class="send-content-item">
|
|
<lable>账户状况:</lable><input class="check-input" type="checkbox" name="sendcontent" value="账户状况" />
|
|
<lable>互换估值:</lable><input class="check-input" type="checkbox" name="sendcontent" value="互换估值" />
|
|
<lable>互换交易流水:</lable><input class="check-input" type="checkbox" name="sendcontent" value="互换交易流水" />
|
|
<lable>资金明细:</lable><input class="check-input" type="checkbox" name="sendcontent" value="资金明细" />
|
|
<lable>质押记录:</lable><input class="check-input" type="checkbox" name="sendcontent" value="质押记录" />
|
|
</div>
|
|
<h3>邮件附件:</h3>
|
|
<div class="send-type-item">
|
|
<template v-for="(fileType,index) in Model.FileTypes">
|
|
<lable>{{fileType.type}}</lable>
|
|
<input class="check-input" type="checkbox" :id="'cb'+fileType.type" value="true" v-model="fileType.checked" />
|
|
</template>
|
|
</div>
|
|
}
|
|
else
|
|
{
|
|
<div class="send-content-item" hidden>
|
|
<lable>账户状况:</lable><input class="check-input" type="checkbox" name="sendcontent" value="账户状况" checked onclick="return false;" />
|
|
</div>
|
|
<div class="send-type-item" hidden>
|
|
<template v-for="(fileType,index) in Model.FileTypes">
|
|
<lable>{{fileType.type}}</lable>
|
|
<input class="check-input" type="checkbox" :id="'cb'+fileType.type" value="true" v-model="fileType.checked" />
|
|
</template>
|
|
</div>
|
|
}
|
|
</div>
|
|
<div>
|
|
<input class="btn btn-primary" type="button" value="保存" v-on:click="saveLuoKuan()" />
|
|
<input class="btn btn-primary" type="button" value="导出" v-on:click="downloadFile()" />
|
|
<input class="btn btn-primary" type="button" value="发送" v-on:click="sendReport()" />
|
|
<input class="btn btn-primary" type="button" value="取消" v-on:click="close()" />
|
|
</div>
|
|
</div>
|
|
|
|
@await Html.PartialAsync("/Views/Common/_chooseContractType.cshtml", "vue.sendReport()") |