ComplianceServer/oldcode/Core.Web/Views/InComplaint/InComplaintEdit.cshtml

361 lines
14 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@using CRM.Core.Model.Entity
@using Core.Web.WebHelper
@model Core.Web.Controllers.InComplaintController.InComplaintDto
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
var read = (bool)ViewBag.Readonly;
}
<style>
.layui-form-label {
width: 150px
}
.layui-input-block {
margin-left: 0;
}
.layui-laydate-content > .layui-laydate-list {
padding-bottom: 0px;
overflow: hidden;
}
.layui-laydate-content > .layui-laydate-list > li {
width: 50%
}
.merge-box .scrollbox .merge-list {
padding-bottom: 5px;
}
.layui-form-item .layui-input-inline {
float: left;
width: auto !important;
margin-right: 10px;
}
</style>
<div class="x-body">
<form class="layui-form" action="" lay-filter="formTest">
<input type="hidden" id="id" name="id" value="@Model.id" />
@*<input type="hidden" id="eid" name="eid" value="" />*@
<input type="hidden" id="operator" name="operator" value="@ViewBag.userName" />
<input type="hidden" id="operatoreid" name="operatoreid" value="@ViewBag.eid" />
@*<input type="hidden" id="companycode" name="companycode" value="" />*@
<div class="layui-form-item">
<label class="layui-form-label"><span style="color: red">*</span>客户ID</label>
<div class="layui-input-inline">
<input type="text" name="resid" id="resid" lay-verify="required" placeholder="" autocomplete="off" class="layui-input" style="width:300px;" value="@Model.resid" @Html.Raw(Model.id == 0 ? "" : "disabled")>
</div>
@if (Model.id == 0)
{
<div class="layui-input-inline" style="width:0;">
<button class="layui-btn layui-btn-sm layui-btn-primary" type="button" id="search">查找</button>
</div>
}
</div>
<div class="layui-form-item">
<label class="layui-form-label">客户姓名:</label>
<div class="layui-input-inline">
<input type="text" name="cname" id="cname" placeholder="" autocomplete="off" class="layui-input" style="width:300px;" value="@Model.cname">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label"><span style="color: red">*</span>事业部:</label>
<div class="layui-input-inline">
<select name="deptid" id="deptid" lay-verify="required" lay-filter="deptid" @Html.Raw(Model.id == 0 ? "" : "disabled")>
<option value="">请选择</option>
@if (ViewBag.companyList != null)
{
var list = ViewBag.companyList as List<CRM.Core.BLL.Util.DeptmentDto>;
foreach (var item in list)
{
<option value="@item.Id">@item.Title</option>
}
}
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label"><span style="color: red">*</span>客户内诉日期:</label>
<div class="layui-input-inline">
<input class="layui-input" lay-verify="required" placeholder="" name="inComplaintDate" id="inComplaintDate" style="width:300px;" value="@Model.inComplaintDateStr" @Html.Raw(Model.id == 0 ? "" : "disabled")>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label"><span style="color: red">*</span>内诉渠道(可多选)</label>
<div class="layui-input-inline">
<div id="InComplaintChannels" style="width: 400px"></div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label"><span style="color: red">*</span>投诉原因 (可多选)</label>
<div class="layui-input-inline">
<div id="Reasons" style="width: 400px"></div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label"><span style="color: red">*</span>投诉内容:</label>
<div class="layui-input-inline">
<textarea class="layui-textarea" lay-verify="required" name="content" id="content" style="width:300px;" @Html.Raw(read ? "disabled" : "")>@Model.content</textarea>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">处理结果:</label>
<div class="layui-input-inline">
<textarea class="layui-textarea" name="follow" id="follow" style="width:300px;" @Html.Raw(read ? "disabled" : "")>@Model.follow</textarea>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">合规核查:</label>
<div class="layui-input-inline">
<textarea class="layui-textarea" name="remark" id="remark" style="width:300px;" @Html.Raw(read ? "disabled" : "")>@Model.remark</textarea>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">风险情况:</label>
<div class="layui-input-inline">
<textarea class="layui-textarea" name="riskSituation" id="riskSituation" style="width:300px;" @Html.Raw(read ? "disabled" : "")>@Model.riskSituation</textarea>
</div>
</div>
@if (!read)
{
<div class="layui-form-item">
<div class="layui-input-block" style="float: right">
<button class="layui-btn layui-btn-sm layui-btn-normal" type="button" lay-submit="" id="save" lay-filter="save" onclick="return false;">保存</button>
</div>
</div>
}
</form>
</div>
<script src="~/Scripts/layui_ext/xm-select/xm-select.js"></script>
<script>
var selectRow = {};
var layer;
var table;
var winindex;
var upload;
var inneruserTree;
var element;
var form;
var accessories = [];
////var deptInfos = @Html.Raw(Json.Encode(@ViewBag.companyList));
layui.config({
base: '../Scripts/layui_ext/',
}).extend({
selectInput: 'selectInput/selectInput'
}).use(['table', 'laydate', 'upload', 'flow', 'element', 'form', 'selectInput'], function () {
var $ = layui.jquery
, upload = layui.upload
, element = layui.element
, layer = layui.layer
, form = layui.form
, selectInput = layui.selectInput;
element = layui.element;
var laydate = layui.laydate;
laydate.render({
elem: '#inComplaintDate'
});
var File_Server = '@ViewBag.File_Server';
var loading;
var resid = '@Html.Raw(Model.resid)';
var deptid = '@Html.Raw(Model.deptid)';
var id = '@Html.Raw(ViewBag.id)';
var reasonTree = [
{ value: "1", name: "亏损" },
{ value: "2", name: "宣传不符" },
{ value: "4", name: "服务不满" },
{ value: "8", name: "产品不合适" },
{ value: "16", name: "个人原因" },
{ value: "32", name: "拖延退款" },
{ value: "64", name: "5个工作日无理由" }
];
var channelTree = [
{ value: "1", name: "400申诉热线" },
{ value: "2", name: "投诉留言" },
{ value: "4", name: "业务部反馈" },
{ value: "8", name: "微信后台" }
];
if (id != '' && id != '0') {
$('select[name=deptid]').attr("disabled", "disabled");
var dept = deptInfos.find(x => x.Id == deptid);
console.log(dept);
if (dept) {
$("#deptid").append(new Option(dept.Title, dept.Id, true, true));
}
//search(resid, deptid);
form.render('select');
renderselectReason(reasonTree, [@Html.Raw(Model.reasons==null?"": string.Join(",", Model.reasons))]);
renderselectChannel(channelTree, [@Html.Raw(Model.inComplaintChannels == null?"": string.Join(",", Model.inComplaintChannels))]);
} else {
renderselectReason(reasonTree, []);
renderselectChannel(channelTree, []);
}
//form.on('select(deptid)', function (data) {
// console.log(data);
// console.log(deptInfos);
// var dept = deptInfos.find(x => x.Id == data.value);
// console.log(dept);
// if (dept) {
// $("#companycode").val(dept.CompanyCode);
// }
//})
form.on('submit(save)', function (data) {
var id = '@Model.id';
console.log(id)
if (id != '' && id != '0') {
layer.confirm('是否确认保存该投诉?', { icon: 3, title: '提示' }, function (index) {
$.ajax({
type: "POST",
url: '/InComplaint/Update',
data: JSON.stringify(data.field),
dataType: "json",
contentType: "application/json",
success: function (da) {
if (da.code == 0) {
parent.layer.msg('操作成功!', { icon: 1 });
parent.TableReload();
parent.Closed();
} else {
layer.msg(da.retmsg, { icon: 2 });
}
},
error: function () {
layer.msg('操作失败!', { icon: 2 });
}
});
});
} else {
layer.confirm('是否确认保存该投诉?', { icon: 3, title: '提示' }, function (index) {
$.ajax({
type: "POST",
url: '/InComplaint/Create',
data: JSON.stringify(data.field),
dataType: "json",
contentType: "application/json",
success: function (da) {
if (da.code == 0) {
parent.layer.msg('操作成功!', { icon: 1 });
parent.TableReload();
parent.Closed();
} else {
layer.msg(da.message, { icon: 2 });
}
},
error: function () {
layer.msg('操作失败!', { icon: 2 });
}
});
});
}
})
$('#search').on('click', function () {
var resid = $('#resid').val();
if (!resid) {
layer.msg('请输入客户ID', { icon: 2 });
return;
}
//$('#deptid').find('option').remove();
search(resid);
})
})
function search(resid, select) {
layui.use('form', function () {
var form = layui.form;
$.ajax({
type: "GET",
url: '/InComplaint/GetComplaintCustomerInfo?resid=' + resid,
dataType: "json",
contentType: "application/json",
success: function (da) {
console.log(da)
if (da.code == 0 && da.data != null) {
$('#cname').val(da.data.cname);
//$('#eid').val(da.data.eid);
//$("#deptid").append(new Option('请选择', ''));
//$(da.data.deptInfos).each(function (index, val) {
// if (select && val.deptid == select) {
// $("#deptid").append(new Option(val.deptname, val.deptid, true, true));
// } else {
// $("#deptid").append(new Option(val.deptname, val.deptid));
// }
//});
//deptInfos = da.data.deptInfos;
//form.render('select');
} else {
$('#cname').val("");
//$('#eid').val("");
layer.msg('客户ID不存在', { icon: 2 });
}
},
error: function () {
layer.msg('操作失败!', { icon: 2 });
}
});
});
}
function renderselectReason(reasonTree, check) {
var optionsReason = {
el: '#Reasons',
name: 'Reasons',//表单的name属性
filterable: true, //搜索
direction: 'down', // 展开方向 下
layVerify: 'required',
tips: '请选择投诉原因',
toolbar: {//工具条,全选,清空,反选,自定义
show: true,
list: [
'CLEAR'
]
},
data: reasonTree,
initValue: check,
disabled: @Html.Raw(Model.id == 0 ? "false" : "true")
};
var selectReason = xmSelect.render(optionsReason);
return selectReason;
}
function renderselectChannel(channelTree, check) {
var optionsChannel = {
el: '#InComplaintChannels',
name: 'InComplaintChannels',//表单的name属性
filterable: true, //搜索
direction: 'down', // 展开方向 下
layVerify: 'required',
tips: '请选择内诉渠道',
toolbar: {//工具条,全选,清空,反选,自定义
show: true,
list: [
'CLEAR'
]
},
data: channelTree,
initValue: check,
disabled: @Html.Raw(Model.id == 0 ? "false" : "true")
};
var selectChannel = xmSelect.render(optionsChannel);
return selectChannel;
}
function Closed() {
layer.close(winindex);
}
</script>