more.vue.btl 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <template>
  2. <uv-popup ref="popRef" mode="bottom" bg-color="null" z-index="99">
  3. <view class="container">
  4. <tui-list-view unlined="all" background-color="transparent">
  5. <tui-list-cell v-if="$snowy.hasPerm('mobile${className}Edit')" :hover="true" :arrow="false" @click="edit" :radius="10" >
  6. <view class="item"> 编辑 </view>
  7. </tui-list-cell>
  8. <tui-list-cell v-if="$snowy.hasPerm('mobile${className}Delete')" :hover="true" :arrow="false" @click="del" :radius="10" :margin-top="2">
  9. <view class="item"> 刪除 </view>
  10. </tui-list-cell>
  11. <tui-list-cell :hover="true" :arrow="false" @click="cancel" :margin-top="10" :radius="10">
  12. <view class="item"> 取消 </view>
  13. </tui-list-cell>
  14. </tui-list-view>
  15. </view>
  16. </uv-popup>
  17. </template>
  18. <script setup name="${classNameFirstLower}More">
  19. import { ${classNameFirstLower}Delete } from '@/api/${moduleName}/${classNameFirstLower}Api'
  20. import { reactive, ref, getCurrentInstance } from "vue"
  21. const emits = defineEmits(['handleOk'])
  22. const popRef = ref()
  23. const record = ref({})
  24. const open = (data) => {
  25. record.value = data
  26. popRef.value.open()
  27. }
  28. // 编辑
  29. const edit = () => {
  30. uni.navigateTo({
  31. url: '/pages/${moduleName}/${busName}/form?id=' + record.value.id
  32. })
  33. popupRef.value.close()
  34. }
  35. // 删除
  36. const del = () => {
  37. uni.$snowy.modal.confirm(`确定要删除吗?`).then(() => {
  38. ${classNameFirstLower}Delete([{
  39. id: record.value.id
  40. }]).then(res => {
  41. emits('handleOk')
  42. popupRef.value.close()
  43. })
  44. })
  45. }
  46. // 取消
  47. const cancel = () => {
  48. popupRef.value.close()
  49. }
  50. defineExpose({
  51. open
  52. })
  53. </script>
  54. <style lang="scss" scoped>
  55. .container {
  56. padding: 5upx;
  57. background-color: transparent;
  58. .item {
  59. text-align: center;
  60. }
  61. }
  62. </style>