| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946 |
- {% load staticfiles %}
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8" />
- <link href="{% static '/lib/bootstrap-3.3.7/css/bootstrap.css' %}" rel="stylesheet">
- <link rel="stylesheet" href="{% static '/lib/font-awesome/4.5.0/css/font-awesome.css' %}">
- <link rel="stylesheet" href="{% static '/lib/css/ace.min.css' %}" />
- <link rel="stylesheet" href="{% static '/lib/css/ace-skins.min.css' %}">
- <link rel="stylesheet" href="{% static '/lib/css/ace-rtl.min.css' %}">
- <link rel="stylesheet" href="{% static '/lib/layui/css/layui.css' %}">
- <link rel="stylesheet" href="{% static '/css/loading.css' %}?versions=0.3.3" />
- <link href="{% static '/lib/css/magnific-popup.css' %}" rel="stylesheet" type="text/css" media="all" />
- <link rel="stylesheet" href="{% static '/css/loading.css' %}?versions=0.3.3" />
- <style>
- body {
- background: #fff;
- overflow: hidden;
- }
- .clearfix:before,
- .clearfix:after {
- display: table;
- line-height: 0;
- content: ""
- }
- .clearfix:after {
- clear: both
- }
- .fl {
- float: left;
- }
- .fr {
- float: right;
- }
- .mfp-bottom-bar {
- color: #fff;
- }
- a {
- text-decoration: none !important;
- }
- .popup-gallery>div {
- float: left;
- width: 400px;
- overflow: hidden;
- text-align: center;
- position: relative;
- padding-bottom: 15px;
- }
- .imgParent:hover span {
- display: block;
- }
- .imgParent .delBtn {
- display: none;
- position: absolute;
- top: 10px;
- right: 58px;
- cursor: pointer;
- background: url(../static/img/delIcon.png);
- width: 25px;
- height: 25px;
- background-size: cover;
- }
- .content-body {
- margin-top: 20px;
- }
- .popupA img {
- width: 300px;
- height: 300px;
- }
- .imgParent a,
- .popupA p {
- color: #08c;
- padding: 10px;
- }
- /* 配置 */
- #lookDescribe {
- max-width: 700px;
- }
- .white-popup {
- position: relative;
- background: #FFF;
- padding: 20px;
- width: auto;
- max-width: 500px;
- margin: 20px auto;
- }
- .white-popup h1 {
- font-size: 20px;
- /* margin: 10px 0; */
- color: #006dcc;
- line-height: 15px;
- }
- .pupopTitle {
- width: 140px;
- text-align: right;
- vertical-align: middle;
- /* margin-top: 7px; */
- line-height: 30px;
- }
- .pupopBody input,
- .pupopBody select {
- padding: 4px 6px;
- margin-bottom: 10px;
- font-size: 14px;
- line-height: 20px;
- color: #4a4a4a;
- background: #fff;
- border: 1px solid #ccc;
- vertical-align: middle;
- width: 200px;
- }
- .pupopBody select,
- .pupopBody input {
- height: 30px;
- width: 215px;
- line-height: 30px;
- cursor: pointer;
- border: 1px solid #ccc;
- }
- .btnParent {
- text-align: center;
- }
- .btnParent input {
- color: #fff;
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
- background-color: #006dcc;
- width: 80px;
- height: 30px;
- border-radius: 3px;
- border: none;
- cursor: pointer;
- margin: 5px 17px;
- }
- .btnParent input:hover {
- color: #fff;
- background-color: #04c;
- }
- .nullData {
- width: 100%;
- height: 500px;
- background: #ddd;
- text-align: center;
- line-height: 500px;
- font-size: 20px;
- border: 1px solid #ddd;
- }
- #wormDetails {
- width: 100%;
- text-align: center;
- line-height: 30px;
- }
- #wormDetails tr {
- border-bottom: 1px solid #e6e6e6;
- /* line-height: 40px; */
- }
- #wormDetails .option,
- #wormDetails .optionName {
- /* width: 150px; */
- }
- #wormDetails input {
- width: 80%;
- text-align: center;
- }
- .saveBtn {
- display: none;
- }
- #addwormType,
- #delwormType {
- display: none;
- }
- #delwormType .pupopBody {
- width: 340px;
- font-size: 0;
- }
- #addwormType h2,
- #delwormType h2 {
- font-size: 16px;
- text-indent: 30px;
- color: #006dcc;
- }
- .my_protocol {
- line-height: 30px;
- display: inline-block;
- width: 169px;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
- .my_protocol .input_agreement_protocol {
- appearance: none;
- -webkit-appearance: none;
- outline: none;
- display: none;
- }
- /*未选中时*/
- .my_protocol .input_agreement_protocol+span {
- cursor: pointer;
- width: 16px;
- height: 16px;
- background-color: red;
- display: inline-block;
- background: url(../static/img/checkboxBj.png) no-repeat;
- background-position-x: 0px;
- background-position-y: 0px;
- position: relative;
- top: 3px;
- margin-right: 3px;
- }
- /*选中checkbox时,修改背景图片的位置*/
- .my_protocol .input_agreement_protocol:checked+span {
- background-position: -19px 0px
- }
- /* 图片列表批量删除复选框样式 */
- .imgcheckbox input[type='checkbox']+span {
- cursor: pointer;
- width: 18px;
- height: 18px;
- background-color: red;
- display: inline-block;
- background: url(/static/img/tick.png) no-repeat center;
- background-position: -19px 0px;
- position: relative;
- top: 3px;
- border: 1px solid #bbb;
- }
- .imgcheckbox input[type='checkbox']:checked+span {
- background-position-x: 3px;
- background-position-y: 3px;
- }
- .imgcheckbox input {
- display: none;
- }
- .imgcheckbox {
- display: none;
- position: absolute;
- right: 19px;
- top: 0px;
- }
- .searchCover {
- margin: 20px 0;
- }
- .delbox {
- text-align: right;
- }
- .canceldelimgBtn {
- display: none;
- }
- /* 自动识别虫害 */
- /* .wormImg{
- width: 150px;
- float: left;
- margin-top: 20px;
- margin-right: 10px;
- }
- .wormIcon{
- float: left;
- margin-top: -5px;
- margin-right: 10px;
- font-size: 26px;
- color: #f1d300;
- /* color: #bd0606;
- }
- .wormName{
- text-align: center;
- line-height: 30px !important;
- }
- .synopsis{
- line-height: 23px;
- min-height: 100px;
- } */
- /* 自动识别2 */
- .wormBox {
- /* min-height: 100px; */
- }
- .wormImgTag {
- /* float: left;
- width: 25%; */
- }
- .wormImgTag>img {
- width: 100%;
- }
- .wormResult {
- /* margin-left: 140px;
- width: 75%;*/
- line-height: 28px;
- }
- .wormResult>span {
- width: 50%;
- display: inline-block;
- }
- .wormResult>span i {
- font-style: normal;
- color: #cf0000;
- font-weight: 600;
- }
- .wormResult>span i:hover {
- color: #006dcc;
- }
- .clear {
- clear: both;
- }
- .wormIcon {
- float: left;
- margin-top: -5px;
- margin-right: 10px;
- font-size: 26px;
- color: #f1d300;
- }
- .resultTitle {
- font-size: 16px;
- margin: 5px 0;
- border-left: 4px solid #006dcc;
- padding-left: 6px;
- font-weight: 600;
- }
- /* 顶部位置 */
- .page-header>h1,
- .searchCover {
- width: 48%;
- display: inline-block;
- }
- /* 模拟查看数据 */
- .imgParent .simulation {
- padding: 0;
- }
- .simulation {
- display: none;
- }
- .resultLookGitImg {
- float: right;
- margin-bottom: 20px;
- }
- #bindSim{
- display: none;
- }
- #bindSim>div {
- text-align: center;
- }
- #bindSim>.hint {
- line-height: 100px;
- font-size: 16px;
- color: #333;
- }
- .layui-layer {
- border-radius: 10px;
- overflow: hidden;
- }
- #failure{
- display: none;
- text-align: center;
- }
- #failure >div{
- margin: 15px;
- }
- #wormDetails th{
- text-align: center;
- }
- </style>
- </head>
- <body>
- <div class="content">
- <input type="hidden" name="" value="{{disc}}" id="discern">
- <div class="page-header">
- <span class="headerPlace" onclick="goback()">
- <img src="{% static '/img/gobackIcon.png' %}" alt="">返回
- </span>
- <!-- 操作 -->
- <div class="delbox" style="float: right;">
- <button type="button" onclick="popupFrame('ctrl','takephoto','')" class="btn btn-sm btn-warning">拍照</button>
- <button type="button" onclick="reload()" class="btn btn-sm btn-success">刷新</button>
- <button type="button" onclick="delimgAll(this)" class="btn btn-sm btn-primary batchesBtn">批量删除</button>
- <button type="button" onclick="canceldelimg(this)" id="canceldel" class="btn btn-sm canceldelimgBtn">取消</button>
- </div>
- </div>
- <div class="timeSelect">
- 时间段查询:
- <input type="text" value="" class="fp-user" id="timSelectBox" autocomplete="off" placeholder="时间段查询" onkeypress="if (event.keyCode == 13) img_filter();"
- />
- <input type="hidden" id="begin">
- <input type="hidden" id="end">
- <button type="button" onclick="img_filter()" class="btn btn-sm btn-primary">筛选</button>
- </div>
- <input type="hidden" value="{{simid|default_if_none:""}}" id="simid">
- <input type="hidden" value="{{dver}}" id="dver">
- <!-- 图片列表 -->
- <div class="content-body" id="imgList">
- </div>
- <div class="fenpei-bottom">
- <input type="hidden" id="imei" value="{{imei}}">
- <input type="hidden" id="totalPage" value={{ nums }}>
- <div id="page" style="text-align: center;"></div>
- </div>
- <!-- 添加详情 -->
- <div id="test-popup" class="white-popup mfp-hide">
- <h1>添加详情</h1>
- <hr/>
- <form action="" id="pupopForm">
- <input type="hidden" value="" id="imgPath">
- <input type="hidden" value="" id="photo_time">
- <div class="pupopBox clearfix">
- <div class="fl pupopTitle">害虫名称:</div>
- <div class="fl pupopBody">
- <!-- <input type="text" value="" name="wormName"> -->
- <select name="wormName" id=""></select>
- <img src="{% static '/img/addicon.png' %}" id="addNameBtn" alt="" onclick="addNameBox()" title="添加害虫种类" width="28" style="margin-bottom: 10px;cursor: pointer;">
- <img src="{% static '/img/subtract.png' %}" id="delNameBtn" alt="" onclick="delNameBox()" title="删除害虫种类" width="28" style="margin-bottom: 10px;cursor: pointer;">
- </div>
- </div>
- <div class="pupopBox clearfix">
- <div class="fl pupopTitle">数量:</div>
- <div class="fl pupopBody">
- <input type="number" value="0" min="0" name="wormNum">
- </div>
- </div>
- <div class="pupopBox clearfix">
- <div class="fl pupopTitle">作物种类:</div>
- <div class="fl pupopBody">
- <input type="text" value="" placeholder="选填项" name="wormKind">
- </div>
- </div>
- <!-- <div class="pupopBox clearfix">
- <div class="fl pupopTitle">雌雄:</div>
- <div class="fl pupopBody">
- <select name="wormSex" id="">
- <option value="0">雌</option>
- <option value="1">雄</option>
- </select>
- </div>
- </div> -->
- <div class="pupopBox clearfix">
- <div class="fl pupopTitle">虫害阶段:</div>
- <div class="fl pupopBody">
- <input type="text" value="" placeholder="选填项" name="wormTime">
- </div>
- </div>
- <div class="btnParent">
- <input type="button" id='saveBtn' onclick="savePopWin()" value="保存">
- <input type="button" id='cancelBtn' onclick="closePopWin($(this))" value="取消">
- </div>
- </form>
- <!-- 添加害虫种类 -->
- <div id="addwormType">
- <h2>添加害虫种类</h2>
- <form action="" class="">
- <div class="pupopBox clearfix">
- <div class="fl pupopTitle">害虫名称:</div>
- <div class="fl pupopBody">
- <input type="text" maxlength="20" value="" name="wormTypeSelect">
- <!-- <img src="{% static '/img/addicon.png' %}" alt="" onclick="goBackAddDetial()" title="返回添加" width="28"> -->
- </div>
- </div>
- <div class="btnParent">
- <input type="button" id='saveBtn' onclick="saveWormType()" value="保存">
- <input type="button" id='cancelBtn' onclick="goBackAddDetial()" value="取消">
- </div>
- </form>
- </div>
- <!-- 删除害虫种类 -->
- <div id="delwormType">
- <h2>删除害虫种类</h2>
- <form action="" class="">
- <div class="pupopBox clearfix">
- <div class="fl pupopTitle">害虫名称:</div>
- <div class="fr pupopBody"></div>
- </div>
- <div class="btnParent">
- <input type="button" id='saveBtn' onclick="saveDelWormType()" value="确定">
- <input type="button" id='cancelBtn' onclick="goBackAddDetial()" value="取消">
- </div>
- </form>
- </div>
- </div>
- <!-- 查看描述 -->
- <div id="lookDescribe" class="white-popup mfp-hide">
- <h1>虫害详情</h1>
- <br />
- <form action="">
- <input type="hidden" value="" id="imgPath_dteial">
- <table id="wormDetails" class="table table-striped table-hover">
- <tr>
- <th>害虫名称</th>
- <th>数量</th>
- <th>作物种类</th>
- <th>虫害阶段</th>
- <th style="width:110px">操作</th>
- </tr>
- <!-- <tr>
- <td class="option">大蛾子</td>
- <td class="option">12</td>
- <td class="option">花生地</td>
- <td class="option">大</td>
- <td>
- <button type="button" class="btn editBtn btn-primary" onclick="edit($(this))">编辑</button>
- <button type="button" class="btn saveBtn btn-success" onclick="save($(this))">保存</button>
- <button type="button" class="btn delBtn btn-danger">删除</button>
- </td>
- </tr> -->
- </table>
- </form>
- </div>
- <!-- 添加病虫种类 -->
- <!-- <div id="addwormType" class="white-popup mfp-hide">
- <h1>害虫种类</h1>
- <form action="" class="">
- <div class="pupopBox clearfix">
- <div class="fl pupopTitle">病虫名称:</div>
- <div class="fl pupopBody">
- <input type="text" value="" name="wormTypeSelect">
- </div>
- </div>
- <div class="btnParent">
- <input type="button" id='saveBtn' onclick="saveWormType()" value="保存">
- <input type="button" id='cancelBtn' onclick="closePopWin($(this))" value="取消">
- </div>
- </form>
- </div> -->
- <!-- 自动识别 -->
- <div id="autoDiscern" class="white-popup mfp-hide">4
- <h1>害虫计数</h1>
- <hr>
- <input type="hidden" value="" id="currImgPath">
- <div class="wormBox">
- </div>
- </div>
- <!-- 失败识别 -->
- <div id="failure">
- <div>
- <img src="{% static 'img/failureIcon.png'%}" alt="">
- </div>
- <p>未能识别此昆虫,努力开发中</p>
- </div>
- <!-- 版本5HK的加上SIM卡绑定提示 -->
- <div id="bindSim">
- <div class="hint">此设备还未绑定SIM卡,请先绑定SIM卡。</div>
- <div>
- <button class="layui-btn layui-btn-radius layui-btn-normal" onclick="binding()">立即绑定</button>
- <button class="layui-btn layui-btn-radius layui-btn-primary" onclick="closeSim()">稍后再来</button>
- </div>
- </div>
- <!-- loading -->
- <div id="loadingParent">
- <div id="loadCenter">
- <div class="skype-loader">
- <div class="dot">
- <div class="first"></div>
- </div>
- <div class="dot"></div>
- <div class="dot"></div>
- <div class="dot"></div>
- </div>
- Logging in...
- </div>
- </div>
- </div>
- <script src="{% static '/lib/js/jquery-2.1.4.min.js' %}"></script>
- <script src="{% static '/lib/layui/layui.all.js' %}"></script>
- <script type="text/javascript">
- $.ajaxSetup({
- data: { csrfmiddlewaretoken: '{{ csrf_token }}' },
- });
- </script>
- <script src="{% static '/js/reportmanage/cbd_image.js' %}?versions=0.3.3"></script>
- <script>
- //点击修改名称,跳出弹框并显示所选设备的设备名称;
- // function addwormType(obj) {
- // layui.use('layer', function () { //独立版的layer无需执行这一句
- // var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句
- // layer.prompt({ title: '添加病虫种类', area: 400 }, function (val, index) {
- // layer.close(index);
- // // ChangeNameSub(deviceId, oldDevicename, val);
- // });
- // });
- // }
- if ($('#dver').val().indexOf('HK') != -1) {
- if($('#simid').val() == ''){
- layui.use('layer', function () {
- var layer = layui.layer;
- layer.open({
- type: 1,
- title: '提示',
- area: ['400px', '200px'],
- content: $('#bindSim')
- });
- });
- }
- }
- function binding() {
- var sidebar = $('#sidebar', parent.document);
- var menuLi = sidebar.find('.nav-list.nav').children();
- menuLi.each(function (idx, val) {
- console.log($(val))
- $(val).removeClass('open');
- $(val).find('ul').removeClass('nav-show').hide();
- $(val).removeClass('active');
- $(val).children('ul').children().removeClass('active');
- if ($(val).children('a').find('.menu-text').html() == '设备管理') {
- $(val).addClass('active');
- $(val).addClass('open');
- $(val).children('ul').removeClass('nav-hide').addClass('nav-show').show();
- $(val).children('ul').children().each(function (index, obj) {
- if ($(obj).find('.menu-text').html() == '虫情测报') {
- $(obj).addClass('active');
- }
- })
- }
- })
- location.href = 'equipmanage_cbd_detail?id='+$('#imei').val()
- }
- function closeSim() {
- layer.closeAll();
- }
- // 查看详情 编辑
- var initial = [];
- function edit(obj) {
- if ($('#wormDetails .saveBtn.current').length == 1) {
- layer.msg('正在编辑中');
- } else {
- initial = [];
- obj.hide().next().show();
- var parent = obj.parents('tr');
- var option = parent.find('.option');
- option.each(function () {
- var txt = $(this).html();
- initial.push(txt);
- var html = '<input type="text" value="' + txt + '">';
- $(this).html(html);
- })
- }
- $('#wormDetails .saveBtn').removeClass('current');
- obj.next().addClass('current');
- console.log('旧的', initial)
- }
- //查看详情 保存
- function save(obj) {
- obj.hide().prev().show();
- var parent = obj.parents('tr');
- var option = parent.find('.option');
- var wormName = parent.find('.optionName').html();
- var dataarr = [];
- var addr = $('#imgPath').val();
- option.each(function () {
- var txt = $(this).find('input').val();
- // var html = txt;
- dataarr[$(this).index()] = txt
- // $(this).html(html);
- })
- var data = {
- 'pest_name': wormName,
- 'pest_num': dataarr[1],
- 'crop_name': dataarr[2],
- 'pest_case': dataarr[3]
- }
- $('#wormDetails .saveBtn').removeClass('current');
- console.log(data);
- var addr = $('#imgPath_dteial').val();
- $.ajax({
- url: 'cbd_describe_img',
- type: 'post',
- data: { req: 'change_save', addr: addr, describe: JSON.stringify(data) },
- success: function (data) {
- if (data == 0) {
- //成功
- option.each(function () {
- var txt = $(this).find('input').val();
- var html = txt;
- // dataarr[$(this).index()] = txt
- $(this).html(html);
- })
- } else {
- //失败
- option.each(function () {
- var txt = $(this).find('input').val();
- var html = txt;
- // dataarr[$(this).index()] = txt
- $(this).html(initial[$(this).index() - 1]);
- })
- layer.msg('编辑失败');
- }
- }
- })
- }
- // 删除
- function delItemDetial(obj) {
- var parent = obj.parents('tr');
- var wormName = parent.find('.optionName').html();
- var data = { 'pest_name': wormName };
- var addr = $('#imgPath_dteial').val();
- $.ajax({
- url: 'cbd_describe_img',
- type: 'post',
- data: { req: 'del_desc', addr: addr, describe: JSON.stringify(data) },
- success: function (data) {
- if (data == 0) {
- //成功
- parent.remove();
- if ($('#wormDetails tr').length < 2) {
- var html = '<tr><td class="nullData" colspan="5">暂无数据</td></tr>'
- $("#wormDetails tr:not(:first)").remove();
- $('#wormDetails').append(html);
- }
- } else {
- //失败
- layer.msg('删除失败');
- }
- }
- })
- }
- function saveWormType() {
- var wormTypeSelect = $('#addwormType').find('input[name="wormTypeSelect"]').val();
- if (wormTypeSelect) {
- $.ajax({
- url: 'cbd_describe_img',
- type: 'get',
- data: { req: "add_pest", pest: wormTypeSelect },
- success: function (data) {
- if (data == 2) {
- layer.msg('创建名称失败');
- } else if (data == 1) {
- layer.msg('名称已存在');
- } else {
- layer.msg('创建名称成功');
- setTimeout(function () {
- //模拟数据
- var msg = $.parseJSON(data);
- // 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" }];
- $('#pupopForm select[name="wormName"]').empty();
- for (var i = 0; i < msg.length; i++) {
- var html = "<option value='" + msg[i].pest_name + "'>" + msg[i].pest_name + "</option>"
- $('#pupopForm select[name="wormName"]').append(html);
- }
- goBackAddDetial();
- }, 500)
- }
- }
- })
- } else {
- layer.msg('请填写害虫名称');
- }
- }
- function saveDelWormType() {
- var nameData = [];
- $("#delwormType input[type='checkbox']:checked").each(function () {
- nameData.push($(this).val());
- })
- if (nameData.length) {
- $.ajax({
- url: 'cbd_describe_img',
- type: 'get',
- data: { req: "del_pest", pest: JSON.stringify(nameData) },
- success: function (data) {
- var msg = $.parseJSON(data);
- $('#pupopForm select[name="wormName"]').empty();
- for (var i = 0; i < msg.length; i++) {
- var html = "<option value='" + msg[i].pest_name + "'>" + msg[i].pest_name + "</option>"
- $('#pupopForm select[name="wormName"]').append(html);
- };
- goBackAddDetial()
- }
- })
- } else {
- layer.msg('请至少选择一项');
- }
- }
- //添加名称显示框
- function addNameBox() {
- $('#addwormType').show();
- $('#addwormType').prev().hide();
- $('#addwormType').next().hide();
- }
- function delNameBox() {
- $('#addwormType').hide();
- $('#addwormType').prev().hide();
- $('#addwormType').next().show();
- var newPestName = [];
- $('#pupopForm option').each(function () {
- newPestName.push($(this).html());
- })
- $('#delwormType .pupopBody').empty();
- for (var i = 0; i < newPestName.length; i++) {
- var pestName = '<label class="my_protocol">' +
- '<input class="input_agreement_protocol" value="' + newPestName[i] + '" type="checkbox">' +
- '<span></span>' + newPestName[i] + '</label>';
- $('#delwormType .pupopBody').append(pestName);
- }
- }
- //返回添加详情
- function goBackAddDetial() {
- $('#addwormType').hide();
- $('#addwormType').next().hide();
- $('#addwormType').prev().show();
- $('#addwormType').find('form')[0].reset();
- $('#delwormType').find('form')[0].reset();
- if ($('#pupopForm option').length >= 180) {
- $('#addNameBtn').hide();
- } else {
- $('#addNameBtn').show();
- }
- if ($('#pupopForm option').length <= 0) {
- $('#delNameBtn').hide();
- } else {
- $('#delNameBtn').show();
- }
- }
- // 拍照
- function popupFrame(cmd, type, data) {
- //询问框
- layer.confirm('确定拍照?', {
- icon: 3,
- btn: ['确定', '取消'] //按钮
- }, function (index) {
- handleFun(cmd, type, data);
- layer.close(index);
- }, function () {
- });
- }
- function handleFun(cmd, type, data) {
- var id = $('#imei').val();
- $.ajax({
- type: "post",
- url: 'cbd_mqtt',
- data: {
- "req": "ctrl",//控制
- "topicid": id,
- "cmd": cmd,//升级 update
- "type": type,
- "data": data
- },
- dataType: "json",
- beforeSend: function () {
- $('#loadingParent').show();
- },
- complete: function () {
- setTimeout(function () {
- $('#loadingParent').hide();
- }, 3000)
- },
- success: function (data) {
- layer.close();
- }
- })
- }
- </script>
- </body>
- </html>
|