|
@@ -1,381 +1,379 @@
|
|
|
-<template>
|
|
|
- <div class="app-container">
|
|
|
- <div class="filter-container">
|
|
|
- <div class="filter-left" :model="query">
|
|
|
- <div class="filter-item">
|
|
|
- 团队名称:
|
|
|
- <el-input
|
|
|
- v-model.trim="query.teamName "
|
|
|
- placeholder=""
|
|
|
- style="width: 150px"
|
|
|
- ></el-input>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="filter-item">
|
|
|
- 人员名称:
|
|
|
- <el-input
|
|
|
- v-model.trim="query.name "
|
|
|
- placeholder=""
|
|
|
- style="width: 150px"
|
|
|
- ></el-input>
|
|
|
- </div>
|
|
|
- <!-- <div class="filter-item">
|
|
|
- 人员名称:
|
|
|
-
|
|
|
- <device-list :deviceList="deviceList" :query=this.query></device-list>
|
|
|
-
|
|
|
- </div> -->
|
|
|
-
|
|
|
- <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="openAdd"
|
|
|
- >新增</el-button
|
|
|
- >
|
|
|
- <el-button icon="el-icon-delete" type="danger" @click="batchDelete"
|
|
|
- >删除</el-button
|
|
|
- >
|
|
|
- <el-button type="warning" @click="handleDownload">
|
|
|
- <svg-icon icon-class="export" />
|
|
|
- 导出
|
|
|
- </el-button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
-
|
|
|
- <el-divider></el-divider>
|
|
|
-
|
|
|
- <el-table
|
|
|
- :data="list"
|
|
|
- stripe
|
|
|
- :header-cell-style="{ background: '#EBF1FF', 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="teamName" label="团队名称" width="100">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="name" label="团队人员" width="100">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="teamLabel" label="团队标签" width="80">
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <el-table-column label="标签" width="120">
|
|
|
- <template slot-scope="scope">
|
|
|
- {{ scope.row.label == 1 ? '团队责任人' : '团队普通成员' }}
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <el-table-column prop="phone" label="联系方式" width="150">
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <el-table-column label="状态" width="100">
|
|
|
- <template slot-scope="scope">
|
|
|
- {{ scope.row.state == 1 ? '显示' : '不显示' }}
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <el-table-column prop="founder" label="创建人" width="120">
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <el-table-column label="创建时间" width="200">
|
|
|
- <template slot-scope="{ row }">
|
|
|
- <span>{{ renderTime(row.creationTime) }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <el-table-column label="操作" width="150" fixed="right">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-button
|
|
|
- icon="el-icon-edit"
|
|
|
- style="color: #406ce5"
|
|
|
- @click="handleEdit(scope.$index, scope.row)"
|
|
|
- >修改</el-button
|
|
|
- >
|
|
|
- <el-button
|
|
|
- icon="el-icon-delete"
|
|
|
- style="color: #f27979"
|
|
|
- @click="handleDelete(scope.row.id)"
|
|
|
- >删除</el-button
|
|
|
- >
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
-
|
|
|
- <el-pagination
|
|
|
- background
|
|
|
- @current-change="handleCurrentChange"
|
|
|
- :current-page="page.pageNo"
|
|
|
- :page-size="1"
|
|
|
- layout="prev, pager, next"
|
|
|
- :total="page.total"
|
|
|
- >
|
|
|
- </el-pagination>
|
|
|
-
|
|
|
- <edit
|
|
|
- :title="edit.title"
|
|
|
- :visible="edit.visible"
|
|
|
- :formData="edit.formData"
|
|
|
- :remoteClose="remoteClose"
|
|
|
- />
|
|
|
-
|
|
|
- <!-- 视频详情弹框 start -->
|
|
|
- <el-dialog
|
|
|
- title="视频详情"
|
|
|
- :visible.sync="dialogVideoDetailVisible"
|
|
|
- class="routeDialog"
|
|
|
- >
|
|
|
- <div style="text-align: center">
|
|
|
- <img src="@/assets/video.png" alt="" width="100%" />
|
|
|
- </div>
|
|
|
- </el-dialog>
|
|
|
- <!-- 视频详情弹框 end -->
|
|
|
- </div>
|
|
|
-</template>
|
|
|
-
|
|
|
-
|
|
|
-<script>
|
|
|
-
|
|
|
-//引入api文件
|
|
|
-import api from "@/api/team";
|
|
|
-
|
|
|
-//引入局部组件
|
|
|
-import edit from "./edit";
|
|
|
-import deviceList from "./deviceList";
|
|
|
-
|
|
|
-export default {
|
|
|
- //组件注册
|
|
|
- components: {
|
|
|
- edit,
|
|
|
- deviceList
|
|
|
- },
|
|
|
- name: "elect-partol",
|
|
|
-
|
|
|
- data() {
|
|
|
- return {
|
|
|
- page: {
|
|
|
- //分页对象
|
|
|
- pageNo: 1,
|
|
|
- pageSize: 2,
|
|
|
- total: 0,
|
|
|
- },
|
|
|
- query: {}, //查询条件
|
|
|
- list: [], //列表数据
|
|
|
-
|
|
|
- deviceList:[], //设备列表
|
|
|
-
|
|
|
- edit: {
|
|
|
- title: "",
|
|
|
- visible: false,
|
|
|
- formData: {
|
|
|
- // patrolPlanCycle: [],
|
|
|
- },
|
|
|
- },
|
|
|
-
|
|
|
- //视频弹框
|
|
|
- dialogVideoDetailVisible: false,
|
|
|
-
|
|
|
- multipleSelection: [],
|
|
|
-
|
|
|
-
|
|
|
- };
|
|
|
- },
|
|
|
-
|
|
|
- created() {
|
|
|
- //aa 钩子里调用查询组件
|
|
|
- this.fetchData();
|
|
|
- this.fetchPersonData()
|
|
|
- },
|
|
|
-
|
|
|
- methods: {
|
|
|
- //列表查询
|
|
|
-
|
|
|
- fetchData() {
|
|
|
- api
|
|
|
- .getList(this.query, this.page.pageNo, this.page.pageSize)
|
|
|
- .then((response) => {
|
|
|
- // 列表数据
|
|
|
- this.list = response.pageList;
|
|
|
- this.page.total = response.totalPages;
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
-
|
|
|
- //设备下拉列表查询
|
|
|
- fetchPersonData() {
|
|
|
- api.getPersonList().then(
|
|
|
- (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) {
|
|
|
- this.edit.visible = true;
|
|
|
- this.edit.title = "修改";
|
|
|
- // row.patrolPlanCycle = row.patrolPlanCycle
|
|
|
- // ? row.patrolPlanCycle.split(",")
|
|
|
- // : [];
|
|
|
- this.edit.formData = row;
|
|
|
- },
|
|
|
-
|
|
|
- //删除
|
|
|
- handleDelete(id) {
|
|
|
- this.$confirm("确定删除该数据吗?", "删除", {
|
|
|
- confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消",
|
|
|
- type: "warning",
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
-
|
|
|
- // 发送删除请求
|
|
|
- api.deleteById({ queryJson: id }).then((response) => {
|
|
|
- // 处理响应结果提示
|
|
|
- this.$message({
|
|
|
- type: response.success ? "success" : "error",
|
|
|
- message: response.Msg,
|
|
|
- });
|
|
|
- });
|
|
|
- // 刷新列表数据
|
|
|
- this.fetchData();
|
|
|
-
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- // 不用理会
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- //全部删除
|
|
|
- batchDelete() {
|
|
|
- let multData = this.multipleSelection;
|
|
|
- let tableData = this.list;
|
|
|
- let multDataLen = multData.length;
|
|
|
- let tableDataLen = tableData.length;
|
|
|
-
|
|
|
- for (let i = 0; i < multDataLen; i++) {
|
|
|
- for (let y = 0; y < tableDataLen; y++) {
|
|
|
- if (JSON.stringify(tableData[y]) == JSON.stringify(multData[i])) {
|
|
|
- //判断是否相等,相等就删除
|
|
|
- this.list.splice(y, 1);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- handleSelectionChange(val) {
|
|
|
- this.multipleSelection = val;
|
|
|
- },
|
|
|
-
|
|
|
- //导出功能
|
|
|
- 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;
|
|
|
- });
|
|
|
- },
|
|
|
- formatJson(filterVal) {
|
|
|
- return this.list.map((v) =>
|
|
|
- filterVal.map((j) => {
|
|
|
- if (j === "timestamp") {
|
|
|
- return parseTime(v[j]);
|
|
|
- } else {
|
|
|
- return v[j];
|
|
|
- }
|
|
|
- })
|
|
|
- );
|
|
|
- },
|
|
|
-
|
|
|
- //时间格式化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/, "");
|
|
|
- },
|
|
|
-
|
|
|
- },
|
|
|
-};
|
|
|
-</script>
|
|
|
-<style scoped>
|
|
|
-.table-tit {
|
|
|
- background: rgb(235, 241, 255);
|
|
|
- border: 1px solid #d9d9d9;
|
|
|
- border-bottom: 0;
|
|
|
- font-weight: bold;
|
|
|
- padding: 8px 10px;
|
|
|
-}
|
|
|
-.el-checkbox {
|
|
|
- margin-right: 15px;
|
|
|
- line-height: 0;
|
|
|
-}
|
|
|
-.el-dialog {
|
|
|
- min-width: 736px !important;
|
|
|
-}
|
|
|
-</style>
|
|
|
-<style >
|
|
|
-</style>
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <div class="filter-container">
|
|
|
+ <div class="filter-left" :model="query">
|
|
|
+ <div class="filter-item">
|
|
|
+ 团队名称:
|
|
|
+ <el-input
|
|
|
+ v-model.trim="query.teamName "
|
|
|
+ placeholder=""
|
|
|
+ style="width: 150px"
|
|
|
+ ></el-input>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="filter-item">
|
|
|
+ 人员名称:
|
|
|
+ <el-input
|
|
|
+ v-model.trim="query.name "
|
|
|
+ placeholder=""
|
|
|
+ style="width: 150px"
|
|
|
+ ></el-input>
|
|
|
+ </div>
|
|
|
+ <!-- <div class="filter-item">
|
|
|
+ 人员名称:
|
|
|
+
|
|
|
+ <device-list :deviceList="deviceList" :query=this.query></device-list>
|
|
|
+
|
|
|
+ </div> -->
|
|
|
+
|
|
|
+ <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="openAdd"
|
|
|
+ >新增</el-button
|
|
|
+ >
|
|
|
+ <el-button icon="el-icon-delete" type="danger" @click="batchDelete"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ <el-button type="warning" @click="handleDownload">
|
|
|
+ <svg-icon icon-class="export" />
|
|
|
+ 导出
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <el-divider></el-divider>
|
|
|
+
|
|
|
+ <el-table
|
|
|
+ :data="list"
|
|
|
+ stripe
|
|
|
+ :header-cell-style="{ background: '#EBF1FF', 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="teamName" label="团队名称" width="100">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="name" label="团队人员" width="100">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="teamLabel" label="团队标签" width="80">
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="标签" width="120">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.label == 1 ? '团队责任人' : '团队普通成员' }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column prop="phone" label="联系方式" width="150">
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="状态" width="100">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.state == 1 ? '显示' : '不显示' }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column prop="founder" label="创建人" width="120">
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="创建时间" width="200">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <span>{{ renderTime(row.creationTime) }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="操作" width="150" fixed="right">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ icon="el-icon-edit"
|
|
|
+ style="color: #406ce5"
|
|
|
+ @click="handleEdit(scope.$index, scope.row)"
|
|
|
+ >修改</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ icon="el-icon-delete"
|
|
|
+ style="color: #f27979"
|
|
|
+ @click="handleDelete(scope.row.id)"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <el-pagination
|
|
|
+ background
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
+ :current-page="page.pageNo"
|
|
|
+ :page-size="1"
|
|
|
+ layout="prev, pager, next"
|
|
|
+ :total="page.total"
|
|
|
+ >
|
|
|
+ </el-pagination>
|
|
|
+
|
|
|
+ <edit
|
|
|
+ :title="edit.title"
|
|
|
+ :visible="edit.visible"
|
|
|
+ :formData="edit.formData"
|
|
|
+ :remoteClose="remoteClose"
|
|
|
+ />
|
|
|
+
|
|
|
+ <!-- 视频详情弹框 start -->
|
|
|
+ <el-dialog
|
|
|
+ title="视频详情"
|
|
|
+ :visible.sync="dialogVideoDetailVisible"
|
|
|
+ class="routeDialog"
|
|
|
+ >
|
|
|
+ <div style="text-align: center">
|
|
|
+ <img src="@/assets/video.png" alt="" width="100%" />
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ <!-- 视频详情弹框 end -->
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+
|
|
|
+<script>
|
|
|
+
|
|
|
+//引入api文件
|
|
|
+import api from "@/api/team";
|
|
|
+
|
|
|
+//引入局部组件
|
|
|
+import edit from "./edit";
|
|
|
+import deviceList from "./deviceList";
|
|
|
+
|
|
|
+export default {
|
|
|
+ //组件注册
|
|
|
+ components: {
|
|
|
+ edit,
|
|
|
+ deviceList
|
|
|
+ },
|
|
|
+ name: "elect-partol",
|
|
|
+
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ page: {
|
|
|
+ //分页对象
|
|
|
+ pageNo: 1,
|
|
|
+ pageSize: 2,
|
|
|
+ total: 0,
|
|
|
+ },
|
|
|
+ query: {}, //查询条件
|
|
|
+ list: [], //列表数据
|
|
|
+
|
|
|
+ deviceList:[], //设备列表
|
|
|
+
|
|
|
+ edit: {
|
|
|
+ title: "",
|
|
|
+ visible: false,
|
|
|
+ formData: {
|
|
|
+ // patrolPlanCycle: [],
|
|
|
+ },
|
|
|
+ },
|
|
|
+
|
|
|
+ //视频弹框
|
|
|
+ dialogVideoDetailVisible: false,
|
|
|
+
|
|
|
+ multipleSelection: [],
|
|
|
+
|
|
|
+
|
|
|
+ };
|
|
|
+ },
|
|
|
+
|
|
|
+ created() {
|
|
|
+ //aa 钩子里调用查询组件
|
|
|
+ this.fetchData();
|
|
|
+ this.fetchPersonData()
|
|
|
+ },
|
|
|
+
|
|
|
+ methods: {
|
|
|
+ //列表查询
|
|
|
+
|
|
|
+ fetchData() {
|
|
|
+ api
|
|
|
+ .getList(this.query, this.page.pageNo, this.page.pageSize)
|
|
|
+ .then((response) => {
|
|
|
+ // 列表数据
|
|
|
+ this.list = response.pageList;
|
|
|
+ this.page.total = response.totalPages;
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ //设备下拉列表查询
|
|
|
+ fetchPersonData() {
|
|
|
+ api.getPersonList().then(
|
|
|
+ (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() {
|
|
|
+ this.edit.formData = {};
|
|
|
+ this.edit.visible = false;
|
|
|
+ this.fetchData();
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ //修改
|
|
|
+ handleEdit(index, row) {
|
|
|
+ this.edit.visible = true;
|
|
|
+ this.edit.title = "修改";
|
|
|
+ // row.patrolPlanCycle = row.patrolPlanCycle
|
|
|
+ // ? row.patrolPlanCycle.split(",")
|
|
|
+ // : [];
|
|
|
+ this.edit.formData = row;
|
|
|
+ },
|
|
|
+
|
|
|
+ //删除
|
|
|
+ handleDelete(id) {
|
|
|
+ this.$confirm("确定删除该数据吗?", "删除", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+
|
|
|
+ // 发送删除请求
|
|
|
+ api.deleteById({ queryJson: id }).then((response) => {
|
|
|
+ // 处理响应结果提示
|
|
|
+ this.$message({
|
|
|
+ type: response.success ? "success" : "error",
|
|
|
+ message: response.Msg,
|
|
|
+ });
|
|
|
+ });
|
|
|
+ // 刷新列表数据
|
|
|
+ this.fetchData();
|
|
|
+
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ // 不用理会
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ //全部删除
|
|
|
+ batchDelete() {
|
|
|
+ let multData = this.multipleSelection;
|
|
|
+ let tableData = this.list;
|
|
|
+ let multDataLen = multData.length;
|
|
|
+ let tableDataLen = tableData.length;
|
|
|
+
|
|
|
+ for (let i = 0; i < multDataLen; i++) {
|
|
|
+ for (let y = 0; y < tableDataLen; y++) {
|
|
|
+ if (JSON.stringify(tableData[y]) == JSON.stringify(multData[i])) {
|
|
|
+ //判断是否相等,相等就删除
|
|
|
+ this.list.splice(y, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleSelectionChange(val) {
|
|
|
+ this.multipleSelection = val;
|
|
|
+ },
|
|
|
+
|
|
|
+ //导出功能
|
|
|
+ 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;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ formatJson(filterVal) {
|
|
|
+ return this.list.map((v) =>
|
|
|
+ filterVal.map((j) => {
|
|
|
+ if (j === "timestamp") {
|
|
|
+ return parseTime(v[j]);
|
|
|
+ } else {
|
|
|
+ return v[j];
|
|
|
+ }
|
|
|
+ })
|
|
|
+ );
|
|
|
+ },
|
|
|
+
|
|
|
+ //时间格式化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/, "");
|
|
|
+ },
|
|
|
+
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style scoped>
|
|
|
+.table-tit {
|
|
|
+ background: rgb(235, 241, 255);
|
|
|
+ border: 1px solid #d9d9d9;
|
|
|
+ border-bottom: 0;
|
|
|
+ font-weight: bold;
|
|
|
+ padding: 8px 10px;
|
|
|
+}
|
|
|
+.el-checkbox {
|
|
|
+ margin-right: 15px;
|
|
|
+ line-height: 0;
|
|
|
+}
|
|
|
+.el-dialog {
|
|
|
+ min-width: 736px !important;
|
|
|
+}
|
|
|
+</style>
|
|
|
+<style >
|
|
|
+</style>
|