1
2024-01-24 67fb3bd7367fdf8a5b2186d4ff1c0f4d572c6d91
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>任务首页</title>
    <meta name="author" content="小柒2012" />
    <meta name="site" content="https://blog.52itstyle.com" />
    <link rel="stylesheet" th:href="@{/iview/iview.css}">
    <script th:src="@{/libs/jquery-3.2.1.min.js}" type="text/javascript"></script>
    <script th:src="@{/libs/vue.min.js}" type="text/javascript"></script>
    <script th:src="@{/layer/layer.js}" type="text/javascript"></script>
    <script th:src="@{/iview/iview.min.js}" type="text/javascript"></script>
    <script th:src="@{/common.js}" type="text/javascript"></script>
    <style type="text/css">
        [v-cloak] {
            display: none;
        }
    </style>
</head>
<body>
<div id="app" v-cloak>
    <div style="margin-bottom: 6px;margin: 30px">
        <i-input v-model="content" placeholder="异构系统分发配置"  style="width: 300px"></i-input>
        <i-button type="primary" @click="search()" icon="ios-search">搜索</i-button>
        <i-button type="primary" @click="empty()" icon="ios-close-empty">清空</i-button>
        <i-button type="info" style="float: right;" @click="add()" icon="person-add">新增</i-button>
    </div>
    <div style="margin-bottom: 6px;margin: 30px">
        <template>
            <i-table border :content="self" :columns="tableTitle" :data="JobData"></i-table>
            <br>
            <Page  style="float: right;" :current="pageNo" :total="tableSize" :page-size="pageSize"  @on-change="changePage" @on-page-size-change="changePageSize" show-elevator show-sizer show-total></Page>
        </template>
    </div>
</div>
<script type="text/javascript">
    var vm = new Vue({
        el : '#app',
        data : {
            content : '',
            pageNo : 1,
            pageSize : 10,
            jobName : "",
            JobData : [],
            tableSize : 50,
            tableTitle:[ {
                key : "sysName",
                title : "系统名称"
            }, {
                key : "address",
                title : "分发地址"
            }, {
                key : "description",
                title : "接口描述"
            }, {
                key : "association",
                title : "关联接口"
            }, {
                key : "isEnable",
                title : "是否启用"
            },{
                key : "cronExpression",
                title : "操作时间"
            }, {
                title : '操作',
                key : 'action',
                width : 300,
                align : 'left',
                render : function(h, params) {
                    var functionList = [];
                    //修改
                    var edit = h('Button', {
                        props : {
                            type : 'primary',
                            size : 'small',
                            icon : 'edit'
                        },
                        style : {
                            marginRight : '8px'
                        },
                        on : {
                            click : function() {
                                vm.edit(params.row.id,params.row.sysName,params.row.address,params.row.description,params.row.association,params.row.isEnable,params.row.cronExpression);
                            }
                        }
                    }, '修改');
                    functionList.push(edit);
                    //废弃
                    var remove = h('Button', {
                        props : {
                            type : 'primary',
                            size : 'small',
                            icon : 'close'
                        },
                        style : {
                            marginRight : '8px'
                        },
                        on : {
                            click : function() {
                                vm.remove(params.row.id,params.row.sysName,params.row.address,params.row.description,params.row.association,params.row.cronExpression);
                            }
                        }
                    }, '废弃');
                    functionList.push(remove);
                    //启用
                    var enable = h('Button', {
                        props : {
                            type : 'primary',
                            size : 'small',
                            icon : 'ios-reload'
                        },
                        style : {
                            marginRight : '8px'
                        },
                        on : {
                            click : function() {
                                vm.enable(params.row.id,params.row.sysName,params.row.address,params.row.description,params.row.association,params.row.cronExpression);
                            }
                        }
                    }, '启用');
                    functionList.push(enable);
                    // 返回方法集合
                    return h('div', functionList);
                }
            }]
 
        },
        methods : {
            //搜索
            search : function(){
                $.ajax({
                    url:"../distribution/list",
                    type:"post",
                    data:{'sysName':this.content,"pageNo":this.pageNo,'pageSize':this.pageSize},
                    success: function(result) {
 
                    }
                });
            },
            empty : function(){
                vm.content = '';
                this.list();
            },
            //任务列表(自行实现分页)
            list : function() {
                $.ajax({
                    url:"../distribution/list",
                    type:"post",
                    data:{'time':(new Date()).toString(),"pageNo":this.pageNo,'pageSize':this.pageSize},
                    success: function(result) {
                        vm.JobData = result.msg.pageData;
                        vm.tableSize = result.msg.totalCount;
                    }
                });
            },
            //启用
            enable : function(id,sysName,address,description,association,cronExpression){
                $.ajax({
                    url:"../distribution/enable",
                    type:"post",
                    data:{'time':(new Date()).toString(),"id":id,"sysName":sysName,"address":address,"description":description,"association":association,"cronExpression":cronExpression},
                    success: function(result) {
                        if(result.code=="0"){
                            vm.$Notice.success({
                                desc:  '启用配置成功'
                            });
                            vm.list();
                        }
                    }
                });
            },
            //新建任务
            add : function(){
                dialogOpen({
                    title: '新增',
                    url: 'sysConfig/add.shtml',
                    scroll : true,
                    width: '500px',
                    height: '500px',
                    yes : function(iframeId) {
                        top.frames[iframeId].vm.acceptClick();
                    },
                });
            },
            edit : function(id,sysName,address,description,association,isEnable,cronExpression){
 
                dialogOpen({
                    title: '修改',
                    url: 'sysConfig/add.shtml',
                    scroll : true,
                    width: '500px',
                    height: '500px',
                    success : function(iframeId){
                        top.frames[iframeId].vm.formQuartz.id = id;
                        top.frames[iframeId].vm.formQuartz.sysName = sysName;
                        top.frames[iframeId].vm.formQuartz.address = address;
                        top.frames[iframeId].vm.formQuartz.description = description;
                        top.frames[iframeId].vm.formQuartz.association = association;
                        top.frames[iframeId].vm.formQuartz.isEnable = isEnable;
                        top.frames[iframeId].vm.formQuartz.cronExpression = cronExpression;
                    },
                    yes : function(iframeId) {
                        top.frames[iframeId].vm.acceptClick();
                    },
                });
            },
            //
            remove : function(id,sysName,address,description,association,cronExpression){
                var that = this;
                top.layer.confirm('确定要废弃吗?', {
                    btn: ['确定','取消'] //按钮
                }, function(){
                    $.ajax({
                        url:"../distribution/remove",
                        type:"post",
                        data:{'time':(new Date()).toString(),"id":id,"sysName":sysName,"address":address,"description":description,"association":association,"cronExpression":cronExpression},
                        success: function(result) {
                            if(result.code=="0"){
                                top.layer.msg('废弃配置成功', {icon: 1});
                                window.setTimeout(that.list(),1500);
                            }
                        }
                    });
                }, function(){
 
                });
            },
            reload :  function(){
                this.load();
            },
            changePage : function(pageNo) {
                vm.pageNo = pageNo;
                vm.load();
            },
            changePageSize : function(pageSize) {
                vm.pageSize = pageSize;
                vm.load();
            }
        },
        created : function() {
            this.list();
        }
    })
 
</script>
</body>
</html>