index - 副本 (4).vue 60 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867
  1. <template>
  2. <div class="app-container" style="height: 100vh;">
  3. <!-- v-loading="loading" -->
  4. <!-- element-loading-text="拼命加载中" -->
  5. <!-- element-loading-spinner="el-icon-loading" -->
  6. <!-- element-loading-background="rgba(0, 0, 0, 0.8)" -->
  7. <div class="ntgs" style="padding: 0;">
  8. <el-row :gutter="10" class="mb8">
  9. <div class="iuer" style="margin-bottom:10px;">
  10. </div>
  11. </el-row>
  12. <div>
  13. <el-row :gutter="20">
  14. <!-- postList -->
  15. <el-col :span='4'>
  16. <div style="background-color: #fff;border-radius: 10px;padding: 20px 20px;height: 95vh;">
  17. <p
  18. style="margin: 0;border-left: 6px solid #03BF8A;margin-left: -20px;padding-left: 10px;font-weight: 800;">
  19. 通道管理</p>
  20. <div :class="ishge == index ? 'anche' : ''"
  21. style=" height: 36px;;line-height: 36px;margin-top: 10px;padding: 0 10px;"
  22. v-for="(item,index) in channelNumberList" :key="index">
  23. <div @click="ishg(item,index)"
  24. style="display: flex;align-items: center;justify-content: space-between;">
  25. <div style="font-size: 16px;
  26. color: #333333;"> {{item.channelNum == null?'暂无数据' : item.channelNum}}</div>
  27. <img src="../../../assets/images/icon_htgl_zd.png" alt="" style="width: 10px;height: 12px;">
  28. </div>
  29. </div>
  30. </div>
  31. </el-col>
  32. <!-- v-if="isshoe" -->
  33. <el-col :span='14'
  34. style="padding-left: 30px; background-color: #fff;border-radius: 10px;padding: 20px; height: 95vh;">
  35. <div style="display: flex;align-items: center;justify-content: space-between;margin-bottom: 18px;">
  36. <p
  37. style="margin: 0;border-left: 6px solid #03BF8A;margin-left: -20px;padding-left: 10px;font-weight: 800;">
  38. 坐标点配置
  39. <span style="font-size: 12px; color: red;cursor: pointer;" @click="xiazag">下载插件</span>
  40. </p>
  41. <div>
  42. <!-- <el-button type="danger" plain>删除</el-button> -->
  43. <span style="font-size: 12px; color: red;">(点击保存之前,请先确认参数配置和坐标点配置都完成)</span>
  44. <el-button type="warning" plain @click="submitForm">保存</el-button>
  45. <el-button type="success" plain>关闭</el-button>
  46. </div>
  47. </div>
  48. <div>
  49. <div class="tool-box" style="margin: 0;padding: 0;height: 80px;text-align: left;">
  50. <!-- <div>
  51. <el-button
  52. size="mini"
  53. :type="isDrawing ? 'warning' : 'primary'"
  54. @click="startDraw"
  55. >绘制区域</el-button
  56. >
  57. <el-button
  58. size="mini"
  59. type="danger"
  60. :disabled="isDrawing"
  61. @click="clearAll"
  62. >全部清除</el-button
  63. >
  64. <el-button
  65. size="mini"
  66. type="success"
  67. :disabled="isDrawing"
  68. @click="savePoints"
  69. >保存</el-button
  70. >
  71. </div> -->
  72. <div class=" ">
  73. <div style="display: flex;">
  74. <el-button :type="isDrawing ? 'warning' : 'primary'" @click="startDraw">绘制区域</el-button>
  75. <el-button type="primary" plain @click="clearAll">全部清除</el-button>
  76. <el-button type="primary" :disabled="isDrawing" plain @click="savePoints">保存</el-button>
  77. </div>
  78. <!-- <div style="flex: 1;"></div> -->
  79. <!-- <el-button type="primary" plain @click="clickCapturePic">抓图</el-button> -->
  80. </div>
  81. <div style="margin-top: 5px;">
  82. <p style="text-align: left; margin: 0;font-size: 13px;color: #FF6969;">每次绘制前,点击绘制按钮开始绘制,单击鼠标左键即是当前点绘制完成可绘制下一个点, 双击鼠标左键即本次绘制完成。</p>
  83. </div>
  84. </div>
  85. <div class="canvas-wrap">
  86. <canvas id="imgCanvas" ref="canvaxbox"></canvas>
  87. <!--用来和鼠标进行交互操作的canvas-->
  88. <canvas
  89. id="drawCanvas"
  90. ref="canvas"
  91. :style="{ cursor: isDrawing ? 'crosshair' : 'default' }"
  92. >
  93. </canvas>
  94. <!--存储已生成的点线,避免被清空-->
  95. <canvas id="saveCanvas" ref="canvasSave"></canvas>
  96. </div>
  97. </div>
  98. <!-- <div style="width: 100%; height: 70vh;">
  99. <div v-if="isfse" id="divPlugin" style="width: 100%; height: 69vh;"></div>
  100. </div> -->
  101. <!-- <img src="../../../assets/images/pic_ssyl_lt.png" alt="" style="width: 100%; margin-top: 20px;"> -->
  102. <!-- 344 -->
  103. <!-- <video id="video" controls autoplay muted width="100%" height="480px"style="margin-top: 20px;"></video> -->
  104. <!-- <video
  105. class="videosmall"
  106. ref="videosmallone"
  107. preload="auto"
  108. muted
  109. autoplay
  110. width="95%"
  111. type="rtmp/flv"
  112. >
  113. <source src="" />
  114. </video> -->
  115. </el-col>
  116. <el-col :span="6">
  117. <div style="background-color: #fff;border-radius: 10px;padding: 20px 20px;height: 95vh;">
  118. <p
  119. style="margin: 0;border-left: 6px solid #03BF8A;margin-left: -20px;padding-left: 10px;font-weight: 800;">
  120. 参数配置</p>
  121. <div>
  122. <el-form ref="form" :model="form" :rules="rules" label-width="60px">
  123. <p style="margin: 0; margin-top: 10px; color:#03BF8A ; margin-bottom: 10px;">时间配置(分钟 <span
  124. style="font-size: 12px;color: #FEA71B;">只能输入正数</span>)</p>
  125. <el-form-item label="离岗" prop="leaveTime">
  126. <el-input :min="0" type="number" v-model="form.leaveTime" placeholder="请输入离岗时间设置 默认:10 分钟" />
  127. </el-form-item>
  128. <el-form-item label="玩手机" prop="playTime">
  129. <el-input :min="0" type="number" v-model="form.playTime" placeholder="请输入玩手机时间设置 默认:10 分钟" />
  130. </el-form-item>
  131. <p style="margin: 0; margin-top: 10px; color:#03BF8A ; margin-bottom: 10px;">相似度配置<span
  132. style="font-size: 12px;color: #FEA71B;">(只能输入正数)</span></p>
  133. <el-form-item label="离岗" prop="leaveRate">
  134. <el-input :min="0" :max="1" type="number" v-model="form.leaveRate"
  135. placeholder="请输入离岗时间相似度设置 默认:0.5" />
  136. </el-form-item>
  137. <el-form-item label="玩手机" prop="playRate">
  138. <el-input :min="0" :max="1" type="number" v-model="form.playRate"
  139. placeholder="请输入玩手机相似度设置 默认:0.5" />
  140. </el-form-item>
  141. </el-form>
  142. </div>
  143. <p
  144. style="margin: 0;border-left: 6px solid #03BF8A;margin-left: -20px;padding-left: 10px;font-weight: 800;">
  145. 绘制区域</p>
  146. <div class="drawings-list">
  147. <div class="tflex" v-for="(shape, index) in shapes" :key="index">
  148. <!-- :class="{ selected: selectedIndex === index }" -->
  149. <div class="txt">
  150. <el-popover placement="top-start" width="200" trigger="hover">
  151. <div v-for="(ite,idx) in shape.points">
  152. {{ite.x}},{{ite.y}}
  153. </div>
  154. <div slot="reference" class="snhseinu">
  155. <el-input v-model="shape.name" placeholder="请输入内容"></el-input>
  156. </div>
  157. </el-popover>
  158. </div>
  159. <img class="delimg" src="../../../assets/images/del.png"
  160. @click.stop="clickDelSnapPolygon(shape.id,index)" />
  161. </div>
  162. </div>
  163. </div>
  164. </el-col>
  165. <!-- <el-col :span="24">
  166. <div class="ihgswq wrapper" ref="wrapper" style=" overflow: hidden;">
  167. <div class="fijge content nhgwesvq" ref="content" style="width:1610px;">
  168. <div class='shotw ' v-for="(item,index) in postList" :key="index" @click="isfgw(item)" >
  169. <img src="../../../assets/images/fengm.png" alt="">
  170. <img src="../../../assets/images/icon_spjk_play.png" alt="" class="iges">
  171. <p style="font-size: 14px;">{{item.name}}</p>
  172. </div>
  173. </div>
  174. </div>
  175. </el-col> -->
  176. </el-row>
  177. <!-- <pagination
  178. v-show="total>0"
  179. :total="total"
  180. :page.sync="queryParams.pageNo"
  181. :limit.sync="queryParams.pageSize"
  182. @pagination="getList"
  183. /> -->
  184. </div>
  185. </div>
  186. <!-- 添加或修改岗位对话框 -->
  187. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  188. </el-dialog>
  189. <el-dialog :title="titles" :visible.sync="opens" width="1000px" append-to-body>
  190. </el-dialog>
  191. <el-dialog title="页面二维码" :visible.sync="opent" width="200px" style="padding: 0;" class="nhgrls" append-to-body>
  192. <div v-show="opent" style="display: flex;justify-content: center;align-items: center;">
  193. <!-- <span>{{'https://qszdh.qs163.cn/pages/index/index?id=' + this.bg}}</span> -->
  194. <!-- <vue-qr :text="'https://qszdh.qs163.cn/pages/index/index?id=' + this.bg" :size="200"></vue-qr> -->
  195. </div>
  196. </el-dialog>
  197. </div>
  198. </template>
  199. <script>
  200. import {
  201. listChannelNumber,
  202. listChannelNumbernopa,
  203. getChannelNumber,
  204. delChannelNumber,
  205. addChannelNumber,
  206. updateChannelNumber
  207. } from "@/api/system/channelNumber"
  208. import {
  209. listWarnManage,
  210. getWarnManage,
  211. delWarnManage,
  212. addWarnManage,
  213. updateWarnManage
  214. } from "@/api/manage/warnManage"
  215. import {
  216. listParameterSet,
  217. getParameterSet,
  218. delParameterSet,
  219. addParameterSet,
  220. updateParameterSet
  221. } from "@/api/manage/parameterSet"
  222. // import { listReservat,camera,cameraIndexCode, listReservatd, getReservat, delReservat, addReservat, updateReservat,setPass,delReservathx,openDz,closeDz } from "@/api/tonggi/houtai";
  223. // import vueQr from "vue-qr";
  224. // import videojs from 'video.js'
  225. // import 'video.js/dist/video-js.css'
  226. // import {videoPlayer} from 'vue-video-player'
  227. // import 'videojs-flash'
  228. // import flvjs from 'flv.js/dist/flv.min.js'
  229. // import flvjs from "flv.js";
  230. import mqtt from 'mqtt';
  231. import {
  232. MqttClient
  233. } from 'mqtt'
  234. // 状态变量
  235. // const client = mqtt.connect('ws://13.229.167.76:1884/mqtt')
  236. var client = MqttClient || null
  237. import Bscroll from "better-scroll";
  238. export default {
  239. name: "Post",
  240. dicts: ['sys_normal_disable', 'sys_yes_no', 'youke', 'tjzh', 'youkes', 'lafafen', 'fange', 'jluly'],
  241. // components: {
  242. // vueQr,
  243. // videoPlayer
  244. // },
  245. data() {
  246. return {
  247. // 遮罩层
  248. loading: true,
  249. opent: false,
  250. bg: null,
  251. titles: '',
  252. editableTabsValue: '6',
  253. opens: false,
  254. // 通道管理表格数据
  255. channelNumberList: [],
  256. imageUrl: '@/assets/logo/logo.png',
  257. printObj: {
  258. id: "nhgrew", // 这里是要打印元素的ID
  259. popTitle: "", // 打印的标题
  260. },
  261. pickerOptions: {
  262. disabledDate(time) {
  263. //disabledDate 文档上:设置禁用状态,参数为当前日期,要求返回 Boolean
  264. // return time.getTime() > Date.now()//选当前时间之前的时间
  265. return time.getTime() < Date.now() - 8.64e7; //选当前时间之后的时间
  266. }
  267. },
  268. // 选中数组
  269. ids: [],
  270. // 非单个禁用
  271. single: true,
  272. checkedScoreDataDetails: [],
  273. scoreDataDetailsList: [],
  274. tabPosition: 'left',
  275. // 非多个禁用
  276. multiple: true,
  277. // 显示搜索条件
  278. showSearch: true,
  279. // 总条数
  280. total: 0,
  281. // 岗位表格数据
  282. postList: [],
  283. // 弹出层标题
  284. title: "",
  285. // 是否显示弹出层
  286. open: false,
  287. // 查询参数
  288. queryParams: {
  289. pageNo: 1,
  290. pageSize: 500,
  291. name: null,
  292. postCode: undefined,
  293. postName: undefined,
  294. status: undefined,
  295. reservatType: undefined
  296. },
  297. // 表单参数
  298. form: {},
  299. // 表单校验
  300. rules: {
  301. receptionId: [{
  302. required: true,
  303. message: "不能为空",
  304. trigger: "blur"
  305. }],
  306. },
  307. ruless: {
  308. visitName: [{
  309. required: true,
  310. message: "不能为空",
  311. trigger: "blur"
  312. }],
  313. visitPhone: [{
  314. required: true,
  315. message: "不能为空",
  316. trigger: "blur"
  317. }],
  318. visitNum: [{
  319. required: true,
  320. message: "不能为空",
  321. trigger: "blur"
  322. }],
  323. visitDate: [{
  324. required: true,
  325. message: "不能为空",
  326. trigger: "blur"
  327. }],
  328. visitTime: [{
  329. required: true,
  330. message: "不能为空",
  331. trigger: "blur"
  332. }],
  333. },
  334. forms: {
  335. parameterId: null,
  336. channelId: null,
  337. equipmentId: null,
  338. equipmentNum: null,
  339. equipmentName: null,
  340. channelNum: null,
  341. channelRange: null,
  342. leaveTime: 10,
  343. playTime: 10,
  344. leaveRate: 0.5,
  345. playRate: 0.5,
  346. delFlag: null,
  347. createBy: null,
  348. createTime: null,
  349. updateBy: null,
  350. updateTime: null,
  351. remark: null
  352. },
  353. tableMaxHeight: '200',
  354. kje: 0,
  355. ksjegsg: [],
  356. Scroll: null,
  357. videoShow: false,
  358. flvPlayer: null,
  359. player: null,
  360. name: null,
  361. isshiwa: false,
  362. isjfwe: {},
  363. isshoe: false,
  364. webRtcServer: null,
  365. camera_ip: '127.0.0.1:8000',
  366. g_iWndIndex: 0,
  367. iRtspPort: '', //预览中的ip
  368. szDeviceIdentify: '', //ip_port,
  369. isfse: false,
  370. g_bEnableDraw: false,
  371. // 所有绘制的图形
  372. shapes: [],
  373. // 禁用
  374. isdisflag: false,
  375. connectionStatus: '',
  376. isConnected: false,
  377. connecting: false,
  378. messages: [{
  379. type: 'sent',
  380. content: '',
  381. timestamp: ''
  382. }],
  383. messageToSend: [],
  384. mqttConfig: {
  385. url: 'ws://13.229.167.76:1884/mqtt',
  386. topic: 'detection/rect'
  387. },
  388. mqttThemeName: {
  389. url: 'ws://13.229.167.76:1884/mqtt',
  390. topic: 'detection/rect'
  391. },
  392. ishge: 0,
  393. ips: '',
  394. isdesl: false,
  395. imgUrl: "../../../assets/images/pic_ssyl_lt.png",
  396. isDrawing: false, // 是否正在绘制
  397. ratio: 1,
  398. imgWidth: 3020,
  399. imgHeight: 1080,
  400. wrapWidth: 600,
  401. wrapHeight: 300,
  402. canvasWidth: 600,
  403. canvasHeight: 300,
  404. drawingPoints: [],
  405. drawedPoints: [],
  406. imgCanvas: null,
  407. imgCtx: null,
  408. drawCanvas: null,
  409. drawCtx: null,
  410. saveCanvas: null,
  411. saveCtx: null,
  412. submitData: [
  413. ],
  414. connectionStatus:'',
  415. isConnected:false,
  416. connecting:false,
  417. messages:[{ type: 'sent' , content: '', timestamp: '' }],
  418. messageToSend:[],
  419. };
  420. },
  421. created() {
  422. this.isfse = false
  423. // this.getList();
  424. this.getListtd()
  425. window.onresize = () => {
  426. this.changeTableMaxHeight()
  427. }
  428. this.changeTableMaxHeight()
  429. },
  430. mounted() {
  431. // this.toggleConnection()
  432. // this.webRtcServer = new WebRtcStreamer('video', location.protocol + '//' + this.camera_ip)
  433. // //需要查看的rtsp地址,根据自己的摄像头传入对应的rtsp地址即可。注意:视频编码格式必须是H264的,否则无法正常显示,编码格式可在摄像头的后台更改
  434. // this.webRtcServer.connect('rtsp://admin:zxy123456@192.168.101.64:554/h264/ch1/main/av_stream')
  435. window.onresize = () => {
  436. this.changeTableMaxHeight()
  437. this.initCanvas();
  438. this.getImage();
  439. }
  440. this.changeTableMaxHeight()
  441. this.$nextTick(() => {
  442. this.initScroll()
  443. this.initCanvas();
  444. this.getImage();
  445. })
  446. },
  447. beforeDestroy() {
  448. // this.destoryVideo()
  449. if (WebVideoCtrl) {
  450. console.log(this.szDeviceIdentify)
  451. WebVideoCtrl.I_Logout(this.szDeviceIdentify)
  452. WebVideoCtrl.I_StopAllPlay()
  453. WebVideoCtrl.I_DestroyPlugin()
  454. WebVideoCtrl.I_Resize()
  455. }
  456. },
  457. methods: {
  458. /** 查询通道管理列表 */
  459. getListtd() {
  460. this.loading = true
  461. let queryParams = {}
  462. listChannelNumbernopa().then(response => {
  463. this.channelNumberList = response.rows
  464. if (this.channelNumberList.length != 0) {
  465. getChannelNumber(this.channelNumberList[0].channelId).then(response => {
  466. if (response.data.isChannel != 'N') {
  467. this.shapes = JSON.parse(response.data.parameterSet.channelRange)
  468. let sngseju = []
  469. this.shapes.filter(rou=>{
  470. let sngsejutoe = []
  471. for(var i=0; i< rou.points.length;i++ ){
  472. let sngsejq = []
  473. sngsejq.push(rou.points[i].x,rou.points[i].y)
  474. sngsejutoe.push(sngsejq)
  475. }
  476. console.log(sngsejutoe)
  477. sngseju.push(sngsejutoe)
  478. })
  479. this.drawedPoints = sngseju
  480. let objectPoints = [];
  481. // "object": [{"polygon": {"x1":700,"y1":273,"x2":975,"y2":278,"x3":1107,"y3":368,"x4":718,"y4":354} }]
  482. objectPoints = this.drawedPoints.map((area) => {
  483. console.log(area)
  484. let polygon = {};
  485. area.forEach((point, i) => {
  486. console.log(point)
  487. polygon[`x${i + 1}`] = point[0];
  488. polygon[`y${i + 1}`] = point[1];
  489. });
  490. // console.log(polygon)
  491. return {
  492. polygon: polygon,
  493. };
  494. });
  495. this.submitData = objectPoints;
  496. console.log("最终提交数据", objectPoints);
  497. this.messageToSend = this.submitData
  498. console.log(this.drawedPoints,this.submitData)
  499. this.form = response.data.parameterSet
  500. let result = (this.form.leaveTime / 60).toFixed(1);
  501. let resultl = (this.form.playTime / 60).toFixed(1);
  502. this.form.channelId = response.data.channelId
  503. this.form.isChannel = response.data.isChannel
  504. this.form.equipmentNum = response.data.equipmentNum
  505. this.form.equipmentId = response.data.equipmentId
  506. this.form.equipmentName = response.data.equipmentName
  507. this.form.channelNum = response.data.channelNum
  508. let snghs = response.data.videoAddress.split('@')
  509. let snghst = snghs[1].split(':')
  510. let snsgduan = snghst[1].split('/')
  511. // console.log(snghs,snghst[0],snsgduan,8)
  512. this.ips = response.data.equipmentIp
  513. let sgse = {
  514. 'ip': response.data.equipmentIp,
  515. 'account': response.data.account,
  516. 'password': response.data.password,
  517. 'port': response.data.port
  518. }
  519. this.form.leaveTime = result
  520. this.form.playTime = resultl
  521. // WebVideoCtrl.I_Logout(this.szDeviceIdentify)
  522. // // WebVideoCtrl.I_StopAllPlay()
  523. // // WebVideoCtrl.I_DestroyPlugin()
  524. // // WebVideoCtrl.I_Resize()
  525. // this.getVideo(sgse)
  526. // this.clickAddSnapPolygon()
  527. // var that = this
  528. // setTimeout(function() {
  529. // that.clickEnableDraw() //娃娃消失
  530. // }, 4000);
  531. // WebVideoCtrl.I_ShowPlugin()
  532. // this.clickEnableDraw()
  533. this.renderDatas()
  534. console.log(result)
  535. } else {
  536. this.form = {
  537. parameterId: null,
  538. channelId: response.data.channelId,
  539. equipmentId: response.data.equipmentId,
  540. equipmentNum: response.data.equipmentNum,
  541. equipmentName: response.data.equipmentName,
  542. channelNum: response.data.channelNum,
  543. channelRange: null,
  544. isChannel: response.data.isChannel,
  545. leaveTime: 10,
  546. playTime: 10,
  547. leaveRate: 0.5,
  548. playRate: 0.5,
  549. delFlag: null,
  550. createBy: null,
  551. createTime: null,
  552. updateBy: null,
  553. updateTime: null,
  554. remark: null
  555. }
  556. this.ips = response.data.equipmentIp
  557. // let result = (this.form.leaveTime / 60).toFixed(1);
  558. // let resultl = (this.form.playTime / 60).toFixed(1);
  559. // this.form.leaveTime = result
  560. // this.form.playTime = resultl
  561. // WebVideoCtrl.I_Logout(this.szDeviceIdentify)
  562. let sgse = {
  563. 'ip': response.data.equipmentIp,
  564. 'account': response.data.account,
  565. 'password': response.data.password,
  566. 'port': response.data.port
  567. }
  568. // this.getVideo(sgse)
  569. // this.clickAddSnapPolygon()
  570. // var that = this
  571. // setTimeout(function() {
  572. // that.clickEnableDraw() //娃娃消失
  573. // }, 4000);
  574. // WebVideoCtrl.I_ShowPlugin()
  575. }
  576. })
  577. }
  578. this.loading = false
  579. // getWarnManage(this.$route.query.id).then(response => {
  580. // this.form = response.data
  581. this.loading = false
  582. })
  583. },
  584. // 回显
  585. nshgehuixw(){
  586. let sngseju = []
  587. this.shapes.filter(rou=>{
  588. let sngsejutoe = []
  589. for(var i=0; i< rou.points.length;i++ ){
  590. let sngsejq = []
  591. sngsejq.push(rou.points[i].x,rou.points[i].y)
  592. sngsejutoe.push(sngsejq)
  593. }
  594. console.log(sngsejutoe)
  595. sngseju.push(sngsejutoe)
  596. })
  597. this.drawedPoints = sngseju
  598. let objectPoints = [];
  599. // "object": [{"polygon": {"x1":700,"y1":273,"x2":975,"y2":278,"x3":1107,"y3":368,"x4":718,"y4":354} }]
  600. objectPoints = this.drawedPoints.map((area) => {
  601. console.log(area)
  602. let polygon = {};
  603. area.forEach((point, i) => {
  604. console.log(point)
  605. polygon[`x${i + 1}`] = Math.round(point[0] * this.ratio);
  606. polygon[`y${i + 1}`] = Math.round(point[1] * this.ratio);
  607. });
  608. // console.log(polygon)
  609. return {
  610. polygon: polygon,
  611. };
  612. });
  613. this.submitData = objectPoints;
  614. console.log("最终提交数据", objectPoints);
  615. this.messageToSend = this.submitData
  616. console.log(this.drawedPoints,this.submitData)
  617. this.renderDatas()
  618. },
  619. // 画图
  620. initCanvas() {
  621. // 初始化canvas画布
  622. let canvasWrap = document.getElementsByClassName("canvas-wrap");
  623. this.wrapWidth = canvasWrap[0].clientWidth;
  624. this.wrapHeight = canvasWrap[0].clientHeight;
  625. this.imgCanvas = document.getElementById("imgCanvas");
  626. this.imgCtx = this.imgCanvas.getContext("2d");
  627. // 绘制canvas
  628. this.drawCanvas = document.getElementById("drawCanvas");
  629. this.drawCtx = this.drawCanvas.getContext("2d");
  630. // 保存绘制区域 saveCanvas
  631. this.saveCanvas = document.getElementById("saveCanvas");
  632. this.saveCtx = this.saveCanvas.getContext("2d");
  633. // this.initImgCanvas()
  634. },
  635. initImgCanvas() {
  636. // 计算宽高比
  637. let ww = this.wrapWidth; // 画布宽度
  638. let wh = this.wrapHeight; // 画布高度
  639. let iw = this.imgWidth; // 图片宽度
  640. let ih = this.imgHeight; // 图片高度
  641. if (iw / ih < ww / wh) {
  642. // 以高为主
  643. this.ratio = ih / wh;
  644. this.canvasHeight = wh;
  645. this.canvasWidth = (wh * iw) / ih;
  646. } else {
  647. // 以宽为主
  648. this.ratio = iw / ww;
  649. this.canvasWidth = ww;
  650. this.canvasHeight = (ww * ih) / iw;
  651. }
  652. // 初始化画布大小
  653. this.imgCanvas.width = this.canvasWidth;
  654. this.imgCanvas.height = this.canvasHeight;
  655. this.drawCanvas.width = this.canvasWidth;
  656. this.drawCanvas.height = this.canvasHeight;
  657. this.saveCanvas.width = this.canvasWidth;
  658. this.saveCanvas.height = this.canvasHeight;
  659. // 图片加载绘制
  660. let img = document.createElement("img");
  661. img.src = this.imgUrl;
  662. console.log(this.imgUrl)
  663. img.onload = () => {
  664. console.log("图片已加载");
  665. this.imgCtx.drawImage(img, 0, 0, this.canvasWidth, this.canvasHeight);
  666. this.renderDatas(); // 渲染原有数据
  667. };
  668. },
  669. startDraw() {
  670. // 绘制区域
  671. if (this.isDrawing) return;
  672. this.isDrawing = true;
  673. // 绘制逻辑
  674. this.drawCanvas.addEventListener("click", this.drawImageClickFn);
  675. this.drawCanvas.addEventListener("dblclick", this.drawImageDblClickFn);
  676. this.drawCanvas.addEventListener("mousemove", this.drawImageMoveFn);
  677. },
  678. clearAll() {
  679. // 清空所有绘制区域
  680. this.saveCtx.clearRect(0, 0, this.canvasWidth, this.canvasHeight);
  681. this.drawedPoints = [];
  682. this.shapes = []
  683. },
  684. getImage() {
  685. // 这里请求接口 ...
  686. this.imgUrl = "http://192.168.101.97:5000/video_feed";
  687. // this.imgWidth = 1920;
  688. // this.imgHeight = 1080;
  689. // this.imgUrl =JSON.parse(this.$route.query.src)
  690. this.imgWidth = 660;
  691. this.imgHeight = 380;
  692. this.imgUrl && this.initImgCanvas();
  693. },
  694. drawImageClickFn(e) {
  695. let drawCtx = this.drawCtx;
  696. if (e.offsetX || e.layerX) {
  697. let pointX = e.offsetX == undefined ? e.layerX : e.offsetX;
  698. let pointY = e.offsetY == undefined ? e.layerY : e.offsetY;
  699. let lastPoint = this.drawingPoints[this.drawingPoints.length - 1] || [];
  700. if (lastPoint[0] !== pointX || lastPoint[1] !== pointY) {
  701. this.drawingPoints.push([pointX, pointY]);
  702. }
  703. }
  704. },
  705. drawImageMoveFn(e) {
  706. let drawCtx = this.drawCtx;
  707. if (e.offsetX || e.layerX) {
  708. let pointX = e.offsetX == undefined ? e.layerX : e.offsetX;
  709. let pointY = e.offsetY == undefined ? e.layerY : e.offsetY;
  710. // 绘制
  711. drawCtx.clearRect(0, 0, this.canvasWidth, this.canvasHeight);
  712. // 绘制点
  713. drawCtx.fillStyle = "blue";
  714. this.drawingPoints.forEach((item, i) => {
  715. drawCtx.beginPath();
  716. drawCtx.arc(...item, 6, 0, 180);
  717. drawCtx.fill(); //填充
  718. // console.log(item)
  719. });
  720. // 绘制动态区域
  721. drawCtx.save();
  722. drawCtx.beginPath();
  723. this.drawingPoints.forEach((item, i) => {
  724. drawCtx.lineTo(...item);
  725. });
  726. drawCtx.lineTo(pointX, pointY);
  727. drawCtx.lineWidth = "3";
  728. drawCtx.strokeStyle = "blue";
  729. drawCtx.fillStyle = "rgba(255, 0, 0, 0.3)";
  730. drawCtx.stroke();
  731. drawCtx.fill(); //填充
  732. drawCtx.restore();
  733. }
  734. },
  735. drawImageDblClickFn(e) {
  736. let drawCtx = this.drawCtx;
  737. let saveCtx = this.saveCtx;
  738. if (e.offsetX || e.layerX) {
  739. let pointX = e.offsetX == undefined ? e.layerX : e.offsetX;
  740. let pointY = e.offsetY == undefined ? e.layerY : e.offsetY;
  741. let lastPoint = this.drawingPoints[this.drawingPoints.length - 1] || [];
  742. if (lastPoint[0] !== pointX || lastPoint[1] !== pointY) {
  743. this.drawingPoints.push([pointX, pointY]);
  744. }
  745. }
  746. // 清空绘制图层
  747. drawCtx.clearRect(0, 0, this.canvasWidth, this.canvasHeight);
  748. // 绘制区域至保存图层
  749. this.drawSaveArea(this.drawingPoints);
  750. this.drawedPoints.push(this.drawingPoints);
  751. this.drawingPoints = [];
  752. this.isDrawing = false;
  753. // 绘制结束逻辑
  754. this.drawCanvas.removeEventListener("click", this.drawImageClickFn);
  755. this.drawCanvas.removeEventListener("dblclick", this.drawImageDblClickFn);
  756. this.drawCanvas.removeEventListener("mousemove", this.drawImageMoveFn);
  757. },
  758. drawSaveArea(points) {
  759. // console.log(points, "points");
  760. if (points.length === 0) return;
  761. this.saveCtx.save();
  762. this.saveCtx.beginPath();
  763. points.forEach((item, i) => {
  764. this.saveCtx.lineTo(...item);
  765. });
  766. this.saveCtx.closePath();
  767. this.saveCtx.lineWidth = "2";
  768. this.saveCtx.fillStyle = "rgba(255,0, 255, 0.3)";
  769. this.saveCtx.strokeStyle = "red";
  770. this.saveCtx.stroke();
  771. this.saveCtx.fill(); //填充
  772. this.saveCtx.restore();
  773. },
  774. savePoints() {
  775. // 将画布坐标数据转换成提交数据
  776. let objectPoints = [];
  777. // "object": [{"polygon": {"x1":700,"y1":273,"x2":975,"y2":278,"x3":1107,"y3":368,"x4":718,"y4":354} }]
  778. console.log(this.drawedPoints)
  779. objectPoints = this.drawedPoints.map((area,t) => {
  780. console.log(t)
  781. let polygon = [];
  782. area.forEach((point, i) => {
  783. let nsdfs = {x:null,y:null}
  784. console.log(point,93)
  785. nsdfs.x = Math.round(point[0] * this.ratio)
  786. nsdfs.y = Math.round(point[1] * this.ratio)
  787. // polygon[`x${i + 1}`] = Math.round(point[0] * this.ratio);
  788. // polygon[`y${i + 1}`] = Math.round(point[1] * this.ratio);
  789. polygon.push(nsdfs)
  790. });
  791. console.log(polygon)
  792. return {
  793. points: polygon,
  794. id:t+1,
  795. name:'绘制区域' + (t+1),
  796. ip:this.ips
  797. };
  798. });
  799. this.submitData = objectPoints;
  800. this.shapes = objectPoints
  801. console.log("最终提交数据", objectPoints);
  802. this.messageToSend = this.submitData
  803. // this.sendMessage()
  804. // this.$router.go(-1)
  805. },
  806. renderDatas() {
  807. // 将提交数据数据转换成画布坐标
  808. this.drawedPoints = this.submitData.map((item) => {
  809. console.log(item.polygon,item,19)
  810. let polygon = item.polygon;
  811. let points = [];
  812. for (let i = 1; i < Object.keys(polygon).length / 2 + 1; i++) {
  813. if (!isNaN(polygon[`x${i}`]) && !isNaN(polygon[`y${i}`])) {
  814. points.push([
  815. polygon[`x${i}`] / this.ratio,
  816. polygon[`y${i}`] / this.ratio,
  817. ]);
  818. }
  819. }
  820. console.log(points)
  821. this.drawSaveArea(points);
  822. return points;
  823. });
  824. },
  825. //删除图形
  826. clickDelSnapPolygon(szId, idx) {
  827. console.log(3)
  828. this.shapes.splice(idx, 1)
  829. // this.shapes.splice(idx,1)
  830. let shzou = []
  831. // "object": [{"polygon": {"x1":700,"y1":273,"x2":975,"y2":278,"x3":1107,"y3":368,"x4":718,"y4":354} }]
  832. for(var i = 0 ; i <this.shapes.length; i++){
  833. this.shapes[i].id= i+ 1
  834. }
  835. this.saveCtx.clearRect(0, 0, this.canvasWidth, this.canvasHeight);
  836. this.nshgehuixw()
  837. // this.submitData = this.shapes
  838. // this.drawedPoints = this.shapes
  839. // this.renderDatas()
  840. console.log(this.shapes,shzou)
  841. },
  842. clickEnableDraw() {
  843. WebVideoCtrl.I_SetDrawStatus(true).then(() => {
  844. this.g_bEnableDraw = true;
  845. // showOPInfo("启用绘制成功!");
  846. }, (oError) => {
  847. // showOPInfo("启用绘制失败!", oError.errorCode, oError.errorMsg);
  848. });
  849. },
  850. getdrawFn() {
  851. this.isdisflag = !this.isdisflag;
  852. if (this.isdisflag) {
  853. this.clickDisableDraw()
  854. } else {
  855. this.clickEnableDraw()
  856. }
  857. },
  858. // 禁用多边形绘制
  859. clickDisableDraw() {
  860. WebVideoCtrl.I_SetDrawStatus(false).then(() => {
  861. this.g_bEnableDraw = false;
  862. // showOPInfo("禁用绘制成功!");
  863. this.clickAddSnapPolygon()
  864. }, (oError) => {
  865. // showOPInfo("禁用绘制失败!", oError.errorCode, oError.errorMsg);
  866. });
  867. },
  868. clickGetSnapPolygon() {
  869. var that = this;
  870. WebVideoCtrl.I_GetSnapPolygonInfo(this.g_iWndIndex).then((szXml) => {
  871. console.log('获取图形:', szXml);
  872. that.getpoint(szXml)
  873. });
  874. },
  875. //获取x,y轴
  876. getpoint(xmlString) {
  877. var that = this;
  878. const parser = new DOMParser();
  879. const xmlDoc = parser.parseFromString(xmlString, "text/xml");
  880. // 获取所有 SnapPolygon 节点
  881. const polygonNodes = xmlDoc.querySelectorAll("SnapPolygon");
  882. var newArr = [];
  883. var arr1 = JSON.parse(JSON.stringify(this.shapes))
  884. // 提取每个多边形的 id 和坐标点
  885. this.polygons = Array.from(polygonNodes).map((polygonNode) => {
  886. const id = polygonNode.querySelector("id").textContent;
  887. const pointNodes = polygonNode.querySelectorAll("point");
  888. const points = Array.from(pointNodes).map((pointNode) => ({
  889. x: pointNode.querySelector("x").textContent,
  890. y: pointNode.querySelector("y").textContent,
  891. }));
  892. var newobj = {
  893. id: id,
  894. points: points,
  895. name: '区域' + id,
  896. ip: this.ips
  897. }
  898. newArr.push(newobj)
  899. // return { id, points };
  900. });
  901. this.shapes = arr1.map(item1 => {
  902. const matchedItem = newArr.find(item2 => item2.id == item1.id);
  903. return {
  904. id: item1.id,
  905. name: '区域' + item1.id,
  906. ip: this.ips,
  907. points: matchedItem ? matchedItem.points : item1.points,
  908. };
  909. });
  910. console.log(this.shapes, 78)
  911. // this.shapes=JSON.parse(JSON.stringify(newArr))
  912. this.messageToSend = this.shapes
  913. this.sendMessage()
  914. console.log(this.shapes)
  915. },
  916. toggleConnection() {
  917. if (this.isConnected) {
  918. // 断开连接
  919. client.end()
  920. this.isConnected = false
  921. this.connectionStatus = 'Disconnected'
  922. return
  923. }
  924. // 建立连接
  925. this.connecting = true
  926. try {
  927. client = mqtt.connect(this.mqttConfig.url, {
  928. clientId: 'mqttjs_' + Math.random().toString(16).substr(2, 8),
  929. keepalive: 60,
  930. clean: true,
  931. connectTimeout: 4000,
  932. reconnectPeriod: 1000
  933. })
  934. client.on('connect', () => {
  935. this.isConnected = true
  936. this.connectionStatus = 'Connected'
  937. this.connecting = false
  938. console.log(3)
  939. // 订阅主题
  940. client.subscribe(this.mqttConfig.topic, (err) => {
  941. if (err) {
  942. console.error('Subscribe error:', err)
  943. } else {
  944. console.log('成功订阅 detection/rect 主题!')
  945. }
  946. })
  947. })
  948. client.on('message', (topic, message) => {
  949. // 接受信息
  950. console.log(topic, message)
  951. this.messages.unshift({
  952. type: 'received',
  953. content: message.toString(),
  954. timestamp: new Date().toLocaleTimeString()
  955. })
  956. })
  957. client.on('error', (err) => {
  958. console.error('MQTT Error:', err)
  959. this.connectionStatus = 'Error'
  960. this.connecting = false
  961. })
  962. } catch (error) {
  963. console.error('Connection error:', error)
  964. this.connectionStatus = 'Error'
  965. this.connecting = false
  966. }
  967. },
  968. sendMessage() {
  969. if (!client || !this.messageToSend) return
  970. this.messageToSend = JSON.stringify(this.messageToSend)
  971. console.log(this.messageToSend)
  972. client.publish(this.mqttConfig.topic, this.messageToSend)
  973. this.messages.unshift({
  974. type: 'sent',
  975. content: this.messageToSend,
  976. timestamp: new Date().toLocaleTimeString()
  977. })
  978. this.messageToSend = []
  979. },
  980. // 添加图形,最多不超过16个图形
  981. clickAddSnapPolygon() {
  982. var that = this;
  983. if (!this.g_bEnableDraw) {
  984. return;
  985. }
  986. var shapes = JSON.parse(JSON.stringify(this.shapes))
  987. let szId = 1; // 默认从 1 开始
  988. if (shapes && shapes.length > 0) {
  989. const ids = shapes.map(item => item.id).sort((a, b) => a - b);
  990. for (const id of ids) {
  991. if (id > szId) {
  992. // 如果当前 id > szId,说明 szId 未被使用
  993. break;
  994. }
  995. szId = Number(id) + 1; // 否则,继续检查下一个
  996. }
  997. }
  998. if (!/^[1-9]\d*$/.test(szId)) {
  999. alert("图形ID只能为正整数!");
  1000. return
  1001. }
  1002. if (Number(szId) > 32) {
  1003. alert("图形ID范围1-32!");
  1004. return
  1005. }
  1006. console.log(szId)
  1007. // var szName = encodeString($("#snapName").val());
  1008. var szName = '';
  1009. var szInfo = {
  1010. }
  1011. var szInfo = "<?xml version='1.0' encoding='utf-8'?>";
  1012. szInfo += "<SnapPolygonList>";
  1013. szInfo += "<SnapPolygon>";
  1014. szInfo += "<id>" + szId + "</id>"; // [1, 32]
  1015. szInfo += "<polygonType>0</polygonType>"; //如果想绘制多边形,polygonType指需要改为1
  1016. szInfo += "<PointNumMax>17</PointNumMax>"; // [MinClosed, 17]
  1017. szInfo += "<MinClosed>4</MinClosed>"; // [4, 17]
  1018. szInfo += "<tips>#" + szId + "#" + szName + "</tips>";
  1019. szInfo += "<isClosed>false</isClosed>";
  1020. szInfo += "<color><r>0</r><g>255</g><b>0</b></color>";
  1021. szInfo += "<pointList/>";
  1022. szInfo += "</SnapPolygon>";
  1023. szInfo += "</SnapPolygonList>";
  1024. WebVideoCtrl.I_SetSnapPolygonInfo(this.g_iWndIndex, szInfo).then(() => {
  1025. // showOPInfo("添加图形成功!");
  1026. var obj = {
  1027. id: szId,
  1028. points: [],
  1029. 'name': '区域' + szId,
  1030. 'ip': this.ips
  1031. }
  1032. if (this.shapes && this.shapes.length) {
  1033. this.shapes.splice(Number(szId) - 1, 0, obj)
  1034. } else {
  1035. this.shapes.push(obj)
  1036. }
  1037. console.log(this.shapes)
  1038. });
  1039. WebVideoCtrl.I_SetSnapDrawMode(this.g_iWndIndex, 2);
  1040. },
  1041. // 通道点击
  1042. ishg(val, row) {
  1043. this.isfse = false
  1044. this.ishge = row
  1045. getChannelNumber(val.channelId).then(response => {
  1046. if (response.data.isChannel == 'Y') {
  1047. this.form = response.data.parameterSet
  1048. this.shapes = JSON.parse(this.form.channelRange)
  1049. this.form.channelId = response.data.channelId
  1050. this.form.isChannel = response.data.isChannel
  1051. this.form.equipmentNum = response.data.equipmentNum
  1052. this.form.equipmentId = response.data.equipmentId
  1053. this.form.equipmentName = response.data.equipmentName
  1054. this.form.channelNum = response.data.channelNum
  1055. let snghs = response.data.videoAddress.split('@')
  1056. let snghst = snghs[1].split(':')
  1057. let snsgduan = snghst[1].split('/')
  1058. // this.ips = snghst[0]
  1059. this.ips = response.data.equipmentIp
  1060. console.log(snghs, snghst, snsgduan)
  1061. let sgse = {
  1062. 'ip': response.data.equipmentIp,
  1063. 'account': response.data.account,
  1064. 'password': response.data.password,
  1065. 'port': response.data.port
  1066. }
  1067. WebVideoCtrl.I_Logout(this.szDeviceIdentify)
  1068. WebVideoCtrl.I_StopAllPlay()
  1069. WebVideoCtrl.I_DestroyPlugin()
  1070. WebVideoCtrl.I_Resize()
  1071. this.getVideo(sgse)
  1072. // this.clickEnableDraw()
  1073. this.clickAddSnapPolygon()
  1074. var that = this
  1075. setTimeout(function() {
  1076. that.clickEnableDraw() //娃娃消失
  1077. }, 4000);
  1078. WebVideoCtrl.I_ShowPlugin()
  1079. } else {
  1080. this.form = {
  1081. parameterId: null,
  1082. channelId: response.data.channelId,
  1083. equipmentId: response.data.equipmentId,
  1084. equipmentNum: response.data.equipmentNum,
  1085. equipmentName: response.data.equipmentName,
  1086. channelNum: response.data.channelNum,
  1087. channelRange: null,
  1088. isChannel: response.data.isChannel,
  1089. leaveTime: 10,
  1090. playTime: 10,
  1091. leaveRate: 0.5,
  1092. playRate: 0.5,
  1093. delFlag: null,
  1094. createBy: null,
  1095. createTime: null,
  1096. updateBy: null,
  1097. updateTime: null,
  1098. remark: null
  1099. }
  1100. let snghs = response.data.videoAddress.split('@')
  1101. let snghst = snghs[1].split(':')
  1102. let snsgduan = snghst[1].split('/')
  1103. this.ips = response.data.equipmentIp
  1104. // this.ips = snghst[0]
  1105. console.log(snghs, snghst, snsgduan)
  1106. let sgse = {
  1107. 'ip': response.data.equipmentIp,
  1108. 'account': response.data.account,
  1109. 'password': response.data.password,
  1110. 'port': response.data.port
  1111. }
  1112. WebVideoCtrl.I_Logout(this.szDeviceIdentify)
  1113. WebVideoCtrl.I_StopAllPlay()
  1114. WebVideoCtrl.I_DestroyPlugin()
  1115. WebVideoCtrl.I_Resize()
  1116. this.getVideo(sgse)
  1117. var that = this
  1118. setTimeout(function() {
  1119. that.clickEnableDraw() //娃娃消失
  1120. }, 4000);
  1121. // this.clickEnableDraw()
  1122. this.clickAddSnapPolygon()
  1123. WebVideoCtrl.I_ShowPlugin()
  1124. }
  1125. })
  1126. // this.clickStartRealPlay('192.168.101.64', '80',1, 0, 1);
  1127. },
  1128. init(
  1129. val) { //这个val 就是一个地址,例如: http://192.168.2.201:85/live/9311272c49b845baa2b2810ad9bf3f68.flv 这是个服务器返回给我的一个监控视频流地址
  1130. setTimeout(() => { //使用定时器是因为,在mounted声明周期里调用,可能会出现DOM没加载出来的原因
  1131. var videoElement = this.$refs.videosmallone; // 获取到html中的video标签
  1132. this.isshiwa = true
  1133. if (flvjs.isSupported()) {
  1134. //因为我这个是复用组件,进来先判断 player是否存在,如果存在,销毁掉它,不然会占用TCP名额
  1135. if (this.player !== null) {
  1136. this.player.pause();
  1137. this.player.unload();
  1138. this.player.detachMediaElement();
  1139. this.player.destroy();
  1140. this.player = null;
  1141. }
  1142. this.player = flvjs.createPlayer( //创建直播流,加载到DOM中去
  1143. {
  1144. type: "flv",
  1145. url: val, //你的url地址
  1146. isLive: true, //数据源是否为直播流
  1147. hasAudio: false, //数据源是否包含有音频
  1148. hasVideo: true, //数据源是否包含有视频
  1149. enableStashBuffer: true, //是否启用缓存区
  1150. }, {
  1151. enableWorker: false, //不启用分离线程
  1152. enableStashBuffer: false, //关闭IO隐藏缓冲区
  1153. autoCleanupSourceBuffer: true, //自动清除缓存
  1154. lazyLoad: false,
  1155. }
  1156. );
  1157. this.isshoe = true
  1158. this.player.attachMediaElement(videoElement); //放到dom中去
  1159. //!!!!!!这里需要注意,有的时候load加载完成不一定可以播放,要是播放不成功,用settimeout 给下面的this.player.play() 延时几百毫秒再播放
  1160. // setTimeout(this.player.play(), 48000);
  1161. setTimeout(() => {
  1162. //到时间时只执行一次就停止
  1163. this.player.load(); //准备完成
  1164. this.player.play()
  1165. console.log('播放')
  1166. }, 900)
  1167. }
  1168. }, 500);
  1169. },
  1170. createVideo() {
  1171. if (flvjs.isSupported()) {
  1172. console.log(1)
  1173. var videoElement = document.getElementById('myFlvVideo')
  1174. console.log(videoElement, flvjs)
  1175. this.flvPlayer = flvjs.createPlayer({
  1176. type: 'application/x-mpegURL',
  1177. isLive: true,
  1178. hasAudio: false,
  1179. url: 'https://stream1.freetv.fun/86d463c0006da643e45e26b34875df87059dcba13e69d0a5471b185793c122a2.m3u8'
  1180. }, {
  1181. cors: true, // 是否跨域
  1182. enableWorker: false, // 是否多线程工作
  1183. enableStashBuffer: false, // 是否启用缓存
  1184. stashInitialSize: 400, // 缓存大小(kb) 默认384kb
  1185. autoCleanupSourceBuffer: true // 是否自动清理缓存
  1186. })
  1187. this.flvPlayer.attachMediaElement(videoElement)
  1188. this.flvPlayer.load()
  1189. this.flvPlayer.play()
  1190. console.log(1244)
  1191. // 报错重连
  1192. this.flvPlayer.on(flvjs.Events.ERROR, (errType, errDetail) => {
  1193. console.log('errorType:', errType)
  1194. console.log('errorDetail:', errDetail)
  1195. if (this.flvPlayer) {
  1196. this.destoryVideo()
  1197. this.createVideo()
  1198. }
  1199. })
  1200. }
  1201. console.log(this.flvPlayer.play())
  1202. },
  1203. destoryVideo() {
  1204. this.player.pause()
  1205. this.player.unload()
  1206. this.player.detachMediaElement()
  1207. this.player.destroy()
  1208. this.player = null
  1209. },
  1210. initScroll() {
  1211. // 给内层盒子设置宽度,不设置宽度的话无法滚动
  1212. // let width = this.goods.length * 60
  1213. // // 如果有外边距,可以这样写。需要去掉最后一个元素的外边距,在后面减一下
  1214. // let width = this.goodslength * (60 + 10) - 10
  1215. let width = 6 * (200 + 10) - 10
  1216. // this.$refs.content.style.width = width + 'px'
  1217. this.$nextTick(() => {
  1218. if (!this.Scroll) {
  1219. this.Scroll = new Bscroll(this.$refs.wrapper, {
  1220. click: true, // 配置允许点击事件
  1221. scrollX: true, // 开启横向滚动
  1222. eventPassthrough: 'vertical', // 当设置 eventPassthrough 为 'vertical' 的时候,scrollY 无效
  1223. mouseWheel: true,
  1224. scrollbar: { // 滚动条, 要加相对位置
  1225. fade: true
  1226. }
  1227. })
  1228. } else {
  1229. this.Scroll.refresh() // 重新计算 better-scroll,当 DOM 结构发生变化的时确保滚动效果正常
  1230. }
  1231. })
  1232. },
  1233. // 取消按钮
  1234. cancel() {
  1235. this.open = false;
  1236. this.opens = false;
  1237. this.reset();
  1238. },
  1239. // 表单重置
  1240. reset() {
  1241. this.form = {
  1242. receptionId: undefined,
  1243. receptionPhone: undefined,
  1244. // postSort: 0,
  1245. // status: "0",
  1246. receptionName: undefined
  1247. };
  1248. this.resetForm("form");
  1249. },
  1250. iszheg(event) {
  1251. console.log(event);
  1252. // 校验身份证:
  1253. console.log(reg.test(this.form.idCard), 23741)
  1254. if (reg.test(this.form.idCard) || _IDre15.test(this.form.idCard)) {
  1255. // this.idea();
  1256. this.go(this.form.idCard);
  1257. // callback()
  1258. } else {
  1259. if (ncjsle.test(this.form.idCard) || nhyeli.test(this.form.idCard)) {
  1260. console.log(3)
  1261. } else {
  1262. if (gnse.test(this.form.idCard)) {
  1263. console.log(4)
  1264. } else {
  1265. if (tw.test(this.form.idCard) || twe.test(this.form.idCard)) {
  1266. console.log(5)
  1267. } else {
  1268. this.$message.error('证件格式不正确');
  1269. }
  1270. }
  1271. }
  1272. }
  1273. },
  1274. erw(row) {
  1275. this.$router.push({
  1276. path: '/reny/ewm',
  1277. query: {
  1278. 'tenantId': row.investigateTableId
  1279. }
  1280. })
  1281. },
  1282. hussar_17Click(val) {
  1283. const _this = this
  1284. var url = process.env.VUE_APP_BASE_API + 'pages/index/index?id=' + val.investigateTableId;
  1285. console.log(url, this.$refs.canvas, 6)
  1286. this.opent = true
  1287. QRCode.toCanvas(
  1288. canvas,
  1289. url, //生成二维码的数据
  1290. {
  1291. width: 100,
  1292. height: 100,
  1293. margin: 1.5
  1294. }, //margin调整二维码的白边大小
  1295. function(error) {
  1296. if (error) {
  1297. console.log(error);
  1298. }
  1299. }
  1300. );
  1301. // console.log(qrcode,987)
  1302. },
  1303. /** 成绩_子添加按钮操作 */
  1304. handleAddScoreDataDetails() {
  1305. let obj = {};
  1306. obj.duty = "";
  1307. obj.idCard = "";
  1308. obj.phonenumber = "";
  1309. obj.userName = "";
  1310. this.scoreDataDetailsList.push(obj);
  1311. console.log(this.scoreDataDetailsList)
  1312. },
  1313. /** 成绩_子删除按钮操作 */
  1314. handleDeleteScoreDataDetails() {
  1315. if (this.checkedScoreDataDetails.length == 0) {
  1316. this.$modal.msgError("请先选择要删除的数据");
  1317. } else {
  1318. const scoreDataDetailsList = this.scoreDataDetailsList;
  1319. const checkedScoreDataDetails = this.checkedScoreDataDetails;
  1320. this.scoreDataDetailsList = scoreDataDetailsList.filter(function(item) {
  1321. return checkedScoreDataDetails.indexOf(item.index) == -1
  1322. });
  1323. }
  1324. },
  1325. /** 复选框选中数据 */
  1326. handleScoreDataDetailsSelectionChange(selection) {
  1327. this.checkedScoreDataDetails = selection.map(item => item.index)
  1328. },
  1329. /** 成绩_子序号 */
  1330. rowScoreDataDetailsIndex({
  1331. row,
  1332. rowIndex
  1333. }) {
  1334. row.index = rowIndex + 1;
  1335. },
  1336. /** 删除按钮操作 */
  1337. handleDelete(row) {
  1338. const postIds = row.recordId || this.ids;
  1339. delReservat(postIds).then(response => {
  1340. this.$modal.msgSuccess("操作成功");
  1341. this.getList();
  1342. });
  1343. // this.$modal.confirm('是否确认删除数据项?').then(function() {
  1344. // return delPost(postIds);
  1345. // }).then(() => {
  1346. // this.getList();
  1347. // this.$modal.msgSuccess("删除成功");
  1348. // }).catch(() => {});
  1349. },
  1350. handleDeletehx(row) {
  1351. const postIds = row.reservatId || this.ids;
  1352. let nhg = {}
  1353. nhg.reservatId = postIds
  1354. delReservathx(nhg).then(response => {
  1355. this.$modal.msgSuccess("操作成功");
  1356. this.getList();
  1357. });
  1358. // this.$modal.confirm('是否确认删除数据项?').then(function() {
  1359. // return delPost(postIds);
  1360. // }).then(() => {
  1361. // this.getList();
  1362. // this.$modal.msgSuccess("删除成功");
  1363. // }).catch(() => {});
  1364. },
  1365. // 发送短信
  1366. handleUpdatefas(row) {
  1367. updateFs(row).then(response => {
  1368. this.$modal.msgSuccess("发送成功");
  1369. // this.getList();
  1370. });
  1371. },
  1372. handleDeletegx(row) {
  1373. updateGx(row).then(response => {
  1374. this.$modal.msgSuccess("发送成功");
  1375. // this.getList();
  1376. });
  1377. },
  1378. /** 导出按钮操作 */
  1379. handleExport() {
  1380. this.download('system/reservat/export', {
  1381. ...this.queryParams
  1382. }, `预约人员.xlsx`)
  1383. },
  1384. // 获取屏幕高度
  1385. showFilterForm() {
  1386. this.filterActive = !this.filterActive
  1387. this.changeTableMaxHeight()
  1388. },
  1389. changeTableMaxHeight() {
  1390. let height = document.body.offsetHeight // 网页可视区域高度
  1391. // if (this.filterActive) {
  1392. // this.tableMaxHeight = height - 320
  1393. // } else {
  1394. this.tableMaxHeight = height - 350
  1395. // }
  1396. console.log(height)
  1397. },
  1398. /** 提交按钮 */
  1399. submitForm() {
  1400. this.$refs["form"].validate(valid => {
  1401. if (valid) {
  1402. // console.log(this.form)
  1403. // return
  1404. this.form.leaveTime = (this.form.leaveTime - 0) * 60
  1405. this.form.playTime = (this.form.playTime - 0) * 60
  1406. this.form.channelRange = JSON.stringify(this.shapes)
  1407. if (this.form.isChannel != 'N') {
  1408. updateParameterSet(this.form).then(response => {
  1409. this.$modal.msgSuccess("修改成功")
  1410. this.open = false
  1411. let result = (this.form.leaveTime / 60).toFixed(1);
  1412. let resultl = (this.form.playTime / 60).toFixed(1);
  1413. this.form.leaveTime = result
  1414. this.form.playTime = resultl
  1415. // this.$router.go(-1)
  1416. })
  1417. } else {
  1418. addParameterSet(this.form).then(response => {
  1419. this.$modal.msgSuccess("新增成功")
  1420. this.open = false
  1421. // this.$router.go(-1)
  1422. let result = (this.form.leaveTime / 60).toFixed(1);
  1423. let resultl = (this.form.playTime / 60).toFixed(1);
  1424. this.form.leaveTime = result
  1425. this.form.playTime = resultl
  1426. })
  1427. }
  1428. }
  1429. })
  1430. },
  1431. xiazag() {
  1432. var loadUrl = 'http://172.28.195.154:15010/prod-api/profile/HCWebSDKPluginsUserSetup.exe'
  1433. window.open(loadUrl, );
  1434. // const x = new XMLHttpRequest()
  1435. // x.open('GET', 'http://192.168.9.240:5010/profile/HCWebSDKPluginsUserSetup.zip', true)
  1436. // x.responseType = 'blob'
  1437. // x.onload = function() {
  1438. // const url = window.URL.createObjectURL(x.response)
  1439. // const a = document.createElement('a')
  1440. // a.href = 'http://192.168.9.240:5010/profile/HCWebSDKPluginsUserSetup.zip'
  1441. // a.download = ''
  1442. // a.click()
  1443. // }
  1444. // x.send()
  1445. }
  1446. }
  1447. };
  1448. </script>
  1449. <style lang="scss">
  1450. .snhseinu {
  1451. .el-input--medium .el-input__inner {
  1452. border: none;
  1453. }
  1454. }
  1455. .isjses {
  1456. .el-tabs--left .el-tabs__nav-wrap.is-left::after {
  1457. width: 6px;
  1458. }
  1459. .el-tabs--left .el-tabs__active-bar.is-left,
  1460. {
  1461. width: 6px;
  1462. }
  1463. }
  1464. .ingaqe {
  1465. .el-input--medium {
  1466. width: 100%;
  1467. }
  1468. }
  1469. .nhgrls {
  1470. .el-dialog__body {
  1471. padding: 0;
  1472. }
  1473. }
  1474. .hyr {
  1475. span {
  1476. text-decoration: underline;
  1477. }
  1478. }
  1479. </style>
  1480. <style scoped lang="scss">
  1481. .tool-box {
  1482. width: 98%;
  1483. height: 40px;
  1484. padding: 5px 30px;
  1485. margin: 20px auto 0;
  1486. box-sizing: border-box;
  1487. text-align: right;
  1488. }
  1489. .canvas-wrap {
  1490. // width: 80vw;
  1491. // height: 45vw;
  1492. width:100%;
  1493. height: 69vh;
  1494. margin: 0px auto;
  1495. background-color: #fff; //#fff;
  1496. border: 3px;
  1497. border-color: #333;
  1498. position: relative;
  1499. }
  1500. #imgCanvas,
  1501. #drawCanvas,
  1502. #saveCanvas {
  1503. background: rgba(255, 0, 255, 0);
  1504. position: absolute;
  1505. top: 50%;
  1506. left: 50%;
  1507. transform: translate(-50%, -50%);
  1508. }
  1509. #drawCanvas {
  1510. z-index: 2;
  1511. }
  1512. .nghwgq {
  1513. display: flex;
  1514. flex-direction: column;
  1515. justify-content: center;
  1516. align-items: center;
  1517. margin-top: 90px;
  1518. div {
  1519. color: #aaa;
  1520. }
  1521. }
  1522. .ihgswq {
  1523. // width:100%;
  1524. // overflow-x: hidden;
  1525. // margin-top: 30px;
  1526. }
  1527. .fijge {
  1528. // width: 110%;
  1529. display: flex;
  1530. display: -webkit-flex;
  1531. justify-content: space-between;
  1532. .shotw {
  1533. position: relative;
  1534. // width:32%;
  1535. width: 238px;
  1536. height: 140px;
  1537. margin-left: 0;
  1538. margin-right: 20px;
  1539. margin-bottom: 15px;
  1540. img {
  1541. height: 100%;
  1542. cursor: pointer;
  1543. }
  1544. p {
  1545. // bottom:-10px;
  1546. margin: 0;
  1547. font-weight: bold;
  1548. font-size: 16px;
  1549. padding: 5px 10px;
  1550. cursor: pointer;
  1551. }
  1552. .iges {
  1553. position: absolute;
  1554. top: 50%;
  1555. left: 50%;
  1556. width: 30px;
  1557. height: 30px;
  1558. transform: translate(-50%, -50%);
  1559. cursor: pointer;
  1560. }
  1561. }
  1562. }
  1563. .nhgwesvq {
  1564. width: 1610px !important;
  1565. }
  1566. .shotw {
  1567. position: relative;
  1568. margin-left: -20px;
  1569. margin-right: -20px;
  1570. img {
  1571. width: 100%;
  1572. height: 80vh;
  1573. }
  1574. p {
  1575. position: absolute;
  1576. bottom: 0;
  1577. left: 0;
  1578. background-color: rgba(0, 0, 0, .5);
  1579. width: 100%;
  1580. padding: 13px 5px;
  1581. color: #fff;
  1582. font-weight: bold;
  1583. font-size: 18px;
  1584. }
  1585. .p {
  1586. top: 0px;
  1587. height: 60px;
  1588. margin: 0;
  1589. padding-left: 20px;
  1590. }
  1591. }
  1592. .ksfpo {
  1593. background-color: #3464EB;
  1594. padding: 6px 12px;
  1595. border-radius: 4px;
  1596. color: #fff;
  1597. cursor: pointer;
  1598. }
  1599. .ksfpok {
  1600. background-color: #FFFFFF;
  1601. padding: 5px 11px;
  1602. border-radius: 4px;
  1603. color: #3464EB;
  1604. border: 1px solid #3464EB;
  1605. margin-left: 10px;
  1606. cursor: pointer;
  1607. }
  1608. .ksfpofg {
  1609. background-color: #75DB75;
  1610. padding: 5px 11px;
  1611. border-radius: 4px;
  1612. color: #FFFFFF;
  1613. border: 1px solid #75DB75;
  1614. margin-left: 10px;
  1615. cursor: pointer;
  1616. }
  1617. .iuer {
  1618. display: flex;
  1619. justify-content: space-between;
  1620. align-items: center;
  1621. .ite {
  1622. display: flex;
  1623. justify-content: space-between;
  1624. align-items: center;
  1625. p {
  1626. cursor: pointer;
  1627. margin: 0;
  1628. font-size: 15px;
  1629. font-family: PingFang SC;
  1630. font-weight: 500;
  1631. color: #666666;
  1632. padding: 4px 12px;
  1633. background: #Fff;
  1634. border-radius: 4px;
  1635. margin-right: 20px;
  1636. position: relative;
  1637. }
  1638. .actt {
  1639. background: #fff;
  1640. // border-bottom: 3px solid #5974E0;
  1641. // border-radius: 0;
  1642. // border-bottom-right-radius: 4px;
  1643. color: #5974E0;
  1644. }
  1645. .actt {
  1646. &::after {
  1647. content: "";
  1648. width: 40%;
  1649. height: 5px;
  1650. border-radius: 3px;
  1651. transform: translate(-50%);
  1652. background-color: #5974E0;
  1653. position: absolute;
  1654. left: 50%;
  1655. bottom: -3px;
  1656. }
  1657. }
  1658. }
  1659. }
  1660. .lqw {
  1661. padding: 0 10px;
  1662. margin: 0;
  1663. margin-bottom: 20px;
  1664. }
  1665. .nhgel {
  1666. height: 170px;
  1667. background-color: #313b61;
  1668. width: 100%;
  1669. position: absolute;
  1670. top: 0;
  1671. left: 0;
  1672. z-index: 0;
  1673. }
  1674. .app-container {
  1675. background-color: #f3f4f6;
  1676. padding-top: 10px;
  1677. height: 180vh;
  1678. }
  1679. .ntgs {
  1680. position: relative;
  1681. // background-color: #fff;
  1682. padding: 5px;
  1683. // border-radius: 5px;
  1684. padding-top: 10px;
  1685. padding: 10px 20px;
  1686. .pagination-container {
  1687. height: 50px;
  1688. }
  1689. }
  1690. .nghfs {
  1691. position: relative;
  1692. background-color: #fff;
  1693. padding-top: 18px !important;
  1694. padding: 5px;
  1695. // border-radius: 5px;
  1696. // margin-bottom: 20px;
  1697. }
  1698. .ksf {
  1699. img {
  1700. width: 100%;
  1701. height: 100%;
  1702. }
  1703. }
  1704. .ingwfaq {
  1705. font-weight: bold;
  1706. font-size: 16px;
  1707. }
  1708. .dflex {
  1709. display: flex;
  1710. }
  1711. .dflext {
  1712. display: flex;
  1713. align-items: flex-start;
  1714. }
  1715. .drawings-list {
  1716. width: 100%;
  1717. flex: 0 0 auto;
  1718. padding-left: 10px;
  1719. line-height: 36px;
  1720. .delimg {
  1721. width: 15px;
  1722. height: 15px;
  1723. margin-left: 5px;
  1724. }
  1725. .txt {
  1726. font-size: 12px;
  1727. padding-left: 5px;
  1728. flex: 1;
  1729. }
  1730. .tflex {
  1731. display: flex;
  1732. align-items: center;
  1733. }
  1734. }
  1735. .disbtn {
  1736. display: flex;
  1737. align-items: center;
  1738. flex: 0 0 auto;
  1739. min-height: 34px;
  1740. cursor: pointer;
  1741. img {
  1742. width: 14px;
  1743. height: 14px;
  1744. margin-right: 10px;
  1745. }
  1746. font-weight: 500;
  1747. font-size: 14px;
  1748. color: #444444;
  1749. }
  1750. .anche {
  1751. background: #E7F1EE !important;
  1752. border-radius: 4px !important;
  1753. font-weight: 400;
  1754. div {
  1755. color: #03BF8A !important;
  1756. }
  1757. }
  1758. </style>