km-knowledage-collectmodal.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <div>
  3. <sd-favorites-tree
  4. ref="tree"
  5. :type="1"
  6. :hideleftbtn="true"
  7. @treeSelectd="treeSelectd"
  8. ></sd-favorites-tree>
  9. <!-- 新建收藏夹弹窗框 -->
  10. <sd-detail-modal
  11. ref="createFavoritesModal"
  12. :record-id="docId"
  13. page-id="comp/bookmark/kmBookmarkFolder"
  14. :modal-props="{ width: 450 }"
  15. @saved="fwSaved"
  16. >
  17. <template v-slot="{ model, fields }">
  18. <sd-create-modal
  19. :model="model"
  20. :fields="fields"
  21. @modalTreeSelectd="modalTreeSelectd"
  22. ></sd-create-modal>
  23. </template>
  24. </sd-detail-modal>
  25. </div>
  26. </template>
  27. <script>
  28. import { Modal } from 'ant-design-vue'
  29. import sdCreateModal from '../person-center/km-create-modal'
  30. import sdFavoritesTree from '../person-center/km-favorites-tree'
  31. import components from './_import-components/km-knowledage-collectmodal-import'
  32. export default {
  33. name: 'KmKnowledageCollectmodal',
  34. metaInfo: {
  35. title: '收藏弹框',
  36. },
  37. components: {
  38. ...components,
  39. 'sd-favorites-tree': sdFavoritesTree,
  40. 'sd-create-modal': sdCreateModal,
  41. },
  42. props: {
  43. showCreatedMoldal: {
  44. type: Boolean,
  45. default: false,
  46. },
  47. },
  48. data() {
  49. return {
  50. docId: null,
  51. modelSelectedKey: null,
  52. }
  53. },
  54. watch: {
  55. showCreatedMoldal: function(newValue) {
  56. this.docId = undefined
  57. this.$refs.createFavoritesModal.show()
  58. },
  59. },
  60. mounted() {},
  61. methods: {
  62. // 选择收藏夹
  63. treeSelectd(id) {
  64. if (id.length < 1) return
  65. this.modelSelectedKey = parseInt(id)
  66. this.$emit('selectKey', this.modelSelectedKey)
  67. },
  68. // 新建收藏夹保存
  69. fwSaved() {
  70. Modal.confirm({
  71. title: '新建收藏夹',
  72. content: '已保存',
  73. })
  74. this.$refs.tree.refresh(1)
  75. },
  76. modalTreeSelectd(id) {
  77. this.modelSelectedKey = id
  78. },
  79. },
  80. }
  81. </script>
  82. <style module lang="scss">
  83. @use '@/common/design' as *;
  84. .spin {
  85. width: 100%;
  86. line-height: 30;
  87. }
  88. </style>