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

204 lines
7.6 KiB
Plaintext

@{
ViewBag.Title = "客户报告发送";
Layout = "~/Views/Shared/_InfoLayout.cshtml";
var otherUsers = AppManager.SmtpConfig.OtherUsers;
var defaultUser = AppManager.SmtpConfig;
}
@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">
$(function () {
var m_ue = makeUeEditor('margin_container');
changeOperate();
changeTemplate();
});
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: "",sendUser:"", 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 m_ue = UE.getEditor('margin_container');
var selectcontent = [];
$("input[name='sendcontent']").each(function (i, d) {
if (d.checked) {
selectcontent.push(d.value);
}
});
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;
}
if (template) {
main.post("/clientbalance/saveLuokuan", { sendUser: vue.Model.sendUser,title: vue.Model.Title, luokuan: "", marginluokuan: m_ue.getContent(), sheets: selectcontent.join(','), template: template });
} else {
main.message("模板名不能设置为空");
return false;
}
},
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.sendUser,res.Title, res.TradeMarketSheets,res.LuoKuanDesc,res.MarginLuoKuanDesc)
}
});
}
function setTemplate(sendUser, title, sheets, luokuan, marginLuokuan) {
vue.Model.Title = title;
!sheets && (sheets = '');
$("[name=sendcontent]").each(function () {
let val = $(this).val();
val !== '账户状况' && $(this).prop('checked', sheets.indexOf(val) >= 0);
});
var m_ue = UE.getEditor('margin_container');
m_ue.ready(function () {//编辑器初始化完成再赋值
let html = main.decodeHtmlEntity(marginLuokuan);
m_ue.setContent(html); //赋值给UEditor
});
}
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()" }) 新增 &nbsp;&nbsp;
@Html.RadioButton("operate", "Update", true, new { onclick = "changeOperate()" }) 修改 &nbsp;&nbsp;
@Html.RadioButton("operate", "Remove", new { onclick = "changeOperate()" }) 删除 &nbsp;&nbsp;
<div id="selectTemplate">
@Html.MyAceDropdownInput2("setTemplate", "模板名:&nbsp; ", YLErp.Web.Controllers.clientbalanceController.GetAllClientBalanceTemplate(), false, "默认", true, new { onchange = "changeTemplate()" })
</div>
<div id="newTemplate">
@Html.ShortInput("addTemplate", "模板名:&nbsp; ")
</div>
<h3>发件人:</h3>
<select id="sendUser">
<option value="@defaultUser.From">@defaultUser.UserName</option>
@if (otherUsers != null)
{
foreach (var user in otherUsers)
{
<option value="@user.From">@user.UserName</option>
}
}
</select>
<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%;margin-bottom:5px">
<script id="margin_container" type="text/plain">
</script>
</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="close()" />
</div>
</div>