From 610a3c14abbd833de453bf4fe4dc0ce771482681 Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期五, 25 十一月 2022 14:24:35 +0800
Subject: [PATCH] 完善数据上报
---
src/views/dataPush/components/device.vue | 62 ++++++++++++++++++++++++------
1 files changed, 49 insertions(+), 13 deletions(-)
diff --git a/src/views/dataPush/components/device.vue b/src/views/dataPush/components/device.vue
index 41f078d..93d91fd 100644
--- a/src/views/dataPush/components/device.vue
+++ b/src/views/dataPush/components/device.vue
@@ -3,7 +3,7 @@
<div class="search">
<div class="left">
<div class="id">
- 璁惧鍚嶇О
+ 璁惧鍚嶇О/IP/缂栫爜
<el-input v-model="inputText" placeholder="璇疯緭鍏�" clearable></el-input>
</div>
</div>
@@ -22,23 +22,28 @@
<div class="table-area">
<el-table
- id="multipleTable"
- ref="multipleTable"
+ v-loading="tbLoading"
+ id="devTable"
+ ref="devTable"
:data="dataList"
:fit="true"
- :default-sort="{ prop: 'createTime', order: 'descending' }"
+ :default-sort="{ prop: 'devCode', order: 'ascending' }"
>
<el-table-column prop="devName" label="璁惧鍚嶇О" show-overflow-tooltip></el-table-column>
<!-- <el-table-column prop="devId" label="璁惧ID" show-overflow-tooltip></el-table-column> -->
<el-table-column prop="devIp" label="璁惧IP" show-overflow-tooltip></el-table-column>
<el-table-column prop="devCode" label="璁惧缂栫爜" show-overflow-tooltip></el-table-column>
- <el-table-column prop="state" label="鐘舵��" show-overflow-tooltip>
+ <el-table-column label="浼佷笟缂栫爜" show-overflow-tooltip>
<template slot-scope="scope">
- <div v-if="scope.row.state == 0" class="status green">绂荤嚎</div>
- <div v-else class="status">鍦ㄧ嚎</div>
+ {{ scope.row.companyCode | fillCompanyCode(companyCodeOptions) }}
</template>
</el-table-column>
- <el-table-column prop="companyCode" label="浼佷笟缂栫爜" show-overflow-tooltip></el-table-column>
+ <el-table-column prop="state" label="鐘舵��" show-overflow-tooltip>
+ <template slot-scope="scope">
+ <div v-if="scope.row.state == 0" class="status">绂荤嚎</div>
+ <div v-else class="status green">鍦ㄧ嚎</div>
+ </template>
+ </el-table-column>
<el-table-column label="鎿嶄綔" align="center" width="100px">
<template slot-scope="scope">
@@ -88,7 +93,7 @@
<el-input v-model="ruleForm.devCode" placeholder="璇疯緭鍏ヨ澶囩紪鐮�" style="width: 350px"></el-input>
</el-form-item>
<el-form-item label="浼佷笟缂栫爜" prop="companyCode">
- <el-input v-model="ruleForm.companyCode" placeholder="璇疯緭鍏ヤ紒涓氱紪鐮�" style="width: 350px"></el-input>
+ <el-input v-model="ruleForm.companyCode" placeholder="璇疯緭鍏ヤ紒涓氱紪鐮�" style="width: 350px"> </el-input>
</el-form-item>
</el-form>
<div class="right">
@@ -103,13 +108,38 @@
import { getDevicesList, devicesCreate, devicesUpdate, devicesDelete } from "@/api/report"
export default {
+ filters: {
+ fillCompanyCode(key, opts) {
+ let obj = opts.find((t) => t.value == key)
+ return obj ? obj.lable : key
+ }
+ },
data() {
return {
+ tbLoading: false,
query: {},
inputText: "", //杈撳叆妗嗗唴瀹�
isShowAdd: false, //鏄惁灞曠ず鏂板寮圭獥
dataList: [],
tip: 1,
+ companyCodeOptions: [
+ {
+ value: "370300010",
+ lable: "370300010/姹囦赴"
+ },
+ {
+ value: "370300450",
+ lable: "370300450/娴风泭"
+ },
+ {
+ value: "370300440",
+ lable: "370300440/閲戞眹涓�"
+ },
+ {
+ value: "370300480",
+ lable: "370300480/涓眹"
+ }
+ ],
ruleForm: {
//y
devName: "",
@@ -145,6 +175,7 @@
mounted() {},
methods: {
async fetchDevicesList(val) {
+ this.tbLoading = true
if (val === 1) {
let query = { pageIndex: this.page, pageSize: this.size, keyword: this.inputText }
this.query = query
@@ -156,10 +187,13 @@
this.dataList = res.data
this.total = res.total
}
+ setTimeout(() => {
+ this.tbLoading = false
+ }, 200)
},
delUser(row) {
console.log(row, "row")
- this.$confirm("纭瑕佸垹闄よ鐢ㄦ埛鍚�, 鏄惁缁х画?", "鎻愮ず", {
+ this.$confirm("纭瑕佸垹闄よ澶囧悧, 鏄惁缁х画?", "鎻愮ず", {
confirmButtonText: "纭畾",
cancelButtonText: "鍙栨秷",
type: "warning"
@@ -177,12 +211,12 @@
//鍒嗛〉鍔熻兘
handleSizeChange(size) {
this.size = size
- this.fetchDevicesList()
+ this.fetchDevicesList(1)
},
//鍒嗛〉鍔熻兘
refrash(page) {
this.page = page
- this.fetchDevicesList()
+ this.fetchDevicesList(1)
},
addDevice() {
@@ -226,6 +260,7 @@
message: res.data
})
this.goback()
+ this.fetchDevicesList()
}
})
} else if (this.tip === 2) {
@@ -248,6 +283,7 @@
message: res.msg
})
this.goback()
+ this.fetchDevicesList()
}
})
}
@@ -259,7 +295,7 @@
goback() {
this.isShowAdd = false
},
- async editUser(row) {
+ editUser(row) {
this.tip = 2
this.isShowAdd = true
this.ruleForm.devName = row.devName
--
Gitblit v1.8.0