wujingjing
2024-05-17 1c8b789894e34f697e23a1a82bdd4d17bb9323a6
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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
<template>
    <!-- 左侧分类目录树,上部表格操作 card,下部 table 数据展示 -->
    <div class="h100">
        <el-row :gutter="8" class="h100">
            <el-col :span="4" :xs="24" class="h100">
                <el-card shadow="hover" class="h100" v-loading="treeLoading">
                    <!-- 目录树 -->
                    <LeftTreeByMgr
                        class="h100 left-tree-card"
                        ref="leftTreeRef"
                        :treedata="listTreeData"
                        title-name="分组列表"
                        :show-more-operate="true"
                        :show-add="true"
                        :folderIcon="() => false"
                        :current-node-key="currentListID"
                        :expand-on-click-node="false"
                        :default-expand-all="true"
                        :show-sorter="true"
                        @click="handleClickNode"
                        :customDropdown="true"
                        @tree-add="openOperateGroupDialog"
                        @node-drag-end="dragNodeEnd"
                    >
                        <template #customDropdown="{ data, node }">
                            <el-dropdown-menu>
                                <el-dropdown-item>
                                    <el-button
                                        @click.stop="() => openOperateGroupDialog(data)"
                                        link
                                        type="primary"
                                        icon="ele-Edit"
                                        style="cursor: pointer"
                                    >
                                        编辑
                                    </el-button>
                                </el-dropdown-item>
                                <el-dropdown-item>
                                    <el-button link type="danger" @click.stop="() => deleteCurrentGroup(data)" icon="ele-Delete" style="cursor: pointer">
                                        删除
                                    </el-button>
                                </el-dropdown-item>
                                <el-dropdown-item>
                                    <el-button @click.stop="() => openParentDlg(data)" link type="primary" icon="ele-Menu" style="cursor: pointer">
                                        父级
                                    </el-button>
                                </el-dropdown-item>
                            </el-dropdown-menu>
                        </template>
                    </LeftTreeByMgr>
                </el-card>
            </el-col>
 
            <el-col :span="20" :xs="24" class="flex-column h100">
                <el-card shadow="hover" :body-style="{ paddingBottom: '0' }">
                    <!-- 查询、重置、排序、增加表单 -->
                    <el-form :inline="true" :model="parasQueryParams">
                        <el-form-item label="名称" prop="Name">
                            <el-input v-model="parasQueryParams.Name" style="width: 226.4px" placeholder="名称" clearable></el-input>
                        </el-form-item>
                        <el-form-item label="编码" prop="Code">
                            <el-input v-model="parasQueryParams.Code" style="width: 226.4px" placeholder="编码" clearable />
                        </el-form-item>
 
                        <el-form-item>
                            <el-button type="primary" icon="ele-Search" @click="handleQueryParasTable"> 查询 </el-button>
                            <el-button icon="ele-Refresh" @click="resetParasQuery">重置 </el-button>
                            <el-button icon="ele-Plus" @click="openOperateParasDialog()"> 增加 </el-button>
                        </el-form-item>
                        <el-form-item label="排序">
                            <el-switch
                                :disabled="displayParasTableData !== parasTableData"
                                v-model="isParasTableDrag"
                                @change="handleParasTableDrag"
                                inline-prompt
                                active-icon="ele-Check"
                                inactive-icon="ele-Close"
                            >
                            </el-switch>
                        </el-form-item>
                    </el-form>
                </el-card>
 
                <el-card class="flex-auto scroll-table-card" shadow="hover" style="margin-top: 8px">
                    <!-- 数据展示表格 -->
                    <el-table
                        v-loading="parasTableLoading"
                        ref="draggableTypeTableRef"
                        border
                        row-key="ID"
                        :row-class-name="isParasTableDrag ? 'cursor-move' : 'cursor-pointer'"
                        :cell-style="{ textAlign: 'center' }"
                        :header-cell-style="{ textAlign: 'center' }"
                        :data="displayParasTableData"
                        style="width: 100%"
                        highlight-current-row
                    >
                        <el-table-column prop="Name" width="240" label="名称" fixed="left" show-overflow-tooltip />
                        <el-table-column prop="Code" width="300" label="编码" show-overflow-tooltip />
                        <el-table-column prop="Format" label="格式" show-overflow-tooltip>
                            <template #default="scope">
                                {{ FORMAT_MAP[scope.row.Format] }}
                            </template>
                        </el-table-column>
                        <el-table-column prop="PValue" label="参数值" show-overflow-tooltip />
                        <el-table-column prop="Description" label="说明" width="550" show-overflow-tooltip />
                        <el-table-column label="操作" width="160" fixed="right" show-overflow-tooltip>
                            <template #default="scope">
                                <el-button icon="ele-Edit" size="small" text type="primary" @click="openOperateParasDialog(scope.row)">
                                    编辑
                                </el-button>
                                <el-button icon="ele-Delete" size="small" text type="danger" @click="deleteCurrentTypeRow(scope.row)">
                                    删除
                                </el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                </el-card>
            </el-col>
        </el-row>
        <el-dialog
            :destroy-on-close="true"
            v-model="groupDialogIsShow"
            width="400"
            :close-on-click-modal="false"
            @closed="closeGroupDialog"
        >
            <template #header>
                <div style="color: #fff">
                    <SvgIcon :name="groupDialogHeaderIcon" :size="16" style="margin-right: 3px; display: inline; vertical-align: middle" />
                    <span> {{ groupDialogTitle }} </span>
                </div>
            </template>
 
            <el-form :model="groupDialogFormValue" ref="groupDialogFormRef" :rules="groupDialogFormRules" label-width="55">
                <el-form-item label="父级" v-if="!isEditGroupDialog" prop="ParentID">
                    <el-tree-select
                        default-expand-all
                        filterable
                        style="width: 100%"
                        v-model="groupDialogFormValue.ParentID"
                        :props="{
                            id: 'ID',
                            label: 'Name',
                            children: 'Children',
                        }"
                        :data="listTreeData"
                        node-key="ID"
                        :clearable="true"
                        :accordion="true"
                        :expandNode="false"
                        :check-strictly="true"
                        placeholder="请选择父级"
                    >
                    </el-tree-select>
                </el-form-item>
                <el-form-item label="名称" prop="Name">
                    <el-input placeholder="请输入名称" v-model="groupDialogFormValue.Name"></el-input>
                </el-form-item>
 
                <el-form-item label="说明" prop="Description">
                    <el-input placeholder="请输入说明" v-model="groupDialogFormValue.Description" type="textarea" :rows="3" />
                </el-form-item>
            </el-form>
            <template #footer>
                <div>
                    <el-button @click="closeGroupDialog">取 消</el-button>
                    <el-button type="primary" @click="submitGroupFormValue">确 定</el-button>
                </div>
            </template>
        </el-dialog>
 
        <!-- 增加、修改数据对话框 -->
        <el-dialog
            :destroy-on-close="true"
            v-model="parasDialogIsShow"
            width="400"
            :close-on-click-modal="false"
            @closed="closeParasDialog"
        >
            <template #header>
                <div style="color: #fff">
                    <SvgIcon :name="parasDialogHeaderIcon" :size="16" style="margin-right: 3px; display: inline; vertical-align: middle" />
                    <span> {{ parasDialogTitle }} </span>
                </div>
            </template>
 
            <el-form :model="parasDialogFormValue" ref="parasDialogFormRef" :rules="parasDialogFormRules" label-width="78">
                <el-form-item label="名称" prop="Name">
                    <el-input placeholder="请输入名称" v-model="parasDialogFormValue.Name"></el-input>
                </el-form-item>
                <el-form-item label="编码" prop="Code">
                    <el-input placeholder="请输入唯一编码" v-model="parasDialogFormValue.Code"></el-input>
                </el-form-item>
                <el-form-item label="格式" prop="Format">
                    <el-select v-model="parasDialogFormValue.Format" class="w100" filterable @change="parasFormatChange">
                        <el-option
                            v-for="item of Object.keys(FORMAT_MAP)"
                            :key="item"
                            :label="FORMAT_MAP[item]"
                            :value="parseInt(item)"
                        ></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="参数值" prop="PValue">
                    <!-- 文本、多文本、数值、整数、长整数 -->
                    <el-input
                        v-if="INPUT_FORMAT.includes(parasDialogFormValue.Format)"
                        v-model="parasDialogFormValue.PValue"
                        v-bind="getInputProps(parasDialogFormValue.Format)"
                    ></el-input>
                    <!-- 时间输入(包括有 choice) -->
                    <el-date-picker
                        class="w100"
                        v-else-if="parasDialogFormValue.Format === PropertyFormatEnum.Time"
                        value-format="YYYY-MM-DD"
                        v-model="parasDialogFormValue.PValue"
                    >
                    </el-date-picker>
                    <!-- 布尔值输入 -->
                    <el-radio-group
                        class="w100"
                        v-else-if="parasDialogFormValue.Format === PropertyFormatEnum.Boolean"
                        v-model="parasDialogFormValue.PValue"
                    >
                        <el-radio label="true" :value="true">是</el-radio>
                        <el-radio label="false" :value="false">否</el-radio>
                    </el-radio-group>
                </el-form-item>
                <el-form-item label="说明" prop="Description">
                    <el-input placeholder="请输入说明" v-model="parasDialogFormValue.Description" type="textarea" :rows="3" />
                </el-form-item>
            </el-form>
            <template #footer>
                <div>
                    <el-button @click="closeParasDialog">取 消</el-button>
                    <el-button type="primary" @click="submitParasFormValue">确 定</el-button>
                </div>
            </template>
        </el-dialog>
        <ParentDialog
            v-model="parentDlgIsShow"
            :data="listTreeData"
            :api="parasGroupApi.UpdateBasicSysParasGroupTreeSortCode"
            :rowData="parentDlgMapRow"
            @submitSuccess="submitParentForm"
        >
        </ParentDialog>
    </div>
</template>
 
<script setup lang="ts">
import type { PropType } from 'vue';
import { ref, computed, onMounted, nextTick } from 'vue';
import LeftTreeByMgr from '/@/components/tree/leftTreeByMgr.vue';
 
import * as parasApi from '/@/api/basic/sys/sysParas';
import * as parasGroupApi from '/@/api/basic/sys/sysParasGroup';
import { FORMAT_MAP, PropertyFormatEnum, INPUT_FORMAT } from '/@/projectCom/basic/types';
 
import type { FormInstance, FormRules } from 'element-plus';
import { ElMessage, ElMessageBox } from 'element-plus';
import { useQueryTable } from '/@/hooks/useQueryTable';
import { updateSort, useTableSort } from '/@/hooks/useTableSort';
import { useValidateUniqueness } from '/@/hooks/useValidateUniqueness';
import { deepClone } from '/@/utils/other';
import { EXTEND_TYPE_MAP } from '/@/projectCom/basic/types';
import type { AxiosRequestConfig, AxiosResponse } from 'axios';
import ParentDialog from '/@/components/dialog/parentDialog/ParentDialog.vue';
import { arrayIsEmpty, convertListToTree, flatten } from '/@/utils/util';
import { booleanRegex, dateRegex, integerRegex, numberRegex } from '/@/utils/toolsValidate';
 
const props = defineProps({
    request: {
        type: Function as PropType<(config: AxiosRequestConfig<any>) => Promise<AxiosResponse<any, any>>>,
    },
});
//#region ====================== 左侧树数据,tree init ======================
const leftTreeRef = ref(null);
const treeLoading = ref(false);
const listTreeData = ref([]);
const currentListID = ref('');
const currentNode = ref(null);
const handleClickNode = (data) => {
    nextTick(() => {
        leftTreeRef.value?.treeRef.setCurrentKey(data.ID);
    });
    currentListID.value = data.ID;
    currentNode.value = data;
    getTypeTableData();
};
const getListTreeData = async (selectFirst = false) => {
    treeLoading.value = true;
    const res = await parasGroupApi.GetAllBasicSysParasGroup(props.request).finally(() => {
        treeLoading.value = false;
    });
    if (res?.Code === 0) {
        listTreeData.value = convertListToTree(res.Data) || [];
        if (selectFirst) {
            const firstListTreeNode = listTreeData.value[0];
            if (firstListTreeNode) {
                handleClickNode(firstListTreeNode);
            } else {
                parasTableData.value = [];
                currentNode.value = null;
                currentListID.value = null;
            }
        } else {
            currentNode.value && handleClickNode(currentNode.value);
        }
    } else {
        ElMessage.error('获取分组失败' + (res?.Message ? `,${JSON.stringify(res.Message)}` : ''));
    }
};
//#endregion
//#region ====================== 获取、删除表格数据 ======================
const parasTableLoading = ref(false);
const parasTableData = ref([]);
const isParasTableDrag = ref(false);
const getTypeTableData = async () => {
    parasTableLoading.value = true;
    const res = await parasApi.GetBasicSysParasByGroupID({ GroupID: currentListID.value }, props.request).finally(() => {
        parasTableLoading.value = false;
    });
    if (res?.Code === 0) {
        parasTableData.value = res.Data || [];
    } else {
        ElMessage.error('获取系统参数失败' + (res?.Message ? `,${JSON.stringify(res.Message)}` : ''));
    }
};
const deleteCurrentTypeRow = (row: any) => {
    ElMessageBox.confirm(`确定删除系统参数:【${row.Name}】?`, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
    }).then(async () => {
        const res = await parasApi.DeleteABasicSysParas(
            {
                ID: row.ID,
            },
            props.request
        );
        if (res?.Code === 0) {
            if (res.Data) {
                ElMessage.success('删除系统参数成功');
                getTypeTableData();
            } else {
                ElMessage.error('删除系统参数失败');
            }
        } else {
            ElMessage.error('删除系统参数失败' + (res?.Message ? `,${JSON.stringify(res.Message)}` : ''));
        }
    });
};
//#endregion
 
//#region ====================== 搜索表格,对表格排序 ======================
const parasQueryParams = ref({
    Name: '',
    Code: '',
});
const { handleDragStatus: handleParasTableDrag, draggableTableRef: draggableTypeTableRef } = useTableSort(
    parasTableData,
    parasApi.UpdateBasicSysParasSorter,
    getTypeTableData,
    undefined,
    false,
    props.request
);
 
const {
    resetQuery: resetParasQuery,
    handleQueryTable: handleQueryParasTable,
    displayTableData: displayParasTableData,
} = useQueryTable(parasTableData, parasQueryParams, getTypeTableData);
//#endregion
 
//#region ====================== 增加、修改表格记录操作, dialog init======================
const isEditTypeDialog = ref(false);
const parasDialogTitle = computed(() => {
    return isEditTypeDialog.value ? '修改系统参数' : '添加系统参数';
});
const parasDialogHeaderIcon = computed(() => {
    return isEditTypeDialog.value ? 'ele-Edit' : 'ele-Plus';
});
const parasDialogFormValue = ref({
    Name: '',
    Code: '',
}) as any;
const parasDialogIsShow = ref(false);
const parasDialogFormRef = ref<FormInstance>(null);
const parasInitialCode = ref('');
const { uniquenessValidator: parasCodeValidator } = useValidateUniqueness(
    parasApi.GetIsExistBasicSysParasCode,
    parasInitialCode,
    '编码',
    'Code',
    undefined,
    false,
    props.request
);
 
const pValueValidator = (rule, value, callback) => {
    if (!value) {
        callback('必填项!');
    } else if (value && parasDialogFormValue.value.Format === PropertyFormatEnum.Numeric && !numberRegex.test(value)) {
        callback('请输入数字!');
    } else if (
        value &&
        [PropertyFormatEnum.Bigint, PropertyFormatEnum.Integer].includes(parasDialogFormValue.value.Format) &&
        !integerRegex.test(value)
    ) {
        callback('请输入整数!');
    } else if (value && PropertyFormatEnum.Time === parasDialogFormValue.value.Format && !dateRegex.test(value)) {
        callback('请输入正确的日期格式(yyyy-MM-dd HH:mm:ss 或 yyyy-MM-dd)');
    } else if (value && PropertyFormatEnum.Boolean === parasDialogFormValue.value.Format && !booleanRegex.test(value)) {
        callback('请输入 true 或 false');
    } else {
        callback();
    }
};
 
const parasDialogFormRules = ref<FormRules>({
    Name: [{ required: true, message: '请输入名称', trigger: 'blur' }],
    Code: [{ required: true, validator: parasCodeValidator as any, trigger: 'blur' }],
    Format: [{ required: true, message: '请选择格式', trigger: 'change' }],
    PValue: [{ required: true, validator: pValueValidator as any, trigger: 'blur' }],
});
const openOperateParasDialog = (row?) => {
    if (!currentListID.value) {
        return ElMessage.warning('请先选择分组!');
    }
    if (row) {
        isEditTypeDialog.value = true;
        const { ID, Name, Code, Description, Format, PValue } = row;
        parasInitialCode.value = Code;
        parasDialogFormValue.value = deepClone({ ID, Name, Code, Description, Format, PValue });
    } else {
        isEditTypeDialog.value = false;
        parasInitialCode.value = '';
 
        parasDialogFormValue.value = {
            GroupID: currentListID.value,
            Name: '',
            Code: '',
            Description: '',
            Format: PropertyFormatEnum.Integer,
            PValue: '',
        };
    }
    parasDialogIsShow.value = true;
};
 
const closeParasDialog = () => {
    parasDialogIsShow.value = false;
    parasDialogFormRef.value.clearValidate();
};
 
const submitParasFormValue = async () => {
    const valid = await parasDialogFormRef.value.validate().catch(() => {});
    if (!valid) return;
 
    if (isEditTypeDialog.value) {
        const res = await parasApi.UpdateABasicSysParas(parasDialogFormValue.value, props.request);
        if (res?.Code === 0) {
            if (res.Data) {
                getTypeTableData();
                parasDialogIsShow.value = false;
                ElMessage.success('修改系统参数成功');
            } else {
                ElMessage.error('修改系统参数失败');
            }
        } else {
            ElMessage.error('修改系统参数失败' + (res?.Message ? `,${JSON.stringify(res.Message)}` : ''));
        }
    } else {
        const res = await parasApi.InsertABasicSysParas(parasDialogFormValue.value, props.request);
        if (res?.Code === 0) {
            if (res.Data) {
                getTypeTableData();
                parasDialogIsShow.value = false;
                ElMessage.success('添加系统参数成功');
            } else {
                ElMessage.error('添加系统参数失败');
            }
        } else {
            ElMessage.error('添加系统参数失败' + (res?.Message ? `,${JSON.stringify(res.Message)}` : ''));
        }
    }
};
//#endregion
 
//#region ====================== 删除左侧树系统分组数据 ======================
 
const deleteCurrentGroup = (row: any) => {
    ElMessageBox.confirm(`确定删除系统分组:【${row.Name}】?`, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
    }).then(async () => {
        const res = await parasGroupApi.DeleteABasicSysParasGroup(
            {
                ID: row.ID,
            },
            props.request
        );
        if (res?.Code === 0) {
            if (res.Data) {
                ElMessage.success('删除系统分组成功');
                getListTreeData(true);
            } else {
                ElMessage.error('删除系统分组失败');
            }
        } else {
            ElMessage.error('删除系统分组失败' + (res?.Message ? `,${JSON.stringify(res.Message)}` : ''));
        }
    });
};
//#endregion
 
//#region ====================== 增加、删除系统分组操作, dialog init======================
const isEditGroupDialog = ref(false);
const groupDialogTitle = computed(() => {
    return isEditGroupDialog.value ? '修改系统分组' : '添加系统分组';
});
const groupDialogHeaderIcon = computed(() => {
    return isEditGroupDialog.value ? 'ele-Edit' : 'ele-Plus';
});
const groupDialogFormValue = ref({
    Name: '',
    Code: '',
    Description: '',
}) as any;
const groupDialogIsShow = ref(false);
const groupDialogFormRef = ref<FormInstance>(null);
 
const groupDialogFormRules = ref<FormRules>({
    Name: [{ required: true, message: '请输入名称', trigger: 'blur' }],
});
const openOperateGroupDialog = (data?) => {
    if (data) {
        isEditGroupDialog.value = true;
        const { ID, Name, Code, Description } = data;
        groupDialogFormValue.value = deepClone({ ID, Name, Code, Description });
    } else {
        isEditGroupDialog.value = false;
        groupDialogFormValue.value = { Name: '', Code: '', Description: '' };
    }
    groupDialogIsShow.value = true;
};
 
const closeGroupDialog = () => {
    groupDialogIsShow.value = false;
    groupDialogFormRef.value.clearValidate();
};
 
const submitGroupFormValue = async () => {
    const valid = await groupDialogFormRef.value.validate().catch(() => {});
    if (!valid) return;
 
    if (isEditGroupDialog.value) {
        const res = await parasGroupApi.UpdateABasicSysParasGroup(groupDialogFormValue.value, props.request);
        if (res?.Code === 0) {
            if (res.Data) {
                getListTreeData();
                groupDialogIsShow.value = false;
                ElMessage.success('修改系统分组成功');
            } else {
                ElMessage.error('修改系统分组失败');
            }
        } else {
            ElMessage.error('修改系统分组失败' + (res?.Message ? `,${JSON.stringify(res.Message)}` : ''));
        }
    } else {
        const res = await parasGroupApi.InsertABasicSysParasGroup(groupDialogFormValue.value, props.request);
        if (res?.Code === 0) {
            if (res.Data) {
                getListTreeData(arrayIsEmpty(listTreeData.value));
                groupDialogIsShow.value = false;
                ElMessage.success('添加系统分组成功');
            } else {
                ElMessage.error('添加系统分组失败');
            }
        } else {
            ElMessage.error('添加系统分组失败' + (res?.Message ? `,${JSON.stringify(res.Message)}` : ''));
        }
    }
};
//#endregion
 
//#region ====================== 左侧树拖拽 ======================
const dragNodeEnd = async (draggingNode, dropNode, dropType, ev, originTreeData) => {
    updateSort(
        listTreeData,
        flatten(listTreeData.value),
        originTreeData,
        () => {
            handleClickNode(draggingNode.data);
            getListTreeData();
        },
        parasGroupApi.UpdateBasicSysParasGroupSorter,
        () => {
            handleClickNode(draggingNode.data);
        },
        undefined,
        props.request
    );
};
//#endregion
 
//#region ====================== 挂载时获取初始数据 ======================
onMounted(() => {
    getListTreeData(true);
});
//#endregion
 
//#region ====================== 修改父级 ======================
const parentDlgIsShow = ref(false);
const parentDlgMapRow = ref(null);
const openParentDlg = (row?) => {
    parentDlgMapRow.value = row;
    parentDlgIsShow.value = true;
};
const submitParentForm = (res) => {
    getListTreeData();
};
//#endregion
const getInputProps = (format: PropertyFormatEnum) => {
    let inputProps = {};
    switch (format) {
        case PropertyFormatEnum.MultiText:
            inputProps = {
                type: 'textarea',
                row: 3,
            };
    }
    return {
        ...inputProps,
    } as any;
};
 
const parasFormatChange = () => {
    parasDialogFormValue.value.PValue = '';
};
</script>
<style scoped lang="scss"></style>