WXL
9 小时以前 0c03027d7f238bf5beb98e85463f53f0bd92bbaa
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
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
<template>
  <div class="meeting-management">
    <!-- 页面头部 -->
    <div class="page-header">
      <div class="header-actions">
        <el-button type="primary" icon="el-icon-plus" @click="handleAdd">
          新建会议
        </el-button>
        <el-button icon="el-icon-download" @click="exportData">
          导出数据
        </el-button>
      </div>
    </div>
 
    <!-- 搜索筛选区域 -->
    <el-card class="filter-card">
      <el-form :model="queryParams" inline>
        <el-form-item label="会议类型">
          <el-select
            v-model="queryParams.meetingType"
            clearable
            placeholder="请选择"
          >
            <el-option label="科研会议" value="research" />
            <el-option label="日常会议" value="daily" />
            <el-option label="项目会议" value="project" />
            <el-option label="部门会议" value="department" />
            <el-option label="评审会议" value="review" />
          </el-select>
        </el-form-item>
        <el-form-item label="会议地点">
          <el-input
            v-model="queryParams.location"
            placeholder="请输入会议地点"
            clearable
            style="width: 150px"
          />
        </el-form-item>
        <el-form-item label="会议开始时间范围">
          <el-date-picker
            v-model="queryParams.dateRange"
            type="daterange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            value-format="yyyy-MM-dd"
          />
        </el-form-item>
        <el-form-item label="状态">
          <el-select
            v-model="queryParams.status"
            clearable
            placeholder="请选择"
          >
            <el-option label="待开始" value="1" />
            <el-option label="进行中" value="2" />
            <el-option label="已结束" value="3" />
            <el-option label="已取消" value="4" />
            <el-option label="待审核" value="0" />
            <el-option label="已通过" value="1" />
            <el-option label="已驳回" value="2" />
          </el-select>
        </el-form-item>
        <el-form-item label="会议主题">
          <el-input
            v-model="queryParams.title"
            placeholder="请输入会议主题"
            clearable
            style="width: 150px"
          />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="handleQuery">查询</el-button>
          <el-button @click="handleReset">重置</el-button>
        </el-form-item>
      </el-form>
    </el-card>
 
    <!-- 数据表格 -->
    <el-card>
      <el-table
        :data="tableData"
        v-loading="loading"
        border
        style="width: 100%"
        @sort-change="handleSortChange"
      >
        <el-table-column prop="id" label="ID" width="80" fixed align="center" />
        <el-table-column
          prop="title"
          align="center"
          label="会议主题"
          width="200"
          fixed
        >
          <template #default="scope">
            <el-button type="text" @click="handleView(scope.row.id)">
              {{ scope.row.title }}
            </el-button>
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          prop="meetingType"
          label="会议类型"
          width="120"
        >
          <template #default="scope">
            <el-tag :type="getMeetingTypeTag(scope.row.typeId)">
              {{ getMeetingTypeText(scope.row.typeId) }}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          label="会议状态"
          width="100"
          fixed="right"
        >
          <template #default="scope">
            <el-tag :type="getMeetingStatusTag(scope.row.status)">
              {{ getMeetingStatusText(scope.row.status) }}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          prop="organizerName"
          label="组织者"
          width="120"
          ><template #default="scope">
            <span>{{ scope.organizerName || scope.createBy }}</span>
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          prop="locationName"
          label="会议地点"
          width="150"
        />
        <el-table-column
          align="center"
          prop="startTime"
          label="开始时间"
          width="160"
          sortable
        >
          <template #default="scope">
            <span>{{ formatDateTime(scope.row.startTime) }}</span>
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          prop="endTime"
          label="结束时间"
          width="160"
          sortable
        >
          <template #default="scope">
            <span>{{ formatDateTime(scope.row.endTime) }}</span>
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          prop="duration"
          label="持续时间"
          width="100"
        >
          <template #default="scope">
            <span>{{ calculateDuration(scope.row) }}</span>
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          prop="summary"
          label="会议概要"
          min-width="200"
          show-overflow-tooltip
        />
        <el-table-column align="center" label="会议纪要" width="120">
          <template #default="scope">
            <el-button
              size="mini"
              type="text"
              @click="handleViewMinutes(scope.row)"
              :disabled="!scope.row.recordcontent"
            >
              {{ scope.row.recordcontent ? "查看纪要" : "暂无" }}
            </el-button>
          </template>
        </el-table-column>
        <el-table-column align="center" label="审核状态" width="100">
          <template #default="scope">
            <el-tag :type="getApprovalStatusTag(scope.row.approvalStatus)">
              {{ getApprovalStatusText(scope.row.approvalStatus) }}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column label="操作" align="center" width="200" fixed="right">
          <template #default="scope">
            <el-button
              size="mini"
              type="text"
              @click="handleView(scope.row.id)"
            >
              查看
            </el-button>
            <el-button
              size="mini"
              type="text"
              @click="handleEdit(scope.row.id)"
              :disabled="scope.row.delFlag === 1"
            >
              编辑
            </el-button>
            <el-button
              size="mini"
              type="text"
              @click="handleCopy(scope.row.id)"
              style="color: #67C23A;"
              :disabled="scope.row.delFlag === 1"
            >
              复制
            </el-button>
            <el-button
              size="mini"
              type="text"
              @click="handleDelete(scope.row)"
              style="color: #F56C6C;"
              :disabled="scope.row.delFlag === 1"
            >
              删除
            </el-button>
          </template>
        </el-table-column>
      </el-table>
 
      <!-- 分页 -->
      <div class="pagination-container">
        <el-pagination
          :current-page="pagination.pageNum"
          :page-size="pagination.pageSize"
          :total="pagination.total"
          layout="total, sizes, prev, pager, next, jumper"
          :page-sizes="[10, 20, 50, 100]"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
        />
      </div>
    </el-card>
 
    <!-- 会议纪要对话框 -->
    <el-dialog
      title="会议纪要"
      :visible.sync="minutesDialogVisible"
      width="700px"
    >
      <div v-if="currentRecord.recordcontent">
        <el-alert
          title="会议纪要详情"
          type="info"
          :closable="false"
          style="margin-bottom: 16px;"
        />
        <div class="minutes-content">
          <el-card>
            <div
              style="white-space: pre-line; line-height: 1.6; max-height: 300px; overflow-y: auto;"
            >
              {{ currentRecord.recordcontent }}
            </div>
          </el-card>
        </div>
 
        <!-- 会议纪要附件展示 -->
        <div class="detail-attachments">
          <div
            v-if="parseAttachments(currentRecord.recordattachment).length > 0"
            class="attachment-grid"
          >
            <div
              v-for="file in parseAttachments(currentRecord.recordattachment)"
              :key="file.id || file.name"
              class="attachment-card"
            >
              <template v-if="isImageFile(file)">
                <!-- 图片使用 el-image 预览 -->
                <el-image
                  class="image-attachment"
                  :src="getFileUrl(file)"
                  :preview-src-list="getImagePreviewList(file)"
                  fit="cover"
                  :style="{ width: imageSize, height: imageSize }"
                  lazy
                >
                  <div slot="error" class="image-error">
                    <i class="el-icon-picture-outline"></i>
                    <span>加载失败</span>
                  </div>
                  <div slot="placeholder" class="image-loading">
                    <i class="el-icon-loading"></i>
                  </div>
                </el-image>
                <div class="image-info">
                  <div class="file-name" :title="file.name">
                    {{ file.name }}
                  </div>
                  <div class="file-actions">
                    <el-button
                      type="text"
                      size="mini"
                      @click="handleDownload(file)"
                      icon="el-icon-download"
                      title="下载"
                    />
                    <el-button
                      type="text"
                      size="mini"
                      @click="handlePreview(file)"
                      icon="el-icon-view"
                      title="预览"
                    />
                  </div>
                </div>
              </template>
 
              <template v-else>
                <!-- 非图片文件保持原有样式 -->
                <el-card shadow="hover" class="file-card">
                  <div class="file-content">
                    <i
                      :class="getFileIcon(file.type || file.name)"
                      class="file-icon"
                    ></i>
                    <div class="file-info">
                      <div class="file-name" :title="file.name">
                        {{ file.name }}
                      </div>
                      <div class="file-meta">
                        <span class="file-type">{{
                          getFileTypeText(file)
                        }}</span>
                        <span class="file-size" v-if="file.size">
                          {{ formatFileSize(file.size) }}
                        </span>
                      </div>
                    </div>
                  </div>
                  <div class="file-actions" v-if="file.url">
                    <el-button
                      type="text"
                      size="mini"
                      @click="handleDownload(file)"
                    >
                      下载
                    </el-button>
                    <el-button
                      v-if="canPreview(file)"
                      type="text"
                      size="mini"
                      @click="handlePreview(file)"
                    >
                      预览
                    </el-button>
                  </div>
                </el-card>
              </template>
            </div>
          </div>
        </div>
 
        <div
          class="minutes-meta"
          style="margin-top: 16px; color: #909399; font-size: 12px;"
        >
          <span
            >记录时间: {{ formatDateTime(currentRecord.recorderTime) }}</span
          >
          <span style="margin-left: 16px;"
            >记录人: {{ currentRecord.recorderBy || "未指定" }}</span
          >
        </div>
      </div>
      <div v-else>
        <el-empty description="暂无会议纪要"></el-empty>
      </div>
      <span slot="footer">
        <el-button @click="minutesDialogVisible = false">关闭</el-button>
        <el-button
          type="primary"
          @click="handleEdit(currentRecord.id)"
          v-if="currentRecord.recordcontent"
        >
          编辑纪要
        </el-button>
      </span>
    </el-dialog>
 
    <!-- 查看详情对话框 -->
    <el-dialog
      :title="`会议详情 - ${currentRecord.title || ''}`"
      :visible.sync="detailDialogVisible"
      width="800px"
      :before-close="handleDetailClose"
    >
      <el-descriptions :column="2" border v-if="currentRecord.id">
        <el-descriptions-item label="会议编号">{{
          currentRecord.meetingNumber
        }}</el-descriptions-item>
        <el-descriptions-item label="会议主题">{{
          currentRecord.title
        }}</el-descriptions-item>
        <el-descriptions-item label="会议类型">
          <el-tag :type="getMeetingTypeTag(currentRecord.typeId)">
            {{ getMeetingTypeText(currentRecord.typeId) }}
          </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="会议状态">
          <el-tag :type="getMeetingStatusTag(currentRecord.status)">
            {{ getMeetingStatusText(currentRecord.status) }}
          </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="组织者">{{
          currentRecord.organizerName || currentRecord.createBy
        }}</el-descriptions-item>
        <el-descriptions-item label="会议地点">{{
          currentRecord.locationName || currentRecord.locationId
        }}</el-descriptions-item>
        <el-descriptions-item label="开始时间">{{
          formatDateTime(currentRecord.startTime)
        }}</el-descriptions-item>
        <el-descriptions-item label="结束时间">{{
          formatDateTime(currentRecord.endTime)
        }}</el-descriptions-item>
        <el-descriptions-item label="持续时间">{{
          calculateDuration(currentRecord)
        }}</el-descriptions-item>
        <el-descriptions-item label="审核状态">
          <el-tag :type="getApprovalStatusTag(currentRecord.approvalStatus)">
            {{ getApprovalStatusText(currentRecord.approvalStatus) }}
          </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="审核人">{{
          currentRecord.approverBy || "未审核"
        }}</el-descriptions-item>
        <el-descriptions-item label="审核时间">{{
          currentRecord.approvalTime
            ? formatDateTime(currentRecord.approvalTime)
            : "未审核"
        }}</el-descriptions-item>
        <el-descriptions-item label="会议概要" :span="2">
          {{ currentRecord.summary }}
        </el-descriptions-item>
        <el-descriptions-item label="会议内容" :span="2">
          <div
            v-html="currentRecord.content"
            style="white-space: pre-line; max-height: 300px; overflow-y: auto;"
          ></div>
        </el-descriptions-item>
 
        <!-- 会议附件 -->
        我理解您的需求,您希望将会议附件中的图片文件以el-image的预览图形式展示,其他文件类型保持原有的展示方式。让我修改这部分代码:
        <el-descriptions-item label="会议附件" :span="2">
          <div class="detail-attachments">
            <div
              v-if="
                currentRecord.attachment &&
                  parseAttachments(currentRecord.attachment).length > 0
              "
              class="attachment-grid"
            >
              <!-- 图片附件 - 使用 el-image 预览形式 -->
              <div
                v-for="file in parseAttachments(currentRecord.attachment)"
                :key="file.id || file.name"
                class="attachment-card"
              >
                <template v-if="isImageFile(file)">
                  <!-- 图片使用 el-image 预览 -->
                  <el-image
                    class="image-attachment"
                    :src="getFileUrl(file)"
                    :preview-src-list="getImagePreviewList(file)"
                    fit="cover"
                    :style="{ width: imageSize, height: imageSize }"
                    lazy
                  >
                    <div slot="error" class="image-error">
                      <i class="el-icon-picture-outline"></i>
                      <span>加载失败</span>
                    </div>
                    <div slot="placeholder" class="image-loading">
                      <i class="el-icon-loading"></i>
                    </div>
                  </el-image>
                  <div class="image-info">
                    <div class="file-name" :title="file.name">
                      {{ file.name }}
                    </div>
                    <div class="file-actions">
                      <el-button
                        type="text"
                        size="mini"
                        @click="handleDownload(file)"
                        icon="el-icon-download"
                        title="下载"
                      />
                      <el-button
                        type="text"
                        size="mini"
                        @click="handlePreview(file)"
                        icon="el-icon-view"
                        title="预览"
                      />
                    </div>
                  </div>
                </template>
 
                <template v-else>
                  <!-- 非图片文件保持原有样式 -->
                  <el-card shadow="hover" class="file-card">
                    <div class="file-content">
                      <i
                        :class="getFileIcon(file.type || file.name)"
                        class="file-icon"
                      ></i>
                      <div class="file-info">
                        <div class="file-name" :title="file.name">
                          {{ file.name }}
                        </div>
                        <div class="file-meta">
                          <span class="file-type">{{
                            getFileTypeText(file)
                          }}</span>
                          <span class="file-size" v-if="file.size">
                            {{ formatFileSize(file.size) }}
                          </span>
                        </div>
                      </div>
                    </div>
                    <div class="file-actions" v-if="file.url">
                      <el-button
                        type="text"
                        size="mini"
                        @click="handleDownload(file)"
                      >
                        下载
                      </el-button>
                      <el-button
                        v-if="canPreview(file)"
                        type="text"
                        size="mini"
                        @click="handlePreview(file)"
                      >
                        预览
                      </el-button>
                    </div>
                  </el-card>
                </template>
              </div>
            </div>
            <div v-else class="no-attachment">
              <el-empty description="暂无会议附件" :image-size="50"></el-empty>
            </div>
          </div>
        </el-descriptions-item>
 
        <el-descriptions-item label="创建人">{{
          currentRecord.createBy
        }}</el-descriptions-item>
        <el-descriptions-item label="创建时间">{{
          formatDateTime(currentRecord.createTime)
        }}</el-descriptions-item>
        <el-descriptions-item label="更新人">{{
          currentRecord.updateBy
        }}</el-descriptions-item>
        <el-descriptions-item label="更新时间">{{
          formatDateTime(currentRecord.updateTime)
        }}</el-descriptions-item>
        <el-descriptions-item label="备注" :span="2">{{
          currentRecord.remark || "无"
        }}</el-descriptions-item>
      </el-descriptions>
 
      <span slot="footer">
        <el-button @click="detailDialogVisible = false">关闭</el-button>
        <el-button
          type="primary"
          @click="handleEdit(currentRecord.id)"
          :disabled="currentRecord.delFlag === 1"
        >
          编辑
        </el-button>
      </span>
    </el-dialog>
 
    <!-- 新增/编辑对话框 -->
    <el-dialog
      :title="`${isEditing ? '编辑' : '新增'}会议`"
      :visible.sync="editDialogVisible"
      width="800px"
      :before-close="handleEditClose"
    >
      <el-form
        ref="editForm"
        :model="editForm"
        :rules="editRules"
        label-width="100px"
        label-position="left"
      >
        <el-form-item label="会议主题" prop="title">
          <el-input v-model="editForm.title" placeholder="请输入会议主题" />
        </el-form-item>
 
        <el-form-item label="会议类型" prop="typeId">
          <el-select
            v-model="editForm.typeId"
            placeholder="请选择会议类型"
            style="width: 100%"
          >
            <el-option label="科研会议" :value="1" />
            <el-option label="日常会议" :value="2" />
            <el-option label="项目会议" :value="3" />
            <el-option label="部门会议" :value="4" />
            <el-option label="评审会议" :value="5" />
          </el-select>
        </el-form-item>
 
        <el-form-item label="会议地点" prop="locationName">
          <el-select
            v-model="editForm.locationName"
            placeholder="请选择会议地点"
            style="width: 100%"
          >
            <el-option label="第一会议室" value="第一会议室" />
            <el-option label="第二会议室" value="第二会议室" />
            <el-option label="第三会议室" value="第三会议室" />
            <el-option label="线上会议" value="线上会议" />
          </el-select>
        </el-form-item>
 
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="开始时间" prop="startTime">
              <el-date-picker
                v-model="editForm.startTime"
                type="datetime"
                placeholder="选择开始时间"
                value-format="yyyy-MM-dd HH:mm:ss"
                style="width: 100%"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="结束时间" prop="endTime">
              <el-date-picker
                v-model="editForm.endTime"
                type="datetime"
                placeholder="选择结束时间"
                value-format="yyyy-MM-dd HH:mm:ss"
                style="width: 100%"
              />
            </el-form-item>
          </el-col>
        </el-row>
 
        <el-form-item label="提前提醒" prop="reminderMinutes">
          <el-input-number
            v-model="editForm.reminderMinutes"
            :min="0"
            :max="1440"
            :step="5"
            controls-position="right"
            style="width: 100%"
          >
            <template #append>分钟</template>
          </el-input-number>
        </el-form-item>
 
        <el-form-item label="会议概要" prop="summary">
          <el-input
            v-model="editForm.summary"
            type="textarea"
            :rows="2"
            placeholder="请输入会议概要"
            maxlength="200"
            show-word-limit
          />
        </el-form-item>
 
        <el-form-item label="会议内容" prop="content">
          <el-input
            v-model="editForm.content"
            type="textarea"
            :rows="6"
            placeholder="请输入会议具体内容(支持HTML格式)"
          />
        </el-form-item>
 
        <!-- 修改会议附件部分 -->
        <el-form-item label="会议附件">
          <div class="attachment-section">
            <div class="attachment-header">
              <i class="el-icon-paperclip"></i>
              <span class="attachment-title">会议附件上传</span>
              <span class="attachment-tip"
                >支持上传文档、图片等文件 (最多{{ attachmentLimit }}个)</span
              >
            </div>
 
            <!-- 使用 UploadAttachment 组件 -->
            <UploadAttachment
              ref="uploadAttachment"
              :file-list="attachmentFileList"
              :limit="attachmentLimit"
              :accept="attachmentAccept"
              @change="handleAttachmentChange"
              @upload-success="handleAttachmentUploadSuccess"
              @upload-error="handleAttachmentUploadError"
              @remove="handleAttachmentRemove"
            />
          </div>
 
          <!-- 会议附件列表 -->
          <div
            class="attachment-list"
            v-if="editForm.attachment && editForm.attachment.length > 0"
          >
            <div class="list-title">
              已上传附件 ({{ editForm.attachment.length }})
            </div>
            <el-table
              :data="editForm.attachment"
              style="width: 100%"
              size="small"
              border
            >
              <el-table-column label="文件名" min-width="200">
                <template #default="scope">
                  <i
                    class="el-icon-document"
                    style="margin-right: 8px; color: #409EFF;"
                  ></i>
                  <span class="file-name">{{ scope.row.name }}</span>
                </template>
              </el-table-column>
              <el-table-column label="文件类型" width="100">
                <template #default="scope">
                  <el-tag size="small">{{
                    getFileType(scope.row.name)
                  }}</el-tag>
                </template>
              </el-table-column>
              <el-table-column label="文件大小" width="100">
                <template #default="scope">
                  <span>{{ formatFileSize(scope.row.size) }}</span>
                </template>
              </el-table-column>
              <el-table-column label="操作" width="200">
                <template #default="scope">
                  <el-button
                    size="mini"
                    type="primary"
                    @click="handlePreviewAttachment(scope.row)"
                  >
                    预览
                  </el-button>
                  <el-button
                    size="mini"
                    type="danger"
                    @click="handleRemoveMeetingAttachment(scope.$index)"
                  >
                    删除
                  </el-button>
                </template>
              </el-table-column>
            </el-table>
          </div>
        </el-form-item>
 
        <el-divider>会议纪要(可会后补充)</el-divider>
 
        <el-form-item label="纪要内容" prop="recordcontent">
          <el-input
            v-model="editForm.recordcontent"
            type="textarea"
            :rows="6"
            placeholder="请输入会议纪要内容,包括会议决议、行动计划、责任人等信息"
            maxlength="1000"
            show-word-limit
          />
          <div style="color: #909399; font-size: 12px; margin-top: 4px;">
            提示:可记录会议讨论要点、决议事项、行动计划等
          </div>
        </el-form-item>
 
        <!-- 修改会议纪要附件部分 -->
        <el-form-item label="纪要附件">
          <div class="attachment-section">
            <div class="attachment-header">
              <i class="el-icon-paperclip"></i>
              <span class="attachment-title">纪要附件上传</span>
              <span class="attachment-tip"
                >支持上传与纪要相关的补充材料 (最多{{
                  minutesAttachmentLimit
                }}个)</span
              >
            </div>
 
            <UploadAttachment
              ref="uploadMinutesAttachment"
              :file-list="minutesAttachmentFileList"
              :limit="minutesAttachmentLimit"
              :accept="minutesAttachmentAccept"
              @change="handleMinutesAttachmentChange"
              @upload-success="handleMinutesUploadSuccess"
              @upload-error="handleMinutesUploadError"
              @remove="handleMinutesAttachmentRemove"
            />
          </div>
 
          <div
            class="attachment-list"
            v-if="
              editForm.recordattachment && editForm.recordattachment.length > 0
            "
          >
            <div class="list-title">
              已上传纪要附件 ({{ editForm.recordattachment.length }})
            </div>
            <el-table
              :data="editForm.recordattachment"
              style="width: 100%"
              size="small"
              border
            >
              <el-table-column label="文件名" min-width="200">
                <template #default="scope">
                  <i
                    class="el-icon-document"
                    style="margin-right: 8px; color: #409EFF;"
                  ></i>
                  <span class="file-name">{{ scope.row.name }}</span>
                </template>
              </el-table-column>
              <el-table-column label="文件类型" width="100">
                <template #default="scope">
                  <el-tag size="small">{{
                    getFileType(scope.row.name)
                  }}</el-tag>
                </template>
              </el-table-column>
              <el-table-column label="文件大小" width="100">
                <template #default="scope">
                  <span>{{ formatFileSize(scope.row.size) }}</span>
                </template>
              </el-table-column>
              <el-table-column label="操作" width="200">
                <template #default="scope">
                  <el-button
                    size="mini"
                    type="primary"
                    @click="handlePreviewMinutesAttachment(scope.row)"
                  >
                    预览
                  </el-button>
                  <el-button
                    size="mini"
                    type="danger"
                    @click="handleRemoveMinutesAttachment(scope.$index)"
                  >
                    删除
                  </el-button>
                </template>
              </el-table-column>
            </el-table>
          </div>
        </el-form-item>
 
        <el-form-item label="备注" prop="remark">
          <el-input
            v-model="editForm.remark"
            type="textarea"
            :rows="2"
            placeholder="请输入备注信息"
          />
        </el-form-item>
      </el-form>
 
      <span slot="footer">
        <el-button @click="handleEditClose">取消</el-button>
        <el-button type="primary" @click="handleSave" :loading="saveLoading">
          {{ isEditing ? "保存" : "新增" }}
        </el-button>
      </span>
    </el-dialog>
    <!-- 文件预览弹窗 -->
    <FilePreviewDialog
      :visible="previewVisible"
      :file="currentPreviewFile"
      @close="previewVisible = false"
      @download="handleDownload"
    />
  </div>
</template>
 
<script>
import {
  meetinglist,
  meetingedit,
  meetingadd,
  meetingInfo,
  meetingDel,
  exporremeeting
} from "@/api/officeManagementApi";
import UploadAttachment from "@/components/UploadAttachment";
import FilePreviewDialog from "@/components/FilePreviewDialog";
import dayjs from "dayjs";
export default {
  name: "MeetingManagement",
  components: {
    UploadAttachment,
    FilePreviewDialog
  },
  data() {
    return {
      // 查询参数
      queryParams: {
        title: "",
        meetingType: "",
        location: "",
        dateRange: [],
        status: ""
      },
      // 分页参数
      pagination: {
        pageNum: 1,
        pageSize: 10,
        total: 0
      },
      // 加载状态
      loading: false,
      saveLoading: false,
      // 对话框显示状态
      detailDialogVisible: false,
      editDialogVisible: false,
      minutesDialogVisible: false,
      // 当前操作记录
      currentRecord: {},
      // 编辑状态
      isEditing: false,
      // 表格数据
      tableData: [],
      imageSize: "100px", // 图片显示大小
      // 编辑表单数据
      editForm: this.getDefaultFormData(),
      // 表单验证规则
      editRules: {
        title: [{ required: true, message: "请输入会议主题", trigger: "blur" }],
        typeId: [
          { required: true, message: "请选择会议类型", trigger: "change" }
        ],
        locationId: [
          { required: true, message: "请选择会议地点", trigger: "change" }
        ],
        startTime: [
          { required: true, message: "请选择开始时间", trigger: "change" }
        ],
        endTime: [
          { required: true, message: "请选择结束时间", trigger: "change" }
        ],
        summary: [
          { required: true, message: "请输入会议概要", trigger: "blur" }
        ],
        content: [
          { required: true, message: "请输入会议内容", trigger: "blur" }
        ],
        reminderMinutes: [
          { required: true, message: "请输入提前提醒时间", trigger: "blur" }
        ]
      },
      // 附件相关配置
      attachmentLimit: 10,
      minutesAttachmentLimit: 5,
      attachmentAccept:
        ".pdf,.jpg,.jpeg,.png,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.zip,.rar",
      minutesAttachmentAccept: ".pdf,.jpg,.jpeg,.png,.doc,.docx,.xls,.xlsx",
 
      // 文件预览相关
      previewVisible: false,
      currentPreviewFile: null,
 
      // 附件文件列表
      attachmentFileList: [],
      minutesAttachmentFileList: [],
 
      // 编辑表单数据 - 修改默认值
      editForm: this.getDefaultFormData()
    };
  },
  mounted() {
    this.loadData();
  },
  methods: {
    // 加载数据
    async loadData() {
      this.loading = true;
      try {
        const params = {
          pageNum: this.pagination.pageNum,
          pageSize: this.pagination.pageSize,
          ...this.queryParams
        };
 
        // 处理时间范围查询
        if (
          this.queryParams.dateRange &&
          this.queryParams.dateRange.length === 2
        ) {
          params.startTime = this.queryParams.dateRange[0];
          params.endTime = this.queryParams.dateRange[1];
        }
 
        const response = await meetinglist(params);
 
        if (response.code === 200) {
          this.tableData = response.rows || [];
          this.pagination.total = response.total || 0;
        } else {
          this.$message.error(response.msg || "获取数据失败");
        }
      } catch (error) {
        console.error("加载数据失败:", error);
        this.$message.error("数据加载失败");
      } finally {
        this.loading = false;
      }
    },
    // 修改获取文件类型方法
    getFileType(fileName) {
      if (!fileName) return "other";
      const extension = fileName
        .split(".")
        .pop()
        .toLowerCase();
      const imageTypes = ["jpg", "jpeg", "png", "gif", "bmp", "webp"];
      const pdfTypes = ["pdf"];
      const officeTypes = ["doc", "docx", "xls", "xlsx", "ppt", "pptx"];
      const zipTypes = ["zip", "rar"];
 
      if (imageTypes.includes(extension)) return "image";
      if (pdfTypes.includes(extension)) return "pdf";
      if (officeTypes.includes(extension)) return "office";
      if (zipTypes.includes(extension)) return "archive";
      return "other";
    },
    // 判断是否为图片文件
    isImageFile(file) {
      if (!file || !file.name) return false;
      const imageExtensions = [
        "jpg",
        "jpeg",
        "png",
        "gif",
        "bmp",
        "webp",
        "svg"
      ];
      const extension = file.name
        .split(".")
        .pop()
        .toLowerCase();
      return imageExtensions.includes(extension);
    },
 
    // 获取文件URL
    getFileUrl(file) {
      return file.url || file.path || file.fileUrl || "";
    },
 
    // 获取图片预览列表
    getImagePreviewList(file) {
      const url = this.getFileUrl(file);
      if (!url) return [];
      return [url];
    },
    // 获取文件类型文本
    getFileTypeText(file) {
      if (!file.name) return "文件";
      const ext = file.name
        .split(".")
        .pop()
        .toLowerCase();
      const typeMap = {
        pdf: "PDF文档",
        doc: "Word文档",
        docx: "Word文档",
        xls: "Excel表格",
        xlsx: "Excel表格",
        ppt: "PPT演示",
        pptx: "PPT演示",
        zip: "压缩包",
        rar: "压缩包",
        txt: "文本文档",
        jpg: "图片",
        jpeg: "图片",
        png: "图片",
        gif: "图片"
      };
      return typeMap[ext] || "文件";
    },
 
    // 判断文件是否可以预览
    canPreview(file) {
      if (!file.name) return false;
      const previewableExtensions = ["pdf", "jpg", "jpeg", "png", "gif", "txt"];
      const extension = file.name
        .split(".")
        .pop()
        .toLowerCase();
      return previewableExtensions.includes(extension);
    },
 
    // 文件预览
    handlePreview(file) {
      this.currentPreviewFile = {
        fileName: file.name,
        fileUrl: this.getFileUrl(file),
        fileType: this.getFileType(file.name)
      };
      this.previewVisible = true;
    },
    // 附件转换为上传文件列表
    parseAttachmentToFileList(attachments) {
      if (!attachments || !Array.isArray(attachments)) return [];
      return attachments.map((item, index) => ({
        uid: item.id || `attachment-${index}-${Date.now()}`,
        name: item.name || item.fileName,
        url: item.url || item.path || item.fileUrl,
        size: item.size,
        status: "success"
      }));
    },
    // 获取文件图标
    getFileIcon(fileName) {
      if (!fileName) return "el-icon-document";
      const ext = fileName
        .split(".")
        .pop()
        .toLowerCase();
      const iconMap = {
        pdf: "el-icon-document",
        doc: "el-icon-document",
        docx: "el-icon-document",
        xls: "el-icon-document",
        xlsx: "el-icon-document",
        ppt: "el-icon-document",
        pptx: "el-icon-document",
        jpg: "el-icon-picture",
        jpeg: "el-icon-picture",
        png: "el-icon-picture",
        gif: "el-icon-picture",
        zip: "el-icon-folder",
        rar: "el-icon-folder"
      };
      return iconMap[ext] || "el-icon-document";
    },
 
    // 查看会议纪要
    handleViewMinutes(record) {
      this.currentRecord = { ...record };
      this.minutesDialogVisible = true;
    },
 
    // 解析附件JSON
    parseAttachments(attachmentJson) {
      if (!attachmentJson) return [];
      try {
        if (typeof attachmentJson === "string") {
          return JSON.parse(attachmentJson);
        }
        return attachmentJson;
      } catch (error) {
        console.error("解析附件失败:", error);
        return [];
      }
    },
 
    // 获取会议类型标签样式
    getMeetingTypeTag(typeId) {
      const typeMap = {
        1: "primary", // 科研会议
        2: "success", // 日常会议
        3: "warning", // 项目会议
        4: "info", // 部门会议
        5: "danger" // 评审会议
      };
      return typeMap[typeId] || "info";
    },
 
    // 获取会议类型文本
    getMeetingTypeText(typeId) {
      const textMap = {
        1: "科研会议",
        2: "日常会议",
        3: "项目会议",
        4: "部门会议",
        5: "评审会议"
      };
      return textMap[typeId] || "其他";
    },
 
    // 获取会议状态标签样式
    getMeetingStatusTag(status) {
      const statusMap = {
        1: "primary", // 待开始
        2: "success", // 进行中
        3: "info", // 已结束
        4: "danger" // 已取消
      };
      return statusMap[status] || "info";
    },
 
    // 获取会议状态文本
    getMeetingStatusText(status) {
      const textMap = {
        1: "待开始",
        2: "进行中",
        3: "已结束",
        4: "已取消"
      };
      return textMap[status] || "未知";
    },
 
    // 获取审核状态标签样式
    getApprovalStatusTag(status) {
      const statusMap = {
        0: "warning", // 待审核
        1: "success", // 已通过
        2: "danger" // 已驳回
      };
      return statusMap[status] || "info";
    },
 
    // 获取审核状态文本
    getApprovalStatusText(status) {
      const textMap = {
        0: "待审核",
        1: "已通过",
        2: "已驳回"
      };
      return textMap[status] || "未审核";
    },
 
    // 格式化日期时间
    formatDateTime(dateTime) {
      if (!dateTime) return "";
      return dateTime.replace("T", " ");
    },
 
    // 计算会议持续时间
    calculateDuration(record) {
      if (!record.startTime || !record.endTime) return "";
      const start = new Date(record.startTime);
      const end = new Date(record.endTime);
      const duration = (end - start) / (1000 * 60); // 分钟数
 
      if (duration < 60) {
        return `${Math.round(duration)}分钟`;
      } else {
        const hours = Math.floor(duration / 60);
        const minutes = Math.round(duration % 60);
        return minutes > 0 ? `${hours}小时${minutes}分钟` : `${hours}小时`;
      }
    },
 
    // 文件大小格式化
    formatFileSize(bytes) {
      if (!bytes || bytes === 0) return "0 B";
      const k = 1024;
      const sizes = ["B", "KB", "MB", "GB"];
      const i = Math.floor(Math.log(bytes) / Math.log(k));
      return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
    },
 
    // 查询处理
    handleQuery() {
      this.pagination.pageNum = 1;
      this.loadData();
    },
 
    // 重置查询
    handleReset() {
      this.queryParams = {
        title: "",
        meetingType: "",
        location: "",
        dateRange: [],
        status: ""
      };
      this.pagination.pageNum = 1;
      this.loadData();
    },
 
    // 查看详情
    async handleView(id) {
      try {
        const response = await meetingInfo(id);
        if (response.code === 200) {
          const data = response.data || {};
          // 解析附件
          if (data.attachment && typeof data.attachment === "string") {
            data.attachment = this.parseAttachments(data.attachment);
          }
          if (
            data.recordattachment &&
            typeof data.recordattachment === "string"
          ) {
            data.recordattachment = this.parseAttachments(
              data.recordattachment
            );
          }
          this.currentRecord = data;
          this.detailDialogVisible = true;
        } else {
          this.$message.error(response.msg || "获取详情失败");
        }
      } catch (error) {
        console.error("获取详情失败:", error);
        this.$message.error("获取详情失败");
      }
    },
 
    // 新增记录
    handleAdd() {
      this.isEditing = false;
      this.editForm = this.getDefaultFormData();
      this.attachmentFileList = [];
      this.minutesAttachmentFileList = [];
      this.editDialogVisible = true;
      this.$nextTick(() => {
        this.$refs.editForm && this.$refs.editForm.clearValidate();
      });
    },
 
    // 编辑记录
    async handleEdit(id) {
      try {
        const response = await meetingInfo(id);
        if (response.code === 200) {
          this.isEditing = true;
          const data = response.data || {};
 
          // 解析附件
          if (data.attachment) {
            data.attachment = this.parseAttachments(data.attachment);
            this.attachmentFileList = this.parseAttachmentToFileList(
              data.attachment
            );
          }
          if (data.recordattachment) {
            data.recordattachment = this.parseAttachments(
              data.recordattachment
            );
            this.minutesAttachmentFileList = this.parseAttachmentToFileList(
              data.recordattachment
            );
          }
 
          this.currentRecord = data;
          this.editForm = { ...data };
          this.editDialogVisible = true;
          this.detailDialogVisible = false;
          this.$nextTick(() => {
            this.$refs.editForm && this.$refs.editForm.clearValidate();
          });
        } else {
          this.$message.error(response.msg || "获取记录失败");
        }
      } catch (error) {
        console.error("获取记录失败:", error);
        this.$message.error("获取记录失败");
      }
    },
 
    // 复制记录
    async handleCopy(id) {
      try {
        const response = await meetingInfo(id);
        if (response.code === 200) {
          this.isEditing = false;
          const copiedRecord = { ...response.data };
 
          // 移除ID,生成新记录
          delete copiedRecord.id;
          delete copiedRecord.meetingNumber;
          copiedRecord.title = copiedRecord.title + "(复制)";
          copiedRecord.parentMeetingId = id;
 
          // 解析附件
          if (copiedRecord.attachment) {
            copiedRecord.attachmentFiles = this.parseAttachments(
              copiedRecord.attachment
            );
          }
          if (copiedRecord.recordattachment) {
            copiedRecord.recordattachmentFiles = this.parseAttachments(
              copiedRecord.recordattachment
            );
          }
 
          this.editForm = copiedRecord;
          this.editDialogVisible = true;
          this.$nextTick(() => {
            this.$refs.editForm && this.$refs.editForm.clearValidate();
          });
        } else {
          this.$message.error(response.msg || "获取记录失败");
        }
      } catch (error) {
        console.error("获取记录失败:", error);
        this.$message.error("获取记录失败");
      }
    },
 
    // 删除记录
    async handleDelete(record) {
      try {
        await this.$confirm("确定要删除这条会议记录吗?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        });
 
        const response = await meetingDel(record.id);
        if (response.code === 200) {
          this.$message.success("删除成功");
          this.loadData();
        } else {
          this.$message.error(response.msg || "删除失败");
        }
      } catch (error) {
        if (error !== "cancel") {
          console.error("删除失败:", error);
          this.$message.error("删除失败");
        }
      }
    },
 
    // 附件变化处理
    handleAttachmentChange(fileList) {
      this.attachmentFileList = fileList;
    },
 
    handleMinutesAttachmentChange(fileList) {
      this.minutesAttachmentFileList = fileList;
    },
    // 附件上传成功处理
    handleAttachmentUploadSuccess({ file, fileList, response }) {
      if (response && response.code === 200) {
        if (!this.editForm.attachment) {
          this.editForm.attachment = [];
        }
 
        console.log(file, "file");
        console.log(response, "response");
 
        const attachmentObj = {
          name: file.name,
          url: response.data || file.url,
          fileName: file.name,
          size: file.size || 0,
          type: this.getFileExtension(file.name),
          createTime: dayjs().format("YYYY-MM-DD HH:mm:ss")
        };
        console.log(this.editForm.attachment, "this.editForm.attachment");
 
        this.editForm.attachment.push(attachmentObj);
        console.log(this.editForm.attachment, "this.editForm.attachment");
 
        this.$message.success("会议附件上传成功");
      }
    },
    handleMinutesUploadSuccess({ file, fileList, response }) {
      if (response && response.code === 200) {
        if (!this.editForm.recordattachment) {
          this.editForm.recordattachment = [];
        }
 
        const attachmentObj = {
          name: file.name,
          url: response.data || file.url,
          fileName: file.name,
          size: file.size || 0,
          type: this.getFileExtension(file.name),
          createTime: dayjs().format("YYYY-MM-DD HH:mm:ss")
        };
        this.editForm.recordattachment.push(attachmentObj);
        this.$message.success("纪要附件上传成功");
      }
    },
    // 附件上传错误处理
    handleAttachmentUploadError({ file, fileList, error }) {
      console.error("会议附件上传失败:", error);
      this.$message.error("文件上传失败,请重试");
    },
 
    handleMinutesUploadError({ file, fileList, error }) {
      console.error("纪要附件上传失败:", error);
      this.$message.error("文件上传失败,请重试");
    },
    // 附件移除处理
    handleAttachmentRemove(file) {
      if (file.url && this.editForm.attachment) {
        const index = this.editForm.attachment.findIndex(
          item =>
            item.url === file.url ||
            item.path === file.url ||
            item.fileUrl === file.url
        );
        if (index > -1) {
          this.editForm.attachment.splice(index, 1);
        }
      }
    },
 
    handleMinutesAttachmentRemove(file) {
      if (file.url && this.editForm.recordattachment) {
        const index = this.editForm.recordattachment.findIndex(
          item =>
            item.url === file.url ||
            item.path === file.url ||
            item.fileUrl === file.url
        );
        if (index > -1) {
          this.editForm.recordattachment.splice(index, 1);
        }
      }
    },
    // 手动删除附件
    handleRemoveMeetingAttachment(index) {
      if (this.editForm.attachment && this.editForm.attachment[index]) {
        this.editForm.attachment.splice(index, 1);
        this.attachmentFileList.splice(index, 1);
        this.$message.success("会议附件删除成功");
      }
    },
 
    handleRemoveMinutesAttachment(index) {
      if (
        this.editForm.recordattachment &&
        this.editForm.recordattachment[index]
      ) {
        this.editForm.recordattachment.splice(index, 1);
        this.minutesAttachmentFileList.splice(index, 1);
        this.$message.success("纪要附件删除成功");
      }
    },
    // 文件预览
    handlePreviewAttachment(file) {
      this.currentPreviewFile = {
        fileName: file.name || file.fileName,
        fileUrl: file.url || file.path || file.fileUrl,
        fileType: this.getFileType(file.name)
      };
      this.previewVisible = true;
    },
 
    handlePreviewMinutesAttachment(file) {
      this.currentPreviewFile = {
        fileName: file.name || file.fileName,
        fileUrl: file.url || file.path || file.fileUrl,
        fileType: this.getFileType(file.name)
      };
      this.previewVisible = true;
    },
    // 文件下载
    handleDownload(file) {
      if (file.url) {
        const link = document.createElement("a");
        link.href = file.url;
        link.download = file.name || file.fileName || "download";
        link.style.display = "none";
        document.body.appendChild(link);
        link.click();
        document.body.removeChild(link);
        this.$message.success("开始下载文件");
      } else {
        this.$message.warning("文件地址不存在,无法下载");
      }
    },
    // 获取文件扩展名
    getFileExtension(filename) {
      if (!filename) return "";
      return filename
        .split(".")
        .pop()
        .toLowerCase();
    },
    // 保存记录
    async handleSave() {
      try {
        const valid = await this.$refs.editForm.validate();
        if (!valid) return;
 
        // 验证时间
        if (this.editForm.startTime && this.editForm.endTime) {
          if (
            new Date(this.editForm.endTime) <= new Date(this.editForm.startTime)
          ) {
            this.$message.error("结束时间必须晚于开始时间");
            return;
          }
        }
 
        // 检查是否有未上传完成的文件
        const pendingFiles = [
          ...this.attachmentFileList.filter(item => item.status !== "success"),
          ...this.minutesAttachmentFileList.filter(
            item => item.status !== "success"
          )
        ];
 
        if (pendingFiles.length > 0) {
          this.$message.warning(
            "还有文件未上传完成,请先上传所有文件或移除未上传的文件"
          );
          return;
        }
 
        this.saveLoading = true;
 
        // 准备数据
        const formData = { ...this.editForm };
 
        // 处理附件为JSON字符串
        if (formData.attachment && Array.isArray(formData.attachment)) {
          formData.attachment = JSON.stringify(
            formData.attachment.map(item => ({
              name: item.name || item.fileName,
              url: item.url || item.path || item.fileUrl,
              size: item.size || 0,
              type:
                item.type || this.getFileExtension(item.name || item.fileName)
            }))
          );
        }
 
        if (
          formData.recordattachment &&
          Array.isArray(formData.recordattachment)
        ) {
          formData.recordattachment = JSON.stringify(
            formData.recordattachment.map(item => ({
              name: item.name || item.fileName,
              url: item.url || item.path || item.fileUrl,
              size: item.size || 0,
              type:
                item.type || this.getFileExtension(item.name || item.fileName)
            }))
          );
        }
 
        // 清理临时字段
        delete formData.attachmentFiles;
        delete formData.recordattachmentFiles;
 
        let response;
        if (this.isEditing) {
          response = await meetingedit(formData);
        } else {
          response = await meetingadd(formData);
        }
 
        if (response.code === 200) {
          this.$message.success(this.isEditing ? "保存成功" : "新增成功");
          this.editDialogVisible = false;
          this.loadData();
        } else {
          this.$message.error(
            response.msg || (this.isEditing ? "保存失败" : "新增失败")
          );
        }
      } catch (error) {
        console.error("保存失败:", error);
        this.$message.error(this.isEditing ? "保存失败" : "新增失败");
      } finally {
        this.saveLoading = false;
      }
    },
 
    // 关闭详情对话框
    handleDetailClose() {
      this.detailDialogVisible = false;
      this.currentRecord = {};
    },
 
    // 关闭编辑对话框
    handleEditClose() {
      this.editDialogVisible = false;
      this.currentRecord = {};
      this.editForm = this.getDefaultFormData();
      this.attachmentFileList = [];
      this.minutesAttachmentFileList = [];
      this.$nextTick(() => {
        this.$refs.editForm && this.$refs.editForm.clearValidate();
      });
    },
 
    // 导出数据
    exportData() {
      const queryParams = this.queryParams;
      this.$modal
        .confirm("是否确认导出所有会议纪要数据项?")
        .then(() => {
          return exporremeeting(queryParams);
        })
        .then(response => {
          this.$download.name(response.msg);
        })
        .catch(() => {});
    },
 
    // 分页大小变化
    handleSizeChange(size) {
      this.pagination.pageSize = size;
      this.pagination.pageNum = 1;
      this.loadData();
    },
 
    // 当前页变化
    handleCurrentChange(page) {
      this.pagination.pageNum = page;
      this.loadData();
    },
 
    // 排序变化
    handleSortChange(sort) {
      console.log("排序变化:", sort);
    },
 
    // 默认表单数据
    getDefaultFormData() {
      return {
        id: null,
        title: "",
        typeId: null,
        locationId: null,
        startTime: "",
        endTime: "",
        summary: "",
        content: "",
        attachment: [], // 改为数组
        recordcontent: "",
        recordattachment: [], // 改为数组
        recorderBy: "",
        remark: "",
        status: 1,
        reminderMinutes: 30,
        approvalStatus: 0
      };
    }
  }
};
</script>
 
<style scoped>
.meeting-management {
  padding: 20px;
}
 
.attachment-section {
  margin-bottom: 16px;
}
 
.attachment-header {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
  padding: 8px 0;
  border-bottom: 1px solid #ebeef5;
}
 
.attachment-title {
  font-weight: bold;
  margin: 0 8px;
}
 
.attachment-tip {
  font-size: 12px;
  color: #909399;
}
 
.attachment-list {
  margin-top: 16px;
}
 
.list-title {
  font-weight: bold;
  margin-bottom: 12px;
  color: #303133;
}
/* 图片附件样式 */
.image-attachment {
  border-radius: 4px;
  border: 1px solid #ebeef5;
  cursor: pointer;
  transition: all 0.3s;
  margin-bottom: 8px;
}
 
.image-attachment:hover {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}
 
.image-info {
  text-align: center;
  padding: 4px 0;
}
 
.image-info .file-name {
  font-size: 12px;
  color: #606266;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100px;
}
 
.image-info .file-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
}
 
.image-loading,
.image-error {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  color: #909399;
  font-size: 12px;
}
 
.image-loading i,
.image-error i {
  font-size: 20px;
  margin-bottom: 4px;
}
 
/* 文件卡片样式 */
.file-card {
  width: 100%;
  min-height: 60px;
  margin-bottom: 8px;
}
 
.file-content {
  display: flex;
  align-items: center;
}
 
.file-icon {
  font-size: 24px;
  margin-right: 12px;
  color: #409eff;
  flex-shrink: 0;
}
 
.file-info {
  flex: 1;
  min-width: 0;
}
 
.file-name {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
 
.file-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #909399;
}
 
.file-actions {
  margin-top: 8px;
  text-align: right;
}
 
/* 附件网格布局 */
.attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 16px;
}
 
.attachment-card {
  display: flex;
  flex-direction: column;
}
 
/* 响应式调整 */
@media (max-width: 768px) {
  .attachment-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
  }
 
  .image-attachment {
    width: 80px !important;
    height: 80px !important;
  }
}
.file-name {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
 
/* 其他样式保持不变 */
.meeting-management {
  padding: 20px;
}
 
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
 
.page-header h2 {
  margin: 0;
  color: #303133;
}
 
.filter-card {
  margin-bottom: 20px;
}
 
.pagination-container {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}
 
.attachment-item {
  margin-bottom: 8px;
}
 
.minutes-content {
  margin-bottom: 16px;
}
 
.minutes-meta {
  border-top: 1px solid #e4e7ed;
  padding-top: 12px;
}
 
/* 响应式调整 */
@media (max-width: 768px) {
  .minutes-content .el-card {
    margin: 0 -20px;
  }
}
 
/* 响应式设计 */
@media (max-width: 768px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
 
  .header-actions {
    width: 100%;
    justify-content: space-between;
  }
}
 
/* 新增附件相关样式 */
.attachment-upload-section {
  border: 1px solid #ebeef5;
  border-radius: 4px;
  padding: 15px;
  background-color: #fafafa;
}
 
.section-title {
  font-weight: bold;
  margin-bottom: 8px;
  color: #303133;
}
 
.upload-tip {
  font-size: 12px;
  color: #909399;
  margin-bottom: 10px;
}
 
.uploaded-files {
  margin-top: 10px;
}
 
.file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid #f0f0f0;
}
 
.file-item:last-child {
  border-bottom: none;
}
 
.file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
 
.attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
 
.file-card {
  transition: all 0.3s ease;
}
 
.file-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
 
.file-content {
  display: flex;
  align-items: center;
}
 
.file-icon {
  font-size: 24px;
  color: #409eff;
  margin-right: 10px;
}
 
.file-info {
  flex: 1;
}
 
.file-name {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
 
.file-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #909399;
}
 
.file-actions {
  margin-top: 8px;
  text-align: center;
}
 
.file-link {
  display: flex;
  align-items: center;
}
 
.no-attachment {
  text-align: center;
  padding: 20px;
  color: #909399;
}
 
/* 响应式设计 */
@media (max-width: 768px) {
  .attachment-grid {
    grid-template-columns: 1fr;
  }
}
</style>