sgj
8 天以前 71fe4f1f6a75c86640a726b9c230e8aaae2a28e7
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
<!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-color: #f5f7fa;
            color: #333;
            line-height: 1.6;
            padding: 20px;
            min-height: 100vh;
        }
        .container {
            max-width: 1000px;
            margin: 0 auto;
            padding: 30px;
            background-color: white;
            border-radius: 12px;
            box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
        }
        header {
            text-align: center;
            margin-bottom: 40px;
        }
 
        h1 {
            color: #2c3e50;
            margin-bottom: 10px;
            font-size: 28px;
        }
 
        .description {
            color: #7f8c8d;
            max-width: 600px;
            margin: 0 auto;
        }
 
        .process-container {
            position: relative;
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 60px;
        }
 
        /* 连接线 */
        .process-line {
            position: absolute;
            top: 40px;
            left: 80px;
            right: 80px;
            height: 4px;
            background-color: #e0e0e0;
            z-index: 1;
        }
 
        .process-line.active {
            background-color: #3498db;
        }
 
        .node {
            position: relative;
            display: flex;
            flex-direction: column;
            align-items: center;
            width: 120px;
            z-index: 2;
        }
 
        .node-indicator {
            width: 80px;
            height: 80px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 20px;
            font-weight: bold;
            color: white;
            margin-bottom: 15px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
            transition: all 0.3s ease;
            cursor: pointer;
        }
 
        .node-indicator.start {
            background: linear-gradient(135deg, #1abc9c, #16a085);
        }
 
        .node-indicator.manager {
            background: linear-gradient(135deg, #3498db, #2980b9);
        }
 
        .node-indicator.leader {
            background: linear-gradient(135deg, #9b59b6, #8e44ad);
        }
 
        .node-indicator.group {
            background: linear-gradient(135deg, #e67e22, #d35400);
        }
 
        .node-indicator.end {
            background: linear-gradient(135deg, #e74c3c, #c0392b);
        }
 
        .node-indicator.disabled {
            background: #bdc3c7;
            transform: scale(0.9);
            opacity: 0.7;
        }
 
        .node-label {
            font-weight: 600;
            margin-bottom: 8px;
            color: #2c3e50;
            text-align: center;
        }
 
        .toggle-container {
            display: flex;
            align-items: center;
            justify-content: center;
        }
 
        /* 切换开关样式 */
        .toggle-switch {
            position: relative;
            display: inline-block;
            width: 50px;
            height: 24px;
        }
 
        .toggle-switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }
 
        .toggle-slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #ccc;
            transition: .4s;
            border-radius: 24px;
        }
 
        .toggle-slider:before {
            position: absolute;
            content: "";
            height: 18px;
            width: 18px;
            left: 3px;
            bottom: 3px;
            background-color: white;
            transition: .4s;
            border-radius: 50%;
        }
 
        input:checked + .toggle-slider {
            background-color: #2ecc71;
        }
 
        input:checked + .toggle-slider:before {
            transform: translateX(26px);
        }
 
        .toggle-label {
            margin-left: 8px;
            font-size: 14px;
            color: #7f8c8d;
        }
 
        .toggle-label.active {
            color: #2ecc71;
            font-weight: 600;
        }
 
        .toggle-label.inactive {
            color: #e74c3c;
        }
 
        .controls {
            display: flex;
            justify-content: center;
            gap: 20px;
            margin-top: 40px;
            padding-top: 30px;
            border-top: 1px solid #eee;
        }
 
        .btn {
            padding: 12px 30px;
            border: none;
            border-radius: 6px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
        }
 
        .btn-save {
            background-color: #3498db;
            color: white;
        }
 
        .btn-save:hover {
            background-color: #2980b9;
            transform: translateY(-2px);
        }
 
        .btn-reset {
            background-color: #ecf0f1;
            color: #34495e;
        }
 
        .btn-reset:hover {
            background-color: #d5dbdb;
        }
 
        .status-bar {
            background-color: #f8f9fa;
            padding: 15px 20px;
            border-radius: 8px;
            margin-top: 30px;
            border-left: 4px solid #3498db;
        }
 
        .status-text {
            font-size: 15px;
            color: #2c3e50;
        }
 
        .status-text .enabled-count {
            font-weight: bold;
            color: #27ae60;
        }
 
        .status-text .disabled-count {
            font-weight: bold;
            color: #e74c3c;
        }
 
        @media (max-width: 768px) {
            .process-container {
                flex-direction: column;
                align-items: center;
            }
 
            .node {
                margin-bottom: 30px;
                width: 100%;
            }
 
            .process-line {
                display: none;
            }
 
            .controls {
                flex-direction: column;
            }
        }
    </style>
</head>
<body>
<div class="container">
 
    <div class="process-container">
        <!-- 连接线 -->
        <div class="process-line" id="processLine"></div>
 
        <!-- 开始节点 -->
        <div class="node">
            <div class="node-indicator start" id="node-start">开始</div>
            <div class="node-label">开始节点</div>
            <div class="toggle-container">
                <label class="toggle-switch">
                    <input type="checkbox" class="node-toggle" data-node="start" checked>
                    <span class="toggle-slider"></span>
                </label>
                <span class="toggle-label active" id="label-start">启用</span>
            </div>
        </div>
 
        <!-- 经理审批节点 -->
        <div class="node">
            <div class="node-indicator manager" id="node-manager">经理</div>
            <div class="node-label">经理审批</div>
            <div class="toggle-container">
                <label class="toggle-switch">
                    <input type="checkbox" class="node-toggle" data-node="manager" checked>
                    <span class="toggle-slider"></span>
                </label>
                <span class="toggle-label active" id="label-manager">启用</span>
            </div>
        </div>
 
        <!-- 领导审批节点 -->
        <div class="node">
            <div class="node-indicator leader" id="node-leader">领导</div>
            <div class="node-label">领导审批</div>
            <div class="toggle-container">
                <label class="toggle-switch">
                    <input type="checkbox" class="node-toggle" data-node="leader" checked>
                    <span class="toggle-slider"></span>
                </label>
                <span class="toggle-label active" id="label-leader">启用</span>
            </div>
        </div>
 
        <!-- 集团审批节点 -->
        <div class="node">
            <div class="node-indicator group" id="node-group">集团</div>
            <div class="node-label">集团审批</div>
            <div class="toggle-container">
                <label class="toggle-switch">
                    <input type="checkbox" class="node-toggle" data-node="group" checked>
                    <span class="toggle-slider"></span>
                </label>
                <span class="toggle-label active" id="label-group">启用</span>
            </div>
        </div>
 
        <!-- 结束节点 -->
        <div class="node">
            <div class="node-indicator end" id="node-end">结束</div>
            <div class="node-label">结束节点</div>
            <div class="toggle-container">
                <label class="toggle-switch">
                    <input type="checkbox" class="node-toggle" data-node="end" checked disabled>
                    <span class="toggle-slider"></span>
                </label>
                <span class="toggle-label active" id="label-end">启用</span>
            </div>
        </div>
    </div>
 
    <div class="status-bar">
        <p class="status-text">当前状态:<span id="enabledCount" class="enabled-count">5</span>个节点已启用,<span id="disabledCount" class="disabled-count">0</span>个节点已禁用。<span id="statusDetail">所有节点均已启用,流程可正常执行。</span></p>
    </div>
 
    <div class="controls">
        <button class="btn btn-save" id="saveBtn">保存配置</button>
        <button class="btn btn-reset" id="resetBtn">重置为默认</button>
    </div>
</div>
 
<script>
    document.addEventListener('DOMContentLoaded', function() {
        // 获取所有节点切换开关
        const nodeToggles = document.querySelectorAll('.node-toggle');
        const processLine = document.getElementById('processLine');
 
        // 更新连接线状态
        function updateProcessLine() {
            const enabledNodes = [];
 
            nodeToggles.forEach(toggle => {
                if (toggle.checked) {
                    enabledNodes.push(toggle.dataset.node);
                }
            });
 
            // 如果所有节点都启用,将连接线设置为激活状态
            if (enabledNodes.length === nodeToggles.length) {
                processLine.classList.add('active');
            } else {
                processLine.classList.remove('active');
            }
 
            // 更新节点指示器状态
            nodeToggles.forEach(toggle => {
                const node = toggle.dataset.node;
                const nodeIndicator = document.getElementById(`node-${node}`);
                const label = document.getElementById(`label-${node}`);
 
                if (toggle.checked) {
                    nodeIndicator.classList.remove('disabled');
                    label.textContent = '启用';
                    label.className = 'toggle-label active';
                } else {
                    nodeIndicator.classList.add('disabled');
                    label.textContent = '禁用';
                    label.className = 'toggle-label inactive';
                }
            });
 
            // 更新状态栏
            updateStatusBar();
        }
 
        // 更新状态栏信息
        function updateStatusBar() {
            const enabledCount = document.querySelectorAll('.node-toggle:checked').length;
            const disabledCount = nodeToggles.length - enabledCount;
 
            document.getElementById('enabledCount').textContent = enabledCount;
            document.getElementById('disabledCount').textContent = disabledCount;
 
            const statusDetail = document.getElementById('statusDetail');
 
            if (enabledCount === nodeToggles.length) {
                statusDetail.textContent = '所有节点均已启用,流程可正常执行。';
            } else if (disabledCount === nodeToggles.length) {
                statusDetail.textContent = '所有节点均已禁用,流程无法执行。';
            } else if (disabledCount === 1) {
                statusDetail.textContent = '有1个节点被禁用,流程将跳过该节点执行。';
            } else {
                statusDetail.textContent = `有${disabledCount}个节点被禁用,流程将跳过这些节点执行。`;
            }
        }
 
        // 为每个切换开关添加事件监听
        nodeToggles.forEach(toggle => {
            toggle.addEventListener('change', updateProcessLine);
        });
 
        // 保存配置按钮
        document.getElementById('saveBtn').addEventListener('click', function() {
            const config = {};
            nodeToggles.forEach(toggle => {
                config[toggle.dataset.node] = toggle.checked;
            });
 
            // 在实际应用中,这里会发送配置到服务器
            // 现在只显示一个提示
            alert('配置已保存!\n\n当前配置:\n' +
                JSON.stringify(config, null, 2));
 
            // 添加视觉反馈
            this.textContent = '保存成功!';
            this.style.backgroundColor = '#2ecc71';
 
            setTimeout(() => {
                this.textContent = '保存配置';
                this.style.backgroundColor = '#3498db';
            }, 1500);
        });
 
        // 重置按钮
        document.getElementById('resetBtn').addEventListener('click', function() {
            if (confirm('确定要重置所有节点配置为默认状态吗?')) {
                nodeToggles.forEach(toggle => {
                    // 结束节点始终启用且不可更改
                    if (toggle.dataset.node === 'end') {
                        toggle.checked = true;
                        toggle.disabled = true;
                    } else {
                        toggle.checked = true;
                    }
                });
 
                updateProcessLine();
 
                // 添加视觉反馈
                this.textContent = '已重置!';
                this.style.backgroundColor = '#9b59b6';
 
                setTimeout(() => {
                    this.textContent = '重置为默认';
                    this.style.backgroundColor = '#ecf0f1';
                }, 1500);
            }
        });
 
        // 为节点指示器添加点击切换功能
        document.querySelectorAll('.node-indicator').forEach(indicator => {
            // 跳过结束节点,因为它不可禁用
            if (indicator.id === 'node-end') return;
 
            indicator.addEventListener('click', function() {
                const nodeId = this.id.replace('node-', '');
                const toggle = document.querySelector(`.node-toggle[data-node="${nodeId}"]`);
 
                if (toggle && !toggle.disabled) {
                    toggle.checked = !toggle.checked;
                    toggle.dispatchEvent(new Event('change'));
                }
            });
        });
 
        // 初始化状态
        updateProcessLine();
    });
</script>
</body>
</html>