【优化】移动端代码生成模板优化

pull/141/MERGE
877617829 1 year ago
parent 9d90ba4467
commit e6f4ee7f4d

@ -49,20 +49,6 @@
</view> </view>
</template> </template>
<script setup name="${classNameFirstLower}Form"> <script setup name="${classNameFirstLower}Form">
<%
var iptTool = 0;
for(var i = 0; i < configList.~size; i++) {
if(!configList[i].needTableId) {
if(configList[i].effectType == 'select' || configList[i].effectType == 'radio' || configList[i].effectType == 'checkbox') {
iptTool++;
}
}
}
%>
<% if(iptTool > 0) { %>
import tool from '@/plugins/tool'
<% } %>
import XEUtils from "xe-utils"
import { onLoad } from "@dcloudio/uni-app" import { onLoad } from "@dcloudio/uni-app"
import { ${classNameFirstLower}Detail, ${classNameFirstLower}SubmitForm } from '@/api/${moduleName}/${classNameFirstLower}Api' import { ${classNameFirstLower}Detail, ${classNameFirstLower}SubmitForm } from '@/api/${moduleName}/${classNameFirstLower}Api'
import { reactive, ref, getCurrentInstance } from "vue" import { reactive, ref, getCurrentInstance } from "vue"
@ -101,7 +87,7 @@
<% for(var i = 0; i < configList.~size; i++) { %> <% for(var i = 0; i < configList.~size; i++) { %>
<% if(!configList[i].needTableId) { %> <% if(!configList[i].needTableId) { %>
<% if(configList[i].effectType == 'select' || configList[i].effectType == 'radio' || configList[i].effectType == 'checkbox') { %> <% if(configList[i].effectType == 'select' || configList[i].effectType == 'radio' || configList[i].effectType == 'checkbox') { %>
${configList[i].fieldNameCamelCase}Options.value = tool.dictList('${configList[i].dictTypeCode}') ${configList[i].fieldNameCamelCase}Options.value = uni.$snowy.tool.dictList('${configList[i].dictTypeCode}')
<% } %> <% } %>
<% } %> <% } %>
<% } %> <% } %>

@ -35,8 +35,8 @@
<% } %> <% } %>
</view> </view>
</view> </view>
<snowy-empty :fixed="true" v-if="$utils.isEmpty(${classNameFirstLower}Data)" /> <snowy-empty :fixed="true" v-show="$xeu.isEmpty(${classNameFirstLower}Data)" />
<snowy-float-btn v-if="hasPerm('mobile${className}Add')" @click="add"></snowy-float-btn> <snowy-float-btn v-if="$snowy.hasPerm('mobile${className}Add')" @click="add"></snowy-float-btn>
<more ref="moreRef" @handleOk="loadData(true)"></more> <more ref="moreRef" @handleOk="loadData(true)"></more>
</template> </template>
@ -46,7 +46,6 @@
<% } %> <% } %>
import { ${classNameFirstLower}Page } from '@/api/${moduleName}/${classNameFirstLower}Api' import { ${classNameFirstLower}Page } from '@/api/${moduleName}/${classNameFirstLower}Api'
import more from './more.vue' import more from './more.vue'
import XEUtils from 'xe-utils'
import { onLoad, onShow, onReady, onPullDownRefresh, onReachBottom } from "@dcloudio/uni-app" import { onLoad, onShow, onReady, onPullDownRefresh, onReachBottom } from "@dcloudio/uni-app"
import { reactive, ref, getCurrentInstance } from "vue" import { reactive, ref, getCurrentInstance } from "vue"
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
@ -71,7 +70,7 @@
} }
Object.assign(parameter, searchFormState) Object.assign(parameter, searchFormState)
${classNameFirstLower}Page(parameter).then(res => { ${classNameFirstLower}Page(parameter).then(res => {
if (XEUtils.isEmpty(res?.data?.records)){ if (uni.$xeu.isEmpty(res?.data?.records)){
return return
} }
${classNameFirstLower}Data.value = ${classNameFirstLower}Data.value.concat(res.data.records) ${classNameFirstLower}Data.value = ${classNameFirstLower}Data.value.concat(res.data.records)

@ -2,10 +2,10 @@
<uv-popup ref="popRef" mode="bottom" bg-color="null" z-index="99"> <uv-popup ref="popRef" mode="bottom" bg-color="null" z-index="99">
<view class="container"> <view class="container">
<tui-list-view unlined="all" background-color="transparent"> <tui-list-view unlined="all" background-color="transparent">
<tui-list-cell v-if="hasPerm('mobile${className}Edit')" :hover="true" :arrow="false" @click="edit" :radius="10" > <tui-list-cell v-if="$snowy.hasPerm('mobile${className}Edit')" :hover="true" :arrow="false" @click="edit" :radius="10" >
<view class="item"> 编辑 </view> <view class="item"> 编辑 </view>
</tui-list-cell> </tui-list-cell>
<tui-list-cell v-if="hasPerm('mobile${className}Delete')" :hover="true" :arrow="false" @click="del" :radius="10" :margin-top="2"> <tui-list-cell v-if="$snowy.hasPerm('mobile${className}Delete')" :hover="true" :arrow="false" @click="del" :radius="10" :margin-top="2">
<view class="item"> 刪除 </view> <view class="item"> 刪除 </view>
</tui-list-cell> </tui-list-cell>
<tui-list-cell :hover="true" :arrow="false" @click="cancel" :margin-top="10" :radius="10"> <tui-list-cell :hover="true" :arrow="false" @click="cancel" :margin-top="10" :radius="10">
@ -17,7 +17,6 @@
</template> </template>
<script setup name="${classNameFirstLower}More"> <script setup name="${classNameFirstLower}More">
import { ${classNameFirstLower}Delete } from '@/api/${moduleName}/${classNameFirstLower}Api' import { ${classNameFirstLower}Delete } from '@/api/${moduleName}/${classNameFirstLower}Api'
import modal from '@/plugins/modal'
import { reactive, ref, getCurrentInstance } from "vue" import { reactive, ref, getCurrentInstance } from "vue"
const emits = defineEmits(['handleOk']) const emits = defineEmits(['handleOk'])
const popRef = ref() const popRef = ref()
@ -35,7 +34,7 @@
} }
// 删除 // 删除
const del = () => { const del = () => {
modal.confirm(`确定要删除吗?`).then(() => { uni.$snowy.modal.confirm(`确定要删除吗?`).then(() => {
${classNameFirstLower}Delete([{ ${classNameFirstLower}Delete([{
id: record.value.id id: record.value.id
}]).then(res => { }]).then(res => {

@ -44,21 +44,6 @@
</uv-popup> </uv-popup>
</template> </template>
<script setup name="${classNameFirstLower}Search"> <script setup name="${classNameFirstLower}Search">
<%
var iptTool = 0;
if (searchCount > 0) {
for(var i = 0; i < configList.~size; i++) {
if(!configList[i].needTableId) {
if(configList[i].effectType == 'select' || configList[i].effectType == 'radio' || configList[i].effectType == 'checkbox') {
iptTool++;
}
}
}
}
%>
<% if(iptTool > 0) { %>
import tool from '@/plugins/tool'
<% } %>
import { ref } from "vue" import { ref } from "vue"
const emits = defineEmits(['reset', 'confirm']) const emits = defineEmits(['reset', 'confirm'])
const props = defineProps({ const props = defineProps({
@ -71,7 +56,7 @@
<% for(var i = 0; i < configList.~size; i++) { %> <% for(var i = 0; i < configList.~size; i++) { %>
<% if(!configList[i].needTableId && configList[i].needPage) { %> <% if(!configList[i].needTableId && configList[i].needPage) { %>
<% if (configList[i].effectType == 'select' || configList[i].effectType == 'radio' || configList[i].effectType == 'checkbox') { %> <% if (configList[i].effectType == 'select' || configList[i].effectType == 'radio' || configList[i].effectType == 'checkbox') { %>
const ${configList[i].fieldNameCamelCase}Options = tool.dictList('${configList[i].dictTypeCode}') const ${configList[i].fieldNameCamelCase}Options = uni.$snowy.tool.dictList('${configList[i].dictTypeCode}')
<% } %> <% } %>
<% } %> <% } %>
<% } %> <% } %>

Loading…
Cancel
Save