代码优化,删除initData.js,生产环境移除console

This commit is contained in:
dqjdda
2019-11-25 19:18:43 +08:00
parent 882dc03e3c
commit 0351b72735
27 changed files with 80 additions and 170 deletions

View File

@@ -89,8 +89,8 @@
value="Like"
/>
<el-option
label="DateRange"
value="DateRange"
label="BetWeen"
value="BetWeen"
/>
</el-select>
</template>
@@ -146,6 +146,10 @@
<el-input v-model="form.pack" style="width: 40%" />
<span style="color: #C0C0C0;margin-left: 10px;">项目包的名称生成的代码放到哪个包里面</span>
</el-form-item>
<el-form-item label="接口名称" prop="apiAlias">
<el-input v-model="form.apiAlias" style="width: 40%" />
<span style="color: #C0C0C0;margin-left: 10px;">接口的名称用于控制器与接口文档中</span>
</el-form-item>
<el-form-item label="前端路径" prop="path">
<el-input v-model="form.path" style="width: 40%" />
<span style="color: #C0C0C0;margin-left: 10px;">输入views文件夹下的目录不存在即创建</span>
@@ -173,18 +177,18 @@
</template>
<script>
import initData from '@/mixins/initData'
import crud from '@/mixins/crud'
import { update, get } from '@/api/generator/genConfig'
import { save } from '@/api/generator/generator'
import { getDicts } from '@/api/system/dict'
export default {
name: 'GeneratorConfig',
components: {},
mixins: [initData],
mixins: [crud],
data() {
return {
activeName: 'first', tableName: '', tableHeight: 550, columnLoading: false, configLoading: false, dicts: [],
form: { id: null, tableName: '', author: '', pack: '', path: '', moduleName: '', cover: 'false', apiPath: '', prefix: '' },
form: { id: null, tableName: '', author: '', pack: '', path: '', moduleName: '', cover: 'false', apiPath: '', prefix: '', apiAlias: null },
rules: {
author: [
{ required: true, message: '作者不能为空', trigger: 'blur' }
@@ -196,7 +200,10 @@ export default {
{ required: true, message: '包路径不能为空', trigger: 'blur' }
],
path: [
{ required: true, message: '前端代码生成路径不能为空', trigger: 'blur' }
{ required: true, message: '前端路径不能为空', trigger: 'blur' }
],
apiAlias: [
{ required: true, message: '接口名称不能为空', trigger: 'blur' }
],
cover: [
{ required: true, message: '不能为空', trigger: 'blur' }

View File

@@ -46,36 +46,13 @@
</template>
<script>
import initData from '@/mixins/initData'
import { parseTime } from '@/utils/index'
import crud from '@/mixins/crud'
import { generator } from '@/api/generator/generator'
export default {
name: 'GeneratorIndex',
mixins: [initData],
mixins: [crud],
data() {
return {
loading: false, dialog: false,
form: { author: '', pack: '', path: '', moduleName: '', cover: 'false', apiPath: '', prefix: '' },
rules: {
author: [
{ required: true, message: '作者不能为空', trigger: 'blur' }
],
pack: [
{ required: true, message: '包路径不能为空', trigger: 'blur' }
],
moduleName: [
{ required: true, message: '包路径不能为空', trigger: 'blur' }
],
path: [
{ required: true, message: '前端代码生成路径不能为空', trigger: 'blur' }
],
apiPath: [
{ required: true, message: '前端Api文件生成路径不能为空', trigger: 'blur' }
],
cover: [
{ required: true, message: '不能为空', trigger: 'blur' }
]
}
}
},
created() {
@@ -84,13 +61,8 @@ export default {
})
},
methods: {
parseTime,
beforeInit() {
this.url = 'api/generator/tables'
const query = this.query
const name = query.name
this.params = { page: this.page, size: this.size }
if (name) { this.params['name'] = name }
return true
},
toGen(tableName) {

View File

@@ -9,8 +9,8 @@
:default-time="['00:00:00','23:59:59']"
type="daterange"
range-separator=":"
class="el-range-editor--small date-item"
style="width: 220px;height: 30.5px"
size="small"
class="date-item"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"

View File

@@ -9,8 +9,8 @@
:default-time="['00:00:00','23:59:59']"
type="daterange"
range-separator=":"
class="el-range-editor--small date-item"
style="width: 220px;height: 30.5px"
size="small"
class="date-item"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"

View File

@@ -7,8 +7,8 @@
:default-time="['00:00:00','23:59:59']"
type="daterange"
range-separator=":"
class="el-range-editor--small date-item"
style="width: 240px;height: 30.5px"
size="small"
class="date-item"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="部署开始日期"
end-placeholder="部署结束日期"

View File

@@ -9,8 +9,8 @@
:default-time="['00:00:00','23:59:59']"
type="daterange"
range-separator=":"
class="el-range-editor--small date-item"
style="width: 220px;height: 30.5px"
size="small"
class="date-item"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"

View File

@@ -6,8 +6,8 @@
:default-time="['00:00:00','23:59:59']"
type="daterange"
range-separator=":"
class="el-range-editor--small date-item"
style="width: 220px;height: 30.5px"
size="small"
class="date-item"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"

View File

@@ -9,8 +9,8 @@
:default-time="['00:00:00','23:59:59']"
type="daterange"
range-separator=":"
class="el-range-editor--small date-item"
style="width: 220px;height: 30.5px"
size="small"
class="date-item"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"

View File

@@ -9,8 +9,8 @@
:default-time="['00:00:00','23:59:59']"
type="daterange"
range-separator=":"
class="el-range-editor--small date-item"
style="width: 220px;height: 30.5px"
size="small"
class="date-item"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"

View File

@@ -9,8 +9,8 @@
:default-time="['00:00:00','23:59:59']"
type="daterange"
range-separator=":"
class="el-range-editor--small date-item"
style="width: 220px;height: 30.5px"
size="small"
class="date-item"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"

View File

@@ -9,8 +9,8 @@
:default-time="['00:00:00','23:59:59']"
type="daterange"
range-separator=":"
class="el-range-editor--small date-item"
style="width: 220px;height: 30.5px"
size="small"
class="date-item"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"

View File

@@ -9,8 +9,8 @@
:default-time="['00:00:00','23:59:59']"
type="daterange"
range-separator=":"
class="el-range-editor--small date-item"
style="width: 220px;height: 30.5px"
size="small"
class="date-item"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"

View File

@@ -8,8 +8,8 @@
:default-time="['00:00:00','23:59:59']"
type="daterange"
range-separator=":"
class="el-range-editor--small date-item"
style="width: 220px;height: 30.5px"
size="small"
class="date-item"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"

View File

@@ -88,12 +88,12 @@ import updateEmail from './center/updateEmail'
import { getToken } from '@/utils/auth'
import store from '@/store'
import { parseTime } from '@/utils/index'
import initData from '@/mixins/initData'
import crud from '@/mixins/crud'
import Avatar from '@/assets/images/avatar.png'
export default {
name: 'Center',
components: { updatePass, updateEmail },
mixins: [initData],
mixins: [crud],
data() {
return {
Avatar: Avatar,
@@ -123,8 +123,6 @@ export default {
},
beforeInit() {
this.url = 'api/logs/user'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort }
return true
},
handleSuccess(response, file, fileList) {

View File

@@ -19,8 +19,8 @@
:default-time="['00:00:00','23:59:59']"
type="daterange"
range-separator=":"
class="el-range-editor--small date-item"
style="width: 220px;height: 30.5px"
size="small"
class="date-item"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"

View File

@@ -9,8 +9,8 @@
:default-time="['00:00:00','23:59:59']"
type="daterange"
range-separator=":"
class="el-range-editor--small date-item"
style="width: 220px;height: 30.5px"
size="small"
class="date-item"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"

View File

@@ -9,8 +9,8 @@
:default-time="['00:00:00','23:59:59']"
type="daterange"
range-separator=":"
class="el-range-editor--small date-item"
style="width: 220px;height: 30.5px"
size="small"
class="date-item"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"

View File

@@ -11,8 +11,8 @@
:default-time="['00:00:00','23:59:59']"
type="daterange"
range-separator=":"
class="el-range-editor--small date-item"
style="width: 220px;height: 30.5px"
size="small"
class="date-item"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"