206 lines
7.7 KiB
Plaintext
206 lines
7.7 KiB
Plaintext
@{
|
|
ViewBag.Title = "编辑描述";
|
|
Layout = "~/Views/Shared/_InfoLayout.cshtml";
|
|
var otherUsers = AppManager.SmtpConfig.OtherUsers;
|
|
var defaultUser = AppManager.SmtpConfig;
|
|
}
|
|
@section CSS{
|
|
<style>
|
|
#container {
|
|
min-height: 280px;
|
|
}
|
|
</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">
|
|
$(document).ready(function () {
|
|
var ue = makeUeEditor('container');
|
|
var ue2 = makeUeEditor('container2');
|
|
var ue3 = makeUeEditor('container3');
|
|
|
|
changeOperate();
|
|
changeTemplate();
|
|
});
|
|
|
|
function savedesc() {
|
|
var ccemail = $("#CCEmail").val();
|
|
var ue = UE.getEditor('container');
|
|
var ue2 = UE.getEditor('container2');
|
|
var ue3 = UE.getEditor('container3');
|
|
var sendUser = $("#sendUser").val();
|
|
var needAppendix = $("#NeedAppendix").prop("checked");
|
|
var AppendixType = "";
|
|
|
|
var template = $("#setTemplate").val();
|
|
if ($("#operate:checked").val() == "AddNew") {
|
|
if (!$("#addTemplate").val()) {
|
|
main.message("模板名为空,无法新增");
|
|
return;
|
|
}
|
|
template = $("#addTemplate").val();
|
|
}
|
|
|
|
if (needAppendix) {
|
|
AppendixType = $("#fileType:checked").val();
|
|
}
|
|
|
|
if ($("#operate:checked").val() == "Remove") {
|
|
main.confirm("目前勾选删除,确认要删除该模板?", function () {
|
|
main.post("/trade/removeTemplate", { template: template }).done(function (res) {
|
|
})
|
|
});
|
|
return;
|
|
}
|
|
if (template) {
|
|
main.post("/trade/SaveTradeDetailDesc", {
|
|
ccemail: ccemail, biaoTou: ue.getContent(),
|
|
biaoWei: ue2.getContent(), luoKuan: ue3.getContent(),
|
|
sendUser: sendUser, appendixType: AppendixType, template: template
|
|
}).done(function (res) {
|
|
});
|
|
}
|
|
else {
|
|
main.post("/trade/SaveTradeDetailDesc", {
|
|
ccemail: ccemail, biaoTou: ue.getContent(),
|
|
biaoWei: ue2.getContent(), luoKuan: ue3.getContent(),
|
|
sendUser: sendUser, appendixType: AppendixType
|
|
}).done(function (res) {
|
|
});
|
|
}
|
|
}
|
|
|
|
function makeUeEditor(id) {
|
|
UE.delEditor(id);
|
|
var ue = UE.getEditor(id, {
|
|
autoHeight: false,
|
|
wordCount: false,
|
|
});
|
|
return ue;
|
|
}
|
|
|
|
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 setTemplate(ccEmail, biaoTou, biaoWei, luoKuan, sendUser,appendix) {
|
|
$("#CCEmail").val(ccEmail);
|
|
var ue = UE.getEditor('container');
|
|
ue.ready(function () {//编辑器初始化完成再赋值
|
|
let html = main.decodeHtmlEntity(biaoTou);
|
|
ue.setContent(html); //赋值给UEditor
|
|
});
|
|
var ue2 = UE.getEditor('container2');
|
|
ue2.ready(function () {//编辑器初始化完成再赋值
|
|
let html = main.decodeHtmlEntity(biaoWei);
|
|
ue2.setContent(html); //赋值给UEditor
|
|
});
|
|
var ue3 = UE.getEditor('container3');
|
|
ue3.ready(function () {//编辑器初始化完成再赋值
|
|
let html = main.decodeHtmlEntity(luoKuan);
|
|
ue3.setContent(html); //赋值给UEditor
|
|
});
|
|
$("#CCEMail").val(ccEmail);
|
|
|
|
$("#sendUser").val(sendUser);
|
|
|
|
if (appendix) {
|
|
$("#NeedAppendix").prop("checked", true);
|
|
}
|
|
else {
|
|
$("#NeedAppendix").prop("checked", false);
|
|
}
|
|
showTypes(appendix);
|
|
|
|
}
|
|
|
|
function changeTemplate() {
|
|
var template = $("#setTemplate").val();
|
|
main.post("/trade/GetTradeDetailTemplate", { template: template }).done(function (res) {
|
|
if (res) {
|
|
setTemplate(res.CCEmail, res.TradeDetailsBiaoTou, res.TradeDetailsBiaoWei, res.TradeDetailsLuoKuan, res.TradeDetailsSendUser, res.TradeDetailsNeedAppendix);
|
|
}
|
|
});
|
|
}
|
|
|
|
function showTypes(appendix) {
|
|
if ($("#NeedAppendix").prop("checked")) {
|
|
$("#AppendixType").show();
|
|
} else {
|
|
$("#AppendixType").hide();
|
|
}
|
|
if (appendix) {
|
|
if (appendix == "PDF") {
|
|
$("input#fileType").eq(1).prop("checked", true)
|
|
}
|
|
else {
|
|
$("input#fileType").eq(0).prop("checked", true)
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
}
|
|
|
|
<div class="toolbarDiv">
|
|
<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", "模板名: ", tradeController.GetAllTradeDetailTemplate(), false, "默认", true, new { onchange = "changeTemplate()" })
|
|
</div>
|
|
<div id="newTemplate">
|
|
@Html.ShortInput("addTemplate", "模板名: ")
|
|
</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>
|
|
<div class="form-group">
|
|
<h3>表头说明:</h3>
|
|
<div style="margin-top: 20px;">
|
|
<script id="container" type="text/plain">
|
|
</script>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<h3>表尾说明:</h3>
|
|
<div style="margin-top: 20px;">
|
|
<script id="container2" type="text/plain">
|
|
</script>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<h3>邮件落款:</h3>
|
|
<div style="margin-top: 20px;">
|
|
<script id="container3" type="text/plain">
|
|
</script>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
邮件CC地址: <input type="text" id="CCEmail" style="width: 300px;" />
|
|
</div>
|
|
<div class="form-group">
|
|
<input type="checkbox" id="NeedAppendix" style="margin-right:6px" onchange="showTypes()"/> 添加附件
|
|
</div>
|
|
<div class="form-group" id="AppendixType">
|
|
@Html.RadioButton("fileType", "Excel",true) Excel
|
|
@Html.RadioButton("fileType", "PDF") PDF
|
|
</div>
|
|
<input type="button" class="btn btn-primary" style="margin-top: 20px;" value="保存说明" onclick="savedesc()" />
|
|
</div>
|