index.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803
  1. <template>
  2. <div class="app-container">
  3. <!--工具栏-->
  4. <div class="head-container">
  5. <div v-if="crud.props.searchToggle">
  6. <el-input
  7. v-model="query.code"
  8. clearable
  9. size="small"
  10. placeholder="输入可视对讲编号"
  11. style="width: 160px"
  12. class="filter-item"
  13. @keyup.enter.native="crud.toQuery"
  14. />
  15. <el-input
  16. v-model="query.name"
  17. clearable
  18. size="small"
  19. placeholder="输入可视对讲名称"
  20. style="width: 160px"
  21. class="filter-item"
  22. @keyup.enter.native="crud.toQuery"
  23. />
  24. <el-select
  25. v-model="query.type"
  26. filterable
  27. clearable
  28. size="small"
  29. placeholder="请选择类型"
  30. class="filter-item"
  31. style="width: 160px"
  32. @change="crud.toQuery"
  33. >
  34. <el-option
  35. v-for="item in optionsObj.VisualIntercomType"
  36. :key="item.value"
  37. :label="item.label"
  38. :value="+item.value"
  39. />
  40. </el-select>
  41. <el-select
  42. v-model="query.buildId"
  43. filterable
  44. clearable
  45. size="small"
  46. placeholder="请选择建筑名称"
  47. class="filter-item"
  48. style="width: 160px"
  49. @change="handleChangeBuildId"
  50. >
  51. <el-option
  52. v-for="item in optionsObj.Build"
  53. :key="item.value"
  54. :label="item.label"
  55. :value="item.value"
  56. />
  57. </el-select>
  58. <el-select
  59. v-model="query.floorNo"
  60. filterable
  61. clearable
  62. size="small"
  63. placeholder="请选择楼层"
  64. class="filter-item"
  65. style="width: 160px"
  66. @change="crud.toQuery"
  67. >
  68. <el-option
  69. v-for="item in optionsObj.FloorNo"
  70. :key="item.value"
  71. :label="item.label"
  72. :value="item.value"
  73. />
  74. </el-select>
  75. <el-select
  76. v-model="query.faceRecognition"
  77. clearable
  78. size="small"
  79. placeholder="人脸识别"
  80. class="filter-item"
  81. style="width: 160px"
  82. @change="crud.toQuery"
  83. >
  84. <el-option
  85. v-for="item in 2"
  86. :key="item"
  87. :label="item == '1' ? '是' : '否'"
  88. :value="item == '1' ? true : false"
  89. />
  90. </el-select>
  91. <el-select
  92. v-model="query.enable"
  93. clearable
  94. size="small"
  95. placeholder="启用状态"
  96. class="filter-item"
  97. style="width: 160px"
  98. @change="crud.toQuery"
  99. >
  100. <el-option
  101. v-for="item in 2"
  102. :key="item"
  103. :label="item == '1' ? '启用' : '禁用'"
  104. :value="item == '1' ? true : false"
  105. />
  106. </el-select>
  107. <rrOperation />
  108. </div>
  109. <crudOperation :permission="permission" />
  110. </div>
  111. <!-- 表单组件 -->
  112. <el-dialog
  113. append-to-body
  114. :close-on-click-modal="false"
  115. :before-close="crud.cancelCU"
  116. :visible.sync="crudCU"
  117. :title="crud.status.title"
  118. width="1200px"
  119. >
  120. <el-row :gutter="40">
  121. <el-col :span="8">
  122. <el-form ref="form" :model="form" :rules="rules" size="small" label-width="100px">
  123. <el-form-item label="编号" prop="code">
  124. <el-input v-model="form.code" size="small" class="filter-item" style="width: 280px" />
  125. </el-form-item>
  126. <el-form-item label="名称" prop="name">
  127. <el-input v-model="form.name" size="small" class="filter-item" style="width: 280px" />
  128. </el-form-item>
  129. <el-form-item label="类型" prop="type">
  130. <el-select v-model="form.type" size="small" class="filter-item" style="width: 280px">
  131. <el-option
  132. v-for="item in optionsObj.VisualIntercomType"
  133. :key="item.value"
  134. :label="item.label"
  135. :value="+item.value"
  136. />
  137. </el-select>
  138. </el-form-item>
  139. <el-form-item label="建筑名称" prop="buildId">
  140. <el-select
  141. v-model="form.buildId"
  142. size="small"
  143. class="filter-item"
  144. style="width: 280px"
  145. disabled
  146. >
  147. <el-option
  148. v-for="item in optionsObj.Build"
  149. :key="item.value"
  150. :label="item.label"
  151. :value="item.value"
  152. />
  153. </el-select>
  154. </el-form-item>
  155. <el-form-item label="楼层" prop="floorNo">
  156. <el-input
  157. v-model="form.floorNo"
  158. size="small"
  159. class="filter-item"
  160. style="width: 280px"
  161. disabled
  162. />
  163. </el-form-item>
  164. <el-form-item label="高度" prop="height">
  165. <el-input
  166. v-model="form.height"
  167. size="small"
  168. class="filter-item"
  169. style="width: 280px"
  170. />
  171. </el-form-item>
  172. <el-form-item label="序列号" prop="sn">
  173. <el-input v-model="form.sn" size="small" class="filter-item" style="width: 280px" />
  174. </el-form-item>
  175. <el-form-item label="MAC地址" prop="mac">
  176. <el-input v-model="form.mac" size="small" class="filter-item" style="width: 280px" />
  177. </el-form-item>
  178. <el-form-item label="ip地址" prop="ip">
  179. <el-input v-model="form.ip" size="small" class="filter-item" style="width: 280px" />
  180. </el-form-item>
  181. <el-form-item label="端口号" prop="port">
  182. <el-input v-model="form.port" size="small" class="filter-item" style="width: 280px" />
  183. </el-form-item>
  184. <el-form-item label="用户名" prop="userName">
  185. <el-input
  186. v-model="form.userName"
  187. size="small"
  188. class="filter-item"
  189. style="width: 280px"
  190. />
  191. </el-form-item>
  192. <el-form-item label="密码" prop="password">
  193. <el-input
  194. v-model="form.password"
  195. show-password
  196. size="small"
  197. class="filter-item"
  198. style="width: 280px"
  199. />
  200. </el-form-item>
  201. <el-form-item label="关联摄像头" prop="cameraID">
  202. <el-select
  203. v-model="form.cameraID"
  204. size="small"
  205. class="filter-item"
  206. style="width: 280px"
  207. filterable
  208. clearable
  209. >
  210. <el-option
  211. v-for="item in optionsObj.Camera"
  212. :key="item.value"
  213. :label="item.label"
  214. :value="item.value"
  215. />
  216. </el-select>
  217. </el-form-item>
  218. <el-form-item label="人脸识别" prop="faceRecognition">
  219. <el-switch
  220. v-model="form.faceRecognition"
  221. active-color="#13ce66"
  222. inactive-color="#ff4949"
  223. :active-value="true"
  224. :inactive-value="false"
  225. >
  226. </el-switch>
  227. </el-form-item>
  228. <el-form-item label="备注" prop="remark">
  229. <el-input
  230. v-model="form.remark"
  231. size="small"
  232. class="filter-item"
  233. style="width: 280px"
  234. />
  235. </el-form-item>
  236. <el-form-item label="启用" prop="enable">
  237. <el-switch
  238. v-model="form.enable"
  239. active-color="#13ce66"
  240. inactive-color="#ff4949"
  241. :active-value="true"
  242. :inactive-value="false"
  243. >
  244. </el-switch>
  245. </el-form-item>
  246. </el-form>
  247. </el-col>
  248. <el-col :span="16">
  249. <relative-map
  250. v-if="crudCU"
  251. ref="relativeMap"
  252. v-model="mapData"
  253. drawShow
  254. :buildFloor="buildFloor"
  255. drawMode="Point"
  256. />
  257. </el-col>
  258. </el-row>
  259. <div slot="footer" class="dialog-footer">
  260. <el-button type="text" @click="crud.cancelCU"> 取消 </el-button>
  261. <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">
  262. 确认
  263. </el-button>
  264. </div>
  265. </el-dialog>
  266. <!--表格渲染-->
  267. <el-table
  268. ref="table"
  269. v-loading="crud.loading"
  270. :data="crud.data"
  271. style="width: 100%"
  272. @selection-change="crud.selectionChangeHandler"
  273. >
  274. <el-table-column type="selection" width="55" />
  275. <el-table-column
  276. v-for="item in visualIntercomConfigTableOptions"
  277. :key="item.prop"
  278. :label="item.label"
  279. :prop="item.prop"
  280. :width="item.width"
  281. :align="item.align"
  282. :fixed="item.fixed"
  283. :sortable="item.sortable"
  284. >
  285. </el-table-column>
  286. <!-- 编辑与删除 -->
  287. <el-table-column
  288. v-if="checkPer(['admin', 'visualintercom:config:edit', 'visualintercom:config:del'])"
  289. label="操作"
  290. width="130px"
  291. align="center"
  292. fixed="right"
  293. >
  294. <template slot-scope="scope">
  295. <udOperation :data="scope.row" :permission="permission" />
  296. </template>
  297. </el-table-column>
  298. </el-table>
  299. <!--分页组件-->
  300. <pagination />
  301. </div>
  302. </template>
  303. <script>
  304. import permission from '@/directive/permission'
  305. import crudVisualIntercom from '@/api/visualIntercom/config'
  306. import { getOptions } from '@/api/visualIntercom/public'
  307. import CRUD, { presenter, header, form, crud } from '@crud/crud'
  308. // import { crudOperation, rrOperation, udOperation, pagination } from '@crud'
  309. import crudComps from '@crud'
  310. import DateRangePicker from '@/components/DateRangePicker'
  311. import { visualIntercomConfigTableOptions } from '../tableConfig'
  312. import { initData } from '@/api/data'
  313. //import CameraMap from './cameraMap'
  314. import {
  315. isPosNumber,
  316. isNegNumber,
  317. isNumber,
  318. isPosInteger,
  319. isNegInteger,
  320. isInteger,
  321. } from '@/utils/validate'
  322. import RelativeMap from '@/components/RelativeMap'
  323. const defaultForm = {
  324. id: '0',
  325. code: '', //编号
  326. name: '', //名称
  327. type: '',
  328. buildId: '', //建筑ID
  329. floorNo: null, //楼层号
  330. location: null, //坐标
  331. height: 0, //高度
  332. faceRecognition: false,
  333. enable: true, //是否显示在GIS
  334. sn: '', //序列号
  335. mac: '', //mac地址
  336. ip: '', //ip地址
  337. port: '', //端口号
  338. userName: '', //用户名
  339. password: '', // 密码
  340. cameraID: '', // 绑定摄像头
  341. remark: '', //备注
  342. }
  343. export default {
  344. name: 'Robot',
  345. directives: { permission },
  346. mixins: [presenter(), header(), form(defaultForm), crud()],
  347. components: { ...crudComps, DateRangePicker, RelativeMap },
  348. cruds() {
  349. return CRUD({
  350. title: '可视对讲配置',
  351. url: 'visualIntercom/config/getPageListJson',
  352. listOrder: [],
  353. crudMethod: { ...crudVisualIntercom },
  354. optShow: {
  355. add: true,
  356. edit: true,
  357. del: true,
  358. reset: true,
  359. import: true,
  360. export: true,
  361. },
  362. robotList: [
  363. {
  364. id: '', //主键ID
  365. modelId: '', //模型ID
  366. number: '', //设备编号
  367. category: '', //设备类型
  368. issueDate: '', //发售时间
  369. sequence: '', //出厂号
  370. title: '', //名称
  371. profile: '', //头像
  372. desc: '', //描述
  373. func: '', //功能说明
  374. battery: '', //剩余电量
  375. deviceStatus: '', //设备状态
  376. taskMode: '', //机器人任务执行模式
  377. createTime: '', //创建时间
  378. },
  379. ],
  380. recognizeTypeList: [
  381. {
  382. id: '', //主键ID
  383. name: '', //识别类型名称
  384. code: '', //编号
  385. desc: '', //描述信息
  386. createTime: '', //创建时间
  387. },
  388. ],
  389. areaTree: {
  390. id: '', //主键ID
  391. parentId: '', //父节点ID
  392. parent: '', //父节点名称
  393. path: '', //区域树路径
  394. level: '', //层级
  395. sort: '', //排序比重值
  396. name: '', //区域名称
  397. memo: '', //备注
  398. editor: '', //编辑人
  399. createTime: '', //创建时间
  400. subList: '', //下级区域节点
  401. naviList: '', //下辖导航点
  402. },
  403. navPointList: [
  404. {
  405. id: '', //主键ID
  406. robotId: '', //机器人ID
  407. robot: '', //机器人名称
  408. mapId: '', //地图ID
  409. map: '', //地图名称
  410. areaId: '', //区域ID
  411. area: '', //区域名称
  412. alias: '', //导航点别名
  413. naviType: '', //导航点类型
  414. sequence: '', //导航点编号
  415. coordinateX: '', //横坐标
  416. coordinateY: '', //纵坐标
  417. yaw: '', //航向角
  418. longitude: '', //经度
  419. latitude: '', //维度
  420. distance: '', //与原点距离
  421. chargingDeviceId: '', //充电设备ID
  422. positionCount: '', //巡检点个数
  423. positionList: '', //巡检点列表
  424. createTime: '', //创建时间
  425. },
  426. ],
  427. patrolPostionList: [
  428. {
  429. id: '', //主键ID
  430. robotId: '', //机器人ID
  431. mapId: '', //地图ID
  432. areaId: '', //区域ID
  433. area: '', //区域名称
  434. naviId: '', //导航点ID
  435. naviSequence: '', //导航点别名
  436. indicatorId: '', //指标ID
  437. indicatorName: '', //指标名称
  438. categoryId: '', //指标类目ID
  439. categoryName: '', //指标类目名称
  440. recognizeId: '', //识别类型ID
  441. recognizeName: '', //识别类型名称
  442. recognizeCode: '', //识别类型编码
  443. regionSequence: '', //区域编号
  444. panRotateAngleLocationH: '', //云台水平算法定位转动角度
  445. panRotateAngleLocationV: '', //云台垂直算法定位转动角度
  446. panRotateAngleRecognizeH: '', //云台水平算法识别转动角度
  447. panRotateAngleRecognizeV: '', //云台垂直算法识别转动角度
  448. visibleCameraLocationZoom: '', //可见光相机算法定位变焦
  449. visibleCameraLocationFocus: '', //可见光相机算法定位聚焦
  450. visibleCameraRecognizeZoom: '', //可见光相机算法识别变焦
  451. visibleCameraRecognizeFocus: '', //可见光相机算法识别聚焦
  452. infraredCameraRadiation: '', //红外相机辐射
  453. infraredCameraZoom: '', //红外相机变焦
  454. infraredCameraFocus: '', //红外相机聚焦
  455. infraredDistance: '', //红外线距离
  456. needFillLight: '', //是否开启补光灯
  457. hasObstacle: '', //是否有障碍
  458. recordVoiceSecond: '', //录音时间
  459. cycleTaskPicturePtzStepDegree: '', //循环拍照的步长
  460. cycleRangeDegree: '', //环测范围
  461. cycleIsClockwise: '', //环测旋转方向
  462. cyclePtzSpeed: '', //环测转动速度
  463. sceneList: '', //已设置阈值场景列表
  464. resourceList: [
  465. {
  466. id: '', //主键ID
  467. mapId: '', //地图ID
  468. naviId: '', //导航点ID
  469. positionId: '', //巡检点ID
  470. index: '', //序号
  471. type: '', //资源类型
  472. url: '', //资源路径
  473. createTime: '', //创建时间
  474. },
  475. ], //算法资源列表
  476. createTime: '', //创建时间
  477. },
  478. ],
  479. taskList: [
  480. {
  481. //任务
  482. id: '', //主键ID
  483. periodicTaskId: '', //任务模板ID
  484. orgId: '', //组织ID
  485. robotId: '', //机器人Id
  486. robot: '', //机器人名称
  487. mapId: '', //地图ID
  488. map: '', //地图名称
  489. sceneId: '', //巡检场景ID
  490. scene: '', //场景名称
  491. title: '', //任务名称
  492. type: '', //任务类型
  493. taskFrom: '', //任务下发来源
  494. priority: '', //任务优先级
  495. exitOnPrior: '', //遇更高优先级任务提前终止
  496. finalJob: '', //任务完成后指令
  497. scheduleTime: '', //计划开始时间
  498. beginTime: '', //任务开始时间
  499. endTime: '', //任务结束时间
  500. state: '', //任务状态
  501. progress: '', //运行进度
  502. totalNumber: '', //须检测总数
  503. finishedNumber: '', //已检测总数
  504. defectNumber: '', //缺陷总数
  505. unrecognizeNumber: '', //未识别总数
  506. areaList: '', //关联区域列表
  507. positionList: '', //检测点列表
  508. nextPosition: '', //当前任务下一个检测点位
  509. editor: '', //编辑人
  510. createTime: '', //创建时间
  511. },
  512. ],
  513. patrolRecordList: [
  514. {
  515. id: '', //主键ID
  516. orgId: '', //组织ID
  517. robotId: '', //机器人ID
  518. robot: '', //机器人名称
  519. taskId: '', //任务ID
  520. task: '', //任务名称
  521. sceneId: '', //场景ID
  522. scene: '', //场景名称
  523. mapId: '', //地图ID
  524. map: '', //地图名称
  525. areaId: '', //区域ID
  526. area: '', //区域名称
  527. naviId: '', //导航点ID
  528. naviSequence: '', //导航点编号
  529. positionId: '', //巡检点ID
  530. indicatorId: '', //指标ID
  531. indicatorName: '', //指标名称
  532. categoryId: '', //指标类目ID
  533. categoryName: '', //指标类目名称
  534. recognizeId: '', //识别类型ID
  535. recognizeCode: '', //识别类型编码
  536. recognizeName: '', //识别类型名称
  537. unit: '', //单位
  538. index: '', //序号
  539. patrolTime: '', //巡检时间
  540. recognizeState: '', //识别状态
  541. thresholdId: '', //识别阈值ID
  542. defectGrade: '', //缺陷等级
  543. value: '', //检测值
  544. detail: '', //检测值明细
  545. adjustTime: '', //矫正时间
  546. recognizeTime: '', //识别时间
  547. modifiedGrade: '', //修正后等级
  548. defectReview: '', //缺陷追溯
  549. reviewMemo: '', //缺陷审核备注
  550. reviewState: '', //缺陷处理状态
  551. confirmTime: '', //缺陷确认时间
  552. reviewerId: '', //缺陷确认人ID
  553. reviewer: '', //缺陷确认人名
  554. solveTime: '', //缺陷解决时间
  555. solverId: '', //缺陷解决人ID
  556. solver: '', //缺陷解决人名
  557. guardLine: '', //警戒线
  558. resourceList: [
  559. {
  560. index: '', //序号
  561. type: '', //资源类型
  562. originUrl: '', //原始资源路径
  563. processedUrl: '', //已处理资源路径
  564. },
  565. ], //算法资源列表
  566. createTime: '', //创建时间
  567. },
  568. ],
  569. RobotRealtimeInfoList: [
  570. {
  571. id: '', //主键ID
  572. orgId: '', //组织ID
  573. robotId: '', //机器人ID
  574. robot: '', //机器人名称
  575. taskId: '', //任务ID
  576. task: '', //任务名称
  577. sceneId: '', //场景ID
  578. scene: '', //场景名称
  579. mapId: '', //地图ID
  580. map: '', //地图名称
  581. areaId: '', //区域ID
  582. area: '', //区域名称
  583. naviId: '', //导航点ID
  584. naviSequence: '', //导航点编号
  585. positionId: '', //巡检点ID
  586. indicatorId: '', //指标ID
  587. indicatorName: '', //指标名称
  588. categoryId: '', //指标类目ID
  589. categoryName: '', //指标类目名称
  590. recognizeId: '', //识别类型ID
  591. recognizeCode: '', //识别类型编码
  592. recognizeName: '', //识别类型名称
  593. unit: '', //单位
  594. index: '', //序号
  595. patrolTime: '', //巡检时间
  596. recognizeState: '', //识别状态
  597. thresholdId: '', //识别阈值ID
  598. defectGrade: '', //缺陷等级
  599. value: '', //检测值
  600. detail: '', //检测值明细
  601. adjustTime: '', //矫正时间
  602. recognizeTime: '', //识别时间
  603. modifiedGrade: '', //修正后等级
  604. defectReview: '', //缺陷追溯
  605. reviewMemo: '', //缺陷审核备注
  606. reviewState: '', //缺陷处理状态
  607. confirmTime: '', //缺陷确认时间
  608. reviewerId: '', //缺陷确认人ID
  609. reviewer: '', //缺陷确认人名
  610. solveTime: '', //缺陷解决时间
  611. solverId: '', //缺陷解决人ID
  612. solver: '', //缺陷解决人名
  613. guardLine: '', //警戒线
  614. resourceList: [
  615. {
  616. id: '', //主键ID
  617. orgId: '', //组织ID
  618. robotId: '', //机器人ID
  619. robot: '', //机器人名称
  620. mapId: '', //地图ID
  621. health: '', //机器人本体是否正常
  622. reportTime: '', //上报时间
  623. leftWheelSpeed: '', //左轮速度
  624. rightWheelSpeed: '', //右轮速度
  625. speed: '', //实时速度
  626. angularSpeed: '', //实时角速度
  627. cpuUsed: '', //CPU使用率
  628. memUsed: '', //内存使用率
  629. diskUsed: '', //磁盘使用率
  630. batteryRatio: '', //剩余电量比率
  631. batteryVolt: '', //当前电池电压
  632. batteryCurrent: '', //当前电池电流
  633. temperature: '', //舱内温度
  634. humidity: '', //舱内湿度
  635. mileage: '', //当前行驶里程
  636. rotation: '', //当前旋转角度
  637. direction: '', //当前行驶方向
  638. distance: '', //距原点距离
  639. laserDistance: '', //激光距离
  640. panRotateAngleH: '', //云台水平转动角度
  641. panRotateAngleV: '', //云台垂直转动角度
  642. visibleFocus: '', //可见光相机焦距
  643. visibleZoom: '', //可见光相机变焦
  644. infraredFocus: '', //红外相机焦距
  645. coordinateX: '', //横坐标
  646. coordinateY: '', //纵坐标
  647. yaw: '', //航向角
  648. longitude: '', //经度
  649. latitude: '', //维度
  650. controlSysState: '', //控制系统状态
  651. chargeSysState: '', //充电系统状态
  652. visibleCameraState: '', //可见光相机状态
  653. infraredCameraState: '', //红外相机状态
  654. panState: '', //云台状态
  655. bridgeState: '', //网桥状态
  656. laserObstacleState: '', //激光避障器状态
  657. mmwObstacleState: '', //毫米波避障器状态
  658. backObstacleState: '', //后置避障器状态
  659. pitObstacleState: '', //测坑避障器状态
  660. wiperState: '', //雨刷状态
  661. lightState: '', //补光灯状态
  662. recordState: '', //录音状态
  663. intercomState: '', //对讲机状态
  664. eStopState: '', //急停按钮状态
  665. runState: '', //机器人运行状态
  666. taskMode: '', //机器人任务执行模式
  667. createTime: '', //创建时间
  668. },
  669. ], //算法资源列表
  670. createTime: '', //创建时间
  671. },
  672. ],
  673. })
  674. },
  675. computed: {
  676. crudCU() {
  677. return this.crud.status.cu > 0
  678. },
  679. VUE_APP_BASE_API() {
  680. return process.env.VUE_APP_BASE_API
  681. },
  682. VUE_APP_BASE_WS() {
  683. return 'ws://' + window.location.host + process.env.VUE_APP_BASE_API
  684. },
  685. },
  686. data() {
  687. var chackHeight = (rule, value, callback) => {
  688. if (!isPosNumber(value)) return callback(new Error('请输入正确的高度'))
  689. return callback()
  690. }
  691. return {
  692. visualIntercomConfigTableOptions,
  693. permission: {
  694. add: ['admin', 'visualintercom:config:add'],
  695. edit: ['admin', 'visualintercom:config:edit'],
  696. del: ['admin', 'visualintercom:config:del'],
  697. },
  698. rules: {
  699. code: [{ required: true, message: '请选输入编号', trigger: 'blur' }],
  700. name: [{ required: true, message: '请输入名称', trigger: 'blur' }],
  701. type: [{ required: true, message: '选择类型', trigger: 'blur' }],
  702. buildId: [{ required: true, message: '请在地图上画点', trigger: 'blur' }],
  703. floorNo: [{ required: true, message: '请在地图上画点', trigger: 'blur' }],
  704. height: [{ required: true, validator: chackHeight, trigger: 'blur' }],
  705. ip: [{ required: true, message: '请输入IP地址', trigger: 'blur' }],
  706. userName: [{ required: true, message: '请输入用户名', trigger: 'blur' }],
  707. },
  708. optionsObj: {
  709. Camera: [],
  710. Build: [],
  711. FloorNo: [],
  712. VisualIntercomType: [],
  713. },
  714. mapData: [],
  715. buildFloor: {},
  716. }
  717. },
  718. created() {
  719. this.getOptions()
  720. },
  721. methods: {
  722. [CRUD.HOOK.beforeToAdd]() {
  723. this.mapData = []
  724. this.buildFloor = {}
  725. },
  726. // 打开
  727. [CRUD.HOOK.beforeToEdit]() {
  728. this.mapData = [
  729. {
  730. buildId: this.form.buildId,
  731. floorNo: this.form.floorNo,
  732. geometries: [
  733. {
  734. type: 'Point',
  735. points: [{ x: this.form.location.x, y: this.form.location.y }],
  736. },
  737. ],
  738. },
  739. ]
  740. this.buildFloor = {
  741. buildId: this.form.buildId,
  742. floorNo: this.form.floorNo,
  743. }
  744. },
  745. //验证前处理
  746. [CRUD.HOOK.beforeValidateCU]() {
  747. if (
  748. this.mapData &&
  749. this.mapData.length > 0 &&
  750. this.mapData[0].geometries &&
  751. this.mapData[0].geometries.length > 0 &&
  752. this.mapData[0].geometries[0].points &&
  753. this.mapData[0].geometries[0].points.length > 0
  754. ) {
  755. this.form.buildId = this.mapData[0].buildId
  756. this.form.floorNo = this.mapData[0].floorNo
  757. this.form.location = {
  758. buildId: this.mapData[0].buildId,
  759. floorNo: this.mapData[0].floorNo,
  760. x: this.mapData[0].geometries[0].points[0].x,
  761. y: this.mapData[0].geometries[0].points[0].y,
  762. }
  763. } else {
  764. this.$message.error('请绘制正确的点')
  765. return false
  766. }
  767. },
  768. // 提交前的验证
  769. [CRUD.HOOK.afterValidateCU]() {},
  770. async handleChangeBuildId(val) {
  771. await this.getFloorNoOption(val)
  772. this.crud.toQuery()
  773. },
  774. getOptions() {
  775. Object.keys(this.optionsObj).forEach(async (key) => {
  776. if (key == 'FloorNo') return
  777. try {
  778. let res = await getOptions(key)
  779. if (res.code === 20000) this.optionsObj[key] = res.data.content
  780. } catch (error) {
  781. console.log(error)
  782. }
  783. })
  784. },
  785. async getFloorNoOption(buildId) {
  786. try {
  787. let res = await getOptions('FloorNo', { buildId: buildId })
  788. if (res.code === 20000) {
  789. this.optionsObj.FloorNo = res.data.content
  790. this.query.floorNo = null
  791. }
  792. } catch (error) {}
  793. },
  794. },
  795. }
  796. </script>
  797. <style></style>