PanelE.html 81 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493
  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" 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. keyCode_17 = false
  534. // 按键 功能
  535. function f_keydown() {
  536. $(document).keydown(function(event){
  537. console.log("keyCode keydown:"+event.keyCode)
  538. if(event.keyCode == 70){
  539. console.log("keyCode_70:",keyCode_70)
  540. keyCode_70()
  541. return false
  542. }
  543. if(event.keyCode == 17){
  544. keyCode_17 = true
  545. $("#PanelCanvas").css('cursor', 'move');
  546. return false
  547. }
  548. //
  549. // if (event.ctrlKey && event.keyCode == 70) {
  550. // alert("‘Ctrl+Enter’");
  551. // };
  552. // switch (event.keyCode) {
  553. //
  554. // }
  555. return true
  556. });
  557. $(document).keyup(function(event){
  558. console.log("keyCode keyup:"+event.keyCode)
  559. if(event.keyCode == 17){
  560. keyCode_17 = false
  561. $("#PanelCanvas").css('cursor', 'default');
  562. return false
  563. }
  564. //
  565. // if (event.ctrlKey && event.keyCode == 70) {
  566. // alert("‘Ctrl+Enter’");
  567. // };
  568. // switch (event.keyCode) {
  569. //
  570. // }
  571. return true
  572. });
  573. }
  574. </script>
  575. <script>
  576. var mousemove_x = 0
  577. var mousemove_y = 0
  578. addEventListener("mousemove", function (a) {
  579. if (keyCode_17){
  580. // console.log('top',mousemove_y - a.y,'left',mousemove_x - a.x)
  581. $("#PanelCanvas").css({
  582. 'top': mousemove_y - a.y,
  583. 'left': mousemove_x - a.x,
  584. });
  585. }else {
  586. mousemove_x = a.x + parseInt($("#PanelCanvas").css("left"))
  587. mousemove_y = a.y + parseInt($("#PanelCanvas").css("top"))
  588. }
  589. });
  590. </script>
  591. <!--移动面板-->
  592. <script>
  593. // //创建拖拽方法
  594. // PanelCanvas_move = true
  595. //
  596. // $("#PanelCanvas").mousedown(function(e){
  597. // if(!PanelCanvas_move){return;}
  598. // if(!keyCode_17){return;}
  599. // console.log(e)
  600. // var canvas = $(this);
  601. // var pos = $(this).position();
  602. // this.posix = {'x': e.pageX - pos.left, 'y': e.pageY - pos.top};
  603. // $.extend(document, {'move': true, 'move_target': this, 'call_down' : function(e, posix){
  604. // canvas.css({
  605. // 'cursor': 'move',
  606. // 'top': e.pageY - posix.y,
  607. // 'left': e.pageX - posix.x
  608. // });
  609. // }, 'call_up' : function(){
  610. // canvas.css('cursor', 'default');
  611. // }});
  612. // })
  613. //
  614. //
  615. // function f_PanelCanvas_onmouseover() {
  616. // // console.log("进入")
  617. // PanelCanvas_move = false
  618. // }
  619. //
  620. //
  621. // function f_PanelCanvas_onmouseout() {
  622. // // console.log("出去")
  623. // PanelCanvas_move = true
  624. // }
  625. </script>
  626. <!--数据缓存-->
  627. <script>
  628. var Public_Value_map = new Map();
  629. //读取 同步缓存数据
  630. function f_Public_Value_get(tab) {
  631. if(Public_Value_map.has(tab)){ //判断映射是否存在
  632. return {V:Public_Value_map.get(tab),is:true}
  633. }
  634. return {V:0,is:false}
  635. }
  636. //设置 同步缓存数据
  637. function f_Public_Value_set(tab,value) {
  638. Public_Value_map.set(tab,value); //添加设置映射
  639. }
  640. </script>
  641. <!--画板入口-->
  642. <script src="{{.OSS_Static}}/panel/PanelCanvas.js"></script>
  643. <script>
  644. // "#canvas"
  645. //
  646. // V_PanelCanvas1 =
  647. // V_PanelCanvas2 = f_canvas2(500,500,"{{.OSS_Static}}/images/demo_picture.jpg")
  648. var V_PanelCanvas_Map = new Map();
  649. //
  650. // V_PanelCanvas = new f_canvas2(500, 500, "{{.OSS_Static}}/images/demo_picture.jpg", 1, "{\"sn_sn\":\"866222050911984\",\"tab_tab\":\"v_do_2\",\"text1_text\":\"替换的文本\"}")
  651. // V_PanelCanvas_Map.set(V_PanelCanvas.PanelCanvas_id,V_PanelCanvas)
  652. // //测试加载
  653. // var loadData = [
  654. //
  655. // {text: "A0000001v_xx_7", rotate: 0, color: "rgb(255, 165, 0)", height: 70, width: 77, pageX: 89, pageY: 39}];
  656. // $.each(loadData, function (i, row) {
  657. // V_PanelCanvas.F_CreateBox(row);
  658. // });
  659. //
  660. //
  661. // V_PanelCanvas = new f_canvas2(500, 500, "{{.OSS_Static}}/images/demo_picture.jpg", 1, "{\"sn_sn\":\"866222050911984\"}")
  662. // V_PanelCanvas_Map.set(V_PanelCanvas.PanelCanvas_id,V_PanelCanvas)
  663. // var loadData = [
  664. // {text: "A0000001v_xx_1", rotate: 1, color: "rgb(255, 255, 0)", height: 70, width: 77, pageX: 29, pageY: 64}
  665. // ];
  666. // $.each(loadData, function (i, row) {
  667. // V_PanelCanvas.F_CreateBox(row);
  668. // });
  669. // var V_PanelCanvas1 = new Function(f_canvas(500,500,"{{.OSS_Static}}/images/demo_picture.jpg"))
  670. // var V_PanelCanvas2 = new Function(f_canvas(500,500,"{{.OSS_Static}}/images/demo_picture.jpg"))
  671. Height = $(window).height();
  672. $("#PanelTool_Device_List").css("height",(Height-125)+"px")
  673. function f_PaneView_Get() {
  674. $.ajax({
  675. type: 'POST',
  676. url: '../../Panel/PaneView_Get',//发送请求
  677. data: {
  678. T_viewid: "{{.T_viewid}}",
  679. },
  680. success: function (result) {
  681. console.log(result)
  682. if (result.Code == 200) {
  683. T_PanelCanvas = result.Data
  684. PanelCanvas_mode = T_PanelCanvas.T_mode
  685. f_PanelCanvas_mode_0(result)
  686. switch (PanelCanvas_mode) {
  687. case 0:
  688. $("#PanelCanvas_mode").html("自由模式")
  689. break
  690. case 1:
  691. $("#PanelCanvas_mode").html("瀑瀑模式")
  692. break
  693. case 2:
  694. $("#PanelCanvas_mode").html("满屏模式")
  695. break
  696. }
  697. $("#PanelCanvas_wh").html("["+T_PanelCanvas.T_width+"*"+T_PanelCanvas.T_height+"]")
  698. } else {
  699. layer.msg('视图获取错误!');
  700. setTimeout(function(){
  701. //要执行的代码
  702. f_PaneView_Get()
  703. },2000);
  704. }
  705. }
  706. });
  707. }
  708. // 自由模式
  709. function f_PanelCanvas_mode_0(result) {
  710. T_PanelCanvas = result.Data
  711. // CSS 样式
  712. $('#PanelCanvas').css({
  713. width: T_PanelCanvas.T_width + "px",
  714. height: T_PanelCanvas.T_height + "px"
  715. });
  716. // CSS 自定义样式
  717. f_Up_css(T_PanelCanvas.T_css,"PanelCanvas")
  718. // 加载 组件
  719. if(result.Data.T_text.length < 10 ){
  720. return;
  721. }
  722. PaneView_json = JSON.parse(result.Data.T_text)
  723. for(var i = 0;i < PaneView_json.length;i++){
  724. Layer_Mould_json = PaneView_json[i]
  725. console.log("创建面板 PaneView_json",Layer_Mould_json)
  726. 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)
  727. V_PanelCanvas_Map.set(V_PanelCanvas.PanelCanvas_id,V_PanelCanvas)
  728. for(var row_i = 0; row_i < Layer_Mould_json.Data_list.length; row_i++){
  729. // rowjson = Layer_Mould_json.Data_list[i]
  730. console.log("row json+ ",Layer_Mould_json.Data_list[row_i])
  731. V_PanelCanvas.F_CreateBox(Layer_Mould_json.Data_list[row_i]);
  732. }
  733. }
  734. }
  735. // 瀑瀑模式
  736. function f_PanelCanvas_mode_1(result){
  737. T_PanelCanvas = result.Data
  738. // CSS 样式
  739. $('#PanelCanvas').css({
  740. width: '100%',
  741. height: '100%',
  742. overflowX: "hidden",
  743. overflowY: "auto",
  744. });
  745. // CSS 自定义样式
  746. f_Up_css(T_PanelCanvas.T_css,"PanelCanvas")
  747. // 加载 组件
  748. if(result.Data.T_text.length < 10 ){
  749. return;
  750. }
  751. PaneView_json = JSON.parse(result.Data.T_text)
  752. for(var i = 0;i < PaneView_json.length;i++){
  753. Layer_Mould_json = PaneView_json[i]
  754. console.log("创建面板 PaneView_json",Layer_Mould_json)
  755. 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)
  756. V_PanelCanvas_Map.set(V_PanelCanvas.PanelCanvas_id,V_PanelCanvas)
  757. for(var row_i = 0; row_i < Layer_Mould_json.Data_list.length; row_i++){
  758. // rowjson = Layer_Mould_json.Data_list[i]
  759. console.log("row json+ ",Layer_Mould_json.Data_list[row_i])
  760. V_PanelCanvas.F_CreateBox(Layer_Mould_json.Data_list[row_i]);
  761. }
  762. }
  763. }
  764. function f_PaneView_Save(T_text) {
  765. $.ajax({
  766. type: 'POST',
  767. url: '../../Panel/PaneView_Post',//发送请求
  768. data: {
  769. T_viewid: "{{.T_viewid}}",
  770. T_text: T_text,
  771. T_mode: T_PanelCanvas.T_mode,
  772. T_width: T_PanelCanvas.T_width,
  773. T_height: T_PanelCanvas.T_height,
  774. T_css: T_PanelCanvas.T_css,
  775. T_data: T_PanelCanvas.T_data,
  776. },
  777. success: function (result) {
  778. console.log(result)
  779. if (result.Code == 200) {
  780. layer.msg('保存成功!');
  781. } else {
  782. layer.msg('保存失败!');
  783. }
  784. }
  785. });
  786. }
  787. </script>
  788. <!--发布订阅模式-->
  789. <script>
  790. // 控制中心
  791. var pubSub = {
  792. list: {},
  793. // 订阅
  794. subscribe: function(key, fn) {
  795. console.log("加入:",key)
  796. Public_V = f_Public_Value_get(key)
  797. if (Public_V.is){
  798. this.publish(key,Public_V.V)
  799. }
  800. if (!this.list[key]) this.list[key] = [];
  801. this.list[key].push(fn);
  802. key_list = key.split("/")
  803. if(key_list[0].length > 3){
  804. NewSubscribe(key_list[0]) // 订阅SN
  805. }
  806. },
  807. //取消订阅
  808. unsubscribe: function(key, fn) {
  809. let fnList = this.list[key];
  810. if (!fnList) return false;
  811. if (!fn) { // 不传入指定的方法,清空所用 key 下的订阅
  812. fnList && (fnList.length = 0);
  813. } else {
  814. fnList.forEach((item, index) => {
  815. item === fn && fnList.splice(index, 1);
  816. });
  817. }
  818. },
  819. // 发布
  820. publish: function(key, ...args) {
  821. if (this.list[key]){
  822. for (let fn of this.list[key]) fn.call(this, ...args);
  823. }
  824. }
  825. }
  826. function f_Data_Read(T_sn) {
  827. T_sn_list = T_sn.split("-")
  828. $.ajax({
  829. type: 'POST',
  830. url: '../../Data/Device_Sensor',//发送请求
  831. data: {
  832. T_sn: T_sn_list[0],
  833. T_id: T_sn_list[1],
  834. },
  835. success: function (result) {
  836. console.log(result)
  837. if (result.Code == 200) {
  838. for (const [key, value] of Object.entries(result.Data)) {
  839. console.log(key,value);
  840. pubSub.publish(T_sn+"/"+key, value);
  841. f_Public_Value_set(T_sn+"/"+key, value)
  842. }
  843. }
  844. }
  845. });
  846. }
  847. </script>
  848. <!--websocket-->
  849. <script src="{{.OSS_Static}}/js/jquery.cookie.min.js"></script>
  850. <script>
  851. var websocket = null;
  852. //判断当前浏览器是否支持WebSocket
  853. run_WebSocket()
  854. function run_WebSocket() {
  855. console.log("run_WebSocket");
  856. if ('WebSocket' in window) {
  857. url = window.location.host
  858. if (url.indexOf("baozhida") != -1) {
  859. websocket = new WebSocket("wss://" + window.location.host + "/wsPanel/join?User_tokey=" + $.cookie('User_tokey'));
  860. } else {
  861. websocket = new WebSocket("ws://" + window.location.host + "/wsPanel/join?User_tokey=" + $.cookie('User_tokey'));
  862. }
  863. } else {
  864. alert('Dont support websocket')
  865. }
  866. }
  867. //连接成功建立的回调方法
  868. websocket.onopen = function () {
  869. console.log("websocket open");
  870. // get_DeviceCh_List(0)
  871. setTimeout(function(){
  872. SubscribeSend()
  873. },2000);
  874. // send("{\"Sn\":\"" + getQueryString("Sn") + "\"}")
  875. };
  876. //接收到消息的回调方法
  877. websocket.onmessage = function (event) {
  878. // console.log("websocket:",event.data)
  879. var obj = JSON.parse(event.data);
  880. console.log("websocket:",obj)
  881. if(obj.Code == 200){
  882. return
  883. }
  884. sn_id = obj.T_sn+"-"+obj.T_id
  885. for (const [key, value] of Object.entries(obj)) {
  886. // console.log(key,value);
  887. pubSub.publish(sn_id+"/"+key, value);
  888. f_Public_Value_set(sn_id+"/"+key, value)
  889. }
  890. // pubSub.publish(sn_id+'/'+obj.tab, obj.value);
  891. // // op:类型u8, //操作 0-主动上传 1-读 2- 写 3-成功 4-失败
  892. // switch (obj.op) {
  893. // case 3:
  894. // Del_Mid(obj.mid)
  895. // break;
  896. // case 4:
  897. // Err_Mid(obj.mid)
  898. // break;
  899. // }
  900. // console.log(obj.sn,"进入。。 Device_Sn = ",obj.sn)
  901. // Pu_DeviceCh_List_g(obj.sn,obj.tab,obj.value)
  902. //
  903. // if (obj.type == 0) {
  904. // // console.log("data.length:",obj.sensor.length)
  905. //
  906. // Pu_DeviceCh_List_g(obj.sn, obj.sensor)
  907. //
  908. // if (obj.type == 0) {
  909. // $("#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")
  910. //
  911. // // console.log(timestamp_V, obj.sensor[0].UT, " 刷新间隔:" + (timestamp_V - obj.sensor[0].UT) + "s")
  912. // timestamp_V = obj.sensor[0].UT
  913. //
  914. // }
  915. //
  916. //
  917. // }
  918. };
  919. //连接关闭的回调方法
  920. websocket.onclose = function () {
  921. console.log("close");
  922. // setTimeout(function () {
  923. // //要执行的代码
  924. // run_WebSocket();
  925. // }, 2000);
  926. };
  927. //连接发生错误的回调方法
  928. websocket.onerror = function () {
  929. console.log("error");
  930. setTimeout(function () {
  931. //要执行的代码
  932. run_WebSocket();
  933. }, 2000);
  934. };
  935. //监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常。
  936. window.onbeforeunload = function () {
  937. websocket.close();
  938. console.log("窗口关闭事件");
  939. };
  940. //关闭连接
  941. function closeWebSocket() {
  942. websocket.close();
  943. console.log("onbeforeunload");
  944. window.clearInterval(intervalId);
  945. }
  946. //发送消息
  947. function send(message) {
  948. websocket.send(message);
  949. }
  950. var SbscribeMap = new Set();
  951. // 订阅 SN
  952. function Subscribe(SN) {
  953. if(!SbscribeMap.has(SN)){
  954. console.log("加入订阅:",SN)
  955. SbscribeMap.add(SN)
  956. }
  957. //
  958. }
  959. // 订阅 SN
  960. function NewSubscribe(SN) {
  961. if(!SbscribeMap.has(SN)){
  962. console.log("加入订阅:",SN)
  963. SbscribeMap.add(SN)
  964. send("{ \"Sn\":\""+SN+"\"}")
  965. f_Data_Read(SN)
  966. }
  967. //
  968. }
  969. // 订阅 SN
  970. function SubscribeSend() {
  971. for (var SN of SbscribeMap) { // 遍历Set
  972. send("{ \"Sn\":\""+SN+"\"}")
  973. }
  974. console.log("开始订阅:",SbscribeMap)
  975. }
  976. </script>
  977. <!--/// ----------------------------- 编辑 -------------------------------------- -->
  978. <!--鼠标拖拽-->
  979. <script>
  980. var isDown = false //鼠标释放
  981. var V_PanelTool_id = 0 //工具 ID
  982. var V_PanelTool_class = 0 // 1 基础 2 层模型
  983. var V_PanelCanvas_id = 0
  984. function v_ondragleave(class_id,id) {
  985. console.log("离开工具栏")
  986. console.log(id)
  987. V_PanelTool_id = id
  988. V_PanelTool_class = class_id
  989. setTimeout(function(){
  990. //要执行的代码
  991. console.log("释放层 id",V_PanelCanvas_id)
  992. switch (V_PanelTool_class) {
  993. case 1:
  994. console.log("加入 基础组件",PanelTool_List[V_PanelTool_id].T_text)
  995. V_PanelCanvas_Map.get(V_PanelCanvas_id).F_CreateBox({
  996. text: PanelTool_List[V_PanelTool_id].T_text,
  997. rotate: 0,
  998. color: PanelTool_List[V_PanelTool_id].T_color,
  999. height: PanelTool_List[V_PanelTool_id].T_height,
  1000. width: PanelTool_List[V_PanelTool_id].T_width,
  1001. pageX: 20, pageY: 20
  1002. });
  1003. break;
  1004. case 2: // 弃用
  1005. console.log("释放 层 模型",Layer_Mould_List[V_PanelTool_id])
  1006. break;
  1007. }
  1008. },200);
  1009. }
  1010. // $( ".divulli" ).draggable({ cursor: "move", cursorAt: { top: 56, left: 56 } });
  1011. // 进入
  1012. function f_ondragenter(id) {
  1013. console.log("进入",id)
  1014. // document.getElementById("example").style.cursor = "move"; canvas.css('cursor', 'default');
  1015. $(document).css('cursor', 'move');
  1016. }
  1017. //另一对象
  1018. function f_ondragover(id) {
  1019. console.log("另一对象",id)
  1020. isDown = false
  1021. $(document).css('cursor', 'move');
  1022. }
  1023. //离开
  1024. function f_ondragleave(id) {
  1025. console.log("离开",id)
  1026. isDown = true
  1027. setTimeout(function(){
  1028. //要执行的代码
  1029. console.log(isDown)
  1030. if(isDown){
  1031. console.log("释放层 id",id)
  1032. switch (V_PanelTool_class) {
  1033. case 1:
  1034. console.log("释放 基础组件",PanelTool_List[V_PanelTool_id].T_text)
  1035. V_PanelCanvas_Map.get(id).F_CreateBox({
  1036. text: PanelTool_List[V_PanelTool_id].T_text,
  1037. rotate: 0,
  1038. color: PanelTool_List[V_PanelTool_id].T_color,
  1039. height: PanelTool_List[V_PanelTool_id].T_height,
  1040. width: PanelTool_List[V_PanelTool_id].T_width,
  1041. pageX: 20, pageY: 20
  1042. });
  1043. break;
  1044. case 2: // 弃用
  1045. console.log("释放 层 模型",Layer_Mould_List[V_PanelTool_id])
  1046. break;
  1047. }
  1048. }
  1049. },200);
  1050. }
  1051. </script>
  1052. <!--底层-->
  1053. <script>
  1054. T_PanelCanvas = {}
  1055. //加载layer拓展
  1056. layer.config({
  1057. extend: 'extend/layer.ext.js'
  1058. });
  1059. //右键菜单参数
  1060. context.init({
  1061. fadeSpeed: 100,
  1062. above: 'auto',
  1063. preventDoubleContext: true,
  1064. compress: false
  1065. });
  1066. context.attach('#PanelCanvas', [
  1067. {header: '面板模式'},
  1068. {
  1069. text: '自由模式', action: function (e) {
  1070. e.preventDefault();
  1071. T_PanelCanvas.T_mode = 0
  1072. $("#PanelCanvas_mode").html("自由模式")
  1073. }
  1074. },
  1075. {
  1076. text: '瀑瀑模式(一层)', action: function (e) {
  1077. e.preventDefault();
  1078. T_PanelCanvas.T_mode = 1
  1079. $("#PanelCanvas_mode").html("瀑瀑模式")
  1080. $("#open_layer_data_layer_textarea").val(T_PanelCanvas.T_data)
  1081. layer.open({
  1082. title: '瀑瀑数据来源',
  1083. type: 1,
  1084. area: ['577px','690px'],
  1085. fix: true, //不固定
  1086. maxmin: false,
  1087. content: $('#open_layer_data_layer'),
  1088. shadeClose: true,
  1089. anim: 1,
  1090. shade: 0.4,
  1091. isOutAnim: false,
  1092. scrollbar: false,
  1093. btn:["确定"],
  1094. yes:function (Index) {
  1095. T_PanelCanvas.T_data = $("#open_layer_data_layer_textarea").val()
  1096. layer.close(Index);
  1097. }
  1098. });
  1099. // var box = $('#PanelCanvas');
  1100. // box.css({
  1101. // width: '100%',
  1102. // height: '100%',
  1103. // overflowX: "hidden",
  1104. // overflowY: "auto",
  1105. // });
  1106. // T_PanelCanvas.T_width = 0;
  1107. // T_PanelCanvas.T_height = 0;
  1108. // PanelCanvas_mode = 1
  1109. }
  1110. },
  1111. {
  1112. text: '满屏模式', action: function (e) {
  1113. e.preventDefault();
  1114. T_PanelCanvas.T_mode = 2
  1115. $("#PanelCanvas_mode").html("满屏模式")
  1116. }
  1117. },
  1118. {header: '自定义尺寸'},
  1119. {
  1120. text: '1920x1080 (2K)', action: function (e) {
  1121. e.preventDefault();
  1122. var box = $('#PanelCanvas');
  1123. box.css({
  1124. width: 1920,
  1125. height: 1080
  1126. });
  1127. T_PanelCanvas.T_width = 1920;
  1128. T_PanelCanvas.T_height = 1080;
  1129. $("#PanelCanvas_wh").html("["+T_PanelCanvas.T_width+"*"+T_PanelCanvas.T_height+"]")
  1130. }
  1131. },
  1132. {
  1133. text: '3840x2160 (4K)', action: function (e) {
  1134. e.preventDefault();
  1135. var box = $('#PanelCanvas');
  1136. box.css({
  1137. width: 3840,
  1138. height: 2160
  1139. });
  1140. T_PanelCanvas.T_width = 3840;
  1141. T_PanelCanvas.T_height = 2160;
  1142. $("#PanelCanvas_wh").html("["+T_PanelCanvas.T_width+"*"+T_PanelCanvas.T_height+"]")
  1143. }
  1144. },
  1145. {
  1146. text: '自定义尺寸', action: function (e) {
  1147. e.preventDefault();
  1148. layer.prompt({
  1149. title: '请输入区域尺寸(宽,高),最小值:30 \n4K=3840*2160\n2K= 2560*1440',
  1150. formType: 0,
  1151. value: Math.round(T_PanelCanvas.T_width) + "," + Math.round(T_PanelCanvas.T_height)
  1152. }, function (value, index, elem) {
  1153. var reg = /^[0-9]+,[0-9]+$/;
  1154. if (!reg.test(value)) {
  1155. alert('输入格式不正确,请输入整数 如:100,100');
  1156. return;
  1157. }
  1158. var size = value.split(',');
  1159. var box = $('#PanelCanvas');
  1160. box.css({
  1161. width: size[0] < 30 ? 30 : size[0],
  1162. height: size[1] < 30 ? 30 : size[1]
  1163. });
  1164. T_PanelCanvas.T_width = size[0];
  1165. T_PanelCanvas.T_height = size[1];
  1166. $("#PanelCanvas_wh").html("["+T_PanelCanvas.T_width+"*"+T_PanelCanvas.T_height+"]")
  1167. layer.close(index);
  1168. });
  1169. }
  1170. },
  1171. {divider: true},
  1172. {header: '更改样式'},
  1173. {
  1174. text: 'CSS样式', action: function (e) {
  1175. e.preventDefault();
  1176. $("#open_layer_css_layer_textarea").val(T_PanelCanvas.T_css)
  1177. f_attribute_css_inti() // 初始化 CSS 自定义样式
  1178. layer.open({
  1179. title: '自定义 CSS样式',
  1180. type: 1,
  1181. area: ['577px','690px'],
  1182. fix: true, //不固定
  1183. maxmin: false,
  1184. content: $('#open_layer_css_layer'),
  1185. shadeClose: true,
  1186. anim: 1,
  1187. shade: 0.4,
  1188. isOutAnim: false,
  1189. scrollbar: false,
  1190. btn:["确定"],
  1191. yes:function (Index) {
  1192. T_PanelCanvas.T_css = $("#open_layer_css_layer_textarea").val()
  1193. f_Up_css(T_PanelCanvas.T_css,"PanelCanvas")
  1194. layer.close(Index);
  1195. }
  1196. });
  1197. }
  1198. },
  1199. ]);
  1200. </script>
  1201. <!--保存为面板-->
  1202. <script>
  1203. var Save_layer_obj = {}
  1204. function f_Save_layer(obj) {
  1205. Save_layer_obj = obj
  1206. Attribute_layer_id = layer.open({
  1207. title: '保存为面板',
  1208. type: 1,
  1209. area: ['277px','290px'],
  1210. fix: false, //不固定
  1211. maxmin: false,
  1212. content: $('#open_layer_save_layer'),
  1213. shadeClose: true,
  1214. anim: 1,
  1215. shade: 0.4,
  1216. isOutAnim: false,
  1217. scrollbar: false,
  1218. });
  1219. }
  1220. function f_Save_layer_choice() {
  1221. box_json = Save_layer_obj.F_get_box_json()
  1222. layer_name = $("#open_layer_save_layer_name").val()
  1223. layer_img = $("#open_layer_save_layer_img").val()
  1224. console.log("F_get_box_json:",box_json)
  1225. console.log("open_layer_save_layer_name:",layer_name)
  1226. console.log("open_layer_save_layer_img:",layer_img)
  1227. f_Save_Layer(layer_name,layer_img,JSON.stringify(box_json))
  1228. layer.close(Attribute_layer_id);
  1229. }
  1230. function f_Save_Layer(name,img,text) {
  1231. $.ajax({
  1232. type: 'POST',
  1233. url: '../../Panel/Layer_Mould_Save',//发送请求
  1234. data: {
  1235. layer_name: name,
  1236. layer_img: img,
  1237. layer_json: text,
  1238. },
  1239. success: function (result) {
  1240. console.log(result)
  1241. if (result.Code == 200) {
  1242. layer.msg('上传成功!');
  1243. }
  1244. }
  1245. });
  1246. }
  1247. // 保存工程
  1248. function f_Save() {
  1249. o_PanelCanvas_List = []
  1250. for(let [key,v] of V_PanelCanvas_Map) {
  1251. console.log("V_PanelCanvas_Map key:", key);
  1252. box_json = v.F_get_box_json()
  1253. o_PanelCanvas_List.push(box_json)
  1254. }
  1255. //
  1256. console.log("o_PanelCanvas_List:",o_PanelCanvas_List)
  1257. // console.log(JSON.stringify(o_PanelCanvas_List))
  1258. f_PaneView_Save(JSON.stringify(o_PanelCanvas_List))
  1259. }
  1260. </script>
  1261. <!--// 左侧 工具-->
  1262. <script>
  1263. var menuRight = document.getElementById('menuRight')
  1264. var body = document.body;
  1265. classie.toggle(body, 'cbp-spmenu-push-toright');
  1266. classie.toggle(body, 'cbp-spmenu-push-toright_bady');
  1267. classie.toggle(menuRight, 'cbp-spmenu-open');
  1268. console.log("menuRight.height",menuRight.clientHeight)
  1269. $(".help-left").css("max-height",menuRight.clientHeight - 64 + "px")
  1270. // 基础工具
  1271. var PanelTool_List = []
  1272. function f_PanelTool_List() {
  1273. $.ajax({
  1274. type: 'POST',
  1275. url: '../../Panel/PanelTool_List',//发送请求
  1276. data: {
  1277. page: 1,
  1278. page_z: 990,
  1279. },
  1280. success: function (result) {
  1281. console.log(result)
  1282. if (result.Code == 200) {
  1283. PanelTool_List = result.Data.List
  1284. Show_PanelTool_List(PanelTool_List) // 列表
  1285. // if(result.Data.Page_size > result.Data.Page ){
  1286. // f_PanelTool_List(result.Data.Page+1)
  1287. // }
  1288. } else {
  1289. }
  1290. }
  1291. });
  1292. }
  1293. function Show_PanelTool_List(data) {
  1294. $('#PanelTool_1').append("" +
  1295. "<div class=\"divulli\" onmousedown='f_Add_NewLayer()' >\n" +
  1296. " <img src=\"https://standardoss.baozhida.cn/UpImage/57f8984e-7327-49d3-8bc9-00719f02d61e.png\">\n" +
  1297. " <div>添加层</div>\n" +
  1298. "</div>")
  1299. for (let i = 0; i < data.length; i++) {
  1300. switch (data[i].T_class) {
  1301. case 1:
  1302. $('#PanelTool_1').append("" +
  1303. "<div class=\"divulli\" onmousedown='v_ondragleave(1,"+ i +")' >\n" +
  1304. " <img src=\""+data[i].T_img+"\">\n" +
  1305. " <div>"+data[i].T_name+"</div>\n" +
  1306. "</div>")
  1307. break
  1308. case 2:
  1309. $('#PanelTool_2').append("" +
  1310. "<div class=\"divulli\" onmousedown='v_ondragleave(1,"+ i +")' >\n" +
  1311. " <img src=\""+data[i].T_img+"\">\n" +
  1312. " <div>"+data[i].T_name+"</div>\n" +
  1313. "</div>")
  1314. break
  1315. case 3:
  1316. $('#PanelTool_3').append("" +
  1317. "<div class=\"divulli\" onmousedown='v_ondragleave(1,"+ i +")' >\n" +
  1318. " <img src=\""+data[i].T_img+"\">\n" +
  1319. " <div>"+data[i].T_name+"</div>\n" +
  1320. "</div>")
  1321. break
  1322. }
  1323. // Pu_DeviceCh_View(data[i].T_sn+data[i].T_tab+"_"+data[i].T_ch,data[i].T_value)
  1324. }
  1325. }
  1326. ///////////------------ 模板
  1327. Layer_Mould_List = []
  1328. function f_Layer_Mould_List() {
  1329. $.ajax({
  1330. type: 'POST',
  1331. url: '../../Panel/Layer_Mould_List',//发送请求
  1332. data: {
  1333. page: 1,
  1334. page_z: 990,
  1335. },
  1336. success: function (result) {
  1337. console.log(result)
  1338. if (result.Code == 200) {
  1339. Layer_Mould_List = result.Data.List
  1340. Show_Layer_Mould_List(Layer_Mould_List) // 列表
  1341. // if(result.Data.Page_size > result.Data.Page ){
  1342. // f_PanelTool_List(result.Data.Page+1)
  1343. // }
  1344. } else {
  1345. }
  1346. }
  1347. });
  1348. }
  1349. function Show_Layer_Mould_List(data) {
  1350. for (let i = 0; i < data.length; i++) {
  1351. switch (data[i].T_class) {
  1352. case 1:
  1353. $('#LayerMould_1').append("" +
  1354. "<div class=\"divulli\" ondblclick='f_Add_Layer_Mould("+ i +")' >\n" +
  1355. " <img src=\""+data[i].T_img+"\">\n" +
  1356. " <div>"+data[i].T_name+"</div>\n" +
  1357. "</div>")
  1358. break
  1359. case 2:
  1360. $('#LayerMould_2').append("" +
  1361. "<div class=\"divulli\" ondblclick='f_Add_Layer_Mould("+ i +")' >\n" +
  1362. " <img src=\""+data[i].T_img+"\">\n" +
  1363. " <div>"+data[i].T_name+"</div>\n" +
  1364. "</div>")
  1365. break
  1366. }
  1367. // Pu_DeviceCh_View(data[i].T_sn+data[i].T_tab+"_"+data[i].T_ch,data[i].T_value)
  1368. }
  1369. }
  1370. // - 添加面板
  1371. function f_Add_Layer_Mould(i_id) {
  1372. console.log("V_PanelCanvas_Map:",V_PanelCanvas_Map.size)
  1373. if(PanelCanvas_mode == 1 && V_PanelCanvas_Map.size != 0){
  1374. layer.msg('只允许一个层!');
  1375. return
  1376. }
  1377. Layer_Mould_json = JSON.parse(Layer_Mould_List[i_id].T_text)
  1378. console.log("释放 层 模型",Layer_Mould_json)
  1379. 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)
  1380. V_PanelCanvas_Map.set(V_PanelCanvas.PanelCanvas_id,V_PanelCanvas)
  1381. //测试加载
  1382. // var loadData = [
  1383. // {text: "A0000001v_xx_7", rotate: 0, color: "rgb(255, 165, 0)", height: 70, width: 77, pageX: 89, pageY: 39}
  1384. // ];
  1385. for(var i = 0; i < Layer_Mould_json.Data_list.length; i++){
  1386. // rowjson = Layer_Mould_json.Data_list[i]
  1387. console.log("rowjson",Layer_Mould_json.Data_list[i])
  1388. V_PanelCanvas.F_CreateBox(Layer_Mould_json.Data_list[i]);
  1389. }
  1390. // $.each(, function (i, row) {
  1391. //
  1392. // //
  1393. // });
  1394. }
  1395. // - 添加面板
  1396. function f_Add_NewLayer() {
  1397. V_PanelCanvas = new f_canvas2(0,0,600, 600, 0, "{ \"sn_sn\": \"\" }","")
  1398. V_PanelCanvas_Map.set(V_PanelCanvas.PanelCanvas_id,V_PanelCanvas)
  1399. }
  1400. ///////////------------
  1401. //获得元素
  1402. var lis = document.querySelectorAll('#tab-header span');
  1403. var content = document.querySelectorAll('#tab-content .dom');
  1404. // 遍历1级菜单里的li元素
  1405. for (var i = 0; i < lis.length; i++) {
  1406. // onmouseenter、onmousemove与mousemove的区别:
  1407. // 其支持冒泡,所以当鼠标移入或鼠标移入其子元素的时候都会触发相关事件
  1408. // 其不支持冒泡,所以当鼠标移入这个元素本身的时候会触发相关事件
  1409. // 不支持冒泡事件,当鼠标在元素上移动的时候会触发相关事件
  1410. lis[i].onclick = ( function (i) {
  1411. return function () {
  1412. for (var j = 0; j < lis.length; j++) {
  1413. content[j].style.display = 'none';
  1414. lis[j].style.color = '';
  1415. lis[j].style.border = '1px solid #e5e5e5';
  1416. }
  1417. content[i].style.display = 'block';
  1418. lis[i].style.color = '#69d1ff';
  1419. lis[i].style.border = '2px solid #69d1ff';
  1420. }
  1421. })(i)
  1422. }
  1423. lis[0].onclick()
  1424. </script>
  1425. <!--// 左侧 工具 - 设备 -->
  1426. <script>
  1427. // 更新列表
  1428. function f_PanelTool_Device_List() {
  1429. $('#PanelTool_Device_List').html("")
  1430. for (let i = 0; i < Device_List.length; i++) {
  1431. $('#PanelTool_Device_List').append("" +
  1432. "<div style='padding: 4px;margin: 5px;border:1px solid #ececec;' > " +
  1433. "<div>SN:"+Device_List[i].T_sn+"</div>"+
  1434. Device_List[i].T_name+"["+Device_List[i].T_id+"]" +
  1435. "</div>")
  1436. }
  1437. }
  1438. function open_menu(Id) {
  1439. layer.open({
  1440. title: "设备参数配置 ",
  1441. type: 2,
  1442. area: ['500px', '630px'],
  1443. fix: false, //不固定
  1444. maxmin: false,
  1445. content: "../../DeviceCh/DeviceChParameter_Id_Html?Id="+Id,
  1446. shadeClose:true,
  1447. anim: 1,
  1448. isOutAnim: false,
  1449. });
  1450. }
  1451. </script>
  1452. <!--文件上传-->
  1453. <script src="https://cdn.staticfile.org/qiniu-js/3.4.0/qiniu.min.js"></script>
  1454. <script>
  1455. var F_c=function(up_url) {}
  1456. // F_c = function(up_url) {
  1457. // if (H_img_id.length > 1) {
  1458. // $("#" + H_img_id).attr("src", up_url)
  1459. // }
  1460. // }
  1461. $("#UpLoadFile").change(function () {
  1462. let file = this.files[0];
  1463. console.log(file)
  1464. filesplit = file.type.split("/")
  1465. console.log("filesplit:",filesplit[filesplit.length-1])
  1466. $.ajax({
  1467. type: 'POST',
  1468. url: '../../Config/UpFileToken',//发送请求
  1469. data: {
  1470. T_suffix: filesplit[filesplit.length-1],
  1471. },
  1472. success: function (result) {
  1473. console.log(result)
  1474. if (result.Code == 200) {
  1475. f_upload(file, result.Data)
  1476. }
  1477. }
  1478. });
  1479. })
  1480. function f_upload(file, token) {
  1481. // let file = this.files[0];
  1482. let config = {
  1483. useCdnDomain: true,
  1484. region: qiniu.region.z2,
  1485. debugLogLevel: 'INFO',
  1486. useCdnDomain: true, // 表示是否使用 cdn 加速域名
  1487. };
  1488. let putExtra = {
  1489. fname: "",
  1490. params: {},
  1491. mimeType: null
  1492. };
  1493. // 设置next,error,complete对应的操作,分别处理相应的进度信息,错误信息,以及完成后的操作
  1494. var error = function (err) {
  1495. console.log(err);
  1496. alert("上传出错")
  1497. };
  1498. var complete = function (res) {
  1499. console.log(res)
  1500. if (res.key) {
  1501. console.log("url:", res.key)
  1502. F_c(res.key)
  1503. // if (H_img_id.length > 1) {
  1504. // $("#" + H_img_id).attr("src", res.key)
  1505. // H_img_id = ""
  1506. // }
  1507. }
  1508. };
  1509. var next = function (response) {
  1510. console.log(response)
  1511. };
  1512. var subObject = {
  1513. next: next,
  1514. error: error,
  1515. complete: complete
  1516. };
  1517. let subscription;
  1518. // 调用sdk上传接口获得相应的observable,控制上传和暂停
  1519. let observable = qiniu.upload(file, "key", token, putExtra, config);
  1520. subscription = observable.subscribe(subObject);
  1521. }
  1522. </script>
  1523. <!-- 资源库 -->
  1524. <script>
  1525. var ConfigImg_List = []
  1526. var Device_List = []
  1527. var Device_List_map = new Map();
  1528. var ConfiglibImg_T_str = "";
  1529. var ConfiglibImg_page = 1;
  1530. function f_PaneView_Post(my) {
  1531. Attribute_my = my
  1532. $.ajax({
  1533. type: 'POST',
  1534. url: '../../Panel/PaneView_Post',//发送请求
  1535. data: {
  1536. T_text: "",
  1537. T_width: 1920,
  1538. T_height: 1080,
  1539. T_css: "",
  1540. },
  1541. success: function (result) {
  1542. console.log(result)
  1543. if (result.Code == 200) {
  1544. $(Attribute_my).val(result.Data)
  1545. } else {
  1546. layer.msg('新建面板失败!');
  1547. }
  1548. }
  1549. });
  1550. }
  1551. function f_ConfigImg_List() {
  1552. $.ajax({
  1553. type: 'POST',
  1554. url: '../../Config/ConfigImg_List',//发送请求
  1555. data: {
  1556. page: 1,
  1557. page_z: 9999,
  1558. },
  1559. success: function (result) {
  1560. console.log(result)
  1561. if (result.Code == 200) {
  1562. ConfigImg_List = result.Data.List
  1563. } else {
  1564. layer.msg('获取图片失败!');
  1565. }
  1566. }
  1567. });
  1568. }
  1569. var ConfiglibImg_List = []
  1570. var ConfiglibImg_page = 0;
  1571. var ConfiglibImg_T_str = ""
  1572. function f_ConfiglibImg_List_inti(T_str0) {
  1573. ConfiglibImg_List = []
  1574. ConfiglibImg_page = 0;
  1575. ConfiglibImg_T_str = T_str0
  1576. // 更新列表
  1577. $('#open_layer_Data_List').html("")
  1578. $('#open_layer_Data_List').append("<div style='width: 100px;height: 120px;float: left;margin: 6px;text-align: center;'> " +
  1579. "<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\"> " +
  1580. "<span>上传图片</span>"+
  1581. "</div>")
  1582. return
  1583. }
  1584. function f_ConfiglibImg_List() {
  1585. ConfiglibImg_page += 1;
  1586. $.ajax({
  1587. type: 'POST',
  1588. url: '../../Config/ConfiglibImg_List',//发送请求
  1589. data: {
  1590. T_str0: ConfiglibImg_T_str,
  1591. page: ConfiglibImg_page,
  1592. page_z: 200,
  1593. },
  1594. success: function (result) {
  1595. console.log(result)
  1596. if (result.Code == 200) {
  1597. for (let i = 0; i < result.Data.List.length; i++) {
  1598. ConfiglibImg_List.push(result.Data.List[i])
  1599. $('#open_layer_Data_List').append("<div style='width: 100px;height: 120px;float: left;margin: 6px;text-align: center;'> " +
  1600. "<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\"> " +
  1601. "<span>"+ result.Data.List[i].T_str0+"</span>"+
  1602. "</div>")
  1603. }
  1604. } else {
  1605. layer.msg('获取图片失败!');
  1606. }
  1607. }
  1608. });
  1609. }
  1610. function f_Device_List(T_name) {
  1611. $.ajax({
  1612. type: 'POST',
  1613. url: '../../../Data/Device_Sensor_List',//发送请求
  1614. data: {
  1615. // T_sn: T_sn,
  1616. T_name: T_name,
  1617. // T_class_id: parseInt(T_class_id),
  1618. page: 1,
  1619. page_z: 30,
  1620. },
  1621. success: function (result) {
  1622. console.log(result)
  1623. if (result.Code == 200) {
  1624. Device_List_r = result.Data.DeviceSensor_lite
  1625. for (let i = 0; i < Device_List_r.length; i++) {
  1626. Device_List_map.set(Device_List_r[i].T_sn,Device_List_r[i]);
  1627. Device_List.push(Device_List_r[i])
  1628. }
  1629. f_PanelTool_Device_List()
  1630. } else {
  1631. layer.msg('获取主设备失败!');
  1632. }
  1633. }
  1634. });
  1635. }
  1636. </script>
  1637. <!--图片组选择-->
  1638. <script>
  1639. var Attribute_my = {}
  1640. var Attribute_layer_id = 0
  1641. function f_attribute_imggroup(my) {
  1642. Attribute_my = my
  1643. Attribute_layer_id = layer.open({
  1644. title: '请选择 图标',
  1645. type: 1,
  1646. area: [($(window).width() * 0.9) + 'px', ($(window).height() - 50) + 'px'],
  1647. fix: false, //不固定
  1648. maxmin: false,
  1649. content: $('#open_layer_Data_List'),
  1650. shadeClose: true,
  1651. anim: 1,
  1652. shade: 0.4,
  1653. isOutAnim: false,
  1654. scrollbar: false,
  1655. });
  1656. // 更新列表
  1657. $('#open_layer_Data_List').html("")
  1658. for (let i = 0; i < ConfigImg_List.length; i++) {
  1659. $('#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\">")
  1660. }
  1661. }
  1662. function f_attribute_ConfigImg_choice(id) {
  1663. 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
  1664. console.log($(Attribute_my))
  1665. $(Attribute_my).val(img_str)
  1666. //关闭当前frame
  1667. console.log(Attribute_layer_id)
  1668. layer.close(Attribute_layer_id);
  1669. }
  1670. </script>
  1671. <!--CSS 自定义样式-->
  1672. <script>
  1673. // 初始化 CSS 自定义样式
  1674. function f_attribute_css_inti() {
  1675. // $("#S_open_layer_css_layer_background_img").val("")
  1676. // $("#S_open_layer_css_layer_backgroundcolour_colour1").val("")
  1677. }
  1678. function f_attribute_libimg(my) {
  1679. Attribute_my = my
  1680. Attribute_layer_id = layer.open({
  1681. title: '请选择 图片(按 f 搜索关键字)',
  1682. type: 1,
  1683. area: [($(window).width() * 0.9) + 'px', ($(window).height() - 50) + 'px'],
  1684. fix: false, //不固定
  1685. maxmin: false,
  1686. content: $('#open_layer_Data_List'),
  1687. shadeClose: true,
  1688. anim: 1,
  1689. shade: 0.4,
  1690. isOutAnim: false,
  1691. scrollbar: false,
  1692. end:function () {
  1693. keyCode_70 = {}
  1694. }
  1695. });
  1696. console.log("Attribute_layer_id layer:",Attribute_layer_id)
  1697. //
  1698. //
  1699. // layer.open($.extend({
  1700. // btn: ["&#x786E;&#x5B9A;", "&#x53D6;&#x6D88;"],
  1701. // content: "e",
  1702. // skin: "layui-layer-prompt" + b("prompt"),
  1703. // success: function (a) {
  1704. // d = a.find(".layui-layer-input"), d.focus()
  1705. // },
  1706. // yes: function (b) {
  1707. // var e = d.val();
  1708. // "" === 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)
  1709. // }
  1710. // }, a))
  1711. //
  1712. keyCode_70 = function () {
  1713. AAAA = layer.prompt({
  1714. type:1,
  1715. title: '请输 搜索关键字',
  1716. formType: 0,
  1717. value: ""
  1718. }, function (value, index, elem) {
  1719. //
  1720. console.log(value)
  1721. console.log(index)
  1722. layer.close(index);
  1723. f_ConfiglibImg_List_inti(value)
  1724. f_ConfiglibImg_List()
  1725. });
  1726. console.log("搜索关键字 layer:",AAAA)
  1727. }
  1728. f_ConfiglibImg_List_inti("")
  1729. f_ConfiglibImg_List()
  1730. // 滚轮 触发
  1731. $(".layui-layer-content").scroll(function () {
  1732. nScrollHight = $(this)[0].scrollHeight;
  1733. nScrollTop = $(this)[0].scrollTop;
  1734. if(nScrollTop + $(".layui-layer-content").height() >= nScrollHight) {
  1735. //加载loadHotService();
  1736. console.log("n")
  1737. f_ConfiglibImg_List()
  1738. }
  1739. });
  1740. }
  1741. function f_attribute_Configlibimg_UpLoadFile() {
  1742. $('#UpLoadFile').click();
  1743. F_c = function(up_url) {
  1744. $(Attribute_my).val(up_url)
  1745. //关闭当前frame
  1746. layer.close(Attribute_layer_id);
  1747. }
  1748. }
  1749. function f_attribute_Configlibimg_choice(id) {
  1750. img_str = ConfiglibImg_List[id].T_img0
  1751. console.log($(Attribute_my))
  1752. $(Attribute_my).val(img_str)
  1753. //关闭当前frame
  1754. console.log(Attribute_layer_id)
  1755. layer.close(Attribute_layer_id);
  1756. }
  1757. </script>
  1758. <!--文字组选择-->
  1759. <script>
  1760. function f_attribute_Textgroup(my) {
  1761. Attribute_my = my
  1762. Attribute_layer_id = layer.open({
  1763. title: '请选择 图标',
  1764. type: 1,
  1765. area: [($(window).width() * 0.9) + 'px', ($(window).height() - 50) + 'px'],
  1766. fix: false, //不固定
  1767. maxmin: false,
  1768. content: $('#open_layer_Data_List'),
  1769. shadeClose: true,
  1770. anim: 1,
  1771. shade: 0.4,
  1772. isOutAnim: false,
  1773. scrollbar: false,
  1774. });
  1775. // 更新列表
  1776. $('#open_layer_Data_List').html("")
  1777. for (let i = 0; i < ConfigImg_List.length; i++) {
  1778. $('#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\">")
  1779. }
  1780. }
  1781. function f_attribute_ConfigText_choice(id) {
  1782. 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
  1783. console.log($(Attribute_my))
  1784. $(Attribute_my).val(img_str)
  1785. //关闭当前frame
  1786. console.log(Attribute_layer_id)
  1787. layer.close(Attribute_layer_id);
  1788. }
  1789. </script>
  1790. <!--主设备选择-->
  1791. <script>
  1792. f_attribute_Device_List_page = 1
  1793. f_attribute_Device_List_name = ""
  1794. function f_attribute_Device_List(page) {
  1795. f_attribute_Device_List_page = page
  1796. console.log("f_attribute_Device_List_name:",f_attribute_Device_List_name)
  1797. $.ajax({
  1798. type: 'POST',
  1799. url: '../../../Data/Device_Sensor_List',//发送请求
  1800. data: {
  1801. // T_sn: T_sn,
  1802. T_name: f_attribute_Device_List_name,
  1803. // T_class_id: parseInt(T_class_id),
  1804. page: f_attribute_Device_List_page,
  1805. page_z: 30,
  1806. },
  1807. success: function (result) {
  1808. console.log(result)
  1809. if (result.Code == 200) {
  1810. Device_List_r = result.Data.DeviceSensor_lite
  1811. for (let i = 0; i < Device_List_r.length; i++) {
  1812. $('#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' > " +
  1813. "<div>SN:"+Device_List_r[i].T_sn+"["+Device_List_r[i].T_id+"]" +"</div>"+
  1814. Device_List_r[i].T_name+
  1815. "</div>")
  1816. }
  1817. } else {
  1818. layer.msg('获取主设备失败!');
  1819. }
  1820. }
  1821. });
  1822. }
  1823. function f_attribute_Device(my,duo) {
  1824. Attribute_my = my
  1825. Attribute_layer_id = layer.open({
  1826. title: '请选择 设备',
  1827. type: 1,
  1828. area: ['385px', ($(window).height() - 150) + 'px'],
  1829. fix: false, //不固定
  1830. maxmin: false,
  1831. content: $('#open_layer_Data_List'),
  1832. shadeClose: true,
  1833. anim: 1,
  1834. shade: 0.4,
  1835. isOutAnim: false,
  1836. scrollbar: true
  1837. });
  1838. $(".layui-layer-content").scroll(function () {
  1839. var scrollTop = $(this).scrollTop();
  1840. var scrollHeight = $("#open_layer_Data_List").height();
  1841. var windowHeight = $(this).height();
  1842. // console.log("scrollTop:",scrollTop," scrollHeight:",scrollHeight," windowHeight:",windowHeight)
  1843. if (scrollTop + windowHeight > scrollHeight) {
  1844. f_attribute_Device_List_page += 1
  1845. f_attribute_Device_List(1)
  1846. // alert('滑动到底部了')
  1847. }
  1848. });
  1849. // $('#open_layer_Data_List').css("height",($(window).height() - 150) + 'px')
  1850. f_attribute_Device_list_init()
  1851. }
  1852. function f_attribute_Device_list_init() {
  1853. f_attribute_Device_List_name = $("#D_Name").val()
  1854. // 更新列表
  1855. $('#open_layer_Data_List').html(" " +
  1856. "<div style='user-select: auto;' class=\"layui-input-block\">\n" +
  1857. " <input id='D_Name' type=\"text\" name=\"title\" required placeholder=\"请输入 名称\" autocomplete=\"off\" class=\"layui-input\"> " +
  1858. " <button class=\"layui-btn\" onclick='f_attribute_Device_list_init()'>搜索</button> \n" +
  1859. "</div>")
  1860. f_attribute_Device_List(1)
  1861. }
  1862. function f_attribute__Device_choice(sn,id,duo) {
  1863. console.log($(Attribute_my))
  1864. if(duo.length > 0){
  1865. $(Attribute_my).val($(Attribute_my).val() + sn + "-" + id+ "" + duo )
  1866. }else {
  1867. $(Attribute_my).val(sn + "-" + id )
  1868. }
  1869. //关闭当前frame
  1870. console.log(Attribute_layer_id)
  1871. layer.close(Attribute_layer_id);
  1872. }
  1873. </script>
  1874. <!--主设备 通道 选择-->
  1875. <script>
  1876. function f_attribute_DeviceCh(my,value_map) {
  1877. // S_sn = $("#S_sn_sn").val()
  1878. // console.log("S_sn:",S_sn)
  1879. // if(S_sn == "[-{sn}-]"){
  1880. // console.log("value_map:",value_map)
  1881. // S_sn = value_map
  1882. // }
  1883. //
  1884. // if(S_sn == undefined){
  1885. // alert("主设备(SN)参数异常,如果是全局SN,请先配置 层 SN参数!")
  1886. // return
  1887. // }
  1888. //
  1889. // if(!Device_List_map.has(S_sn)){ //判断映射是否存在
  1890. // alert("没有找到 主设备(SN) "+S_sn)
  1891. // }
  1892. Attribute_my = my
  1893. // console.log("S_sn:",S_sn)
  1894. Attribute_layer_id = layer.open({
  1895. title: '请选择 设备',
  1896. type: 1,
  1897. area: ['315px', ($(window).height() - 150) + 'px'],
  1898. fix: false, //不固定
  1899. maxmin: false,
  1900. content: $('#open_layer_Data_List'),
  1901. shadeClose: true,
  1902. anim: 1,
  1903. shade: 0.4,
  1904. isOutAnim: false,
  1905. scrollbar: false,
  1906. });
  1907. // 更新列表
  1908. $('#open_layer_Data_List').html("")
  1909. $('#open_layer_Data_List').append("<div id='attribute_ProductValue_List' style='padding: 4px;margin: 5px;border:1px solid #ececec;' > </div>")
  1910. f_attribute_DeviceCh_ProductValue_List()
  1911. }
  1912. function f_attribute_DeviceCh_ProductValue_List() {
  1913. // $.ajax({
  1914. // type: 'POST',
  1915. // url: '../../DeviceCh/DeviceCh_List',//发送请求
  1916. // data: {
  1917. // T_sn: T_sn,
  1918. // page: 1,
  1919. // page_z: 9999,
  1920. // },
  1921. // success: function (result) {
  1922. // console.log(result)
  1923. // if (result.Code == 200) {
  1924. //
  1925. // } else {
  1926. // layer.msg('获取主设备失败!');
  1927. // }
  1928. // }
  1929. // });
  1930. T_tab_list = []
  1931. T_tab_list.push({
  1932. T_tab:"T_sn",
  1933. T_name:"设备SN"
  1934. })
  1935. T_tab_list.push({
  1936. T_tab:"T_id",
  1937. T_name:"传感器ID"
  1938. })
  1939. T_tab_list.push({
  1940. T_tab:"T_name",
  1941. T_name:"设备名称"
  1942. })
  1943. T_tab_list.push({
  1944. T_tab:"T_t",
  1945. T_name:"温度"
  1946. })
  1947. T_tab_list.push({
  1948. T_tab:"T_rh",
  1949. T_name:"湿度"
  1950. })
  1951. T_tab_list.push({
  1952. T_tab:"T_Tlower",
  1953. T_name:"最低温度"
  1954. })
  1955. T_tab_list.push({
  1956. T_tab:"T_Tupper",
  1957. T_name:"最高温度"
  1958. })
  1959. T_tab_list.push({
  1960. T_tab:"T_RHlower",
  1961. T_name:"最低湿度"
  1962. })
  1963. T_tab_list.push({
  1964. T_tab:"T_RHupper",
  1965. T_name:"最高湿度"
  1966. })
  1967. T_tab_list.push({
  1968. T_tab:"T_Site",
  1969. T_name:"经纬度"
  1970. })
  1971. T_tab_list.push({
  1972. T_tab:"T_Dattery",
  1973. T_name:"电量"
  1974. })
  1975. T_tab_list.push({
  1976. T_tab:"T_monitor",
  1977. T_name:"监控状态"
  1978. })
  1979. T_tab_list.push({
  1980. T_tab:"T_time",
  1981. T_name:"时间"
  1982. })
  1983. for (let i = 0; i < T_tab_list.length; i++) {
  1984. $('#attribute_ProductValue_List').append("<div style='padding: 4px;margin: 5px;border:1px solid #ececec;' > " +
  1985. "<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>"+
  1986. // "<span onclick='f_attribute_DeviceCh_Tab_choice(" + result.Data[i].T_tab+"_"+ch_i + ")' style='float: right;color: #ff0300' >"+">>属性 </span>"+
  1987. "</div>")
  1988. }
  1989. }
  1990. function f_attribute_DeviceCh_Tab_choice(tab) {
  1991. console.log($(Attribute_my))
  1992. $(Attribute_my).val(tab )
  1993. //关闭当前frame
  1994. console.log(Attribute_layer_id)
  1995. layer.close(Attribute_layer_id);
  1996. }
  1997. </script>
  1998. <!--颜色选择-->
  1999. <script src="{{.OSS_Static}}/panel/colorpicker.js"></script>
  2000. <script type="text/javascript">
  2001. // 编辑框
  2002. function f_attribute_color(my) {
  2003. Attribute_my = my
  2004. console.log("Attribute_my:",Attribute_my)
  2005. Colorpicker.create({
  2006. el: Attribute_my.id, //元素id
  2007. color: $(Attribute_my).val(), //默认颜色
  2008. change: function (elem, hex) {
  2009. console.log(hex)
  2010. //选中颜色发生改变时事件
  2011. // elem.style.backgroundColor = hex;
  2012. $(Attribute_my).val(hex)
  2013. $(Attribute_my).css("backgroundColor",hex)
  2014. }
  2015. })
  2016. }
  2017. // 组件背景
  2018. function f_assembly_bcolor(curNum) {
  2019. layer.open({
  2020. title:"调色板",
  2021. type: 1,
  2022. content: '<div id=\'f_assembly_bcolor\' style="width: 200px;height: 40px;background-color: '+curNum.css('background-color')+'" > </div>' //这里content是一个普通的String
  2023. });
  2024. Attribute_my = document.getElementById("f_assembly_bcolor")
  2025. console.log("Attribute_my:",Attribute_my)
  2026. Colorpicker.create({
  2027. el: Attribute_my.id, //元素id
  2028. color: curNum.css('background-color'), //默认颜色
  2029. change: function (elem, hex) {
  2030. console.log(hex)
  2031. //选中颜色发生改变时事件
  2032. elem.style.backgroundColor = hex;
  2033. // $(Attribute_my).val(hex)
  2034. curNum.css('background-color', hex);
  2035. }
  2036. })
  2037. }
  2038. </script>
  2039. <!--图片选择-->
  2040. <script type="text/javascript">
  2041. // 图片 回调函数
  2042. function f_attribute_img(my) {
  2043. $('#UpLoadFile').click();
  2044. F_c = function(up_url) {
  2045. $(my).val(up_url)
  2046. }
  2047. }
  2048. </script>
  2049. <!--远程执行-->
  2050. <script>
  2051. // var Data_Write_Map = new Map();
  2052. // // 执行 V_id 标识出发位置,用来 反馈执行结果
  2053. // function f_Data_Write(V_id,T_sn,T_tab,T_value) {
  2054. // $.ajax({
  2055. // type: 'POST',
  2056. // url: '../../Device/Data_Write',//发送请求
  2057. // async: false,
  2058. // data: {
  2059. // T_sn:T_sn,
  2060. // T_tab:T_tab,
  2061. // T_value:T_value,
  2062. // },
  2063. // success: function(result) {
  2064. // console.log(result)
  2065. // pubSub.publish(T_sn+'/'+T_tab, T_value);
  2066. // f_Public_Value_set(T_sn+'/'+T_tab, T_value) //同步缓存数据
  2067. //
  2068. // Data_Write_Map.set(result.Data,{V_id:V_id,Munm:1});
  2069. // }
  2070. // });
  2071. // }
  2072. // setInterval(function(){
  2073. // // 遍历
  2074. // $(".Mid").remove() // 清空
  2075. // for(let [Mid,v] of Data_Write_Map) {
  2076. // console.log("Mid:", Mid,v);
  2077. // Data_Write_Map.set(Mid,{V_id:v.V_id,Munm:v.Munm + 1});
  2078. // if(v.Munm > 3 && v.Munm < 20 && v.Munm % 2 == 0){
  2079. // $("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>')
  2080. // }
  2081. //
  2082. // if(v.Munm > 10){
  2083. // Del_Mid(Mid)
  2084. // }
  2085. // }
  2086. // },1000);
  2087. //
  2088. //
  2089. // function Del_Mid(Mid) {
  2090. // if(Data_Write_Map.has(Mid)){ //判断映射是否存在
  2091. // // console.log("delete:",Data_Write_Map.get(Data_Write_Map))
  2092. // Data_Write_Map.delete(Mid);
  2093. // }
  2094. // }
  2095. //
  2096. // function Err_Mid(Mid) {
  2097. // // if(Data_Write_Map.has(Mid)){ //判断映射是否存在
  2098. // // console.log(Data_Write_Map.get(Data_Write_Map))
  2099. // // }
  2100. // }
  2101. </script>
  2102. <script>
  2103. function BrowserType()
  2104. {
  2105. var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
  2106. var isOpera = userAgent.indexOf("Opera") > -1; //判断是否Opera浏览器
  2107. var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera; //判断是否IE浏览器
  2108. var isEdge = userAgent.indexOf("Windows NT 6.1; Trident/7.0;") > -1 && !isIE; //判断是否IE的Edge浏览器
  2109. var isFF = userAgent.indexOf("Firefox") > -1; //判断是否Firefox浏览器
  2110. var isSafari = userAgent.indexOf("Safari") > -1 && userAgent.indexOf("Chrome") == -1; //判断是否Safari浏览器
  2111. var isChrome = userAgent.indexOf("Chrome") > -1 && userAgent.indexOf("Safari") > -1; //判断Chrome浏览器
  2112. if (isIE)
  2113. {
  2114. var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
  2115. reIE.test(userAgent);
  2116. var fIEVersion = parseFloat(RegExp["$1"]);
  2117. return {name:"IE",num: fIEVersion};
  2118. }//isIE end
  2119. if (isFF) { return {name:"FF",num: "FF"};}
  2120. if (isOpera) { return {name:"Opera",num: "Opera"};}
  2121. if (isSafari) { return {name:"Safari",num: "Safari"};}
  2122. if (isChrome) { return {name:"Chrome",num: "Chrome"};}
  2123. if (isEdge) { return {name:"Edge",num: "Edge"};}
  2124. }
  2125. Browser = BrowserType();
  2126. </script>
  2127. </body>
  2128. </html>
  2129. <!-- 通讯协议标准
  2130. 头:sn+ch 如: A0000001v_xx_1
  2131. v_xx_1 : 值
  2132. v_xx_1-img : 对应图片
  2133. v_xx_1-color : 对应颜色
  2134. v_xx_1-bimg : 对应图片
  2135. v_xx_1-bcolor : 对应颜色
  2136. -->