!30 RuoYi-Vue3-FastAPI 1.6.2
Merge pull request !30 from insistence/develop
This commit is contained in:
7
.gitignore
vendored
7
.gitignore
vendored
@@ -136,3 +136,10 @@ dmypy.json
|
|||||||
|
|
||||||
# Cython debug symbols
|
# Cython debug symbols
|
||||||
cython_debug/
|
cython_debug/
|
||||||
|
|
||||||
|
# PyCharm
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
# VSCode
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
@@ -1,12 +1,12 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<img alt="logo" src="https://oscimg.oschina.net/oscnet/up-d3d0a9303e11d522a06cd263f3079027715.png">
|
<img alt="logo" src="https://oscimg.oschina.net/oscnet/up-d3d0a9303e11d522a06cd263f3079027715.png">
|
||||||
</p>
|
</p>
|
||||||
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">RuoYi-Vue3-FastAPI v1.6.1</h1>
|
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">RuoYi-Vue3-FastAPI v1.6.2</h1>
|
||||||
<h4 align="center">基于RuoYi-Vue3+FastAPI前后端分离的快速开发框架</h4>
|
<h4 align="center">基于RuoYi-Vue3+FastAPI前后端分离的快速开发框架</h4>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://gitee.com/insistence2022/RuoYi-Vue3-FastAPI/stargazers"><img src="https://gitee.com/insistence2022/RuoYi-Vue3-FastAPI/badge/star.svg?theme=dark"></a>
|
<a href="https://gitee.com/insistence2022/RuoYi-Vue3-FastAPI/stargazers"><img src="https://gitee.com/insistence2022/RuoYi-Vue3-FastAPI/badge/star.svg?theme=dark"></a>
|
||||||
<a href="https://github.com/insistence/RuoYi-Vue3-FastAPI"><img src="https://img.shields.io/github/stars/insistence/RuoYi-Vue3-FastAPI?style=social"></a>
|
<a href="https://github.com/insistence/RuoYi-Vue3-FastAPI"><img src="https://img.shields.io/github/stars/insistence/RuoYi-Vue3-FastAPI?style=social"></a>
|
||||||
<a href="https://gitee.com/insistence2022/RuoYi-Vue3-FastAPI"><img src="https://img.shields.io/badge/RuoYiVue3FastAPI-v1.6.1-brightgreen.svg"></a>
|
<a href="https://gitee.com/insistence2022/RuoYi-Vue3-FastAPI"><img src="https://img.shields.io/badge/RuoYiVue3FastAPI-v1.6.2-brightgreen.svg"></a>
|
||||||
<a href="https://gitee.com/insistence2022/RuoYi-Vue3-FastAPI/blob/master/LICENSE"><img src="https://img.shields.io/github/license/mashape/apistatus.svg"></a>
|
<a href="https://gitee.com/insistence2022/RuoYi-Vue3-FastAPI/blob/master/LICENSE"><img src="https://img.shields.io/github/license/mashape/apistatus.svg"></a>
|
||||||
<img src="https://img.shields.io/badge/python-≥3.9-blue">
|
<img src="https://img.shields.io/badge/python-≥3.9-blue">
|
||||||
<img src="https://img.shields.io/badge/MySQL-≥5.7-blue">
|
<img src="https://img.shields.io/badge/MySQL-≥5.7-blue">
|
||||||
|
@@ -10,7 +10,7 @@ APP_HOST = '0.0.0.0'
|
|||||||
# 应用端口
|
# 应用端口
|
||||||
APP_PORT = 9099
|
APP_PORT = 9099
|
||||||
# 应用版本
|
# 应用版本
|
||||||
APP_VERSION= '1.6.1'
|
APP_VERSION= '1.6.2'
|
||||||
# 应用是否开启热重载
|
# 应用是否开启热重载
|
||||||
APP_RELOAD = true
|
APP_RELOAD = true
|
||||||
# 应用是否开启IP归属区域查询
|
# 应用是否开启IP归属区域查询
|
||||||
|
@@ -10,7 +10,7 @@ APP_HOST = '0.0.0.0'
|
|||||||
# 应用端口
|
# 应用端口
|
||||||
APP_PORT = 9099
|
APP_PORT = 9099
|
||||||
# 应用版本
|
# 应用版本
|
||||||
APP_VERSION= '1.6.1'
|
APP_VERSION= '1.6.2'
|
||||||
# 应用是否开启热重载
|
# 应用是否开启热重载
|
||||||
APP_RELOAD = false
|
APP_RELOAD = false
|
||||||
# 应用是否开启IP归属区域查询
|
# 应用是否开启IP归属区域查询
|
||||||
|
@@ -252,6 +252,8 @@ class GenConstant:
|
|||||||
'double',
|
'double',
|
||||||
'decimal',
|
'decimal',
|
||||||
]
|
]
|
||||||
|
COLUMNNAME_NOT_ADD_SHOW = ['create_by', 'create_time']
|
||||||
|
COLUMNNAME_NOT_EDIT_SHOW = ['update_by', 'update_time']
|
||||||
COLUMNNAME_NOT_EDIT = ['id', 'create_by', 'create_time', 'del_flag']
|
COLUMNNAME_NOT_EDIT = ['id', 'create_by', 'create_time', 'del_flag']
|
||||||
COLUMNNAME_NOT_LIST = ['id', 'create_by', 'create_time', 'del_flag', 'update_by', 'update_time']
|
COLUMNNAME_NOT_LIST = ['id', 'create_by', 'create_time', 'del_flag', 'update_by', 'update_time']
|
||||||
COLUMNNAME_NOT_QUERY = ['id', 'create_by', 'create_time', 'del_flag', 'update_by', 'update_time', 'remark']
|
COLUMNNAME_NOT_QUERY = ['id', 'create_by', 'create_time', 'del_flag', 'update_by', 'update_time', 'remark']
|
||||||
|
@@ -201,9 +201,12 @@ class SchedulerUtil:
|
|||||||
job_executor = job_info.job_executor
|
job_executor = job_info.job_executor
|
||||||
if iscoroutinefunction(job_func):
|
if iscoroutinefunction(job_func):
|
||||||
job_executor = 'default'
|
job_executor = 'default'
|
||||||
|
job_trigger = DateTrigger()
|
||||||
|
if job_info.status == '0':
|
||||||
|
job_trigger = OrTrigger(triggers=[DateTrigger(), MyCronTrigger.from_crontab(job_info.cron_expression)])
|
||||||
scheduler.add_job(
|
scheduler.add_job(
|
||||||
func=eval(job_info.invoke_target),
|
func=eval(job_info.invoke_target),
|
||||||
trigger=OrTrigger(triggers=[DateTrigger(), MyCronTrigger.from_crontab(job_info.cron_expression)]),
|
trigger=job_trigger,
|
||||||
args=job_info.job_args.split(',') if job_info.job_args else None,
|
args=job_info.job_args.split(',') if job_info.job_args else None,
|
||||||
kwargs=json.loads(job_info.job_kwargs) if job_info.job_kwargs else None,
|
kwargs=json.loads(job_info.job_kwargs) if job_info.job_kwargs else None,
|
||||||
id=str(job_info.job_id),
|
id=str(job_info.job_id),
|
||||||
|
@@ -5,6 +5,7 @@ from module_admin.entity.do.log_do import SysLogininfor, SysOperLog
|
|||||||
from module_admin.entity.vo.log_vo import LogininforModel, LoginLogPageQueryModel, OperLogModel, OperLogPageQueryModel
|
from module_admin.entity.vo.log_vo import LogininforModel, LoginLogPageQueryModel, OperLogModel, OperLogPageQueryModel
|
||||||
from utils.common_util import SnakeCaseUtil
|
from utils.common_util import SnakeCaseUtil
|
||||||
from utils.page_util import PageUtil
|
from utils.page_util import PageUtil
|
||||||
|
from utils.time_format_util import TimeFormatUtil
|
||||||
|
|
||||||
|
|
||||||
class OperationLogDao:
|
class OperationLogDao:
|
||||||
@@ -38,8 +39,8 @@ class OperationLogDao:
|
|||||||
SysOperLog.business_type == query_object.business_type if query_object.business_type else True,
|
SysOperLog.business_type == query_object.business_type if query_object.business_type else True,
|
||||||
SysOperLog.status == query_object.status if query_object.status else True,
|
SysOperLog.status == query_object.status if query_object.status else True,
|
||||||
SysOperLog.oper_time.between(
|
SysOperLog.oper_time.between(
|
||||||
datetime.combine(datetime.strptime(query_object.begin_time, '%Y-%m-%d'), time(00, 00, 00)),
|
datetime.combine(TimeFormatUtil.parse_date(query_object.begin_time), time(00, 00, 00)),
|
||||||
datetime.combine(datetime.strptime(query_object.end_time, '%Y-%m-%d'), time(23, 59, 59)),
|
datetime.combine(TimeFormatUtil.parse_date(query_object.end_time), time(23, 59, 59)),
|
||||||
)
|
)
|
||||||
if query_object.begin_time and query_object.end_time
|
if query_object.begin_time and query_object.end_time
|
||||||
else True,
|
else True,
|
||||||
@@ -120,8 +121,8 @@ class LoginLogDao:
|
|||||||
SysLogininfor.user_name.like(f'%{query_object.user_name}%') if query_object.user_name else True,
|
SysLogininfor.user_name.like(f'%{query_object.user_name}%') if query_object.user_name else True,
|
||||||
SysLogininfor.status == query_object.status if query_object.status else True,
|
SysLogininfor.status == query_object.status if query_object.status else True,
|
||||||
SysLogininfor.login_time.between(
|
SysLogininfor.login_time.between(
|
||||||
datetime.combine(datetime.strptime(query_object.begin_time, '%Y-%m-%d'), time(00, 00, 00)),
|
datetime.combine(TimeFormatUtil.parse_date(query_object.begin_time), time(00, 00, 00)),
|
||||||
datetime.combine(datetime.strptime(query_object.end_time, '%Y-%m-%d'), time(23, 59, 59)),
|
datetime.combine(TimeFormatUtil.parse_date(query_object.end_time), time(23, 59, 59)),
|
||||||
)
|
)
|
||||||
if query_object.begin_time and query_object.end_time
|
if query_object.begin_time and query_object.end_time
|
||||||
else True,
|
else True,
|
||||||
|
@@ -103,9 +103,10 @@ class DictTypeService:
|
|||||||
if dict_type_info.dict_type != page_object.dict_type:
|
if dict_type_info.dict_type != page_object.dict_type:
|
||||||
for dict_data in dict_data_list:
|
for dict_data in dict_data_list:
|
||||||
edit_dict_data = DictDataModel(
|
edit_dict_data = DictDataModel(
|
||||||
dictCode=dict_data.dict_code,
|
dictCode=dict_data.get('dict_code'),
|
||||||
dictType=page_object.dict_type,
|
dictType=page_object.dict_type,
|
||||||
updateBy=page_object.update_by,
|
updateBy=page_object.update_by,
|
||||||
|
updateTime=page_object.update_time,
|
||||||
).model_dump(exclude_unset=True)
|
).model_dump(exclude_unset=True)
|
||||||
await DictDataDao.edit_dict_data_dao(query_db, edit_dict_data)
|
await DictDataDao.edit_dict_data_dao(query_db, edit_dict_data)
|
||||||
await DictTypeDao.edit_dict_type_dao(query_db, edit_dict_type)
|
await DictTypeDao.edit_dict_type_dao(query_db, edit_dict_type)
|
||||||
|
@@ -494,6 +494,7 @@ class UserService:
|
|||||||
}
|
}
|
||||||
|
|
||||||
for item in user_list:
|
for item in user_list:
|
||||||
|
item['deptName'] = item.get('dept').get('deptName')
|
||||||
if item.get('status') == '0':
|
if item.get('status') == '0':
|
||||||
item['status'] = '正常'
|
item['status'] = '正常'
|
||||||
else:
|
else:
|
||||||
|
@@ -118,12 +118,12 @@ class {{ BusinessName }}Dao:
|
|||||||
{{ ClassName }}.{{ field }} <= query_object.{{ field }} if query_object.{{ field }} else True,
|
{{ ClassName }}.{{ field }} <= query_object.{{ field }} if query_object.{{ field }} else True,
|
||||||
{% elif column.query_type == "LIKE" %}
|
{% elif column.query_type == "LIKE" %}
|
||||||
{{ ClassName }}.{{ field }}.like(f'%{% raw %}{{% endraw %}query_object.{{ field }}{% raw %}}{% endraw %}%') if query_object.{{ field }} else True,
|
{{ ClassName }}.{{ field }}.like(f'%{% raw %}{{% endraw %}query_object.{{ field }}{% raw %}}{% endraw %}%') if query_object.{{ field }} else True,
|
||||||
{% elif column.query_type == "BETWEEN" %}
|
{% elif column.html_type == "datetime" and column.query_type == "BETWEEN" %}
|
||||||
{{ ClassName }}.{{ field }}.between(
|
{{ ClassName }}.{{ field }}.between(
|
||||||
datetime.combine(datetime.strptime(query_object.begin_time, '%Y-%m-%d'), time(00, 00, 00)),
|
datetime.combine(datetime.strptime(query_object.begin_{{ column.column_name }}, '%Y-%m-%d'), time(00, 00, 00)),
|
||||||
datetime.combine(datetime.strptime(query_object.end_time, '%Y-%m-%d'), time(23, 59, 59)),
|
datetime.combine(datetime.strptime(query_object.end_{{ column.column_name }}, '%Y-%m-%d'), time(23, 59, 59)),
|
||||||
)
|
)
|
||||||
if query_object.begin_time and query_object.end_time
|
if query_object.begin_{{ column.column_name }} and query_object.end_{{ column.column_name }}
|
||||||
else True,
|
else True,
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -145,7 +145,7 @@ class {{ BusinessName }}Dao:
|
|||||||
:param {{ businessName }}: {{ functionName }}对象
|
:param {{ businessName }}: {{ functionName }}对象
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
db_{{ businessName }} = {{ ClassName }}(**{{ businessName }}.model_dump(exclude={% raw %}{{% endraw %}{% if table.sub %}'{{ subclassName }}_list', {% endif %}{% for column in columns %}{% if not column.insert %}'{{ column.python_field | camel_to_snake }}'{% if not loop.last %}, {% endif %}{% endif %}{% endfor %}{% raw %}}{% endraw %}))
|
db_{{ businessName }} = {{ ClassName }}(**{{ businessName }}.model_dump(exclude={% raw %}{{% endraw %}{% if table.sub %}'{{ subclassName }}_list', {% endif %}{% for column in columns %}{% if not column.insert and column.column_name not in column_not_add_show + column_not_edit_show %}'{{ column.python_field | camel_to_snake }}'{% if not loop.last %}, {% endif %}{% endif %}{% endfor %}{% raw %}}{% endraw %}))
|
||||||
db.add(db_{{ businessName }})
|
db.add(db_{{ businessName }})
|
||||||
await db.flush()
|
await db.flush()
|
||||||
|
|
||||||
|
@@ -103,7 +103,7 @@ class {{ BusinessName }}Service:
|
|||||||
:param page_object: 编辑{{ functionName }}对象
|
:param page_object: 编辑{{ functionName }}对象
|
||||||
:return: 编辑{{ functionName }}校验结果
|
:return: 编辑{{ functionName }}校验结果
|
||||||
"""
|
"""
|
||||||
edit_{{ businessName }} = page_object.model_dump(exclude_unset=True, exclude={% raw %}{{% endraw %}{% if table.sub %}'{{ subclassName }}_list', {% endif %}{% for column in columns %}{% if not column.edit and not column.pk %}'{{ column.python_field | camel_to_snake }}'{% if not loop.last %}, {% endif %}{% endif %}{% endfor %}{% raw %}}{% endraw %})
|
edit_{{ businessName }} = page_object.model_dump(exclude_unset=True, exclude={% raw %}{{% endraw %}{% if table.sub %}'{{ subclassName }}_list', {% endif %}{% for column in columns %}{% if not column.edit and not column.pk and column.column_name not in column_not_edit_show %}'{{ column.python_field | camel_to_snake }}'{% if not loop.last %}, {% endif %}{% endif %}{% endfor %}{% raw %}}{% endraw %})
|
||||||
{{ businessName }}_info = await cls.{{ businessName }}_detail_services(query_db, page_object.{{ pk_field }})
|
{{ businessName }}_info = await cls.{{ businessName }}_detail_services(query_db, page_object.{{ pk_field }})
|
||||||
if {{ businessName }}_info.{{ pk_field }}:
|
if {{ businessName }}_info.{{ pk_field }}:
|
||||||
{% for column in columns %}
|
{% for column in columns %}
|
||||||
|
@@ -3,10 +3,14 @@
|
|||||||
{% set pkParentheseIndex = pkColumn.column_comment.find("(") %}
|
{% set pkParentheseIndex = pkColumn.column_comment.find("(") %}
|
||||||
{% set pk_field_comment = pkColumn.column_comment[:pkParentheseIndex] if pkParentheseIndex != -1 else pkColumn.column_comment %}
|
{% set pk_field_comment = pkColumn.column_comment[:pkParentheseIndex] if pkParentheseIndex != -1 else pkColumn.column_comment %}
|
||||||
{% set vo_field_required = namespace(has_required=False) %}
|
{% set vo_field_required = namespace(has_required=False) %}
|
||||||
|
{% set vo_field_daterange = namespace(has_daterange=False) %}
|
||||||
{% for column in columns %}
|
{% for column in columns %}
|
||||||
{% if column.required %}
|
{% if column.required %}
|
||||||
{% set vo_field_required.has_required = True %}
|
{% set vo_field_required.has_required = True %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if column.html_type == "datetime" and column.query_type == "BETWEEN" %}
|
||||||
|
{% set vo_field_daterange.has_daterange = True %}
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% set sub_vo_field_required = namespace(has_required=False) %}
|
{% set sub_vo_field_required = namespace(has_required=False) %}
|
||||||
{% if table.sub %}
|
{% if table.sub %}
|
||||||
@@ -142,9 +146,16 @@ class {{ BusinessName }}QueryModel({% if table.sub %}{{ BusinessName }}BaseModel
|
|||||||
"""
|
"""
|
||||||
{{ functionName }}不分页查询模型
|
{{ functionName }}不分页查询模型
|
||||||
"""
|
"""
|
||||||
|
{% if vo_field_daterange.has_daterange %}
|
||||||
begin_time: Optional[str] = Field(default=None, description='开始时间')
|
{% for column in columns %}
|
||||||
end_time: Optional[str] = Field(default=None, description='结束时间')
|
{% if column.html_type == "datetime" and column.query_type == "BETWEEN" %}
|
||||||
|
begin_{{ column.column_name }}: Optional[str] = Field(default=None, description='开始{{ column.column_comment }}')
|
||||||
|
end_{{ column.column_name }}: Optional[str] = Field(default=None, description='结束{{ column.column_comment }}')
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% else %}
|
||||||
|
pass
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
@as_query
|
@as_query
|
||||||
|
@@ -35,12 +35,13 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "datetime" and column.query_type != "BETWEEN" %}
|
{% elif column.html_type == "datetime" and column.query_type != "BETWEEN" %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ column.python_field }}">
|
<el-form-item label="{{ comment }}" prop="{{ column.python_field }}">
|
||||||
<el-date-picker clearable
|
<el-date-picker
|
||||||
v-model="queryParams.{{ column.python_field }}"
|
v-model="queryParams.{{ column.python_field }}"
|
||||||
type="date"
|
type="date"
|
||||||
value-format="yyyy-MM-dd"
|
value-format="yyyy-MM-dd"
|
||||||
placeholder="请选择{{ comment }}">
|
placeholder="请选择{{ comment }}"
|
||||||
</el-date-picker>
|
clearable
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "datetime" and column.query_type == "BETWEEN" %}
|
{% elif column.html_type == "datetime" and column.query_type == "BETWEEN" %}
|
||||||
<el-form-item label="{{ comment }}">
|
<el-form-item label="{{ comment }}">
|
||||||
@@ -52,7 +53,7 @@
|
|||||||
range-separator="-"
|
range-separator="-"
|
||||||
start-placeholder="开始日期"
|
start-placeholder="开始日期"
|
||||||
end-placeholder="结束日期"
|
end-placeholder="结束日期"
|
||||||
></el-date-picker>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -161,33 +162,33 @@
|
|||||||
<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 %}
|
||||||
{% if column.insert and not column.pk %}
|
{% if (column.insert or column.edit) and not column.pk and column.column_name not in column_not_add_show + column_not_edit_show %}
|
||||||
{% if column.usable_column or not column.super_column %}
|
{% if column.usable_column or not column.super_column %}
|
||||||
{% set parentheseIndex = column.column_comment.find("(") %}
|
{% set parentheseIndex = column.column_comment.find("(") %}
|
||||||
{% set comment = column.column_comment[:parentheseIndex] if parentheseIndex != -1 else column.column_comment %}
|
{% set comment = column.column_comment[:parentheseIndex] if parentheseIndex != -1 else column.column_comment %}
|
||||||
{% set dictType = column.dict_type %}
|
{% set dictType = column.dict_type %}
|
||||||
{% if treeParentCode and column.python_field == treeParentCode %}
|
{% if treeParentCode and column.python_field == treeParentCode %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ treeParentCode }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ treeParentCode }}">
|
||||||
<treeselect v-model="form.{{ treeParentCode }}" :options="{{ businessName }}Options" :normalizer="normalizer" placeholder="请选择{{ comment }}" />
|
<treeselect v-model="form.{{ treeParentCode }}" :options="{{ businessName }}Options" :normalizer="normalizer" placeholder="请选择{{ comment }}" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "input" %}
|
{% elif column.html_type == "input" %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-input v-model="form.{{ field }}" placeholder="请输入{{ comment }}" />
|
<el-input v-model="form.{{ field }}" placeholder="请输入{{ comment }}" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "imageUpload" %}
|
{% elif column.html_type == "imageUpload" %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<image-upload v-model="form.{{ field }}"/>
|
<image-upload v-model="form.{{ field }}"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "fileUpload" %}
|
{% elif column.html_type == "fileUpload" %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<file-upload v-model="form.{{ field }}"/>
|
<file-upload v-model="form.{{ field }}"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "editor" %}
|
{% elif column.html_type == "editor" %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<editor v-model="form.{{ field }}" :min-height="192"/>
|
<editor v-model="form.{{ field }}" :min-height="192"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "select" and dictType %}
|
{% elif column.html_type == "select" and dictType %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-select v-model="form.{{ field }}" placeholder="请选择{{ comment }}">
|
<el-select v-model="form.{{ field }}" placeholder="请选择{{ comment }}">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in dict.type.{{ dictType }}"
|
v-for="dict in dict.type.{{ dictType }}"
|
||||||
@@ -202,13 +203,13 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "select" and not dictType %}
|
{% elif column.html_type == "select" and not dictType %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-select v-model="form.{{ field }}" placeholder="请选择{{ comment }}">
|
<el-select v-model="form.{{ field }}" placeholder="请选择{{ comment }}">
|
||||||
<el-option label="请选择字典生成" value="" />
|
<el-option label="请选择字典生成" value="" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "checkbox" and dictType %}
|
{% elif column.html_type == "checkbox" and dictType %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-checkbox-group v-model="form.{{ field }}">
|
<el-checkbox-group v-model="form.{{ field }}">
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
v-for="dict in dict.type.{{ dictType }}"
|
v-for="dict in dict.type.{{ dictType }}"
|
||||||
@@ -219,13 +220,13 @@
|
|||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "checkbox" and not dictType %}
|
{% elif column.html_type == "checkbox" and not dictType %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-checkbox-group v-model="form.{{ field }}">
|
<el-checkbox-group v-model="form.{{ field }}">
|
||||||
<el-checkbox>请选择字典生成</el-checkbox>
|
<el-checkbox>请选择字典生成</el-checkbox>
|
||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "radio" and dictType %}
|
{% elif column.html_type == "radio" and dictType %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-radio-group v-model="form.{{ field }}">
|
<el-radio-group v-model="form.{{ field }}">
|
||||||
<el-radio
|
<el-radio
|
||||||
v-for="dict in dict.type.{{ dictType }}"
|
v-for="dict in dict.type.{{ dictType }}"
|
||||||
@@ -240,13 +241,13 @@
|
|||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "radio" and not dictType %}
|
{% elif column.html_type == "radio" and not dictType %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-radio-group v-model="form.{{ field }}">
|
<el-radio-group v-model="form.{{ field }}">
|
||||||
<el-radio label="请选择字典生成" value="" />
|
<el-radio label="请选择字典生成" value="" />
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "datetime" %}
|
{% elif column.html_type == "datetime" %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-date-picker clearable
|
<el-date-picker clearable
|
||||||
v-model="form.{{ field }}"
|
v-model="form.{{ field }}"
|
||||||
type="date"
|
type="date"
|
||||||
@@ -255,7 +256,7 @@
|
|||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "textarea" %}
|
{% elif column.html_type == "textarea" %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-input v-model="form.{{ field }}" type="textarea" placeholder="请输入内容" />
|
<el-input v-model="form.{{ field }}" type="textarea" placeholder="请输入内容" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -351,8 +352,8 @@ export default {
|
|||||||
{% if column.html_type == "datetime" and column.query_type == "BETWEEN" %}
|
{% if column.html_type == "datetime" and column.query_type == "BETWEEN" %}
|
||||||
{% set AttrName = column.python_field[0] | upper + column.python_field[1:] %}
|
{% set AttrName = column.python_field[0] | upper + column.python_field[1:] %}
|
||||||
if (null != this.daterange{{ AttrName }} && '' != this.daterange{{ AttrName }}) {
|
if (null != this.daterange{{ AttrName }} && '' != this.daterange{{ AttrName }}) {
|
||||||
this.queryParams.params["begin{{ AttrName }}"] = this.daterange{{ AttrName }}[0];
|
this.queryParams.begin{{ AttrName }} = this.daterange{{ AttrName }}[0];
|
||||||
this.queryParams.params["end{{ AttrName }}"] = this.daterange{{ AttrName }}[1];
|
this.queryParams.end{{ AttrName }} = this.daterange{{ AttrName }}[1];
|
||||||
}
|
}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -485,6 +486,10 @@ export default {
|
|||||||
this.getList();
|
this.getList();
|
||||||
this.$modal.msgSuccess("删除成功");
|
this.$modal.msgSuccess("删除成功");
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
|
},
|
||||||
|
/** 是否渲染字段 */
|
||||||
|
renderField(insert, edit) {
|
||||||
|
return this.form.{{ pkColumn.python_field }} == null ? insert : edit;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@@ -35,12 +35,13 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "datetime" and column.query_type != "BETWEEN" %}
|
{% elif column.html_type == "datetime" and column.query_type != "BETWEEN" %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ column.python_field }}">
|
<el-form-item label="{{ comment }}" prop="{{ column.python_field }}">
|
||||||
<el-date-picker clearable
|
<el-date-picker
|
||||||
v-model="queryParams.{{ column.python_field }}"
|
v-model="queryParams.{{ column.python_field }}"
|
||||||
type="date"
|
type="date"
|
||||||
value-format="yyyy-MM-dd"
|
value-format="yyyy-MM-dd"
|
||||||
placeholder="请选择{{ comment }}">
|
placeholder="请选择{{ comment }}"
|
||||||
</el-date-picker>
|
clearable
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "datetime" and column.query_type == "BETWEEN" %}
|
{% elif column.html_type == "datetime" and column.query_type == "BETWEEN" %}
|
||||||
<el-form-item label="{{ comment }}">
|
<el-form-item label="{{ comment }}">
|
||||||
@@ -52,7 +53,7 @@
|
|||||||
range-separator="-"
|
range-separator="-"
|
||||||
start-placeholder="开始日期"
|
start-placeholder="开始日期"
|
||||||
end-placeholder="结束日期"
|
end-placeholder="结束日期"
|
||||||
></el-date-picker>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -173,29 +174,29 @@
|
|||||||
<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 %}
|
||||||
{% if column.insert and not column.pk %}
|
{% if (column.insert or column.edit) and not column.pk and column.column_name not in column_not_add_show + column_not_edit_show %}
|
||||||
{% if column.usable_column or not column.super_column %}
|
{% if column.usable_column or not column.super_column %}
|
||||||
{% set parentheseIndex = column.column_comment.find("(") %}
|
{% set parentheseIndex = column.column_comment.find("(") %}
|
||||||
{% set comment = column.column_comment[:parentheseIndex] if parentheseIndex != -1 else column.column_comment %}
|
{% set comment = column.column_comment[:parentheseIndex] if parentheseIndex != -1 else column.column_comment %}
|
||||||
{% set dictType = column.dict_type %}
|
{% set dictType = column.dict_type %}
|
||||||
{% if column.html_type == "input" %}
|
{% if column.html_type == "input" %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-input v-model="form.{{ field }}" placeholder="请输入{{ comment }}" />
|
<el-input v-model="form.{{ field }}" placeholder="请输入{{ comment }}" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "imageUpload" %}
|
{% elif column.html_type == "imageUpload" %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<image-upload v-model="form.{{ field }}"/>
|
<image-upload v-model="form.{{ field }}"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "fileUpload" %}
|
{% elif column.html_type == "fileUpload" %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<file-upload v-model="form.{{ field }}"/>
|
<file-upload v-model="form.{{ field }}"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "editor" %}
|
{% elif column.html_type == "editor" %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<editor v-model="form.{{ field }}" :min-height="192"/>
|
<editor v-model="form.{{ field }}" :min-height="192"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "select" and dictType %}
|
{% elif column.html_type == "select" and dictType %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-select v-model="form.{{ field }}" placeholder="请选择{{ comment }}">
|
<el-select v-model="form.{{ field }}" placeholder="请选择{{ comment }}">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in dict.type.{{ dictType }}"
|
v-for="dict in dict.type.{{ dictType }}"
|
||||||
@@ -210,13 +211,13 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "select" and not dictType %}
|
{% elif column.html_type == "select" and not dictType %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-select v-model="form.{{ field }}" placeholder="请选择{{ comment }}">
|
<el-select v-model="form.{{ field }}" placeholder="请选择{{ comment }}">
|
||||||
<el-option label="请选择字典生成" value="" />
|
<el-option label="请选择字典生成" value="" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "checkbox" and dictType %}
|
{% elif column.html_type == "checkbox" and dictType %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-checkbox-group v-model="form.{{ field }}">
|
<el-checkbox-group v-model="form.{{ field }}">
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
v-for="dict in dict.type.{{ dictType }}"
|
v-for="dict in dict.type.{{ dictType }}"
|
||||||
@@ -227,13 +228,13 @@
|
|||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "checkbox" and not dictType %}
|
{% elif column.html_type == "checkbox" and not dictType %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-checkbox-group v-model="form.{{ field }}">
|
<el-checkbox-group v-model="form.{{ field }}">
|
||||||
<el-checkbox>请选择字典生成</el-checkbox>
|
<el-checkbox>请选择字典生成</el-checkbox>
|
||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "radio" and dictType %}
|
{% elif column.html_type == "radio" and dictType %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-radio-group v-model="form.{{ field }}">
|
<el-radio-group v-model="form.{{ field }}">
|
||||||
<el-radio
|
<el-radio
|
||||||
v-for="dict in dict.type.{{ dictType }}"
|
v-for="dict in dict.type.{{ dictType }}"
|
||||||
@@ -248,13 +249,13 @@
|
|||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "radio" and not dictType %}
|
{% elif column.html_type == "radio" and not dictType %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-radio-group v-model="form.{{ field }}">
|
<el-radio-group v-model="form.{{ field }}">
|
||||||
<el-radio label="请选择字典生成" value="" />
|
<el-radio label="请选择字典生成" value="" />
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "datetime" %}
|
{% elif column.html_type == "datetime" %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-date-picker clearable
|
<el-date-picker clearable
|
||||||
v-model="form.{{ field }}"
|
v-model="form.{{ field }}"
|
||||||
type="date"
|
type="date"
|
||||||
@@ -263,7 +264,7 @@
|
|||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "textarea" %}
|
{% elif column.html_type == "textarea" %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-input v-model="form.{{ field }}" type="textarea" placeholder="请输入内容" />
|
<el-input v-model="form.{{ field }}" type="textarea" placeholder="请输入内容" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -426,8 +427,8 @@ export default {
|
|||||||
{% if column.html_type == "datetime" and column.query_type == "BETWEEN" %}
|
{% if column.html_type == "datetime" and column.query_type == "BETWEEN" %}
|
||||||
{% set AttrName = column.python_field[0] | upper + column.python_field[1:] %}
|
{% set AttrName = column.python_field[0] | upper + column.python_field[1:] %}
|
||||||
if (null != this.daterange{{ AttrName }} && '' != this.daterange{{ AttrName }}) {
|
if (null != this.daterange{{ AttrName }} && '' != this.daterange{{ AttrName }}) {
|
||||||
this.queryParams.params["begin{{ AttrName }}"] = this.daterange{{ AttrName }}[0];
|
this.queryParams.begin{{ AttrName }} = this.daterange{{ AttrName }}[0];
|
||||||
this.queryParams.params["end{{ AttrName }}"] = this.daterange{{ AttrName }}[1];
|
this.queryParams.end{{ AttrName }} = this.daterange{{ AttrName }}[1];
|
||||||
}
|
}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -580,6 +581,10 @@ export default {
|
|||||||
this.download('{{ moduleName }}/{{ businessName }}/export', {
|
this.download('{{ moduleName }}/{{ businessName }}/export', {
|
||||||
...this.queryParams
|
...this.queryParams
|
||||||
}, `{{ businessName }}_${new Date().getTime()}.xlsx`);
|
}, `{{ businessName }}_${new Date().getTime()}.xlsx`);
|
||||||
|
},
|
||||||
|
/** 是否渲染字段 */
|
||||||
|
renderField(insert, edit) {
|
||||||
|
return this.form.{{ pkColumn.python_field }} == null ? insert : edit;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@@ -13,12 +13,13 @@
|
|||||||
v-model="queryParams.{{ column.python_field }}"
|
v-model="queryParams.{{ column.python_field }}"
|
||||||
placeholder="请输入{{ comment }}"
|
placeholder="请输入{{ comment }}"
|
||||||
clearable
|
clearable
|
||||||
|
style="width: 240px"
|
||||||
@keyup.enter="handleQuery"
|
@keyup.enter="handleQuery"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif (column.html_type == "select" or column.html_type == "radio") and dictType %}
|
{% elif (column.html_type == "select" or column.html_type == "radio") and dictType %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ column.python_field }}">
|
<el-form-item label="{{ comment }}" prop="{{ column.python_field }}">
|
||||||
<el-select v-model="queryParams.{{ column.python_field }}" placeholder="请选择{{ comment }}" clearable>
|
<el-select v-model="queryParams.{{ column.python_field }}" placeholder="请选择{{ comment }}" clearable style="width: 240px">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in {{ dictType }}"
|
v-for="dict in {{ dictType }}"
|
||||||
:key="dict.value"
|
:key="dict.value"
|
||||||
@@ -29,18 +30,20 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif (column.html_type == "select" or column.html_type == "radio") and not dictType %}
|
{% elif (column.html_type == "select" or column.html_type == "radio") and not dictType %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ column.python_field }}">
|
<el-form-item label="{{ comment }}" prop="{{ column.python_field }}">
|
||||||
<el-select v-model="queryParams.{{ column.python_field }}" placeholder="请选择{{ comment }}" clearable>
|
<el-select v-model="queryParams.{{ column.python_field }}" placeholder="请选择{{ comment }}" clearable style="width: 240px">
|
||||||
<el-option label="请选择字典生成" value="" />
|
<el-option label="请选择字典生成" value="" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "datetime" and column.query_type != "BETWEEN" %}
|
{% elif column.html_type == "datetime" and column.query_type != "BETWEEN" %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ column.python_field }}">
|
<el-form-item label="{{ comment }}" prop="{{ column.python_field }}">
|
||||||
<el-date-picker clearable
|
<el-date-picker
|
||||||
v-model="queryParams.{{ column.python_field }}"
|
v-model="queryParams.{{ column.python_field }}"
|
||||||
type="date"
|
type="date"
|
||||||
value-format="YYYY-MM-DD"
|
value-format="YYYY-MM-DD"
|
||||||
placeholder="请选择{{ comment }}">
|
placeholder="请选择{{ comment }}"
|
||||||
</el-date-picker>
|
clearable
|
||||||
|
style="width: 240px"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "datetime" and column.query_type == "BETWEEN" %}
|
{% elif column.html_type == "datetime" and column.query_type == "BETWEEN" %}
|
||||||
<el-form-item label="{{ comment }}" style="width: 308px">
|
<el-form-item label="{{ comment }}" style="width: 308px">
|
||||||
@@ -51,7 +54,8 @@
|
|||||||
range-separator="-"
|
range-separator="-"
|
||||||
start-placeholder="开始日期"
|
start-placeholder="开始日期"
|
||||||
end-placeholder="结束日期"
|
end-placeholder="结束日期"
|
||||||
></el-date-picker>
|
style="width: 240px"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -136,13 +140,13 @@
|
|||||||
<el-form ref="{{ businessName }}Ref" :model="form" :rules="rules" label-width="80px">
|
<el-form ref="{{ businessName }}Ref" :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 %}
|
||||||
{% if column.insert and not column.pk %}
|
{% if (column.insert or column.edit) and not column.pk and column.column_name not in column_not_add_show + column_not_edit_show %}
|
||||||
{% if column.usable_column or not column.super_column %}
|
{% if column.usable_column or not column.super_column %}
|
||||||
{% set parentheseIndex = column.column_comment.find("(") %}
|
{% set parentheseIndex = column.column_comment.find("(") %}
|
||||||
{% set comment = column.column_comment[:parentheseIndex] if parentheseIndex != -1 else column.column_comment %}
|
{% set comment = column.column_comment[:parentheseIndex] if parentheseIndex != -1 else column.column_comment %}
|
||||||
{% set dictType = column.dict_type %}
|
{% set dictType = column.dict_type %}
|
||||||
{% if treeParentCode and column.python_field == treeParentCode %}
|
{% if treeParentCode and column.python_field == treeParentCode %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ treeParentCode }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ treeParentCode }}">
|
||||||
<el-tree-select
|
<el-tree-select
|
||||||
v-model="form.{{ treeParentCode }}"
|
v-model="form.{{ treeParentCode }}"
|
||||||
:data="{{ businessName }}Options"
|
:data="{{ businessName }}Options"
|
||||||
@@ -153,23 +157,23 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "input" %}
|
{% elif column.html_type == "input" %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-input v-model="form.{{ field }}" placeholder="请输入{{ comment }}" />
|
<el-input v-model="form.{{ field }}" placeholder="请输入{{ comment }}" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "imageUpload" %}
|
{% elif column.html_type == "imageUpload" %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<image-upload v-model="form.{{ field }}"/>
|
<image-upload v-model="form.{{ field }}"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "fileUpload" %}
|
{% elif column.html_type == "fileUpload" %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<file-upload v-model="form.{{ field }}"/>
|
<file-upload v-model="form.{{ field }}"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "editor" %}
|
{% elif column.html_type == "editor" %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<editor v-model="form.{{ field }}" :min-height="192"/>
|
<editor v-model="form.{{ field }}" :min-height="192"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "select" and dictType %}
|
{% elif column.html_type == "select" and dictType %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-select v-model="form.{{ field }}" placeholder="请选择{{ comment }}">
|
<el-select v-model="form.{{ field }}" placeholder="请选择{{ comment }}">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in {{ dictType }}"
|
v-for="dict in {{ dictType }}"
|
||||||
@@ -184,13 +188,13 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "select" and not dictType %}
|
{% elif column.html_type == "select" and not dictType %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-select v-model="form.{{ field }}" placeholder="请选择{{ comment }}">
|
<el-select v-model="form.{{ field }}" placeholder="请选择{{ comment }}">
|
||||||
<el-option label="请选择字典生成" value="" />
|
<el-option label="请选择字典生成" value="" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "checkbox" and dictType %}
|
{% elif column.html_type == "checkbox" and dictType %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-checkbox-group v-model="form.{{ field }}">
|
<el-checkbox-group v-model="form.{{ field }}">
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
v-for="dict in {{ dictType }}"
|
v-for="dict in {{ dictType }}"
|
||||||
@@ -201,13 +205,13 @@
|
|||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "checkbox" and not dictType %}
|
{% elif column.html_type == "checkbox" and not dictType %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-checkbox-group v-model="form.{{ field }}">
|
<el-checkbox-group v-model="form.{{ field }}">
|
||||||
<el-checkbox>请选择字典生成</el-checkbox>
|
<el-checkbox>请选择字典生成</el-checkbox>
|
||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "radio" and dictType %}
|
{% elif column.html_type == "radio" and dictType %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-radio-group v-model="form.{{ field }}">
|
<el-radio-group v-model="form.{{ field }}">
|
||||||
<el-radio
|
<el-radio
|
||||||
v-for="dict in {{ dictType }}"
|
v-for="dict in {{ dictType }}"
|
||||||
@@ -222,13 +226,13 @@
|
|||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "radio" and not dictType %}
|
{% elif column.html_type == "radio" and not dictType %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-radio-group v-model="form.{{ field }}">
|
<el-radio-group v-model="form.{{ field }}">
|
||||||
<el-radio label="请选择字典生成" value="" />
|
<el-radio label="请选择字典生成" value="" />
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "datetime" %}
|
{% elif column.html_type == "datetime" %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-date-picker clearable
|
<el-date-picker clearable
|
||||||
v-model="form.{{ field }}"
|
v-model="form.{{ field }}"
|
||||||
type="date"
|
type="date"
|
||||||
@@ -237,7 +241,7 @@
|
|||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "textarea" %}
|
{% elif column.html_type == "textarea" %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-input v-model="form.{{ field }}" type="textarea" placeholder="请输入内容" />
|
<el-input v-model="form.{{ field }}" type="textarea" placeholder="请输入内容" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -315,8 +319,8 @@ function getList() {
|
|||||||
{% if column.html_type == "datetime" and column.query_type == "BETWEEN" %}
|
{% if column.html_type == "datetime" and column.query_type == "BETWEEN" %}
|
||||||
{% set AttrName = column.python_field[0] | upper + column.python_field[1:] %}
|
{% set AttrName = column.python_field[0] | upper + column.python_field[1:] %}
|
||||||
if (null != daterange{{ AttrName }} && '' != daterange{{ AttrName }}) {
|
if (null != daterange{{ AttrName }} && '' != daterange{{ AttrName }}) {
|
||||||
queryParams.value.params["begin{{ AttrName }}"] = daterange{{ AttrName }}.value[0];
|
queryParams.value.begin{{ AttrName }} = daterange{{ AttrName }}.value[0];
|
||||||
queryParams.value.params["end{{ AttrName }}"] = daterange{{ AttrName }}.value[1];
|
queryParams.value.end{{ AttrName }} = daterange{{ AttrName }}.value[1];
|
||||||
}
|
}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -450,5 +454,10 @@ function handleDelete(row) {
|
|||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 是否渲染字段 */
|
||||||
|
function renderField(insert, edit) {
|
||||||
|
return form.value.{{ pkColumn.python_field }} == null ? insert : edit;
|
||||||
|
}
|
||||||
|
|
||||||
getList();
|
getList();
|
||||||
</script>
|
</script>
|
@@ -13,12 +13,13 @@
|
|||||||
v-model="queryParams.{{ column.python_field }}"
|
v-model="queryParams.{{ column.python_field }}"
|
||||||
placeholder="请输入{{ comment }}"
|
placeholder="请输入{{ comment }}"
|
||||||
clearable
|
clearable
|
||||||
|
style="width: 240px"
|
||||||
@keyup.enter="handleQuery"
|
@keyup.enter="handleQuery"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif (column.html_type == "select" or column.html_type == "radio") and dictType %}
|
{% elif (column.html_type == "select" or column.html_type == "radio") and dictType %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ column.python_field }}">
|
<el-form-item label="{{ comment }}" prop="{{ column.python_field }}">
|
||||||
<el-select v-model="queryParams.{{ column.python_field }}" placeholder="请选择{{ comment }}" clearable>
|
<el-select v-model="queryParams.{{ column.python_field }}" placeholder="请选择{{ comment }}" clearable style="width: 240px">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in {{ dictType }}"
|
v-for="dict in {{ dictType }}"
|
||||||
:key="dict.value"
|
:key="dict.value"
|
||||||
@@ -29,18 +30,20 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif (column.html_type == "select" or column.html_type == "radio") and not dictType %}
|
{% elif (column.html_type == "select" or column.html_type == "radio") and not dictType %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ column.python_field }}">
|
<el-form-item label="{{ comment }}" prop="{{ column.python_field }}">
|
||||||
<el-select v-model="queryParams.{{ column.python_field }}" placeholder="请选择{{ comment }}" clearable>
|
<el-select v-model="queryParams.{{ column.python_field }}" placeholder="请选择{{ comment }}" clearable style="width: 240px">
|
||||||
<el-option label="请选择字典生成" value="" />
|
<el-option label="请选择字典生成" value="" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "datetime" and column.query_type != "BETWEEN" %}
|
{% elif column.html_type == "datetime" and column.query_type != "BETWEEN" %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ column.python_field }}">
|
<el-form-item label="{{ comment }}" prop="{{ column.python_field }}">
|
||||||
<el-date-picker clearable
|
<el-date-picker
|
||||||
v-model="queryParams.{{ column.python_field }}"
|
v-model="queryParams.{{ column.python_field }}"
|
||||||
type="date"
|
type="date"
|
||||||
value-format="YYYY-MM-DD"
|
value-format="YYYY-MM-DD"
|
||||||
placeholder="请选择{{ comment }}">
|
placeholder="请选择{{ comment }}"
|
||||||
</el-date-picker>
|
clearable
|
||||||
|
style="width: 240px"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "datetime" and column.query_type == "BETWEEN" %}
|
{% elif column.html_type == "datetime" and column.query_type == "BETWEEN" %}
|
||||||
<el-form-item label="{{ comment }}" style="width: 308px">
|
<el-form-item label="{{ comment }}" style="width: 308px">
|
||||||
@@ -51,7 +54,8 @@
|
|||||||
range-separator="-"
|
range-separator="-"
|
||||||
start-placeholder="开始日期"
|
start-placeholder="开始日期"
|
||||||
end-placeholder="结束日期"
|
end-placeholder="结束日期"
|
||||||
></el-date-picker>
|
style="width: 240px"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -159,29 +163,29 @@
|
|||||||
<el-form ref="{{ businessName }}Ref" :model="form" :rules="rules" label-width="80px">
|
<el-form ref="{{ businessName }}Ref" :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 %}
|
||||||
{% if column.insert and not column.pk %}
|
{% if (column.insert or column.edit) and not column.pk and column.column_name not in column_not_add_show + column_not_edit_show %}
|
||||||
{% if column.usable_column or not column.super_column %}
|
{% if column.usable_column or not column.super_column %}
|
||||||
{% set parentheseIndex = column.column_comment.find("(") %}
|
{% set parentheseIndex = column.column_comment.find("(") %}
|
||||||
{% set comment = column.column_comment[:parentheseIndex] if parentheseIndex != -1 else column.column_comment %}
|
{% set comment = column.column_comment[:parentheseIndex] if parentheseIndex != -1 else column.column_comment %}
|
||||||
{% set dictType = column.dict_type %}
|
{% set dictType = column.dict_type %}
|
||||||
{% if column.html_type == "input" %}
|
{% if column.html_type == "input" %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-input v-model="form.{{ field }}" placeholder="请输入{{ comment }}" />
|
<el-input v-model="form.{{ field }}" placeholder="请输入{{ comment }}" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "imageUpload" %}
|
{% elif column.html_type == "imageUpload" %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<image-upload v-model="form.{{ field }}"/>
|
<image-upload v-model="form.{{ field }}"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "fileUpload" %}
|
{% elif column.html_type == "fileUpload" %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<file-upload v-model="form.{{ field }}"/>
|
<file-upload v-model="form.{{ field }}"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "editor" %}
|
{% elif column.html_type == "editor" %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<editor v-model="form.{{ field }}" :min-height="192"/>
|
<editor v-model="form.{{ field }}" :min-height="192"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "select" and dictType %}
|
{% elif column.html_type == "select" and dictType %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-select v-model="form.{{ field }}" placeholder="请选择{{ comment }}">
|
<el-select v-model="form.{{ field }}" placeholder="请选择{{ comment }}">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in {{ dictType }}"
|
v-for="dict in {{ dictType }}"
|
||||||
@@ -196,13 +200,13 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "select" and not dictType %}
|
{% elif column.html_type == "select" and not dictType %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-select v-model="form.{{ field }}" placeholder="请选择{{ comment }}">
|
<el-select v-model="form.{{ field }}" placeholder="请选择{{ comment }}">
|
||||||
<el-option label="请选择字典生成" value="" />
|
<el-option label="请选择字典生成" value="" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "checkbox" and dictType %}
|
{% elif column.html_type == "checkbox" and dictType %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-checkbox-group v-model="form.{{ field }}">
|
<el-checkbox-group v-model="form.{{ field }}">
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
v-for="dict in {{ dictType }}"
|
v-for="dict in {{ dictType }}"
|
||||||
@@ -213,13 +217,13 @@
|
|||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "checkbox" and not dictType %}
|
{% elif column.html_type == "checkbox" and not dictType %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-checkbox-group v-model="form.{{ field }}">
|
<el-checkbox-group v-model="form.{{ field }}">
|
||||||
<el-checkbox>请选择字典生成</el-checkbox>
|
<el-checkbox>请选择字典生成</el-checkbox>
|
||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "radio" and dictType %}
|
{% elif column.html_type == "radio" and dictType %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-radio-group v-model="form.{{ field }}">
|
<el-radio-group v-model="form.{{ field }}">
|
||||||
<el-radio
|
<el-radio
|
||||||
v-for="dict in {{ dictType }}"
|
v-for="dict in {{ dictType }}"
|
||||||
@@ -234,13 +238,13 @@
|
|||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "radio" and not dictType %}
|
{% elif column.html_type == "radio" and not dictType %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-radio-group v-model="form.{{ field }}">
|
<el-radio-group v-model="form.{{ field }}">
|
||||||
<el-radio label="请选择字典生成" value="" />
|
<el-radio label="请选择字典生成" value="" />
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "datetime" %}
|
{% elif column.html_type == "datetime" %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-date-picker clearable
|
<el-date-picker clearable
|
||||||
v-model="form.{{ field }}"
|
v-model="form.{{ field }}"
|
||||||
type="date"
|
type="date"
|
||||||
@@ -249,7 +253,7 @@
|
|||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% elif column.html_type == "textarea" %}
|
{% elif column.html_type == "textarea" %}
|
||||||
<el-form-item label="{{ comment }}" prop="{{ field }}">
|
<el-form-item v-if="renderField({{ column.insert | lower }}, {{ column.edit | lower }})" label="{{ comment }}" prop="{{ field }}">
|
||||||
<el-input v-model="form.{{ field }}" type="textarea" placeholder="请输入内容" />
|
<el-input v-model="form.{{ field }}" type="textarea" placeholder="请输入内容" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -397,8 +401,8 @@ function getList() {
|
|||||||
{% if column.html_type == "datetime" and column.query_type == "BETWEEN" %}
|
{% if column.html_type == "datetime" and column.query_type == "BETWEEN" %}
|
||||||
{% set AttrName = column.python_field[0] | upper + column.python_field[1:] %}
|
{% set AttrName = column.python_field[0] | upper + column.python_field[1:] %}
|
||||||
if (null != daterange{{ AttrName }} && '' != daterange{{ AttrName }}) {
|
if (null != daterange{{ AttrName }} && '' != daterange{{ AttrName }}) {
|
||||||
queryParams.value.params["begin{{ AttrName }}"] = daterange{{ AttrName }}.value[0];
|
queryParams.value.begin{{ AttrName }} = daterange{{ AttrName }}.value[0];
|
||||||
queryParams.value.params["end{{ AttrName }}"] = daterange{{ AttrName }}.value[1];
|
queryParams.value.end{{ AttrName }} = daterange{{ AttrName }}.value[1];
|
||||||
}
|
}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -567,5 +571,10 @@ function handleExport() {
|
|||||||
}, `{{ businessName }}_${new Date().getTime()}.xlsx`);
|
}, `{{ businessName }}_${new Date().getTime()}.xlsx`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 是否渲染字段 */
|
||||||
|
function renderField(insert, edit) {
|
||||||
|
return form.value.{{ pkColumn.python_field }} == null ? insert : edit;
|
||||||
|
}
|
||||||
|
|
||||||
getList();
|
getList();
|
||||||
</script>
|
</script>
|
@@ -14,4 +14,5 @@ psycopg2==2.9.10
|
|||||||
redis==5.2.1
|
redis==5.2.1
|
||||||
requests==2.32.3
|
requests==2.32.3
|
||||||
SQLAlchemy[asyncio]==2.0.38
|
SQLAlchemy[asyncio]==2.0.38
|
||||||
|
sqlglot[rs]==26.6.0
|
||||||
user-agents==2.2.0
|
user-agents==2.2.0
|
||||||
|
@@ -91,6 +91,8 @@ class TemplateUtils:
|
|||||||
'table': gen_table,
|
'table': gen_table,
|
||||||
'dicts': cls.get_dicts(gen_table),
|
'dicts': cls.get_dicts(gen_table),
|
||||||
'dbType': DataBaseConfig.db_type,
|
'dbType': DataBaseConfig.db_type,
|
||||||
|
'column_not_add_show': GenConstant.COLUMNNAME_NOT_ADD_SHOW,
|
||||||
|
'column_not_edit_show': GenConstant.COLUMNNAME_NOT_EDIT_SHOW,
|
||||||
}
|
}
|
||||||
|
|
||||||
# 设置菜单、树形结构、子表的上下文
|
# 设置菜单、树形结构、子表的上下文
|
||||||
|
@@ -1,4 +1,7 @@
|
|||||||
import datetime
|
from copy import deepcopy
|
||||||
|
from datetime import datetime
|
||||||
|
from dateutil.parser import parse
|
||||||
|
from typing import Dict, List, Union
|
||||||
|
|
||||||
|
|
||||||
def object_format_datetime(obj):
|
def object_format_datetime(obj):
|
||||||
@@ -8,7 +11,7 @@ def object_format_datetime(obj):
|
|||||||
"""
|
"""
|
||||||
for attr in dir(obj):
|
for attr in dir(obj):
|
||||||
value = getattr(obj, attr)
|
value = getattr(obj, attr)
|
||||||
if isinstance(value, datetime.datetime):
|
if isinstance(value, datetime):
|
||||||
setattr(obj, attr, value.strftime('%Y-%m-%d %H:%M:%S'))
|
setattr(obj, attr, value.strftime('%Y-%m-%d %H:%M:%S'))
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
@@ -21,7 +24,7 @@ def list_format_datetime(lst):
|
|||||||
for obj in lst:
|
for obj in lst:
|
||||||
for attr in dir(obj):
|
for attr in dir(obj):
|
||||||
value = getattr(obj, attr)
|
value = getattr(obj, attr)
|
||||||
if isinstance(value, datetime.datetime):
|
if isinstance(value, datetime):
|
||||||
setattr(obj, attr, value.strftime('%Y-%m-%d %H:%M:%S'))
|
setattr(obj, attr, value.strftime('%Y-%m-%d %H:%M:%S'))
|
||||||
return lst
|
return lst
|
||||||
|
|
||||||
@@ -41,7 +44,7 @@ def format_datetime_dict_list(dicts):
|
|||||||
if isinstance(v, dict):
|
if isinstance(v, dict):
|
||||||
# 递归遍历子字典
|
# 递归遍历子字典
|
||||||
new_item[k] = format_datetime_dict_list([v])[0]
|
new_item[k] = format_datetime_dict_list([v])[0]
|
||||||
elif isinstance(v, datetime.datetime):
|
elif isinstance(v, datetime):
|
||||||
# 如果值是 datetime 类型,则格式化为字符串
|
# 如果值是 datetime 类型,则格式化为字符串
|
||||||
new_item[k] = v.strftime('%Y-%m-%d %H:%M:%S')
|
new_item[k] = v.strftime('%Y-%m-%d %H:%M:%S')
|
||||||
else:
|
else:
|
||||||
@@ -50,3 +53,89 @@ def format_datetime_dict_list(dicts):
|
|||||||
result.append(new_item)
|
result.append(new_item)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
class TimeFormatUtil:
|
||||||
|
"""
|
||||||
|
时间格式化工具类
|
||||||
|
"""
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def format_time(cls, time_info: Union[str, datetime], format: str = '%Y-%m-%d %H:%M:%S'):
|
||||||
|
"""
|
||||||
|
格式化时间字符串或datetime对象为指定格式
|
||||||
|
|
||||||
|
:param time_info: 时间字符串或datetime对象
|
||||||
|
:param format: 格式化格式,默认为'%Y-%m-%d %H:%M:%S'
|
||||||
|
:return: 格式化后的时间字符串
|
||||||
|
"""
|
||||||
|
if isinstance(time_info, datetime):
|
||||||
|
format_date = time_info.strftime(format)
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
date = parse(time_info)
|
||||||
|
format_date = date.strftime(format)
|
||||||
|
except Exception:
|
||||||
|
format_date = time_info
|
||||||
|
|
||||||
|
return format_date
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def parse_date(cls, time_str: str):
|
||||||
|
"""
|
||||||
|
解析时间字符串提取日期部分
|
||||||
|
|
||||||
|
:param time_str: 时间字符串
|
||||||
|
:return: 日期部分
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
dt = parse(time_str)
|
||||||
|
return dt.date()
|
||||||
|
except Exception:
|
||||||
|
return time_str
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def format_time_dict(cls, time_dict: Dict, format: str = '%Y-%m-%d %H:%M:%S'):
|
||||||
|
"""
|
||||||
|
格式化时间字典
|
||||||
|
|
||||||
|
:param time_dict: 时间字典
|
||||||
|
:param format: 格式化格式,默认为'%Y-%m-%d %H:%M:%S'
|
||||||
|
:return: 格式化后的时间字典
|
||||||
|
"""
|
||||||
|
copy_time_dict = deepcopy(time_dict)
|
||||||
|
for k, v in copy_time_dict.items():
|
||||||
|
if isinstance(v, (str, datetime)):
|
||||||
|
copy_time_dict[k] = cls.format_time(v, format)
|
||||||
|
elif isinstance(v, dict):
|
||||||
|
copy_time_dict[k] = cls.format_time_dict(v, format)
|
||||||
|
elif isinstance(v, list):
|
||||||
|
copy_time_dict[k] = cls.format_time_list(v, format)
|
||||||
|
else:
|
||||||
|
copy_time_dict[k] = v
|
||||||
|
|
||||||
|
return copy_time_dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def format_time_list(cls, time_list: List, format: str = '%Y-%m-%d %H:%M:%S'):
|
||||||
|
"""
|
||||||
|
格式化时间列表
|
||||||
|
|
||||||
|
:param time_list: 时间列表
|
||||||
|
:param format: 格式化格式,默认为'%Y-%m-%d %H:%M:%S'
|
||||||
|
:return: 格式化后的时间列表
|
||||||
|
"""
|
||||||
|
format_time_list = []
|
||||||
|
for item in time_list:
|
||||||
|
if isinstance(item, (str, datetime)):
|
||||||
|
format_item = cls.format_time(item, format)
|
||||||
|
elif isinstance(item, dict):
|
||||||
|
format_item = cls.format_time_dict(item, format)
|
||||||
|
elif isinstance(item, list):
|
||||||
|
format_item = cls.format_time_list(item, format)
|
||||||
|
else:
|
||||||
|
format_item = item
|
||||||
|
|
||||||
|
format_time_list.append(format_item)
|
||||||
|
|
||||||
|
return format_time_list
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "vfadmin",
|
"name": "vfadmin",
|
||||||
"version": "1.6.1",
|
"version": "1.6.2",
|
||||||
"description": "vfadmin管理系统",
|
"description": "vfadmin管理系统",
|
||||||
"author": "insistence",
|
"author": "insistence",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@@ -131,10 +131,6 @@ aside {
|
|||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pagination-container {
|
|
||||||
margin-top: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-center {
|
.text-center {
|
||||||
text-align: center
|
text-align: center
|
||||||
}
|
}
|
||||||
|
@@ -102,21 +102,12 @@
|
|||||||
|
|
||||||
/** 表格布局 **/
|
/** 表格布局 **/
|
||||||
.pagination-container {
|
.pagination-container {
|
||||||
position: relative;
|
display: flex;
|
||||||
height: 25px;
|
justify-content: flex-end;
|
||||||
margin-bottom: 10px;
|
margin-top: 20px;
|
||||||
margin-top: 15px;
|
|
||||||
padding: 10px 20px !important;
|
|
||||||
background-color: transparent !important;
|
background-color: transparent !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 分页器定位 */
|
|
||||||
.pagination-container .el-pagination {
|
|
||||||
position: absolute;
|
|
||||||
right: 0;
|
|
||||||
top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 弹窗中的分页器 */
|
/* 弹窗中的分页器 */
|
||||||
.el-dialog .pagination-container {
|
.el-dialog .pagination-container {
|
||||||
position: static !important;
|
position: static !important;
|
||||||
|
@@ -13,12 +13,13 @@
|
|||||||
:headers="headers"
|
:headers="headers"
|
||||||
class="upload-file-uploader"
|
class="upload-file-uploader"
|
||||||
ref="fileUpload"
|
ref="fileUpload"
|
||||||
|
v-if="!disabled"
|
||||||
>
|
>
|
||||||
<!-- 上传按钮 -->
|
<!-- 上传按钮 -->
|
||||||
<el-button type="primary">选取文件</el-button>
|
<el-button type="primary">选取文件</el-button>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
<!-- 上传提示 -->
|
<!-- 上传提示 -->
|
||||||
<div class="el-upload__tip" v-if="showTip">
|
<div class="el-upload__tip" v-if="showTip && !disabled">
|
||||||
请上传
|
请上传
|
||||||
<template v-if="fileSize"> 大小不超过 <b style="color: #f56c6c">{{ fileSize }}MB</b> </template>
|
<template v-if="fileSize"> 大小不超过 <b style="color: #f56c6c">{{ fileSize }}MB</b> </template>
|
||||||
<template v-if="fileType"> 格式为 <b style="color: #f56c6c">{{ fileType.join("/") }}</b> </template>
|
<template v-if="fileType"> 格式为 <b style="color: #f56c6c">{{ fileType.join("/") }}</b> </template>
|
||||||
@@ -31,7 +32,7 @@
|
|||||||
<span class="el-icon-document"> {{ getFileName(file.name) }} </span>
|
<span class="el-icon-document"> {{ getFileName(file.name) }} </span>
|
||||||
</el-link>
|
</el-link>
|
||||||
<div class="ele-upload-list__item-content-action">
|
<div class="ele-upload-list__item-content-action">
|
||||||
<el-link :underline="false" @click="handleDelete(index)" type="danger">删除</el-link>
|
<el-link :underline="false" @click="handleDelete(index)" type="danger" v-if="!disabled">删除</el-link>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</transition-group>
|
</transition-group>
|
||||||
@@ -46,22 +47,27 @@ const props = defineProps({
|
|||||||
// 数量限制
|
// 数量限制
|
||||||
limit: {
|
limit: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 5,
|
default: 5
|
||||||
},
|
},
|
||||||
// 大小限制(MB)
|
// 大小限制(MB)
|
||||||
fileSize: {
|
fileSize: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 5,
|
default: 5
|
||||||
},
|
},
|
||||||
// 文件类型, 例如['png', 'jpg', 'jpeg']
|
// 文件类型, 例如['png', 'jpg', 'jpeg']
|
||||||
fileType: {
|
fileType: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => ["doc", "xls", "ppt", "txt", "pdf"],
|
default: () => ["doc", "docx", "xls", "xlsx", "ppt", "pptx", "txt", "pdf"]
|
||||||
},
|
},
|
||||||
// 是否显示提示
|
// 是否显示提示
|
||||||
isShowTip: {
|
isShowTip: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
|
},
|
||||||
|
// 禁用组件(仅查看文件)
|
||||||
|
disabled: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -97,7 +97,6 @@ function handleCurrentChange(val) {
|
|||||||
<style scoped>
|
<style scoped>
|
||||||
.pagination-container {
|
.pagination-container {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
padding: 32px 16px;
|
|
||||||
}
|
}
|
||||||
.pagination-container.hidden {
|
.pagination-container.hidden {
|
||||||
display: none;
|
display: none;
|
||||||
|
Reference in New Issue
Block a user