代码生成 改变

szh_zidingyibiaoti
张同海 2 years ago
parent deb5961757
commit 28f4aa314c

@ -33,7 +33,7 @@ Vue.filter('Fmoney', function (val) {
val = '0' val = '0'
} }
// eslint-disable-next-line eqeqeq // eslint-disable-next-line eqeqeq
const sign = (val == (val = Math.abs(val))) const sign = val == (val = Math.abs(val))
val = Math.floor(val * 100 + 0.50000000001) val = Math.floor(val * 100 + 0.50000000001)
let cents = val % 100 let cents = val % 100
val = Math.floor(val / 100).toString() val = Math.floor(val / 100).toString()
@ -44,7 +44,7 @@ Vue.filter('Fmoney', function (val) {
for (let i = 0; i < Math.floor((val.length - (1 + i)) / 3); I++) { for (let i = 0; i < Math.floor((val.length - (1 + i)) / 3); I++) {
val = val.substring(0, val.length - (4 * i + 3)) + ',' + val.substring(val.length - (4 * i + 3)) val = val.substring(0, val.length - (4 * i + 3)) + ',' + val.substring(val.length - (4 * i + 3))
} }
return (((sign) ? '' : '-') + val + '.' + cents) return (sign ? '' : '-') + val + '.' + cents
}) })
/** /**

@ -5,7 +5,8 @@
:visible="visible" :visible="visible"
:confirmLoading="confirmLoading" :confirmLoading="confirmLoading"
@ok="handleSubmit" @ok="handleSubmit"
@cancel="handleCancel"> @cancel="handleCancel"
>
<a-spin :spinning="confirmLoading"> <a-spin :spinning="confirmLoading">
<a-form :form="form"> <a-form :form="form">
<a-row :gutter="24"> <a-row :gutter="24">
@ -14,12 +15,15 @@
<a-select <a-select
style="width: 100%" style="width: 100%"
placeholder="请选择数据库表" placeholder="请选择数据库表"
v-decorator="['tableName', {rules: [{ required: true, message: '请选择数据库表!' }]}]"> v-decorator="['tableName', { rules: [{ required: true, message: '请选择数据库表!' }] }]"
>
<a-select-option <a-select-option
v-for="(item, index) in tableNameData" v-for="(item, index) in tableNameData"
:key="index" :key="index"
:value="item.entityName" :value="item.entityName"
@click="tableNameSele(item)">{{ item.tableName }}</a-select-option> @click="tableNameSele(item)"
>{{ item.tableName }}</a-select-option
>
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-col> </a-col>
@ -27,7 +31,8 @@
<a-form-item label="业务名" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback> <a-form-item label="业务名" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input <a-input
placeholder="请输入业务名" placeholder="请输入业务名"
v-decorator="['busName', {rules: [{required: true, message: '请输入业务名!'}]}]" /> v-decorator="['busName', { rules: [{ required: true, message: '请输入业务名!' }] }]"
/>
</a-form-item> </a-form-item>
</a-col> </a-col>
<!--<a-col :md="12" :sm="24"> <!--<a-col :md="12" :sm="24">
@ -48,12 +53,15 @@
<a-select <a-select
style="width: 100%" style="width: 100%"
placeholder="请选择应用分类" placeholder="请选择应用分类"
v-decorator="['menuApplication', {rules: [{ required: true, message: '请选择应用分类!' }]}]"> v-decorator="['menuApplication', { rules: [{ required: true, message: '请选择应用分类!' }] }]"
>
<a-select-option <a-select-option
v-for="(item, index) in appData" v-for="(item, index) in appData"
:key="index" :key="index"
:value="item.code" :value="item.code"
@click="changeApplication(item.code)">{{ item.name }}</a-select-option> @click="changeApplication(item.code)"
>{{ item.name }}</a-select-option
>
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-col> </a-col>
@ -66,9 +74,9 @@
:dropdownStyle="{ maxHeight: '300px', overflow: 'auto' }" :dropdownStyle="{ maxHeight: '300px', overflow: 'auto' }"
:treeData="menuTreeData" :treeData="menuTreeData"
placeholder="请选择父级菜单" placeholder="请选择父级菜单"
treeDefaultExpandAll> treeDefaultExpandAll
<span slot="title" slot-scope="{ id }">{{ id }} >
</span> <span slot="title" slot-scope="{ id }">{{ id }} </span>
</a-tree-select> </a-tree-select>
</a-form-item> </a-form-item>
</div> </div>
@ -79,14 +87,16 @@
<a-form-item label="命名空间" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback> <a-form-item label="命名空间" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input <a-input
placeholder="请输入代码包名" placeholder="请输入代码包名"
v-decorator="['nameSpace', {rules: [{required: true, message: '请输入命名空间!'}]}]" /> v-decorator="['nameSpace', { rules: [{ required: true, message: '请输入命名空间!' }] }]"
/>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :md="12" :sm="24"> <a-col :md="12" :sm="24">
<a-form-item label="作者姓名" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback> <a-form-item label="作者姓名" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input <a-input
placeholder="请输入作者姓名" placeholder="请输入作者姓名"
v-decorator="['authorName', {rules: [{required: true, message: '请输入作者姓名!'}]}]" /> v-decorator="['authorName', { rules: [{ required: true, message: '请输入作者姓名!' }] }]"
/>
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
@ -115,12 +125,16 @@
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :md="12" :sm="24"> <a-col :md="12" :sm="24">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="生成方式"> <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="生成方式">
<a-radio-group v-decorator="['generateType',{rules: [{ required: true, message: '请选择生成方式!' }]}]"> <a-radio-group
v-decorator="['generateType', { rules: [{ required: true, message: '请选择生成方式!' }] }]"
>
<a-radio <a-radio
v-for="(item, index) in generateTypeData" v-for="(item, index) in generateTypeData"
:key="index" :key="index"
:value="item.code" :value="item.code"
@click="generateTypeRadio(item.code)">{{ item.name }}</a-radio> @click="generateTypeRadio(item.code)"
>{{ item.name }}</a-radio
>
</a-radio-group> </a-radio-group>
</a-form-item> </a-form-item>
</a-col> </a-col>
@ -131,16 +145,9 @@
</template> </template>
<script> <script>
import { import { getAppList } from '@/api/modular/system/appManage'
getAppList import { getMenuTree } from '@/api/modular/system/menuManage'
} from '@/api/modular/system/appManage' import { codeGenerateInformationList, codeGenerateAdd } from '@/api/modular/gen/codeGenerateManage'
import {
getMenuTree
} from '@/api/modular/system/menuManage'
import {
codeGenerateInformationList,
codeGenerateAdd
} from '@/api/modular/gen/codeGenerateManage'
export default { export default {
data() { data() {
return { return {
@ -209,7 +216,7 @@
* 获得所有数据库的表 * 获得所有数据库的表
*/ */
codeGenerateInformationList() { codeGenerateInformationList() {
codeGenerateInformationList().then((res) => { codeGenerateInformationList().then(res => {
this.tableNameData = res.data this.tableNameData = res.data
}) })
}, },
@ -217,7 +224,7 @@
* 获得菜单所属应用 * 获得菜单所属应用
*/ */
getSysApplist() { getSysApplist() {
return getAppList().then((res) => { return getAppList().then(res => {
if (res.success) { if (res.success) {
this.appData = res.data this.appData = res.data
} else { } else {
@ -238,14 +245,13 @@
*/ */
handleSubmit() { handleSubmit() {
const { const {
form: { form: { validateFields }
validateFields
}
} = this } = this
validateFields((errors, values) => { validateFields((errors, values) => {
if (!errors) { if (!errors) {
this.confirmLoading = true this.confirmLoading = true
codeGenerateAdd(values).then((res) => { codeGenerateAdd(values)
.then(res => {
if (res.success) { if (res.success) {
this.$message.success('新增成功') this.$message.success('新增成功')
this.$emit('ok', values) this.$emit('ok', values)
@ -253,7 +259,8 @@
} else { } else {
this.$message.error('新增失败:' + res.message) this.$message.error('新增失败:' + res.message)
} }
}).finally((res) => { })
.finally(res => {
this.confirmLoading = false this.confirmLoading = false
}) })
} }
@ -287,17 +294,19 @@
*/ */
changeApplication(value) { changeApplication(value) {
getMenuTree({ getMenuTree({
'application': value application: value
}).then((res) => { }).then(res => {
if (res.success) { if (res.success) {
this.menuTreeData = [{ this.menuTreeData = [
'id': '-1', {
'parentId': '0', id: '-1',
'title': '顶级', parentId: '0',
'value': '0', title: '顶级',
'pid': '0', value: '0',
'children': res.data pid: '0',
}] children: res.data
}
]
this.form.getFieldDecorator('menuPid', { this.form.getFieldDecorator('menuPid', {
initialValue: '0' initialValue: '0'
}) })

@ -12,7 +12,8 @@
:pagination="false" :pagination="false"
:alert="true" :alert="true"
:loading="tableLoading" :loading="tableLoading"
:rowKey="(record) => record.id"> :rowKey="record => record.id"
>
<template slot="columnComment" slot-scope="text, record"> <template slot="columnComment" slot-scope="text, record">
<a-input v-model="record.columnComment" /> <a-input v-model="record.columnComment" />
</template> </template>
@ -26,7 +27,8 @@
style="width: 120px" style="width: 120px"
v-model="record.effectType" v-model="record.effectType"
:disabled="judgeColumns(record)" :disabled="judgeColumns(record)"
@change="effectTypeChange(record, $event)"> @change="effectTypeChange(record, $event)"
>
<a-select-option v-for="(item, index) in effectTypeData" :key="index" :value="item.code">{{ <a-select-option v-for="(item, index) in effectTypeData" :key="index" :value="item.code">{{
item.name item.name
}}</a-select-option> }}</a-select-option>
@ -38,7 +40,8 @@
v-model="record.dictTypeCode" v-model="record.dictTypeCode"
:disabled=" :disabled="
record.effectType !== 'radio' && record.effectType !== 'select' && record.effectType !== 'checkbox' record.effectType !== 'radio' && record.effectType !== 'select' && record.effectType !== 'checkbox'
"> "
>
<a-select-option v-for="(item, index) in dictDataAll" :key="index" :value="item.code">{{ <a-select-option v-for="(item, index) in dictDataAll" :key="index" :value="item.code">{{
item.name item.name
}}</a-select-option> }}</a-select-option>
@ -74,10 +77,7 @@
</a-card> </a-card>
</template> </template>
<script> <script>
import { import { sysCodeGenerateConfigList, sysCodeGenerateConfigEdit } from '@/api/modular/gen/sysCodeGenerateConfigManage'
sysCodeGenerateConfigList,
sysCodeGenerateConfigEdit
} from '@/api/modular/gen/sysCodeGenerateConfigManage'
import fkModal from './fkModal' import fkModal from './fkModal'
export default { export default {
components: { components: {
@ -86,7 +86,8 @@
data() { data() {
return { return {
// //
columns: [{ columns: [
{
title: '字段', title: '字段',
dataIndex: 'columnName' dataIndex: 'columnName'
}, },
@ -170,7 +171,7 @@
tableLoading: false, tableLoading: false,
visible: false, visible: false,
loadData: [], loadData: [],
javaTypeData: [], // javaTypeData: [],
effectTypeData: [], effectTypeData: [],
dictDataAll: [], dictDataAll: [],
codeGenQueryTypeData: [], codeGenQueryTypeData: [],
@ -185,7 +186,7 @@
this.indexConfigShow = true this.indexConfigShow = true
this.tableLoading = true this.tableLoading = true
const dictOption = this.$options const dictOption = this.$options
this.javaTypeData = dictOption.filters['dictData']('code_gen_net_type') // this.javaTypeData = dictOption.filters['dictData']('code_gen_net_type')
this.effectTypeData = dictOption.filters['dictData']('code_gen_effect_type') this.effectTypeData = dictOption.filters['dictData']('code_gen_effect_type')
this.dictDataAll = dictOption.filters['dictDataAll']() this.dictDataAll = dictOption.filters['dictDataAll']()
this.yesOrNoData = dictOption.filters['dictData']('yes_or_no') this.yesOrNoData = dictOption.filters['dictData']('yes_or_no')
@ -193,7 +194,7 @@
const params = { const params = {
codeGenId: data.id codeGenId: data.id
} }
sysCodeGenerateConfigList(params).then((res) => { sysCodeGenerateConfigList(params).then(res => {
this.loadData = res.data this.loadData = res.data
this.loadData.forEach(item => { this.loadData.forEach(item => {
for (const key in item) { for (const key in item) {
@ -230,7 +231,7 @@
// const param = { // const param = {
// sysCodeGenerateConfigParamList: loadDatas // sysCodeGenerateConfigParamList: loadDatas
// } // }
sysCodeGenerateConfigEdit(loadDatas).then((res) => { sysCodeGenerateConfigEdit(loadDatas).then(res => {
this.tableLoading = false this.tableLoading = false
if (res.success) { if (res.success) {
this.$message.success('编辑成功') this.$message.success('编辑成功')

Loading…
Cancel
Save