parameter.vue
2.5 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<template>
<div>
<el-dialog
title="参数设置"
:visible.sync="dialogVisible"
width="60%"
:before-close="handleClose"
>
<span>
<el-input placeholder="请输入内容" v-model="paramsval" class="input-with-select">
<el-button
slot="append"
icon="el-icon-search"
@click="$refs.iframe.contentWindow.clickButton(paramsval)"
></el-button>
</el-input>
<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 {
paramsval:"",
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);
}, 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>';
if (this.XMLStr.split("@").length > 1) {
this.XMLStr = '<?xml version="1.0" encoding="GBK"?><root></root>';
}
if (obj && obj.basicConfig && obj.basicConfig.xml) {
this.basicXml = obj.basicConfig.xml;
this.$refs.iframe.contentWindow.loadParameterTree(
this.basicXml,
this.XMLStr
);
} else {
console.error("参数配置存在错误!请检测basicConfig是否为空");
}
},
save: function() {
this.$refs.iframe.contentWindow.submit();
//ifram 传递回来的饿xml
this.XMLStr = this.$refs.iframe.contentWindow.xmlStr;
this.handleClose();
this.$parent.submit(this.XMLStr, "config");
},
handleClose(done) {
this.dialogVisible = false;
this.$store.commit("setocxstate", 1);
}
}
};
</script>
<style lang="stylus" scoped>
.input-with-select{
width 300px
margin-bottom 5px;
}
</style>