tanghaolin
2025-04-15 8c3d15eae99d51193e20ff222dedf96cdba57b33
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
<template>
  <div class="chengBenFenXi">
    <el-tabs @tab-click="tabClick" v-model="state.m_activeName" type="border-card">
      <el-tab-pane name="tabParas" :label="t('LCC.Analysis.TR')" ref="elTabPane">
        <div class="div_tr">
          <div class="div_box">
            <div class="div_box_title">
              <div style="
                        width: 100%;
                        height: 100%;
                        display: flex;
                        justify-content: space-between;
                        position: relative;
                      ">
                <span>{{ t("LCC.workingPointFlow.TR")
                }}<i style="margin-left: 0.2rem" @click="addTr" class="iconfont icontianjia1"></i></span>
                <div style="width: 30%; margin-right: 0.1rem">
                  <select style="width: 100%; font-family: 'Source Han Sans'" v-model="state.m_selWrkStatusType"
                    @change="changeSelectWorkStatusType">
                    <option v-for="item in state.m_workStatusList" :key="item.value" :value="item.value">
                      {{ item.label }}
                    </option>
                  </select>
                </div>
              </div>
            </div>
            <div class="div_box_content">
              <table style="width: 100%">
                <thead class="table_head">
                  <tr>
                    <th>{{ t("LCC.status.TR") }}</th>
                    <th>{{ t("LCC.flowRatio.TR") }}(%)</th>
                    <th>{{ t("LCC.timeScale.TR") }}(%)</th>
                  </tr>
                </thead>
                <tbody id="pumpStatusTableBody">
                  <tr v-for="(item, index) in state.m_runStatusList" :key="index">
                    <td>{{ item.Name }}</td>
                    <td>
                      <input type="number" v-model="item.FlowRatio" onblur class="pump_flow" />
                    </td>
                    <td style="position: relative">
                      <input type="number" v-model="item.TimeRatio" onblur class="pump_time pump_timebili" />
                      <i v-if="item.close" @click="closeTr(index)" class="closeTr el-icon-close"></i>
                    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
          <div class="div_box">
            <div class="div_box_title">{{ t("LCC.energyCosts.TR") }}</div>
            <div class="div_box_content">
              <div class="div_box_content_group">
                <label class="pump_label" id="GongZuoTianShiLabel">{{
                  t("LCC.workingDays.TR")
                }}</label>
                <div class="pump_value">
                  <input type="number" v-model="state.nhcb.gzts" class="pump_time" />
                </div>
                <label class="pump_label" id="GongZuoXiaoShiLabel">{{
                  t("LCC.workingHours.TR")
                }}</label>
                <div class="pump_value">
                  <input type="number" v-model="state.nhcb.gzxs" class="pump_time" />
                </div>
              </div>
              <div class="div_box_content_group">
                <label class="pump_label" id="DianFeilabel">{{ t("LCC.powerFees.TR") }}({{ t("LCC.per.TR") }})</label>
                <div class="pump_value">
                  <input type="number" v-model="state.nhcb.df" class="pump_time" />
                </div>
                <label class="pump_label">{{ t("LCC.risiPowerPrice.TR") }}({{
                  t("LCC.year.TR")
                }})</label>
                <div class="pump_value">
                  <input type="number" v-model="state.nhcb.dfsz" class="pump_time" />
                </div>
              </div>
              <div class="div_box_content_group">
                <label class="pump_label" id="ZhouQilabel">{{ t("LCC.CalcCycle.TR") }}({{ t("LCC.year.TR") }})</label>
                <div class="pump_value">
                  <input type="number" v-model="state.nhcb.jszq" class="pump_time" />
                </div>
                <label class="pump_label">{{ t("LCC.interestRate.TR") }}(%)</label>
                <div class="pump_value">
                  <input type="number" v-model="state.nhcb.lilv" class="pump_time" />
                </div>
              </div>
              <div class="div_box_content_group">
                <label class="pump_label" id="XiaoLvXiaJianglabel">{{ t("LCC.droop.TR") }}(%{{ t("LCC.year.TR")
                }})</label>
                <div class="pump_value">
                  <input type="number" v-model="state.nhcb.xlxj" class="pump_time" />
                </div>
                <label class="pump_label">{{ t("LCC.co2Ratio.TR") }}(KW/Kg)</label>
                <div class="pump_value">
                  <input type="number" v-model="state.nhcb.co2xs" class="pump_time" />
                </div>
              </div>
              <div class="div_box_content_group">
                <label class="pump_label" id="nhcbmeixs">{{ t("LCC.conversionFactor.TR") }}({{
                  t("LCC.tonAndkW.TR")
                }})</label>
                <div class="pump_value">
                  <input type="number" v-model="state.nhcb.meixs" class="pump_time" />
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="div_tr">
          <div style="height: 1.8rem" class="div_box">
            <div class="div_box_title">
              {{ t("LCC.maintenanceCost.TR") }} ({{ t("LCC.thousand.TR") }}/{{
                t("LCC.eachYear.TR")
              }})
            </div>
            <div class="div_box_content">
              <div class="div_box_content_group">
                <label class="pump_label" id="WeiHuWeiXiulabel">{{
                  t("LCC.maintenance.TR")
                }}</label>
                <div class="pump_value">
                  <input type="number" v-model="state.whwxcb.whhxl" class="pump_time" />
                </div>
                <label class="pump_label" id="YunXingFeilabel">{{
                  t("LCC.runningCost.TR")
                }}</label>
                <div class="pump_value">
                  <input type="number" v-model="state.whwxcb.yxfy" class="pump_time" />
                </div>
              </div>
              <div class="div_box_content_group">
                <label class="pump_label" id="SunHaolabel">{{
                  t("LCC.downtimeAndLoss.TR")
                }}</label>
                <div class="pump_value">
                  <input type="number" v-model="state.whwxcb.sctghsh" class="pump_time" />
                </div>
                <label class="pump_label" id="HuanJinglabel">{{
                  t("LCC.environmentalFee.TR")
                }}</label>
                <div class="pump_value">
                  <input type="number" v-model="state.whwxcb.hjbhf" class="pump_time" />
                </div>
              </div>
              <div class="div_box_content_group">
                <label class="pump_label" id="QiTalabel">{{
                  t("LCC.othersFee.TR")
                }}</label>
                <div class="pump_value">
                  <input type="number" v-model="state.whwxcb.qtnfy" class="pump_time" />
                </div>
              </div>
            </div>
          </div>
          <div style="width: calc(50% - 0.1rem)">
            <div style="height: 1rem; width: 100%; margin-left: -0.02rem" class="div_box">
              <div class="div_box_title">
                {{ t("LCC.initialCost.TR") }} ({{ t("LCC.thousand.TR") }})
              </div>
              <div class="div_box_content">
                <div class="div_box_content_group">
                  <label class="pump_label" id="ChuShiTouZilabel">{{
                    t("LCC.orderCost.TR")
                  }}</label>
                  <div class="pump_value">
                    <input type="number" v-model="state.cscb.sbcgfy" class="pump_time" />
                  </div>
                  <label class="pump_label" id="AnZhuangTiaoShilabel">{{
                    t("LCC.installDebugCharge.TR")
                  }}</label>
                  <div class="pump_value">
                    <input type="number" v-model="state.cscb.azhtsfy" class="pump_time" />
                  </div>
                </div>
              </div>
            </div>
            <el-button class="btn_color" style="margin-top: 0.1rem" @click="clickAnaCostMoneyBtn">{{ t("LCC.Analysis.TR")
            }}</el-button>
          </div>
        </div>
      </el-tab-pane>
      <el-tab-pane name="tabResult" :disabled="state.tabIsClick" :label="t('LCC.mapOfCosts.TR')">
        <div style="display: flex; height: 100%; width: 100%">
          <el-table :data="state.moneyComponentList" stripe :border="true" :cell-style="rowClass"
            :header-cell-style="rowClass" style="width: 30%">
            <el-table-column prop="name" :label="t('LCC.costItem.TR')"></el-table-column>
            <el-table-column width="80" prop="value" :label="t('LCC.cost.TR')"></el-table-column>
            <el-table-column width="100" prop="per" :label="t('LCC.percentage.TR')"></el-table-column>
          </el-table>
          <div id="echart_pie_box"></div>
        </div>
      </el-tab-pane>
      <el-tab-pane name="four" :disabled="state.tabIsClick" :label="t('LCC.accumulationCurve.TR')">
        <div style="display: flex; height: 100%; width: 100%">
          <el-table :data="state.chartDataLeiJiTable" stripe :border="true" style="width: 30%"
            :height="state.chartDataTableHeight" :cell-style="rowClass" :header-cell-style="rowClass">
            <el-table-column width="60" prop="year" :label="t('LCC.year.TR')"></el-table-column>
            <el-table-column prop="feiyong" :label="t('LCC.cost.TR')"></el-table-column>
            <el-table-column prop="co2" :label="t('LCC.co2.TR')"></el-table-column>
            <el-table-column prop="ljyml" :label="t('LCC.coalConsumption.TR')"></el-table-column>
          </el-table>
          <div style="width: 70%; height: 100%" id="echart_box_fyqx"></div>
        </div>
      </el-tab-pane>
      <el-tab-pane name="five" :disabled="state.tabIsClick" :label="t('LCC.statisticalChart.TR')">
        <div style="width: 100%; height: 100%" id="echart_box_dntj"></div>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
 
<script setup name="chengbenfenxi">
import { reactive, shallowRef, ref, onMounted, nextTick } from "vue";
import UnitHelper from "@/utils/unit.js";
import { useI18n } from 'vue-i18n'
import echarts from '@/utils/echarts.js';
import { ElMessage, ElTabs, ElTabPane, ElTable, ElTableColumn, ElButton, } from "element-plus";
const { t } = useI18n()
let m_chartPie = shallowRef(null);
let m_chartCost = shallowRef(null);
let m_chartYear = shallowRef(null);
const colors = [
  "#FF0000",
  "#0000FF",
  "#6AAA6A",
  "#A52A2A",
  "#1E90FF",
  "#FF00FF",
  "#434384",
  "#800000",
  "#7FFFD4",
  "#546570",
  "#c4ccd3",
];
let state = reactive({
  tabIsClick: true,
  m_activeName: "tabParas",
  m_cbCalcPowerByFlow: null,
  m_cbCalcEtaByFlow: null,
  m_FlowPercent100: 0, //百分之百点的流量
  m_unitQ: 0,
  m_runStatusList: [],
  m_selWrkStatusType: 0, //工作点流量的展示类型
  nhcb: {
    //能耗成本
    gzts: 200, //每年大致工作天数
    gzxs: 12, //每天大致工作小时
    df: 1, //电费
    dfsz: 0, //电费上涨(每年)
    jszq: 10, //计算周期(年)
    lilv: 1, //利率(%)
    xlxj: 0, //效率下降(%年)
    co2xs: 0.622, //CO2系数(KW/Kg)
    meixs: 2.7978, //煤炭折算系数(吨/万千瓦)
  },
  whwxcb: {
    //维护维修成本
    whhxl: "", //维护和修理
    yxfy: "", //运行费用
    sctghsh: "", //生产停工和损耗
    hjbhf: "", //环境保护费
    qtnfy: "", //其他年费用
  },
  cscb: {
    //初始成本
    sbcgfy: "", //设备采购费用
    azhtsfy: "", //安装和调试费用
  },
  m_workStatusList: [],
  chartData4Pies: [],
  chartData4LeiJi: [],
  chartData4Year: [],
  moneyComponentList: [],
 
  chartDataLeiJiTable: [],
  chartDataTableHeight: 0,
 
  m_totalList电费: [], //年度电费 (千元)
  m_yearList电费: [], //每年的电费 (千元)
 
  m_totalListCO2: [], //年累计CO2排放量
  m_yearListCO2: [], //每年CO2排放量
 
  m_totalList煤: [], //
  m_yearList煤: [],
 
  m_yearList费用: [],
})
onMounted(() => {
  nextTick(function () {
    let tableHeight = document.getElementById('pane-tabParas').offsetHeight - 30;
    state.chartDataTableHeight = tableHeight;
  });
 
  let runStatusList = [
    {
      FlowRatio: "100",
      Name: `${t("LCC.fullLoad.TR")}`,
      TimeRatio: 55,
    },
    {
      FlowRatio: "75",
      Name: `${t("LCC.partialLoad.TR")}`,
      TimeRatio: 15,
    },
    {
      FlowRatio: "50",
      Name: `${t("LCC.partialLoad.TR")}`,
      TimeRatio: 30,
    },
  ];
 
  let workStatusList = [
    { label: `${t("LCC.default.TR")}`, value: 0 },
    { label: `${t("LCC.heating.TR")}`, value: 1 },
    { label: `${t("LCC.pressurize.TR")}`, value: 2 },
    { label: `${t("LCC.custom.TR")}`, value: 3 },
  ];
 
  state.m_runStatusList = runStatusList;
  state.m_workStatusList = workStatusList;
})
const initLccData = (flowPercent100, unitQ, unitNameQ) => {
  if (flowPercent100 <= 0) return;
  state.m_unitQ = unitQ;
  state.m_FlowPercent100 = flowPercent100;
}
//
const getFlowPercent100 = () => {
  return state.m_FlowPercent100;
}
//获取运行点
const getRunStatusList = () => {
  return state.m_runStatusList;
}
//监听工作点列表类型的选择
const changeSelectWorkStatusType = (e) => {
  changeWorkStatusType(state.m_selWrkStatusType);
}
//切换工作点流量列表数据
const changeWorkStatusType = (type) => {
  let statusList = [];
  if (type == 0) {
    statusList.push({
      FlowRatio: "100",
      Name: `${t("LCC.fullLoad.TR")}`,
      TimeRatio: 55,
    });
    statusList.push({
      FlowRatio: "75",
      Name: `${t("LCC.partialLoad.TR")}`,
      TimeRatio: 15,
    });
    statusList.push({
      FlowRatio: "50",
      Name: `${t("LCC.partialLoad.TR")}`,
      TimeRatio: 30,
    });
  } else if (type == 1) {
    statusList.push({
      FlowRatio: "100",
      Name: `${t("LCC.fullLoad.TR")}`,
      TimeRatio: 35,
    });
    statusList.push({
      FlowRatio: "75",
      Name: `${t("LCC.partialLoad.TR")}`,
      TimeRatio: 10,
    });
    statusList.push({
      FlowRatio: "50",
      Name: `${t("LCC.partialLoad.TR")}`,
      TimeRatio: 25,
    });
    statusList.push({
      FlowRatio: "40",
      Name: `${t("LCC.nightCoolingOperation.TR")}`,
      TimeRatio: 30,
    });
  } else if (type == 2) {
    statusList.push({
      FlowRatio: "100",
      Name: `${t("LCC.fullLoad.TR")}`,
      TimeRatio: 10,
    });
    statusList.push({
      FlowRatio: "80",
      Name: `${t("LCC.partialLoad.TR")}`,
      TimeRatio: 20,
    });
    statusList.push({
      FlowRatio: "50",
      Name: `${t("LCC.partialLoad.TR")}`,
      TimeRatio: 15,
    });
    statusList.push({
      FlowRatio: "40",
      Name: `${t("LCC.lowLoad.TR")}`,
      TimeRatio: 20,
    });
  } else if (type == 3) {
    statusList.push({
      FlowRatio: "",
      Name: "",
      TimeRatio: "",
    });
  }
  state.m_runStatusList = statusList;
}
//设置计算的回调函数
const setCalcFuncByFlowCb = (cb_power, cb_eta) => {
  if (state.m_cbCalcPowerByFlow == null) state.m_cbCalcPowerByFlow = cb_power;
  if (state.m_cbCalcEtaByFlow == null) state.m_cbCalcEtaByFlow = cb_eta;
}
//定义表格row样式
const rowClass = () => {
  return { 'textAlign': 'center' };
}
const addTr = () => {
  state.m_runStatusList.push({
    Name: `${t("LCC.load.TR")}`,
    FlowRatio: "",
    TimeRatio: "",
    close: true,
  });
}
const closeTr = (i) => {
  state.m_runStatusList.splice(i, 1);
}
//初始化费用图图表
const initChartPie = () => {
  let data = state.chartData4Pies;
  let legendSelected = {};
  data.forEach((item) => {
    if (item[1] == 0) {
      legendSelected["" + item[0] + ""] = false;
    } else {
      legendSelected["" + item[0] + ""] = true;
    }
  });
  m_chartPie.value = echarts.init(document.getElementById("echart_pie_box"));
  var legendData = [];
  var seriesData = [];
  for (var i = 0; i < data.length; i++) {
    legendData.push(data[i][0]);
    seriesData.push({
      name: data[i][0],
      value: data[i][1],
      label: {
        formatter: "{b}:{d}%\n" + `${t("LCC.cost.TR")}` + ":{c}",
      },
      itemStyle: { color: colors[i] },
    });
  }
 
  let chart_pie_option = {
    title: {
      text: "",
      subtext: "",
      left: "center",
    },
    tooltip: {
      trigger: "item",
      formatter: "{b} : {c} ({d}%)",
    },
 
    legend: {
      //type: 'scroll',
      //orient: 'vertical',
      orient: "vertical",
      left: "right",
      right: 10,
      top: 20,
      bottom: 20,
      data: legendData,
      selected: legendSelected,
    },
    series: [
      {
        name: "",
        type: "pie",
        radius: "55%",
        center: ["40%", "50%"],
        data: seriesData,
        emphasis: {
          itemStyle: {
            shadowBlur: 10,
            shadowOffsetX: 0,
            shadowColor: "rgba(0, 0, 0, 0.5)",
          },
        },
      },
    ],
  };
 
  // 使用刚指定的配置项和数据显示图表。
  m_chartPie.value.setOption(chart_pie_option);
}
//年度累计曲线图表
const initChartLeiJi = () => {
  let chartData4LeiJi = state.chartData4LeiJi;
  if (m_chartCost.value) {
    m_chartCost.value.setOption({
      yAxis: [
        {
          min: null,
          max: null,
          interval: null,
        },
        {
          min: null,
          max: null,
          interval: null,
        },
      ],
    });
  }
  m_chartCost.value = echarts.init(document.getElementById("echart_box_fyqx"));
 
  let chart_lj_option = {
    color: [colors[0], colors[1], colors[2], colors[3]],
    tooltip: {
      trigger: "axis",
      axisPointer: {
        type: "shadow",
      },
    },
    grid: {
      top: "15%",
      left: "2%",
      right: "8%",
      bottom: "3%",
      containLabel: true,
    },
 
    legend: {
      data: [
        `${t("LCC.totalAnnualCost.TR")}` +
        "(" +
        `${t("LCC.tenThousand.TR")}` +
        ")",
        `${t("LCC.co2TotalEmissions.TR")}` +
        "(" +
        `${t("LCC.tenThousandTon.TR")}` +
        ")",
        "用电量",
        `${t("LCC.coalConsumption.TR")}`,
      ],
    },
    xAxis: [
      {
        axisLine: {
          onZero: false,
        },
        type: "category",
        axisTick: {
          alignWithLabel: true,
        },
        data: chartData4LeiJi.year,
      },
    ],
    yAxis: [
      {
        type: "value",
        // name: "总费用(万)",
        name:
          `${t("LCC.totalAnnualCost.TR")}` +
          "(" +
          `${t("LCC.tenThousand.TR")}` +
          ")",
        offset: 0,
 
        axisLine: {
          show: true,
          lineStyle: {
            color: colors[0],
          },
        },
        axisTick: {
          show: true,
        },
        axisLabel: {
          formatter: "{value} ",
        },
      },
      {
        type: "value",
        // name: "CO2总排放量(万吨)",
        name:
          `${t("LCC.co2TotalEmissions.TR")}` +
          "(" +
          `${t("LCC.tenThousandTon.TR")}` +
          ")",
 
        nameLocation: "middle",
        nameRotate: 270,
        nameGap: 35,
        position: "right",
        splitNumber: 5,
        axisLine: {
          show: true,
          lineStyle: {
            color: colors[1],
          },
        },
        axisTick: {
          show: true,
        },
        axisLabel: {
          formatter: "{value}  ",
        },
      },
      {
        type: "value",
        // name: "耗煤量",
        name: `${t("LCC.coalConsumption.TR")}`,
        nameLocation: "middle",
        nameRotate: 270,
        nameGap: 45,
        position: "right",
        splitNumber: 5,
        offset: 60,
        axisLine: {
          show: true,
          lineStyle: {
            color: colors[2],
          },
        },
        axisTick: {
          show: true,
        },
        axisLabel: {
          formatter: "{value}  ",
        },
      },
    ],
    series: [
      {
        name:
          `${t("LCC.totalAnnualCost.TR")}` +
          "(" +
          `${t("LCC.tenThousand.TR")}` +
          ")",
        type: "line",
        data: chartData4LeiJi.feiyong,
      },
      {
        name:
          `${t("LCC.co2TotalEmissions.TR")}` +
          "(" +
          `${t("LCC.tenThousandTon.TR")}` +
          ")",
        type: "line",
        yAxisIndex: 1,
        data: chartData4LeiJi.co2,
      },
      {
        name: `${t("LCC.coalConsumption.TR")}`,
        type: "line",
        yAxisIndex: 2,
        data: chartData4LeiJi.ljyml,
      },
    ],
  };
  m_chartCost.value.setOption(chart_lj_option);
  var feiyongmaxmin = m_chartCost.value.getModel()._componentsMap.data.get('yAxis')[0].axis.scale._extent;
 
  var co2maxmin = m_chartCost.value.getModel()._componentsMap.data.get('yAxis')[1].axis.scale._extent;
 
  var ljhmlmaxmin = m_chartCost.value.getModel()._componentsMap.data.get('yAxis')[2].axis.scale._extent;
 
  var chart_max_FY = getChartMaxMinInterval(
    feiyongmaxmin[1],
    feiyongmaxmin[0],
    5
  ); //费用
  var chart_max_co2 = getChartMaxMinInterval(
    co2maxmin[1],
    co2maxmin[0],
    5
  ); //co2
  var chart_max_hml = getChartMaxMinInterval(
    ljhmlmaxmin[1],
    ljhmlmaxmin[0],
    5
  ); //耗煤量
 
  m_chartCost.value.setOption({
    yAxis: [
      {
        min: chart_max_FY.min,
        max: chart_max_FY.max,
        interval: chart_max_FY.interval,
      },
      {
        //gridIndex: 1,
        min: chart_max_co2.min,
        max: chart_max_co2.max,
        interval: chart_max_co2.interval,
      },
      {
        //gridIndex: 1,
        min: chart_max_hml.min,
        max: chart_max_hml.max,
        interval: chart_max_hml.interval,
      },
    ],
  });
}
//当年统计图表
const initChartYear = () => {
  let chartData4Year = state.chartData4Year;
  // console.log(chartData4Year, 510);
  if (m_chartYear.value) {
    m_chartYear.value.setOption({
      yAxis: [
        {
          min: null,
          max: null,
          interval: null,
        },
        {
          min: null,
          max: null,
          interval: null,
        },
      ],
    });
  }
  m_chartYear.value = echarts.init(document.getElementById("echart_box_dntj"));
  let chart_year_option = {
    color: [colors[0], colors[1], colors[2], colors[3]],
    tooltip: {
      trigger: "axis",
      axisPointer: {
        type: "shadow",
      },
    },
    grid: {
      top: "15%",
      left: "5%",
      right: "6%",
      bottom: "3%",
      containLabel: true,
    },
 
    legend: {
      data: [
        `${t("LCC.totalAnnualCost.TR")}` +
        "(" +
        `${t("LCC.tenThousand.TR")}` +
        ")",
        `${t("LCC.co2TotalEmissions.TR")}` +
        "(" +
        `${t("LCC.tenThousandTon.TR")}` +
        ")",
        `${t("LCC.coalConsumption.TR")}`,
      ],
    },
    xAxis: [
      {
        axisLine: {
          onZero: false,
        },
        type: "category",
        axisTick: {
          alignWithLabel: true,
        },
        data: chartData4Year.year,
      },
    ],
    yAxis: [
      {
        type: "value",
        nameLocation: "middle",
        nameRotate: 270,
        nameGap: 35,
        offset: 0,
        position: "right",
        name:
          `${t("LCC.totalAnnualCost.TR")}` +
          "(" +
          `${t("LCC.tenThousand.TR")}` +
          ")",
        axisLine: {
          show: true,
          lineStyle: {
            color: colors[0],
          },
        },
        axisTick: {
          show: true,
        },
        axisLabel: {
          formatter: "{value} ",
        },
      },
      {
        type: "value",
        nameLocation: "middle",
        name:
          `${t("LCC.co2TotalEmissions.TR")}` +
          "(" +
          `${t("LCC.tenThousandTon.TR")}` +
          ")",
        position: "right",
        nameRotate: 270,
        nameGap: 45,
        offset: 60,
        splitNumber: 5,
        axisLine: {
          show: true,
          lineStyle: {
            color: colors[1],
          },
        },
        axisTick: {
          show: true,
        },
        axisLabel: {
          formatter: "{value}  ",
        },
      },
      {
        type: "value",
        nameLocation: "middle",
        name: `${t("LCC.coalConsumption.TR")}`,
        position: "right",
        nameRotate: 270,
        nameGap: 50,
        offset: 120,
        axisLine: {
          show: true,
          lineStyle: {
            color: colors[2],
          },
        },
        axisTick: {
          show: true,
        },
        axisLabel: {
          formatter: "{value}  ",
        },
      },
    ],
    series: [
      {
        name:
          `${t("LCC.totalAnnualCost.TR")}` +
          "(" +
          `${t("LCC.tenThousand.TR")}` +
          ")",
        type: "bar",
        data: chartData4Year.feiyong,
      },
      {
        name:
          `${t("LCC.co2TotalEmissions.TR")}` +
          "(" +
          `${t("LCC.tenThousandTon.TR")}` +
          ")",
        type: "bar",
        yAxisIndex: 1,
        data: chartData4Year.co2,
      },
      {
        name: `${t("LCC.coalConsumption.TR")}`,
        type: "bar",
        yAxisIndex: 2,
        data: chartData4Year.dnyml,
      },
    ],
  };
  m_chartYear.value.setOption(chart_year_option);
  // console.log(m_chartYear.getModel(), 643);
  var feiyongmaxmin =
    m_chartYear.value.getModel()._componentsMap.data.get('yAxis')[0].axis.scale._extent; //费用
  var co2maxmin =
    m_chartYear.value.getModel()._componentsMap.data.get('yAxis')[1].axis.scale._extent; //co2
  var meiliangmaxmin =
    m_chartYear.value.getModel()._componentsMap.data.get('yAxis')[2].axis.scale._extent; //用煤量
 
  var chart_max_FY = getChartMaxMinInterval(
    feiyongmaxmin[1],
    feiyongmaxmin[0],
    5
  ); //费用
  var chart_max_co2 = getChartMaxMinInterval(
    co2maxmin[1],
    co2maxmin[0],
    5
  ); //co2
  var chart_max_meiliangmaxmin = getChartMaxMinInterval(
    meiliangmaxmin[1],
    meiliangmaxmin[0],
    5
  ); //用煤量
 
  m_chartYear.value.setOption({
    yAxis: [
      {
        min: chart_max_FY.min,
        max: chart_max_FY.max,
        interval: chart_max_FY.interval,
      },
      {
        //gridIndex: 1,
        min: chart_max_co2.min,
        max: chart_max_co2.max,
        interval: chart_max_co2.interval,
      },
      {
        //gridIndex: 1,
        min: chart_max_meiliangmaxmin.min,
        max: chart_max_meiliangmaxmin.max,
        interval: chart_max_meiliangmaxmin.interval,
      },
    ],
  });
}
//tab栏切换
const tabClick = (obj) => {
  // console.log(obj);
  // let name = obj.props.name;
  setTimeout(() => {
    if (m_chartPie.value) {
      m_chartPie.value.resize();
    }
    if (m_chartCost.value) {
      m_chartCost.value.resize();
    }
    if (m_chartYear.value) {
      m_chartYear.value.resize();
    }
  }, 10);
}
//成本分析表单校验
const checkInputValid = () => {
  let nhcb = state.nhcb;
  let calcYearNum = parseInt(nhcb.jszq); //计算周期(年)
  if (isNaN(calcYearNum) || calcYearNum < 2) {
    ElMessage.warning({
      message: `${t("LCC.calculationPeriod.TR")}`,
      type: "warning",
    });
    return false;
  }
 
  let runStatusList = state.m_runStatusList;
 
  //
  let total_bili = 0;
  for (let i = 0; i < runStatusList.length; i++) {
    let item = runStatusList[i];
    if (item.TimeRatio == null || item.TimeRatio == "") continue;
 
    let bili = parseFloat(item.TimeRatio);
    if (isNaN(bili)) {
      ElMessage.warning({
        message: `${t("LCC.scaleTime.TR")}`,
        type: "warning",
      });
      return;
    }
    bili = parseInt(bili);
    if (isNaN(bili)) {
      ElMessage.warning({
        message: `${t("LCC.scaleTime.TR")}`,
        type: "warning",
      });
      return;
    }
    total_bili += parseInt(bili);
  }
  if (runStatusList.length == 1) {
    state.m_runStatusList = runStatusList;
    runStatusList[0].TimeRatio = "100";
    total_bili = 100;
  }
  if (total_bili > 102 || total_bili < 98) {
    ElMessage.warning({
      message: `${t("LCC.sumProportions.TR")}`,
      type: "warning",
    });
    return false;
  }
 
  let df = parseFloat(nhcb.df); //电费(每度)
  if (isNaN(df)) {
    ElMessage.warning({
      message: `${t("LCC.electricCharge.TR")}`,
      type: "warning",
    });
    return false;
  }
  let ratio_co2 = parseFloat(nhcb.co2xs); //CO2系数
  if (isNaN(ratio_co2)) {
    ElMessage.warning({
      message: `${t("LCC.coefficient_c.TR")}`,
      type: "warning",
    });
    return false;
  }
  let ratio_mei = parseFloat(nhcb.meixs); // 煤炭折算系数
  if (isNaN(ratio_mei)) {
    ElMessage.warning({
      message: `${t("LCC.conversionCoefficient.TR")}`,
      type: "warning",
    });
    return false;
  }
  return true;
}
//
const MyRound = (v, num) => {
  if (num == 1) return Math.round(v * 10) / 10.0;
  else return Math.round(v * 100) / 100.0;
}
//
const CalcYearPower = (zhouqi) => {
  let nhcb = state.nhcb;
  let mngzts = parseFloat(nhcb.gzts); //每年大致工作天数
  if (isNaN(mngzts)) {
    ElMessage.warning({
      message: "请输入每年大致工作天数!",
      type: "warning",
    });
    return;
  }
  var d_每年工作天数 = mngzts;
 
  let mtgzxs = parseFloat(nhcb.gzxs); //每天大致工作小时
  if (isNaN(mtgzxs)) {
    ElMessage.warning({
      message: "请输入每天大致工作小时!",
      type: "warning",
    });
    return;
  }
  var d_工作小时 = mtgzxs;
 
  let runStatusList = state.m_runStatusList;
 
  let value_每年效率下降点 = parseFloat(nhcb.xlxj); //系统效率下降(%每年)
  if (isNaN(value_每年效率下降点)) {
    value_每年效率下降点 = 0;
  }
 
  if (value_每年效率下降点 < 0.1) {
    //没有下降
    var percent_gonglv = 0;
    for (let i = 0; i < runStatusList.length; i++) {
      var row = runStatusList[i];
      var flow = (parseFloat(row.FlowRatio) / 100) * state.m_FlowPercent100;
      var timePercent = parseFloat(row.TimeRatio) / 100;
 
      //var axisEff = this.MyRound(this.m_cbCalcEtaByFlow(flow,this.m_unitQ), 1);
      var power = MyRound(
        state.m_cbCalcPowerByFlow(flow, state.m_unitQ),
        2
      );
 
      var gonglv = power * d_每年工作天数 * d_工作小时 * timePercent;
      //console.log("lcc calc ",flow,power,gonglv,this.m_unitQ)
      percent_gonglv += gonglv;
    }
    percent_gonglv = MyRound(percent_gonglv, 1);
 
    var percentPowerList = []; //每年的用电量
    for (var year = 0; year < zhouqi; year++) {
      percentPowerList.push(percent_gonglv);
    }
 
    return percentPowerList;
  } else {
    var eta_dict = [];
    var power_dict = [];
    for (let i = 0; i < runStatusList.length; i++) {
      var row = runStatusList[i];
      var flow = (parseFloat(row.FlowRatio) / 100) * state.m_FlowPercent100;
      var timePercent = parseFloat(row.TimeRatio) / 100;
 
      var axisEff = MyRound(
        state.m_cbCalcEtaByFlow(flow, state.m_unitQ),
        1
      );
      var axisPower = MyRound(
        state.m_cbCalcPowerByFlow(flow, state.m_unitQ),
        2
      );
 
      eta_dict.push(axisEff);
      power_dict.push(
        axisPower * d_每年工作天数 * d_工作小时 * timePercent
      );
    }
 
    var percentPowerList = []; //每年的用电量
    for (var year = 0; year < zhouqi; year++) {
      //处理效率下降问题
      for (let i = 0; i < runStatusList.length; i++) {
        var axisEff = eta_dict[i];
        var axisPower = power_dict[i];
 
        if (axisEff > 5) {
          //防止效率下降到负数
          axisEff = axisEff - value_每年效率下降点;
          axisPower =
            (axisPower * axisEff) / (axisEff - value_每年效率下降点);
 
          eta_dict[i] = MyRound(axisEff, 1); //修改值
          power_dict[i] = MyRound(axisPower, 2);
        }
      }
      var sum = 0;
      power_dict.forEach((ele) => {
        sum += ele;
      });
 
      percentPowerList.push(MyRound(sum, 1));
    }
    return percentPowerList;
  }
}
//计算 费用组成 (以及计算每年的费用)
const CalcYearValue = (percentPowerList, zhouqi) => {
  //console.log(percentPowerList, "percentPowerList");
  let chartData4Pies = [];
 
  let nhcb = state.nhcb;
  let dianfei_raio = parseFloat(nhcb.df); //电费(每度)
 
  let dianfei_zhengzhang = parseFloat(nhcb.dfsz); //电费上涨(每年)
  if (isNaN(dianfei_zhengzhang)) {
    dianfei_zhengzhang = 0;
  }
  let ratio_co2 = parseFloat(nhcb.co2xs); //CO2系数
 
  let ratio_mei = parseFloat(nhcb.meixs); // 煤炭折算系数
 
  var totalList电费 = []; //年度电费
  var yearList电费 = []; //每年的电费
 
  var totalListCO2 = []; //年累计CO2排放量
  var yearListCO2 = []; //每年CO2排放量
 
  var totalList煤 = [];
  var yearList煤 = [];
 
  var rato_电费 = 1; //电费实际系数,//第一年无变化
 
  var value_电费_累计 = 0;
  var value_co2_累计 = 0; //C02累计排放量
  var value_煤_累计 = 0; //累计煤
 
  for (var year = 0; year < zhouqi; year++) {
    var valve_每年耗电量 = percentPowerList[year];
 
    var value_电费_当年 = MyRound(
      (valve_每年耗电量 * dianfei_raio * rato_电费) / 1000, //换算成千元
      1
    );
    var value_co2_当年 = MyRound(
      (valve_每年耗电量 * ratio_co2) / 1000,
      3
    ); //当年排放CO2量(吨) 系数是kg 所以除以1000
    var value_煤_当年 = MyRound(
      (valve_每年耗电量 * ratio_mei) / 10000,
      3
    ); //吨  系数是万千瓦 所以除以10000
 
    yearListCO2.push(value_co2_当年);
    yearList电费.push(value_电费_当年);
    yearList煤.push(value_煤_当年);
 
    //console.log(year,value_电费_当年)
    value_co2_累计 += value_co2_当年;
    totalListCO2.push(value_co2_累计);
 
    value_电费_累计 += value_电费_当年;
    totalList电费.push(value_电费_累计);
 
    value_煤_累计 += value_煤_当年;
    totalList煤.push(value_煤_累计);
 
    rato_电费 = rato_电费 * (1 + dianfei_zhengzhang / 100);
  }
 
  state.m_totalList电费 = totalList电费; //年度电费
  state.m_yearList电费 = yearList电费; //每年的电费
 
  state.m_totalListCO2 = totalListCO2; //年累计CO2排放量
  state.m_yearListCO2 = yearListCO2; //每年CO2排放量
 
  state.m_totalList煤 = totalList煤;
  state.m_yearList煤 = yearList煤;
  return true;
}
//分析成本
const clickAnaCostMoneyBtn = () => {
  if (!checkInputValid()) return;
 
  let nhcb = state.nhcb;
  let zhouqi = parseInt(nhcb.jszq); //计算周期(年)
  if (zhouqi < 2) {
    zhouqi = 3;
  }
 
  //计算每年的功率
  var percentPowerList = CalcYearPower(zhouqi);
  if (percentPowerList == null || percentPowerList.length == 0) return;
 
  //计算 费用组成 (以及计算每年的费用)
  if (!CalcYearValue(percentPowerList, zhouqi)) {
    return;
  }
 
  //计算 费用组成 (以及计算每年的费用)
  if (!CalcPercenYearMoney(zhouqi)) return;
  // 计算 累计数据
  if (!CalcYearTolalMoneyValue(zhouqi)) return;
 
  state.tabIsClick = false;
  state.m_activeName = "tabResult";
  nextTick(() => {
    initChartPie();
    initChartLeiJi();
    initChartYear();
  })
  return;
}
//计算每年的费用 (以及费用组成 )
const CalcPercenYearMoney = (zhouqi) => {
  //
  var yearList费用 = []; //每年的费用
  state.m_yearList电费.forEach((element) => {
    yearList费用.push(MyRound(element, 1));
  });
 
  var list_各项费用组成 = [];
  //
  list_各项费用组成.push([
    `${t("LCC.powerFees.TR")}`,
    MyRound(
      MyRound(
        state.m_totalList电费[state.m_totalList电费.length - 1],
        1
      ),
      0
    ),
  ]);
 
  let nhcb = state.nhcb;
  let whwxcb = state.whwxcb;
  let cscb = state.cscb;
 
  //利率
  var lilv = 0;
  if (nhcb.lilv == "") {
    lilv = 0;
  } else {
    lilv = parseFloat(nhcb.lilv);
  }
  //初期
  var cost初期投资 = 0;
 
  if (cscb.sbcgfy == "") {
    cost初期投资 = 0;
  } else {
    cost初期投资 = parseFloat(cscb.sbcgfy);
  }
  //安装和调试
  var cost安装和调试 = 0;
  if (cscb.azhtsfy == "") {
    cost安装和调试 = 0;
  } else {
    cost安装和调试 = parseFloat(cscb.azhtsfy);
  }
 
  yearList费用[0] += cost初期投资 + cost安装和调试;
  list_各项费用组成.push([
    `${t("LCC.initialCost.TR")}`,
    cost初期投资 + cost安装和调试,
  ]);
 
  //每年 费用
  var cost维护和修理_bf = 0;
  if (whwxcb.whhxl == "") {
    cost维护和修理_bf = 0;
  } else {
    cost维护和修理_bf = parseFloat(whwxcb.whhxl);
  }
  var cost维护和修理 = 0;
  if (cost维护和修理_bf > 0) {
    for (var year = 0; year < zhouqi; year++) {
      cost维护和修理 += cost维护和修理_bf;
      yearList费用[year] += cost维护和修理_bf;
      cost维护和修理_bf = MyRound(
        (cost维护和修理_bf * (100 + lilv)) / 100,
        1
      );
    }
  }
 
  list_各项费用组成.push([
    `${t("LCC.maintenanceAndRepair.TR")}`,
    MyRound(cost维护和修理, 0),
  ]);
 
  var cost运行费用_bf = 0;
  var cost运行费用 = 0;
  if (whwxcb.yxfy == "") {
    cost运行费用_bf = 0;
  } else {
    cost运行费用_bf = parseFloat(whwxcb.yxfy);
  }
 
  if (cost运行费用_bf > 0) {
    for (var year = 0; year < zhouqi; year++) {
      cost运行费用 += cost运行费用_bf;
      yearList费用[year] += cost运行费用_bf;
      cost运行费用_bf = MyRound(
        (cost运行费用_bf * (100 + lilv)) / 100,
        1
      );
    }
  }
 
  list_各项费用组成.push([
    `${t("LCC.runningCost.TR")}`,
    MyRound(cost运行费用, 0),
  ]);
 
  var cost生产停工和损耗_bf = 0;
  var cost生产停工和损耗 = 0;
  if (whwxcb.sctghsh == "") {
    cost生产停工和损耗_bf = 0;
  } else {
    cost生产停工和损耗_bf = parseFloat(whwxcb.sctghsh);
  }
  if (cost生产停工和损耗_bf > 0) {
    for (var year = 0; year < zhouqi; year++) {
      cost生产停工和损耗 += cost生产停工和损耗_bf;
      yearList费用[year] += cost生产停工和损耗_bf;
      cost生产停工和损耗_bf = MyRound(
        (cost生产停工和损耗_bf * (100 + lilv)) / 100,
        1
      );
    }
  }
 
  list_各项费用组成.push([
    `${t("LCC.downtimeAndLoss.TR")}`,
    MyRound(cost生产停工和损耗, 0),
  ]);
 
  var cost环境保护费_bf = 0;
  var cost环境保护费 = 0;
  if (whwxcb.hjbhf == "") {
    cost环境保护费_bf = 0;
  } else {
    cost环境保护费_bf = parseFloat(whwxcb.hjbhf);
  }
  if (cost环境保护费_bf > 0) {
    for (var year = 0; year < zhouqi; year++) {
      cost环境保护费 += cost环境保护费_bf;
      yearList费用[year] += cost环境保护费_bf;
      cost环境保护费_bf = MyRound(
        (cost环境保护费_bf * (100 + lilv)) / 100,
        1
      );
    }
  }
 
  list_各项费用组成.push([
    `${t("LCC.environmentalFee.TR")}`,
    MyRound(cost环境保护费, 0),
  ]);
 
  var cost其他年费_bf = 0;
  var cost其他年费 = 0;
  if (whwxcb.qtnfy == "") {
    cost其他年费_bf = 0;
  } else {
    cost其他年费_bf = parseFloat(whwxcb.qtnfy);
  }
  if (cost其他年费_bf > 0) {
    for (var year = 0; year < zhouqi; year++) {
      cost其他年费 += cost其他年费_bf;
      yearList费用[year] += cost其他年费_bf;
      cost其他年费_bf = MyRound(
        (cost其他年费_bf * (100 + lilv)) / 100,
        1
      );
    }
  }
  list_各项费用组成.push([
    `${t("LCC.othersFee.TR")}`,
    MyRound(cost其他年费, 0),
  ]);
 
  state.m_yearList费用 = yearList费用;
 
  // console.log("各项费用组成", list_各项费用组成);
 
  let nowyear = new Date().getFullYear(); //当前年份
  let chartData4Year = {
    //单年图表数据
    feiyong: [],
    co2: [],
    dnyml: [], //单年用煤量
    year: [],
  };
  for (var i = 0; i < yearList费用.length; i++) {
    // console.log(
    //   "年",
    //   i,
    //   yearList费用[i],
    //   this.m_yearList煤[i],
    //   this.m_yearListCO2[i]
    // );
    chartData4Year.year.push(nowyear);
    chartData4Year.feiyong.push(yearList费用[i]);
    chartData4Year.dnyml.push(state.m_yearList煤[i]);
    chartData4Year.co2.push(state.m_yearListCO2[i]);
 
    nowyear++;
  }
 
  /**
   * 处理饼图表格数据
   **/
  //电费排序(降序)
  list_各项费用组成 = sortDianFei(list_各项费用组成);
  // console.log(chartData4Pies,1033)
  let moneyComponentList = [];
  let zong = list_各项费用组成
    .map((item) => {
      return item[1];
    })
    .reduce((total, num) => {
      return total + num;
    });
  for (var i = 0; i < list_各项费用组成.length; i++) {
    let item = list_各项费用组成[i];
    moneyComponentList.push({
      name: item[0],
      value: item[1],
      per: ((parseFloat(item[1]) / zong) * 100).toFixed(2),
      color: colors[i],
    });
  }
  //获取饼图数据
  state.chartData4Pies = list_各项费用组成;
  state.moneyComponentList = moneyComponentList;
  //获取单年柱状图表数据
  state.chartData4Year = chartData4Year;
 
  return true;
}
//计算 累计费用
const CalcYearTolalMoneyValue = (zhouqi) => {
  var totalList费用 = []; //总费用
  var yearList费用 = state.m_yearList费用;
  for (var i = 0; i < yearList费用.length; i++) {
    var item = 0;
    for (var j = 0; j <= i; j++) {
      item += yearList费用[j];
    }
    totalList费用.push(MyRound(item, 1));
  }
  //console.log(totalList费用);
 
  let nowyear = new Date().getFullYear(); //当前年份
  var year_info_list = {
    feiyong: [],
    co2: [],
    ljyml: [],
    year: [],
  };
 
  for (var i = 0; i < totalList费用.length; i++) {
    // console.log(
    //   "累计",
    //   i,
    //   totalList费用[i],
    //   this.m_totalList煤[i],
    //   this.m_totalListCO2[i]
    // );
 
    year_info_list.year.push(nowyear);
    year_info_list.co2.push(parseFloat(state.m_totalListCO2[i]).toFixed(2));
    year_info_list.ljyml.push(parseFloat(state.m_totalList煤[i]).toFixed(2));
    year_info_list.feiyong.push(totalList费用[i]);
 
    nowyear++;
  }
  //获取累计表格数据
  year_info_list.year.forEach((item, index) => {
    state.chartDataLeiJiTable.push({
      year: item,
      feiyong: year_info_list.feiyong[index],
      co2: year_info_list.co2[index],
      ljyml: year_info_list.ljyml[index],
    });
  });
  state.chartData4LeiJi = year_info_list;
  return true;
}
const getPowerByFlow = (flow) => {
  if (state.m_cbCalcPowerByFlow == null) return null;
 
  return state.m_cbCalcPowerByFlow(flow, state.m_unitQ);
}
//排序(降序)
const sortDianFei = (data) => {
  data.sort(function (a, b) {
    var v1 = a[1];
    var v2 = b[1];
    return v2 - v1;
  });
  //console.log(data)
  return data;
}
//计算echarts 的 max ,min ,interval
const getChartMaxMinInterval = (max, min, splitNumber) => {
  function getMaxMinNumber(n, l) {
    var a1 = Math.floor(Math.log(n) / Math.LN10);
    var b;
    if (l) {
      a1 < 2
        ? (b =
          n / Math.pow(10, a1) - parseInt(n / Math.pow(10, a1)) > 0.5
            ? MyRound(n / Math.pow(10, a1)) * Math.pow(10, a1)
            : (parseInt(n / Math.pow(10, a1)) + 0.5) * Math.pow(10, a1))
        : (b = Math.ceil(n / Math.pow(10, 1)) * Math.pow(10, 1));
    } else {
      a1 < 2
        ? (b =
          n / Math.pow(10, a1) - parseInt(n / Math.pow(10, a1)) > 0.5
            ? (parseInt(n / Math.pow(10, a1)) + 0.5) * Math.pow(10, a1)
            : Math.floor(n / Math.pow(10, a1)) * Math.pow(10, a1))
        : (b = Math.floor(n / Math.pow(10, 1)) * Math.pow(10, 1));
    }
    return l ? (-20 <= a1 ? +b.toFixed(a1 < 0 ? -a1 + 1 : 0) : b) : b;
  }
  var interval = 0;
  if ((max - min) % splitNumber != 0) {
    interval = getMaxMinNumber((max - min) / splitNumber, 1);
    max = parseFloat(
      (parseFloat((interval * splitNumber).toFixed(12)) + min).toFixed(12)
    ); //解决小数精度一般问题,极端问题并不能解决。
    min = min;
  } else {
    interval = (max - min) / splitNumber;
    min = min;
    max = max;
  }
  return { max: max, min: min, interval: interval };
}
defineExpose({
  initLccData,
  setCalcFuncByFlowCb
})
 
</script>
 
<style lang="scss">
/* scoped */
#echart_pie_box {
  width: 7.6rem;
  height: 5rem;
}
 
.chengBenFenXi {
  .el-tabs__header {
    height: 0.4rem;
    line-height: 0.4rem;
  }
 
  .el-tabs__item {
    height: 0.4rem;
    line-height: 0.4rem;
  }
 
  .el-tabs__content {
    height: 4.75rem;
 
    .el-tab-pane {
      height: 100%;
    }
  }
 
  .el-tabs--border-card>.el-tabs__header .el-tabs__item.is-disabled {
    cursor: not-allowed;
  }
 
  .div_tr {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.1rem;
 
    &:last-of-type {
      margin-bottom: 0;
    }
 
    .div_box {
      width: calc(50% - 0.1rem);
      height: 2.6rem;
      border: 0.01rem solid #bce8f1;
 
      .div_box_title {
        height: 0.3rem;
        line-height: 0.3rem;
        background-color: #c1e0cc;
        color: #31708f;
        padding-left: 0.1rem;
        text-align: left;
      }
 
      .div_box_content {
        min-height: 2.3rem;
        overflow: auto;
        padding: 0.1rem;
        box-sizing: border-box;
 
        table {
          thead {
            height: 0.3rem;
            line-height: 0.3rem;
          }
 
          tr {
            height: 0.3rem;
            line-height: 0.3rem;
 
            .closeTr {
              position: absolute;
              right: 0rem;
              top: 0.07rem;
              display: inline-block;
              width: 0.2rem;
              height: 0.2rem;
              line-height: 0.2rem;
            }
          }
        }
 
        .pump_flow,
        .pump_time {
          border: none;
          border-bottom: 0.01rem solid #ddd;
          outline: none;
          text-align: center;
          // height: 0.3rem;
        }
 
        .pump_flow {
          width: 1.2rem;
        }
 
        .pump_time {
          width: 1rem;
        }
 
        .div_box_content_group {
          display: flex;
          padding: 0.05rem 0;
          box-sizing: border-box;
          align-items: center;
          .pump_label {
            width: 30%;
            text-align: right;
            padding-right: 0.05rem;
            margin-bottom: 0rem;
            // height: 0.3rem;
            // line-height: 0.3rem;
          }
 
          .pump_value {
            width: 20%;
            height: 0.3rem;
            line-height: 0.3rem;
 
            input {
              width: 100%;
              border: 0;
              border-bottom: 0.01rem solid #ccc;
              text-align: center;
            }
          }
        }
      }
    }
  }
}
</style>