fix: 修复vue2模版异常问题
This commit is contained in:
@@ -157,7 +157,7 @@
|
||||
</el-table>
|
||||
|
||||
<!-- 添加或修改{{ functionName }}对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
{% for column in columns %}
|
||||
{% set field = column.python_field %}
|
||||
@@ -283,6 +283,9 @@ export default {
|
||||
{% if dicts %}
|
||||
dicts: [{{ dicts }}],
|
||||
{% endif %}
|
||||
components: {
|
||||
Treeselect
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
@@ -291,6 +294,8 @@ export default {
|
||||
showSearch: true,
|
||||
// {{ functionName }}表格数据
|
||||
{{ businessName }}List: [],
|
||||
// {{ functionName }}树选项
|
||||
{{ businessName }}Options: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
@@ -375,7 +380,6 @@ export default {
|
||||
data.children = this.handleTree(response.data, "{{ treeCode }}", "{{ treeParentCode }}");
|
||||
this.{{ businessName }}Options.push(data);
|
||||
});
|
||||
}
|
||||
},
|
||||
/** 取消按钮 */
|
||||
cancel() {
|
||||
@@ -394,7 +398,6 @@ export default {
|
||||
{% endfor %}
|
||||
};
|
||||
this.resetForm("form");
|
||||
}
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
@@ -408,7 +411,7 @@ export default {
|
||||
this.daterange{{ AttrName }} = [];
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
this.resetForm("queryRef");
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
@@ -432,7 +435,7 @@ export default {
|
||||
});
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
this.getTreeselect();
|
||||
if (row != null) {
|
||||
@@ -483,5 +486,6 @@ export default {
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
@@ -169,7 +169,7 @@
|
||||
/>
|
||||
|
||||
<!-- 添加或修改{{ functionName }}对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
{% for column in columns %}
|
||||
{% set field = column.python_field %}
|
||||
@@ -457,7 +457,6 @@ export default {
|
||||
this.{{ subclassName }}List = [];
|
||||
{% endif %}
|
||||
this.resetForm("form");
|
||||
}
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
@@ -472,7 +471,7 @@ export default {
|
||||
this.daterange{{ AttrName }} = [];
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
this.resetForm("queryRef");
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 多选框选中数据 */
|
||||
@@ -579,8 +578,9 @@ export default {
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('{{ moduleName }}/{{ businessName }}/export', {
|
||||
...queryParams.value
|
||||
...this.queryParams
|
||||
}, `{{ businessName }}_${new Date().getTime()}.xlsx`);
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
@@ -5,6 +5,7 @@ from jinja2 import Environment, FileSystemLoader
|
||||
from typing import Dict, List, Set
|
||||
from config.constant import GenConstant
|
||||
from config.env import DataBaseConfig
|
||||
from exceptions.exception import ServiceWarning
|
||||
from module_generator.entity.vo.gen_vo import GenTableModel, GenTableColumnModel
|
||||
from utils.common_util import CamelCaseUtil, SnakeCaseUtil
|
||||
from utils.string_util import StringUtil
|
||||
@@ -60,6 +61,8 @@ class TemplateUtils:
|
||||
:param gen_table: 生成表的配置信息
|
||||
:return: 模板上下文字典
|
||||
"""
|
||||
if not gen_table.options:
|
||||
raise ServiceWarning(message='请先完善生成配置信息')
|
||||
class_name = gen_table.class_name
|
||||
module_name = gen_table.module_name
|
||||
business_name = gen_table.business_name
|
||||
@@ -445,6 +448,7 @@ class TemplateUtils:
|
||||
"""
|
||||
if '(' in column_type:
|
||||
column_type_list = column_type.split('(')
|
||||
if column_type_list[0] in GenConstant.COLUMNTYPE_STR:
|
||||
sqlalchemy_type = (
|
||||
StringUtil.get_mapping_value_by_key_ignore_case(
|
||||
GenConstant.DB_TO_SQLALCHEMY_TYPE_MAPPING, column_type_list[0]
|
||||
@@ -452,6 +456,10 @@ class TemplateUtils:
|
||||
+ '('
|
||||
+ column_type_list[1]
|
||||
)
|
||||
else:
|
||||
sqlalchemy_type = StringUtil.get_mapping_value_by_key_ignore_case(
|
||||
GenConstant.DB_TO_SQLALCHEMY_TYPE_MAPPING, column_type_list[0]
|
||||
)
|
||||
else:
|
||||
sqlalchemy_type = StringUtil.get_mapping_value_by_key_ignore_case(
|
||||
GenConstant.DB_TO_SQLALCHEMY_TYPE_MAPPING, column_type
|
||||
|
Reference in New Issue
Block a user