| | |
| | | #else |
| | | #set($comment=$column.columnComment) |
| | | #end |
| | | #if($column.htmlType == "input") |
| | | #if($column.htmlType == "input" || $column.htmlType == "textarea") |
| | | <el-form-item label="${comment}" prop="${column.javaField}"> |
| | | <el-input |
| | | v-model="queryParams.${column.javaField}" |
| | |
| | | <el-form-item label="${comment}" prop="${column.javaField}"> |
| | | <el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small"> |
| | | <el-option |
| | | v-for="dict in ${column.javaField}Options" |
| | | :key="dict.dictValue" |
| | | :label="dict.dictLabel" |
| | | :value="dict.dictValue" |
| | | v-for="dict in dict.type.${dictType}" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | plain |
| | | icon="el-icon-download" |
| | | size="mini" |
| | | :loading="exportLoading" |
| | | @click="handleExport" |
| | | v-hasPermi="['${moduleName}:${businessName}:export']" |
| | | >导出</el-button> |
| | |
| | | <span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | #elseif($column.list && $column.htmlType == "imageUpload") |
| | | <el-table-column label="${comment}" align="center" prop="${javaField}" width="100"> |
| | | <template slot-scope="scope"> |
| | | <image-preview :src="scope.row.${javaField}" :width="50" :height="50"/> |
| | | </template> |
| | | </el-table-column> |
| | | #elseif($column.list && $column.dictType && "" != $column.dictType) |
| | | <el-table-column label="${comment}" align="center" prop="${javaField}" :formatter="${javaField}Format" /> |
| | | <el-table-column label="${comment}" align="center" prop="${javaField}"> |
| | | <template slot-scope="scope"> |
| | | #if($column.htmlType == "checkbox") |
| | | <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/> |
| | | #else |
| | | <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField}"/> |
| | | #end |
| | | </template> |
| | | </el-table-column> |
| | | #elseif($column.list && "" != $javaField) |
| | | <el-table-column label="${comment}" align="center" prop="${javaField}" /> |
| | | #end |
| | |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "imageUpload") |
| | | <el-form-item label="${comment}"> |
| | | <imageUpload v-model="form.${field}"/> |
| | | <image-upload v-model="form.${field}"/> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "fileUpload") |
| | | <el-form-item label="${comment}"> |
| | | <fileUpload v-model="form.${field}"/> |
| | | <file-upload v-model="form.${field}"/> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "editor") |
| | | <el-form-item label="${comment}"> |
| | |
| | | <el-form-item label="${comment}" prop="${field}"> |
| | | <el-select v-model="form.${field}" placeholder="请选择${comment}"> |
| | | <el-option |
| | | v-for="dict in ${field}Options" |
| | | :key="dict.dictValue" |
| | | :label="dict.dictLabel" |
| | | #if($column.javaType == "Integer" || $column.javaType == "Long"):value="parseInt(dict.dictValue)"#else:value="dict.dictValue"#end |
| | | v-for="dict in dict.type.${dictType}" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | #if($column.javaType == "Integer" || $column.javaType == "Long"):value="parseInt(dict.value)"#else:value="dict.value"#end |
| | | |
| | | ></el-option> |
| | | </el-select> |
| | |
| | | <el-form-item label="${comment}"> |
| | | <el-checkbox-group v-model="form.${field}"> |
| | | <el-checkbox |
| | | v-for="dict in ${field}Options" |
| | | :key="dict.dictValue" |
| | | :label="dict.dictValue"> |
| | | {{dict.dictLabel}} |
| | | v-for="dict in dict.type.${dictType}" |
| | | :key="dict.value" |
| | | :label="dict.value"> |
| | | {{dict.label}} |
| | | </el-checkbox> |
| | | </el-checkbox-group> |
| | | </el-form-item> |
| | |
| | | <el-form-item label="${comment}"> |
| | | <el-radio-group v-model="form.${field}"> |
| | | <el-radio |
| | | v-for="dict in ${field}Options" |
| | | :key="dict.dictValue" |
| | | #if($column.javaType == "Integer" || $column.javaType == "Long"):label="parseInt(dict.dictValue)"#else:label="dict.dictValue"#end |
| | | v-for="dict in dict.type.${dictType}" |
| | | :key="dict.value" |
| | | #if($column.javaType == "Integer" || $column.javaType == "Long"):label="parseInt(dict.value)"#else:label="dict.value"#end |
| | | |
| | | >{{dict.dictLabel}}</el-radio> |
| | | >{{dict.label}}</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | #elseif($column.htmlType == "radio" && $dictType) |
| | |
| | | |
| | | <script> |
| | | import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"; |
| | | import { downLoadExcel } from "@/utils/download"; |
| | | |
| | | export default { |
| | | name: "${BusinessName}", |
| | | #if(${dicts} != '') |
| | | dicts: [${dicts}], |
| | | #end |
| | | data() { |
| | | return { |
| | | // 按钮loading |
| | | buttonLoading: false, |
| | | // 遮罩层 |
| | | loading: true, |
| | | // 导出遮罩层 |
| | | exportLoading: false, |
| | | // 选中数组 |
| | | ids: [], |
| | | #if($table.sub) |
| | |
| | | // 是否显示弹出层 |
| | | open: false, |
| | | #foreach ($column in $columns) |
| | | #set($parentheseIndex=$column.columnComment.indexOf("(")) |
| | | #if($parentheseIndex != -1) |
| | | #set($comment=$column.columnComment.substring(0, $parentheseIndex)) |
| | | #else |
| | | #set($comment=$column.columnComment) |
| | | #end |
| | | #if(${column.dictType} && ${column.dictType} != '') |
| | | // $comment字典 |
| | | ${column.javaField}Options: [], |
| | | #elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN") |
| | | #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") |
| | | #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| | | // $comment时间范围 |
| | | daterange${AttrName}: [], |
| | |
| | | pageSize: 10, |
| | | #foreach ($column in $columns) |
| | | #if($column.query) |
| | | $column.javaField: undefined#if($velocityCount != $columns.size()),#end |
| | | |
| | | $column.javaField: undefined#if($foreach.count != $columns.size()),#end |
| | | #end |
| | | #end |
| | | }, |
| | |
| | | #end |
| | | $column.javaField: [ |
| | | { required: true, message: "$comment不能为空", trigger: #if($column.htmlType == "select")"change"#else"blur"#end } |
| | | ]#if($velocityCount != $columns.size()),#end |
| | | |
| | | ]#if($foreach.count != $columns.size()),#end |
| | | #end |
| | | #end |
| | | } |
| | |
| | | }, |
| | | created() { |
| | | this.getList(); |
| | | #foreach ($column in $columns) |
| | | #if(${column.dictType} && ${column.dictType} != '') |
| | | this.getDicts("${column.dictType}").then(response => { |
| | | this.${column.javaField}Options = response.data; |
| | | }); |
| | | #end |
| | | #end |
| | | }, |
| | | methods: { |
| | | /** 查询${functionName}列表 */ |
| | |
| | | this.loading = false; |
| | | }); |
| | | }, |
| | | #foreach ($column in $columns) |
| | | #if(${column.dictType} && ${column.dictType} != '') |
| | | #set($parentheseIndex=$column.columnComment.indexOf("(")) |
| | | #if($parentheseIndex != -1) |
| | | #set($comment=$column.columnComment.substring(0, $parentheseIndex)) |
| | | #else |
| | | #set($comment=$column.columnComment) |
| | | #end |
| | | // $comment字典翻译 |
| | | ${column.javaField}Format(row, column) { |
| | | return this.selectDictLabel#if($column.htmlType == "checkbox")s#end(this.${column.javaField}Options, row.${column.javaField}); |
| | | }, |
| | | #end |
| | | #end |
| | | // 取消按钮 |
| | | cancel() { |
| | | this.open = false; |
| | |
| | | this.form = { |
| | | #foreach ($column in $columns) |
| | | #if($column.htmlType == "radio") |
| | | $column.javaField: #if($column.javaType == "Integer" || $column.javaType == "Long")0#else"0"#end#if($velocityCount != $columns.size()),#end |
| | | |
| | | $column.javaField: #if($column.javaType == "Integer" || $column.javaType == "Long")0#else"0"#end#if($foreach.count != $columns.size()),#end |
| | | #elseif($column.htmlType == "checkbox") |
| | | $column.javaField: []#if($velocityCount != $columns.size()),#end |
| | | |
| | | $column.javaField: []#if($foreach.count != $columns.size()),#end |
| | | #else |
| | | $column.javaField: undefined#if($velocityCount != $columns.size()),#end |
| | | |
| | | $column.javaField: undefined#if($foreach.count != $columns.size()),#end |
| | | #end |
| | | #end |
| | | }; |
| | |
| | | #end |
| | | if (this.form.${pkColumn.javaField} != null) { |
| | | update${BusinessName}(this.form).then(response => { |
| | | this.msgSuccess("修改成功"); |
| | | this.#[[$modal]]#.msgSuccess("修改成功"); |
| | | this.open = false; |
| | | this.getList(); |
| | | }).finally(() => { |
| | |
| | | }); |
| | | } else { |
| | | add${BusinessName}(this.form).then(response => { |
| | | this.msgSuccess("新增成功"); |
| | | this.#[[$modal]]#.msgSuccess("新增成功"); |
| | | this.open = false; |
| | | this.getList(); |
| | | }).finally(() => { |
| | |
| | | /** 删除按钮操作 */ |
| | | handleDelete(row) { |
| | | const ${pkColumn.javaField}s = row.${pkColumn.javaField} || this.ids; |
| | | this.$confirm('是否确认删除${functionName}编号为"' + ${pkColumn.javaField}s + '"的数据项?', "警告", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }).then(() => { |
| | | this.loading = true; |
| | | return del${BusinessName}(${pkColumn.javaField}s); |
| | | }).then(() => { |
| | | this.loading = false; |
| | | this.getList(); |
| | | this.msgSuccess("删除成功"); |
| | | this.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + ${pkColumn.javaField}s + '"的数据项?').then(() => { |
| | | this.loading = true; |
| | | return del${BusinessName}(${pkColumn.javaField}s); |
| | | }).then(() => { |
| | | this.loading = false; |
| | | this.getList(); |
| | | this.#[[$modal]]#.msgSuccess("删除成功"); |
| | | }).finally(() => { |
| | | this.loading = false; |
| | | this.loading = false; |
| | | }); |
| | | }, |
| | | #if($table.sub) |
| | |
| | | /** ${subTable.functionName}删除按钮操作 */ |
| | | handleDelete${subClassName}() { |
| | | if (this.checked${subClassName}.length == 0) { |
| | | this.$alert("请先选择要删除的${subTable.functionName}数据", "提示", { confirmButtonText: "确定", }); |
| | | this.#[[$modal]]#.msgError("请先选择要删除的${subTable.functionName}数据"); |
| | | } else { |
| | | this.${subclassName}List.splice(this.checked${subClassName}[0].index - 1, 1); |
| | | const ${subclassName}List = this.${subclassName}List; |
| | | const checked${subClassName} = this.checked${subClassName}; |
| | | this.${subclassName}List = ${subclassName}List.filter(function(item) { |
| | | return checked${subClassName}.indexOf(item.index) == -1 |
| | | }); |
| | | } |
| | | }, |
| | | /** 单选框选中数据 */ |
| | | /** 复选框选中数据 */ |
| | | handle${subClassName}SelectionChange(selection) { |
| | | if (selection.length > 1) { |
| | | this.$refs.${subclassName}.clearSelection(); |
| | | this.$refs.${subclassName}.toggleRowSelection(selection.pop()); |
| | | } else { |
| | | this.checked${subClassName} = selection; |
| | | } |
| | | this.checked${subClassName} = selection.map(item => item.index) |
| | | }, |
| | | #end |
| | | /** 导出按钮操作 */ |
| | | handleExport() { |
| | | downLoadExcel('/${moduleName}/${businessName}/export', this.queryParams); |
| | | this.download('${moduleName}/${businessName}/export', { |
| | | ...this.queryParams |
| | | }, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`) |
| | | } |
| | | } |
| | | }; |