123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- $(function () {
- var mask = mui.createMask();//callback为用户点击蒙版时自动执行的回调;
- /**
- * 初始化二级菜单按钮
- */
- var strButton = $("#sj").val();
- var strBArr = strButton.split(",");
- for (var i = 0 ; i < strBArr.length ; i++) {
- if (strBArr[i] == "0") {
- $(".show"+i).hide();
- }else {
- $(".show"+i).show();
- }
- }
-
-
-
- /**
- * 点击td选中input
- */
- $(".listcenter>li,.checkBox").on("tap",function (e) {
- if (e && e.stopPropagation) {
- e.stopPropagation();
- } else {
- window.event.cancelBubble = true;
- }
- if ($(this).find("input[type='checkbox']").is(":checked")) {
- $(this).find("input[type='checkbox']").removeAttr("checked");
- } else {
- $(this).find("input[type='checkbox']").prop("checked", true);
- }
- });
- /**
- * 拖拽
- */
- if ($("#hkbjtb").val() == "true" || $("#flzbjtb").val() == "true") {
- tuozhuai("kgtb","box1");
- tuozhuai("cstb","box2");
- tuozhuai("iphonetb","box3");
- }
- /**
- * 滚动input以外失去焦点
- * */
- iscroll.on('scrollStart',function(e){
- var el = document.activeElement;
- if (el.nodeName.toLowerCase() == 'input') {
- el.blur();
- this.disable();
- this.enable();
- };
- return;
- });
- /**
- * 点击input以外失去焦点
- * */
- var beforeIpt=null;
- $("input").on("focus", function (e) {
- beforeIpt=this;
- });
- $(document).on("tap", function (e) {
- if(e.target.nodeName.toLowerCase()!="input") {
- if(beforeIpt) {
- beforeIpt.blur();
- beforeIpt=null;
- }
- }
- });
- /**
- * 开关事件
- * */
- mui('.mui-content .mui-switch').each(function() { //循环所有toggle
- mui(this)['switch']();
- //toggle 事件监听
- this.addEventListener('toggle', function(event) {
- event.stopPropagation();
- //event.detail.isActive 可直接获取当前状态
- var isActive = this.classList.contains("mui-active"); //判断打开ON或者关闭OFF
- if(isActive){ //打开状态
- $(this).parent().next().slideDown(500,function(){
- iscroll.refresh();
- });
- }else{ //关闭状态
- $(this).parent().next().slideUp(500,function(){
- iscroll.refresh();
- });
- }
- });
- });
-
- /**
- * 行为选择
- * */
- $(".xiugai").on("tap",function(){
- $(this).addClass("qq");
- mask.show();//显示遮罩
- $(".xw").show();
- mScrol3.refresh();
- //赋值
- var val = $(this).data("box") + "";
- var checkeds = $(".xwa").find("input[type='checkbox']");
- var m = 0;
- for (var i = 0; i < checkeds.length; i++) {
- if (i < 3) {//有可能四位 那么依次是声光,电话,短信,蜂鸣器
- m = i;
- } else {
- if (val.length > 4) { //如果超过4位那么,一次是 声光,电话,短信,其他1,其他2, 蜂鸣器
- m = i + 2;
- } else {
- m = i;
- }
- }
- checkeds.eq(i).prop("checked", "");
- checkeds.eq(i).next().removeClass("colorActive");
- if (val.charAt(m) == "2") {
- checkeds.eq(i).prop("checked", "true");
- checkeds.eq(i).next().addClass("colorActive");
- }
- }
- $(".xwdq").bind("tap",function(){
- //box赋值
- var box = $(".xw li .xwa").find("input[type='checkbox']");
- var boxarr = "";
- for (var i = 0 ; i < box.length ; i++) {
- boxarr += box.eq(i).is(":checked") ? 2 : 1;
- }
- $(".qq").data("box", boxarr);
- $(".qq").parent().prev().attr("value",boxarr);
- if ($(".xwa").find("input[type='checkbox']").is(":checked")) {
- var chk_value =[];
- $('.xw li .xwa input[type="checkbox"]:checked').each(function(i,checkbox){
- chk_value.push($(this).siblings().html());
- $(this).prop("checked", false);
- });
- var temp_string = chk_value.join("/");
- $(".wdxxbox .row .qq").html(temp_string + "<span class='caret'></span>");
- }
- $(".wdxxbox .row div").removeClass("qq");
- $(".xw,.xgmsgbox").hide();
- mask.close();//关闭遮罩
- iscroll.refresh();
- });
- });
- mui('body').on('tap', '.mui-backdrop', function(e) {
- $(".xw,.xgmsgbox").hide();
- $(".xgmsgbox").hide();
- });
-
- });
- //返回
- function bjcsBackUrl() {
- var zsid = $("#zsid").val();
- haifm.loadMobilePage("haifm", "wsclHaifmvMain.htm?mcid=" + $("#mcid").val()); //污水处理页面
- }
- /**
- * 保存
- */
- function savebjcs() {
- var cod = $("#cod").val();
- var bod = $("#bod").val();
- var ss = $("#ss").val();
- var nhsn = $("#nhsn").val();
- jQuery.ajax({
- dataType : 'json',
- type : "post",
- url : "saveWsclBjsz.htm",
- data : {
- "lqid" : $("#lqid").val(),
- "cod" : cod,
- "bod" : bod,
- "ss" : ss,
- "nhsn" : nhsn
- },
- dataType : "json",
- async : true,
- success : function(data) {
- // 保存成功
- if (data.returnCode == 1) {
- mui.alert("保存成功");
- }else if (data.returnCode == 2) {
- mui.alert("系统出错请稍后");
- }else if (data.returnCode == 3) {
- mui.alert("查无此栏期");
- }
- },
- error : function(data) {
- alert("系统异常 请稍后再试");
- }
- });
- }
|