image.html 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071
  1. {% load staticfiles %}
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head>
  5. <meta charset="UTF-8" />
  6. <link href="{% static '/lib/bootstrap-3.3.7/css/bootstrap.css' %}" rel="stylesheet">
  7. <link rel="stylesheet" href="{% static '/lib/font-awesome/4.5.0/css/font-awesome.css' %}">
  8. <link rel="stylesheet" href="{% static '/lib/css/ace.min.css' %}" />
  9. <link rel="stylesheet" href="{% static '/lib/css/ace-skins.min.css' %}">
  10. <link rel="stylesheet" href="{% static '/lib/css/ace-rtl.min.css' %}">
  11. <link rel="stylesheet" href="{% static '/lib/layui/css/layui.css' %}">
  12. <link rel="stylesheet" href="{% static '/css/loading.css' %}?versions=0.5.4" />
  13. <!-- <link href="{% static '/lib/css/magnific-popup.css' %}" rel="stylesheet" type="text/css" media="all" /> -->
  14. <link rel="stylesheet" href="{% static '/lib/css/viewer.css' %}">
  15. <link rel="stylesheet" href="{% static '/css/loading.css' %}?versions=0.5.4" />
  16. <style>
  17. body {
  18. /* background: #fff; */
  19. background-color: #fff;
  20. overflow: hidden;
  21. }
  22. .clearfix:before,
  23. .clearfix:after {
  24. display: table;
  25. line-height: 0;
  26. content: ""
  27. }
  28. .clearfix:after {
  29. clear: both
  30. }
  31. .fl {
  32. float: left;
  33. }
  34. .fr {
  35. float: right;
  36. }
  37. .mfp-bottom-bar {
  38. color: #fff;
  39. }
  40. a {
  41. text-decoration: none !important;
  42. }
  43. /* 图片列表 */
  44. #imgList{
  45. display: flex;
  46. flex-wrap: wrap;
  47. }
  48. .imgParent{
  49. position: relative;
  50. width: 400px;
  51. text-align: center;
  52. margin-top: 20px;
  53. }
  54. .popupA{
  55. width: 300px;
  56. margin: 0 auto;
  57. }
  58. .imgParent:hover span {
  59. display: block;
  60. }
  61. .imgParent .delBtn {
  62. display: none;
  63. position: absolute;
  64. top: 10px;
  65. right: 58px;
  66. cursor: pointer;
  67. background: url(../static/img/delIcon.png);
  68. width: 25px;
  69. height: 25px;
  70. background-size: cover;
  71. }
  72. .popupA img {
  73. width: 300px;
  74. height: 300px;
  75. cursor: pointer;
  76. }
  77. .imgParent a,
  78. .popupA p {
  79. color: #08c;
  80. padding: 10px;
  81. }
  82. /* 配置 */
  83. #lookDescribe {
  84. max-width: 700px;
  85. }
  86. .white-popup {
  87. position: relative;
  88. background: #FFF;
  89. padding: 20px;
  90. width: auto;
  91. /* margin: 20px auto; */
  92. }
  93. .white-popup h1 {
  94. font-size: 20px;
  95. /* margin: 10px 0; */
  96. color: #006dcc;
  97. line-height: 15px;
  98. }
  99. .pupopTitle {
  100. width: 140px;
  101. text-align: right;
  102. vertical-align: middle;
  103. /* margin-top: 7px; */
  104. line-height: 30px;
  105. }
  106. .pupopBody input,
  107. .pupopBody select {
  108. padding: 4px 6px;
  109. margin-bottom: 10px;
  110. font-size: 14px;
  111. line-height: 20px;
  112. color: #4a4a4a;
  113. background: #fff;
  114. border: 1px solid #ccc;
  115. vertical-align: middle;
  116. width: 200px;
  117. }
  118. .pupopBody select,
  119. .pupopBody input {
  120. height: 30px;
  121. width: 215px;
  122. /* line-height: 30px; */
  123. cursor: pointer;
  124. border: 1px solid #ccc;
  125. }
  126. .btnParent {
  127. text-align: center;
  128. }
  129. .btnParent input {
  130. color: #fff;
  131. text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
  132. background-color: #006dcc;
  133. width: 80px;
  134. height: 30px;
  135. border-radius: 3px;
  136. border: none;
  137. cursor: pointer;
  138. margin: 5px 17px;
  139. }
  140. .btnParent input:hover {
  141. color: #fff;
  142. background-color: #04c;
  143. }
  144. .nullData {
  145. width: 100%;
  146. height: 500px;
  147. background: #ddd;
  148. text-align: center;
  149. line-height: 500px;
  150. font-size: 20px;
  151. border: 1px solid #ddd;
  152. }
  153. #wormDetails {
  154. width: 100%;
  155. text-align: center;
  156. line-height: 30px;
  157. }
  158. #wormDetails tr {
  159. border-bottom: 1px solid #e6e6e6;
  160. /* line-height: 40px; */
  161. }
  162. #wormDetails input {
  163. width: 80%;
  164. text-align: center;
  165. }
  166. .saveBtn {
  167. display: none;
  168. }
  169. #addwormType,
  170. #delwormType {
  171. display: none;
  172. }
  173. #delwormType .pupopBody {
  174. width: 340px;
  175. font-size: 0;
  176. }
  177. #addwormType h2,
  178. #delwormType h2 {
  179. font-size: 16px;
  180. text-indent: 30px;
  181. color: #006dcc;
  182. }
  183. .my_protocol {
  184. line-height: 30px;
  185. display: inline-block;
  186. width: 169px;
  187. overflow: hidden;
  188. white-space: nowrap;
  189. text-overflow: ellipsis;
  190. }
  191. .my_protocol .input_agreement_protocol {
  192. appearance: none;
  193. -webkit-appearance: none;
  194. outline: none;
  195. display: none;
  196. }
  197. /*未选中时*/
  198. .my_protocol .input_agreement_protocol+span {
  199. cursor: pointer;
  200. width: 16px;
  201. height: 16px;
  202. background-color: red;
  203. display: inline-block;
  204. background: url(../static/img/checkboxBj.png) no-repeat;
  205. background-position-x: 0px;
  206. background-position-y: 0px;
  207. position: relative;
  208. top: 3px;
  209. margin-right: 3px;
  210. }
  211. /*选中checkbox时,修改背景图片的位置*/
  212. .my_protocol .input_agreement_protocol:checked+span {
  213. background-position: -19px 0px
  214. }
  215. /* 图片列表批量删除复选框样式 */
  216. .imgcheckbox input[type='checkbox']+span {
  217. cursor: pointer;
  218. width: 18px;
  219. height: 18px;
  220. background-color: red;
  221. display: inline-block;
  222. background: url(/static/img/tick.png) no-repeat center;
  223. background-position: -19px 0px;
  224. position: relative;
  225. top: 3px;
  226. border: 1px solid #bbb;
  227. }
  228. .imgcheckbox input[type='checkbox']:checked+span {
  229. background-position-x: 3px;
  230. background-position-y: 3px;
  231. }
  232. .imgcheckbox input {
  233. display: none;
  234. }
  235. .imgcheckbox {
  236. display: none;
  237. position: absolute;
  238. right: 19px;
  239. top: 0px;
  240. }
  241. .searchCover {
  242. margin: 20px 0;
  243. }
  244. .delbox {
  245. text-align: right;
  246. }
  247. .canceldelimgBtn {
  248. display: none;
  249. }
  250. /* 自动识别虫害 */
  251. /* .wormImg{
  252. width: 150px;
  253. float: left;
  254. margin-top: 20px;
  255. margin-right: 10px;
  256. }
  257. .wormIcon{
  258. float: left;
  259. margin-top: -5px;
  260. margin-right: 10px;
  261. font-size: 26px;
  262. color: #f1d300;
  263. /* color: #bd0606;
  264. }
  265. .wormName{
  266. text-align: center;
  267. line-height: 30px !important;
  268. }
  269. .synopsis{
  270. line-height: 23px;
  271. min-height: 100px;
  272. } */
  273. /* 自动识别2 */
  274. .wormImgTag>img {
  275. width: 100%;
  276. height: 680px;
  277. }
  278. .wormResult {
  279. /* margin-left: 140px;
  280. width: 75%;*/
  281. line-height: 28px;
  282. width: 520px;
  283. }
  284. .wormResult>span {
  285. width: 50%;
  286. display: inline-block;
  287. }
  288. .wormResult>span i {
  289. font-style: normal;
  290. color: #cf0000;
  291. font-weight: 600;
  292. }
  293. .wormResult>span i:hover {
  294. color: #006dcc;
  295. }
  296. .clear {
  297. clear: both;
  298. }
  299. .wormIcon {
  300. float: left;
  301. margin-top: -5px;
  302. margin-right: 10px;
  303. font-size: 26px;
  304. color: #f1d300;
  305. }
  306. .resultTitle {
  307. font-size: 16px;
  308. margin: 5px 0;
  309. border-left: 4px solid #006dcc;
  310. padding-left: 6px;
  311. font-weight: 600;
  312. }
  313. /* 顶部位置 */
  314. .page-header>h1,
  315. .searchCover {
  316. width: 48%;
  317. display: inline-block;
  318. }
  319. /* 模拟查看数据 */
  320. .imgParent .simulation {
  321. padding: 0;
  322. }
  323. .simulation {
  324. display: none;
  325. }
  326. .resultLookGitImg {
  327. float: right;
  328. margin-bottom: 10px;
  329. margin-left: 45px;
  330. }
  331. #bindSim{
  332. display: none;
  333. }
  334. #bindSim>div {
  335. text-align: center;
  336. }
  337. #bindSim>.hint {
  338. line-height: 100px;
  339. font-size: 16px;
  340. color: #333;
  341. }
  342. .layui-layer {
  343. border-radius: 10px;
  344. overflow: hidden;
  345. }
  346. #failure{
  347. display: none;
  348. text-align: center;
  349. }
  350. #failure >div{
  351. margin: 15px;
  352. }
  353. #wormDetails th{
  354. text-align: center;
  355. }
  356. #test-popup,#lookDescribe,#autoDiscern{
  357. display: none;
  358. }
  359. .layui-layer-skin .layui-layer-padding{
  360. padding: 50px;
  361. }
  362. .layui-layer-skin .layui-layer-content .layui-layer-ico{
  363. top: 47px;
  364. }
  365. #rainControl{
  366. display: none;
  367. }
  368. #rainControl>div {
  369. text-align: center;
  370. }
  371. #rainControl>.hint {
  372. line-height: 100px;
  373. font-size: 16px;
  374. color: #333;
  375. }
  376. #rainControl>.hint {
  377. line-height: 100px;
  378. font-size: 16px;
  379. color: #333;
  380. }
  381. #hide {
  382. display: none;
  383. }
  384. .rainControltxt {
  385. color: red;
  386. font-size: 20px;
  387. font-weight: 550;
  388. }
  389. .wormBox {
  390. display: flex;
  391. }
  392. .dataListA {
  393. margin: 0 0 0 35px;
  394. width: 395px;
  395. }
  396. .dataListB {
  397. width: 80%;
  398. }
  399. .dataNums {
  400. width: 120px !important;
  401. }
  402. .layui-layer-page .layui-layer-content {
  403. overflow: hidden;
  404. }
  405. </style>
  406. </head>
  407. <body>
  408. <div class="content">
  409. <input type="hidden" name="" value="{{disc}}" id="discern">
  410. <div class="page-header">
  411. <span class="headerPlace" onclick="goback()">
  412. <img src="{% static '/img/gobackIcon.png' %}" alt="">返回
  413. </span>
  414. <!-- 操作 -->
  415. <div class="delbox" style="float: right;">
  416. <button type="button" onclick="popupFrame('ctrl','takephoto','')" class="btn btn-sm btn-warning">拍照</button>
  417. <button type="button" onclick="reload()" class="btn btn-sm btn-success">刷新</button>
  418. {% if role == "superuser" or role == "staff" %}
  419. <button type="button" onclick="akeyGatherFun()" id="akeyDelete" class="btn btn-sm">一键搜集</button>
  420. <button type="button" onclick="delimgAll(this)" class="btn btn-sm btn-primary batchesBtn">批量删除</button>
  421. <!-- <button type="button" onclick="delimgAll(this)" class="btn btn-sm btn-primary batchesBtn">批量删除</button> -->
  422. <button type="button" onclick="canceldelimg(this)" id="canceldel" class="btn btn-sm canceldelimgBtn">取消</button>
  423. <button type="button" onclick="akeyDeleteFun()" id="akeyDelete" class="btn btn-sm">一键删除</button>
  424. {% endif %}
  425. </div>
  426. </div>
  427. <div class="timeSelect">
  428. 时间段查询:
  429. <input type="text" value="" class="fp-user" id="timSelectBox" autocomplete="off" placeholder="时间段查询" onkeypress="if (event.keyCode == 13) img_filter();"
  430. />
  431. <input type="hidden" id="begin">
  432. <input type="hidden" id="end">
  433. <button type="button" onclick="img_filter()" class="btn btn-sm btn-primary">筛选</button>
  434. </div>
  435. <input type="hidden" value="{{simid|default_if_none:""}}" id="simid">
  436. <input type="hidden" value="{{dver}}" id="dver">
  437. <!-- 图片列表 -->
  438. <div class="content-body" id="imgList">
  439. </div>
  440. <div class="fenpei-bottom">
  441. <input type="hidden" id="imei" value="{{imei}}">
  442. <input type="hidden" id="totalPage" value={{ nums }}>
  443. <div id="page" style="text-align: center;"></div>
  444. </div>
  445. <!-- 添加详情 -->
  446. <div id="test-popup" class="white-popup mfp-hide">
  447. <!-- <h1>添加详情</h1>
  448. <hr/> -->
  449. <form action="" id="pupopForm">
  450. <input type="hidden" value="" id="imgPath">
  451. <input type="hidden" value="" id="photo_time">
  452. <div class="pupopBox clearfix">
  453. <div class="fl pupopTitle">害虫名称:</div>
  454. <div class="fl pupopBody">
  455. <!-- <input type="text" value="" name="wormName"> -->
  456. <select name="wormName" id=""></select>
  457. <img src="{% static '/img/addicon.png' %}" id="addNameBtn" alt="" onclick="addNameBox()" title="添加害虫种类" width="28" style="margin-bottom: 10px;cursor: pointer;">
  458. <img src="{% static '/img/subtract.png' %}" id="delNameBtn" alt="" onclick="delNameBox()" title="删除害虫种类" width="28" style="margin-bottom: 10px;cursor: pointer;">
  459. </div>
  460. </div>
  461. <div class="pupopBox clearfix">
  462. <div class="fl pupopTitle">数量:</div>
  463. <div class="fl pupopBody">
  464. <input type="number" value="0" min="0" name="wormNum">
  465. </div>
  466. </div>
  467. <div class="pupopBox clearfix">
  468. <div class="fl pupopTitle">作物种类:</div>
  469. <div class="fl pupopBody">
  470. <input type="text" value="" placeholder="选填项" name="wormKind">
  471. </div>
  472. </div>
  473. <!-- <div class="pupopBox clearfix">
  474. <div class="fl pupopTitle">雌雄:</div>
  475. <div class="fl pupopBody">
  476. <select name="wormSex" id="">
  477. <option value="0">雌</option>
  478. <option value="1">雄</option>
  479. </select>
  480. </div>
  481. </div> -->
  482. <div class="pupopBox clearfix">
  483. <div class="fl pupopTitle">虫害阶段:</div>
  484. <div class="fl pupopBody">
  485. <input type="text" value="" placeholder="选填项" name="wormTime">
  486. </div>
  487. </div>
  488. <div class="btnParent">
  489. <input type="button" id='saveBtn' onclick="savePopWin()" value="保存">
  490. <input type="button" id='cancelBtn' onclick="closePopWin($(this))" value="取消">
  491. </div>
  492. </form>
  493. <!-- 添加害虫种类 -->
  494. <div id="addwormType">
  495. <h2>添加害虫种类</h2>
  496. <form action="" class="">
  497. <div class="pupopBox clearfix">
  498. <div class="fl pupopTitle">害虫名称:</div>
  499. <div class="fl pupopBody">
  500. <input type="text" maxlength="20" value="" name="wormTypeSelect">
  501. <!-- <img src="{% static '/img/addicon.png' %}" alt="" onclick="goBackAddDetial()" title="返回添加" width="28"> -->
  502. </div>
  503. </div>
  504. <div class="btnParent">
  505. <input type="button" id='saveBtn' onclick="saveWormType()" value="保存">
  506. <input type="button" id='cancelBtn' onclick="goBackAddDetial()" value="取消">
  507. </div>
  508. </form>
  509. </div>
  510. <!-- 删除害虫种类 -->
  511. <div id="delwormType">
  512. <h2>删除害虫种类</h2>
  513. <form action="" class="">
  514. <div class="pupopBox clearfix">
  515. <div class="fl pupopTitle">害虫名称:</div>
  516. <div class="fr pupopBody"></div>
  517. </div>
  518. <div class="btnParent">
  519. <input type="button" id='saveBtn' onclick="saveDelWormType()" value="确定">
  520. <input type="button" id='cancelBtn' onclick="goBackAddDetial()" value="取消">
  521. </div>
  522. </form>
  523. </div>
  524. </div>
  525. <!-- 查看描述 -->
  526. <div id="lookDescribe" class="white-popup mfp-hide">
  527. <!-- <h1>虫害详情</h1>
  528. <br /> -->
  529. <form action="">
  530. <input type="hidden" value="" id="imgPath_dteial">
  531. <table id="wormDetails" class="table table-striped table-hover">
  532. <tr>
  533. <th>害虫名称</th>
  534. <th>数量</th>
  535. <th>作物种类</th>
  536. <th>虫害阶段</th>
  537. <th style="width:110px">操作</th>
  538. </tr>
  539. <!-- <tr>
  540. <td class="option">大蛾子</td>
  541. <td class="option">12</td>
  542. <td class="option">花生地</td>
  543. <td class="option">大</td>
  544. <td>
  545. <button type="button" class="btn editBtn btn-primary" onclick="edit($(this))">编辑</button>
  546. <button type="button" class="btn saveBtn btn-success" onclick="save($(this))">保存</button>
  547. <button type="button" class="btn delBtn btn-danger">删除</button>
  548. </td>
  549. </tr> -->
  550. </table>
  551. </form>
  552. </div>
  553. <!-- 添加病虫种类 -->
  554. <!-- <div id="addwormType" class="white-popup mfp-hide">
  555. <h1>害虫种类</h1>
  556. <form action="" class="">
  557. <div class="pupopBox clearfix">
  558. <div class="fl pupopTitle">病虫名称:</div>
  559. <div class="fl pupopBody">
  560. <input type="text" value="" name="wormTypeSelect">
  561. </div>
  562. </div>
  563. <div class="btnParent">
  564. <input type="button" id='saveBtn' onclick="saveWormType()" value="保存">
  565. <input type="button" id='cancelBtn' onclick="closePopWin($(this))" value="取消">
  566. </div>
  567. </form>
  568. </div> -->
  569. <!-- 自动识别 -->
  570. <div id="autoDiscern" class="white-popup mfp-hide">
  571. <!-- <h1>害虫计数</h1>
  572. <hr> -->
  573. <input type="hidden" value="" id="currImgPath">
  574. <div class="wormBox">
  575. </div>
  576. </div>
  577. <!-- 失败识别 -->
  578. <div id="failure">
  579. <div>
  580. <img src="{% static 'img/failureIcon.png'%}" alt="">
  581. </div>
  582. <p>未能识别此昆虫,努力开发中</p>
  583. </div>
  584. <!-- 版本5HK的加上SIM卡绑定提示 -->
  585. <div id="bindSim">
  586. <div class="hint">此设备还未绑定SIM卡,请先绑定SIM卡。</div>
  587. <div>
  588. <button class="layui-btn layui-btn-radius layui-btn-normal" onclick="binding()">立即绑定</button>
  589. <button class="layui-btn layui-btn-radius layui-btn-primary" onclick="closeSim()">稍后再来</button>
  590. </div>
  591. </div>
  592. <!-- loading -->
  593. <div id="loadingParent">
  594. <div id="loadCenter">
  595. <div class="skype-loader">
  596. <div class="dot">
  597. <div class="first"></div>
  598. </div>
  599. <div class="dot"></div>
  600. <div class="dot"></div>
  601. <div class="dot"></div>
  602. </div>
  603. Logging in...
  604. </div>
  605. </div>
  606. {% if rain == "1" %}
  607. <div id="rainControl">
  608. <div id="hide">111</div>
  609. <div class="hint">该设备近日触发<span class="rainControltxt">雨控</span>(雨控保护状态下设备<span class="rainControltxt">不拍照</span>)</div>
  610. <div>
  611. <button class="layui-btn layui-btn-radius layui-btn-normal" onclick="rainControl()">确定</button>
  612. </div>
  613. </div>
  614. {% else %}
  615. <div id="hide">000</div>
  616. {% endif %}
  617. <input type="hidden" name="" value="{{rain}}" id="rain">
  618. </div>
  619. <script src="{% static '/lib/js/jquery-2.1.4.min.js' %}"></script>
  620. <script src="{% static '/lib/layui/layui.all.js' %}"></script>
  621. <script src="{% static '/lib/js/viewer.js' %}"></script>
  622. <script type="text/javascript">
  623. $.ajaxSetup({
  624. data: { csrfmiddlewaretoken: '{{ csrf_token }}' },
  625. });
  626. </script>
  627. <script src="{% static '/js/reportmanage/cbd_image.js' %}?versions=0.5.4"></script>
  628. <script>
  629. console.log($('#dver').val())
  630. if ($('#dver').val().indexOf('HK') != -1) {
  631. if($('#simid').val() == ''){
  632. layui.use('layer', function () {
  633. var layer = layui.layer;
  634. layer.open({
  635. type: 1,
  636. title: '提示',
  637. area: ['400px', '200px'],
  638. content: $('#bindSim')
  639. });
  640. });
  641. }
  642. }
  643. function binding() {
  644. var sidebar = $('#sidebar', parent.document);
  645. var menuLi = sidebar.find('.nav-list.nav').children();
  646. menuLi.each(function (idx, val) {
  647. console.log($(val))
  648. $(val).removeClass('open');
  649. $(val).find('ul').removeClass('nav-show').hide();
  650. $(val).removeClass('active');
  651. $(val).children('ul').children().removeClass('active');
  652. if ($(val).children('a').find('.menu-text').html() == '设备管理') {
  653. $(val).addClass('active');
  654. $(val).addClass('open');
  655. $(val).children('ul').removeClass('nav-hide').addClass('nav-show').show();
  656. $(val).children('ul').children().each(function (index, obj) {
  657. if ($(obj).find('.menu-text').html() == '虫情测报') {
  658. $(obj).addClass('active');
  659. }
  660. })
  661. }
  662. })
  663. location.href = 'equipmanage_cbd_detail?id='+$('#imei').val()
  664. }
  665. function closeSim() {
  666. layer.closeAll();
  667. }
  668. // 查看详情 编辑
  669. var initial = [];
  670. function edit(obj) {
  671. if ($('#wormDetails .saveBtn.current').length == 1) {
  672. layer.msg('正在编辑中');
  673. } else {
  674. initial = [];
  675. obj.hide().next().show();
  676. var parent = obj.parents('tr');
  677. var option = parent.find('.option');
  678. option.each(function () {
  679. var txt = $(this).html();
  680. initial.push(txt);
  681. var html = '<input type="text" value="' + txt + '">';
  682. $(this).html(html);
  683. })
  684. }
  685. $('#wormDetails .saveBtn').removeClass('current');
  686. obj.next().addClass('current');
  687. console.log('旧的', initial)
  688. }
  689. //查看详情 保存
  690. function save(obj) {
  691. obj.hide().prev().show();
  692. var parent = obj.parents('tr');
  693. var option = parent.find('.option');
  694. var wormName = parent.find('.optionName').html();
  695. var dataarr = [];
  696. var addr = $('#imgPath').val();
  697. option.each(function () {
  698. var txt = $(this).find('input').val();
  699. // var html = txt;
  700. dataarr[$(this).index()] = txt
  701. // $(this).html(html);
  702. })
  703. var data = {
  704. 'pest_name': wormName,
  705. 'pest_num': dataarr[1],
  706. 'crop_name': dataarr[2],
  707. 'pest_case': dataarr[3]
  708. }
  709. $('#wormDetails .saveBtn').removeClass('current');
  710. console.log(data);
  711. var addr = $('#imgPath_dteial').val();
  712. $.ajax({
  713. url: 'cbd_describe_img',
  714. type: 'post',
  715. data: { req: 'change_save', addr: addr, describe: JSON.stringify(data) },
  716. success: function (data) {
  717. if (data == 0) {
  718. //成功
  719. option.each(function () {
  720. var txt = $(this).find('input').val();
  721. var html = txt;
  722. // dataarr[$(this).index()] = txt
  723. $(this).html(html);
  724. })
  725. } else {
  726. //失败
  727. option.each(function () {
  728. var txt = $(this).find('input').val();
  729. var html = txt;
  730. // dataarr[$(this).index()] = txt
  731. $(this).html(initial[$(this).index() - 1]);
  732. })
  733. layer.msg('编辑失败');
  734. }
  735. }
  736. })
  737. }
  738. // 删除
  739. function delItemDetial(obj) {
  740. var parent = obj.parents('tr');
  741. var wormName = parent.find('.optionName').html();
  742. var data = { 'pest_name': wormName };
  743. var addr = $('#imgPath_dteial').val();
  744. $.ajax({
  745. url: 'cbd_describe_img',
  746. type: 'post',
  747. data: { req: 'del_desc', addr: addr, describe: JSON.stringify(data) },
  748. success: function (data) {
  749. if (data == 0) {
  750. //成功
  751. parent.remove();
  752. if ($('#wormDetails tr').length < 2) {
  753. var html = '<tr><td class="nullData" colspan="5">暂无数据</td></tr>'
  754. $("#wormDetails tr:not(:first)").remove();
  755. $('#wormDetails').append(html);
  756. }
  757. } else {
  758. //失败
  759. layer.msg('删除失败');
  760. }
  761. }
  762. })
  763. }
  764. function saveWormType() {
  765. var wormTypeSelect = $('#addwormType').find('input[name="wormTypeSelect"]').val();
  766. if (wormTypeSelect) {
  767. $.ajax({
  768. url: 'cbd_describe_img',
  769. type: 'get',
  770. data: { req: "add_pest", pest: wormTypeSelect },
  771. success: function (data) {
  772. if (data == 2) {
  773. layer.msg('创建名称失败');
  774. } else if (data == 1) {
  775. layer.msg('名称已存在');
  776. } else {
  777. layer.msg('创建名称成功');
  778. setTimeout(function () {
  779. //模拟数据
  780. var msg = $.parseJSON(data);
  781. // var da = [{ "pest_name": "\u641c\u7d22" }, { "pest_name": "\u5927\u86fe\u5b50" }, { "pest_name": "\u5927\u86fe\u5b50" }, { "pest_name": "\u5927\u86fe\u5b50" }, { "pest_name": "\u5927\u86fe\u5b50" }];
  782. $('#pupopForm select[name="wormName"]').empty();
  783. for (var i = 0; i < msg.length; i++) {
  784. var html = "<option value='" + msg[i].pest_name + "'>" + msg[i].pest_name + "</option>"
  785. $('#pupopForm select[name="wormName"]').append(html);
  786. }
  787. goBackAddDetial();
  788. }, 500)
  789. }
  790. }
  791. })
  792. } else {
  793. layer.msg('请填写害虫名称');
  794. }
  795. }
  796. function saveDelWormType() {
  797. var nameData = [];
  798. $("#delwormType input[type='checkbox']:checked").each(function () {
  799. nameData.push($(this).val());
  800. })
  801. if (nameData.length) {
  802. $.ajax({
  803. url: 'cbd_describe_img',
  804. type: 'get',
  805. data: { req: "del_pest", pest: JSON.stringify(nameData) },
  806. success: function (data) {
  807. var msg = $.parseJSON(data);
  808. $('#pupopForm select[name="wormName"]').empty();
  809. for (var i = 0; i < msg.length; i++) {
  810. var html = "<option value='" + msg[i].pest_name + "'>" + msg[i].pest_name + "</option>"
  811. $('#pupopForm select[name="wormName"]').append(html);
  812. };
  813. goBackAddDetial()
  814. }
  815. })
  816. } else {
  817. layer.msg('请至少选择一项');
  818. }
  819. }
  820. //添加名称显示框
  821. function addNameBox() {
  822. $('#addwormType').show();
  823. $('#addwormType').prev().hide();
  824. $('#addwormType').next().hide();
  825. }
  826. function delNameBox() {
  827. $('#addwormType').hide();
  828. $('#addwormType').prev().hide();
  829. $('#addwormType').next().show();
  830. var newPestName = [];
  831. $('#pupopForm option').each(function () {
  832. newPestName.push($(this).html());
  833. })
  834. $('#delwormType .pupopBody').empty();
  835. for (var i = 0; i < newPestName.length; i++) {
  836. var pestName = '<label class="my_protocol">' +
  837. '<input class="input_agreement_protocol" value="' + newPestName[i] + '" type="checkbox">' +
  838. '<span></span>' + newPestName[i] + '</label>';
  839. $('#delwormType .pupopBody').append(pestName);
  840. }
  841. }
  842. //返回添加详情
  843. function goBackAddDetial() {
  844. $('#addwormType').hide();
  845. $('#addwormType').next().hide();
  846. $('#addwormType').prev().show();
  847. $('#addwormType').find('form')[0].reset();
  848. $('#delwormType').find('form')[0].reset();
  849. if ($('#pupopForm option').length >= 180) {
  850. $('#addNameBtn').hide();
  851. } else {
  852. $('#addNameBtn').show();
  853. }
  854. if ($('#pupopForm option').length <= 0) {
  855. $('#delNameBtn').hide();
  856. } else {
  857. $('#delNameBtn').show();
  858. }
  859. }
  860. // 一键搜集图片
  861. function akeyGatherFun(){
  862. //询问框
  863. layer.confirm('是否搜索全部图片?', {
  864. title:'警告信息',
  865. icon: 0,
  866. offset: '200px',
  867. skin: 'layui-layer-skin',
  868. btn: ['确定', '取消'], //按钮
  869. content: '<strong style="color:red">是否搜索全部图片?</strong>'
  870. }, function (index) {
  871. var id = $('#imei').val();
  872. $.ajax({
  873. type: "post",
  874. url: 'collect_photo',
  875. data: {
  876. imei: id
  877. },
  878. success: function (data) {
  879. if (data == 1) {
  880. layer.msg('请稍后刷新查看',{icon:1})
  881. // reload()
  882. } else {
  883. alert('删除失败')
  884. }
  885. }
  886. })
  887. layer.close(index);
  888. }, function () {
  889. });
  890. }
  891. // 一键删除
  892. function akeyDeleteFun(){
  893. //询问框
  894. layer.confirm('确定删除全部图片?', {
  895. title:'警告信息',
  896. icon: 0,
  897. skin: 'layui-layer-skin',
  898. // area:['400px','250px'],
  899. btn: ['确定', '取消'], //按钮
  900. content: '<strong style="color:red">确定删除全部图片?<span style="font-size:18px">此操作不可逆</span></strong>'
  901. }, function (index) {
  902. var id = $('#imei').val();
  903. $.ajax({
  904. type: "post",
  905. url: 'cbd_delete_img',
  906. data: {
  907. imei: id,
  908. allpic:1
  909. },
  910. success: function (data) {
  911. if (data) {
  912. reload()
  913. } else {
  914. alert('删除失败')
  915. }
  916. }
  917. })
  918. layer.close(index);
  919. }, function () {
  920. });
  921. }
  922. // 拍照
  923. function popupFrame(cmd, type, data) {
  924. //询问框
  925. layer.confirm('确定拍照?', {
  926. icon: 3,
  927. btn: ['确定', '取消'] //按钮
  928. }, function (index) {
  929. handleFun(cmd, type, data);
  930. layer.close(index);
  931. }, function () {
  932. });
  933. }
  934. function handleFun(cmd, type, data) {
  935. var id = $('#imei').val();
  936. $.ajax({
  937. type: "post",
  938. url: 'cbd_mqtt',
  939. data: {
  940. "req": "ctrl",//控制
  941. "topicid": id,
  942. "cmd": cmd,//升级 update
  943. "type": type,
  944. "data": data
  945. },
  946. dataType: "json",
  947. beforeSend: function () {
  948. $('#loadingParent').show();
  949. },
  950. complete: function () {
  951. setTimeout(function () {
  952. $('#loadingParent').hide();
  953. }, 3000)
  954. },
  955. success: function (data) {
  956. layer.close();
  957. }
  958. })
  959. }
  960. //雨控提示
  961. function bindsheb() {
  962. layer.closeAll();
  963. }
  964. </script>
  965. </body>
  966. </html>