| var layer;// 定义全局变量  | 
| var laydate;  | 
| var form;  | 
| var test = {"name":"系统名称","screenName":"大屏名称","screenSlogan":"大屏标语","opVendor":"运维厂商","opPhone":"180********"  | 
|     ,"contacter":"联系人","usedTime":"2022-08-14 15:16:18","menu3DVld":"1", "etcPlat":"0", "linkage":"0"};  | 
| var sysInfo = {};  | 
| (function () {  | 
|     layui.use(['layer', 'form', 'laydate'], function () {  | 
|         layer = layui.layer;  | 
|         form = layui.form;  | 
|         laydate = layui.laydate;  | 
|         //开始时间  | 
|         laydate.render({  | 
|             elem: '#usedTime'  | 
|             , type: 'date'  | 
|             , trigger: 'click'  | 
|             , theme: 'custom'  | 
|         });  | 
|   | 
|         laydate.render({  | 
|             elem: '#time'  | 
|             , type: 'datetime'  | 
|             , trigger: 'click'  | 
|             , theme: 'custom'  | 
|             ,value: new Date()  | 
|         });  | 
|   | 
|         //测试  | 
|         // form.val("form-info", test);  | 
|   | 
|         //默认查询  | 
|         queryInfo();  | 
|   | 
|         queryTime();  | 
|     });  | 
| }).call(this);  | 
|   | 
|   | 
| //执行保存,系统参数  | 
| function saveInfo() {  | 
|     var info = form.val("form-info");  | 
|     info.usedTime = timeStr(info.usedTime);  | 
|   | 
|     if(info.name){  | 
|         sysInfo.name = info.name;  | 
|     }  | 
|     if(info.screenName){  | 
|         sysInfo.screenName = info.screenName;  | 
|     }  | 
|     if(info.screenSlogan){  | 
|         sysInfo.screenSlogan = info.screenSlogan;  | 
|     }  | 
|     if(info.opVendor){  | 
|         sysInfo.opVendor = info.opVendor;  | 
|     }  | 
|     if(info.opPhone){  | 
|         sysInfo.opPhone = info.opPhone;  | 
|     }  | 
|     if(info.contacter){  | 
|         sysInfo.contacter = info.contacter;  | 
|     }  | 
|     if(info.usedTime){  | 
|         sysInfo.usedTime = info.usedTime;  | 
|     }  | 
|     // if(info.menu3DVld){  | 
|     //     sysInfo.menu3DVld = info.menu3DVld;  | 
|     // }  | 
|     if(info.mainShow){  | 
|         sysInfo.mainShow = info.mainShow;  | 
|     }else if(!sysInfo.mainShow){  | 
|         sysInfo.mainShow = "0";  | 
|     }  | 
|   | 
|   | 
|   | 
|     // console.log(JSON.stringify(info));  | 
|     $.post("./cgi-bin/sys-set/save-info", JSON.stringify(info), function (data, status) {  | 
|         if (data.code == "success") {  | 
|             window.parent.parent.notify("数据保存成功!");  | 
|         } else {  | 
|             window.parent.parent.notify("数据保存出错,请重新操作!!msg=" + data.msg);  | 
|         }  | 
|     }, "json");  | 
| }  | 
|   | 
| //时间格式处理,2021-02-26 -----20210226  | 
| function timeStr(time) {  | 
|     return time.replace('-','').replace('-','');  | 
| }  | 
|   | 
|   | 
| //执行查询,系统参数  | 
| function queryInfo() {  | 
|     $.get("./cgi-bin/sys-set/query-info", function (data, status) {  | 
|         if ("success" == status) {  | 
|             sysInfo = data;  | 
|             renderInfo(data);  | 
|         } else {  | 
|             window.parent.parent.notify("数据查询出错,请重新操作!!msg=" + data.msg);  | 
|         }  | 
|     }, "json");  | 
| }  | 
|   | 
| function renderInfo(data){  | 
|     data.usedTime = strTime(data.usedTime);  | 
|     form.val("form-info", data);  | 
| }  | 
|   | 
| //时间格式处理,20210226-----2021-02-26  | 
| function strTime(time) {  | 
|     return time.substring(0, 4) + "-" + time.substring(4, 6) + "-" + time.substring(6, 8);  | 
| }  | 
|   | 
| function setTime(){  | 
|     var time = $("#time").val();  | 
|     // console.log(time);  | 
|     var param = {"time":time};  | 
|     $.post("./cgi-bin/device-ctrl/set-time", JSON.stringify(param), function (data, status) {  | 
|         if ("success" == data.code) {  | 
|             window.parent.parent.notify("时间校准操作成功!");  | 
|         } else {  | 
|             window.parent.parent.notify("操作失败,请重新操作!"+data.msg);  | 
|         }  | 
|     }, "json");  | 
| }  | 
|   | 
| //执行查询  | 
| function queryTime() {  | 
|     $.get("./cgi-bin/device-ctrl/query-version", function (data, status) {  | 
|         if ("success" == status) {  | 
|             $("#time").val(data.time);  | 
|         } else {  | 
|             window.parent.parent.notify("数据查询出错,请重新操作!!");  | 
|         }  | 
|     }, "json");  | 
| }  | 
|   | 
|   |