PeriodReportCommands.js 1.27 KB
Newer Older
YazhouChen's avatar
YazhouChen committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
import Vue from 'vue'
import uniqueId from 'lodash'
import {i18n} from '../main'
import AuthorityFilter from '../commands/AuthorityFilter'
import DeletePeriodReportDialog from '@/components/DialogComponents/PeriodReportDialog/DeletePeriodReportDialog.vue'

Vue.component('DeletePeriodReportDialog', DeletePeriodReportDialog)

let CommandTypes = {
  DELETE_PERIOD_REPORT_CMD: {
    type: 'DeletePeriodReportDialog',
    executeComponent: 'DeletePeriodReportDialog',
    registerComponent: DeletePeriodReportDialog
  }
}

class PeriodReportCommands {
  static deletePeriodReportCommand (template1, commandContext) {
    let command = {
      id: uniqueId(CommandTypes.DELETE_PERIOD_REPORT_CMD.type),
      visible: true,
      disabled: false,
      target: template1,
      executeComponent: CommandTypes.DELETE_PERIOD_REPORT_CMD.executeComponent,
      execute: undefined,
      done: undefined,
      name: i18n.tc('ReportTemplateManagement.deleteReportTemplate')
    }
    command.execute = function () {
      Vue.set(commandContext, command.id, command)
    }
    command.done = function () {
      Vue.delete(commandContext, command.id)
    }
    return AuthorityFilter.periodReportAuthorityFilter(command)
  }
}

PeriodReportCommands.CommandTypes = CommandTypes

export default PeriodReportCommands