From e8c9c0ca7e6c307243c158fd529c59c5a3717f2f Mon Sep 17 00:00:00 2001 From: wuwei <wuquan-1230@q63.com> Date: 星期五, 13 六月 2025 10:05:06 +0800 Subject: [PATCH] 1.同步最新的文件 --- local/bin/snmp_val.sh | 33 ++ local/www/sys-register.html | 2 local/www/cgi-bin/snmp/enable | 24 + local/version | 2 upgrade/app.tgz | 0 local/app/NetModule | 0 local/www/detail-jmkt.html | 17 - local/www/detail-mj.html | 298 ++++++------------- local/www/cgi-bin/warn-list/update | 2 local/default/sysConfig.json | 1 local/www/cgi-bin/download/download.cgi | 0 local/www/cgi-bin/snmp/query | 20 + local/www/cgi-bin/sys-set/systemSpace | 2 local/www/sys-param-set.html | 7 local/www/cgi-bin/snmp/download | 17 + local/default/snmp.json | 29 + local/www/cgi-bin/state/query-device | 36 +- local/default/app.ini | 2 local/www/cgi-bin/do/do | 42 ++ local/www/js/page/device-net.js | 2 local/bin/export.sh | 9 /dev/null | 20 - local/www/detail-ups.html | 139 --------- local/bin/snmp_cfg | 0 local/app/MainControl | 0 local/www/sys-snmp-conf.html | 190 ++++++++++++ local/www/cgi-bin/register/query_sn | 5 27 files changed, 496 insertions(+), 403 deletions(-) diff --git a/local/app/MainControl b/local/app/MainControl index d97b0f6..95adeaf 100755 --- a/local/app/MainControl +++ b/local/app/MainControl Binary files differ diff --git a/local/app/NetModule b/local/app/NetModule index dd6b8cd..fd4faca 100755 --- a/local/app/NetModule +++ b/local/app/NetModule Binary files differ diff --git a/local/bin/export.sh b/local/bin/export.sh new file mode 100755 index 0000000..51fe1e6 --- /dev/null +++ b/local/bin/export.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +sqlite3 /work/iot_cfg.db ".headers on " "select d.name as 璁惧鍚嶇О,'1.3.6.1.4.1.27116.'||d.id||'.'||a.passcode as OID, d.id as 璁惧ID, a.passcode as 閫氶亾鍙�, a.name as 鏁版嵁鍚嶇О,a.note as 澶囨敞 from device d left join accuracy a on d.id=a.id where uploadFlag=0" > /tmp/oid_list.csv +sqlite3 /work/iot_cfg.db "SELECT name as 璁惧鍚嶇О, '1.3.6.1.4.1.27116.'||id||'.3' as OID, id as 璁惧ID, 3 as 閫氶亾鍙� , '鐘舵��' as 鏁版嵁鍚嶇О, '0-姝e父;1-鍛婅' as 澶囨敞 FROM ioDevice ;" >> /tmp/oid_list.csv + +sed -i 's/|/,/g' /tmp/oid_list.csv + + +/usr/local/bin/snmp_cfg -f /work/snmp.json /tmp/oid_list.csv diff --git a/local/bin/snmp_cfg b/local/bin/snmp_cfg new file mode 100755 index 0000000..74b3fbd --- /dev/null +++ b/local/bin/snmp_cfg Binary files differ diff --git a/local/bin/snmp_val.sh b/local/bin/snmp_val.sh new file mode 100755 index 0000000..d09feb4 --- /dev/null +++ b/local/bin/snmp_val.sh @@ -0,0 +1,33 @@ +#!/bin/sh + + + + +# 鑾峰彇浼犲叆鐨� OID +OID="$1" +jsoner=./jsoner + +#echo "鑴氭湰琚皟鐢�, OID: $OID" +chn=${OID##*.} +id=${OID%.*} +id=${id##*.} + +#echo "id: $id chn: $chn" + +chn=`expr $chn - 1 ` + +#echo "$jsoner -g /tmp/$id value-$chn.value" +val=`$jsoner -g /tmp/$id value-$chn.value` +ret=$? +#echo "ret = $ret" + +if [ $ret -eq 0 ] +then + RESPONSE="{\"type\": \"OctetString\", \"value\": \"$val\" }" + echo "$RESPONSE" + +else + # 榛樿杩斿洖 + RESPONSE="{\"type\": \"OctetString\", \"value\": \"noData\"}" + echo "$RESPONSE" +fi \ No newline at end of file diff --git a/local/default/app.ini b/local/default/app.ini index b0c39b4..a14d178 100644 --- a/local/default/app.ini +++ b/local/default/app.ini @@ -9,5 +9,5 @@ mul=MulticastIP lk=linkage rtsp=rtsp -export applist=" $main $dc $net $gate $svr " +export applist=" $main $dc $net $gate $svr $lk" diff --git a/local/default/snmp.json b/local/default/snmp.json new file mode 100644 index 0000000..dc8e2d8 --- /dev/null +++ b/local/default/snmp.json @@ -0,0 +1,29 @@ +{ + "script_handler": "/usr/local/bin/snmp_val.sh", + "oids": [ + { + "oid": "1.3.6.1.4.1.71116.1.1", + "name": "temphum", + "type": "Integer", + "description": "status" + }, + { + "oid": "1.3.6.1.4.1.71116.1.2", + "name": "temphum", + "type": "OctetString", + "description": "warn status" + }, + { + "oid": "1.3.6.1.4.1.71116.1.4", + "name": "temphum", + "type": "OctetString", + "description": "temp" + }, + { + "oid": "1.3.6.1.4.1.71116.3.4", + "name": "temphum", + "type": "OctetString", + "description": "hum" + } + ] +} \ No newline at end of file diff --git a/local/default/sysConfig.json b/local/default/sysConfig.json index e986ede..1ec6256 100755 --- a/local/default/sysConfig.json +++ b/local/default/sysConfig.json @@ -4,6 +4,7 @@ "menu3DVld": "0", "linkage": "0", "etcPlat": "0", + "snmp": 0, "name": "鍔ㄧ幆鐩戞帶绯荤粺", "opPhone": "4006271116", "opVendor": "椋庢鑷磋繙淇℃伅鎶�鏈偂浠芥湁闄愬叕鍙�", diff --git a/local/version b/local/version index 50b8724..7f74ba5 100644 --- a/local/version +++ b/local/version @@ -1,3 +1,3 @@ -2025-05-29-v001 +2025-06-13-v001 type=1 IGD5300 diff --git a/local/www/cgi-bin/do/do b/local/www/cgi-bin/do/do new file mode 100755 index 0000000..dfa1e27 --- /dev/null +++ b/local/www/cgi-bin/do/do @@ -0,0 +1,42 @@ +#!/bin/sh +#鎵цURL鐨勫弬鏁板懡浠� +#渚嬶細http://192.168.1.123/cgi-bin/do/do?sqlite3 /work/iot_cfg.db "select * from alarm" +export PATH=/sbin:/usr/sbin:$PATH +echo -en "Content-type: text/html; charset=utf-8\n\n" +#***************************************************** +source ../bin/env.sh +db="../bin/db" +jsoner="../bin/jsoner" + +# 1. 鑾峰彇鍙傛暟閫昏緫 +if [ "$REQUEST_METHOD" = "GET" ]; then + # 浠嶶RL鑾峰彇鍙傛暟锛堟牸寮忥細?key=value锛� + params="$QUERY_STRING" # 鍐呯疆鐜鍙橀噺[5,7](@ref) +elif [ "$REQUEST_METHOD" = "POST" ]; then + # 浠庢爣鍑嗚緭鍏ヨ鍙朠OST鏁版嵁 + read -t 5 params # 5绉掕秴鏃堕槻姝㈤樆濉瀃6](@ref) +else + echo "error: Unsupported method" + exit 1 +fi + +# 2. 鍙傛暟楠岃瘉涓庤緭鍑� +if [ -z "$params" ]; then + echo "error: No parameters received" +else + # 绠�鏄撹В鐮佸鐞嗭紙绌烘牸鍜岀壒娈婂瓧绗︼級 + decoded_params=$(echo "$params" | sed -e 's/%20/ /g' -e 's/%22/"/g' -e 's/%2F/\//g' -e 's/+/ /g') + # 鍛戒护瀛楃涓插啓鍏ユ枃浠� + echo "$decoded_params" > /tmp/.cmd +fi + +#3. 鎵ц鍛戒护 +data=`sh /tmp/.cmd` + +if [ $? -eq 0 ] +then + echo "{\"code\":\"success\",\"result\":\"$data\"}" +else + echo "{\"code\":\"error\",\"result\":\"$data\"}" +fi + diff --git a/local/www/cgi-bin/download/download.cgi b/local/www/cgi-bin/download/download.cgi index 773ea77..418c2d1 100755 --- a/local/www/cgi-bin/download/download.cgi +++ b/local/www/cgi-bin/download/download.cgi Binary files differ diff --git a/local/www/cgi-bin/register/query_sn b/local/www/cgi-bin/register/query_sn index 85339e4..9ecb587 100755 --- a/local/www/cgi-bin/register/query_sn +++ b/local/www/cgi-bin/register/query_sn @@ -1,5 +1,6 @@ #!/bin/sh # 鏌ヨ-涓插彛璁惧 +export PATH=/sbin:/usr/sbin:$PATH echo -en "Content-type: text/html; charset=utf-8\n\n" #***************************************************** source ../bin/env.sh @@ -11,7 +12,11 @@ #echo "query device list: $content" >> log +tmp=`sqlite3 /work/iot_cfg.db "select id from machine"` + +if [ "$tmp" = "" ];then /usr/local/script/update_sn > /dev/null +fi sn=`sqlite3 /work/iot_cfg.db "select id from machine"` diff --git a/local/www/cgi-bin/snmp/download b/local/www/cgi-bin/snmp/download new file mode 100755 index 0000000..4a7f40a --- /dev/null +++ b/local/www/cgi-bin/snmp/download @@ -0,0 +1,17 @@ +#!/bin/sh +# 绔彛閰嶇疆-鏌ヨ +echo -en "Content-type: text/html; charset=utf-8\n\n" +#***************************************************** +source ../bin/env.sh +db="../bin/db" + +file="/tmp/oid_list.csv" + +if [ -f "$file" ] +then + echo "{\"code\":\"success\"}" +else + echo "{\"code\":\"error\"}" +fi + + diff --git a/local/www/cgi-bin/snmp/enable b/local/www/cgi-bin/snmp/enable new file mode 100755 index 0000000..7e0cc76 --- /dev/null +++ b/local/www/cgi-bin/snmp/enable @@ -0,0 +1,24 @@ +#!/bin/sh +#SNMP妯$粍鐘舵�佹煡璇� +export PATH=/sbin:/usr/sbin:$PATH +echo -en "Content-type: text/html; charset=utf-8\n\n" +#***************************************************** +source ../bin/env.sh +db="../bin/db" +jsoner="../bin/jsoner" + +read content + +enable=`$jsoner $content enable` + +cfg=`jsoner -g /work/sysConfig.json snmp` + +if [ "$enable" == "true" ] +then + `jsoner -s /work/sysConfig.json snmp "1"` > /dev/null + +else + `jsoner -s /work/sysConfig.json snmp "0"` > /dev/null +fi + +echo "{\"code\": \"success\"}" diff --git a/local/www/cgi-bin/snmp/query b/local/www/cgi-bin/snmp/query new file mode 100755 index 0000000..84a0829 --- /dev/null +++ b/local/www/cgi-bin/snmp/query @@ -0,0 +1,20 @@ +#!/bin/sh +#SNMP妯$粍鐘舵�佹煡璇� +export PATH=/sbin:/usr/sbin:$PATH +echo -en "Content-type: text/html; charset=utf-8\n\n" +#***************************************************** +source ../bin/env.sh +db="../bin/db" + + +enable=`jsoner -g /work/sysConfig.json snmp` + +if [ "$enable" == "1" ] +then + echo "{\"enable\": true}" +else + echo "{\"enable\": false}" +fi + + + diff --git a/local/www/cgi-bin/state/query-device b/local/www/cgi-bin/state/query-device index 253ec17..9c3d211 100755 --- a/local/www/cgi-bin/state/query-device +++ b/local/www/cgi-bin/state/query-device @@ -10,26 +10,30 @@ # 瀹氫箟瑕佹搷浣滅殑鏂囦欢 file="/tmp/device_status" -# 鐢熸垚涓存椂鏂囦欢 -temp_file=$(mktemp) -delete_pattern=$(mktemp) +cat $file -# 鑾峰彇闇�瑕佸垹闄ょ殑琛屽彿鑼冨洿锛堝墠涓�琛�+褰撳墠琛�+鍚庝笁琛岋級 -awk '/^[[:space:]]*"id"[[:space:]]*:[[:space:]]*"25[67]"[[:space:]]*,/ { - start = NR - 1 > 0 ? NR - 1 : 1 - end = NR + 3 - for (i = start; i <= end; i++) - print i - }' "$file" | sort -nu > "$delete_pattern" +exit + +# # 鐢熸垚涓存椂鏂囦欢 +# temp_file=$(mktemp) +# delete_pattern=$(mktemp) + +# # 鑾峰彇闇�瑕佸垹闄ょ殑琛屽彿鑼冨洿锛堝墠涓�琛�+褰撳墠琛�+鍚庝笁琛岋級 +# awk '/^[[:space:]]*"id"[[:space:]]*:[[:space:]]*"25[67]"[[:space:]]*,/ { +# start = NR - 1 > 0 ? NR - 1 : 1 +# end = NR + 3 +# for (i = start; i <= end; i++) +# print i +# }' "$file" | sort -nu > "$delete_pattern" - # 鎵ц杩囨护骞舵樉绀虹粨鏋� - awk 'NR == FNR {del[$1]; next} !(FNR in del)' "$delete_pattern" "$file" | tee "$temp_file" +# # 鎵ц杩囨护骞舵樉绀虹粨鏋� +# awk 'NR == FNR {del[$1]; next} !(FNR in del)' "$delete_pattern" "$file" | tee "$temp_file" - # 鍙�夛細濡傛灉瑕佺洿鎺ヤ慨鏀瑰師鏂囦欢锛屽彇娑堜互涓嬫敞閲� - # mv "$temp_file" "$file" +# # 鍙�夛細濡傛灉瑕佺洿鎺ヤ慨鏀瑰師鏂囦欢锛屽彇娑堜互涓嬫敞閲� +# # mv "$temp_file" "$file" - # 娓呯悊涓存椂鏂囦欢 - rm "$delete_pattern" "$temp_file" +# # 娓呯悊涓存椂鏂囦欢 +# rm "$delete_pattern" "$temp_file" diff --git a/local/www/cgi-bin/sys-set/systemSpace b/local/www/cgi-bin/sys-set/systemSpace index 1dc9c95..37c9a22 100755 --- a/local/www/cgi-bin/sys-set/systemSpace +++ b/local/www/cgi-bin/sys-set/systemSpace @@ -6,7 +6,7 @@ db="../bin/db" jsoner="../bin/jsoner" -path="/work" +path="/work/data" df_output=$(df -h $path | tail -n 1) diff --git a/local/www/cgi-bin/warn-list/update b/local/www/cgi-bin/warn-list/update index 5aa9642..ccf84d5 100755 --- a/local/www/cgi-bin/warn-list/update +++ b/local/www/cgi-bin/warn-list/update @@ -19,4 +19,4 @@ fi sn=`$jsoner $content sn` -`msg alarm $id` > /dev/null +`msg alarm $sn` > /dev/null diff --git a/local/www/detail-jmkt.html b/local/www/detail-jmkt.html index c129b8d..e54dc82 100644 --- a/local/www/detail-jmkt.html +++ b/local/www/detail-jmkt.html @@ -473,23 +473,6 @@ function renderValue(type,item) { var result = item.value; - // if(type == "2002" || type == "2020" || type == "2022"){ - // if(item.passcode >= 8 && item.passcode <= 998){ - // result = (item.value=="0"?"姝e父":"鍛婅"); - // if(item.passcode == 16){ - // if(item.value=="0"){ - // result = "閫侀"; - // } - // if(item.value=="1"){ - // result = "鍒剁儹"; - // } - // if(item.value=="2"){ - // result = "鍒跺喎"; - // } - // // result = (item.value=="0"?"鍏抽棴":"寮�鍚�"); - // } - // } - // } var str = ""; if(item.note && item.note.length > 0){ diff --git a/local/www/detail-mj.html b/local/www/detail-mj.html index 01593ae..2a24808 100644 --- a/local/www/detail-mj.html +++ b/local/www/detail-mj.html @@ -14,158 +14,6 @@ <body class="pdgxq-body"> <div class="i-container"> -<!-- <div class="jmkt-main">--> - -<!-- <div class="layui-fluid">--> -<!-- <div class="pdgxq-m1 layui-row layui-col-space20">--> -<!-- <div class="layui-col-lg5 layui-col-md5">--> -<!-- <div class="pdgxq-m1-left pdgxq-m1-box" style="height: 730px">--> -<!-- <div class="pdgxq-H">--> -<!-- <h3><i></i>鏈�杩戝紑闂ㄨ褰�</h3>--> -<!-- </div>--> - -<!-- <div class="pdgxq-table jmkt-table-wrap">--> -<!-- <table class="layui-table pdgxq-table1" lay-skin="nob">--> -<!-- <colgroup>--> -<!-- <col width="30%">--> -<!-- <col width="30%">--> -<!-- <col width="40%">--> -<!-- <col>--> -<!-- </colgroup>--> -<!-- <thead>--> -<!-- <tr>--> -<!-- <th>鍗″彿/濮撳悕</th>--> -<!-- <th>寮�闂ㄨ鏄�</th>--> -<!-- <th>寮�闂ㄦ椂闂�</th>--> -<!-- </tr>--> -<!-- </thead>--> -<!-- <tbody>--> -<!-- <tr>--> -<!-- <td>1001/寮犱笁</td>--> -<!-- <td>1鍙烽棬-鍒峰崱寮�闂�</td>--> -<!-- <td>2020-04-26 12:30:56</td>--> -<!-- </tr>--> -<!-- <tr>--> -<!-- <td>1002/鏉庡洓</td>--> -<!-- <td>2鍙烽棬-鎸囩汗寮�闂�</td>--> -<!-- <td>2020-04-25 12:35:28</td>--> -<!-- </tr>--> -<!-- <tr>--> -<!-- <td>1003/鐜嬩簲</td>--> -<!-- <td>3鍙烽棬-瀵嗙爜寮�闂�</td>--> -<!-- <td>2020-04-25 12:35:28</td>--> -<!-- </tr>--> -<!-- <tr>--> -<!-- <td>1002/鏉庡洓</td>--> -<!-- <td>2鍙烽棬-鎸囩汗寮�闂�</td>--> -<!-- <td>2020-04-25 12:35:28</td>--> -<!-- </tr>--> -<!-- <tr>--> -<!-- <td>1003/鐜嬩簲</td>--> -<!-- <td>3鍙烽棬-瀵嗙爜寮�闂�</td>--> -<!-- <td>2020-04-25 12:35:28</td>--> -<!-- </tr>--> -<!-- <tr>--> -<!-- <td>1002/鏉庡洓</td>--> -<!-- <td>2鍙烽棬-鎸囩汗寮�闂�</td>--> -<!-- <td>2020-04-25 12:35:28</td>--> -<!-- </tr>--> -<!-- <tr>--> -<!-- <td>1003/鐜嬩簲</td>--> -<!-- <td>3鍙烽棬-瀵嗙爜寮�闂�</td>--> -<!-- <td>2020-04-25 12:35:28</td>--> -<!-- </tr>--> -<!-- <tr>--> -<!-- <td>1003/鐜嬩簲</td>--> -<!-- <td>3鍙烽棬-瀵嗙爜寮�闂�</td>--> -<!-- <td>2020-04-25 12:35:28</td>--> -<!-- </tr>--> -<!-- <tr>--> -<!-- <td>1003/鐜嬩簲</td>--> -<!-- <td>3鍙烽棬-瀵嗙爜寮�闂�</td>--> -<!-- <td>2020-04-25 12:35:28</td>--> -<!-- </tr>--> -<!-- <tr>--> -<!-- <td>1003/鐜嬩簲</td>--> -<!-- <td>3鍙烽棬-瀵嗙爜寮�闂�</td>--> -<!-- <td>2020-04-25 12:35:28</td>--> -<!-- </tr>--> -<!-- <tr>--> -<!-- <td>1003/鐜嬩簲</td>--> -<!-- <td>3鍙烽棬-瀵嗙爜寮�闂�</td>--> -<!-- <td>2020-04-25 12:35:28</td>--> -<!-- </tr>--> -<!-- <tr>--> -<!-- <td>1003/鐜嬩簲</td>--> -<!-- <td>3鍙烽棬-瀵嗙爜寮�闂�</td>--> -<!-- <td>2020-04-25 12:35:28</td>--> -<!-- </tr>--> - -<!-- </tbody>--> -<!-- </table>--> - -<!-- </div><!–pdgxq-table end–>--> - -<!-- </div>--> - -<!-- </div><!–pdgxq-m1-left end–>--> - -<!-- <div class="layui-col-lg7 layui-col-md7">--> -<!-- <div class="pdgxq-m1-right pdgxq-m1-box">--> -<!-- <div class="pdgxq-H">--> -<!-- <h3><i></i>缁熻淇℃伅</h3>--> -<!-- </div>--> - -<!-- <div class="lsyg-jkxx-box">--> - -<!-- <div class=" layui-row">--> - -<!-- <div class="layui-col-lg6 layui-col-md6">--> -<!-- <div class="mj-item mj-item1">--> -<!-- <img src="./images/mj-bg1-img.png" class="mj-item-img"/>--> -<!-- <div class="mj-itemCon">--> -<!-- <h4>鍗曟棩寮�闂ㄦ鏁�</h4>--> -<!-- <p>5</p>--> -<!-- </div>--> - -<!-- </div>--> - -<!-- </div>--> - -<!-- <div class="layui-col-lg6 layui-col-md6">--> -<!-- <div class="mj-item mj-item2">--> -<!-- <img src="./images/mj-bg1-img.png" class="mj-item-img"/>--> -<!-- <div class="mj-itemCon">--> -<!-- <h4>杩�7澶╁紑闂ㄦ鏁�</h4>--> -<!-- <p>20</p>--> -<!-- </div>--> -<!-- </div>--> -<!-- </div>--> -<!-- </div>--> - -<!-- </div><!–lsyg-jkxx-box end–>--> -<!-- </div>--> - -<!-- <div style="padding-top: 20px">--> -<!-- <div class="pdgxq-m2-right pdgxq-m2-box">--> -<!-- <h3>璁惧鍩烘湰淇℃伅</h3>--> -<!-- <p>璁惧鍚嶇О锛氭満鎴块棬绂�</p>--> -<!-- <p>璁惧鐘舵�侊細婵�娲�</p>--> -<!-- <p>杩愮淮鍘傚晢锛氶姝h嚧杩滀俊鎭妧鏈偂浠芥湁闄愬叕鍙�</p>--> - -<!-- <div class="pdgxq-phone">--> -<!-- <h4>杩愮淮鐢佃瘽</h4>--> -<!-- <p>400-627-1116</p>--> -<!-- </div>--> -<!-- </div>--> -<!-- </div>--> - -<!-- </div><!–pdgxq-m1-left end–>--> - -<!-- </div><!–pdgxq-m1 end–>--> -<!-- </div>--> - -<!-- </div><!–jmkt-main end–>--> <div class="jmkt-main"> <div class="layui-fluid"> @@ -182,9 +30,9 @@ <p></p> <p>璁惧鍚嶇О锛�<span id="deviceName">鏈煡璁惧#1</span></p> <p>璁惧鐘舵�侊細<span id="deviceVld">婵�娲�</span></p> - <p>杩愮淮鍘傚晢锛�<span id="opVendor"></span></p> + <p style="display: none;">杩愮淮鍘傚晢锛�<span id="opVendor"></span></p> - <div class="pdgxq-phone"> + <div class="pdgxq-phone" style="display: none;"> <h4>杩愮淮鐢佃瘽</h4> <p id="opPhone"></p> </div> @@ -200,15 +48,15 @@ <div class="pdgxq-m1-right pdgxq-m1-box" style="height: 730px"> <div class="pdgxq-H"> <h3><i></i>寮�闂ㄨ褰�</h3> -<!-- <div id="open" class="jmkt-tit-more" onclick="sendAction();">--> -<!-- <button type="button" class="layui-btn layui-btn-normal pop-complete-btn"--> -<!-- style="background-color: #46b8da;color: #ffffff;">寮�闂�</button>--> -<!-- </div>--> + <div id="open" class="jmkt-tit-more" onclick="sendAction();"> + <button type="button" class="layui-btn layui-btn-normal pop-complete-btn" + style="background-color: #46b8da;color: #ffffff;">寮�闂�</button> + </div> </div> - <div class="pdgxq-group clearfix"> + <div class="pdgxq-group clearfix" style=""> <div class="pdgxq-group-item jmkt-chuli"> - <span id="warnState">鏃�</span>璀﹀憡鐘舵�� + <span id="warnState">鍏抽棬</span>鍛婅鐘舵�� </div> <div class="pdgxq-group-item jmkt-yichuli"> <span id="conState">姝e父</span>閫氳鐘舵�� @@ -268,6 +116,8 @@ </div><!--pdgxq-m1 end--> </div> + + </div> <!--i-container end--> @@ -297,21 +147,21 @@ $("#deviceName").html(device.name); $("#deviceVld").html(device.vld==0?'婵�娲�':'鍋滅敤'); queryRecord(deviceId); - //setInterval(function () { - // queryRecord(deviceId); - // // queryData(deviceId); - //},5000); + setInterval(function () { + // queryRecord(deviceId); + queryData(deviceId); + },5000); } - function queryData(deviceId,device) { + function queryData(deviceId) { console.log("======闂ㄧ椤甸潰-鏌ヨ瀹炴椂======"); var data = {id: deviceId}; $.post("./cgi-bin/detail/query-data", JSON.stringify(data), function (data, status) { if ("success" == status) { console.log('---------鑾峰彇鍒扮殑璁惧瀹炴椂鏁版嵁-----' + data); - renderInfo(data,device); + renderInfo(data); } else { console.log("鏁版嵁鏌ヨ鍑洪敊锛岃閲嶆柊鎿嶄綔锛�"); window.parent.notify("鏁版嵁鏌ヨ鍑洪敊锛岃閲嶆柊鎿嶄綔锛�"); @@ -320,25 +170,20 @@ }; //寮�濮嬫覆鏌撳疄鏃舵暟鎹� - function renderInfo(deviceData, device) { - console.log("--------娓叉煋瀹炴椂鏁版嵁-------闂ㄧid="+device.id); - console.log(deviceData); - //璁惧鍩烘湰淇℃伅 - $("#deviceName").html(device.name); - $("#deviceVld").html(device.vld==0?'婵�娲�':'鍋滅敤'); - + function renderInfo(deviceData) { //鐩戞帶灞炴�у疄鏃舵暟鎹覆鏌� var list = deviceData.value; if(list !=null && list.length>0){ $.each(list,function(index,item) { //閫氳鐘舵�� if (item.passcode == 1) { - $("#conState").html(item.value == 0 ? "姝e父" : "寮傚父"); + $("#conState").html(item.value == 0 ? "姝e父" : "閫氳寮傚父"); + $("#warnState").html(item.value == 0 ? "姝e父" : "閫氳寮傚父"); } - //璀﹀憡鐘舵�� - if (item.passcode == 2) { - $("#warnState").html(item.value == 0 ? "鏃�" : "鎶ヨ"); - } + // //闂ㄧ鐘舵�� + // if (item.passcode == 4) { + // $("#warnState").html(item.value == 0 ? "鍏抽棬" : "寮�闂�"); + // } }); } @@ -361,6 +206,15 @@ function queryRecord(id) { console.log("--------鏌ョ湅闂ㄧ鍘嗗彶璁板綍-------闂ㄧid="+id); var param = {"id": id}; + // $.post("./cgi-bin/record-his/query", JSON.stringify(param), function (data, status) { + // if ("success" == status) { + // //娓叉煋鍘嗗彶鏁版嵁鍒楄〃 + // renderRecordInfo(data); + // }else { + // window.parent.notify("闂ㄧ鏁版嵁鏌ヨ鍑洪敊锛岃閲嶆柊鎿嶄綔锛�"); + // } + // }, "json"); + $.post("./cgi-bin/record-his/query-by-id", JSON.stringify(param), function (data, status) { if ("success" == status) { //娓叉煋鍘嗗彶鏁版嵁鍒楄〃 @@ -372,46 +226,74 @@ } //寮�濮嬫覆鏌� function renderRecordInfo(dataList) { - console.log(dataList); - + var li = dataList; + console.log(li); + console.log(li.length); //闂ㄧ鍘嗗彶鏁版嵁娓叉煋 var html=""; - if(dataList !=null && dataList.length>0){ + if(li != null && li.length > 0){ var list; - $.each(dataList,function(index,item){ - list = eval(item.value); - if(list !=null && list.length>0){ - var tag1 = ''; //鍗″彿/濮撳悕 - var tag2 = ''; //闂ㄥ彿 - var tag3 = ''; //寮�闂ㄧ被鍨� - var tag4 = ''; //寮�闂ㄦ椂闂� - $.each(list,function(index,item){ - if(item.passcode == 3){ - tag2 = item.value + '鍙烽棬-'; + $.each(li,function(index,item){ + if(item.value){ + list = eval(item.value); + if(list !=null && list.length>0) { + var tag1 = ''; //鍗″彿/濮撳悕 + var tag2 = ''; //闂ㄥ彿 + var tag3 = ''; //寮�闂ㄧ被鍨� + var tag4 = ''; //寮�闂ㄦ椂闂� + for (var i = 0; i < list.length; i++) { + var cur = list[i]; + if (cur.passcode == 3) { + tag2 = cur.value + '鍙烽棬-'; + } + if (cur.passcode == 5) { + tag1 = cur.value; + } + if (cur.passcode == 6) { + tag3 = cur.value; + } + if (cur.passcode == 7) { + // tag4 = cur.value.substring(0, 4) + "-" + + // cur.value.substring(4, 6) + "-" + + // cur.value.substring(6, 8) + " " + + // cur.value.substring(8, 10) + ":" + + // cur.value.substring(10, 12) + ":" + + // cur.value.substring(12, 14); + tag4 = cur.value; + } } - if(item.passcode == 5){ - tag1 = item.value; - } - if(item.passcode == 6){ - tag3 = item.value; - } - if(item.passcode == 7){ - tag4 = item.value.substring(0,4) + "-" + - item.value.substring(4,6) + "-" + - item.value.substring(6,8) + " " + - item.value.substring(8,10) + ":" + - item.value.substring(10,12)+ ":" + - item.value.substring(12,14); - } - }); - html += "<tr><td>"+ tag1 +"</td><td>" + tag2 + tag3 + "</td><td>" + tag4 + "</td></tr>"; + + html += "<tr><td>" + tag1 + "</td><td>" + tag2 + tag3 + "</td><td>" + tag4 + "</td></tr>"; + } } + }); }else { - html += "<tr><td colspan='3'>鏆傛棤鏁版嵁</td></tr>"; + // html += "<tr><td colspan='3'>鏆傛棤鏁版嵁</td></tr>"; } $("#listData").html(html); } + + + + function sendAction() { + if (confirm('鏄惁杩涜寮�闂ㄦ搷浣滐紵')){ + var param = {"id": deviceId,"passcode":8,"value":1}; + console.log("======寮�闂ㄦ搷浣滃懡浠ゅ彂閫�======"); + // console.log(JSON.stringify(param)); + // $.post("./cgi-bin/action/open-door", JSON.stringify(param), function (data, status) { + // + // }, "json"); + $.ajaxSettings.async = false; + $.post("./cgi-bin/file/action-control", JSON.stringify(param), function (data, status) { + + }, "json"); + window.parent.notify("鍛戒护鍙戦�佹垚鍔燂紒"); + } + return false; + } + + </script> </body> diff --git a/local/www/detail-ups.html b/local/www/detail-ups.html index 0a853b2..205581f 100644 --- a/local/www/detail-ups.html +++ b/local/www/detail-ups.html @@ -203,7 +203,7 @@ } html += "<tr><td>"+cur.name+"</td><td>"+str+"</td><td>"+time+"</td></tr>"; }else{ - html += "<tr><td>"+cur.name+"</td><td>"+renderValue(device.id,device.type,cur.passcode,cur.value)+"</td><td>"+time+"</td></tr>"; + html += "<tr><td>"+cur.name+"</td><td>"+renderValue(device.type,cur)+"</td><td>"+time+"</td></tr>"; //娓叉煋鍒楄〃 @@ -284,7 +284,7 @@ } html += "<tr><td>"+cur.name+"</td><td>"+str+"</td><td>"+time+"</td></tr>"; }else{ - html += "<tr><td>"+cur.name+"</td><td>"+renderValue(device.id,device.type,cur.passcode,cur.value)+"</td><td>"+time+"</td></tr>"; + html += "<tr><td>"+cur.name+"</td><td>"+renderValue(device.type,cur)+"</td><td>"+time+"</td></tr>"; //娓叉煋鍒楄〃 // html += "<tr><td>"+cur.name+"</td><td>"+(cur.value?cur.value:"")+"</td><td>"+time+"</td></tr>"; @@ -357,139 +357,8 @@ } } - function renderValue(id,type,code,value) { - var res = value; - - // if(type == "1001"){ - // if(code == 3 || code == 5){ - // res = value+"V"; - // } - // else if(code == 4 || code == 6){ - // res = value+"A"; - // } - // else if(code == 7){ - // res = value+"Hz"; - // } - // else if(code == 8){ - // res = value+"%"; - // } - // else if(code == 9){ - // res = value+"鈩�"; - // } - // else if(code == 10){ - // if(value == 0){ - // res = "甯傜數渚涚數" - // } - // if(value == 1){ - // res = "鐢垫睜渚涚數" - // } - // } - // else if(code == 11){ - // if(value == 0){ - // res = "姝e父" - // } - // if(value == 1){ - // res = "鏃佽矾" - // } - // if(value == 2){ - // res = "鐢垫睜渚涚數" - // } - // } - // else if(code == 12){ - // res = value+"V"; - // } - // else if(code == 13){ - // res = value+"%"; - // } - // else if(code == 14){ - // res = value+"min"; - // } - // else if(code >= 15 && code < 999){ - // res = value == "0"?"姝e父":"鍛婅"; - // } - // } - // - // if(type == "1002"){ - // if(code >= 3 && code <= 5){ - // res = value+"V"; - // } - // else if(code >= 6 && code <= 8){ - // res = value+"A"; - // } - // else if(code >= 9 && code <= 11){ - // res = value+"V"; - // } - // else if(code >= 12 && code <= 14){ - // res = value+"A"; - // } - // else if(code == 15){ - // res = value+"Hz"; - // } - // else if(code >= 16 && code <= 18){ - // res = value+"%"; - // } - // else if(code == 19){ - // res = value+"鈩�"; - // } - // else if(code == 20){ - // if(value == 0){ - // res = "甯傜數渚涚數" - // } - // if(value == 1){ - // res = "鐢垫睜渚涚數" - // } - // if(value == 2){ - // res = "涓嶄緵鐢�" - // } - // if(value == 3){ - // res = "鑱斿悎渚涚數" - // } - // if(value == 4){ - // res = "鏃佽矾渚涚數" - // } - // } - // else if(code == 21){ - // if(value == 0){ - // res = "姝e父" - // } - // if(value == 1){ - // res = "鏃佽矾" - // } - // if(value == 2){ - // res = "鐢垫睜渚涚數" - // } - // } - // else if(code == 22){ - // res = value+"V"; - // } - // else if(code == 23){ - // res = value+"%"; - // } - // else if(code == 24){ - // res = value+"min"; - // } - // else{ - // if(code >= 25 && code <= 998){ - // res = value == 0 ? "姝e父" : "鍛婅"; - // if(value != 0 && value != 1){ - // res = value; - // } - // - // // if(code >= 25 && code <= 27){ - // // res = value + "V"; - // // } - // // if(code >= 28 && code <= 30){ - // // res = value + "KW"; - // // } - // // if(code >= 31 && code <= 35){ - // // res = value + "Hz"; - // // } - // - // } - // - // } - // } - + function renderValue(type,cur) { + var res = cur.value; var str = ""; if(cur.note && cur.note.length > 0){ diff --git a/local/www/download.html b/local/www/download.html deleted file mode 100644 index 3067761..0000000 --- a/local/www/download.html +++ /dev/null @@ -1,16 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Test Upload</title> - <meta name="author" content="Jack"> -</head> -<body> - <table> - <tr> - <td><a href="/cgi-bin/download.cgi?filename=/work/data/www.tgz" download="www.tgz"> 鏂版枃浠惰缃� </a></td> - </tr> - </table> - -</body> -</html> diff --git a/local/www/js/page/device-net.js b/local/www/js/page/device-net.js index 842c631..c56babc 100644 --- a/local/www/js/page/device-net.js +++ b/local/www/js/page/device-net.js @@ -272,7 +272,7 @@ libnamezh: $("#device-libname option[value='"+ $("#device-libname").val() +"']").text(), type: $("#device-type").val(), vld: $("#device-vld").val(), - userName: $("#dev-libname").val(), + userName: $("#device-userName").val(), passwd: $("#device-passwd").val(), // userName: $("#dev-libname").val(), taskNo: $("#device-taskNo").val(), diff --git a/local/www/sys-param-set.html b/local/www/sys-param-set.html index 0e1140d..82de834 100644 --- a/local/www/sys-param-set.html +++ b/local/www/sys-param-set.html @@ -39,10 +39,11 @@ <li class="layui-this"><span>绔彛璁剧疆</span></li> <li class=""><span>骞冲彴璁剧疆</span></li> <li class=""><span>缃戠粶璁剧疆</span></li> - <li class=""><span>瀛樺偍绠$悊</span></li> + <li class=""><span>瀛樺偍璁剧疆</span></li> <li class=""><span>璺敱琛�</span></li> <li class=""><span>鍥藉瘑閰嶇疆</span></li> <li class=""><span>MQTT</span></li> + <li class=""><span>SNMP</span></li> <li id="etc" class="" style="display: none;"><span>楂橀�烢TC鐪佸钩鍙伴厤缃�</span></li> </ul> <div class="layui-tab-content"> @@ -75,6 +76,10 @@ data-id="sys-mqtt-conf.html" seamless></iframe> </div> <div class="layui-tab-item"> + <iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="sys-snmp-conf.html" frameborder="0" + data-id="sys-snmp-conf.html" seamless></iframe> + </div> + <div class="layui-tab-item"> <iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="sys-etc-param.html" frameborder="0" data-id="sys-etc-param.html" seamless></iframe> </div> diff --git a/local/www/sys-register.html b/local/www/sys-register.html index cd3fde2..d6f0a13 100644 --- a/local/www/sys-register.html +++ b/local/www/sys-register.html @@ -57,7 +57,7 @@ <div class="layui-card" style="height: 270px;"> <div class="layui-card-header layui-row"> <div class="layui-col-md11"> - 娉ㄥ唽鏈烘鐮� + 娉ㄥ唽鏈哄櫒鐮� </div> <div class="layui-col-md1"> <button class="layui-btn layui-btn-normal" style="height: 25px;line-height: 25px;" diff --git a/local/www/sys-snmp-conf.html b/local/www/sys-snmp-conf.html new file mode 100644 index 0000000..0c7a8cd --- /dev/null +++ b/local/www/sys-snmp-conf.html @@ -0,0 +1,190 @@ +<!DOCTYPE html> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<meta name="viewport" + content="width=device-width, initial-scale=1, maximum-scale=1"> +<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> +<meta name="renderer" content="webkit"> +<title>鏅鸿兘杩愮淮绠$悊绯荤粺-SNMP</title> + + <link rel="stylesheet" type="text/css" href="plugins/layui/css/layui.css" /> + <link rel="stylesheet" type="text/css" href="css/page/device-control.css" /> + <style> + .layui-col-md4 { + width: 100%; + } + + .layui-inline { + margin-left: unset; + } + + .layui-layer-dialog .layui-layer-content { + border-bottom: solid 1px #eae5e5; + } + .btns button{ + width: 120px; + } + + </style> +</head> + +<body class="pdgxq-body"> + <div class="i-container"> + <div class="jmkt-main"> + <div class="layui-fluid"> + <div class="pdgxq-m1 layui-row layui-col-space20"> + <!--pdgxq-m1-left end--> + <div class="layui-col-lg12 layui-col-md12 img-main" id="img-main" style="padding: 20px;"> + <div class="pdgxq-m1-left pdgxq-m1-box" style="width: 100%;"> + <form class="layui-form" id="form-param" lay-filter="form-param" action=""> + <div class="layui-row" style="padding: 20px 0;"> + + <div class="layui-col-md4"> + <div class="layui-inline" style="margin-left: -16%"> + <label class="layui-form-label">SNMP妯$粍锛�</label> + <div class="layui-input-block"> + <input type="checkbox" id="enable" name="enable" lay-skin="switch" + lay-filter="switch" lay-text="鍚敤|鍋滅敤"> + </div> + </div> + </div> + <div class="layui-col-md4"> + <div class="layui-inline"> + <label class="layui-form-label">鐗堟湰鍙凤細</label> + <div class="layui-input-block"> + <input id="ver" type="text" name="ver" value="V2.0" + class="layui-input" readonly> + </div> + </div> + </div> + <div class="layui-col-md4"> + <div class="layui-inline"> + <label class="layui-form-label">鍏辩敤浣撳悕绉帮細</label> + <div class="layui-input-block"> + <input id="publicName" type="text" name="publicName" value="public" + class="layui-input" readonly> + </div> + </div> + </div> + <div class="layui-col-md4"> + <div class="layui-inline"> + <label class="layui-form-label">绔彛鍙凤細</label> + <div class="layui-input-block"> + <input id="port" type="text" name="port" value="161" + class="layui-input" readonly> + </div> + </div> + </div> + + <div class="layui-col-md4" style=""> + <div class="layui-inline"> + <div class="layui-input-block btns" style="margin-left: 15px"> + + <button style="margin-right: 50px; font-size: 16px" + class="layui-btn layui-btn-warm" + onclick="javaScript:downLoadF(); return false;">瀵煎嚭OID琛� + </button> + </div> + </div> + </div> + + </div> + </form> + </div> + </div> + + </div> + <!--pdgxq-m1 end--> + </div> + </div> + <!--jmkt-main end--> + </div> + <!--i-container end--> + + <script type="text/javascript" src="js/jquery.min.js"></script> + <script src="plugins/layui/layui.js"></script> + <script src="js/constant.js"></script> + <script type="text/javascript"> + + var layer;// 瀹氫箟鍏ㄥ眬鍙橀噺 + var form; + var laydate; + $(function () { + layui.use(['layer', 'form', 'laydate'], function () { + layer = layui.layer; + form = layui.form; + laydate = layui.laydate; + + form.on('switch(switch)', function(data){ + //寮�鍏崇姸鎬佹敼鍙樻椂瑙﹀彂 + changeStatus(this.checked); + }); + query(); + }); + }); + + function query() { + $.ajaxSettings.async = false; + $.get("./cgi-bin/snmp/query", function (data, status) { + if ("success" == status) { + form.val('form-param', { + "enable": data.enable//0-鍚敤锛�1-绂佺敤 + }); + form.render(); + } else { + window.parent.parent.notify("绯荤粺鑾峰彇鐩戞帶璁惧淇℃伅澶辫触锛�"); + } + }, "json"); + } + + /** + * 淇敼鐘舵�� + * @param enable true or false + */ + function changeStatus(enable) { + var obj = {"enable":enable}; + $.post("./cgi-bin/snmp/enable", JSON.stringify(obj), function (data, status) { + if (data.code == "success") { + //window.parent.parent.notify("鏁版嵁淇濆瓨鎴愬姛"); + window.parent.parent.notify("SNMP妯$粍鐘舵�佷繚瀛樻垚鍔�"); + } else { + window.parent.parent.notify("鏁版嵁淇濆瓨鍑洪敊锛岃閲嶆柊鎿嶄綔锛�"+data.msg+"锛�"); + } + }, "json"); + } + + //瀵煎嚭 + function downLoadF() { + $.ajaxSettings.async = false; + $.get("./cgi-bin/snmp/download", function (data, status) { + if ("success" == data.code) { + downLoadF2(); + }else{ + window.parent.parent.notify("鐢熸垚oid琛ㄥ嚭閿�"); + } + }, "json"); + } + + function downLoadF2() { + var fileName = "oid_list.csv"; + var url = "./cgi-bin/download/download.cgi?filename=/temp/oid_list.csv"; + + // 瀵逛簬<a>鏍囩锛屽彧鏈� Firefox 鍜� Chrome锛堝唴鏍革級 鏀寔 download 灞炴�� + if ('download' in document.createElement('a')) { // 鏀寔a鏍囩download鐨勬祻瑙堝櫒 + var link = document.createElement('a'); // 鍒涘缓a鏍囩 + link.download = fileName;// a鏍囩娣诲姞灞炴�� + link.style.display = 'none'; + // link.href = URL.createObjectURL(blob); + link.href = url; + document.body.appendChild(link); + link.click(); // 鎵ц涓嬭浇 + URL.revokeObjectURL(link.href); // 閲婃斁url + document.body.removeChild(link); // 閲婃斁鏍囩 + } else { // 鍏朵粬娴忚鍣� + navigator.msSaveBlob(url, fileName); + } + } + </script> +</body> +</html> diff --git a/local/www/upload.html b/local/www/upload.html deleted file mode 100644 index f055664..0000000 --- a/local/www/upload.html +++ /dev/null @@ -1,20 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Test Upload</title> - <meta name="author" content="Jack"> - <script type="text/javascript"> - function showUploadResult(result) { - alert(result); - } - </script> -</head> -<body> -<form action="cgi-bin/upload/upload.cgi" method="post" enctype="multipart/form-data" target="uploadResult"> - <input type="file" name="file" value="" /> - <input type="submit" name="submit" value="OK"> -</form> -<iframe name="uploadResult" style="display:none;"></iframe> -</body> -</html> diff --git a/upgrade/app.tgz b/upgrade/app.tgz index 1700ae9..4644fd1 100644 --- a/upgrade/app.tgz +++ b/upgrade/app.tgz Binary files differ -- Gitblit v1.9.3