197
197
style =" width : 65px ;margin-right : 5px ;margin-bottom : 5px "
198
198
@input =" dataChange(index - 1, $event)" @change =" dataChangeDone" ><template #prepend >{{
199
199
index - 1
200
- }}</template ></el-input >
200
+ }}</template ></el-input >
201
201
</div >
202
202
</el-tab-pane >
203
203
@@ -276,7 +276,75 @@ const speicalDb = computed(() => {
276
276
}
277
277
return list
278
278
})
279
+ const props = defineProps <{
280
+ height: number
281
+ editIndex: string
282
+
283
+ }>()
284
+ // const start = toRef(props, 'start')
285
+ const h = toRef (props , ' height' )
286
+ const editIndex = toRef (props , ' editIndex' )
287
+ const dataBase = useDataStore ()
288
+ const gridOptions = computed (() => {
289
+ const v: VxeGridProps <CanInterAction > = {
290
+ border: true ,
291
+ size: " mini" ,
292
+ columnConfig: {
293
+ resizable: true ,
294
+ },
295
+ height: props .height ,
296
+ showOverflow: true ,
297
+ scrollY: {
298
+ enabled: true ,
299
+ gt: 0
300
+ },
301
+ rowConfig: {
302
+ isCurrent: true ,
279
303
304
+ },
305
+ editConfig: {
306
+ trigger: ' click' ,
307
+ mode: ' cell' ,
308
+ showIcon: false ,
309
+ beforeEditMethod({ rowIndex , column , row }) {
310
+ if (periodTimer .value [rowIndex ] == true ) {
311
+ return false
312
+ }
313
+ if (column .field == ' name' && row .database != undefined ) {
314
+ return false
315
+ }
316
+ return true
317
+ }
318
+ },
319
+ toolbarConfig: {
320
+ slots: {
321
+ tools: ' toolbar'
322
+ }
323
+ },
324
+ align: ' center' ,
325
+ columns: [
326
+ {
327
+ type: " seq" ,
328
+ width: 50 ,
329
+ title: " " ,
330
+ align: " center" ,
331
+ fixed: " left" ,
332
+ resizable: false ,
333
+ },
334
+ { field: ' send' , title: ' Send' , width: 100 , resizable: false , slots: { default: ' default_send' } },
335
+ { field: ' trigger' , title: ' Trigger' , width: 200 , resizable: false , slots: { default: ' default_trigger' } },
336
+ { field: ' name' , title: ' Name' , width: 100 , editRender: {}, slots: { edit: ' default_name' } },
337
+ { field: ' id' , title: ' ID (HEX)' , minWidth: 100 , editRender: {}, slots: { edit: ' default_id' } },
338
+ { field: ' channel' , title: ' Channel' , minWidth: 100 , editRender: {}, slots: { default: ' default_channel' , edit: ' edit_channel' } },
339
+ { field: ' type' , title: ' Type' , width: 100 , editRender: {}, slots: { default: ' default_type1' , edit: ' default_type' } },
340
+ { field: ' dlc' , title: ' DLC' , width: 100 , editRender: {}, slots: { edit: ' default_dlc' } },
341
+
342
+ ],
343
+ data: dataBase .ia [props .editIndex ]?.action || []
344
+
345
+ }
346
+ return v
347
+ })
280
348
function addFrame() {
281
349
const channel = Object .keys (devices .value )[0 ] || ' '
282
350
dataBase .ia [editIndex .value ].action .push ({
@@ -441,19 +509,35 @@ const devices = computed(() => {
441
509
const dd: Record <string , CanBaseInfo > = {}
442
510
for (const d in dataBase .devices ) {
443
511
if (dataBase .devices [d ] && dataBase .devices [d ].type == ' can' && dataBase .devices [d ].canDevice ) {
444
- dd [d ] = dataBase .devices [d ].canDevice
512
+ if (dataBase .ia [editIndex .value ].devices .includes (d )) {
513
+ dd [d ] = dataBase .devices [d ].canDevice
514
+ }
515
+
445
516
446
517
447
518
}
448
519
449
520
}
450
521
return dd
451
522
})
523
+ watch (devices , (val ) => {
524
+ // check channel
525
+ const action = dataBase .ia [editIndex .value ].action as CanInterAction []
526
+ const list = Object .keys (val )
527
+ for (const a of action ) {
528
+ if (! list .includes (a .channel )) {
529
+
530
+ a .channel = ' '
531
+ }
532
+
533
+ }
534
+ })
452
535
interface Option {
453
536
key: string
454
537
label: string
455
538
disabled: boolean
456
539
}
540
+
457
541
const allDeviceLabel = computed (() => {
458
542
const dd: Option [] = []
459
543
for (const d of Object .keys (devices .value )) {
@@ -485,15 +569,9 @@ function openPr(index: number) {
485
569
}
486
570
487
571
}
488
- const props = defineProps <{
489
- height: number
490
- editIndex: string
491
572
492
- }>()
493
- // const start = toRef(props, 'start')
494
- const h = toRef (props , ' height' )
495
573
watch (formData , (v ) => {
496
- v = cloneDeep (v )
574
+ v = cloneDeep (v )
497
575
if (v && popoverIndex .value != - 1 ) {
498
576
if (! isEqual (dataBase .ia [editIndex .value ].action [popoverIndex .value ], v )) {
499
577
Object .assign (dataBase .ia [editIndex .value ].action [popoverIndex .value ], v )
@@ -506,68 +584,7 @@ watch(formData, (v) => {
506
584
}, {
507
585
deep: true
508
586
})
509
- const editIndex = toRef (props , ' editIndex' )
510
- const dataBase = useDataStore ()
511
- const gridOptions = computed (() => {
512
- const v: VxeGridProps <CanInterAction > = {
513
- border: true ,
514
- size: " mini" ,
515
- columnConfig: {
516
- resizable: true ,
517
- },
518
- height: props .height ,
519
- showOverflow: true ,
520
- scrollY: {
521
- enabled: true ,
522
- gt: 0
523
- },
524
- rowConfig: {
525
- isCurrent: true ,
526
587
527
- },
528
- editConfig: {
529
- trigger: ' click' ,
530
- mode: ' cell' ,
531
- showIcon: false ,
532
- beforeEditMethod({ rowIndex , column , row }) {
533
- if (periodTimer .value [rowIndex ] == true ) {
534
- return false
535
- }
536
- if (column .field == ' name' && row .database != undefined ) {
537
- return false
538
- }
539
- return true
540
- }
541
- },
542
- toolbarConfig: {
543
- slots: {
544
- tools: ' toolbar'
545
- }
546
- },
547
- align: ' center' ,
548
- columns: [
549
- {
550
- type: " seq" ,
551
- width: 50 ,
552
- title: " " ,
553
- align: " center" ,
554
- fixed: " left" ,
555
- resizable: false ,
556
- },
557
- { field: ' send' , title: ' Send' , width: 100 , resizable: false , slots: { default: ' default_send' } },
558
- { field: ' trigger' , title: ' Trigger' , width: 200 , resizable: false , slots: { default: ' default_trigger' } },
559
- { field: ' name' , title: ' Name' , width: 100 , editRender: {}, slots: { edit: ' default_name' } },
560
- { field: ' id' , title: ' ID (HEX)' , minWidth: 100 , editRender: {}, slots: { edit: ' default_id' } },
561
- { field: ' channel' , title: ' Channel' , minWidth: 100 , editRender: {}, slots: { default: ' default_channel' , edit: ' edit_channel' } },
562
- { field: ' type' , title: ' Type' , width: 100 , editRender: {}, slots: { default: ' default_type1' , edit: ' default_type' } },
563
- { field: ' dlc' , title: ' DLC' , width: 100 , editRender: {}, slots: { edit: ' default_dlc' } },
564
-
565
- ],
566
- data: dataBase .ia [props .editIndex ]?.action || []
567
-
568
- }
569
- return v
570
- })
571
588
572
589
573
590
0 commit comments