| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- var id = helper.request.queryString("id");
- $(document).ready(function () {
- //获取工单详情
- getWorkOrderdetails();
- //保存
- $('.customerSubmit').click(function() {
- saveCustomer();
- });
- //重要级别
- getDealTimely();
- //普通工单禁止选择原因
- $('#reason').attr("disabled", "disabled");
- })
- // 重要级别
- function getDealTimely() {
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
- dataType: 'json',
- async: true,
- data: {
- token: $.cookie("token"),
- flag: "GDDJ"
- },
- success: function(data) {
- var Count = data.data;
- $(Count).each(function(i, n) {
- $('<option value="' + n.F_Name + '">' + n.F_Name + '</option>').appendTo($("#dealTimely"));
- })
- }
- });
- }
- // 重要级别原因(Ⅰ级)
- function getReasonOne() {
- $("#reason").empty();
- $("#reason").append("<option value='' selected='selected'>请选择</option>");
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
- dataType: 'json',
- async: true,
- data: {
- token: $.cookie("token"),
- flag: "YJYY"
- },
- success: function(data) {
- var Count = data.data;
- $(Count).each(function(i, n) {
- $('<option value="' + n.F_Name + '">' + n.F_Name + '</option>').appendTo($("#reason"));
- })
- }
- });
- }
- // 重要级别原因(Ⅱ级)
- function getReasonTwo() {
- $("#reason").empty();
- $("#reason").append("<option value='' selected='selected'>请选择</option>");
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
- dataType: 'json',
- async: true,
- data: {
- token: $.cookie("token"),
- flag: "EJYY"
- },
- success: function(data) {
- var Count = data.data;
- $(Count).each(function(i, n) {
- $('<option value="' + n.F_Name + '">' + n.F_Name + '</option>').appendTo($("#reason"));
- })
- }
- });
- }
- // 重要级别显示原因
- $('#dealTimely').on('change',function(){
- if ($('#dealTimely').val() === 'Ⅰ级' || $('#dealTimely').val() === "1类问题"){
- $('#reason').val('');
- $('#reason').removeAttr("disabled");
- getReasonOne();
- } else if ($('#dealTimely').val() === 'Ⅱ级' || $('#dealTimely').val() === "2类问题"){
- $('#reason').val('');
- $('#reason').removeAttr("disabled");
- getReasonTwo();
- } else {
- $('#reason').val('');
- $('#reason').attr("disabled", "disabled");
- }
- })
- //获取工单详情
- function getWorkOrderdetails() {
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "WorkOrder/GetDetails",
- dataType: 'json',
- async: true,
- cache: false,
- data: {
- id: id,
- token: $.cookie("token")
- },
- success: function(result) {
- if (result.rows.length > 0) {
- var data = result.rows[0];
- // 重要级别
- $("#dealTimely option:selected").text(data.F_DealTimely);
- $("#dealTimely option:selected").val(data.F_DealTimely);
- // 重要级别原因
- $("#reason option:selected").text(data.F_Reason);
- $("#reason option:selected").val(data.F_Reason);
- }
- }
- });
- }
- //保存
- function saveCustomer() {
- $.ajax({
- type: "post",
- url: huayi.config.callcenter_url + "WorkOrder/Sing",
- dataType: 'json',
- async: true,
- beforeSend: function() { //触发ajax请求开始时执行
- $('.customerSubmit').attr("disabled", true);
- $('.customerSubmit').text('确定中...');
- },
- data: {
- token: $.cookie("token"),
- id: id,
- dealTimely: $('#dealTimely').val(), //重要级别内容
- reason: $('#reason').val(), //重要级别原因
- },
- success: function(data) {
- if (data.state.toLowerCase() == 'success') {
- $('.customerSubmit').attr("disabled", false);
- $('.customerSubmit').text('确定');
- var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
- parent.layer.close(index); //再执行关闭
- parent.layer.msg("保存成功!");
- // parent.$('#workorderlist').bootstrapTable('refresh');
- parent.initTable();
- } else {
- $('.customerSubmit').attr("disabled", false);
- $('.customerSubmit').text('确定');
- }
- }
- });
- }
|