南昌市物联网技防平台-前端
shuishen
2021-04-08 a4e06ccd3cd976fbe4eef99e188d42ec9f3ad054
src/views/policeTracking/policeTracking.vue
@@ -144,6 +144,16 @@
                </el-form-item>
              </el-col>
              <el-col span="12">
                <el-form-item label="历史视频">
                  <el-button type="primary" @click.stop="oldVideoSatart = true"
                    >视频播放
                  </el-button>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col span="12">
                <el-form-item label="备注">
                  <el-input
                    disabled="true"
@@ -154,6 +164,98 @@
              </el-col>
            </el-row>
          </el-form>
          <div
            v-if="form.jtype != 2"
            style="margin-top: 20px"
            role="tab"
            aria-expanded="true"
            aria-controls="el-collapse-content-823"
            aria-describedby="el-collapse-content-823"
          >
            <div
              role="button"
              tabindex="0"
              class="el-collapse-item__header focusing is-active"
            >
              <div
                class="avue-group__header avue-group"
                style="position: relative"
              >
                <i class="el-icon-document avue-group__icon"></i>
                <h1 class="avue-group__title">人员信息</h1>
                <el-button
                  @click="onSubmit('通知' + ensureNames, 1), (flag = false)"
                  size="small"
                  style="position: absolute; right: 0"
                  :disabled="!flag"
                  :type="!flag ? 'info' : 'danger'"
                  >通 知</el-button
                >
              </div>
            </div>
          </div>
          <el-card v-if="form.jtype != 2">
            <el-table
              ref="multipleTable"
              :data="tableData"
              tooltip-effect="dark"
              style="width: 100%"
              @selection-change="handleSelectionChange"
              max-height="240"
            >
              <el-table-column
                v-if="flag"
                type="selection"
                width="55"
                align="center"
              >
              </el-table-column>
              <el-table-column
                prop="ind"
                label="序号"
                width="60"
                align="center"
              >
              </el-table-column>
              <el-table-column
                prop="name"
                label="姓名"
                width="100"
                align="center"
              >
              </el-table-column>
              <el-table-column
                prop="phone"
                label="联系电话"
                width="120"
                align="center"
              >
              </el-table-column>
              <el-table-column
                prop="online_status"
                label="在线状态"
                width="80"
                align="center"
              >
              </el-table-column>
              <el-table-column
                prop="tenantName"
                label="所属部门"
                align="center"
              >
              </el-table-column>
              <el-table-column
                prop="roleName"
                label="所属角色"
                width="100"
                align="center"
              >
              </el-table-column>
            </el-table>
          </el-card>
          <div
            style="margin-top: 20px"
@@ -331,14 +433,17 @@
              <div>
                <el-image
                  :src="src"
                  :preview-src-list="srcList"
                  style="width: 150px; margin-left: 5px"
                ></el-image>
                <el-image
                  :src="src"
                  :preview-src-list="srcList"
                  style="width: 150px; margin-left: 5px"
                ></el-image>
                <el-image
                  :src="src"
                  :preview-src-list="srcList"
                  style="width: 150px; margin-left: 5px"
                ></el-image>
              </div>
@@ -374,7 +479,12 @@
          <el-row :align="center" style="margin-top: 40px">
            <el-col :offset="10">
              <el-button @click="onSubmit" type="danger">处理完成</el-button>
              <el-button
                @click="onSubmit('处理完成', 2)"
                :disabled="form.jtype == 2 ? true : false"
                :type="form.jtype == 2 ? 'info' : 'danger'"
                >处理完成</el-button
              >
            </el-col>
          </el-row>
        </el-card>
@@ -385,11 +495,32 @@
      <iframe
        id="mapDiv"
        ref="mapDiv"
        src="https://web.byisf.com:18001/map/index.html?openid=ClientManagement"
        :src="baseUrl"
        frameborder="0"
        width="100%"
        height="100%"
      ></iframe>
      <el-dialog
        class="old-video-dialog-box"
        width="100%"
        title="历史回放"
        :visible.sync="oldVideoSatart"
        :close-on-press-escape="false"
        :close-on-click-modal="false"
        @close="vaddress = ''"
        append-to-body
      >
        <video
          :src="vaddress"
          muted="muted"
          autoplay="autoplay"
          loop
          id="old_video"
          style="width: 100%; height: 100%; object-fit: fill"
          controls
        ></video>
      </el-dialog>
    </el-col>
  </el-row>
</template>
@@ -398,8 +529,10 @@
import axios from "axios";
export default {
  inject: ["reload"],
  data() {
    return {
      flag: true,
      selectOptions: [],
      receivingList: [],
      security: {
@@ -412,6 +545,11 @@
      },
      src:
        "https://cube.elemecdn.com/6/94/4d3ea53c084bad6931a56d5158a48jpeg.jpeg",
      srcList: [
        "https://cube.elemecdn.com/6/94/4d3ea53c084bad6931a56d5158a48jpeg.jpeg",
        "https://cube.elemecdn.com/6/94/4d3ea53c084bad6931a56d5158a48jpeg.jpeg",
        "https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg",
      ],
      form: {},
      itemOption: {
        menuBtn: false,
@@ -464,44 +602,179 @@
          },
        ],
      },
      tableData: [],
      multipleSelection: [],
      ensureNames: "",
      baseUrl: "",
      oldVideoSatart: false,
      vaddress: null,
    };
  },
  created() {
    this.form = this.$route.query;
    this.vaddress = this.form.vaddress;
    this.getReceivingAlarm();
    this.baseUrl = `/map/index.html?ISinit=1&openid=AlertSecurity&id=${this.form.id}&jd=${this.form.jd}&wd=${this.form.wd}&pid=${this.form.deptId}&deptId=${this.form.deptId}&oneId=${this.form.oneId}`;
  },
  mounted() {
    this.getList();
    this.$refs.mapDiv.onload = () => {
      window.frames[0].init("AlertSecurity", {
        x: this.form.jd,
        y: this.form.wd,
      });
    };
  },
  updated() {
    var arr = [];
    this.tableData.forEach((item) => {
      if (item.id == this.form.oneId) {
        arr.push(item);
      }
    });
    this.toggleSelection(arr);
  },
  methods: {
    onSubmit() {
      var newAxios = axios.create({
        baseURL: "https://web.byisf.com:18001",
        withCredentials: false,
        headers: {},
      });
    getDate() {
      // 当前时间
      var timestamp = Date.parse(new Date());
      var serverDate = new Date(timestamp);
      newAxios
      // 本周周一的时间
      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();
      //秒
      var currenS =
        currentData.getSeconds() < 10
          ? "0" + currentData.getSeconds()
          : currentData.getSeconds();
      return {
        day: {
          beginTime: currentY + "-" + currentM + "-" + currentD + " 00:00:00",
          endTime:
            currentY +
            "-" +
            currentM +
            "-" +
            currentD +
            " " +
            currenH +
            ":" +
            currenM +
            ":00",
        },
        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",
        },
        current:
          currentY +
          "-" +
          currentM +
          "-" +
          currentD +
          " " +
          currenH +
          ":" +
          currenM +
          ":" +
          currenS,
      };
    },
    onSubmit(zc, jtype) {
      var that = this;
      axios
        .post(
          "/api/blade-jfpts/jingdan/jingdan/updateInfo",
          "/api/blade-jfpts/alarm/alarm/updateJtype",
          {},
          {
            params: {
              id: this.form.id,
              handleP: this.form.handleP,
              handName: this.form.handName,
              handletype: this.form.handletype,
              type: "2",
              jid: this.form.id,
              jtype: jtype,
              rid: this.form.alarmId,
              bz: this.form.bz,
              snumber: this.form.alarmId,
              sname: this.form.alarmPeople,
              zc: zc,
              zctime: this.getDate().current,
            },
          }
        )
        .then((res) => {
          if (res.data.msg == "修改成功") {
        .then(function (res) {
          that.getReceivingAlarm();
          if (jtype == 2) {
            var arr = [];
            this.$store.state.tags.tagList.forEach((item) => {
              if (item.value != this.$store.state.tags.tag.value) {
            that.$store.state.tags.tagList.forEach((item) => {
              if (item.value != that.$store.state.tags.tag.value) {
                arr.push(item);
              }
            });
            this.$store.state.tags.tagList = arr;
            this.$router.go(-1);
            that.$store.state.tags.tagList = arr;
            that.$router.go(-1);
          }
        });
    },
@@ -513,6 +786,69 @@
          this.receivingList = res.data.data.records;
        });
    },
    getList() {
      var that = this;
      axios
        .get(`/api/blade-user/pages?current=1&size=9999&work_status=&deptId=${that.form.deptId}`)
        .then(function (res) {
          that.tableData = [];
          var i = 0;
          res.data.data.records.forEach((item) => {
            if (item.id == that.form.oneId) {
              that.tableData.push({
                id: item.id,
                ind: (i += 1),
                name: item.name,
                phone: item.phone,
                online_status: item.online_status == 1 ? "在线" : "掉线",
                roleName: item.roleName + "(负责人)",
                tenantName: item.tenantName,
              });
            }
          });
          res.data.data.records.forEach((item) => {
            if (item.roleName == "处警员" && item.id != that.form.oneId) {
              that.tableData.push({
                id: item.id,
                ind: (i += 1),
                name: item.name,
                phone: item.phone,
                online_status: item.online_status == 1 ? "在线" : "掉线",
                roleName: item.roleName,
                tenantName: item.tenantName,
              });
            }
          });
        });
    },
    handleSelectionChange(val) {
      this.ensureNames = "";
      val.forEach((item, index) => {
        if (index == val.length - 1) {
          this.ensureNames += item.name;
          this.ensureNames += "。";
        } else {
          this.ensureNames += item.name;
          this.ensureNames += "、";
        }
      });
      this.multipleSelection = val;
    },
    toggleSelection(rows) {
      if (rows) {
        rows.forEach((row) => {
          this.$refs.multipleTable.toggleRowSelection(row);
        });
      } else {
        this.$refs.multipleTable.clearSelection();
      }
    },
  },
};
</script>