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