zhangyanpeng
2024-05-29 1f227a1cf627526701c652ba84bae3e430bba8d3
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"><meta http-equiv="Expires" content="0"><meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Cache-control" content="no-cache"><meta http-equiv="Cache" content="no-cache">
    <title>页面编辑器</title>
    <script type="text/javascript">
        var pageVue = null;
            function loadJsCss(callback) {
            var jscss_urls = [];
            window.top.initJsCss(document, jscss_urls, callback);
        };
        
        function initVue() {
            vue = new BasicsVue({
                el: "#vbody",
                data: {
                    dataname: "",
                    row: {},
                    
                    testpages: [
                        {code: "p003", name: "表单设计", url: "module/ztest/表单设计.html"},
                        {code: "p001", name: "拖拽测试", url: "module/ztest/拖拽.html"},
                        {code: "p002", name: "画线工具", url: "module/ztest/画线工具.html"},
                        {code: "p004", name: "3D", url: "module/ztest/3D.html"},
                        {code: "p005", name: "缩放", url: "module/ztest/缩放.html"},
                        {code: "p006", name: "大小", url: "module/ztest/大小.html"},
                        {code: "p009", name: "测试", url: "module/ztest/测试.html"},
                        {code: "p007", name: "模板1", url: "module/system/page/sample_new/sample_table.html"},
                        {code: "p008", name: "模板5", url: "module/system/page/sample_new/sample_form_detail.html"},
 
 
                        
                    ],
                    testpagesobj: {}
                },
                created() {
                    var me = this;
                    this.testpages.map(p=>{
                        me.testpagesobj[p.code] = p;
                    })
                    
                },
                
                mounted() {
                    var me = this;
                },
                
                methods:{
                    getDataObjByDataName() {
                        var me = this;
                        //页面信息
                        var params = {
                            dataname: "sys_data_object",
                            filter: "name='" + this.dataname + "'",
                        }
                        
                        Server.call("root/data/getEntitySet", params, function(result) {
                            console.log(result);
                            
                            if (result && result.data.entityset && result.data.entityset.length == 1) {
                                me.row = result.data.entityset[0];
                                me.editData();
                            }
                            
                        });
                    },
                    
                    editData() {
                        var me = this;
                        var config = {
                            totab: false, //true: 以Tab导航的方式打开
                            width: "1200px",
                            height: "900px",
                            icon: "icon-product",
                            text: "字段详情",
                            id: "editor_form",//totab: true时需设置,用于判断是否已打开此页面
                            url: "module/system/page/page_editor/popup/editor_form.html",
                            data: me.row,
                            delta: {dataname: me.dataname},
                            sceneCode: "edit",
                            callback: function(obj, callback) {
                                if (callback) {
                                    callback();
                                }
                            }
                        };
                        me.doPopupByPublic(config);
                    },
                    
                    createObjectMeta() {
                        var me = this;
                        if (!this.dataname) {
                            return
                        }
                        var params = {
                            "dataName": this.dataname
                        }
                        Server.call("root/system/synchronizOneObjectMeta", params, function(result) {
                            console.log(result);
                            Root.message({
                                type: 'success',
                                message: "已生成"
                            });
                        })
                    },
                    
                    openPage(val) {
                        var page = this.testpagesobj[val];
                        this.opentestpage(page);
                    },
                    opentestpage(page) {
                        var me = this;
                        
                        var config = {
                            totab: false, //true: 以Tab导航的方式打开
                            width: "100vw",
                            height: "100vh",
                            icon: "icon-product",
                            text: page.name,
                            id: "test_" + page.code,//totab: true时需设置,用于判断是否已打开此页面
                            url: page.url,
                            data: {},
                            delta: {},//备案版本,
                            sceneCode: "browse",//"refuseedit",//"approval", //"add"//"browse",
                            callback: function(obj, callback) {
                                if (callback) {
                                    callback();
                                }
                            }
                        };
                        me.doPopupByPublic(config);
                    },
                    
                    
                }
            });
        };
        
        loadJsCss(function () {
            initVue();
        });
    </script>
</head>
 
<style>
    .h_menu {
        height: 100px;
        overflow: auto;
    }
</style>
 
<body style="margin: 0px;">
    <div v-cloak id="vbody">
        <div style="line-height: 40px; padding-left: 10px; padding-right: 10px;">
            <el-form label-width="80px">
                <el-form-item label="dataname:">
                    <el-input v-model="dataname" placeholder="要编辑的dataname"></el-input>
                </el-form-item>
            </el-form>
            <div style="text-align: end;">
                <el-dropdown @command="openPage">
                  <el-button type="primary">
                    更多测试页面<i class="el-icon-arrow-down el-icon--right"></i>
                  </el-button>
                  <el-dropdown-menu slot="dropdown" class="h_menu">
                      <el-dropdown-item v-for="(page, k) in testpages" :key="k" :command="page.code">{{page.name}}</el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
                
                <el-button-group>
                    <el-button size="mini" @click="createObjectMeta">生成字段</el-button>
                    <el-button size="mini" @click="getDataObjByDataName">编辑字段</el-button>
                </el-button-group>
            </div>
            
        </div>
    </div>
</body>
</html>