吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 1776|回复: 24
收起左侧

[其他转载] 项目完成进度管理AI写的附提示词

[复制链接]
Doublevv 发表于 2025-7-11 09:29
管理项目进度,跟踪完成情况,可导出csv表,DeepSeek写的。
项目完成情况管理系统.png
提示词:
以表格形式展示一个项目完成情况,这个表的结构如下:
第1列,序号(从1开始)
第2列,项目名称(空白,待初始化时从外部文件导入)
第3列,责任人(空白,待初始化时从外部文件导入)
第4列,项目标题(空白,待项目完成后由用户输入)
第5列,项目完成人(空白,待项目完成后由用户输入)
第6列,项目完成时间(日期,空白,待项目完成后由用户输入)
第7列,项目编号(空白,待项目完成后由用户输入)
第8列,完成情况(空白,默认值为未完成,若项目完成时间非空则值为已完成)
功能要求:
1.导入csv功能,目的是初始化这个表;
2.导出表到csv文件功能,导出当前项目完成进度;
3.新建项目功能;
3.持久化存储;
4.界面美观;
5.已完成的项目使用醒目的颜色标记;
6.使用本地化的css;
7.不使用font-awesome图标字体等外部资源;
页面布局:
第1行:title:项目完成情况一览表  右侧下拉显示的导入、导出、新建、重置菜单
第2行:项目总数:   已完成数:   未完成数:
第3行: 表头
第4行:表格数据

[Asm] 纯文本查看 复制代码
001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
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
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>项目完成情况管理系统</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
        }
         
        body {
            background: linear-gradient(135deg, #f0f5ff 0%, #e6f7ff 100%);
            min-height: 100vh;
            padding: 20px;
            color: #333;
        }
         
        .container {
            max-width: 1400px;
            margin: 0 auto;
            background: white;
            border-radius: 15px;
            box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12);
            overflow: hidden;
            position: relative;
        }
         
        header {
            background: linear-gradient(90deg, #1a6bc4, #0d4a9e);
            color: white;
            padding: 25px 30px;
            position: relative;
            overflow: hidden;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
        }
         
        header::before {
            content: "";
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 70%);
            transform: rotate(30deg);
        }
         
        .header-content {
            max-width: 65%;
        }
         
        h1 {
            font-size: 2.5rem;
            letter-spacing: 1px;
            text-shadow: 0 3px 6px rgba(0, 0, 0, 0.25);
            position: relative;
            margin-bottom: 10px;
        }
         
        .subtitle {
            font-size: 1.1rem;
            opacity: 0.9;
            font-weight: 300;
        }
         
        .header-controls {
            display: flex;
            gap: 15px;
            flex-wrap: wrap;
            justify-content: flex-end;
        }
         
        .control-btn {
            background: rgba(255, 255, 255, 0.15);
            color: white;
            border: none;
            padding: 12px 18px;
            border-radius: 8px;
            font-size: 1rem;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 8px;
            transition: all 0.25s ease;
            backdrop-filter: blur(5px);
            border: 1px solid rgba(255, 255, 255, 0.1);
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
            min-width: 120px;
        }
         
        .control-btn:hover {
            background: rgba(255, 255, 255, 0.25);
            transform: translateY(-2px);
        }
         
        .stats {
            display: flex;
            justify-content: center;
            background: #0d4a9e;
            padding: 18px;
            color: white;
            font-size: 1.25rem;
            gap: 50px;
            position: relative;
            z-index: 2;
        }
         
        .stat-item {
            display: flex;
            align-items: center;
            gap: 12px;
        }
         
        .stat-value {
            font-weight: bold;
            font-size: 1.5rem;
            background: rgba(255, 255, 255, 0.15);
            padding: 6px 22px;
            border-radius: 25px;
            min-width: 80px;
            text-align: center;
            backdrop-filter: blur(4px);
        }
         
        .table-container {
            padding: 25px;
            overflow: auto;
            max-height: 680px;
            position: relative;
        }
         
        table {
            width: 100%;
            border-collapse: separate;
            border-spacing: 0;
            box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
            border-radius: 12px;
            overflow: hidden;
        }
         
        th {
            background: #1a6bc4;
            color: white;
            padding: 18px 15px;
            text-align: left;
            position: sticky;
            top: 0;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.8px;
            font-size: 1.05rem;
        }
         
        th:first-child {
            border-top-left-radius: 12px;
        }
         
        th:last-child {
            border-top-right-radius: 12px;
        }
         
        td {
            padding: 16px 15px;
            border-bottom: 1px solid #e0e8f0;
            transition: background 0.2s;
        }
         
        tr:nth-child(even) {
            background-color: #f8fbfe;
        }
         
        tr:hover {
            background-color: #f0f7ff;
        }
         
        .completed-row {
            background-color: #edf7ed !important;
            border-left: 5px solid #4caf50;
        }
         
        .completed-row:hover {
            background-color: #e0f0e0 !important;
        }
         
        input {
            width: 100%;
            padding: 10px 12px;
            border: 1px solid #d0dde9;
            border-radius: 6px;
            font-size: 1rem;
            transition: all 0.3s;
            background: rgba(255, 255, 255, 0.7);
        }
         
        input:focus {
            outline: none;
            border-color: #1a6bc4;
            box-shadow: 0 0 0 3px rgba(26, 107, 196, 0.2);
            background: white;
        }
         
        input[type="date"] {
            padding: 9px 12px;
        }
         
        .status-badge {
            display: inline-block;
            padding: 7px 15px;
            border-radius: 25px;
            font-size: 0.9rem;
            font-weight: 600;
            text-align: center;
            min-width: 90px;
        }
         
        .status-completed {
            background: linear-gradient(135deg, #4CAF50, #2E7D32);
            color: white;
            box-shadow: 0 3px 6px rgba(76, 175, 80, 0.2);
        }
         
        .status-pending {
            background: linear-gradient(135deg, #FF9800, #F57C00);
            color: white;
            box-shadow: 0 3px 6px rgba(255, 152, 0, 0.2);
        }
         
        footer {
            text-align: center;
            padding: 25px;
            color: #6c7a89;
            font-size: 0.95rem;
            border-top: 1px solid #edf2f7;
            background: #f9fbfd;
        }
         
        .file-input-wrapper {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: hidden;
            clip: rect(0, 0, 0, 0);
            border: 0;
        }
         
        .notification {
            position: fixed;
            top: 30px;
            right: 30px;
            padding: 18px 25px;
            border-radius: 10px;
            background: #4CAF50;
            color: white;
            font-weight: 500;
            box-shadow: 0 8px 20px rgba(0,0,0,0.15);
            transform: translateX(150%);
            transition: transform 0.4s ease;
            z-index: 1000;
        }
         
        .notification.show {
            transform: translateX(0);
        }
         
        .notification.error {
            background: #f44336;
        }
         
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.7);
            z-index: 2000;
            align-items: center;
            justify-content: center;
        }
         
        .modal-content {
            background: white;
            border-radius: 15px;
            width: 90%;
            max-width: 500px;
            padding: 30px;
            box-shadow: 0 20px 40px rgba(0,0,0,0.3);
            transform: translateY(-50px);
            opacity: 0;
            transition: all 0.4s ease;
        }
         
        .modal.show {
            display: flex;
        }
         
        .modal.show .modal-content {
            transform: translateY(0);
            opacity: 1;
        }
         
        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 25px;
        }
         
        .modal-title {
            font-size: 1.8rem;
            color: #1a6bc4;
        }
         
        .close-modal {
            background: none;
            border: none;
            font-size: 2rem;
            cursor: pointer;
            color: #999;
            transition: color 0.2s;
        }
         
        .close-modal:hover {
            color: #f44336;
        }
         
        .modal-body {
            margin-bottom: 30px;
        }
         
        .modal-text {
            font-size: 1.1rem;
            line-height: 1.6;
            margin-bottom: 20px;
            color: #555;
        }
         
        .modal-footer {
            display: flex;
            gap: 15px;
            justify-content: flex-end;
        }
         
        .modal-btn {
            padding: 12px 25px;
            border: none;
            border-radius: 8px;
            font-size: 1.05rem;
            cursor: pointer;
            transition: all 0.2s;
        }
         
        .btn-confirm {
            background: #1a6bc4;
            color: white;
        }
         
        .btn-confirm:hover {
            background: #0d4a9e;
        }
         
        .btn-cancel {
            background: #f5f5f5;
            color: #666;
        }
         
        .btn-cancel:hover {
            background: #e0e0e0;
        }
         
        [url=home.php?mod=space&uid=945662]@media[/url] (max-width: 1100px) {
            .header-content {
                max-width: 100%;
                text-align: center;
                margin-bottom: 20px;
            }
             
            .header-controls {
                width: 100%;
                justify-content: center;
            }
             
            header {
                padding: 20px 15px;
            }
        }
         
        @media (max-width: 768px) {
            h1 {
                font-size: 2rem;
            }
             
            .stats {
                flex-direction: column;
                gap: 15px;
                padding: 15px;
            }
             
            .stat-item {
                justify-content: center;
            }
             
            .control-btn {
                padding: 10px 15px;
                font-size: 0.9rem;
                min-width: 100px;
            }
        }
         
        @media (max-width: 480px) {
            .header-controls {
                gap: 10px;
            }
             
            .control-btn {
                min-width: auto;
                padding: 8px 12px;
            }
             
            .control-btn span:last-child {
                display: none;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <header>
            <div class="header-content">
                <h1>项目完成情况一览表</h1>
                <p class="subtitle">高效管理项目进度,实时跟踪完成情况,提升团队协作效率</p>
            </div>
             
            <div class="header-controls">
                <button class="control-btn" id="import-btn">
                    <span>&#128229;</span> <span>导入CSV</span>
                </button>
                <button class="control-btn" id="export-btn">
                    <span>&#128228;</span> <span>导出CSV</span>
                </button>
                <button class="control-btn" id="new-btn">
                    <span>&#10133;</span> <span>新建项目</span>
                </button>
                <button class="control-btn" id="reset-btn">
                    <span>&#128260;</span> <span>重置数据</span>
                </button>
            </div>
        </header>
         
        <div class="stats">
            <div class="stat-item">
                <span>项目总数:</span>
                <span class="stat-value" id="total-count">0</span>
            </div>
            <div class="stat-item">
                <span>已完成数:</span>
                <span class="stat-value" id="completed-count">0</span>
            </div>
            <div class="stat-item">
                <span>未完成数:</span>
                <span class="stat-value" id="pending-count">0</span>
            </div>
        </div>
         
        <div class="table-container">
            <table id="project-table">
                <thead>
                    <tr>
                        <th style="width: 60px;">序号</th>
                        <th>项目名称</th>
                        <th>责任人</th>
                        <th>项目标题</th>
                        <th>项目完成人</th>
                        <th style="width: 150px;">完成时间</th>
                        <th style="width: 130px;">项目编号</th>
                        <th style="width: 110px;">完成情况</th>
                    </tr>
                </thead>
                <tbody id="table-body">
                    <!-- 表格数据将通过JavaScript动态生成 -->
                </tbody>
            </table>
        </div>
         
        <footer>
            <p>项目完成情况管理系统 &#169; 2023 | 数据已本地存储 | 支持CSV导入导出</p>
        </footer>
    </div>
     
    <input type="file" id="csv-file-input" class="file-input-wrapper" accept=".csv">
     
    <div class="notification" id="notification">操作成功!</div>
     
    <div class="modal" id="reset-modal">
        <div class="modal-content">
            <div class="modal-header">
                <h2 class="modal-title">确认重置数据</h2>
                <button class="close-modal">×</button>
            </div>
            <div class="modal-body">
                <p class="modal-text">您确定要重置所有项目数据吗?此操作将永久删除当前所有项目记录,且不可恢复。</p>
                <p class="modal-text"><strong>请注意:</strong> 重置操作将清除所有本地存储数据,包括已完成的项目信息。</p>
            </div>
            <div class="modal-footer">
                <button class="modal-btn btn-cancel" id="cancel-reset">取消</button>
                <button class="modal-btn btn-confirm" id="confirm-reset">确认重置</button>
            </div>
        </div>
    </div>
 
    <script>
        // 示例项目数据
        const sampleProjects = [
            { id: "PRJ-2023-001", name: "网站重构项目", owner: "张伟" },
            { id: "PRJ-2023-002", name: "移动应用开发", owner: "李娜" },
            { id: "PRJ-2023-003", name: "数据库迁移", owner: "王强" },
            { id: "PRJ-2023-004", name: "安全系统升级", owner: "赵敏" },
            { id: "PRJ-2023-005", name: "客户关系管理", owner: "陈明" },
            { id: "PRJ-2023-006", name: "市场推广活动", owner: "刘芳" },
            { id: "PRJ-2023-007", name: "产品UI设计", owner: "杨光" },
            { id: "PRJ-2023-008", name: "服务器部署", owner: "徐静" },
            { id: "PRJ-2023-009", name: "API接口开发", owner: "黄涛" },
            { id: "PRJ-2023-010", name: "数据分析报告", owner: "周华" },
            { id: "PRJ-2023-011", name: "内部培训系统", owner: "吴刚" },
            { id: "PRJ-2023-012", name: "财务系统升级", owner: "郑琳" },
            { id: "PRJ-2023-013", name: "云服务迁移", owner: "钱勇" },
            { id: "PRJ-2023-014", name: "用户调研分析", owner: "孙悦" },
            { id: "PRJ-2023-015", name: "产品测试计划", owner: "朱华" }
        ];
 
        // 初始化项目数据
        let projects = [];
 
        // DOM元素
        const tableBody = document.getElementById('table-body');
        const importBtn = document.getElementById('import-btn');
        const exportBtn = document.getElementById('export-btn');
        const newBtn = document.getElementById('new-btn');
        const resetBtn = document.getElementById('reset-btn');
        const totalCountEl = document.getElementById('total-count');
        const completedCountEl = document.getElementById('completed-count');
        const pendingCountEl = document.getElementById('pending-count');
        const csvFileInput = document.getElementById('csv-file-input');
        const notification = document.getElementById('notification');
        const resetModal = document.getElementById('reset-modal');
        const closeModal = document.querySelector('.close-modal');
        const cancelResetBtn = document.getElementById('cancel-reset');
        const confirmResetBtn = document.getElementById('confirm-reset');
 
        // 页面加载时初始化
        document.addEventListener('DOMContentLoaded', () => {
            loadFromLocalStorage();
            renderTable();
            updateStats();
             
            // 添加事件监听器
            importBtn.addEventListener('click', triggerFileInput);
            csvFileInput.addEventListener('change', handleFileImport);
            exportBtn.addEventListener('click', exportToCSV);
            newBtn.addEventListener('click', addNewProject);
            resetBtn.addEventListener('click', showResetModal);
            closeModal.addEventListener('click', hideResetModal);
            cancelResetBtn.addEventListener('click', hideResetModal);
            confirmResetBtn.addEventListener('click', resetData);
        });
 
        // 触发文件选择
        function triggerFileInput() {
            csvFileInput.click();
        }
 
        // 处理文件导入
        function handleFileImport(event) {
            const file = event.target.files[0];
            if (!file) return;
             
            const reader = new FileReader();
            reader.onload = function(e) {
                try {
                    const csvData = e.target.result;
                    const parsedData = parseCSV(csvData);
                     
                    if (parsedData.length > 0) {
                        projects = parsedData.map((row, index) => ({
                            name: row[0] || `项目${index + 1}`,
                            owner: row[1] || '待分配',
                            title: row[2] || '',
                            completer: row[3] || '',
                            date: row[4] || '',
                            id: row[5] || `PRJ-${new Date().getFullYear()}-${String(index + 1).padStart(3, '0')}`,
                            completed: !!row[4]
                        }));
                         
                        saveToLocalStorage();
                        renderTable();
                        updateStats();
                        showNotification('成功导入 ' + parsedData.length + ' 个项目数据');
                    } else {
                        showNotification('导入失败:CSV文件格式不正确', true);
                    }
                } catch (error) {
                    console.error('CSV导入错误:', error);
                    showNotification('导入失败:' + error.message, true);
                }
            };
            reader.readAsText(file);
             
            // 重置input,允许再次选择同一文件
            event.target.value = '';
        }
 
        // 解析CSV数据
        function parseCSV(csv) {
            const lines = csv.split('\n');
            const result = [];
             
            // 检查是否有标题行
            const hasHeader = lines[0].includes('项目名称') && lines[0].includes('责任人');
             
            for (let i = hasHeader ? 1 : 0; i < lines.length; i++) {
                const line = lines[i].trim();
                if (!line) continue;
                 
                // 简单处理带逗号的值
                const values = [];
                let current = '';
                let inQuotes = false;
                 
                for (let j = 0; j < line.length; j++) {
                    const char = line[j];
                     
                    if (char === '"') {
                        inQuotes = !inQuotes;
                    } else if (char === ',' && !inQuotes) {
                        values.push(current);
                        current = '';
                    } else {
                        current += char;
                    }
                }
                values.push(current);
                 
                // 确保每行有6列
                if (values.length >= 6) {
                    result.push(values.slice(0, 6));
                }
            }
             
            return result;
        }
 
        // 导出为CSV
        function exportToCSV() {
            if (projects.length === 0) {
                showNotification('没有数据可导出', true);
                return;
            }
             
            // 创建CSV内容
            let csvContent = '项目名称,责任人,项目标题,项目完成人,项目完成时间,项目编号\n';
             
            projects.forEach(project => {
                const row = [
                    `"${project.name}"`,
                    `"${project.owner}"`,
                    `"${project.title}"`,
                    `"${project.completer}"`,
                    `"${project.date}"`,
                    `"${project.id}"`
                ];
                csvContent += row.join(',') + '\n';
            });
             
            // 创建下载链接
            const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
            const url = URL.createObjectURL(blob);
            const link = document.createElement('a');
            link.setAttribute('href', url);
            link.setAttribute('download', `项目完成情况_${new Date().toLocaleDateString().replace(/\//g, '-')}.csv`);
            link.style.visibility = 'hidden';
            document.body.appendChild(link);
            link.click();
            document.body.removeChild(link);
             
            showNotification('成功导出 ' + projects.length + ' 个项目数据');
        }
 
        // 渲染表格
        function renderTable() {
            tableBody.innerHTML = '';
             
            projects.forEach((project, index) => {
                const row = document.createElement('tr');
                if (project.completed) {
                    row.classList.add('completed-row');
                }
                 
                row.innerHTML = `
                    <td>${index + 1}</td>
                    <td>${project.name}</td>
                    <td>${project.owner}</td>
                    <td>
                        <input type="text" class="project-title"
                               value="${project.title || ''}"
                               data-index="${index}">
                    </td>
                    <td>
                        <input type="text" class="project-completer"
                               value="${project.completer || ''}"
                               data-index="${index}">
                    </td>
                    <td>
                        <input type="date" class="project-date"
                               value="${project.date || ''}"
                               data-index="${index}">
                    </td>
                    <td>
                        <input type="text" class="project-id"
                               value="${project.id || ''}"
                               data-index="${index}">
                    </td>
                    <td>
                        <span class="status-badge ${project.completed ? 'status-completed' : 'status-pending'}">
                            ${project.completed ? '已完成' : '未完成'}
                        </span>
                    </td>
                `;
                 
                tableBody.appendChild(row);
            });
             
            // 添加事件监听
            document.querySelectorAll('.project-title').forEach(input => {
                input.addEventListener('input', handleInputChange);
            });
             
            document.querySelectorAll('.project-completer').forEach(input => {
                input.addEventListener('input', handleInputChange);
            });
             
            document.querySelectorAll('.project-date').forEach(input => {
                input.addEventListener('change', handleDateChange);
            });
             
            document.querySelectorAll('.project-id').forEach(input => {
                input.addEventListener('input', handleInputChange);
            });
        }
 
        // 处理输入变化
        function handleInputChange(e) {
            const index = e.target.dataset.index;
            const field = e.target.classList[0].split('-')[1];
             
            projects[index][field] = e.target.value;
            saveToLocalStorage();
        }
 
        // 处理日期变化
        function handleDateChange(e) {
            const index = e.target.dataset.index;
            projects[index].date = e.target.value;
            projects[index].completed = !!e.target.value;
             
            saveToLocalStorage();
            renderTable();
            updateStats();
        }
 
        // 更新统计数据
        function updateStats() {
            totalCountEl.textContent = projects.length;
             
            const completed = projects.filter(p => p.completed).length;
            completedCountEl.textContent = completed;
            pendingCountEl.textContent = projects.length - completed;
        }
 
        // 添加新项目
        function addNewProject() {
            if (projects.length >= 65) {
                showNotification('已达到最大项目数(65个)', true);
                return;
            }
             
            const newProject = {
                name: `新项目 ${projects.length + 1}`,
                owner: '待分配',
                title: '',
                completer: '',
                date: '',
                id: `PRJ-${new Date().getFullYear()}-${String(projects.length + 1).padStart(3, '0')}`,
                completed: false
            };
             
            projects.push(newProject);
            saveToLocalStorage();
            renderTable();
            updateStats();
            showNotification('已添加新项目');
        }
 
        // 显示重置确认模态框
        function showResetModal() {
            resetModal.classList.add('show');
        }
 
        // 隐藏重置确认模态框
        function hideResetModal() {
            resetModal.classList.remove('show');
        }
 
        // 重置数据
        function resetData() {
            projects = [];
            localStorage.removeItem('projectData');
            renderTable();
            updateStats();
            hideResetModal();
            showNotification('数据已重置');
        }
 
        // 显示通知
        function showNotification(message, isError = false) {
            notification.textContent = message;
            notification.classList.remove('error');
             
            if (isError) {
                notification.classList.add('error');
            }
             
            notification.classList.add('show');
             
            setTimeout(() => {
                notification.classList.remove('show');
            }, 3000);
        }
 
        // 保存到本地存储
        function saveToLocalStorage() {
            localStorage.setItem('projectData', JSON.stringify(projects));
        }
 
        // 从本地存储加载
        function loadFromLocalStorage() {
            const savedData = localStorage.getItem('projectData');
            if (savedData) {
                projects = JSON.parse(savedData);
            } else {
                // 初始加载一些示例数据
                projects = sampleProjects.slice(0, 10).map(proj => ({
                    ...proj,
                    title: '',
                    completer: '',
                    date: '',
                    id: proj.id,
                    completed: false
                }));
                 
                // 标记前四个为已完成
                projects[0].title = "企业网站重构";
                projects[0].completer = "张伟";
                projects[0].date = "2023-08-15";
                projects[0].completed = true;
                 
                projects[1].title = "移动端应用开发";
                projects[1].completer = "李娜";
                projects[1].date = "2023-09-01";
                projects[1].completed = true;
                 
                projects[2].title = "数据库迁移";
                projects[2].completer = "王强";
                projects[2].date = "2023-09-15";
                projects[2].completed = true;
                 
                projects[3].title = "安全系统升级";
                projects[3].completer = "赵敏";
                projects[3].date = "2023-10-01";
                projects[3].completed = true;
            }
        }
    </script>
</body>
</html>

免费评分

参与人数 2吾爱币 +2 热心值 +1 收起 理由
shengruqing + 1 我很赞同!
外婆的铜锣湾 + 1 + 1 谢谢@Thanks!

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

ydafu168 发表于 2025-7-11 09:38
目前感觉deepseek写代码还是非常强大的。
 楼主| Doublevv 发表于 2025-7-22 16:14
eflying 发表于 2025-7-22 12:48
导入CSV数据成功,但是文字显示变乱码符号,什么情况啊大佬

这是因为windows系统默认编码为gbk,使用wps编辑csv文件后,文件编码变成了gbk。
解决办法1
使用notepad4、emeditor文字编辑软件等打开csv文件,选择utf8编码另存一下。
解决办法2
修改楼主的代码,支持导入、导出csv文件使用gbk编码。
3处修改
1.第685行 const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
改为:
const blob = new Blob([gbkArray], { type: 'text/csv;charset=gbk;' });

2.第616行  reader.readAsText(file);
改为:
reader.readAsArrayBuffer(file);

1.第590行  const csvData = e.target.result;
改为:
const buffer = e.target.result;
const decoder = new TextDecoder('gbk');
const csvData = decoder.decode(buffer);
robert1234 发表于 2025-7-11 09:37
ZX0228 发表于 2025-7-11 09:42
只有完成情况啊,没有进度,项目开始时间,项目预计完成时间,项目完成进度。
jun269 发表于 2025-7-11 09:52
看上去有点漂亮
qsc11 发表于 2025-7-11 10:11
小白一个,谢谢贴主的分享
scandisk0083 发表于 2025-7-11 10:19
如果能转化多种格式就最完美了
kylo 发表于 2025-7-11 10:20
牛逼期待成品啊我去。
xiao_007 发表于 2025-7-11 10:31
成品在哪里
神界三个小生 发表于 2025-7-11 10:34
ydafu168 发表于 2025-7-11 09:38
目前感觉deepseek写代码还是非常强大的。

写的还挺快,至于能不能运行他就不管了
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2025-8-17 16:24

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表