index.vue 81 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
  4. <el-form-item label="名称" prop="cameraName">
  5. <el-input
  6. v-model="queryParams.cameraName"
  7. placeholder="请输入摄像头名称"
  8. clearable
  9. @keyup.enter.native="handleQuery"
  10. />
  11. </el-form-item>
  12. <el-form-item label="摄像头厂家" prop="cameraFactory">
  13. <el-select v-model="queryParams.cameraFactory" placeholder="摄像头厂家">
  14. <el-option
  15. v-for="dict in dict.type.camera_factory"
  16. :key="dict.value"
  17. :label="dict.label"
  18. :value="dict.value"
  19. />
  20. </el-select>
  21. </el-form-item>
  22. <el-form-item label="运营商类型" prop="operatorType">
  23. <el-select v-model="queryParams.operatorType" placeholder="运营商类型">
  24. <el-option
  25. v-for="dict in dict.type.operator_type"
  26. :key="dict.value"
  27. :label="dict.label"
  28. :value="dict.value"
  29. />
  30. </el-select>
  31. </el-form-item>
  32. <el-form-item label="摄像头用途" prop="cameraUse">
  33. <el-select v-model="queryParams.cameraUse" placeholder="摄像头用途">
  34. <el-option
  35. v-for="dict in dict.type.camera_use"
  36. :key="dict.value"
  37. :label="dict.label"
  38. :value="dict.value"
  39. />
  40. </el-select>
  41. </el-form-item>
  42. <el-form-item label="摄像头ip" prop="cameraIp">
  43. <el-input
  44. v-model="queryParams.cameraIp"
  45. placeholder="请输入摄像头ip"
  46. clearable
  47. @keyup.enter.native="handleQuery"
  48. />
  49. </el-form-item>
  50. <el-form-item label="工作状态" prop="workingStatus">
  51. <el-select v-model="queryParams.workingStatus" placeholder="工作状态" clearable>
  52. <el-option
  53. v-for="dict in dict.type.device_status"
  54. :key="dict.value"
  55. :label="dict.label"
  56. :value="dict.value"
  57. />
  58. </el-select>
  59. </el-form-item>
  60. <el-form-item label="离线时间">
  61. <el-date-picker
  62. v-model="dateRange"
  63. style="width: 280px"
  64. value-format="yyyy-MM-dd HH:mm:ss"
  65. :default-time="['00:00:00', '23:59:59']"
  66. type="datetimerange"
  67. range-separator="-"
  68. start-placeholder="开始日期"
  69. end-placeholder="结束日期"
  70. ></el-date-picker>
  71. </el-form-item>
  72. <el-form-item>
  73. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  74. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  75. </el-form-item>
  76. </el-form>
  77. <el-row :gutter="10" class="mb8">
  78. <el-col :span="1.5">
  79. <el-button
  80. type="primary"
  81. plain
  82. icon="el-icon-plus"
  83. size="mini"
  84. @click="handleAdd"
  85. v-hasPermi="['camera:camera:add']"
  86. >新增
  87. </el-button>
  88. </el-col>
  89. <el-col :span="1.5">
  90. <el-button
  91. type="success"
  92. plain
  93. icon="el-icon-edit"
  94. size="mini"
  95. :disabled="single"
  96. @click="handleUpdate"
  97. v-hasPermi="['camera:camera:edit']"
  98. >修改
  99. </el-button>
  100. </el-col>
  101. <el-col :span="1.5">
  102. <el-button
  103. type="danger"
  104. plain
  105. icon="el-icon-delete"
  106. size="mini"
  107. :disabled="multiple"
  108. @click="handleDelete"
  109. v-hasPermi="['camera:camera:remove']"
  110. >删除
  111. </el-button>
  112. </el-col>
  113. <el-col :span="1.5">
  114. <el-button
  115. type="warning"
  116. plain
  117. icon="el-icon-download"
  118. size="mini"
  119. @click="handleExport"
  120. v-hasPermi="['camera:camera:export']"
  121. >导出
  122. </el-button>
  123. </el-col>
  124. <!-- <el-col :span="1.5">-->
  125. <!-- <el-button-->
  126. <!-- icon="el-icon-refresh"-->
  127. <!-- size="mini"-->
  128. <!-- :disabled="multiple"-->
  129. <!-- @click="replayPreview_hik"-->
  130. <!-- >查看电视墙-->
  131. <!-- </el-button>-->
  132. <!-- </el-col>-->
  133. <el-col :span="1.5">
  134. <el-button
  135. icon="el-icon-refresh"
  136. type="success"
  137. size="mini"
  138. @click="synchronizeCamera"
  139. v-hasPermi="['DahuaController:DahuaController:edit']"
  140. >同步设备状态
  141. </el-button>
  142. </el-col>
  143. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  144. </el-row>
  145. <el-table v-loading="loading" :visible.sync="loading" :data="cameraList" @selection-change="handleSelectionChange">
  146. <el-table-column type="selection" width="55" align="center"/>
  147. <el-table-column label="摄像头名称" align="center">
  148. <template slot-scope="scope">
  149. <span v-if="scope.row.cameraName && scope.row.cameraName.length <= 10">
  150. {{ scope.row.cameraName }}
  151. </span>
  152. <el-tooltip v-else :content="scope.row.cameraName" placement="top">
  153. <span>{{ scope.row.cameraName ? scope.row.cameraName.substring(0, 10) + '...' : '' }}</span>
  154. </el-tooltip>
  155. </template>
  156. </el-table-column>
  157. <el-table-column label="ip" align="center" prop="cameraIp"/>
  158. <el-table-column label="摄像头厂家" align="center" prop="cameraFactory" width="100">
  159. <template slot-scope="scope">
  160. <dict-tag :options="dict.type.camera_factory" :value="scope.row.cameraFactory"/>
  161. </template>
  162. </el-table-column>
  163. <!-- <el-table-column label="融合平台" align="center" prop="convergencePlatform">-->
  164. <!-- <template slot-scope="scope">-->
  165. <!-- <dict-tag :options="dict.type.convergence_platform" :value="scope.row.convergencePlatform"/>-->
  166. <!-- </template>-->
  167. <!-- </el-table-column>-->
  168. <!-- <el-table-column label="所属区域" align="center" prop="cameraRegion"/>-->
  169. <el-table-column label="设备状态" align="center" prop="workingStatus" width="100">
  170. <template slot-scope="scope">
  171. <dict-tag :options="dict.type.device_status" :value="scope.row.workingStatus"/>
  172. </template>
  173. </el-table-column>
  174. <el-table-column label="离线原因" align="center" prop="offlineReason">
  175. <template slot-scope="scope">
  176. <dict-tag :options="dict.type.camera_offline_reason" :value="scope.row.offlineReason"/>
  177. </template>
  178. </el-table-column>
  179. <el-table-column label="操作" align="center" width="550" class-name="small-padding fixed-width">
  180. <template slot-scope="scope">
  181. <el-button
  182. size="mini"
  183. type="text"
  184. icon="el-icon-video-camera"
  185. @click="preview(scope.row)"
  186. v-hasPermi="['camerachannel:camerachannel:selectchannel']"
  187. >预览
  188. </el-button>
  189. <el-button
  190. size="mini"
  191. type="text"
  192. icon="el-icon-video-camera"
  193. @click="playBack(scope.row)"
  194. v-hasPermi="['camerachannel:camerachannel:selectchannel']"
  195. >回放
  196. </el-button>
  197. <el-button
  198. size="mini"
  199. type="text"
  200. icon="el-icon-edit"
  201. @click="handleUpdate(scope.row)"
  202. v-hasPermi="['camera:camera:edit']"
  203. >修改
  204. </el-button>
  205. <el-button
  206. size="mini"
  207. type="text"
  208. icon="el-icon-delete"
  209. @click="handleDelete(scope.row)"
  210. v-hasPermi="['camera:camera:remove']"
  211. >删除
  212. </el-button>
  213. <el-button
  214. size="mini"
  215. type="text"
  216. icon="el-icon-view"
  217. @click="handleSee(scope.row)"
  218. v-hasPermi="['camera:camera:query']"
  219. >查看
  220. </el-button>
  221. <el-button
  222. size="mini"
  223. type="text"
  224. icon="el-icon-link"
  225. @click="handleCameraChannel(scope.row)"
  226. v-hasPermi="['camerachannel:camerachannel:list']"
  227. >通道管理
  228. </el-button>
  229. <el-button
  230. size="mini"
  231. type="text"
  232. icon="el-icon-s-management"
  233. @click="handleCameraDept(scope.row)"
  234. v-hasPermi="['aidevicedept:aidevicedept:list']"
  235. >部门管理
  236. </el-button>
  237. <el-button
  238. size="mini"
  239. type="text"
  240. icon="el-icon-document"
  241. @click="handleCameraEvent(scope.row)"
  242. v-hasPermi="['aideviceevent:aideviceevent:list']"
  243. >事件管理
  244. </el-button>
  245. <el-button
  246. size="mini"
  247. type="text"
  248. icon="el-icon-document"
  249. @click="handleCameraLog(scope.row)"
  250. v-hasPermi="['camera:camera:listLog']"
  251. >运行历史
  252. </el-button>
  253. </template>
  254. </el-table-column>
  255. </el-table>
  256. <pagination
  257. v-show="total>0"
  258. :total="total"
  259. :page.sync="queryParams.pageNum"
  260. :limit.sync="queryParams.pageSize"
  261. @pagination="getListByDept"
  262. />
  263. <!-- 添加或修改摄像头对话框 -->
  264. <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body :close-on-click-modal="false">
  265. <el-card class="box-card">
  266. <el-steps :active="active" align-center>
  267. <el-step title="设备基础信息" icon="el-icon-video-camera-solid"></el-step>
  268. <el-step title="设备详细信息" icon="el-icon-success"></el-step>
  269. </el-steps>
  270. </el-card>
  271. <el-card class="box-card" style="margin-top:15px;">
  272. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  273. <div v-show="active == 1">
  274. <el-row>
  275. <el-col :span="20">
  276. <el-form-item label="摄像头厂家" prop="cameraFactory">
  277. <el-select v-model="form.cameraFactory" placeholder="摄像头厂家">
  278. <el-option v-for="dict in dict.type.camera_factory" :key="dict.value" :label="dict.label"
  279. :value="dict.value"
  280. />
  281. </el-select>
  282. </el-form-item>
  283. <el-form-item label="融合平台" prop="convergencePlatform">
  284. <el-select v-model="form.convergencePlatform" placeholder="融合平台">
  285. <el-option v-for="dict in dict.type.convergence_platform" :key="dict.value" :label="dict.label"
  286. :value="dict.value"
  287. />
  288. </el-select>
  289. </el-form-item>
  290. <el-form-item label="摄像头名称" prop="cameraName">
  291. <el-input v-model="form.cameraName" placeholder="请输入摄像头名称"/>
  292. </el-form-item>
  293. <el-form-item label="所属区域" prop="cameraRegion">
  294. <el-input v-model="form.cameraRegion" placeholder="请输入所属区域"/>
  295. </el-form-item>
  296. <el-form-item label="半径" prop="cameraRadius">
  297. <el-input v-model="form.cameraRadius" placeholder="请输入半径"/>
  298. </el-form-item>
  299. <el-form-item label="高度" prop="height">
  300. <el-input v-model="form.height" placeholder="请输入高度"/>
  301. </el-form-item>
  302. <el-form-item label="经度" prop="longitude">
  303. <el-input v-model="form.longitude" placeholder="请输入经度" @dblclick.native="showMap"/>
  304. </el-form-item>
  305. <el-form-item label="纬度" prop="latitude">
  306. <el-input v-model="form.latitude" placeholder="请输入纬度" @dblclick.native="showMap"/>
  307. </el-form-item>
  308. <el-form-item label="摄像头用途" prop="cameraUse">
  309. <el-select v-model="form.cameraUse" placeholder="请选择摄像头用途">
  310. <el-option
  311. v-for="dict in dict.type.camera_use"
  312. :key="dict.value"
  313. :label="dict.label"
  314. :value="dict.value"
  315. ></el-option>
  316. </el-select>
  317. </el-form-item>
  318. </el-col>
  319. </el-row>
  320. </div>
  321. <div v-show="active == 2 ">
  322. <el-row>
  323. <el-col :span="18">
  324. <el-form-item label="ip" prop="cameraIp">
  325. <el-input v-model="form.cameraIp" placeholder="请输入ip"/>
  326. </el-form-item>
  327. <el-form-item label="端口" prop="cameraPort">
  328. <el-input v-model="form.cameraPort" maxlength="10" placeholder="请输入端口"/>
  329. </el-form-item>
  330. <el-form-item label="账号" prop="cameraAccount">
  331. <el-input v-model="form.cameraAccount" maxlength="20" placeholder="请输入账号"/>
  332. </el-form-item>
  333. <el-form-item label="密码" prop="cameraPasword">
  334. <el-input v-model="form.cameraPasword" maxlength="20" placeholder="请输入密码" show-password
  335. autocomplete="new-password"
  336. />
  337. </el-form-item>
  338. <el-form-item label="摄像头编码" prop="cameraCode">
  339. <el-input v-model="form.cameraCode" :disabled="cameraCodeDisabled" placeholder="请输入摄像头编码"/>
  340. </el-form-item>
  341. <el-form-item label="通道编号" prop="channelNum">
  342. <el-input v-model="form.channelNum" placeholder="请输入通道编号"/>
  343. </el-form-item>
  344. <el-form-item label="摄像头类型" prop="cameraType">
  345. <el-select v-model="form.cameraType" placeholder="请选择摄像头类型">
  346. <el-option
  347. v-for="dict in dict.type.camera_type"
  348. :key="dict.value"
  349. :label="dict.label"
  350. :value="dict.value"
  351. ></el-option>
  352. </el-select>
  353. </el-form-item>
  354. <el-form-item label="可用系统" prop="list">
  355. <el-select v-model="form.list" multiple placeholder="请选择用途">
  356. <el-option
  357. v-for="dict in dict.type.camera_system"
  358. :key="dict.value"
  359. :label="dict.label"
  360. :value="dict.value"
  361. ></el-option>
  362. </el-select>
  363. </el-form-item>
  364. <el-form-item label="运营商类型" prop="operatorType">
  365. <el-select v-model="form.operatorType" placeholder="请选择运营商类型">
  366. <el-option
  367. v-for="dict in dict.type.operator_type"
  368. :key="dict.value"
  369. :label="dict.label"
  370. :value="dict.value"
  371. ></el-option>
  372. </el-select>
  373. </el-form-item>
  374. <el-form-item label="图片" prop="cameraImagesList">
  375. <image-upload v-model="form.cameraImagesList"/>
  376. </el-form-item>
  377. </el-col>
  378. </el-row>
  379. </div>
  380. </el-form>
  381. </el-card>
  382. <div slot="footer" class="dialog-footer" v-show="active != 3">
  383. <el-button v-if="active < 2 && form.cameraFactory !== undefined" :disabled="isFormIncomplete()"
  384. style="margin-top: 12px" type="primary" @click="next"
  385. >下一步
  386. </el-button>
  387. </div>
  388. <div slot="footer" class="dialog-footer" v-show="active == 2">
  389. <el-button v-if="active > 1" style="margin-top: 12px" @click="pre">上一步</el-button>
  390. <el-button type="primary" @click="submitForm">确定</el-button>
  391. </div>
  392. </el-dialog>
  393. <!-- 详情 -->
  394. <el-dialog :title="title" :visible.sync="openSee" width="1000px" append-to-body>
  395. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  396. <el-row>
  397. <el-col :span="12">
  398. <!--<el-form-item label="数据所属部门" prop="dataDeptId">
  399. <deptselector :setValue=setDataDeptId ></deptselector>
  400. </el-form-item>-->
  401. <el-form-item label="融合平台" prop="convergencePlatform" label-width="120px">
  402. <el-select v-model="form.convergencePlatform" placeholder="融合平台" :disabled="true"
  403. style="width: 360px;"
  404. >
  405. <el-option
  406. v-for="dict in dict.type.convergence_platform"
  407. :key="dict.value"
  408. :label="dict.label"
  409. :value="dict.value"
  410. />
  411. </el-select>
  412. </el-form-item>
  413. <el-form-item label="摄像头厂家" prop="cameraFactory" label-width="120px">
  414. <el-select v-model="form.cameraFactory" placeholder="摄像头厂家" :disabled="true " style="width: 360px;">
  415. <el-option
  416. v-for="dict in dict.type.camera_factory"
  417. :key="dict.value"
  418. :label="dict.label"
  419. :value="dict.value"
  420. />
  421. </el-select>
  422. </el-form-item>
  423. <el-form-item label="摄像头类型" prop="cameraType" label-width="120px">
  424. <el-select v-model="form.cameraType" placeholder="请选择摄像头类型" :disabled="true"
  425. style="width: 360px;"
  426. >
  427. <el-option
  428. v-for="dict in dict.type.camera_type"
  429. :key="dict.value"
  430. :label="dict.label"
  431. :value="dict.value"
  432. ></el-option>
  433. </el-select>
  434. </el-form-item>
  435. <el-form-item label="摄像头名称" prop="cameraName" label-width="120px">
  436. <el-input v-model="form.cameraName" :disabled="true"/>
  437. </el-form-item>
  438. <el-form-item label="摄像头编码" prop="cameraCode" label-width="120px">
  439. <el-input v-model="form.cameraCode" :disabled="true"/>
  440. </el-form-item>
  441. <el-form-item label="通道编号" prop="channelNum" label-width="120px">
  442. <el-input v-model="form.channelNum" :disabled="true"/>
  443. </el-form-item>
  444. <el-form-item label="账号" prop="cameraAccount" label-width="120px">
  445. <el-input v-model="form.cameraAccount" :disabled="true"/>
  446. </el-form-item>
  447. <el-form-item label="密码" prop="cameraPasword" label-width="120px">
  448. <el-input v-model="form.cameraPasword" :disabled="true" show-password/>
  449. </el-form-item>
  450. <el-form-item label="摄像头用途" prop="cameraUse" label-width="120px">
  451. <el-select v-model="form.cameraUse" placeholder="请选择摄像头用途" :disabled="true" style="width: 360px;">
  452. <el-option
  453. v-for="dict in dict.type.camera_use"
  454. :key="dict.value"
  455. :label="dict.label"
  456. :value="dict.value"
  457. ></el-option>
  458. </el-select>
  459. </el-form-item>
  460. </el-col>
  461. <el-col :span="12">
  462. <el-form-item label="所属区域" prop="cameraRegion" label-width="120px">
  463. <el-input v-model="form.cameraRegion" :disabled="true"/>
  464. </el-form-item>
  465. <el-form-item label="运营商类型" prop="operatorType" label-width="120px">
  466. <el-select v-model="form.operatorType" placeholder="请选择运营商类型" :disabled="true"
  467. style="width: 360px;"
  468. >
  469. <el-option
  470. v-for="dict in dict.type.operator_type"
  471. :key="dict.value"
  472. :label="dict.label"
  473. :value="dict.value"
  474. ></el-option>
  475. </el-select>
  476. </el-form-item>
  477. <el-form-item label="半径" prop="cameraRadius" label-width="120px">
  478. <el-input type="number" v-model="form.cameraRadius" :disabled="true"/>
  479. </el-form-item>
  480. <el-form-item label="高度" prop="height" label-width="120px">
  481. <el-input type="number" v-model="form.height" :disabled="true"/>
  482. </el-form-item>
  483. <el-form-item label="经度" prop="longitude" label-width="120px">
  484. <el-input type="number" v-model="form.longitude" :disabled="true"/>
  485. </el-form-item>
  486. <el-form-item label="纬度" prop="latitude" label-width="120px">
  487. <el-input type="number" v-model="form.latitude" :disabled="true"/>
  488. </el-form-item>
  489. <el-form-item label="ip" prop="cameraIp" label-width="120px">
  490. <el-input v-model="form.cameraIp" :disabled="true"/>
  491. </el-form-item>
  492. <el-form-item label="端口" prop="cameraPort" label-width="120px">
  493. <el-input v-model="form.cameraPort" :disabled="true"/>
  494. </el-form-item>
  495. <el-form-item label="可用系统" prop="list" label-width="120px">
  496. <el-select v-model="form.list" multiple placeholder="请选择用途" :disabled="true" style="width: 360px;">
  497. <el-option
  498. v-for="dict in dict.type.camera_system"
  499. :key="dict.value"
  500. :label="dict.label"
  501. :value="dict.value"
  502. ></el-option>
  503. </el-select>
  504. </el-form-item>
  505. </el-col>
  506. </el-row>
  507. </el-form>
  508. <div slot="footer" class="dialog-footer">
  509. <el-button @click="cancelSel">取 消</el-button>
  510. </div>
  511. </el-dialog>
  512. <!-- 超图弹框 -->
  513. <ISuperMap ref="ISuperMap" v-if="ISuperMapvisible" @send="send"/>
  514. <!--<el-dialog :title="titleLongitude" :visible.sync="showLongitude">-->
  515. <!--<el-input v-show="false" v-model="form.longitude"></el-input>-->
  516. <!--<el-input v-show="false" v-model="form.latitude"></el-input>-->
  517. <!--<supermap style="width: 100%;height: 500px;" :mapDiv="'cameraMap'" :mapSite="{doubleClickZoom:false}"-->
  518. <!--:codes="['9fa5']" :isSideBySide="false" :showLatLng="showLatLng"></supermap>-->
  519. <!--<el-button type="primary" @click="showLongitude=false">确 定</el-button>-->
  520. <!--</el-dialog>-->
  521. <!-- 通道管理弹框 -->
  522. <el-dialog :title="titleCameraChannel" :visible.sync="showCameraChannel" @close="closeDialog">
  523. <camerachannel v-if="showCameraChannel" ref="cameraChannel" :sonId="sonIdValue" :channelCameraIp="channelCameraIp"
  524. :channelCameraPort="channelCameraPort" :channelCameraAccount="channelCameraAccount"
  525. :channelCameraPasword="channelCameraPasword" :deviceCode="deviceCode"
  526. :deviceSn="deviceSn" :deviceProtocolType="deviceProtocolType" :deviceLoginType="deviceLoginType"
  527. :cameraUse="cameraUse" style="width: 100%;height: 100%;"
  528. ></camerachannel>
  529. </el-dialog>
  530. <!-- 运行历史弹框 -->
  531. <el-dialog :title="titleCameraLog" :visible.sync="showCameraLog" @close="closeDialog">
  532. <camerastatelog v-if="showCameraLog" ref="cameraLog" :sonId="sonIdValue"
  533. style="width: 100%;height: 100%;"
  534. ></camerastatelog>
  535. </el-dialog>
  536. <!-- 部门管理弹框 -->
  537. <el-dialog :title="titleCameraDept" :visible.sync="showCameraDept" @close="closeDialog">
  538. <aidevicedept v-if="showCameraDept" ref="cameraDept" :sonId="sonIdValue" :sonCode="sonCodeValue"
  539. :sonName="sonNameValue" :sonType="sonTypeValue" style="width: 100%;height: 100%;"
  540. ></aidevicedept>
  541. </el-dialog>
  542. <!-- 事件管理弹框 -->
  543. <el-dialog :title="titleCameraEvent" :visible.sync="showCameraEvent" @close="closeDialog">
  544. <!--<cameraevent v-if="showCameraEvent" ref="cameraEvent" :sonId="sonIdValue"
  545. style="width: 100%;height: 100%;"></cameraevent>-->
  546. <aideviceevent v-if="showCameraEvent" ref="cameraEvent" :sonId="sonIdValue" :sonCode="sonCodeValue"
  547. :sonName="sonNameValue" :sonType="sonTypeValue"
  548. style="width: 100%;height: 100%;"
  549. ></aideviceevent>
  550. </el-dialog>
  551. <!--大华预览回放窗口-->
  552. <el-dialog :title="dssPreviewTitle" :visible.sync="dssPreviewVisible" v-if="dssPreviewVisible"
  553. customClass="videoCustomWidth"
  554. @close="destroy" append-to-body
  555. >
  556. <div id="dssPreview" style="width:1020px;height:625px;position:relative;"></div>
  557. </el-dialog>
  558. <!--海康预览回放窗口-->
  559. <!--预览-->
  560. <el-dialog :title="cameraTitle" :visible.sync="cameraVisible" v-if="cameraVisible" customClass="videoCustomWidth"
  561. @close="hikDisconnect" append-to-body
  562. >
  563. <div id="playWnd" style="width:1020px;height:625px;position:relative;"></div>
  564. </el-dialog>
  565. <!--回放-->
  566. <el-dialog :title="cameraTitlePlayBack" :visible.sync="cameraVisiblePlayBack" v-if="cameraVisiblePlayBack"
  567. customClass="videoCustomWidthPlayBack"
  568. @close="cancelEventLocationShow()"
  569. >
  570. <div class="item" style="z-index: 99999"><span class="label">回放开始时间:</span>
  571. <input type="datetime-local" value-format="yyyy-MM-dd HH:mm:ss" v-model="startTimeStamp"/>
  572. <span class="label">回放结束时间:</span>
  573. <input type="datetime-local" value-format="yyyy-MM-dd HH:mm:ss" v-model="endTimeStamp"/>
  574. </div>
  575. <div class="item" style="margin-top: 20px;margin-left: -20px;">
  576. <button style="width:90px;padding:0;margin:0;" class="btn" @click="startPlayback">回放</button>
  577. <button style="width:90px;padding:0;margin:0;" class="btn" @click="stopAllPlayback">停止全部回放</button>
  578. </div>
  579. <div style="width:1020px;height:625px;position:relative;">
  580. <div id="playWndPlayBack" class="playWndPlayBack" style="left: 0px; top: 0px;"></div>
  581. </div>
  582. </el-dialog>
  583. <haikang-t-v-walls ref="haikangTVWalls"></haikang-t-v-walls>
  584. </div>
  585. </template>
  586. <script>
  587. import {
  588. listCamera,
  589. listCameraByDept,
  590. getCamera,
  591. delCamera,
  592. addCamera,
  593. updateCamera,
  594. selectchannelCodeByCameraId,
  595. listStateLog,
  596. synchronizeOfflineCamera
  597. } from '@/api/centerMonitor/camera/camera'
  598. import {listCamerachannel} from '@/api/centerMonitor/camera/camerachannel'
  599. import deptselector from '@/views/components/deptselector'
  600. import supermap from '@/views/components/supermap'
  601. import ISuperMap from '@/views/components/ISuperMap'
  602. import camerachannel from './camerachannel'
  603. import camerastatelog from './camerastatelog'
  604. import aidevicedept from '@/views/centerMonitor/aidevicedept/aidevicedept'
  605. import aideviceevent from '@/views/centerMonitor/aideviceevent/aideviceevent'
  606. import haikangTVWalls from '@/views/components/haikangTVWalls.vue'
  607. import {checkNonnegativeInteger, checkLat, checkLon} from '@/api/system/rules'
  608. import {
  609. selectConfigKey
  610. } from '@/api/system/config'
  611. // import moment from 'moment';
  612. /** ----------------------------------摄像头预览开始------------------------------------- */
  613. import {getDahuaVideoServer} from '@/api/centerMonitor/dahua/dahua'
  614. import DHWs from '@/daHua/lib/DHWs'
  615. import {
  616. getHaiKangVideoServer
  617. } from '@/api/haikang/haikang'
  618. /** ----------------------------------摄像头预览结束------------------------------------- */
  619. export default {
  620. name: 'Camera',
  621. metaInfo() {
  622. return {
  623. title: this.pageName
  624. }
  625. },
  626. components: {
  627. deptselector,
  628. supermap,
  629. camerachannel,
  630. camerastatelog,
  631. aidevicedept,
  632. aideviceevent,
  633. ISuperMap,
  634. haikangTVWalls
  635. },
  636. dicts: ['camera_system', 'operator_type', 'camera_factory', 'camera_type', 'camera_use', 'device_status', 'camera_offline_reason', 'convergence_platform'],
  637. data() {
  638. let disabledDate = date => {
  639. return date.getTime() > new Date().getTime() - 24 * 60 * 60 * 1000
  640. }
  641. return {
  642. pageName: '全域视联平台',
  643. pickerOptions: {
  644. disabledDate,
  645. // selectableRange 用来限制时分秒的选择,这里要求只能选择当前时间之后到0点的时间点 但应该只限今天
  646. selectableRange: '00:00:00 - 23:59:59'
  647. },
  648. /***海康***/
  649. cameraTitle: '',
  650. cameraVisible: false,
  651. cameraTitlePlayBack: '',
  652. cameraVisiblePlayBack: false,
  653. cameraIndexCodePlayBack: '',
  654. startTimeStamp: '',
  655. endTimeStamp: '',
  656. initCount: 0,
  657. pubKey: '',
  658. oWebControl: null,
  659. /***大华***/
  660. dssPreviewTitle: '',
  661. dssPreviewVisible: false,
  662. ctrl: 'ctrl1',
  663. active: 1,
  664. // 选中数组
  665. ids: [],
  666. //摄像头编码是否可编辑
  667. cameraCodeDisabled: true,
  668. // 遮罩层
  669. loading: true,
  670. // 选中数组
  671. cameraCodes: [],
  672. // 非单个禁用
  673. single: true,
  674. // 非多个禁用
  675. multiple: true,
  676. // 显示搜索条件
  677. showSearch: true,
  678. // 日期范围
  679. dateRange: [],
  680. // 总条数
  681. total: 0,
  682. // 摄像头表格数据
  683. cameraList: [],
  684. // 弹出层标题
  685. title: '',
  686. // 是否显示弹出层
  687. open: false,
  688. // 是否显示详情弹出层
  689. openSee: false,
  690. // 超图
  691. sign: 1,
  692. ISuperMapvisible: false,
  693. showLongitude: false,
  694. titleLongitude: '',
  695. // 通道
  696. showCameraChannel: false,
  697. titleCameraChannel: '',
  698. // 日志
  699. showCameraLog: false,
  700. titleCameraLog: '',
  701. // 部门
  702. showCameraDept: false,
  703. titleCameraDept: '',
  704. // 事件
  705. showCameraEvent: false,
  706. titleCameraEvent: '',
  707. //传递到子页面摄像头ID
  708. sonIdValue: null,
  709. //传递到子页面摄像头Code
  710. sonCodeValue: null,
  711. //传递到子页面摄像头Name
  712. sonNameValue: null,
  713. //传递到子页面设备类型
  714. sonTypeValue: null,
  715. //通道子页面传值
  716. channelCameraIp: null,
  717. channelCameraPort: null,
  718. channelCameraAccount: null,
  719. channelCameraPasword: null,
  720. cameraUse: null,
  721. deviceCode: null,
  722. deviceSn: null,
  723. deviceProtocolType: null,
  724. deviceLoginType: null,
  725. // 查询参数
  726. queryParams: {
  727. pageNum: 1,
  728. pageSize: 10,
  729. dataStatus: null,
  730. dataDeptId: null,
  731. cameraName: null,
  732. cameraIp: null,
  733. cameraPort: null,
  734. cameraAccount: null,
  735. cameraPasword: null,
  736. cameraCode: null,
  737. cameraFactory: null,
  738. convergencePlatform: null,
  739. cameraRegion: null,
  740. cameraRadius: null,
  741. height: null,
  742. longitude: null,
  743. latitude: null,
  744. operatorType: null,
  745. cameraUse: null,
  746. channelNum: null,
  747. workingStatus: null,
  748. cameraImg: null,
  749. deviceCode: null,
  750. deviceSn: null,
  751. deviceProtocolType: null,
  752. deviceLoginType: null
  753. },
  754. // 通道查询参数
  755. queryChannelParams: {
  756. pageNum: 1,
  757. pageSize: 10,
  758. dataStatus: null,
  759. cameraId: null,
  760. channelCode: null,
  761. channelName: null,
  762. channelType: null
  763. },
  764. cameraSystemList: [],
  765. // 表单参数
  766. form: {
  767. cameraImages: [],
  768. cameraImagesList: []
  769. },
  770. // 表单校验
  771. rules: {
  772. cameraName: [
  773. {required: true, message: '摄像头名称不能为空', trigger: 'blur'}
  774. ],
  775. // cameraIp: [
  776. // {
  777. // required: true,
  778. // pattern: /^(?:[1-9]|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.(?:\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.(?:\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.(?:\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])$/,
  779. // message: "请输入正确的IP地址",
  780. // trigger: "blur",
  781. // validator: (rule, value, callback) => {
  782. // if (this.form.cameraFactory == 0 && !value.match(rule.pattern)) {
  783. // callback(new Error("请输入正确的IP地址"));
  784. // } else if (this.form.cameraFactory == 0 && !value) {
  785. // callback(new Error("IP不能为空"));
  786. // } else {
  787. // callback();
  788. // }
  789. // },
  790. // },
  791. // ],
  792. cameraIp: [
  793. {
  794. validator: (rule, value, callback) => {
  795. if (!value) {
  796. // 如果值为空,则不进行验证
  797. callback()
  798. } else {
  799. // 进行 IP 地址格式验证
  800. if (!value.match(/^(?:[1-9]|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.(?:\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.(?:\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.(?:\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])$/)) {
  801. // 如果值不符合规定格式,则返回错误
  802. callback(new Error('请输入正确的IP地址'))
  803. } else {
  804. callback()
  805. }
  806. }
  807. }
  808. }
  809. ],
  810. cameraPort: [
  811. {
  812. validator: (rule, value, callback) => {
  813. if (!value) {
  814. callback()
  815. } else if (!value.match(/^[1-9]\d*$/)) {
  816. callback(new Error('请输入正确的端口'))
  817. } else {
  818. callback()
  819. }
  820. }
  821. }
  822. ],
  823. // cameraPort: [
  824. // {
  825. // validator: (rule, value, callback) => {
  826. // // 处理存入前的值
  827. // const processedValue = value === null ? '' : value;
  828. //
  829. // if (processedValue === "") {
  830. // // 如果值为空,则不进行验证
  831. // callback();
  832. // } else if (!/^[1-9]\d*$/.test(processedValue)) {
  833. // // 如果值不符合规定格式,则返回错误
  834. // callback(new Error("请输入正确的端口"));
  835. // } else {
  836. // callback();
  837. // }
  838. // },
  839. // },
  840. // ],
  841. // cameraAccount: [
  842. // {required: true, message: "账号不能为空", trigger: "blur",
  843. // validator: (rule, value, callback) => {
  844. // if (this.form.cameraFactory == 0 && !value) {
  845. // callback(new Error("账号不能为空"));
  846. // } else {
  847. // callback();
  848. // }
  849. // },
  850. //
  851. // },
  852. // ],
  853. // cameraPasword: [
  854. // {required: true, message: "密码不能为空", trigger: "blur",
  855. // validator: (rule, value, callback) => {
  856. // if (this.form.cameraFactory == 0 && !value) {
  857. // callback(new Error("密码不能为空"));
  858. // } else {
  859. // callback();
  860. // }
  861. // },
  862. // },
  863. // ],
  864. cameraCode: [
  865. {required: true, message: '摄像头编码不能为空', trigger: 'blur'}
  866. ],
  867. convergencePlatform: [
  868. {required: true, message: '融合平台不能为空', trigger: 'blur'}
  869. ],
  870. cameraFactory: [
  871. {required: true, message: '摄像头厂家不能为空', trigger: 'blur'}
  872. ],
  873. height: [
  874. {required: true, message: '高度不能为空', trigger: 'blur'}
  875. ],
  876. cameraRegion: [
  877. {required: true, message: '所属区域不能为空', trigger: 'blur'}
  878. ],
  879. cameraRadius: [
  880. {required: true, message: '半径不能为空', trigger: 'blur'},
  881. {validator: checkNonnegativeInteger, trigger: 'blur'}
  882. ],
  883. longitude: [
  884. {required: true, message: '经度不能为空', trigger: 'change'},
  885. {validator: checkLon, trigger: 'blur'}
  886. ],
  887. latitude: [
  888. {required: true, message: '纬度不能为空', trigger: 'change'},
  889. {validator: checkLat, trigger: 'blur'}
  890. ],
  891. list: [
  892. {required: true, message: '可用系统不能为空', trigger: 'blur'}
  893. ],
  894. cameraType: [
  895. {required: true, message: '摄像头类型不能为空', trigger: 'blur'}
  896. ],
  897. cameraUse: [
  898. {required: true, message: '摄像头用途不能为空', trigger: 'blur'}
  899. ]
  900. }
  901. }
  902. },
  903. activated: function () {
  904. let startTime = this.$route.query.startTime // 从url中获取startTime参数
  905. let endTime = this.$route.query.endTime // 从url中获取endTime参数
  906. if (startTime && endTime) {
  907. startTime = startTime + ' 00:00:00'
  908. endTime = endTime + ' 23:59:59'
  909. this.dateRange = [startTime, endTime]
  910. }
  911. this.queryParams.workingStatus = this.$route.query.workingStatus
  912. this.queryParams.deptId = this.$route.query.deptId
  913. this.queryParams.pageNum = 1
  914. if (this.queryParams.deptId != null && this.queryParams.workingStatus != null) {
  915. this.getListByDept()
  916. } else {
  917. this.getList()
  918. }
  919. },
  920. created() {
  921. //此处必须第二次调用 防止组件注册后直接F5刷新页面 导致不走getList方法
  922. this.getList()
  923. /** ----------------------------------摄像头预览开始------------------------------------- */
  924. const DHWsInstance = DHWs.getInstance()
  925. this.ws = DHWsInstance
  926. /** ----------------------------------摄像头预览结束------------------------------------- */
  927. },
  928. mounted() {
  929. this.cameraSystemList = this.dict.type.camera_system
  930. window.alertLoginFailed = this.alertLoginFailed// 登陆失败
  931. window.alertReinstall = this.alertReinstall// 请重新安装客户端
  932. setTimeout(() => {
  933. this.pageName = '全域视联平台'
  934. }, 2000)
  935. },
  936. methods: {
  937. isFormIncomplete() {
  938. return !this.form.cameraFactory || !this.form.cameraName || !this.form.cameraRegion || !this.form.cameraRadius || !this.form.height || !this.form.longitude || !this.form.latitude
  939. },
  940. login: function (row) { // 调用登录接口
  941. console.log('row', row)
  942. },
  943. next() {
  944. this.$refs['form'].validateField('longitude', (valid, message) => {
  945. if (valid == '') {
  946. this.$refs['form'].validateField('latitude', (valids, message) => {
  947. if (valids == '') {
  948. if (this.active++ > 5) this.active = 1
  949. }
  950. })
  951. }
  952. })
  953. },
  954. pre() {
  955. if (this.active-- < 1) this.active = 1
  956. },
  957. showMap() {
  958. this.ISuperMapvisible = true
  959. this.$nextTick(() => {
  960. this.$refs.ISuperMap.init(this.sign, {
  961. id: this.form.id,
  962. longitude: this.form.longitude,
  963. latitude: this.form.latitude,
  964. xiantude: this.form.longitude//this.form.longitude换成每个页面对应线或者面对应的字段
  965. })
  966. })
  967. },
  968. send(val) {
  969. if (val === true) {
  970. this.ISuperMapvisible = false
  971. return
  972. }
  973. if (this.sign === 1) {
  974. this.form.longitude = val.longitude
  975. this.form.latitude = val.latitude
  976. }
  977. if (this.sign === 2 || this.sign === 3) this.form.longitude = val.xiantude//this.form.longitude 换成对应的线或区域的字段
  978. this.ISuperMapvisible = false
  979. },
  980. showLatLng: function (lat, lng) {
  981. this.form.latitude = lat
  982. this.form.longitude = lng
  983. },
  984. // 取消按钮
  985. cancelSel() {
  986. this.openSee = false
  987. this.reset()
  988. },
  989. /** 查询摄像头详情 */
  990. handleSee(row) {
  991. this.reset()
  992. const id = row.id || this.ids
  993. getCamera(id).then(response => {
  994. this.form = response.data
  995. const selectList = []
  996. for (let index in this.form.list) {
  997. selectList.push(this.form.list[index].type)
  998. }
  999. this.form.list = selectList
  1000. this.openSee = true
  1001. this.title = '详情'
  1002. })
  1003. },
  1004. /** 查询摄像头列表 */
  1005. getList() {
  1006. this.loading = true
  1007. listCamera(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
  1008. this.cameraList = response.rows
  1009. this.total = response.total
  1010. this.loading = false
  1011. })
  1012. },
  1013. /** 查询摄像头列表 */
  1014. getListByDept() {
  1015. if (this.queryParams.workingStatus != null && this.queryParams.deptId != null) {
  1016. this.loading = true
  1017. listCameraByDept(this.queryParams).then(response => {
  1018. this.cameraList = response.rows
  1019. this.total = response.total
  1020. this.loading = false
  1021. })
  1022. } else {
  1023. // 执行查询所有列表的逻辑
  1024. this.getList()
  1025. }
  1026. },
  1027. /** 通道管理列表 */
  1028. handleCameraChannel(row) {
  1029. const id = row.id || this.ids
  1030. this.sonIdValue = id
  1031. this.channelCameraIp = row.cameraIp
  1032. this.channelCameraPort = row.cameraPort
  1033. this.channelCameraAccount = row.cameraAccount
  1034. this.channelCameraPasword = row.cameraPasword
  1035. this.cameraUse = row.cameraUse
  1036. this.deviceCode = row.deviceCode
  1037. this.deviceSn = row.deviceSn
  1038. this.deviceProtocolType = row.deviceProtocolType
  1039. this.deviceLoginType = row.deviceLoginType
  1040. this.showCameraChannel = true
  1041. this.titleCameraChannel = '通道管理列表'
  1042. },
  1043. /** 日志管理列表 */
  1044. handleCameraLog(row) {
  1045. const id = row.id || this.ids
  1046. this.sonIdValue = id
  1047. this.showCameraLog = true
  1048. this.titleCameraLog = '运行历史列表'
  1049. },
  1050. /** 部门管理列表 */
  1051. handleCameraDept(row) {
  1052. const id = row.id
  1053. this.sonIdValue = id
  1054. this.sonTypeValue = 'device_type_1'
  1055. this.sonCodeValue = row.cameraCode
  1056. this.sonNameValue = row.cameraName
  1057. this.showCameraDept = true
  1058. this.titleCameraDept = '部门管理列表'
  1059. },
  1060. /** 事件类型管理列表 */
  1061. handleCameraEvent(row) {
  1062. const id = row.id
  1063. this.sonIdValue = id
  1064. this.sonTypeValue = 'device_type_1'
  1065. this.sonCodeValue = row.cameraCode
  1066. this.sonNameValue = row.cameraName
  1067. this.showCameraEvent = true
  1068. this.titleCameraEvent = '事件类型管理列表'
  1069. },
  1070. closeDialog() {
  1071. this.showCameraChannel = false
  1072. this.showCameraDept = false
  1073. this.showCameraEvent = false
  1074. this.showCameraLog = false
  1075. },
  1076. // 取消按钮
  1077. cancel() {
  1078. this.open = false
  1079. this.reset()
  1080. },
  1081. setDataDeptId(e) {
  1082. this.form.dataDeptId = e
  1083. this.queryParams.dataDeptId = e
  1084. },
  1085. // 表单重置
  1086. reset() {
  1087. this.active = 1
  1088. this.form = {
  1089. id: null,
  1090. createBy: null,
  1091. createTime: null,
  1092. updateBy: null,
  1093. updateTime: null,
  1094. dataStatus: 'data_status_1',
  1095. dataDeptId: null,
  1096. cameraName: null,
  1097. cameraIp: null,
  1098. cameraPort: null,
  1099. cameraAccount: null,
  1100. cameraPasword: null,
  1101. cameraCode: null,
  1102. cameraFactory: null,
  1103. convergencePlatform: null,
  1104. cameraRegion: null,
  1105. cameraRadius: null,
  1106. height: null,
  1107. longitude: null,
  1108. latitude: null,
  1109. workingStatus: '0',
  1110. deptId: null
  1111. }
  1112. this.resetForm('form')
  1113. },
  1114. /** 搜索按钮操作 */
  1115. handleQuery() {
  1116. this.queryParams.pageNum = 1
  1117. this.getList()
  1118. },
  1119. /** 重置按钮操作 */
  1120. resetQuery() {
  1121. this.dateRange = []
  1122. this.resetForm('queryForm')
  1123. this.handleQuery()
  1124. },
  1125. /** 新增按钮操作 */
  1126. handleAdd() {
  1127. //设置新增时可以改摄像头编码
  1128. this.cameraCodeDisabled = false
  1129. this.reset()
  1130. this.open = true
  1131. this.title = '添加摄像头'
  1132. },
  1133. /** 修改按钮操作 */
  1134. handleUpdate(row) {
  1135. this.reset()
  1136. //设置修改时不能改摄像头编码
  1137. this.cameraCodeDisabled = false
  1138. const id = row.id || this.ids
  1139. getCamera(id).then(response => {
  1140. this.form = response.data
  1141. const updateList = []
  1142. for (let index in this.form.list) {
  1143. updateList.push(this.form.list[index].type)
  1144. }
  1145. this.form.list = updateList
  1146. this.open = true
  1147. this.title = '修改摄像头'
  1148. })
  1149. },
  1150. /** 删除按钮操作 */
  1151. handleDelete(row) {
  1152. const ids = row.id || this.ids
  1153. this.$modal.confirm('是否确认删除摄像头数据?').then(function () {
  1154. return delCamera(ids)
  1155. }).then(() => {
  1156. this.getList()
  1157. this.$modal.msgSuccess('删除成功')
  1158. }).catch(() => {
  1159. })
  1160. },
  1161. // 多选框选中数据
  1162. handleSelectionChange(selection) {
  1163. this.ids = selection.map(item => item.id)
  1164. this.single = selection.length !== 1
  1165. this.multiple = !selection.length
  1166. },
  1167. /** ----------------------------------摄像头预览开始------------------------------------- */
  1168. preview(row) {
  1169. selectConfigKey('DssVersion').then(res => {
  1170. if (this.ws.getLocalDssVersion() != res.data) {
  1171. this.$modal.confirm('系统检测到新客户端版本,请更新后使用', '系统提示', {
  1172. confirmButtonText: '确定',
  1173. cancelButtonText: '取消',
  1174. type: 'warning'
  1175. }).then(() => {
  1176. selectConfigKey('video_plugin_url').then(response => {
  1177. window.open(response.data)
  1178. })
  1179. }).catch(() => {
  1180. return
  1181. })
  1182. return
  1183. }
  1184. const convergencePlatform = row.convergencePlatform
  1185. const cameraCode = row.cameraCode
  1186. const cameraName = row.cameraName
  1187. const deviceSn = row.deviceSn
  1188. const deviceCode = row.deviceCode
  1189. const deviceProtocolType = row.deviceProtocolType
  1190. const deviceLoginType = row.deviceLoginType
  1191. console.log(convergencePlatform)
  1192. //如果是大华摄像头
  1193. if (convergencePlatform === '1') {
  1194. selectchannelCodeByCameraId(row.id).then(res => {
  1195. if (cameraCode != null && cameraCode.length > 0) {
  1196. this.dssPreviewTitle = '视频预览'
  1197. this.dssPreviewVisible = true
  1198. this.preview_dss(cameraCode, cameraName, deviceCode, deviceSn, deviceProtocolType, deviceLoginType)
  1199. } else {
  1200. this.$modal.msg('没有匹配到相对应摄像头!!!')
  1201. }
  1202. })
  1203. } else {
  1204. //海康头
  1205. console.log('haikang')
  1206. const cameraIndexCode = row.cameraCode
  1207. this.$refs.haikangTVWalls.showTVWall(cameraIndexCode, 0)
  1208. }
  1209. })
  1210. },
  1211. /** ----------------------------------摄像头预览结束------------------------------------- */
  1212. /** ----------------------------------摄像头回放开始------------------------------------- */
  1213. playBack(row) {
  1214. selectConfigKey('DssVersion').then(res => {
  1215. if (this.ws.getLocalDssVersion() != res.data) {
  1216. this.$modal.confirm('系统检测到新客户端版本,请更新后使用', '系统提示', {
  1217. confirmButtonText: '确定',
  1218. cancelButtonText: '取消',
  1219. type: 'warning'
  1220. }).then(() => {
  1221. selectConfigKey('video_plugin_url').then(response => {
  1222. window.open(response.data)
  1223. })
  1224. }).catch(() => {
  1225. return
  1226. })
  1227. return
  1228. }
  1229. const cameraCode = row.cameraCode
  1230. const cameraName = row.cameraName
  1231. const deviceSn = row.deviceSn
  1232. const deviceCode = row.deviceCode
  1233. const deviceProtocolType = row.deviceProtocolType
  1234. const deviceLoginType = row.deviceLoginType
  1235. const convergencePlatform = row.convergencePlatform
  1236. //如果是大华摄像头
  1237. if (convergencePlatform === '1') {
  1238. selectchannelCodeByCameraId(row.id).then(res => {
  1239. if (cameraCode != null && cameraCode.length > 0) {
  1240. this.dssPreviewTitle = '视频回放'
  1241. this.dssPreviewVisible = true
  1242. this.playBack_dss(cameraCode, cameraName, deviceCode, deviceSn, deviceProtocolType, deviceLoginType)
  1243. } else {
  1244. this.$modal.msg('没有匹配到相对应摄像头!!!')
  1245. }
  1246. })
  1247. } else {
  1248. //海康头
  1249. console.log('haikang')
  1250. const cameraIndexCode = row.cameraCode
  1251. this.$refs.haikangTVWalls.showTVWall(cameraIndexCode, 1)
  1252. }
  1253. })
  1254. },
  1255. /** ----------------------------------摄像头回放结束------------------------------------- */
  1256. /** ----------------------------------大华摄像头预览开始------------------------------------- */
  1257. alertLogin: function () {
  1258. this.$modal.msg('登录中....')
  1259. },
  1260. alertLoginSuccess: function () {
  1261. this.$modal.msgSuccess('登录成功!')
  1262. },
  1263. alertLoginFailed: function () {
  1264. this.$modal.msgError('登陆失败!')
  1265. },
  1266. alertReinstall: function () {
  1267. this.$modal.msgWarning('请重新安装客户端')
  1268. },
  1269. /** 预览按钮操作 */
  1270. preview_dss(cameraCode, cameraName, deviceCode, deviceSn, deviceProtocolType, deviceLoginType) {
  1271. getDahuaVideoServer().then(newResponse => {
  1272. this.ws.detectConnectQt().then(res => {
  1273. console.log('检测连接结果:', res);
  1274. if (res) { // 连接客户端成功
  1275. this.alertLogin()
  1276. this.ws.login({
  1277. loginIp: newResponse.loginIp,
  1278. loginPort: newResponse.loginPort,
  1279. userName: newResponse.userName,
  1280. userPwd: newResponse.userPwd,
  1281. token: '',
  1282. https: 1
  1283. })
  1284. console.log('登录结果:', res);
  1285. this.ws.on('loginState', (res) => {
  1286. this.isLogin = res
  1287. if (res) {
  1288. this.alertLoginSuccess()
  1289. this.activePanel = 'key2'
  1290. // this.realTimeVideoDialog(channelCode)
  1291. let channelList = []
  1292. for (let i = 0; i < cameraCode.length; i++) {
  1293. let code = {'channelId': cameraCode}
  1294. channelList.push(code)
  1295. }
  1296. // 构建参数对象
  1297. let params;
  1298. if (deviceCode === null && deviceSn === null && deviceProtocolType === null && deviceLoginType === null) {
  1299. params = this.careteListJson(cameraCode, cameraName);
  1300. } else {
  1301. params = this.careteListJson(cameraCode, cameraName, deviceCode, deviceSn, deviceProtocolType, deviceLoginType);
  1302. }
  1303. // 过滤掉 null 参数
  1304. if (deviceCode === null) delete params.deviceCode
  1305. if (deviceSn === null) delete params.deviceSn
  1306. if (deviceProtocolType === null) delete params.deviceProtocolType
  1307. if (deviceLoginType === null) delete params.deviceLoginType
  1308. this.create(params, channelList, 'dssPreview', 'realMonitorUI')
  1309. this.playRealMonitorVideo(channelList)
  1310. } else {
  1311. this.alertLoginFailed()
  1312. }
  1313. })
  1314. } else { // 连接客户端失败
  1315. this.alertReinstall()
  1316. }
  1317. })
  1318. })
  1319. },
  1320. careteListJson(cameraCode, cameraName, deviceCode = null, deviceSn = null, deviceProtocolType = null, deviceLoginType = null) {
  1321. const treeLabels = [{
  1322. 'id': null,
  1323. 'labelCode': '999',
  1324. 'labelName': '电视墙',
  1325. 'cameraType': null,
  1326. 'parentLabelCode': ''
  1327. },
  1328. {
  1329. 'id': null,
  1330. 'labelCode': cameraCode,
  1331. 'labelName': cameraName,
  1332. 'cameraType': '1',
  1333. 'parentLabelCode': '999'
  1334. }]
  1335. const channelDates = []
  1336. for (let i in cameraCode) {
  1337. let currentParams = {
  1338. 'channelCode': cameraCode,
  1339. 'channelName': cameraName,
  1340. 'channelSn': null,
  1341. 'cameraType': '1',
  1342. 'online': '1',
  1343. 'cameraCode': '1'
  1344. };
  1345. if (deviceCode !== null) {
  1346. currentParams.deviceCode = deviceCode;
  1347. }
  1348. if (deviceSn !== null) {
  1349. currentParams.deviceSn = deviceSn;
  1350. }
  1351. if (deviceProtocolType !== null) {
  1352. currentParams.deviceProtocolType = deviceProtocolType;
  1353. }
  1354. if (deviceLoginType !== null) {
  1355. currentParams.deviceLoginType = deviceLoginType;
  1356. }
  1357. channelDates.push(currentParams);
  1358. }
  1359. const labelChannels = [{
  1360. 'labelCode': cameraCode,
  1361. 'channelDates': channelDates
  1362. }]
  1363. let tvListJson = [{
  1364. 'switchTab': '2',
  1365. 'treeLabels': treeLabels,
  1366. 'labelChannels': labelChannels
  1367. }]
  1368. console.log('11111111111111111111111111', {
  1369. cameraCode, cameraName, deviceCode, deviceSn, deviceProtocolType, deviceLoginType
  1370. })
  1371. return tvListJson
  1372. },
  1373. create(tvListJson, channelList, domId, ctrlType) { // 调用创建控件接口
  1374. let _this = this
  1375. const params = [
  1376. {
  1377. 'ctrlType': ctrlType,
  1378. 'ctrlCode': 'ctrl1',
  1379. 'ctrlProperty': {
  1380. 'displayMode': 1,
  1381. 'splitNum': 1,
  1382. 'channelList': [
  1383. {
  1384. 'channelId': ''
  1385. }
  1386. ]
  1387. },
  1388. 'visible': true,
  1389. 'domId': domId
  1390. }
  1391. ]
  1392. this.setPos(domId)
  1393. this.customizeTree(tvListJson)
  1394. _this.ws.createCtrl(params)
  1395. },
  1396. setPos(domId) {
  1397. let target = document.getElementById(domId)
  1398. target.style.right = `19px`
  1399. target.style.top = `-20px`
  1400. target.style.width = `1070px`
  1401. target.style.height = `700px`
  1402. if (document.createEvent) {
  1403. var event = document.createEvent('HTMLEvents')
  1404. event.initEvent('resize', true, true)
  1405. window.dispatchEvent(event)
  1406. } else if (document.createEventObject) {
  1407. window.fireEvent('onresize')
  1408. }
  1409. },
  1410. destroy() { // 调用销毁控件接口
  1411. if (!this.isLogin) {
  1412. this.$modal.msgWarning('正在登陆客户端,请稍等......')
  1413. return false
  1414. }
  1415. const ctrls = this.ws.ctrls.map(i => {
  1416. if (i.ctrlCode === this.ctrl) {
  1417. return i.ctrlCode
  1418. }
  1419. })
  1420. this.ws.destroyCtrl(ctrls)
  1421. },
  1422. customizeTree(tvListJson) { // 调用控件接口树
  1423. const config = this.ws.config
  1424. const {loginIp, userCode} = config
  1425. this.ws.postMessage('customizeTree', {
  1426. loginIp,
  1427. userCode,
  1428. params: {
  1429. array: tvListJson
  1430. }
  1431. })
  1432. },
  1433. playRealMonitorVideo(array) { // 自定义设备树自动播放指定通道编码视频
  1434. const config = this.ws.config
  1435. const {loginIp, userCode} = config
  1436. this.ws.postMessage('playRealMonitorVideo', {
  1437. loginIp,
  1438. userCode,
  1439. params: {
  1440. ctrlCode: 'ctrl1',
  1441. array: array
  1442. }
  1443. })
  1444. },
  1445. /** ----------------------------------大华摄像头预览结束------------------------------------- */
  1446. /** ----------------------------------大华摄像头回放开始------------------------------------- */
  1447. /** 预览按钮操作 */
  1448. // playBack_dss(channelCode, channelName,cameraCode,cameraName) {
  1449. playBack_dss(cameraCode, cameraName, deviceCode, deviceSn, deviceProtocolType, deviceLoginType) {
  1450. getDahuaVideoServer().then(newResponse => {
  1451. this.ws.detectConnectQt().then(res => {
  1452. if (res) { // 连接客户端成功
  1453. this.alertLogin()
  1454. this.ws.login({
  1455. loginIp: newResponse.loginIp,
  1456. loginPort: newResponse.loginPort,
  1457. userName: newResponse.userName,
  1458. userPwd: newResponse.userPwd,
  1459. token: '',
  1460. https: 1
  1461. })
  1462. this.ws.on('loginState', (res) => {
  1463. this.isLogin = res
  1464. if (res) {
  1465. this.alertLoginSuccess()
  1466. this.activePanel = 'key2'
  1467. let channelList = []
  1468. for (let i = 0; i < cameraCode.length; i++) {
  1469. let code = {'channelId': cameraCode}
  1470. channelList.push(code)
  1471. }
  1472. this.create(this.careteListJson(cameraCode, cameraName, deviceCode, deviceSn, deviceProtocolType, deviceLoginType), channelList, 'dssPreview', 'playbackUI')
  1473. } else {
  1474. this.alertLoginFailed()
  1475. }
  1476. })
  1477. } else { // 连接客户端失败
  1478. this.alertReinstall()
  1479. }
  1480. })
  1481. })
  1482. },
  1483. /** ----------------------------------大华摄像头回放结束------------------------------------- */
  1484. /** ----------------------------------海康摄像头预览开始------------------------------------- */
  1485. /** 预览按钮操作 */
  1486. preview_hik(row) {
  1487. let that = this
  1488. let cameraCode = row.cameraCode
  1489. getHaiKangVideoServer({cameraCode: cameraCode}).then(newResponse => {
  1490. if (newResponse.code == 200) {
  1491. that.cameraVisible = true
  1492. that.cameraTitle = '摄像头-' + newResponse.data.cameraName
  1493. that.initPlugin(newResponse.data.appkey, newResponse.data.loginIp, newResponse.data.secret, newResponse.data.loginPort)
  1494. setTimeout(function () {
  1495. that.playhk(newResponse.data.channelCode)
  1496. }, 5000)
  1497. }
  1498. })
  1499. },
  1500. replayPreview_hik(row) {
  1501. const cameraCodes = row.cameraCode || this.cameraCodes
  1502. let that = this
  1503. that.cameraVisible = true
  1504. that.cameraTitle = '查看电视墙'
  1505. that.initPluginTvWall()
  1506. setTimeout(function () {
  1507. for (let j = 0; j < cameraCodes.length; j++) {
  1508. getHaiKangVideoServer({cameraCode: cameraCodes[j]}).then(newResponse => {
  1509. if (newResponse.code == 200) {
  1510. that.playhk(newResponse.data.channelCode)
  1511. }
  1512. })
  1513. }
  1514. }, 3000)
  1515. },
  1516. cancelEventLocationShow() {
  1517. if (this.oWebControl != null) {
  1518. this.oWebControl.JS_HideWnd() // 先让窗口隐藏,规避可能的插件窗口滞后于浏览器消失问题
  1519. this.oWebControl.JS_Disconnect().then(function () { // 断开与插件服务连接成功
  1520. },
  1521. function () { // 断开与插件服务连接失败
  1522. })
  1523. }
  1524. this.cameraIndexCodePlayBack = ''
  1525. },
  1526. /** 回放预览按钮操作 */
  1527. // playBack(row) {
  1528. // let that = this;
  1529. // let cameraCode = row.cameraCode;
  1530. // getHaiKangVideoServer({cameraCode: cameraCode}).then(newResponse => {
  1531. // if (newResponse.code == 200) {
  1532. // that.cameraVisiblePlayBack = true
  1533. // that.cameraTitlePlayBack = '摄像头-回放-' + newResponse.data.cameraName
  1534. // that.initPluginPlayBack()
  1535. // this.cameraIndexCodePlayBack = newResponse.data.channelCode
  1536. // }
  1537. // })
  1538. // },
  1539. startPlayback() {
  1540. //录像回放功能
  1541. var cameraIndexCode = this.cameraIndexCodePlayBack //获取输入的监控点编号值,必填
  1542. var startTimeStamp = new Date(this.startTimeStamp).getTime() //回放开始时间戳,必填
  1543. var endTimeStamp = new Date(this.endTimeStamp).getTime() //回放结束时间戳,必填
  1544. var recordLocation = 0 //录像存储位置:0-中心存储,1-设备存储
  1545. var transMode = 1 //传输协议:0-UDP,1-TCP
  1546. var gpuMode = 0 //是否启用GPU硬解,0-不启用,1-启用
  1547. var wndId = -1 //播放窗口序号(在2x2以上布局下可指定播放窗口)
  1548. this.oWebControl.JS_RequestInterface({
  1549. funcName: 'startPlayback',
  1550. argument: JSON.stringify({
  1551. cameraIndexCode: cameraIndexCode, //监控点编号
  1552. startTimeStamp: Math.floor(startTimeStamp / 1000).toString(), //录像查询开始时间戳,单位:秒
  1553. endTimeStamp: Math.floor(endTimeStamp / 1000).toString(), //录像结束开始时间戳,单位:秒
  1554. recordLocation: recordLocation, //录像存储类型:0-中心存储,1-设备存储
  1555. transMode: transMode, //传输协议:0-UDP,1-TCP
  1556. gpuMode: gpuMode, //是否启用GPU硬解,0-不启用,1-启用
  1557. wndId: wndId //可指定播放窗口
  1558. })
  1559. })
  1560. },
  1561. stopAllPlayback() {
  1562. //录像回放停止
  1563. this.oWebControl.JS_RequestInterface({
  1564. funcName: 'stopAllPlayback'
  1565. })
  1566. },
  1567. // 创建播放实例--回放
  1568. initPluginPlayBack() {
  1569. let that = this
  1570. that.oWebControl = new WebControl({
  1571. szPluginContainer: 'playWndPlayBack', // 指定容器id
  1572. iServicePortStart: 15900, // 指定起止端口号,建议使用该值
  1573. iServicePortEnd: 15909,
  1574. szClassId: '23BF3B0A-2C56-4D97-9C03-0CB103AA8F11', // 用于IE10使用ActiveX的clsid
  1575. cbConnectSuccess: function () { // 创建WebControl实例成功
  1576. that.oWebControl.JS_StartService('window', { // WebControl实例创建成功后需要启动服务
  1577. dllPath: './VideoPluginConnect.dll' // 值"./VideoPluginConnect.dll"写死
  1578. }).then(function () { // 启动插件服务成功
  1579. that.oWebControl.JS_SetWindowControlCallback({ // 设置消息回调
  1580. cbIntegrationCallBack: cbIntegrationCallBack
  1581. })
  1582. that.oWebControl.JS_CreateWnd('playWndPlayBack', 1020, 600).then(function () { //JS_CreateWnd创建视频播放窗口,宽高可设定
  1583. that.initPlayBack() // 创建播放实例成功后初始化
  1584. })
  1585. }, function () { // 启动插件服务失败
  1586. })
  1587. },
  1588. cbConnectError: function () { // 创建WebControl实例失败
  1589. that.oWebControl = null
  1590. $('#playWndPlayBack').html('插件未启动,正在尝试启动,请稍候...')
  1591. WebControl.JS_WakeUp('VideoWebPlugin://') // 程序未启动时执行error函数,采用wakeup来启动程序
  1592. initCount++
  1593. if (initCount < 3) {
  1594. setTimeout(function () {
  1595. that.initPluginPlayBack()
  1596. }, 3000)
  1597. } else {
  1598. $('#playWndPlayBack').html('插件启动失败,请检查插件是否安装!')
  1599. }
  1600. },
  1601. cbConnectClose: function (bNormalClose) {
  1602. // 异常断开:bNormalClose = false
  1603. // JS_Disconnect正常断开:bNormalClose = true
  1604. console.log('cbConnectClose')
  1605. that.oWebControl = null
  1606. }
  1607. })
  1608. },
  1609. // 创建播放实例电视墙
  1610. initPluginTvWall() {
  1611. let that = this
  1612. that.oWebControl = new WebControl({
  1613. szPluginContainer: 'playWnd', // 指定容器id
  1614. iServicePortStart: 15900, // 指定起止端口号,建议使用该值
  1615. iServicePortEnd: 15909,
  1616. szClassId: '23BF3B0A-2C56-4D97-9C03-0CB103AA8F11', // 用于IE10使用ActiveX的clsid
  1617. cbConnectSuccess: function () { // 创建WebControl实例成功
  1618. that.oWebControl.JS_StartService('window', { // WebControl实例创建成功后需要启动服务
  1619. dllPath: './VideoPluginConnect.dll' // 值"./VideoPluginConnect.dll"写死
  1620. }).then(function () { // 启动插件服务成功
  1621. that.oWebControl.JS_SetWindowControlCallback({ // 设置消息回调
  1622. cbIntegrationCallBack: cbIntegrationCallBack
  1623. })
  1624. that.oWebControl.JS_CreateWnd('playWnd', 1020, 600).then(function () { //JS_CreateWnd创建视频播放窗口,宽高可设定
  1625. that.initTvWall() // 创建播放实例成功后初始化
  1626. })
  1627. }, function () { // 启动插件服务失败
  1628. })
  1629. },
  1630. cbConnectError: function () { // 创建WebControl实例失败
  1631. that.oWebControl = null
  1632. $('#playWnd').html('插件未启动,正在尝试启动,请稍候...')
  1633. WebControl.JS_WakeUp('VideoWebPlugin://') // 程序未启动时执行error函数,采用wakeup来启动程序
  1634. initCount++
  1635. if (initCount < 3) {
  1636. setTimeout(function () {
  1637. that.initPluginTvWall()
  1638. }, 3000)
  1639. } else {
  1640. $('#playWnd').html('插件启动失败,请检查插件是否安装!')
  1641. }
  1642. },
  1643. cbConnectClose: function (bNormalClose) {
  1644. // 异常断开:bNormalClose = false
  1645. // JS_Disconnect正常断开:bNormalClose = true
  1646. console.log('cbConnectClose')
  1647. that.oWebControl = null
  1648. }
  1649. })
  1650. },
  1651. //初始化回放
  1652. initPlayBack() {
  1653. let that = this
  1654. this.getPubKey(function () {
  1655. ////////////////////////////////// 请自行修改以下变量值 ////////////////////////////////////
  1656. var appkey = '24699060' //综合安防管理平台提供的appkey,必填
  1657. var secret = that.setEncrypt('tt1pMbsrlwGZUWucdAPw') //综合安防管理平台提供的secret,必填
  1658. var ip = '36.49.108.22' //综合安防管理平台IP地址,必填
  1659. var playMode = 1 //初始播放模式:0-预览,1-回放
  1660. var port = 1443 //综合安防管理平台端口,若启用HTTPS协议,默认443
  1661. var snapDir = 'D:\\SnapDir' //抓图存储路径
  1662. var videoDir = 'D:\\VideoDir' //紧急录像或录像剪辑存储路径
  1663. var layout = '1x1' //playMode指定模式的布局
  1664. var enableHTTPS = 1 //是否启用HTTPS协议与综合安防管理平台交互,这里总是填1
  1665. var encryptedFields = 'secret' //加密字段,默认加密领域为secret
  1666. var showToolbar = 1 //是否显示工具栏,0-不显示,非0-显示
  1667. var showSmart = 1 //是否显示智能信息(如配置移动侦测后画面上的线框),0-不显示,非0-显示
  1668. var buttonIDs = '0,16,256,257,258,259,260,512,513,514,515,516,517,768,769' //自定义工具条按钮
  1669. ////////////////////////////////// 请自行修改以上变量值 ////////////////////////////////////
  1670. that.oWebControl.JS_RequestInterface({
  1671. funcName: 'init',
  1672. argument: JSON.stringify({
  1673. appkey: appkey, //API网关提供的appkey
  1674. secret: secret, //API网关提供的secret
  1675. ip: ip, //API网关IP地址
  1676. playMode: playMode, //播放模式(决定显示预览还是回放界面)
  1677. port: port, //端口
  1678. snapDir: snapDir, //抓图存储路径
  1679. videoDir: videoDir, //紧急录像或录像剪辑存储路径
  1680. layout: layout, //布局
  1681. enableHTTPS: enableHTTPS, //是否启用HTTPS协议
  1682. encryptedFields: encryptedFields, //加密字段
  1683. showToolbar: showToolbar, //是否显示工具栏
  1684. showSmart: showSmart, //是否显示智能信息
  1685. buttonIDs: buttonIDs //自定义工具条按钮
  1686. })
  1687. }).then(function (oData) {
  1688. that.oWebControl.JS_Resize(1020, 600) // 初始化后resize一次,规避firefox下首次显示窗口后插件窗口未与DIV窗口重合问题
  1689. })
  1690. })
  1691. },
  1692. //初始化电视墙
  1693. initTvWall() {
  1694. let that = this
  1695. this.getPubKey(function () {
  1696. ////////////////////////////////// 请自行修改以下变量值 ////////////////////////////////////
  1697. var appkey = '24699060' //综合安防管理平台提供的appkey,必填
  1698. var secret = that.setEncrypt('tt1pMbsrlwGZUWucdAPw') //综合安防管理平台提供的secret,必填
  1699. var ip = '36.49.108.22' //综合安防管理平台IP地址,必填
  1700. var playMode = 0 //初始播放模式:0-预览,1-回放
  1701. var port = 1443 //综合安防管理平台端口,若启用HTTPS协议,默认443
  1702. var snapDir = 'D:\\SnapDir' //抓图存储路径
  1703. var videoDir = 'D:\\VideoDir' //紧急录像或录像剪辑存储路径
  1704. var layout = '3x3' //playMode指定模式的布局
  1705. var enableHTTPS = 1 //是否启用HTTPS协议与综合安防管理平台交互,这里总是填1
  1706. var encryptedFields = 'secret' //加密字段,默认加密领域为secret
  1707. var showToolbar = 1 //是否显示工具栏,0-不显示,非0-显示
  1708. var showSmart = 1 //是否显示智能信息(如配置移动侦测后画面上的线框),0-不显示,非0-显示
  1709. var buttonIDs = '0,16,256,257,258,259,260,512,513,514,515,516,517,768,769' //自定义工具条按钮
  1710. ////////////////////////////////// 请自行修改以上变量值 ////////////////////////////////////
  1711. that.oWebControl.JS_RequestInterface({
  1712. funcName: 'init',
  1713. argument: JSON.stringify({
  1714. appkey: appkey, //API网关提供的appkey
  1715. secret: secret, //API网关提供的secret
  1716. ip: ip, //API网关IP地址
  1717. playMode: playMode, //播放模式(决定显示预览还是回放界面)
  1718. port: port, //端口
  1719. snapDir: snapDir, //抓图存储路径
  1720. videoDir: videoDir, //紧急录像或录像剪辑存储路径
  1721. layout: layout, //布局
  1722. enableHTTPS: enableHTTPS, //是否启用HTTPS协议
  1723. encryptedFields: encryptedFields, //加密字段
  1724. showToolbar: showToolbar, //是否显示工具栏
  1725. showSmart: showSmart, //是否显示智能信息
  1726. buttonIDs: buttonIDs //自定义工具条按钮
  1727. })
  1728. }).then(function (oData) {
  1729. that.oWebControl.JS_Resize(1020, 600) // 初始化后resize一次,规避firefox下首次显示窗口后插件窗口未与DIV窗口重合问题
  1730. })
  1731. })
  1732. },
  1733. // 创建播放实例
  1734. initPlugin(newappkey, newloginIp, newsecret, newloginPort) {
  1735. let that = this
  1736. that.oWebControl = new WebControl({
  1737. szPluginContainer: 'playWnd', // 指定容器id
  1738. iServicePortStart: 15900, // 指定起止端口号,建议使用该值
  1739. iServicePortEnd: 15909,
  1740. szClassId: '23BF3B0A-2C56-4D97-9C03-0CB103AA8F11', // 用于IE10使用ActiveX的clsid
  1741. cbConnectSuccess: function () { // 创建WebControl实例成功
  1742. that.oWebControl.JS_StartService('window', { // WebControl实例创建成功后需要启动服务
  1743. dllPath: './VideoPluginConnect.dll' // 值"./VideoPluginConnect.dll"写死
  1744. }).then(function () { // 启动插件服务成功
  1745. that.oWebControl.JS_SetWindowControlCallback({ // 设置消息回调
  1746. cbIntegrationCallBack: cbIntegrationCallBack
  1747. })
  1748. that.oWebControl.JS_CreateWnd('playWnd', 1020, 600).then(function () { //JS_CreateWnd创建视频播放窗口,宽高可设定
  1749. that.init(newappkey, newloginIp, newsecret, newloginPort) // 创建播放实例成功后初始化
  1750. })
  1751. }, function () { // 启动插件服务失败
  1752. })
  1753. },
  1754. cbConnectError: function () { // 创建WebControl实例失败
  1755. that.oWebControl = null
  1756. $('#playWnd').html('插件未启动,正在尝试启动,请稍候...')
  1757. WebControl.JS_WakeUp('VideoWebPlugin://') // 程序未启动时执行error函数,采用wakeup来启动程序
  1758. initCount++
  1759. if (initCount < 3) {
  1760. setTimeout(function () {
  1761. that.initPlugin(newappkey, newloginIp, newsecret, newloginPort)
  1762. }, 3000)
  1763. } else {
  1764. $('#playWnd').html('插件启动失败,请检查插件是否安装!<a href="./public/hk/VideoWebPlugin.exe">点击下载插件</a>')
  1765. }
  1766. },
  1767. cbConnectClose: function (bNormalClose) {
  1768. // 异常断开:bNormalClose = false
  1769. // JS_Disconnect正常断开:bNormalClose = true
  1770. console.log('cbConnectClose')
  1771. that.oWebControl = null
  1772. }
  1773. })
  1774. },
  1775. //播放海康摄像头
  1776. playhk(channelCode) {
  1777. var cameraIndexCode = channelCode //获取输入的监控点编号值,必填
  1778. var streamMode = 0 //主子码流标识:0-主码流,1-子码流
  1779. var transMode = 1 //传输协议:0-UDP,1-TCP
  1780. var gpuMode = 0 //是否启用GPU硬解,0-不启用,1-启用
  1781. var wndId = -1 //播放窗口序号(在2x2以上布局下可指定播放窗口)
  1782. cameraIndexCode = cameraIndexCode.replace(/(^\s*)/g, '')
  1783. cameraIndexCode = cameraIndexCode.replace(/(\s*$)/g, '')
  1784. this.oWebControl.JS_RequestInterface({
  1785. funcName: 'startPreview',
  1786. argument: JSON.stringify({
  1787. cameraIndexCode: cameraIndexCode, //监控点编号
  1788. streamMode: streamMode, //主子码流标识
  1789. transMode: transMode, //传输协议
  1790. gpuMode: gpuMode, //是否开启GPU硬解
  1791. wndId: wndId //可指定播放窗口
  1792. })
  1793. })
  1794. },
  1795. //初始化
  1796. init(newappkey, newloginIp, newsecret, newloginPort) {
  1797. let that = this
  1798. that.getPubKey(function () {
  1799. ////////////////////////////////// 请自行修改以下变量值 ////////////////////////////////////
  1800. var appkey = newappkey //综合安防管理平台提供的appkey,必填
  1801. var secret = that.setEncrypt(newsecret) //综合安防管理平台提供的secret,必填
  1802. var ip = newloginIp //综合安防管理平台IP地址,必填
  1803. var playMode = 0 //初始播放模式:0-预览,1-回放
  1804. var port = Number(newloginPort) //综合安防管理平台端口,若启用HTTPS协议,默认443
  1805. var snapDir = 'D:\\SnapDir' //抓图存储路径
  1806. var videoDir = 'D:\\VideoDir' //紧急录像或录像剪辑存储路径
  1807. var layout = '1x1' //playMode指定模式的布局
  1808. var enableHTTPS = 1 //是否启用HTTPS协议与综合安防管理平台交互,这里总是填1
  1809. var encryptedFields = 'secret' //加密字段,默认加密领域为secret
  1810. var showToolbar = 1 //是否显示工具栏,0-不显示,非0-显示
  1811. var showSmart = 1 //是否显示智能信息(如配置移动侦测后画面上的线框),0-不显示,非0-显示
  1812. var buttonIDs = '0,16,256,257,258,259,260,512,513,514,515,516,517,768,769' //自定义工具条按钮
  1813. ////////////////////////////////// 请自行修改以上变量值 ////////////////////////////////////
  1814. that.oWebControl.JS_RequestInterface({
  1815. funcName: 'init',
  1816. argument: JSON.stringify({
  1817. appkey: appkey, //API网关提供的appkey
  1818. secret: secret, //API网关提供的secret
  1819. ip: ip, //API网关IP地址
  1820. playMode: playMode, //播放模式(决定显示预览还是回放界面)
  1821. port: port, //端口
  1822. snapDir: snapDir, //抓图存储路径
  1823. videoDir: videoDir, //紧急录像或录像剪辑存储路径
  1824. layout: layout, //布局
  1825. enableHTTPS: enableHTTPS, //是否启用HTTPS协议
  1826. encryptedFields: encryptedFields, //加密字段
  1827. showToolbar: showToolbar, //是否显示工具栏
  1828. showSmart: showSmart, //是否显示智能信息
  1829. buttonIDs: buttonIDs //自定义工具条按钮
  1830. })
  1831. }).then(function (oData) {
  1832. that.oWebControl.JS_Resize(1020, 600) // 初始化后resize一次,规避firefox下首次显示窗口后插件窗口未与DIV窗口重合问题
  1833. })
  1834. })
  1835. },
  1836. //获取公钥
  1837. getPubKey(callback) {
  1838. let that = this
  1839. that.oWebControl.JS_RequestInterface({
  1840. funcName: 'getRSAPubKey',
  1841. argument: JSON.stringify({
  1842. keyLength: 1024
  1843. })
  1844. }).then(function (oData) {
  1845. console.log(oData)
  1846. if (oData.responseMsg.data) {
  1847. that.pubKey = oData.responseMsg.data
  1848. callback()
  1849. }
  1850. })
  1851. },
  1852. //RSA加密
  1853. setEncrypt(value) {
  1854. var encrypt = new JSEncrypt()
  1855. encrypt.setPublicKey(this.pubKey)
  1856. return encrypt.encrypt(value)
  1857. },
  1858. hikDisconnect() {
  1859. console.log('111')
  1860. let that = this
  1861. if (that.oWebControl != null) {
  1862. that.oWebControl.JS_HideWnd() // 先让窗口隐藏,规避可能的插件窗口滞后于浏览器消失问题
  1863. that.oWebControl.JS_Disconnect().then(function () {
  1864. }, function () {
  1865. }) // 断开与插件服务连接成功 // 断开与插件服务连接失败
  1866. }
  1867. },
  1868. /** ----------------------------------海康摄像头预览结束------------------------------------- */
  1869. /** 提交按钮 */
  1870. submitForm() {
  1871. this.$refs['form'].validate(valid => {
  1872. if (valid) {
  1873. //如果后台报错:比如IP重复,需要将原来的form.list 赋值回去,否则再次点击保存时,form.list值已经改变,上面的for循环会出问题
  1874. let old_form_list = this.form.list
  1875. let list = []
  1876. for (let item in this.form.list) {
  1877. for (let items in this.cameraSystemList) {
  1878. if (this.cameraSystemList[items].value == this.form.list[item]) {
  1879. const yongtu = {}
  1880. yongtu.type = this.cameraSystemList[items].value
  1881. yongtu.typeName = this.cameraSystemList[items].label
  1882. list.push(yongtu)
  1883. }
  1884. }
  1885. }
  1886. let that = this
  1887. that.form.list = list
  1888. if (that.form.id != null) {
  1889. that.form.cameraImages = this.form.cameraImagesList ? typeof this.form.cameraImagesList == 'string' ? this.form.cameraImagesList.split(',') : this.form.cameraImagesList : []
  1890. that.form.cameraImagesList = []
  1891. updateCamera(that.form).then(response => {
  1892. that.$modal.msgSuccess('修改成功')
  1893. that.open = false
  1894. that.getList()
  1895. }).catch((error) => {
  1896. //如果后台报错:比如IP重复,需要将原来的form.list 赋值回去,否则再次点击保存时,form.list值已经改变,上面的双层for循环会出问题
  1897. that.form.list = old_form_list
  1898. })
  1899. } else {
  1900. that.form.cameraImages = this.form.cameraImagesList ? typeof this.form.cameraImagesList == 'string' ? this.form.cameraImagesList.split(',') : this.form.cameraImagesList : []
  1901. that.form.cameraImagesList = []
  1902. addCamera(this.form).then(response => {
  1903. this.$modal.msgSuccess('新增成功')
  1904. this.open = false
  1905. this.getList()
  1906. this.resetForm('form')
  1907. }).catch((error) => {
  1908. //如果后台报错:比如IP重复,需要将原来的form.list 赋值回去,否则再次点击保存时,form.list值已经改变,上面的双层for循环会出问题
  1909. this.form.list = old_form_list
  1910. })
  1911. }
  1912. }
  1913. })
  1914. },
  1915. /** 导出按钮操作 */
  1916. handleExport() {
  1917. this.download('sooka-sponest-center-monitor/camera/export', {
  1918. ...this.queryParams
  1919. }, `camera_${new Date().getTime()}.xlsx`)
  1920. },
  1921. synchronizeCamera() {
  1922. let that = this
  1923. that.loading = true
  1924. that.$modal.msgSuccess('开始同步')
  1925. synchronizeOfflineCamera().then(function (res) {
  1926. if (res.code == 200) {
  1927. that.loading = false
  1928. that.$modal.msgSuccess('设备状态同步成功')
  1929. that.getList()
  1930. } else {
  1931. that.loading = false
  1932. that.$modal.warn('设备状态同步失败')
  1933. }
  1934. })
  1935. }
  1936. }
  1937. }
  1938. // 推送消息
  1939. function cbIntegrationCallBack(oData) {
  1940. console.log(JSON.stringify(oData.responseMsg))
  1941. }
  1942. </script>
  1943. <style rel="stylesheet/scss" lang="scss">
  1944. //视频摄像头预览弹层样式
  1945. .videoCustomWidth {
  1946. width: 1070px !important;
  1947. height: 760px !important;
  1948. }
  1949. //视频摄像头预览弹层样式
  1950. .videoCustomWidthPlayBack {
  1951. width: 1080px !important;
  1952. height: 780px !important;
  1953. }
  1954. </style>