| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- /**
- * 提交超时原因
- * */
- $(function() {
- autosize($('textarea'));
- $('#pro_save').on('click', saveOverTimeReasons);
- });
- //提交
- function saveOverTimeReasons() {
- if(!$.trim($("#timeoutreason").val())) {
- layer.confirm('请输入原因', {
- icon: 2,
- btn: ['确定'] //按钮
- });
- return;
- }
- var id = helper.request.queryString('edit_id');
- var loadIndex;
- $.ajax({
- type: 'post',
- url: huayi.config.callcenter_url + "equipmentapi/api/WoTimeOut/upreason",
- dataType: 'json',
- async: true,
- beforeSend: function() { //触发ajax请求开始时执行
- $('#pro_save').attr("disabled", true);
- $('#pro_save').text('提交中...');
- loadIndex = layer.load();
- },
- data: {
- id: id, // 是 string id
- timeoutreason: $('#timeoutreason').val(), // 是 string 超时原因
- istimeout: $('#istimeout').find('input[name="istimeoutRadios"]:checked').val(), // 是 int 主管确认是否超时 0未确认,1超时,2不超时
- },
- success: function(data) {
- layer.close(loadIndex);
- if(data.state == "success") {
- var index = parent.layer.getFrameIndex(window.name);
- parent.layer.close(index);
- parent.$('#table_all').bootstrapTable('refresh');
- parent.layer.msg("提交成功");
- } else {
- $('#pro_save').attr("disabled", false);
- $('#pro_save').text('提交');
- }
- },
- error: function(textStatus) {
- layer.close(loadIndex);
- layer.confirm('网络繁忙,请稍后再试...', {
- closeBtn: 0,
- btn: ['确定'] //按钮
- });
- $('#pro_save').attr("disabled", false);
- $('#pro_save').text('提交');
- },
- complete: function(XMLHttpRequest, textStatus) {
- layer.close(loadIndex);
- if(textStatus == 'timeout') {
- var xmlhttp = window.XMLHttpRequest ? new window.XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHttp");
- xmlhttp.abort();
- layer.confirm('网络超时,请稍后再试...', {
- closeBtn: 0,
- btn: ['确定'] //按钮
- });
- }
- $('#pro_save').attr("disabled", false);
- $('#pro_save').text('提交');
- },
- });
- }
|