PanelE_.html 79 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420
  1. <!doctype html>
  2. <html>
  3. <title>宝智达物联网平台-面板编辑器</title>
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  6. <script type="text/javascript" src="{{.OSS_Static}}/panel/jquery.min.js"></script>
  7. <script type="text/javascript" src="{{.OSS_Static}}/panel/layer/layer.js"></script>
  8. <script type="text/javascript" src="{{.OSS_Static}}/panel/context/context.js"></script>
  9. <script type="text/javascript" src="{{.OSS_Static}}/panel/drag.js"></script>
  10. <link rel="stylesheet" type="text/css" href="{{.OSS_Static}}/panel/context/context.standalone.css">
  11. <!--右侧菜单-->
  12. <link rel="stylesheet" type="text/css" href="{{.OSS_Static}}/panel/SlidePushMenus/css/default.css"/>
  13. <link rel="stylesheet" type="text/css" href="{{.OSS_Static}}/panel/SlidePushMenus/css/component.css"/>
  14. <script src="{{.OSS_Static}}/panel/SlidePushMenus/js/modernizr.custom.js"></script>
  15. <script src="{{.OSS_Static}}/panel/SlidePushMenus/js/classie.js"></script>
  16. <!-- <script src="{{.OSS_Static}}/panel/toggle/togglestyle.css"></script>-->
  17. <link rel="stylesheet" type="text/css" href="https://www.jq22.com/demo/csstoggle202003032356/style.css"/>
  18. <style type="text/css">
  19. html, body {
  20. margin: 0;
  21. padding: 0;
  22. overflow: hidden;
  23. }
  24. .transparent {
  25. filter: alpha(opacity=50);
  26. -moz-opacity: 0.5;
  27. -khtml-opacity: 0.5;
  28. /*opacity: 0.5; // 模糊*/
  29. }
  30. .box {
  31. width: 200px;
  32. height: 100px;
  33. cursor: move;
  34. position: absolute;
  35. top: 30px;
  36. left: 30px;
  37. z-index: 99;
  38. }
  39. .box .bg {
  40. width: 100%;
  41. height: 100%;
  42. background-color: orange;
  43. }
  44. .box .coor {
  45. width: 10px;
  46. height: 10px;
  47. overflow: hidden;
  48. cursor: se-resize;
  49. position: absolute;
  50. right: 0;
  51. bottom: 0;
  52. background-color: red;
  53. z-index: 9999999999;
  54. }
  55. .box .content {
  56. position: absolute;
  57. left: 50%;
  58. top: 50%;
  59. z-index: 99;
  60. text-align: center;
  61. font: bold 14px/1.5em simsun;
  62. }
  63. #debug {
  64. position: absolute;
  65. right: 10px;
  66. top: 10px;
  67. z-index: 88;
  68. border: 1px solid #ccc;
  69. width: 100px;
  70. height: 100px;
  71. background: #fff;
  72. }
  73. #toolbar {
  74. position: absolute;
  75. left: 10px;
  76. top: 10px;
  77. z-index: 88;
  78. }
  79. </style>
  80. <style>
  81. .help-left {
  82. width: 310px;
  83. font-family: 'microsoft YaHei';
  84. float: left;
  85. overflow-x: hidden;
  86. max-height: 100%;
  87. overflow-y: auto;
  88. }
  89. .menu {
  90. border-left: 1px solid #ccc;
  91. border-right: 1px solid #ccc;
  92. background-color:#FEFEFE;
  93. width:100%;
  94. float: left;
  95. }
  96. .menu:last-child {
  97. border-bottom: 1px solid #ccc;
  98. }
  99. .menu summary {
  100. height: 40px;
  101. line-height: 40px;
  102. text-indent: 10px;
  103. outline: none;
  104. font-size: 14px;
  105. font-weight: 700;
  106. border-top: 1px solid #ddd;
  107. background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #FEFEFE), color-stop(1, #CCCCCC));
  108. cursor: pointer;
  109. width:100%;
  110. float: left;
  111. text-align: left;
  112. }
  113. .menu summary::-webkit-details-marker {
  114. display: none;
  115. }
  116. .menu .divul {
  117. padding: 10px 0;
  118. clear:left;
  119. width:100%;
  120. float: left;
  121. margin-left: 1px;
  122. }
  123. .menu .divulli {
  124. padding: 10px 0;
  125. width:97px;
  126. height: 100px;
  127. float: left;
  128. cursor: move;
  129. }
  130. .menu .divulli img {
  131. width:60px;
  132. height:60px;
  133. -webkit-user-select: none;
  134. cursor: default;
  135. pointer-events: none;
  136. }
  137. .menu .divulli div {
  138. width:97%;
  139. margin-top:-8px;
  140. overflow: hidden;
  141. text-overflow: ellipsis;
  142. white-space: nowrap;
  143. text-align: center;
  144. display:inline-block
  145. }
  146. .menu .divulli pre {
  147. width:0px;
  148. height:0px;
  149. overflow: hidden;
  150. }
  151. .menu .divulli:hover {
  152. background-color: #ececec;
  153. /*text-decoration: underline;*/
  154. }
  155. </style>
  156. <style>
  157. #tab-header span {
  158. padding: 0px 10px ;
  159. height: 38px;
  160. font-size: 20px;
  161. border-radius: 5px;
  162. padding-bottom: 10px;
  163. padding-top: 4px;
  164. }
  165. #tab-content .dom {
  166. display: none;
  167. }
  168. .open_layer_layui-layer-input {
  169. /*display: block;*/
  170. width: 220px;
  171. height: 30px;
  172. margin: 0 auto;
  173. line-height: 30px;
  174. padding: 0 5px;
  175. border: 1px solid #ccc;
  176. box-shadow: 1px 1px 5px rgba(0, 0, 0, .1) inset;
  177. color: #333;
  178. user-select: auto;
  179. }
  180. #open_layer_save_layer button {
  181. display: block;
  182. height: 38px;
  183. line-height: 38px;
  184. border: 1px solid transparent;
  185. padding: 0 18px;
  186. margin: 20px auto;
  187. background-color: #1E9FFF;;
  188. color: #fff;
  189. white-space: nowrap;
  190. text-align: center;
  191. font-size: 14px;
  192. border-radius: 2px;
  193. cursor: pointer;
  194. }
  195. .layer_mode_tab{
  196. position: absolute;
  197. bottom: 0px;
  198. right: 300px;
  199. background-color: #9AD4FF69;
  200. color: #0093FF;
  201. padding: 6px;
  202. height: 23px;
  203. z-index:999999999999999999999;
  204. border-radius: 5px;
  205. }
  206. .layer_tool_tab{
  207. position: absolute;
  208. top: 0;
  209. left: 10px;
  210. /*background:#FFF;*/
  211. width: 100%;
  212. height: 30px;
  213. z-index:999999999999999999999;
  214. }
  215. .layer_tool_tab button {
  216. height: 28px;
  217. line-height: 28px;
  218. float: left;
  219. border: 1px solid transparent;
  220. padding: 0 18px;
  221. margin: 1px;
  222. background-color: #1E9FFF;;
  223. color: #fff;
  224. white-space: nowrap;
  225. text-align: center;
  226. font-size: 12px;
  227. border-radius: 2px;
  228. cursor: pointer;
  229. }
  230. .layer_tool_tab button:hover {
  231. background-color: #0092ff;;
  232. font-size: 12px;
  233. }
  234. .PanelCanvas_div{
  235. cursor: default;
  236. user-select: none;
  237. position: absolute;
  238. border: 2px dashed rgb(204, 204, 204);
  239. /*padding: 10px;*/
  240. }
  241. .PanelCanvas_rel_div{
  242. border: 2px dashed rgb(204, 204, 204);
  243. }
  244. .gridbackground { /*网格背景*/
  245. /*90度直线,100灰度,0.1透明度,5%宽度,0透明度背景*/
  246. background: linear-gradient(90deg, rgba(141, 128, 128, 0.1) 5%, transparent 0),
  247. /*0度直线,100灰度,0.1透明度,5%宽度,0透明度背景*/
  248. linear-gradient(rgba(100, 100, 100, 0.1) 5%, transparent 0);
  249. /*横纵向宽距*/
  250. background-size: 20px 20px;
  251. }
  252. </style>
  253. </head>
  254. <div id="open_layer_Data_List" hidden style="">
  255. </div>
  256. <div id="open_layer_save_layer" hidden style="padding:20px">
  257. <div style="">面板名称:</div>
  258. <input id='open_layer_save_layer_name' ondblclick='f_attribute_Device(this)' type="'text'" class="open_layer_layui-layer-input" value="">
  259. <div style="margin-top: 20px;">面板图片:</div>
  260. <input id='open_layer_save_layer_img' ondblclick='f_attribute_img(this)' type="'text'" class="open_layer_layui-layer-input" value="">
  261. <button onclick="f_Save_layer_choice()">保存为面板</button>
  262. </div>
  263. <!--瀑瀑模式 - 数据来源-->
  264. <div id="open_layer_data_layer" hidden style="padding:20px;">
  265. <div style="width: 100%;float: left;margin-top: 0px;margin-bottom: 10px">数据来源:</div>
  266. <textarea id="open_layer_data_layer_textarea" class="layui-layer-prompt layui-layer-input"
  267. style="width: 99%;height: 400px;user-select: auto;"></textarea>
  268. <!-- <div style="float: left">-->
  269. <!-- 方式一:-->
  270. <!-- 插入SN,以换行符结束-->
  271. <!-- </div>-->
  272. <!-- <div style="float: left">-->
  273. <!-- 方式二:-->
  274. <!-- </div>-->
  275. </div>
  276. <!--自定义 CSS-->
  277. <div id="open_layer_css_layer" hidden style="padding:20px;">
  278. <!-- 背景图片-->
  279. <div style="width: 100%;float: left;margin: 10px 0px;">
  280. <div style="width: 80px;float: left">
  281. 背景图片:
  282. </div>
  283. <div style="width: 170px;float: left">
  284. <input id='S_open_layer_css_layer_background_img' ondblclick='f_attribute_libimg(this)' style="user-select: auto;" type='text' class="layui-layer-input" value="">
  285. </div>
  286. <div style="width: 80px;float: left">
  287. 背景拉伸:
  288. </div>
  289. <div style="width: 100px;float: left">
  290. <select id="S_open_layer_css_layer_background_select">
  291. <option value=" no-repeat center center/100%;">缩放背景</option>
  292. <option value=" no-repeat 100% 100%;">铺满背景</option>
  293. <option value=" no-repeat;height:100%;width:100%;overflow: hidden;background-size:cover;">拉伸铺满</option>
  294. <option value=" repeat;">重复背景</option>
  295. </select>
  296. </div>
  297. <div style="width: 20px;float: left;margin-left: 10px;" onclick="S_open_layer_css_layer_background_on()">
  298. +
  299. </div>
  300. <script>
  301. function S_open_layer_css_layer_background_on() {
  302. text = "background : url('"+$("#S_open_layer_css_layer_background_img").val()+"') "+$("#S_open_layer_css_layer_background_select").val()
  303. $("#open_layer_css_layer_textarea").val($("#open_layer_css_layer_textarea").val()+"\n"+text)
  304. }
  305. </script>
  306. </div>
  307. <!-- 背景颜色-->
  308. <div style="width: 100%;float: left;margin: 10px 0px;">
  309. <div style="width: 80px;float: left">
  310. 背景颜色:
  311. </div>
  312. <div style="width: 65px;float: left">
  313. <input id='S_open_layer_css_layer_backgroundcolour_colour1' ondblclick='f_attribute_color(this)' style="width: 55px;" type='text' class="layui-layer-input">
  314. </div>
  315. <div style="width: 20px;float: left;margin-left: 10px;" onclick="S_open_layer_css_layer_backgroundcolour_colour1_on()">
  316. +
  317. </div>
  318. <script>
  319. function S_open_layer_css_layer_backgroundcolour_colour1_on() {
  320. text = "background-color : "+$("#S_open_layer_css_layer_backgroundcolour_colour1").val()+";"
  321. $("#open_layer_css_layer_textarea").val($("#open_layer_css_layer_textarea").val()+"\n"+text)
  322. }
  323. </script>
  324. <div style="width: 80px;float: left">
  325. 颜色渐变:
  326. </div>
  327. <div style="width: 65px;float: left">
  328. <input id='S_open_layer_css_layer_backgroundcolour_colour2' ondblclick='f_attribute_color(this)' style="width: 55px;" type='text' class="layui-layer-input">
  329. </div>
  330. <div style="width: 65px;float: left">
  331. <input id='S_open_layer_css_layer_backgroundcolour_colour3' ondblclick='f_attribute_color(this)' style="width: 55px;" type='text' class="layui-layer-input">
  332. </div>
  333. <div style="width: 100px;float: left">
  334. <select id="S_open_layer_css_layer_backgroundcolour_select" style="width: 90px;">
  335. <option value="">从上到下</option>
  336. <option value=" to right,">从左到右</option>
  337. <option value=" to bottom right,">对角线</option>
  338. </select>
  339. </div>
  340. <div style="width: 40px;float: left;margin-left: 10px;" onclick="S_open_layer_css_layer_backgroundcolour_colourgradient_on()">
  341. +
  342. </div>
  343. <script>
  344. function S_open_layer_css_layer_backgroundcolour_colourgradient_on() {
  345. text = "background-image : linear-gradient("+$("#S_open_layer_css_layer_backgroundcolour_select").val()+""+$("#S_open_layer_css_layer_backgroundcolour_colour2").val()+", "+$("#S_open_layer_css_layer_backgroundcolour_colour3").val()+")"+";"
  346. $("#open_layer_css_layer_textarea").val($("#open_layer_css_layer_textarea").val()+"\n"+text)
  347. }
  348. </script>
  349. </div>
  350. <div style="width: 100%;float: left;margin-top: 20px;margin-bottom: 10px">样式文本:</div>
  351. <textarea id="open_layer_css_layer_textarea" class="layui-layer-prompt layui-layer-input"
  352. style="width: 99%;height: 400px;user-select: auto;"></textarea>
  353. </div>
  354. <body >
  355. <input hidden type="file" id="UpLoadFile"/>
  356. <div id="PanelCanvas" class="gridbackground" draggable="true" style="user-select: none;height: 4000px;width: 4000px;position: absolute;left: 0px;top: 0px;background-color: #f0f0f0">
  357. <!-- <div id="PanelCanvas1" >-->
  358. <!-- <img src="{{.OSS_Static}}/images/demo_picture.jpg" />-->
  359. <!-- </div>-->
  360. </div>
  361. <!--左側工具欄-->
  362. <div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';">
  363. <nav class="cbp-spmenu cbp-spmenu-vertical cbp-spmenu-right" id="menuRight">
  364. <!-- <div onclick="f_on_menuLeft()" style="position: relative;left: -55px;width: 80px;height: 0px;color: #FFFFFF;font-size: 20px">-->
  365. <!-- <span style="background-color: #47a3da;padding: 0px 6px"> ^ </span>-->
  366. <!-- </div>-->
  367. <h3>宝智达冷链科技</h3>
  368. <!-- 选项卡部分 -->
  369. <div id="tab">
  370. <!-- 头部区域 -->
  371. <div id="tab-header" style="background:#e5e5e5;height: 30px;padding-top: 10px;overflow-y: hidden;">
  372. <span ondblclick="f_PanelTool_Device_List()">设备</span>
  373. <span >基础</span>
  374. <span >资源</span>
  375. <!-- <span >模块</span>-->
  376. <span >面板</span>
  377. <!-- <span >高级</span>-->
  378. </div>
  379. <!-- 身体部分 -->
  380. <div id="tab-content">
  381. <!-- 设备-->
  382. <div class="dom" style="background-color: #FEFEFE;display:block ">
  383. <div id="PanelTool_Device_List" style="padding-top: 10px;padding-bottom: 10px;overflow-x: hidden;overflow-y: auto;">
  384. </div>
  385. </div>
  386. <!-- 基础-->
  387. <div class="dom" style="display: block;">
  388. <section class="help-left">
  389. <details class="menu" open>
  390. <summary>基本组件</summary>
  391. <p draggable="true">这是一个可拖动的段落。</p>
  392. <div id="PanelTool_1" class="divul">
  393. </div>
  394. </details>
  395. <details class="menu" open>
  396. <summary>数据组件</summary>
  397. <div id="PanelTool_2" class="divul">
  398. </div>
  399. </details>
  400. <details class="menu" open>
  401. <summary>图表组件</summary>
  402. <div id="PanelTool_3" class="divul">
  403. </div>
  404. </details>
  405. <details class="menu" open>
  406. <summary>高级组件</summary>
  407. <div id="PanelTool_4" class="divul">
  408. </div>
  409. </details>
  410. </section>
  411. </div>
  412. <!-- 资源-->
  413. <div class="dom">
  414. <section class="help-left">
  415. <details class="menu" open>
  416. <summary>图标资源</summary>
  417. <div id="PanelSource_1" class="divul">
  418. </div>
  419. </details>
  420. </section>
  421. </div>
  422. <!-- 第二部分 -->
  423. <!-- <div class="dom">-->
  424. <!-- 222222222-->
  425. <!-- </div>-->
  426. <!-- 第二部分 -->
  427. <div class="dom">
  428. <section class="help-left">
  429. <details class="menu" open>
  430. <summary>产品面板</summary>
  431. <div id="LayerMould_1" class="divul">
  432. <!-- <div class="divulli" draggable="true" data-PanelToolId="1" ondragleave="v_ondragleave(1)">-->
  433. <!-- <img src="{{.OSS_Static}}/images/仪器控制.png">-->
  434. <!-- <div>设备管理</div>-->
  435. <!-- </div>-->
  436. </div>
  437. </details>
  438. <!-- <details class="menu" open>-->
  439. <!-- <summary>设备组件</summary>-->
  440. <!-- <div id="LayerMould_2" class="divul">-->
  441. <!-- &lt;!&ndash; <div class="divulli" draggable="true" data-PanelToolId="1" ondragleave="v_ondragleave(1)">&ndash;&gt;-->
  442. <!-- &lt;!&ndash; <img src="{{.OSS_Static}}/images/仪器控制.png">&ndash;&gt;-->
  443. <!-- &lt;!&ndash; <div>设备管理</div>&ndash;&gt;-->
  444. <!-- &lt;!&ndash; </div>&ndash;&gt;-->
  445. <!-- </div>-->
  446. <!-- </details>-->
  447. </section>
  448. </div>
  449. <!-- 第二部分 -->
  450. <!-- <div class="dom">-->
  451. <!-- 222222222-->
  452. <!-- </div>-->
  453. </div>
  454. </div>
  455. </nav>
  456. </div>
  457. <!--工程管理-->
  458. <div class="layer_tool_tab" >
  459. <button onclick="f_Save()">保存</button>
  460. <button onclick="f_PaneView_V();">返回视图</button>
  461. <button onclick="T_viewid_setItem();">复制底板</button>
  462. <button onclick="T_viewid_getItem();">粘贴底板</button>
  463. </div>
  464. <script>
  465. function T_viewid_setItem()
  466. {
  467. localStorage.setItem("T_viewid",T_viewid);
  468. console.log(localStorage.getItem("T_viewid")," OK!")
  469. }
  470. function T_viewid_getItem()
  471. {
  472. console.log("T_viewid:",localStorage.getItem("T_viewid"))
  473. $.ajax({
  474. type: 'POST',
  475. url: '../../Panel/PaneView_Get',//发送请求
  476. data: {
  477. T_viewid: localStorage.getItem("T_viewid"),
  478. },
  479. success: function (result) {
  480. console.log(result)
  481. if (result.Code == 200) {
  482. T_PanelCanvas = result.Data
  483. PanelCanvas_mode = T_PanelCanvas.T_mode
  484. f_PanelCanvas_mode_0(result)
  485. switch (PanelCanvas_mode) {
  486. case 0:
  487. $("#PanelCanvas_mode").html("自由模式")
  488. break
  489. case 1:
  490. $("#PanelCanvas_mode").html("瀑瀑模式")
  491. break
  492. case 2:
  493. $("#PanelCanvas_mode").html("满屏模式")
  494. break
  495. }
  496. $("#PanelCanvas_wh").html("["+T_PanelCanvas.T_width+"*"+T_PanelCanvas.T_height+"]")
  497. }
  498. }
  499. });
  500. }
  501. </script>
  502. <!--面板模式-->
  503. <div class="layer_mode_tab" >
  504. <span id="PanelCanvas_mode">自由模式</span>
  505. <span id="PanelCanvas_wh">[1233*3222]</span>
  506. </div>
  507. <!--页面 加载完成后执行-->
  508. <script>
  509. var OSS_Static = "{{.OSS_Static}}" // 全局 资源地址
  510. var USER_UUID = "{{.USER_UUID}}" // 全局 USER_UUID
  511. var T_viewid = "{{.T_viewid}}" // 全局 USER_UUID
  512. var PanelCanvas_lock = false; //区块锁定标识
  513. var PanelCanvas_mode = 0; //0 自由模式 1 瀑瀑模式
  514. // 页面 加载完成后执行
  515. window.onload = function () {
  516. console.log("页面 加载完成后执行")
  517. f_keydown()
  518. f_PanelTool_List()
  519. f_Layer_Mould_List()
  520. $('img').on('dragstart', function(event) { event.preventDefault(); });
  521. // 资源
  522. f_ConfigImg_List()
  523. f_Device_List("")
  524. f_PaneView_Get()
  525. }
  526. // 切换试图
  527. function f_PaneView_V() {
  528. ToUrl = decodeURIComponent("{{.ToUrl}}")
  529. console.log("跳转:",ToUrl)
  530. window.location.href=ToUrl
  531. }
  532. keyCode_70 = {}
  533. // 按键 功能
  534. function f_keydown() {
  535. $(document).keydown(function(event){
  536. console.log("keyCode:"+event.keyCode)
  537. if(event.keyCode == 70){
  538. console.log("keyCode_70:",keyCode_70)
  539. keyCode_70()
  540. return false
  541. }
  542. //
  543. // if (event.ctrlKey && event.keyCode == 70) {
  544. // alert("‘Ctrl+Enter’");
  545. // };
  546. // switch (event.keyCode) {
  547. //
  548. // }
  549. return true
  550. });
  551. }
  552. </script>
  553. <!--移动面板-->
  554. <script>
  555. //创建拖拽方法
  556. PanelCanvas_move = true
  557. $("#PanelCanvas").mousedown(function(e){
  558. if(!PanelCanvas_move){return;}
  559. var canvas = $(this);
  560. var pos = $(this).position();
  561. this.posix = {'x': e.pageX - pos.left, 'y': e.pageY - pos.top};
  562. $.extend(document, {'move': true, 'move_target': this, 'call_down' : function(e, posix){
  563. canvas.css({
  564. 'cursor': 'move',
  565. 'top': e.pageY - posix.y,
  566. 'left': e.pageX - posix.x
  567. });
  568. }, 'call_up' : function(){
  569. canvas.css('cursor', 'default');
  570. }});
  571. })
  572. function f_PanelCanvas_onmouseover() {
  573. // console.log("进入")
  574. PanelCanvas_move = false
  575. }
  576. function f_PanelCanvas_onmouseout() {
  577. // console.log("出去")
  578. PanelCanvas_move = true
  579. }
  580. </script>
  581. <!--数据缓存-->
  582. <script>
  583. var Public_Value_map = new Map();
  584. //读取 同步缓存数据
  585. function f_Public_Value_get(tab) {
  586. if(Public_Value_map.has(tab)){ //判断映射是否存在
  587. return {V:Public_Value_map.get(tab),is:true}
  588. }
  589. return {V:0,is:false}
  590. }
  591. //设置 同步缓存数据
  592. function f_Public_Value_set(tab,value) {
  593. Public_Value_map.set(tab,value); //添加设置映射
  594. }
  595. </script>
  596. <!--画板入口-->
  597. <script src="{{.OSS_Static}}/panel/PanelCanvas.js"></script>
  598. <script>
  599. // "#canvas"
  600. //
  601. // V_PanelCanvas1 =
  602. // V_PanelCanvas2 = f_canvas2(500,500,"{{.OSS_Static}}/images/demo_picture.jpg")
  603. var V_PanelCanvas_Map = new Map();
  604. //
  605. // V_PanelCanvas = new f_canvas2(500, 500, "{{.OSS_Static}}/images/demo_picture.jpg", 1, "{\"sn_sn\":\"866222050911984\",\"tab_tab\":\"v_do_2\",\"text1_text\":\"替换的文本\"}")
  606. // V_PanelCanvas_Map.set(V_PanelCanvas.PanelCanvas_id,V_PanelCanvas)
  607. // //测试加载
  608. // var loadData = [
  609. //
  610. // {text: "A0000001v_xx_7", rotate: 0, color: "rgb(255, 165, 0)", height: 70, width: 77, pageX: 89, pageY: 39}];
  611. // $.each(loadData, function (i, row) {
  612. // V_PanelCanvas.F_CreateBox(row);
  613. // });
  614. //
  615. //
  616. // V_PanelCanvas = new f_canvas2(500, 500, "{{.OSS_Static}}/images/demo_picture.jpg", 1, "{\"sn_sn\":\"866222050911984\"}")
  617. // V_PanelCanvas_Map.set(V_PanelCanvas.PanelCanvas_id,V_PanelCanvas)
  618. // var loadData = [
  619. // {text: "A0000001v_xx_1", rotate: 1, color: "rgb(255, 255, 0)", height: 70, width: 77, pageX: 29, pageY: 64}
  620. // ];
  621. // $.each(loadData, function (i, row) {
  622. // V_PanelCanvas.F_CreateBox(row);
  623. // });
  624. // var V_PanelCanvas1 = new Function(f_canvas(500,500,"{{.OSS_Static}}/images/demo_picture.jpg"))
  625. // var V_PanelCanvas2 = new Function(f_canvas(500,500,"{{.OSS_Static}}/images/demo_picture.jpg"))
  626. Height = $(window).height();
  627. $("#PanelTool_Device_List").css("height",(Height-125)+"px")
  628. function f_PaneView_Get() {
  629. $.ajax({
  630. type: 'POST',
  631. url: '../../Panel/PaneView_Get',//发送请求
  632. data: {
  633. T_viewid: "{{.T_viewid}}",
  634. },
  635. success: function (result) {
  636. console.log(result)
  637. if (result.Code == 200) {
  638. T_PanelCanvas = result.Data
  639. PanelCanvas_mode = T_PanelCanvas.T_mode
  640. f_PanelCanvas_mode_0(result)
  641. switch (PanelCanvas_mode) {
  642. case 0:
  643. $("#PanelCanvas_mode").html("自由模式")
  644. break
  645. case 1:
  646. $("#PanelCanvas_mode").html("瀑瀑模式")
  647. break
  648. case 2:
  649. $("#PanelCanvas_mode").html("满屏模式")
  650. break
  651. }
  652. $("#PanelCanvas_wh").html("["+T_PanelCanvas.T_width+"*"+T_PanelCanvas.T_height+"]")
  653. } else {
  654. layer.msg('视图获取错误!');
  655. setTimeout(function(){
  656. //要执行的代码
  657. f_PaneView_Get()
  658. },2000);
  659. }
  660. }
  661. });
  662. }
  663. // 自由模式
  664. function f_PanelCanvas_mode_0(result) {
  665. T_PanelCanvas = result.Data
  666. // CSS 样式
  667. $('#PanelCanvas').css({
  668. width: T_PanelCanvas.T_width + "px",
  669. height: T_PanelCanvas.T_height + "px"
  670. });
  671. // CSS 自定义样式
  672. f_Up_css(T_PanelCanvas.T_css,"PanelCanvas")
  673. // 加载 组件
  674. if(result.Data.T_text.length < 10 ){
  675. return;
  676. }
  677. PaneView_json = JSON.parse(result.Data.T_text)
  678. for(var i = 0;i < PaneView_json.length;i++){
  679. Layer_Mould_json = PaneView_json[i]
  680. console.log("创建面板 PaneView_json",Layer_Mould_json)
  681. V_PanelCanvas = new f_canvas2(Layer_Mould_json.PanelCanvas_top,Layer_Mould_json.PanelCanvas_left,Layer_Mould_json.PanelCanvas_width, Layer_Mould_json.PanelCanvas_height, Layer_Mould_json.PanelCanvas_z, JSON.stringify(Layer_Mould_json.PanelCanvas_map), Layer_Mould_json.PanelCanvas_css)
  682. V_PanelCanvas_Map.set(V_PanelCanvas.PanelCanvas_id,V_PanelCanvas)
  683. for(var row_i = 0; row_i < Layer_Mould_json.Data_list.length; row_i++){
  684. // rowjson = Layer_Mould_json.Data_list[i]
  685. console.log("row json+ ",Layer_Mould_json.Data_list[row_i])
  686. V_PanelCanvas.F_CreateBox(Layer_Mould_json.Data_list[row_i]);
  687. }
  688. }
  689. }
  690. // 瀑瀑模式
  691. function f_PanelCanvas_mode_1(result){
  692. T_PanelCanvas = result.Data
  693. // CSS 样式
  694. $('#PanelCanvas').css({
  695. width: '100%',
  696. height: '100%',
  697. overflowX: "hidden",
  698. overflowY: "auto",
  699. });
  700. // CSS 自定义样式
  701. f_Up_css(T_PanelCanvas.T_css,"PanelCanvas")
  702. // 加载 组件
  703. if(result.Data.T_text.length < 10 ){
  704. return;
  705. }
  706. PaneView_json = JSON.parse(result.Data.T_text)
  707. for(var i = 0;i < PaneView_json.length;i++){
  708. Layer_Mould_json = PaneView_json[i]
  709. console.log("创建面板 PaneView_json",Layer_Mould_json)
  710. V_PanelCanvas = new f_canvas2(Layer_Mould_json.PanelCanvas_top,Layer_Mould_json.PanelCanvas_left,Layer_Mould_json.PanelCanvas_width, Layer_Mould_json.PanelCanvas_height, Layer_Mould_json.PanelCanvas_z, JSON.stringify(Layer_Mould_json.PanelCanvas_map), Layer_Mould_json.PanelCanvas_css)
  711. V_PanelCanvas_Map.set(V_PanelCanvas.PanelCanvas_id,V_PanelCanvas)
  712. for(var row_i = 0; row_i < Layer_Mould_json.Data_list.length; row_i++){
  713. // rowjson = Layer_Mould_json.Data_list[i]
  714. console.log("row json+ ",Layer_Mould_json.Data_list[row_i])
  715. V_PanelCanvas.F_CreateBox(Layer_Mould_json.Data_list[row_i]);
  716. }
  717. }
  718. }
  719. function f_PaneView_Save(T_text) {
  720. $.ajax({
  721. type: 'POST',
  722. url: '../../Panel/PaneView_Post',//发送请求
  723. data: {
  724. T_viewid: "{{.T_viewid}}",
  725. T_text: T_text,
  726. T_mode: T_PanelCanvas.T_mode,
  727. T_width: T_PanelCanvas.T_width,
  728. T_height: T_PanelCanvas.T_height,
  729. T_css: T_PanelCanvas.T_css,
  730. T_data: T_PanelCanvas.T_data,
  731. },
  732. success: function (result) {
  733. console.log(result)
  734. if (result.Code == 200) {
  735. layer.msg('保存成功!');
  736. } else {
  737. layer.msg('保存失败!');
  738. }
  739. }
  740. });
  741. }
  742. </script>
  743. <!--发布订阅模式-->
  744. <script>
  745. // 控制中心
  746. var pubSub = {
  747. list: {},
  748. // 订阅
  749. subscribe: function(key, fn) {
  750. console.log("加入:",key)
  751. Public_V = f_Public_Value_get(key)
  752. if (Public_V.is){
  753. this.publish(key,Public_V.V)
  754. }
  755. if (!this.list[key]) this.list[key] = [];
  756. this.list[key].push(fn);
  757. key_list = key.split("/")
  758. if(key_list[0].length > 3){
  759. NewSubscribe(key_list[0]) // 订阅SN
  760. }
  761. },
  762. //取消订阅
  763. unsubscribe: function(key, fn) {
  764. let fnList = this.list[key];
  765. if (!fnList) return false;
  766. if (!fn) { // 不传入指定的方法,清空所用 key 下的订阅
  767. fnList && (fnList.length = 0);
  768. } else {
  769. fnList.forEach((item, index) => {
  770. item === fn && fnList.splice(index, 1);
  771. });
  772. }
  773. },
  774. // 发布
  775. publish: function(key, ...args) {
  776. if (this.list[key]){
  777. for (let fn of this.list[key]) fn.call(this, ...args);
  778. }
  779. }
  780. }
  781. function f_Data_Read(T_sn) {
  782. T_sn_list = T_sn.split("-")
  783. $.ajax({
  784. type: 'POST',
  785. url: '../../Data/Device_Sensor',//发送请求
  786. data: {
  787. T_sn: T_sn_list[0],
  788. T_id: T_sn_list[1],
  789. },
  790. success: function (result) {
  791. console.log(result)
  792. if (result.Code == 200) {
  793. for (const [key, value] of Object.entries(result.Data)) {
  794. console.log(key,value);
  795. pubSub.publish(T_sn+"/"+key, value);
  796. f_Public_Value_set(T_sn+"/"+key, value)
  797. }
  798. }
  799. }
  800. });
  801. }
  802. </script>
  803. <!--websocket-->
  804. <script src="{{.OSS_Static}}/js/jquery.cookie.min.js"></script>
  805. <script>
  806. var websocket = null;
  807. //判断当前浏览器是否支持WebSocket
  808. run_WebSocket()
  809. function run_WebSocket() {
  810. console.log("run_WebSocket");
  811. if ('WebSocket' in window) {
  812. url = window.location.host
  813. if (url.indexOf("baozhida") != -1) {
  814. websocket = new WebSocket("wss://" + window.location.host + "/wsPanel/join?User_tokey=" + $.cookie('User_tokey'));
  815. } else {
  816. websocket = new WebSocket("ws://" + window.location.host + "/wsPanel/join?User_tokey=" + $.cookie('User_tokey'));
  817. }
  818. } else {
  819. alert('Dont support websocket')
  820. }
  821. }
  822. //连接成功建立的回调方法
  823. websocket.onopen = function () {
  824. console.log("websocket open");
  825. // get_DeviceCh_List(0)
  826. setTimeout(function(){
  827. SubscribeSend()
  828. },2000);
  829. // send("{\"Sn\":\"" + getQueryString("Sn") + "\"}")
  830. };
  831. //接收到消息的回调方法
  832. websocket.onmessage = function (event) {
  833. // console.log("websocket:",event.data)
  834. var obj = JSON.parse(event.data);
  835. console.log("websocket:",obj)
  836. if(obj.Code == 200){
  837. return
  838. }
  839. sn_id = obj.T_sn+"-"+obj.T_id
  840. for (const [key, value] of Object.entries(obj)) {
  841. // console.log(key,value);
  842. pubSub.publish(sn_id+"/"+key, value);
  843. f_Public_Value_set(sn_id+"/"+key, value)
  844. }
  845. // pubSub.publish(sn_id+'/'+obj.tab, obj.value);
  846. // // op:类型u8, //操作 0-主动上传 1-读 2- 写 3-成功 4-失败
  847. // switch (obj.op) {
  848. // case 3:
  849. // Del_Mid(obj.mid)
  850. // break;
  851. // case 4:
  852. // Err_Mid(obj.mid)
  853. // break;
  854. // }
  855. // console.log(obj.sn,"进入。。 Device_Sn = ",obj.sn)
  856. // Pu_DeviceCh_List_g(obj.sn,obj.tab,obj.value)
  857. //
  858. // if (obj.type == 0) {
  859. // // console.log("data.length:",obj.sensor.length)
  860. //
  861. // Pu_DeviceCh_List_g(obj.sn, obj.sensor)
  862. //
  863. // if (obj.type == 0) {
  864. // $("#T_time").html("刷新时间:" + dateChangeFormat_x('YYYY-mm-dd HH:MM:SS', obj.sensor[0].UT) + " 上传刷新间隔:" + Math.abs(timestamp_V - obj.sensor[0].UT).toFixed(0) + "s")
  865. //
  866. // // console.log(timestamp_V, obj.sensor[0].UT, " 刷新间隔:" + (timestamp_V - obj.sensor[0].UT) + "s")
  867. // timestamp_V = obj.sensor[0].UT
  868. //
  869. // }
  870. //
  871. //
  872. // }
  873. };
  874. //连接关闭的回调方法
  875. websocket.onclose = function () {
  876. console.log("close");
  877. // setTimeout(function () {
  878. // //要执行的代码
  879. // run_WebSocket();
  880. // }, 2000);
  881. };
  882. //连接发生错误的回调方法
  883. websocket.onerror = function () {
  884. console.log("error");
  885. setTimeout(function () {
  886. //要执行的代码
  887. run_WebSocket();
  888. }, 2000);
  889. };
  890. //监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常。
  891. window.onbeforeunload = function () {
  892. websocket.close();
  893. console.log("窗口关闭事件");
  894. };
  895. //关闭连接
  896. function closeWebSocket() {
  897. websocket.close();
  898. console.log("onbeforeunload");
  899. window.clearInterval(intervalId);
  900. }
  901. //发送消息
  902. function send(message) {
  903. websocket.send(message);
  904. }
  905. var SbscribeMap = new Set();
  906. // 订阅 SN
  907. function Subscribe(SN) {
  908. if(!SbscribeMap.has(SN)){
  909. console.log("加入订阅:",SN)
  910. SbscribeMap.add(SN)
  911. }
  912. //
  913. }
  914. // 订阅 SN
  915. function NewSubscribe(SN) {
  916. if(!SbscribeMap.has(SN)){
  917. console.log("加入订阅:",SN)
  918. SbscribeMap.add(SN)
  919. send("{ \"Sn\":\""+SN+"\"}")
  920. f_Data_Read(SN)
  921. }
  922. //
  923. }
  924. // 订阅 SN
  925. function SubscribeSend() {
  926. for (var SN of SbscribeMap) { // 遍历Set
  927. send("{ \"Sn\":\""+SN+"\"}")
  928. }
  929. console.log("开始订阅:",SbscribeMap)
  930. }
  931. </script>
  932. <!--/// ----------------------------- 编辑 -------------------------------------- -->
  933. <!--鼠标拖拽-->
  934. <script>
  935. var isDown = false //鼠标释放
  936. var V_PanelTool_id = 0 //工具 ID
  937. var V_PanelTool_class = 0 // 1 基础 2 层模型
  938. var V_PanelTool_class = 0 // 1 基础 2 层模型
  939. function v_ondragleave(class_id,id) {
  940. console.log("离开工具栏")
  941. console.log(id)
  942. V_PanelTool_id = id
  943. V_PanelTool_class = class_id
  944. }
  945. // $( ".divulli" ).draggable({ cursor: "move", cursorAt: { top: 56, left: 56 } });
  946. // 进入
  947. function f_ondragenter(id) {
  948. console.log("进入",id)
  949. // document.getElementById("example").style.cursor = "move"; canvas.css('cursor', 'default');
  950. $(document).css('cursor', 'move');
  951. }
  952. //另一对象
  953. function f_ondragover(id) {
  954. console.log("另一对象",id)
  955. isDown = false
  956. $(document).css('cursor', 'move');
  957. }
  958. //离开
  959. function f_ondragleave(id) {
  960. console.log("离开",id)
  961. isDown = true
  962. setTimeout(function(){
  963. //要执行的代码
  964. console.log(isDown)
  965. if(isDown){
  966. console.log("释放层 id",id)
  967. switch (V_PanelTool_class) {
  968. case 1:
  969. console.log("释放 基础组件",PanelTool_List[V_PanelTool_id].T_text)
  970. V_PanelCanvas_Map.get(id).F_CreateBox({
  971. text: PanelTool_List[V_PanelTool_id].T_text,
  972. rotate: 0,
  973. color: PanelTool_List[V_PanelTool_id].T_color,
  974. height: PanelTool_List[V_PanelTool_id].T_height,
  975. width: PanelTool_List[V_PanelTool_id].T_width,
  976. pageX: 20, pageY: 20
  977. });
  978. break;
  979. case 2: // 弃用
  980. console.log("释放 层 模型",Layer_Mould_List[V_PanelTool_id])
  981. break;
  982. }
  983. }
  984. },200);
  985. }
  986. </script>
  987. <!--底层-->
  988. <script>
  989. T_PanelCanvas = {}
  990. //加载layer拓展
  991. layer.config({
  992. extend: 'extend/layer.ext.js'
  993. });
  994. //右键菜单参数
  995. context.init({
  996. fadeSpeed: 100,
  997. above: 'auto',
  998. preventDoubleContext: true,
  999. compress: false
  1000. });
  1001. context.attach('#PanelCanvas', [
  1002. {header: '面板模式'},
  1003. {
  1004. text: '自由模式', action: function (e) {
  1005. e.preventDefault();
  1006. T_PanelCanvas.T_mode = 0
  1007. $("#PanelCanvas_mode").html("自由模式")
  1008. }
  1009. },
  1010. {
  1011. text: '瀑瀑模式(一层)', action: function (e) {
  1012. e.preventDefault();
  1013. T_PanelCanvas.T_mode = 1
  1014. $("#PanelCanvas_mode").html("瀑瀑模式")
  1015. $("#open_layer_data_layer_textarea").val(T_PanelCanvas.T_data)
  1016. layer.open({
  1017. title: '瀑瀑数据来源',
  1018. type: 1,
  1019. area: ['577px','690px'],
  1020. fix: true, //不固定
  1021. maxmin: false,
  1022. content: $('#open_layer_data_layer'),
  1023. shadeClose: true,
  1024. anim: 1,
  1025. shade: 0.4,
  1026. isOutAnim: false,
  1027. scrollbar: false,
  1028. btn:["确定"],
  1029. yes:function (Index) {
  1030. T_PanelCanvas.T_data = $("#open_layer_data_layer_textarea").val()
  1031. layer.close(Index);
  1032. }
  1033. });
  1034. // var box = $('#PanelCanvas');
  1035. // box.css({
  1036. // width: '100%',
  1037. // height: '100%',
  1038. // overflowX: "hidden",
  1039. // overflowY: "auto",
  1040. // });
  1041. // T_PanelCanvas.T_width = 0;
  1042. // T_PanelCanvas.T_height = 0;
  1043. // PanelCanvas_mode = 1
  1044. }
  1045. },
  1046. {
  1047. text: '满屏模式', action: function (e) {
  1048. e.preventDefault();
  1049. T_PanelCanvas.T_mode = 2
  1050. $("#PanelCanvas_mode").html("满屏模式")
  1051. }
  1052. },
  1053. {header: '自定义尺寸'},
  1054. {
  1055. text: '1920x1080 (2K)', action: function (e) {
  1056. e.preventDefault();
  1057. var box = $('#PanelCanvas');
  1058. box.css({
  1059. width: 1920,
  1060. height: 1080
  1061. });
  1062. T_PanelCanvas.T_width = 1920;
  1063. T_PanelCanvas.T_height = 1080;
  1064. $("#PanelCanvas_wh").html("["+T_PanelCanvas.T_width+"*"+T_PanelCanvas.T_height+"]")
  1065. }
  1066. },
  1067. {
  1068. text: '3840x2160 (4K)', action: function (e) {
  1069. e.preventDefault();
  1070. var box = $('#PanelCanvas');
  1071. box.css({
  1072. width: 3840,
  1073. height: 2160
  1074. });
  1075. T_PanelCanvas.T_width = 3840;
  1076. T_PanelCanvas.T_height = 2160;
  1077. $("#PanelCanvas_wh").html("["+T_PanelCanvas.T_width+"*"+T_PanelCanvas.T_height+"]")
  1078. }
  1079. },
  1080. {
  1081. text: '自定义尺寸', action: function (e) {
  1082. e.preventDefault();
  1083. layer.prompt({
  1084. title: '请输入区域尺寸(宽,高),最小值:30 \n4K=3840*2160\n2K= 2560*1440',
  1085. formType: 0,
  1086. value: Math.round(T_PanelCanvas.T_width) + "," + Math.round(T_PanelCanvas.T_height)
  1087. }, function (value, index, elem) {
  1088. var reg = /^[0-9]+,[0-9]+$/;
  1089. if (!reg.test(value)) {
  1090. alert('输入格式不正确,请输入整数 如:100,100');
  1091. return;
  1092. }
  1093. var size = value.split(',');
  1094. var box = $('#PanelCanvas');
  1095. box.css({
  1096. width: size[0] < 30 ? 30 : size[0],
  1097. height: size[1] < 30 ? 30 : size[1]
  1098. });
  1099. T_PanelCanvas.T_width = size[0];
  1100. T_PanelCanvas.T_height = size[1];
  1101. $("#PanelCanvas_wh").html("["+T_PanelCanvas.T_width+"*"+T_PanelCanvas.T_height+"]")
  1102. layer.close(index);
  1103. });
  1104. }
  1105. },
  1106. {divider: true},
  1107. {header: '更改样式'},
  1108. {
  1109. text: 'CSS样式', action: function (e) {
  1110. e.preventDefault();
  1111. $("#open_layer_css_layer_textarea").val(T_PanelCanvas.T_css)
  1112. f_attribute_css_inti() // 初始化 CSS 自定义样式
  1113. layer.open({
  1114. title: '自定义 CSS样式',
  1115. type: 1,
  1116. area: ['577px','690px'],
  1117. fix: true, //不固定
  1118. maxmin: false,
  1119. content: $('#open_layer_css_layer'),
  1120. shadeClose: true,
  1121. anim: 1,
  1122. shade: 0.4,
  1123. isOutAnim: false,
  1124. scrollbar: false,
  1125. btn:["确定"],
  1126. yes:function (Index) {
  1127. T_PanelCanvas.T_css = $("#open_layer_css_layer_textarea").val()
  1128. f_Up_css(T_PanelCanvas.T_css,"PanelCanvas")
  1129. layer.close(Index);
  1130. }
  1131. });
  1132. }
  1133. },
  1134. ]);
  1135. </script>
  1136. <!--保存为面板-->
  1137. <script>
  1138. var Save_layer_obj = {}
  1139. function f_Save_layer(obj) {
  1140. Save_layer_obj = obj
  1141. Attribute_layer_id = layer.open({
  1142. title: '保存为面板',
  1143. type: 1,
  1144. area: ['277px','290px'],
  1145. fix: false, //不固定
  1146. maxmin: false,
  1147. content: $('#open_layer_save_layer'),
  1148. shadeClose: true,
  1149. anim: 1,
  1150. shade: 0.4,
  1151. isOutAnim: false,
  1152. scrollbar: false,
  1153. });
  1154. }
  1155. function f_Save_layer_choice() {
  1156. box_json = Save_layer_obj.F_get_box_json()
  1157. layer_name = $("#open_layer_save_layer_name").val()
  1158. layer_img = $("#open_layer_save_layer_img").val()
  1159. console.log("F_get_box_json:",box_json)
  1160. console.log("open_layer_save_layer_name:",layer_name)
  1161. console.log("open_layer_save_layer_img:",layer_img)
  1162. f_Save_Layer(layer_name,layer_img,JSON.stringify(box_json))
  1163. layer.close(Attribute_layer_id);
  1164. }
  1165. function f_Save_Layer(name,img,text) {
  1166. $.ajax({
  1167. type: 'POST',
  1168. url: '../../Panel/Layer_Mould_Save',//发送请求
  1169. data: {
  1170. layer_name: name,
  1171. layer_img: img,
  1172. layer_json: text,
  1173. },
  1174. success: function (result) {
  1175. console.log(result)
  1176. if (result.Code == 200) {
  1177. layer.msg('上传成功!');
  1178. }
  1179. }
  1180. });
  1181. }
  1182. // 保存工程
  1183. function f_Save() {
  1184. o_PanelCanvas_List = []
  1185. for(let [key,v] of V_PanelCanvas_Map) {
  1186. console.log("V_PanelCanvas_Map key:", key);
  1187. box_json = v.F_get_box_json()
  1188. o_PanelCanvas_List.push(box_json)
  1189. }
  1190. //
  1191. console.log("o_PanelCanvas_List:",o_PanelCanvas_List)
  1192. // console.log(JSON.stringify(o_PanelCanvas_List))
  1193. f_PaneView_Save(JSON.stringify(o_PanelCanvas_List))
  1194. }
  1195. </script>
  1196. <!--// 左侧 工具-->
  1197. <script>
  1198. var menuRight = document.getElementById('menuRight')
  1199. var body = document.body;
  1200. classie.toggle(body, 'cbp-spmenu-push-toright');
  1201. classie.toggle(body, 'cbp-spmenu-push-toright_bady');
  1202. classie.toggle(menuRight, 'cbp-spmenu-open');
  1203. console.log("menuRight.height",menuRight.clientHeight)
  1204. $(".help-left").css("max-height",menuRight.clientHeight - 64 + "px")
  1205. // 基础工具
  1206. var PanelTool_List = []
  1207. function f_PanelTool_List() {
  1208. $.ajax({
  1209. type: 'POST',
  1210. url: '../../Panel/PanelTool_List',//发送请求
  1211. data: {
  1212. page: 1,
  1213. page_z: 990,
  1214. },
  1215. success: function (result) {
  1216. console.log(result)
  1217. if (result.Code == 200) {
  1218. PanelTool_List = result.Data.List
  1219. Show_PanelTool_List(PanelTool_List) // 列表
  1220. // if(result.Data.Page_size > result.Data.Page ){
  1221. // f_PanelTool_List(result.Data.Page+1)
  1222. // }
  1223. } else {
  1224. }
  1225. }
  1226. });
  1227. }
  1228. function Show_PanelTool_List(data) {
  1229. $('#PanelTool_1').append("" +
  1230. "<div class=\"divulli\" draggable=\"true\" onmousedown='f_Add_NewLayer()' >\n" +
  1231. " <img src=\"https://standardoss.baozhida.cn/UpImage/57f8984e-7327-49d3-8bc9-00719f02d61e.png\">\n" +
  1232. " <div>添加层</div>\n" +
  1233. "</div>")
  1234. for (let i = 0; i < data.length; i++) {
  1235. switch (data[i].T_class) {
  1236. case 1:
  1237. $('#PanelTool_1').append("" +
  1238. "<div class=\"divulli\" draggable=\"true\" onmousedown='v_ondragleave(1,"+ i +")' >\n" +
  1239. " <img src=\""+data[i].T_img+"\">\n" +
  1240. " <div>"+data[i].T_name+"</div>\n" +
  1241. "</div>")
  1242. break
  1243. case 2:
  1244. $('#PanelTool_2').append("" +
  1245. "<div class=\"divulli\" draggable=\"true\" onmousedown='v_ondragleave(1,"+ i +")' >\n" +
  1246. " <img src=\""+data[i].T_img+"\">\n" +
  1247. " <div>"+data[i].T_name+"</div>\n" +
  1248. "</div>")
  1249. break
  1250. case 3:
  1251. $('#PanelTool_3').append("" +
  1252. "<div class=\"divulli\" draggable=\"true\" onmousedown='v_ondragleave(1,"+ i +")' >\n" +
  1253. " <img src=\""+data[i].T_img+"\">\n" +
  1254. " <div>"+data[i].T_name+"</div>\n" +
  1255. "</div>")
  1256. break
  1257. }
  1258. // Pu_DeviceCh_View(data[i].T_sn+data[i].T_tab+"_"+data[i].T_ch,data[i].T_value)
  1259. }
  1260. }
  1261. ///////////------------ 模板
  1262. Layer_Mould_List = []
  1263. function f_Layer_Mould_List() {
  1264. $.ajax({
  1265. type: 'POST',
  1266. url: '../../Panel/Layer_Mould_List',//发送请求
  1267. data: {
  1268. page: 1,
  1269. page_z: 990,
  1270. },
  1271. success: function (result) {
  1272. console.log(result)
  1273. if (result.Code == 200) {
  1274. Layer_Mould_List = result.Data.List
  1275. Show_Layer_Mould_List(Layer_Mould_List) // 列表
  1276. // if(result.Data.Page_size > result.Data.Page ){
  1277. // f_PanelTool_List(result.Data.Page+1)
  1278. // }
  1279. } else {
  1280. }
  1281. }
  1282. });
  1283. }
  1284. function Show_Layer_Mould_List(data) {
  1285. for (let i = 0; i < data.length; i++) {
  1286. switch (data[i].T_class) {
  1287. case 1:
  1288. $('#LayerMould_1').append("" +
  1289. "<div class=\"divulli\" draggable=\"false\" ondblclick='f_Add_Layer_Mould("+ i +")' >\n" +
  1290. " <img src=\""+data[i].T_img+"\">\n" +
  1291. " <div>"+data[i].T_name+"</div>\n" +
  1292. "</div>")
  1293. break
  1294. case 2:
  1295. $('#LayerMould_2').append("" +
  1296. "<div class=\"divulli\" draggable=\"false\" ondblclick='f_Add_Layer_Mould("+ i +")' >\n" +
  1297. " <img src=\""+data[i].T_img+"\">\n" +
  1298. " <div>"+data[i].T_name+"</div>\n" +
  1299. "</div>")
  1300. break
  1301. }
  1302. // Pu_DeviceCh_View(data[i].T_sn+data[i].T_tab+"_"+data[i].T_ch,data[i].T_value)
  1303. }
  1304. }
  1305. // - 添加面板
  1306. function f_Add_Layer_Mould(i_id) {
  1307. console.log("V_PanelCanvas_Map:",V_PanelCanvas_Map.size)
  1308. if(PanelCanvas_mode == 1 && V_PanelCanvas_Map.size != 0){
  1309. layer.msg('只允许一个层!');
  1310. return
  1311. }
  1312. Layer_Mould_json = JSON.parse(Layer_Mould_List[i_id].T_text)
  1313. console.log("释放 层 模型",Layer_Mould_json)
  1314. V_PanelCanvas = new f_canvas2(0,0,Layer_Mould_json.PanelCanvas_width, Layer_Mould_json.PanelCanvas_height, Layer_Mould_json.PanelCanvas_z, JSON.stringify(Layer_Mould_json.PanelCanvas_map),Layer_Mould_json.PanelCanvas_css)
  1315. V_PanelCanvas_Map.set(V_PanelCanvas.PanelCanvas_id,V_PanelCanvas)
  1316. //测试加载
  1317. // var loadData = [
  1318. // {text: "A0000001v_xx_7", rotate: 0, color: "rgb(255, 165, 0)", height: 70, width: 77, pageX: 89, pageY: 39}
  1319. // ];
  1320. for(var i = 0; i < Layer_Mould_json.Data_list.length; i++){
  1321. // rowjson = Layer_Mould_json.Data_list[i]
  1322. console.log("rowjson",Layer_Mould_json.Data_list[i])
  1323. V_PanelCanvas.F_CreateBox(Layer_Mould_json.Data_list[i]);
  1324. }
  1325. // $.each(, function (i, row) {
  1326. //
  1327. // //
  1328. // });
  1329. }
  1330. // - 添加面板
  1331. function f_Add_NewLayer() {
  1332. V_PanelCanvas = new f_canvas2(0,0,600, 600, 0, "{ \"sn_sn\": \"\" }","")
  1333. V_PanelCanvas_Map.set(V_PanelCanvas.PanelCanvas_id,V_PanelCanvas)
  1334. }
  1335. ///////////------------
  1336. //获得元素
  1337. var lis = document.querySelectorAll('#tab-header span');
  1338. var content = document.querySelectorAll('#tab-content .dom');
  1339. // 遍历1级菜单里的li元素
  1340. for (var i = 0; i < lis.length; i++) {
  1341. // onmouseenter、onmousemove与mousemove的区别:
  1342. // 其支持冒泡,所以当鼠标移入或鼠标移入其子元素的时候都会触发相关事件
  1343. // 其不支持冒泡,所以当鼠标移入这个元素本身的时候会触发相关事件
  1344. // 不支持冒泡事件,当鼠标在元素上移动的时候会触发相关事件
  1345. lis[i].onclick = ( function (i) {
  1346. return function () {
  1347. for (var j = 0; j < lis.length; j++) {
  1348. content[j].style.display = 'none';
  1349. lis[j].style.color = '';
  1350. lis[j].style.border = '1px solid #e5e5e5';
  1351. }
  1352. content[i].style.display = 'block';
  1353. lis[i].style.color = '#69d1ff';
  1354. lis[i].style.border = '2px solid #69d1ff';
  1355. }
  1356. })(i)
  1357. }
  1358. lis[0].onclick()
  1359. </script>
  1360. <!--// 左侧 工具 - 设备 -->
  1361. <script>
  1362. // 更新列表
  1363. function f_PanelTool_Device_List() {
  1364. $('#PanelTool_Device_List').html("")
  1365. for (let i = 0; i < Device_List.length; i++) {
  1366. $('#PanelTool_Device_List').append("" +
  1367. "<div style='padding: 4px;margin: 5px;border:1px solid #ececec;' > " +
  1368. "<div>SN:"+Device_List[i].T_sn+"</div>"+
  1369. Device_List[i].T_name+"["+Device_List[i].T_id+"]" +
  1370. "</div>")
  1371. }
  1372. }
  1373. function open_menu(Id) {
  1374. layer.open({
  1375. title: "设备参数配置 ",
  1376. type: 2,
  1377. area: ['500px', '630px'],
  1378. fix: false, //不固定
  1379. maxmin: false,
  1380. content: "../../DeviceCh/DeviceChParameter_Id_Html?Id="+Id,
  1381. shadeClose:true,
  1382. anim: 1,
  1383. isOutAnim: false,
  1384. });
  1385. }
  1386. </script>
  1387. <!--文件上传-->
  1388. <script src="https://cdn.staticfile.org/qiniu-js/3.4.0/qiniu.min.js"></script>
  1389. <script>
  1390. var F_c=function(up_url) {}
  1391. // F_c = function(up_url) {
  1392. // if (H_img_id.length > 1) {
  1393. // $("#" + H_img_id).attr("src", up_url)
  1394. // }
  1395. // }
  1396. $("#UpLoadFile").change(function () {
  1397. let file = this.files[0];
  1398. console.log(file)
  1399. filesplit = file.type.split("/")
  1400. console.log("filesplit:",filesplit[filesplit.length-1])
  1401. $.ajax({
  1402. type: 'POST',
  1403. url: '../../Config/UpFileToken',//发送请求
  1404. data: {
  1405. T_suffix: filesplit[filesplit.length-1],
  1406. },
  1407. success: function (result) {
  1408. console.log(result)
  1409. if (result.Code == 200) {
  1410. f_upload(file, result.Data)
  1411. }
  1412. }
  1413. });
  1414. })
  1415. function f_upload(file, token) {
  1416. // let file = this.files[0];
  1417. let config = {
  1418. useCdnDomain: true,
  1419. region: qiniu.region.z2,
  1420. debugLogLevel: 'INFO',
  1421. useCdnDomain: true, // 表示是否使用 cdn 加速域名
  1422. };
  1423. let putExtra = {
  1424. fname: "",
  1425. params: {},
  1426. mimeType: null
  1427. };
  1428. // 设置next,error,complete对应的操作,分别处理相应的进度信息,错误信息,以及完成后的操作
  1429. var error = function (err) {
  1430. console.log(err);
  1431. alert("上传出错")
  1432. };
  1433. var complete = function (res) {
  1434. console.log(res)
  1435. if (res.key) {
  1436. console.log("url:", res.key)
  1437. F_c(res.key)
  1438. // if (H_img_id.length > 1) {
  1439. // $("#" + H_img_id).attr("src", res.key)
  1440. // H_img_id = ""
  1441. // }
  1442. }
  1443. };
  1444. var next = function (response) {
  1445. console.log(response)
  1446. };
  1447. var subObject = {
  1448. next: next,
  1449. error: error,
  1450. complete: complete
  1451. };
  1452. let subscription;
  1453. // 调用sdk上传接口获得相应的observable,控制上传和暂停
  1454. let observable = qiniu.upload(file, "key", token, putExtra, config);
  1455. subscription = observable.subscribe(subObject);
  1456. }
  1457. </script>
  1458. <!-- 资源库 -->
  1459. <script>
  1460. var ConfigImg_List = []
  1461. var Device_List = []
  1462. var Device_List_map = new Map();
  1463. var ConfiglibImg_T_str = "";
  1464. var ConfiglibImg_page = 1;
  1465. function f_PaneView_Post(my) {
  1466. Attribute_my = my
  1467. $.ajax({
  1468. type: 'POST',
  1469. url: '../../Panel/PaneView_Post',//发送请求
  1470. data: {
  1471. T_text: "",
  1472. T_width: 1920,
  1473. T_height: 1080,
  1474. T_css: "",
  1475. },
  1476. success: function (result) {
  1477. console.log(result)
  1478. if (result.Code == 200) {
  1479. $(Attribute_my).val(result.Data)
  1480. } else {
  1481. layer.msg('新建面板失败!');
  1482. }
  1483. }
  1484. });
  1485. }
  1486. function f_ConfigImg_List() {
  1487. $.ajax({
  1488. type: 'POST',
  1489. url: '../../Config/ConfigImg_List',//发送请求
  1490. data: {
  1491. page: 1,
  1492. page_z: 9999,
  1493. },
  1494. success: function (result) {
  1495. console.log(result)
  1496. if (result.Code == 200) {
  1497. ConfigImg_List = result.Data.List
  1498. } else {
  1499. layer.msg('获取图片失败!');
  1500. }
  1501. }
  1502. });
  1503. }
  1504. var ConfiglibImg_List = []
  1505. var ConfiglibImg_page = 0;
  1506. var ConfiglibImg_T_str = ""
  1507. function f_ConfiglibImg_List_inti(T_str0) {
  1508. ConfiglibImg_List = []
  1509. ConfiglibImg_page = 0;
  1510. ConfiglibImg_T_str = T_str0
  1511. // 更新列表
  1512. $('#open_layer_Data_List').html("")
  1513. $('#open_layer_Data_List').append("<div style='width: 100px;height: 120px;float: left;margin: 6px;text-align: center;'> " +
  1514. "<img onclick='f_attribute_Configlibimg_UpLoadFile();keyCode_70 = {}' style='padding: 4px;margin: 5px;border:1px solid #ececec;' src=\"https://standardoss.baozhida.cn/UpImage/2ac296ef-6a6f-4bfe-a5dc-79f4a565962d.png\" width=\"70\" height=\"70\"> " +
  1515. "<span>上传图片</span>"+
  1516. "</div>")
  1517. return
  1518. }
  1519. function f_ConfiglibImg_List() {
  1520. ConfiglibImg_page += 1;
  1521. $.ajax({
  1522. type: 'POST',
  1523. url: '../../Config/ConfiglibImg_List',//发送请求
  1524. data: {
  1525. T_str0: ConfiglibImg_T_str,
  1526. page: ConfiglibImg_page,
  1527. page_z: 200,
  1528. },
  1529. success: function (result) {
  1530. console.log(result)
  1531. if (result.Code == 200) {
  1532. for (let i = 0; i < result.Data.List.length; i++) {
  1533. ConfiglibImg_List.push(result.Data.List[i])
  1534. $('#open_layer_Data_List').append("<div style='width: 100px;height: 120px;float: left;margin: 6px;text-align: center;'> " +
  1535. "<img onclick='f_attribute_Configlibimg_choice(" + (ConfiglibImg_List.length - 1) + ");keyCode_70 = {}' style='padding: 4px;margin: 5px;border:1px solid #ececec;' src=\"" + result.Data.List[i].T_img0 + "\" width=\"70\" height=\"70\"> " +
  1536. "<span>"+ result.Data.List[i].T_str0+"</span>"+
  1537. "</div>")
  1538. }
  1539. } else {
  1540. layer.msg('获取图片失败!');
  1541. }
  1542. }
  1543. });
  1544. }
  1545. function f_Device_List(T_name) {
  1546. $.ajax({
  1547. type: 'POST',
  1548. url: '../../../Data/Device_Sensor_List',//发送请求
  1549. data: {
  1550. // T_sn: T_sn,
  1551. T_name: T_name,
  1552. // T_class_id: parseInt(T_class_id),
  1553. page: 1,
  1554. page_z: 30,
  1555. },
  1556. success: function (result) {
  1557. console.log(result)
  1558. if (result.Code == 200) {
  1559. Device_List_r = result.Data.DeviceSensor_lite
  1560. for (let i = 0; i < Device_List_r.length; i++) {
  1561. Device_List_map.set(Device_List_r[i].T_sn,Device_List_r[i]);
  1562. Device_List.push(Device_List_r[i])
  1563. }
  1564. f_PanelTool_Device_List()
  1565. } else {
  1566. layer.msg('获取主设备失败!');
  1567. }
  1568. }
  1569. });
  1570. }
  1571. </script>
  1572. <!--图片组选择-->
  1573. <script>
  1574. var Attribute_my = {}
  1575. var Attribute_layer_id = 0
  1576. function f_attribute_imggroup(my) {
  1577. Attribute_my = my
  1578. Attribute_layer_id = layer.open({
  1579. title: '请选择 图标',
  1580. type: 1,
  1581. area: [($(window).width() * 0.9) + 'px', ($(window).height() - 50) + 'px'],
  1582. fix: false, //不固定
  1583. maxmin: false,
  1584. content: $('#open_layer_Data_List'),
  1585. shadeClose: true,
  1586. anim: 1,
  1587. shade: 0.4,
  1588. isOutAnim: false,
  1589. scrollbar: false,
  1590. });
  1591. // 更新列表
  1592. $('#open_layer_Data_List').html("")
  1593. for (let i = 0; i < ConfigImg_List.length; i++) {
  1594. $('#open_layer_Data_List').append("<img onclick='f_attribute_ConfigImg_choice(" + i + ")' style='padding: 4px;margin: 5px;border:1px solid #ececec;' src=\"" + ConfigImg_List[i].T_img1 + "\" width=\"70\" height=\"70\">")
  1595. }
  1596. }
  1597. function f_attribute_ConfigImg_choice(id) {
  1598. img_str = ConfigImg_List[id].T_img0 +"|"+ ConfigImg_List[id].T_img1+"|"+ ConfigImg_List[id].T_img2+"|"+ ConfigImg_List[id].T_img3+"|"+ ConfigImg_List[id].T_img4+"|"+ ConfigImg_List[id].T_img5
  1599. console.log($(Attribute_my))
  1600. $(Attribute_my).val(img_str)
  1601. //关闭当前frame
  1602. console.log(Attribute_layer_id)
  1603. layer.close(Attribute_layer_id);
  1604. }
  1605. </script>
  1606. <!--CSS 自定义样式-->
  1607. <script>
  1608. // 初始化 CSS 自定义样式
  1609. function f_attribute_css_inti() {
  1610. // $("#S_open_layer_css_layer_background_img").val("")
  1611. // $("#S_open_layer_css_layer_backgroundcolour_colour1").val("")
  1612. }
  1613. function f_attribute_libimg(my) {
  1614. Attribute_my = my
  1615. Attribute_layer_id = layer.open({
  1616. title: '请选择 图片(按 f 搜索关键字)',
  1617. type: 1,
  1618. area: [($(window).width() * 0.9) + 'px', ($(window).height() - 50) + 'px'],
  1619. fix: false, //不固定
  1620. maxmin: false,
  1621. content: $('#open_layer_Data_List'),
  1622. shadeClose: true,
  1623. anim: 1,
  1624. shade: 0.4,
  1625. isOutAnim: false,
  1626. scrollbar: false,
  1627. end:function () {
  1628. keyCode_70 = {}
  1629. }
  1630. });
  1631. console.log("Attribute_layer_id layer:",Attribute_layer_id)
  1632. //
  1633. //
  1634. // layer.open($.extend({
  1635. // btn: ["&#x786E;&#x5B9A;", "&#x53D6;&#x6D88;"],
  1636. // content: "e",
  1637. // skin: "layui-layer-prompt" + b("prompt"),
  1638. // success: function (a) {
  1639. // d = a.find(".layui-layer-input"), d.focus()
  1640. // },
  1641. // yes: function (b) {
  1642. // var e = d.val();
  1643. // "" === e ? d.focus() : 0 > (a.maxlength || 500) ? layer.tips("&#x6700;&#x591A;&#x8F93;&#x5165;" + (a.maxlength || 500) + "&#x4E2A;&#x5B57;&#x6570;", d, {tips: 1}) : c && c(e, b, d)
  1644. // }
  1645. // }, a))
  1646. //
  1647. keyCode_70 = function () {
  1648. AAAA = layer.prompt({
  1649. type:1,
  1650. title: '请输 搜索关键字',
  1651. formType: 0,
  1652. value: ""
  1653. }, function (value, index, elem) {
  1654. //
  1655. console.log(value)
  1656. console.log(index)
  1657. layer.close(index);
  1658. f_ConfiglibImg_List_inti(value)
  1659. f_ConfiglibImg_List()
  1660. });
  1661. console.log("搜索关键字 layer:",AAAA)
  1662. }
  1663. f_ConfiglibImg_List_inti("")
  1664. f_ConfiglibImg_List()
  1665. // 滚轮 触发
  1666. $(".layui-layer-content").scroll(function () {
  1667. nScrollHight = $(this)[0].scrollHeight;
  1668. nScrollTop = $(this)[0].scrollTop;
  1669. if(nScrollTop + $(".layui-layer-content").height() >= nScrollHight) {
  1670. //加载loadHotService();
  1671. console.log("n")
  1672. f_ConfiglibImg_List()
  1673. }
  1674. });
  1675. }
  1676. function f_attribute_Configlibimg_UpLoadFile() {
  1677. $('#UpLoadFile').click();
  1678. F_c = function(up_url) {
  1679. $(Attribute_my).val(up_url)
  1680. //关闭当前frame
  1681. layer.close(Attribute_layer_id);
  1682. }
  1683. }
  1684. function f_attribute_Configlibimg_choice(id) {
  1685. img_str = ConfiglibImg_List[id].T_img0
  1686. console.log($(Attribute_my))
  1687. $(Attribute_my).val(img_str)
  1688. //关闭当前frame
  1689. console.log(Attribute_layer_id)
  1690. layer.close(Attribute_layer_id);
  1691. }
  1692. </script>
  1693. <!--文字组选择-->
  1694. <script>
  1695. function f_attribute_Textgroup(my) {
  1696. Attribute_my = my
  1697. Attribute_layer_id = layer.open({
  1698. title: '请选择 图标',
  1699. type: 1,
  1700. area: [($(window).width() * 0.9) + 'px', ($(window).height() - 50) + 'px'],
  1701. fix: false, //不固定
  1702. maxmin: false,
  1703. content: $('#open_layer_Data_List'),
  1704. shadeClose: true,
  1705. anim: 1,
  1706. shade: 0.4,
  1707. isOutAnim: false,
  1708. scrollbar: false,
  1709. });
  1710. // 更新列表
  1711. $('#open_layer_Data_List').html("")
  1712. for (let i = 0; i < ConfigImg_List.length; i++) {
  1713. $('#open_layer_Data_List').append("<img onclick='f_attribute_ConfigText_choice(" + i + ")' style='padding: 4px;margin: 5px;border:1px solid #ececec;' src=\"" + ConfigImg_List[i].T_img1 + "\" width=\"70\" height=\"70\">")
  1714. }
  1715. }
  1716. function f_attribute_ConfigText_choice(id) {
  1717. img_str = ConfigImg_List[id].T_str0 +"|"+ ConfigImg_List[id].T_str1+"|"+ ConfigImg_List[id].T_str2+"|"+ ConfigImg_List[id].T_str3+"|"+ ConfigImg_List[id].T_str4+"|"+ ConfigImg_List[id].T_str5
  1718. console.log($(Attribute_my))
  1719. $(Attribute_my).val(img_str)
  1720. //关闭当前frame
  1721. console.log(Attribute_layer_id)
  1722. layer.close(Attribute_layer_id);
  1723. }
  1724. </script>
  1725. <!--主设备选择-->
  1726. <script>
  1727. f_attribute_Device_List_page = 1
  1728. f_attribute_Device_List_name = ""
  1729. function f_attribute_Device_List(page) {
  1730. f_attribute_Device_List_page = page
  1731. console.log("f_attribute_Device_List_name:",f_attribute_Device_List_name)
  1732. $.ajax({
  1733. type: 'POST',
  1734. url: '../../../Data/Device_Sensor_List',//发送请求
  1735. data: {
  1736. // T_sn: T_sn,
  1737. T_name: f_attribute_Device_List_name,
  1738. // T_class_id: parseInt(T_class_id),
  1739. page: f_attribute_Device_List_page,
  1740. page_z: 30,
  1741. },
  1742. success: function (result) {
  1743. console.log(result)
  1744. if (result.Code == 200) {
  1745. Device_List_r = result.Data.DeviceSensor_lite
  1746. for (let i = 0; i < Device_List_r.length; i++) {
  1747. $('#open_layer_Data_List').append("<div onclick=\"f_attribute__Device_choice(\'" + Device_List_r[i].T_sn + "\',\'" + Device_List_r[i].T_id + "\',\'\')\" style='padding: 4px;margin: 5px;border:1px solid #ececec;height: 40px' > " +
  1748. "<div>SN:"+Device_List_r[i].T_sn+"["+Device_List_r[i].T_id+"]" +"</div>"+
  1749. Device_List_r[i].T_name+
  1750. "</div>")
  1751. }
  1752. } else {
  1753. layer.msg('获取主设备失败!');
  1754. }
  1755. }
  1756. });
  1757. }
  1758. function f_attribute_Device(my,duo) {
  1759. Attribute_my = my
  1760. Attribute_layer_id = layer.open({
  1761. title: '请选择 设备',
  1762. type: 1,
  1763. area: ['385px', ($(window).height() - 150) + 'px'],
  1764. fix: false, //不固定
  1765. maxmin: false,
  1766. content: $('#open_layer_Data_List'),
  1767. shadeClose: true,
  1768. anim: 1,
  1769. shade: 0.4,
  1770. isOutAnim: false,
  1771. scrollbar: true
  1772. });
  1773. $(".layui-layer-content").scroll(function () {
  1774. var scrollTop = $(this).scrollTop();
  1775. var scrollHeight = $("#open_layer_Data_List").height();
  1776. var windowHeight = $(this).height();
  1777. // console.log("scrollTop:",scrollTop," scrollHeight:",scrollHeight," windowHeight:",windowHeight)
  1778. if (scrollTop + windowHeight > scrollHeight) {
  1779. f_attribute_Device_List_page += 1
  1780. f_attribute_Device_List(1)
  1781. // alert('滑动到底部了')
  1782. }
  1783. });
  1784. // $('#open_layer_Data_List').css("height",($(window).height() - 150) + 'px')
  1785. f_attribute_Device_list_init()
  1786. }
  1787. function f_attribute_Device_list_init() {
  1788. f_attribute_Device_List_name = $("#D_Name").val()
  1789. // 更新列表
  1790. $('#open_layer_Data_List').html(" " +
  1791. "<div style='user-select: auto;' class=\"layui-input-block\">\n" +
  1792. " <input id='D_Name' type=\"text\" name=\"title\" required placeholder=\"请输入 名称\" autocomplete=\"off\" class=\"layui-input\"> " +
  1793. " <button class=\"layui-btn\" onclick='f_attribute_Device_list_init()'>搜索</button> \n" +
  1794. "</div>")
  1795. f_attribute_Device_List(1)
  1796. }
  1797. function f_attribute__Device_choice(sn,id,duo) {
  1798. console.log($(Attribute_my))
  1799. if(duo.length > 0){
  1800. $(Attribute_my).val($(Attribute_my).val() + sn + "-" + id+ "" + duo )
  1801. }else {
  1802. $(Attribute_my).val(sn + "-" + id )
  1803. }
  1804. //关闭当前frame
  1805. console.log(Attribute_layer_id)
  1806. layer.close(Attribute_layer_id);
  1807. }
  1808. </script>
  1809. <!--主设备 通道 选择-->
  1810. <script>
  1811. function f_attribute_DeviceCh(my,value_map) {
  1812. // S_sn = $("#S_sn_sn").val()
  1813. // console.log("S_sn:",S_sn)
  1814. // if(S_sn == "[-{sn}-]"){
  1815. // console.log("value_map:",value_map)
  1816. // S_sn = value_map
  1817. // }
  1818. //
  1819. // if(S_sn == undefined){
  1820. // alert("主设备(SN)参数异常,如果是全局SN,请先配置 层 SN参数!")
  1821. // return
  1822. // }
  1823. //
  1824. // if(!Device_List_map.has(S_sn)){ //判断映射是否存在
  1825. // alert("没有找到 主设备(SN) "+S_sn)
  1826. // }
  1827. Attribute_my = my
  1828. // console.log("S_sn:",S_sn)
  1829. Attribute_layer_id = layer.open({
  1830. title: '请选择 设备',
  1831. type: 1,
  1832. area: ['315px', ($(window).height() - 150) + 'px'],
  1833. fix: false, //不固定
  1834. maxmin: false,
  1835. content: $('#open_layer_Data_List'),
  1836. shadeClose: true,
  1837. anim: 1,
  1838. shade: 0.4,
  1839. isOutAnim: false,
  1840. scrollbar: false,
  1841. });
  1842. // 更新列表
  1843. $('#open_layer_Data_List').html("")
  1844. $('#open_layer_Data_List').append("<div id='attribute_ProductValue_List' style='padding: 4px;margin: 5px;border:1px solid #ececec;' > </div>")
  1845. f_attribute_DeviceCh_ProductValue_List()
  1846. }
  1847. function f_attribute_DeviceCh_ProductValue_List() {
  1848. // $.ajax({
  1849. // type: 'POST',
  1850. // url: '../../DeviceCh/DeviceCh_List',//发送请求
  1851. // data: {
  1852. // T_sn: T_sn,
  1853. // page: 1,
  1854. // page_z: 9999,
  1855. // },
  1856. // success: function (result) {
  1857. // console.log(result)
  1858. // if (result.Code == 200) {
  1859. //
  1860. // } else {
  1861. // layer.msg('获取主设备失败!');
  1862. // }
  1863. // }
  1864. // });
  1865. T_tab_list = []
  1866. T_tab_list.push({
  1867. T_tab:"T_sn",
  1868. T_name:"设备SN"
  1869. })
  1870. T_tab_list.push({
  1871. T_tab:"T_id",
  1872. T_name:"传感器ID"
  1873. })
  1874. T_tab_list.push({
  1875. T_tab:"T_name",
  1876. T_name:"设备名称"
  1877. })
  1878. T_tab_list.push({
  1879. T_tab:"T_t",
  1880. T_name:"温度"
  1881. })
  1882. T_tab_list.push({
  1883. T_tab:"T_rh",
  1884. T_name:"湿度"
  1885. })
  1886. T_tab_list.push({
  1887. T_tab:"T_Tlower",
  1888. T_name:"最低温度"
  1889. })
  1890. T_tab_list.push({
  1891. T_tab:"T_Tupper",
  1892. T_name:"最高温度"
  1893. })
  1894. T_tab_list.push({
  1895. T_tab:"T_RHlower",
  1896. T_name:"最低湿度"
  1897. })
  1898. T_tab_list.push({
  1899. T_tab:"T_RHupper",
  1900. T_name:"最高湿度"
  1901. })
  1902. T_tab_list.push({
  1903. T_tab:"T_Site",
  1904. T_name:"经纬度"
  1905. })
  1906. T_tab_list.push({
  1907. T_tab:"T_Dattery",
  1908. T_name:"电量"
  1909. })
  1910. T_tab_list.push({
  1911. T_tab:"T_monitor",
  1912. T_name:"监控状态"
  1913. })
  1914. T_tab_list.push({
  1915. T_tab:"T_time",
  1916. T_name:"时间"
  1917. })
  1918. for (let i = 0; i < T_tab_list.length; i++) {
  1919. $('#attribute_ProductValue_List').append("<div style='padding: 4px;margin: 5px;border:1px solid #ececec;' > " +
  1920. "<span onclick='f_attribute_DeviceCh_Tab_choice(\"" + T_tab_list[i].T_tab + "\")' >"+T_tab_list[i].T_tab+" -> "+T_tab_list[i].T_name+"</span>"+
  1921. // "<span onclick='f_attribute_DeviceCh_Tab_choice(" + result.Data[i].T_tab+"_"+ch_i + ")' style='float: right;color: #ff0300' >"+">>属性 </span>"+
  1922. "</div>")
  1923. }
  1924. }
  1925. function f_attribute_DeviceCh_Tab_choice(tab) {
  1926. console.log($(Attribute_my))
  1927. $(Attribute_my).val(tab )
  1928. //关闭当前frame
  1929. console.log(Attribute_layer_id)
  1930. layer.close(Attribute_layer_id);
  1931. }
  1932. </script>
  1933. <!--颜色选择-->
  1934. <script src="{{.OSS_Static}}/panel/colorpicker.js"></script>
  1935. <script type="text/javascript">
  1936. // 编辑框
  1937. function f_attribute_color(my) {
  1938. Attribute_my = my
  1939. console.log("Attribute_my:",Attribute_my)
  1940. Colorpicker.create({
  1941. el: Attribute_my.id, //元素id
  1942. color: $(Attribute_my).val(), //默认颜色
  1943. change: function (elem, hex) {
  1944. console.log(hex)
  1945. //选中颜色发生改变时事件
  1946. // elem.style.backgroundColor = hex;
  1947. $(Attribute_my).val(hex)
  1948. $(Attribute_my).css("backgroundColor",hex)
  1949. }
  1950. })
  1951. }
  1952. // 组件背景
  1953. function f_assembly_bcolor(curNum) {
  1954. layer.open({
  1955. title:"调色板",
  1956. type: 1,
  1957. content: '<div id=\'f_assembly_bcolor\' style="width: 200px;height: 40px;background-color: '+curNum.css('background-color')+'" > </div>' //这里content是一个普通的String
  1958. });
  1959. Attribute_my = document.getElementById("f_assembly_bcolor")
  1960. console.log("Attribute_my:",Attribute_my)
  1961. Colorpicker.create({
  1962. el: Attribute_my.id, //元素id
  1963. color: curNum.css('background-color'), //默认颜色
  1964. change: function (elem, hex) {
  1965. console.log(hex)
  1966. //选中颜色发生改变时事件
  1967. elem.style.backgroundColor = hex;
  1968. // $(Attribute_my).val(hex)
  1969. curNum.css('background-color', hex);
  1970. }
  1971. })
  1972. }
  1973. </script>
  1974. <!--图片选择-->
  1975. <script type="text/javascript">
  1976. // 图片 回调函数
  1977. function f_attribute_img(my) {
  1978. $('#UpLoadFile').click();
  1979. F_c = function(up_url) {
  1980. $(my).val(up_url)
  1981. }
  1982. }
  1983. </script>
  1984. <!--远程执行-->
  1985. <script>
  1986. // var Data_Write_Map = new Map();
  1987. // // 执行 V_id 标识出发位置,用来 反馈执行结果
  1988. // function f_Data_Write(V_id,T_sn,T_tab,T_value) {
  1989. // $.ajax({
  1990. // type: 'POST',
  1991. // url: '../../Device/Data_Write',//发送请求
  1992. // async: false,
  1993. // data: {
  1994. // T_sn:T_sn,
  1995. // T_tab:T_tab,
  1996. // T_value:T_value,
  1997. // },
  1998. // success: function(result) {
  1999. // console.log(result)
  2000. // pubSub.publish(T_sn+'/'+T_tab, T_value);
  2001. // f_Public_Value_set(T_sn+'/'+T_tab, T_value) //同步缓存数据
  2002. //
  2003. // Data_Write_Map.set(result.Data,{V_id:V_id,Munm:1});
  2004. // }
  2005. // });
  2006. // }
  2007. // setInterval(function(){
  2008. // // 遍历
  2009. // $(".Mid").remove() // 清空
  2010. // for(let [Mid,v] of Data_Write_Map) {
  2011. // console.log("Mid:", Mid,v);
  2012. // Data_Write_Map.set(Mid,{V_id:v.V_id,Munm:v.Munm + 1});
  2013. // if(v.Munm > 3 && v.Munm < 20 && v.Munm % 2 == 0){
  2014. // $("body").append('<div class="Mid" style="user-select: none;position: absolute;left: '+$("#"+v.V_id).offset().left+'px;top: '+$("#"+v.V_id).offset().top+'px;z-index: 999999999999999;width: 20px;height: 20px;background-color:rgb(255, 0, 0);border-radius: 25px;"></div>')
  2015. // }
  2016. //
  2017. // if(v.Munm > 10){
  2018. // Del_Mid(Mid)
  2019. // }
  2020. // }
  2021. // },1000);
  2022. //
  2023. //
  2024. // function Del_Mid(Mid) {
  2025. // if(Data_Write_Map.has(Mid)){ //判断映射是否存在
  2026. // // console.log("delete:",Data_Write_Map.get(Data_Write_Map))
  2027. // Data_Write_Map.delete(Mid);
  2028. // }
  2029. // }
  2030. //
  2031. // function Err_Mid(Mid) {
  2032. // // if(Data_Write_Map.has(Mid)){ //判断映射是否存在
  2033. // // console.log(Data_Write_Map.get(Data_Write_Map))
  2034. // // }
  2035. // }
  2036. </script>
  2037. <script>
  2038. function BrowserType()
  2039. {
  2040. var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
  2041. var isOpera = userAgent.indexOf("Opera") > -1; //判断是否Opera浏览器
  2042. var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera; //判断是否IE浏览器
  2043. var isEdge = userAgent.indexOf("Windows NT 6.1; Trident/7.0;") > -1 && !isIE; //判断是否IE的Edge浏览器
  2044. var isFF = userAgent.indexOf("Firefox") > -1; //判断是否Firefox浏览器
  2045. var isSafari = userAgent.indexOf("Safari") > -1 && userAgent.indexOf("Chrome") == -1; //判断是否Safari浏览器
  2046. var isChrome = userAgent.indexOf("Chrome") > -1 && userAgent.indexOf("Safari") > -1; //判断Chrome浏览器
  2047. if (isIE)
  2048. {
  2049. var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
  2050. reIE.test(userAgent);
  2051. var fIEVersion = parseFloat(RegExp["$1"]);
  2052. return {name:"IE",num: fIEVersion};
  2053. }//isIE end
  2054. if (isFF) { return {name:"FF",num: "FF"};}
  2055. if (isOpera) { return {name:"Opera",num: "Opera"};}
  2056. if (isSafari) { return {name:"Safari",num: "Safari"};}
  2057. if (isChrome) { return {name:"Chrome",num: "Chrome"};}
  2058. if (isEdge) { return {name:"Edge",num: "Edge"};}
  2059. }
  2060. Browser = BrowserType();
  2061. </script>
  2062. </body>
  2063. </html>
  2064. <!-- 通讯协议标准
  2065. 头:sn+ch 如: A0000001v_xx_1
  2066. v_xx_1 : 值
  2067. v_xx_1-img : 对应图片
  2068. v_xx_1-color : 对应颜色
  2069. v_xx_1-bimg : 对应图片
  2070. v_xx_1-bcolor : 对应颜色
  2071. -->