|
@@ -1,11 +1,11 @@
|
|
|
<template>
|
|
|
<div class="app-container">
|
|
|
<div class="filter-container">
|
|
|
- <div class="filter-left">
|
|
|
+ <div class="filter-left" :model="query">
|
|
|
<div class="filter-item">
|
|
|
点位名称:
|
|
|
<el-input
|
|
|
- v-model="input"
|
|
|
+ v-model.trim="query.pointName"
|
|
|
placeholder=""
|
|
|
style="width: 150px"
|
|
|
></el-input>
|
|
@@ -13,28 +13,29 @@
|
|
|
<div class="filter-item">
|
|
|
点位地址:
|
|
|
<el-input
|
|
|
- v-model="input"
|
|
|
+ v-model.trim="query.pointAddress"
|
|
|
placeholder=""
|
|
|
style="width: 150px"
|
|
|
></el-input>
|
|
|
</div>
|
|
|
|
|
|
- <el-button type="primary" icon="el-icon-search" class="search-button"
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-search"
|
|
|
+ class="search-button"
|
|
|
+ @click="queryData"
|
|
|
>搜索</el-button
|
|
|
>
|
|
|
</div>
|
|
|
|
|
|
<div class="handle-button-right">
|
|
|
- <el-button
|
|
|
- icon="el-icon-plus"
|
|
|
- type="success"
|
|
|
- @click="dialogAddVisible = true"
|
|
|
+ <el-button icon="el-icon-plus" type="success" @click="openAdd"
|
|
|
>新增</el-button
|
|
|
>
|
|
|
<el-button icon="el-icon-delete" type="danger" @click="batchDelete"
|
|
|
>删除</el-button
|
|
|
>
|
|
|
- <el-button type="warning">
|
|
|
+ <el-button type="warning" @click="handleDownload">
|
|
|
<svg-icon icon-class="export" />
|
|
|
导出
|
|
|
</el-button>
|
|
@@ -42,45 +43,70 @@
|
|
|
</div>
|
|
|
|
|
|
<el-divider></el-divider>
|
|
|
+
|
|
|
<el-table
|
|
|
- :data="tableData"
|
|
|
+ :data="list"
|
|
|
stripe
|
|
|
border
|
|
|
:header-cell-style="{ background: '#EBF1FF', color: '#606266' }"
|
|
|
style="width: 100%"
|
|
|
id="out-table"
|
|
|
@selection-change="handleSelectionChange"
|
|
|
+ @sort-change="changeSort"
|
|
|
>
|
|
|
<el-table-column type="selection" width="40"> </el-table-column>
|
|
|
+ <!-- <el-table-column prop="companyCode" label="单位编号"> </el-table-column> -->
|
|
|
|
|
|
- <el-table-column prop="pointName" label="点位名称"> </el-table-column>
|
|
|
+ <el-table-column prop="dwtype" label="点位设备类型" width="140">
|
|
|
+ </el-table-column>
|
|
|
|
|
|
- <el-table-column prop="pointLabel" label="点位标签">
|
|
|
+ <el-table-column prop="pointName" label="点位名称" width="100">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="pointadder" label="点位地址" width="160">
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="点位详情">
|
|
|
<template slot-scope="{ row }">
|
|
|
- <div class="check" @click="dialogPointLabelVisible = true">
|
|
|
- {{ row.pointLabel }}
|
|
|
+ <div class="check" @click="dialogPointDetailVisible = true">
|
|
|
+ <!-- {{ row.pointDetails }} -->
|
|
|
+ 查看
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
- <el-table-column prop="pointAddress" label="点位地址" width="230">
|
|
|
+ <el-table-column label="点位标签">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <div class="check" @click="dialogPointLabelVisible = true">
|
|
|
+ <!-- {{ row.pointLabel }} -->
|
|
|
+ 查看
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
|
|
|
- <el-table-column prop="pointAbject" label="点位对象">
|
|
|
+ <el-table-column label="点位表?">
|
|
|
<template slot-scope="{ row }">
|
|
|
<div class="check" @click="dialogPointObjectVisible = true">
|
|
|
- {{ row.pointObject }}
|
|
|
+ <!-- {{ row.pointLabel }} -->
|
|
|
+ 查看
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
- <el-table-column prop="newTime" label="最新改动时间" width="230">
|
|
|
+ <el-table-column prop="qrurl" label="二维码储存路径" width="160">
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column prop="remarks" label="点位备注"> </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="状态">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.state == 1 ? "显示" : "不显示" }}
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="pointDetail" label="点位详情">
|
|
|
+
|
|
|
+ <el-table-column prop="user" label="创建人"> </el-table-column>
|
|
|
+ <el-table-column label="创建时间" width="200" sortable="custom">
|
|
|
<template slot-scope="{ row }">
|
|
|
- <div class="check" @click="dialogPointDetailVisible = true">
|
|
|
- {{ row.pointDetail }}
|
|
|
- </div>
|
|
|
+ <span>{{ renderTime(row.creationTime) }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
@@ -90,23 +116,47 @@
|
|
|
icon="el-icon-edit"
|
|
|
style="color: #406ce5"
|
|
|
@click="handleEdit(scope.$index, scope.row)"
|
|
|
- >编辑</el-button
|
|
|
+ >修改</el-button
|
|
|
>
|
|
|
<el-button
|
|
|
icon="el-icon-delete"
|
|
|
style="color: #f27979"
|
|
|
- @click="handleDelete(scope.$index, scope.row)"
|
|
|
+ @click="handleDelete(scope.row.id)"
|
|
|
>删除</el-button
|
|
|
>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
|
|
|
- <el-pagination background layout="prev, pager, next" :total="1000">
|
|
|
+ <el-pagination
|
|
|
+ background
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
+ :current-page="page.pageNo"
|
|
|
+ :page-size="1"
|
|
|
+ layout="prev, pager, next"
|
|
|
+ :total="page.total"
|
|
|
+ >
|
|
|
</el-pagination>
|
|
|
|
|
|
+ <!-- 点位详情弹框 start -->
|
|
|
+ <el-dialog
|
|
|
+ title="点位详情"
|
|
|
+ :visible.sync="dialogPointDetailVisible"
|
|
|
+ class="routeDialog"
|
|
|
+ >
|
|
|
+ <div style="text-align: center">
|
|
|
+ <img src="@/assets/route.png" alt="" width="100%" />
|
|
|
+ <p style="margin: 20px auto">虹泾总部园巡检点位1</p>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ <!-- 点位详情弹框 end -->
|
|
|
+
|
|
|
<!-- 点位标签弹框 start -->
|
|
|
- <el-dialog title="点位标签" :visible.sync="dialogPointLabelVisible">
|
|
|
+ <el-dialog
|
|
|
+ title="点位标签"
|
|
|
+ :visible.sync="dialogPointLabelVisible"
|
|
|
+ class="routeDialog"
|
|
|
+ >
|
|
|
<div style="width: 60%; margin: 0 auto">
|
|
|
<div style="margin: 30px auto 50px; text-align: center">
|
|
|
<img src="@/assets/code.png" alt="" width="50%" />
|
|
@@ -132,15 +182,14 @@
|
|
|
</el-dialog>
|
|
|
<!-- 点位标签弹框 end -->
|
|
|
|
|
|
- <!-- 点位对象弹框 start -->
|
|
|
+ <!-- 点位表弹框 start -->
|
|
|
<el-dialog
|
|
|
- title="点位对象"
|
|
|
+ title="点位表"
|
|
|
:visible.sync="dialogPointObjectVisible"
|
|
|
-
|
|
|
class="pointObjectDialog"
|
|
|
>
|
|
|
<div style="height: 400px">
|
|
|
- <el-form :model="form">
|
|
|
+ <el-form >
|
|
|
<el-table
|
|
|
:data="tableDataPointObject"
|
|
|
stripe
|
|
@@ -156,338 +205,211 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="pointAddress" label="点位地址" width="240">
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="设备详情" width="80">
|
|
|
+ <!--
|
|
|
<template slot-scope="{ row }">
|
|
|
<div class="check" @click="dialogPointObjectVisible = true">
|
|
|
{{ row.detail }}
|
|
|
</div>
|
|
|
</template>
|
|
|
- </el-table-column>
|
|
|
+ </el-table-column> -->
|
|
|
</el-table>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
- <!-- 点位对象弹框 end -->
|
|
|
-
|
|
|
- <!-- 点位详情弹框 start -->
|
|
|
- <el-dialog
|
|
|
- title="点位详情"
|
|
|
- :visible.sync="dialogPointDetailVisible"
|
|
|
- class="routeDialog"
|
|
|
- >
|
|
|
- <div style="text-align: center">
|
|
|
- <img src="@/assets/route.png" alt="" width="100%" />
|
|
|
- <p style="margin: 20px auto">虹泾总部园巡检点位1</p>
|
|
|
- </div>
|
|
|
- </el-dialog>
|
|
|
- <!-- 点位详情弹框 end -->
|
|
|
-
|
|
|
- <!-- 新增弹框 start -->
|
|
|
- <el-dialog
|
|
|
- title="增加巡检点位"
|
|
|
- :visible.sync="dialogAddVisible"
|
|
|
- class="routeDialogVisible"
|
|
|
- >
|
|
|
- <el-form :model="form">
|
|
|
- <el-form-item label="点位名称:" :label-width="formLabelWidth">
|
|
|
- <el-input v-model="form.name" autocomplete="off"></el-input>
|
|
|
- </el-form-item>
|
|
|
-
|
|
|
- <el-form-item label="所属项目/建筑:" :label-width="formLabelWidth">
|
|
|
- <el-select v-model="form.region" placeholder="" style="width: 100%">
|
|
|
- <el-option label="建筑一" value="1"></el-option>
|
|
|
- <el-option label="建筑二" value="2"></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
-
|
|
|
- <el-form-item label="点位地址:" :label-width="formLabelWidth">
|
|
|
- <el-input v-model="form.name" autocomplete="off"></el-input>
|
|
|
- </el-form-item>
|
|
|
-
|
|
|
- <el-form-item label="设备类型:" :label-width="formLabelWidth">
|
|
|
- <el-checkbox-group v-model="form.type">
|
|
|
- <el-checkbox label="水系统" name="type"></el-checkbox>
|
|
|
- <el-checkbox label="火系统" name="type"></el-checkbox>
|
|
|
- <el-checkbox label="电气火灾" name="type"></el-checkbox>
|
|
|
- <el-checkbox label="气体火灾" name="type"></el-checkbox>
|
|
|
- <el-checkbox label="RTU" name="type"></el-checkbox>
|
|
|
- <el-checkbox label="视频监控" name="type"></el-checkbox>
|
|
|
- <el-checkbox label="其他" name="type"></el-checkbox>
|
|
|
- </el-checkbox-group>
|
|
|
- </el-form-item>
|
|
|
-
|
|
|
- <el-form-item label="点位图片:" :label-width="formLabelWidth">
|
|
|
- <el-upload
|
|
|
- class="upload-demo"
|
|
|
- action="https://jsonplaceholder.typicode.com/posts/"
|
|
|
- :on-preview="handlePreview"
|
|
|
- :on-remove="handleRemove"
|
|
|
- :before-remove="beforeRemove"
|
|
|
- multiple
|
|
|
- :limit="3"
|
|
|
- :on-exceed="handleExceed"
|
|
|
- :file-list="fileList"
|
|
|
- >
|
|
|
- <el-button size="small">点击上传</el-button>
|
|
|
- <div slot="tip" class="el-upload__tip">
|
|
|
- 只能上传jpg/png文件,且不超过500kb
|
|
|
- </div>
|
|
|
- </el-upload>
|
|
|
- </el-form-item>
|
|
|
-
|
|
|
- <el-form-item label="备注:" :label-width="formLabelWidth">
|
|
|
- <el-input v-model="form.name" autocomplete="off"></el-input>
|
|
|
- </el-form-item>
|
|
|
-
|
|
|
- <el-table
|
|
|
- :data="addTableData"
|
|
|
- stripe
|
|
|
- border
|
|
|
- :header-cell-style="{ background: '#eee', color: '#606266' }"
|
|
|
- style="width: 100%"
|
|
|
- id="out-table"
|
|
|
- @selection-change="handleSelectionChange"
|
|
|
- >
|
|
|
- <el-table-column type="selection" width="40"> </el-table-column>
|
|
|
- <el-table-column prop="order" label="序号" width="50">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="pointName" label="设备名称"> </el-table-column>
|
|
|
- <el-table-column prop="pointAddress" label="设备地址" width="250">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="设备详情">
|
|
|
- <template slot-scope="{ row }">
|
|
|
- <div class="check">
|
|
|
- {{ row.pointDetail }}
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- </el-form>
|
|
|
-
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
- <el-button @click="dialogAddVisible = false" style="background: #f6f6f6"
|
|
|
- >取 消</el-button
|
|
|
- >
|
|
|
- <el-button type="primary" @click="dialogAddVisible = false"
|
|
|
- >保 存</el-button
|
|
|
- >
|
|
|
- </div>
|
|
|
- </el-dialog>
|
|
|
- <!-- 新增弹框 end -->
|
|
|
+ <!-- 点位表弹框 end -->
|
|
|
+
|
|
|
+ <edit
|
|
|
+ :title="edit.title"
|
|
|
+ :visible="edit.visible"
|
|
|
+ :formData="edit.formData"
|
|
|
+ :remoteClose="remoteClose"
|
|
|
+ />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
|
|
|
<script>
|
|
|
-// 引入导出Excel表格依赖
|
|
|
-import FileSaver from "file-saver";
|
|
|
-import XLSX from "xlsx";
|
|
|
+//引入api文件
|
|
|
+import api from "@/api/patrolPoint";
|
|
|
+
|
|
|
+//引入局部组件
|
|
|
+import edit from "./edit";
|
|
|
+// import deviceList from "./deviceList";
|
|
|
|
|
|
export default {
|
|
|
- name: "javascriptthree",
|
|
|
+ //组件注册
|
|
|
+ components: {
|
|
|
+ edit,
|
|
|
+ // deviceList,
|
|
|
+ },
|
|
|
+ name: "elect-partol",
|
|
|
+
|
|
|
data() {
|
|
|
return {
|
|
|
- tableData: [
|
|
|
- {
|
|
|
- pointName: "虹泾巡检路线1",
|
|
|
- pointLabel: "查看",
|
|
|
- pointAddress: "徐乐路208号虹泾总部园",
|
|
|
- pointObject: "查看",
|
|
|
- newTime: "2020-09-15 12:20:12",
|
|
|
- pointDetail: "查看",
|
|
|
- },
|
|
|
- {
|
|
|
- pointName: "虹泾巡检路线2",
|
|
|
- pointLabel: "查看",
|
|
|
- pointAddress: "徐乐路208号虹泾总部园",
|
|
|
- pointObject: "查看",
|
|
|
- newTime: "2020-09-15 12:20:12",
|
|
|
- pointDetail: "查看",
|
|
|
- },
|
|
|
- {
|
|
|
- pointName: "虹泾巡检路线3",
|
|
|
- pointLabel: "查看",
|
|
|
- pointAddress: "徐乐路208号虹泾总部园",
|
|
|
- pointObject: "查看",
|
|
|
- newTime: "2020-09-15 12:20:12",
|
|
|
- pointDetail: "查看",
|
|
|
- },
|
|
|
- ],
|
|
|
-
|
|
|
- addTableData: [
|
|
|
- {
|
|
|
- order: "1",
|
|
|
- pointName: "点位121212121",
|
|
|
- pointAddress: "青浦区徐泾镇徐乐路208号1楼",
|
|
|
- pointDetail: "查看",
|
|
|
- },
|
|
|
- ],
|
|
|
- multipleSelection: [],
|
|
|
-
|
|
|
- options: [
|
|
|
- {
|
|
|
- value: "1",
|
|
|
- label: "责任人1",
|
|
|
- },
|
|
|
- {
|
|
|
- value: "2",
|
|
|
- label: "责任人2",
|
|
|
- },
|
|
|
- {
|
|
|
- value: "3",
|
|
|
- label: "责任人3",
|
|
|
- },
|
|
|
- ],
|
|
|
- value: "",
|
|
|
+ page: {
|
|
|
+ //分页对象
|
|
|
+ pageNo: 1,
|
|
|
+ pageSize: 1,
|
|
|
+ total: 0,
|
|
|
+ },
|
|
|
+ query: {}, //查询条件
|
|
|
+ list: [], //列表数据
|
|
|
|
|
|
- options2: [
|
|
|
- {
|
|
|
- value: "1",
|
|
|
- label: "路线1",
|
|
|
- },
|
|
|
- {
|
|
|
- value: "2",
|
|
|
- label: "路线2",
|
|
|
- },
|
|
|
- {
|
|
|
- value: "3",
|
|
|
- label: "路线3",
|
|
|
- },
|
|
|
- ],
|
|
|
- value2: "",
|
|
|
+ // deviceList: [], //设备列表
|
|
|
|
|
|
- options3: [
|
|
|
- {
|
|
|
- value: "1",
|
|
|
- label: "单位名称1",
|
|
|
- },
|
|
|
- {
|
|
|
- value: "2",
|
|
|
- label: "单位名称2",
|
|
|
- },
|
|
|
- {
|
|
|
- value: "3",
|
|
|
- label: "单位名称3",
|
|
|
+ edit: {
|
|
|
+ title: "",
|
|
|
+ visible: false,
|
|
|
+ formData: {
|
|
|
+ patrolPlanCycle: [],
|
|
|
},
|
|
|
- ],
|
|
|
- value3: "",
|
|
|
-
|
|
|
- input: "",
|
|
|
-
|
|
|
- dialogAddVisible: false,
|
|
|
- form: {
|
|
|
- name: "",
|
|
|
- region: "",
|
|
|
- region2: "",
|
|
|
- date1: "",
|
|
|
- date2: "",
|
|
|
- delivery: false,
|
|
|
- type: [],
|
|
|
- resource: "",
|
|
|
- desc: "",
|
|
|
},
|
|
|
- formLabelWidth: "120px",
|
|
|
|
|
|
- //点位标签
|
|
|
+ //点位详情弹框
|
|
|
+ dialogPointDetailVisible: false,
|
|
|
+ //点位标签弹框
|
|
|
dialogPointLabelVisible: false,
|
|
|
-
|
|
|
- // 点位对象
|
|
|
+ //点位表
|
|
|
dialogPointObjectVisible: false,
|
|
|
-
|
|
|
tableDataPointObject: [
|
|
|
{
|
|
|
order: "1",
|
|
|
pointName: "867725032779518",
|
|
|
pointAddress: "青浦区徐泾镇徐乐路208号虹泾1楼",
|
|
|
- detail: "查看",
|
|
|
+ // detail: "查看",
|
|
|
},
|
|
|
{
|
|
|
order: "2",
|
|
|
pointName: "867725032779518",
|
|
|
pointAddress: "青浦区徐泾镇徐乐路208号虹泾2楼",
|
|
|
- detail: "查看",
|
|
|
+ // detail: "查看",
|
|
|
},
|
|
|
{
|
|
|
order: "3",
|
|
|
pointName: "867725032779518",
|
|
|
pointAddress: "青浦区徐泾镇徐乐路208号虹泾3楼",
|
|
|
- detail: "查看",
|
|
|
+ // detail: "查看",
|
|
|
},
|
|
|
],
|
|
|
|
|
|
- //点位详情
|
|
|
- dialogPointDetailVisible: false,
|
|
|
-
|
|
|
- type: [],
|
|
|
-
|
|
|
- // 上传图片
|
|
|
- fileList: [
|
|
|
- {
|
|
|
- name: "food.jpeg",
|
|
|
- url:
|
|
|
- "https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100",
|
|
|
- },
|
|
|
- {
|
|
|
- name: "food2.jpeg",
|
|
|
- url:
|
|
|
- "https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100",
|
|
|
- },
|
|
|
- ],
|
|
|
+ multipleSelection: [],
|
|
|
};
|
|
|
},
|
|
|
+
|
|
|
+ created() {
|
|
|
+ //aa 钩子里调用查询组件
|
|
|
+ this.fetchData();
|
|
|
+ this.fetchPersonData();
|
|
|
+ },
|
|
|
+
|
|
|
methods: {
|
|
|
- //定义导出Excel表格事件
|
|
|
- exportExcel() {
|
|
|
- /* 从表生成工作簿对象 */
|
|
|
- var wb = XLSX.utils.table_to_book(document.querySelector("#out-table"));
|
|
|
- /* 获取二进制字符串作为输出 */
|
|
|
- var wbout = XLSX.write(wb, {
|
|
|
- bookType: "xlsx",
|
|
|
- bookSST: true,
|
|
|
- type: "array",
|
|
|
- });
|
|
|
- try {
|
|
|
- FileSaver.saveAs(
|
|
|
- //Blob 对象表示一个不可变、原始数据的类文件对象。
|
|
|
- //Blob 表示的不一定是JavaScript原生格式的数据。
|
|
|
- //File 接口基于Blob,继承了 blob 的功能并将其扩展使其支持用户系统上的文件。
|
|
|
- //返回一个新创建的 Blob 对象,其内容由参数中给定的数组串联组成。
|
|
|
- new Blob([wbout], { type: "application/octet-stream" }),
|
|
|
- //设置导出文件名称
|
|
|
- "sheetjs.xlsx"
|
|
|
- );
|
|
|
- } catch (e) {
|
|
|
- if (typeof console !== "undefined") console.log(e, wbout);
|
|
|
+ // // 从后台获取数据,重新排序
|
|
|
+ // changeSort(val) {
|
|
|
+ // // this.fetchData()
|
|
|
+ // console.log(val); // column: {…} order: "ascending" prop: "date"
|
|
|
+ // // 根据当前排序重新获取后台数据,一般后台会需要一个排序的参数
|
|
|
+ // },
|
|
|
+
|
|
|
+ changeSort(val) {
|
|
|
+ const { prop, order } = val;
|
|
|
+
|
|
|
+ if (order === "ascending") {
|
|
|
+ this.query.sort = "desc";
|
|
|
+ } else {
|
|
|
+ this.query.sort = "-1";
|
|
|
}
|
|
|
- return wbout;
|
|
|
+ this.fetchData();
|
|
|
+ },
|
|
|
+
|
|
|
+ //列表查询
|
|
|
+
|
|
|
+ fetchData() {
|
|
|
+ api
|
|
|
+ .getList(this.query, this.page.pageNo, this.page.pageSize)
|
|
|
+ .then((response) => {
|
|
|
+ console.log("response", response);
|
|
|
+ // 列表数据
|
|
|
+ this.list = response.pageList;
|
|
|
+ this.page.total = response.totalPages;
|
|
|
+ // this.sort=response.sort
|
|
|
+ });
|
|
|
},
|
|
|
+
|
|
|
+ //设备下拉列表查询
|
|
|
+ fetchPersonData() {
|
|
|
+ api.getPersonList().then((response) => {
|
|
|
+ console.log("response2");
|
|
|
+ console.log(response);
|
|
|
+ this.deviceList = response.pageList;
|
|
|
+ // this.page.total = response.totalPages;
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ //分页 (当页码改变后触发到此方法 val是当前点击到的那个页码)
|
|
|
+ handleCurrentChange(val) {
|
|
|
+ this.page.pageNo = val;
|
|
|
+ this.fetchData();
|
|
|
+ },
|
|
|
+
|
|
|
+ //条件查询
|
|
|
+ queryData() {
|
|
|
+ this.page.pageNo = 1; //将页码 变为1,第一页
|
|
|
+ this.fetchData();
|
|
|
+ },
|
|
|
+
|
|
|
+ //打开新增窗口
|
|
|
+ openAdd() {
|
|
|
+ this.edit.visible = true;
|
|
|
+ this.edit.title = "新增";
|
|
|
+ },
|
|
|
+
|
|
|
+ //关闭窗口 (子组件会触发此事件方法来关闭窗口)
|
|
|
+ remoteClose() {
|
|
|
+ console.log("============");
|
|
|
+ console.log(this.edit.formData);
|
|
|
+ this.edit.formData = {};
|
|
|
+ this.edit.visible = false;
|
|
|
+ this.fetchData();
|
|
|
+ },
|
|
|
+
|
|
|
+ //修改
|
|
|
handleEdit(index, row) {
|
|
|
- alert(index, row);
|
|
|
+ this.edit.visible = true;
|
|
|
+ this.edit.title = "修改";
|
|
|
+ // row.patrolPlanCycle = row.patrolPlanCycle
|
|
|
+ // ? row.patrolPlanCycle.split(",")
|
|
|
+ // : [];
|
|
|
+ this.edit.formData = row;
|
|
|
},
|
|
|
- handleDelete(index, row) {
|
|
|
+
|
|
|
+ //删除
|
|
|
+ handleDelete(id) {
|
|
|
this.$confirm("确定删除该数据吗?", "删除", {
|
|
|
confirmButtonText: "确定",
|
|
|
cancelButtonText: "取消",
|
|
|
type: "warning",
|
|
|
})
|
|
|
.then(() => {
|
|
|
- this.$message({
|
|
|
- type: "success",
|
|
|
- message: "删除成功!",
|
|
|
+ // 发送删除请求
|
|
|
+ api.deleteById({ queryJson: id }).then((response) => {
|
|
|
+ // 处理响应结果提示
|
|
|
+ this.$message({
|
|
|
+ type: response.success ? "success" : "error",
|
|
|
+ message: response.Msg,
|
|
|
+ });
|
|
|
});
|
|
|
- this.tableData.splice(index, 1);
|
|
|
+ // 刷新列表数据
|
|
|
+ this.fetchData();
|
|
|
})
|
|
|
.catch(() => {
|
|
|
- this.$message({
|
|
|
- type: "info",
|
|
|
- message: "已取消删除",
|
|
|
- });
|
|
|
+ // 不用理会
|
|
|
});
|
|
|
},
|
|
|
|
|
|
+ //全部删除
|
|
|
batchDelete() {
|
|
|
let multData = this.multipleSelection;
|
|
|
- let tableData = this.tableData;
|
|
|
+ let tableData = this.list;
|
|
|
let multDataLen = multData.length;
|
|
|
let tableDataLen = tableData.length;
|
|
|
|
|
@@ -495,7 +417,7 @@ export default {
|
|
|
for (let y = 0; y < tableDataLen; y++) {
|
|
|
if (JSON.stringify(tableData[y]) == JSON.stringify(multData[i])) {
|
|
|
//判断是否相等,相等就删除
|
|
|
- this.tableData.splice(y, 1);
|
|
|
+ this.list.splice(y, 1);
|
|
|
console.log("aa");
|
|
|
}
|
|
|
}
|
|
@@ -505,22 +427,58 @@ export default {
|
|
|
this.multipleSelection = val;
|
|
|
},
|
|
|
|
|
|
- //上传图片
|
|
|
- handleRemove(file, fileList) {
|
|
|
- console.log(file, fileList);
|
|
|
- },
|
|
|
- handlePreview(file) {
|
|
|
- console.log(file);
|
|
|
+ //导出功能
|
|
|
+ handleDownload() {
|
|
|
+ this.downloadLoading = true;
|
|
|
+ import("@/vendor/Export2Excel").then((excel) => {
|
|
|
+ const tHeader = [
|
|
|
+ "巡更计划名称",
|
|
|
+ "设备名称",
|
|
|
+ "执行开始日期",
|
|
|
+ "执行结束日期",
|
|
|
+ "巡更开始时间",
|
|
|
+ "巡更结束时间",
|
|
|
+ "巡更周期",
|
|
|
+ "添加时间",
|
|
|
+ ];
|
|
|
+ const filterVal = [
|
|
|
+ "deviceName",
|
|
|
+ "patrolPlanName",
|
|
|
+ "startDate",
|
|
|
+ "endDate",
|
|
|
+ "startTime",
|
|
|
+ "endTime",
|
|
|
+ "patrolPlanCycle",
|
|
|
+ "creationTime",
|
|
|
+ ];
|
|
|
+ const data = this.formatJson(filterVal);
|
|
|
+ excel.export_json_to_excel({
|
|
|
+ header: tHeader,
|
|
|
+ data,
|
|
|
+ filename: "table-list",
|
|
|
+ });
|
|
|
+ this.downloadLoading = false;
|
|
|
+ });
|
|
|
},
|
|
|
- handleExceed(files, fileList) {
|
|
|
- this.$message.warning(
|
|
|
- `当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${
|
|
|
- files.length + fileList.length
|
|
|
- } 个文件`
|
|
|
+ formatJson(filterVal) {
|
|
|
+ return this.list.map((v) =>
|
|
|
+ filterVal.map((j) => {
|
|
|
+ if (j === "timestamp") {
|
|
|
+ return parseTime(v[j]);
|
|
|
+ } else {
|
|
|
+ return v[j];
|
|
|
+ }
|
|
|
+ })
|
|
|
);
|
|
|
},
|
|
|
- beforeRemove(file, fileList) {
|
|
|
- return this.$confirm(`确定移除 ${file.name}?`);
|
|
|
+
|
|
|
+ //时间格式化2021-01-21T05:53:00.000+0000
|
|
|
+ renderTime(date) {
|
|
|
+ var dateee = new Date(date).toJSON();
|
|
|
+ return new Date(+new Date(dateee) + 8 * 3600 * 1000)
|
|
|
+ .toISOString()
|
|
|
+ .replace(/T/g, " ")
|
|
|
+ .replace(/\.[\d]{3}Z/, "");
|
|
|
},
|
|
|
},
|
|
|
};
|
|
@@ -534,17 +492,12 @@ export default {
|
|
|
padding: 8px 10px;
|
|
|
}
|
|
|
.el-checkbox {
|
|
|
- width: 80px;
|
|
|
- margin-right: 10px;
|
|
|
+ margin-right: 15px;
|
|
|
+ line-height: 0;
|
|
|
}
|
|
|
-.el-checkbox-group {
|
|
|
- width: 290px;
|
|
|
+.el-dialog {
|
|
|
+ min-width: 736px !important;
|
|
|
}
|
|
|
</style>
|
|
|
<style >
|
|
|
-.el-upload-list--picture-card .el-upload-list__item,
|
|
|
-.el-upload--picture-card {
|
|
|
- width: 100px;
|
|
|
- height: 100px;
|
|
|
-}
|
|
|
</style>
|