parameter.vue
2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<template>
<div>
<el-dialog
title="参数设置"
:visible.sync="dialogVisible"
width="50%"
:before-close="handleClose">
<span>
<iframe
id="iframe"
ref="iframe"
src="./dynamicParameters.html"
frameborder="0"
width="100%"
height="415"
scrolling="no"
></iframe>
</span>
<span slot="footer" class="dialog-footer">
<el-button @click="handleClose">取 消</el-button>
<el-button type="primary" @click="save">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
return {
dialogVisible: false,
XMLStr:'',
basicXml:'',
taskData:""
};
},
methods: {
init(data){
this.$store.commit('setocxstate',0)
this.dialogVisible = true;
this.taskData = data;
let that = this;
setTimeout(()=>{
that.xmlInit(data.mtasks[0].scenes[0]);
},800)
},
balltaskinit(data){
this.$store.commit('setocxstate',0)
this.dialogVisible = true;
setTimeout(()=>{
this.xmlInit(data);
},800)
},
xmlInit: function (obj) {
this.XMLStr = obj.config.xml || '<?xml version="1.0" encoding="GBK"?><root></root>'
console.log('XML:'+this.XMLStr.split('@').length)
if (this.XMLStr.split('@').length>1) {
this.XMLStr = '<?xml version="1.0" encoding="GBK"?><root></root>'
}
this.basicXml = obj.basicConfig.xml;
this.$refs.iframe.contentWindow.loadParameterTree(this.basicXml,this.XMLStr);
},
save:function () {
this.$refs.iframe.contentWindow.submit();
//ifram 传递回来的饿xml
this.XMLStr = this.$refs.iframe.contentWindow.xmlStr;
this.dialogVisible = false;
this.$parent.submit(this.XMLStr,'config')
},
handleClose(done) {
this.dialogVisible = false;
this.$store.commit('setocxstate',1)
}
}
}
</script>
<style lang="stylus" scoped>
</style>