sgj
2026-02-26 d0b93ade5d7a25f5b4a413c16bcc1c1b3d154b92
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
<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org">
<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: #FFF;
            color: #333;
            line-height: 1.6;
            overflow: hidden;
        }
 
        .container {
            max-width: 1000px;
            margin: 0 auto;
            padding: 10px;
        }
 
        .process-container {
            position: relative;
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 25px;
        }
 
        /* 连接线 */
        .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: #FFF;
            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.node1 {
            background: linear-gradient(135deg, #3498db, #2980b9);
        }
 
        .node-indicator.node2 {
            background: linear-gradient(135deg, #9b59b6, #8e44ad);
        }
 
        .node-indicator.node3 {
            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: #FFF;
            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;
        }
 
        .status-bar {
            background-color: #fcf8e3;
            border-color: #faebcc;
            padding: 15px 15px;
            border-radius: 6px;
            margin-top: 15px;
            /*border-left: 4px solid #037d41;*/
        }
        .status-text {
            font-size: 13px;
            color: #2c3e50;
        }
        @media (max-width: 768px) {
            .process-container {
                flex-direction: column;
                align-items: center;
            }
            .node {
                margin-bottom: 15px;
                width: 100%;
            }
            .process-line {
                display: none;
            }
        }
    </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" id="name-start">开始节点</div>
            <div class="toggle-container">
                <label class="toggle-switch">
                    <input type="checkbox" class="node-toggle" data-node="start" checked disabled>
                    <span class="toggle-slider"></span>
                </label>
                <span class="toggle-label active" id="label-start">启用</span>
            </div>
        </div>
 
        <!-- 库区审批 -->
        <div class="node">
            <div class="node-indicator node1" id="node-node1">库区</div>
            <div class="node-label" id="name-node1">库区领导审批</div>
            <div class="toggle-container">
                <label class="toggle-switch">
                    <input type="checkbox" class="node-toggle" data-node="node1" id="nodeVal1" th:checked="${data.nodeVal1=='Y'}" >
                    <span class="toggle-slider"></span>
                </label>
                <span class="toggle-label active" id="label-node1" th:text="${data.nodeVal1=='Y'?'启用':'禁用'}">启用</span>
            </div>
        </div>
 
        <!-- 监管审批 -->
        <div class="node">
            <div class="node-indicator node2" id="node-node2">监管</div>
            <div class="node-label" id="name-node2">监管审批</div>
            <div class="toggle-container">
                <label class="toggle-switch">
                    <input type="checkbox" class="node-toggle" data-node="node2" id="nodeVal2" th:checked="${data.nodeVal2=='Y'}">
                    <span class="toggle-slider"></span>
                </label>
                <span class="toggle-label active" id="label-node2" th:text="${data.nodeVal2=='Y'?'启用':'禁用'}">启用</span>
            </div>
        </div>
 
        <!-- 银行审批 -->
        <div class="node">
            <div class="node-indicator node3" id="node-node3">银行</div>
            <div class="node-label" id="name-node3">银行审批</div>
            <div class="toggle-container">
                <label class="toggle-switch">
                    <input type="checkbox" class="node-toggle" data-node="node3" id="nodeVal3" th:checked="${data.nodeVal3=='Y'}">
                    <span class="toggle-slider"></span>
                </label>
                <span class="toggle-label active" id="label-node3" th:text="${data.nodeVal3=='Y'?'启用':'禁用'}">启用</span>
            </div>
        </div>
 
        <!-- 结束节点 -->
        <div class="node">
            <div class="node-indicator end" id="node-end">结束</div>
            <div class="node-label" id="name-end">结束节点</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">
               注:1.启用流程=否,当前流程不使用,业务流程不配置对应业务不执行工单审批。<br>
           2.启用节点的有权限的任何人均可进行处理和审批,如工单指派人员,则仅处理人可以处理。
        </p>
    </div>
</div>
</body>
 
<script th:inline="javascript">
    const data = [[${data}]];
</script>
<script th:src="@{/js/jquery.min.js}"></script>
<script>
    $(function () {
        // 获取所有节点切换开关
        const nodeToggles = document.querySelectorAll('.node-toggle');
        const processLine = document.getElementById('processLine');
 
        // 更新连接线状态
        function updateProcessLine() {
            const nodes =[];
            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}`);
                const name = document.getElementById(`name-${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';
                }
 
                //封装数据用于传递给后台
                nodes.push({
                    node: node,
                    val: toggle.checked,
                    name: name.textContent
                });
            });
            //console.log(nodes);
            //数据传输给上级页面
            window.parent.onNodeValChange(nodes);
        }
 
        // 为每个切换开关添加事件监听
        nodeToggles.forEach(toggle => {
            toggle.addEventListener('change', updateProcessLine);
        });
 
        // 为节点指示器添加点击切换功能
        document.querySelectorAll('.node-indicator').forEach(indicator => {
            // 跳过结束节点,因为它不可禁用
            if (indicator.id === 'node-end' || indicator.id === 'node-start') 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>
</html>