This commit is contained in:
2019-03-13 16:03:59 +08:00
commit ca2f3f4822
224 changed files with 56136 additions and 0 deletions

305
root/index.html Normal file
View File

@@ -0,0 +1,305 @@
<!DOCTYPE html>
<html lang="zh-cn">
<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>代码构建工具_2.0</title>
<!-- zui -->
<link href="res/zui/css/zui.min.css" rel="stylesheet">
<link rel="stylesheet" href="res/css/zui-theme.css">
<link rel="stylesheet" href="res/css/zui-theme.css">
<link rel="stylesheet" href="res/css/red-kit.css">
<link href="res/zui/lib/uploader/zui.uploader.min.css" rel="stylesheet">
<style>
body{
padding: 20px 50px;
}
.file-icon i:before {
content: '\f1c3';
color: rgb(42, 173, 31);
}
.checkbox:first-child{
padding-top: 0;
margin-top: -5px;
}
</style>
</head>
<body>
<div class="container-fluid ddl">
<h1>代码构建工具<!--(内部版) V1.0--></h1>
<hr>
<row>
<div class="col-md-12">
<table class="table table-bordered">
<tr>
<th style="width: 120px;">
<button type="button" class="btn btn-primary uploader-btn-browse"><i class="icon icon-cloud-upload"></i> 选择数据文件</button>
</th>
<td colspan="3">
<div id="uploaderExample" class="uploader" style="margin-bottom:0">
<div class="file-list" data-drag-placeholder="请拖拽文件到此处"></div>
</div>
</td>
</tr>
<tr>
<th>选择需创建代码的业务</th>
<td colspan="3" class="ck">
<div v-for="sheet in sheets" class="checkbox col-md-2">
<label>
<input type="checkbox" v-model="row.sheetNames" :value="sheet"> <span v-text="sheet"></span>
</label>
</div>
</td>
</tr>
<tr>
<th>后端代码创建路径</th>
<td><input v-model="row.dirPath" class="form-control"></td>
<th>代码包模块名</th>
<td><input v-model="row.pkg" class="form-control"></td>
</tr>
<tr>
<th>前端代码创建路径</th>
<td><input v-model="row.pageDirPath" class="form-control"></td>
<th>前端代码包模块名</th>
<td><input v-model="row.pageModel" class="form-control"></td>
</tr>
<tr>
<th>后端模板选择</th>
<td>
<label class="radio-inline"><input type="radio" name="a" value="" checked> <span>mybaits</span></label>
<label class="radio-inline"><input type="radio" name="a" value="" disabled> <span>hibernate</span></label>
</td>
<th>前端模板选择</th>
<td>
<label class="radio-inline"><input type="radio" name="b" value="" checked> <span>angularjs</span></label>
<label class="radio-inline"><input type="radio" name="b" value="" disabled> <span>vue</span></label>
</td>
</tr>
<tr>
<th>代码签名</th>
<td>
<input v-model="row.author">
</td>
<th>需要构建的代码</th>
<td class="ck">
<div v-for="item in ins" class="checkbox col-md-2">
<label>
<input type="checkbox" v-model="row.ca" :value="item.name"> <span v-text="item.label"></span>
</label>
</div>
</td>
</tr>
<tr>
<td colspan="4">
<button @click="creater()" class="btn btn-primary" type="button">构建代码</button>
</td>
</tr>
</table>
</div>
</row>
<!-- modal-tpl -->
<div class="col-md-12">
<!-- 对话框触发按钮 -->
<!-- 对话框HTML -->
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">关闭</span></button>
<h4 class="modal-title">代码创建</h4>
</div>
<div class="modal-body" v-html="msg">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary" data-dismiss="modal">确定</button>
</div>
</div>
</div>
</div>
<!-- 小对话框 -->
<!--<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#mySmModal">小对话框</button>-->
<div class="modal fade" id="mySmModal">
<div class="modal-dialog modal-sm">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">关闭</span></button>
<h4 class="modal-title">确认删除数据吗?</h4>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button @click="$('#mySmModal').modal('hide');" type="button" class="btn btn-primary">确定</button>
</div>
</div>
</div>
</div>
</div>
<script src="/res/zui/lib/jquery/jquery.js"></script>
<script src="/res/zui/js/zui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script src="/res/zui/lib/uploader/zui.uploader.min.js"></script>
<script src="/res/js/red.js"></script>
<script>
var fileName = red.getData("fileName","");
var vm = new Vue({
el: ".ddl",
data: {
sheets: [],
files:[],
row: getCfg(),
msg: "",
ins: [{name:"service", label:"后端"},{name:"front", label:"前端"}, {name:"ddl", label:"建表语句"}]
},
watch: {
row: {
handler: function(n,o) {
red.setData("cfg_" + fileName, n);
},
deep: true
}
},
methods: {
//历史上传的文件数据(文件存贮在用户本地)
loadFiles: function () {
red.getJSON("/upload/files", {}, function (json) {
vm.files = json;
vm.initUpload();
});
},
//上传文件事件初始化
initUpload: function () {
$('#uploaderExample').uploader({
/*onUploadComplete: function(files) {
var fileName = files[0].name;
checkFile(null, fileName);
},*/
autoUpload: true, // 当选择文件后立即自动进行上传操作
browse_button: ".uploader-btn-browse",
url: '/upload/excel', // 文件上传提交地址
filters: {
mime_types:[
{title: 'Excel文件', extensions: 'xls,xlsx'}
],
prevent_duplicates: true
},
deleteConfirm:true,
deleteActionOnDone: true,
staticFiles: vm.files,
fileTemplate:
'<div class="file">\n' +
' <div class="file-progress-bar"></div>\n' +
' <div class="file-wrapper">\n' +
' <div class="actions" style="width: 30px;">' +
' <input type="radio" name="fileName" onclick="checkFile(this)" title="使用此数据文件" class="fileName">' +
' </div>\n' +
' <div class="file-icon"><i class="icon icon-file-o"></i></div>\n' +
' <div class="content">\n' +
' <div class="file-name"></div>' +
' <div class="file-size small text-muted"></div>' +
' </div>' +
' <div class="actions">\n' +
' <div class="file-status" data-toggle="tooltip"><i class="icon"></i> <span class="text"></span></div>\n' +
' <a data-toggle="tooltip" class="btn btn-link btn-download-file" target="_blank"><i\n' +
' class="icon icon-download-alt"></i></a>\n' +
' <button type="button" data-toggle="tooltip" class="btn btn-link btn-reset-file" title="Repeat"><i\n' +
' class="icon icon-repeat"></i></button>\n' +
' <button type="button" data-toggle="tooltip" class="btn btn-link btn-rename-file" title="Rename"><i\n' +
' class="icon icon-pencil"></i></button>\n' +
' <button onclick="delFile(this)" type="button" data-toggle="tooltip" title="Remove" class="btn btn-link btn-delete-file fileName"><i\n' +
' class="icon icon-trash text-danger"></i></button>\n' +
' </div>\n' +
' </div>\n' +
'</div>',
fileFormater: function ($file, file, status) {
$file.find('.file-name').text(file.name);
$file.find(".fileName").attr("fileName",file.name);
if (fileName) {
$file.find("input[filename='"+ fileName +"']").attr("checked", true);
}
$file.find(".file-icon i").addClass("icon icon-file-excel file-icon-xlsx");
}
});
},
//创建代码
creater: function () {
console.log(this.fileName)
console.log(this.row);
this.row["fileName"] = fileName;
red.post("/abc/creater", {cfgBean: JSON.stringify(this.row)}, function (json) {
//red.showMsg({msg:"创建代码成功"})
vm.msg = json;
$('#myModal').modal({moveable: true});
});
}
},
mounted: function () {
this.loadFiles();
if (fileName) {
checkFile(null, fileName);
}
}
});
function checkFile(e, filename) {
var v = filename || $(e).attr("fileName");
$("input[filename=\'"+ v +"\']").attr("checked", "checked");
fileName = v;
red.setData("fileName", v);
loadSheets(v);
if (e) {
vm.row = red.getData("cfg_" + v, {
dirPath: "E:/wk/abc/src/main/",
pageDirPath: "D:/wk/abc-front/app/src/modules/",
pkg: "com.eversec.ac",
pageModel: "abx",
author: "EverCA",
ca:["service"],
sheetNames: []
});
}
}
function delFile(e) {
var v = $(e).attr("fileName");
red.post("/upload/del",{fileName: v}, function (json) {
location.reload();
})
}
function loadSheets(fileName) {
if(!fileName) {
return false;
}
red.post("/abc/sheets",{fileName: fileName}, function (json) {
vm.sheets = json;
})
}
function getCfg() {
return red.getData("cfg_" + fileName, {
fileName: "",
dirPath: "E:/wk/abc/src/main/",
pageDirPath: "E:/wk/abc-front/app/src/modules/",
pkg: "com.eversec.ac",
pageModel: "abx",
author: "EverCA",
ca:["service"],
sheetNames: ["message_finger"]
});
}
</script>
</body>
</html>