模版调整
This commit is contained in:
parent
b0459a9150
commit
9b19334efe
|
|
@ -31,14 +31,8 @@
|
||||||
<el-form-item label="${column.columnComment}" prop="${column.javaField}">
|
<el-form-item label="${column.columnComment}" prop="${column.javaField}">
|
||||||
<el-input v-model="formData.name" placeholder="请输入${column.columnComment}" />
|
<el-input v-model="formData.name" placeholder="请输入${column.columnComment}" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
#elseif($column.htmlType=="number")
|
|
||||||
<el-form-item label="${column.columnComment}" prop="${column.javaField}">
|
|
||||||
<div>
|
|
||||||
<el-input-number v-model="formData.sort" />
|
|
||||||
</div>
|
|
||||||
</el-form-item>
|
|
||||||
#elseif($column.htmlType=="textarea")
|
#elseif($column.htmlType=="textarea")
|
||||||
<el-form-item label="备注" prop="remark">
|
<el-form-item label="${column.columnComment}" prop="${column.javaField}">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="formData.${column.javaField}"
|
v-model="formData.${column.javaField}"
|
||||||
placeholder="请输入${column.columnComment}"
|
placeholder="请输入${column.columnComment}"
|
||||||
|
|
@ -51,10 +45,10 @@
|
||||||
<el-checkbox-group v-model="formData.${column.javaField}" placeholder="请选择${column.columnComment}">
|
<el-checkbox-group v-model="formData.${column.javaField}" placeholder="请选择${column.columnComment}">
|
||||||
#if($column.dictType!="")
|
#if($column.dictType!="")
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
v-for="(item, index) in dictData.${column.dictType}"
|
v-for="(item, index) in dictData.${column.dictType}"
|
||||||
:key="index"
|
:key="index"
|
||||||
:label="item.value"
|
:label="item.value"
|
||||||
:disabled="!item.status"
|
:disabled="!item.status"
|
||||||
>
|
>
|
||||||
{{ item.name }}
|
{{ item.name }}
|
||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
|
|
@ -135,9 +129,10 @@
|
||||||
})
|
})
|
||||||
|
|
||||||
const formData = reactive({
|
const formData = reactive({
|
||||||
${primaryKey}: '',
|
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
#if($column.isEdit)
|
#if($column.javaField==$primaryKey)
|
||||||
|
${primaryKey}: '',
|
||||||
|
#elseif($column.isEdit)
|
||||||
#if($column.htmlType=="checkbox")
|
#if($column.htmlType=="checkbox")
|
||||||
${column.javaField}: [],
|
${column.javaField}: [],
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
|
|
@ -2,42 +2,42 @@
|
||||||
<div class="index-tree">
|
<div class="index-tree">
|
||||||
<el-card class="!border-none mb-4" shadow="never">
|
<el-card class="!border-none mb-4" shadow="never">
|
||||||
<el-form ref="formRef" class="mb-[-16px]" :model="queryParams" :inline="true">
|
<el-form ref="formRef" class="mb-[-16px]" :model="queryParams" :inline="true">
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
#if($column.isQuery==1)
|
#if($column.isQuery==1)
|
||||||
#if($column.htmlType=="datetime")
|
#if($column.htmlType=="datetime")
|
||||||
<el-form-item label="${column.columnComment}" prop="${column.javaField}">
|
<el-form-item label="${column.columnComment}" prop="${column.javaField}">
|
||||||
<data-picker
|
<data-picker
|
||||||
v-model:startTime="queryParams.startTime"
|
v-model:startTime="queryParams.startTime"
|
||||||
v-model:endTime="queryParams.endTime"
|
v-model:endTime="queryParams.endTime"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
#elseif($column.htmlType=="select")
|
#elseif($column.htmlType=="select")
|
||||||
<el-form-item label="${column.columnComment}" prop="${column.javaField}">
|
<el-form-item label="${column.columnComment}" prop="${column.javaField}">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="queryParams.${column.javaField}"
|
v-model="queryParams.${column.javaField}"
|
||||||
class="w-56"
|
class="w-56"
|
||||||
clearable
|
clearable
|
||||||
>
|
>
|
||||||
#if($column.dictType=="")
|
#if($column.dictType=="")
|
||||||
<el-option label="请选择字典生成" value="" />
|
<el-option label="请选择字典生成" value="" />
|
||||||
#else
|
#else
|
||||||
<el-option label="全部" value="" />
|
<el-option label="全部" value="" />
|
||||||
<el-option
|
<el-option
|
||||||
v-for="(item, index) in dictData.${column.dictType}"
|
v-for="(item, index) in dictData.${column.dictType}"
|
||||||
:key="index"
|
:key="index"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.value"
|
:value="item.value"
|
||||||
/>
|
/>
|
||||||
#end
|
#end
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
#elseif($column.htmlType=="input")
|
#elseif($column.htmlType=="input")
|
||||||
<el-form-item label="${column.columnComment}" prop="${column.javaField}">
|
<el-form-item label="${column.columnComment}" prop="${column.javaField}">
|
||||||
<el-input class="w-56" v-model="queryParams.${column.javaField}" />
|
<el-input class="w-56" v-model="queryParams.${column.javaField}" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
#end
|
|
||||||
#end
|
|
||||||
#end
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="getLists">查询</el-button>
|
<el-button type="primary" @click="getLists">查询</el-button>
|
||||||
<el-button @click="getLists">重置</el-button>
|
<el-button @click="getLists">重置</el-button>
|
||||||
|
|
@ -63,27 +63,27 @@
|
||||||
row-key="${table.treePrimary}"
|
row-key="${table.treePrimary}"
|
||||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
||||||
>
|
>
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
#if($column.isList)
|
#if($column.isList)
|
||||||
#if($column.htmlType=="imageUpload")
|
#if($column.htmlType=="imageUpload")
|
||||||
#if($column.htmlType=="select" || $column.htmlType=="radio" || $column.htmlType=="checkbox")
|
#if($column.htmlType=="select" || $column.htmlType=="radio" || $column.htmlType=="checkbox")
|
||||||
<el-table-column label="${column.columnComment}" prop="${column.javaField}" min-width="100">
|
<el-table-column label="${column.columnComment}" prop="${column.javaField}" min-width="100">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<dict-value :options="dictData.${column.dictType}" :value="row.${column.javaField}" />
|
<dict-value :options="dictData.${column.dictType}" :value="row.${column.javaField}" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
#elseif($column.htmlType=="imageUpload")
|
#elseif($column.htmlType=="imageUpload")
|
||||||
<el-table-column label="${column.columnComment}" prop="${column.javaField}" min-width="60">
|
<el-table-column label="${column.columnComment}" prop="${column.javaField}" min-width="60">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<image-contain width="50px" height="50px" :src="row.${column.javaField}" />
|
<image-contain width="50px" height="50px" :src="row.${column.javaField}" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
#else
|
#else
|
||||||
<el-table-column label="${column.columnComment}" prop="${column.javaField}" min-width="100" />
|
<el-table-column label="${column.columnComment}" prop="${column.javaField}" min-width="100" />
|
||||||
#end
|
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
#end
|
||||||
<el-table-column label="操作" width="160" fixed="right">
|
<el-table-column label="操作" width="160" fixed="right">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-button
|
<el-button
|
||||||
|
|
@ -114,20 +114,30 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-card>
|
</el-card>
|
||||||
<edit-popup v-if="showEdit" ref="editRef" @success="getLists" @close="showEdit = false" />
|
<edit-popup
|
||||||
|
v-if="showEdit"
|
||||||
|
ref="editRef"
|
||||||
|
#if($dictFields!="")
|
||||||
|
:dict-data="dictData"
|
||||||
|
#end
|
||||||
|
@success="getLists"
|
||||||
|
@close="showEdit = false"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ${moduleName}Edit, ${moduleName}Delete, ${moduleName}Lists } from '@/api/${moduleName}'
|
import { ${moduleName}Edit, ${moduleName}Delete, ${moduleName}Lists } from '@/api/${moduleName}'
|
||||||
import EditPopup from './edit.vue'
|
import EditPopup from './edit.vue'
|
||||||
import feedback from '@/utils/feedback'
|
import feedback from '@/utils/feedback'
|
||||||
|
import { useDictData } from '@/hooks/useDictOptions'
|
||||||
|
|
||||||
const tableRef = shallowRef<InstanceType<typeof ElTable>>()
|
const tableRef = shallowRef<InstanceType<typeof ElTable>>()
|
||||||
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
||||||
let isExpand = false
|
let isExpand = false
|
||||||
const showEdit = ref(false)
|
const showEdit = ref(false)
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const lists = ref<any[]>([])
|
const lists = ref<any[]>([])
|
||||||
|
|
||||||
const queryParams = reactive({
|
const queryParams = reactive({
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
#if($column.isQuery)
|
#if($column.isQuery)
|
||||||
|
|
@ -147,6 +157,16 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if($dictFields!="")
|
||||||
|
const { dictData } = useDictData<{
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.dictType!="")
|
||||||
|
${column.dictType}: any[]
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
}>([${dictFields}])
|
||||||
|
#end
|
||||||
|
|
||||||
const handleAdd = async (${table.treePrimary}?: number) => {
|
const handleAdd = async (${table.treePrimary}?: number) => {
|
||||||
showEdit.value = true
|
showEdit.value = true
|
||||||
await nextTick()
|
await nextTick()
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,9 @@
|
||||||
<edit-popup
|
<edit-popup
|
||||||
v-if="showEdit"
|
v-if="showEdit"
|
||||||
ref="editRef"
|
ref="editRef"
|
||||||
|
#if($dictFields!="")
|
||||||
:dict-data="dictData"
|
:dict-data="dictData"
|
||||||
|
#end
|
||||||
@success="getLists"
|
@success="getLists"
|
||||||
@close="showEdit = false"
|
@close="showEdit = false"
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue