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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
| <template>
| <div style="width: 100%; height: 100%">
| <div class="left-top" v-if="disForm == '行政区划仿真'">
| 行政区划仿真(30m精度)
| </div>
| <div class="left-top" v-if="disForm == '重点区域仿真'">
| 重点区域仿真(10m精度)
| </div>
| <div class="forms">
| <el-form :model="forms" label-width="auto" style="max-width: 600px">
| <el-form-item label="行政区域:" v-if="disForm == '行政区划仿真'">
| <el-select
| v-model="forms.eare"
| placeholder="Select"
| style="max-width: 600px"
| >
| <el-option
| v-for="item in cityOptions"
| :key="item.value"
| :label="item.label"
| :value="item.value"
| />
| </el-select>
| </el-form-item>
| <el-form-item label="上传参数">
| <el-upload
| v-model:file-list="forms.fileList"
| class="upload-demo"
| action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15"
| multiple
| :on-preview="handlePreview"
| :on-remove="handleRemove"
| :before-remove="beforeRemove"
| :limit="3"
| :on-exceed="handleExceed"
| :before-upload="beforeUpload"
| accept=".xlsx,.xls,.csv"
| >
| <el-button type="primary">点击上传降雨数据</el-button>
| <template #append>mm/h</template>
| </el-upload>
| </el-form-item>
| <el-form-item label="重点区域" v-if="disForm == '重点区域仿真'">
| <el-select
| v-model="forms.eares"
| placeholder="Select"
| style="max-width: 600px"
| >
| <el-option
| v-for="item in earesOptions"
| :key="item.value"
| :label="item.label"
| :value="item.value"
| />
| </el-select>
| </el-form-item>
|
| <el-form-item label="降雨量:">
| <el-input
| v-model="forms.rainfall"
| style="max-width: 600px"
| placeholder="Please input"
| >
| <template #append>mm</template>
| </el-input>
| </el-form-item>
| <el-form-item label="降雨时长:">
| <el-input
| v-model="forms.duration"
| style="max-width: 600px"
| placeholder="Please input"
| >
| <template #append>h</template>
| </el-input></el-form-item
| >
| <el-form-item label="降雨强度:">
| <el-input
| v-model="forms.intensity"
| style="max-width: 600px"
| placeholder="Please input"
| >
| <template #append>mm/h</template>
| </el-input>
| </el-form-item>
| <el-form-item label="仿真参数:"> </el-form-item>
| </el-form>
| <div style="display: flex; justify-content: flex-end">
| <el-button>保存方案</el-button>
| <el-button @click="startPlay">开始模拟</el-button>
| </div>
| </div>
| </div>
| </template>
| <script setup>
| import { reactive, ref, watch } from "vue";
| import { initeWaterPrimitiveView } from "@/utils/water";
|
| const emit = defineEmits(["start", "end"]);
| function endPlay() {
| emit("end");
| }
|
| function startPlay() {
| initeWaterPrimitiveView();
| emit("start");
| }
|
| const value = ref("");
|
| const cityOptions = [
| {
| value: "北京市",
| label: "北京市",
| },
| {
| value: "东城区",
| label: "东城区",
| },
| {
| value: "西城区",
| label: "西城区",
| },
| {
| value: "朝阳区",
| label: "朝阳区",
| },
| {
| value: "海淀区",
| label: "海淀区",
| },
| {
| value: "丰台区",
| label: "丰台区",
| },
| {
| value: "石景山区",
| label: "石景山区",
| },
| {
| value: "门头沟区",
| label: "门头沟区",
| },
| {
| value: "房山区",
| label: "房山区",
| },
| {
| value: "通州区",
| label: "通州区",
| },
| {
| value: "顺义区",
| label: "顺义区",
| },
| {
| value: "昌平区",
| label: "昌平区",
| },
| {
| value: "大兴区",
| label: "大兴区",
| },
| {
| value: "怀柔区",
| label: "怀柔区",
| },
| {
| value: "平谷区",
| label: "平谷区",
| },
| {
| value: "密云区",
| label: "密云区",
| },
| {
| value: "延庆区",
| label: "延庆区",
| },
| ];
| const earesOptions = [
| {
| value: "孙胡沟",
| label: "孙胡沟",
| },
| {
| value: "鱼水洞后沟",
| label: "鱼水洞后沟",
| },
| {
| value: "于家西沟",
| label: "于家西沟",
| },
| {
| value: "北河沟",
| label: "北河沟",
| },
| {
| value: "龙泉峪村",
| label: "龙泉峪村",
| },
| ];
|
| const forms = reactive({
| eare: "北京市",
| eares: "孙胡沟",
| rainfall: "50",
| duration: "5",
| intensity: "70",
| fileList: [],
| });
|
| function handleRemove(file, uploadFiles) {
| console.log(file, uploadFiles);
| }
|
| function handlePreview(uploadFile) {
| console.log(uploadFile);
| }
|
| function handleExceed(files, uploadFiles) {
| ElMessage.warning(
| `The limit is 3, you selected ${files.length} files this time, add up to ${
| files.length + uploadFiles.length
| } totally`
| );
| }
| const beforeUpload = (file) => {
| const allowedTypes = [
| "application/vnd.ms-excel",
| "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
| "text/csv",
| "application/csv",
| "text/x-csv",
| "application/x-csv",
| "text/comma-separated-values",
| "text/x-comma-separated-values",
| ];
|
| const isAllowed = allowedTypes.includes(file.type);
| const extension = file.name.split(".").pop().toLowerCase();
| const isExtensionValid = ["xls", "xlsx", "csv"].includes(extension);
|
| if (!isAllowed || !isExtensionValid) {
| ElMessage.error("只能上传 Excel (.xls, .xlsx) 或 CSV 文件");
| return false; // 阻止上传
| }
|
| return true; // 允许上传
| };
|
| function beforeRemove(uploadFile, uploadFiles) {
| return ElMessageBox.confirm(
| `Cancel the transfer of ${uploadFile.name} ?`
| ).then(
| () => true,
| () => false
| );
| }
|
| const disForm = ref("");
|
| // 定义 Props
| const props = defineProps({
| clickValue: String,
| });
|
| // 监听 Props 变化
| watch(
| () => props.clickValue,
| (newValue) => {
| disForm.value = newValue || "行政区划仿真";
| },
| { immediate: true, deep: true }
| );
| </script>
| <style lang="less" scoped>
| .forms {
| background: url("@/assets/img/screen/leftbg.png");
| margin-top: 10px;
| width: 100%;
| height: 100%;
| padding: 10px 10px 0px 0px;
| box-sizing: border-box;
| }
| /deep/ .el-input-group__append,
| .el-input-group__prepend {
| background-color: #084b42;
| color: #fff;
| }
| /deep/ .el-form-item__label {
| color: #61f7d4 !important;
| }
| </style>
|
|