Эх сурвалжийг харах

增加web动环设备管理页面分页接口

jingyuanchao 1 жил өмнө
parent
commit
e357fbf227

+ 11 - 0
src/api/iot/sensorData.js

@@ -0,0 +1,11 @@
+import request from '@/utils/request'
+
+
+// 查询定时任务调度列表
+export function list(query) {
+    return request({
+      url: '/iot/sensor/find',
+      method: 'post',
+      data: query
+    })
+  }

+ 260 - 0
src/views/iot/sensorData/index.vue

@@ -0,0 +1,260 @@
+<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="设备名称" prop="deviceName">
+                <el-input
+                  v-model="queryParams.deviceName"
+                  clearable
+                  placeholder="请输入关键字"
+                  @keyup.enter.native="handleQuery"
+                />
+              </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-download"
+                  size="mini"
+                  @click="handleExport"
+                  v-hasPermi="['core:task:export']"
+                  >导出</el-button
+                >
+              </el-col>
+
+              <right-toolbar
+                :showSearch.sync="showSearch"
+                @queryTable="getList"
+              ></right-toolbar>
+            </el-row>
+          </div>
+
+          <el-table
+            v-loading="loading"
+            :data="taskList"
+            border
+            height="600"
+            size="small"
+          >
+            <el-table-column label="设备名称" align="center" prop="deviceName" width="220"/>
+            <el-table-column label="资产类别" align="center" prop="assetsType" width="220"/>
+            <el-table-column label="设备类型" align="center" prop="categoryType"/>
+            <el-table-column label="所属机构" align="center" prop="orgName" width="220"/>
+            <el-table-column label="上报时间" align="center" prop="updateTime" width="220"/>
+            <el-table-column label="上报内容" align="center" prop="info" width="220" show-overflow-tooltip="true"/>
+            <el-table-column
+              label="操作"
+              fixed="right"
+              width="300"
+              align="center"
+            >
+              <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>
+          <dialog-info ref="infoDialog" @success="refresh(true)"></dialog-info>
+          <pagination
+            v-show="total > 0"
+            :total="total"
+            :page.sync="queryParams.pageNum"
+            :limit.sync="queryParams.pageSize"
+            @pagination="getList"
+          />
+        </div>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { list } from "@/api/iot/sensorData";
+import OrgTree from "@/components/orgTree/orgQuerySelector.vue";
+import DataRangePicker from "@/components/dateTime/daterange.picker.vue";
+import { mapGetters } from "vuex";
+export default {
+  components: { OrgTree, DataRangePicker },
+  name: "Task",
+  dicts: ["sys_org_type"],
+  data() {
+    return {
+      // 遮罩层
+      loading: false,
+      // 选中数组
+      ids: [],
+      // 非单个停用
+      single: true,
+      // 非多个停用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 1,
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        dateRange: [],
+        checkSub: true,
+      },
+      selectedOrgName: "",
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {},
+
+      orgName: "",
+    };
+  },
+  created() {
+    this.queryParams.orgId = this.$store.getters.orgId;
+    this.getList();
+  },
+  computed: {
+    ...mapGetters(["orgId", "orgName"]),
+  },
+  methods: {
+    /** 查询列表 */
+    getList() {
+      this.loading = true;
+      list(this.queryParams).then((response) => {
+        this.taskList = 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,
+        orgPath: null,
+        orgName: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      //this.queryParams.dateRange = [];
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.queryParams.orgId = this.orgId;
+      this.selectedOrgName = this.orgName;
+      this.queryParams.checkSub = true;
+      this.queryParams.dateRange = ["", ""];
+      this.queryParams.planStartTime = null;
+      this.$refs["orgTree"].setCheckSub(this.queryParams.checkSub);
+      this.handleQuery();
+    },
+
+    /** 修改按钮操作 */
+    lookView(row) {
+      this.$refs["infoDialog"].show(row.id, {});
+    },
+
+    /** 导出按钮操作 */
+    // handleExport() {
+    //   console.log(this);
+    //   this.download(
+    //     "core/retrievalTask/export",
+    //     {
+    //       ...this.queryParams,
+    //     },
+    //     `${
+    //       this.selectedOrgName
+    //     }-${this.$tab.getCurrentTabName()}-${dayjs().format("YYYYMMDD")}.xlsx`
+    //   );
+    // },
+  },
+};
+</script>
+<style lang="scss" scoped></style>