initdb默认string长度改为191

This commit is contained in:
pixel
2021-02-13 16:22:50 +08:00
parent 329d094e2a
commit 11efbe7699
9 changed files with 207 additions and 137 deletions

View File

@@ -1,75 +1,77 @@
{
"name": "gin-vue-admin",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "node openDocument.js && vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
"name": "gin-vue-admin",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "node openDocument.js && vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"@antv/dom-util": "2.0.2",
"@antv/g-canvas": "^0.4.12",
"@antv/g6": "3.5.2",
"@antv/matrix-util": "2.0.7",
"@antv/util": "~2.0.9",
"@moefe/vue-aplayer": "^2.0.0-beta.5",
"axios": "^0.19.2",
"core-js": "^3.6.5",
"echarts": "^4.7.0",
"element-ui": "^2.12.0",
"highlight.js": "^10.6.0",
"marked": "^2.0.0",
"node-sass": "^4.14.1",
"path": "^0.12.7",
"qs": "^6.8.0",
"quill": "^1.3.7",
"sass-loader": "^8.0.0",
"screenfull": "^5.0.2",
"script-ext-html-webpack-plugin": "^2.1.4",
"spark-md5": "^3.0.1",
"timeline-vuejs": "1.1.1",
"vue": "^2.6.10",
"vue-particle-line": "^0.1.4",
"vue-router": "^3.1.3",
"vue-simple-uploader": "^0.7.4",
"vuescroll": "^4.14.4",
"vuex": "^3.1.1",
"vuex-persist": "^2.1.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.5.6",
"@vue/cli-plugin-eslint": "^4.5.6",
"@vue/cli-service": "^4.5.6",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"vue-template-compiler": "^2.6.10",
"core-js": "^3.3.2",
"node-sass": "^4.12.0",
"numericjs": "^1.2.6",
"raw-loader": "^3.1.0",
"sass-loader": "^8.0.0"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"dependencies": {
"@moefe/vue-aplayer": "^2.0.0-beta.5",
"axios": "^0.19.2",
"core-js": "^3.6.5",
"echarts": "^4.7.0",
"element-ui": "^2.12.0",
"node-sass": "^4.14.1",
"path": "^0.12.7",
"qs": "^6.8.0",
"quill": "^1.3.7",
"sass-loader": "^8.0.0",
"screenfull": "^5.0.2",
"script-ext-html-webpack-plugin": "^2.1.4",
"spark-md5": "^3.0.1",
"timeline-vuejs": "1.1.1",
"vue": "^2.6.10",
"vue-particle-line": "^0.1.4",
"vue-router": "^3.1.3",
"vue-simple-uploader": "^0.7.4",
"vuescroll": "^4.14.4",
"vuex": "^3.1.1",
"vuex-persist": "^2.1.0",
"@antv/dom-util": "2.0.2",
"@antv/matrix-util": "2.0.7",
"@antv/g-canvas": "^0.4.12",
"@antv/g6": "3.5.2",
"@antv/util": "~2.0.9"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.5.6",
"@vue/cli-plugin-eslint": "^4.5.6",
"@vue/cli-service": "^4.5.6",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"vue-template-compiler": "^2.6.10",
"core-js": "^3.3.2",
"node-sass": "^4.12.0",
"numericjs": "^1.2.6",
"raw-loader": "^3.1.0",
"sass-loader": "^8.0.0"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"rules": {},
"parserOptions": {
"parser": "babel-eslint"
}
},
"postcss": {
"plugins": {
"autoprefixer": {}
}
},
"browserslist": [
"> 1%",
"last 2 versions"
]
}
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"rules": {},
"parserOptions": {
"parser": "babel-eslint"
}
},
"postcss": {
"plugins": {
"autoprefixer": {}
}
},
"browserslist": [
"> 1%",
"last 2 versions"
]
}

View File

@@ -1,16 +1,13 @@
import service from '@/utils/request'
// @Tags api
// @Summary 分页获取角色列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body modelInterface.PageInfo true "分页获取用户列表"
// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /api/getApiList [post]
// {
// page int
// pageSize int
// }
export const preview = (data) => {
return service({
url: "/autoCode/preview",
method: 'post',
data,
})
}
export const createTemp = (data) => {
return service({
url: "/autoCode/createTemp",
@@ -20,7 +17,6 @@ export const createTemp = (data) => {
})
}
// @Tags SysApi
// @Summary 获取当前所有数据库
// @Security ApiKeyAuth

View File

@@ -0,0 +1,58 @@
<template>
<div class="previewCode">
<el-tabs v-model="activeName">
<el-tab-pane :label="key" :name="key" v-for="(item,key) in previewCode" :key="key">
<div style="background:#fff;padding:0 20px" :id="key"></div>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import marked from "marked"
import hljs from "highlight.js";
// import 'highlight.js/styles/atelier-cave-light.css';
import 'highlight.js/styles/atelier-plateau-light.css';
export default {
props:{
previewCode:{
type:Object,
default(){
return {}
}
}
},
data(){
return{
activeName: "",
}
},
mounted(){
marked.setOptions({
renderer: new marked.Renderer(),
highlight: function(code) {
return hljs.highlightAuto(code).value;
},
pedantic: false,
gfm: true,
tables: true,
breaks: false,
sanitize: false,
smartLists: true,
smartypants: false,
xhtml: false
}
);
for(const key in this.previewCode){
if(this.activeName == ""){
this.activeName = key
}
document.getElementById(key).innerHTML = marked(this.previewCode[key])
}
}
}
</script>
<style lang="scss">
</style>

View File

@@ -58,7 +58,7 @@
<el-input v-model="form.description" placeholder="中文描述作为自动api描述"></el-input>
</el-form-item>
<el-form-item label="文件名称" prop="packageName">
<el-input v-model="form.packageName"></el-input>
<el-input v-model="form.packageName" placeholder="生成文件的默认名称"></el-input>
</el-form-item>
<el-form-item label="自动创建api">
<el-checkbox v-model="form.autoCreateApiToSql"></el-checkbox>
@@ -117,6 +117,7 @@
<el-tag type="danger">id , created_at , updated_at , deleted_at 会自动生成请勿重复创建</el-tag>
<!-- 组件列表 -->
<div class="button-box clearflex">
<el-button @click="enterForm(true)" type="primary">预览代码</el-button>
<el-button @click="enterForm" type="primary">生成代码</el-button>
</div>
<!-- 组件弹窗 -->
@@ -127,6 +128,13 @@
<el-button type="primary" @click="enterDialog"> </el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="previewFlag">
<PreviewCodeDialg v-if="previewFlag" :previewCode="preViewCode"></PreviewCodeDialg>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="previewFlag = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
@@ -144,8 +152,9 @@ const fieldTemplate = {
};
import FieldDialog from "@/view/systemTools/autoCode/component/fieldDialog.vue";
import PreviewCodeDialg from "@/view/systemTools/autoCode/component/previewCodeDialg.vue";
import { toUpperCase, toHump } from "@/utils/stringFun.js";
import { createTemp, getDB, getTable, getColumn } from "@/api/autoCode.js";
import { createTemp, getDB, getTable, getColumn, preview } from "@/api/autoCode.js";
import { getDict } from "@/utils/dictionary";
export default {
@@ -153,6 +162,7 @@ export default {
data() {
return {
activeNames: [""],
preViewCode:{},
dbform: {
dbName: "",
tableName: ""
@@ -191,11 +201,13 @@ export default {
},
dialogMiddle: {},
bk: {},
dialogFlag: false
dialogFlag: false,
previewFlag:false
};
},
components: {
FieldDialog
FieldDialog,
PreviewCodeDialg
},
methods: {
editAndAddField(item) {
@@ -250,7 +262,7 @@ export default {
deleteField(index) {
this.form.fields.splice(index, 1);
},
async enterForm() {
async enterForm(isPreview) {
if (this.form.fields.length <= 0) {
this.$message({
type: "error",
@@ -277,31 +289,38 @@ export default {
});
return false;
}
const data = await createTemp(this.form);
if (data.headers?.success == "false") {
return;
} else {
this.$message({
type: "success",
message: "自动化代码创建成功,正在下载"
});
}
const blob = new Blob([data]);
const fileName = "ginvueadmin.zip";
if ("download" in document.createElement("a")) {
// 不是IE浏览器
let url = window.URL.createObjectURL(blob);
let link = document.createElement("a");
link.style.display = "none";
link.href = url;
link.setAttribute("download", fileName);
document.body.appendChild(link);
link.click();
document.body.removeChild(link); // 下载完成移除元素
window.URL.revokeObjectURL(url); // 释放掉blob对象
} else {
// IE 10+
window.navigator.msSaveBlob(blob, fileName);
if(isPreview){
const data = await preview(this.form);
console.log(data.code == 0)
this.preViewCode = data.data.autoCode
this.previewFlag = true
}else{
const data = await createTemp(this.form);
if (data.headers?.success == "false") {
return;
} else {
this.$message({
type: "success",
message: "自动化代码创建成功,正在下载"
});
}
const blob = new Blob([data]);
const fileName = "ginvueadmin.zip";
if ("download" in document.createElement("a")) {
// 不是IE浏览器
let url = window.URL.createObjectURL(blob);
let link = document.createElement("a");
link.style.display = "none";
link.href = url;
link.setAttribute("download", fileName);
document.body.appendChild(link);
link.click();
document.body.removeChild(link); // 下载完成移除元素
window.URL.revokeObjectURL(url); // 释放掉blob对象
} else {
// IE 10+
window.navigator.msSaveBlob(blob, fileName);
}
}
} else {
return false;
@@ -373,6 +392,7 @@ export default {
.button-box {
padding: 10px 20px;
.el-button {
margin-right: 20px;
float: right;
}
}