dialog.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <cus-dialog
  3. :visible="visible"
  4. @on-close="handleClose"
  5. ref="scriptDialog"
  6. width="1000px"
  7. :title="$t('fm.eventscript.config.title')"
  8. :action="false"
  9. :before-close="beforeClose"
  10. >
  11. <el-container style="height: 600px;" class="fm-event-panel-dialog-container">
  12. <event-script-index v-model="scriptList" ref="eventScriptIndex" @on-confirm-event="handleConfirmEvent"></event-script-index>
  13. </el-container>
  14. </cus-dialog>
  15. </template>
  16. <script>
  17. import CusDialog from '../CusDialog.vue'
  18. import EventScriptIndex from './index.vue'
  19. export default {
  20. components: {
  21. CusDialog,
  22. EventScriptIndex
  23. },
  24. emits: ['dialog-close', 'dialog-confirm'],
  25. data: () => ({
  26. visible: false,
  27. scriptList: []
  28. }),
  29. methods: {
  30. open (list, eventName, eventKey) {
  31. this.visible = true
  32. if (list) {
  33. this.scriptList = list
  34. }
  35. this.$nextTick(() => {
  36. if (!eventKey && eventName) {
  37. this.$refs.eventScriptIndex.loadNewFunction(eventName)
  38. }
  39. if (eventKey && eventName) {
  40. this.$refs.eventScriptIndex.loadFunction(eventKey, eventName)
  41. }
  42. })
  43. },
  44. handleClose () {
  45. this.$emit('dialog-close', this.scriptList)
  46. this.visible = false
  47. },
  48. handleConfirmEvent (eventObj) {
  49. this.$emit('dialog-close', this.scriptList)
  50. this.$emit('dialog-confirm', eventObj)
  51. this.visible = false
  52. },
  53. beforeClose (done) {
  54. this.$refs.eventScriptIndex.beforeClose(done)
  55. }
  56. }
  57. }
  58. </script>
  59. <style lang="scss">
  60. .fm-event-panel-dialog-container{
  61. border: 1px solid var(--el-border-color-lighter);
  62. }
  63. </style>