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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
import Vue from 'vue'
import uniqueId from 'lodash'
import AuthorityFilter from '../commands/AuthorityFilter'
import CreateAndCopyLocationDialog from "@/components/DialogComponents/LocationConfigurationDialog/CreateAndCopyLocatonCofig.vue"
import DeleteLocationDialog from "@/components/DialogComponents/LocationConfigurationDialog/DeleteLocationConfigDialog.vue";
import UpdateLocationDialog from '@/components/DialogComponents/LocationConfigurationDialog/UpdateLocationConfig.vue'
import ImportLocationDialog from '@/components/DialogComponents/LocationConfigurationDialog/ImportLocationConfigDialog.vue'
Vue.component('CreateAndCopyLocationDialog',CreateAndCopyLocationDialog);
Vue.component('DeleteLocationDialog',DeleteLocationDialog);
Vue.component('UpdateLocationDialog',UpdateLocationDialog);
Vue.component('ImportLocationDialog',ImportLocationDialog);
let CommandTypes = {
CREATE_COPY_LOCATION_CMD: {
type: 'CreateAndCopyLocation',
executeComponent: 'CreateAndCopyLocationDialog',
registerComponent: CreateAndCopyLocationDialog
},
DELETE_LOCATION_CMD: {
type: 'DeleteLocation',
executeComponent: 'DeleteLocationDialog',
registerComponent: DeleteLocationDialog // import对应的对话框组件
},
UPDATE_LOCATION_CMD: {
type: 'UpdateLocation',
executeComponent: 'UpdateLocationDialog',
registerComponent: UpdateLocationDialog // import对应的对话框组件
},
IMPORT_LOCATION_CMD: {
type: 'ImportLocationToExcel',
executeComponent: 'ImportLocationDialog',
registerComponent: ImportLocationDialog // import对应的对话框组件
},
};
class LocationCommands {
static createAndCopyLocationCommand (title, location, commandContext) {
let command = {
id: uniqueId(CommandTypes.CREATE_COPY_LOCATION_CMD.type),
visible: true,
disabled: false,
target: location,
title: title,
executeComponent: CommandTypes.CREATE_COPY_LOCATION_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.locationsAuthorityFilter(command)
}
static deleteLocationCommand (location, commandContext) {
let command = {
id: uniqueId(CommandTypes.DELETE_LOCATION_CMD.type),
visible: true,
disabled: false,
target: location,
executeComponent: CommandTypes.DELETE_LOCATION_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.locationsAuthorityFilter(command)
}
static updateLocationCommand (location, commandContext) {
let command = {
id: uniqueId(CommandTypes.UPDATE_LOCATION_CMD.type),
visible: true,
disabled: false,
target: location,
executeComponent: CommandTypes.UPDATE_LOCATION_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.locationsAuthorityFilter(command)
}
static importLocationCommand (commandContext) {
let command = {
id: uniqueId(CommandTypes.IMPORT_LOCATION_CMD.type),
visible: true,
disabled: false,
target: null,
executeComponent: CommandTypes.IMPORT_LOCATION_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.locationsAuthorityFilter(command)
}
}
LocationCommands.CommandTypes = CommandTypes;
export default LocationCommands