QuestionFolderDialog.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <el-dialog
  3. custom-class="side-dialog"
  4. :visible.sync="modalIsShow"
  5. :title="title"
  6. width="600px"
  7. :modal="true"
  8. :close-on-click-modal="false"
  9. :close-on-press-escape="false"
  10. append-to-body
  11. >
  12. <question-folder
  13. v-if="modalIsShow"
  14. ref="QuestionFolder"
  15. :is-edit="isEdit"
  16. @selected="nodeSelected"
  17. ></question-folder>
  18. <div slot="footer" class="box-justify">
  19. <div></div>
  20. <div>
  21. <el-button v-if="!isEdit" type="primary" @click="confirm"
  22. >确定</el-button
  23. >
  24. <el-button @click="cancel">取消</el-button>
  25. </div>
  26. </div>
  27. </el-dialog>
  28. </template>
  29. <script>
  30. import QuestionFolder from "./QuestionFolder.vue";
  31. export default {
  32. name: "QuestionFolderDialog",
  33. components: { QuestionFolder },
  34. props: {
  35. isEdit: {
  36. type: Boolean,
  37. default: true,
  38. },
  39. },
  40. data() {
  41. return {
  42. modalIsShow: false,
  43. curNodeData: {},
  44. };
  45. },
  46. computed: {
  47. title() {
  48. return this.isEdit ? "新建文件夹" : "选择文件夹";
  49. },
  50. },
  51. methods: {
  52. cancel() {
  53. this.modalIsShow = false;
  54. },
  55. open() {
  56. this.modalIsShow = true;
  57. },
  58. nodeSelected(node) {
  59. this.curNodeData = node || {};
  60. },
  61. confirm() {
  62. if (!this.curNodeData.id && this.curNodeData.id !== 0) {
  63. this.$message.error("请选择文件夹!");
  64. return;
  65. }
  66. this.$emit("selected", this.curNodeData);
  67. this.cancel();
  68. },
  69. },
  70. };
  71. </script>