Skip to content
This repository was archived by the owner on Mar 19, 2021. It is now read-only.

Commit 3c9b5b1

Browse files
committed
npm run format
1 parent f0409a2 commit 3c9b5b1

15 files changed

+118
-117
lines changed

frontend/src/App.vue

+6-8
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
hide-details
1515
inset
1616
color="black"
17-
v-bind:label="$vuetify.theme.dark?'深色模式':'浅色模式'"
17+
v-bind:label="$vuetify.theme.dark ? '深色模式' : '浅色模式'"
1818
></v-switch>
1919
</v-app-bar>
2020

@@ -36,23 +36,21 @@ import AboutDialog from "@/components/AboutDialog.vue";
3636
export default {
3737
components: {
3838
DrawerList,
39-
AboutDialog
39+
AboutDialog,
4040
},
4141
props: {
42-
source: String
42+
source: String,
4343
},
4444
mounted() {
45-
this.$vuetify.theme.dark = window.matchMedia(
46-
"(prefers-color-scheme: dark)"
47-
).matches;
45+
this.$vuetify.theme.dark = window.matchMedia("(prefers-color-scheme: dark)").matches;
4846
},
4947
methods: {
5048
switchDrawer() {
5149
this.$refs.DrawerList.switchDrawer();
5250
},
5351
openDialog() {
5452
this.$refs.AboutDialog.openDialog();
55-
}
56-
}
53+
},
54+
},
5755
};
5856
</script>

frontend/src/components/AboutDialog.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@
3333
export default {
3434
data: () => ({
3535
dialog: false,
36-
hc: ""
36+
hc: "",
3737
}),
3838
methods: {
3939
openDialog() {
4040
this.dialog = true;
41-
}
42-
}
41+
},
42+
},
4343
};
4444
</script>

frontend/src/components/ChartCard.vue

+7-9
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<v-card style="overflow-y: hidden;">
33
<div :class="themeClasses" ref="chart" style="width: 100%; height: 77vh;"></div>
44
<v-card-actions>
5-
<v-btn text color='accent' @click="follow">跟随</v-btn>
6-
<v-btn text color='grey' @click="exportData">导出</v-btn>
5+
<v-btn text color="accent" @click="follow">跟随</v-btn>
6+
<v-btn text color="grey" @click="exportData">导出</v-btn>
77
</v-card-actions>
88
</v-card>
99
</template>
@@ -34,7 +34,7 @@ const lineColors = {
3434
};
3535
3636
export default {
37-
name: 'ChartCard',
37+
name: "ChartCard",
3838
mixins: [Themeable],
3939
data: () => ({
4040
indexColor: -1,
@@ -66,7 +66,7 @@ export default {
6666
});
6767
},
6868
watch: {
69-
isDark: function () {
69+
isDark: function() {
7070
for (const s of this.chart.options.series) {
7171
this.updateColor(s);
7272
}
@@ -111,9 +111,7 @@ export default {
111111
const jsonWS = JSON.parse(data);
112112
const seriesArray = this.chart.options.series;
113113
for (const dp of jsonWS.DataPack) {
114-
let series = seriesArray.find(
115-
(a) => a.name == dp.Name
116-
);
114+
let series = seriesArray.find((a) => a.name == dp.Name);
117115
if (!series) {
118116
this.indexColor++;
119117
series = {
@@ -136,10 +134,10 @@ export default {
136134
},
137135
exportData() {
138136
const json = JSON.stringify(this.chart.options);
139-
const blob = new Blob([json], {type: 'application/json'});
137+
const blob = new Blob([json], { type: "application/json" });
140138
const anchor = document.createElement("a");
141139
anchor.href = URL.createObjectURL(blob);
142-
anchor.download = '上位机导出数据.json';
140+
anchor.download = "上位机导出数据.json";
143141
anchor.style.display = "none";
144142
document.body.appendChild(anchor);
145143
anchor.click();

frontend/src/components/DrawerList.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ export default {
3535
SerialPort,
3636
SaveConfig,
3737
VariableList,
38-
VariableAllDialog
38+
VariableAllDialog,
3939
},
4040
data: () => ({
41-
drawer: null
41+
drawer: null,
4242
}),
4343
methods: {
4444
switchDrawer() {
@@ -50,7 +50,7 @@ export default {
5050
getAllV() {
5151
this.$refs.cardRead.getVariables();
5252
this.$refs.cardModi.getVariables();
53-
}
54-
}
53+
},
54+
},
5555
};
5656
</script>

frontend/src/components/PanelCard.vue

+6-6
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ import axios from "axios";
5353
export default {
5454
data: () => ({
5555
menu: false,
56-
variables: []
56+
variables: [],
5757
}),
5858
mounted() {
5959
this.getVariables();
@@ -63,7 +63,7 @@ export default {
6363
this.menu = true;
6464
},
6565
getVariables() {
66-
axios.get("/variable-modi/list").then(response => {
66+
axios.get("/variable-modi/list").then((response) => {
6767
this.variables = response.data.Variables;
6868
});
6969
},
@@ -74,16 +74,16 @@ export default {
7474
Name: i.Name,
7575
Type: i.Type,
7676
Addr: i.Addr,
77-
Data: parseFloat(i.Data)
77+
Data: parseFloat(i.Data),
7878
})
79-
.then(response => {
79+
.then((response) => {
8080
if (response.data.status == 0) {
8181
this.$toasted.show("变量修改成功");
8282
} else if (response.data.status == 22) {
8383
this.$toasted.error("变量操作时串口错误");
8484
}
8585
});
86-
}
87-
}
86+
},
87+
},
8888
};
8989
</script>

frontend/src/components/SaveConfig.vue

+9-9
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<v-list-item-title>保存选项</v-list-item-title>
55
</v-list-item>
66
<v-list-item v-for="i in config" :key="i.n">
7-
<v-switch v-model="i.v" :label="i.t" v-on:change="updateConfig(i.n,i.v)" inset></v-switch>
7+
<v-switch v-model="i.v" :label="i.t" v-on:change="updateConfig(i.n, i.v)" inset></v-switch>
88
</v-list-item>
99
</v-list>
1010
</template>
@@ -17,34 +17,34 @@ export default {
1717
{
1818
t: "变量列表",
1919
n: "sda",
20-
v: true
20+
v: true,
2121
},
2222
{
2323
t: "观察变量",
2424
n: "svr",
25-
v: true
25+
v: true,
2626
},
2727
{
2828
t: "修改变量",
2929
n: "svm",
30-
v: true
31-
}
32-
]
30+
v: true,
31+
},
32+
],
3333
}),
3434
mounted() {
3535
this.getConfig();
3636
},
3737
methods: {
3838
getConfig() {
39-
axios.get("/file/config").then(response => {
39+
axios.get("/file/config").then((response) => {
4040
this.config[0].v = response.data.IsSaveDataAddr;
4141
this.config[1].v = response.data.IsSaveVariableRead;
4242
this.config[2].v = response.data.IsSaveVariableModi;
4343
});
4444
},
4545
updateConfig(n, v) {
4646
axios.get("/file/config?" + n + "=" + v);
47-
}
48-
}
47+
},
48+
},
4949
};
5050
</script>

frontend/src/components/SerialPort.vue

+7-7
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,20 @@ export default {
2424
data: () => ({
2525
status: false,
2626
serial: null,
27-
serialList: []
27+
serialList: [],
2828
}),
2929
mounted() {
3030
this.getSerialList();
3131
this.getSerial();
3232
},
3333
methods: {
3434
getSerialList() {
35-
axios.get("/serial/list").then(response => {
35+
axios.get("/serial/list").then((response) => {
3636
this.serialList = response.data.Ports;
3737
});
3838
},
3939
getSerial() {
40-
axios.get("/serial").then(response => {
40+
axios.get("/serial").then((response) => {
4141
this.serial = response.data.Name;
4242
if (this.serial) {
4343
this.status = true;
@@ -46,7 +46,7 @@ export default {
4646
},
4747
optSerial() {
4848
if (this.status) {
49-
axios.get("/serial/open?port=" + this.serial).then(response => {
49+
axios.get("/serial/open?port=" + this.serial).then((response) => {
5050
if (response.data.status == 0) {
5151
this.$toasted.show("串口打开成功");
5252
} else if (response.data.status == 1) {
@@ -58,7 +58,7 @@ export default {
5858
}
5959
});
6060
} else {
61-
axios.get("/serial/close").then(response => {
61+
axios.get("/serial/close").then((response) => {
6262
if (response.data.status == 0) {
6363
this.$toasted.show("串口关闭成功");
6464
} else if (response.data.status == 12) {
@@ -70,7 +70,7 @@ export default {
7070
}
7171
});
7272
}
73-
}
74-
}
73+
},
74+
},
7575
};
7676
</script>

frontend/src/components/VariableAllDialog.vue

+20-15
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@
1515
<v-file-input label="上传变量地址表文件" v-model="file"></v-file-input>
1616
</v-col>
1717
<v-col cols="8">
18-
<v-text-field clearable placeholder="搜索变量" prepend-icon="mdi-magnify" v-model="keyword"></v-text-field>
18+
<v-text-field
19+
clearable
20+
placeholder="搜索变量"
21+
prepend-icon="mdi-magnify"
22+
v-model="keyword"
23+
></v-text-field>
1924
</v-col>
2025
</v-row>
2126

@@ -32,9 +37,9 @@
3237
</thead>
3338
<tbody>
3439
<tr v-for="list in searchData" :key="list.Name">
35-
<td>{{list.Name}}</td>
36-
<td>{{list.Type}}</td>
37-
<td>{{list.Addr}}</td>
40+
<td>{{ list.Name }}</td>
41+
<td>{{ list.Type }}</td>
42+
<td>{{ list.Addr }}</td>
3843
<td>
3944
<v-btn icon v-on:click="variableReadAdd(list)">
4045
<v-icon>mdi-plus</v-icon>
@@ -62,17 +67,17 @@ export default {
6267
file: null,
6368
lists: [],
6469
searchData: [],
65-
keyword: ""
70+
keyword: "",
6671
}),
6772
watch: {
6873
file: function() {
6974
let file = this.file;
7075
let param = new FormData();
7176
param.append("file", file);
7277
let config = {
73-
headers: { "Content-Type": "multipart/form-data" }
78+
headers: { "Content-Type": "multipart/form-data" },
7479
};
75-
axios.post("/file/upload", param, config).then(response => {
80+
axios.post("/file/upload", param, config).then((response) => {
7681
if (response.data.status == 0) {
7782
this.getVariableList();
7883
this.$toasted.show("文件上传成功");
@@ -102,7 +107,7 @@ export default {
102107
} else {
103108
return this.searchData;
104109
}
105-
}
110+
},
106111
},
107112
mounted() {
108113
this.getVariableList();
@@ -116,7 +121,7 @@ export default {
116121
this.dialog = false;
117122
},
118123
getVariableList() {
119-
axios.get("/file/variables").then(response => {
124+
axios.get("/file/variables").then((response) => {
120125
this.lists = response.data.Variables;
121126
this.searchData = response.data.Variables;
122127
});
@@ -127,9 +132,9 @@ export default {
127132
Board: 1,
128133
Name: i.Name,
129134
Type: i.Type,
130-
Addr: parseInt(i.Addr, 16)
135+
Addr: parseInt(i.Addr, 16),
131136
})
132-
.then(response => {
137+
.then((response) => {
133138
if (response.data.status == 0) {
134139
this.$toasted.show("变量添加成功");
135140
} else if (response.data.status == 22) {
@@ -145,9 +150,9 @@ export default {
145150
Board: 1,
146151
Name: i.Name,
147152
Type: i.Type,
148-
Addr: parseInt(i.Addr, 16)
153+
Addr: parseInt(i.Addr, 16),
149154
})
150-
.then(response => {
155+
.then((response) => {
151156
if (response.data.status == 0) {
152157
this.$toasted.show("变量添加成功");
153158
} else if (response.data.status == 22) {
@@ -156,7 +161,7 @@ export default {
156161
this.$toasted.error("重复添加变量");
157162
}
158163
});
159-
}
160-
}
164+
},
165+
},
161166
};
162167
</script>

0 commit comments

Comments
 (0)