From c72156587ad51a022b2e3fced4701c8c9785302f Mon Sep 17 00:00:00 2001 From: mark <mark18340872469@163.com> Date: 星期日, 09 十月 2022 16:31:30 +0800 Subject: [PATCH] 请求拦截器 小改 --- src/views/dataPush/components/point.vue | 109 +++++++++++++++++++++++++++--------------------------- 1 files changed, 55 insertions(+), 54 deletions(-) diff --git a/src/views/dataPush/components/point.vue b/src/views/dataPush/components/point.vue index 86afa06..4614ced 100644 --- a/src/views/dataPush/components/point.vue +++ b/src/views/dataPush/components/point.vue @@ -10,7 +10,6 @@ <div class="right"> <div class="button searchBtn" @click="checkCamerasList(1)">鎼滅储</div> - <!-- <div class="button resetBtn" @click="reset">閲嶇疆</div> --> </div> </div> <div class="btns"> @@ -18,10 +17,17 @@ <span class="iconfont"></span> <span>娣诲姞鐐逛綅</span> </div> - <div class="switchBox"> - <el-switch v-model="value1" @change="changeAll($event)" active-text="鎬荤偣浣嶅紑" inactive-text="鎬荤偣浣嶅叧"> + <!-- <div class="switchBox"> + 鎬荤偣浣嶅紑鍏� + <el-switch + v-model="value1" + width="60" + active-color="#13ce66" + inactive-color="#f0f3f5" + @change="changeAll($event)" + > </el-switch> - </div> + </div> --> </div> <div class="table-area"> @@ -32,9 +38,9 @@ :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="鎺ㄩ�佹椂闂�" width="100px" show-overflow-tooltip> <template slot-scope="scope">{{ scope.row.startTime }}-{{ scope.row.endTime }}</template> @@ -83,7 +89,7 @@ class="add-ruleForm" > <el-form-item label="鐐逛綅鍚嶇О" prop="CameraName"> - <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> @@ -109,7 +115,7 @@ :picker-options="{ start: '00:00', step: '00:30', - end: ruleForm.EndTime ? ruleForm.EndTime : '23:30', + end: ruleForm.EndTime ? ruleForm.EndTime : '24:00', maxTime: ruleForm.EndTime }" > @@ -125,7 +131,7 @@ :picker-options="{ start: ruleForm.StartTime ? ruleForm.StartTime : '00:00', step: '00:30', - end: '23:30', + end: '24:00', minTime: ruleForm.StartTime }" > @@ -135,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> @@ -144,13 +150,16 @@ <script> import { getLocalCameraTree } from "@/api/area" -import { traverse } from "./point" import { getClusterDevList } from "@/api/clusterManage" 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: "", //杈撳叆妗嗗唴瀹� @@ -218,12 +227,10 @@ updatedAt: "", id: "" }, - dataList: [], - 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" }], @@ -235,6 +242,20 @@ total: 0 //鎬绘暟, } }, + // 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 @@ -244,11 +265,8 @@ this.aaaaa() }, - // const rsp: any = await getLocalCameraTree(params) - // console.log(rsp, "rsp") methods: { async changeAll(val) { - console.log(val) let enable val ? (enable = 1) : (enable = 0) let rsp = await camerasSwitch({ enable: enable }) @@ -261,7 +279,6 @@ } }, changeSwitch(val, row) { - console.log(val, row, "val, rowval, row") let params = { CameraName: row.cameraName, ChannelCode: row.channelCode, @@ -277,7 +294,6 @@ id: row.id } camerasUpdate(params).then((res) => { - console.log(res, "res") if (res && res.success) { this.$message({ type: "success", @@ -287,7 +303,6 @@ }) }, editCameras(row) { - console.log(row, "row") this.tip = 2 this.isShowAdd = true this.resetUser() @@ -305,20 +320,22 @@ 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) - console.log(this.value1) } 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 }) + // 杩欎釜鏄� 娣诲姞鏃剁殑鐐逛綅 鏄粠鎽勫儚鏈洪〉闈� 鏉ョ殑 let array = [] this.cameraOptions = traverse(camereReq.data.treeMenu, array) }, @@ -327,12 +344,12 @@ this.tip = 1 this.resetUser() }, //y - saveUser() { + save() { this.$refs["ruleForm"].validate((valid) => { if (valid) { if (this.tip !== 1) { + // tip1 鏄坊鍔� 鍏朵粬鏄紪杈� 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, @@ -347,8 +364,8 @@ updatedAt: this.ruleForm.updatedAt, id: this.ruleForm.id } + // 缂栬緫 camerasUpdate(params).then((res) => { - console.log(res, "res") if (res && res.success) { this.$message({ type: "success", @@ -360,7 +377,6 @@ }) } else { 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, @@ -372,9 +388,8 @@ 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", @@ -436,15 +451,6 @@ this.ruleForm.Sceneslist = [] this.ruleForm.StartTime = "" this.ruleForm.EndTime = "" - - // Scenes: "", - // CameraId: "", // 鎽勫儚鏈篿d - // Level: "", - // Enable: false, - // createdAt: "", - // updatedAt: "", - // id: "" - // } }, goback() { this.isShowAdd = false @@ -453,21 +459,8 @@ } </script> -// +<style scoped lang="scss"></style> <style scoped lang="scss"> -// -</style> -<style scoped lang="scss"> -::deep .el-switch { - color: #f52323; - .el-switch__core { - height: 32px !important; - } - .el-switch__core::after { - height: 30px !important; - width: 30px !important; - } -} .sub-account { padding: 20px; .head-name { @@ -628,13 +621,14 @@ } .btns { + display: flex; + margin: 20px 0; + text-align: center; + justify-content: space-between; .switchBox { display: flex; align-items: center; } - display: flex; - margin: 20px 0; - text-align: center; .add { margin-right: 20px; width: 126px; @@ -764,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