chore: 优化代码生成模板
This commit is contained in:
parent
1bb3e53656
commit
74529144aa
10
docs/template/modules/soy.operate-drawer.vue.vm
vendored
10
docs/template/modules/soy.operate-drawer.vue.vm
vendored
@ -92,14 +92,14 @@ async function handleSubmit() {
|
||||
|
||||
// request
|
||||
if (props.operateType === 'add') {
|
||||
const { #foreach($column in $columns)#if($column.insert)$column.javaType#if($foreach.hasNext), #end#end#end } = model;
|
||||
const { error } = await fetchCreate${BusinessName}({ #foreach($column in $columns)#if($column.insert)$column.javaType#if($foreach.hasNext), #end#end#end });
|
||||
const { #foreach($column in $columns)#if($column.insert)$column.javaField#if($foreach.hasNext), #end#end#end } = model;
|
||||
const { error } = await fetchCreate${BusinessName}({ #foreach($column in $columns)#if($column.insert)$column.javaField#if($foreach.hasNext), #end#end#end });
|
||||
if (error) return;
|
||||
}
|
||||
|
||||
if (props.operateType === 'edit') {
|
||||
const { #foreach($column in $columns)#if($column.edit)$column.javaType#if($foreach.hasNext), #end#end#end } = model;
|
||||
const { error } = await fetchUpdate${BusinessName}({ #foreach($column in $columns)#if($column.edit)$column.javaType#if($foreach.hasNext), #end#end#end });
|
||||
const { #foreach($column in $columns)#if($column.edit)$column.javaField#if($foreach.hasNext), #end#end#end } = model;
|
||||
const { error } = await fetchUpdate${BusinessName}({ #foreach($column in $columns)#if($column.edit)$column.javaField#if($foreach.hasNext), #end#end#end });
|
||||
if (error) return;
|
||||
}
|
||||
|
||||
@ -136,7 +136,7 @@ watch(visible, () => {
|
||||
v-model:value="model.$column.javaField"
|
||||
:rows="3"
|
||||
type="textarea"
|
||||
:placeholder="请输入$column.columnComment"
|
||||
placeholder="请输入$column.columnComment"
|
||||
/>
|
||||
#elseif($column.htmlType == "select" && "" != $dictType)
|
||||
<NSelect
|
||||
|
12
docs/template/modules/soy.search.vue.vm
vendored
12
docs/template/modules/soy.search.vue.vm
vendored
@ -21,8 +21,7 @@ const { formRef, validate, restoreValidation } = useNaiveForm();
|
||||
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||
const dateRange${AttrName} = ref<[string, string]>();
|
||||
#end
|
||||
#end
|
||||
#end#end
|
||||
|
||||
const model = defineModel<Api.$ModuleName.${BusinessName}SearchParams>('model', { required: true });
|
||||
|
||||
@ -30,6 +29,7 @@ const model = defineModel<Api.$ModuleName.${BusinessName}SearchParams>('model',
|
||||
#foreach($dict in $dictList)
|
||||
const { options: ${dict.name}Options } = useDict(${dict.type}#if($dict.immediate), false#end);
|
||||
#end#end
|
||||
|
||||
async function reset() {
|
||||
#foreach ($column in $columns)
|
||||
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||
@ -60,7 +60,7 @@ async function search() {
|
||||
<NCard :bordered="false" size="small" class="card-wrapper">
|
||||
<NCollapse>
|
||||
<NCollapseItem :title="$t('common.search')" name="user-search">
|
||||
<NForm ref="formRef" :model="model" :rules="rules" label-placement="left" :label-width="80">
|
||||
<NForm ref="formRef" :model="model" label-placement="left" :label-width="80">
|
||||
<NGrid responsive="screen" item-responsive>
|
||||
#foreach($column in $columns)
|
||||
#if($column.query)
|
||||
@ -129,8 +129,10 @@ async function search() {
|
||||
</NButton>
|
||||
</NSpace>
|
||||
</NFormItemGi>
|
||||
</NGrid>
|
||||
</NForm>
|
||||
</NGrid>
|
||||
</NForm>
|
||||
</NCollapseItem>
|
||||
</NCollapse>
|
||||
</NCard>
|
||||
</template>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user