import Vue from 'vue' import uniqueId from 'lodash' import AuthorityFilter from '../commands/AuthorityFilter' import CreateAndCopyQosDialog from "@/components/DialogComponents/QosDialog/CreateAndCopyQos.vue" import DeleteQosDialog from "@/components/DialogComponents/QosDialog/DeleteQosDialog.vue"; // import UpdateQosDialog from "@/components/DialogComponents/QosDialog/UpdateQosDialog.vue"; Vue.component('CreateAndCopyQosDialog',CreateAndCopyQosDialog); Vue.component('DeleteQosDialog',DeleteQosDialog); // Vue.component('UpdateQosDialog',UpdateQosDialog); let CommandTypes = { CREATE_COPY_QOS_CMD: { type: 'CreateAndCopyQos', executeComponent: 'CreateAndCopyQosDialog', registerComponent: CreateAndCopyQosDialog }, DELETE_QOS_CMD: { type: 'DeleteQos', executeComponent: 'DeleteQosDialog', registerComponent: DeleteQosDialog // import对应的对话框组件 }, // UPDATE_QOS_CMD: { // type: 'UpdateQos', // executeComponent: 'UpdateQosDialog', // registerComponent: UpdateQosDialog // import对应的对话框组件 // }, }; class QosCommands { static createAndCopyQosCommand (title, Qos, commandContext) { let command = { id: uniqueId(CommandTypes.CREATE_COPY_QOS_CMD.type), visible: true, disabled: false, target: Qos, title: title, executeComponent: CommandTypes.CREATE_COPY_QOS_CMD.executeComponent, execute: undefined, done: undefined, }; command.execute = function () { Vue.set(commandContext, command.id, command); }; command.done = function () { Vue.delete(commandContext, command.id) }; return AuthorityFilter.QOSAuthorityFilter(command) } static deleteQosCommand (Qos, commandContext) { let command = { id: uniqueId(CommandTypes.DELETE_QOS_CMD.type), visible: true, disabled: false, target: Qos, executeComponent: CommandTypes.DELETE_QOS_CMD.executeComponent, execute: undefined, done: undefined, }; command.execute = function () { Vue.set(commandContext, command.id, command); }; command.done = function () { Vue.delete(commandContext, command.id) }; return AuthorityFilter.QOSAuthorityFilter(command) } } QosCommands.CommandTypes = CommandTypes; export default QosCommands