salary.js 131.4 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 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785
import * as types from '../constants/ActionTypes';
import {
  getCustomerSalaryList, deleteSalaryPlan, getSalaryDetail, insertSalary, getSalaryPlan, getSalaryPlanDetail, getCustomerTem, getSalaryCycles, getSendBatch, confirmSalaryCycles, deleteSalaryCycles,
  getSalaryCyclesRecord, getPersonSalaryRecord, getPayrollTaxList, getPayrollTaxDetail, getPendingPayrollTaxDetail, getPayrollPersonDetail, getPayrollPersonRecords,
  getSalaryCyclesDet, getPayrollTaxStaticDet, getSalarySilpRecord, resendSalaryCycles, exportSalaryCycles, importSalaryCycles, exportPayrollTaxCycles,
  importPayrollTaxCycles, addSalaryPlan, uploadSalaryPlan, getAbnormalList, getTaxIndexStatics, getSalaryIndexStatics, getPersonTaxRecordDetail, getPersonSalaryRecordDetail, addMybank, getMybank,
  salaryPayroll, getLegalEntities, goDeclareTax, getIntegral, getDrawMoney, postIntegral, postDrawMoney, dowmDrawMoney, getAttendanceStatistics, postAttendanceStatistics, getBillingDetails,
    declaringUnit,
    dealAbnormalCyCles,
    getPersonSalaryCountRecord,
    getSalarySendDetailInCustomer,
    updatePayTaskTem,
    exportSalaryPlanActionUtils,
    thirdPartyPay,
    loadErrorInCaculate,
    confirmSalaryProcess,
    newPaySalaryBill,
    getSalaryBillList,
    getSalaryBillRecord,
    getUserBillDetail,
    repeatSendBill,
    ignoreSpecialDecutionToCount,
    remindSpecialDecution,
    remindFinanceDecution,
    getsendSimpleList,
    getsendPersonalSendBatchList,
    getWaitSendNaturalList,
    getSpecialDeuctionList,
    getAssistanceDownloadUrl,
    checkSalaryPlanRepeatOrNot,
    downloadPlanSheet2,
    getHaiXiaAbstractList,
    addHaiXiaAbstractItem,
    delHaiXiaAbstractItem,
    editHaiXiaAbstractItem,
    getHaiXiaAbstractItemDetail,
    payTaxNow,
    payTaxList,
    payTaxDetail,
    getConsolidatedList,
    payTaxStatistics,
    payTaxDetailStatistics,
    getSettingState ,
    makeSettingState,
    exportNaturalInfo,
    updateNatureHuman,
    getSalaryImportList,
    getSalaryImportDetail,
    putIssueToFinance,
    uploadHistoryBill,
    creatHistoryBill,
    getHistorySalaryStatistics,
    getHistorySalaryDet,
    getHistorySalaryList,
    getHistorySalaryRecords,
    getHistorySalaryImportRecords,   
    getHistorySalaryImportRecordsDet, 
    delHistorySalaryList,
    delPersonalTaxDeuction,
    countHistorySalary,
    getHistoryTaxBalanceList,
    getHistoryTaxBalanceDetail,
    getHistorySalaryCountState,
    isOrNotTaxDeuction,
    notifyFounder,
    downloadScheme,
    SimulationTaxlist,
    SimulationTaxJudge,
    addSimulationTax,
    SimulationTaxDetail,
    SimulationTaxDetailList,
    SimulationTaxDel,
    SimulationTaxStatis,
    SimulationTaxDo,
    SimulationTaxConfirm,
    SimulationTaxDifference,
    downWageSheet,
    recallUtil,
    salaryBatchDown,
    consolidatedTaxList,
    calibrationAll,
    salarySheetRecall,
    salaryPlanCancle,
    getInitializeSimulatedTaxList,
    postInitializeTaxImport,
    taxImportRecord,

} from '../../utils/salaryUtil';
import { message, notification } from 'antd';
import moment from 'moment';
import { SubmissionError, change, submit, initialize} from 'redux-form';
import { getOssFilePath } from '../../utils/commonUtils'
import React from 'react';
import { downloadFileByUrl } from '../../utils/fileUtil';
import { loadCustomerLegalEntities} from './custome';
import { getLegalList } from './settingAction';
import { defaultSlipFields , remunerationDefaultSlipFields , laborRemunerationDefaultSlipFields , getDefaultData  } from './../../containers/salary/salaryData'

export class NotificationIcon extends React.Component {
  render() {
    const { type } = this.props;
    if (type == 'success') {
      return (
        <img style={{ width: '32px', height: '32px' }} src='./img/成功icon.png' />
      )
    } else if (type == 'error') {
      return (
        <img style={{ width: '32px', height: '32px' }} src='./img/错误icon.png' />
      )
    } else if (type == 'info') {
      return (
        <img style={{ width: '32px', height: '32px' }} src='./img/信息icon.png' />
      )
    }
  }
}

//映射字段
export function mappingColumnAction(input_columns, system_fields, mapping_columns) {
  return {
    type: types.MAPPING_COLUMN,
    mappingColumn: {
      input_columns,
      system_fields
    },
    mappings: mapping_columns
  }
}
//更新薪酬方案
export function uploadSalaryPlanAction(values) {
  return dispatch => {
    return uploadSalaryPlan(values).then(data => {
      if (data.code && data.code >= 300) {
        message.error(data.message);
        return false;
      } else {
        message.success('更新薪酬方案成功');
        dispatch(getSalaryPlanDetailAction(values))
        return true;
      }
    }).catch(err => { throw err });
  }
}
//新建薪酬方案 addSalaryPlan
export function addSalaryPlanAction(values) {
  return dispatch => {
    dispatch({ type: 'MASK_SHOW', maskShow: true });
    return addSalaryPlan(values).then(data => {
      dispatch({ type: 'MASK_SHOW', maskShow: false });
      if(data.code&&data.code>=300){
        dispatch({
            type: types.ADD_SALARY_PLAN,
            addSalaryPlan: false
          });
        notification.open({
          // duration   : null,
          message    : '错误',
          description: '创建失败,'+data.message,
          icon       : <NotificationIcon type='error'/>,
        });

      } else {
        dispatch({
          type: types.ADD_SALARY_PLAN,
          planData: data,
          addSalaryPlan: true
        });
      }
      dispatch(change('step_one', 'current', 3));
    }).catch(err => {       dispatch({ type: 'MASK_SHOW', maskShow: false });throw err; });
  }
}
//新建工资条发放任务
export function newPaySalaryBillAction(values) {
  return dispatch => {
    dispatch({ type: 'MASK_SHOW', maskShow: true });
    return newPaySalaryBill(values).then(data => {
      dispatch({ type: 'MASK_SHOW', maskShow: false });
      if (data.code && data.code >= 300) {
        message.error(data.message);
        // dispatch({
        //   type: types.ADD_SALARY_PLAN,
        //   addSalaryPlan: false
        // });
      } else {
        dispatch(change('step_one','showPaySalary',true));
        // dispatch({
        //   type: types.ADD_SALARY_PLAN,
        //   planData: data,
        //   addSalaryPlan: true
        // });
      }
    }).catch(err => { dispatch({ type: 'MASK_SHOW', maskShow: false });throw err });
  }
}
export function cleanPlanValueAction(values) {//清空addSalaryPlan
  return dispatch => {
    dispatch({
      type: types.ADD_SALARY_PLAN,
      addSalaryPlan: 'init'
    });
  }
}
//获取薪酬方案列表
export function getSalaryPlanAction(values) {
  return dispatch => {
    return getSalaryPlan(values).then(data => {
        if (data.code && data.code >= 300) {
            if (data.message) {
              message.error(data.message);
            } else {
              message.error('请求数据有误');
            }
          } else {
            dispatch({
                type: types.GET_SALARY_LIST,
                salaryList: data
              });
            const { total_count } = data;
            dispatch(change('search_list_salary_plan', 'total_count', total_count))
            dispatch(change('search_salary_plan_void', 'total_count', total_count))
            return data;
          }
    
    }).catch(err => { throw err });
  }
}
//获取薪酬方案列表
export function getSalaryPlanAction_Power(values) {
  return dispatch => {
    return getSalaryPlan(values).then(data => {
        if (data.code && data.code >= 300) {
            if (data.message) {
              message.error(data.message);
            } else {
              message.error('请求数据有误');
            }
          } else {
            dispatch({
                type: types.GET_SALARY_LIST_POWER,
                salaryList_power: data
              });
            return data;
          }
    
    }).catch(err => { throw err });
  }
}

//清除薪酬方案列表
export function cleanSalaryPlanAction(values){
  return dispatch => {
    return {
      type      : types.GET_SALARY_LIST,
      salaryList: {}
    }
  }
}

//导出薪酬方案
export function exportSalaryPlanAction(values) {
  return dispatch => {
    return exportSalaryPlanActionUtils(values).then(data => {
      if (data.code && data.code >= 300) {
        notification.open({
          message: '错误',
          description: '导出失败,' + data.message,
          icon: <NotificationIcon type='error' />,
        });
      } else {
        notification.open({
          message: '成功',
          description: '导出成功',
          icon: <NotificationIcon type='success' />,
        });
        if (data.file_path) {
          window.open(getOssFilePath(data.file_path));
        }
      }
    }).catch(err => { throw err });
  }
}

//获取具体的某个工资条的用户列表
export function getSalaryBillRecordAction(values) {
  return dispatch => {
    return getSalaryBillRecord(values).then(data => {
  
      if (data.code && data.code >= 300) {
        if (data.message) {
          message.error(data.message);
        } else {
          message.error('请求数据有误');
        }
      } else {
        dispatch({
          type: types.GET_SALARY_USER_LIST,
          salaryUserList: data
        });
        const { total_count } = data;
        dispatch(change('search_list_salary_user_bill', 'total_count', total_count))
      }
    }).catch(err => { throw err });
  }
}
//删除具体的某个工资条的用户列表

export function cleanSalaryBillRecord(values){
  return dispatch => {
    return {
      type      : types.GET_SALARY_USER_LIST,
      salaryUserList: {}
    }
  }
}


//删除薪酬方案
export function deleteSalaryPlanAction(values) {
  return dispatch => {
    return deleteSalaryPlan(values).then(data => {
      if (data.code && data.code >= 300) {
        if (data.message) {
          message.error(data.message);
        } else {
          message.error('删除失败');
        }
      } else {
        message.success('删除成功');
        dispatch(submit('search_list_salary_plan'));
      }
    }).catch(err => { throw err });
  }
}
//获取薪酬方案详情
export function getSalaryPlanDetailAction(values) {
  return dispatch => {
    return getSalaryPlanDetail(values).then(data => {
      dispatch({
        type: types.GET_SALARY_PLAN_DETAIL,
        salaryDetail: data
      });
      return data
    }).catch(err => { throw err });
  }
}
/*清除薪酬模板*/
export function cleanCustomTem(values){
  return {
    type        : types.CUSTOM_TEM,
    customTem   : {
      input_columns:[],
      columnOrder:{},
      system_fields:[]
    },
    errorMessage: true
  }
}

//模糊匹配的处理,回填的是上传表头字段的key值
/*
name 姓名
mobile 手机号码
credential_type 证照类型
credential_number 证件号码
bank 开户行
bank_card_no 银行号码
tax_free_income 免税收入
personal_endowment 个人养老
personal_medical 个人医疗
personal_unemployment 个人失业
personal_house_fund 个人公积金
commercial_insurance 商业健康保险
tax_extension 税延养老保险
annuity年金
donation_deducted 准予扣除的捐赠额
other_deduction其他扣除
tax_savings减免税额
pay_salary 应发工资
salary 实发工资
actual_donation 实际捐赠额 
donation_way 捐赠方式
remark 备注
tax_adjust 税后调整
first_tax '首次校准个税'
* */
 




const fuzzyMatchAct = (data, dispatch, source, taxation_method) => { 

    /** 
    *  @params
            data ---数据    
            taxation_method---针对薪酬方案的个税申报类型
            source---模糊匹配来源     
                                adjust:首次校准   historyBill: 导入历史工资表 || 批量导入历史工资表     hro-slip:直接发放工资条
                                historyImportSingle  单个导入历史工资表
                                historyImportMultiple  批量导入历史工资表
     *  */ 
  if (data) {
    const { input_columns = [], system_fields = [] ,mapItemArr=[], map_system_fields=[]} = data;
    console.log('input_columns11111',input_columns);
    let salary_fields = []; // 配置映射的结构
    if (map_system_fields && map_system_fields.length > 0) {
      map_system_fields.map((item, i) => {

        if (input_columns && input_columns.length > 0) {
          input_columns.map((obj, j) => {
            let objNew = {};
            let dataformatNew = (str) => {
              let category = '';
              if (str == 'commercial_insurance' || str == 'tax_extension' || str == 'annuity' || str == 'other_fee' || str == 'donation_deducted' || str == 'actual_donation' || str == 'donation_way') {
                category = 'exemption';
              } else {
                category = '';
              }
             
              if (item['key'] == str && obj['key'] == str) {
                objNew = Object.assign({}, item, obj, {
                  system_column: item.column,
                  order: obj.order,
                  key: item.key,
                  name: obj.title,
                  category: category || '',
                });

                // 应发工资 特殊处理
                /**
                 * 工资条发放映射字段的时候,需要pay_salary应发工资的结构
                 * 薪酬方案映射的时候  不需要
                 *  */
                if(taxation_method == '0109'){
                  salary_fields.push(objNew);
                }else{
                  if (str != 'pay_salary') {
                    salary_fields.push(objNew);
                  } else if ((str == 'pay_salary') && (source == 'hro-slip')) {
                    salary_fields.push(objNew);
                  }
                }
              
                /**   公式的数据结构展示
                     *   "income_formula": [{
                                        "title": "应纳税额",
                                    "key": "tax_income",
                                    "order": 23,
                                    "pos":1,
                                    "operator": "+"
                                },]
                    */
                if (str == 'pay_salary') { // 处理默认的回填的收入额

                let income_formula_format = {};
                income_formula_format = Object.assign({}, obj, { operator: '+' });
                console.log([income_formula_format])
                data.entryType == 'copy' ? '' : taxation_method == '0109' ? '' : dispatch(change('step_one', 'income_formula', [income_formula_format]));
                data.entryType == 'copy' ? '' : dispatch(change('step_one', 'income_formula_str', obj['title']));
                }
                data.entryType == 'copy' ? '' : dispatch(change('step_one', str, obj['key']));
                dispatch(change('pending_salary', str, obj['key']));
                dispatch(change('salaryFirstAdjustModal_form', str, obj['key']));
                dispatch(change('SimulationTaxCompute', str, obj['key']));

                if(source=='historyImportSingle'){ // 单个导入历史工资表
                    console.log('str',str,obj['key']);
                  
                    dispatch(change('historyImportSingle', str, obj['key']));
                }
                if(source=='historyImportMultiple'){ //批量导入历史工资表
                    dispatch(change('historyImportMultiple', str, obj['key']));
                }
              }
            }
            mapItemArr.map((keyItem, indexArr) => {
              dataformatNew(keyItem);
            });
          })
        }
      })
    }
    if (taxation_method == '0101') {
      salary_fields = salary_fields.filter(filterItem => {
        return filterItem.key != "first_tax"
      })
    } else if (taxation_method == '0103') {
      salary_fields = salary_fields.filter(filterItem => {
        return filterItem.key != "personal_endowment" && filterItem.key != "personal_medical" && filterItem.key != "personal_unemployment" && filterItem.key != "personal_house_fund" && filterItem.key != "tax_extension" && filterItem.key != "commercial_insurance" && filterItem.key != "first_tax" && filterItem.key != "annuity"
      })
    } else if (taxation_method == '0108') {
      salary_fields = salary_fields.filter(filterItem => {
        return filterItem.key != "personal_endowment" && filterItem.key != "personal_medical" && filterItem.key != "personal_unemployment" && filterItem.key != "personal_house_fund" && filterItem.key != "first_tax"
      })
    } else if (taxation_method == '0401') {
      salary_fields = salary_fields.filter(filterItem => {
        // return filterItem.key != "personal_endowment" && filterItem.key != "personal_medical" && filterItem.key != "personal_unemployment" && filterItem.key != "personal_house_fund" && filterItem.key != "first_tax"
        return filterItem.key != 'taxable_income_formula_str' && filterItem.key != 'commercial_insurance' && filterItem.key != 'tax_extension' && filterItem.key != "commercial_insurance" && filterItem.key != "pay_salary" && filterItem.key != "personal_endowment" && filterItem.key != "personal_medical" && filterItem.key != "personal_unemployment" && filterItem.key != "personal_house_fund" && filterItem.key != "first_tax" && filterItem.key != "annuity"
      })
    }else if(taxation_method == '0500'){
      salary_fields = salary_fields.filter(filterItem => {
        return filterItem.key != 'taxable_income_formula_str' && filterItem.key != 'actual_donation' && filterItem.key != 'donation_way' && filterItem.key != "pay_salary" && filterItem.key != "personal_endowment" && filterItem.key != "personal_medical" && filterItem.key != "personal_unemployment" && filterItem.key != "personal_house_fund" && filterItem.key != "tax_extension" && filterItem.key != "commercial_insurance" && filterItem.key != "first_tax" && filterItem.key != "annuity"
      })
    }else if(taxation_method == '0109'){
      salary_fields = salary_fields.filter(filterItem => {
        return filterItem.key != 'taxable_income_formula_str' && filterItem.key != 'actual_donation' && filterItem.key != 'donation_way' && filterItem.key != 'donation_deducted' &&     filterItem.key != "personal_endowment" && filterItem.key != "personal_medical" && filterItem.key != "personal_unemployment" && filterItem.key != "personal_house_fund" && filterItem.key != "tax_extension" && filterItem.key != "commercial_insurance" && filterItem.key != "first_tax" && filterItem.key != "annuity"
      })
    }
    // salary_fields = salary_fields.concat(defaultSlipFields)
    data.entryType == 'copy' ? '' : dispatch(change('step_one', 'salary_fields', salary_fields));
    dispatch(change('pending_salary', 'salary_fields', salary_fields));
    dispatch(change('salaryFirstAdjustModal_form', 'salary_fields', salary_fields));
    return salary_fields;
  }
}
/*上传映射的模板   
    1 、 创建薪酬方案模板
    2、首次校准模板  sourceToIdentify ---- adjust
    3、导入历史工资表 sourceToIdentify ---- historyBill
    3、导入历史工资表 sourceToIdentify ---- historyImportSingle
    3、导入历史工资表 sourceToIdentify ---- historyImportMultiple
*/

export function uploadHistoryBillExcel(values){
    return dispatch => {
        dispatch({ type: 'MASK_SHOW', maskShow: true });
        return uploadHistoryBill(values).then(data => {
            
            
          if(data.code&&data.code>=300){
            dispatch({
              type        : types.CUSTOM_TEM,
              errorMessage: false
            });
            notification.open({
              // duration   : null,
              message    : '错误',
              description: '上传失败,'+data.message,
              icon       : <NotificationIcon type='error'/>,
            });
          }else{
            dispatch({
              type        : types.PROGRAMDATA,
              programData:data
            })

            const { sourceToIdentify='' } =values;
            return data;
          }
        }).catch(err => { 
            dispatch({ type: 'MASK_SHOW', MASK_SHOW:false}) ;
            throw err
    });
    }
}

export function updateCustomTem(values){
    return dispatch => {
        dispatch({ type: 'MASK_SHOW', maskShow: true });
        return getCustomerTem(values).then(data => {
            dispatch({ type: 'MASK_SHOW', MASK_SHOW:false})
            
          if(data.code&&data.code>=300){
            dispatch({
              type        : types.CUSTOM_TEM,
              errorMessage: false
            });
            notification.open({
              // duration   : null,
              message    : '错误',
              description: '上传失败,'+data.message,
              icon       : <NotificationIcon type='error'/>,
            });
          }else{
            dispatch({
              type        : types.PROGRAMDATA,
              programData:data
            })
        
            processingData(data , dispatch , values, {isUpload:true})
          }
          return data;
        }).catch(err => { 
            dispatch({ type: 'MASK_SHOW', MASK_SHOW:false}) ;
            throw err
    });
    }
}
export function processingData(data , dispatch ,values ,isUpload) {
 console.log(values,values.entryType)
  const { 
        sourceToIdentify='' , // 映射来源
        taxation_method = '' ,//新建薪酬方案时候的个税申报类型
        entryType=''      //判断入口时 正常添加 还是 复制薪酬方案   entryType==copy  复制
} = values
  dispatch(change("step_one" ,'entryType' , entryType ))
  let { input_columns = [], system_fields = [] } = data, columnOrder = {};
  let input_options = [], salary_slip_fields = [];
  console.log('taxation_method111',taxation_method);
  let mapItemArr = [];//定义需要映射的字段所有的key数组   (  !!!!!!!如果有新的映射关系时,一定要更新该数组 !!!!!!! )
  let map_system_fields = [];//定义需要映射的字段中所有的系统字段中所有的key数组   (  !!!!!!!如果有新的映射关系时,一定要更新该数组 !!!!!!! )
console.log('sourceToIdentify111',sourceToIdentify)
    if (sourceToIdentify == 'salaryPlan') {// 新建薪酬方案时的映射
         mapItemArr = [  //定义需要映射的字段所有的key数组   (  !!!!!!!如果有新的映射关系时,一定要更新该数组 !!!!!!! )
            'name', 'mobile', 'credential_type', 'credential_number', 'bank', 'salary', 'bank_card_no', 'tax_free_income', 'personal_endowment', 'personal_medical',
            'personal_unemployment', 'personal_house_fund', 'commercial_insurance', 'tax_extension', 'annuity', 'donation_deducted', 'other_fee', 'tax_savings', 'pay_salary', 'actual_donation', 'donation_way', 'remark', 'tax_adjust', 'first_tax', 'last_pay_salary','salary_reduction_banlance'
          ];
        
        if(taxation_method == '0109'){
          map_system_fields = [  //定义需要映射的字段所有的系统字段 (  !!!!!!!如果有新的映射关系时,一定要更新该数组 !!!!!!! )
            {"column":"*姓名","key":"name","is_required":"required","order":0},{"column":"*证照号码","key":"credential_number","is_required":"required","order":1},{"column":"*银行卡号","key":"bank_card_no","is_required":"required","order":2},
            {"column":"本月股权激励收入","key":"pay_salary","is_required":"optional","order":3},{"column":"本年累计股权激励(不含本月)","key":"last_pay_salary","is_required":"optional","order":4},{"column":"本年累计免税收入","key":"tax_free_income","is_required":"optional","order":5},
            {"column":"本年累计准予扣除的捐赠额","key":"donation_deducted","is_required":"optional","order":6},{"column":"本年累计其他","key":"other_fee","is_required":"optional","order":7},{"column":"备注","key":"remark","is_required":"optional","order":8},
            {"column":"本年累计减免税额","key":"tax_savings","is_required":"optional","order":9},{"column":"本年累计已扣缴税额","key":"salary_reduction_banlance","is_required":"optional","order":10},{"column":"*手机号码","key":"mobile","is_required":"required","order":11},
            {"column":"证照类型","key":"credential_type","is_required":"optional","order":12},{"column":"开户行","key":"bank","is_required":"optional","order":13},
        ];
        }else{
          map_system_fields = [  //定义需要映射的字段所有的系统字段 (  !!!!!!!如果有新的映射关系时,一定要更新该数组 !!!!!!! )
            {"column":"*姓名","key":"name","is_required":"required","order":0},{"column":"*证照号码","key":"credential_number","is_required":"required","order":1},{"column":"*银行卡号","key":"bank_card_no","is_required":"required","order":2},{"column":"个人养老","key":"personal_endowment","is_required":"optional","order":3},{"column":"个人医疗","key":"personal_medical","is_required":"optional","order":4},{"column":"个人失业","key":"personal_unemployment","is_required":"optional","order":5},{"column":"商业健康保险","key":"commercial_insurance","is_required":"optional","order":6},{"column":"年金","key":"annuity","is_required":"optional","order":7},{"column":"其他扣除","key":"other_fee","is_required":"optional","order":8},{"column":"个人公积金","key":"personal_house_fund","is_required":"optional","order":9},{"column":"税延养老保险","key":"tax_extension","is_required":"optional","order":10},{"column":"减免税额","key":"tax_savings","is_required":"optional","order":11},{"column":"开户行","key":"bank","is_required":"optional","order":12},
            {"column":"免税收入","key":"tax_free_income","is_required":"optional","order":13},{"column":"*手机号码","key":"mobile","is_required":"required","order":14},{"column":"证照类型","key":"credential_type","is_required":"optional","order":15},{"column":"准予扣除的捐赠额","key":"donation_deducted","is_required":"optional","order":16},{"column":"应发工资","key":"pay_salary","is_required":"optional","order":17},{"column":"捐赠方式","key":"donation_way","is_required":"optional","order":18},{"column":"实际捐赠额","key":"actual_donation","is_required":"optional","order":19},{"column":"备注","key":"remark","is_required":"optional","order":20},{"column":"税后调整","key":"tax_adjust","is_required":"optional","order":21},
            {"column":"本年累计股权激励(不含本月)","key":"last_pay_salary","is_required":"optional","order":22},{"column":"本年累计已扣缴税额","key":"salary_reduction_banlance","is_required":"optional","order":23},
        ];
        }
        //  map_system_fields = [  //定义需要映射的字段所有的系统字段 (  !!!!!!!如果有新的映射关系时,一定要更新该数组 !!!!!!! )
        //     {"column":"*姓名","key":"name","is_required":"required","order":0},{"column":"*证照号码","key":"credential_number","is_required":"required","order":1},{"column":"*银行卡号","key":"bank_card_no","is_required":"required","order":2},{"column":"个人养老","key":"personal_endowment","is_required":"optional","order":3},{"column":"个人医疗","key":"personal_medical","is_required":"optional","order":4},{"column":"个人失业","key":"personal_unemployment","is_required":"optional","order":5},{"column":"商业健康保险","key":"commercial_insurance","is_required":"optional","order":6},{"column":"年金","key":"annuity","is_required":"optional","order":7},{"column":"其他扣除","key":"other_fee","is_required":"optional","order":8},{"column":"个人公积金","key":"personal_house_fund","is_required":"optional","order":9},{"column":"税延养老保险","key":"tax_extension","is_required":"optional","order":10},{"column":"减免税额","key":"tax_savings","is_required":"optional","order":11},{"column":"开户行","key":"bank","is_required":"optional","order":12},
        //     {"column":"免税收入","key":"tax_free_income","is_required":"optional","order":13},{"column":"*手机号码","key":"mobile","is_required":"required","order":14},{"column":"证照类型","key":"credential_type","is_required":"optional","order":15},{"column":"准予扣除的捐赠额","key":"donation_deducted","is_required":"optional","order":16},{"column":"应发工资","key":"pay_salary","is_required":"optional","order":17},{"column":"捐赠方式","key":"donation_way","is_required":"optional","order":18},{"column":"实际捐赠额","key":"actual_donation","is_required":"optional","order":19},{"column":"备注","key":"remark","is_required":"optional","order":20},{"column":"税后调整","key":"tax_adjust","is_required":"optional","order":21},
        //     {"column":"本年累计股权激励(不含本月)","key":"last_pay_salary","is_required":"optional","order":22},{"column":"本年累计已扣缴税额","key":"salary_reduction_banlance","is_required":"optional","order":23},
        // ];
         // ********************************针对重复导入表格的时候 将映射关系清空。********************************
        dispatch(change("step_one" ,'income_formula' , [] ))
        dispatch(change("step_one" ,'taxable_income_formula' , [] ))
        dispatch(change("step_one" ,'taxable_income_formula_str' , '' ))
        dispatch(change("step_one" ,'income_formula_str' , '' ))
    } 
    // 首次校准  只针对个税一个字段进行自动匹配
    if (sourceToIdentify == 'adjust') {
        mapItemArr = ['first_tax'];
        map_system_fields =[
            {"column":"个税","key":"first_tax","is_required":"optional","order":22},
            ]
    }
    // 单个导入历史工资表   || 批量导入历史工资表   :  historyImportSingle || historyImportMultiple
    if (sourceToIdentify == 'historyImportSingle' ||sourceToIdentify == 'historyImportMultiple' ) {
        mapItemArr = ['first_tax','tax_balance','salary'];
        map_system_fields =[
            {"column":"个税","key":"first_tax","is_required":"optional","order":22},
            {"column":"实发工资","key":"salary","is_required":"optional","order":22},
            {"column":"当期补退差额","key":"tax_balance","is_required":"optional","order":22}
        ]
    }
    if (sourceToIdentify == 'hro-slip') { // 工资条发放  
        mapItemArr = [
            'name',
            'credential_type',
            'credential_number',
            'mobile',
            'salary',
            'pay_salary',
            'bank',
            'bank_card_no',
            'first_tax',
    
        ];
        map_system_fields =[
            {"column":"姓名","key":"name","is_required":"required","order":0},{"column":"证件号码","key":"credential_number","is_required":"required","order":1},{"column":"手机号码","key":"mobile","is_required":"required","order":2},{"column":"实发工资","key":"salary","is_required":"required","order":3},{"column":"个税","key":"first_tax","is_required":"required","order":4},{"column":"证照类型","key":"credential_type","is_required":"required","order":5},{"column":"应发工资","key":"pay_salary","is_required":"required","order":6},{"column":"开户行","key":"bank","is_required":"required","order":7},{"column":"银行卡号","key":"bank_card_no","is_required":"required","order":8}
        ]
    }
    if (sourceToIdentify == "smart_tax" ||sourceToIdentify == 'simulation-tax') {  //智能办税
      mapItemArr = [
        'childrens_education',
        'caring_old_people',
        'housing_rent',
        'housing_loan_interest',
        'continuing_education',
      ];
      map_system_fields = [
        { "column": "子女教育", "key": "childrens_education", "is_required": "required", "order": 0 },
        { "column": "赡养老人", "key": "caring_old_people", "is_required": "required", "order": 1 },
        { "column": "住房租金", "key": "housing_rent", "is_required": "required", "order": 2 },
        { "column": "住房贷款利息", "key": "housing_loan_interest", "is_required": "required", "order": 3 },
        { "column": "继续教育", "key": "continuing_education", "is_required": "required", "order": 4 },
      ]
    }
    // ********************************针对重复导入表格的时候 将映射关系清空。********************************
        mapItemArr.map(item=>{
            dispatch(change("step_one" ,item , '' ))// 针对新建薪酬方案
            dispatch(change("historyImportSingle" ,item , '' ))// 针对单个导入薪酬历史工资表
            dispatch(change("historyImportMultiple" ,item , '' ))// 针对批量导入历史工资表
            dispatch(change("salaryFirstAdjustModal_form" ,item , '' ))// 针对首次校准、智能办税
            dispatch(change("SimulationTaxCompute" ,item , '' ))//预算工资
        })
 
  
    // input_columns = input_columns.concat(defaultSlipFields)
    /******************************** 下拉选项的数据的处理*******************/
    input_columns.map((col, i) => {
        let input_columns_obj = {}, flagIsMapped = false;

        let salary_slip_obj = Object.assign({}, col, {
        label: col.title,
        value: col.key,
        "original_column": col.title,
        "name": col.title,
        "key": col.key,
        "is_slip": true,
        "is_required": col.is_required,
        'category':'user'
        });

        if (sourceToIdentify == 'adjust') { // 首次校准 映射个税 但是不做disabled限制

        } else {
            mapItemArr.map((keyItem, indexArr) => { // 拼接带有disabled属性的下拉选项结构
                map_system_fields.map((sysKeyItem, indexArr) => {
                if ((keyItem == col['key'] && sysKeyItem['key'] == col['key']) || col.isDisabled ) {
                    // console.log(keyItem ,sysKeyItem )
                    flagIsMapped = true;
                    
                }


                })// 拼接带有disabled属性的下拉选项结构
            });
        }
        
    if (flagIsMapped) {
        if (sourceToIdentify == 'salaryPlan') { // 薪酬方案映射 
            if (taxation_method == '0103') {
                if(col.key == "pay_salary" || col.key == "personal_endowment" || col.key == "personal_medical" || col.key == "personal_unemployment" || col.key == "personal_house_fund" || col.key == "tax_extension" || col.key == "commercial_insurance" || col.key == "first_tax" || col.key == "annuity"){
                input_options.push(Object.assign({}, { ...col, name: col['title'], id: col['key'], isDisabled: false }));
                }else{
                input_options.push(Object.assign({}, { ...col, name: col['title'], id: col['key'], isDisabled: true }));
                }
            }else if (taxation_method == '0108') {
                if(col.key == "pay_salary" || col.key == "personal_endowment" || col.key == "personal_medical" || col.key == "personal_unemployment" || col.key == "personal_house_fund" || col.key == "first_tax"){
                input_options.push(Object.assign({}, { ...col, name: col['title'], id: col['key'], isDisabled: false }));
                }else{
                input_options.push(Object.assign({}, { ...col, name: col['title'], id: col['key'], isDisabled: true }));
                }
            }else if (taxation_method == '0401') {   
                if(col.key == 'taxable_income_formula_str' || col.key == 'commercial_insurance' || col.key == 'tax_extension' || col.key == "commercial_insurance" || col.key == "pay_salary" || col.key == "personal_endowment" || col.key == "personal_medical" || col.key == "personal_unemployment" || col.key == "personal_house_fund" || col.key == "first_tax" || col.key == "annuity"){
                input_options.push(Object.assign({}, { ...col, name: col['title'], id: col['key'], isDisabled: false }));
                }else{
                input_options.push(Object.assign({}, { ...col, name: col['title'], id: col['key'], isDisabled: true }));
                }
            }else if(taxation_method == '0500'){
              if(col.key == 'taxable_income_formula_str' || col.key == 'actual_donation' || col.key == 'donation_way' || col.key == "pay_salary" || col.key == "personal_endowment" || col.key == "personal_medical" || col.key == "personal_unemployment" || col.key == "personal_house_fund" || col.key == "tax_extension" || col.key == "commercial_insurance" || col.key == "first_tax" || col.key == "annuity"){
                input_options.push(Object.assign({}, { ...col, name: col['title'], id: col['key'], isDisabled: false }));
                }else{
                input_options.push(Object.assign({}, { ...col, name: col['title'], id: col['key'], isDisabled: true }));
                }
            }else if(taxation_method == '0109'){
              if(col.key == 'taxable_income_formula_str' || col.key == 'actual_donation' || col.key == 'donation_way' || col.key == 'donation_deducted' ||     col.key == "personal_endowment" || col.key == "personal_medical" || col.key == "personal_unemployment" || col.key == "personal_house_fund" || col.key == "tax_extension" || col.key == "commercial_insurance" || col.key == "first_tax" || col.key == "annuity"){
                input_options.push(Object.assign({}, { ...col, name: col['title'], id: col['key'], isDisabled: false }));
                }else{
                input_options.push(Object.assign({}, { ...col, name: col['title'], id: col['key'], isDisabled: true }));
                }
            }else{
                if(col.key == "pay_salary" || col.key == "first_tax"){
                input_options.push(Object.assign({}, { ...col, name: col['title'], id: col['key'], isDisabled: false }));
                }else{
                input_options.push(Object.assign({}, { ...col, name: col['title'], id: col['key'], isDisabled: true }));
                }
            }
        }else{
           
            input_options.push(Object.assign({}, { ...col, name: col['title'], id: col['key'], isDisabled: true }));
        }
       
    } else {
        input_options.push(Object.assign({}, { ...col, name: col['title'], id: col['key'], isDisabled: false }));
    }
        salary_slip_fields.push(salary_slip_obj);
    });
      console.warn('salary_slip_fields' , salary_slip_fields)
    salary_slip_fields = salary_slip_fields.concat( getDefaultData(taxation_method ) )  //如果个税申报类型是 稿酬时  用remunerationDefaultSlipFields()  返回的数组 有10个默认值  其他的 用 defaultSlipFields   有17个默认值
    console.log(salary_slip_fields , salary_slip_fields , getDefaultData(taxation_method ))
    if (entryType == 'copy') {   //入口为  复制薪酬方案
      let input_columns_data = JSON.parse(JSON.stringify(values.input_columns)), salary_fields_obj = {}
      //处理input_columns   input_options  下拉选项
      input_columns_data.map((item, index) => {
        let lock = false
        values.salary_fields.map((innerItem, innerIndex) => {
          if (item.title == innerItem.name) {
            lock = true
          }
        })
        if (lock) {
          input_columns_data[index] = { ...item, name: item.title, id: item.key, isDisabled: true }
        } else {
          input_columns_data[index] = { ...item, name: item.title, id: item.key, isDisabled: false }
        }
      })
      //处理input_columns   input_options  下拉选项 结束
      //处理回填值  第二步
      //values.new_input_options 是  映射字段、两个公式。前端手动组成
      values.new_input_options.map((item, index) => {
        input_columns_data.map( (innerItem , innerIndex)=>{
          if( item.name ==innerItem.title ){
            salary_fields_obj = Object.assign( {} ,salary_fields_obj , { [item.key] : innerItem.key  } )
          }
        } )
      })
      //处理回填值  第二步  结束
      let income_formula_str = '' , taxable_income_formula_str = ''
      //获取 公式一
      values.income_formula.map( (item , index)=>{
        income_formula_str += item.operator + item.title
      } )
      income_formula_str = income_formula_str.substr( 1 ,income_formula_str.length )
      //获取 公式二
      values.taxable_income_formula.map( (item , index)=>{
        taxable_income_formula_str += item.operator + item.title 
      } )
      taxable_income_formula_str = taxable_income_formula_str.substr( 1 ,taxable_income_formula_str.length )
      let lock = true
      values.salary_slip_fields.map(item=>{
        if(!item.is_slip){
          lock = false;
        }
      })
      console.log(values.salary_slip)
      // showPayRules internal
      dispatch(initialize('step_one', {
        'has_slip': 'yes',
        'current': 0,
        'currentMapping': 0,
        ...values,
        'input_columns': values.input_columns,
        'input_options': JSON.parse(JSON.stringify(input_columns_data)),
        'uploadExcelDone': true,
        'planName': values.name,
        'fileName': values.file_path.split('/')[values.file_path.split('/').length - 1],
        'area': [values.province_code, values.city_code, values.district_code],
        // 'salary_slip_fields': values.salary_slip_fields,
        'object_path': values.file_path,
        ...salary_fields_obj,
        'income_formula_str':income_formula_str,  
        'income_formula':values.income_formula,
        'taxable_income_formula_str':taxable_income_formula_str,
        'employee_ids': lock ? ['1'] : [],
        'showPayRules':values.insurance_source == 'internal' ? true : false
      })) 
    } else {   //正常创建薪酬方案
      dispatch(change('step_one', 'salary_slip_fields', salary_slip_fields))
      dispatch(change('step_one', 'input_options', JSON.parse(JSON.stringify(input_options))));
      dispatch(change('step_one', 'input_columns', input_columns))
    }
    let salary_fields = [];
    if (sourceToIdentify == 'adjust') {// 首次校准 映射个税
        dispatch(change('pending_salary', 'input_options', JSON.parse(JSON.stringify(input_options))));
        dispatch(change('salaryFirstAdjustModal_form', 'input_options', JSON.parse(JSON.stringify(input_options))));
        salary_fields = fuzzyMatchAct(Object.assign({},data,{mapItemArr,map_system_fields}), dispatch, sourceToIdentify,'');
        dispatch(change('pending_salary', 'salary_fields', salary_fields))
        dispatch(change('salaryFirstAdjustModal_form', 'salary_fields', salary_fields))

    }  else if( sourceToIdentify== 'historyImportSingle' || sourceToIdentify== 'historyImportMultiple'){  // 单个|批量导入历史工资表
        salary_fields = fuzzyMatchAct(Object.assign({},data,{mapItemArr,map_system_fields}), dispatch, sourceToIdentify, taxation_method);
        // console.log('input_options5555',input_options);
        // console.log('sourceToIdentify66666',sourceToIdentify);
        // console.log('sourceToIdentify7777',salary_fields);
        dispatch(change('historyImportSingle', 'salary_fields', salary_fields))
        dispatch(change('historyImportMultiple', 'salary_fields', salary_fields))
        dispatch(change('historyImportSingle', 'input_options', JSON.parse(JSON.stringify(input_options))));
        dispatch(change('historyImportMultiple', 'input_options', JSON.parse(JSON.stringify(input_options))));
        dispatch(change('historyImportSingle', 'input_columns',input_columns));
        dispatch(change('historyImportMultiple', 'input_columns', input_columns));

    }else if(sourceToIdentify == 'smart_tax'){ //智能办税
      dispatch(change('salaryFirstAdjustModal_form', 'input_options', JSON.parse(JSON.stringify(input_options))));
      salary_fields = fuzzyMatchAct(Object.assign({},data,{mapItemArr,map_system_fields}), dispatch, sourceToIdentify, taxation_method);
      // console.log('salary_fieldssalary_fields', salary_fields)
      dispatch(change('salaryFirstAdjustModal_form', 'salary_fields', salary_fields))
    }else if(sourceToIdentify == 'simulation-tax'){
      // console.log('11111111111111111111111111111111111' ,  JSON.parse(JSON.stringify(input_options))  )
      dispatch(change('SimulationTaxCompute', 'input_options', JSON.parse(JSON.stringify(input_options))));
      salary_fields = fuzzyMatchAct(Object.assign({},data,{mapItemArr,map_system_fields}), dispatch, sourceToIdentify, taxation_method);
      // console.log('SimulationTaxCompute', salary_fields)
      dispatch(change('SimulationTaxCompute', 'salary_fields', salary_fields))
    }else{
        salary_fields = fuzzyMatchAct(Object.assign({},data,{mapItemArr,map_system_fields} , {entryType}), dispatch, sourceToIdentify, taxation_method);
        console.warn(salary_fields)
        entryType == 'copy' ? '' : dispatch(change('step_one', 'salary_fields', salary_fields))
        dispatch(change('step_one', 'uploadExcelDone', true))// 新建薪酬方案时候,控制点击按钮
    }

  /******************************** 下拉选项的数据的处理*******************/
    input_columns.map((col, i) => {
        if (col.title)
        col.name = col.title;
        if (col.dataIndex)
        col.data_index = col.dataIndex;
        columnOrder[col.name] = i;
    });
    data['columnOrder'] = columnOrder;
    dispatch({
        type: types.CUSTOM_TEM,
        customTem: Object.assign({},data,{map_system_fields}),
        errorMessage: true
    });
    if (isUpload.isUpload) {
        notification.open({
        duration: 1.5,
        message: '信息',
        description: '上传成功,继续映射系统字段',
        icon: <NotificationIcon type='info' />,
        });
    }

    let anchorElement = document.getElementById('mapping_field');
    if (anchorElement) { anchorElement.scrollIntoView(); }
}
/*上传工资条excel*/
export function updatePayTaskTemAction(values){
  return dispatch => {
    dispatch({ type: 'MASK_SHOW', maskShow: true });
    return updatePayTaskTem(values).then(data => {
      dispatch({ type: 'MASK_SHOW', maskShow: false });
      const { sourceToIdentify='' } =values;
      if(data.code&&data.code>=300){
        dispatch({
          type        : types.PAYSAlARY_TEM,
          errorMessage: false
        });
        notification.open({
          // duration   : null,
          message    : '错误',
          description: '上传失败,'+data.message,
          icon       : <NotificationIcon type='error'/>,
        });
      }else{
        const {input_columns=[], system_fields=[]} = data;
        let input_options=[],//映射字段下拉选项
        salary_slip_fields=[];// 工资条可见字段
        // 下拉选项的数据的处理
         /******************************** 下拉选项的数据的处理*******************/
         let  mapItemArr = [
            'name',
            'credential_type',
            'credential_number',
            'mobile',
            'salary',
            'pay_salary',
            'bank',
            'bank_card_no',
            'first_tax',
    
    ];;
      let map_system_fields =[
        {"column":"姓名","key":"name","is_required":"required","order":0},{"column":"证件号码","key":"credential_number","is_required":"required","order":1},{"column":"手机号码","key":"mobile","is_required":"required","order":2},{"column":"实发工资","key":"salary","is_required":"required","order":3},{"column":"个税","key":"first_tax","is_required":"required","order":4},{"column":"证照类型","key":"credential_type","is_required":"required","order":5},{"column":"应发工资","key":"pay_salary","is_required":"required","order":6},{"column":"开户行","key":"bank","is_required":"required","order":7},{"column":"银行卡号","key":"bank_card_no","is_required":"required","order":8}
    ]
    mapItemArr.map(item=>{
        dispatch(change("step_one" ,item , '' ))
        dispatch(change("salaryFirstAdjustModal_form" ,item , '' ))
      })
         input_columns.map((col,i)=>{
            let input_columns_obj={}, flagIsMapped=false;

            let salary_slip_obj=Object.assign({},col,{
              label:col.title,
              value:col.key,
              "original_column": col.title,
              "name"           : col.title,
              "key"            : col.key,
              "is_slip"        : true,
              "is_required"    : col.is_required});
              
             
                mapItemArr.map((keyItem, indexArr)=>{ // 拼接带有disabled属性的下拉选项结构
                    map_system_fields.map((sysKeyItem, indexArr)=>{
                            if(keyItem==col['key']&&sysKeyItem['key']==col['key']){
                                flagIsMapped=true;
                            }
                        

                        })// 拼接带有disabled属性的下拉选项结构
                
                });

                // mapItemArr.map((keyItem, indexArr)=>{ // 拼接带有disabled属性的下拉选项结构
                //     if(keyItem==col['key']){
                //             flagIsMapped=true;
                //     }// 拼接带有disabled属性的下拉选项结构
                // });

            if(flagIsMapped){
              input_options.push(Object.assign({},{...col, name:col['title'], id:col['key'], isDisabled:true}));
          }else{
              input_options.push(Object.assign({},{...col, name:col['title'], id:col['key'], isDisabled:false}));
          }
          salary_slip_fields.push(salary_slip_obj);
          });
   
        const salary_slip_val=[];
        if(salary_slip_fields&&salary_slip_fields.length>0){
			salary_slip_fields.map((field,i)=>{
				salary_slip_val.push(field.key);
			});
        }
        dispatch(change('step_one', 'salary_slip_fields', salary_slip_fields))
        dispatch(change('step_one', 'input_options', JSON.parse(JSON.stringify(input_options))));
        let salary_fields=[];
        salary_fields=fuzzyMatchAct(Object.assign({},data,{mapItemArr,map_system_fields}),dispatch,sourceToIdentify,'');
        // console.log('source',salary_fields);
        dispatch(change('step_one', 'salary_fields', salary_fields))
        dispatch(change('step_one', 'salary_slip_fields_val', salary_slip_val))
        dispatch(change('step_one', 'salary_slip_fields_control',['y']));

        dispatch({
          type        : types.PAYSAlARY_TEM,
          paySalaryTem   : data,
          errorMessage: true
        });
        notification.open({
          // duration   : null,
          message    : '信息',
          description: '上传成功,继续映射系统字段',
          icon       : <NotificationIcon type='info'/>,
        });

      return data;
      }
    }).catch(err => {throw err});
  }
}
//获取发放批次列表
export function getSalaryCyclesAction(values) {
  return dispatch => {
    return getSalaryCycles(values).then(data => {
      dispatch({
        type: types.GET_SALARY_CYLES,
        salaryCyles: data
      });
      const { total_count } = data;
      dispatch(change('search_list_batch_grant', 'total_count', total_count));
    }).catch(err => { throw err });
  }
}
//获取工资条列表
export function getSalaryBillListAction(values) {
  return dispatch => {
    return getSalaryBillList(values).then(data => {
      if (data.code && data.code >= 300) {
        message.error(data.message);
      }else{
        dispatch({
          type: types.GET_SALARY_BILL,
          salaryBill: data
        });
        const { total_count } = data;
        dispatch(change('search_salary_bill_list', 'total_count', total_count));
      }
      
    }).catch(err => { throw err });
  }
}
//清空发放批次列表
export function cleanSalaryCyclesAction(values) {
  return {
    type: types.GET_SALARY_CYLES,
    salaryCyles: {}
  }
}
//清空工资条列表
export function cleanSalaryBillListAction(values) {
  return {
    type: types.GET_SALARY_BILL,
    salaryBill: {}
  }
}

//新建发放任务
export function buildSendBatch(values) {
  return dispatch => {
    dispatch({ type: 'MASK_SHOW', maskShow: true });
    return getSendBatch(values).then(data => {
      dispatch({ type: 'MASK_SHOW', maskShow: false });
      if (data.code && data.code >= 300) {
        // if (data.code = 403) {
        //   notification.open({
        //     // duration   : null,
        //     message: '失败',
        //     description: data.message,
        //     icon: <NotificationIcon type='error' />,
        //   });
        // } else {
        //   notification.open({
        //     // duration   : null,
        //     message: '失败',
        //     description: '发布任务失败',
        //     icon: <NotificationIcon type='error' />,
        //   });
        // }

        notification.open({
            // duration   : null,
            message: '操作失败',
            description: data.message,
            icon: <NotificationIcon type='error' />,
        });
        
        
        return true;
      } else { 
            const {status=''} =data;
            let alertTipText='';
            
        if(status&&status=='calculating'){
            alertTipText=`该发放批次中有员工还在其它计算中的批次中,请先完成其它批次的确认工作再继续发放`;
            notification.open({
                // duration   : null,
                message: '发放异常',
                description: alertTipText,
                icon: <NotificationIcon type='error' />,
              });
        }else if(status&&status=='active'){
            alertTipText=`该发放批次中有员工还在其它未确认的批次中,请先完成其它批次的确认工作再继续发放`;
            notification.open({
                // duration   : null,
                message: '发放异常',
                description: alertTipText,
                icon: <NotificationIcon type='error' />,
              });
            
        }else{
            let { sourceIsFirstAdjust=false} = values;
            //正在努力上传并核算,请到发放批次或异常批次中查看详情
            if(values.direct_release=='n'){
               
        
                if(sourceIsFirstAdjust){
                    notification.open({
                        duration   : 4,
                        message: '成功',
                        description: '首次校准的工资信息已生成,请在首次校准列表中查看发放进度',
                        icon: <NotificationIcon type='success' />,
                      });
                }else{
                    notification.open({
                        // duration   : null,
                        message: '成功',
                        description: '正在努力上传并核算,请到发放批次或异常批次中查看详情',
                        icon: <NotificationIcon type='success' />,
                      });
                }
              }else{

                if(sourceIsFirstAdjust){
                    notification.open({
                        duration   : 4,
                        message: '成功',
                        description: '首次校准的工资信息已生成,当员工的自然人信息申报成功后即可启动计算,请到薪酬发放批次中查看计算结果。',
                        icon: <NotificationIcon type='success' />,
                      });
                }else{
                    notification.open({
                        // duration   : null,
                        message: '成功',
                        description: '正在努力上传并核算,请到发放批次或异常批次中查看详情',
                        icon: <NotificationIcon type='success' />,
                      });
                }
               
              }
        }
       
       
        dispatch({
          type: types.SEND_BATCH,
          buildBatch: data
        });
        let { sourceIsFirstAdjust=false}=values;
        if( sourceIsFirstAdjust ){
            dispatch(getSalaryIndexStaticsAction('source=first'));
        }else{
            dispatch(getSalaryIndexStaticsAction());
        }
        dispatch(submit('search_list_batch_grant'))
       
        return false;
      }
    });
  }
}

//待审核批次确认
export function confirmSalaryCyclesAction(values) {
  return dispatch => {
    dispatch({ type: 'MASK_SHOW', maskShow: true });
    return confirmSalaryProcess(values).then(data => {
      dispatch({ type: 'MASK_SHOW', maskShow: false });
        const {btnComeFrom='',sourceFrom=''} =values;
      if (data.code && data.code >= 300) {
        // message.error('操作失败');
        if(data.message){
            // message.error(data.message);
            notification.open({
                // duration   : null,
                message: '操作失败',
                description: data.message,
                icon: <NotificationIcon type='error' />,
              });
        }else{
            notification.open({
                // duration   : null,
                message: '操作失败',
                description: '批次确认失败',
                icon: <NotificationIcon type='error' />,
              });
            // notification.open({
            //     // duration   : null,
            //     message: '操作失败',
            //     description: '批次确认失败',
            //     icon: <NotificationIcon type='error' />,
            //   });
        }
      } else {
        
        // message.success('确认完成,等候财务发放工资');
        // notification.open({
        //     // duration   : null,
        //     message: '操作成功',
        //     description: '确认完成,等候财务发放工资',
        //     icon: <NotificationIcon type='error' />,
        //   });
        dispatch(submit('search_list_batch_grant'));
        let { sourceIsFirstAdjust=false}=values ,strTip = '';
        if( sourceIsFirstAdjust ){
            strTip = '操作成功'
            dispatch(getSalaryIndexStaticsAction('source=first'));
        }else{
            dispatch(getSalaryIndexStaticsAction());
            strTip = '确认完成'
            if(sourceFrom=='firstAdjust'){
                strTip = '操作成功'
            }
        }
        notification.open({
            // duration   : null,
            message: '操作成功',
            description: strTip,
            icon: <NotificationIcon type='success' />,
          });
        if(btnComeFrom=='detail'){ // 详情中的确认批次按钮
            if(sourceFrom!='firstAdjust'){  //  首次校准
                document.location.href='#/container/salary/salary_send_batch_list?sourceType=active'
            }else if(sourceFrom == 'firstAdjust'){   //  正常批次
                document.location.href=`#/container/salary/salary_first_adjust_batch_list?sourceType=active`
                
            }
           
        }
    

      }
      return data
    }).catch(err => { 
      dispatch({ type: 'MASK_SHOW', maskShow: false });
      throw err
     });
  }
}

//批次删除
export function deleteSalaryCyclesAction(values) {
  return dispatch => {
    dispatch({ type: 'MASK_SHOW', maskShow: true });
    return deleteSalaryCycles(values).then(data => {
      dispatch({ type: 'MASK_SHOW', maskShow: false });
      let throwErr = values.throwErr ? values.throwErr : false
      if (data.code && data.code >= 300) {
        if (!throwErr) {
          if (data.message) {
            message.error(data.message);
          } else {
            message.error('删除失败');
          }
        }
      } else {
        if (!throwErr) {
          message.success('删除成功');
          dispatch(submit('search_list_batch_grant'));
          let { sourceIsFirstAdjust = false } = values;
          if (sourceIsFirstAdjust) {
            dispatch(getSalaryIndexStaticsAction('source=first'));
          } else {
            dispatch(getSalaryIndexStaticsAction());// 统计数据
          }
          dispatch(change('active_salary', 'showModal', false));
        }
      }
      return data
    }).catch(err => { 
      dispatch({ type: 'MASK_SHOW', maskShow: false });
      throw err 
    });
  }
}
//批次异常处理
export function dealAbnormalCyClesAction(values) {
  return dispatch => {
    return dealAbnormalCyCles(values).then(data => {
      if (data.code && data.code >= 300) {
          console.log(data,'data222222');
            if(data.message){
                message.error(data.message);
                // notification.open({
                //     // duration   : null,
                //     message: '操作失败',
                //     description: data.message,
                //     icon: <NotificationIcon type='error' />,
                //   });
            }else{  
                message.error('异常处理失败');
                // notification.open({
                //     // duration   : null,
                //     message: '操作失败',
                //     description: '异常处理失败',
                //     icon: <NotificationIcon type='error' />,
                //   });
            }
            // dispatch(change('active_salary','showModal',false)); 
      } else {
        message.success('操作成功');
        // notification.open({
        //     // duration   : null,
        //     message: '操作成功',
        //     description: '批次异常处理成功',
        //     icon: <NotificationIcon type='error' />,
        //   });
        dispatch(submit('search_list_batch_grant'));
        dispatch(change('active_salary','showModal',false)); 
      }
    }).catch(err => { throw err });
  }
}
//获取单雇员的工资条详情
export function getUserBillDetailAction(values) {
  return dispatch => {
    return getUserBillDetail(values).then(data => {
      if (data.code && data.code >= 300) {
        message.error(data.message?data.message:'请求数据详情出错');
      } else {
        
        dispatch({
          type: types.USER_SALARY_BILL_DET,
          userSalaryBillDet: data
        })
        return data;
      }
    }).catch(err => { throw err });
  }
}
//工资条重发撤回操作
export function repeatSendBillAction(values) {
  return dispatch => {
    return repeatSendBill(values).then(data => {
      if (data.code && data.code >= 300) {
        message.error(data.message?data.message:'请求数据详情出错');
      } else {
        const {status=''}= values;
        dispatch(submit('search_list_salary_user_bill'))
        if(status=='repate'){
        
          dispatch(change('person_salary','showRepeat',false));
          message.success('工资条重发成功');
        }else  if(status=='cancel'){
          message.success('工资条撤回成功');
  
        }
        // dispatch({
        //   type: types.USER_SALARY_BILL_DET,
        //   userSalaryBillDet: data
        // })
      }
    }).catch(err => { throw err });
  }
}

//工资表明细列表
export function getSalaryCyclesRecordAction(values) {
  return dispatch => {
    return getSalaryCyclesRecord(values).then(data => {
      const temp = [];
      if(data.code&&data.code > 300 &&data.code !=403){

      }else if(data.code &&data.code ==403){
        dispatch({
          type: types.CYLES_RECORD,
          cylesRecord: {
            dataSource:[],
            columns:[],
            total_count:null,
            isPermission:'no'
          }
        });
      }else{
        const { items = [], titles = '', total_count = 0 } = data;
        const columns = JSON.parse(titles ? titles : '[]');
        
        items.map((item, i) => {
          const detail = JSON.parse(item.detail ? item.detail : '{}');
       
          for(var key in detail){
              detail[`${key}_types`] = detail[key]
          }
  
          temp.push({
            ...detail,
            ...item,
          })
        });
        let columns_value = [];
  
        columns.map((data, i) => {
          if(data.key=='name'||data.key=='credential_type'||data.key=='credential_number'||data.key=='mobile'||data.key=='pay_salary'){
          }else{
              data.width = 200;
              data.title = data.title?data.title:data.name;
              // if(data.data_index){
              //     data.dataIndex=data.data_index+'_types';
              //     columns_value.push(Object.assign({},data,))
              // }
  
              if(data.key){
                  data.dataIndex=data.key+'_types';
                  data.key=data.key+'_types';
                  columns_value.push(Object.assign({},data,))
              }
              
          }
          
        });
        dispatch({
          type: types.CYLES_RECORD,
          cylesRecord: {
            dataSource: temp,
            total_count,
            columns:columns_value,
            isPermission:'yes'
          }
        });
        dispatch(change('pedding_salary_peo_list', 'total_count', total_count))
        dispatch(change('search_batch_list_detail', 'total_count', total_count))
        dispatch(change('modal', 'total_count', total_count))
      }
     
      // return temp;
      return {...data ,temp:temp };
    }).catch(err => { throw err });
  }
}

//个人发放明细列表
export function getPersonSalaryRecordAction(values) {
  return dispatch => {
    return getPersonSalaryRecord(values).then(data => {
        if (data.code && data.code >= 300) {
            notification.open({
                message: '错误',
                description: '数据获取失败,' + data.message,
                icon: <NotificationIcon type='error' />,
            });
        } else {
            dispatch({
                type: types.PERSON_RECORD,
                personRecord: data
              });
              const { total_count } = data;
              dispatch(change('search_list_person_send', 'total_count', total_count));
              return data;
        }
      
    }).catch(err => { throw err });
  }
}

//个税申报列表
export function getPayrollTaxListAction(values) {
  return dispatch => {
    return getPayrollTaxList(values).then(data => {
      dispatch({
        type: types.PAYROLL_TAX_LIST,
        payrollTaxList: data
      });
      const { total_count } = data;
      dispatch(change('search_list_batch_grant', 'total_count', total_count))
    }).catch(err => { throw err });
  }
}


//个税申报列表详情
export function getPayrollTaxDetailAction(values) {
  return dispatch => {
    return getPayrollTaxDetail(values).then(data => {
      const { items = [], titles = '', total_count = 0 } = data;
      const columns = JSON.parse(titles ? titles : '[]');
      const temp = [];
      items.map((item, i) => {
        const detail = JSON.parse(item.detail ? item.detail : '{}');
        temp.push({
          ...item,
          ...detail
        })
      });
      columns.map(data => {
        data.width = 200;
      });
      dispatch({
        type: types.PAYROLL_TAX_DETAIL,
        payrollTaxDetail: {
          dataSource: temp,
          total_count,
          columns
        }
      });
      return data
    }).catch(err => { throw err });
  }
}

//待发放个税申报列表详情
export function getPendingPayrollTaxDetailAction(values) {
  return dispatch => {
    return getPendingPayrollTaxDetail(values).then(data => {
      const { items = [], titles = '', total_count = 0 } = data;
      const columns = JSON.parse(titles ? titles : '[]');
      const temp = [];
      items.map((item, i) => {
        const detail = JSON.parse(item.detail ? item.detail : '{}');
        temp.push({
          ...item,
          ...detail
        })
      });
      columns.map(data => {
        data.width = 200;
      });
      dispatch({
        type: types.PENDING_PAYROLL_TAX_DETAIL,
        pendingPayrollTaxDetail: {
          dataSource: temp,
          total_count,
          columns
        }
      });
    }).catch(err => { throw err });
  }
}

//个税申报人员信息
export function getPayrollPersonDetailAction(values) {
  return dispatch => {
    return getPayrollPersonDetail(values).then(data => {
      dispatch({
        type: types.PAYROLL_PERSON_DETAIL,
        payrollPersonDetail: data
      });
    }).catch(err => { throw err });
  }
}
//发放批次中  获取计算异常详情列表
export function loadErrorInCaculateAction(values) {
  return dispatch => {
    return loadErrorInCaculate(values).then(data => {
      dispatch({
        type: types.ERROR_IN_CACULATE_LIST,
        errorInCaculateList: data
      });
    }).catch(err => { throw err });
  }
}
//发放批次中  清空计算异常详情列表
export function clearErrorInCaculateAction(values) {
  return dispatch => {
      dispatch({
        type: types.ERROR_IN_CACULATE_LIST,
        errorInCaculateList: {}
      });
   
  }
}

//个税申报明细列表
export function getPayrollPersonRecordsAction(values) {
  return dispatch => {
    return getPayrollPersonRecords(values).then(data => {
      dispatch({
        type: types.PAYROLL_PERSON_RECORD,
        payrollPersonRecord: data
      });
      const { total_count } = data;
      dispatch(change('search_list_payroll_tax', 'total_count', total_count))
    }).catch(err => { throw err });
  }
}

//获取发放详情
export function getSalaryCyclesDetAction(values) {
  return dispatch => {
    return getSalaryCyclesDet(values).then(data => {
      if(data.code&&data.code > 300 &&data.code!=403){

      }else if(data.code&&data.code==403){
        dispatch({
          type: types.SALARY_CYLES_DET,
          salaryCylesDet: {...data , isPermission:'no'}
        });
      }else{
        dispatch({
          type: types.SALARY_CYLES_DET,
          salaryCylesDet: {...data , isPermission:'yes'}
        });
        if(data&&data.customer_id&&data.tenant_id){
          dispatch(loadCustomerLegalEntities(data.customer_id));//客户法务实体
          dispatch(getLegalList({'tenant_id':data.tenant_id}));//机构法务实体
        }
      }
      
      return data
    }).catch(err => { throw err });
  }
}

//获取个税详情
export function getPayrollTaxStaticDetAction(values) {
  return dispatch => {
    return getPayrollTaxStaticDet(values).then(data => {
      dispatch({
        type: types.PAYROLL_TAX_STATIC_DET,
        payrollTaxStaticDet: data
      });
      return data
    }).catch(err => { throw err });
  }
}

//工资条明细列表
export function getSalarySilpRecordAction(values) {
  return dispatch => {
    return getSalarySilpRecord(values).then(data => {
      if(data.code&&data.code> 300&&data.code!=403){

      }else if(data.code&&data.code==403){
        dispatch({
          type: types.SLIP_RECORD,
          slipRecord: {
            dataSource: [],
          total_count:null,
          columns:[],
            isPermission:'no'
          }
        });
      }else{
        const { items = [], titles = '', total_count = 0 } = data;
        const columns = JSON.parse(titles ? titles : '[]');
        const temp = [];
        items.map((item, i) => {
          const detail = JSON.parse(item.detail ? item.detail : '{}');
          temp.push({
            ...item,
            ...detail
          })
        });
        columns.map(data => {
          data.width = 200;
        });
        dispatch({
          type: types.SLIP_RECORD,
          slipRecord: {
            dataSource: temp,
            total_count,
            columns,
            isPermission:'yes'
          }
        });
        dispatch(change('search_batch_list_detail', 'total_count', total_count))
      }
    }).catch(err => { throw err });
  }
}

//重新发放薪资
export function resendSalaryCyclesAction(values) {
  return dispatch => {
    return resendSalaryCycles(values).then(data => {
      if (data.code && data.code >= 300) {
        message.error('修改失败');
      } else {
        message.success('修改成功');
        dispatch(submit('search_list_batch_grant'));
      }
      return data
    }).catch(err => { throw err });
  }
}

//导出工资表
export function exportSalaryCyclesAction(values) {
  return dispatch => {
    return exportSalaryCycles(values).then(data => {
      if (data.code && data.code >= 300&&data.code !=403) {
        notification.open({
          message: '错误',
          description: data.message,
          icon: <NotificationIcon type='error' />,
        })
       
      }else if(data.code && data.code == 403){
        notification.open({
          message: '错误',
          description: '您没有下载权限,请联系管理员',
          icon: <NotificationIcon type='error' />,
        })
      } else {
        message.success('导出成功');
        if (data && data.download_path) {
          const url = getOssFilePath(data.download_path);
          console.log(url,'url');
        //   window.open(url);
          location.href=url;
        }
      }
      return data
    }).catch(err => { throw err });
  }
}

//导入发放结果
export function importSalaryCyclesAction(params) {
  return dispatch => {
    return importSalaryCycles(params)
      .then(data => {
        if (data.code && data.code >= 300) {
          dispatch({
            type: types.IMPORT_SALARY_CYLES,
            salary_is_import: false
          });
        } else {
          if (data.errors && data.errors != '[]') {
            dispatch({
              type: types.IMPORT_SALARY_CYLES,
              salary_is_import: false
            });
          } else {
            dispatch({
              type: types.IMPORT_SALARY_CYLES,
              salary_is_import: true
            });
          }
        }
      })
      .catch(err => { throw err; });
  };
}

export function cleanSalaryImport() {//清空salary_is_import,errorSalaryMeg
  return {
    type: types.IMPORT_SALARY_CYLES,
    salary_is_import: 'init',
    errorSalaryMeg: ''
  }
}

//导出个税申报表
export function exportPayrollTaxCyclesAction(values) {
  return dispatch => {
    return exportPayrollTaxCycles(values).then(data => {
      if (data.code && data.code >= 300) {
        notification.open({
          message: '错误',
          description: '导出失败,' + data.message,
          icon: <NotificationIcon type='error' />,
        });
      } else {
        notification.open({
          message: '成功',
          description: '导出成功',
          icon: <NotificationIcon type='success' />,
        });
        if (data.personal_info_path) {
          // const personal_info_path = getOssFilePath(data.personal_info_path);
          window.open(getOssFilePath(data.personal_info_path));
        }
        if (data.salary_path) {
          // const salary_path = getOssFilePath(data.salary_path);
          window.open(getOssFilePath(data.salary_path));
        }
        if (data.service_fee_path) {
          // const service_fee_path = getOssFilePath(data.service_fee_path);
          window.open(getOssFilePath(data.service_fee_path));
        }
        if (data.yearend_bonus_path) {
          // const yearend_bonus_path = getOssFilePath(data.yearend_bonus_path);
          window.open(getOssFilePath(data.yearend_bonus_path));
        }
      }
    }).catch(err => { throw err });
  }
}

//导入个税申报结果
export function importPayrollTaxCyclesAction(params) {
  return dispatch => {
    return importPayrollTaxCycles(params)
      .then(data => {
        if (data.code && data.code >= 300) {
          dispatch({
            type: types.IMPORT_TAX_CYLES,
            tax_is_import: false
          });
        } else {
          if (data.errors && data.errors != '[]') {
            dispatch({
              type: types.IMPORT_TAX_CYLES,
              tax_is_import: false
            });
          } else {
            dispatch({
              type: types.IMPORT_TAX_CYLES,
              tax_is_import: true
            });
          }
        }
      })
      .catch(err => { throw err; });
  };
}

export function cleanPayrollTaxImport() {//清空salary_is_import,errorSalaryMeg
  return {
    type: types.IMPORT_TAX_CYLES,
    tax_is_import: 'init',
    errorTaxMeg: ''
  }
}

//异常数据列表
export function getAbnormalListAction(values) {
  return dispatch => {
    return getAbnormalList(values).then(data => {
      dispatch({
        type: types.ABNORMSL_LIST,
        abnormalList: data
      });
      const {total_count} =data;
      dispatch(change('abnormal_reason_list_search', "total_count", total_count));
     
    }).catch(err => { throw err });
  }
}

//个税申报批次统计(首页)
export function getTaxIndexStaticsAction(values) {
  return dispatch => {
    return getTaxIndexStatics(values).then(data => {
      dispatch({
        type: types.TAX_INDEX_STATICS,
        taxIndexStatic: data
      });
    }).catch(err => { throw err });
  }
}

//获得薪酬批次统计(首页)
export function getSalaryIndexStaticsAction(values) {
  return dispatch => {
    return getSalaryIndexStatics(values).then(data => {
      dispatch({
        type: types.SALARY_INDEX_STATICS,
        salaryIndexStatic: data
      });
    }).catch(err => { throw err });
  }
}
//清空薪酬批次统计(首页)
export function clearSalaryIndexStaticsAction(values) {
  return dispatch => {
    return {
        type: types.SALARY_INDEX_STATICS,
        salaryIndexStatic: {}
      }
  }
}

//查看个税申报明细详情
export function getPersonTaxRecordDetailAction(values) {
  return dispatch => {
    return getPersonTaxRecordDetail(values).then(data => {
      let { items = [] } = data, dataDetail = {}, newItems = [];
      newItems = items.map(data => {
        if (data.detail) {
          dataDetail = JSON.parse(data.detail)
        }
        data = { ...data, ...dataDetail }
        return data
      });
      dispatch({
        type: types.TAX_RECORD_DETAIL,
        taxRecordDetail: { ...data, newItems }
      });
    }).catch(err => { throw err });
  }
}

//查看个人发放明细详情
export function getPersonSalaryRecordDetailAction(values) {
  return dispatch => {
    return getPersonSalaryRecordDetail(values).then(data => {
        if (data.code && data.code >= 300) {
            if(data.message){
                message.error(data.message)
            }else{
                message.error('请求详情出错')
            }
           
          } else {
                const { titles = '', item = {} } = data;
             
                const dataTitles = titles?JSON.parse(titles):'';
                const dataDetail = (item&&item.detail)?JSON.parse(item.detail ? item.detail : ''):'';
                // const dataTitles = JSON.parse(aaa);
                // const dataDetail = JSON.parse(str);
                dispatch({
                    type: types.SALARY_RECORD_DETAIL,
                    salaryRecordDetail: {
                    dataDetail: { ...data.item, ...dataDetail },
                    dataTitles
                    }
                });
          }
      
    }).catch(err => { throw err });
  }
}
//查看个人发放明细统计页面
export function getPersonSalaryCountRecordAction(values) {
  return dispatch => {
    return getPersonSalaryCountRecord(values).then(data => {
      const { titles = '', item = {} ,total_count} = data;
      dispatch({
        type: types.SALARY_RECORD_COUNT_BOTH,
        salaryRecordCountBoth: data
      });
      dispatch(change('search_list_person_send', "total_count", total_count));
      
      return data;
    }).catch(err => { throw err });
  }
}

//网商银行机构设置:创建
export function addMybankAction(values) {
  return dispatch => {
    return addMybank(values).then(data => {
      if (data.code && data.code >= 300) {
        message.error('设置失败');
      } else {
        message.success('设置成功');
      }
      dispatch(getMybankAction());
    }).catch(err => { throw err });
  }
}

//网商银行机构设置:获取
export function getMybankAction(values) {
  return dispatch => {
    return getMybank(values).then(data => {
      dispatch({
        type: types.SET_BANK_INFO,
        setBankInfo: data,
      });
    }).catch(err => { throw err });
  }
}

//直接发放
export function salaryPayrollAction(values) {
  return dispatch => {
    return salaryPayroll(values).then(data => {
      if (data.code && data.code >= 300) {
        // message.error('操作失败');
        notification.open({
          message: '错误',
          description: '' + data.message,
          icon: <NotificationIcon type='error' />,
        })
        return false;
      } else {
        message.success('操作成功');
        dispatch(submit('search_list_batch_grant'));
        return true;
      }
    }).catch(err => { throw err });
  }
}
//第三方发放支付
export function thirdPartyPayAction(values) {
  return dispatch => {
    return thirdPartyPay(values).then(data => {
      if (data.code && data.code >= 300) {
        message.error(data.message?data.message:'操作失败');
        return false;
      } else {
        message.success('操作成功');
        dispatch(submit('search_list_batch_grant'));
        return true;
      }
    }).catch(err => { throw err });
  }
}


//申报单位列表
export function getLegalEntitiesAction(values) {
  return dispatch => {
    return getLegalEntities(values).then(data => {
      dispatch({
        type: types.LEGAL_ENTITY_LIST,
        legalEntityList: data,
      });
    }).catch(err => { throw err });
  }
}

//财务薪酬 -- 个税列表去申报
export function goDeclareTaxAction(values) {
  return dispatch => {
    return goDeclareTax(values).then(data => {
      if (data.code >= 300) {
        if (data.code == 403) {
          notification.open({
            message: '失败',
            description: data.message + ',请到该客户的法务实体中完善信息',
            icon: <NotificationIcon type='error' />,
          });
        } else {
          notification.open({
            message: '失败',
            description: '操作失败',
            icon: <NotificationIcon type='error' />,
          });
        }
      } else {
        notification.open({
          message: '成功',
          description: '处理成功',
          icon: <NotificationIcon type='success' />,
        });
        dispatch(submit('search_list_batch_grant'));
      }
    }).catch(err => { throw err });
  }
}

//财务  ——积分管理——————————————————————————start
//财务管理 ——  积分列表
export function getIntegralAction(values) {
  return dispatch => {
    return getIntegral(values).then(data => {
      if (data.code >= 300) {
        message.error(data.message)
      } else {
        const { total_count, items } = data;
        dispatch(change("add_Integral", "total_count", total_count))
        dispatch({
          type: types.INTEGRAL_LIST,
          integral_list: items,
        });
      }
    }).catch(err => { throw err });
  }
}
//财务管理 ——  发放积分(批量发放积分)
export function postIntegralAction(values) {
  return dispatch => {
    return postIntegral(values).then(data => {
      if (data.code >= 300) {
        message.error(data.message)
      } else {
        message.success("发放成功!")
        dispatch(submit("add_Integral"))
      }
    }).catch(err => { throw err });
  }
}
//财务  ——积分管理——————————————————————————end
//财务  ——提现管理——————————————————————————start
//财务管理 ——  提现管理  列表
export function getDrawMoneyAction(values) {
  return dispatch => {
    return getDrawMoney(values).then(data => {
      if (data.code >= 300) {
        message.error(data.message)
      } else {
        const { total_count, items } = data;
        dispatch(change("add_DrawMoney", "total_count", total_count))
        dispatch({
          type: types.DRAWMONEY_LIST,
          drawMoney_list: items,
        });
      }
    }).catch(err => { throw err });
  }
}
//财务管理 ——  提现管理    发放(批量发放)
export function postDrawMoneyAction(values) {
  return dispatch => {
    return postDrawMoney(values).then(data => {
      if (data.code >= 300) {
        message.error(data.message)
      } else {
        dispatch(change("add_DrawMoney_from", "modallock", false))
        dispatch(submit("add_DrawMoney"))
        message.success("发放成功!")
      }
    }).catch(err => { throw err });
  }
}
//财务管理 ——  提现管理    导出
export function dowmDrawMoneyAction(values) {
  return dispatch => {
    return dowmDrawMoney(values).then(data => {
      if (data.code >= 300) {
        message.error(data.message)
      } else {
        const { object_path } = data;
        downloadFileByUrl(object_path)
      }
    }).catch(err => { throw err });
  }
}
//财务  ————提现管理——————————————————————————end
//考勤  ————考勤统计——————————————————————————start
//考勤 —— 考勤统计  列表
export function getAttendanceStatisticsAction(values) {
  return dispatch => {
    return getAttendanceStatistics(values).then(data => {
      if (data.code >= 300) {
        message.error(data.message)
      } else {
        const { items, total_count } = data;
        dispatch(change("add_AttendanceStatistics", "total_count", total_count))
        dispatch(change("add_AttendanceRecord", "total_count", total_count))
        dispatch({
          type: types.ATTENDANCESTATISTICS_LIST,
          attendanceStatistics_list: items,
        });
      }
    }).catch(err => { throw err });
  }
}

//修改个税缴纳地
export function activeSalayAction(values){
  return dispatch => {
    return declaringUnit(values).then(data => {
      if (data.code >= 300) {
        message.error(data.message)
      } else {
         message.success('修改个税缴纳的成功');
         return true;
      }
    }).catch(err => { throw err });
  }
}


//待提交专项附加扣除 忽略,直接计算
export function ignoreSpecialDecutionToCountAction(values){
  return dispatch => {
    return ignoreSpecialDecutionToCount(values).then(data => {
      if (data.code >= 300) {
          if(data.message){
            message.error(data.message)
          }else{
              message.error('请求数据失败');
          }
      } else {
        message.success('操作成功');
        dispatch(submit('search_list_batch_grant'));
        let { sourceIsFirstAdjust=false}=values;
        if( sourceIsFirstAdjust ){
            dispatch(getSalaryIndexStaticsAction('source=first'));
        }else{
            dispatch(getSalaryIndexStaticsAction());// 统计数据
        }
        dispatch(change('active_salary','showModal',false)); 
        
         return true;
      }
    }).catch(err => { throw err });
  }
}
//待提交专项附加扣除 提醒员工确认
export function remindSpecialDecutionAction(values){
  return dispatch => {
    return remindSpecialDecution(values).then(data => {
      if (data.code >= 300) {
          if(data.message){
            message.error(data.message)
          }else{
              message.error('请求数据失败');
          }
      } else {
        message.success('操作成功');
        dispatch(change('pending_salary','naturalManRemind',false));
        dispatch(change('pending_salary','specialDeuctionRemind',false));
         return true;
      }
    }).catch(err => { throw err });
  }
}
//待申报自然人 提醒财务专员确认
export function remindFinanceDecutionAction(values){
  return dispatch => {
    return remindFinanceDecution(values).then(data => {
      if (data.code >= 300) {
          if(data.message){
            message.error(data.message)
          }else{
              message.error('请求数据失败');
          }
      } else {
        message.success('操作成功');
        dispatch(change('pending_salary','naturalManRemind',false));
        dispatch(change('pending_salary','specialDeuctionRemind',false));
         return true;
      }
    }).catch(err => { throw err });
  }
}
//个人发放明细   首页的根据法务实体进行的搜索
export function getsendSimpleListAction(values){
  return dispatch => {
    return getsendSimpleList(values).then(data => {
      if (data.code >= 300) {
          if(data.message){
            message.error(data.message)
          }else{
              message.error('请求数据失败');
          }
          
      } else {

        const {total_count} =data;
          dispatch({
            type: types.SENDSIMPLE_LIST,
            send_simple_list: data,
          });
          dispatch(change("spec_add_mon_det_search_from", "total_count", total_count))
         return true;
      }
    }).catch(err => { throw err });
  }
}
//清空 首页的根据法务实体进行的搜索
export function clearSendSimpleListAction(values){
  return dispatch => {
    return dispatch({
        type: types.SENDSIMPLE_LIST,
        send_simple_list: {}
      })
  }
}
//个人发放明细   获取个人在某一个法务实体下的所有的发放批次  统计数据
export function getsendPersonalSendBatchListAction(values){
  return dispatch => {
    return getsendPersonalSendBatchList(values).then(data => {
      if (data.code >= 300) {
          if(data.message){
            message.error(data.message)
          }else{
              message.error('请求数据失败');
          }
      
      } else {
        const {total_count} =data;
        dispatch({
            type: types.SENDPERSONALSENDBATCH_LIST,
            sendPersonalSendBatch_list: data,
          });
          dispatch(change("spec_add_mon_det_search_from", "total_count", total_count))
         return data;
      }
    }).catch(err => { throw err });
  }
}
//获取工资批次中未申报自然人信息列表
export function getWaitSendNaturalListAction(values){
  return dispatch => {
    return getWaitSendNaturalList(values).then(data => {
      if (data.code >= 300) {
          if(data.message){
            message.error(data.message)
          }else{
              message.error('请求数据失败');
          }
      
      } else {
        dispatch({
            type: types.WAIT_SEND_NATURAL_SIMPLE_LIST,
            waitSendNaturalSimpleList: data,
          });
          dispatch(change('naturalMan' , 'total_count' , data.total_count ))
         return true;
      }
    }).catch(err => { throw err });
  }
}
//清空工资批次中未申报自然人信息列表
export function clearWaitSendNaturalListAction(values){
  return dispatch => {
    return dispatch({
            type: types.WAIT_SEND_NATURAL_SIMPLE_LIST,
            waitSendNaturalSimpleList: {},
          });

  }
}
//个人发放明细   获取工资批次中未提交附加项专项扣除人信息列表
export function getSpecialDeuctionListAction(values){
  return dispatch => {
    return getSpecialDeuctionList(values).then(data => {
      if (data.code >= 300) {
          if(data.message){
            message.error(data.message)
          }else{
              message.error('请求数据失败');
          }
      
      } else {
        dispatch({
            type: types.WAIT_SPECIAL_DEUCTION_SIMPLE_LIST,
            waitSpecialDeuctionSimpleList: data,
          });
          dispatch(change('naturalMan', 'total_count', data.total_count))
         return data;
      }
    }).catch(err => { throw err });
  }
}
//清空工资批次中未提交附加项专项扣除人信息列表
export function clearSpecialDeuctionListAction(values){
  return dispatch => {
    return dispatch({
            type: types.WAIT_SPECIAL_DEUCTION_SIMPLE_LIST,
            waitSpecialDeuctionSimpleList: {},
          });

  }
}
//社税机器人助手下载地址
export function getAssistanceDownloadUrlAction(values){
   
    return dispatch => {
        dispatch({ type: 'MASK_SHOW', maskShow:true});
        return getAssistanceDownloadUrl(values).then(data => {
        dispatch({ type: 'MASK_SHOW', maskShow:false});
        if (data.code >= 300) {
            if(data.message){
              message.error(data.message)
            }else{
                message.error('请求数据失败');
            }

        } else {
          dispatch({
              type: types.TAX_ASSISTANCE_URL,
              taxAssistanceUrl: data,
            });
  
           return data;
        }
      }).catch(err => {   dispatch({ type: 'MASK_SHOW', maskShow:false}) ;throw err });
    }
  }

  //检测薪酬方案是否重复
export function checkSalaryPlanRepeatOrNotAction(values){
    return dispatch => {
        return checkSalaryPlanRepeatOrNot(values).then(data => {
            const {code=''} =data;
        if (code > 300) {
            if (code == 409) {// 薪酬方案已存在
                message.error('薪酬方案名称冲突,请重新输入');
            }else{
                if(data.message){
                    message.error(data.message)
                  }else{
                      message.error('薪酬方案查重失败');
                  }
            }
            return true;
        }else {
            return false;
        }
      }).catch(err => {  throw err });
    }
  }
  //获取薪酬助手的薪酬方案模板(包括shett2)
export function downloadPlanSheet2Action(values){
    return dispatch => {
        return downloadPlanSheet2(values).then(data => {
            const {code=''} =data;
        if (code > 300) {
            if(data.message){
                    message.error(data.message)
                  }else{
                      message.error('薪酬方案查重失败');
                  }
             
        }else {
            return data;
        }
      }).catch(err => {  throw err });
    }
  }
//获取海峡人力的摘要配置列表
export function getHaiXiaAbstractListAction(values) {
    return dispatch => {
      return getHaiXiaAbstractList(values).then(data => {
          if (data.code && data.code >= 300) {
              if (data.message) {
                message.error(data.message);
              } else {
                message.error('请求数据有误');
              }
            } else {
              dispatch({
                  type: types.GET_HAIXIA_ABSTRACT_LIST,
                  haiXiaAbstractList: data
                });
              const { total_count } = data;
              dispatch(change('haiXiaConfigAbstract_form_search', 'total_count', total_count))
              return data;
            }
      
      }).catch(err => { throw err });
    }
  }
//清空海峡人力的摘要配置列表
export function clearHaiXiaAbstractListAction(values){
    return dispatch => {
      return dispatch({
              type: types.GET_HAIXIA_ABSTRACT_LIST,
              haiXiaAbstractList: {}
            });
  
    }
  }
  //添加海峡配置字段
export function addHaiXiaAbstractItemAction(values) {
    return dispatch => {
      return addHaiXiaAbstractItem(values).then(data => {
          if (data.code && data.code >= 300) {
              if (data.message) {
                message.error(data.message);
              } else {
                message.error('操作失败');
              }
              return false;
            } else {
                message.success('操作成功');
                dispatch(submit('haiXiaConfigAbstract_form_search'))
              return true;
            }
      
      }).catch(err => { throw err });
    }
  }
  //删除海峡配置字段
export function delHaiXiaAbstractItemAction(values) {
    return dispatch => {
      return delHaiXiaAbstractItem(values).then(data => {
          if (data.code && data.code >= 300) {
              if (data.message) {
                message.error(data.message);
              } else {
                message.error('操作失败');
              }
              return false;
            } else {
                message.success('操作成功');
                dispatch(submit('haiXiaConfigAbstract_form_search'))
              return true;
            }
      
      }).catch(err => { throw err });
    }
  }
  //编辑海峡配置字段
export function editHaiXiaAbstractItemAction(values) {
    return dispatch => {
      return editHaiXiaAbstractItem(values).then(data => {
          if (data.code && data.code >= 300) {
              if (data.message) {
                message.error(data.message);
              } else {
                message.error('操作失败');
              }
              return false;
            } else {
                message.success('操作成功');
                dispatch(submit('haiXiaConfigAbstract_form_search'))
              return true;
            }
      
      }).catch(err => { throw err });
    }
  }
  //获取海峡配置字段详情
export function getHaiXiaAbstractItemDetailAction(values) {
    return dispatch => {
      return getHaiXiaAbstractItemDetail(values).then(data => {
          if (data.code && data.code >= 300) {
              if (data.message) {
                message.error(data.message);
              } else {
                message.error('操作失败');
              }
              return false;
            } else {
                // message.success('操作成功');
              return data;
            }
      
      }).catch(err => { throw err });
    }
  }
  //自然人税收_税款缴纳——立即缴款
export function payTaxNowAction(values) {
    return dispatch => {
      return payTaxNow(values).then(data => {
        return data
      }).catch(err => { throw err });
    }
  }
  //自然人税收_税款缴纳列表
export function payTaxListAction(values) {
    return dispatch => {
      return payTaxList(values).then(data => {
        if(data.code &&data.code > 300){

        }else{
          const { total_count } = data
          dispatch({
            type: types.PAYTAXLIST,
            payTaxList: data
          });
          dispatch(change('NaturalPersonPayTax_search_from', 'total_count', total_count))
        }
        return data
      }).catch(err => { throw err });
    }
  }
  //自然人税收_税款缴纳列表(统计)
export function payTaxStatisticsAction(values) {
    return dispatch => {
      return payTaxStatistics(values).then(data => {
        if(data.code &&data.code > 300){

        }else{
          dispatch({
            type: types.PAYTAXSTATISTICS,
            payTaxStatistics: data
          });
        }
      }).catch(err => { throw err });
    }
  }
  //自然人税收_税款缴纳_详情
export function payTaxDetailAction(values) {
    return dispatch => {
      return payTaxDetail(values).then(data => {
        if(data.code &&data.code > 300){

        }else{
          dispatch({
            type: types.PAYTAXDETAIL,
            payTaxDetail: data.items,
          });
          dispatch(change("NaturalPersonPayTaxDetail_search_from", "total_count", data.total_count))
        }
      }).catch(err => { throw err });
    }
  }
  //自然人税收_税款缴纳_详情(统计)
export function payTaxDetailStatisticsAction(values) {
    return dispatch => {
      return payTaxDetailStatistics(values).then(data => {
        if(data.code &&data.code > 300){

        }else{
          dispatch({
            type: types.PAYTAXDETAILSTATISTICS,
            payTaxDetailStatistics: data,
          });
        }
      }).catch(err => { throw err });
    }
  }
  //获取合并计税列表
export function getConsolidatedListAction(values) {
    return dispatch => {
      return getConsolidatedList(values).then(data => {
        if(data.code &&data.code > 300){
          notification.open({
            message: '错误',
            description: data.message,
            icon: <NotificationIcon type='error' />,
          })
        }else{
          dispatch({
            type: types.CONSOLIDATEDDATA,
            consolidatedData: data,
          });
        }
      }).catch(err => { throw err });
    }
  }
 
  //清空合并计税列表
export function cleanConsolidatedListAction(values) {
    return dispatch => {
      return dispatch({
        type: types.CONSOLIDATEDDATA,
        consolidatedData: {},
      });
    }
  }
 //获取自动确认状态
 export function getSettingStateAction(values) {
     console.log(1111)
    return dispatch => {
      return getSettingState(values).then(data => {
        if(data.code &&data.code > 300){

        }else{
          dispatch({
            type: types.SALARY_SETTING_STATE,
            salarySettingState: data,
          });
        }
        return data
      }).catch(err => { throw err });
    }
}
 //获取自动确认状态
 export function makeSettingStateAction(values) {
    return dispatch => {
      return makeSettingState(values).then(data => {
        if(data.code &&data.code > 300){
            if (data.message) {
                message.error(data.message);
              } else {
                message.error('操作失败');
              }
        }else{
          message.success('操作成功');
        }
      }).catch(err => { throw err });
    }
}
//申报单位列表
export function LegalEntitiesAction(values) {
  return dispatch => {
    return getLegalEntities(values).then(data => {
      dispatch({
        type: types.LEGALENTITIESACTION,
        legalEntityListData: data,
      });
    }).catch(err => { throw err });
  }
}
 //获取自动确认状态
 export function exportNaturalInfoAction(values) {
    return dispatch => {
      return exportNaturalInfo(values).then(data => {
        if(data.code &&data.code > 300){
            if (data.message) {
                message.error(data.message);
              } else {
                message.error('操作失败');
              }
        }else{
            return data;
        }
      }).catch(err => { throw err });
    }
}
// 更新自然人报税基础信息
export function updateNatureHumanAction(values , type) {
    return dispatch => {
      dispatch({ type: 'MASK_SHOW', maskShow: true });
      return updateNatureHuman(values , type)
        .then(data => {
          dispatch({ type: 'MASK_SHOW', maskShow: false });
          if (data.code && data.code >= 300) {
            notification.open({
              message: '错误',
              description: '更新失败,' + data.message,
              icon: <NotificationIcon type='error' />,
            })
          } else {
            // dispatch(change('EmployeeTaxDeclarationDetail','current' , 1))
            // dispatch(change('NaturalImport','current' , 1))
          }
          return data
        }).catch(err => {
            dispatch({ type: 'MASK_SHOW', maskShow: false });
          throw err
        })
    }
  }
// 获取薪酬自然人导入记录
export function getSalaryImportListAction(values , type) {
    return dispatch => {
      return getSalaryImportList(values , type)
        .then(data => {
          if (data.code && data.code >= 300) {
            notification.open({
              message: '错误',
              description: '更新失败,' + data.message,
              icon: <NotificationIcon type='error' />,
            })
          } else {
            // dispatch(change('EmployeeTaxDeclarationDetail','current' , 1))
            // dispatch(change('NaturalImport','current' , 1))
           
            dispatch(change("EmployeeImportRecords_from" , 'total_count' , data.total_count))
            return data
          }
      
        }).catch(err => {
          throw err
        })
    }
  }
// 获取薪酬自然人导入详情
export function getSalaryImportDetailAction(values , type) {
    return dispatch => {
      return getSalaryImportDetail(values , type)
        .then(data => {
          if (data.code && data.code >= 300) {
            notification.open({
              message: '错误',
              description: '更新失败,' + data.message,
              icon: <NotificationIcon type='error' />,
            })
          } else {
              
              return data
          }
      
        }).catch(err => {
          throw err
        })
    }
  }
//    薪酬管理_发放批次_待发放      提交财务发放  操作
export function putIssueToFinanceAction(values , type) {
    return dispatch => {
      dispatch({ type: 'MASK_SHOW', maskShow: true });
      return putIssueToFinance(values , type)
        .then(data => {
          dispatch({ type: 'MASK_SHOW', maskShow: false });
          if (data.code && data.code >= 300) {
            notification.open({
              message: '错误',
              description: '' + data.message,
              icon: <NotificationIcon type='error' />,
            })
          } else {
            if(data.items&&data.items.length > 0){
              dispatch(change('pending_salary' , 'missing_information_tip_lock' , true ))
              dispatch(change('pending_salary' , 'items' , data.items ))
            } else {
              notification.open({
                message: '成功',
                description: '操作成功',
                icon: <NotificationIcon type='success' />,
              })
              dispatch(submit('search_list_batch_grant'))
            }
            
          }
      
        }).catch(err => {
          dispatch({ type: 'MASK_SHOW', maskShow: false });
          throw err
        })
    }
  }

  // 历史工资表导入 
export function creatHistoryBillAction(values , type) {
    return dispatch => {
      return creatHistoryBill(values , type)
        .then(data => {
          if (data.code && data.code >= 300) {
            notification.open({
              message: '错误',
              description: '' + data.message,
              icon: <NotificationIcon type='error' />,
            })
          } else {
            notification.open({
              message: '成功',
              description: '操作成功',
              icon: <NotificationIcon type='success' />,
            })
            return  data;
          }
      
        }).catch(err => {
          throw err
        })
    }
  }

// 历史税差-获取历史税差统计

export function getHistorySalaryStatisticsAction(values , type) {
    return dispatch => {
      return getHistorySalaryStatistics(values , type)
        .then(data => {
          if (data.code && data.code >= 300) {
            notification.open({
              message: '错误',
              description: '' + data.message,
              icon: <NotificationIcon type='error' />,
            })
          } else {
            dispatch({
                type: types.HISTORYSALARYSTATISTICS,
                historySalaryStatistics: data,
              });
            return  data;
          }
      
        }).catch(err => {
          throw err
        })
    }
}
// 历史税差-清空历史税差统计

export function clearHistorySalaryStatisticsAction(values , type) {
    return dispatch => {
        dispatch({
            type: types.HISTORYSALARYSTATISTICS,
            historySalaryStatistics: {},
          })  
    }
}
// 历史税差-查看历史税差列表
export function getHistorySalaryListAction(values , type) {
    return dispatch => {
      return getHistorySalaryList(values , type)
        .then(data => {
          if (data.code && data.code >= 300) {
            notification.open({
              message: '错误',
              description: '' + data.message,
              icon: <NotificationIcon type='error' />,
            })
          } else {
         
            return  data;
          }
      
        }).catch(err => {
          throw err
        })
    }
}
// 历史税差-查看历史税差批次简明详情
export function getHistorySalaryDetAction(values , type) {
    return dispatch => {
      return getHistorySalaryDet(values , type)
        .then(data => {
          if (data.code && data.code >= 300) {
            notification.open({
              message: '错误',
              description: '' + data.message,
              icon: <NotificationIcon type='error' />,
            })
          } else {
            dispatch({
                type: types.SALARY_CYLES_DET,
                salaryCylesDet: data
              });
            return  data;
          }
      
        }).catch(err => {
          throw err
        })
    }
}
// 历史税差-查看历史税差批次详情
export function getHistorySalaryRecordsAction(values , type) {
    return dispatch => {
      return getHistorySalaryRecords(values , type)
        .then(data => {
          if (data.code && data.code >= 300) {
            notification.open({
              message: '错误',
              description: '' + data.message,
              icon: <NotificationIcon type='error' />,
            })
          } else {
            const { items = [], titles = '', total_count = 0 } = data;
            const columns = JSON.parse(titles ? titles : '[]');
            const temp = [];
            items.map((item, i) => {
              const detail = JSON.parse(item.detail ? item.detail : '{}');
           
              for(var key in detail){
                  detail[`${key}_types`] = detail[key]
              }
      
              temp.push({
                ...detail,
                ...item,
              })
            });
            let columns_value = [];
      
            columns.map((data, i) => {
            //   if(data.key=='name'||data.key=='credential_type'||data.key=='credential_number'||data.key=='mobile'||data.key=='pay_salary'){
            //   }else{
              if(data.key=='salary'||data.key=='first_tax'||data.key=='tax_balance'){

              }else{
                  data.width = 200;
                  data.title = data.title?data.title:data.name;
                  // if(data.data_index){
                  //     data.dataIndex=data.data_index+'_types';
                  //     columns_value.push(Object.assign({},data,))
                  // }
      
                  if(data.key){
                      data.dataIndex=data.key+'_types';
                      data.key=data.key+'_types';
                      columns_value.push(Object.assign({},data,))
                  }
                  
              }
              
            });
            dispatch({
              type: types.CYLES_RECORD,
              cylesRecord: {
                dataSource: temp,
                total_count,
                columns:columns_value,
              }
            });
            dispatch(change('search_batch_list_detail', 'total_count', total_count))
            return temp;
          }
      
        }).catch(err => {
          throw err
        })
    }
}

  //历史税差-导入记录-清除
export function cleanHistorySalaryImportRecordsAction(values){
    return dispatch => {
        dispatch({
          type: types.GET_WALFARE_RECORDS_LIST,
          welfareRecordsList: {}
        });
      }
}
// 历史税差-导入记录
export function getHistorySalaryImportRecordsAction(values , type) {
    return dispatch => {
      return getHistorySalaryImportRecords(values , type)
        .then(data => {
          if (data.code && data.code >= 300) {
            notification.open({
              message: '错误',
              description: '' + data.message,
              icon: <NotificationIcon type='error' />,
            })
          } else {
            dispatch({
                type: types.GET_WALFARE_RECORDS_LIST,
                welfareRecordsList: data
              });
              const { total_count } = data;
              dispatch(change('history_salary_import_list_search', 'total_count', total_count))
            return  data;
          }
      
        }).catch(err => {
          throw err
        })
    }
}
// 历史税差-导入记录详情列表
export function getHistorySalaryImportRecordsDetAction(values , type) {
    return dispatch => {
      return getHistorySalaryImportRecordsDet(values , type)
        .then(data => {
          if (data.code && data.code >= 300) {
            notification.open({
              message: '错误',
              description: '' + data.message,
              icon: <NotificationIcon type='error' />,
            })
          } else {
            dispatch({
                type: types.GET_WALFARE_RECORDS_DETAIL,
                welfareRecordsDetail: data
              });
            return  data;
          }
      
        }).catch(err => {
          throw err
        })
    }

}
/*导出薪酬方案*/
export function downloadSchemeAction(values) {
    return dispatch => {
      return downloadScheme(values).then(data => {
          if (data.code && data.code >= 300) {
            notification.open({
              message: '错误',
              description: '操作失败,' + data.message,
              icon: <NotificationIcon type='error' />,
            })
          } else {
            downloadFileByUrl(data.file_path)
        }
    }).catch(err => {
      throw err
        })
    }
}
// 历史税差-计算税差
export function countHistorySalaryAction(values , type) {
    return dispatch => {
      return countHistorySalary(values , type)
      .then(data => {
        if (data.code && data.code >= 300) {
          notification.open({
            message: '错误',
            description: '' + data.message,
            icon: <NotificationIcon type='error' />,
          })
        } else {
            notification.open({
                message: '成功',
                description: '操作成功',
                icon: <NotificationIcon type='success' />,
            });
          return  data;
        }
      }).catch(err => {
        throw err
      })    
    }
}
// 历史税差-删除历史税差批次
export function delHistorySalaryListAction(values , type) {
    return dispatch => {
      return delHistorySalaryList(values , type)
        .then(data => {
          if (data.code && data.code >= 300) {
            notification.open({
              message: '错误',
              description: '' + data.message,
              icon: <NotificationIcon type='error' />,
            })
          } else {
            return  data;
          }
        }).catch(err => {
          throw err
        })
    }
}
// 历史税差-查看导入的饿
export function isOrNotTaxDeuctionAction(values , type) {
    return dispatch => {
      return isOrNotTaxDeuction(values , type)
        .then(data => {
          if (data.code && data.code >= 300) {
            notification.open({
              message: '错误',
              description: '' + data.message,
              icon: <NotificationIcon type='error' />,
            })
          } else {
            return  data;
          }
        }).catch(err => {
          throw err
        })
    }
}
// 历史税差-删除个人税差
export function delPersonalTaxDeuctionAction(values , type) {
    return dispatch => {
      return delPersonalTaxDeuction(values , type)
        .then(data => {
          if (data.code && data.code >= 300) {
            notification.open({
              message: '错误',
              description: '' + data.message,
              icon: <NotificationIcon type='error' />,
            })
          } else {
            notification.open({
                message: '成功',
                description: '操作成功',
                icon: <NotificationIcon type='success' />,
            });
            return  data;
          }
        }).catch(err => {
          throw err
        })
    }
}
// 历史税差-查看税差列表
export function getHistoryTaxBalanceListAction(values , type) {
    return dispatch => {
      return getHistoryTaxBalanceList(values , type)
        .then(data => {
          if (data.code && data.code >= 300) {
            notification.open({
              message: '错误',
              description: '' + data.message,
              icon: <NotificationIcon type='error' />,
            })
          } else {
            return  data;
          }
        }).catch(err => {
          throw err
        })
    }
}
// 历史税差-查看税差详情
export function getHistoryTaxBalanceDetailAction(values , type) {
    return dispatch => {
      return getHistoryTaxBalanceDetail(values , type)
        .then(data => {
          if (data.code && data.code >= 300) {
            notification.open({
              message: '错误',
              description: '' + data.message,
              icon: <NotificationIcon type='error' />,
            })
          } else {
            return  data;
          }
        }).catch(err => {
          throw err
        })
    }

}
  


//智能办税 上传工资表
export function smartTaxUpdateAction(values , type) {
    return dispatch => {
      dispatch({ type: 'MASK_SHOW', maskShow: true });
      return getCustomerTem(values , type)
        .then(data => {
          dispatch({ type: 'MASK_SHOW', maskShow: false });
          if (data.code && data.code >= 300) {
            notification.open({
              message: '错误',
              description: '' + data.message,
              icon: <NotificationIcon type='error' />,
            })
          } else {
            dispatch({
                type: types.SMARTTAXUPDATE,
                smartTaxUpdate: data,
              });
            return  data;
          }
        }).catch(err => {
          dispatch({ type: 'MASK_SHOW', maskShow: false });
          throw err
        })
    }
}
//历史税差-查看计算状态
export function getHistorySalaryCountStateAction(values , type) {
    return dispatch => {
      return getHistorySalaryCountState(values , type)
        .then(data => {
          if (data.code && data.code >= 300) {
            notification.open({
              message: '错误',
              description: '' + data.message,
              icon: <NotificationIcon type='error' />,
            })
          } else {
            return  data;

          }
        }).catch(err => {
          throw err
        })
    }

  }


//通知创建人
export function notifyFounderAction(values, type) {
  return dispatch => {
    return notifyFounder(values, type).then(data => {
      if (data.code && data.code >= 300) {
        notification.open({
          message: '错误',
          description: '' + data.message,
          icon: <NotificationIcon type='error' />,
        })
      } else {
        notification.open({
          message: '成功',
          description: '操作成功',
          icon: <NotificationIcon type='success' />,
        })
        return data;
      }

    }).catch(err => {
      throw err
    })
  }
}
//模拟算税
export function SimulationTaxlistAction(values) {
  return dispatch => {
    return SimulationTaxlist(values).then(data => {
      if (data.code && data.code >= 300) {
        notification.open({
          message: '错误',
          description: '' + data.message,
          icon: <NotificationIcon type='error' />,
        })
      } else {
        dispatch({
          type: types.SIMULATIONTAXLIST,
          SimulationTaxlist: data.items,
        })
        dispatch(change('search_SimulationTaxErrlist', 'total_count', data.total_count))
        dispatch(change('search_SimulationTax', 'total_count', data.total_count))
      }
      return data;
    }).catch(err => {
      throw err
    })
  }
}
//模拟算税判断
export function SimulationTaxJudgeAction(values) {
  return dispatch => {
    return SimulationTaxJudge(values).then(data => {
      if (data.code && data.code >= 300) {
        notification.open({
          message: '错误',
          description: '' + data.message,
          icon: <NotificationIcon type='error' />,
        })
      } else {
        return data.status;
      }

    }).catch(err => {
      throw err
    })
  }
}
//add模拟算税
export function addSimulationTaxAction(values) {
  return dispatch => {
    return addSimulationTax(values).then(data => {
      if (data.code && data.code >= 300) {
        notification.open({
          message: '错误',
          description: '' + data.message,
          icon: <NotificationIcon type='error' />,
        })
      } else {
        notification.open({
          message: '成功',
          description: '操作成功',
          icon: <NotificationIcon type='success' />,
        })
      }
      return data;
    }).catch(err => {
      throw err
    })
  }
}
//获取模拟算税批次详情
export function SimulationTaxDetailAction(values) {
  return dispatch => {
    return SimulationTaxDetail(values).then(data => {
      if (data.code && data.code >= 300&&data.code!=403) {
        notification.open({
          message: '错误',
          description: '' + data.message,
          icon: <NotificationIcon type='error' />,
        })
      }else if(data.code&&data.code == 403){
        notification.open({
          message: '错误',
          description: '您没有导出权限,请联系管理员',
          icon: <NotificationIcon type='error' />,
        })
      } else {
        dispatch({
          type: types.SALARY_CYLES_DET,
          salaryCylesDet: {...data , isPermission:'yes'}
        });
        return data;
      }
    }).catch(err => {
      throw err
    })
  }
}

//获取模拟算税批次详情
export function SimulationTaxDetailListAction(values) {
  return dispatch => {
    return SimulationTaxDetailList(values).then(data => {
      if (data.code && data.code >= 300&&data.code !=403) {
        notification.open({
          message: '错误',
          description: '' + data.message,
          icon: <NotificationIcon type='error' />,
        })
      }else if(data.code && data.code == 403){
        dispatch({
          type: types.CYLES_RECORD,
          cylesRecord: {
            dataSource: [],
            total_count:null,
            columns:[],
            isPermission:'no'
          }
        });
      } else {
        const { items = [], titles = '', total_count = 0 } = data;
        const columns = JSON.parse(titles ? titles : '[]');
        const temp = [];
        items.map((item, i) => {
          const detail = JSON.parse(item.detail ? item.detail : '{}');
       
          for(var key in detail){
              detail[`${key}_types`] = detail[key]
          }
  
          temp.push({
            ...detail,
            ...item,
          })
        });
        let columns_value = [];
  
        columns.map((data, i) => {
          if(data.key=='name'||data.key=='credential_type'||data.key=='credential_number'||data.key=='mobile'||data.key=='pay_salary'){
          }else{
              data.width = 200;
              data.title = data.title?data.title:data.name;
  
              if(data.key){
                  data.dataIndex=data.key+'_types';
                  data.key=data.key+'_types';
                  columns_value.push(Object.assign({},data,))
              }
              
          }
          
        });
        dispatch({
          type: types.CYLES_RECORD,
          cylesRecord: {
            dataSource: temp,
            total_count,
            columns:columns_value,
            isPermission:'yes'
          }
        });
        dispatch(change('pedding_salary_peo_list', 'total_count', total_count))
        dispatch(change('search_batch_list_detail', 'total_count', total_count))
        return temp;
      }
    }).catch(err => {
      throw err
    })
  }
}
//获取模拟算税 删除
export function SimulationTaxDelAction(values) {
  return dispatch => {
    return SimulationTaxDel(values).then(data => {
      if (data.code && data.code >= 300) {
        notification.open({
          message: '错误',
          description: '' + data.message,
          icon: <NotificationIcon type='error' />,
        })
      } else {
        notification.open({
          message: '成功',
          description: '操作成功',
          icon: <NotificationIcon type='success' />,
        })
        return data;
      }
    }).catch(err => {
      throw err
    })
  }
}
//模拟算税批次统计
export function SimulationTaxStatisAction(values) {
  return dispatch => {
    return SimulationTaxStatis(values).then(data => {
      if (data.code && data.code >= 300) {
        notification.open({
          message: '错误',
          description: '' + data.message,
          icon: <NotificationIcon type='error' />,
        })
      } else {
        dispatch({
          type: types.SIMULATIONTAXSTATIS,
          SimulationTaxStatis: data,
        })
        return data;
      }
    }).catch(err => {
      throw err
    })
  }
}
//模拟算税批次  发起校准
export function SimulationTaxDoAction(values) {
  return dispatch => {
    return SimulationTaxDo(values).then(data => {
      if (data.code && data.code >= 300) {
        notification.open({
          message: '错误',
          description: '' + data.message,
          icon: <NotificationIcon type='error' />,
        })
      } else {
        notification.open({
          message: '成功',
          description: '操作成功',
          icon: <NotificationIcon type='success' />,
        })
        return data;
      }
    }).catch(err => {
      throw err
    })
  }
}
//模拟算税批次  发起校准
export function SimulationTaxConfirmAction(values) {
  return dispatch => {
    return SimulationTaxConfirm(values).then(data => {
      if (data.code && data.code >= 300) {
        notification.open({
          message: '错误',
          description: '' + data.message,
          icon: <NotificationIcon type='error' />,
        })
      } else {
        notification.open({
          message: '成功',
          description: '操作成功',
          icon: <NotificationIcon type='success' />,
        })
        return data;
      }
    }).catch(err => {
      throw err
    })
  }
}
//模拟算税批次  发起校准
export function SimulationTaxDifferenceAction(values) {
  return dispatch => {
    return SimulationTaxDifference(values).then(data => {
      if (data.code && data.code >= 300) {
        notification.open({
          message: '错误',
          description: '' + data.message,
          icon: <NotificationIcon type='error' />,
        })
      } else {
        const { item} = data;
        let temp = [];
        if(item&&item.length==2){
          let simulateDetail = JSON.parse(JSON.stringify(item[0]));
          let autoDetail = JSON.parse(JSON.stringify(item[1]));
          for (var key in simulateDetail) {
            simulateDetail[`${key}_simulate`] = simulateDetail[key]
          }
          for (var key in autoDetail) {
            autoDetail[`${key}_auto`] = autoDetail[key]
          }
          temp = [{...simulateDetail,...autoDetail}]
          console.log('teimp',temp)
          dispatch({
            type: types.SIMULATIONTAXDIFFERENCE,
            SimulationTaxDifference: temp
          })
        }
        return data;
      }
    }).catch(err => {
      throw err
    })
  }
}
/*模拟算税    下载工资表 */
export function downWageSheetAction(values) {
  return dispatch => {
    return downWageSheet(values).then(data => {
      if (data.code && data.code >= 300) {
        notification.open({
          message: '错误',
          description: '' + data.message,
          icon: <NotificationIcon type='error' />,
        })
      } else {
        window.open(getOssFilePath(data.download_path));
      }
      return data;
    }).catch(err => {
      throw err
    })
  }
}
/*财务   代发放  撤回 */
export function recallUtilAction(values) {
  return dispatch => {
    return recallUtil(values).then(data => {
      if (data.code && data.code >= 300) {
        notification.open({
          message: '错误',
          description: '' + data.message,
          icon: <NotificationIcon type='error' />,
        })
      } else {
        notification.open({
          message: '成功',
          description: '操作成功',
          icon: <NotificationIcon type='success' />,
        })
        dispatch(change( 'financial_pay' , 'recallLock' , false ))
        dispatch(submit( "search_list_batch_grant" ))
      }
      return data;
    }).catch(err => {
      throw err
    })
  }
}
/*薪酬 发放批次  导出  */
export function salaryBatchDownAction(values) {
  return dispatch => {
    dispatch({ type: 'MASK_SHOW', maskShow: true });
    return salaryBatchDown(values).then(data => {
      dispatch({ type: 'MASK_SHOW', maskShow: false });
      if (data.code && data.code >= 300) {
        notification.open({
          message: '错误',
          description: '' + data.message,
          icon: <NotificationIcon type='error' />,
        })
      } else {
        downloadFileByUrl(data.download_path)
      }
      return data;
    }).catch(err => {
      dispatch({ type: 'MASK_SHOW', maskShow: false });
      throw err
    })
  }
}
/*模拟算税    获取合并计税列表 */
export function consolidatedTaxListAction(values) {
  return dispatch => {
    return consolidatedTaxList(values).then(data => {
      if (data.code && data.code >= 300) {
        notification.open({
          message: '错误',
          description: '' + data.message,
          icon: <NotificationIcon type='error' />,
        })
      } else {
        dispatch({
          type: types.CONSOLIDATED_DATA,
          consolidatedData: data
        })
        
      }
      return data;
    }).catch(err => {
      throw err
    })
  }
}
/*模拟算税    批量发起校准 */
export function calibrationAllAction(values) {
  return dispatch => {
    return calibrationAll(values).then(data => {
      if (data.code && data.code >= 300) {
        notification.open({
          message: '错误',
          description: '' + data.message,
          icon: <NotificationIcon type='error' />,
        })
      } else {
        notification.open({
          message: '成功',
          description: '操作成功' ,
          icon: <NotificationIcon type='success' />,
        })
      }
      return data;
    }).catch(err => {
      throw err
    })
  }
}
/*工资条批次    撤回  */
export function salarySheetRecallAction(values) {
  return dispatch => {
    return salarySheetRecall(values).then(data => {
      if (data.code && data.code >= 300) {
        notification.open({
          message: '错误',
          description: '' + data.message,
          icon: <NotificationIcon type='error' />,
        })
      } else {
        notification.open({
          message: '成功',
          description: '操作成功',
          icon: <NotificationIcon type='success' />,
        })
      }
      return data;
    }).catch(err => {
      throw err
    })
  }
}
/*薪酬方案  作废  */
export function salaryPlanCancleAction(values) {
  return dispatch => {
    return salaryPlanCancle(values).then(data => {
      if (data.code && data.code >= 300) {
        notification.open({
          message: '错误',
          description: '' + data.message,
          icon: <NotificationIcon type='error' />,
        })
      } else {
        notification.open({
          message: '成功',
          description: '操作成功',
          icon: <NotificationIcon type='success' />,
        })
        dispatch(submit('search_list_salary_plan'))
      }
    }).catch(err => {
      throw err
    })
  }
}
/*初始化模拟算税数据 列表  */
export function getInitializeSimulatedTaxListAction(values) {
  return dispatch => {
    return getInitializeSimulatedTaxList(values).then(data => {
      if (data.code && data.code >= 300) {
        notification.open({
          message: '错误',
          description: '' + data.message,
          icon: <NotificationIcon type='error' />,
        })
      } else {
        dispatch(change('search_SimulationTaxImport', 'total_count', data.total_count))
        dispatch({
          type: types.INITIALIZE_SIMULATED_SAX_SIST,
          InitializeSimulatedTaxList: data
        })
      }
    }).catch(err => {
      throw err
    })
  }
}
/*初始化模拟算税数据 导入  */
export function postInitializeTaxImportAction(values) {
  return dispatch => {
    dispatch({ type: 'MASK_SHOW', maskShow: true });
    return postInitializeTaxImport(values).then(data => {
      dispatch({ type: 'MASK_SHOW', maskShow: false });
      if (data.code && data.code >= 300) {
        notification.open({
          message: '错误',
          description: '' + data.message,
          icon: <NotificationIcon type='error' />,
        })
      } else {
        if (data.errors && data.errors.length > 0) {
          let arr = [], dataArr = [];
          arr = JSON.parse(data.errors)
          arr.map(item => {
            dataArr.push(item.message)
          })
          dispatch(change('SimulationTaxImport' , 'errMessage', dataArr.length > 0 ? dataArr.join('、') : ''))
        } else {
          dispatch(change('SimulationTaxImport' , 'lock', false))
          dispatch(submit('search_SimulationTaxImport'))
          notification.open({
            message: '成功',
            description: '操作成功',
            icon: <NotificationIcon type='success' />,
          })
        }
      }
      return data
    }).catch(err => {
      dispatch({ type: 'MASK_SHOW', maskShow: false });
      throw err
    })
  }
}
/*初始化模拟算税数据 导入记录  列表  */
export function taxImportRecordAction(values) {
  return dispatch => {
    return taxImportRecord(values).then(data => {
      if (data.code && data.code >= 300) {
        notification.open({
          message: '错误',
          description: '' + data.message,
          icon: <NotificationIcon type='error' />,
        })
      } else {
        dispatch(change('search_TaxImportRecord', 'total_count', data.total_count))
        dispatch({
          type: types.TAX_IMPORT_RECORD,
          taxImportRecord: data
        })
      }
      return data
    }).catch(err => {
      throw err
    })
  }
}