| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959 |
- <template>
- <div style="cursor: default; width: 99%">
- <div class="search-box">
- <search-bar
- @fun="getDisplayType"
- :displayType="displayType"
- @fun2="getIDName"
- @fun3="getIsOnline"
- ref="screenData"
- >
- <template slot="search-box">
- <template v-if="userType == 1">
- <el-select
- v-model="queryInfo.dver"
- class="select01"
- clearable
- size="mini"
- placeholder="请选择设备版本"
- @change="searchChange()"
- >
- <el-option
- v-for="item in dverGather"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- ></el-option>
- </el-select>
- </template>
- </template>
- </search-bar>
- <!-- <el-button
- class="devicePlant"
- type="primary"
- size="mini"
- v-btnRight:pestRanking="$route.path"
- @click="devicePlant"
- >害虫排名</el-button
- >
- <el-button
- class="pestAll"
- type="primary"
- size="mini"
- v-btnRight:pestAnalysis="$route.path"
- @click="pestAll"
- >害虫分析</el-button
- > -->
- </div>
- <template v-if="displayType == 1">
- <el-row :gutter="10" v-loading="loading">
- <el-col
- :xs="24"
- :sm="24"
- :md="12"
- :lg="8"
- :xl="6"
- v-for="item in equipList"
- :key="item.imei"
- style="margin-bottom:10px;"
- >
- <el-card class="box-card">
- <equip-item :is_online="item.device_status">
- <span
- slot="set"
- class="superOperate el-icon-setting"
- @click="equipOperation(item)"
- ></span>
- <span slot="title">智能测报灯</span>
- <div slot="content" class="content">
- <p :title="item.device_name">
- <i class="iconfont icon-biaoqian"></i>
- 设备名称:{{
- (item.device_name == '' ? '无' : item.device_name)
- | ellipsis
- }}
- </p>
- <p>
- <i class="iconfont icon-yonghu"></i>
- 设备ID:{{ item.imei }}
- </p>
- <p>
- <i class="iconfont icon-yonghu"></i>
- 隶属组织 :
- <span v-if="item.org_list.length == 1">{{
- item.org_list[0].org_name
- }}</span>
- <el-popover
- ref="popover"
- placement="right"
- title=""
- width="150"
- trigger="hover"
- v-else
- >
- <div class="popover-content" v-html="content"></div>
- <span @mouseover="orglisthover(item)" slot="reference"
- >{{
- item.org_list.length == 0
- ? '暂无组织'
- : item.org_list[0].org_name
- }}...</span
- >
- </el-popover>
- </p>
- <p>
- <i class="iconfont icon-biaoqian"></i>
- 所属监测点 : {{ item.point_name }}
- </p>
- <p class="onlineState">
- <i class="iconfont icon-diannao"></i>在线状态:
- <span
- :class="{
- red: item.is_online == 0,
- green: item.is_online == 1
- }"
- >
- {{ equipStateDict.is_online.value[item.is_online] }}
- </span>
- </p>
- <p :title="item.address">
- <i class="iconfont icon-dizhi"></i>
- 地址 : {{ (item.address || '无') | ellipsis }}
- </p>
- <p>
- <i class="iconfont icon-shijian"></i>
- 最新上报时间 : {{ (item.uptime * 1000) | formatTime }}
- </p>
- <p v-if="userType == 1">
- <i class="iconfont icon-chouchongbug"></i>
- 识别 :
- <el-select
- @change="operationDiscern($event, item.imei, item.disable)"
- class="my-el-select"
- style="width: 100px; border: 0; font-size: 15px"
- size="mini"
- v-model="item.insectVal"
- placeholder="请选择"
- >
- <el-option
- v-for="itemA in insectOptions"
- :key="itemA.value"
- :label="itemA.label"
- :value="itemA.value"
- >
- </el-option>
- </el-select>
- </p>
- <p class="btns" style="width: 367px">
- <i class="iconfont icon-yemiancaozuo"></i>
- <el-button
- v-btnRight:seePicture="$route.path"
- size="mini"
- type="info"
- @click="
- viewPhotoDialog(
- item.imei,
- item.d_id,
- item.device_name,
- item.address
- )
- "
- >查看图片</el-button
- >
- <el-button
- v-btnRight:deviceControl="$route.path"
- size="mini"
- type="warning"
- @click="
- EquipControl(item.d_id, item.imei, item.device_name)
- "
- >设备控制</el-button
- >
- <el-button
- v-btnRight:pestStatistics="$route.path"
- size="mini"
- type="success"
- @click="
- showTimeControlDialog(item.d_id, item.imei, item.disable)
- "
- >害虫统计</el-button
- >
- <el-button
- v-btnRight:dataDetails="$route.path"
- size="mini"
- type="danger"
- @click="dataDetails(item.imei, item.d_id, item)"
- >数据详情</el-button
- >
- <!-- <el-button
- v-show="userType == 1"
- v-btnRight:dataDetails="$route.path"
- :type="item.disable == '0' ? 'warning' : 'danger'"
- size="mini"
- @click="operationDiscern(item.id, item.disable)"
- >{{
- item.disable == "0" ? "开启识别" : "关闭识别"
- }}</el-button
- > -->
- </p>
- </div>
- </equip-item>
- </el-card>
- </el-col>
- </el-row>
- </template>
- <template v-if="displayType == 2">
- <el-card class="box-card">
- <el-table
- v-loading="loading"
- :data="equipList"
- stripe
- style="width: 100%"
- >
- <el-table-column prop="device_name" label="设备名称" width="180">
- <template slot-scope="scope">{{
- scope.row.device_name == '' ? '无' : scope.row.device_name
- }}</template>
- </el-table-column>
- <el-table-column prop="device_id" label="设备ID" width="180">
- <template slot-scope="scope">{{ scope.row.imei }}</template>
- </el-table-column>
- <el-table-column prop="device_status" label="在线状态">
- <template slot-scope="scope">
- <p style="color: #17bb89" v-if="scope.row.is_online == 1">在线</p>
- <p style="color: #eb6765" v-if="scope.row.is_online == 0">离线</p>
- </template>
- </el-table-column>
- <el-table-column prop="dtype" label="组织">
- <template slot-scope="scope">
- <span v-if="scope.row.org_list.length == 1">{{
- scope.row.org_list[0].org_name
- }}</span>
- <el-popover
- ref="popover"
- placement="right"
- title="组织列表"
- width="150"
- trigger="hover"
- v-else
- >
- <div class="popover-content" v-html="content"></div>
- <span @mouseover="orglisthover(scope.row)" slot="reference"
- >{{
- scope.row.org_list.length == 0
- ? '暂无组织'
- : scope.row.org_list[0].org_name
- }}...</span
- >
- </el-popover>
- </template>
- </el-table-column>
- <el-table-column prop="status_time" label="最新上报时间">
- <template slot-scope="scope">{{
- (scope.row.uptime * 1000) | formatTime
- }}</template>
- </el-table-column>
- <el-table-column prop="address" label="地址">
- <template slot-scope="scope" :title="scope.row.address">{{
- scope.row.address || '无' | ellipsis
- }}</template>
- </el-table-column>
- <el-table-column label="操作" width="400">
- <template slot-scope="scope">
- <el-button
- v-btnRight:seePicture="$route.path"
- size="mini"
- type="info"
- @click="
- viewPhotoDialog(
- scope.row.imei,
- scope.row.d_id,
- scope.row.device_name,
- scope.row.address
- )
- "
- >查看图片</el-button
- >
- <el-button
- v-btnRight:deviceControl="$route.path"
- size="mini"
- type="warning"
- @click="
- EquipControl(
- scope.row.d_id,
- scope.row.imei,
- scope.row.device_name
- )
- "
- >设备控制</el-button
- >
- <el-button
- v-btnRight:pestStatistics="$route.path"
- size="mini"
- type="success"
- @click="
- showTimeControlDialog(
- scope.row.d_id,
- scope.row.imei,
- scope.row.disable
- )
- "
- >害虫统计</el-button
- >
- <!-- <el-button
- v-btnRight:dataDetails="$route.path"
- size="mini"
- type="danger"
- @click="dataDetails(scope.row.imei, scope.row.d_id, scop.row)"
- >数据详情</el-button
- > -->
- <el-button
- v-btnRight:dataDetails="$route.path"
- size="mini"
- type="danger"
- @click="dataDetails(scope.row.imei, scope.row.d_id, scope.row)"
- >数据详情</el-button
- >
- </template>
- </el-table-column>
- </el-table>
- </el-card>
- </template>
- <!-- 暂无数据 -->
- <div
- class="expertDiagnosis_referral_units_not"
- v-if="equipList.length <= 0 && displayType == 1"
- >
- <img
- :src="$imghost + zanwu"
- alt
- class="expertDiagnosis_referral_units_notImg"
- />
- </div>
- <el-pagination
- v-if="equipList.length > 0"
- background
- :page-size="8"
- layout="prev, pager, next, jumper"
- :total="totalNum"
- :current-page="queryInfo.page"
- @current-change="changePage"
- ></el-pagination>
- <!-- 设备控制对话框 -->
- <el-dialog
- title="设备控制"
- :visible.sync="equipControlDialogVisible"
- @close="resetEquipControlDialogClosed"
- width="600px"
- :close-on-click-modal="false"
- :close-on-press-escape="false"
- >
- <div class="handAddForm">
- <el-form
- ref="equipContrlRef"
- :model="equipContrlForm"
- label-position="right"
- label-width="150px"
- >
- <el-form-item label="设备编号:">
- <el-input disabled v-model="equipInfo.device_id"></el-input>
- </el-form-item>
- <el-form-item label="设备名称:" v-if="equipInfo.device_name">
- <el-input disabled v-model="equipInfo.device_name"></el-input>
- </el-form-item>
- <el-form-item label="设备开关:" prop="ds">
- <el-select v-model="equipContrlForm.ds">
- <el-option label="开机" :value="1"></el-option>
- <el-option label="关机" :value="0"></el-option>
- </el-select>
- </el-form-item>
- <!-- <el-form-item label="工作状态:" prop="ws">
- <el-select
- v-model="ws"
- placeholder="请选择工作状态"
- @change="wsChange()"
- >
- <el-option label="待机" :value="0"></el-option>
- <el-option label="工作" :value="1"></el-option>
- </el-select>
- </el-form-item> -->
- <!-- <el-form-item label="定时模式:" prop="ts">
- <el-select
- v-model="equipContrlForm.ts"
- placeholder="请选择定时模式"
- >
- <el-option label="光控" :value="0"></el-option>
- <el-option label="时控" :value="1"></el-option>
- </el-select>
- </el-form-item> -->
- <!-- <el-form-item v-if="equipContrlForm.ts == 1" label="开始结束时间:">
- <el-col :span="11">
- <el-time-select
- placeholder="起始时间"
- v-model="equipContrlForm.st"
- :picker-options="{
- start: '00:00',
- step: '01:00',
- end: '23:00',
- }"
- ></el-time-select>
- </el-col>
- <el-col class="line" :span="2">-</el-col>
- <el-col :span="11">
- <el-time-select
- placeholder="结束时间"
- v-model="equipContrlForm.et"
- :picker-options="{
- start: '00:00',
- step: '01:00',
- end: '23:00',
- }"
- ></el-time-select>
- </el-col>
- </el-form-item> -->
- <!-- <el-form-item
- v-if="equipContrlForm.ts != 1"
- label="定时时长(h):"
- prop="tt"
- >
- <div class="sliderParent">
- <div class="block">
- <el-slider
- v-model="equipContrlForm.tt"
- show-input
- :min="1"
- :max="10"
- ></el-slider>
- </div>
- </div>
- </el-form-item> -->
- <el-form-item label="落虫时间(min):" prop="collt">
- <div class="sliderParent">
- <div class="block">
- <el-slider
- v-model="equipContrlForm.collt"
- show-input
- :min="1"
- :max="20"
- ></el-slider>
- </div>
- </div>
- </el-form-item>
- <el-form-item label="加热时间(min):" prop="htim">
- <div class="sliderParent">
- <div class="block">
- <el-slider
- v-model="equipContrlForm.htim"
- show-input
- :min="1"
- :max="20"
- ></el-slider>
- </div>
- </div>
- </el-form-item>
- <el-form-item label="加热温度(℃):" prop="hst">
- <div class="sliderParent">
- <div class="block">
- <el-slider
- v-model="equipContrlForm.hst"
- show-input
- :min="75"
- :max="120"
- ></el-slider>
- </div>
- </div>
- </el-form-item>
- <el-form-item label="高温保护阈值(℃):" prop="tph">
- <div class="sliderParent">
- <div class="block">
- <el-slider
- v-model="equipContrlForm.tph"
- show-input
- :min="50"
- :max="70"
- ></el-slider>
- </div>
- </div>
- </el-form-item>
- <el-form-item label="低温保护阈值(℃):" prop="tpl">
- <div class="sliderParent">
- <div class="block">
- <el-slider
- v-model="equipContrlForm.tpl"
- show-input
- :min="-20"
- :max="10"
- ></el-slider>
- </div>
- </div>
- </el-form-item>
- <el-form-item label="数据上传间隔(min):" prop="datt">
- <div class="sliderParent">
- <div class="block">
- <el-slider
- v-model="equipContrlForm.datt"
- :step="10"
- show-input
- :min="10"
- :max="60"
- ></el-slider>
- </div>
- </div>
- </el-form-item>
- <!-- <el-form-item label="图片分辨率:" prop="imgres">
- <el-select
- v-model="equipContrlForm.imgres"
- placeholder="请选择图片分辨率"
- >
- <el-option label="高" :value="0"></el-option>
- <el-option label="中" :value="1"></el-option>
- <el-option label="低" :value="2"></el-option>
- </el-select>
- </el-form-item> -->
- <el-form-item class="handAddFormBtn">
- <el-button
- type="primary"
- size="mini"
- @click="equipControlSubm()"
- :disabled="releaseTF"
- >{{ releaseTF ? '发布中...' : '确定' }}</el-button
- >
- <el-button size="mini" @click="equipControlDialogVisible = false"
- >取消</el-button
- >
- </el-form-item>
- </el-form>
- </div>
- </el-dialog>
- <!-- 管理员操作弹框 -->
- <el-dialog
- title="智能测报灯设置"
- :visible.sync="operationDialogVisible"
- width="580px"
- :close-on-click-modal="false"
- :close-on-press-escape="false"
- >
- <div>
- <el-form
- :model="ruleForm"
- :rules="rules"
- ref="ruleForm"
- label-width="100px"
- class="demo-ruleForm"
- >
- <el-form-item label="设备名称" prop="device_name">
- <el-input v-model="ruleForm.device_name"></el-input>
- </el-form-item>
- <el-form-item label="已绑定组织" prop="oldorg_id">
- <div class="haiguan">
- <p
- class="haiguan_item"
- v-for="(item, index) in ruleForm.oldorg_id"
- :key="item.id"
- >
- <span style="margin-right: 5px">{{ item.org_name }}</span>
- <span style="font-size: 16px" @click="oldorgdelect(index)"
- >×</span
- >
- </p>
- <p v-if="ruleForm.oldorg_id.length == 0" class="haiguan_itemnone">
- 暂无绑定
- </p>
- </div>
- </el-form-item>
- <el-form-item label="隶属组织" prop="org_id">
- <el-cascader
- :change-on-select="true"
- v-model="ruleForm.org_id"
- :options="versionsoptions"
- :props="defaultParams"
- :clearable="true"
- placeholder="请选择隶属组织"
- filterable
- ></el-cascader>
- </el-form-item>
- <el-form-item label="所在监测点" prop="point_id">
- <el-select
- v-model="ruleForm.point_id"
- placeholder="请选择所在监测点"
- filterable
- >
- <el-option
- v-for="item in traponsoptions"
- :label="item.point_name"
- :value="item.point_id"
- :key="item.point_id"
- ></el-option>
- </el-select>
- </el-form-item>
- <div class="addtrapbox" style="display: flex">
- <el-form-item label="所在经度" prop="lng">
- <el-input v-model="ruleForm.lng" @blur="latblur"></el-input>
- <p style="height: 24px; padding-left: 16px">
- <!-- {{ ToDegrees(ruleForm.lng, "lng") }} -->
- {{
- isNaN(ruleForm.lng)
- ? ToDigital(ruleForm.lng, 'lng')
- : ToDegrees(ruleForm.lng, 'lng')
- }}
- </p>
- </el-form-item>
- <el-form-item label="所在纬度" prop="lat">
- <el-input v-model="ruleForm.lat" @blur="latblur"></el-input>
- <p style="height: 24px; padding-left: 16px">
- <!-- {{ ToDegrees(ruleForm.lat, "lat") }} -->
- {{
- isNaN(ruleForm.lat)
- ? ToDigital(ruleForm.lat, 'lat')
- : ToDegrees(ruleForm.lat, 'lat')
- }}
- </p>
- </el-form-item>
- </div>
- <div class="buttonbox">
- <el-button type="info" size="mini" @click="dingwei"
- >地图选点</el-button
- >
- </div>
- <el-form-item label="所在城市" prop="basecity">
- <el-input
- v-model="ruleForm.basecity"
- disabled
- style="width: 217px"
- ></el-input>
- </el-form-item>
- </el-form>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button @click="resetForm('ruleForm')" size="mini">取 消</el-button>
- <el-button
- type="primary"
- @click="submitForm('ruleForm')"
- size="mini"
- :disabled="releaseTF"
- >{{ releaseTF ? '发布中...' : '确 定' }}</el-button
- >
- </span>
- </el-dialog>
- <el-dialog
- class="map_dialog"
- title="地图选点"
- :visible.sync="addLocationDialogVisible"
- width="820px"
- @closed="addLocationDialogClosed"
- :close-on-click-modal="false"
- >
- <el-form
- :inline="true"
- :model="locationForm"
- class="demo-form-inline"
- size="mini"
- >
- <el-form-item label="经度">
- <el-input clearable v-model="locationForm.lng"></el-input>
- </el-form-item>
- <el-form-item label="纬度">
- <el-input clearable v-model="locationForm.lat"></el-input>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" size="mini" @click="locationSearch"
- >定位</el-button
- >
- </el-form-item>
- <el-form-item label="">
- <el-input
- placeholder="请输入地区检索"
- v-model="addr"
- clearable
- @change="addrChange()"
- ></el-input>
- </el-form-item>
- </el-form>
- <div class="amap-demo" id="mapContainer2" style="height: 400px"></div>
- <span slot="footer" class="dialog-footer">
- <el-button @click="addLocationDialogVisible = false" size="mini"
- >取 消</el-button
- >
- <el-button type="primary" @click="addLocationSubm" size="mini"
- >确 定</el-button
- >
- </span>
- </el-dialog>
- </div>
- </template>
- <script>
- import SearchBar from '@/components/SearchBar';
- // import TopModule from "@/components/TopModule";
- import EquipItem from '@/components/EquipItem';
- import Circulation from '../../../../static/js/equipState_dict.json';
- import { isArray } from 'highcharts';
- export default {
- filters: {
- ellipsis(value) {
- if (!value) return '';
- if (value.length > 15) {
- return value.slice(0, 15) + '...';
- }
- return value;
- }
- },
- data() {
- return {
- // 测试父传子传值
- // routerName: '虫情测报',
- zanwu: '/images/expertDiagnosis/zanwu.png',
- //图表和表格切换
- displayType: '',
- //设备列表
- equipList: [],
- dverGather: [
- { label: '全部', value: '' },
- { label: '版本1', value: '1' },
- { label: '版本2', value: '2' },
- { label: '版本3', value: '3' },
- { label: '版本4', value: '4' },
- { label: '版本5', value: '5' }
- ],
- userList: [
- { label: '用户1', value: '用户1' },
- { label: '用户2', value: '用户2' }
- ],
- d_id: '',
- device_id: '',
- ws: 0, //工作模式
- equipInfo: {
- //设备控制回显
- device_id: '',
- device_name: ''
- },
- equipContrlForm: {
- st: '',
- et: '',
- // ts: 0,
- // tt: null,
- collt: null,
- htim: null,
- hst: null,
- tph: null,
- // tpl: null,
- tpl: 0,
- datt: null,
- ds: 1
- // tt: "null",
- // collt: "null",
- // htim: "null",
- // hst: 'null',
- // tph: 'null',
- // tpl: 'null',
- // datt: 'null',
- // ds: '1',
- // imgres: 0,
- },
- //参数
- queryInfo: {
- page: 1,
- is_online: null,
- dver: null,
- selectUser: '',
- f_id: '',
- ename: ''
- },
- totalNum: 0,
- //设备控制对话框
- equipControlDialogVisible: false,
- operationDialogVisible: false,
- mqttDialogVisible: false,
- mqttConfig: {
- muid: '',
- mpwd: '',
- mip: '',
- mport: '',
- mpub: '',
- msub: '',
- fuid: '',
- fpwd: '',
- fip: '',
- fport: ''
- },
- loading: true,
- equipStateDict: {}, //
- // 管理员操作 - 更换imei
- replaceImeiData: '',
- // 开始关闭识别
- typeOperation: '', //按钮类型
- // 识别功能筛选 - 仅限管理员可操作
- insectVal: '',
- insectOptions: [
- {
- value: 0,
- label: '禁用'
- },
- {
- value: 1,
- label: '识别'
- },
- {
- value: 2,
- label: '计数'
- }
- ],
- versionsoptions: [], //组织
- traponsoptions: [], //监测点
- defaultParams: {
- label: 'org_name',
- value: 'id',
- children: 'childrens',
- multiple: true,
- checkStrictly: true
- },
- ruleForm: {
- // org_name:"",
- device_name: '',
- org_id: [],
- point_id: '',
- lng: '',
- lat: '',
- device_name: '',
- device_id: '',
- basecity: '',
- oldorg_id: []
- },
- rules: {
- device_name: [
- { required: true, message: '请输入设备名称', trigger: 'blur' }
- ],
- lng: [{ required: true, message: '请输入经度', trigger: 'blur' }],
- lat: [{ required: true, message: '请输入纬度', trigger: 'blur' }],
- point_id: [
- { required: true, message: '请选择所在监测点', trigger: 'change' }
- ]
- },
- //地图属性
- addLocationDialogVisible: false,
- locationForm: {
- lng: '',
- lat: ''
- },
- addr: '', //搜索栏地址
- address: '', //地图上标签地址
- center: [114.05, 22.55],
- content: '',
- releaseTF: false
- };
- },
- created() {
- console.log('created');
- this.displayType = String(localStorage.getItem('cbdListType') || '1');
- },
- mounted() {
- this.equipStateDict = Circulation;
- if (this.$route.query.id !== undefined) {
- this.queryInfo.f_id = this.$route.query.id;
- this.$refs.screenData.searchVal = this.$route.query.id;
- }
- console.log('mounted');
- this.getEquipList();
- this.getmon();
- },
- activated() {
- this.getEquipList();
- console.log('cbd_activated');
- },
- deactivated() {
- console.log('cbd_deactivated');
- },
- watch: {
- operationDialogVisible: function(e) {
- if (e) {
- console.log(this.$data.ruleForm);
- if (this.$data.ruleForm.lat != '' && this.$data.ruleForm.lng != '') {
- this.city(
- this.ToDigital(this.$data.ruleForm.lat),
- this.ToDigital(this.$data.ruleForm.lng)
- );
- }
- }
- }
- },
- computed: {
- userType: function() {
- //获取用户类型
- return sessionStorage.getItem('myuser_type');
- }
- },
- methods: {
- getIsOnline(data) {
- this.queryInfo.is_online = data;
- this.queryInfo.page = 1;
- this.getEquipList();
- },
- getIDName(data) {
- this.queryInfo.f_id = data.f_id;
- this.queryInfo.ename = data.ename;
- this.queryInfo.page = 1;
- this.getEquipList();
- },
- getDisplayType(data) {
- this.displayType = String(data);
- localStorage.setItem('cbdListType', data);
- },
- //获取设备列表
- getEquipList() {
- this.$axios({
- method: 'POST',
- url: '/api/api_gateway?method=monitor_manage.cbd_manage.cbd_list',
- data: this.qs.stringify({
- device_type_id: 3,
- page_size: 8,
- page: this.queryInfo.page,
- device_status: this.queryInfo.is_online,
- device_name: this.queryInfo.ename,
- device_id: this.queryInfo.f_id,
- dver_num: this.queryInfo.dver
- })
- }).then(res => {
- if (res.data.message == '') {
- this.equipList = res.data.data.data;
- // insectVal
- for (var i = 0; i < this.equipList.length; i++) {
- if (this.equipList[i].disable == 0) {
- // 禁用
- this.equipList[i].insectVal = '禁用';
- } else if (this.equipList[i].disable == 1) {
- // 识别
- this.equipList[i].insectVal = '识别';
- } else if (this.equipList[i].disable == 2) {
- // 计数
- this.equipList[i].insectVal = '计数';
- }
- }
- this.equipList.insectVal = this.totalNum = res.data.data.counts;
- this.loading = false;
- }
- // console.log(res.data.data.data)
- var data = res.data.data.data;
- for (var i = 0; i < data.length; i++) {
- if (data[i].disable == '2') {
- console.log(data[i].imei + '这是计数');
- } else if (data[i].disable == '1') {
- console.log(data[i].imei + '这是带识别的');
- }
- }
- });
- },
- //改变page
- changePage(val) {
- this.queryInfo.page = val;
- this.getEquipList();
- },
- // 数据详情
- dataDetails(e_id, d_id, data) {
- this.device_id = e_id;
- this.$router.push({
- path: `/index/DataDetails/${e_id}/${d_id}`,
- query: {
- addr: data.address,
- name: data.device_name
- }
- });
- },
- // 查看图片
- viewPhotoDialog(id, d_id, name, addr) {
- this.device_id = id;
- this.$router.push({
- path: `/index/DataPhotos`,
- query: { id: id, d_id: d_id, name: name, addr: addr }
- });
- },
- //设备控制
- EquipControl(d_id, device_id, device_name) {
- this.d_id = d_id;
- this.equipInfo = { device_id, device_name };
- this.$axios({
- method: 'POST',
- url:
- '/api/api_gateway?method=monitor_manage.cbd_manage.cbd_control_info',
- data: this.qs.stringify({ d_id, cmd: 'paramconf' })
- }).then(res => {
- if (res.data.data && Object.keys(res.data.data).length > 0) {
- let data = res.data.data;
- data.ds = Number(data.ds);
- data.st =
- data.st && data.st < 10 ? '0' + data.st + ':00' : data.st + ':00';
- data.et =
- data.et && data.et < 10 ? '0' + data.et + ':00' : data.et + ':00';
- // this.equipContrlForm = data;
- // console.log(data)
- var obj = {};
- console.log(data);
- console.log(data.ds);
- for (let kay in data) {
- if (typeof data[kay] == 'string' && kay !== 'st' && kay !== 'et') {
- var a = data[kay];
- if (Number(a) < 0) {
- obj[kay] = Number(data[kay]);
- } else if (Number(a) >= 0) {
- obj[kay] = parseInt(data[kay]);
- }
- } else {
- obj[kay] = data[kay];
- }
- }
- // this.equipContrlForm = data;
- console.log(obj);
- this.equipContrlForm = obj;
- }
- this.equipControlDialogVisible = true;
- });
- },
- //设备控制提交
- equipControlSubm() {
- let newForm = Object.assign({}, this.equipContrlForm); //深拷贝
- newForm.st = newForm.st + '';
- newForm.et = newForm.et + '';
- newForm.st && newForm.st.slice(0, 2).charAt(0) != '0'
- ? newForm.st.slice(0, 2)
- : newForm.st.slice(1, 2);
- newForm.et =
- newForm.et && newForm.et.slice(0, 2).charAt(0) != '0'
- ? newForm.et.slice(0, 2)
- : newForm.et.slice(1, 2);
- // console.log(newForm);
- for (let k in newForm) {
- if (typeof newForm[k] == 'number') {
- newForm[k] = newForm[k] + '';
- }
- }
- newForm.st = newForm.st.replace(':00', '');
- this.$delete(newForm, 'admin');
- console.log(newForm);
- this.releaseTF = true;
- this.$axios({
- method: 'POST',
- url:
- '/api/api_gateway?method=monitor_manage.cbd_manage.cbd_device_control',
- data: this.qs.stringify({
- d_id: this.d_id,
- config: JSON.stringify(newForm)
- })
- }).then(res => {
- if (res.data.message == '') {
- if (document.getElementsByClassName('el-message').length == 0) {
- this.$message.success('设备控制修改成功');
- }
- } else {
- if (document.getElementsByClassName('el-message').length == 0) {
- this.$message.error('设备控制修改失败');
- }
- }
- this.releaseTF = false;
- this.equipControlDialogVisible = false;
- });
- },
- resetEquipControlDialogClosed() {
- this.$refs.equipContrlRef.resetFields();
- this.ws = 0;
- },
- //害虫统计
- showTimeControlDialog(d_id, id, disable) {
- this.device_id = id;
- if (sessionStorage.getItem('myuser_type') == 1) {
- // 管理员
- this.$router.push({
- path: `/index/pestsStats/${d_id}/${id}`,
- query: { disable: disable }
- });
- } else {
- // 非管理员
- if (disable == 2) {
- // 计数
- this.$router.push({
- path: `/index/PestsStatsNumber/${d_id}/${id}`,
- query: { disable: disable }
- });
- } else if (disable == 1 || disable == 0) {
- // 识别开启或关闭
- this.$router.push({
- path: `/index/pestsStats/${d_id}/${id}`,
- query: { disable: disable }
- });
- }
- }
- },
- //设备控制->工作模式切换
- wsChange() {
- this.$confirm('确定修改工作模式?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(() => {
- this.$axios({
- method: 'POST',
- url:
- '/api/api_gateway?method=monitor_manage.cbd_manage.cbd_device_control',
- data: this.qs.stringify({
- device_type_id: 3,
- d_id: this.d_id,
- work_type: this.ws
- })
- }).then(res => {
- if (res.data.message == '') {
- if (document.getElementsByClassName('el-message').length == 0) {
- this.$message({
- type: 'success',
- message: '修改成功!'
- });
- }
- } else {
- if (document.getElementsByClassName('el-message').length == 0) {
- this.$message({
- type: 'error',
- message: res.data.message
- });
- }
- }
- });
- })
- .catch(() => {
- if (document.getElementsByClassName('el-message').length == 0) {
- this.$message({
- type: 'info',
- message: '已取消修改'
- });
- }
- });
- },
- equipOperation(item) {
- console.log(item);
- this.ruleForm.device_id = item.imei;
- this.ruleForm.device_name = item.device_name;
- this.ruleForm.lng = item.lng;
- this.ruleForm.lat = item.lat;
- this.ruleForm.point_id = item.point_id;
- this.d_id = item.d_id;
- this.equipInfo = {
- device_id: item.device_id,
- device_name: item.device_name
- };
- // for (var key in this.ruleForm) {
- // this.ruleForm[key] = e[key];
- // }
- this.ruleForm.org_id = [];
- this.ruleForm.oldorg_id = item.org_list;
- this.city(
- this.ToDigital(this.ruleForm.lat),
- this.ToDigital(this.ruleForm.lng)
- );
- // this.getmon3(item);
- this.operationDialogVisible = true;
- },
- getmon3(item) {
- //弃用
- this.$axios({
- method: 'POST',
- url:
- '/api/api_gateway?method=sysmenage.usermanager.get_parent_org_list',
- data: this.qs.stringify({
- device_id: item.d_id
- })
- }).then(res => {
- // console.log(res.data.data);
- var orgdatas = res.data.data;
- this.ruleForm.org_id = [];
- for (var i = 0; i < item.org_list.length; i++) {
- var arr = [item.org_list[i].org_id];
- this.ruleForm.org_id.push(arr);
- }
- if (orgdatas.length != 0) {
- for (var i = 0; i < orgdatas.length; i++) {
- if (orgdatas[i].lenngth != 0) {
- for (var j = 0; j < orgdatas[i].length; j++) {
- this.ruleForm.org_id[i].unshift(orgdatas[i][j].org_id);
- }
- }
- }
- }
- if (this.ruleForm.org_id[0] != this.versionsoptions[0].id) {
- this.ruleForm.org_id.unshift(this.versionsoptions[0].id);
- }
- console.log(this.ruleForm.org_id);
- });
- },
- // 设备版本、用户筛选
- searchChange() {
- console.log(this.queryInfo.selectUser);
- this.getEquipList();
- },
- mqttControl() {
- this.mqttDialogVisible = true;
- },
- mqttDialogClosed() {
- this.$refs.mqttConfigRef.resetFields();
- },
- mqttSubm() {
- this.$refs.mqttConfigRef.validate(valid => {
- console.log(valid);
- if (!valid) {
- return false;
- }
- let obj = {
- mqtt: {
- uid: this.mqttConfig.muid,
- pwd: this.mqttConfig.mpwd,
- ip: this.mqttConfig.mip,
- port: this.mqttConfig.mport,
- pub: this.mqttConfig.mpub,
- sub: this.mqttConfig.msub,
- keepalive: 60,
- lastwill: '/yfkj/cbd/offline/'
- },
- ftp: {
- uid: this.mqttConfig.fuid,
- pwd: this.mqttConfig.fpwd,
- ip: this.mqttConfig.fip,
- port: this.mqttConfig.fport
- }
- };
- this.$confirm('此操作将上传修改的MQTT配置, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(() => {
- this.$axios({
- method: 'POST',
- url:
- '/api/api_gateway?method=monitor_manage.cbd_manage.cbd_device_control',
- data: this.qs.stringify({
- device_type_id: 3,
- d_id: this.d_id,
- cmd: 'setnet',
- config: JSON.stringify(obj)
- })
- }).then(res => {
- if (res.data.message == '') {
- if (document.getElementsByClassName('el-message').length == 0) {
- this.$message.success('提交成功');
- }
- } else {
- if (document.getElementsByClassName('el-message').length == 0) {
- this.$message.error('提交失败');
- }
- }
- });
- this.mqttDialogVisible = false;
- })
- .catch(() => {
- if (document.getElementsByClassName('el-message').length == 0) {
- this.$message({
- type: 'info',
- message: '已取消',
- duration: 1500
- });
- }
- });
- });
- },
- mqttInfo() {
- this.$axios({
- method: 'POST',
- url:
- '/api/api_gateway?method=monitor_manage.cbd_manage.cbd_control_info',
- data: this.qs.stringify({
- d_id: this.d_id,
- cmd: 'netconf'
- })
- }).then(res => {
- if (res.data.message == '') {
- let { ftp, mqtt } = res.data.data;
- console.log(ftp, mqtt);
- this.mqttConfig = {
- muid: mqtt.uid,
- mpwd: mqtt.pwd,
- mip: mqtt.ip,
- mport: mqtt.port,
- mpub: mqtt.pub,
- msub: mqtt.sub,
- fuid: ftp.uid,
- fpwd: ftp.pwd,
- fip: ftp.ip,
- fport: ftp.port
- };
- }
- });
- this.mqttDialogVisible = true;
- },
- pestAll() {
- this.$router.push('/index/tongji');
- },
- devicePlant() {
- this.$router.push('/index/deviceTongji');
- },
- // 修改设备号 - 更换imei
- replaceImei() {
- console.log(this.d_id);
- this.$prompt('请输入imei', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消'
- })
- .then(({ value }) => {
- this.replaceImeiData = value;
- // this.equipBtnControl("imei");
- })
- .catch(() => {
- if (document.getElementsByClassName('el-message').length == 0) {
- this.$message({
- type: 'info',
- message: '取消输入'
- });
- }
- });
- },
- // 管理员操作 - 升级文件更新
- fileUploadSectionFile(param) {
- let that = this;
- let formData = new FormData();
- formData.append('fileName', param.file);
- that
- .$axios({
- method: 'POST',
- url: 'api/update/save_file',
- data: formData
- })
- .then(res => {
- console.log(res);
- if (res.data == 'OK' || res.data == 'OK!') {
- if (document.getElementsByClassName('el-message').length == 0) {
- this.$message({
- message: '文件上传成功',
- type: 'success',
- duration: 1500
- });
- }
- } else {
- if (document.getElementsByClassName('el-message').length == 0) {
- this.$message({
- message: res.data,
- type: 'warning',
- duration: 1500
- });
- }
- }
- })
- .catch(err => {
- console.log(err);
- });
- },
- // 管理员操作 - 开启关闭识别
- operationDiscern(val, id, operation) {
- if (val == 0) {
- // 当前处于识别关闭状态
- this.$confirm('确认关闭识别状态?')
- .then(_ => {
- this.operationDiscernAxios(id, 'disable');
- })
- .catch(_ => {});
- } else if (val == 1) {
- // 当前处于识别开启状态
- this.$confirm('确认开启识别状态?')
- .then(_ => {
- this.operationDiscernAxios(id, 'enable');
- })
- .catch(_ => {});
- } else if (val == 2) {
- // 当前处于识别开启状态
- this.$confirm('确认开启计数状态?')
- .then(_ => {
- this.operationDiscernAxios(id, 'count');
- })
- .catch(_ => {});
- }
- },
- operationDiscernAxios(id, req) {
- // ret=disable时禁用识别功能, ret=enable,时启用识别统计功能, ret =count 计数功能
- var that = this;
- that
- .$axios({
- method: 'post',
- url:
- '/api/api_gateway?method=monitor_manage.cbd_manage.disable_cbd_discern',
- data: that.qs.stringify({
- device_id: id, // 设备号
- ret: req // ret=disable时禁用识别功能, ret=enable,时启用识别统计功能
- })
- })
- .then(res => {
- if (res.data.data == true) {
- that.getEquipList(); //图片列表数据请求
- }
- })
- .catch(err => {
- console.log(err);
- if (document.getElementsByClassName('el-message').length == 0) {
- this.$message.error('操作失败,请重试!');
- }
- });
- },
- oldorgdelect(index) {
- this.ruleForm.oldorg_id.splice(index, 1);
- },
- submitForm(formName) {
- var org_id = [];
- if (Array.isArray(this.ruleForm.org_id)) {
- for (var i = 0; i < this.ruleForm.org_id.length; i++) {
- org_id.push(
- this.ruleForm.org_id[i][this.ruleForm.org_id[i].length - 1]
- );
- }
- } else {
- org_id = this.ruleForm.org_id;
- }
- for (var i = 0; i < this.ruleForm.oldorg_id.length; i++) {
- if (org_id.length > 0) {
- if (org_id.indexOf(this.ruleForm.oldorg_id[i].org_id) == -1) {
- org_id.push(this.ruleForm.oldorg_id[i].org_id);
- }
- } else {
- org_id.push(this.ruleForm.oldorg_id[i].org_id);
- }
- }
- if (org_id.length > 0) {
- org_id = org_id.join('/');
- } else {
- this.$message({
- message: '请选择隶属组织',
- type: 'warning'
- });
- return;
- }
- console.log(org_id);
- if (this.ruleForm.basecity == '请重新选择地址') {
- this.$message({
- showClose: true,
- message: '请重新选择地址',
- type: 'warning'
- });
- this.releaseTF = false;
- return;
- }
- this.$refs[formName].validate(valid => {
- if (valid) {
- this.releaseTF = true;
- this.$axios({
- method: 'POST',
- url:
- '/api/api_gateway?method=monitor_manage.cbd_manage.add_device_info',
- data: this.qs.stringify({
- org_id: org_id, // 非必传(num) 诱捕器id 修改项
- point_id: this.ruleForm.point_id, // 必传(string) 设备编号
- lat: this.ToDegrees(this.ruleForm.lat, 'lat'), // 必传(string) 纬度
- lng: this.ToDegrees(this.ruleForm.lng, 'lng'), //
- device_id: this.ruleForm.device_id,
- device_name: this.ruleForm.device_name,
- city: this.ruleForm.basecity
- })
- })
- .then(res => {
- console.log(res);
- if (res.data.data) {
- // var message = "";
- // if (this.parameter == "add") {
- // // console.log(this.$data.addtitle)
- // message = "添加成功!";
- // } else if (this.parameter == "modify") {
- // message = "修改成功!";
- // }
- if (document.getElementsByClassName('el-message').length == 0) {
- this.$message({
- showClose: true,
- message: '修改成功!',
- type: 'success'
- });
- }
- this.operationDialogVisible = false;
- this.getEquipList();
- } else {
- if (document.getElementsByClassName('el-message').length == 0) {
- this.$message({
- showClose: true,
- message: '添加失败' + res.data.message,
- type: 'warning'
- });
- }
- }
- this.releaseTF = false;
- })
- .finally(() => {
- this.releaseTF = false;
- });
- } else {
- if (document.getElementsByClassName('el-message').length == 0) {
- this.$message({
- message: '请将信息填写完全',
- type: 'warning'
- });
- }
- return false;
- }
- });
- },
- resetForm(formName) {
- this.operationDialogVisible = false;
- this.$refs[formName].resetFields();
- for (var key in this.ruleForm) {
- this.ruleForm[key] = '';
- }
- },
- getmon() {
- //获取监测点列表 组织列表
- this.$axios({
- method: 'POST',
- url: '/api/api_gateway?method=sysmenage.usermanager.org_list',
- data: this.qs.stringify({
- page_item: '100000000'
- })
- }).then(res => {
- console.log(res.data.data);
- // this.versionsoptions = res.data.data.page_list; //组织
- var arr = res.data.data.page_list; //组织
- console.log(this.versionsoptions);
- if (arr[0].parent_name == '根组织') {
- this.versionsoptions = arr;
- } else {
- // var obj = {
- // id: 148,
- // org_name: '研发部',
- // childrens: []
- // };
- // for (var i = 0; i < arr.length; i++) {
- // obj.childrens.push(arr[i]);
- // obj.id = arr[0].parent_id;
- // obj.org_name = arr[0].parent_name;
- // }
- // this.versionsoptions.push(obj);
- this.versionsoptions = arr;
- }
- console.log(this.versionsoptions);
- this.traponsoptions = res.data.data.point_data;
- this.inducer_data = res.data.data.inducer_data;
- });
- },
- init() {
- console.log(document.getElementById('mapContainer2'));
- var map = new AMap.Map('mapContainer2', {
- center: this.center,
- resizeEnable: true,
- zoom: 10
- });
- AMap.plugin(['AMap.ToolBar', 'AMap.Geocoder'], () => {
- map.addControl(new AMap.ToolBar());
- this.geocoder = new AMap.Geocoder({
- city: '全国',
- radius: 1000
- });
- });
- setTimeout(() => {
- var marker = new AMap.Marker({
- position: this.center
- });
- console.log(this.center);
- marker.setMap(map);
- }, 1000);
- this.map = map;
- this.testevent();
- },
- addrChange() {
- //位置搜索
- var marker = new AMap.Marker();
- this.geocoder.getLocation(this.addr, (status, result) => {
- if (status === 'complete' && result.geocodes.length) {
- var lnglat = result.geocodes[0].location;
- marker.setPosition(lnglat);
- this.map.add(marker);
- this.map.setFitView(marker);
- this.locationForm = {
- lat: lnglat.lat,
- lng: lnglat.lng
- };
- } else {
- if (document.getElementsByClassName('el-message').length == 0) {
- this.$message.error('根据地址查询位置失败');
- }
- }
- });
- },
- // 地图点击事件
- testevent() {
- this.map.on('click', ev => {
- var lnglat = [ev.lnglat.lng, ev.lnglat.lat];
- this.locationForm = { lng: lnglat[0], lat: lnglat[1] };
- this.map.clearMap();
- var marker = new AMap.Marker({
- position: lnglat
- });
- marker.setMap(this.map);
- this.getAddress(lnglat);
- setTimeout(() => {
- new AMap.InfoWindow({
- content: '<h5>' + '当前选中地址' + '</h5>' + this.address,
- offset: new AMap.Pixel(0, -32)
- }).open(this.map, lnglat);
- }, 100);
- });
- },
- getAddress(lnglat) {
- AMap.plugin('AMap.Geocoder', () => {
- this.geocoder.getAddress(lnglat, (status, result) => {
- if (status === 'complete' && result.info === 'OK') {
- this.address = result.regeocode.formattedAddress;
- }
- });
- });
- },
- addLocationSubm() {
- //点击确定
- this.ruleForm.lng = this.locationForm.lng;
- this.ruleForm.lat = this.locationForm.lat;
- console.log(this.ruleForm);
- this.city(
- this.ToDigital(this.ruleForm.lat),
- this.ToDigital(this.ruleForm.lng)
- );
- this.addLocationDialogVisible = false;
- },
- addLocationDialogClosed() {
- //弹框关闭时
- // this.locationForm = { lat: "", lng: "" };
- this.center = [114.05, 22.55];
- this.map = null;
- },
- locationSearch() {
- if (this.locationForm.lat && this.locationForm.lng) {
- let lnglat = [this.locationForm.lng, this.locationForm.lat];
- var marker = new AMap.Marker({
- position: lnglat
- });
- marker.setMap(this.map);
- } else {
- if (document.getElementsByClassName('el-message').length == 0) {
- this.$message.warning('请输入经纬度!');
- }
- // return fasle;
- }
- },
- dingwei() {
- if (this.ruleForm.lng != '' && this.ruleForm.lng != 0) {
- this.center[0] = this.ToDigital(this.ruleForm.lng);
- }
- if (this.ruleForm.lat != '' && this.ruleForm.lat != 0) {
- this.center[1] = this.ToDigital(this.ruleForm.lat);
- }
- this.addLocationDialogVisible = true;
- setTimeout(() => {
- this.init();
- }, 500);
- },
- //度转度°分′秒″
- ToDegrees(val, type) {
- if (typeof val == 'undefined' || val == '' || isNaN(val)) {
- return val;
- }
- val = val.toString();
- var A = '';
- if (type == 'lng') {
- A = val > 0 ? 'E' : 'W';
- } else if (type == 'lat') {
- A = val > 0 ? 'N' : 'S';
- }
- var i = val.indexOf('.');
- var strDu = i < 0 ? val : val.substring(0, i); //获取度
- var strFen = 0;
- var strMiao = 0;
- if (i > 0) {
- var strFen = '0' + val.substring(i);
- strFen = strFen * 60 + '';
- i = strFen.indexOf('.');
- if (i > 0) {
- strMiao = '0' + strFen.substring(i);
- strFen = strFen.substring(0, i); //获取分
- strMiao = strMiao * 60 + '';
- i = strMiao.indexOf('.');
- strMiao = strMiao.substring(0, i + 4); //取到小数点后面三位
- strMiao = parseFloat(strMiao).toFixed(2); //精确小数点后面两位
- }
- }
- console.log(strDu, strFen, strMiao);
- return strDu + '°' + strFen + '′' + strMiao + '″' + A;
- },
- //度°分′秒″转度
- ToDigital(lnglat) {
- console.log(lnglat);
- if (!isNaN(lnglat)) {
- return lnglat;
- }
- lnglat = lnglat.toString();
- var strDu, strFen, strMiao;
- var duindex = lnglat.indexOf('°'); //字符度的下标
- var fenindex = lnglat.indexOf('′'); //字符分的下标
- var miaoindex = lnglat.indexOf('″'); //字符秒的下标
- strDu = lnglat.slice(0, duindex);
- strFen = lnglat.slice(duindex + 1, fenindex);
- strMiao = lnglat.slice(fenindex + 1, miaoindex);
- // len = len > 6 || typeof len == "undefined" ? 6 : len; //精确到小数点后最多六位
- strDu =
- typeof strDu == 'undefined' || strDu == '' ? 0 : parseFloat(strDu);
- strFen =
- typeof strFen == 'undefined' || strFen == ''
- ? 0
- : parseFloat(strFen) / 60;
- strMiao =
- typeof strMiao == 'undefined' || strMiao == ''
- ? 0
- : parseFloat(strMiao) / 3600;
- var digital = strDu + strFen + strMiao;
- if (digital == 0) {
- return '';
- } else {
- return digital.toFixed(6);
- }
- },
- orglisthover(e) {
- console.log(e);
- var str = ``;
- for (var i = 0; i < e.org_list.length; i++) {
- str += `<p>` + e.org_list[i].org_name + `</p>`;
- }
- this.content = str;
- },
- city(lat, lng) {
- $.ajax({
- url: 'https://restapi.amap.com/v3/geocode/regeo',
- type: 'get',
- dataType: 'jsonp',
- data: this.qs.stringify({
- location: lng + ',' + lat,
- key: '78ce288400f4fc6d9458989875c833c2',
- extensions: 'base'
- }),
- success: res => {
- console.log(res);
- if (res.regeocode.addressComponent.city.length == 0) {
- this.ruleForm.basecity = '请重新选择地址';
- } else {
- this.ruleForm.basecity = res.regeocode.addressComponent.city;
- }
- console.log(this.ruleForm);
- },
- error: function(err) {
- // alert("服务端错误,请刷新浏览器后重试");
- }
- });
- // return arr;
- },
- latblur() {
- if (this.ruleForm.lat != '' && this.ruleForm.lng != '') {
- this.city(
- this.ToDigital(this.ruleForm.lat),
- this.ToDigital(this.ruleForm.lng)
- );
- }
- }
- },
- components: {
- SearchBar,
- EquipItem
- // TopModule
- }
- };
- </script>
- <style lang="less" scoped>
- // 去除下拉框的边框
- .my-el-select /deep/ .el-input .el-input__inner {
- border: 0 !important;
- }
- .handAddForm {
- /deep/.el-form-item {
- margin-bottom: 8px;
- }
- .handAddFormBtn {
- text-align: right;
- }
- }
- .sliderParent {
- display: flex;
- .block {
- flex: 1;
- margin-right: 10px;
- /deep/.el-slider__runway,
- /deep/.el-slider__bar {
- height: 10px;
- }
- }
- > span {
- width: 40px;
- }
- }
- .swi-box {
- text-align: center;
- padding: 10px 0;
- label {
- color: #333;
- margin-right: 8px;
- font-size: 14px;
- }
- i.el-icon-edit {
- margin-right: 8px;
- }
- }
- .buttonbox {
- margin-bottom: 23px;
- padding-left: 100px;
- /deep/.el-button {
- background-color: #409eff;
- border-color: #409eff;
- }
- }
- .real-time {
- display: flex;
- justify-content: left;
- align-items: center;
- padding: 20px 0;
- .left {
- margin-right: 10px;
- .icon-box {
- border-radius: 50%;
- width: 46px;
- height: 46px;
- padding: 5px;
- box-sizing: border-box;
- margin-bottom: 3px;
- img {
- width: 100%;
- height: auto;
- }
- }
- .aisle {
- text-align: center;
- font-size: 14px;
- color: #666;
- }
- }
- .right {
- color: #333;
- .num {
- font-weight: 600;
- font-size: 20px;
- margin-bottom: 3px;
- }
- .unit {
- font-size: 14px;
- color: #666;
- }
- }
- }
- .checkData {
- text-align: right;
- font-size: 14px;
- span {
- cursor: pointer;
- }
- }
- .red {
- color: rgb(235, 103, 101);
- }
- .green {
- color: rgb(23, 187, 137);
- }
- .el-date-editor--time-select {
- width: 100% !important;
- }
- .el-form .line {
- text-align: center;
- }
- .el-select {
- width: 100%;
- }
- .tit {
- font-weight: 800;
- margin: 15px 0 8px 0;
- }
- .item {
- margin-bottom: 10px;
- }
- .onlineState {
- margin: 0 3px 0 3px;
- }
- .onlineState .icon-diannao {
- margin: 0 19px 0 -2px !important;
- }
- .search-box {
- position: relative;
- .pestAll {
- position: absolute;
- top: 1px;
- // right: 740px;
- left: 225px;
- }
- .devicePlant {
- position: absolute;
- top: 1px;
- // right: 816px;
- left: 140px;
- }
- }
- .haiguan {
- display: flex;
- flex-wrap: wrap;
- margin-top: 5px;
- .haiguan_item {
- // width: 70px;
- height: 20px;
- border: 1px solid #d4d2d2;
- line-height: 20px;
- margin-right: 10px;
- padding: 2px 10px;
- border-radius: 5px;
- }
- .haiguan_itemnone {
- line-height: 20px;
- }
- }
- // 表格文字居中
- /deep/.el-table th > .cell {
- // text-align: center;
- }
- /deep/.el-table .cell {
- // text-align: center;
- }
- // 按钮
- .btns {
- /deep/.el-button--mini {
- padding: 6px 8px !important;
- }
- /deep/.el-button--info {
- color: #fff;
- background-color: #409eff;
- border-color: #409eff;
- }
- }
- </style>
|