From ecaf8750dd9c537e581ae05c65be9a26db5e67a7 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期二, 24 十一月 2020 16:41:00 +0800 Subject: [PATCH] 完成向上级联->注册 --- web_src/src/components/platformEdit.vue | 42 +++++++++++++++++++++++++++++++++++------- 1 files changed, 35 insertions(+), 7 deletions(-) diff --git a/web_src/src/components/platformEdit.vue b/web_src/src/components/platformEdit.vue index faacdde..7dee4ca 100644 --- a/web_src/src/components/platformEdit.vue +++ b/web_src/src/components/platformEdit.vue @@ -30,7 +30,7 @@ <el-form-item label="鏈湴绔彛" prop="devicePort"> <el-input v-model="platform.devicePort" :disabled="true"></el-input> </el-form-item> - + </el-form> </el-col> <el-col :span="12"> @@ -61,8 +61,8 @@ </el-form-item> <el-form-item label="鍏朵粬閫夐」" > <el-checkbox label="鍚敤" v-model="platform.enable" ></el-checkbox> - <el-checkbox label="鍏佽浜戝彴鎺у埗" v-model="platform.PTZEnable"></el-checkbox> - <el-checkbox label="鍚敤RTCP淇濇椿" v-model="platform.rtcp"></el-checkbox> + <el-checkbox label="浜戝彴鎺у埗" v-model="platform.PTZEnable"></el-checkbox> + <el-checkbox label="RTCP淇濇椿" v-model="platform.rtcp"></el-checkbox> </el-form-item> <el-form-item> <el-button type="primary" @click="onSubmit">{{onSubmit_text}}</el-button> @@ -81,10 +81,26 @@ name: 'platformEdit', 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, @@ -145,7 +161,7 @@ { required: true, message:"璇疯緭鍏IP鏈嶅姟绔彛", trigger: 'blur' } ], deviceGBId: [ - { required: true, message:"璇疯緭鍏ヨ澶囧浗鏍囩紪鍙�", trigger: 'blur' } + {validator: deviceGBIdRules, trigger: 'blur' } ], username: [ { required: false, message:"璇疯緭鍏IP璁よ瘉鐢ㄦ埛鍚�", trigger: 'blur' } @@ -176,7 +192,7 @@ this.platform = platform; this.onSubmit_text = "淇濆瓨" } - + }, onSubmit: function () { console.log('onSubmit'); @@ -206,7 +222,19 @@ this.showDialog = false; this.$refs.platform1.resetFields(); this.$refs.platform2.resetFields(); - + }, + deviceGBIdExit: async function (deviceGbId) { + var result = false; + var that = this + await that.$axios.post(`/api/platforms/exit/${deviceGbId}`) + .then(function (res) { + result = res.data; + }) + .catch(function (error) { + console.log(error); + }); + return result; + } } -- Gitblit v1.8.0