videoclouddevice.vue 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680
  1. <template>
  2. <basic-container>
  3. <avue-crud :option="option" :table-loading="loading" :data="data" :page="page" :permission="permissionList"
  4. :before-open="beforeOpen" v-model="form" ref="crud" @row-update="rowUpdate" @row-save="rowSave" @row-del="rowDel"
  5. @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange" @current-change="currentChange"
  6. @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
  7. <template slot="menuLeft">
  8. <el-button type="danger" size="small" icon="el-icon-delete" plain v-if="permission.videoclouddevice_delete"
  9. @click="handleDelete">删 除
  10. </el-button>
  11. <el-button type="success" icon="el-icon-paperclip" size="small" @click="showDeviceBindBatch()">批量绑定</el-button>
  12. </template>
  13. <template slot="menu" slot-scope="{row}">
  14. <el-button-group>
  15. <el-button size="mini" icon="el-icon-refresh" plain v-if="permission.vcdevice_sync" @click="rowSync(row, row.$index)">刷新</el-button>
  16. <el-button size="mini" icon="el-icon-video-play" type="success" v-if="permission.vcdevice_play && row.enable == 1" @click="play(row)">播放</el-button>
  17. <el-button size="mini" icon="el-icon-close" type="danger" v-if="permission.vcdevice_stop && row.enable == 1" @click="stop(row)">停用</el-button>
  18. <el-button size="mini" icon="el-icon-check" type="primary" :loading="startBtnLoading" v-if="permission.vcdevice_start && row.enable != 1 && row.isOnline == 1" @click="start(row)">获取视频</el-button>
  19. <el-button size="mini">
  20. <el-dropdown>
  21. <span>
  22. 更多<i class="el-icon-arrow-down el-icon--right"></i>
  23. </span>
  24. <el-dropdown-menu slot="dropdown">
  25. <el-dropdown-item icon="el-icon-view" type="text" @click.native="view(row)">查看</el-dropdown-item>
  26. <el-dropdown-item icon="el-icon-delete" type="text" @click.native="rowDel(row)">删除</el-dropdown-item>
  27. <el-dropdown-item icon="el-icon-paperclip" type="text" @click.native="showDeviceBind(row)">{{!row.residentialId ? '设备绑定' : '设备改绑'}}</el-dropdown-item>
  28. </el-dropdown-menu>
  29. </el-dropdown>
  30. </el-button>
  31. </el-button-group>
  32. <!--<el-button icon="el-icon-paperclip" type="text" @click="showDeviceBind(scope.row)">{{!scope.row.residentialId ? '设备绑定' : '设备改绑'}}</el-button>-->
  33. <!--<el-button icon="el-icon-video-camera" type="text" @click="showVideo(scope.row)">查看监控</el-button>-->
  34. </template>
  35. <template slot="isOnline" slot-scope="{row}">
  36. <el-tag v-if="row.isOnline == 1" type="success">在线</el-tag>
  37. <el-tag v-else type="info">离线</el-tag>
  38. </template>
  39. </avue-crud>
  40. <!-- 播放器-->
  41. <devicePlayer ref="devicePlayer"></devicePlayer>
  42. <!-- 小区列表-->
  43. <el-dialog :modal-append-to-body="false" append-to-body :visible.sync="bindVisible" title="设备绑定" center width="20%">
  44. <div style="text-align: center;">
  45. <!-- <el-select v-model="selectValue" filterable placeholder="请选择">
  46. <el-option v-for="item in residentialList" :key="item.id" :label="item.name" :value="item.id">
  47. </el-option>
  48. </el-select>
  49. <p style="margin-top: 20px;">
  50. <el-button type="primary" icon="el-icon-paperclip" @click="bindDevice">绑定</el-button>
  51. </p> -->
  52. <avue-form v-model="bindForm" :option="bindOption" @submit="bindDevice">
  53. </avue-form>
  54. </div>
  55. </el-dialog>
  56. <el-dialog :modal-append-to-body="false" append-to-body :visible.sync="bindBatchVisible" title="设备批量绑定" center
  57. width="50%">
  58. <div style="text-align: center;">
  59. <avue-form v-model="bindBatchForm" :option="bindOption" @submit="bindBatchDevice">
  60. </avue-form>
  61. <!-- <el-select v-model="selectValue" filterable placeholder="请选择">
  62. <el-option v-for="item in residentialList" :key="item.id" :label="item.name" :value="item.id">
  63. </el-option>
  64. </el-select>
  65. <p style="margin-top: 20px;">
  66. <el-button type="primary" icon="el-icon-paperclip" @click="bindBatchDevice">绑定</el-button>
  67. </p> -->
  68. </div>
  69. </el-dialog>
  70. <el-dialog :modal-append-to-body="false" append-to-body :visible.sync="videoVisible" title="视频监控" center width="50%">
  71. <div>
  72. <div align="center">{{video.name}}</div>
  73. <video :id="videoId" controls="true" width="100%" height="100%">
  74. </video>
  75. </div>
  76. </el-dialog>
  77. <el-dialog :modal-append-tobody="false" append-to-body :visible.sync="editVisiable" title="编辑" width="60%">
  78. <avue-form :option="option" v-model="editForm" @submit="submitVideoclouddevice"></avue-form>
  79. </el-dialog>
  80. <el-dialog :modal-append-tobody="false" append-to-body :visible.sync="detailVisible" title="查看" width="60%">
  81. <avue-form :option="option1" v-model="detailForm" ></avue-form>
  82. </el-dialog>
  83. </basic-container>
  84. </template>
  85. <script>
  86. import {
  87. getList,
  88. getDetail,
  89. add,
  90. update,
  91. remove,
  92. start,
  93. stop,
  94. play,
  95. sync
  96. } from "../../../../api/device/videoclouddevice.js";
  97. import {
  98. mapGetters
  99. } from "vuex";
  100. import {
  101. getAllList
  102. } from "../../../../api/community/residential.js";
  103. import devicePlayer from "../../videodevice/devicePlayer";
  104. export default {
  105. components: {devicePlayer},
  106. data() {
  107. return {
  108. getListLoading: false,
  109. startBtnLoading: false,
  110. bindBatchForm:{},
  111. bindForm: {},
  112. videoVisible: false,
  113. video: {},
  114. editVisiable: false,
  115. editForm: {},
  116. detailVisible: false,
  117. detailForm: {},
  118. selectValue: "",
  119. form: {},
  120. query: {},
  121. loading: true,
  122. bindVisible: false,
  123. bindBatchVisible: false,
  124. residentialList: [],
  125. page: {
  126. pageSize: 10,
  127. currentPage: 1,
  128. total: 0
  129. },
  130. selectionList: [],
  131. option: {
  132. menu: true,
  133. menuWidth:320,
  134. height: 'auto',
  135. calcHeight: 30,
  136. tip: false,
  137. searchShow: true,
  138. searchMenuSpan: 6,
  139. labelWidth: 150,
  140. border: true,
  141. index: true,
  142. viewBtn: false,
  143. editBtn: false,
  144. delBtn: false,
  145. selection: true,
  146. dialogClickModal: false,
  147. addBtn:false,
  148. column: [{
  149. label: "设备编号",
  150. prop: "deviceId",
  151. hide: true,
  152. addDisplay:false,
  153. editDisplay:false,
  154. span: 12,
  155. rules: [{
  156. required: true,
  157. message: "请输入设备编号",
  158. trigger: "blur"
  159. }]
  160. },
  161. {
  162. label: "设备名称",
  163. prop: "deviceName",
  164. search: true,
  165. span: 12,
  166. rules: [{
  167. required: true,
  168. message: "请输入设备名称",
  169. trigger: "blur"
  170. }]
  171. },
  172. {
  173. label: "设备号",
  174. prop: "deviceNum",
  175. span: 12,
  176. search: true,
  177. rules: [{
  178. required: true,
  179. message: "请输入设备号",
  180. trigger: "blur"
  181. }]
  182. },
  183. {
  184. label: "设备密码",
  185. prop: "devicePassword",
  186. span: 12,
  187. hide: true,
  188. rules: [{
  189. required: true,
  190. message: "请输入设备密码",
  191. trigger: "blur"
  192. }]
  193. },
  194. {
  195. label: "型号",
  196. prop: "modelSequence",
  197. span: 12,
  198. hide: true,
  199. rules: [{
  200. required: true,
  201. message: "请输入型号",
  202. trigger: "blur"
  203. }]
  204. },
  205. {
  206. // label: "协议类型(1:GB28181,2:ONVIF)",
  207. label: "协议类型",
  208. prop: "protocolType",
  209. span: 12,
  210. hide: true,
  211. rules: [{
  212. required: true,
  213. message: "请输入协议类型(1:GB28181,2:ONVIF)",
  214. trigger: "blur"
  215. }]
  216. },
  217. {
  218. label: "是否在线",
  219. prop: "isOnline",
  220. slot: true,
  221. width: 100,
  222. align: "center",
  223. dataType: "number",
  224. type: "select",
  225. search: true,
  226. dicData:[
  227. {
  228. label:'在线',
  229. value:1
  230. },
  231. {
  232. label:'离线',
  233. value:0
  234. }
  235. ],
  236. // dicUrl: "/api/blade-system/dict-biz/dictionary?code=online_or_offline",
  237. // props: {
  238. // label: 'dictValue',
  239. // value: 'dictKey'
  240. // },
  241. rules: [{
  242. required: true,
  243. message: "请输入是否在线(0:不在线,1:在线)",
  244. trigger: "blur"
  245. }]
  246. },
  247. {
  248. // label: "是否支持云存储(0:不支持,1:支持)",
  249. label: "是否支持云存储",
  250. prop: "isSupportCloudStorage",
  251. span: 12,
  252. hide: true,
  253. type:'select',
  254. dicData:[
  255. {
  256. label:'支持',
  257. value:1
  258. },
  259. {
  260. label:'不支持',
  261. value:0
  262. }
  263. ],
  264. rules: [{
  265. required: true,
  266. message: "请输入是否支持云存储(0:不支持,1:支持)",
  267. trigger: "blur"
  268. }]
  269. },
  270. {
  271. // label: "是否支持本地存储(0:不支持,1:支持)",
  272. label: "是否支持本地存储",
  273. prop: "isSupportLocalStorage",
  274. type:'select',
  275. span: 12,
  276. hide: true,
  277. dicData:[
  278. {
  279. label:'支持',
  280. value:1
  281. },
  282. {
  283. label:'不支持',
  284. value:0
  285. }
  286. ],
  287. rules: [{
  288. required: true,
  289. message: "请输入是否支持本地存储(0:不支持,1:支持)",
  290. trigger: "blur"
  291. }]
  292. },
  293. /*{
  294. label: "是否支持云台",
  295. prop: "isSupportPtz",
  296. span: 12,
  297. dataType: "number",
  298. type: "select",
  299. dicData:[
  300. {
  301. label:'支持',
  302. value:1
  303. },
  304. {
  305. label:'不支持',
  306. value:0
  307. }
  308. ],
  309. // dicUrl: "/api/blade-system/dict-biz/dictionary?code=is_support",
  310. // props: {
  311. // label: 'dictValue',
  312. // value: 'dictKey'
  313. // },
  314. rules: [{
  315. required: true,
  316. message: "请输入是否支持云台(0:不支持,1:支持)",
  317. trigger: "blur"
  318. }]
  319. },*/
  320. {
  321. // label: "是否支持移动侦测(0:不支持,1:支持)",
  322. label: "是否支持移动侦测",
  323. prop: "isSupportMotionDetection",
  324. span: 12,
  325. hide: true,
  326. type:'select',
  327. dicData:[
  328. {
  329. label:'支持',
  330. value:1
  331. },
  332. {
  333. label:'不支持',
  334. value:0
  335. }
  336. ],
  337. rules: [{
  338. required: true,
  339. message: "请输入是否支持移动侦测(0:不支持,1:支持)",
  340. trigger: "blur"
  341. }]
  342. },
  343. {
  344. // label: "是否支持手动报警(0:不支持,1:支持)",
  345. label: "是否支持手动报警",
  346. prop: "isSupportManualAlarm",
  347. span: 12,
  348. hide: true,
  349. type:'select',
  350. dicData:[
  351. {
  352. label:'支持',
  353. value:1
  354. },
  355. {
  356. label:'不支持',
  357. value:0
  358. }
  359. ],
  360. rules: [{
  361. required: true,
  362. message: "请输入是否支持手动报警(0:不支持,1:支持)",
  363. trigger: "blur"
  364. }]
  365. },
  366. {
  367. // label: "是否支持外部开关报警(0:不支持,1:支持)",
  368. label: "是否支持外部开关报警",
  369. prop: "isSupportExternalAlarmSwitch",
  370. span: 12,
  371. hide: true,
  372. type:"select",
  373. dicData:[
  374. {
  375. label:'支持',
  376. value:1
  377. },
  378. {
  379. label:'不支持',
  380. value:0
  381. }
  382. ],
  383. rules: [{
  384. required: true,
  385. message: "请输入是否支持外部开关报警(0:不支持,1:支持)",
  386. trigger: "blur"
  387. }]
  388. },
  389. {
  390. // label: "设备是否有反转倒置能力(0:否,1:是)",
  391. label: "设备是否有反转倒置能力",
  392. prop: "isHaveInversion",
  393. span: 12,
  394. hide: true,
  395. type:'select',
  396. dicData:[
  397. {
  398. label:'支持',
  399. value:1
  400. },
  401. {
  402. label:'不支持',
  403. value:0
  404. }
  405. ],
  406. rules: [{
  407. required: true,
  408. message: "请输入设备是否有反转倒置能力(0:否,1:是)",
  409. trigger: "blur"
  410. }]
  411. },
  412. // {
  413. // label: "云存储类别",
  414. // prop: "cloudStorageType",
  415. // span: 12,
  416. // type: "select",
  417. // dataType: "number",
  418. // dicUrl: "/api/blade-system/dict-biz/dictionary?code=cloud_storage_type",
  419. // props: {
  420. // label: 'dictValue',
  421. // value: 'dictKey'
  422. // },
  423. // rules: [{
  424. // required: true,
  425. // message: "请输入云存储类别(0:无云存储,1:电信分布式存储,2:21cn存储)",
  426. // trigger: "blur"
  427. // }]
  428. // },
  429. {
  430. label: "云存储配置id",
  431. prop: "cloudStorageConfId",
  432. span: 12,
  433. hide: true,
  434. rules: [{
  435. required: true,
  436. message: "请输入云存储配置id",
  437. trigger: "blur"
  438. }]
  439. },
  440. {
  441. // label: "视频流获取方式(0:主动推流,1:主动拉取流)",
  442. label: "视频流获取方式",
  443. prop: "streamType",
  444. span: 12,
  445. hide: true,
  446. type:'select',
  447. dicData:[
  448. {
  449. label:'主动推流',
  450. value:0
  451. },
  452. {
  453. label:'主动拉取流',
  454. value:1
  455. }
  456. ],
  457. rules: [{
  458. required: true,
  459. message: "请输入视频流获取方式(0:主动推流,1:主动拉取流)",
  460. trigger: "blur"
  461. }]
  462. },
  463. {
  464. label: "设备地址",
  465. prop: "address",
  466. span: 12,
  467. hide: true,
  468. rules: [{
  469. required: true,
  470. message: "请输入设备地址",
  471. trigger: "blur"
  472. }]
  473. },
  474. {
  475. // label: "是否拥有者(0:否,1:是)",
  476. label: "是否拥有者",
  477. prop: "isOwner",
  478. span: 12,
  479. hide: true,
  480. type:'select',
  481. dicData:[
  482. {
  483. label:'否',
  484. value:0
  485. },
  486. {
  487. label:'是',
  488. value:1
  489. }
  490. ],
  491. rules: [{
  492. required: true,
  493. message: "请输入是否拥有者(0:否,1:是)",
  494. trigger: "blur"
  495. }]
  496. },
  497. {
  498. label: "所属NVR的编号",
  499. prop: "parentNvrNum",
  500. span: 12,
  501. hide: true,
  502. rules: [{
  503. required: true,
  504. message: "请输入所属NVR的编号",
  505. trigger: "blur"
  506. }]
  507. },
  508. {
  509. // label: "告警状态(0:正常;1:告警)",
  510. label: "告警状态",
  511. prop: "alarmStatus",
  512. span: 12,
  513. hide: true,
  514. type:'select',
  515. dicData:[
  516. {
  517. label:'正常',
  518. value:0
  519. },
  520. {
  521. label:'告警',
  522. value:1
  523. }
  524. ],
  525. rules: [{
  526. required: true,
  527. message: "请输入告警状态(0:正常;1:告警)",
  528. trigger: "blur"
  529. }]
  530. },
  531. {
  532. label: "经度",
  533. prop: "longitude",
  534. hide:true,
  535. span: 12,
  536. rules: [{
  537. required: true,
  538. message: "请输入经度",
  539. trigger: "blur"
  540. }]
  541. },
  542. {
  543. label: "纬度",
  544. prop: "latitude",
  545. hide:true,
  546. span: 12,
  547. rules: [{
  548. required: true,
  549. message: "请输入纬度",
  550. trigger: "blur"
  551. }]
  552. },
  553. {
  554. label: "维护人员信息",
  555. prop: "maintainer",
  556. span: 12,
  557. hide: true,
  558. rules: [{
  559. required: true,
  560. message: "请输入维护人员信息",
  561. trigger: "blur"
  562. }]
  563. },
  564. {
  565. label: "是否封存",
  566. prop: "block",
  567. span: 12,
  568. hide: true,
  569. type:'select',
  570. dicData:[
  571. {
  572. label:'封存',
  573. value:true
  574. },
  575. {
  576. label:'不封存',
  577. value:false
  578. }
  579. ],
  580. rules: [{
  581. required: true,
  582. message: "请输入是否封存,true封存",
  583. trigger: "blur"
  584. }]
  585. },
  586. {
  587. label: "封存时间",
  588. prop: "blockTime",
  589. span: 12,
  590. hide: true,
  591. rules: [{
  592. required: true,
  593. message: "请输入封存时间",
  594. trigger: "blur"
  595. }]
  596. },
  597. {
  598. label: "路由器id",
  599. prop: "routeId",
  600. span: 12,
  601. hide: true,
  602. rules: [{
  603. required: true,
  604. message: "请输入路由器id",
  605. trigger: "blur"
  606. }]
  607. },
  608. {
  609. // label: "摄像头类型 G:枪机 D:球机",
  610. label: "摄像头类型",
  611. prop: "equipType",
  612. span: 12,
  613. hide: true,
  614. type:'select',
  615. dicData:[
  616. {
  617. label:'枪机',
  618. value:'G'
  619. },
  620. {
  621. label:'球机',
  622. value:'D'
  623. }
  624. ],
  625. rules: [{
  626. required: true,
  627. message: "请输入摄像头类型 G:枪机 D:球机",
  628. trigger: "blur"
  629. }]
  630. },
  631. {
  632. label: "设备最后状态更新时间",
  633. prop: "updateStateTimeString",
  634. span: 12,
  635. hide: true,
  636. rules: [{
  637. required: true,
  638. message: "请输入设备最后状态更新时间",
  639. trigger: "blur"
  640. }]
  641. },
  642. {
  643. label: "设备监控位id",
  644. prop: "districtId",
  645. span: 12,
  646. hide: true,
  647. display:false,
  648. rules: [{
  649. required: true,
  650. message: "请输入设备监控位id",
  651. trigger: "blur"
  652. }]
  653. },
  654. {
  655. // label: "存储位置(通过该字段快速查询,所有的子节点)机构树位置",
  656. label: "存储位置",
  657. prop: "orgPosition",
  658. span: 12,
  659. hide: true,
  660. display:false,
  661. rules: [{
  662. required: true,
  663. message: "请输入存储位置(通过该字段快速查询,所有的子节点)机构树位置",
  664. trigger: "blur"
  665. }]
  666. },
  667. {
  668. label: "rtsp视频播放地址",
  669. prop: "rtspUrl",
  670. span: 12,
  671. hide: true,
  672. rules: [{
  673. required: true,
  674. message: "请输入rtsp视频播放地址",
  675. trigger: "blur"
  676. }]
  677. },
  678. {
  679. label: "http-flv视频播放地址",
  680. prop: "httpFlvUrl",
  681. span: 12,
  682. hide: true,
  683. rules: [{
  684. required: true,
  685. message: "请输入http-flv视频播放地址",
  686. trigger: "blur"
  687. }]
  688. },
  689. {
  690. label: "视频云账号",
  691. prop: "accountName",
  692. search: true,
  693. searchLabelWidth: 100,
  694. span: 12,
  695. rules: [{
  696. required: true,
  697. message: "请输入所属账户",
  698. trigger: "blur"
  699. }]
  700. },
  701. ]
  702. },
  703. option1:{
  704. menu: true,
  705. height: 'auto',
  706. calcHeight: 30,
  707. tip: false,
  708. searchShow: true,
  709. searchMenuSpan: 6,
  710. labelWidth: 150,
  711. border: true,
  712. index: true,
  713. viewBtn: false,
  714. editBtn: false,
  715. delBtn: true,
  716. selection: true,
  717. dialogClickModal: false,
  718. disabled:true,
  719. submitBtn:false,
  720. emptyBtn:false,
  721. column: [{
  722. label: "设备编号",
  723. prop: "deviceId",
  724. hide: true,
  725. span: 12,
  726. rules: [{
  727. required: true,
  728. message: "请输入设备编号",
  729. trigger: "blur"
  730. }]
  731. },
  732. {
  733. label: "设备名称",
  734. prop: "deviceName",
  735. search: true,
  736. span: 12,
  737. rules: [{
  738. required: true,
  739. message: "请输入设备名称",
  740. trigger: "blur"
  741. }]
  742. },
  743. {
  744. label: "设备号",
  745. prop: "deviceNum",
  746. span: 12,
  747. rules: [{
  748. required: true,
  749. message: "请输入设备号",
  750. trigger: "blur"
  751. }]
  752. },
  753. {
  754. label: "设备密码",
  755. prop: "devicePassword",
  756. span: 12,
  757. hide: true,
  758. rules: [{
  759. required: true,
  760. message: "请输入设备密码",
  761. trigger: "blur"
  762. }]
  763. },
  764. {
  765. label: "设备类型",
  766. prop: "deviceType",
  767. span: 12,
  768. search: true,
  769. dataType: "number",
  770. type: "select",
  771. dicUrl: "/api/blade-system/dict-biz/dictionary?code=video_device_type",
  772. props: {
  773. label: 'dictValue',
  774. value: 'dictKey'
  775. },
  776. rules: [{
  777. required: true,
  778. message: "请输入设备类型(132:IPC;111:DVR;118:NVR,114:解码器)",
  779. trigger: "blur"
  780. }]
  781. },
  782. {
  783. label: "型号",
  784. prop: "modelSequence",
  785. span: 12,
  786. hide: true,
  787. rules: [{
  788. required: true,
  789. message: "请输入型号",
  790. trigger: "blur"
  791. }]
  792. },
  793. {
  794. // label: "协议类型(1:GB28181,2:ONVIF)",
  795. label: "协议类型",
  796. prop: "protocolType",
  797. span: 12,
  798. hide: true,
  799. rules: [{
  800. required: true,
  801. message: "请输入协议类型(1:GB28181,2:ONVIF)",
  802. trigger: "blur"
  803. }]
  804. },
  805. {
  806. label: "是否在线",
  807. prop: "isOnline",
  808. span: 12,
  809. dataType: "number",
  810. type: "select",
  811. search: true,
  812. slot: true,
  813. dicData:[
  814. {
  815. label:'在线',
  816. value:1
  817. },
  818. {
  819. label:'离线',
  820. value:0
  821. }
  822. ],
  823. // dicUrl: "/api/blade-system/dict-biz/dictionary?code=online_or_offline",
  824. // props: {
  825. // label: 'dictValue',
  826. // value: 'dictKey'
  827. // },
  828. rules: [{
  829. required: true,
  830. message: "请输入是否在线(0:不在线,1:在线)",
  831. trigger: "blur"
  832. }]
  833. },
  834. {
  835. // label: "是否支持云存储(0:不支持,1:支持)",
  836. label: "是否支持云存储",
  837. prop: "isSupportCloudStorage",
  838. span: 12,
  839. hide: true,
  840. type:'select',
  841. dicData:[
  842. {
  843. label:'支持',
  844. value:1
  845. },
  846. {
  847. label:'不支持',
  848. value:0
  849. }
  850. ],
  851. rules: [{
  852. required: true,
  853. message: "请输入是否支持云存储(0:不支持,1:支持)",
  854. trigger: "blur"
  855. }]
  856. },
  857. {
  858. // label: "是否支持本地存储(0:不支持,1:支持)",
  859. label: "是否支持本地存储",
  860. prop: "isSupportLocalStorage",
  861. type:'select',
  862. span: 12,
  863. hide: true,
  864. dicData:[
  865. {
  866. label:'支持',
  867. value:1
  868. },
  869. {
  870. label:'不支持',
  871. value:0
  872. }
  873. ],
  874. rules: [{
  875. required: true,
  876. message: "请输入是否支持本地存储(0:不支持,1:支持)",
  877. trigger: "blur"
  878. }]
  879. },
  880. // {
  881. // label: "是否支持云台",
  882. // prop: "isSupportPtz",
  883. // span: 12,
  884. // dataType: "number",
  885. // type: "select",
  886. // dicData:[
  887. // {
  888. // label:'支持',
  889. // value:1
  890. // },
  891. // {
  892. // label:'不支持',
  893. // value:0
  894. // }
  895. // ],
  896. // // dicUrl: "/api/blade-system/dict-biz/dictionary?code=is_support",
  897. // // props: {
  898. // // label: 'dictValue',
  899. // // value: 'dictKey'
  900. // // },
  901. // rules: [{
  902. // required: true,
  903. // message: "请输入是否支持云台(0:不支持,1:支持)",
  904. // trigger: "blur"
  905. // }]
  906. // },
  907. {
  908. // label: "是否支持移动侦测(0:不支持,1:支持)",
  909. label: "是否支持移动侦测",
  910. prop: "isSupportMotionDetection",
  911. span: 12,
  912. hide: true,
  913. type:'select',
  914. dicData:[
  915. {
  916. label:'支持',
  917. value:1
  918. },
  919. {
  920. label:'不支持',
  921. value:0
  922. }
  923. ],
  924. rules: [{
  925. required: true,
  926. message: "请输入是否支持移动侦测(0:不支持,1:支持)",
  927. trigger: "blur"
  928. }]
  929. },
  930. {
  931. // label: "是否支持手动报警(0:不支持,1:支持)",
  932. label: "是否支持手动报警",
  933. prop: "isSupportManualAlarm",
  934. span: 12,
  935. hide: true,
  936. type:'select',
  937. dicData:[
  938. {
  939. label:'支持',
  940. value:1
  941. },
  942. {
  943. label:'不支持',
  944. value:0
  945. }
  946. ],
  947. rules: [{
  948. required: true,
  949. message: "请输入是否支持手动报警(0:不支持,1:支持)",
  950. trigger: "blur"
  951. }]
  952. },
  953. {
  954. // label: "是否支持外部开关报警(0:不支持,1:支持)",
  955. label: "是否支持外部开关报警",
  956. prop: "isSupportExternalAlarmSwitch",
  957. span: 12,
  958. hide: true,
  959. type:"select",
  960. dicData:[
  961. {
  962. label:'支持',
  963. value:1
  964. },
  965. {
  966. label:'不支持',
  967. value:0
  968. }
  969. ],
  970. rules: [{
  971. required: true,
  972. message: "请输入是否支持外部开关报警(0:不支持,1:支持)",
  973. trigger: "blur"
  974. }]
  975. },
  976. {
  977. // label: "设备是否有反转倒置能力(0:否,1:是)",
  978. label: "设备是否有反转倒置能力",
  979. prop: "isHaveInversion",
  980. span: 12,
  981. hide: true,
  982. type:'select',
  983. dicData:[
  984. {
  985. label:'支持',
  986. value:1
  987. },
  988. {
  989. label:'不支持',
  990. value:0
  991. }
  992. ],
  993. rules: [{
  994. required: true,
  995. message: "请输入设备是否有反转倒置能力(0:否,1:是)",
  996. trigger: "blur"
  997. }]
  998. },
  999. {
  1000. label: "云存储类别",
  1001. prop: "cloudStorageType",
  1002. span: 12,
  1003. type: "select",
  1004. dataType: "number",
  1005. dicUrl: "/api/blade-system/dict-biz/dictionary?code=cloud_storage_type",
  1006. props: {
  1007. label: 'dictValue',
  1008. value: 'dictKey'
  1009. },
  1010. rules: [{
  1011. required: true,
  1012. message: "请输入云存储类别(0:无云存储,1:电信分布式存储,2:21cn存储)",
  1013. trigger: "blur"
  1014. }]
  1015. },
  1016. {
  1017. label: "云存储配置id",
  1018. prop: "cloudStorageConfId",
  1019. span: 12,
  1020. hide: true,
  1021. rules: [{
  1022. required: true,
  1023. message: "请输入云存储配置id",
  1024. trigger: "blur"
  1025. }]
  1026. },
  1027. {
  1028. // label: "视频流获取方式(0:主动推流,1:主动拉取流)",
  1029. label: "视频流获取方式",
  1030. prop: "streamType",
  1031. span: 12,
  1032. hide: true,
  1033. type:'select',
  1034. dicData:[
  1035. {
  1036. label:'主动推流',
  1037. value:0
  1038. },
  1039. {
  1040. label:'主动拉取流',
  1041. value:1
  1042. }
  1043. ],
  1044. rules: [{
  1045. required: true,
  1046. message: "请输入视频流获取方式(0:主动推流,1:主动拉取流)",
  1047. trigger: "blur"
  1048. }]
  1049. },
  1050. {
  1051. label: "设备地址",
  1052. prop: "address",
  1053. span: 12,
  1054. hide: true,
  1055. rules: [{
  1056. required: true,
  1057. message: "请输入设备地址",
  1058. trigger: "blur"
  1059. }]
  1060. },
  1061. {
  1062. // label: "是否拥有者(0:否,1:是)",
  1063. label: "是否拥有者",
  1064. prop: "isOwner",
  1065. span: 12,
  1066. hide: true,
  1067. type:'select',
  1068. dicData:[
  1069. {
  1070. label:'否',
  1071. value:0
  1072. },
  1073. {
  1074. label:'是',
  1075. value:1
  1076. }
  1077. ],
  1078. rules: [{
  1079. required: true,
  1080. message: "请输入是否拥有者(0:否,1:是)",
  1081. trigger: "blur"
  1082. }]
  1083. },
  1084. {
  1085. label: "所属NVR的编号",
  1086. prop: "parentNvrNum",
  1087. span: 12,
  1088. hide: true,
  1089. rules: [{
  1090. required: true,
  1091. message: "请输入所属NVR的编号",
  1092. trigger: "blur"
  1093. }]
  1094. },
  1095. {
  1096. // label: "告警状态(0:正常;1:告警)",
  1097. label: "告警状态",
  1098. prop: "alarmStatus",
  1099. span: 12,
  1100. hide: true,
  1101. type:'select',
  1102. dicData:[
  1103. {
  1104. label:'正常',
  1105. value:0
  1106. },
  1107. {
  1108. label:'告警',
  1109. value:1
  1110. }
  1111. ],
  1112. rules: [{
  1113. required: true,
  1114. message: "请输入告警状态(0:正常;1:告警)",
  1115. trigger: "blur"
  1116. }]
  1117. },
  1118. {
  1119. label: "经度",
  1120. prop: "longitude",
  1121. hide:true,
  1122. span: 12,
  1123. rules: [{
  1124. required: true,
  1125. message: "请输入经度",
  1126. trigger: "blur"
  1127. }]
  1128. },
  1129. {
  1130. label: "纬度",
  1131. prop: "latitude",
  1132. hide:true,
  1133. span: 12,
  1134. rules: [{
  1135. required: true,
  1136. message: "请输入纬度",
  1137. trigger: "blur"
  1138. }]
  1139. },
  1140. {
  1141. label: "维护人员信息",
  1142. prop: "maintainer",
  1143. span: 12,
  1144. hide: true,
  1145. rules: [{
  1146. required: true,
  1147. message: "请输入维护人员信息",
  1148. trigger: "blur"
  1149. }]
  1150. },
  1151. {
  1152. label: "是否封存",
  1153. prop: "block",
  1154. span: 12,
  1155. hide: true,
  1156. type:'select',
  1157. dicData:[
  1158. {
  1159. label:'封存',
  1160. value:true
  1161. },
  1162. {
  1163. label:'不封存',
  1164. value:false
  1165. }
  1166. ],
  1167. rules: [{
  1168. required: true,
  1169. message: "请输入是否封存,true封存",
  1170. trigger: "blur"
  1171. }]
  1172. },
  1173. {
  1174. label: "封存时间",
  1175. prop: "blockTime",
  1176. span: 12,
  1177. hide: true,
  1178. rules: [{
  1179. required: true,
  1180. message: "请输入封存时间",
  1181. trigger: "blur"
  1182. }]
  1183. },
  1184. {
  1185. label: "路由器id",
  1186. prop: "routeId",
  1187. span: 12,
  1188. hide: true,
  1189. rules: [{
  1190. required: true,
  1191. message: "请输入路由器id",
  1192. trigger: "blur"
  1193. }]
  1194. },
  1195. {
  1196. // label: "摄像头类型 G:枪机 D:球机",
  1197. label: "摄像头类型",
  1198. prop: "equipType",
  1199. span: 12,
  1200. hide: true,
  1201. type:'select',
  1202. dicData:[
  1203. {
  1204. label:'枪机',
  1205. value:'G'
  1206. },
  1207. {
  1208. label:'球机',
  1209. value:'D'
  1210. }
  1211. ],
  1212. rules: [{
  1213. required: true,
  1214. message: "请输入摄像头类型 G:枪机 D:球机",
  1215. trigger: "blur"
  1216. }]
  1217. },
  1218. {
  1219. label: "设备最后状态更新时间",
  1220. prop: "updateStateTimeString",
  1221. span: 12,
  1222. hide: true,
  1223. rules: [{
  1224. required: true,
  1225. message: "请输入设备最后状态更新时间",
  1226. trigger: "blur"
  1227. }]
  1228. },
  1229. {
  1230. label: "设备监控位id",
  1231. prop: "districtId",
  1232. span: 12,
  1233. hide: true,
  1234. rules: [{
  1235. required: true,
  1236. message: "请输入设备监控位id",
  1237. trigger: "blur"
  1238. }]
  1239. },
  1240. {
  1241. // label: "存储位置(通过该字段快速查询,所有的子节点)机构树位置",
  1242. label: "存储位置",
  1243. prop: "orgPosition",
  1244. span: 12,
  1245. hide: true,
  1246. display:false,
  1247. rules: [{
  1248. required: true,
  1249. message: "请输入存储位置(通过该字段快速查询,所有的子节点)机构树位置",
  1250. trigger: "blur"
  1251. }]
  1252. },
  1253. {
  1254. label: "rtsp视频播放地址",
  1255. prop: "rtspUrl",
  1256. span: 12,
  1257. hide: true,
  1258. rules: [{
  1259. required: true,
  1260. message: "请输入rtsp视频播放地址",
  1261. trigger: "blur"
  1262. }]
  1263. },
  1264. {
  1265. label: "http-flv视频播放地址",
  1266. prop: "httpFlvUrl",
  1267. span: 12,
  1268. hide: true,
  1269. rules: [{
  1270. required: true,
  1271. message: "请输入http-flv视频播放地址",
  1272. trigger: "blur"
  1273. }]
  1274. },
  1275. {
  1276. label: "所属账户",
  1277. prop: "accountName",
  1278. span: 12,
  1279. hide: true,
  1280. rules: [{
  1281. required: true,
  1282. message: "请输入所属账户",
  1283. trigger: "blur"
  1284. }]
  1285. },
  1286. ]
  1287. },
  1288. bindOption: {
  1289. column: [
  1290. {
  1291. label: "所属小区",
  1292. prop: "residentialId",
  1293. type: "select",
  1294. search: true,
  1295. filterable: true,
  1296. span:24,
  1297. cascaderItem: ['buildingId'],
  1298. dicUrl: "/api/cyzh-community/residential/list?size=9999",
  1299. dicFormatter:(res)=>{
  1300. return res.data.records;//返回字典的层级结构
  1301. },
  1302. props: {
  1303. label: "name",
  1304. value: "id"
  1305. },
  1306. rules: [{
  1307. required: true,
  1308. message: "请选择所属小区",
  1309. trigger: "blur"
  1310. }]
  1311. },
  1312. {
  1313. label: "所属楼栋",
  1314. prop: "buildingId",
  1315. search: true,
  1316. type: "select",
  1317. span:24,
  1318. cascaderIndex: 0,
  1319. // dicFlag: true,
  1320. dicUrl: "/api/cyzh-community/building/list?residentialId={{key}}",
  1321. dicFormatter:(res) => {
  1322. return res.data.records;//返回字典层级结构
  1323. },
  1324. filterable: true,
  1325. props: {
  1326. label: "name",
  1327. value: "id"
  1328. },
  1329. }]
  1330. },
  1331. data: []
  1332. };
  1333. },
  1334. computed: {
  1335. ...mapGetters(["permission"]),
  1336. permissionList() {
  1337. return {
  1338. addBtn: this.vaildData(this.permission.vcdevice_add, false),
  1339. viewBtn: this.vaildData(this.permission.vcdevice_view, false),
  1340. delBtn: this.vaildData(this.permission.vcdevice_delete, false),
  1341. editBtn: this.vaildData(this.permission.vcdevice_edit, false),
  1342. startBtn: this.vaildData(this.permission.vcdevice_start, false),
  1343. stopBtn: this.vaildData(this.permission.vcdevice_stop, false),
  1344. playBtn: this.vaildData(this.permission.vcdevice_play, false)
  1345. };
  1346. },
  1347. ids() {
  1348. let ids = [];
  1349. this.selectionList.forEach(ele => {
  1350. ids.push(ele.id);
  1351. });
  1352. return ids.join(",");
  1353. }
  1354. },
  1355. methods: {
  1356. //同步设备
  1357. rowSync(row, index){
  1358. let that = this;
  1359. sync(row).then(res => {
  1360. if(res.data.success){
  1361. let result = res.data.data;
  1362. that.$set(that.data, index, result)
  1363. that.$message({
  1364. type: "success",
  1365. message: res.data.msg
  1366. });
  1367. }else{
  1368. that.$message({
  1369. type: "fail",
  1370. message: res.data.msg
  1371. });
  1372. }
  1373. })
  1374. },
  1375. //获取视频并开启
  1376. start(row){
  1377. let that = this;
  1378. this.getListLoading = true;
  1379. this.startBtnLoading = true;
  1380. let params = {"deviceNum" : row.deviceNum }
  1381. start(params).then(res => {
  1382. that.startBtnLoading = false;
  1383. if(res.data.success){
  1384. that.onLoad(this.page);
  1385. this.$message({
  1386. type: "success",
  1387. message: "获取视频地址成功,请点击播放"
  1388. });
  1389. }else{
  1390. this.$message({
  1391. type: "fail",
  1392. message: "保存失败,请检查地址是否可用!"
  1393. });
  1394. }
  1395. }).catch(error => {
  1396. that.startBtnLoading = false;
  1397. });
  1398. },
  1399. stop(row){
  1400. let that = this;
  1401. this.getListLoading = true;
  1402. let params = { "app": "live", "streamId" : row.deviceNum }
  1403. stop(params).then(res => {
  1404. that.onLoad(this.page);
  1405. this.$message({
  1406. type: "success",
  1407. message: "视频停用成功"
  1408. });
  1409. }).catch(error => {
  1410. that.getListLoading = false
  1411. });
  1412. },
  1413. play(row){
  1414. let that = this;
  1415. this.getListLoading = true;
  1416. let params = { "app": "live", "streamId" : row.deviceNum }
  1417. play(params).then(res => {
  1418. that.getListLoading = false;
  1419. that.$refs.devicePlayer.openDialog("streamPlay", null, null, {
  1420. streamInfo: res.data.data,
  1421. hasAudio: true
  1422. });
  1423. }).catch(error => {
  1424. that.getListLoading = false;
  1425. })
  1426. },
  1427. showVideo(row) {
  1428. // this.video.url = "http://139.9.103.171/live?port=1935&app=myapp&stream=" + row.id;
  1429. this.video.url = "ws://36.103.228.148:8888/live/" + row.id + ".flv";
  1430. this.video.name = row.deviceName;
  1431. this.videoVisible = true;
  1432. this.$nextTick(() => {
  1433. try {
  1434. let videoElement = document.getElementById('videoId');
  1435. let flvPlayer = flvjs.createPlayer({
  1436. type: 'flv',
  1437. url: this.video.url
  1438. });
  1439. flvPlayer.on(flvjs.Events.ERROR, (errType, errDetail) => {
  1440. // errType是 NetworkError时,对应errDetail有:Exception、HttpStatusCodeInvalid、ConnectingTimeout、EarlyEof、UnrecoverableEarlyEof
  1441. // errType是 MediaError时,对应errDetail是MediaMSEError
  1442. });
  1443. flvPlayer.on(flvjs.Events.MEDIA_SOURCE_CLOSE || flvjs.Events.MEDIA_SOURCE_ENDED, () => {})
  1444. flvPlayer.attachMediaElement(videoElement);
  1445. flvPlayer.load();
  1446. flvPlayer.play();
  1447. } catch (e) {
  1448. console.log(e);
  1449. }
  1450. })
  1451. },
  1452. showDeviceBindBatch() {
  1453. if (this.selectionList.length === 0) {
  1454. this.$message.warning("请选择至少一条数据");
  1455. return;
  1456. }
  1457. if (this.residentialList.length == 0) {
  1458. // 请求获取小区列表
  1459. getAllList().then(res => {
  1460. console.log(res.data.data);
  1461. this.residentialList = res.data.data;
  1462. this.selectValue = "";
  1463. this.bindBatchVisible = true;
  1464. })
  1465. } else {
  1466. this.selectValue = ""
  1467. this.bindBatchVisible = true;
  1468. }
  1469. // this.form = row;
  1470. },
  1471. showDeviceBind(row) {
  1472. if (this.residentialList.length == 0) {
  1473. // 请求获取小区列表
  1474. getAllList().then(res => {
  1475. this.residentialList = res.data.data;
  1476. this.selectValue = ""
  1477. this.bindVisible = true;
  1478. })
  1479. } else {
  1480. this.selectValue = ""
  1481. this.bindVisible = true;
  1482. }
  1483. this.bindForm = row;
  1484. },
  1485. bindBatchDevice(loading,done) {
  1486. // if (this.selectValue == "") {
  1487. // this.$message.warning("请选择所属小区");
  1488. // return;
  1489. // }
  1490. //保存
  1491. // debugger
  1492. bindResidentialBatch(this.ids, this.bindBatchForm.residentialId,this.bindBatchForm.buildingId).then(() => {
  1493. // debugger
  1494. this.bindBatchVisible = false;
  1495. this.bindBatchForm = {};
  1496. this.onLoad(this.page);
  1497. this.$message({
  1498. type: "success",
  1499. message: "操作成功!"
  1500. });
  1501. done();
  1502. }, error => {
  1503. loading();
  1504. console.log(error);
  1505. });
  1506. },
  1507. bindDevice(loading,done) {
  1508. // this.form.residentialId = this.selectValue;
  1509. //保存
  1510. updateVideoDevice(this.bindForm).then(() => {
  1511. this.onLoad(this.page);
  1512. this.bindVisible = false;
  1513. this.$message({
  1514. type: "success",
  1515. message: "操作成功!"
  1516. });
  1517. done();
  1518. }, error => {
  1519. loading();
  1520. console.log(error);
  1521. });
  1522. },
  1523. rowSave(row, done, loading) {
  1524. add(row).then(() => {
  1525. this.onLoad(this.page);
  1526. this.$message({
  1527. type: "success",
  1528. message: "操作成功!"
  1529. });
  1530. done();
  1531. }, error => {
  1532. loading();
  1533. window.console.log(error);
  1534. });
  1535. },
  1536. rowUpdate(row, index, done, loading) {
  1537. update(row).then(() => {
  1538. this.onLoad(this.page);
  1539. this.$message({
  1540. type: "success",
  1541. message: "操作成功!"
  1542. });
  1543. done();
  1544. }, error => {
  1545. loading();
  1546. console.log(error);
  1547. });
  1548. },
  1549. rowDel(row) {
  1550. this.$confirm("确定将选择数据删除?", {
  1551. confirmButtonText: "确定",
  1552. cancelButtonText: "取消",
  1553. type: "warning"
  1554. })
  1555. .then(() => {
  1556. return remove(row.id);
  1557. })
  1558. .then(() => {
  1559. this.onLoad(this.page);
  1560. this.$message({
  1561. type: "success",
  1562. message: "操作成功!"
  1563. });
  1564. });
  1565. },
  1566. handleDelete() {
  1567. if (this.selectionList.length === 0) {
  1568. this.$message.warning("请选择至少一条数据");
  1569. return;
  1570. }
  1571. this.$confirm("确定将选择数据删除?", {
  1572. confirmButtonText: "确定",
  1573. cancelButtonText: "取消",
  1574. type: "warning"
  1575. })
  1576. .then(() => {
  1577. return remove(this.ids);
  1578. })
  1579. .then(() => {
  1580. this.onLoad(this.page);
  1581. this.$message({
  1582. type: "success",
  1583. message: "操作成功!"
  1584. });
  1585. this.$refs.crud.toggleSelection();
  1586. });
  1587. },
  1588. beforeOpen(done, type) {
  1589. if (["edit", "view"].includes(type)) {
  1590. getDetail(this.form.id).then(res => {
  1591. this.form = res.data.data;
  1592. });
  1593. }
  1594. done();
  1595. },
  1596. searchReset() {
  1597. this.query = {};
  1598. this.onLoad(this.page);
  1599. },
  1600. searchChange(params, done) {
  1601. this.query = params;
  1602. this.page.currentPage = 1;
  1603. this.onLoad(this.page, params);
  1604. done();
  1605. },
  1606. selectionChange(list) {
  1607. this.selectionList = list;
  1608. },
  1609. selectionClear() {
  1610. this.selectionList = [];
  1611. this.$refs.crud.toggleSelection();
  1612. },
  1613. currentChange(currentPage) {
  1614. this.page.currentPage = currentPage;
  1615. },
  1616. sizeChange(pageSize) {
  1617. this.page.pageSize = pageSize;
  1618. },
  1619. refreshChange() {
  1620. this.onLoad(this.page, this.query);
  1621. },
  1622. edit(row) {
  1623. console.log(row,"编辑数据")
  1624. this.editForm = row;
  1625. this.editVisiable = true;
  1626. },
  1627. view(row) {
  1628. console.log(row,"详情数据")
  1629. this.detailForm = row;
  1630. this.detailVisible = true;
  1631. },
  1632. submitVideoclouddevice(row,done,loading) {
  1633. update(row).then(() => {
  1634. this.onLoad(this.page);
  1635. this.$message({
  1636. type: "success",
  1637. message: "操作成功!"
  1638. });
  1639. done();
  1640. }, error => {
  1641. loading();
  1642. console.log(error);
  1643. });
  1644. },
  1645. onLoad(page, params = {}) {
  1646. this.loading = true;
  1647. getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
  1648. const data = res.data.data;
  1649. this.page.total = data.total;
  1650. this.data = data.records;
  1651. this.loading = false;
  1652. this.selectionClear();
  1653. });
  1654. }
  1655. }
  1656. };
  1657. </script>
  1658. <style>
  1659. .el-dropdown-link {
  1660. cursor: pointer;
  1661. color: #409eff;
  1662. font-size: small;
  1663. margin-left: 10px;
  1664. }
  1665. </style>