143 lines
4.7 KiB
Plaintext
143 lines
4.7 KiB
Plaintext
@{
|
||
ViewBag.Title = "ChangeStatus";
|
||
Layout = "~/Views/Shared/_content.cshtml";
|
||
}
|
||
|
||
<style>
|
||
.layui-form-label {
|
||
width: 100px;
|
||
}
|
||
|
||
.layui-input-block {
|
||
margin-left: 130px;
|
||
min-height: 36px;
|
||
}
|
||
.layui-form {
|
||
margin-top: 20px;
|
||
margin-right: 65px;
|
||
}
|
||
#extdiv {
|
||
margin-left: 20px;
|
||
margin-top: 40px;
|
||
}
|
||
</style>
|
||
<div class="x-body">
|
||
<form class="layui-form">
|
||
<div class="layui-form-item" style="display:none">
|
||
<label class="layui-form-label">udid:</label>
|
||
<div class="layui-input-block">
|
||
<input type="text" id="udid" name="udid" class="layui-input">
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label">状态:</label>
|
||
<div class="layui-input-block" >
|
||
<select id="status" class="layui-form-mid">
|
||
</select>
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label">工单:</label>
|
||
<div class="layui-input-block" >
|
||
<textarea name="content" id="content" rows="7" style="width:100%"></textarea>
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item" id="extdiv">
|
||
<button class="layui-btn" lay-submit="" lay-filter="save">确定</button>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
|
||
<script>
|
||
var apiPath = '@ViewBag.apiPath';
|
||
layui.extend({
|
||
}).use(['form', 'element', 'jquery'], function () {
|
||
var form = layui.form
|
||
, layer = layui.layer
|
||
//初始化
|
||
var udid = '@Html.Raw(ViewBag.udid)';
|
||
init(udid);
|
||
|
||
//提交
|
||
form.on('submit(save)', function (data) {
|
||
$(this).hide();
|
||
var data = {
|
||
id: $("#udid").val(),
|
||
status: Number($("#status").val()),
|
||
content: $("#content").val(),
|
||
eid: '@ViewBag.Eid',
|
||
ename: '@ViewBag.Uname',
|
||
};
|
||
console.log(data);
|
||
$.ajax({
|
||
type: "Post",
|
||
url: apiPath + '/Complaint/Status',
|
||
data: JSON.stringify(data),
|
||
dataType: "json",
|
||
contentType: "application/json",
|
||
success: function (msg) {
|
||
console.log(msg);
|
||
if (msg.code == 0) {
|
||
layer.alert("操作成功!", {
|
||
yes: function () {
|
||
layer.closeAll();
|
||
parent.layer.closeAll();
|
||
if (parent.refresh) parent.refresh();
|
||
if (parent.TableReload) parent.TableReload();
|
||
else if (parent.parent.TableReload) parent.parent.TableReload();
|
||
}
|
||
})
|
||
}
|
||
|
||
else {
|
||
layer.alert(msg.message);
|
||
}
|
||
},
|
||
error: function () {
|
||
layer.msg('创建失败!', { icon: 2 });
|
||
}
|
||
});
|
||
$(this).show();
|
||
return false;
|
||
});
|
||
|
||
});
|
||
function initCheckValue(selectid, value) {
|
||
var select = document.getElementById(selectid);
|
||
select.append(new Option("待跟进", "0"));
|
||
select.append(new Option("跟进中", "1"));
|
||
select.append(new Option("已完结", "2"));
|
||
select.append(new Option("待跟进(已超时)", "-1"));
|
||
for (var i = 0; i < select.options.length; i++) {
|
||
if (select.options[i].value < value && value != -1 || select.options[i].value == -1) {
|
||
select.options[i].disabled = true;
|
||
//防止浏览器不兼容:将disable项手动置灰
|
||
select.options[i].style.color = "graytext";
|
||
}
|
||
if (select.options[i].value == value) {
|
||
select.options[i].selected = true;
|
||
}
|
||
}
|
||
layui.form.render("select");
|
||
}
|
||
function init(udid) {
|
||
$.ajax({
|
||
type: "Get",
|
||
url: apiPath + '/Complaint/StatusDetail?udid=' + udid,
|
||
dataType: "json",
|
||
contentType: "application/json",
|
||
success: function (da) {
|
||
if (da.code == 0) {
|
||
if (udid != '') {
|
||
$('#udid').val(udid);
|
||
initCheckValue('status', da.data.status);
|
||
}
|
||
|
||
}
|
||
},
|
||
error: function () {
|
||
layer.msg('失败!', { icon: 2 });
|
||
}
|
||
});
|
||
}
|
||
</script> |