Bläddra i källkod

泄漏激光云台配置页面增加

fbw 2 år sedan
förälder
incheckning
dd0b9a6732

+ 27 - 0
src/api/laserPtz/config.js

@@ -0,0 +1,27 @@
+import request from '@/utils/request'
+
+export function add(data) {
+  return request({
+    url: 'leak/laserPtz/config/insert',
+    method: 'post',
+    data
+  })
+}
+
+export function del(ids) {
+  return request({
+    url: 'leak/laserPtz/config/delete',
+    method: 'post',
+    data: ids
+  })
+}
+
+export function edit(data) {
+  return request({
+    url: 'leak/laserPtz/config/update',
+    method: 'post',
+    data
+  })
+}
+
+export default { add, edit, del }

+ 9 - 0
src/api/laserPtz/public.js

@@ -0,0 +1,9 @@
+import request from '@/utils/request'
+
+export function getOptions(type, data) {
+  return request({
+    url: `leak/laserPtz/options/get${type}Options`,
+    method: 'post',
+    data
+  })
+}

+ 205 - 0
src/views/leak/laserPtz/alarm/index.vue

@@ -0,0 +1,205 @@
+<template>
+  <div class="app-container">
+    <!--工具栏-->
+    <div class="head-container">
+      <div v-if="crud.props.searchToggle">
+        <el-select
+          v-model="query.perimeterId"
+          filterable
+          clearable
+          size="small"
+          placeholder="请选择周界"
+          class="filter-item"
+          style="width: 160px"
+          @change="perimeterChangeHandle"
+        >
+          <el-option
+            v-for="item in optionsObj.Perimeter"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value"
+          />
+        </el-select>
+        <el-select
+          v-model="query.segmentId"
+          filterable
+          clearable
+          size="small"
+          placeholder="请选择分段"
+          class="filter-item"
+          style="width: 160px"
+          @change="crud.toQuery"
+        >
+          <el-option
+            v-for="item in optionsObj.Segment"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value"
+          />
+        </el-select>
+        <el-select
+          v-model="query.type"
+          filterable
+          clearable
+          size="small"
+          placeholder="请选择报警类型"
+          class="filter-item"
+          style="width: 160px"
+          @change="crud.toQuery"
+        >
+          <el-option
+            v-for="item in optionsObj.AlarmType"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value"
+          />
+        </el-select>
+        <date-range-picker
+          type="datetimerange"
+          v-model="customs.timeRange"
+          class="date-item"
+          style="width: 400px !important"
+          @change="crud.toQuery"
+        />
+        <rrOperation />
+      </div>
+      <crudOperation :permission="permission"></crudOperation>
+    </div>
+    <el-dialog
+      append-to-body
+      :close-on-click-modal="false"
+      :visible.sync="dialogVisible"
+      title="报警地图"
+      width="800px"
+    >
+      
+    </el-dialog>
+    <!--表格渲染-->
+    <el-table
+      ref="table"
+      v-loading="crud.loading"
+      :data="crud.data"
+      style="width: 100%"
+      @selection-change="crud.selectionChangeHandler"
+    >
+      <!-- <el-table-column type="selection" width="55" /> -->
+      <el-table-column
+        v-for="item in perimeterAlarmTableOptions"
+        :key="item.prop"
+        :label="item.label"
+        :prop="item.prop"
+        :width="item.width"
+        :align="item.align"
+        :fixed="item.fixed"
+        :sortable="item.sortable"
+      >
+      </el-table-column>
+      <el-table-column label="操作" width="130px" align="center" fixed="right">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="success"
+            icon="el-icon-view"
+            @click="toView(scope.row)"
+            style="margin-right: 5px"
+          />
+        </template>
+      </el-table-column>
+    </el-table>
+    <!--分页组件-->
+    <pagination />
+  </div>
+</template>
+
+<script>
+import permission from '@/directive/permission'
+import DateRangePicker from '@/components/DateRangePicker'
+import { getOptions } from '@/api/perimeter/public'
+import CRUD, { presenter, header, form, crud } from '@crud/crud'
+// import { crudOperation, rrOperation, udOperation, pagination } from '@crud'
+import crudComps from '@crud'
+import { perimeterAlarmTableOptions } from '../../tableConfig'
+import Dayjs from 'dayjs'
+const defaultForm = {
+  id: '',
+}
+
+export default {
+  name: 'PerimeterAlarm',
+  directives: { permission },
+  mixins: [presenter(), header(), form(defaultForm), crud()],
+  components: { ...crudComps, DateRangePicker },
+  cruds() {
+    return CRUD({
+      title: '周界报警记录',
+      url: 'perimeter/alarm/getListJson',
+      listOrder: [],
+      //crudMethod: { ...crudRailAreaInOutLog },
+      optShow: { add: false, edit: false, del: false },
+    })
+  },
+  computed: {
+    crudCU() {
+      return this.crud.status.cu > 0
+    },
+    VUE_APP_BASE_API() {
+      return process.env.VUE_APP_BASE_API
+    },
+  },
+  created() {
+    this.getOptions()
+  },
+  data() {
+    return {
+      dialogVisible: false,
+      dialogType: '',
+      datetimeRange: undefined,
+      perimeterAlarmTableOptions,
+      viewLoading: false,
+      permission: {},
+      optionsObj: {
+        Perimeter: [],
+        Segment: [],
+        AlarmType: [],
+      },
+    }
+  },
+  methods: {
+    toView(data) {
+      this.form = data
+      ;(this.dialogType = 'view'), (this.dialogVisible = true)
+    },
+    closeDialog() {
+      this.dialogVisible = false
+    },
+    async perimeterChangeHandle(data) {
+      this.query.minorType = ''
+      if (data) await this.getSegmentOptions(data)
+      else this.optionsObj['Segment'] = []
+      this.crud.toQuery()
+    },
+    async getOptions() {
+      Object.keys(this.optionsObj).forEach(async (key) => {
+        if (key == 'Segment') return
+        try {
+          let res = await getOptions(key)
+          if (res.code === 20000) this.optionsObj[key] = res.data.content
+        } catch (error) {
+          console.log(error)
+        }
+      })
+    },
+    async getSegmentOptions(data) {
+      try {
+        this.optionsObj['Segment'] = []
+        let res = await getOptions('Segment', { id: data })
+        if (res.code === 20000) this.optionsObj['Segment'] = res.data.content
+      } catch (error) {
+        console.log(error)
+      }
+    },
+  },
+}
+</script>
+
+<style></style>

+ 420 - 0
src/views/leak/laserPtz/config/index.vue

@@ -0,0 +1,420 @@
+<template>
+  <div class="app-container">
+    <!--工具栏-->
+    <div class="head-container">
+      <div v-if="crud.props.searchToggle">
+        <el-input
+          v-model="query.code"
+          clearable
+          size="small"
+          placeholder="输入编号"
+          style="width: 160px"
+          class="filter-item"
+          @keyup.enter.native="crud.toQuery"
+        />
+        <el-input
+          v-model="query.name"
+          clearable
+          size="small"
+          placeholder="输入名称"
+          style="width: 160px"
+          class="filter-item"
+          @keyup.enter.native="crud.toQuery"
+        />
+        <el-select
+          v-model="query.type"
+          filterable
+          clearable
+          size="small"
+          placeholder="请选择类型"
+          class="filter-item"
+          style="width: 160px"
+          @change="crud.toQuery"
+        >
+          <el-option
+            v-for="item in optionsObj.LaserPtzType"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value"
+          />
+        </el-select>
+        <el-select
+          v-model="query.buildId"
+          filterable
+          clearable
+          size="small"
+          placeholder="请选择建筑名称"
+          class="filter-item"
+          style="width: 160px"
+          @change="crud.toQuery"
+        >
+          <el-option
+            v-for="item in optionsObj.Build"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value"
+          />
+        </el-select>
+        <rrOperation />
+      </div>
+      <crudOperation :permission="permission" />
+    </div>
+    <!-- 表单组件 -->
+    <el-dialog
+      append-to-body
+      :close-on-click-modal="false"
+      :before-close="crud.cancelCU"
+      :visible.sync="crudCU"
+      :title="crud.status.title"
+      width="1200px"
+    >
+      <el-row :gutter="40">
+        <el-col :span="8">
+          <el-form ref="form" :model="form" :rules="rules" size="small" label-width="100px">
+            <el-form-item label="编号" prop="code">
+              <el-input v-model="form.code" size="small" style="width: 280px" />
+            </el-form-item>
+            <el-form-item label="名称" prop="name">
+              <el-input v-model="form.name" size="small" style="width: 280px" />
+            </el-form-item>
+            <el-form-item label="类型" prop="type">
+              <el-select
+                v-model="form.type"
+                size="small"
+                style="width: 280px"
+              >
+                <el-option
+                  v-for="item in optionsObj.LaserPtzType"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="+item.value"
+                />
+              </el-select>
+            </el-form-item>
+            <el-form-item label="建筑名称" prop="buildId">
+              <el-select
+                v-model="form.buildId"
+                size="small"
+                style="width: 280px"
+                disabled
+              >
+                <el-option
+                  v-for="item in optionsObj.Build"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value"
+                />
+              </el-select>
+            </el-form-item>
+            <el-form-item label="摄像头" prop="cameraId">
+              <el-select
+                v-model="form.cameraId"
+                size="small"
+                style="width: 280px"
+              >
+                <el-option
+                  v-for="item in optionsObj.Camera"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value"
+                />
+              </el-select>
+            </el-form-item>
+            <el-form-item label="高度" prop="height">
+              <el-input-number
+                v-model="form.height"
+                size="small"
+                :min="0"
+                style="width: 280px"
+              />
+            </el-form-item>
+            <el-form-item label="起始角度" prop="startAngle">
+              <el-input-number
+                v-model="form.startAngle"
+                size="small"
+                :min="0" :max="360"
+                style="width: 280px"
+              />
+            </el-form-item>
+            <el-form-item label="结束角度" prop="endAngle">
+              <el-input-number
+                v-model="form.endAngle"
+                size="small"
+                :min="0" :max="360"
+                style="width: 280px"
+              />
+            </el-form-item>
+            <el-form-item label="半径" prop="radius">
+              <el-input-number
+                v-model="form.radius"
+                size="small"
+                :min="0"
+                style="width: 280px"
+              />
+            </el-form-item>
+            <el-form-item label="浓度标签" prop="concentrationTag">
+              <tag-select-simple
+                v-model="form.concentrationTag"
+                size="small"
+                style="width: 280px"
+              />
+            </el-form-item>
+            <el-form-item label="光强标签" prop="lightIntensityTag">
+              <tag-select-simple
+                v-model="form.lightIntensityTag"
+                size="small"
+                style="width: 280px"
+              />
+            </el-form-item>
+            <el-form-item label="水平位置标签" prop="panTag">
+              <tag-select-simple
+                v-model="form.panTag"
+                size="small"
+                style="width: 280px"
+              />
+            </el-form-item>
+            <el-form-item label="垂直位置标签" prop="tileTag">
+              <tag-select-simple
+                v-model="form.tileTag"
+                size="small"
+                style="width: 280px"
+              />
+            </el-form-item>
+            <el-form-item label="备注" prop="remark">
+              <el-input
+                v-model="form.remark"
+                type="textarea"
+                autosize
+                clearable
+                size="small"
+                style="width: 280px"
+              />
+            </el-form-item>
+          </el-form>
+        </el-col>
+        <el-col :span="16">
+          <relative-map
+            v-if="crudCU"
+            ref="RelativeMap"
+            :buildFloor="buildFloor"
+            v-model="mapData"
+            drawShow
+            drawMode="Point"
+            :lineLengthShow="true"
+          />
+        </el-col>
+      </el-row>
+
+      <div slot="footer" class="dialog-footer">
+        <el-button type="text" @click="crud.cancelCU"> 取消 </el-button>
+        <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">
+          确认
+        </el-button>
+      </div>
+    </el-dialog>
+    <!--表格渲染-->
+    <el-table
+      ref="table"
+      v-loading="crud.loading"
+      :data="crud.data"
+      style="width: 100%"
+      @selection-change="crud.selectionChangeHandler"
+    >
+      <el-table-column type="selection" width="55" />
+      <el-table-column
+        v-for="item in laserPtzConfigConfigTableOptions"
+        :key="item.prop"
+        :label="item.label"
+        :prop="item.prop"
+        :width="item.width"
+        :align="item.align"
+        :fixed="item.fixed"
+        :sortable="item.sortable"
+      >
+        <template slot-scope="scope">
+          <img
+            style="width: 32px; height: 32px"
+            v-if="item.prop === 'iconPath'"
+            :src="VUE_APP_BASE_API + scope.row.iconPath"
+            alt=""
+          />
+          <span v-else>{{ scope.row[item.prop] }}</span>
+        </template>
+      </el-table-column>
+      <!--   编辑与删除   -->
+      <el-table-column
+        v-if="checkPer(['admin', 'leak:laserptz:config:edit', 'leak:laserptz:config:del'])"
+        label="操作"
+        width="130px"
+        align="center"
+        fixed="right"
+      >
+        <template slot-scope="scope">
+          <udOperation :data="scope.row" :permission="permission" />
+        </template>
+      </el-table-column>
+    </el-table>
+    <!--分页组件-->
+    <pagination />
+  </div>
+</template>
+
+<script>
+import permission from '@/directive/permission'
+import crudMethod from '@/api/leak/laserPtz/config'
+import { getOptions as getOptions2 } from '@/api/options'
+import { getOptions } from '@/api/leak/laserPtz/public'
+import CRUD, { presenter, header, form, crud } from '@crud/crud'
+// import { crudOperation, rrOperation, udOperation, pagination } from '@crud'
+import crudComps from '@crud'
+import DateRangePicker from '@/components/DateRangePicker'
+import TagSelectSimple from '@/components/TagSelectSimple'
+import { laserPtzConfigConfigTableOptions } from '../../tableConfig'
+
+import RelativeMap from '@/components/RelativeMap'
+
+const defaultForm = {
+  id: '0',
+  code: '', //编号
+  name: '', //名称
+  type:'',//类型
+  buildId: '', //建筑ID
+  floorNo: 0, //楼层号
+  location: {}, //坐标
+  height: 0,//高度
+  startAngle: 0,//起始角度
+  endAngle: 0,//结束角度
+  radius:0,//半径
+  cameraId: null,//摄像头ID
+  concentrationTag: null,//浓度标签
+  lightIntensityTag: null,//光强标签
+  panTag: null,//水平位置标签
+  tileTag: null,//垂直位置标签
+  remark: '', //备注
+}
+
+export default {
+  name: 'LeakLaserPtzConfig',
+  directives: { permission },
+  mixins: [presenter(), header(), form(defaultForm), crud()],
+  components: { ...crudComps, DateRangePicker, RelativeMap, TagSelectSimple },
+  cruds() {
+    return CRUD({
+      title: '泄露检测激光云台',
+      url: 'leak/laserPtz/config/getList',
+      listOrder: [],
+      crudMethod: { ...crudMethod },
+    })
+  },
+  computed: {
+    crudCU() {
+      return this.crud.status.cu > 0
+    },
+    VUE_APP_BASE_API() {
+      return process.env.VUE_APP_BASE_API
+    },
+    VUE_APP_BASE_WS() {
+      return 'ws://' + window.location.host + process.env.VUE_APP_BASE_API
+    },
+  },
+  data() {
+    return {
+      laserPtzConfigConfigTableOptions,
+      permission: {
+        add: ['admin', 'leak:laserptz:config:add'],
+        edit: ['admin', 'leak:laserptz:config:edit'],
+        del: ['admin', 'leak:laserptz:config:del'],
+      },
+      rules: {
+        code: [{ required: true, message: '请输入编号', trigger: 'blur' }],
+        name: [{ required: true, message: '请输入名称', trigger: 'blur' }],
+        type: [{ required: true, message: '请选择类型', trigger: 'blur' }],
+        buildId: [{ required: true, message: '请在地图上画点', trigger: 'blur' }],
+        cameraId: [{ required: true, message: '请选择摄像头', trigger: 'blur' }],
+      },
+      optionsObj: {
+        Build: [],
+        Camera: [],
+        LaserPtzType: [],
+      },
+      iconOptions: [],
+      mapData: [],
+      buildFloor: {},
+    }
+  },
+  created() {
+    this.getOptions()
+  },
+  methods: {
+    [CRUD.HOOK.beforeToAdd]() {
+      this.mapData = []
+      this.buildFloor = {}
+    },
+    // 打开
+    [CRUD.HOOK.beforeToEdit]() {
+      this.mapData = [
+        {
+          buildId: this.form.buildId,
+          floorNo: 0,
+          geometries: [
+            {
+              type: 'Point',
+              points: [{ x: this.form.location.x, y: this.form.location.y }],
+            },
+          ],
+        },
+      ]
+      this.buildFloor = {
+        buildId: this.form.buildId,
+        floorNo: 0,
+      }
+    },
+    //验证前处理
+    [CRUD.HOOK.beforeValidateCU]() {
+      if (
+        this.mapData &&
+        this.mapData.length > 0 &&
+        this.mapData[0].geometries &&
+        this.mapData[0].geometries.length > 0 &&
+        this.mapData[0].geometries[0].points &&
+        this.mapData[0].geometries[0].points.length > 0
+      ) {
+        this.form.buildId = this.mapData[0].buildId
+        this.form.floorNo = 0
+        this.form.location = {
+          buildId: this.mapData[0].buildId,
+          floorNo: 0,
+          x: this.mapData[0].geometries[0].points[0].x,
+          y: this.mapData[0].geometries[0].points[0].y,
+        }
+      } else {
+        this.$message.error('请绘制正确的点')
+        return false
+      }
+    },
+    // 提交前的验证
+    [CRUD.HOOK.afterValidateCU]() {},
+    getOptions() {
+      Object.keys(this.optionsObj).forEach(async (key) => {
+        if (key == 'Build') {
+          try {
+            let res = await getOptions2(key)
+            if (res.code === 20000) this.optionsObj[key] = res.data.content
+          } catch (error) {
+            console.log(error)
+          }
+        } else {
+          try {
+            let res = await getOptions(key)
+            if (res.code === 20000) this.optionsObj[key] = res.data.content
+          } catch (error) {
+            console.log(error)
+          }
+        }
+      })
+    },
+  },
+}
+</script>
+
+<style></style>

+ 105 - 0
src/views/leak/tableConfig.js

@@ -0,0 +1,105 @@
+// 激光云台配置
+export const laserPtzConfigConfigTableOptions = [
+  {
+    index: '',
+    prop: 'code',
+    label: '编号',
+    width: '160',
+    align: 'center',
+    fixed: false,
+    sortable: false
+  },
+  {
+    index: '',
+    prop: 'name',
+    label: '名称',
+    width: '160',
+    align: 'center',
+    fixed: false,
+    sortable: false
+  },
+  {
+    index: '',
+    prop: 'typeStr',
+    label: '类型',
+    width: '160',
+    align: 'center',
+    fixed: false,
+    sortable: false
+  },
+  {
+    index: '',
+    prop: 'buildName',
+    label: '建筑',
+    width: '160',
+    align: 'center',
+    fixed: false,
+    sortable: false
+  },
+  {
+    index: '',
+    prop: 'remark',
+    label: '备注',
+    width: '',
+    align: 'center',
+    fixed: false,
+    sortable: false
+  }
+]
+// 激光云台报警
+export const perimeterAlarmTableOptions = [
+  {
+    index: '',
+    prop: 'perimeterName',
+    label: '周界名称',
+    width: '160',
+    align: 'center',
+    fixed: false,
+    sortable: false
+  },
+  {
+    index: '',
+    prop: 'segmentCode',
+    label: '分段编号',
+    width: '160',
+    align: 'center',
+    fixed: false,
+    sortable: false
+  },
+  {
+    index: '',
+    prop: 'typeStr',
+    label: '报警类型',
+    width: '100',
+    align: 'center',
+    fixed: false,
+    sortable: false
+  },
+  {
+    index: '',
+    prop: 'content',
+    label: '报警内容',
+    width: '',
+    align: 'center',
+    fixed: false,
+    sortable: false
+  },
+  {
+    index: '',
+    prop: 'startTime',
+    label: '报警开始时间',
+    width: '160',
+    align: 'center',
+    fixed: false,
+    sortable: false
+  },
+  {
+    index: '',
+    prop: 'endTime',
+    label: '报警结束时间',
+    width: '160',
+    align: 'center',
+    fixed: false,
+    sortable: false
+  }
+]