From c3724c5d5a1f5b8feb39a7e7e35fb994dbf332f9 Mon Sep 17 00:00:00 2001
From: mark <mark18340872469@163.com>
Date: 星期五, 30 九月 2022 18:17:04 +0800
Subject: [PATCH] 客户需求优化(页面2
---
src/views/dataPush/components/point.vue | 312 +++++++++++++++++++++++++++++++++++++++------------
1 files changed, 236 insertions(+), 76 deletions(-)
diff --git a/src/views/dataPush/components/point.vue b/src/views/dataPush/components/point.vue
index bdd9d7b..4614ced 100644
--- a/src/views/dataPush/components/point.vue
+++ b/src/views/dataPush/components/point.vue
@@ -1,10 +1,33 @@
<template>
<div class="sub-account" v-if="!isShowAdd">
+ <div class="search">
+ <div class="left">
+ <div class="id">
+ 鐐逛綅鍚嶇О
+ <el-input v-model="inputText" placeholder="璇疯緭鍏�" clearable></el-input>
+ </div>
+ </div>
+
+ <div class="right">
+ <div class="button searchBtn" @click="checkCamerasList(1)">鎼滅储</div>
+ </div>
+ </div>
<div class="btns">
<div class="button add" @click="addPoint">
<span class="iconfont"></span>
<span>娣诲姞鐐逛綅</span>
</div>
+ <!-- <div class="switchBox">
+ 鎬荤偣浣嶅紑鍏�
+ <el-switch
+ v-model="value1"
+ width="60"
+ active-color="#13ce66"
+ inactive-color="#f0f3f5"
+ @change="changeAll($event)"
+ >
+ </el-switch>
+ </div> -->
</div>
<div class="table-area">
@@ -15,14 +38,28 @@
:fit="true"
:default-sort="{ prop: 'createTime', order: 'descending' }"
>
- <el-table-column prop="cameraName" label="鐐逛綅鍚嶇О" show-overflow-tooltip></el-table-column>
+ <el-table-column prop="cameraName" label="鐐逛綅鍚嶇О" width="130px" show-overflow-tooltip></el-table-column>
<el-table-column prop="channelCode" label="鎶ヨ閫氶亾缂栫爜" show-overflow-tooltip></el-table-column>
- <el-table-column prop="companyCode" label="浼佷笟缂栫爜" show-overflow-tooltip></el-table-column>
+ <el-table-column prop="companyCode" label="浼佷笟缂栫爜" width="130px" show-overflow-tooltip></el-table-column>
<el-table-column prop="scenes" label="鎺ㄩ�佸満鏅�" show-overflow-tooltip></el-table-column>
- <el-table-column prop="updatedAt" label="鎺ㄩ�佹椂闂�" show-overflow-tooltip></el-table-column>
+ <el-table-column prop="updatedAt" label="鎺ㄩ�佹椂闂�" width="100px" show-overflow-tooltip>
+ <template slot-scope="scope">{{ scope.row.startTime }}-{{ scope.row.endTime }}</template>
+ </el-table-column>
+ <el-table-column prop="Enable" label="寮�鍏�" width="70px" show-overflow-tooltip>
+ <template slot-scope="scope">
+ <el-switch
+ v-model="scope.row.enable"
+ @change="changeSwitch($event, scope.row)"
+ active-color="#13ce66"
+ inactive-color="#f0f3f5"
+ >
+ </el-switch>
+ </template>
+ </el-table-column>
<el-table-column label="鎿嶄綔" align="center" width="100px">
<template slot-scope="scope">
+ <span class="iconfont option" @click="editCameras(scope.row)">缂栬緫</span>
<span class="iconfont option" style="color:red" @click="delCameras(scope.row)">鍒犻櫎</span>
</template>
</el-table-column>
@@ -48,12 +85,11 @@
:rules="rules"
:label-position="'left'"
ref="ruleForm"
- label-width="100px"
+ label-width="120px"
class="add-ruleForm"
>
<el-form-item label="鐐逛綅鍚嶇О" prop="CameraName">
- <!-- <el-input v-model="ruleForm.CameraName" placeholder="璇疯緭鍏ョ偣浣嶅悕绉�" style="width: 350px"></el-input> -->
- <el-select style="width: 350px" v-model="ruleForm.CameraName" placeholder="璇烽�夋嫨">
+ <el-select filterable style="width: 350px" v-model="ruleForm.CameraName" placeholder="璇烽�夋嫨">
<el-option v-for="item in cameraOptions" :key="item.id" :label="item.name" :value="item.name"> </el-option>
</el-select>
</el-form-item>
@@ -69,7 +105,7 @@
</el-option>
</el-select>
</el-form-item>
- <el-form-item label="鎺ㄩ�佹椂闂�">
+ <el-form-item label="鎺ㄩ�佹椂闂�" required>
<el-col :span="12" style="width: 175px">
<el-form-item prop="StartTime">
<el-time-select
@@ -79,7 +115,8 @@
:picker-options="{
start: '00:00',
step: '00:30',
- end: '23:30'
+ end: ruleForm.EndTime ? ruleForm.EndTime : '24:00',
+ maxTime: ruleForm.EndTime
}"
>
</el-time-select>
@@ -92,9 +129,10 @@
placeholder="缁撴潫鏃堕棿"
v-model="ruleForm.EndTime"
:picker-options="{
- start: '00:00',
+ start: ruleForm.StartTime ? ruleForm.StartTime : '00:00',
step: '00:30',
- end: '23:30'
+ end: '24:00',
+ minTime: ruleForm.StartTime
}"
>
</el-time-select>
@@ -103,7 +141,7 @@
</el-form-item>
</el-form>
<div class="right">
- <div class="button searchBtn" @click="saveUser">淇濆瓨</div>
+ <div class="button searchBtn" @click="save">淇濆瓨</div>
<div class="button resetBtn" @click="resetUser">閲嶇疆</div>
<div class="button resetBtn" style="margin-left:20px" @click="goback">杩斿洖</div>
</div>
@@ -113,11 +151,18 @@
<script>
import { getLocalCameraTree } from "@/api/area"
import { getClusterDevList } from "@/api/clusterManage"
-import { camerasList, camerasCreate, camerasDelete } from "@/api/report"
+import { camerasList, camerasCreate, camerasConfig, camerasSwitch, camerasUpdate, camerasDelete } from "@/api/report"
+import { traverse } from "./point/point"
+import "./point/point.scss"
export default {
data() {
return {
+ activeColor: "",
+ inactiveColor: "#f0f3f5",
+ value1: false,
+ query: {},
+ inputText: "", //杈撳叆妗嗗唴瀹�
cameraOptions: [],
scene_nameOptions: [
{
@@ -135,10 +180,6 @@
{
value: "鍖哄煙鍏ヤ镜",
label: "鍖哄煙鍏ヤ镜"
- },
- {
- value: "浜哄憳鎾ょ",
- label: "浜哄憳鎾ょ"
},
{
value: "浜哄憳绂诲矖",
@@ -161,8 +202,8 @@
label: "鏈僵鎴村畨鍏ㄥ附"
},
{
- value: "鏈┛鐫�宸ヤ綔鏈�",
- label: "鏈┛鐫�宸ヤ綔鏈�"
+ value: "鏈┛宸ヨ",
+ label: "鏈┛宸ヨ"
},
{
value: "鐫″矖",
@@ -181,85 +222,184 @@
CameraId: "", // 鎽勫儚鏈篿d
Level: "",
- Enable: true
+ Enable: false,
+ createdAt: "",
+ updatedAt: "",
+ id: ""
},
-
dataList: [],
-
- tip: 1,
+ tip: 1, // 鍖哄垎淇濆瓨杩樻槸缂栬緫 浣嗘槸鐜板湪娌℃湁缂栬緫
rules: {
- CameraName: [{ required: true, message: "璇烽�夋嫨璁惧鍚嶇О", trigger: "change" }],
+ CameraName: [{ required: true, message: "璇烽�夋嫨鐐逛綅鍚嶇О", trigger: "change" }],
ChannelCode: [{ required: true, message: "璇疯緭鍏ユ姤璀﹂�氶亾缂栫爜", trigger: "blur" }],
CompanyCode: [{ required: true, message: "璇疯緭鍏ヤ紒涓氱紪鐮�", trigger: "blur" }],
- Sceneslist: [{ type: "array", required: true, message: "璇烽�夋嫨鎺ㄩ�佸満鏅�", trigger: "change" }]
- // StartTime: [{ required: true, message: "璇烽�夋嫨寮�濮嬫椂闂�", trigger: "change" }],
- // EndTime: [{ required: true, message: "璇烽�夋嫨缁撴潫鏃堕棿", trigger: "change" }]
+ Sceneslist: [{ type: "array", required: true, message: "璇烽�夋嫨鎺ㄩ�佸満鏅�", trigger: "change" }],
+ StartTime: [{ type: "string", required: true, message: "璇烽�夋嫨寮�濮嬫椂闂�", trigger: "change" }],
+ EndTime: [{ type: "string", required: true, message: "璇烽�夋嫨缁撴潫鏃堕棿", trigger: "change" }]
},
page: 1,
size: 10, //鍒嗛〉鐩稿叧
total: 0 //鎬绘暟,
}
},
- created() {
- this.checkCamerasList()
+ // computed: {
+ // // activeColor() {
+ // // return this.value1 ? "#13ce66" : "#f0f3f5"
+ // // }
+ // },
+ // watch: {
+ // value1: {
+ // handler(newVal, oldVal) {
+ // console.log(newVal, oldVal, "newVal, oldVal")
+ // newVal ? (this.activeColor = "#13ce66") : (this.activeColor = "#f0f3f5")
+ // },
+ // deep: true
+ // }
+ // },
+ async created() {
+ let query = { pageIndex: this.page, pageSize: this.size, keyword: this.inputText }
+ this.query = query
+ let res = await camerasList(query)
+ this.dataList = res.data
+ this.total = res.total
this.aaaaa()
},
- // const rsp: any = await getLocalCameraTree(params)
- // console.log(rsp, "rsp")
methods: {
+ async changeAll(val) {
+ let enable
+ val ? (enable = 1) : (enable = 0)
+ let rsp = await camerasSwitch({ enable: enable })
+ if (rsp && rsp.success) {
+ this.$message({
+ type: "success",
+ message: "鎴愬姛!"
+ })
+ this.checkCamerasList()
+ }
+ },
+ changeSwitch(val, row) {
+ let params = {
+ CameraName: row.cameraName,
+ ChannelCode: row.channelCode,
+ CompanyCode: row.companyCode,
+ Scenes: row.scenes,
+ StartTime: row.startTime,
+ EndTime: row.endTime,
+ CameraId: row.cameraId, //
+ Level: row.level,
+ Enable: val,
+ createdAt: row.createdAt,
+ updatedAt: row.updatedAt,
+ id: row.id
+ }
+ camerasUpdate(params).then((res) => {
+ if (res && res.success) {
+ this.$message({
+ type: "success",
+ message: res.msg
+ })
+ }
+ })
+ },
+ editCameras(row) {
+ this.tip = 2
+ this.isShowAdd = true
+ this.resetUser()
+ this.ruleForm.StartTime = row.startTime
+ this.ruleForm.EndTime = row.endTime
+ this.ruleForm.CameraName = row.cameraName
+ this.ruleForm.ChannelCode = row.channelCode
+ this.ruleForm.CompanyCode = row.companyCode
+ this.ruleForm.Sceneslist = row.scenes.split(",")
+
+ this.ruleForm.Level = row.level
+ this.ruleForm.Enable = row.enable
+ this.ruleForm.createdAt = row.createdAt
+ this.ruleForm.updatedAt = row.updatedAt
+ this.ruleForm.id = row.id
+ },
async aaaaa() {
+ // 杩涘叆椤甸潰鍓嶇殑鍒濆鍖�
+ let res = await camerasConfig()
+ // 鎬诲紑鍏�
+ if (res && res.success) {
+ res.data.enable === 0 ? (this.value1 = false) : (this.value1 = true)
+ }
let clusterId = ""
let clusterReq = await getClusterDevList()
+ // 鏌ヨ
if (clusterReq && clusterReq.success) {
if (clusterReq.data.clusterList.length > 0) {
clusterId = clusterReq.data.clusterList[0].cluster_id
}
}
- console.log(clusterId)
let camereReq = await getLocalCameraTree({ clusterId: clusterId })
- console.log(camereReq.data.treeMenu, "camereReqcamereReqcamereReq")
- let array = camereReq.data.treeMenu
- for (let i = 0; i < array.length; i++) {
- console.log(array[i].children, "11111111")
- for (let j = 0; j < array[i].children.length; j++) {
- this.cameraOptions.push(array[i].children[j])
- }
- }
- console.log(this.cameraOptions, "arrrrrrrrrrrrrrrr")
+ // 杩欎釜鏄� 娣诲姞鏃剁殑鐐逛綅 鏄粠鎽勫儚鏈洪〉闈� 鏉ョ殑
+ let array = []
+ this.cameraOptions = traverse(camereReq.data.treeMenu, array)
},
addPoint() {
this.isShowAdd = true
this.tip = 1
this.resetUser()
}, //y
- saveUser() {
+ save() {
this.$refs["ruleForm"].validate((valid) => {
if (valid) {
- let obj = this.cameraOptions.find((item) => item.name === this.ruleForm.CameraName)
- console.log(obj, "dddddddd")
- let params = {
- CameraName: this.ruleForm.CameraName,
- ChannelCode: this.ruleForm.ChannelCode,
- CompanyCode: this.ruleForm.CompanyCode,
- Scenes: this.ruleForm.Sceneslist.toString(),
- StartTime: this.ruleForm.StartTime,
- EndTime: this.ruleForm.EndTime,
- CameraId: obj.id, //
- Level: this.ruleForm.Level,
- Enable: this.ruleForm.Enable
- }
- console.log(params, "paramsv")
- camerasCreate(params).then((res) => {
- console.log(res, "res")
- if (res && res.success) {
- this.$message({
- type: "success",
- message: res.msg
- })
- this.goback()
+ if (this.tip !== 1) {
+ // tip1 鏄坊鍔� 鍏朵粬鏄紪杈�
+ let obj = this.cameraOptions.find((item) => item.name === this.ruleForm.CameraName)
+ let params = {
+ CameraName: this.ruleForm.CameraName,
+ ChannelCode: this.ruleForm.ChannelCode,
+ CompanyCode: this.ruleForm.CompanyCode,
+ Scenes: this.ruleForm.Sceneslist.toString(),
+ StartTime: this.ruleForm.StartTime,
+ EndTime: this.ruleForm.EndTime,
+ CameraId: obj.id, //
+ Level: this.ruleForm.Level,
+ Enable: this.ruleForm.Enable,
+ createdAt: this.ruleForm.createdAt,
+ updatedAt: this.ruleForm.updatedAt,
+ id: this.ruleForm.id
}
- })
+ // 缂栬緫
+ camerasUpdate(params).then((res) => {
+ if (res && res.success) {
+ this.$message({
+ type: "success",
+ message: res.msg
+ })
+ this.goback()
+ this.checkCamerasList()
+ }
+ })
+ } else {
+ let obj = this.cameraOptions.find((item) => item.name === this.ruleForm.CameraName)
+ let params = {
+ CameraName: this.ruleForm.CameraName,
+ ChannelCode: this.ruleForm.ChannelCode,
+ CompanyCode: this.ruleForm.CompanyCode,
+ Scenes: this.ruleForm.Sceneslist.toString(),
+ StartTime: this.ruleForm.StartTime,
+ EndTime: this.ruleForm.EndTime,
+ CameraId: obj.id, //
+ Level: this.ruleForm.Level,
+ Enable: this.ruleForm.Enable
+ }
+ // 鏂板缓
+ camerasCreate(params).then((res) => {
+ if (res && res.success) {
+ this.$message({
+ type: "success",
+ message: res.msg
+ })
+ this.goback()
+ this.checkCamerasList()
+ }
+ })
+ }
} else {
return false
}
@@ -290,20 +430,27 @@
this.checkCamerasList()
})
},
- async checkCamerasList() {
- let res = await camerasList({ pageIndex: this.page, pageSize: this.size })
- this.dataList = res.data
- this.total = res.total
+ async checkCamerasList(val) {
+ if (val === 1) {
+ let query = { pageIndex: this.page, pageSize: this.size, keyword: this.inputText }
+ this.query = query
+ let res = await camerasList(query)
+ this.dataList = res.data
+ this.total = res.total
+ } else {
+ let res = await camerasList(this.query)
+ this.dataList = res.data
+ this.total = res.total
+ }
},
resetUser() {
- this.ruleForm = {
- CameraName: "",
- ChannelCode: "",
- CompanyCode: "",
- Sceneslist: [],
- StartTime: "",
- EndTime: ""
- }
+ // this.ruleForm. = {
+ this.ruleForm.CameraName = ""
+ this.ruleForm.ChannelCode = ""
+ this.ruleForm.CompanyCode = ""
+ this.ruleForm.Sceneslist = []
+ this.ruleForm.StartTime = ""
+ this.ruleForm.EndTime = ""
},
goback() {
this.isShowAdd = false
@@ -312,6 +459,7 @@
}
</script>
+<style scoped lang="scss"></style>
<style scoped lang="scss">
.sub-account {
padding: 20px;
@@ -476,6 +624,11 @@
display: flex;
margin: 20px 0;
text-align: center;
+ justify-content: space-between;
+ .switchBox {
+ display: flex;
+ align-items: center;
+ }
.add {
margin-right: 20px;
width: 126px;
@@ -605,6 +758,13 @@
</style>
<style>
+/* .el-switch__core {
+ height: 32px !important;
+}
+.el-switch__core::after {
+ height: 30px !important;
+ width: 30px !important;
+} */
.el-date-table td.start-date span,
.el-date-table td.end-date span {
background-color: #0065ff;
--
Gitblit v1.8.0