From 2b1f7a47394363e95deb4dfa0f1c67d41e747f7f Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期三, 01 二月 2023 10:56:40 +0800 Subject: [PATCH] Merge branch 'wvp-28181-2.0' into fix-269 --- web_src/src/components/dialog/pushStreamEdit.vue | 180 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 180 insertions(+), 0 deletions(-) diff --git a/web_src/src/components/dialog/pushStreamEdit.vue b/web_src/src/components/dialog/pushStreamEdit.vue new file mode 100644 index 0000000..de4e7bc --- /dev/null +++ b/web_src/src/components/dialog/pushStreamEdit.vue @@ -0,0 +1,180 @@ +<template> + <div id="addStreamProxy" v-loading="isLoging"> + <el-dialog + title=" 鍔犲叆" + width="40%" + top="2rem" + :close-on-click-modal="false" + :visible.sync="showDialog" + :destroy-on-close="true" + @close="close()" + > + <div id="shared" style="margin-top: 1rem;margin-right: 100px;"> + <el-form ref="streamProxy" :rules="rules" :model="proxyParam" label-width="140px"> + <el-form-item label="鍚嶇О" prop="name"> + <el-input v-model="proxyParam.name" clearable></el-input> + </el-form-item> + <el-form-item label="娴佸簲鐢ㄥ悕" prop="app"> + <el-input v-model="proxyParam.app" clearable :disabled="edit"></el-input> + </el-form-item> + <el-form-item label="娴両D" prop="stream"> + <el-input v-model="proxyParam.stream" clearable :disabled="edit"></el-input> + </el-form-item> + <el-form-item label="鍥芥爣缂栫爜" prop="gbId"> + <el-input v-model="proxyParam.gbId" placeholder="璁剧疆鍥芥爣缂栫爜鍙帹閫佸埌鍥芥爣" clearable></el-input> + </el-form-item> + <el-form-item label="缁忓害" prop="longitude" v-if="proxyParam.gbId"> + <el-input v-model="proxyParam.longitude" placeholder="缁忓害" clearable></el-input> + </el-form-item> + <el-form-item label="绾害" prop="latitude" v-if="proxyParam.gbId"> + <el-input v-model="proxyParam.latitude" placeholder="缁忓害" clearable></el-input> + </el-form-item> + <el-form-item> + <div style="float: right;"> + <el-button type="primary" @click="onSubmit">淇濆瓨</el-button> + <el-button @click="close">鍙栨秷</el-button> + </div> + </el-form-item> + </el-form> + </div> + </el-dialog> + </div> +</template> + +<script> +export default { + name: "pushStreamEdit", + props: {}, + computed: {}, + created() {}, + data() { + // var deviceGBIdRules = async (rule, value, callback) => { + // console.log(value); + // if (value === "") { + // callback(new Error("璇疯緭鍏ヨ澶囧浗鏍囩紪鍙�")); + // } else { + // var exit = await this.deviceGBIdExit(value); + // console.log(exit); + // console.log(exit == "true"); + // console.log(exit === "true"); + // if (exit) { + // callback(new Error("璁惧鍥芥爣缂栧彿宸插瓨鍦�")); + // } else { + // callback(); + // } + // } + // }; + return { + listChangeCallback: null, + showDialog: false, + isLoging: false, + edit: false, + proxyParam: { + name: null, + app: null, + stream: null, + gbId: null, + longitude: null, + latitude: null, + }, + rules: { + name: [{ required: true, message: "璇疯緭鍏ュ悕绉�", trigger: "blur" }], + app: [{ required: true, message: "璇疯緭鍏ュ簲鐢ㄥ悕", trigger: "blur" }], + stream: [{ required: true, message: "璇疯緭鍏ユ祦ID", trigger: "blur" }], + gbId: [{ required: true, message: "璇疯緭鍏ュ浗鏍囩紪鐮�", trigger: "blur" }], + }, + }; + }, + methods: { + openDialog: function (proxyParam, callback) { + this.showDialog = true; + this.listChangeCallback = callback; + if (proxyParam != null) { + this.proxyParam = proxyParam; + this.edit = true + }else{ + this.proxyParam= { + name: null, + app: null, + stream: null, + gbId: null, + longitude: null, + latitude: null, + } + this.edit = false + } + }, + onSubmit: function () { + console.log("onSubmit"); + if (this.edit) { + this.$axios({ + method:"post", + url:`/api/push/save_to_gb`, + data: this.proxyParam + }).then( (res) => { + if (res.data.code === 0) { + this.$message({ + showClose: true, + message: "淇濆瓨鎴愬姛", + type: "success", + }); + this.showDialog = false; + if (this.listChangeCallback != null) { + this.listChangeCallback(); + } + } + }).catch((error)=> { + console.log(error); + }); + }else { + this.$axios({ + method:"post", + url:`/api/push/add`, + data: this.proxyParam + }).then( (res) => { + if (res.data.code === 0) { + this.$message({ + showClose: true, + message: "淇濆瓨鎴愬姛", + type: "success", + }); + this.showDialog = false; + if (this.listChangeCallback != null) { + this.listChangeCallback(); + } + } + }).catch((error)=> { + console.log(error); + }); + } + + }, + close: function () { + console.log("鍏抽棴鍔犲叆GB"); + this.showDialog = false; + this.$refs.streamProxy.resetFields(); + }, + deviceGBIdExit: async function (deviceGbId) { + var result = false; + var that = this; + await that.$axios({ + method:"get", + url:`/api/platform/exit/${deviceGbId}` + }).then(function (res) { + result = res.data; + }).catch(function (error) { + console.log(error); + }); + return result; + }, + checkExpires: function() { + if (this.platform.enable && this.platform.expires == "0") { + this.platform.expires = "300"; + } + }, + handleNodeClick: function (node){ + + } + }, +}; +</script> -- Gitblit v1.8.0