Cbd.vue 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959
  1. <template>
  2. <div style="cursor: default; width: 99%">
  3. <div class="search-box">
  4. <search-bar
  5. @fun="getDisplayType"
  6. :displayType="displayType"
  7. @fun2="getIDName"
  8. @fun3="getIsOnline"
  9. ref="screenData"
  10. >
  11. <template slot="search-box">
  12. <template v-if="userType == 1">
  13. <el-select
  14. v-model="queryInfo.dver"
  15. class="select01"
  16. clearable
  17. size="mini"
  18. placeholder="请选择设备版本"
  19. @change="searchChange()"
  20. >
  21. <el-option
  22. v-for="item in dverGather"
  23. :key="item.value"
  24. :label="item.label"
  25. :value="item.value"
  26. ></el-option>
  27. </el-select>
  28. </template>
  29. </template>
  30. </search-bar>
  31. <!-- <el-button
  32. class="devicePlant"
  33. type="primary"
  34. size="mini"
  35. v-btnRight:pestRanking="$route.path"
  36. @click="devicePlant"
  37. >害虫排名</el-button
  38. >
  39. <el-button
  40. class="pestAll"
  41. type="primary"
  42. size="mini"
  43. v-btnRight:pestAnalysis="$route.path"
  44. @click="pestAll"
  45. >害虫分析</el-button
  46. > -->
  47. </div>
  48. <template v-if="displayType == 1">
  49. <el-row :gutter="10" v-loading="loading">
  50. <el-col
  51. :xs="24"
  52. :sm="24"
  53. :md="12"
  54. :lg="8"
  55. :xl="6"
  56. v-for="item in equipList"
  57. :key="item.imei"
  58. style="margin-bottom:10px;"
  59. >
  60. <el-card class="box-card">
  61. <equip-item :is_online="item.device_status">
  62. <span
  63. slot="set"
  64. class="superOperate el-icon-setting"
  65. @click="equipOperation(item)"
  66. ></span>
  67. <span slot="title">智能测报灯</span>
  68. <div slot="content" class="content">
  69. <p :title="item.device_name">
  70. <i class="iconfont icon-biaoqian"></i>
  71. 设备名称:{{
  72. (item.device_name == '' ? '无' : item.device_name)
  73. | ellipsis
  74. }}
  75. </p>
  76. <p>
  77. <i class="iconfont icon-yonghu"></i>
  78. 设备ID:{{ item.imei }}
  79. </p>
  80. <p>
  81. <i class="iconfont icon-yonghu"></i>
  82. 隶属组织 :
  83. <span v-if="item.org_list.length == 1">{{
  84. item.org_list[0].org_name
  85. }}</span>
  86. <el-popover
  87. ref="popover"
  88. placement="right"
  89. title=""
  90. width="150"
  91. trigger="hover"
  92. v-else
  93. >
  94. <div class="popover-content" v-html="content"></div>
  95. <span @mouseover="orglisthover(item)" slot="reference"
  96. >{{
  97. item.org_list.length == 0
  98. ? '暂无组织'
  99. : item.org_list[0].org_name
  100. }}...</span
  101. >
  102. </el-popover>
  103. </p>
  104. <p>
  105. <i class="iconfont icon-biaoqian"></i>
  106. 所属监测点 : {{ item.point_name }}
  107. </p>
  108. <p class="onlineState">
  109. <i class="iconfont icon-diannao"></i>在线状态:
  110. <span
  111. :class="{
  112. red: item.is_online == 0,
  113. green: item.is_online == 1
  114. }"
  115. >
  116. {{ equipStateDict.is_online.value[item.is_online] }}
  117. </span>
  118. </p>
  119. <p :title="item.address">
  120. <i class="iconfont icon-dizhi"></i>
  121. 地址 : {{ (item.address || '无') | ellipsis }}
  122. </p>
  123. <p>
  124. <i class="iconfont icon-shijian"></i>
  125. 最新上报时间 : {{ (item.uptime * 1000) | formatTime }}
  126. </p>
  127. <p v-if="userType == 1">
  128. <i class="iconfont icon-chouchongbug"></i>
  129. 识别 :
  130. <el-select
  131. @change="operationDiscern($event, item.imei, item.disable)"
  132. class="my-el-select"
  133. style="width: 100px; border: 0; font-size: 15px"
  134. size="mini"
  135. v-model="item.insectVal"
  136. placeholder="请选择"
  137. >
  138. <el-option
  139. v-for="itemA in insectOptions"
  140. :key="itemA.value"
  141. :label="itemA.label"
  142. :value="itemA.value"
  143. >
  144. </el-option>
  145. </el-select>
  146. </p>
  147. <p class="btns" style="width: 367px">
  148. <i class="iconfont icon-yemiancaozuo"></i>
  149. <el-button
  150. v-btnRight:seePicture="$route.path"
  151. size="mini"
  152. type="info"
  153. @click="
  154. viewPhotoDialog(
  155. item.imei,
  156. item.d_id,
  157. item.device_name,
  158. item.address
  159. )
  160. "
  161. >查看图片</el-button
  162. >
  163. <el-button
  164. v-btnRight:deviceControl="$route.path"
  165. size="mini"
  166. type="warning"
  167. @click="
  168. EquipControl(item.d_id, item.imei, item.device_name)
  169. "
  170. >设备控制</el-button
  171. >
  172. <el-button
  173. v-btnRight:pestStatistics="$route.path"
  174. size="mini"
  175. type="success"
  176. @click="
  177. showTimeControlDialog(item.d_id, item.imei, item.disable)
  178. "
  179. >害虫统计</el-button
  180. >
  181. <el-button
  182. v-btnRight:dataDetails="$route.path"
  183. size="mini"
  184. type="danger"
  185. @click="dataDetails(item.imei, item.d_id, item)"
  186. >数据详情</el-button
  187. >
  188. <!-- <el-button
  189. v-show="userType == 1"
  190. v-btnRight:dataDetails="$route.path"
  191. :type="item.disable == '0' ? 'warning' : 'danger'"
  192. size="mini"
  193. @click="operationDiscern(item.id, item.disable)"
  194. >{{
  195. item.disable == "0" ? "开启识别" : "关闭识别"
  196. }}</el-button
  197. > -->
  198. </p>
  199. </div>
  200. </equip-item>
  201. </el-card>
  202. </el-col>
  203. </el-row>
  204. </template>
  205. <template v-if="displayType == 2">
  206. <el-card class="box-card">
  207. <el-table
  208. v-loading="loading"
  209. :data="equipList"
  210. stripe
  211. style="width: 100%"
  212. >
  213. <el-table-column prop="device_name" label="设备名称" width="180">
  214. <template slot-scope="scope">{{
  215. scope.row.device_name == '' ? '无' : scope.row.device_name
  216. }}</template>
  217. </el-table-column>
  218. <el-table-column prop="device_id" label="设备ID" width="180">
  219. <template slot-scope="scope">{{ scope.row.imei }}</template>
  220. </el-table-column>
  221. <el-table-column prop="device_status" label="在线状态">
  222. <template slot-scope="scope">
  223. <p style="color: #17bb89" v-if="scope.row.is_online == 1">在线</p>
  224. <p style="color: #eb6765" v-if="scope.row.is_online == 0">离线</p>
  225. </template>
  226. </el-table-column>
  227. <el-table-column prop="dtype" label="组织">
  228. <template slot-scope="scope">
  229. <span v-if="scope.row.org_list.length == 1">{{
  230. scope.row.org_list[0].org_name
  231. }}</span>
  232. <el-popover
  233. ref="popover"
  234. placement="right"
  235. title="组织列表"
  236. width="150"
  237. trigger="hover"
  238. v-else
  239. >
  240. <div class="popover-content" v-html="content"></div>
  241. <span @mouseover="orglisthover(scope.row)" slot="reference"
  242. >{{
  243. scope.row.org_list.length == 0
  244. ? '暂无组织'
  245. : scope.row.org_list[0].org_name
  246. }}...</span
  247. >
  248. </el-popover>
  249. </template>
  250. </el-table-column>
  251. <el-table-column prop="status_time" label="最新上报时间">
  252. <template slot-scope="scope">{{
  253. (scope.row.uptime * 1000) | formatTime
  254. }}</template>
  255. </el-table-column>
  256. <el-table-column prop="address" label="地址">
  257. <template slot-scope="scope" :title="scope.row.address">{{
  258. scope.row.address || '无' | ellipsis
  259. }}</template>
  260. </el-table-column>
  261. <el-table-column label="操作" width="400">
  262. <template slot-scope="scope">
  263. <el-button
  264. v-btnRight:seePicture="$route.path"
  265. size="mini"
  266. type="info"
  267. @click="
  268. viewPhotoDialog(
  269. scope.row.imei,
  270. scope.row.d_id,
  271. scope.row.device_name,
  272. scope.row.address
  273. )
  274. "
  275. >查看图片</el-button
  276. >
  277. <el-button
  278. v-btnRight:deviceControl="$route.path"
  279. size="mini"
  280. type="warning"
  281. @click="
  282. EquipControl(
  283. scope.row.d_id,
  284. scope.row.imei,
  285. scope.row.device_name
  286. )
  287. "
  288. >设备控制</el-button
  289. >
  290. <el-button
  291. v-btnRight:pestStatistics="$route.path"
  292. size="mini"
  293. type="success"
  294. @click="
  295. showTimeControlDialog(
  296. scope.row.d_id,
  297. scope.row.imei,
  298. scope.row.disable
  299. )
  300. "
  301. >害虫统计</el-button
  302. >
  303. <!-- <el-button
  304. v-btnRight:dataDetails="$route.path"
  305. size="mini"
  306. type="danger"
  307. @click="dataDetails(scope.row.imei, scope.row.d_id, scop.row)"
  308. >数据详情</el-button
  309. > -->
  310. <el-button
  311. v-btnRight:dataDetails="$route.path"
  312. size="mini"
  313. type="danger"
  314. @click="dataDetails(scope.row.imei, scope.row.d_id, scope.row)"
  315. >数据详情</el-button
  316. >
  317. </template>
  318. </el-table-column>
  319. </el-table>
  320. </el-card>
  321. </template>
  322. <!-- 暂无数据 -->
  323. <div
  324. class="expertDiagnosis_referral_units_not"
  325. v-if="equipList.length <= 0 && displayType == 1"
  326. >
  327. <img
  328. :src="$imghost + zanwu"
  329. alt
  330. class="expertDiagnosis_referral_units_notImg"
  331. />
  332. </div>
  333. <el-pagination
  334. v-if="equipList.length > 0"
  335. background
  336. :page-size="8"
  337. layout="prev, pager, next, jumper"
  338. :total="totalNum"
  339. :current-page="queryInfo.page"
  340. @current-change="changePage"
  341. ></el-pagination>
  342. <!-- 设备控制对话框 -->
  343. <el-dialog
  344. title="设备控制"
  345. :visible.sync="equipControlDialogVisible"
  346. @close="resetEquipControlDialogClosed"
  347. width="600px"
  348. :close-on-click-modal="false"
  349. :close-on-press-escape="false"
  350. >
  351. <div class="handAddForm">
  352. <el-form
  353. ref="equipContrlRef"
  354. :model="equipContrlForm"
  355. label-position="right"
  356. label-width="150px"
  357. >
  358. <el-form-item label="设备编号:">
  359. <el-input disabled v-model="equipInfo.device_id"></el-input>
  360. </el-form-item>
  361. <el-form-item label="设备名称:" v-if="equipInfo.device_name">
  362. <el-input disabled v-model="equipInfo.device_name"></el-input>
  363. </el-form-item>
  364. <el-form-item label="设备开关:" prop="ds">
  365. <el-select v-model="equipContrlForm.ds">
  366. <el-option label="开机" :value="1"></el-option>
  367. <el-option label="关机" :value="0"></el-option>
  368. </el-select>
  369. </el-form-item>
  370. <!-- <el-form-item label="工作状态:" prop="ws">
  371. <el-select
  372. v-model="ws"
  373. placeholder="请选择工作状态"
  374. @change="wsChange()"
  375. >
  376. <el-option label="待机" :value="0"></el-option>
  377. <el-option label="工作" :value="1"></el-option>
  378. </el-select>
  379. </el-form-item> -->
  380. <!-- <el-form-item label="定时模式:" prop="ts">
  381. <el-select
  382. v-model="equipContrlForm.ts"
  383. placeholder="请选择定时模式"
  384. >
  385. <el-option label="光控" :value="0"></el-option>
  386. <el-option label="时控" :value="1"></el-option>
  387. </el-select>
  388. </el-form-item> -->
  389. <!-- <el-form-item v-if="equipContrlForm.ts == 1" label="开始结束时间:">
  390. <el-col :span="11">
  391. <el-time-select
  392. placeholder="起始时间"
  393. v-model="equipContrlForm.st"
  394. :picker-options="{
  395. start: '00:00',
  396. step: '01:00',
  397. end: '23:00',
  398. }"
  399. ></el-time-select>
  400. </el-col>
  401. <el-col class="line" :span="2">-</el-col>
  402. <el-col :span="11">
  403. <el-time-select
  404. placeholder="结束时间"
  405. v-model="equipContrlForm.et"
  406. :picker-options="{
  407. start: '00:00',
  408. step: '01:00',
  409. end: '23:00',
  410. }"
  411. ></el-time-select>
  412. </el-col>
  413. </el-form-item> -->
  414. <!-- <el-form-item
  415. v-if="equipContrlForm.ts != 1"
  416. label="定时时长(h):"
  417. prop="tt"
  418. >
  419. <div class="sliderParent">
  420. <div class="block">
  421. <el-slider
  422. v-model="equipContrlForm.tt"
  423. show-input
  424. :min="1"
  425. :max="10"
  426. ></el-slider>
  427. </div>
  428. </div>
  429. </el-form-item> -->
  430. <el-form-item label="落虫时间(min):" prop="collt">
  431. <div class="sliderParent">
  432. <div class="block">
  433. <el-slider
  434. v-model="equipContrlForm.collt"
  435. show-input
  436. :min="1"
  437. :max="20"
  438. ></el-slider>
  439. </div>
  440. </div>
  441. </el-form-item>
  442. <el-form-item label="加热时间(min):" prop="htim">
  443. <div class="sliderParent">
  444. <div class="block">
  445. <el-slider
  446. v-model="equipContrlForm.htim"
  447. show-input
  448. :min="1"
  449. :max="20"
  450. ></el-slider>
  451. </div>
  452. </div>
  453. </el-form-item>
  454. <el-form-item label="加热温度(℃):" prop="hst">
  455. <div class="sliderParent">
  456. <div class="block">
  457. <el-slider
  458. v-model="equipContrlForm.hst"
  459. show-input
  460. :min="75"
  461. :max="120"
  462. ></el-slider>
  463. </div>
  464. </div>
  465. </el-form-item>
  466. <el-form-item label="高温保护阈值(℃):" prop="tph">
  467. <div class="sliderParent">
  468. <div class="block">
  469. <el-slider
  470. v-model="equipContrlForm.tph"
  471. show-input
  472. :min="50"
  473. :max="70"
  474. ></el-slider>
  475. </div>
  476. </div>
  477. </el-form-item>
  478. <el-form-item label="低温保护阈值(℃):" prop="tpl">
  479. <div class="sliderParent">
  480. <div class="block">
  481. <el-slider
  482. v-model="equipContrlForm.tpl"
  483. show-input
  484. :min="-20"
  485. :max="10"
  486. ></el-slider>
  487. </div>
  488. </div>
  489. </el-form-item>
  490. <el-form-item label="数据上传间隔(min):" prop="datt">
  491. <div class="sliderParent">
  492. <div class="block">
  493. <el-slider
  494. v-model="equipContrlForm.datt"
  495. :step="10"
  496. show-input
  497. :min="10"
  498. :max="60"
  499. ></el-slider>
  500. </div>
  501. </div>
  502. </el-form-item>
  503. <!-- <el-form-item label="图片分辨率:" prop="imgres">
  504. <el-select
  505. v-model="equipContrlForm.imgres"
  506. placeholder="请选择图片分辨率"
  507. >
  508. <el-option label="高" :value="0"></el-option>
  509. <el-option label="中" :value="1"></el-option>
  510. <el-option label="低" :value="2"></el-option>
  511. </el-select>
  512. </el-form-item> -->
  513. <el-form-item class="handAddFormBtn">
  514. <el-button
  515. type="primary"
  516. size="mini"
  517. @click="equipControlSubm()"
  518. :disabled="releaseTF"
  519. >{{ releaseTF ? '发布中...' : '确定' }}</el-button
  520. >
  521. <el-button size="mini" @click="equipControlDialogVisible = false"
  522. >取消</el-button
  523. >
  524. </el-form-item>
  525. </el-form>
  526. </div>
  527. </el-dialog>
  528. <!-- 管理员操作弹框 -->
  529. <el-dialog
  530. title="智能测报灯设置"
  531. :visible.sync="operationDialogVisible"
  532. width="580px"
  533. :close-on-click-modal="false"
  534. :close-on-press-escape="false"
  535. >
  536. <div>
  537. <el-form
  538. :model="ruleForm"
  539. :rules="rules"
  540. ref="ruleForm"
  541. label-width="100px"
  542. class="demo-ruleForm"
  543. >
  544. <el-form-item label="设备名称" prop="device_name">
  545. <el-input v-model="ruleForm.device_name"></el-input>
  546. </el-form-item>
  547. <el-form-item label="已绑定组织" prop="oldorg_id">
  548. <div class="haiguan">
  549. <p
  550. class="haiguan_item"
  551. v-for="(item, index) in ruleForm.oldorg_id"
  552. :key="item.id"
  553. >
  554. <span style="margin-right: 5px">{{ item.org_name }}</span>
  555. <span style="font-size: 16px" @click="oldorgdelect(index)"
  556. >×</span
  557. >
  558. </p>
  559. <p v-if="ruleForm.oldorg_id.length == 0" class="haiguan_itemnone">
  560. 暂无绑定
  561. </p>
  562. </div>
  563. </el-form-item>
  564. <el-form-item label="隶属组织" prop="org_id">
  565. <el-cascader
  566. :change-on-select="true"
  567. v-model="ruleForm.org_id"
  568. :options="versionsoptions"
  569. :props="defaultParams"
  570. :clearable="true"
  571. placeholder="请选择隶属组织"
  572. filterable
  573. ></el-cascader>
  574. </el-form-item>
  575. <el-form-item label="所在监测点" prop="point_id">
  576. <el-select
  577. v-model="ruleForm.point_id"
  578. placeholder="请选择所在监测点"
  579. filterable
  580. >
  581. <el-option
  582. v-for="item in traponsoptions"
  583. :label="item.point_name"
  584. :value="item.point_id"
  585. :key="item.point_id"
  586. ></el-option>
  587. </el-select>
  588. </el-form-item>
  589. <div class="addtrapbox" style="display: flex">
  590. <el-form-item label="所在经度" prop="lng">
  591. <el-input v-model="ruleForm.lng" @blur="latblur"></el-input>
  592. <p style="height: 24px; padding-left: 16px">
  593. <!-- {{ ToDegrees(ruleForm.lng, "lng") }} -->
  594. {{
  595. isNaN(ruleForm.lng)
  596. ? ToDigital(ruleForm.lng, 'lng')
  597. : ToDegrees(ruleForm.lng, 'lng')
  598. }}
  599. </p>
  600. </el-form-item>
  601. <el-form-item label="所在纬度" prop="lat">
  602. <el-input v-model="ruleForm.lat" @blur="latblur"></el-input>
  603. <p style="height: 24px; padding-left: 16px">
  604. <!-- {{ ToDegrees(ruleForm.lat, "lat") }} -->
  605. {{
  606. isNaN(ruleForm.lat)
  607. ? ToDigital(ruleForm.lat, 'lat')
  608. : ToDegrees(ruleForm.lat, 'lat')
  609. }}
  610. </p>
  611. </el-form-item>
  612. </div>
  613. <div class="buttonbox">
  614. <el-button type="info" size="mini" @click="dingwei"
  615. >地图选点</el-button
  616. >
  617. </div>
  618. <el-form-item label="所在城市" prop="basecity">
  619. <el-input
  620. v-model="ruleForm.basecity"
  621. disabled
  622. style="width: 217px"
  623. ></el-input>
  624. </el-form-item>
  625. </el-form>
  626. </div>
  627. <span slot="footer" class="dialog-footer">
  628. <el-button @click="resetForm('ruleForm')" size="mini">取 消</el-button>
  629. <el-button
  630. type="primary"
  631. @click="submitForm('ruleForm')"
  632. size="mini"
  633. :disabled="releaseTF"
  634. >{{ releaseTF ? '发布中...' : '确 定' }}</el-button
  635. >
  636. </span>
  637. </el-dialog>
  638. <el-dialog
  639. class="map_dialog"
  640. title="地图选点"
  641. :visible.sync="addLocationDialogVisible"
  642. width="820px"
  643. @closed="addLocationDialogClosed"
  644. :close-on-click-modal="false"
  645. >
  646. <el-form
  647. :inline="true"
  648. :model="locationForm"
  649. class="demo-form-inline"
  650. size="mini"
  651. >
  652. <el-form-item label="经度">
  653. <el-input clearable v-model="locationForm.lng"></el-input>
  654. </el-form-item>
  655. <el-form-item label="纬度">
  656. <el-input clearable v-model="locationForm.lat"></el-input>
  657. </el-form-item>
  658. <el-form-item>
  659. <el-button type="primary" size="mini" @click="locationSearch"
  660. >定位</el-button
  661. >
  662. </el-form-item>
  663. <el-form-item label="">
  664. <el-input
  665. placeholder="请输入地区检索"
  666. v-model="addr"
  667. clearable
  668. @change="addrChange()"
  669. ></el-input>
  670. </el-form-item>
  671. </el-form>
  672. <div class="amap-demo" id="mapContainer2" style="height: 400px"></div>
  673. <span slot="footer" class="dialog-footer">
  674. <el-button @click="addLocationDialogVisible = false" size="mini"
  675. >取 消</el-button
  676. >
  677. <el-button type="primary" @click="addLocationSubm" size="mini"
  678. >确 定</el-button
  679. >
  680. </span>
  681. </el-dialog>
  682. </div>
  683. </template>
  684. <script>
  685. import SearchBar from '@/components/SearchBar';
  686. // import TopModule from "@/components/TopModule";
  687. import EquipItem from '@/components/EquipItem';
  688. import Circulation from '../../../../static/js/equipState_dict.json';
  689. import { isArray } from 'highcharts';
  690. export default {
  691. filters: {
  692. ellipsis(value) {
  693. if (!value) return '';
  694. if (value.length > 15) {
  695. return value.slice(0, 15) + '...';
  696. }
  697. return value;
  698. }
  699. },
  700. data() {
  701. return {
  702. // 测试父传子传值
  703. // routerName: '虫情测报',
  704. zanwu: '/images/expertDiagnosis/zanwu.png',
  705. //图表和表格切换
  706. displayType: '',
  707. //设备列表
  708. equipList: [],
  709. dverGather: [
  710. { label: '全部', value: '' },
  711. { label: '版本1', value: '1' },
  712. { label: '版本2', value: '2' },
  713. { label: '版本3', value: '3' },
  714. { label: '版本4', value: '4' },
  715. { label: '版本5', value: '5' }
  716. ],
  717. userList: [
  718. { label: '用户1', value: '用户1' },
  719. { label: '用户2', value: '用户2' }
  720. ],
  721. d_id: '',
  722. device_id: '',
  723. ws: 0, //工作模式
  724. equipInfo: {
  725. //设备控制回显
  726. device_id: '',
  727. device_name: ''
  728. },
  729. equipContrlForm: {
  730. st: '',
  731. et: '',
  732. // ts: 0,
  733. // tt: null,
  734. collt: null,
  735. htim: null,
  736. hst: null,
  737. tph: null,
  738. // tpl: null,
  739. tpl: 0,
  740. datt: null,
  741. ds: 1
  742. // tt: "null",
  743. // collt: "null",
  744. // htim: "null",
  745. // hst: 'null',
  746. // tph: 'null',
  747. // tpl: 'null',
  748. // datt: 'null',
  749. // ds: '1',
  750. // imgres: 0,
  751. },
  752. //参数
  753. queryInfo: {
  754. page: 1,
  755. is_online: null,
  756. dver: null,
  757. selectUser: '',
  758. f_id: '',
  759. ename: ''
  760. },
  761. totalNum: 0,
  762. //设备控制对话框
  763. equipControlDialogVisible: false,
  764. operationDialogVisible: false,
  765. mqttDialogVisible: false,
  766. mqttConfig: {
  767. muid: '',
  768. mpwd: '',
  769. mip: '',
  770. mport: '',
  771. mpub: '',
  772. msub: '',
  773. fuid: '',
  774. fpwd: '',
  775. fip: '',
  776. fport: ''
  777. },
  778. loading: true,
  779. equipStateDict: {}, //
  780. // 管理员操作 - 更换imei
  781. replaceImeiData: '',
  782. // 开始关闭识别
  783. typeOperation: '', //按钮类型
  784. // 识别功能筛选 - 仅限管理员可操作
  785. insectVal: '',
  786. insectOptions: [
  787. {
  788. value: 0,
  789. label: '禁用'
  790. },
  791. {
  792. value: 1,
  793. label: '识别'
  794. },
  795. {
  796. value: 2,
  797. label: '计数'
  798. }
  799. ],
  800. versionsoptions: [], //组织
  801. traponsoptions: [], //监测点
  802. defaultParams: {
  803. label: 'org_name',
  804. value: 'id',
  805. children: 'childrens',
  806. multiple: true,
  807. checkStrictly: true
  808. },
  809. ruleForm: {
  810. // org_name:"",
  811. device_name: '',
  812. org_id: [],
  813. point_id: '',
  814. lng: '',
  815. lat: '',
  816. device_name: '',
  817. device_id: '',
  818. basecity: '',
  819. oldorg_id: []
  820. },
  821. rules: {
  822. device_name: [
  823. { required: true, message: '请输入设备名称', trigger: 'blur' }
  824. ],
  825. lng: [{ required: true, message: '请输入经度', trigger: 'blur' }],
  826. lat: [{ required: true, message: '请输入纬度', trigger: 'blur' }],
  827. point_id: [
  828. { required: true, message: '请选择所在监测点', trigger: 'change' }
  829. ]
  830. },
  831. //地图属性
  832. addLocationDialogVisible: false,
  833. locationForm: {
  834. lng: '',
  835. lat: ''
  836. },
  837. addr: '', //搜索栏地址
  838. address: '', //地图上标签地址
  839. center: [114.05, 22.55],
  840. content: '',
  841. releaseTF: false
  842. };
  843. },
  844. created() {
  845. console.log('created');
  846. this.displayType = String(localStorage.getItem('cbdListType') || '1');
  847. },
  848. mounted() {
  849. this.equipStateDict = Circulation;
  850. if (this.$route.query.id !== undefined) {
  851. this.queryInfo.f_id = this.$route.query.id;
  852. this.$refs.screenData.searchVal = this.$route.query.id;
  853. }
  854. console.log('mounted');
  855. this.getEquipList();
  856. this.getmon();
  857. },
  858. activated() {
  859. this.getEquipList();
  860. console.log('cbd_activated');
  861. },
  862. deactivated() {
  863. console.log('cbd_deactivated');
  864. },
  865. watch: {
  866. operationDialogVisible: function(e) {
  867. if (e) {
  868. console.log(this.$data.ruleForm);
  869. if (this.$data.ruleForm.lat != '' && this.$data.ruleForm.lng != '') {
  870. this.city(
  871. this.ToDigital(this.$data.ruleForm.lat),
  872. this.ToDigital(this.$data.ruleForm.lng)
  873. );
  874. }
  875. }
  876. }
  877. },
  878. computed: {
  879. userType: function() {
  880. //获取用户类型
  881. return sessionStorage.getItem('myuser_type');
  882. }
  883. },
  884. methods: {
  885. getIsOnline(data) {
  886. this.queryInfo.is_online = data;
  887. this.queryInfo.page = 1;
  888. this.getEquipList();
  889. },
  890. getIDName(data) {
  891. this.queryInfo.f_id = data.f_id;
  892. this.queryInfo.ename = data.ename;
  893. this.queryInfo.page = 1;
  894. this.getEquipList();
  895. },
  896. getDisplayType(data) {
  897. this.displayType = String(data);
  898. localStorage.setItem('cbdListType', data);
  899. },
  900. //获取设备列表
  901. getEquipList() {
  902. this.$axios({
  903. method: 'POST',
  904. url: '/api/api_gateway?method=monitor_manage.cbd_manage.cbd_list',
  905. data: this.qs.stringify({
  906. device_type_id: 3,
  907. page_size: 8,
  908. page: this.queryInfo.page,
  909. device_status: this.queryInfo.is_online,
  910. device_name: this.queryInfo.ename,
  911. device_id: this.queryInfo.f_id,
  912. dver_num: this.queryInfo.dver
  913. })
  914. }).then(res => {
  915. if (res.data.message == '') {
  916. this.equipList = res.data.data.data;
  917. // insectVal
  918. for (var i = 0; i < this.equipList.length; i++) {
  919. if (this.equipList[i].disable == 0) {
  920. // 禁用
  921. this.equipList[i].insectVal = '禁用';
  922. } else if (this.equipList[i].disable == 1) {
  923. // 识别
  924. this.equipList[i].insectVal = '识别';
  925. } else if (this.equipList[i].disable == 2) {
  926. // 计数
  927. this.equipList[i].insectVal = '计数';
  928. }
  929. }
  930. this.equipList.insectVal = this.totalNum = res.data.data.counts;
  931. this.loading = false;
  932. }
  933. // console.log(res.data.data.data)
  934. var data = res.data.data.data;
  935. for (var i = 0; i < data.length; i++) {
  936. if (data[i].disable == '2') {
  937. console.log(data[i].imei + '这是计数');
  938. } else if (data[i].disable == '1') {
  939. console.log(data[i].imei + '这是带识别的');
  940. }
  941. }
  942. });
  943. },
  944. //改变page
  945. changePage(val) {
  946. this.queryInfo.page = val;
  947. this.getEquipList();
  948. },
  949. // 数据详情
  950. dataDetails(e_id, d_id, data) {
  951. this.device_id = e_id;
  952. this.$router.push({
  953. path: `/index/DataDetails/${e_id}/${d_id}`,
  954. query: {
  955. addr: data.address,
  956. name: data.device_name
  957. }
  958. });
  959. },
  960. // 查看图片
  961. viewPhotoDialog(id, d_id, name, addr) {
  962. this.device_id = id;
  963. this.$router.push({
  964. path: `/index/DataPhotos`,
  965. query: { id: id, d_id: d_id, name: name, addr: addr }
  966. });
  967. },
  968. //设备控制
  969. EquipControl(d_id, device_id, device_name) {
  970. this.d_id = d_id;
  971. this.equipInfo = { device_id, device_name };
  972. this.$axios({
  973. method: 'POST',
  974. url:
  975. '/api/api_gateway?method=monitor_manage.cbd_manage.cbd_control_info',
  976. data: this.qs.stringify({ d_id, cmd: 'paramconf' })
  977. }).then(res => {
  978. if (res.data.data && Object.keys(res.data.data).length > 0) {
  979. let data = res.data.data;
  980. data.ds = Number(data.ds);
  981. data.st =
  982. data.st && data.st < 10 ? '0' + data.st + ':00' : data.st + ':00';
  983. data.et =
  984. data.et && data.et < 10 ? '0' + data.et + ':00' : data.et + ':00';
  985. // this.equipContrlForm = data;
  986. // console.log(data)
  987. var obj = {};
  988. console.log(data);
  989. console.log(data.ds);
  990. for (let kay in data) {
  991. if (typeof data[kay] == 'string' && kay !== 'st' && kay !== 'et') {
  992. var a = data[kay];
  993. if (Number(a) < 0) {
  994. obj[kay] = Number(data[kay]);
  995. } else if (Number(a) >= 0) {
  996. obj[kay] = parseInt(data[kay]);
  997. }
  998. } else {
  999. obj[kay] = data[kay];
  1000. }
  1001. }
  1002. // this.equipContrlForm = data;
  1003. console.log(obj);
  1004. this.equipContrlForm = obj;
  1005. }
  1006. this.equipControlDialogVisible = true;
  1007. });
  1008. },
  1009. //设备控制提交
  1010. equipControlSubm() {
  1011. let newForm = Object.assign({}, this.equipContrlForm); //深拷贝
  1012. newForm.st = newForm.st + '';
  1013. newForm.et = newForm.et + '';
  1014. newForm.st && newForm.st.slice(0, 2).charAt(0) != '0'
  1015. ? newForm.st.slice(0, 2)
  1016. : newForm.st.slice(1, 2);
  1017. newForm.et =
  1018. newForm.et && newForm.et.slice(0, 2).charAt(0) != '0'
  1019. ? newForm.et.slice(0, 2)
  1020. : newForm.et.slice(1, 2);
  1021. // console.log(newForm);
  1022. for (let k in newForm) {
  1023. if (typeof newForm[k] == 'number') {
  1024. newForm[k] = newForm[k] + '';
  1025. }
  1026. }
  1027. newForm.st = newForm.st.replace(':00', '');
  1028. this.$delete(newForm, 'admin');
  1029. console.log(newForm);
  1030. this.releaseTF = true;
  1031. this.$axios({
  1032. method: 'POST',
  1033. url:
  1034. '/api/api_gateway?method=monitor_manage.cbd_manage.cbd_device_control',
  1035. data: this.qs.stringify({
  1036. d_id: this.d_id,
  1037. config: JSON.stringify(newForm)
  1038. })
  1039. }).then(res => {
  1040. if (res.data.message == '') {
  1041. if (document.getElementsByClassName('el-message').length == 0) {
  1042. this.$message.success('设备控制修改成功');
  1043. }
  1044. } else {
  1045. if (document.getElementsByClassName('el-message').length == 0) {
  1046. this.$message.error('设备控制修改失败');
  1047. }
  1048. }
  1049. this.releaseTF = false;
  1050. this.equipControlDialogVisible = false;
  1051. });
  1052. },
  1053. resetEquipControlDialogClosed() {
  1054. this.$refs.equipContrlRef.resetFields();
  1055. this.ws = 0;
  1056. },
  1057. //害虫统计
  1058. showTimeControlDialog(d_id, id, disable) {
  1059. this.device_id = id;
  1060. if (sessionStorage.getItem('myuser_type') == 1) {
  1061. // 管理员
  1062. this.$router.push({
  1063. path: `/index/pestsStats/${d_id}/${id}`,
  1064. query: { disable: disable }
  1065. });
  1066. } else {
  1067. // 非管理员
  1068. if (disable == 2) {
  1069. // 计数
  1070. this.$router.push({
  1071. path: `/index/PestsStatsNumber/${d_id}/${id}`,
  1072. query: { disable: disable }
  1073. });
  1074. } else if (disable == 1 || disable == 0) {
  1075. // 识别开启或关闭
  1076. this.$router.push({
  1077. path: `/index/pestsStats/${d_id}/${id}`,
  1078. query: { disable: disable }
  1079. });
  1080. }
  1081. }
  1082. },
  1083. //设备控制->工作模式切换
  1084. wsChange() {
  1085. this.$confirm('确定修改工作模式?', '提示', {
  1086. confirmButtonText: '确定',
  1087. cancelButtonText: '取消',
  1088. type: 'warning'
  1089. })
  1090. .then(() => {
  1091. this.$axios({
  1092. method: 'POST',
  1093. url:
  1094. '/api/api_gateway?method=monitor_manage.cbd_manage.cbd_device_control',
  1095. data: this.qs.stringify({
  1096. device_type_id: 3,
  1097. d_id: this.d_id,
  1098. work_type: this.ws
  1099. })
  1100. }).then(res => {
  1101. if (res.data.message == '') {
  1102. if (document.getElementsByClassName('el-message').length == 0) {
  1103. this.$message({
  1104. type: 'success',
  1105. message: '修改成功!'
  1106. });
  1107. }
  1108. } else {
  1109. if (document.getElementsByClassName('el-message').length == 0) {
  1110. this.$message({
  1111. type: 'error',
  1112. message: res.data.message
  1113. });
  1114. }
  1115. }
  1116. });
  1117. })
  1118. .catch(() => {
  1119. if (document.getElementsByClassName('el-message').length == 0) {
  1120. this.$message({
  1121. type: 'info',
  1122. message: '已取消修改'
  1123. });
  1124. }
  1125. });
  1126. },
  1127. equipOperation(item) {
  1128. console.log(item);
  1129. this.ruleForm.device_id = item.imei;
  1130. this.ruleForm.device_name = item.device_name;
  1131. this.ruleForm.lng = item.lng;
  1132. this.ruleForm.lat = item.lat;
  1133. this.ruleForm.point_id = item.point_id;
  1134. this.d_id = item.d_id;
  1135. this.equipInfo = {
  1136. device_id: item.device_id,
  1137. device_name: item.device_name
  1138. };
  1139. // for (var key in this.ruleForm) {
  1140. // this.ruleForm[key] = e[key];
  1141. // }
  1142. this.ruleForm.org_id = [];
  1143. this.ruleForm.oldorg_id = item.org_list;
  1144. this.city(
  1145. this.ToDigital(this.ruleForm.lat),
  1146. this.ToDigital(this.ruleForm.lng)
  1147. );
  1148. // this.getmon3(item);
  1149. this.operationDialogVisible = true;
  1150. },
  1151. getmon3(item) {
  1152. //弃用
  1153. this.$axios({
  1154. method: 'POST',
  1155. url:
  1156. '/api/api_gateway?method=sysmenage.usermanager.get_parent_org_list',
  1157. data: this.qs.stringify({
  1158. device_id: item.d_id
  1159. })
  1160. }).then(res => {
  1161. // console.log(res.data.data);
  1162. var orgdatas = res.data.data;
  1163. this.ruleForm.org_id = [];
  1164. for (var i = 0; i < item.org_list.length; i++) {
  1165. var arr = [item.org_list[i].org_id];
  1166. this.ruleForm.org_id.push(arr);
  1167. }
  1168. if (orgdatas.length != 0) {
  1169. for (var i = 0; i < orgdatas.length; i++) {
  1170. if (orgdatas[i].lenngth != 0) {
  1171. for (var j = 0; j < orgdatas[i].length; j++) {
  1172. this.ruleForm.org_id[i].unshift(orgdatas[i][j].org_id);
  1173. }
  1174. }
  1175. }
  1176. }
  1177. if (this.ruleForm.org_id[0] != this.versionsoptions[0].id) {
  1178. this.ruleForm.org_id.unshift(this.versionsoptions[0].id);
  1179. }
  1180. console.log(this.ruleForm.org_id);
  1181. });
  1182. },
  1183. // 设备版本、用户筛选
  1184. searchChange() {
  1185. console.log(this.queryInfo.selectUser);
  1186. this.getEquipList();
  1187. },
  1188. mqttControl() {
  1189. this.mqttDialogVisible = true;
  1190. },
  1191. mqttDialogClosed() {
  1192. this.$refs.mqttConfigRef.resetFields();
  1193. },
  1194. mqttSubm() {
  1195. this.$refs.mqttConfigRef.validate(valid => {
  1196. console.log(valid);
  1197. if (!valid) {
  1198. return false;
  1199. }
  1200. let obj = {
  1201. mqtt: {
  1202. uid: this.mqttConfig.muid,
  1203. pwd: this.mqttConfig.mpwd,
  1204. ip: this.mqttConfig.mip,
  1205. port: this.mqttConfig.mport,
  1206. pub: this.mqttConfig.mpub,
  1207. sub: this.mqttConfig.msub,
  1208. keepalive: 60,
  1209. lastwill: '/yfkj/cbd/offline/'
  1210. },
  1211. ftp: {
  1212. uid: this.mqttConfig.fuid,
  1213. pwd: this.mqttConfig.fpwd,
  1214. ip: this.mqttConfig.fip,
  1215. port: this.mqttConfig.fport
  1216. }
  1217. };
  1218. this.$confirm('此操作将上传修改的MQTT配置, 是否继续?', '提示', {
  1219. confirmButtonText: '确定',
  1220. cancelButtonText: '取消',
  1221. type: 'warning'
  1222. })
  1223. .then(() => {
  1224. this.$axios({
  1225. method: 'POST',
  1226. url:
  1227. '/api/api_gateway?method=monitor_manage.cbd_manage.cbd_device_control',
  1228. data: this.qs.stringify({
  1229. device_type_id: 3,
  1230. d_id: this.d_id,
  1231. cmd: 'setnet',
  1232. config: JSON.stringify(obj)
  1233. })
  1234. }).then(res => {
  1235. if (res.data.message == '') {
  1236. if (document.getElementsByClassName('el-message').length == 0) {
  1237. this.$message.success('提交成功');
  1238. }
  1239. } else {
  1240. if (document.getElementsByClassName('el-message').length == 0) {
  1241. this.$message.error('提交失败');
  1242. }
  1243. }
  1244. });
  1245. this.mqttDialogVisible = false;
  1246. })
  1247. .catch(() => {
  1248. if (document.getElementsByClassName('el-message').length == 0) {
  1249. this.$message({
  1250. type: 'info',
  1251. message: '已取消',
  1252. duration: 1500
  1253. });
  1254. }
  1255. });
  1256. });
  1257. },
  1258. mqttInfo() {
  1259. this.$axios({
  1260. method: 'POST',
  1261. url:
  1262. '/api/api_gateway?method=monitor_manage.cbd_manage.cbd_control_info',
  1263. data: this.qs.stringify({
  1264. d_id: this.d_id,
  1265. cmd: 'netconf'
  1266. })
  1267. }).then(res => {
  1268. if (res.data.message == '') {
  1269. let { ftp, mqtt } = res.data.data;
  1270. console.log(ftp, mqtt);
  1271. this.mqttConfig = {
  1272. muid: mqtt.uid,
  1273. mpwd: mqtt.pwd,
  1274. mip: mqtt.ip,
  1275. mport: mqtt.port,
  1276. mpub: mqtt.pub,
  1277. msub: mqtt.sub,
  1278. fuid: ftp.uid,
  1279. fpwd: ftp.pwd,
  1280. fip: ftp.ip,
  1281. fport: ftp.port
  1282. };
  1283. }
  1284. });
  1285. this.mqttDialogVisible = true;
  1286. },
  1287. pestAll() {
  1288. this.$router.push('/index/tongji');
  1289. },
  1290. devicePlant() {
  1291. this.$router.push('/index/deviceTongji');
  1292. },
  1293. // 修改设备号 - 更换imei
  1294. replaceImei() {
  1295. console.log(this.d_id);
  1296. this.$prompt('请输入imei', '提示', {
  1297. confirmButtonText: '确定',
  1298. cancelButtonText: '取消'
  1299. })
  1300. .then(({ value }) => {
  1301. this.replaceImeiData = value;
  1302. // this.equipBtnControl("imei");
  1303. })
  1304. .catch(() => {
  1305. if (document.getElementsByClassName('el-message').length == 0) {
  1306. this.$message({
  1307. type: 'info',
  1308. message: '取消输入'
  1309. });
  1310. }
  1311. });
  1312. },
  1313. // 管理员操作 - 升级文件更新
  1314. fileUploadSectionFile(param) {
  1315. let that = this;
  1316. let formData = new FormData();
  1317. formData.append('fileName', param.file);
  1318. that
  1319. .$axios({
  1320. method: 'POST',
  1321. url: 'api/update/save_file',
  1322. data: formData
  1323. })
  1324. .then(res => {
  1325. console.log(res);
  1326. if (res.data == 'OK' || res.data == 'OK!') {
  1327. if (document.getElementsByClassName('el-message').length == 0) {
  1328. this.$message({
  1329. message: '文件上传成功',
  1330. type: 'success',
  1331. duration: 1500
  1332. });
  1333. }
  1334. } else {
  1335. if (document.getElementsByClassName('el-message').length == 0) {
  1336. this.$message({
  1337. message: res.data,
  1338. type: 'warning',
  1339. duration: 1500
  1340. });
  1341. }
  1342. }
  1343. })
  1344. .catch(err => {
  1345. console.log(err);
  1346. });
  1347. },
  1348. // 管理员操作 - 开启关闭识别
  1349. operationDiscern(val, id, operation) {
  1350. if (val == 0) {
  1351. // 当前处于识别关闭状态
  1352. this.$confirm('确认关闭识别状态?')
  1353. .then(_ => {
  1354. this.operationDiscernAxios(id, 'disable');
  1355. })
  1356. .catch(_ => {});
  1357. } else if (val == 1) {
  1358. // 当前处于识别开启状态
  1359. this.$confirm('确认开启识别状态?')
  1360. .then(_ => {
  1361. this.operationDiscernAxios(id, 'enable');
  1362. })
  1363. .catch(_ => {});
  1364. } else if (val == 2) {
  1365. // 当前处于识别开启状态
  1366. this.$confirm('确认开启计数状态?')
  1367. .then(_ => {
  1368. this.operationDiscernAxios(id, 'count');
  1369. })
  1370. .catch(_ => {});
  1371. }
  1372. },
  1373. operationDiscernAxios(id, req) {
  1374. // ret=disable时禁用识别功能, ret=enable,时启用识别统计功能, ret =count 计数功能
  1375. var that = this;
  1376. that
  1377. .$axios({
  1378. method: 'post',
  1379. url:
  1380. '/api/api_gateway?method=monitor_manage.cbd_manage.disable_cbd_discern',
  1381. data: that.qs.stringify({
  1382. device_id: id, // 设备号
  1383. ret: req // ret=disable时禁用识别功能, ret=enable,时启用识别统计功能
  1384. })
  1385. })
  1386. .then(res => {
  1387. if (res.data.data == true) {
  1388. that.getEquipList(); //图片列表数据请求
  1389. }
  1390. })
  1391. .catch(err => {
  1392. console.log(err);
  1393. if (document.getElementsByClassName('el-message').length == 0) {
  1394. this.$message.error('操作失败,请重试!');
  1395. }
  1396. });
  1397. },
  1398. oldorgdelect(index) {
  1399. this.ruleForm.oldorg_id.splice(index, 1);
  1400. },
  1401. submitForm(formName) {
  1402. var org_id = [];
  1403. if (Array.isArray(this.ruleForm.org_id)) {
  1404. for (var i = 0; i < this.ruleForm.org_id.length; i++) {
  1405. org_id.push(
  1406. this.ruleForm.org_id[i][this.ruleForm.org_id[i].length - 1]
  1407. );
  1408. }
  1409. } else {
  1410. org_id = this.ruleForm.org_id;
  1411. }
  1412. for (var i = 0; i < this.ruleForm.oldorg_id.length; i++) {
  1413. if (org_id.length > 0) {
  1414. if (org_id.indexOf(this.ruleForm.oldorg_id[i].org_id) == -1) {
  1415. org_id.push(this.ruleForm.oldorg_id[i].org_id);
  1416. }
  1417. } else {
  1418. org_id.push(this.ruleForm.oldorg_id[i].org_id);
  1419. }
  1420. }
  1421. if (org_id.length > 0) {
  1422. org_id = org_id.join('/');
  1423. } else {
  1424. this.$message({
  1425. message: '请选择隶属组织',
  1426. type: 'warning'
  1427. });
  1428. return;
  1429. }
  1430. console.log(org_id);
  1431. if (this.ruleForm.basecity == '请重新选择地址') {
  1432. this.$message({
  1433. showClose: true,
  1434. message: '请重新选择地址',
  1435. type: 'warning'
  1436. });
  1437. this.releaseTF = false;
  1438. return;
  1439. }
  1440. this.$refs[formName].validate(valid => {
  1441. if (valid) {
  1442. this.releaseTF = true;
  1443. this.$axios({
  1444. method: 'POST',
  1445. url:
  1446. '/api/api_gateway?method=monitor_manage.cbd_manage.add_device_info',
  1447. data: this.qs.stringify({
  1448. org_id: org_id, // 非必传(num) 诱捕器id 修改项
  1449. point_id: this.ruleForm.point_id, // 必传(string) 设备编号
  1450. lat: this.ToDegrees(this.ruleForm.lat, 'lat'), // 必传(string) 纬度
  1451. lng: this.ToDegrees(this.ruleForm.lng, 'lng'), //
  1452. device_id: this.ruleForm.device_id,
  1453. device_name: this.ruleForm.device_name,
  1454. city: this.ruleForm.basecity
  1455. })
  1456. })
  1457. .then(res => {
  1458. console.log(res);
  1459. if (res.data.data) {
  1460. // var message = "";
  1461. // if (this.parameter == "add") {
  1462. // // console.log(this.$data.addtitle)
  1463. // message = "添加成功!";
  1464. // } else if (this.parameter == "modify") {
  1465. // message = "修改成功!";
  1466. // }
  1467. if (document.getElementsByClassName('el-message').length == 0) {
  1468. this.$message({
  1469. showClose: true,
  1470. message: '修改成功!',
  1471. type: 'success'
  1472. });
  1473. }
  1474. this.operationDialogVisible = false;
  1475. this.getEquipList();
  1476. } else {
  1477. if (document.getElementsByClassName('el-message').length == 0) {
  1478. this.$message({
  1479. showClose: true,
  1480. message: '添加失败' + res.data.message,
  1481. type: 'warning'
  1482. });
  1483. }
  1484. }
  1485. this.releaseTF = false;
  1486. })
  1487. .finally(() => {
  1488. this.releaseTF = false;
  1489. });
  1490. } else {
  1491. if (document.getElementsByClassName('el-message').length == 0) {
  1492. this.$message({
  1493. message: '请将信息填写完全',
  1494. type: 'warning'
  1495. });
  1496. }
  1497. return false;
  1498. }
  1499. });
  1500. },
  1501. resetForm(formName) {
  1502. this.operationDialogVisible = false;
  1503. this.$refs[formName].resetFields();
  1504. for (var key in this.ruleForm) {
  1505. this.ruleForm[key] = '';
  1506. }
  1507. },
  1508. getmon() {
  1509. //获取监测点列表 组织列表
  1510. this.$axios({
  1511. method: 'POST',
  1512. url: '/api/api_gateway?method=sysmenage.usermanager.org_list',
  1513. data: this.qs.stringify({
  1514. page_item: '100000000'
  1515. })
  1516. }).then(res => {
  1517. console.log(res.data.data);
  1518. // this.versionsoptions = res.data.data.page_list; //组织
  1519. var arr = res.data.data.page_list; //组织
  1520. console.log(this.versionsoptions);
  1521. if (arr[0].parent_name == '根组织') {
  1522. this.versionsoptions = arr;
  1523. } else {
  1524. // var obj = {
  1525. // id: 148,
  1526. // org_name: '研发部',
  1527. // childrens: []
  1528. // };
  1529. // for (var i = 0; i < arr.length; i++) {
  1530. // obj.childrens.push(arr[i]);
  1531. // obj.id = arr[0].parent_id;
  1532. // obj.org_name = arr[0].parent_name;
  1533. // }
  1534. // this.versionsoptions.push(obj);
  1535. this.versionsoptions = arr;
  1536. }
  1537. console.log(this.versionsoptions);
  1538. this.traponsoptions = res.data.data.point_data;
  1539. this.inducer_data = res.data.data.inducer_data;
  1540. });
  1541. },
  1542. init() {
  1543. console.log(document.getElementById('mapContainer2'));
  1544. var map = new AMap.Map('mapContainer2', {
  1545. center: this.center,
  1546. resizeEnable: true,
  1547. zoom: 10
  1548. });
  1549. AMap.plugin(['AMap.ToolBar', 'AMap.Geocoder'], () => {
  1550. map.addControl(new AMap.ToolBar());
  1551. this.geocoder = new AMap.Geocoder({
  1552. city: '全国',
  1553. radius: 1000
  1554. });
  1555. });
  1556. setTimeout(() => {
  1557. var marker = new AMap.Marker({
  1558. position: this.center
  1559. });
  1560. console.log(this.center);
  1561. marker.setMap(map);
  1562. }, 1000);
  1563. this.map = map;
  1564. this.testevent();
  1565. },
  1566. addrChange() {
  1567. //位置搜索
  1568. var marker = new AMap.Marker();
  1569. this.geocoder.getLocation(this.addr, (status, result) => {
  1570. if (status === 'complete' && result.geocodes.length) {
  1571. var lnglat = result.geocodes[0].location;
  1572. marker.setPosition(lnglat);
  1573. this.map.add(marker);
  1574. this.map.setFitView(marker);
  1575. this.locationForm = {
  1576. lat: lnglat.lat,
  1577. lng: lnglat.lng
  1578. };
  1579. } else {
  1580. if (document.getElementsByClassName('el-message').length == 0) {
  1581. this.$message.error('根据地址查询位置失败');
  1582. }
  1583. }
  1584. });
  1585. },
  1586. // 地图点击事件
  1587. testevent() {
  1588. this.map.on('click', ev => {
  1589. var lnglat = [ev.lnglat.lng, ev.lnglat.lat];
  1590. this.locationForm = { lng: lnglat[0], lat: lnglat[1] };
  1591. this.map.clearMap();
  1592. var marker = new AMap.Marker({
  1593. position: lnglat
  1594. });
  1595. marker.setMap(this.map);
  1596. this.getAddress(lnglat);
  1597. setTimeout(() => {
  1598. new AMap.InfoWindow({
  1599. content: '<h5>' + '当前选中地址' + '</h5>' + this.address,
  1600. offset: new AMap.Pixel(0, -32)
  1601. }).open(this.map, lnglat);
  1602. }, 100);
  1603. });
  1604. },
  1605. getAddress(lnglat) {
  1606. AMap.plugin('AMap.Geocoder', () => {
  1607. this.geocoder.getAddress(lnglat, (status, result) => {
  1608. if (status === 'complete' && result.info === 'OK') {
  1609. this.address = result.regeocode.formattedAddress;
  1610. }
  1611. });
  1612. });
  1613. },
  1614. addLocationSubm() {
  1615. //点击确定
  1616. this.ruleForm.lng = this.locationForm.lng;
  1617. this.ruleForm.lat = this.locationForm.lat;
  1618. console.log(this.ruleForm);
  1619. this.city(
  1620. this.ToDigital(this.ruleForm.lat),
  1621. this.ToDigital(this.ruleForm.lng)
  1622. );
  1623. this.addLocationDialogVisible = false;
  1624. },
  1625. addLocationDialogClosed() {
  1626. //弹框关闭时
  1627. // this.locationForm = { lat: "", lng: "" };
  1628. this.center = [114.05, 22.55];
  1629. this.map = null;
  1630. },
  1631. locationSearch() {
  1632. if (this.locationForm.lat && this.locationForm.lng) {
  1633. let lnglat = [this.locationForm.lng, this.locationForm.lat];
  1634. var marker = new AMap.Marker({
  1635. position: lnglat
  1636. });
  1637. marker.setMap(this.map);
  1638. } else {
  1639. if (document.getElementsByClassName('el-message').length == 0) {
  1640. this.$message.warning('请输入经纬度!');
  1641. }
  1642. // return fasle;
  1643. }
  1644. },
  1645. dingwei() {
  1646. if (this.ruleForm.lng != '' && this.ruleForm.lng != 0) {
  1647. this.center[0] = this.ToDigital(this.ruleForm.lng);
  1648. }
  1649. if (this.ruleForm.lat != '' && this.ruleForm.lat != 0) {
  1650. this.center[1] = this.ToDigital(this.ruleForm.lat);
  1651. }
  1652. this.addLocationDialogVisible = true;
  1653. setTimeout(() => {
  1654. this.init();
  1655. }, 500);
  1656. },
  1657. //度转度°分′秒″
  1658. ToDegrees(val, type) {
  1659. if (typeof val == 'undefined' || val == '' || isNaN(val)) {
  1660. return val;
  1661. }
  1662. val = val.toString();
  1663. var A = '';
  1664. if (type == 'lng') {
  1665. A = val > 0 ? 'E' : 'W';
  1666. } else if (type == 'lat') {
  1667. A = val > 0 ? 'N' : 'S';
  1668. }
  1669. var i = val.indexOf('.');
  1670. var strDu = i < 0 ? val : val.substring(0, i); //获取度
  1671. var strFen = 0;
  1672. var strMiao = 0;
  1673. if (i > 0) {
  1674. var strFen = '0' + val.substring(i);
  1675. strFen = strFen * 60 + '';
  1676. i = strFen.indexOf('.');
  1677. if (i > 0) {
  1678. strMiao = '0' + strFen.substring(i);
  1679. strFen = strFen.substring(0, i); //获取分
  1680. strMiao = strMiao * 60 + '';
  1681. i = strMiao.indexOf('.');
  1682. strMiao = strMiao.substring(0, i + 4); //取到小数点后面三位
  1683. strMiao = parseFloat(strMiao).toFixed(2); //精确小数点后面两位
  1684. }
  1685. }
  1686. console.log(strDu, strFen, strMiao);
  1687. return strDu + '°' + strFen + '′' + strMiao + '″' + A;
  1688. },
  1689. //度°分′秒″转度
  1690. ToDigital(lnglat) {
  1691. console.log(lnglat);
  1692. if (!isNaN(lnglat)) {
  1693. return lnglat;
  1694. }
  1695. lnglat = lnglat.toString();
  1696. var strDu, strFen, strMiao;
  1697. var duindex = lnglat.indexOf('°'); //字符度的下标
  1698. var fenindex = lnglat.indexOf('′'); //字符分的下标
  1699. var miaoindex = lnglat.indexOf('″'); //字符秒的下标
  1700. strDu = lnglat.slice(0, duindex);
  1701. strFen = lnglat.slice(duindex + 1, fenindex);
  1702. strMiao = lnglat.slice(fenindex + 1, miaoindex);
  1703. // len = len > 6 || typeof len == "undefined" ? 6 : len; //精确到小数点后最多六位
  1704. strDu =
  1705. typeof strDu == 'undefined' || strDu == '' ? 0 : parseFloat(strDu);
  1706. strFen =
  1707. typeof strFen == 'undefined' || strFen == ''
  1708. ? 0
  1709. : parseFloat(strFen) / 60;
  1710. strMiao =
  1711. typeof strMiao == 'undefined' || strMiao == ''
  1712. ? 0
  1713. : parseFloat(strMiao) / 3600;
  1714. var digital = strDu + strFen + strMiao;
  1715. if (digital == 0) {
  1716. return '';
  1717. } else {
  1718. return digital.toFixed(6);
  1719. }
  1720. },
  1721. orglisthover(e) {
  1722. console.log(e);
  1723. var str = ``;
  1724. for (var i = 0; i < e.org_list.length; i++) {
  1725. str += `<p>` + e.org_list[i].org_name + `</p>`;
  1726. }
  1727. this.content = str;
  1728. },
  1729. city(lat, lng) {
  1730. $.ajax({
  1731. url: 'https://restapi.amap.com/v3/geocode/regeo',
  1732. type: 'get',
  1733. dataType: 'jsonp',
  1734. data: this.qs.stringify({
  1735. location: lng + ',' + lat,
  1736. key: '78ce288400f4fc6d9458989875c833c2',
  1737. extensions: 'base'
  1738. }),
  1739. success: res => {
  1740. console.log(res);
  1741. if (res.regeocode.addressComponent.city.length == 0) {
  1742. this.ruleForm.basecity = '请重新选择地址';
  1743. } else {
  1744. this.ruleForm.basecity = res.regeocode.addressComponent.city;
  1745. }
  1746. console.log(this.ruleForm);
  1747. },
  1748. error: function(err) {
  1749. // alert("服务端错误,请刷新浏览器后重试");
  1750. }
  1751. });
  1752. // return arr;
  1753. },
  1754. latblur() {
  1755. if (this.ruleForm.lat != '' && this.ruleForm.lng != '') {
  1756. this.city(
  1757. this.ToDigital(this.ruleForm.lat),
  1758. this.ToDigital(this.ruleForm.lng)
  1759. );
  1760. }
  1761. }
  1762. },
  1763. components: {
  1764. SearchBar,
  1765. EquipItem
  1766. // TopModule
  1767. }
  1768. };
  1769. </script>
  1770. <style lang="less" scoped>
  1771. // 去除下拉框的边框
  1772. .my-el-select /deep/ .el-input .el-input__inner {
  1773. border: 0 !important;
  1774. }
  1775. .handAddForm {
  1776. /deep/.el-form-item {
  1777. margin-bottom: 8px;
  1778. }
  1779. .handAddFormBtn {
  1780. text-align: right;
  1781. }
  1782. }
  1783. .sliderParent {
  1784. display: flex;
  1785. .block {
  1786. flex: 1;
  1787. margin-right: 10px;
  1788. /deep/.el-slider__runway,
  1789. /deep/.el-slider__bar {
  1790. height: 10px;
  1791. }
  1792. }
  1793. > span {
  1794. width: 40px;
  1795. }
  1796. }
  1797. .swi-box {
  1798. text-align: center;
  1799. padding: 10px 0;
  1800. label {
  1801. color: #333;
  1802. margin-right: 8px;
  1803. font-size: 14px;
  1804. }
  1805. i.el-icon-edit {
  1806. margin-right: 8px;
  1807. }
  1808. }
  1809. .buttonbox {
  1810. margin-bottom: 23px;
  1811. padding-left: 100px;
  1812. /deep/.el-button {
  1813. background-color: #409eff;
  1814. border-color: #409eff;
  1815. }
  1816. }
  1817. .real-time {
  1818. display: flex;
  1819. justify-content: left;
  1820. align-items: center;
  1821. padding: 20px 0;
  1822. .left {
  1823. margin-right: 10px;
  1824. .icon-box {
  1825. border-radius: 50%;
  1826. width: 46px;
  1827. height: 46px;
  1828. padding: 5px;
  1829. box-sizing: border-box;
  1830. margin-bottom: 3px;
  1831. img {
  1832. width: 100%;
  1833. height: auto;
  1834. }
  1835. }
  1836. .aisle {
  1837. text-align: center;
  1838. font-size: 14px;
  1839. color: #666;
  1840. }
  1841. }
  1842. .right {
  1843. color: #333;
  1844. .num {
  1845. font-weight: 600;
  1846. font-size: 20px;
  1847. margin-bottom: 3px;
  1848. }
  1849. .unit {
  1850. font-size: 14px;
  1851. color: #666;
  1852. }
  1853. }
  1854. }
  1855. .checkData {
  1856. text-align: right;
  1857. font-size: 14px;
  1858. span {
  1859. cursor: pointer;
  1860. }
  1861. }
  1862. .red {
  1863. color: rgb(235, 103, 101);
  1864. }
  1865. .green {
  1866. color: rgb(23, 187, 137);
  1867. }
  1868. .el-date-editor--time-select {
  1869. width: 100% !important;
  1870. }
  1871. .el-form .line {
  1872. text-align: center;
  1873. }
  1874. .el-select {
  1875. width: 100%;
  1876. }
  1877. .tit {
  1878. font-weight: 800;
  1879. margin: 15px 0 8px 0;
  1880. }
  1881. .item {
  1882. margin-bottom: 10px;
  1883. }
  1884. .onlineState {
  1885. margin: 0 3px 0 3px;
  1886. }
  1887. .onlineState .icon-diannao {
  1888. margin: 0 19px 0 -2px !important;
  1889. }
  1890. .search-box {
  1891. position: relative;
  1892. .pestAll {
  1893. position: absolute;
  1894. top: 1px;
  1895. // right: 740px;
  1896. left: 225px;
  1897. }
  1898. .devicePlant {
  1899. position: absolute;
  1900. top: 1px;
  1901. // right: 816px;
  1902. left: 140px;
  1903. }
  1904. }
  1905. .haiguan {
  1906. display: flex;
  1907. flex-wrap: wrap;
  1908. margin-top: 5px;
  1909. .haiguan_item {
  1910. // width: 70px;
  1911. height: 20px;
  1912. border: 1px solid #d4d2d2;
  1913. line-height: 20px;
  1914. margin-right: 10px;
  1915. padding: 2px 10px;
  1916. border-radius: 5px;
  1917. }
  1918. .haiguan_itemnone {
  1919. line-height: 20px;
  1920. }
  1921. }
  1922. // 表格文字居中
  1923. /deep/.el-table th > .cell {
  1924. // text-align: center;
  1925. }
  1926. /deep/.el-table .cell {
  1927. // text-align: center;
  1928. }
  1929. // 按钮
  1930. .btns {
  1931. /deep/.el-button--mini {
  1932. padding: 6px 8px !important;
  1933. }
  1934. /deep/.el-button--info {
  1935. color: #fff;
  1936. background-color: #409eff;
  1937. border-color: #409eff;
  1938. }
  1939. }
  1940. </style>