From 041e543111ff5b38dfa2815169cb4e31424e1893 Mon Sep 17 00:00:00 2001
From: hanbaoshan <hanbaoshan@aiotlink.com>
Date: 星期三, 03 二月 2021 11:24:03 +0800
Subject: [PATCH] 事件推送字段配置接口调试
---
src/pages/datapush/index/RightEvent.vue | 61 +++++++++++++++++++++---------
src/api/event.ts | 8 ++++
2 files changed, 50 insertions(+), 19 deletions(-)
diff --git a/src/api/event.ts b/src/api/event.ts
index 48e30cf..58db9b5 100644
--- a/src/api/event.ts
+++ b/src/api/event.ts
@@ -76,4 +76,12 @@
method: "get"
})
+}
+
+//鑾峰彇鎵�鏈夌殑鎺ㄩ�佸瓧娈甸厤缃�
+export const getPushSet = ()=>{
+ return request({
+ url:'/data/api-v/eventPush/getPushSet',
+ method:'get'
+ })
}
\ No newline at end of file
diff --git a/src/pages/datapush/index/RightEvent.vue b/src/pages/datapush/index/RightEvent.vue
index 5722008..59d8ad1 100644
--- a/src/pages/datapush/index/RightEvent.vue
+++ b/src/pages/datapush/index/RightEvent.vue
@@ -186,7 +186,7 @@
</div>
<div class="config-item">
<b>鎺ㄩ�佸瓧娈�</b>
- <el-button type="primary" size="mini" @click="pushFieldDialog=true">璁剧疆</el-button>
+ <el-button type="primary" size="mini" @click="openPushSetDialog">璁剧疆</el-button>
</div>
<div class="save-btn">
<el-button type="info" size="small" @click="onCancle" style="color:#222">鍙栨秷</el-button>
@@ -206,7 +206,7 @@
<el-checkbox v-model="allFieldChecked"></el-checkbox>
</div>
</div>
- <div class="check-area" v-for="configObj in pushFields" :key="configObj.id">
+ <div class="check-area" v-for="configObj in tempPushSet" :key="configObj.id">
<div class="header">
<div class="title">{{configObj.name}}</div>
<div class="right">
@@ -228,7 +228,7 @@
</div>
</div>
<div slot="footer" class="text-center">
- <el-button size="small">鍙栨秷</el-button>
+ <el-button size="small" @click="canclePushFieldSet">鍙栨秷</el-button>
<el-button
size="small"
type="primary"
@@ -241,7 +241,7 @@
</template>
<script>
-import { eventPushsSave, findByEventTopic } from "@/api/event";
+import { eventPushsSave, findByEventTopic,getPushSet } from "@/api/event";
import { findDictionaryByType, findDictionaryByID } from "@/api/dictionary";
import { getTaskList } from "@/api/search";
@@ -285,6 +285,7 @@
ruleValueOptions: []
},
pushFieldDialog: false,
+ tempPushSet: [],
pushFields: [],
allFieldChecked: false,
disabledPushFieldSet: true,
@@ -313,6 +314,12 @@
if (!this.taskEditData.urls) {
this.$set(this.taskEditData, "urls", [])
}
+ //this.taskEditData.push_set = this.eventObject.push_set;
+ if(!this.eventObject.push_set.length){
+ this.$set(this.taskEditData, "push_set", this.pushFields)
+ }else{
+ this.$set(this.taskEditData, "push_set", this.eventObject.push_set)
+ }
if (newVal.rules) {
newVal.rules.forEach(element => {
let newRule = Object.assign(JSON.parse(JSON.stringify(this.baseRule)), element)
@@ -326,7 +333,7 @@
},
deep: true
},
- pushFields: {
+ tempPushSet: {
handler (n, o) {
let _this = this;
let flag = false;
@@ -363,6 +370,10 @@
this.getPushFields();
},
methods: {
+ openPushSetDialog(){
+ this.pushFieldDialog=true;
+ this.tempPushSet = JSON.parse(JSON.stringify(this.taskEditData.push_set));
+ },
varifyField (param) {
var reg = /^[A-Za-z]+[0-9-_]?$/;
if (!reg.test(param.alias)) {
@@ -377,9 +388,13 @@
// })
},
+ canclePushFieldSet(){
+ this.pushFieldDialog = false;
+ },
submitPushFieldSet () {
let flag = false;
- this.pushFields.forEach(configObj => {
+ //this.pushFields.forEach(configObj => {
+ this.tempPushSet.forEach(configObj => {
let errorOne = configObj.children.find(param => param.checked && param.error);
if (errorOne) {
this.$notify({
@@ -390,9 +405,12 @@
}
});
if(flag){
+ //NO SUBMIT
return
}
- alert('submit')
+ this.taskEditData.push_set = this.tempPushSet;
+ console.log(this.taskEditData.push_set);
+ this.pushFieldDialog = false;
},
toggleConfigCheck (configObj) {
configObj.children.forEach(child => {
@@ -400,17 +418,21 @@
})
},
getPushFields () {
- this.pushFields = [
- { id: 'sxjxx', name: '鎽勫儚鏈轰俊鎭�', checked: false, alias: '',
- children: [
- { name: '鎽勫儚鏈篒D', checked: false, alias: 'cameraID', id: 'cameraID', children: null },
- { name: '鎽勫儚鏈哄悕绉�', checked: false, alias: 'cameraName', id: 'cameraName', children: null },
- { name: '鎽勫儚鏈哄湴鍧�', checked: false, alias: 'cameraAddr', id: 'cameraAddr', children: null },
- { name: '鎽勫儚鏈哄潃', checked: false, alias: 'cameraAdr', id: 'cameraAdr', children: null }
- ] },
- { id: 'cjxx', name: '鍦烘櫙淇℃伅', checked: false, alias: '',
- children: [{ name: '鍦烘櫙ID', checked: false, alias: 'taskId', id: 'tskId', children: null }] },
- ];
+ let _this = this;
+ getPushSet().then(res=>{
+ _this.pushFields = res.data;
+ })
+ // this.pushFields = [
+ // { id: 'sxjxx', name: '鎽勫儚鏈轰俊鎭�', checked: false, alias: '',
+ // children: [
+ // { name: '鎽勫儚鏈篒D', checked: false, alias: 'cameraID', id: 'cameraID', children: null },
+ // { name: '鎽勫儚鏈哄悕绉�', checked: false, alias: 'cameraName', id: 'cameraName', children: null },
+ // { name: '鎽勫儚鏈哄湴鍧�', checked: false, alias: 'cameraAddr', id: 'cameraAddr', children: null },
+ // { name: '鎽勫儚鏈哄潃', checked: false, alias: 'cameraAdr', id: 'cameraAdr', children: null }
+ // ] },
+ // { id: 'cjxx', name: '鍦烘櫙淇℃伅', checked: false, alias: '',
+ // children: [{ name: '鍦烘櫙ID', checked: false, alias: 'taskId', id: 'tskId', children: null }] },
+ // ];
},
addUrl () {
@@ -486,7 +508,8 @@
time_end: this.taskEditData.time[1],
urls: this.taskEditData.urls,
is_satisfy_all: this.taskEditData.radioValue === "1",
- link_type: this.taskEditData.lineWay
+ link_type: this.taskEditData.lineWay,
+ push_set: this.taskEditData.push_set
};
let res = await eventPushsSave(json);
--
Gitblit v1.8.0