459242451@qq.com 3 лет назад
Родитель
Сommit
6a0794da91

+ 44 - 0
src/api/qdtl/device.js

@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+
+// 查询巡检设备管理列表
+export function listDevice(query) {
+  return request({
+    url: '/qdtl/device/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询巡检设备管理详细
+export function getDevice(id) {
+  return request({
+    url: '/qdtl/device/' + id,
+    method: 'get'
+  })
+}
+
+// 新增巡检设备管理
+export function addDevice(data) {
+  return request({
+    url: '/qdtl/device',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改巡检设备管理
+export function updateDevice(data) {
+  return request({
+    url: '/qdtl/device',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除巡检设备管理
+export function delDevice(id) {
+  return request({
+    url: '/qdtl/device/' + id,
+    method: 'delete'
+  })
+}

+ 44 - 0
src/api/qdtl/location.js

@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+
+// 查询巡检点管理列表
+export function listLocation(query) {
+  return request({
+    url: '/qdtl/location/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询巡检点管理详细
+export function getLocation(id) {
+  return request({
+    url: '/qdtl/location/' + id,
+    method: 'get'
+  })
+}
+
+// 新增巡检点管理
+export function addLocation(data) {
+  return request({
+    url: '/qdtl/location',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改巡检点管理
+export function updateLocation(data) {
+  return request({
+    url: '/qdtl/location',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除巡检点管理
+export function delLocation(id) {
+  return request({
+    url: '/qdtl/location/' + id,
+    method: 'delete'
+  })
+}

+ 2 - 2
src/views/qdtl/area/index.vue

@@ -80,8 +80,8 @@
           <dict-tag :options="dict.type.tl_area_type" :value="scope.row.areaType"/>
         </template>
       </el-table-column>
-      <el-table-column label="区域设备" align="center" prop="deviceStatic" />
-      <el-table-column label="区域巡检点" align="center" prop="locationStatic" />
+      <el-table-column label="区域设备" align="center" prop="deviceCount" />
+      <el-table-column label="区域巡检点" align="center" prop="locationCount" />
       <el-table-column label="区域描述" align="center" prop="detail" />
       <el-table-column label="备注" align="center" prop="remark" />
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">

+ 319 - 0
src/views/qdtl/device/index.vue

@@ -0,0 +1,319 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="设备编号" prop="deviceCode">
+        <el-input
+          v-model="queryParams.deviceCode"
+          placeholder="请输入设备编号"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="设备名称" prop="deviceName">
+        <el-input
+          v-model="queryParams.deviceName"
+          placeholder="请输入设备名称"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="设备类型" prop="deviceType">
+        <el-select v-model="queryParams.deviceType" placeholder="请选择设备类型" clearable size="small">
+          <el-option
+            v-for="dict in dict.type.tl_device_type"
+            :key="dict.value"
+            :label="dict.label"
+            :value="dict.value"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['qdtl:device:add']"
+        >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['qdtl:device:edit']"
+        >修改</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          plain
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple"
+          @click="handleDelete"
+          v-hasPermi="['qdtl:device:remove']"
+        >删除</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="deviceList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="设备编号" align="center" prop="deviceCode" />
+      <el-table-column label="设备名称" align="center" prop="deviceName" />
+      <el-table-column label="设备类型" align="center" prop="deviceType">
+        <template slot-scope="scope">
+          <dict-tag :options="dict.type.tl_device_type" :value="scope.row.deviceType"/>
+        </template>
+      </el-table-column>
+      <el-table-column label="经纬度" align="center" prop="lnglat" />
+      <el-table-column label="所属区域" align="center" prop="areaId" />
+      <el-table-column label="备注" align="center" prop="remark" />
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['qdtl:device:edit']"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['qdtl:device:remove']"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改巡检设备管理对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="设备编号" prop="deviceCode">
+          <el-input v-model="form.deviceCode" placeholder="请输入设备编号" />
+        </el-form-item>
+        <el-form-item label="设备名称" prop="deviceName">
+          <el-input v-model="form.deviceName" placeholder="请输入设备名称" />
+        </el-form-item>
+        <el-form-item label="设备类型" prop="deviceType">
+          <el-select v-model="form.deviceType" placeholder="请选择设备类型">
+            <el-option
+              v-for="dict in dict.type.tl_device_type"
+              :key="dict.value"
+              :label="dict.label"
+:value="dict.value"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="所属区域" prop="areaId">
+          <el-select v-model="form.deviceType" placeholder="请选择所属区域">
+            <el-option
+              v-for="item in areaOptions"
+              :key="item.id"
+              :label="item.areaName"
+              :value="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="经纬度" prop="lnglat">
+          <el-input v-model="form.lnglat" placeholder="请输入经纬度" />
+        </el-form-item>
+        <el-form-item label="备注" prop="remark">
+          <el-input v-model="form.remark" placeholder="请输入备注" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listDevice, getDevice, delDevice, addDevice, updateDevice } from "@/api/qdtl/device";
+
+export default {
+  name: "Device",
+  dicts: ['tl_device_type'],
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 巡检设备管理表格数据
+      deviceList: [],
+      areaOptions: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        deviceCode: null,
+        deviceName: null,
+        deviceType: null,
+        areaId: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        deviceCode: [
+          { required: true, message: "设备编号不能为空", trigger: "blur" }
+        ],
+        deviceName: [
+          { required: true, message: "设备名称不能为空", trigger: "blur" }
+        ],
+        deviceType: [
+          { required: true, message: "设备类型不能为空", trigger: "change" }
+        ],
+        areaId: [
+          { required: true, message: "所属区域不能为空", trigger: "change" }
+        ],
+      }
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 查询巡检设备管理列表 */
+    getList() {
+      this.loading = true;
+      listDevice(this.queryParams).then(response => {
+        this.deviceList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        deviceCode: null,
+        deviceName: null,
+        deviceType: null,
+        lnglat: null,
+        areaId: null,
+        remark: null,
+        delFlag: null,
+        createBy: null,
+        createTime: null,
+        updateBy: null,
+        updateTime: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加巡检设备管理";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids
+      getDevice(id).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改巡检设备管理";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateDevice(this.form).then(response => {
+              this.$modal.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addDevice(this.form).then(response => {
+              this.$modal.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$modal.confirm('是否确认删除巡检设备管理编号为"' + ids + '"的数据项?').then(function() {
+        return delDevice(ids);
+      }).then(() => {
+        this.getList();
+        this.$modal.msgSuccess("删除成功");
+      }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      this.download('qdtl/device/export', {
+        ...this.queryParams
+      }, `device_${new Date().getTime()}.xlsx`)
+    }
+  }
+};
+</script>

+ 274 - 0
src/views/qdtl/location/index.vue

@@ -0,0 +1,274 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="编号" prop="locationCode">
+        <el-input
+          v-model="queryParams.locationCode"
+          placeholder="请输入编号"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="名称" prop="locationName">
+        <el-input
+          v-model="queryParams.locationName"
+          placeholder="请输入名称"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['qdtl:location:add']"
+        >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['qdtl:location:edit']"
+        >修改</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          plain
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple"
+          @click="handleDelete"
+          v-hasPermi="['qdtl:location:remove']"
+        >删除</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="locationList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="编号" align="center" prop="locationCode" />
+      <el-table-column label="名称" align="center" prop="locationName" />
+      <el-table-column label="描述" align="center" prop="detail" />
+      <el-table-column label="巡检设备" align="center" prop="deviceIds" />
+      <el-table-column label="所属区域" align="center" prop="areaId" />
+      <el-table-column label="备注" align="center" prop="remark" />
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['qdtl:location:edit']"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['qdtl:location:remove']"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改巡检点管理对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="编号" prop="locationCode">
+          <el-input v-model="form.locationCode" placeholder="请输入编号" />
+        </el-form-item>
+        <el-form-item label="名称" prop="locationName">
+          <el-input v-model="form.locationName" placeholder="请输入名称" />
+        </el-form-item>
+        <el-form-item label="描述" prop="detail">
+          <el-input v-model="form.detail" placeholder="请输入描述" />
+        </el-form-item>
+        <el-form-item label="经纬度" prop="lnglat">
+          <el-input v-model="form.lnglat" placeholder="请输入经纬度" />
+        </el-form-item>
+        <el-form-item label="备注" prop="remark">
+          <el-input v-model="form.remark" placeholder="请输入备注" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listLocation, getLocation, delLocation, addLocation, updateLocation } from "@/api/qdtl/location";
+
+export default {
+  name: "Location",
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 巡检点管理表格数据
+      locationList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        locationCode: null,
+        locationName: null,
+        areaId: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+      }
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 查询巡检点管理列表 */
+    getList() {
+      this.loading = true;
+      listLocation(this.queryParams).then(response => {
+        this.locationList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        locationCode: null,
+        locationName: null,
+        detail: null,
+        deviceIds: null,
+        areaId: null,
+        lnglat: null,
+        remark: null,
+        delFlag: null,
+        createBy: null,
+        createTime: null,
+        updateBy: null,
+        updateTime: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加巡检点管理";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids
+      getLocation(id).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改巡检点管理";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateLocation(this.form).then(response => {
+              this.$modal.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addLocation(this.form).then(response => {
+              this.$modal.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$modal.confirm('是否确认删除巡检点管理编号为"' + ids + '"的数据项?').then(function() {
+        return delLocation(ids);
+      }).then(() => {
+        this.getList();
+        this.$modal.msgSuccess("删除成功");
+      }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      this.download('qdtl/location/export', {
+        ...this.queryParams
+      }, `location_${new Date().getTime()}.xlsx`)
+    }
+  }
+};
+</script>