From db5872786c1e1697a59af41386136ee002bb68ad Mon Sep 17 00:00:00 2001 From: zhangzengfei <zhangzengfei@smartai.com> Date: 星期五, 30 六月 2023 17:17:12 +0800 Subject: [PATCH] 修改为汇丰默认图标,修改处理率计算方式 --- src/views/hashrate/CameraManage/CameraRules/components/AddRuleBox.vue | 185 +++++++++++++++++++-------------------------- 1 files changed, 79 insertions(+), 106 deletions(-) diff --git a/src/views/hashrate/CameraManage/CameraRules/components/AddRuleBox.vue b/src/views/hashrate/CameraManage/CameraRules/components/AddRuleBox.vue index 89a9593..87ed854 100644 --- a/src/views/hashrate/CameraManage/CameraRules/components/AddRuleBox.vue +++ b/src/views/hashrate/CameraManage/CameraRules/components/AddRuleBox.vue @@ -1,45 +1,30 @@ <template> <div class="AddBox"> - <div class="title"> - {{ editData.type ? "淇敼" : "娣诲姞" - }}{{ type === "separate" ? "鐙珛" : "鑱斿姩" }}鍦烘櫙 - </div> + <div class="title">{{ editData.type ? "淇敼" : "娣诲姞" }}{{ type === "separate" ? "鐙珛" : "鑱斿姩" }}鍦烘櫙</div> <div class="close iconfont" @click="close"></div> <el-form :model="ruleForm" :rules="rules" ref="form"> <div class="label">鍦烘櫙鍚嶇О</div> <el-form-item prop="scene_name"> - <el-input - class="h32" - v-model="ruleForm.scene_name" - placeholder="璇疯緭鍏�" - ></el-input> + <!-- <el-input class="h32" v-model="ruleForm.scene_name" placeholder="璇疯緭鍏�"></el-input> --> + + <el-select v-model="ruleForm.scene_name" filterable placeholder="璇烽�夋嫨"> + <el-option v-for="item in scene_nameOptions" :key="item.value" :label="item.label" :value="item.value"> + </el-option> + </el-select> </el-form-item> <div class="label">浜嬩欢绛夌骇</div> <el-form-item> - <el-select - class="h32" - v-model="ruleForm.alarm_level" - placeholder="璇烽�夋嫨" - > - <el-option - v-for="item in eventLevel" - :key="item.value" - :label="item.label" - :value="item.value" - ></el-option> + <el-select class="h32" v-model="ruleForm.alarm_level" placeholder="璇烽�夋嫨"> + <el-option v-for="item in eventLevel" :key="item.value" :label="item.label" :value="item.value"></el-option> </el-select> </el-form-item> <div class="label">鏃堕棿娈�</div> <el-form-item prop="time_rule_id"> - <el-select - class="h32 left" - v-model="ruleForm.time_rule_id" - placeholder="璇烽�夋嫨" - > + <el-select @change="changeValue($event)" class="h32 left" v-model="ruleForm.time_rule_id" placeholder="璇烽�夋嫨"> <el-option v-for="item in VideoManageData.TimeRules" :key="item.id" @@ -53,28 +38,13 @@ <div class="label">鍦烘櫙鎻忚堪</div> <el-form-item> - <el-input - class="h32" - v-model="ruleForm.desc" - type="textarea" - ></el-input> + <el-input class="h32" v-model="ruleForm.desc" type="textarea"></el-input> </el-form-item> <div class="label">浜嬩欢澹伴煶</div> <el-form-item> - <el-select - v-model="ruleForm.voice" - placeholder="璇烽�夋嫨" - value-key="id" - @change="selSound" - class="h32 left" - > - <el-option - v-for="item in soundList" - :key="item.id" - :label="item.name" - :value="item" - ></el-option> + <el-select v-model="ruleForm.voice" placeholder="璇烽�夋嫨" value-key="id" @change="selSound" class="h32 left"> + <el-option v-for="item in soundList" :key="item.id" :label="item.name" :value="item"></el-option> </el-select> <span @click="togglePlayer" v-show="ruleForm.voiceId.length"> <i v-if="togglePlay" class="iconfont"></i> @@ -88,82 +58,79 @@ <div class="cancelBtn button" @click="close">鍙栨秷</div> </div> - <TimeSlider - v-if="showTimeSlider" - @close="showTimeSlider = false" - ></TimeSlider> + <TimeSlider v-if="showTimeSlider" @close="showTimeSlider = false"></TimeSlider> </div> </template> <script> -import { getSoundList } from "@/api/event"; -import TimeSlider from "@/views/hashrate/CameraManage/CameraRules/components/TimeSlider"; +import { getSoundList } from "@/api/event" +import TimeSlider from "@/views/hashrate/CameraManage/CameraRules/components/TimeSlider" export default { props: { type: { - type: String, + type: String }, - editData: {}, + editData: {} }, components: { - TimeSlider, - }, - mounted() { - this.getSounds(); - this.eventAudio.addEventListener("ended", () => { - this.togglePlay = true; - }); + TimeSlider }, data() { return { + scene_nameOptions: [], ruleForm: { + time_name: "", alarm_level: 1, scene_name: "", desc: "", template_id: "", time_rule_id: "", voice: {}, - voiceId: "", + voiceId: "" }, eventLevel: [ { label: "涓�绾�", - value: 1, + value: 1 }, { label: "浜岀骇", - value: 2, + value: 2 }, { label: "涓夌骇", - value: 3, + value: 3 }, { label: "鍥涚骇", - value: 4, + value: 4 }, { label: "浜旂骇", - value: 5, - }, + value: 5 + } ], rules: { - scene_name: [ - { required: true, message: "璇疯緭鍏ュ満鏅悕绉�", trigger: "blur" }, - ], - time_rule_id: [ - { required: true, message: "璇烽�夋嫨鏃堕棿娈�", trigger: "blur" }, - ], + scene_name: [{ required: true, message: "璇烽�夋嫨鍦烘櫙鍚嶇О", trigger: "blur" }], + time_rule_id: [{ required: true, message: "璇烽�夋嫨鏃堕棿娈�", trigger: "blur" }] }, soundPath: "", togglePlay: true, eventAudio: new Audio(), soundList: [], - showTimeSlider: false, - }; + showTimeSlider: false + } }, + mounted() { + this.getSounds() + this.eventAudio.addEventListener("ended", () => { + this.togglePlay = true + }) + + this.scene_nameOptions = this.Constants.sceneNameOptions + }, methods: { //缂栬緫鏃跺洖濉暟鎹� initEditData() { @@ -175,72 +142,78 @@ time_rule_id: this.editData.rule.time_rule_id, voice: this.editData.rule.voice, voiceId: this.editData.rule.voiceId, - index: this.editData.index, - }; + index: this.editData.index + } this.soundList.forEach((item) => { if (item.id == this.editData.rule.voiceId) { - this.ruleForm.voiceId = item.id; - this.ruleForm.voice = item; + this.ruleForm.voiceId = item.id + this.ruleForm.voice = item } - }); + }) }, getSounds() { - let _this = this; + let _this = this getSoundList() .then((res) => { if (res.success) { - _this.soundList = [{ id: "", name: "绌�", path: "" }].concat( - res.data.voices - ); + _this.soundList = [{ id: "", name: "绌�", path: "" }].concat(res.data.voices) if (_this.editData.type) { - _this.initEditData(); + _this.initEditData() } } }) - .catch((e) => console.log(e)); + .catch((e) => console.log(e)) }, selSound(sound) { - this.soundPath = sound.path; - this.ruleForm.voiceId = sound.id; - this.togglePlay = true; - this.eventAudio.pause(); - this.$forceUpdate(); + this.soundPath = sound.path + this.ruleForm.voiceId = sound.id + this.togglePlay = true + this.eventAudio.pause() + this.$forceUpdate() // this.eventAudio. }, togglePlayer() { if (!this.soundPath) { this.$notify({ type: "info", - message: "璇峰厛閫夋嫨涓�涓0闊�!", - }); - return false; + message: "璇峰厛閫夋嫨涓�涓0闊�!" + }) + return false } - this.eventAudio.src = this.soundPath; + this.eventAudio.src = this.soundPath if (this.togglePlay) { - this.eventAudio.play(); - this.togglePlay = false; + this.eventAudio.play() + this.togglePlay = false } else { - this.eventAudio.pause(); - this.togglePlay = true; + this.eventAudio.pause() + this.togglePlay = true } }, close() { - this.$emit("close"); + this.$emit("close") }, save() { this.$refs["form"].validate((valid) => { if (valid) { this.$emit("save", { action: this.editData.type ? "edit" : "add", - data: this.ruleForm, - }); + data: this.ruleForm + }) } else { - return false; + return false } - }); + }) }, - }, -}; + changeValue(val) { + console.log(val, "val") + const res = this.VideoManageData.TimeRules.filter((item) => { + return item.id === val + }) + console.log(res, "res") + this.ruleForm.time_name = res[0].name + } + } +} </script> <style lang="scss" scoped> @@ -253,7 +226,7 @@ background-color: #fff; box-shadow: 0px 2px 16px 0px rgba(0, 43, 106, 0.25); - z-index: 2; + z-index: 2002; .title { box-sizing: border-box; @@ -328,4 +301,4 @@ } } } -</style> \ No newline at end of file +</style> -- Gitblit v1.8.0