| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- /**
- * 超时计划添加
- * */
- $(function() {
-
- $('#ot_plancycle').find('input[name="plancycleRadios"]').on('change',function(){
- //超时任务周期:5.小时,6.分钟 7 秒
- switch ($(this).val()){
- case '5':
- $('.ot_planinterval1').show();
- $('.ot_planinterval2').hide();
- $('.ot_planinterval3').hide();
- break;
- case '6':
- $('.ot_planinterval1').hide();
- $('.ot_planinterval2').show();
- $('.ot_planinterval3').hide();
- break;
- case '7':
- $('.ot_planinterval1').hide();
- $('.ot_planinterval2').hide();
- $('.ot_planinterval3').show();
- break;
- default:
- break;
- }
- });
-
- $('#ot_plancycle').find('input[name="plancycleRadios"]:checked').trigger('change');
-
-
- laydate.render({
- elem: '#ot_planinterval_h',
- type: 'time',
- theme: '#249fea',
- value: '0小时',
- format: 'H小时'
- });
- laydate.render({
- elem: '#ot_planinterval_m',
- type: 'time',
- theme: '#249fea',
- value: '0分钟',
- format: 'm分钟'
- });
- laydate.render({
- elem: '#ot_planinterval_s',
- type: 'time',
- theme: '#249fea',
- value: '0秒',
- format: 's秒'
- });
- //添加编辑保存按钮点击
- $('#pro_save').on('click', saveOverTimeOrder);
- });
- //保存
- function saveOverTimeOrder() {
- var ot_plancycle = $('#ot_plancycle').find('input[name="plancycleRadios"]:checked').val();//超时任务周期
- var ot_planinterval = 0;//计划间隔数
- switch (ot_plancycle){
- //5.小时,6.分钟,7.秒
- case '5':
- ot_planinterval = $('#ot_planinterval_h').val().split('小时')[0] - 0
- break;
- case '6':
- ot_planinterval = $('#ot_planinterval_m').val().split('分钟')[0] - 0
- break;
- case '7':
- ot_planinterval = $('#ot_planinterval_s').val().split('秒')[0] - 0
- break;
- default:
- break;
- }
- var loadIndex;
- $.ajax({
- type: 'post',
- url: huayi.config.callcenter_url + "equipmentapi/api/HangfirePlan/addtimeout",
- dataType: 'json',
- async: true,
- beforeSend: function() { //触发ajax请求开始时执行
- $('#pro_save').attr("disabled", true);
- $('#pro_save').text('保存中...');
- loadIndex = layer.load();
- },
- data: {
- wotype: $('#ot_wotype').find('input[name="wotypeRadios"]:checked').val(), // 是 int 工单类型 1.报修,2.保养,3.巡检
- plancycle: ot_plancycle, // 是 int 超时任务周期:4.小时,5.分钟,6.秒
- planinterval: ot_planinterval, // 是 int 计划间隔秒数(0-59)
- },
- 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('保存');
- },
- });
- }
|