|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div class="app-container">
|
|
|
|
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
|
|
|
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
|
|
|
|
|
label-width="100px">
|
|
|
|
|
#foreach($column in $columns)
|
|
|
|
|
#if($column.query)
|
|
|
|
|
#set($dictType=$column.dictType)
|
|
|
|
@ -76,7 +77,8 @@
|
|
|
|
|
size="mini"
|
|
|
|
|
@click="handleAdd"
|
|
|
|
|
v-hasPermi="['${moduleName}:${businessName}:add']"
|
|
|
|
|
>新增</el-button>
|
|
|
|
|
>新增
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button
|
|
|
|
@ -87,7 +89,8 @@
|
|
|
|
|
:disabled="single"
|
|
|
|
|
@click="handleUpdate"
|
|
|
|
|
v-hasPermi="['${moduleName}:${businessName}:edit']"
|
|
|
|
|
>修改</el-button>
|
|
|
|
|
>修改
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button
|
|
|
|
@ -98,7 +101,8 @@
|
|
|
|
|
:disabled="multiple"
|
|
|
|
|
@click="handleDelete"
|
|
|
|
|
v-hasPermi="['${moduleName}:${businessName}:remove']"
|
|
|
|
|
>删除</el-button>
|
|
|
|
|
>删除
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button
|
|
|
|
@ -108,9 +112,10 @@
|
|
|
|
|
size="mini"
|
|
|
|
|
@click="handleExport"
|
|
|
|
|
v-hasPermi="['${moduleName}:${businessName}:export']"
|
|
|
|
|
>导出</el-button>
|
|
|
|
|
>导出
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
<el-table v-loading="loading" :data="${businessName}List" @selection-change="handleSelectionChange">
|
|
|
|
@ -124,31 +129,37 @@
|
|
|
|
|
#set($comment=$column.columnComment)
|
|
|
|
|
#end
|
|
|
|
|
#if($column.pk)
|
|
|
|
|
<el-table-column label="${comment}" align="center" prop="${javaField}" />
|
|
|
|
|
<el-table-column label="${comment}" align="center" prop="${javaField}"
|
|
|
|
|
v-if="columns[${foreach.index}].visible"/>
|
|
|
|
|
#elseif($column.list && $column.htmlType == "datetime")
|
|
|
|
|
<el-table-column label="${comment}" align="center" prop="${javaField}" width="180">
|
|
|
|
|
<el-table-column label="${comment}" align="center" prop="${javaField}" width="180"
|
|
|
|
|
v-if="columns[${foreach.index}].visible">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span>
|
|
|
|
|
<span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
#elseif($column.list && $column.htmlType == "imageUpload")
|
|
|
|
|
<el-table-column label="${comment}" align="center" prop="${javaField}" width="100">
|
|
|
|
|
<el-table-column label="${comment}" align="center" prop="${javaField}" width="100"
|
|
|
|
|
v-if="columns[${foreach.index}].visible">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<image-preview :src="scope.row.${javaField}" :width="50" :height="50"/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
#elseif($column.list && "" != $column.dictType)
|
|
|
|
|
<el-table-column label="${comment}" align="center" prop="${javaField}">
|
|
|
|
|
<el-table-column label="${comment}" align="center" prop="${javaField}"
|
|
|
|
|
v-if="columns[${foreach.index}].visible">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
#if($column.htmlType == "checkbox")
|
|
|
|
|
<dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/>
|
|
|
|
|
<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}" />
|
|
|
|
|
<el-table-column label="${comment}" align="center" prop="${javaField}"
|
|
|
|
|
v-if="columns[${foreach.index}].visible"/>
|
|
|
|
|
#end
|
|
|
|
|
#end
|
|
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
|
@ -159,14 +170,16 @@
|
|
|
|
|
icon="el-icon-edit"
|
|
|
|
|
@click="handleUpdate(scope.row)"
|
|
|
|
|
v-hasPermi="['${moduleName}:${businessName}:edit']"
|
|
|
|
|
>修改</el-button>
|
|
|
|
|
>修改
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button
|
|
|
|
|
size="mini"
|
|
|
|
|
type="text"
|
|
|
|
|
icon="el-icon-delete"
|
|
|
|
|
@click="handleDelete(scope.row)"
|
|
|
|
|
v-hasPermi="['${moduleName}:${businessName}:remove']"
|
|
|
|
|
>删除</el-button>
|
|
|
|
|
>删除
|
|
|
|
|
</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
@ -181,7 +194,7 @@
|
|
|
|
|
|
|
|
|
|
<!-- 添加或修改${functionName}对话框 -->
|
|
|
|
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
|
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
|
|
|
|
#foreach($column in $columns)
|
|
|
|
|
#set($field=$column.javaField)
|
|
|
|
|
#if($column.insert && !$column.pk)
|
|
|
|
@ -258,7 +271,8 @@
|
|
|
|
|
#else
|
|
|
|
|
:label="dict.value"
|
|
|
|
|
#end
|
|
|
|
|
>{{dict.label}}</el-radio>
|
|
|
|
|
>{{dict.label}}
|
|
|
|
|
</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
#elseif($column.htmlType == "radio" && $dictType)
|
|
|
|
@ -288,13 +302,18 @@
|
|
|
|
|
<el-divider content-position="center">${subTable.functionName}信息</el-divider>
|
|
|
|
|
<el-row :gutter="10" class="mb8">
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd${subClassName}">添加</el-button>
|
|
|
|
|
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd${subClassName}">
|
|
|
|
|
添加
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDelete${subClassName}">删除</el-button>
|
|
|
|
|
<el-button type="danger" icon="el-icon-delete" size="mini"
|
|
|
|
|
@click="handleDelete${subClassName}">删除
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-table :data="${subclassName}List" :row-class-name="row${subClassName}Index" @selection-change="handle${subClassName}SelectionChange" ref="${subclassName}">
|
|
|
|
|
<el-table :data="${subclassName}List" :row-class-name="row${subClassName}Index"
|
|
|
|
|
@selection-change="handle${subClassName}SelectionChange" ref="${subclassName}">
|
|
|
|
|
<el-table-column type="selection" width="50" align="center"/>
|
|
|
|
|
<el-table-column label="序号" align="center" prop="index" width="50"/>
|
|
|
|
|
#foreach($column in $subTable.columns)
|
|
|
|
@ -315,10 +334,12 @@
|
|
|
|
|
#elseif($column.list && $column.htmlType == "datetime")
|
|
|
|
|
<el-table-column label="$comment" prop="${javaField}" width="240">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-date-picker clearable v-model="scope.row.$javaField" type="date" value-format="yyyy-MM-dd" placeholder="请选择$comment" />
|
|
|
|
|
<el-date-picker clearable v-model="scope.row.$javaField" type="date"
|
|
|
|
|
value-format="yyyy-MM-dd" placeholder="请选择$comment"/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
#elseif($column.list && ($column.htmlType == "select" || $column.htmlType == "radio") && "" != $column.dictType)
|
|
|
|
|
#elseif($column.list && ($column.htmlType == "select" || $column.htmlType == "radio") &&
|
|
|
|
|
"" != $column.dictType)
|
|
|
|
|
<el-table-column label="$comment" prop="${javaField}" width="150">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-select v-model="scope.row.$javaField" placeholder="请选择$comment">
|
|
|
|
@ -331,7 +352,8 @@
|
|
|
|
|
</el-select>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
#elseif($column.list && ($column.htmlType == "select" || $column.htmlType == "radio") && "" == $column.dictType)
|
|
|
|
|
#elseif($column.list && ($column.htmlType == "select" || $column.htmlType == "radio") &&
|
|
|
|
|
"" == $column.dictType)
|
|
|
|
|
<el-table-column label="$comment" prop="${javaField}" width="150">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-select v-model="scope.row.$javaField" placeholder="请选择$comment">
|
|
|
|
@ -353,7 +375,13 @@
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}";
|
|
|
|
|
import {
|
|
|
|
|
list${BusinessName},
|
|
|
|
|
get${BusinessName},
|
|
|
|
|
del${BusinessName},
|
|
|
|
|
add${BusinessName},
|
|
|
|
|
update${BusinessName}
|
|
|
|
|
} from "@/api/${moduleName}/${businessName}";
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: "${BusinessName}",
|
|
|
|
@ -418,11 +446,24 @@ export default {
|
|
|
|
|
#set($comment=$column.columnComment)
|
|
|
|
|
#end
|
|
|
|
|
$column.javaField: [
|
|
|
|
|
{ required: true, message: "$comment不能为空", trigger: #if($column.htmlType == "select" || $column.htmlType == "radio")"change"#else"blur"#end }
|
|
|
|
|
{
|
|
|
|
|
required: true, message: "$comment不能为空", trigger: #if($column.htmlType ==
|
|
|
|
|
"select" || $column.htmlType == "radio")"change"#else"blur"#end }
|
|
|
|
|
]#if($foreach.count != $columns.size()),#end
|
|
|
|
|
#end
|
|
|
|
|
#end
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
columns: [
|
|
|
|
|
#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
|
|
|
|
|
{key: ${foreach.index}, label: `${comment}`, visible: true},
|
|
|
|
|
#end
|
|
|
|
|
]
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
@ -522,25 +563,65 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
/** 提交按钮 */
|
|
|
|
|
submitForm() {
|
|
|
|
|
this.#[[$]]#refs["form"].validate(valid => {
|
|
|
|
|
this.
|
|
|
|
|
#
|
|
|
|
|
[[$]]
|
|
|
|
|
#refs["form"].validate(valid => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
#foreach($column in $columns)
|
|
|
|
|
#if($column.htmlType == "checkbox")
|
|
|
|
|
this.form.$column.javaField = this.form.${column.javaField}.join(",");
|
|
|
|
|
this.form.$column.javaField = this.form.$
|
|
|
|
|
{
|
|
|
|
|
column.javaField
|
|
|
|
|
}
|
|
|
|
|
.
|
|
|
|
|
join(",");
|
|
|
|
|
#end
|
|
|
|
|
#end
|
|
|
|
|
#if($table.sub)
|
|
|
|
|
this.form.${subclassName}List = this.${subclassName}List;
|
|
|
|
|
this.form.$
|
|
|
|
|
{
|
|
|
|
|
subclassName
|
|
|
|
|
}
|
|
|
|
|
List = this.$
|
|
|
|
|
{
|
|
|
|
|
subclassName
|
|
|
|
|
}
|
|
|
|
|
List;
|
|
|
|
|
#end
|
|
|
|
|
if (this.form.${pkColumn.javaField} != null) {
|
|
|
|
|
update${BusinessName}(this.form).then(response => {
|
|
|
|
|
this.#[[$modal]]#.msgSuccess("修改成功");
|
|
|
|
|
if (this.form.${
|
|
|
|
|
pkColumn.javaField
|
|
|
|
|
}
|
|
|
|
|
!=
|
|
|
|
|
null
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
update$
|
|
|
|
|
{
|
|
|
|
|
BusinessName
|
|
|
|
|
}
|
|
|
|
|
(this.form).then(response => {
|
|
|
|
|
this.
|
|
|
|
|
#
|
|
|
|
|
[[$modal]]
|
|
|
|
|
#.
|
|
|
|
|
msgSuccess("修改成功");
|
|
|
|
|
this.open = false;
|
|
|
|
|
this.getList();
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
add${BusinessName}(this.form).then(response => {
|
|
|
|
|
this.#[[$modal]]#.msgSuccess("新增成功");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
add$
|
|
|
|
|
{
|
|
|
|
|
BusinessName
|
|
|
|
|
}
|
|
|
|
|
(this.form).then(response => {
|
|
|
|
|
this.
|
|
|
|
|
#
|
|
|
|
|
[[$modal]]
|
|
|
|
|
#.
|
|
|
|
|
msgSuccess("新增成功");
|
|
|
|
|
this.open = false;
|
|
|
|
|
this.getList();
|
|
|
|
|
});
|
|
|
|
@ -550,21 +631,51 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
/** 删除按钮操作 */
|
|
|
|
|
handleDelete(row) {
|
|
|
|
|
const ${pkColumn.javaField}s = row.${pkColumn.javaField} || this.ids;
|
|
|
|
|
this.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + ${pkColumn.javaField}s + '"的数据项?').then(function() {
|
|
|
|
|
return del${BusinessName}(${pkColumn.javaField}s);
|
|
|
|
|
const ${pkColumn.javaField}s = row.$
|
|
|
|
|
{
|
|
|
|
|
pkColumn.javaField
|
|
|
|
|
}
|
|
|
|
|
||
|
|
|
|
|
this.ids;
|
|
|
|
|
this.
|
|
|
|
|
#
|
|
|
|
|
[[$modal]]
|
|
|
|
|
#.
|
|
|
|
|
confirm('是否确认删除${functionName}编号为"' + ${pkColumn.javaField}s + '"的数据项?').then(function () {
|
|
|
|
|
return del$
|
|
|
|
|
{
|
|
|
|
|
BusinessName
|
|
|
|
|
}
|
|
|
|
|
(${pkColumn.javaField}s);
|
|
|
|
|
}).then(() => {
|
|
|
|
|
this.getList();
|
|
|
|
|
this.#[[$modal]]#.msgSuccess("删除成功");
|
|
|
|
|
}).catch(() => {});
|
|
|
|
|
this.
|
|
|
|
|
#
|
|
|
|
|
[[$modal]]
|
|
|
|
|
#.
|
|
|
|
|
msgSuccess("删除成功");
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
#if($table.sub)
|
|
|
|
|
#if($table.sub
|
|
|
|
|
)
|
|
|
|
|
/** ${subTable.functionName}序号 */
|
|
|
|
|
row${subClassName}Index({ row, rowIndex }) {
|
|
|
|
|
row$
|
|
|
|
|
{
|
|
|
|
|
subClassName
|
|
|
|
|
}
|
|
|
|
|
Index({row, rowIndex})
|
|
|
|
|
{
|
|
|
|
|
row.index = rowIndex + 1;
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
,
|
|
|
|
|
/** ${subTable.functionName}添加按钮操作 */
|
|
|
|
|
handleAdd${subClassName}() {
|
|
|
|
|
handleAdd$
|
|
|
|
|
{
|
|
|
|
|
subClassName
|
|
|
|
|
}
|
|
|
|
|
()
|
|
|
|
|
{
|
|
|
|
|
let obj = {};
|
|
|
|
|
#foreach($column in $subTable.columns)
|
|
|
|
|
#if($column.pk || $column.javaField == ${subTableFkclassName})
|
|
|
|
@ -572,31 +683,87 @@ export default {
|
|
|
|
|
obj.$column.javaField = "";
|
|
|
|
|
#end
|
|
|
|
|
#end
|
|
|
|
|
this.${subclassName}List.push(obj);
|
|
|
|
|
},
|
|
|
|
|
this.$
|
|
|
|
|
{
|
|
|
|
|
subclassName
|
|
|
|
|
}
|
|
|
|
|
List.push(obj);
|
|
|
|
|
}
|
|
|
|
|
,
|
|
|
|
|
/** ${subTable.functionName}删除按钮操作 */
|
|
|
|
|
handleDelete${subClassName}() {
|
|
|
|
|
if (this.checked${subClassName}.length == 0) {
|
|
|
|
|
this.#[[$modal]]#.msgError("请先选择要删除的${subTable.functionName}数据");
|
|
|
|
|
} else {
|
|
|
|
|
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
|
|
|
|
|
handleDelete$
|
|
|
|
|
{
|
|
|
|
|
subClassName
|
|
|
|
|
}
|
|
|
|
|
()
|
|
|
|
|
{
|
|
|
|
|
if (this.checked${
|
|
|
|
|
subClassName
|
|
|
|
|
}
|
|
|
|
|
.
|
|
|
|
|
length == 0
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
this.
|
|
|
|
|
#
|
|
|
|
|
[[$modal]]
|
|
|
|
|
#.
|
|
|
|
|
msgError("请先选择要删除的${subTable.functionName}数据");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
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) {
|
|
|
|
|
this.checked${subClassName} = selection.map(item => item.index)
|
|
|
|
|
},
|
|
|
|
|
handle$
|
|
|
|
|
{
|
|
|
|
|
subClassName
|
|
|
|
|
}
|
|
|
|
|
SelectionChange(selection)
|
|
|
|
|
{
|
|
|
|
|
this.checked$
|
|
|
|
|
{
|
|
|
|
|
subClassName
|
|
|
|
|
}
|
|
|
|
|
= selection.map(item => item.index)
|
|
|
|
|
}
|
|
|
|
|
,
|
|
|
|
|
#end
|
|
|
|
|
/** 导出按钮操作 */
|
|
|
|
|
handleExport() {
|
|
|
|
|
handleExport()
|
|
|
|
|
{
|
|
|
|
|
this.download('${moduleName}/${businessName}/export', {
|
|
|
|
|
...this.queryParams
|
|
|
|
|
}, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
</script>
|