Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
renren-generator
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
吴迪
renren-generator
Commits
af433352
Commit
af433352
authored
Jul 17, 2023
by
吴迪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加data
parent
57b5bb90
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
219 additions
and
16 deletions
+219
-16
add-or-update.vue.vm
target/classes/template/add-or-update.vue.vm
+1
-1
addui.vue.vm
target/classes/template/addui.vue.vm
+83
-0
index.vue.vm
target/classes/template/index.vue.vm
+14
-14
menu.sql.vm
target/classes/template/menu.sql.vm
+10
-1
updateui.vue.vm
target/classes/template/updateui.vue.vm
+111
-0
No files found.
target/classes/template/add-or-update.vue.vm
View file @
af433352
...
...
@@ -61,7 +61,7 @@
if (data && data.code === 0) {
#foreach($column in $columns)
#if($column.columnName != $pk.columnName)
this.dataForm.${column.attrname} = data.
${classname}
.${column.attrname}
this.dataForm.${column.attrname} = data.
data
.${column.attrname}
#end
#end
}
...
...
target/classes/template/addui.vue.vm
0 → 100644
View file @
af433352
<template>
<div>
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
#foreach($column in $columns)
#if($column.columnName != $pk.columnName)
<el-form-item label="${column.comments}" prop="${column.attrname}">
<el-input v-model="dataForm.${column.attrname}" placeholder="${column.comments}"></el-input>
</el-form-item>
#end
#end
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
<el-button @click="visible = false">取消</el-button>
</span>
</div>
</template>
<script>
export default {
data () {
return {
dataForm: {
#foreach($column in $columns)
#if($column.columnName == $pk.columnName)
${column.attrname}: 0,
#else
${column.attrname}: ''#if($velocityCount != $columns.size()),#end
#end
#end
},
dataRule: {
#foreach($column in $columns)
#if($column.columnName != $pk.columnName)
${column.attrname}: [
{ required: true, message: '${column.comments}不能为空', trigger: 'blur' }
]#if($velocityCount != $columns.size()),#end
#end
#end
}
}
},
methods: {
// 表单提交
dataFormSubmit () {
#[[this.$refs['dataForm'].validate((valid) => {]]#
if (valid) {
this.$http({
url: #[[this.$http.adornUrl]]#(`/${moduleName}/${pathName}/${!this.dataForm.${pk.attrname} ? 'save' : 'update'}`),
method: 'post',
#[[data: this.$http.adornData({]]#
#foreach($column in $columns)
#if($column.columnName == $pk.columnName)
'${column.attrname}': this.dataForm.${column.attrname} || undefined,
#else
'${column.attrname}': this.dataForm.${column.attrname}#if($velocityCount != $columns.size()),#end
#end
#end
})
}).then(({data}) => {
if (data && data.code === 0) {
#[[this.$message({]]#
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
#[[this.$emit('refreshDataList')]]#
}
})
} else {
#[[this.$message.error(data.msg)]]#
}
})
}
})
}
}
}
</script>
target/classes/template/index.vue.vm
View file @
af433352
...
...
@@ -6,7 +6,7 @@
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button v-if="isAuth('${moduleName}:${pathName}:save')" type="primary" @click="add
OrUpdate
Handle()">新增</el-button>
<el-button v-if="isAuth('${moduleName}:${pathName}:save')" type="primary" @click="addHandle()">新增</el-button>
<el-button v-if="isAuth('${moduleName}:${pathName}:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
</el-form-item>
</el-form>
...
...
@@ -37,7 +37,7 @@
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="
addOrU
pdateHandle(scope.row.${pk.attrname})">修改</el-button>
<el-button type="text" size="small" @click="
u
pdateHandle(scope.row.${pk.attrname})">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.${pk.attrname})">删除</el-button>
</template>
</el-table-column>
...
...
@@ -51,13 +51,10 @@
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './${pathName}-add-or-update'
export default {
data () {
return {
...
...
@@ -73,9 +70,6 @@
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated () {
this.getDataList()
},
...
...
@@ -93,7 +87,7 @@
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.list
this.dataList = data.
data.
list
this.totalPage = data.totalCount
} else {
this.dataList = []
...
...
@@ -117,15 +111,21 @@
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
// 新增
addHandle () {
#[[this.$nextTick(() => {]]#
this.$refs.addOrUpdate.init(id)
})
#[[this.$router.push]]#({ name: 'manage-${pathName}-${pathName}addui' })
#[[})]]#
},
// 修改
updateHandle (id) {
#[[this.$nextTick(() => {]]#
#[[this.$router.push]]#({ name: 'manage-${pathName}-${pathName}'updateui', params: { id: id } })
#[[})]]#
},
// 删除
deleteHandle (id) {
// 提示要修改成name,每个表的都不一样,所以做不了通用的,暂时使用id
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.${pk.attrname}
})
...
...
target/classes/template/menu.sql.vm
View file @
af433352
-- 菜单SQL
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
VALUES ('0', '${comments}', '${moduleName}/${pathName}', NULL, '1', 'config', '6');
VALUES ('0', '${comments}', '${moduleName}/${pathName}
/${pathName}
', NULL, '1', 'config', '6');
-- 按钮父菜单ID
set @parentId = @@identity;
...
...
@@ -14,3 +14,12 @@ INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `or
SELECT @parentId, '修改', null, '${moduleName}:${pathName}:update', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '删除', null, '${moduleName}:${pathName}:delete', '2', null, '6';
-- 新增的${moduleName}ui菜单
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
VALUES ('53', '${comments}-新增', '${moduleName}/${pathName}/${pathName}addui', '${moduleName}:${pathName}:save', '1', 'config', '6');
-- 修改的${moduleName}ui菜单
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
VALUES ('53', '${comments}-修改', '${moduleName}/${pathName}/${pathName}updateui', '${moduleName}:${pathName}:update', '1', 'config', '6');
target/classes/template/updateui.vue.vm
0 → 100644
View file @
af433352
<template>
<div>
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
#foreach($column in $columns)
#if($column.columnName != $pk.columnName)
<el-form-item label="${column.comments}" prop="${column.attrname}">
<el-input v-model="dataForm.${column.attrname}" placeholder="${column.comments}"></el-input>
</el-form-item>
#end
#end
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
<el-button @click="visible = false">取消</el-button>
</span>
</div>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
#foreach($column in $columns)
#if($column.columnName == $pk.columnName)
${column.attrname}: 0,
#else
${column.attrname}: ''#if($velocityCount != $columns.size()),#end
#end
#end
},
dataRule: {
#foreach($column in $columns)
#if($column.columnName != $pk.columnName)
${column.attrname}: [
{ required: true, message: '${column.comments}不能为空', trigger: 'blur' }
]#if($velocityCount != $columns.size()),#end
#end
#end
}
}
},
mounted () {
this.$nextTick(() => {
this.init(this.$route.params.id)
})
},
methods: {
init (id) {
this.dataForm.${pk.attrname} = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.${pk.attrname}) {
this.$http({
url: #[[this.$http.adornUrl]]#(`/${moduleName}/${pathName}/info/#[[$]]#{this.dataForm.${pk.attrname}}`),
method: 'get',
#[[params: this.$http.adornParams()]]#
}).then(({data}) => {
if (data && data.code === 0) {
#foreach($column in $columns)
#if($column.columnName != $pk.columnName)
this.dataForm.${column.attrname} = data.data.${column.attrname}
#end
#end
}
})
}
})
},
// 表单提交
dataFormSubmit () {
#[[this.$refs['dataForm'].validate((valid) => {]]#
if (valid) {
this.$http({
url: #[[this.$http.adornUrl]]#(`/${moduleName}/${pathName}/${!this.dataForm.${pk.attrname} ? 'save' : 'update'}`),
method: 'post',
#[[data: this.$http.adornData({]]#
#foreach($column in $columns)
#if($column.columnName == $pk.columnName)
'${column.attrname}': this.dataForm.${column.attrname} || undefined,
#else
'${column.attrname}': this.dataForm.${column.attrname}#if($velocityCount != $columns.size()),#end
#end
#end
})
}).then(({data}) => {
if (data && data.code === 0) {
#[[this.$message({]]#
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
#[[this.$emit('refreshDataList')]]#
}
})
} else {
#[[this.$message.error(data.msg)]]#
}
})
}
})
}
}
}
</script>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment