matrix_components 2.0.365 → 2.0.366

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,263 +0,0 @@
1
- <template>
2
- <div class="demo-container">
3
- <div class="control-panel">
4
- <h3>Excel 预览演示</h3>
5
-
6
- <!-- 文件上传方式 -->
7
- <div class="upload-section">
8
- <h4>方式一:文件上传</h4>
9
- <el-form-item label="弹框模式:">
10
- <el-switch v-model="isShowDialog" @change="hideExcelHandler" />
11
- </el-form-item>
12
- <input
13
- type="file"
14
- @change="importExcel(($event.target as any)?.files?.[0])"
15
- accept=".xls,.xlsx"
16
- />
17
- <button @click="clearFile" :disabled="!file">清除文件</button>
18
- </div>
19
-
20
- <!-- URL方式 -->
21
- <div class="url-section">
22
- <h4>方式二:URL地址</h4>
23
- <input
24
- v-model="excelUrl"
25
- type="text"
26
- placeholder="请输入Excel文件的URL地址"
27
- class="url-input"
28
- />
29
- <button @click="loadFromUrl" :disabled="!excelUrl.trim()">加载URL</button>
30
- <button @click="clearUrl" :disabled="!excelUrl">清除URL</button>
31
- </div>
32
- <button @click="exportExcel" class="export-btn">导出数据</button>
33
- </div>
34
-
35
- <!-- Excel组件 -->
36
- <div class="excel-container">
37
- <NsExcel
38
- v-if="counts"
39
- class="excel"
40
- :file="file"
41
- :isShowDialog="isShowDialog"
42
- dialogWidth="1200px"
43
- dialogHeight="700px"
44
- ref="excelRef"
45
- exportType="2"
46
- @dialogExport="dialogExport"
47
- ></NsExcel>
48
- </div>
49
- <!-- 导出数据展示 -->
50
- <div class="data-display">
51
- <div class="data-section">
52
- <h4>导出数据格式1 (原始格式)</h4>
53
- <pre>{{ data1 }}</pre>
54
- </div>
55
- <div class="data-section">
56
- <h4>导出数据格式2 (Excel格式)</h4>
57
- <pre>{{ data2 }}</pre>
58
- </div>
59
- </div>
60
- </div>
61
- </template>
62
- <script setup lang="ts">
63
- import { nextTick, ref, watch } from 'vue'
64
-
65
- const counts = ref(true)
66
- const isShowDialog = ref(false)
67
- const file = ref()
68
- const excelRef = ref()
69
- const data1 = ref()
70
- const data2 = ref()
71
- const excelUrl = ref(
72
- 'https://501351981.github.io/vue-office/examples/dist/static/test-files/test.xlsx',
73
- )
74
-
75
- function hideExcelHandler(val: boolean) {
76
- counts.value = false
77
- nextTick(() => {
78
- counts.value = true
79
- isShowDialog.value = val
80
- })
81
- }
82
-
83
- function importExcel(f: any) {
84
- // 清除URL,使用文件上传
85
- excelUrl.value = ''
86
- file.value = f
87
- }
88
-
89
- function loadFromUrl() {
90
- if (excelUrl.value.trim()) {
91
- // 清除文件,使用URL
92
- file.value = excelUrl.value.trim()
93
- }
94
- }
95
-
96
- function clearFile() {
97
- file.value = null
98
- data1.value = null
99
- data2.value = null
100
- }
101
-
102
- function clearUrl() {
103
- excelUrl.value = ''
104
- data1.value = null
105
- data2.value = null
106
- }
107
-
108
- function dialogExport(data: any) {
109
- console.warn(`excel导出数据:${data}`)
110
- }
111
-
112
- function exportExcel() {
113
- if (excelRef.value) {
114
- data1.value = excelRef.value.exportExcel(1)
115
- data2.value = excelRef.value.exportExcel(2)
116
- }
117
- }
118
- </script>
119
- <style scoped lang="scss">
120
- .demo-container {
121
- padding: 20px;
122
- max-width: 1400px;
123
- margin: 0 auto;
124
- }
125
-
126
- .control-panel {
127
- background: #f5f5f5;
128
- padding: 20px;
129
- border-radius: 8px;
130
- margin-bottom: 20px;
131
-
132
- h3 {
133
- margin: 0 0 20px 0;
134
- color: #333;
135
- }
136
-
137
- h4 {
138
- margin: 15px 0 10px 0;
139
- color: #666;
140
- font-size: 14px;
141
- }
142
- }
143
-
144
- .upload-section,
145
- .url-section,
146
- .example-section {
147
- margin-bottom: 20px;
148
- padding: 15px;
149
- background: white;
150
- border-radius: 6px;
151
- border: 1px solid #e0e0e0;
152
-
153
- input[type='file'] {
154
- margin-right: 10px;
155
- }
156
-
157
- .url-input {
158
- width: 300px;
159
- padding: 8px 12px;
160
- border: 1px solid #ddd;
161
- border-radius: 4px;
162
- margin-right: 10px;
163
- font-size: 14px;
164
-
165
- &:focus {
166
- outline: none;
167
- border-color: #409eff;
168
- }
169
- }
170
-
171
- button {
172
- padding: 8px 16px;
173
- background: #409eff;
174
- color: white;
175
- border: none;
176
- border-radius: 4px;
177
- cursor: pointer;
178
- margin-right: 10px;
179
- font-size: 14px;
180
-
181
- &:hover:not(:disabled) {
182
- background: #337ecc;
183
- }
184
-
185
- &:disabled {
186
- background: #c0c4cc;
187
- cursor: not-allowed;
188
- }
189
- }
190
- }
191
-
192
- .export-btn {
193
- padding: 10px 20px;
194
- background: #67c23a;
195
- color: white;
196
- border: none;
197
- border-radius: 4px;
198
- cursor: pointer;
199
- font-size: 16px;
200
- font-weight: bold;
201
-
202
- &:hover {
203
- background: #5daf34;
204
- }
205
- }
206
-
207
- .excel {
208
- width: 100%;
209
- height: 500px;
210
- border: 1px solid #e0e0e0;
211
- border-radius: 8px;
212
- overflow: hidden;
213
- margin-bottom: 20px;
214
- }
215
-
216
- .data-display {
217
- display: flex;
218
- gap: 20px;
219
- margin-top: 20px;
220
-
221
- .data-section {
222
- flex: 1;
223
- background: #f9f9f9;
224
- border-radius: 8px;
225
- padding: 15px;
226
-
227
- h4 {
228
- margin: 0 0 10px 0;
229
- color: #333;
230
- font-size: 14px;
231
- }
232
-
233
- pre {
234
- background: white;
235
- padding: 15px;
236
- border-radius: 4px;
237
- border: 1px solid #e0e0e0;
238
- max-height: 300px;
239
- overflow: auto;
240
- font-size: 12px;
241
- line-height: 1.4;
242
- margin: 0;
243
- white-space: pre-wrap;
244
- word-wrap: break-word;
245
- }
246
- }
247
- }
248
-
249
- .excel-container {
250
- height: 300px;
251
- }
252
-
253
- @media (max-width: 768px) {
254
- .data-display {
255
- flex-direction: column;
256
- }
257
-
258
- .url-input {
259
- width: 100% !important;
260
- margin-bottom: 10px;
261
- }
262
- }
263
- </style>
@@ -1,423 +0,0 @@
1
- <template>
2
- <div class="demo-container">
3
- <div class="control-panel">
4
- <h3>动态表单组件演示</h3>
5
- <!-- 配置文件选择 -->
6
- <el-form :model="state" ref="formRef" label-position="left">
7
- <el-button type="primary" @click="getFormData">获取表单数据</el-button>
8
- <br>
9
- <span style="color: red">
10
- 结果:{{ state.formData }}
11
- </span>
12
- <br>
13
- <br>
14
- <NsFormTitle title="模型参数">
15
- <NsForm
16
- ref="row1Ref"
17
- :readOnly="state.readOnly"
18
- backgroundColor="#fff"
19
- :model="state.model"
20
- :rows="state.rows"
21
- formPropKey="rows"
22
- labelColor="#606266"
23
- labelWidth="150"
24
- gapH="20px"
25
- gapV="10px"
26
- ></NsForm>
27
- </NsFormTitle>
28
- <NsFormTitle title="视频配置">
29
- <NsForm
30
- ref="row2Ref"
31
- :readOnly="state.readOnly"
32
- backgroundColor="#fff"
33
- :model="state.model"
34
- :rows="state.rows2"
35
- formPropKey="rows2"
36
- labelColor="#606266"
37
- labelWidth="150"
38
- gapH="20px"
39
- gapV="10px"
40
- ></NsForm>
41
- </NsFormTitle>
42
- <NsFormTitle title="结果保存">
43
- <NsForm
44
- ref="row3Ref"
45
- :readOnly="state.readOnly"
46
- backgroundColor="#fff"
47
- :model="state.model"
48
- :rows="state.rows3"
49
- formPropKey="rows3"
50
- labelColor="#606266"
51
- labelWidth="150"
52
- gapH="20px"
53
- gapV="10px"
54
- ></NsForm>
55
- </NsFormTitle>
56
- </el-form>
57
- </div>
58
- </div>
59
- </template>
60
-
61
- <script setup lang="ts">
62
- import { ElInput, ElMessage, ElRadioGroup } from "element-plus";
63
- import { reactive, ref } from 'vue';
64
-
65
- const props = defineProps({
66
- readOnly: {
67
- type: Boolean,
68
- default: false,
69
- },
70
- row: {
71
- type: Object,
72
- default: () => ({}),
73
- },
74
- });
75
-
76
- const formRef = ref();
77
- const row1Ref = ref();
78
- const row2Ref = ref();
79
- const row3Ref = ref();
80
- const state = reactive({
81
- formData: {},
82
- readOnly: props.readOnly,
83
- model: props.readOnly ? "" : "vertical",
84
- // 第一种方式,在初始化前设置数据
85
- rows: [
86
- [
87
- {
88
- key: "confidence",
89
- label: "置信度",
90
- value: "",
91
- component: ElInput,
92
- params: {
93
- "v-length.range": {
94
- min: 0,
95
- max: 1,
96
- maxLength: 3 },
97
- rules: [
98
- {
99
- required: true,
100
- message: "请输入",
101
- },
102
- ],
103
- },
104
- },
105
- {
106
- key: "iou",
107
- label: "交并比",
108
- value: "",
109
- component: ElInput,
110
- params: {
111
- "v-length.range": {
112
- min: 0,
113
- max: 1,
114
- maxLength: 3 },
115
- rules: [
116
- {
117
- required: true,
118
- message: "请输入",
119
- },
120
- ],
121
- },
122
- },
123
- ],
124
- ],
125
- rows2: [
126
- [
127
- {
128
- key: "timeInterval",
129
- label: "时间间隔(秒)",
130
- value: "",
131
- component: ElInput,
132
- params: {
133
- "v-length.range": {
134
- min: 0,
135
- max: 6000,
136
- int: true
137
- },
138
- rules: [
139
- {
140
- required: true,
141
- message: "请输入",
142
- },
143
- ],
144
- },
145
- },
146
- {
147
- key: "stuck_threshold",
148
- label: "视频帧卡顿(秒)",
149
- value: "",
150
- component: ElInput,
151
- params: {
152
- "v-length.range": {
153
- min: 0,
154
- max: 1000,
155
- int: true
156
- },
157
- rules: [
158
- {
159
- required: true,
160
- message: "请输入",
161
- },
162
- ],
163
- },
164
- },
165
- ],
166
- [
167
- {
168
- key: "max_retries",
169
- label: "最大重连次数",
170
- value: "",
171
- component: ElInput,
172
- params: {
173
- "v-length.range": {
174
- min: 0,
175
- max: 100,
176
- int: true
177
- },
178
- rules: [
179
- {
180
- required: true,
181
- message: "请输入",
182
- },
183
- ],
184
- },
185
- },
186
- {
187
- value: ' '
188
- }
189
- ],
190
- ],
191
- rows3: [
192
- [
193
- {
194
- key: "save_video",
195
- label: "是否保存视频",
196
- value: '1',
197
- component: ElRadioGroup,
198
- params: {
199
- rules: [
200
- {
201
- required: true,
202
- message: "请选择",
203
- trigger: 'change'
204
- },
205
- ],
206
- options: [
207
- {
208
- value: '1',
209
- label: '是',
210
- },
211
- {
212
- value: '0',
213
- label: '否',
214
- },
215
- ]
216
- },
217
- },
218
- {
219
- key: "pre_buffer_second",
220
- label: "帧前缓存(秒)",
221
- value: "",
222
- component: ElInput,
223
- params: {
224
- "v-length.range": {
225
- min: 0,
226
- max: 1000,
227
- int: true
228
- },
229
- rules: [
230
- {
231
- required: true,
232
- message: "请输入",
233
- },
234
- ],
235
- },
236
- },
237
- ],
238
- [
239
- {
240
- key: "det_area_mode",
241
- label: "检测区域工作模式",
242
- value: 'normal',
243
- component: ElRadioGroup,
244
- events: {
245
- change: detAreaModeChange
246
- },
247
- params: {
248
- rules: [
249
- {
250
- required: true,
251
- message: "请选择",
252
- trigger: 'change'
253
- },
254
- ],
255
- options: [
256
- {
257
- value: 'normal',
258
- label: '常规检测(normal)',
259
- },
260
- {
261
- value: 'abnormal',
262
- label: '非常规检测(abnormal)',
263
- },
264
- ]
265
- },
266
- },
267
- ],
268
- ],
269
- });
270
-
271
- function detAreaModeChange(value: any) {
272
- if(value === 'abnormal') {
273
- if(state.rows3?.length && state.rows3[state.rows3.length - 1]?.[0]?.key === 'det_area_json'){
274
- state.rows3.pop()
275
- }
276
- state.rows3.push([{
277
- key: "det_area_json",
278
- label: "感兴趣区域",
279
- value: '',
280
- component: ElInput,
281
- span: 6,
282
- events: {
283
- change: (value) => getAreasHandler(value),
284
- },
285
- params: {
286
- rules: [
287
- {
288
- required: true,
289
- message: "请输入",
290
- trigger: 'change'
291
- },
292
- ],
293
- },
294
- }, {value: ' '}])
295
- }else {
296
- state.rows3.pop()
297
- }
298
- }
299
-
300
- function getAreasHandler(value: any) {
301
- state.rows3[state.rows3.length - 1][0].value = value
302
- }
303
-
304
- /**
305
- * 保存
306
- */
307
- async function getFormData() {
308
- try {
309
- await formRef.value.validate();
310
- } catch (error: any) {
311
- console.log(error);
312
- ElMessage.error('表单校验失败');
313
- state.formData = {}
314
- return false;
315
- }
316
- const data1 = row1Ref.value?.getKeyValuePairs?.(state.rows);
317
- const data2 = row2Ref.value?.getKeyValuePairs?.(state.rows2);
318
- const data3 = row3Ref.value?.getKeyValuePairs?.(state.rows3);
319
- const data = { ...data1, ...data2, ...data3 }
320
- state.formData = data;
321
- ElMessage.success('表单校验成功');
322
- return data;
323
- }
324
-
325
- </script>
326
-
327
- <style lang="scss" scoped>
328
- .demo-container {
329
- padding: 20px;
330
- max-width: 1400px;
331
- margin: 0 auto;
332
- }
333
-
334
- .control-panel {
335
- background: #f5f5f5;
336
- padding: 20px;
337
- border-radius: 8px;
338
- margin-bottom: 20px;
339
-
340
- h3 {
341
- margin: 0 0 20px 0;
342
- color: #333;
343
- }
344
-
345
- h4 {
346
- margin: 15px 0 10px 0;
347
- color: #666;
348
- font-size: 14px;
349
- }
350
- }
351
-
352
- .config-section,
353
- .upload-section,
354
- .action-section {
355
- margin-bottom: 20px;
356
- padding: 15px;
357
- background: white;
358
- border-radius: 6px;
359
- border: 1px solid #e0e0e0;
360
-
361
- .config-select {
362
- width: 300px;
363
- margin-right: 10px;
364
- }
365
-
366
- input[type='file'] {
367
- margin-right: 10px;
368
- }
369
-
370
- .el-button {
371
- margin-right: 10px;
372
- margin-bottom: 5px;
373
- }
374
- }
375
-
376
- .form-container {
377
- background: white;
378
- padding: 20px;
379
- border-radius: 8px;
380
- border: 1px solid #e0e0e0;
381
- margin-bottom: 20px;
382
- }
383
-
384
- .empty-state {
385
- text-align: center;
386
- padding: 60px 20px;
387
- background: white;
388
- border-radius: 8px;
389
- border: 1px solid #e0e0e0;
390
- }
391
-
392
- .data-card {
393
- margin-top: 20px;
394
-
395
- .card-header {
396
- display: flex;
397
- justify-content: space-between;
398
- align-items: center;
399
- }
400
-
401
- .form-data-display {
402
- background-color: #f5f7fa;
403
- padding: 15px;
404
- border-radius: 4px;
405
- font-size: 12px;
406
- line-height: 1.5;
407
- max-height: 400px;
408
- overflow-y: auto;
409
- }
410
- }
411
-
412
- @media (max-width: 768px) {
413
- .config-select {
414
- width: 100% !important;
415
- margin-bottom: 10px;
416
- }
417
-
418
- .el-button {
419
- width: 100%;
420
- margin-bottom: 10px;
421
- }
422
- }
423
- </style>
@@ -1,27 +0,0 @@
1
- <template>
2
- <NsImage :src="src" :apiUrl="apiUrl" :hasPreview="hasPreview">
3
- <img
4
- :src="ThemeVar.VARS.getPropertyValue('--matrix-empty-img')"
5
- style="width: 100%; height: 100%"
6
- @click.stop
7
- />
8
- </NsImage>
9
- </template>
10
-
11
- <script setup lang="ts">
12
- import { reactive, ref } from 'vue';
13
- import { ThemeVar } from '../../packages/utils/loadCssVars'
14
- const src = ref('')
15
- const hasPreview = ref(true)
16
- const apiUrl = reactive( {
17
- type: Object,
18
- default: ()=>({
19
- method: 'get',
20
- url: '/tool/file/getFileDetail',
21
- paramkey: 'fileIds',
22
- params: {},
23
- }),
24
- })
25
- </script>
26
- <style lang="scss" scoped>
27
- </style>