|
|
@@ -0,0 +1,428 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="24" :xs="24">
|
|
|
+ <div class="main-right-box">
|
|
|
+ <div class="main-search-box">
|
|
|
+ <el-form
|
|
|
+ :model="queryParams"
|
|
|
+ ref="queryForm"
|
|
|
+ size="small"
|
|
|
+ :inline="true"
|
|
|
+ v-show="showSearch"
|
|
|
+ >
|
|
|
+ <el-form-item label="组织机构">
|
|
|
+ <org-tree
|
|
|
+ v-model="queryParams.orgId"
|
|
|
+ @defaultKey="getDefaultKey"
|
|
|
+ @defaultOrg="getDefaultOrg"
|
|
|
+ @checkChange="checkChange"
|
|
|
+ @click="clickTreeNode"
|
|
|
+ ref="orgTree"
|
|
|
+ ></org-tree>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="Iot名称" prop="iotName">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.iotName"
|
|
|
+ clearable
|
|
|
+ placeholder="请输入关键字"
|
|
|
+ @keyup.enter.native="handleQuery"/>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="Iot状态" prop="iotStatus">
|
|
|
+ <el-select
|
|
|
+ v-model="queryParams.iotStatus"
|
|
|
+ clearable
|
|
|
+ placeholder="请选择服务状态"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="dict in dict.type.iot_connect_status"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+ :value="dict.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="Iot编码" prop="iotCode">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.iotCode"
|
|
|
+ clearable
|
|
|
+ placeholder="请输入关键字"
|
|
|
+ @keyup.enter.native="handleQuery"/>
|
|
|
+ </el-form-item>
|
|
|
+ <!-- <el-form-item class="searchTitle" label="上报时间">
|
|
|
+ <DataRangePicker
|
|
|
+ v-model="queryParams.dateRange"
|
|
|
+ key="daterange"
|
|
|
+ type="daterange"
|
|
|
+ :clearable="timeClearable"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="设备类型" prop="deviceType">
|
|
|
+ <el-select
|
|
|
+ v-model="queryParams.deviceType"
|
|
|
+ clearable
|
|
|
+ placeholder="请选择设备类型"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="dict in dict.type.sensor_device_type"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+ :value="dict.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>-->
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-search"
|
|
|
+ size="mini"
|
|
|
+ @click="handleQuery"
|
|
|
+ >搜索
|
|
|
+ </el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-refresh"
|
|
|
+ size="mini"
|
|
|
+ @click="resetQuery"
|
|
|
+ >重置
|
|
|
+ </el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-plus"
|
|
|
+ size="mini"
|
|
|
+ @click="handleAdd"
|
|
|
+ >新增
|
|
|
+ </el-button>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-download"
|
|
|
+ size="mini"
|
|
|
+ @click="handleExport"
|
|
|
+ >导出数据
|
|
|
+ </el-button>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <right-toolbar
|
|
|
+ :showSearch.sync="showSearch"
|
|
|
+ @queryTable="getList"
|
|
|
+ ></right-toolbar>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <el-table
|
|
|
+ v-loading="loading"
|
|
|
+ :data="dataList"
|
|
|
+ border
|
|
|
+ height="600"
|
|
|
+ size="small"
|
|
|
+ >
|
|
|
+ <el-table-column label="序号" type="index" align="center" width="70">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{
|
|
|
+ (queryParams.pageNum - 1) * queryParams.pageSize +
|
|
|
+ scope.$index +
|
|
|
+ 1
|
|
|
+ }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="地区" align="center" prop="firstOrgName" width="120"/>
|
|
|
+ <el-table-column label="行社名称" align="center" prop="secondOrgName" width="220"/>
|
|
|
+ <el-table-column label="所属机构" align="center" prop="orgName" width="150"/>
|
|
|
+ <el-table-column label="Iot名称" align="center" prop="iotName" width="150"/>
|
|
|
+ <el-table-column label="Iot编码" align="center" prop="iotCode" width="220" :show-overflow-tooltip="true"/>
|
|
|
+ <el-table-column label="Iot服务IP" align="center" prop="ip" width="150"/>
|
|
|
+ <el-table-column label="状态" align="center" prop="iotStatus" width="150">
|
|
|
+ <template slot-scope="r"
|
|
|
+ >{{
|
|
|
+ getLabel(dict.type.iot_connect_status, r.row.iotStatus, "未知")
|
|
|
+ }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="状态更新时间" align="center" prop="lastConnectTime" width="180"/>
|
|
|
+ <el-table-column
|
|
|
+ label="操作"
|
|
|
+ align="center"
|
|
|
+ fixed="right"
|
|
|
+ width="200"
|
|
|
+ class-name="small-padding fixed-width"
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-view"
|
|
|
+ @click="lookView(scope.row)"
|
|
|
+ >历史数据</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <DetailDialog ref="detailDialog" @success="refresh(true)"></DetailDialog>
|
|
|
+ <pagination
|
|
|
+ v-show="total > 0"
|
|
|
+ :total="total"
|
|
|
+ :page.sync="queryParams.pageNum"
|
|
|
+ :limit.sync="queryParams.pageSize"
|
|
|
+ @pagination="getList"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <!-- 添加或修改教育培训计划对话框 -->
|
|
|
+ <DialogCom
|
|
|
+ :title="title"
|
|
|
+ :visible.sync="open"
|
|
|
+ :before-close="closeDialog"
|
|
|
+ :close="cancel"
|
|
|
+ width="500px"
|
|
|
+ height="500px"
|
|
|
+ append-to-body
|
|
|
+ >
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-width="110px">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="Iot名称" prop="iotName">
|
|
|
+ <el-input
|
|
|
+ v-model="form.iotName"
|
|
|
+ placeholder="请输入Iot名称"
|
|
|
+ maxlength="50"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="所属机构" prop="orgId">
|
|
|
+ <tree-select
|
|
|
+ v-model="form.orgId"
|
|
|
+ :options="deptOptions"
|
|
|
+ :show-count="true"
|
|
|
+ :normalizer="tenantIdnormalizer"
|
|
|
+ :props="{ checkStrictly: true, label: 'name' }"
|
|
|
+ placeholder="请选择所属机构"
|
|
|
+ clearValueText="清除"
|
|
|
+ :noChildrenText="''"
|
|
|
+ noOptionsText="没有数据"
|
|
|
+ noResultsText="没有搜索结果"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="addIot">确 定</el-button>
|
|
|
+ <el-button @click="cancel">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </DialogCom>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { list,add } from "@/api/iot/server";
|
|
|
+import { getLabel } from "./../../commonOption";
|
|
|
+import DetailDialog from "./dialog.detail.vue";
|
|
|
+import OrgTree from "@/components/orgTree/orgQuerySelector.vue";
|
|
|
+import { mapGetters } from "vuex";
|
|
|
+import dayjs from "dayjs";
|
|
|
+import orgSelect from "@/components/orgSelect/zl.orgSelect.vue";
|
|
|
+import {deptTreeSelect} from "@/api/system/public";
|
|
|
+export default {
|
|
|
+ components: { orgSelect, OrgTree,DetailDialog },
|
|
|
+ name: "Task",
|
|
|
+ dicts: ["sys_org_type",'iot_connect_status'],
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 遮罩层
|
|
|
+ loading: false,
|
|
|
+ // 选中数组
|
|
|
+ ids: [],
|
|
|
+ // 非单个停用
|
|
|
+ single: true,
|
|
|
+ // 非多个停用
|
|
|
+ multiple: true,
|
|
|
+ // 显示搜索条件
|
|
|
+ showSearch: true,
|
|
|
+ // 总条数
|
|
|
+ total: 1,
|
|
|
+ // 弹出层标题
|
|
|
+ title: "",
|
|
|
+ // 是否显示弹出层
|
|
|
+ open: false,
|
|
|
+ // 查询参数
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ iotCode: null,
|
|
|
+ checkSub: true,
|
|
|
+ iotName: null,
|
|
|
+ iotStatus: null,
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ iotName: [{ required: true, message: "请输入Iot名称", trigger: "blur" }],
|
|
|
+ orgId: [{ required: true, message: "请选择所属机构", trigger: "blur" }],
|
|
|
+ },
|
|
|
+ // 表单参数
|
|
|
+ form: {},
|
|
|
+ dataList:[],
|
|
|
+ deptOptions: [],
|
|
|
+
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.queryParams.orgId = this.$store.getters.orgId;
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapGetters(["orgId"]),
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getLabel,
|
|
|
+ /** 查询列表 */
|
|
|
+ getList() {
|
|
|
+ this.loading = true;
|
|
|
+ list(this.queryParams).then((response) => {
|
|
|
+ this.dataList = response.rows;
|
|
|
+ this.total = response.total;
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 取消弹框
|
|
|
+ closeHandler() {
|
|
|
+ this.reset();
|
|
|
+ },
|
|
|
+ handleImport() {},
|
|
|
+ getDefaultOrg(org) {
|
|
|
+ this.orgName = org.name;
|
|
|
+ this.selectedOrgName = org.shortName;
|
|
|
+ },
|
|
|
+
|
|
|
+ getDefaultKey(key) {
|
|
|
+ this.queryParams.orgId = key;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ checkChange(state) {
|
|
|
+ this.queryParams.checkSub = state;
|
|
|
+ this.handleQuery();
|
|
|
+ },
|
|
|
+ // 节点单击事件
|
|
|
+ clickTreeNode(data) {
|
|
|
+ this.queryParams.orgId = data.id;
|
|
|
+ this.orgName = data.name;
|
|
|
+ this.selectedOrgName = data.shortName;
|
|
|
+ this.handleQuery();
|
|
|
+ },
|
|
|
+ /** 下穿状态改变*/
|
|
|
+ changeCheckBox() {
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ // 取消按钮
|
|
|
+ cancel() {
|
|
|
+ this.open = false;
|
|
|
+ this.reset();
|
|
|
+ },
|
|
|
+ // 表单重置
|
|
|
+ reset() {
|
|
|
+ this.form = {
|
|
|
+ id: null,
|
|
|
+ orgId: null,
|
|
|
+ iotName: null,
|
|
|
+ };
|
|
|
+ this.resetForm("form");
|
|
|
+ },
|
|
|
+ /** 搜索按钮操作 */
|
|
|
+ handleQuery() {
|
|
|
+ this.queryParams.pageNum = 1;
|
|
|
+ //this.queryParams.dateRange = [];
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+
|
|
|
+ /** 新增按钮操作 */
|
|
|
+ handleAdd() {
|
|
|
+ //this.initRoleList();
|
|
|
+ this.getDeptTree();
|
|
|
+ this.reset();
|
|
|
+ this.open = true;
|
|
|
+ this.title = "新增演练任务";
|
|
|
+ },
|
|
|
+ addIot(){
|
|
|
+
|
|
|
+ add(this.form).then(() => {
|
|
|
+ this.closeDialog();
|
|
|
+ this.getList();
|
|
|
+ this.$modal.msgSuccess("新增成功,等待Iot服务接入!");
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
+ /** 修改按钮操作 */
|
|
|
+ handleUpdate(row) {
|
|
|
+ // this.initRoleList();
|
|
|
+ this.getDeptTree();
|
|
|
+ this.reset();
|
|
|
+ const id = row.id || this.ids;
|
|
|
+ getPlan(id).then((response) => {
|
|
|
+ this.form = response.data;
|
|
|
+ this.formFileListDefualtValue = this.form.fileList;
|
|
|
+ this.open = true;
|
|
|
+ this.title = "编辑演练任务";
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 重置按钮操作 */
|
|
|
+ resetQuery() {
|
|
|
+ this.resetForm("queryForm");
|
|
|
+ this.queryParams.orgId = this.orgId;
|
|
|
+ this.selectedOrgName = this.orgName;
|
|
|
+ this.queryParams.checkSub = true;
|
|
|
+ this.$refs["orgTree"].setCheckSub(this.queryParams.checkSub);
|
|
|
+ this.handleQuery();
|
|
|
+ },
|
|
|
+
|
|
|
+ /** 修改按钮操作 */
|
|
|
+ lookView(row) {
|
|
|
+ this.$refs["detailDialog"].show(row);
|
|
|
+ },
|
|
|
+ closeDialog() {
|
|
|
+ this.cancel();
|
|
|
+ },
|
|
|
+ /** 查询机构树数据 */
|
|
|
+ getDeptTree() {
|
|
|
+ deptTreeSelect().then((response) => {
|
|
|
+ this.deptOptions = response.data;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ tenantIdnormalizer(node, instanceId) {
|
|
|
+ if (node.children && !node.children.length) {
|
|
|
+ delete node.children;
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ id: node.id,
|
|
|
+ label: node.shortName,
|
|
|
+ children: node.children,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ /** 导出按钮操作 */
|
|
|
+ handleExport() {
|
|
|
+ this.download(
|
|
|
+ "iot/sensor/export",
|
|
|
+ {
|
|
|
+ ...this.queryParams,
|
|
|
+ },
|
|
|
+ `${
|
|
|
+ this.selectedOrgName
|
|
|
+ }-${this.$tab.getCurrentTabName()}-${dayjs().format("YYYYMMDD")}.xlsx`
|
|
|
+ );
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped></style>
|