南昌市物联网技防平台-前端
zengh
2021-01-28 5eb237d3614944b4d0286c9edf1643d4d59d1990
前端初版
3 files modified
1 files added
515 ■■■■■ changed files
src/router/views/index.js 11 ●●●●● patch | view | raw | blame | history
src/views/home/home.vue 22 ●●●●● patch | view | raw | blame | history
src/views/realTimePolice/real.vue 21 ●●●● patch | view | raw | blame | history
src/views/realTimePolice/realHistory.vue 461 ●●●●● patch | view | raw | blame | history
src/router/views/index.js
@@ -86,7 +86,16 @@
    },
    component: () =>
      import( /* webpackChunkName: "views" */ '@/views/Video/video')
  }]
  }
  ,{
      path: 'history/:historyId',
      name: '设备历史',
      meta: {
        i18n: 'real'
      },
      component: () =>
        import( /* webpackChunkName: "views" */ '@/views/realTimePolice/realHistory')
    }]
}, {
  path: '/work/process/leave',
  component: Layout,
src/views/home/home.vue
@@ -5,7 +5,24 @@
<script>
  export default {
    name: "tcgl.vue"
    name: "tcgl.vue",
    created() {
      this.getData();
    },
    data() {
      return {
      }
    },
    methods: {
      getData() {
        window.clearTimeout(window.realTimeQuery);
        window.realTimeQuery = setInterval(function () {
          console.log("222222222222");
        }, 3000);
      }
    }
  }
</script>
@@ -16,7 +33,8 @@
    height: 95%;
  }
  .avue-main .avue-view{
  .avue-main .avue-view {
    height: 100%;
    padding: 0px 5px !important;
  }
src/views/realTimePolice/real.vue
@@ -52,7 +52,7 @@
      </template>
      <template slot-scope="{type,size,row}" slot="menu">
        <el-button icon="el-icon-check" :size="size" :type="type" @click.stop="handleStart(row)">历史</el-button>
        <el-button icon="el-icon-check" :size="size" :type="type" @click.stop="handleHistory(row)">历史</el-button>
        <el-button icon="el-icon-check" :size="size" :type="type" @click.stop="handleStart(row)">视频</el-button>
        <el-button icon="el-icon-check" :size="size" :type="type">处置</el-button>
        <el-button icon="el-icon-check" :size="size" :type="type" @click.stop="handleAdd11()">定位</el-button>
@@ -111,6 +111,7 @@
            {
              label: "报警时间",
              type: "datetime",
              width:130,
              format: "yyyy-MM-dd hh:mm:ss",
              valueFormat: "yyyy-MM-dd hh:mm:ss",
              prop: "alarmTime",
@@ -143,6 +144,7 @@
            }, {
              label: "联系电话",
              prop: "phoneNumber",
              width:130,
            }, {
              label: "接警人",
              prop: "galarmPeople",
@@ -151,22 +153,24 @@
              type: "datetime",
              format: "yyyy-MM-dd hh:mm:ss",
              valueFormat: "yyyy-MM-dd hh:mm:ss",
              width:130,
              prop: "jjTime",
            }, {
              label: "事发地址",
              width:200,
              prop: "place",
            }, {
              label: "设备编号",
              search: true,
              searchSpan: 3,
              width:130,
              prop: "deviceNumber",
            }, {
              label: "是否生成警单",
              label: "生成警单",
              search: true,
              searchSpan: 3,
              slot: true,
              searchLabelWidth: 100,
              searchPlaceholder: "请选择",
              searchPlaceholder: "",
              prop: "jtype",
              type: "select",
              dicData: [
@@ -185,6 +189,7 @@
              search: true,
              searchSpan: 3,
              searchLabelWidth: 60,
              placeholder:"行政区",
              type: 'select',
              props: {
                label: 'name',
@@ -199,6 +204,8 @@
              label: '地市',
              prop: 'city',
              type: 'select',
              searchPlaceholder: "地市",
              placeholder:"地市",
              searchLabelWidth: 1,
              searchSpan: 2,
              search: true,
@@ -215,6 +222,8 @@
              label: '区县',
              searchSpan: 2,
              searchLabelWidth: 1,
              searchPlaceholder: "区县",
              placeholder:"区县",
              search: true,
              prop: 'district',
              type: 'select',
@@ -454,9 +463,11 @@
        }
      },
      handleStart(row) {
        this.$router.push({path: `/real/video/${row.channelNumber}/${row.serialNumber}`});
      },
      handleHistory(row) {
        this.$router.push({path: `/real/history/${row.deviceNumber}`});
      },
      handleAdd11(){
        this.qwe=true;
      }
src/views/realTimePolice/realHistory.vue
New file
@@ -0,0 +1,461 @@
<template>
  <basic-container>
    <avue-crud :option="option"
               :table-loading="loading"
               :data="data"
               :page.sync="page"
               ref="crud"
               @row-del="rowDel"
               v-model="form"
               :permission="permissionList"
               @row-update="rowUpdate"
               @row-save="rowSave"
               :before-open="beforeOpen"
               :row-style="rowStyle"
               @search-change="searchChange"
               @search-reset="searchReset"
               @selection-change="selectionChange"
               @current-change="currentChange"
               @size-change="sizeChange"
               @refresh-change="refreshChange"
               @on-load="onLoad">
      <template slot-scope="{row}" slot="jtype">
        <el-tag>{{row.jtype=='0'?'否':row.jtype=='1'?'是':'无'}}</el-tag>
      </template>
    </avue-crud>
    <el-drawer
  title="我是标题"
  append-to-body=true
  :visible.sync="qwe"
  :direction="direction">
        <iframe src="http://www.baidu.com" frameborder="0" width="100%" height="600px"></iframe>
</el-drawer>
  </basic-container>
</template>
<script>
  import {getList, remove, update, add, getclient} from "@/api/real/real";
  import {mapGetters} from "vuex";
  export default {
    data() {
      return {
        qwe:false,
        direction: 'rtl',
        form: {},
        query: {},
        dateTime: [],
        historyId: this.$route.params.historyId,
        loading: true,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        },
        selectionList: [],
        option: {
          height: 'auto',
          indexLabel: '序号',
          calcHeight: 30,
          menuWidth:130,
          labelWidth: '100',
          dialogWidth: 950,
          tip: false,
          searchShow: true,
          searchMenuSpan: 3,
          border: true,
          index: true,
          viewBtn: true,
          selection: true,
          dialogClickModal: false,
          column: [
            {
              label: "警情类型",
              prop: "waringType",
              search: true,
              searchSpan: 3,
            },
            {
              label: "报警时间",
              type: "datetime",
              width:130,
              format: "yyyy-MM-dd hh:mm:ss",
              valueFormat: "yyyy-MM-dd hh:mm:ss",
              prop: "alarmTime",
            },
            {
              label: "报警时间",
              prop: "releaseTimeRange",
              type: "datetime",
              format: "yyyy-MM-dd hh:mm:ss",
              valueFormat: "yyyy-MM-dd hh:mm:ss",
              searchRange: true,
              searchSpan: 5,
              hide: true,
              addDisplay: false,
              editDisplay: false,
              viewDisplay: false,
              search: true,
              rules: [{
                required: true,
                message: "请输入时间",
                trigger: "blur"
              }]
            },
            {
              label: "报警内容",
              prop: "rname",
            }, {
              label: "报警人",
              prop: "alarmPeople",
            }, {
              label: "联系电话",
              prop: "phoneNumber",
              width:130,
            }, {
              label: "接警人",
              prop: "galarmPeople",
            }, {
              label: "接警时间",
              type: "datetime",
              format: "yyyy-MM-dd hh:mm:ss",
              valueFormat: "yyyy-MM-dd hh:mm:ss",
              width:130,
              prop: "jjTime",
            }, {
              label: "事发地址",
              width:200,
              prop: "place",
            }, {
              label: "设备编号",
              width:130,
              addDisabled:true,
              prop: "deviceNumber",
              value:this.historyId,
            }, {
              label: "生成警单",
              search: true,
              searchSpan: 3,
              slot: true,
              searchPlaceholder: "",
              prop: "jtype",
              type: "select",
              dicData: [
                {
                  label: "否",
                  value: '0'
                },
                {
                  label: "是",
                  value: '1'
                }
              ],
            }, {
              label: '行政区',
              prop: 'province',
              placeholder:"行政区",
              type: 'select',
              props: {
                label: 'name',
                value: 'code'
              },
              cascaderItem: ['city', 'district'],
              dicUrl: '/api/blade-system/region/select',
              span: 6,
              className: 'cityClass1'
            },
            {
              label: '地市',
              prop: 'city',
              type: 'select',
              searchPlaceholder: "地市",
              placeholder:"地市",
              props: {
                label: 'name',
                value: 'code'
              },
              dicUrl: '/api/blade-system/region/select?code={{key}}',
              span: 3,
              labelWidth: '0',
              className: 'cityClass2'
            },
            {
              label: '区县',
              searchSpan: 2,
              searchLabelWidth: 1,
              searchPlaceholder: "区县",
              placeholder:"区县",
              prop: 'district',
              type: 'select',
              props: {
                label: 'name',
                value: 'code'
              },
              dicUrl: '/api/blade-system/region/select?code={{key}}',
              span: 3,
              labelWidth: '0',
              className: 'cityClass3'
            },
          ]
        },
        data: []
      };
    },
    computed: {
      ...mapGetters(["permission", "flowRoutes"]),
      permissionList() {
        return {
          addBtn: this.vaildData(null, false),
          viewBtn: this.vaildData(this.permission.real_view, false),
          delBtn: this.vaildData(null, false),
          editBtn: this.vaildData(null, false)
        };
      },
      ids() {
        let ids = [];
        this.selectionList.forEach(ele => {
          ids.push(ele.id);
        });
        return ids.join(",");
      }
    },
    created() {
      this.dateTime = this.getDate();
    },
    methods: {
      rowSave(row, done, loading) {
        add(row).then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          done();
        }, error => {
          window.console.log(error);
          loading();
        });
      },
      rowUpdate(row, index, done, loading) {
        row.coordinate = "";
        update(row).then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          done();
        }, error => {
          window.console.log(error);
          loading();
        });
      },
      rowDel(row) {
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            return remove(row.id);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
          });
      },
      searchReset() {
        this.query = {};
        this.onLoad(this.page);
      },
      searchChange(params, done) {
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
        done();
      },
      selectionChange(list) {
        this.selectionList = list;
      },
      selectionClear() {
        this.selectionList = [];
        this.$refs.crud.toggleSelection();
      },
      handleDelete() {
        if (this.selectionList.length === 0) {
          this.$message.warning("请选择至少一条数据");
          return;
        }
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            return remove(this.ids);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
            this.$refs.crud.toggleSelection();
          });
      },
      beforeOpen(done, type) {
        if (["edit", "view"].includes(type)) {
          getclient(this.form.id).then(res => {
            this.form = res.data.data;
          });
        }
        done();
      },
      currentChange(currentPage) {
        this.page.currentPage = currentPage;
      },
      sizeChange(pageSize) {
        this.page.pageSize = pageSize;
      },
      refreshChange() {
        this.onLoad(this.page, this.query);
      },
      onLoad(page, params = {}) {
        params.deviceNumber = this.historyId;
        const {releaseTimeRange} = this.query;
        let values = {
          ...params,
        };
        if (releaseTimeRange) {
          values = {
            ...params,
            beginTime: releaseTimeRange[0],
            endTime: releaseTimeRange[1],
            ...this.query
          };
          values.releaseTimeRange = null;
        }
        this.loading = true;
        getList(page.currentPage, page.pageSize, values).then(res => {
          const data = res.data.data;
          this.page.total = data.total;
          this.data = data.records;
          this.loading = false;
          this.selectionClear();
        });
      },
      getDate() {
        // 当前时间
        var timestamp = Date.parse(new Date());
        var serverDate = new Date(timestamp);
        // 本周周一的时间
        var mondayTime = timestamp - ((serverDate.getDay() - 1) * 24 * 60 * 60 * 1000)
        var mondayData = new Date(mondayTime);
        //年
        var mondayY = mondayData.getFullYear();
        //月
        var mondayM = (mondayData.getMonth() + 1 < 10 ? '0' + (mondayData.getMonth() + 1) : mondayData.getMonth() + 1);
        //日
        var mondayD = mondayData.getDate() < 10 ? '0' + mondayData.getDate() : mondayData.getDate();
        // 当前时间
        var currentData = new Date(timestamp);
        //年
        var currentY = currentData.getFullYear();
        //月
        var currentM = (currentData.getMonth() + 1 < 10 ? '0' + (currentData.getMonth() + 1) : currentData.getMonth() + 1);
        //日
        var currentD = currentData.getDate() < 10 ? '0' + currentData.getDate() : currentData.getDate();
        //时
        var currenH = currentData.getHours() < 10 ? '0' + currentData.getHours() : currentData.getHours();
        //分
        var currenM = currentData.getMinutes() < 10 ? '0' + currentData.getMinutes() : currentData.getMinutes();
        return {
          week: {
            beginTime: mondayY + '-' + mondayM + '-' + mondayD + ' 00:00:00',
            endTime: currentY + '-' + currentM + '-' + currentD + ' ' + currenH + ':' + currenM + ':00',
          },
          month: {
            beginTime: mondayY + '-' + mondayM + '-01 00:00:00',
            endTime: currentY + '-' + currentM + '-' + currentD + ' ' + currenH + ':' + currenM + ':00',
          }
        }
      },
      getBZdata() {
        var params = {
          beginTime: this.dateTime.week.beginTime,
          endTime: this.dateTime.week.endTime
        };
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
      },
      getBYdata() {
        var params = {
          beginTime: this.dateTime.month.beginTime,
          endTime: this.dateTime.month.endTime
        };
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
      },
      getQBdata() {
        var params = {};
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
      },
      rowStyle({row, column, rowIndex}) {
        if (row.jtype == "1") {
          return {
            color: '#15a2fe'
          }
        } else {
          return {
            color: '#ff7627'
          }
        }
      },
      handleStart(row) {
        this.$router.push({path: `/real/video/${row.channelNumber}/${row.serialNumber}`});
      },
      handleAdd11(){
        this.qwe=true;
      }
    }
  };
</script>
<style>
  .cityClass1 {
    padding-right: 5px !important;
  }
  .cityClass2 {
    padding-left: 0px !important;
    padding-right: 0px !important;
  }
  .cityClass2 div label {
    display: none;
  }
  .cityClass3 div label {
    display: none;
  }
  .cityClass3 {
    padding-left: 5px !important;
  }
</style>