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
119
120
121
122
123
124
125
126
127
128
129
130
131
| <template>
| <div class="btn-list">
| <div
| :class="['btn-item', item.icon, { disabled: item.disabled }]"
| v-for="(item, idx) in list"
| :key="'btn_' + idx"
| :title="item.title"
| @click="itemClick(item)"
| ></div>
| </div>
| </template>
|
| <script>
| import i18n from "./i18n/menuList";
| import { createI18nOption } from "@/assets/js/tools/i18n";
|
| const i18nMixin = createI18nOption(i18n);
| export default {
| name: "",
| mixins: [i18nMixin],
| data() {
| const list = [
| {
| title: this.$t('OpenFile'),
| icon: "open",
| method: "openFile",
| },
| {
| title: this.$t('GenerateReport'),
| icon: "export",
| method: "exportReport",
| disabled: true,
| },
| {
| title: this.$t('ViewProperties'),
| icon: "view",
| method: "viewProp",
| disabled: true,
| },
| {
| title: this.$t('GradedEvaluation'),
| icon: "report",
| method: "setAlarmValue",
| },
| {
| title: this.$t('WindowConfiguration'),
| icon: "window-confirm",
| method: "windowConfirm",
| },
| ];
| return {
| list,
| };
| },
| watch: {
| $route(n) {
| this.list[1].disabled = !["compare", "result"].includes(n.name);
| this.list[2].disabled = !["result"].includes(n.name);
| },
| },
| components: {},
| methods: {
| itemClick(obj) {
| // console.log(obj)
| if (
| obj.method &&
| "function" == typeof this[obj.method] &&
| !obj.disabled
| ) {
| this[obj.method]();
| }
| },
| openFile() {
| window.api.send("open-file-dialog", "MenuList");
| },
| exportReport() {
| this.$bus.$emit("export");
| },
| viewProp() {
| this.$bus.$emit("viewProp");
| },
| setAlarmValue() {
| this.$bus.$emit("setAlarmValue");
| },
| windowConfirm() {
| this.$bus.$emit("windowConfirm");
| },
| },
|
| mounted() {},
| };
| </script>
|
| <style scoped lang="less">
| .btn-list {
| padding: 4px 2px;
| display: flex;
| flex-direction: row;
| .btn-item {
| flex: 1;
| height: 26px;
| cursor: pointer;
| & + .btn-item {
| margin-left: 4px;
| }
| &.open {
| background: url("~@/assets/open.png") center / contain no-repeat;
| }
| &.export {
| background: url("~@/assets/export.png") center / contain no-repeat;
| }
| &.view {
| background: url("~@/assets/view.png") center / contain no-repeat;
| }
| &.report {
| background: url("~@/assets/report.png") center / contain no-repeat;
| }
| &.window-confirm {
| background: url("~@/assets/window-confirm.png") center / contain no-repeat;
| }
| &:hover {
| background-color: rgba(200, 200, 200, 0.4);
| }
| &.disabled.disabled {
| background-color: #999;
| background-blend-mode: luminosity;
| cursor: not-allowed;
| }
| }
| }
| </style>
|
|