优化移动端代码生成

This commit is contained in:
不做码农 2023-07-05 07:49:53 +08:00
parent 7ac3a7b647
commit 861cfded06
2 changed files with 21 additions and 17 deletions

View File

@ -73,7 +73,7 @@ $end
<view class="btn-item"> <view class="btn-item">
<u-button text="取消" shape="circle" icon="close" type="info" @click="handleCancel"></u-button> <u-button text="取消" shape="circle" icon="close" type="info" @click="handleCancel"></u-button>
</view> </view>
<view class="btn-item"> <view class="btn-item" v-if="opertype != 3">
<u-button text="确定" shape="circle" icon="checkmark" type="primary" @click="submit"></u-button> <u-button text="确定" shape="circle" icon="checkmark" type="primary" @click="submit"></u-button>
</view> </view>
</view> </view>
@ -92,7 +92,7 @@ $if(replaceDto.ShowBtnEdit)
$end $end
} }
from '@/api/${tool.FirstLowerCase(genTable.ModuleName)}/${genTable.BusinessName.ToLower()}.js' from '@/api/${tool.FirstLowerCase(genTable.ModuleName)}/${genTable.BusinessName.ToLower()}.js'
export default { export default {
dicts: [ dicts: [
$foreach(item in genTable.Columns) $foreach(item in genTable.Columns)

View File

@ -37,6 +37,12 @@ $end
$end $end
$end $end
<view class="info-btn-wrap justify-end"> <view class="info-btn-wrap justify-end">
$if(replaceDto.ShowBtnView)
<view class="tag-item">
<u-tag text="详情" plain shape="circle" type="info" icon="eye" @click="handleView(item)"
v-if="checkPermi(['${replaceDto.PermissionPrefix}:query'])"></u-tag>
</view>
$end
$if(replaceDto.ShowBtnEdit) $if(replaceDto.ShowBtnEdit)
<view class="tag-item"> <view class="tag-item">
<u-tag text="编辑" plain shape="circle" icon="edit-pen" @click="handleEdit(item)" <u-tag text="编辑" plain shape="circle" icon="edit-pen" @click="handleEdit(item)"
@ -128,25 +134,12 @@ $end
import "@/static/scss/page.scss"; import "@/static/scss/page.scss";
import { import {
list${genTable.BusinessName}, list${genTable.BusinessName},
get${genTable.BusinessName},
$if(replaceDto.ShowBtnAdd)
add${genTable.BusinessName},
$end
$if(replaceDto.ShowBtnDelete || replaceDto.ShowBtnMultiDel) $if(replaceDto.ShowBtnDelete || replaceDto.ShowBtnMultiDel)
del${genTable.BusinessName}, del${genTable.BusinessName},
$end
$if(replaceDto.ShowBtnEdit)
update${genTable.BusinessName},
$end $end
$if(replaceDto.ShowBtnTruncate)
clear${genTable.BusinessName},
$end
$if(showCustomInput)
changeSort
$end
} }
from '@/api/${tool.FirstLowerCase(genTable.ModuleName)}/${genTable.BusinessName.ToLower()}.js' from '@/api/${tool.FirstLowerCase(genTable.ModuleName)}/${genTable.BusinessName.ToLower()}.js'
import { import {
getDate getDate
} from '@/utils/common.js' } from '@/utils/common.js'
@ -216,12 +209,22 @@ $end
} }
}) })
}, },
$if(replaceDto.ShowBtnAdd)
handleAdd() { handleAdd() {
this.${tab}tab.navigateTo('./edit?opertype=1') this.${tab}tab.navigateTo('./edit?opertype=1')
}, },
$end
$if(replaceDto.ShowBtnEdit)
handleEdit(e) { handleEdit(e) {
this.${tab}tab.navigateTo('./edit?opertype=2&${replaceDto.FistLowerPk}=' + e.id) this.${tab}tab.navigateTo('./edit?opertype=2&${replaceDto.FistLowerPk}=' + e.id)
}, },
$end
$if(replaceDto.ShowBtnView)
handleView(e) {
this.${tab}tab.navigateTo('./edit?opertype=3&${replaceDto.FistLowerPk}=' + e.id)
},
$end
$if(replaceDto.ShowBtnDelete || replaceDto.ShowBtnMultiDel)
handleDelete(row) { handleDelete(row) {
const Ids = row.${replaceDto.FistLowerPk}; const Ids = row.${replaceDto.FistLowerPk};
@ -234,6 +237,7 @@ $end
}) })
.catch(() => {}); .catch(() => {});
}, },
$end
resetQuery() { resetQuery() {
this.${refs}refs.uForm.resetFields() this.${refs}refs.uForm.resetFields()
$foreach(column in genTable.Columns) $foreach(column in genTable.Columns)