snowy/snowy-plugin/snowy-plugin-gen/src/main/resources/mobile/more.vue.btl

55 lines
1.9 KiB
Plaintext

<template>
<uni-popup ref="popRef" type="bottom" background-color="transparent" maskBackgroundColor="rgba(0, 0, 0, 0.6)">
<tui-list-view unlined="all" background-color="transparent">
<tui-list-cell v-if="$snowy.hasPerm('mobile${className}Edit')" :hover="true" :arrow="false" @click="edit" :radius="10" >
<view class="snowy-text-center"> 编辑 </view>
</tui-list-cell>
<tui-list-cell v-if="$snowy.hasPerm('mobile${className}Delete')" :hover="true" :arrow="false" @click="del" :radius="10" :margin-top="2">
<view class="snowy-text-center"> 刪除 </view>
</tui-list-cell>
<tui-list-cell :hover="true" :arrow="false" @click="cancel" :margin-top="10" :radius="10">
<view class="snowy-text-center"> 取消 </view>
</tui-list-cell>
</tui-list-view>
</uni-popup>
</template>
<script setup name="${classNameFirstLower}More">
import ${classNameFirstLower}Api from '@/api/${moduleName}/${classNameLowerKebab}-api'
import { reactive, ref, getCurrentInstance } from "vue"
const emits = defineEmits(['handleOk'])
const popRef = ref()
const record = ref({})
const open = (data) => {
record.value = data
popRef.value.open()
}
// 编辑
const edit = () => {
uni.navigateTo({
url: '/pages/${moduleName}/${busName}/form?id=' + record.value.id
})
popRef.value.close()
}
// 删除
const del = () => {
uni.$snowy.modal.confirm(`确定要删除吗?`).then(() => {
${classNameFirstLower}Api.${classNameFirstLower}Delete([{
id: record.value.id
}]).then(data => {
emits('handleOk')
popRef.value.close()
})
})
}
// 取消
const cancel = () => {
popRef.value.close()
}
defineExpose({
open
})
</script>
<style lang="scss" scoped>
</style>