feat:代码生成模板新增清空操作

This commit is contained in:
不做码农
2022-09-23 09:53:23 +08:00
parent c6aecf2c76
commit b8b323a090
7 changed files with 74 additions and 3 deletions

View File

@@ -84,6 +84,13 @@ $if(replaceDto.ShowBtnDelete)
</el-button>
</el-col>
$end
$if(replaceDto.ShowBtnTruncate)
<el-col :span="1.5">
<el-button type="danger" v-hasPermi="['${replaceDto.PermissionPrefix}:delete']" plain icon="delete" @click="handleClear">
清空
</el-button>
</el-col>
$end
$if(replaceDto.ShowBtnExport)
<el-col :span="1.5">
<el-button type="warning" plain icon="download" @click="handleExport" v-hasPermi="['${replaceDto.PermissionPrefix}:export']">
@@ -270,9 +277,12 @@ $end
</div>
</template>
<script setup name="${genTable.BusinessName.ToLower()}">
import { list${genTable.BusinessName}, add${genTable.BusinessName}, del${genTable.BusinessName}, update${genTable.BusinessName}, get${genTable.BusinessName},$if(replaceDto.ShowBtnExport) export${genTable.BusinessName}, $end $if(showCustomInput) changeSort $end } from '@/api/${tool.FirstLowerCase(genTable.ModuleName)}/${genTable.BusinessName.ToLower()}.js'
import { list${genTable.BusinessName}, add${genTable.BusinessName}, del${genTable.BusinessName}, update${genTable.BusinessName}, get${genTable.BusinessName},
$if(replaceDto.ShowBtnExport) export${genTable.BusinessName}, $end
$if(replaceDto.ShowBtnTruncate) clear${genTable.BusinessName}, $end
$if(showCustomInput) changeSort $end }
from '@/api/${tool.FirstLowerCase(genTable.ModuleName)}/${genTable.BusinessName.ToLower()}.js'
const { proxy } = getCurrentInstance()
// 选中${replaceDto.FistLowerPk}数组数组
@@ -542,6 +552,26 @@ function handlePreview(row) {
form.value = row
}
$end
$if(replaceDto.ShowBtnTruncate)
/**
* 清空
*/
function handleClear() {
proxy
.${confirm}confirm("是否确认清空所有数据项?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return clear${genTable.BusinessName}()
})
.then(() => {
handleQuery()
proxy.${modal}modal.msgSuccess('清空成功')
})
}
$end
// 多选框选中数据
function handleSelectionChange(selection) {
ids.value = selection.map((item) => item.${replaceDto.FistLowerPk});