Merge branches '2.4dev' and '2.4opt' of https://gitee.com/elunez/eladmin-web into 2.4opt

This commit is contained in:
zhanghouying
2019-11-27 15:06:31 +08:00
15 changed files with 364 additions and 45 deletions

View File

@@ -10,7 +10,8 @@ export function getAllTable() {
export function generator(tableName, type) {
return request({
url: 'api/generator/' + tableName + '/' + type,
method: 'post'
method: 'post',
responseType: type === 2 ? 'blob' : ''
})
}

View File

@@ -0,0 +1,78 @@
<template>
<div class="json-editor">
<textarea ref="textarea" />
</div>
</template>
<script>
import CodeMirror from 'codemirror'
import 'codemirror/lib/codemirror.css'
// 替换主题这里需修改名称
import 'codemirror/theme/idea.css'
import 'codemirror/mode/clike/clike'
export default {
props: {
value: {
type: String,
required: true
},
height: {
type: String,
required: true
}
},
data() {
return {
editor: false
}
},
watch: {
value(value) {
const editorValue = this.editor.getValue()
if (value !== editorValue) {
this.editor.setValue(this.value)
}
},
height(value) {
this.editor.setSize('auto', this.height)
}
},
mounted() {
this.editor = CodeMirror.fromTextArea(this.$refs.textarea, {
mode: 'text/x-java',
lineNumbers: true,
lint: true,
lineWrapping: true,
tabSize: 2,
cursorHeight: 0.9,
// 替换主题这里需修改名称
theme: 'idea',
readOnly: true
})
this.editor.setSize('auto', this.height)
this.editor.setValue(this.value)
},
methods: {
getValue() {
return this.editor.getValue()
}
}
}
</script>
<style scoped>
.json-editor{
height: 100%;
margin-bottom: 10px;
}
.json-editor >>> .CodeMirror {
font-size: 14px;
overflow-y:auto;
font-weight:normal
}
.json-editor >>> .CodeMirror-scroll{
}
.json-editor >>> .cm-s-rubyblue span.cm-string {
color: #F08047;
}
</style>

View File

@@ -9,7 +9,7 @@ import CodeMirror from 'codemirror'
import 'codemirror/lib/codemirror.css'
// 替换主题这里需修改名称
import 'codemirror/theme/idea.css'
require('codemirror/mode/yaml/yaml.js')
import 'codemirror/mode/yaml/yaml'
export default {
props: {
value: {

View File

@@ -52,9 +52,3 @@ export default {
}
}
</script>
<style scoped>
/deep/ .el-scrollbar__wrap{
margin-right: -22px !important;
}
</style>

View File

@@ -90,6 +90,7 @@ export default {
z-index: 9;
width: calc(100% - #{$sideBarWidth});
transition: width 0.28s;
padding: 0;
}
.hideSidebar .fixed-header {

View File

@@ -5,12 +5,22 @@ import Cookies from 'js-cookie'
import 'normalize.css/normalize.css'
import Element from 'element-ui'
//
import mavonEditor from 'mavon-editor'
import dict from './components/Dict'
import permission from './components/Permission'
import 'mavon-editor/dist/css/index.css'
// 数据字典
import dict from './components/Dict'
// 权限指令
import permission from './components/Permission'
import './assets/styles/element-variables.scss'
import './assets/styles/index.scss' // global css
// global css
import './assets/styles/index.scss'
// 代码高亮
import VueHighlightJS from 'vue-highlightjs'
import 'highlight.js/styles/atom-one-dark.css'
import App from './App'
import store from './store'
@@ -19,6 +29,7 @@ import router from './router/routers'
import './assets/icons' // icon
import './router/index' // permission control
Vue.use(VueHighlightJS)
Vue.use(mavonEditor)
Vue.use(permission)
Vue.use(dict)

View File

@@ -21,9 +21,14 @@
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="140px" align="center" fixed="right">
<el-table-column label="操作" width="160px" align="center" fixed="right">
<template slot-scope="scope">
<el-button size="mini" style="margin-right: 2px" type="text">预览</el-button>
<el-button size="mini" style="margin-right: 2px" type="text">
<router-link :to="'/sys-tools/generator/preview/' + scope.row.tableName">
预览
</router-link>
</el-button>
<el-button size="mini" style="margin-left: -1px;margin-right: 2px" type="text" @click="toDownload(scope.row.tableName)">下载</el-button>
<el-button size="mini" style="margin-left: -1px;margin-right: 2px" type="text">
<router-link :to="'/sys-tools/generator/config/' + scope.row.tableName">
编辑
@@ -74,6 +79,12 @@ export default {
duration: 2500
})
})
},
toDownload(tableName) {
// 打包下载
generator(tableName, 2).then(data => {
this.downloadFile(data, tableName, 'zip')
})
}
}
}

View File

@@ -0,0 +1,38 @@
<template>
<el-tabs v-if="!error" v-model="activeName" type="card">
<el-tab-pane v-for="item in data" :key="item.name" :lazy="true" :label="item.name" :name="item.name">
<Java :value="item.content" :height="height" />
</el-tab-pane>
</el-tabs>
<div v-else class="app-container">
<el-alert
:title="error"
type="error"
/>
</div>
</template>
<script>
import Java from '@/components/JavaEdit/index'
import { generator } from '@/api/generator/generator'
export default {
name: 'Preview',
components: { Java },
data() {
return {
data: null, error: null, height: '', activeName: 'Entity'
}
},
created() {
this.height = document.documentElement.clientHeight - 180 + 'px'
const tableName = this.$route.params.tableName
this.$nextTick(() => {
generator(tableName, 1).then(data => {
this.data = data
}).catch(err => {
this.error = err.response.data.message
})
})
}
}
</script>

View File

@@ -22,7 +22,7 @@
<img :src="codeUrl" @click="getCode">
</div>
</el-form-item>
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">
<el-checkbox v-model="loginForm.rememberMe" style="margin:0 0 25px 0;">
记住我
</el-checkbox>
<el-form-item style="width:100%;">

View File

@@ -31,10 +31,8 @@
</template>
</el-table-column>
</el-table>
<el-dialog :visible.sync="dialog" title="异常详情" append-to-body top="0" width="85%">
<pre>
{{ errorInfo }}
</pre>
<el-dialog :visible.sync="dialog" title="异常详情" append-to-body top="30px" width="85%">
<pre v-highlightjs="errorInfo"><code class="java" /></pre>
</el-dialog>
<!--分页组件-->
<el-pagination
@@ -84,7 +82,7 @@ export default {
}
</script>
<style>
<style scoped>
.demo-table-expand {
font-size: 0;
}
@@ -101,4 +99,12 @@ export default {
font-size: 12px;
}
/deep/ .el-dialog__body{
padding: 0 20px 10px 20px !important;
}
.java.hljs{
color: #444;
background: #ffffff !important;
height: 630px !important;
}
</style>

View File

@@ -55,9 +55,7 @@
</el-table-column>
</el-table>
<el-dialog :visible.sync="errorDialog" append-to-body title="异常详情" width="85%">
<pre>
{{ errorInfo }}
</pre>
<pre v-highlightjs="errorInfo"><code class="java" /></pre>
</el-dialog>
<!--分页组件-->
<el-pagination
@@ -106,3 +104,13 @@ export default {
}
}
</script>
<style scoped>
.java.hljs{
color: #444;
background: #ffffff !important;
}
/deep/ .el-dialog__body{
padding: 0 20px 10px 20px !important;
}
</style>

View File

@@ -60,13 +60,13 @@
<el-input v-model.number="form.phone" />
</el-form-item>
<el-form-item label="邮箱" prop="email">
<el-input v-model="form.email" />
<el-input v-model="form.email" style="width: 191px" />
</el-form-item>
<el-form-item label="部门" prop="dept.id">
<treeselect v-model="form.dept.id" :options="depts" style="width: 178px" placeholder="选择部门" @select="selectFun" />
</el-form-item>
<el-form-item label="岗位" prop="job.id">
<el-select v-model="form.job.id" style="width: 178px" placeholder="请先选择部门">
<el-select v-model="form.job.id" placeholder="请先选择部门">
<el-option
v-for="(item, index) in jobs"
:key="item.name + index"
@@ -75,7 +75,7 @@
/>
</el-select>
</el-form-item>
<el-form-item style="margin-bottom: 0px;" label="角色" prop="roles">
<el-form-item style="margin-bottom: 0;" label="角色" prop="roles">
<el-select v-model="form.roles" style="width: 450px;" multiple placeholder="请选择">
<el-option
v-for="item in roles"

View File

@@ -11,7 +11,7 @@
>
<el-input v-model="domain.value" style="width: 31%" />
<el-button icon="el-icon-plus" @click="addDomain" />
<el-button style="margin-left:0px;" icon="el-icon-minus" @click.prevent="removeDomain(domain)" />
<el-button style="margin-left:0;" icon="el-icon-minus" @click.prevent="removeDomain(domain)" />
</el-form-item>
<div ref="editor" class="editor" />
<el-button :loading="loading" style="margin-left:1.6%;" size="medium" type="primary" @click="doSubmit">发送邮件</el-button>