moreMenu.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <el-dropdown v-if="operateIsPermissionByPath('edit', 'view') || operateIsPermissionByPath('edit', 'download') || (operateIsPermissionByPath('edit', 'share') && props.searchType === '0')">
  3. <span style="margin-left: 8px;" class="oper-span more-btn">
  4. 更多
  5. <el-icon class="el-icon--right">
  6. <arrow-down />
  7. </el-icon>
  8. </span>
  9. <template #dropdown>
  10. <el-dropdown-menu>
  11. <el-dropdown-item :disabled="menu.permiss ? !operateIsPermissionByPath(menu.permiss, menu.key) : !operateIsPermissionByPath(menu.key)" v-for="menu in menus" :key="menu.key"
  12. @click="menu.onClick()">
  13. {{ menu.label }}
  14. </el-dropdown-item>
  15. </el-dropdown-menu>
  16. </template>
  17. </el-dropdown>
  18. </template>
  19. <script setup lang="ts">
  20. import { computed } from "vue";
  21. import { shareCase, downloadCase } from "./quisk";
  22. import { copyCase, getCaseSceneList } from "@/store/case";
  23. import { alert } from "@/helper/message";
  24. import { operateIsPermissionByPath } from "@/directive/permission";
  25. import { usePagging } from "@/hook/pagging";
  26. const props = defineProps<{
  27. caseId: any;
  28. projectName?: string;
  29. title?: string;
  30. prevMenu?: any;
  31. lastMenu?: any;
  32. searchType?: string;
  33. }>();
  34. const appId = import.meta.env.VITE_APP_APP;
  35. const emit = defineEmits(['copy', 'refresh']);
  36. const menus = computed(() => {
  37. if (!props.caseId) {
  38. return [];
  39. }
  40. const caseId = props.caseId;
  41. return [
  42. ...(props.prevMenu || []).map((item) => ({
  43. ...item,
  44. onClick: () => item.onClick(caseId),
  45. })),
  46. {
  47. key: "view",
  48. label: "复制",
  49. permiss: 'edit',
  50. onClick: () => {
  51. emit('copy', props.caseId);
  52. }
  53. },
  54. ...(props.searchType === '0' ? [{
  55. key: "share",
  56. label: "权限",
  57. permiss: 'edit',
  58. onClick: async () => {
  59. shareCase({ caseId: caseId, projectName: props.projectName || '' });
  60. },
  61. }] : []),
  62. // {
  63. // key: "download",
  64. // label: "下载",
  65. // permiss: 'edit',
  66. // onClick: async () => {
  67. // downloadCase({ caseId, title: props.title || '' });
  68. // },
  69. // },
  70. ...(props.lastMenu || []).map((item) => ({
  71. ...item,
  72. onClick: () => item.onClick(caseId),
  73. })),
  74. ];
  75. });
  76. </script>