update vue template

This commit is contained in:
zhangwenjian committed 2020-05-04 23:15:40 +08:00
1 parent c4daa50819
commit 9e2726cbbb
1 file changed
+46 -50
+46 -50
View File
@@ -2,12 +2,12 @@
<div class="app-container"> <div class="app-container">
<el-form ref="queryForm" :model="queryParams" :inline="true" label-width="68px"> <el-form ref="queryForm" :model="queryParams" :inline="true" label-width="68px">
{{range .Columns}} {{range .Columns}}
{{- $x := .IsQuery -}} {{- $x := .IsQuery -}}
{{- if ($x) -}} {{- if ($x) -}}
<el-form-item label="参数名称" prop="{{.JsonField}}"> <el-form-item label="{{.ColumnComment}}" prop="{{.JsonField}}">
<el-input v-model="queryParams.{{.JsonField}}" placeholder="请输入{{.ColumnComment}}" clearable size="small" @keyup.enter.native="handleQuery" /> <el-input v-model="queryParams.{{.JsonField}}" placeholder="请输入{{.ColumnComment}}" clearable size="small" @keyup.enter.native="handleQuery" />
</el-form-item> </el-form-item>
{{end}} {{end}}
{{- end }} {{- end }}
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
@@ -47,13 +47,13 @@
</el-col> </el-col>
</el-row> </el-row>
<el-table v-loading="loading" :data="configList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="{{.ModuleName}}List" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
{{- range .Columns -}} {{- range .Columns -}}
{{- $x := .IsList -}} {{- $x := .IsList -}}
{{- if ($x) -}} {{- if ($x) -}}
<el-table-column label="{{.ColumnComment}}" align="center" prop="{{.JsonField}}" :show-overflow-tooltip="true" /> <el-table-column label="{{.ColumnComment}}" align="center" prop="{{.JsonField}}" :show-overflow-tooltip="true" />
{{- end -}} {{- end -}}
{{- end }} {{- end }}
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
@@ -86,16 +86,13 @@
<!-- 添加或修改参数配置对话框 --> <!-- 添加或修改参数配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px"> <el-dialog :title="title" :visible.sync="open" width="500px">
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="参数名称" prop="configName">
<el-input v-model="form.configName" placeholder="请输入参数名称" />
</el-form-item>
{{ range .Columns }} {{ range .Columns }}
{{- $x := .IsInsert -}} {{- $x := .IsInsert -}}
{{- if ($x) -}} {{- if ($x) -}}
<el-form-item label="{{.ColumnComment}}" prop="{{.JsonField}}"> <el-form-item label="{{.ColumnComment}}" prop="{{.JsonField}}">
<el-input v-model="form.{{.JsonField}}" placeholder="{{.ColumnComment}}" /> <el-input v-model="form.{{.JsonField}}" placeholder="{{.ColumnComment}}" />
</el-form-item> </el-form-item>
{{ end }} {{ end }}
{{- end }} {{- end }}
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@@ -107,8 +104,7 @@
</template> </template>
<script> <script>
import { list{{.ClassName}}, get{{.ClassName}}, del{{.ClassName}}, add{{.ClassName}}, update{{.ClassName}} } from '@/api/system/config' import { list{{.ClassName}}, get{{.ClassName}}, del{{.ClassName}}, add{{.ClassName}}, update{{.ClassName}} } from '@/api/{{.PackageName}}'
import { formatJson } from '@/utils'
export default { export default {
name: 'Config', name: 'Config',
@@ -138,27 +134,27 @@
queryParams: { queryParams: {
pageIndex: 1, pageIndex: 1,
pageSize: 10, pageSize: 10,
{{- range .Columns -}} {{- range .Columns -}}
{{- $x := .IsQuery -}} {{- $x := .IsQuery -}}
{{- if ($x) -}} {{- if ($x) -}}
{{.JsonField}}: undefined, {{.JsonField}}: undefined,
{{- end -}} {{- end -}}
{{- end }} {{- end }}
}, },
// 表单参数 // 表单参数
form: {}, form: {},
// 表单校验 // 表单校验
rules: { rules: {
{{- range .Columns -}} {{- range .Columns -}}
{{- $x := .IsQuery -}} {{- $x := .IsQuery -}}
{{- if ($x) -}} {{- if ($x) -}}
{{.JsonField}}: [ {{.JsonField}}: [
{ required: true, message: '{{.ColumnComment}}不能为空', trigger: 'blur' } { required: true, message: '{{.ColumnComment}}不能为空', trigger: 'blur' }
], ],
{{ end }} {{ end }}
{{- end -}} {{- end -}}
}
} }
}
}, },
created() { created() {
this.getList() this.getList()
@@ -173,7 +169,7 @@
this.loading = false this.loading = false
} }
) )
} },
// 取消按钮 // 取消按钮
cancel() { cancel() {
this.open = false this.open = false
@@ -182,13 +178,13 @@
// 表单重置 // 表单重置
reset() { reset() {
this.form = { this.form = {
{{ range .Columns}} {{ range .Columns}}
{{- $x := .IsInsert -}} {{- $x := .IsInsert -}}
{{ if ($x) -}} {{ if ($x) -}}
{{.JsonField}}: undefined, {{.JsonField}}: undefined,
{{ end }} {{ end }}
{{- end -}} {{- end -}}
} }
this.resetForm('form') this.resetForm('form')
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */