You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
2.9 KiB

3 years ago
  1. <template>
  2. <UView #if(${cfg.moduleName})name="$!{cfg.moduleName}"#end#if(${cfg.rowKey})rowKey="$!{cfg.rowKey}"#end>
  3. <UViewSearch v-model="searchModel">
  4. <URow col="search">
  5. #foreach($vue in ${cfg.vueFields})
  6. #if(${vue.searchComponent})
  7. ${vue.searchComponent}
  8. #end
  9. #end
  10. <UButton func="query" url="/${package.ModuleName}/#if(${controllerMappingHyphenStyle})${controllerMappingHyphen}#else${table.entityPath}#end/view">搜索</UButton>
  11. <UButton func="reset">重置</UButton>
  12. <UButton func="add" url="/${package.ModuleName}/#if(${controllerMappingHyphenStyle})${controllerMappingHyphen}#else${table.entityPath}#end/add" v-auth="'${package.ModuleName}:#if(${controllerMappingHyphenStyle})${controllerMappingHyphen}#else${table.entityPath}#end:add'">新增</UButton>
  13. </URow>
  14. </UViewSearch>
  15. <UViewModal title="${cfg.moduleName}管理" :span="[7, 14]" v-model="editModel" :rules="rules">
  16. <template #default="{model}">
  17. #foreach($vue in ${cfg.vueFields})
  18. #if(${vue.component})
  19. ${vue.component}
  20. #end
  21. #end
  22. </template>
  23. <template #footer>
  24. <UButton func="cancel">取消</UButton>
  25. <UButton func="submit" url="/${package.ModuleName}/#if(${controllerMappingHyphenStyle})${controllerMappingHyphen}#else${table.entityPath}#end/saveOrUpdate">提交</UButton>
  26. <UButton func="reset">重置</UButton>
  27. </template>
  28. </UViewModal>
  29. <UViewTable :columns="columns">
  30. <template #action="{record}">
  31. <UTag func="edit" :data="record" url="/${package.ModuleName}/#if(${controllerMappingHyphenStyle})${controllerMappingHyphen}#else${table.entityPath}#end/edit" v-auth="'${package.ModuleName}:#if(${controllerMappingHyphenStyle})${controllerMappingHyphen}#else${table.entityPath}#end:edit'">修改</UTag>
  32. <UTag func="del" :data="record" url="/${package.ModuleName}/#if(${controllerMappingHyphenStyle})${controllerMappingHyphen}#else${table.entityPath}#end/del" v-auth="'${package.ModuleName}:#if(${controllerMappingHyphenStyle})${controllerMappingHyphen}#else${table.entityPath}#end:del'">删除</UTag>
  33. </template>
  34. </UViewTable>
  35. </UView>
  36. </template>
  37. <!-- ${cfg.moduleName}功能 -->
  38. <script>
  39. import {ref, reactive} from "vue";
  40. export default {
  41. name: "$entity",
  42. setup() {
  43. let columns = ref([
  44. #foreach($field in ${cfg.vueFields})
  45. {field: "${field.field}", title: "${field.label}"},
  46. #end
  47. {field: 'action', title: '操作', type: 'action'},
  48. ]);
  49. let rules = reactive({
  50. #foreach($field in ${cfg.vueFields})
  51. #if(${field.required})
  52. ${field.field}: {required: true, message: '${field.label}必填'},
  53. #end
  54. #end
  55. })
  56. let editModel = ref({});
  57. let searchModel = ref({});
  58. return {columns, rules, editModel, searchModel}
  59. },
  60. }
  61. </script>
  62. <style scoped> </style>