reimbursement-form.vue
44.7 KB
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
<template>
<view class="form-container">
<view class="form-card">
<view class="form-content">
<form @submit="handleFormSubmit">
<!-- 申请人 -->
<!-- <view class="form-group">
<text class="form-label">申请人</text>
<view class="input-wrapper">
<u-input v-model="formData.applicationUserName" placeholder="自动填充" readonly
class="select-input" />
</view>
</view> -->
<!-- 申请门店 -->
<!-- <view class="form-group">
<text class="form-label">申请门店</text>
<view class="input-wrapper">
<u-input v-model="formData.applicationStoreName" placeholder="自动填充" readonly
class="select-input" />
</view>
</view> -->
<!-- 申请时间 -->
<view class="form-group">
<text class="form-label">申请时间</text>
<view class="input-wrapper">
<picker mode="date" :value="formData.applicationTimeStr" @change="onApplicationTimeChange">
<view class="custom-select">
<text class="select-text">{{ formData.applicationTimeStr || '请选择申请时间' }}</text>
<text class="select-arrow">▼</text>
</view>
</picker>
</view>
</view>
<!-- 总金额 -->
<view class="form-group">
<text class="form-label">总金额</text>
<view class="input-wrapper">
<u-input v-model="formData.amount" placeholder="自动计算" type="digit" readonly
class="select-input" />
</view>
</view>
<!-- 购买物品清单 -->
<view class="form-group">
<text class="form-label">购买物品清单</text>
<view class="input-wrapper">
<view class="purchase-select-btn" @tap="openPurchaseDialog">
<text class="btn-text">选择购买物品</text>
</view>
<text v-if="selectedPurchaseRecords.length > 0" class="selected-count">
已选择 {{ selectedPurchaseRecords.length }} 条记录
</text>
</view>
</view>
<!-- 已选择的购买物品清单 -->
<view class="form-group" v-if="selectedPurchaseRecords.length > 0">
<view class="purchase-list">
<view v-for="(item, index) in selectedPurchaseRecords" :key="item.id || index" class="purchase-item">
<view class="purchase-item-header">
<text class="purchase-category">{{ item.reimbursementCategoryName || '无' }}</text>
<view class="purchase-item-actions">
<text v-if="item.isInitial" class="initial-mark">初始记录</text>
<view v-if="!item.isInitial" class="purchase-remove" @tap="removePurchaseRecord(index)">
<text class="remove-icon">✕</text>
</view>
</view>
</view>
<view class="purchase-item-details">
<text class="purchase-detail">单价: ¥{{ item.unitPrice || 0 }}</text>
<text class="purchase-detail">数量: {{ item.quantity || 0 }}</text>
<text class="purchase-detail amount">金额: ¥{{ item.amount || 0 }}</text>
</view>
<view class="purchase-item-time">
<text class="purchase-time">购买时间: {{ formatTime(item.purchaseTime) }}</text>
</view>
</view>
</view>
</view>
<!-- 审批节点配置(仅新建时显示) -->
<view class="form-group" v-if="!formData.id">
<view class="nodes-header">
<text class="form-label">审批节点配置(1-5个节点)</text>
<view class="add-node-btn" @tap="addNode" v-if="formData.nodes.length < 5">
<text class="add-node-text">+ 添加节点</text>
</view>
</view>
<view class="nodes-list">
<view v-for="(node, index) in formData.nodes" :key="index" class="node-item">
<view class="node-header">
<text class="node-order">节点 {{ node.nodeOrder }}</text>
<view v-if="formData.nodes.length > 1" class="remove-node-btn" @tap="removeNode(index)">
<text class="remove-node-text">删除</text>
</view>
</view>
<view class="node-form">
<view class="node-form-item">
<text class="node-label">节点名称</text>
<u-input v-model="node.nodeName" placeholder="请输入节点名称" class="node-input" />
</view>
<view class="node-form-item">
<text class="node-label">审批类型</text>
<picker mode="selector" :range="['会签', '或签']" :value="node.approvalType === '会签' ? 0 : (node.approvalType === '或签' ? 1 : -1)" @change="(e) => { node.approvalType = ['会签', '或签'][e.detail.value] }">
<view class="custom-select">
<text class="select-text">{{ node.approvalType || '请选择审批类型' }}</text>
<text class="select-arrow">▼</text>
</view>
</picker>
</view>
<view class="node-form-item">
<text class="node-label">审批人</text>
<view class="approver-select-wrapper">
<view class="approver-select-btn" @tap="openUserDialog(index)">
<text class="approver-btn-text">{{ getApproverDisplayText(node) }}</text>
</view>
<view v-if="node.approverNames && node.approverNames.length > 0" class="approver-tags">
<view v-for="(name, nameIndex) in node.approverNames" :key="nameIndex" class="approver-tag">
{{ name }}
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 提交按钮 -->
<view class="btn-group">
<button type="submit" class="btn btn-primary"
:style="{opacity: isSubmitting ? 0.5 : 1}"
@tap="isSubmitting ? null : handleFormSubmit()">
{{ isSubmitting ? '提交中...' : (formData.id ? '更新' : '提交') }}
</button>
</view>
</form>
</view>
</view>
<!-- 选择购买物品弹窗 -->
<view v-if="showPurchaseDialog" class="modal-overlay" @tap="closePurchaseDialog">
<view class="modal-content" @tap.stop>
<view class="modal-header">
<text class="modal-title">选择购买物品</text>
<view class="modal-close" @tap="closePurchaseDialog">
<text class="close-icon">✕</text>
</view>
</view>
<view class="modal-body">
<!-- 搜索框 -->
<view class="search-box">
<u-input v-model="searchKeyword" placeholder="搜索分类名称" @input="handleSearch"
class="search-input" />
</view>
<!-- 购买记录列表 -->
<scroll-view scroll-y class="purchase-dialog-list" @scrolltolower="loadMorePurchaseRecords">
<view v-if="purchaseListLoading && filteredPurchaseList.length === 0" class="loading-text">加载中...</view>
<view v-else-if="!purchaseListLoading && filteredPurchaseList.length === 0" class="empty-text">暂无可用记录</view>
<view v-else>
<view
v-for="(item, index) in filteredPurchaseList"
:key="item.id || index"
class="purchase-dialog-item"
:class="{ 'selected': isPurchaseSelected(item.id) }"
@tap="togglePurchaseSelection(item)">
<view class="purchase-dialog-header">
<text class="purchase-dialog-category">{{ item.reimbursementCategoryName || '无' }}</text>
<view v-if="isPurchaseSelected(item.id)" class="selected-mark">✓</view>
</view>
<view class="purchase-dialog-details">
<text class="purchase-dialog-detail">单价: ¥{{ item.unitPrice || 0 }}</text>
<text class="purchase-dialog-detail">数量: {{ item.quantity || 0 }}</text>
<text class="purchase-dialog-detail amount">金额: ¥{{ item.amount || 0 }}</text>
</view>
<view class="purchase-dialog-time">
<text>{{ formatTime(item.purchaseTime) }}</text>
</view>
</view>
<view v-if="purchaseListLoading && filteredPurchaseList.length > 0" class="loading-more">加载更多...</view>
</view>
</scroll-view>
</view>
<view class="modal-footer">
<button class="modal-btn cancel-btn" @tap="closePurchaseDialog">取消</button>
<button class="modal-btn confirm-btn" @tap="confirmPurchaseSelection">确定</button>
</view>
</view>
</view>
<!-- 选择审批人弹窗 -->
<view v-if="showUserDialog" class="modal-overlay" @tap="closeUserDialog">
<view class="modal-content" @tap.stop>
<view class="modal-header">
<text class="modal-title">选择审批人</text>
<view class="modal-close" @tap="closeUserDialog">
<text class="close-icon">✕</text>
</view>
</view>
<view class="modal-body">
<!-- 搜索框 -->
<view class="search-box">
<u-input v-model="userSearchKeyword" placeholder="搜索用户姓名或账号" @input="handleUserSearch"
class="search-input" />
</view>
<!-- 用户列表 -->
<scroll-view scroll-y class="user-dialog-list" @scrolltolower="loadMoreUsers">
<view v-if="userListLoading && userList.length === 0" class="loading-text">加载中...</view>
<view v-else-if="!userListLoading && userList.length === 0" class="empty-text">暂无用户</view>
<view v-else>
<view
v-for="(item, index) in filteredUserList"
:key="item.id || index"
class="user-dialog-item"
:class="{ 'selected': isUserSelected(item.id) }"
@tap="toggleUserSelection(item)">
<view class="user-dialog-header">
<text class="user-dialog-name">{{ item.fullName || item.realName || item.userName || item.id || '无' }}</text>
<view v-if="isUserSelected(item.id)" class="selected-mark">✓</view>
</view>
<view class="user-dialog-details">
<text class="user-dialog-detail">账号: {{ item.account || '无' }}</text>
<text class="user-dialog-detail">ID: {{ item.id || '无' }}</text>
</view>
</view>
<view v-if="userListLoading && filteredUserList.length > 0" class="loading-more">加载更多...</view>
<view v-else-if="!userListLoading && filteredUserList.length >= userTotal && userTotal > 0" class="no-more">没有更多了</view>
<view v-if="userTotal > 0" class="pagination-info">
<text>共 {{ userTotal }} 人,已加载 {{ filteredUserList.length }} 人</text>
</view>
</view>
</scroll-view>
</view>
<view class="modal-footer">
<button class="modal-btn cancel-btn" @tap="closeUserDialog">取消</button>
<button class="modal-btn confirm-btn" @tap="confirmUserSelection">确定</button>
</view>
</view>
</view>
</view>
</template>
<script>
import api from '@/apis/index.js'
import purchaseApi from '@/apis/modules/purchase.js'
import oauthApi from '@/apis/modules/oauth.js'
export default {
data() {
return {
isSubmitting: false,
formData: {
id: undefined,
applicationUserId: undefined,
applicationUserName: undefined,
applicationStoreId: undefined,
applicationStoreName: undefined,
applicationTime: undefined,
applicationTimeStr: undefined,
amount: undefined,
approveStatus: '未审批',
selectedPurchaseRecordIds: [],
nodes: [] // 审批节点配置
},
selectedPurchaseRecords: [],
initialPurchaseRecordIds: [], // 存储初始的购买记录ID列表(编辑时使用)
// 购买物品选择弹窗相关
showPurchaseDialog: false,
purchaseList: [],
filteredPurchaseList: [],
purchaseListLoading: false,
purchaseQuery: {
currentPage: 1,
pageSize: 20,
reimbursementCategoryName: ''
},
purchaseTotal: 0,
tempSelectedPurchaseIds: [],
searchKeyword: '',
userInfo: null,
newuserInfo: null,
// 用户选择弹窗相关
showUserDialog: false,
currentNodeIndex: -1, // 当前正在编辑的节点索引
userList: [],
filteredUserList: [],
userListLoading: false,
userQuery: {
currentPage: 1,
pageSize: 20,
keyword: ''
},
userTotal: 0,
tempSelectedUserIds: [], // 临时选中的用户ID列表
searchTimer: null // 搜索防抖定时器
}
},
onLoad(options) {
this.initializePage(options)
},
methods: {
// 初始化页面
async initializePage(options) {
try {
// 获取用户信息
this.userInfo = uni.getStorageSync('userInfo')
this.newuserInfo = uni.getStorageSync('newuserInfo')
if (!this.userInfo || Object.keys(this.userInfo).length === 0) {
uni.showToast({
title: '请先登录',
icon: 'none'
})
setTimeout(() => {
uni.reLaunch({
url: '/pages/login/login'
})
}, 1500)
return
}
// 设置默认值
this.setDefaultValues()
// 如果有ID,加载编辑数据
if (options.id) {
await this.loadEditData(options.id)
}
} catch (error) {
console.error('页面初始化失败:', error)
uni.showToast({
title: '页面初始化失败',
icon: 'none'
})
}
},
// 设置默认值
setDefaultValues() {
// 申请人:当前登录用户
if (this.userInfo && this.userInfo.userId) {
this.formData.applicationUserId = this.userInfo.userId
this.formData.applicationUserName = this.userInfo.realName || this.userInfo.userName || '当前用户'
}
// 申请门店:当前登录用户的门店
if (this.newuserInfo && this.newuserInfo.mdid) {
this.formData.applicationStoreId = this.newuserInfo.mdid
this.formData.applicationStoreName = this.newuserInfo.mdmc || '当前门店'
} else if (this.userInfo && this.userInfo.mdid) {
this.formData.applicationStoreId = this.userInfo.mdid
this.formData.applicationStoreName = this.userInfo.mdmc || '当前门店'
}
// 申请时间:默认今日
const today = new Date()
today.setHours(0, 0, 0, 0)
this.formData.applicationTime = today.getTime()
this.formData.applicationTimeStr = today.toISOString().split('T')[0]
// 初始化审批节点(仅新建时)
if (!this.formData.id) {
this.initNodes()
}
},
// 初始化审批节点(新建时默认1个节点)
initNodes() {
this.formData.nodes = [
{
nodeOrder: 1,
nodeName: '',
approvalType: '',
approverIds: '',
approverNames: []
}
]
},
// 添加节点
addNode() {
if (this.formData.nodes.length >= 5) {
uni.showToast({
title: '最多只能添加5个节点',
icon: 'none'
})
return
}
const nextOrder = this.formData.nodes.length + 1
this.formData.nodes.push({
nodeOrder: nextOrder,
nodeName: '',
approvalType: '',
approverIds: '',
approverNames: []
})
},
// 删除节点
removeNode(index) {
if (this.formData.nodes.length <= 1) {
uni.showToast({
title: '至少需要1个节点',
icon: 'none'
})
return
}
this.formData.nodes.splice(index, 1)
// 重新排序
this.formData.nodes.forEach((node, idx) => {
node.nodeOrder = idx + 1
})
},
// 打开用户选择弹窗
openUserDialog(nodeIndex) {
this.currentNodeIndex = nodeIndex
this.showUserDialog = true
const node = this.formData.nodes[nodeIndex]
// 初始化已选中的用户ID
if (node.approverIds) {
const idsArray = typeof node.approverIds === 'string'
? node.approverIds.split(',').filter(id => id && id.trim())
: (Array.isArray(node.approverIds) ? node.approverIds : [])
this.tempSelectedUserIds = [...idsArray]
} else {
this.tempSelectedUserIds = []
}
this.userSearchKeyword = ''
this.userQuery.currentPage = 1
this.userList = []
this.filteredUserList = []
this.loadUsers()
},
// 关闭用户选择弹窗
closeUserDialog() {
this.showUserDialog = false
this.currentNodeIndex = -1
this.userSearchKeyword = ''
this.tempSelectedUserIds = []
// 清除搜索定时器
if (this.searchTimer) {
clearTimeout(this.searchTimer)
this.searchTimer = null
}
},
// 加载用户列表
async loadUsers() {
try {
this.userListLoading = true
const params = {
currentPage: this.userQuery.currentPage,
pageSize: this.userQuery.pageSize
}
// 如果有搜索关键词,添加keyword参数
if (this.userSearchKeyword && this.userSearchKeyword.trim()) {
params.keyword = this.userSearchKeyword.trim()
}
const res = await oauthApi.getUserList(params)
if (res.code === 200 && res.data) {
const newList = res.data.list || []
if (this.userQuery.currentPage === 1) {
// 第一页,替换数据
this.userList = newList
this.filteredUserList = newList
} else {
// 后续页,追加数据
this.userList = [...this.userList, ...newList]
this.filteredUserList = [...this.filteredUserList, ...newList]
}
// 获取总数,优先使用pagination.Total,如果没有则使用当前列表长度
const total = res.data.pagination && res.data.pagination.Total
if (total !== undefined && total !== null) {
this.userTotal = total
} else {
// 如果没有总数信息,根据当前页和返回数据判断
if (newList.length < this.userQuery.pageSize) {
// 返回的数据少于每页数量,说明是最后一页
this.userTotal = this.filteredUserList.length + newList.length
} else {
// 可能还有更多数据,暂时设置为当前数量+1(表示可能还有)
this.userTotal = this.filteredUserList.length + newList.length + 1
}
}
} else {
if (this.userQuery.currentPage === 1) {
this.userList = []
this.filteredUserList = []
}
this.userTotal = 0
}
} catch (error) {
console.error('加载用户列表失败:', error)
uni.showToast({
title: '加载用户列表失败',
icon: 'none'
})
if (this.userQuery.currentPage === 1) {
this.userList = []
this.filteredUserList = []
}
this.userTotal = 0
} finally {
this.userListLoading = false
}
},
// 调用getUserInfoList API
async loadUserInfoList(userIds) {
const request = require('@/service/request.js').default
const config = require('@/common/config.js').default
try {
return await request.post(`${config.getApiBaseUrl()}/api/permission/Users/getUserList`, {
userId: userIds
})
} catch (error) {
console.error('获取用户信息失败:', error)
return { code: 500, data: { list: [] } }
}
},
// 通过用户ID搜索用户
async searchUserById() {
if (!this.userSearchKeyword.trim()) {
uni.showToast({
title: '请输入用户ID',
icon: 'none'
})
return
}
try {
this.userListLoading = true
const userIds = this.userSearchKeyword.split(',').map(id => id.trim()).filter(id => id)
if (userIds.length === 0) {
uni.showToast({
title: '请输入有效的用户ID',
icon: 'none'
})
return
}
const res = await this.loadUserInfoList(userIds)
if (res.code === 200 && res.data && res.data.list) {
// 合并到现有列表,去重
const existingIds = new Set(this.userList.map(u => u.id))
const newUsers = res.data.list.filter(u => !existingIds.has(u.id))
this.userList = [...this.userList, ...newUsers]
this.filteredUserList = this.userList
this.userTotal = this.userList.length
// 如果搜索的用户不在列表中,提示
if (newUsers.length === 0 && res.data.list.length > 0) {
uni.showToast({
title: '用户已在列表中',
icon: 'none'
})
}
} else {
uni.showToast({
title: '未找到用户',
icon: 'none'
})
}
} catch (error) {
console.error('搜索用户失败:', error)
uni.showToast({
title: '搜索用户失败',
icon: 'none'
})
} finally {
this.userListLoading = false
}
},
// 加载更多用户
loadMoreUsers() {
if (this.userListLoading) return
if (this.filteredUserList.length >= this.userTotal && this.userTotal > 0) {
return
}
this.userQuery.currentPage++
this.loadUsers()
},
// 搜索用户
handleUserSearch() {
// 防抖处理,延迟500ms后执行搜索
clearTimeout(this.searchTimer)
this.searchTimer = setTimeout(() => {
this.userQuery.currentPage = 1
this.userList = []
this.filteredUserList = []
this.loadUsers()
}, 500)
},
// 切换用户选择状态
toggleUserSelection(user) {
const index = this.tempSelectedUserIds.indexOf(user.id)
if (index > -1) {
this.tempSelectedUserIds.splice(index, 1)
} else {
this.tempSelectedUserIds.push(user.id)
}
},
// 判断用户是否已选中
isUserSelected(userId) {
return this.tempSelectedUserIds.indexOf(userId) > -1
},
// 确认选择用户
async confirmUserSelection() {
if (this.currentNodeIndex < 0) return
const node = this.formData.nodes[this.currentNodeIndex]
// 保存选中的用户ID(逗号分隔的字符串)
node.approverIds = this.tempSelectedUserIds.join(',')
// 获取用户名列表
if (this.tempSelectedUserIds.length > 0) {
// 从已加载的用户列表中获取用户名
const selectedUsers = this.userList.filter(user =>
this.tempSelectedUserIds.indexOf(user.id) > -1
)
// 如果有些用户不在当前列表中,需要单独获取
const missingIds = this.tempSelectedUserIds.filter(id =>
!selectedUsers.find(u => u.id === id)
)
if (missingIds.length > 0) {
try {
const res = await this.loadUserInfoList(missingIds)
if (res.code === 200 && res.data && res.data.list) {
selectedUsers.push(...res.data.list)
}
} catch (error) {
console.error('获取用户信息失败:', error)
}
}
node.approverNames = selectedUsers.map(user =>
user.fullName || user.realName || user.userName || user.id
)
} else {
node.approverNames = []
}
this.closeUserDialog()
},
// 获取审批人显示文本
getApproverDisplayText(node) {
if (node.approverNames && node.approverNames.length > 0) {
return `已选择 ${node.approverNames.length} 人`
}
return '请选择审批人'
},
// 申请时间变化
onApplicationTimeChange(e) {
this.formData.applicationTimeStr = e.detail.value
const date = new Date(e.detail.value)
date.setHours(0, 0, 0, 0)
this.formData.applicationTime = date.getTime()
},
// 打开购买物品选择弹窗
openPurchaseDialog() {
this.showPurchaseDialog = true
this.tempSelectedPurchaseIds = this.selectedPurchaseRecords.map(item => item.id)
this.searchKeyword = ''
this.purchaseQuery.currentPage = 1
this.loadPurchaseRecords()
},
// 关闭购买物品选择弹窗
closePurchaseDialog() {
this.showPurchaseDialog = false
this.searchKeyword = ''
},
// 加载购买记录(使用分页接口)
async loadPurchaseRecords() {
try {
this.purchaseListLoading = true
const params = {
currentPage: this.purchaseQuery.currentPage,
pageSize: this.purchaseQuery.pageSize,
approveStatus: '未审批', // 只选择未审批的购买记录
// createUserStoreId: this.formData.applicationStoreId || '暂无',
createUser:this.newuserInfo&&this.newuserInfo.id?this.newuserInfo.id:'暂无',
}
if (this.searchKeyword) {
params.reimbursementCategoryName = this.searchKeyword
}
const res = await purchaseApi.getPurchaseList(params)
if (res.code === 200 && res.data) {
const newList = res.data.list || []
if (this.purchaseQuery.currentPage === 1) {
// 第一页,替换数据
this.purchaseList = newList
this.filteredPurchaseList = newList
} else {
// 后续页,追加数据
this.purchaseList = [...this.purchaseList, ...newList]
this.filteredPurchaseList = [...this.filteredPurchaseList, ...newList]
}
this.purchaseTotal = (res.data.pagination && res.data.pagination.Total) || 0
} else {
if (this.purchaseQuery.currentPage === 1) {
this.purchaseList = []
this.filteredPurchaseList = []
}
this.purchaseTotal = 0
}
} catch (error) {
console.error('加载购买记录失败:', error)
uni.showToast({
title: '加载购买记录失败',
icon: 'none'
})
if (this.purchaseQuery.currentPage === 1) {
this.purchaseList = []
this.filteredPurchaseList = []
}
this.purchaseTotal = 0
} finally {
this.purchaseListLoading = false
}
},
// 加载更多购买记录
loadMorePurchaseRecords() {
if (this.purchaseListLoading) return
if (this.filteredPurchaseList.length >= this.purchaseTotal) return
this.purchaseQuery.currentPage++
this.loadPurchaseRecords()
},
// 搜索购买记录
handleSearch() {
this.purchaseQuery.currentPage = 1
this.purchaseList = []
this.filteredPurchaseList = []
this.loadPurchaseRecords()
},
// 切换购买记录选择状态
togglePurchaseSelection(item) {
const index = this.tempSelectedPurchaseIds.indexOf(item.id)
if (index > -1) {
this.tempSelectedPurchaseIds.splice(index, 1)
} else {
this.tempSelectedPurchaseIds.push(item.id)
}
},
// 判断购买记录是否已选中
isPurchaseSelected(id) {
return this.tempSelectedPurchaseIds.indexOf(id) > -1
},
// 确认选择购买物品
confirmPurchaseSelection() {
// 根据选中的ID找到对应的记录
const selectedRecords = this.purchaseList.filter(item =>
this.tempSelectedPurchaseIds.indexOf(item.id) > -1
)
// 去重:移除已存在的记录
const existingIds = new Set(this.selectedPurchaseRecords.map(item => item.id))
const newRecords = selectedRecords.filter(item => !existingIds.has(item.id)).map(record => {
// 标记新增的记录
record.isInitial = false
return record
})
// 追加新选中的记录
this.selectedPurchaseRecords = [...this.selectedPurchaseRecords, ...newRecords]
// 更新ID列表
this.formData.selectedPurchaseRecordIds = this.selectedPurchaseRecords.map(item => item.id)
// 自动计算总金额
this.calculateTotalAmount()
this.closePurchaseDialog()
},
// 移除已选中的购买记录
removePurchaseRecord(index) {
const record = this.selectedPurchaseRecords[index]
// 检查是否是初始记录,初始记录不允许移除(编辑时)
if (record && record.isInitial) {
uni.showToast({
title: '初始购买记录不能移除',
icon: 'none'
})
return
}
this.selectedPurchaseRecords.splice(index, 1)
this.formData.selectedPurchaseRecordIds = this.selectedPurchaseRecords.map(item => item.id)
this.calculateTotalAmount()
},
// 计算总金额
calculateTotalAmount() {
const totalAmount = this.selectedPurchaseRecords.reduce((sum, item) => {
return sum + (parseFloat(item.amount) || 0)
}, 0)
this.formData.amount = totalAmount.toFixed(2)
},
// 加载编辑数据
async loadEditData(id) {
try {
uni.showLoading({
title: '加载中...'
})
const res = await api.getReimbursementDetail(id)
if (res.code === 200 && res.data) {
const data = res.data
const formData = data.form || data
const purchaseRecords = data.purchaseRecords || []
this.formData = {
id: formData.id,
applicationUserId: formData.applicationUserId,
applicationUserName: formData.applicationUserName,
applicationStoreId: formData.applicationStoreId,
applicationStoreName: formData.applicationStoreName,
applicationTime: formData.applicationTime,
applicationTimeStr: formData.applicationTime ? new Date(formData.applicationTime).toISOString().split('T')[0] : undefined,
amount: formData.amount,
approveStatus: formData.approveStatus || formData.approvalStatus || '待审批',
selectedPurchaseRecordIds: [],
nodes: [] // 编辑时不需要节点配置
}
// 保存初始的购买记录ID列表
this.initialPurchaseRecordIds = purchaseRecords.map(record => record.id)
// 填充购买记录列表,标记初始记录
this.selectedPurchaseRecords = purchaseRecords.map(record => {
// 处理附件字段
if (record.attachment) {
try {
record.attachment = typeof record.attachment === 'string'
? JSON.parse(record.attachment)
: record.attachment
} catch (e) {
record.attachment = []
}
} else {
record.attachment = []
}
// 标记为初始记录
record.isInitial = true
return record
})
this.formData.selectedPurchaseRecordIds = this.selectedPurchaseRecords.map(item => item.id)
// 计算总金额
this.calculateTotalAmount()
} else {
throw new Error(res.message || '加载数据失败')
}
} catch (error) {
console.error('加载编辑数据失败:', error)
uni.showToast({
title: '加载数据失败',
icon: 'none'
})
} finally {
uni.hideLoading()
}
},
// 表单提交
async handleFormSubmit() {
// 验证必填项
if (!this.formData.selectedPurchaseRecordIds || this.formData.selectedPurchaseRecordIds.length === 0) {
uni.showToast({
title: '请至少选择一条购买记录',
icon: 'none'
})
return
}
// 新建时验证节点配置
if (!this.formData.id) {
if (!this.formData.nodes || this.formData.nodes.length < 1 || this.formData.nodes.length > 5) {
uni.showToast({
title: '审批节点数量必须在1-5个之间',
icon: 'none'
})
return
}
// 验证每个节点
for (let i = 0; i < this.formData.nodes.length; i++) {
const node = this.formData.nodes[i]
if (!node.nodeName) {
uni.showToast({
title: `请填写节点${node.nodeOrder}的名称`,
icon: 'none'
})
return
}
if (!node.approvalType) {
uni.showToast({
title: `请选择节点${node.nodeOrder}的审批类型`,
icon: 'none'
})
return
}
// 验证审批人
let approverIdsArray = []
if (node.approverIds) {
if (Array.isArray(node.approverIds)) {
approverIdsArray = node.approverIds.filter(id => id)
} else if (typeof node.approverIds === 'string') {
approverIdsArray = node.approverIds.split(',').filter(id => id && id.trim())
}
}
if (approverIdsArray.length === 0) {
uni.showToast({
title: `请为节点${node.nodeOrder}选择至少一个审批人`,
icon: 'none'
})
return
}
}
}
if (this.isSubmitting) return
try {
this.isSubmitting = true
uni.showLoading({
title: '提交中...'
})
let submitData = {}
if (this.formData.id) {
// 更新:只传递有值的字段
submitData = {
id: this.formData.id
}
if (this.formData.applicationUserId) {
submitData.applicationUserId = this.formData.applicationUserId
}
if (this.formData.applicationUserName) {
submitData.applicationUserName = this.formData.applicationUserName
}
if (this.formData.applicationStoreId) {
submitData.applicationStoreId = this.formData.applicationStoreId
}
if (this.formData.applicationTime) {
submitData.applicationTime = this.formData.applicationTime
}
if (this.formData.amount) {
submitData.amount = this.formData.amount
}
if (this.formData.selectedPurchaseRecordIds && this.formData.selectedPurchaseRecordIds.length > 0) {
submitData.selectedPurchaseRecordIds = this.formData.selectedPurchaseRecordIds
}
const res = await api.updateReimbursement(this.formData.id, submitData)
if (res.code === 200) {
uni.showToast({
title: '修改成功',
icon: 'success'
})
// 修改成功后,自动重新提交审批
try {
const submitRes = await api.submitApproval(this.formData.id)
if (submitRes.code === 200) {
uni.showToast({
title: '已重新提交审批',
icon: 'success'
})
} else {
uni.showToast({
title: '修改成功,但重新提交审批失败',
icon: 'none'
})
}
} catch (error) {
console.error('重新提交审批失败:', error)
uni.showToast({
title: '修改成功,但重新提交审批失败,请手动提交',
icon: 'none'
})
}
setTimeout(() => {
uni.navigateBack()
}, 1500)
} else {
throw new Error(res.message || '修改失败')
}
} else {
// 创建
submitData = {
applicationUserId: this.formData.applicationUserId,
applicationUserName: this.formData.applicationUserName,
applicationStoreId: this.formData.applicationStoreId,
applicationTime: this.formData.applicationTime,
amount: this.formData.amount,
selectedPurchaseRecordIds: this.formData.selectedPurchaseRecordIds,
nodes: this.formData.nodes.map(node => {
// 转换审批人ID为数组
let approverIds = []
if (node.approverIds) {
if (Array.isArray(node.approverIds)) {
approverIds = node.approverIds.filter(id => id)
} else if (typeof node.approverIds === 'string') {
approverIds = node.approverIds.split(',').filter(id => id && id.trim())
}
}
return {
nodeOrder: node.nodeOrder,
nodeName: node.nodeName,
approvalType: node.approvalType,
approverIds: approverIds,
approverNames: node.approverNames && node.approverNames.length > 0
? node.approverNames
: approverIds
}
})
}
const res = await api.createReimbursement(submitData)
if (res.code === 200) {
uni.showToast({
title: '创建成功',
icon: 'success'
})
// 创建成功后,自动提交审批
let applicationId = null
if (res.data) {
if (typeof res.data === 'object' && res.data.id) {
applicationId = res.data.id
} else if (typeof res.data === 'string') {
applicationId = res.data
} else {
applicationId = String(res.data)
}
}
if (applicationId) {
try {
const submitRes = await api.submitApproval(applicationId)
if (submitRes.code === 200) {
uni.showToast({
title: '已自动提交审批',
icon: 'success'
})
} else {
uni.showToast({
title: '创建成功,但提交审批失败',
icon: 'none'
})
}
} catch (error) {
console.error('提交审批失败:', error)
uni.showToast({
title: '创建成功,但提交审批失败,请手动提交',
icon: 'none'
})
}
} else {
uni.showToast({
title: '创建成功,但无法获取申请ID,请手动提交审批',
icon: 'none'
})
}
setTimeout(() => {
uni.navigateBack()
}, 1500)
} else {
throw new Error(res.message || '创建失败')
}
}
} catch (error) {
console.error('提交失败:', error)
uni.showToast({
title: error.message || '提交失败,请重试',
icon: 'none'
})
} finally {
this.isSubmitting = false
uni.hideLoading()
}
},
// 格式化时间
formatTime(timestamp) {
if (!timestamp) return '无'
const date = new Date(timestamp)
return date.toLocaleString('zh-CN', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit'
})
}
}
}
</script>
<style lang="scss" scoped>
.form-container {
min-height: 100vh;
background: linear-gradient(135deg, #e8f5e9 0%, #b2dfdb 100%);
padding: 40rpx;
box-sizing: border-box;
}
.form-card {
background: #fff;
border-radius: 32rpx;
box-shadow: 0 8rpx 32rpx rgba(76, 175, 80, 0.1);
overflow: hidden;
}
.form-content {
padding: 40rpx;
}
.form-group {
margin-bottom: 32rpx;
}
.form-label {
display: block;
font-size: 28rpx;
color: #2e7d32;
font-weight: 600;
margin-bottom: 16rpx;
}
.input-wrapper {
width: 100%;
}
.select-input {
background: #f9fff9;
border: 3rpx solid #c8e6c9;
border-radius: 24rpx;
padding: 24rpx 32rpx;
}
.custom-select {
display: flex;
align-items: center;
justify-content: space-between;
background: #f9fff9;
border: 3rpx solid #c8e6c9;
border-radius: 24rpx;
padding: 24rpx 32rpx;
min-height: 80rpx;
box-sizing: border-box;
}
.select-text {
font-size: 28rpx;
color: #2e7d32;
flex: 1;
}
.select-arrow {
font-size: 24rpx;
color: #6a9c6a;
}
.purchase-select-btn {
display: flex;
align-items: center;
justify-content: center;
gap: 12rpx;
padding: 24rpx;
background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
border-radius: 24rpx;
box-shadow: 0 4rpx 12rpx rgba(67, 233, 123, 0.3);
}
.btn-icon {
font-size: 32rpx;
color: #fff;
}
.btn-text {
font-size: 28rpx;
color: #fff;
font-weight: 600;
}
.selected-count {
display: block;
margin-top: 16rpx;
font-size: 24rpx;
color: #6a9c6a;
text-align: center;
}
.purchase-list {
display: flex;
flex-direction: column;
gap: 16rpx;
}
.purchase-item {
background: #f9fff9;
border: 2rpx solid #c8e6c9;
border-radius: 16rpx;
padding: 24rpx;
}
.purchase-item-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12rpx;
}
.purchase-item-actions {
display: flex;
align-items: center;
gap: 16rpx;
}
.initial-mark {
font-size: 22rpx;
color: #909399;
padding: 4rpx 12rpx;
background: #f5f5f5;
border-radius: 8rpx;
}
.purchase-category {
font-size: 28rpx;
color: #2e7d32;
font-weight: 600;
}
.purchase-remove {
width: 48rpx;
height: 48rpx;
display: flex;
align-items: center;
justify-content: center;
background: #ffebee;
border-radius: 50%;
}
.remove-icon {
font-size: 24rpx;
color: #c62828;
font-weight: 600;
}
.purchase-item-details {
display: flex;
gap: 24rpx;
margin-bottom: 12rpx;
}
.purchase-detail {
font-size: 24rpx;
color: #6a9c6a;
}
.purchase-detail.amount {
color: #f57c00;
font-weight: 600;
}
.purchase-item-time {
font-size: 22rpx;
color: #909399;
}
.purchase-time {
font-size: 22rpx;
color: #909399;
}
.btn-group {
margin-top: 48rpx;
}
.btn {
width: 100%;
padding: 32rpx;
border-radius: 48rpx;
font-size: 32rpx;
font-weight: 600;
letter-spacing: 2rpx;
border: none;
}
.btn-primary {
background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
color: #fff;
box-shadow: 0 8rpx 24rpx rgba(67, 233, 123, 0.3);
padding: 0;
}
.btn-primary:active {
transform: scale(0.98);
box-shadow: 0 4rpx 12rpx rgba(67, 233, 123, 0.4);
}
/* 弹窗样式 */
.modal-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
}
.modal-content {
width: 90%;
max-height: 80vh;
background: #fff;
border-radius: 24rpx;
display: flex;
flex-direction: column;
overflow: hidden;
}
.modal-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 32rpx;
background: linear-gradient(120deg, #43e97b 0%, #38f9d7 100%);
}
.modal-title {
font-size: 32rpx;
color: #fff;
font-weight: 600;
}
.modal-close {
width: 48rpx;
height: 48rpx;
display: flex;
align-items: center;
justify-content: center;
background: rgba(255, 255, 255, 0.3);
border-radius: 50%;
}
.close-icon {
font-size: 28rpx;
color: #fff;
font-weight: 600;
}
.modal-body {
flex: 1;
padding: 32rpx;
overflow: hidden;
display: flex;
flex-direction: column;
}
.search-box {
margin-bottom: 24rpx;
}
.search-input {
background: #f5f5f5;
border-radius: 16rpx;
}
.purchase-dialog-list {
flex: 1;
max-height: 600rpx;
}
.loading-text,
.empty-text {
text-align: center;
padding: 80rpx 40rpx;
color: #909399;
font-size: 28rpx;
}
.purchase-dialog-item {
background: #f9fff9;
border: 2rpx solid #c8e6c9;
border-radius: 16rpx;
padding: 24rpx;
margin-bottom: 16rpx;
transition: all 0.2s ease;
}
.purchase-dialog-item.selected {
background: #e8f5e9;
border-color: #43e97b;
}
.purchase-dialog-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12rpx;
}
.purchase-dialog-category {
font-size: 28rpx;
color: #2e7d32;
font-weight: 600;
}
.selected-mark {
width: 40rpx;
height: 40rpx;
display: flex;
align-items: center;
justify-content: center;
background: #43e97b;
border-radius: 50%;
color: #fff;
font-size: 24rpx;
font-weight: 600;
}
.purchase-dialog-details {
display: flex;
gap: 24rpx;
margin-bottom: 12rpx;
}
.purchase-dialog-detail {
font-size: 24rpx;
color: #6a9c6a;
}
.purchase-dialog-detail.amount {
color: #f57c00;
font-weight: 600;
}
.purchase-dialog-time {
font-size: 22rpx;
color: #909399;
}
.modal-footer {
display: flex;
gap: 24rpx;
padding: 32rpx;
border-top: 2rpx solid #f0f0f0;
}
.modal-btn {
flex: 1;
padding:15rpx 24rpx;
border-radius: 24rpx;
font-size: 28rpx;
font-weight: 600;
border: none;
}
.cancel-btn {
background: #f5f5f5;
color: #909399;
}
.confirm-btn {
background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
color: #fff;
}
/* 审批节点配置样式 */
.nodes-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24rpx;
}
.add-node-btn {
padding: 12rpx 24rpx;
background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
border-radius: 16rpx;
}
.add-node-text {
font-size: 24rpx;
color: #fff;
font-weight: 600;
}
.nodes-list {
display: flex;
flex-direction: column;
gap: 24rpx;
}
.node-item {
background: #f9fff9;
border: 2rpx solid #c8e6c9;
border-radius: 16rpx;
padding: 24rpx;
}
.node-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24rpx;
padding-bottom: 16rpx;
border-bottom: 2rpx solid #e0e0e0;
}
.node-order {
font-size: 28rpx;
color: #2e7d32;
font-weight: 600;
}
.remove-node-btn {
padding: 8rpx 16rpx;
background: #ffebee;
border-radius: 8rpx;
}
.remove-node-text {
font-size: 24rpx;
color: #c62828;
font-weight: 500;
}
.node-form {
display: flex;
flex-direction: column;
gap: 24rpx;
}
.node-form-item {
display: flex;
flex-direction: column;
gap: 12rpx;
}
.node-label {
font-size: 26rpx;
color: #2e7d32;
font-weight: 500;
}
.node-input {
background: #fff;
border: 2rpx solid #c8e6c9;
border-radius: 16rpx;
padding: 20rpx 24rpx;
}
.node-tip {
font-size: 22rpx;
color: #909399;
margin-top: -8rpx;
}
.loading-more {
text-align: center;
padding: 32rpx;
color: #909399;
font-size: 24rpx;
}
.no-more {
text-align: center;
padding: 32rpx;
color: #909399;
font-size: 24rpx;
}
.pagination-info {
text-align: center;
padding: 24rpx;
color: #6a9c6a;
font-size: 22rpx;
background: #f9fff9;
border-top: 2rpx solid #e0e0e0;
}
/* 审批人选择相关样式 */
.approver-select-wrapper {
display: flex;
flex-direction: column;
gap: 16rpx;
}
.approver-select-btn {
display: flex;
align-items: center;
justify-content: space-between;
background: #f9fff9;
border: 3rpx solid #c8e6c9;
border-radius: 24rpx;
padding: 24rpx 32rpx;
min-height: 80rpx;
box-sizing: border-box;
}
.approver-btn-text {
font-size: 28rpx;
color: #2e7d32;
flex: 1;
}
.approver-tags {
display: flex;
flex-wrap: wrap;
gap: 12rpx;
}
.approver-tag {
display: inline-block;
padding: 8rpx 16rpx;
background: #e8f5e9;
border: 2rpx solid #c8e6c9;
border-radius: 16rpx;
font-size: 24rpx;
color: #2e7d32;
}
/* 用户选择弹窗样式 */
.user-dialog-list {
flex: 1;
max-height: 600rpx;
}
.user-dialog-item {
background: #f9fff9;
border: 2rpx solid #c8e6c9;
border-radius: 16rpx;
padding: 24rpx;
margin-bottom: 16rpx;
transition: all 0.2s ease;
}
.user-dialog-item.selected {
background: #e8f5e9;
border-color: #43e97b;
}
.user-dialog-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12rpx;
}
.user-dialog-name {
font-size: 28rpx;
color: #2e7d32;
font-weight: 600;
}
.user-dialog-details {
display: flex;
gap: 24rpx;
}
.user-dialog-detail {
font-size: 24rpx;
color: #6a9c6a;
}
</style>