NList_wev8.js 127 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
if (typeof (MEC_NS) == 'undefined') {
    MEC_NS = {};
}

MEC_NS.NList = function (type, id, mecJson) {
    this.type = type;
    if (!id) {
        id = new UUID().toString();
    }
    this.id = id;
    if (!mecJson) {
        mecJson = this.getDefaultMecJson();
    }
    this.utils = require('utils');
    this.sourcePanel = this.utils.use('sourcePanel');
    this.sourceFields = [];
    this.advanceSourceFields = [];
    this.mecJson = mecJson;
    this.selectedAdSearchColumns = [];
    this.advancedSearchColumns = [];
    var that = this;
    require(['mec'], function (mec) {
        that.remark = function () {
            return mec.remark(that.mecJson.name);
        };
    });

    if (typeof fieldPicker == 'undefined') {
        fieldPicker = this.utils.use('fieldPicker');
    }
};

/*获取id。 必需的方法*/
MEC_NS.NList.prototype.getID = function () {
    return this.id;
};

/*获取设计的html, 页面上怎么显示控件完全依赖于此方法。 必需的方法*/
MEC_NS.NList.prototype.getDesignHtml = function () {
    return getDesignHtml(this);
};

/*获取构建属性编辑窗体的html,添加和单击控件后会调用此方法,由此方法去构建属性编辑窗体。 必需的方法*/
MEC_NS.NList.prototype.getAttrDlgHtml = function () {
    var theId = this.id;

    var row = this.mecJson.showSet.row;
    var col = this.mecJson.showSet.col;

    var fieldHtm = "";
    for (var i = 0; i < row; i++) {
        fieldHtm += '<div class="field-row-wrap"><div class="move-after move_btn"></div><div class="del-box-after del_btn"></div>';
        for (var j = 0; j < col; j++) {
            var colfield = {};
            fieldHtm += '<div class="field-col-wrap">'
                + '<span class="field" title="' + SystemEnv.getHtmlNoteName(4139) + '">' + SystemEnv.getHtmlNoteName(4139) + '</span>'  //选择字段
                + '<input type="hidden" name="field_json"/>'
                + '</div>';
        }
        fieldHtm += '</div>';
    }

    var getDataFormatHtm = function () {
        var htm = "";
        htm += '<div class="block-area mb-10">';
            htm += '<div class="title">'+SystemEnv.getHtmlNoteName(4295)+'<div class="more-info hidden"></div></div>';
            htm += '<div class="form-group block-control block-area">';
                htm += '<ul class="normal-list outformat-list" style="margin-bottom:0px;">';
                    htm += '<li>';
                        htm += '<div class="inline">';
                            htm += '<input name="key" type="hidden" value="DATAS">';
                            htm += '<input name="name" data-key="DATAS" type="text" class="form-control" value="">';
                        htm += '</div>';
                        htm += '<div class="inline">';
                            htm += '<div class="ml-10">'+SystemEnv.getHtmlNoteName(4302)+'</div>';//数据JSON对应KEY
                        htm += '</div>';
                    htm += '</li>';
                    htm += '<li>';
                        htm += '<div class="inline">';
                            htm += '<input name="key" type="hidden" value="TOTAL_SIZE">';
                            htm += '<input name="name" data-key="TOTAL_SIZE" type="text" class="form-control" value="">';
                        htm += '</div>';
                        htm += '<div class="inline">';
                            htm += '<div class="ml-10" style="position:relative;">'+SystemEnv.getHtmlNoteName(4301);
                            htm += '<div class="more-info pl-3" style="color:#108ee9;position:static;display:inline;"></div></div>';//总记录数对应KEY
                        htm += '</div>';
                    htm += '</li>';
                htm += '</ul>';
                htm += '<ul class="normal-list outformat-list block-control hide">';
                    htm += '<li>';
                        htm += '<div class="inline">';
                            htm += '<div class="inline" style="width:60%;">';
                                htm += '<input name="key" type="hidden" value="STATUS_CODE">';
                                htm += '<input name="name" data-key="STATUS_CODE" type="text" class="form-control" value="">';
                            htm += '</div>';
                            htm += '<div class="inline" style="width:10%;text-align:center;">-</div>';
                            htm += '<div class="inline" style="width:30%;">';
                                htm += '<input name="value" type="text" class="form-control" value="">';
                            htm += '</div>';
                        htm += '</div>';
                        htm += '<div class="inline">';
                            htm += '<div class="ml-10">'+SystemEnv.getHtmlNoteName(5257)+'</div>';//结果状态码对应KEY - 正常响应对应的值
                        htm += '</div>';
                    htm += '</li>';
                    htm += '<li>';
                        htm += '<div class="inline">';
                            htm += '<input name="key" type="hidden" value="ERROR_MSG">';
                            htm += '<input name="name" data-key="ERROR_MSG" type="text" class="form-control" value="">';
                        htm += '</div>';
                        htm += '<div class="inline">';
                            htm += '<div class="ml-10">'+SystemEnv.getHtmlNoteName(5256)+'</div>';//错误提示对应KEY
                        htm += '</div>';
                    htm += '</li>';
                htm += '</ul>';
            htm += '</div>';
        htm += '</div>';
        return htm;
    };
    
    var htm = '<div id="MAD_'+theId+'" style="height: inherit;">';
        //基本信息---start
        htm += '<div class="block-area mb-10">';
            htm += '<div class="title">';
                htm += SystemEnv.getHtmlNoteName(4650);
                htm += '<div class="more-info hidden"></div>';
            htm += '</div>';
            htm += '<div class="form-group block-control">';
                htm += '<div class="row">';
                    htm += '<span class="col-2 span-control">'+SystemEnv.getHtmlNoteName(4142)+'</span>';  // 名称:
                    htm += '<div class="col-m-8">';
                        htm += '<input type="text" id="name_'+theId+'" class="form-control" data-autobind placeholder="'+SystemEnv.getHtmlNoteName(4583)+'" />'; //一个中文的名称,如:人员列表
                    htm += '</div>';
                htm += '</div>';
                
                htm += '<div id="sourcePanel_'+theId+'"></div>';
                
            htm += '</div>';
        htm += '</div>';
        //基本信息---end
        
        htm += '<div data-source-content data-sourcetype4-content>';
            htm += '<div class="url-dataFormat-attr-container">';
                htm += getDataFormatHtm();
            htm += '</div>';
        htm += '</div>';
        
        htm += '<div data-source-content data-sourcetype5-content>';
            htm += '<div class="api-dataFormat-attr-container">';
            htm += getDataFormatHtm();
            htm += '</div>';
        htm += '</div>';
        
        //展示样式---start
        htm += '<div class="block-area mb-10">';
            htm += '<div class="title">'+SystemEnv.getHtmlNoteName(4164)+'<div class="more-info hidden"></div></div>';
            htm += '<div class="form-group block-control">';
                htm += '<div class="row item-config showSet-config-attr-container">';
                    htm += '<div class="col-8 count-container">';
                        htm += SystemEnv.getHtmlNoteName(4585);  //列数:
                        htm += '<span data-autobind class="minu-after showSet-minus-column"></span>';
                        htm += '<input type="text" id="column_'+theId+'" class="count-control" value="'+col+'" disabled="disabled"/>';
                        htm += '<span data-autobind class="add-after showSet-add-column"></span>';
                    htm += '</div>';
                    htm += '<div class="col-4 add-before pd-4 showSet-add-row" data-autobind>'+SystemEnv.getHtmlNoteName(3575)+'</div>';  //添加行
                htm += '</div>';
                
                htm += '<div class="list-item showSet-content-attr-container">';
                    htm += '<div class="container">';
                        htm += '<div class="hori-center">';
                            htm += '<div class="item-left showSet-left">';
                                htm += '<div class="img-field-row-wrap">';
                                    htm += '<span class="img" title="'+SystemEnv.getHtmlNoteName(4166)+'">'+SystemEnv.getHtmlNoteName(4167)+'</span>';  //图片字段   图片   
                                    htm += '<input type="hidden" name="field_json"/>';
                                htm += '</div>';
                            htm += '</div>';
                            
                            htm += '<div class="item-right showSet-right">';
                                htm += '<div class="field-row-wrap title-field-row-wrap">';
                                    htm += '<div class="field-col-wrap field-col-wrap">';
                                        htm += '<span class="field title-field">'+SystemEnv.getHtmlNoteName(3534)+'</span>';  //标题
                                        htm += '<input type="hidden" name="field_json"/>';
                                    htm += '</div>';
                                htm += '</div>';
                                htm += fieldHtm;
                            htm += '</div>';
                        htm += '</div>';
                    htm += '</div>';
                htm += '</div>';
            htm += '</div>';
        htm += '</div>';
        //展示样式---end
        
        //搜索设置---start
        htm += '<div class="block-area mb-10">';
            htm += '<div class="title">'+SystemEnv.getHtmlNoteName(5247)+'<div class="more-info hidden"></div></div>';
            
            htm += '<div class="form-group block-control">';
                htm += '<div class="row">';
                    htm += '<div class="col-2 span-control">';
                        htm += SystemEnv.getHtmlNoteName(6103);  //快捷搜索:
                    htm += '</div>';
                    htm += '<div class="col-m-8"><input type="checkbox" id="quickSearch_'+theId+'"/></div>';
                htm += '</div>';
                
                //showSearchContainer begin
                htm += '<div class="searchWrapper-attr-container">';
                    htm += '<div class="row">';
                        htm += '<span class="col-2 span-control">'+SystemEnv.getHtmlNoteName(4867)+'</span>';  //搜索提示:
                        htm += '<div class="col-m-8"><input type="text" data-autobind="searchTips" id="searchTips_'+theId+'" class="form-control"/></div>';
                    htm += '</div>';
                    
                    htm += '<div data-source-content data-sourcetype1-content>';
                        htm += '<div class="searchColumn-attr-container">';
                            htm += '<div class="title" style="font-weight:normal;color:#666;">';
                                htm += SystemEnv.getHtmlNoteName(6104);  //快捷搜索查询列
                                htm += '<div class="add-before quickSearch-column-add">'+SystemEnv.getHtmlNoteName(3518)+'</div>';  //添加
                            htm += '</div>';
                            
                            htm += '<div class="form-group">';
                                htm += '<div>';
                                    htm += '<div class="tip-control">'+SystemEnv.getHtmlNoteName(6105)+'</div>';  //单击右上角的添加按钮以添加查询列,如果未指定查询列,则默认按照展示中选择的第一列进行查询
                                    htm += '<ul class="normal-list"></ul>';
                                htm += '</div>';
                            htm += '</div>';
                        htm += '</div>';
                    htm += '</div>';
                    
                    htm += '<div data-source-content data-sourcetype3-content>';
                        htm += '<div class="row">';
                            htm += '<span class="col-2 span-control" style="vertical-align: top;">'+SystemEnv.getHtmlNoteName(6106)+'</span>';//快捷搜索查询条件:
                            htm += '<div class="col-m-8">';
                                htm += '<textarea id="searchCondition_' + theId + '" class="area-control" placeholder="'+SystemEnv.getHtmlNoteName(6107)+'name like \'%{searchKey}%\' or content like \'{searchKey}\''+'"></textarea>';  //请输入查询条件,搜索关键词用{searchKey}表示,如:
                            htm += '</div>';
                        htm += '</div>';
                    htm += '</div>';
                        
                    htm += '<div data-source-content data-sourcetype1-content>';
                        htm += '<div class="row">';
                            htm += '<div class="col-2 span-control">';
                                htm += SystemEnv.getHtmlNoteName(4163);  //高级检索:
                            htm += '</div>';
                            htm += '<div class="col-m-8"><input type="checkbox" id="advancedSearch_'+theId+'"/></div>';
                        htm += '</div>';
                        
                        htm += '<div class="advancedSearch-attr-container">';
                            htm += '<div class="row">';
                                htm += '<div class="col-2 span-control">'+SystemEnv.getHtmlNoteName(4869)+'</div>'; //页面标题
                                htm += '<div class="col-m-8">';
                                    htm += '<input class="form-control" type="text" id="asTitle_'+theId+'">';
                                htm += '</div>';
                            htm += '</div>';
                            
                            htm += '<div class="title" style="font-weight:normal;color:#666;border-bottom:0;padding-bottom:0;">';
                                htm += SystemEnv.getHtmlNoteName(6108);  //高级检索字段设置
                                htm += '<div class="add-before advancedSearch-column-add" style="top: 20px;">'+SystemEnv.getHtmlNoteName(3518)+'</div>';  //添加
                                htm += '<table class="table search-fields-table" style="table-layout:fixed;margin-bottom:0;">';
                                    htm += '<thead><tr>';
                                        htm += '<td width="20px"></td>';
                                        htm += '<td width="*">'+SystemEnv.getHtmlNoteName(4324)+'</td>';//字段名称
                                        htm += '<td width="150px">'+SystemEnv.getHtmlNoteName(4740)+'</td>';//显示名称
                                        htm += '<td width="20%" style="text-align:center;">'+SystemEnv.getHtmlNoteName(6211)+'</td>';//快捷条件
                                        htm += '<td width="24px"></td>';
                                    htm += '</tr></thead>';
                                htm += '</table>';
                            htm += '</div>';
                            htm += '<div class="form-group">';
                                htm += '<div>';
                                    htm += '<div class="tip-control">'+SystemEnv.getHtmlNoteName(4159)+'</div>';  //单击右上角的添加按钮以添加内容
                                    htm += '<ul class="normal-list"></ul>';
                                htm += '</div>';
                            htm += '</div>';
                        htm += '</div>';
                    htm += '</div>';
                    
                    htm += '<div class="customBtn-attr-container">';
                        htm += '<div class="title" style="font-weight:normal;color:#666;">';
                            htm += SystemEnv.getHtmlNoteName(4158) + '<span data-source-content data-sourcetype1-content style="color:#999;">&nbsp;('+SystemEnv.getHtmlNoteName(6109)+'<input type="checkbox" id="pageExpand_'+theId+'"/>&nbsp;)&nbsp;</span>';  //自定义按钮
                            htm += '<div data-autobind class="add-before customBtn-add">'+SystemEnv.getHtmlNoteName(3518)+'</div>';  //添加
                        htm += '</div>';
                        htm += '<div class="form-group">';
                            htm += '<div>';
                                htm += '<div class="tip-control">'+SystemEnv.getHtmlNoteName(4159)+'</div>'; //单击右上角的添加按钮以添加内容
                                htm += '<ul class="normal-list"></ul>';
                            htm += '</div>';
                        htm += '</div>';
                    htm += '</div>';
                        
                htm += '</div>'
                //showSearchContainer end
            htm += '</div>';
        htm += '</div>';
        //搜索设置---end
        
        //分页设置---start
        htm += '<div class="block-area mb-10">';
            htm += '<div class="title">'+SystemEnv.getHtmlNoteName(5249)+'<div class="more-info hidden"></div></div>';
            htm += '<div class="form-group block-control">';
                htm += '<div class="row" data-source-content data-sourcetype4-content data-sourcetype5-content>';
                    htm += '<span class="col-2 span-control">'+SystemEnv.getHtmlNoteName(5242)+'</span>';  //起始页码:
                    htm += '<div class="col-m-8">'+SystemEnv.getHtmlNoteName(5250)+'<input type="text" id="pageStart_'+theId+'" class="form-control" style="width:50px;display:inline-block;margin:0 5px;text-align:center;"/>'+SystemEnv.getHtmlNoteName(5251)+'</div>';
                htm += '</div>';
                
                htm += '<div class="row">';
                    htm += '<span class="col-2 span-control">'+SystemEnv.getHtmlNoteName(4247)+'</span>';  //每页显示:
                    htm += '<div class="col-m-8"><input type="text" id="pageSize_'+theId+'" class="form-control"/></div>';
                htm += '</div>';
                
                htm += '<div class="row">';
                    htm += '<div class="col-2 span-control">' + SystemEnv.getHtmlNoteName(6110) + '</div>'; //只显一页:
                    htm += '<div class="col-m-8">';
                        htm += '<input type="checkbox" id="showOnePage_'+theId+'"/>&nbsp;' + SystemEnv.getHtmlNoteName(4874);//选中只显示一页数据
                    htm += '</div>';
                htm += '</div>';
            htm += '</div>';
        htm += '</div>';
        //分页设置---end
        
        //数据展示---start
        htm += '<div class="block-area mb-10">';
            htm += '<div class="title">'+SystemEnv.getHtmlNoteName(5252)+'<div class="more-info hidden"></div></div>';
            htm += '<div class="form-group block-control">';
                htm += '<div class="row">';
                    htm += '<div class="col-2 span-control">';
                        htm += SystemEnv.getHtmlNoteName(5253);  //数据只读:
                    htm += '</div>';
                    htm += '<div class="col-m-8"><input type="checkbox" id="dataReadonly_'+theId+'"/></div>';
                htm += '</div>';

                htm += '<div class="row" data-source-content data-sourcetype1-content>';
                    htm += '<div class="col-2 span-control">';
                        htm += SystemEnv.getHtmlNoteName(6217);  //未读、反馈标识:
                    htm += '</div>';
                    htm += '<div class="col-m-8"><input type="checkbox" id="unreadBadge_'+theId+'"/></div>';
                htm += '</div>';

                htm += '<div class="row">';
                    htm += '<div class="col-2 span-control">';
                        htm += SystemEnv.getHtmlNoteName(4129);  //延迟加载:
                    htm += '</div>';
                    htm += '<div class="col-m-8"><input type="checkbox" id="lazyLoad_'+theId+'"/></div>';
                htm += '</div>';
            htm += '</div>';
        htm += '</div>';
        //数据展示---end

        //数据可选---start
        htm += '<div id="dataSelectable_"'+theId+' class="block-area mb-10">';
            htm += '<div class="title">'+SystemEnv.getHtmlNoteName(4871)+'<div class="more-info hidden"></div></div>';
            htm += '<div class="form-group block-control">';
                htm += '<div class="row">';
                    htm += '<div class="col-2 span-control">' + SystemEnv.getHtmlNoteName(4320) + '</div>'; //数据可选:
                    htm += '<div class="col-m-8">';
                        htm += '<input type="checkbox" id="dataCheck_'+theId+'"/>&nbsp;' + SystemEnv.getHtmlNoteName(4872);//选中可以选择数据
                    htm += '</div>';
                htm += '</div>';

                htm += '<div class="selectableBtn-attr-container">';
                    htm += '<div class="title" style="font-weight:normal;color:#666;">';
                        htm += SystemEnv.getHtmlNoteName(5067)//自定义按钮
                        htm += '<div data-autobind class="add-before customBtn-add">'+SystemEnv.getHtmlNoteName(3518)+'</div>';  //添加
                    htm += '</div>';
                    htm += '<div class="form-group">';
                        htm += '<div>';
                            htm += '<div class="tip-control">'+SystemEnv.getHtmlNoteName(4159)+'</div>'; //单击右上角的添加按钮以添加内容
                            htm += '<ul class="normal-list"></ul>';
                        htm += '</div>';
                    htm += '</div>';
                htm += '</div>';

            htm += '</div>';
        htm += '</div>';
        //数据可选---end
        
        //左滑配置---start
        htm += '<div class="swipe-attr-container block-area mb-10">';
            htm += '<div class="title">';
                htm += SystemEnv.getHtmlNoteName(5254);
                htm += '<div class="add-before" style="right:22px;">'+SystemEnv.getHtmlNoteName(3518)+'</div>';  //添加
                htm += '<div class="more-info hidden"></div>';
            htm +='</div>';
            htm += '<div class="form-group block-control">';
                htm += '<div>';
                    htm += '<div class="tip-control">'+SystemEnv.getHtmlNoteName(4159)+'</div>';  //单击右上角的添加按钮以添加内容
                    htm += '<ul class="normal-list"></ul>';
                htm += '</div>';
            htm += '</div>';
            
        htm += '</div>';
        //左滑配置---end
        
        //回复评论---start
        htm += '<div class="block-area mb-10">';
            htm += '<div class="title">'+SystemEnv.getHtmlNoteName(6160);//回复评论设置
                htm += '<div class="more-info hidden"></div>';
                htm += '<div class="p-loading comment-loading" style="top:6px;font-weight:normal;"><span>'+SystemEnv.getHtmlNoteName(4317)+'</span></div>';
            htm += '</div>';
            htm += '<div class="form-group block-control">';
                htm += '<div class="row">';
                    htm += '<div class="col-2 span-control">';
                        htm += SystemEnv.getHtmlNoteName(6163);  //配置选项:
                    htm += '</div>';
                    htm += '<div class="col-8">';
                        htm += '<span class="hide" content4cubemode-reply-opened>';
                            htm += '<span class="hide" data-source-content4cubemode>';
                                htm += '<span class="cbboxEntry">';
                                    htm += '<input type="checkbox" name="commentSettingType_'+theId+'" value="1">';
                                    htm += '<span class="cbboxLabel" style="padding-right:16px;">'+SystemEnv.getHtmlNoteName(6164)+'</span>';//表单建模配置
                                htm += '</span>';
                            htm += '</span>';
                        htm += '</span>'
                        htm += '<span class="cbboxEntry">';
                            htm += '<input type="checkbox" name="commentSettingType_'+theId+'" value="2">';
                            htm += '<span class="cbboxLabel">'+SystemEnv.getHtmlNoteName(6162)+'</span>'; //自定义配置
                        htm += '</span>'
                    htm += '</div>'
                htm += '</div>';
                
                htm += '<div class="commentSetting-attr-container">';
                    htm += '<div class="commentSetting-attr-content hide">';
                        htm += '<div class="row">';
                            htm += '<span class="col-2 span-control">'+SystemEnv.getHtmlNoteName(6165)+'</span>';  //列表主键字段:
                            htm += '<div class="col-m-8">';
                                htm += '<input type="text" id="commentMainField_'+theId+'" class="form-control" placeholder="'+SystemEnv.getHtmlNoteName(6166)+'id'+'" />'; //如:
                            htm += '</div>';
                        htm += '</div>';
                        
                        htm += '<div class="title" style="font-weight:normal;color:#666;">';
                            htm += SystemEnv.getHtmlNoteName(6167);  //评论表设置
                        htm += '</div>';
                        htm += '<div class="form-group">';
                            htm += '<div class="row">';
                                htm += '<span class="col-2 span-control">'+SystemEnv.getHtmlNoteName(4201)+'</span>';  //数据源:
                                htm += '<div class="col-m-8">';
                                    htm += '<div class="col-8">';
                                        htm +='<select class="form-control" id="commentDatasource_'+theId+'">';
                                        htm +='<option value="">(local)</option>';
                                        htm +='</select>';
                                    htm += '</div>';
                                    htm += '<div class="col-4 pr-10"><input type="button" class="btn-control comment-btn-clear" value="'+SystemEnv.getHtmlNoteName(4335)+'"/></div>';  //清除缓存
                                htm += '</div>';
                            htm += '</div>';
                            
                            htm += '<div class="row">';
                                htm += '<span class="col-2 span-control">'+SystemEnv.getHtmlNoteName(4327)+'</span>';  //表名:
                                htm += '<div class="col-m-8">';
                                    htm += '<select class="form-control comment-tablename" id="commentTablename_'+theId+'">';
                                    htm += '</select>';
                                htm += '</div>';
                            htm += '</div>';
                            
                            htm += '<div class="row">';
                                htm += '<span class="col-2 span-control">'+SystemEnv.getHtmlNoteName(4503)+'</span>';  //主键:
                                htm += '<div class="col-m-8">';
                                    htm += '<select class="form-control comment-primarykey" id="commentPrimaryKey_'+theId+'">';
                                    htm += '</select>';
                                htm += '</div>';
                            htm += '</div>';
                            
                            htm += '<div class="row">';
                                htm += '<span class="col-2 span-control">'+SystemEnv.getHtmlNoteName(6168)+'</span>';  //主键策略:
                                htm += '<div class="col-m-8">';
                                    htm += '<select class="form-control" id="commentPrimaryKeyType_'+theId+'">';
                                        htm += '<option value="1">'+SystemEnv.getHtmlNoteName(6169)+'</option>';  //主键自动增长
                                        htm += '<option value="2">'+SystemEnv.getHtmlNoteName(6170)+'(UUID)</option>';  //32位ID
                                    htm += '</select>';
                                htm += '</div>';
                            htm += '</div>';

                        htm += '</div>';
    
                        htm += '<div class="title" style="font-weight:normal;color:#666;">';
                            htm += SystemEnv.getHtmlNoteName(6171);  //评论表字段设置
                            htm += '<div class="add-before reply-column-add">'+SystemEnv.getHtmlNoteName(3518)+'</div>';  //添加
                        htm += '</div>';
                        htm += '<div class="form-group">';
                            htm += '<div>';
                                htm += '<ul class="normal-list"></ul>';
                            htm += '</div>';
                        htm += '</div>';
                        
                        htm += '<div class="title" style="font-weight:normal;color:#666;">';
                            htm += SystemEnv.getHtmlNoteName(6187);  //评论数据过滤
                        htm += '</div>';
                        htm += '<div class="form-group">';
                            htm += '<div class="row">';
                                htm += '<span class="col-2 span-control" style="vertical-align: top;">'+SystemEnv.getHtmlNoteName(5133)+'</span>';//过滤条件:
                                htm += '<div class="col-m-8" style="position:relative;">';
                                    htm += '<textarea id="commentFilter_' + theId + '" class="area-control" placeholder="'+SystemEnv.getHtmlNoteName(6166)+'status=1 and userid={curruser}'+'"></textarea>';  //如:
                                    htm += '<div class="helper" for="commentFilter">?</div>';
                                    htm += '</div>';
                            htm += '</div>';
                        htm += '</div>';
                        
                        htm += '<div class="title" style="font-weight:normal;color:#666;">';
                            htm += SystemEnv.getHtmlNoteName(6172);  //提醒设置
                        htm += '</div>';
                        htm += '<div class="form-group">';
                            
                            htm += '<div class="row">';
                                htm += '<span class="col-2 span-control">'+SystemEnv.getHtmlNoteName(6173)+'</span>';  //@提醒时的标题:
                                htm += '<div class="col-m-8 pr-10" style="position:relative;">';
                                    htm += '<input type="text" id="commentMsgTitle_'+theId+'" class="form-control" />';
                                    htm += '<div class="helper" for="atTitle" style="top:15px;right:-8px;">?</div>';
                                htm += '</div>';
                            htm += '</div>';
                            
                            htm += '<div class="row">';
                                htm += '<span class="col-2 span-control">'+SystemEnv.getHtmlNoteName(6174)+'</span>';  //点击消息跳转地址:
                                htm += '<div class="col-m-8 pr-10" style="position:relative;">';
                                    htm += '<input type="text" id="commentMsgUrl_'+theId+'" class="form-control" />';
                                    htm += '<div class="helper" for="atLink" style="top:18px;right:-8px;">?</div>';
                                htm += '</div>';
                            htm += '</div>';
                        htm += '</div>';
                    htm += '</div>';//commentSetting-attr-content
                htm += '</div>';//commentSetting-attr-container
                
            htm += '</div>';//form-group end
        htm += '</div>';
        //回复评论---end

        //点赞/踩---start
        htm += '<div class="block-area mb-10">';
            htm += '<div class="title">'+SystemEnv.getHtmlNoteName(6252);//点赞设置
                htm += '<div class="more-info hidden"></div>';
                htm += '<div class="p-loading praise-loading" style="top:6px;font-weight:normal;"><span>'+SystemEnv.getHtmlNoteName(4317)+'</span></div>';
            htm += '</div>';
            htm += '<div class="form-group block-control">';
                htm += '<div class="row">';
                    htm += '<div class="col-2 span-control">';
                        htm += SystemEnv.getHtmlNoteName(6255);  //是否启用:
                    htm += '</div>';
                    htm += '<div class="col-8">';
                        htm += '<span class="hide" content4cubemode-praise-opened>';
                            htm += '<span class="hide" data-source-content4cubemode>';
                                htm += '<span class="cbboxEntry">';
                                    htm += '<input type="checkbox" name="praiseSettingType_'+theId+'" value="1">';
                                    htm += '<span class="cbboxLabel" style="padding-right:16px;">'+SystemEnv.getHtmlNoteName(6164)+'</span>';//表单建模配置
                                htm += '</span>';
                            htm += '</span>';
                        htm += '</span>'
                        htm += '<span class="cbboxEntry">';
                            htm += '<input type="checkbox" name="praiseSettingType_'+theId+'" value="2">';
                            // htm += '<span class="cbboxLabel">'+SystemEnv.getHtmlNoteName(6162)+'</span>'; //自定义配置
                        htm += '</span>'
                    htm += '</div>'
                htm += '</div>';

                htm += '<div class="praiseSetting-attr-container">';
                    htm += '<div class="praiseSetting-attr-content hide">';
                        htm += '<div class="row">';
                            htm += '<span class="col-2 span-control">'+SystemEnv.getHtmlNoteName(6165)+'</span>';  //列表主键字段:
                            htm += '<div class="col-m-8">';
                                htm += '<input type="text" id="praiseMainField_'+theId+'" class="form-control" placeholder="'+SystemEnv.getHtmlNoteName(6166)+'id'+'" />'; //如:
                            htm += '</div>';
                        htm += '</div>';
                        htm += '<div class="row">';
                            htm += '<span class="col-2 span-control">'+SystemEnv.getHtmlNoteName(6250)+'</span>'; //允许赞:
                            htm += '<div class="col-m-8"><input type="checkbox" id="isAllowLike_'+theId+'" value="1"/></div>';
                            htm += '<span class="col-2 span-control">'+SystemEnv.getHtmlNoteName(4514)+'</span>'; //显示名称:
                            htm += '<div class="col-m-8">';
                                htm += '<input type="text" id="likeShowLabel_'+theId+'" class="form-control" placeholder="'+SystemEnv.getHtmlNoteName(6256)+'"/>'; //请输入显示文字
                            htm += '</div>';
                        htm += '</div>';
                        htm += '<div class="row">';
                            htm += '<span class="col-2 span-control">'+SystemEnv.getHtmlNoteName(6251)+'</span>'; //允许踩:
                            htm += '<div class="col-m-8"><input type="checkbox" id="isAllowDislike_'+theId+'" value="1"/></div>';
                            htm += '<span class="col-2 span-control">'+SystemEnv.getHtmlNoteName(4514)+'</span>'; //显示名称:
                            htm += '<div class="col-m-8">';
                                htm += '<input type="text" id="dislikeShowLabel_'+theId+'" class="form-control" placeholder="'+SystemEnv.getHtmlNoteName(6256)+'"/>'; //请输入显示文字
                            htm += '</div>';
                        htm += '</div>';
                        htm += '<div class="title" style="font-weight:normal;color:#666;">';
                            htm += SystemEnv.getHtmlNoteName(6257);  //点赞表设置
                        htm += '</div>';
                        htm += '<div class="form-group">';
                            htm += '<div class="row">';
                                htm += '<span class="col-2 span-control">'+SystemEnv.getHtmlNoteName(4201)+'</span>';  //数据源:
                                htm += '<div class="col-m-8">';
                                    htm += '<div class="col-8">';
                                        htm +='<select class="form-control" id="praiseDatasource_'+theId+'">';
                                        htm +='<option value="">(local)</option>';
                                        htm +='</select>';
                                    htm += '</div>';
                                    htm += '<div class="col-4 pr-10"><input type="button" class="btn-control praise-btn-clear" value="'+SystemEnv.getHtmlNoteName(4335)+'"/></div>';  //清除缓存
                                htm += '</div>';
                            htm += '</div>';

                            htm += '<div class="row">';
                                htm += '<span class="col-2 span-control">'+SystemEnv.getHtmlNoteName(4327)+'</span>';  //表名:
                                htm += '<div class="col-m-8">';
                                    htm += '<select class="form-control praise-tablename" id="praiseTablename_'+theId+'">';
                                    htm += '</select>';
                                htm += '</div>';
                            htm += '</div>';

                            htm += '<div class="row">';
                                htm += '<span class="col-2 span-control">'+SystemEnv.getHtmlNoteName(4503)+'</span>';  //主键:
                                htm += '<div class="col-m-8">';
                                    htm += '<select class="form-control praise-primarykey" id="praisePrimaryKey_'+theId+'">';
                                    htm += '</select>';
                                htm += '</div>';
                            htm += '</div>';

                            htm += '<div class="row">';
                                htm += '<span class="col-2 span-control">'+SystemEnv.getHtmlNoteName(6168)+'</span>';  //主键策略:
                                htm += '<div class="col-m-8">';
                                    htm += '<select class="form-control" id="praisePrimaryKeyType_'+theId+'">';
                                        htm += '<option value="1">'+SystemEnv.getHtmlNoteName(6169)+'</option>';  //主键自动增长
                                        htm += '<option value="2">'+SystemEnv.getHtmlNoteName(6170)+'(UUID)</option>';  //32位ID
                                    htm += '</select>';
                                htm += '</div>';
                            htm += '</div>';

                        htm += '</div>';

                        htm += '<div class="title" style="font-weight:normal;color:#666;">';
                            htm += SystemEnv.getHtmlNoteName(6258);  //点赞表字段设置
                            htm += '<div class="add-before praise-column-add">'+SystemEnv.getHtmlNoteName(3518)+'</div>';  //添加
                        htm += '</div>';
                        htm += '<div class="form-group">';
                            htm += '<div>';
                                htm += '<ul class="normal-list"></ul>';
                            htm += '</div>';
                        htm += '</div>';

                        htm += '<div class="title" style="font-weight:normal;color:#666;">';
                            htm += SystemEnv.getHtmlNoteName(6259);  //点赞数据过滤
                        htm += '</div>';
                        htm += '<div class="form-group">';
                            htm += '<div class="row">';
                                htm += '<span class="col-2 span-control" style="vertical-align: top;">'+SystemEnv.getHtmlNoteName(5133)+'</span>';//过滤条件:
                                htm += '<div class="col-m-8" style="position:relative;">';
                                    htm += '<textarea id="praiseFilter_' + theId + '" class="area-control" placeholder="'+SystemEnv.getHtmlNoteName(6166)+'status=1 and userid={curruser}'+'"></textarea>';  //如:
                                    htm += '<div class="helper" for="praiseFilter">?</div>';
                                    htm += '</div>';
                            htm += '</div>';
                        htm += '</div>';
                    htm += '</div>';//praiseSetting-attr-content
                htm += '</div>';//praiseSetting-attr-container

            htm += '</div>';//form-group end
        htm += '</div>';
        //点赞---end
        
    htm += '</div>';//end MAD
    return htm;
};


/*构建属性编辑窗体完成后调用此方法,主要用于一些必须要使用js对页面进行后置操作时,无需要此方法可至空。 不必需的方法,有此方法系统自动调用*/
MEC_NS.NList.prototype.afterAttrDlgBuild = function () {
    var that = this,
        theId = this.id,
        $attrContainer = this.$attrContainer = $("#MAD_" + theId),
        $apiDataFormatContainer = this.$apiDataFormatContainer = $attrContainer.find(".api-dataFormat-attr-container"),
        $urlDataFormatContainer = this.$urlDataFormatContainer = $attrContainer.find(".url-dataFormat-attr-container"),
        $showsetConfigContainer = this.$showsetConfigContainer = $attrContainer.find(".showSet-config-attr-container"),
        $showsetContentContainer = this.$showsetContentContainer = $attrContainer.find(".showSet-content-attr-container"),
        $commentSettingContainer = this.$commentSettingContainer = $attrContainer.find(".commentSetting-attr-container"),
        $praiseSettingContainer = this.$praiseSettingContainer = $attrContainer.find(".praiseSetting-attr-container"),
        $quickSearchColumnContainer = this.$quickSearchColumnContainer = $attrContainer.find(".searchColumn-attr-container"),
        $advancedSearchColumnContainer = this.$advancedSearchColumnContainer = $attrContainer.find(".advancedSearch-attr-container"),
        $customBtnContainer = this.$customBtnContainer = $attrContainer.find(".customBtn-attr-container"),
        $selectableBtnContainer = this.$selectableBtnContainer = $attrContainer.find(".selectableBtn-attr-container"),
        $swipeContainer = this.$swipeContainer = $attrContainer.find(".swipe-attr-container");

    this.bindAttrDlgHtmlEvent();
    this.initCubeReplyPraiseStatus();
    this.sourcePanel("run", {
        el: $("#sourcePanel_" + theId),
        id: theId,
        data: that.mecJson.sourceData,
        callback: {
            sourceTypeChange: function (type) {
                $attrContainer.find("[data-source-content]").hide();
                $attrContainer.find('[data-sourcetype' + type + '-content]').show();
            },
            sourceFieldsLoaded: function (sourceType, datas) {
                that.sourceFields = datas || [];
                that.advanceSourceFields = that.sourceFields.filter(function(val){
                    return val.htmlType != 6;  // 图片、附件
                })
                if (sourceType == 1) {
                    that.initQuickSearchColumns();
                    that.initAdvanceSearchColumns();
                }
                that.initFieldPicker();
                that.initCubeSourceContent();
                that.doClearFieldsPrompt();
            },
            sourceValueChange: function (options) {
                that.initFieldPicker(options);
                that.initSourceContent(options);
                that.initCubeSourceContent();
                if (!options || !options.sqlChange) {
                    that.doClearFieldsPrompt();
                }
            },
            initDefaultUrlTemplate: function () {
                var msg = SystemEnv.getHtmlNoteName(4304);  //内容来源已经设置,请确认是否初始化模板?
                var $fieldJson = that.$showsetContentContainer
                    .find("input[name='field_json']")
                    .filter(function (index, field) {
                        if (field.value) return field;
                    });
                if ($fieldJson.length) {
                    top.Dialog.confirm(msg, function () {
                        that.initDefaultUrlTemplate();
                    });
                } else {
                    that.initDefaultUrlTemplate();
                }
            },
            customSearchChange: function (sourceType, $select) {
                var $option = $('option:selected', $select);
                if (sourceType == 1) {
                    var unreadBadge = $option.data('unreadbadge') || '0';
                    var modeid = $option.data('modeid') || '';
                    var $unreadBadgeDiv = $('#unreadBadge_' + theId).closest('.row');
                    if (modeid == '') {
                        $('#unreadBadge_' + theId).removeAttr('checked');
                        $unreadBadgeDiv.hide().removeAttr('data-sourcetype1-content');
                    } else {
                        $unreadBadgeDiv.show().attr('data-sourcetype1-content', '');
                        if (unreadBadge == '2') {//虚拟表单隐藏未读反馈配置
                            $('#unreadBadge_' + theId).removeAttr('checked');
                            $unreadBadgeDiv.hide().removeAttr('data-sourcetype1-content');
                        } else if (unreadBadge == '1') {
                            $('#unreadBadge_' + theId).checked();
                        } else {
                            $('#unreadBadge_' + theId).removeAttr('checked');
                        }
                    }
                }
            }
        }
    });

    $("#name_" + theId).val(this.mecJson["name"]);

    //展示样式
    fieldPicker('run', {
        id: theId,
        callback: {
            afterSelect: function (field, target) {
                target = $(target);
                target.find('input').val(JSON.stringify(field));
                target.find('.field').html(require('utils').delHtmlTag(field.fielddesc));
                target.removeClass('choosed');
                field.fieldid != 0 && target.addClass('choosed');
                that.autoUpdate();
            }
        }
    });

    var setDataFormatValue = function (data, $list) {
        data && $list.each(function () {
            var $li = $(this);
            var key = $("input[name='key']", $li).val();
            if (data[key]) {
                var $name = $("input[name='name']", $li), $value = $("input[name='value']", $li);
                if ($value.length) {
                    $name.val(data[key].key);
                    $value.val(data[key].value);
                } else {
                    $name.data("last", data[key]).val(data[key]);
                }
            }
        });
    };
    setDataFormatValue(this.mecJson.urlDataFormat, this.$urlDataFormatContainer.find("ul.normal-list > li"));
    setDataFormatValue(this.mecJson.apiDataFormat, this.$apiDataFormatContainer.find("ul.normal-list > li"));

    var showView = this.mecJson.showSet.view;
    var imgfield = showView.imgfield,       //图片字段信息
        imgfieldV = that.formatJson2Value(imgfield),
        $imgfieldWrap = $showsetContentContainer.find(".img-field-row-wrap");
    if (imgfieldV != "") {
        $imgfieldWrap.find("input[name='field_json']").val(imgfieldV);
        imgfield.fieldid != "0" && $imgfieldWrap.addClass("choosed");
        fieldPicker('setField', $imgfieldWrap, imgfield)
    }

    var titlefield = showView.titlefield,   //标题字段信息
        titlefieldV = that.formatJson2Value(titlefield),
        $titlefieldWrap = $showsetContentContainer.find(".title-field-row-wrap");
    if (titlefieldV != "") {
        $titlefieldWrap.find("input[name='field_json']").val(titlefieldV);
        var fielddesc = titlefield["fielddesc"];
        $titlefieldWrap.find(".field").html(that.utils.delHtmlTag(fielddesc));
        if (titlefield.fieldid != "0") {
            $titlefieldWrap.find(".field-col-wrap").addClass("choosed");
        }
        fieldPicker('setField', $titlefieldWrap.find(".field-col-wrap"), titlefield)
    }

    var otherfields = showView.otherfields;
    var $fieldRowWrap = $showsetContentContainer.find(".field-row-wrap").not(".title-field-row-wrap");
    $fieldRowWrap.each(function (i) {
        $(this).find(".field-col-wrap").each(function (j) {
            var $this = $(this),
                colfield = otherfields[i][j],
                colfieldV = that.formatJson2Value(colfield);
            if (colfieldV != "") {
                $this.find("input[name='field_json']").val(colfieldV);
                var fielddesc = colfield["fielddesc"];
                $this.find(".field").html(that.utils.delHtmlTag(fielddesc));
                if (colfield.fieldid != "0") {
                    $this.addClass("choosed");
                }
                fieldPicker('setField', $this, colfield)
            }
        });
    });

    $showsetContentContainer.find(".item-right").sortable({
        revert: false,
        axis: "y",
        items: ".field-row-wrap:not(.title-field-row-wrap)",
        handle: ".move_btn",
        update: function () {
            that.autoUpdate();
        }
    });
    setTimeout(function () { // dom未加载完成, 宽度为0
        that.resizeFieldColWidth();
    }, 50);

    //回复评论
    var sourceData = this.mecJson.sourceData, sourceType = sourceData.sourceType, modeid = sourceData.modeid;
    var commentSettingType = this.mecJson["commentSettingType"];
    var praiseSettingType = this.mecJson["praiseSettingType"];
    var commentSwitch = this.mecJson["commentSwitch"];
    if (this.mecJson.hasOwnProperty("commentSwitch")) {//兼容历史数据
        if (commentSwitch == "1") {
            if (commentSettingType == "1" && (sourceType != "1" ||
                (sourceType == "1" && Number(modeid) <= 0))) {
                commentSettingType = "2";
            }
        } else {
            commentSettingType = "0";
        }
        delete this.mecJson.commentSwitch;
    }
    var $commentSettingType = $("input[type='checkbox'][name='commentSettingType_" + theId + "'][value='" + commentSettingType + "']");
    if ($commentSettingType.length > 0) {
        $commentSettingType.attr("checked", "checked");
    }
    var $praiseSettingType = $("input[type='checkbox'][name='praiseSettingType_" + theId + "'][value='" + praiseSettingType + "']");
    if ($praiseSettingType.length > 0) {
        $praiseSettingType.attr("checked", "checked");
    }
    //判断是否显示评论设置面板
    this.commentOrPraiseSettingsContentShowHide('comment', commentSettingType == "2");
    //判断是否显示点赞设置面板
    this.commentOrPraiseSettingsContentShowHide('praise', praiseSettingType == "2");

    //评论
    $("#commentMainField_" + theId).val(this.mecJson["commentMainField"]);
    this.setCommentPraiseFields('comment', this.mecJson["commentFields"] || []);
    this.setCommentPraiseDatasource('comment', this.mecJson["commentDatasource"] || "$ECOLOGY_SYS_LOCAL_POOLNAME", this.mecJson["commentTablename"]);
    $("#commentPrimaryKeyType_" + theId).val(this.mecJson["commentPrimaryKeyType"] || "1");
    $("#commentFilter_" + theId).val(this.mecJson["commentFilter"] || "");
    MLanguage.setValue($("#commentMsgTitle_" + theId), this.mecJson["commentMsgTitle"] || "");
    $("#commentMsgUrl_" + theId).val(this.mecJson["commentMsgUrl"] || "");

    //点赞
    $("#praiseMainField_" + theId).val(this.mecJson["praiseMainField"]);
    if(this.mecJson["isAllowLike"] == '1'){
        $("#isAllowLike_" + theId).attr("checked", "checked");
    }
    MLanguage.setValue($("#likeShowLabel_" + theId), this.mecJson["likeShowLabel"] || "");
    if(this.mecJson["isAllowDislike"] == '1'){
        $("#isAllowDislike_" + theId).attr("checked", "checked");
    }
    MLanguage.setValue($("#dislikeShowLabel_" + theId), this.mecJson["dislikeShowLabel"] || "");
    this.setCommentPraiseFields('praise', this.mecJson["praiseFields"] || []);
    this.setCommentPraiseDatasource('praise', this.mecJson["praiseDatasource"] || "$ECOLOGY_SYS_LOCAL_POOLNAME", this.mecJson["praiseTablename"]);
    $("#praisePrimaryKeyType_" + theId).val(this.mecJson["praisePrimaryKeyType"] || "1");
    $("#praiseFilter_" + theId).val(this.mecJson["praiseFilter"] || "");

    //快捷搜索
    var quickSearch = this.mecJson["quickSearch"];
    if (quickSearch == "1") {
        $("#quickSearch_" + theId).attr("checked", "checked");
    }
    that.searchContainerShowHide(quickSearch == "1");

    MLanguage.setValue($("#searchTips_" + theId), this.mecJson["searchTips"]);
    $("#searchCondition_" + theId).val(this.mecJson["searchCondition"]);

    var quickSearchColumns = this.mecJson["quickSearchColumns"] || [];
    if (quickSearchColumns.length == 0) {
        $quickSearchColumnContainer.find(".tip-control").show();
    }

    //高级检索
    var advancedSearch = this.mecJson["advancedSearch"];
    if (advancedSearch == "1") {
        $("#advancedSearch_" + theId).attr("checked", "checked");
    }
    that.advancedSearchContainerShowHide(advancedSearch == "1");

    MLanguage.setValue($("#asTitle_" + theId), this.mecJson["asTitle"]);

    that.advancedSearchColumns = this.mecJson["advancedSearchColumns"] || [];

    if (that.advancedSearchColumns.length == 0) {
        $advancedSearchColumnContainer.find(".tip-control").show();
    }
    $advancedSearchColumnContainer.find("ul.normal-list").sortable({
        revert: false,
        axis: "y",
        items: "li",
        handle: ".bemove"
    });

    //自定义按钮
    var customBtns = this.mecJson["customBtns"] || [];
    if (customBtns.length == 0) {
        $customBtnContainer.find(".tip-control").show();
    } else {
        for (var i = 0; i < customBtns.length; i++) {
            this.addOneCustomBtnToPage(customBtns[i]);
        }
    }
    //表单建模页面拓展
    var pageExpand = this.mecJson["pageExpand"];
    if (pageExpand == "1") {
        $("#pageExpand_" + theId).attr("checked", "checked");
    }

    $customBtnContainer.find("ul.normal-list").sortable({
        revert: false,
        axis: "y",
        items: "li",
        handle: ".bemove",
        update: function () {
            that.autoUpdate();
        }
    });

    $("#pageSize_" + theId).val(this.mecJson["pageSize"]);

    $("#pageStart_" + theId).val(this.mecJson["pageStart"]);

    var showOnePage = this.mecJson["showOnePage"];
    if (showOnePage == "1") {
        $("#showOnePage_" + theId).attr("checked", "checked");
    }

    var dataReadonly = this.mecJson["dataReadonly"];
    if (dataReadonly == "1") {
        $("#dataReadonly_" + theId).attr("checked", "checked");
    }

    //数据可选配置check框
    var dataCheck = this.mecJson["dataCheck"];
    if (dataCheck == "1") {
        $("#dataCheck_" + theId).attr("checked", "checked");
    }
    //数据可选操作按钮
    var selectableBtns = this.mecJson["selectableBtns"] || [];
    if (selectableBtns.length == 0) {
        $selectableBtnContainer.find(".tip-control").show();
    } else {
        for (var i = 0; i < selectableBtns.length; i++) {
            this.addSelectableBtnToPage(selectableBtns[i]);
        }
    }
    $selectableBtnContainer.find("ul.normal-list").sortable({
        revert: false,
        axis: "y",
        items: "li",
        handle: ".bemove",
        update: function () {
            that.autoUpdate();
        }
    });

    //首次加载判断列表是否关联模块,关联表单是否为虚拟表单
    var modeId = that.mecJson.sourceData.modeid || '';
    var $unreadBadgeDiv = $('#unreadBadge_' + theId).closest('.row');
    if (modeId == '') {
        $unreadBadgeDiv.hide().removeAttr('data-sourcetype1-content');
    } else {
        var unreadBadge = that.mecJson["unreadBadge"];
        if (unreadBadge == "1") {
            $("#unreadBadge_" + theId).attr("checked", "checked");
        } else {
            this.utils.api('designer/plugin', {
                action: 'getCustomSearchList',
                notification: false,
                data: {}
            }, function (result) {
                var searchId = that.mecJson.sourceData.searchid || '';
                result.data.every(function (item) {
                    if (item.id == searchId) {
                        if (item.unreadBadge == '2') {//unreadBadge=2,虚拟表单隐藏未读反馈配置
                            $unreadBadgeDiv.hide().removeAttr('data-sourcetype1-content');
                        }
                        return false;
                    }
                    return true;
                });
            });
        }
    }

    var lazyLoad = this.mecJson["lazyLoad"];
    if (lazyLoad == "1") {
        $("#lazyLoad_" + theId).attr("checked", "checked");
    }

    //左滑
    var swipeItems = this.mecJson["swipeItems"] || [];
    if (swipeItems.length == 0) {
        $swipeContainer.find(".tip-control").show();
    } else {
        for (var i = 0; swipeItems && i < swipeItems.length; i++) {
            this.addSwipeItemToPage(swipeItems[i]);
        }
    }
    $swipeContainer.find("ul.normal-list").sortable({
        revert: false,
        axis: "y",
        items: "li",
        handle: ".bemove"
    });

    $("#MAD_" + theId).checkbox({
        onClick: function () {
            that.autoUpdate();
        }
    });
};

/*获取JSON*/
MEC_NS.NList.prototype.getMecJson = function () {
    var theId = this.id;

    this.mecJson["id"] = theId;
    this.mecJson["mectype"] = this.type;

    var $attrContainer = $("#MAD_" + theId);
    if ($attrContainer.length > 0) {
        this.mecJson["name"] = $("#name_" + theId).val(); // 名称

        var sourceData = require("sourcePanel").getData(theId);
        this.mecJson["sourceData"] = sourceData;

        this.mecJson["urlDataFormat"] = this.getUrlDataFormat();
        this.mecJson["apiDataFormat"] = this.getApiDataFormat();

        //展示样式
        var showSet = {}, view = {},
            $fieldRowWrap = this.$showsetContentContainer.find(".field-row-wrap").not(".title-field-row-wrap");

        showSet["row"] = $fieldRowWrap.length; //行数
        showSet["col"] = $("#column_" + theId).val();    //列数
        showSet["view"] = view;

        var imgfieldV = this.$showsetContentContainer.find(".img-field-row-wrap input[name='field_json']").val();
        view["imgfield"] = imgfieldV ? $.parseJSON(imgfieldV) : {};        //图片字段信息

        var titlefieldV = this.$showsetContentContainer.find(".title-field-row-wrap input[name='field_json']").val();
        view["titlefield"] = titlefieldV ? $.parseJSON(titlefieldV) : {};      //标题字段信息

        var otherfields = [];
        $fieldRowWrap.each(function () {
            var rowfields = [];
            $(".field-col-wrap", $(this)).each(function () {
                var colV = $("input[name='field_json']", $(this)).val();
                var colfield = colV ? $.parseJSON(colV) : {};
                rowfields.push(colfield);
            });
            otherfields.push(rowfields);
        });
        view["otherfields"] = otherfields;
        this.mecJson["showSet"] = showSet;//后面希望展示样式配置可以统一封装成一个插件,以免重复代码

        var $commentSettingType = $("input[type='checkbox'][name='commentSettingType_" + theId + "']:checked");
        this.mecJson["commentSettingType"] = $commentSettingType.length > 0 ? $commentSettingType.val() : "0";
        this.mecJson["commentMainField"] = $("#commentMainField_" + theId).val();
        this.mecJson["commentDatasource"] = $("#commentDatasource_" + theId).val();
        this.mecJson["commentTablename"] = $("#commentTablename_" + theId).val();
        this.mecJson["commentPrimaryKey"] = $("#commentPrimaryKey_" + theId).val();
        this.mecJson["commentPrimaryKeyType"] = $("#commentPrimaryKeyType_" + theId).val();
        this.mecJson["commentFields"] = this.getCommentPraiseFields('comment');
        this.mecJson["commentFilter"] = $("#commentFilter_" + theId).val();
        this.mecJson["commentMsgTitle"] = MLanguage.getValue($("#commentMsgTitle_" + theId));
        this.mecJson["commentMsgUrl"] = $("#commentMsgUrl_" + theId).val();

        var $praiseSettingType = $("input[type='checkbox'][name='praiseSettingType_" + theId + "']:checked");
        this.mecJson["praiseSettingType"] = $praiseSettingType.length > 0 ? $praiseSettingType.val() : "0";
        this.mecJson["isAllowLike"] = $("#isAllowLike_" + theId).is(":checked") ? "1" : "0";
        this.mecJson["likeShowLabel"] = MLanguage.getValue($("#likeShowLabel_" + theId));
        this.mecJson["isAllowDislike"] = $("#isAllowDislike_" + theId).is(":checked") ? "1" : "0";
        this.mecJson["dislikeShowLabel"] = MLanguage.getValue($("#dislikeShowLabel_" + theId));
        this.mecJson["praiseMainField"] = $("#praiseMainField_" + theId).val();//列表主键字段
        this.mecJson["praiseDatasource"] = $("#praiseDatasource_" + theId).val();
        this.mecJson["praiseTablename"] = $("#praiseTablename_" + theId).val();
        this.mecJson["praisePrimaryKey"] = $("#praisePrimaryKey_" + theId).val();
        this.mecJson["praisePrimaryKeyType"] = $("#praisePrimaryKeyType_" + theId).val();
        this.mecJson["praiseFields"] = this.getCommentPraiseFields('praise');
        this.mecJson["praiseFilter"] = $("#praiseFilter_" + theId).val();

        this.mecJson["quickSearch"] = $("#quickSearch_" + theId).is(':checked') ? "1" : "0";
        this.mecJson["quickSearchColumns"] = this.getQuickSearchColumns();

        this.mecJson["searchTips"] = MLanguage.getValue($("#searchTips_" + theId));   // 搜索提示文字
        this.mecJson["searchCondition"] = $("#searchCondition_" + theId).val();

        this.mecJson["advancedSearch"] = $("#advancedSearch_" + theId).is(':checked') ? "1" : "0";
        this.mecJson["asTitle"] = MLanguage.getValue($("#asTitle_" + theId));
        this.mecJson["advancedSearchColumns"] = this.getAdvanceSearchColumns();

        this.mecJson["pageExpand"] = $("#pageExpand_" + theId).is(':checked') ? "1" : "0";

        this.mecJson["customBtns"] = this.getCustomBtnDatas();

        this.mecJson["pageSize"] = $("#pageSize_" + theId).val();

        this.mecJson["pageStart"] = $("#pageStart_" + theId).val();

        this.mecJson["showOnePage"] = $("#showOnePage_" + theId).is(':checked') ? "1" : "0";

        this.mecJson["dataReadonly"] = $("#dataReadonly_" + theId).is(':checked') ? "1" : "0";

        this.mecJson["dataCheck"] = $("#dataCheck_" + theId).is(':checked') ? "1" : "0";

        this.mecJson["unreadBadge"] = $("#unreadBadge_" + theId).is(':checked') ? "1" : "0";

        this.mecJson["lazyLoad"] = $("#lazyLoad_" + theId).is(':checked') ? "1" : "0";

        this.mecJson["swipeItems"] = this.getSwipeBtnDatas();

        this.mecJson["selectableBtns"] = this.getSelectableBtns();
    }
    return this.mecJson;
};

MEC_NS.NList.prototype.getCopyMecJson = function (mecJson) {
  	var mec = require("mec");
    
    mec.changeMecJsonUUid(mecJson.customBtns, mecJson.quickSearchColumns, mecJson.swipeItems);
};

MEC_NS.NList.prototype.getDefaultMecJson = function () {
    var count = $("abbr[m_type='NList']", "#homepageContainer").length;

    var row = 3;
    var col = 1;

    var showView = {
        imgfield: {},   //图片字段信息
        titlefield: {}, //图片字段信息
        otherfields: []
    };

    for (var i = 0; i < row; i++) {
        var rowfields = [];
        for (var j = 0; j < col; j++) {
            var colfield = {};
            rowfields.push(colfield);
        }
        showView.otherfields.push(rowfields);
    }
    return {
        name: SystemEnv.getHtmlNoteName(4305) + (count + 1), // 列表
        sourceData: {},
        urlDataFormat: {
            DATAS: "datas",
            TOTAL_SIZE: "totalSize"
        },
        showSet: {
            row: row,
            col: col,
            view: showView
        },
        commentMainField: "id",
        commentPrimaryKey: "id",
        commentPrimaryKeyType: "1",
        praiseMainField: "id",
        praisePrimaryKey: "id",
        praisePrimaryKeyType: "1",
        quickSearch: "1",
        searchTips: SystemEnv.getHtmlNoteName(4170), //搜索提示文字     请输入...
        asTitle: SystemEnv.getHtmlNoteName(4179),   //高级检索
        pageStart: "1",
        pageSize: "10"
    }
};

/*加载数据*/
MEC_NS.NList.loadData = function (callback) {
    UrlSelectUtil.nav.loadNavItems(callback);
};

MEC_NS.NList.prototype.getTemplateCommentFields = function () {
    return [
        {
            key: "MAIN_BILLID",
            value: "",
            desc: 6153//主数据关联字段
        },
        {
            key: "REPLY_BILLID",
            value: "",
            desc: 6154//回复评论数据关联字段
        },
        {
            key: "REPLYOR",
            value: "",
            desc: 6156//评论人
        },
        {
            key: "REPLY_DATE",
            value: "",
            desc: 6157//评论日期
        },
        {
            key: "REPLY_TIME",
            value: "",
            desc: 6158//评论时间
        },
        {
            key: "REPLY_CONTENT",
            value: "",
            desc: 6155//评论内容
        }
    ];
};

MEC_NS.NList.prototype.getTemplatePraiseFields = function () {
    return [
        {
            key: "MAIN_BILLID",
            value: "",
            desc: 6153//主数据关联字段
        },
        {
            key: "PRAISER",
            value: "",
            desc: 6260//用户id
        },
        {
            key: "PRAISE_STATUS",
            value: "",
            desc: 5009//状态
        },
        {
            key: "PRAISE_DATE",
            value: "",
            desc: 6261//点赞(踩)日期
        },
        {
            key: "PRAISE_TIME",
            value: "",
            desc: 6262//点赞(踩)时间
        }
    ];
};

MEC_NS.NList.prototype.validate = function () {
    var theId = this.id,
		$pluginAttr = $('#MAD_' + theId),
		selectedFiledid;

    if (!$pluginAttr.length) {
        return true;
    }

    var sourceData = require("sourcePanel").getData(theId),
        sourceType = sourceData.sourceType,
        searchid = sourceData.searchid,
        mockData = sourceData.mockData.trim(),
        sourceSql = sourceData.sourceSql.trim(),
        sourceUrl = sourceData.sourceUrl.trim(),
        sourceApi = sourceData.apiConfig.api.id,
        isValid = (sourceType == 1 && searchid)
            || (sourceType == 2 && mockData)
            || (sourceType == 3 && sourceSql)
            || (sourceType == 4 && sourceUrl)
            || (sourceType == 5 && sourceApi);

    if (isValid) {
        return true;
    } else {
        var sp = require("sourcePanel").getInstance(theId);
        var validate = function (sourceValue, $field, msg, style) {
            !sourceValue && $field.validate({
                value: sourceValue,
                rules: [{
                    msg: '"' + msg + '" ' + SystemEnv.getHtmlNoteName(6041)//未填写
                }],
                style: style
            });
        };

        switch (sourceType) {
            case '1':
                validate(searchid, sp.$.customSearch.parents('.col-m-8'), SystemEnv.getHtmlNoteName(6100));
                break;
            case '2':
                validate(mockData, sp.$.mockData.parents('.col-m-8'), SystemEnv.getHtmlNoteName(6001));
                break;
            case '3':
                validate(sourceSql, sp.$.sourceSql.parents('.col-m-8'), "SQL", { top: '82px' });
                break;
            case '4':
                validate(sourceUrl, sp.$.sourceUrl.parents('.col-m-8'), "URL");
                break;
            case '5':
                validate(sourceApi, sp.$.api.parents('.col-m-8'), SystemEnv.getHtmlNoteName(5268));
                break;
        }

        return {
            isValid: isValid,
            msg: SystemEnv.getHtmlNoteName(6069) //请设置内容来源对应数据!
        };
    }
};

/* 获取列表名称 */
MEC_NS.NList.prototype.getName = function () {
    var theId = this.id;

    var name = this.mecJson["name"];
    if (name == "" || $.trim(name) == "") {
        name = theId;
    }

    return name;
};
//外部调用,如:日历控件
MEC_NS.NList.prototype.getSourceFields = function (sourceData) {
    var sourceFields = [];
    if (this.sourceFields.length) return this.sourceFields;
    require("utils").api("designer/plugin", {
        action: "getSourceFields",
        notification: false,
        type: 'POST',
        async: false,
        data: {
            source: sourceData.sourceType,
            searchid: sourceData.searchid,
            datasource: compressByLZ(sourceData.datasource),
            sql: compressByLZ(sourceData.sourceSql)
        }
    }, function (result) {
        sourceFields = result.data || [];
    });
    return sourceFields;
};

$.extend(MEC_NS.NList.prototype, {
    autoUpdate: function () {
        var mecHandler = MECHandlerPool.getHandler(this.id);
        //避免导入插件到低版本时报错
        mecHandler && mecHandler.autobind && mecHandler.autobind.update();
    },
    bindAttrDlgHtmlEvent: function () {
        var that = this, theId = this.id, $attrContainer = this.$attrContainer;

        $attrContainer.on("click", ".more-info", function (e) {
            var $this = $(this), $blockArea = $this.closest(".block-area");
            $blockArea.find(".block-control").slideToggle(100, function () {
                $this[$(this).is(":visible") ? "addClass" : "removeClass"]("hidden");
            });
        });

        //输出数据key事件绑定
        this.$apiDataFormatContainer.find("ul.normal-list").on("change", "input[data-key='DATAS']", function (e) {
            var $this = $(this),
                resultKey = $this.val(),
                lastValue = $this.data("last");

            if (resultKey !== lastValue) {
                that.doClearFieldsPrompt(SystemEnv.getHtmlNoteName(5263) + "<br/>" + SystemEnv.getHtmlNoteName(5264));//改变KEY会导致展示样式中已选择的字段信息失效,确认要清空吗?
                that.initFieldPicker({ DATAS: resultKey });
                $this.data("last", resultKey);
            }
        });

        //展示样式事件绑定
        //添加列绑定事件
        var $column = $("#column_" + theId);
        this.$showsetConfigContainer.find(".showSet-add-column").click(function () {
            var colV = parseInt($column.val());
            var $rowWrap = that.$showsetContentContainer.find(".showSet-right .field-row-wrap").not(".title-field-row-wrap");
            var colHtml = '<div class="field-col-wrap">'
                + '<span class="field" title="' + SystemEnv.getHtmlNoteName(4139) + '">' + SystemEnv.getHtmlNoteName(4139) + '</span>'  //选择字段
                + '<input type="hidden" name="field_json"/>'
                + '</div>';
            $rowWrap.append(colHtml);
            that.resizeFieldColWidth();
            colV++;
            $column.val(colV);
        });

        this.$showsetConfigContainer.find(".showSet-minus-column").click(function () {
            var colV = parseInt($column.val());
            if (colV <= 1) {
                return;
            }
            var $rowWrap = that.$showsetContentContainer.find(".showSet-right .field-row-wrap").not(".title-field-row-wrap");
            $rowWrap.find(".field-col-wrap:last-child").remove();
            that.resizeFieldColWidth();
            colV--;
            $column.val(colV);
        });

        //添加行绑定事件
        this.$showsetConfigContainer.find(".showSet-add-row").click(function () {
            var $showsetRight = that.$showsetContentContainer.find(".showSet-right");
            var $column = $("#column_" + theId);
            var colV = parseInt($column.val());
            var $rowWrap = $('<div class="field-row-wrap"><div class="move-after move_btn"></div><div class="del-box-after del_btn"></div></div>');
            var colHtml = "";
            for (var i = 0; i < colV; i++) {
                colHtml += '<div class="field-col-wrap">'
                    + '<span class="field" title="' + SystemEnv.getHtmlNoteName(4139) + '">' + SystemEnv.getHtmlNoteName(4139) + '</span>'  //选择字段
                    + '<input type="hidden" name="field_json"/>'
                    + '</div>';
            }
            $rowWrap.append(colHtml);
            $showsetRight.append($rowWrap);
            that.resizeFieldColWidth();
        });

        this.$showsetContentContainer.find(".showSet-right").on("click", ".del_btn", function () {
            $(this).parent().remove();
            that.autoUpdate();
        });

        this.$showsetContentContainer.on("click", ".field-col-wrap, .img-field-row-wrap", function (e) {
            fieldPicker('show', this, theId);
            e.stopPropagation();
        });

        //回复评论
        var $commentSettingType = $("input[type='checkbox'][name='commentSettingType_" + theId + "']");
        $commentSettingType.on("click", function () {
            var type = $(this).val();
            $commentSettingType.each(function () {
                var $this = $(this);
                if ($this.val() != type) {
                    $this.removeProp("checked");
                }
            });
            that.commentOrPraiseSettingsContentShowHide('comment', type == "2" && this.checked);
        });

        //点赞
        var $praiseSettingType = $("input[type='checkbox'][name='praiseSettingType_" + theId + "']");
        $praiseSettingType.on("click", function () {
            var type = $(this).val();
            $praiseSettingType.each(function () {
                var $this = $(this);
                if ($this.val() != type) {
                    $this.removeProp("checked");
                }
            });
            that.commentOrPraiseSettingsContentShowHide('praise', type == "2" && this.checked);
        });

        require(["modal"], function (modal) {
            var indexArr = [];
            $([that.$commentSettingContainer[0], that.$praiseSettingContainer[0]]).on("click", ".helper", function (e) {
                close();
                var helpFor = $(this).attr("for"), tip;
                if ('atLink' == helpFor) {
                    tip = "1、" + SystemEnv.getHtmlNoteName(6185) + "</br>"//支持系统变量、页面参数、列表数据字段替换,格式:{name}
                        + "2、" + SystemEnv.getHtmlNoteName(6186);//如使用移动建模地址请填写发布地址
                } else if ('commentFilter' == helpFor || 'praiseFilter' == helpFor) {
                    tip = "1、" + SystemEnv.getHtmlNoteName(6188) + "</br>"//用来过滤要显示的评论数据,请填写要过滤的sql条件语句
                        + "2、" + SystemEnv.getHtmlNoteName(6190);//支持系统变量、页面参数替换,格式:{name}
                } else {
                    tip = SystemEnv.getHtmlNoteName(6185);//支持系统变量、页面参数、列表数据字段替换,格式:{name}
                }
                indexArr.push(modal.tips(tip, $(this), {
                    area: ['300px', ''],
                    placement: 'atLink' == helpFor ? 'top' : 'right'
                }));
                e.stopPropagation();
            });
            var close = function () {
                indexArr.map(function (v) {
                    modal.close(v);
                });
                indexArr = [];
            };
            $("body").on("click", function (e) {
                var $target = $(e.target);
                var layero = $target.parents(".layui-layer-tips");
                if (layero.length) return;
                close();
            });
        });

        $("#commentDatasource_" + theId).on("change", function () {
            that.commentPraiseDatasourceChange('comment', $(this).val());
        });

        $("#praiseDatasource_" + theId).on("change", function () {
            that.commentPraiseDatasourceChange('praise', $(this).val());
        });

        //回复评论
        var $commentContainer = this.$commentSettingContainer;
        $commentContainer.on("change", ".comment-tablename", function () {
            that.commentPraiseTablenameChange('comment');
        });
        $commentContainer.find(".comment-btn-clear").on("click", function () {
            var datasource = $("#commentDatasource_" + theId).val(),
                tablename = $("#commentTablename_" + theId).val();

            that.utils.api("designer/plugin", {
                action: "removeTablesFromComInfo",
                data: {
                    datasource: datasource
                }
            }, function (result) {
                that.commentPraiseDatasourceChange('comment', datasource, tablename);
            });
        });
        $commentContainer.find(".reply-column-add").click(function () {
            that.addOneCommentOrPraiseFieldToPage('comment', {
                id: new UUID().toString(),
                key: "CUSTOM_FIELD",
                value: "",
                param: ""
            });
        });
        $commentContainer.on("click", ".delFlag", function (e) {
            $(this).closest("li").remove();
        });

        //点赞
        var $praiseContainer = this.$praiseSettingContainer;
        $praiseContainer.on("change", ".praise-tablename", function () {
            that.commentPraiseTablenameChange('praise');
        });
        $praiseContainer.find(".praise-btn-clear").on("click", function () {
            var datasource = $("#praiseDatasource_" + theId).val(),
                tablename = $("#praiseTablename_" + theId).val();

            that.utils.api("designer/plugin", {
                action: "removeTablesFromComInfo",
                data: {
                    datasource: datasource
                }
            }, function (result) {
                that.commentPraiseDatasourceChange('praise', datasource, tablename);
            });
        });
        $praiseContainer.find(".praise-column-add").click(function () {
            that.addOneCommentOrPraiseFieldToPage('praise', {
                id: new UUID().toString(),
                key: "CUSTOM_FIELD",
                value: "",
                param: ""
            });
        });
        $praiseContainer.on("click", ".delFlag", function (e) {
            $(this).closest("li").remove();
        });

        //快捷搜索
        $("#quickSearch_" + theId).click(function () {
            that.searchContainerShowHide(this.checked);
        });

        var $quickSearchColumnContainer = this.$quickSearchColumnContainer;
        $quickSearchColumnContainer.find(".quickSearch-column-add").click(function () {
            that.addOneQuickSearchColumnToPage({
                id: new UUID().toString(),
                fieldid: "",
                fieldName: ""
            });
        });

        //高级检索
        $("#advancedSearch_" + theId).click(function () {
            that.advancedSearchContainerShowHide(this.checked);
        });

        var $advancedSearchColumnContainer = this.$advancedSearchColumnContainer;
        $advancedSearchColumnContainer.find(".advancedSearch-column-add").click(function () {
            if (that.selectedAdSearchColumns.length === that.advanceSourceFields.length) return;
            var $addBtn = $(this);
			var selectedFiledid = [], fieldid, fieldTitle, fieldName;

			that.selectedAdSearchColumns.forEach(function (val) {
				selectedFiledid.push(parseInt(val.fieldid));
			});

            that.advanceSourceFields.every(function (val) {
				if (selectedFiledid.indexOf(val.fieldid) == -1 && !val.encrypted) {
					fieldid = val.fieldid;
					fieldTitle = val.fieldDesc;
					fieldName = val.fieldName;
					that.selectedAdSearchColumns.push({ fieldid: fieldid, fieldTitle: fieldTitle });
                    return false;
				}
				return true;
			})
			that.addOneAdvanceSearchColumnToPage({
				id: new UUID().toString(),
				fieldid: fieldid,
				fieldName: fieldName,
				fieldTitle: fieldTitle,
				quickItems: []
			});
            $addBtn.toggleClass("disabled", that.selectedAdSearchColumns.length == that.advanceSourceFields.length);
        });

        var $customBtnContainer = this.$customBtnContainer;
        //自定义按钮添加事件绑定
        $customBtnContainer.find(".customBtn-add").click(function () {
            that.addOneCustomBtnToPage({
                id: new UUID().toString(),
                btnType: "1",
                btnText: "",
                btnScript: "",
                picType: "0",
                picPath: ""
            });
        });

        //可选操作按钮配置
        var $selectableBtnContainer = this.$selectableBtnContainer;
        $selectableBtnContainer.find(".customBtn-add").click(function () {
            that.addSelectableBtnToPage({
                id: new UUID().toString(),
                btnType: "1",
                action: "0",
                btnText: "",
                btnScript: "",
                picType: "0",
                picPath: ""
            });
        });
        var $swipeContainer = this.$swipeContainer;
        //左滑配置添加事件绑定
        $swipeContainer.find(".add-before").click(function () {
            var $more = $(this).siblings(".more-info");
            if (!$more.hasClass("hidden")) {//内容收缩时展开
                $more.trigger("click");
            }
            that.addSwipeItemToPage({
                id: new UUID().toString(),
                btnType: "1",
                btnText: "",
                btnScript: "",
                picType: "0",
                picPath: "",
                bgColor: "#FF3B30"
            });
        });

        var $btnList = $attrContainer.find("ul.normal-list")
        //列表删除事件绑定,通用
        $btnList.on("click", ".delFlag", function (e) {
            var $this = $(this),
                $list = $this.closest("ul.normal-list"),
                liId = $this.closest("li").attr("id");

            $("#" + liId).remove();
            if ($list.children("li").length == 0) {
                $list.siblings(".tip-control").show();
            }
            that.autoUpdate();
            if($this.hasClass("delAdFieldFlag")){
                var delFildeid = $this.closest("li").find("option:selected").attr("value");
                that.selectedAdSearchColumns.forEach( function( val , ind ){
                    if(val.fieldid == delFildeid){
                        that.selectedAdSearchColumns.splice( ind , 1 );
                    }
                });
                $attrContainer.find(".advancedSearch-column-add").removeClass("disabled");
            }
        });

        //按钮类型change
        $btnList.on("change", "select[name='btnType']", function () {
            that.btnTypeChange($(this).closest("li").attr("id").replace("li_", ""));
            that.autoUpdate();
        });
        //按钮动作change
        $btnList.on("change", "select[name='action']", function () {
            that.btnActionChange($(this).closest("li").attr("id").replace("li_", ""));
            that.autoUpdate();
        });

        //按钮设置图片
        $btnList.on("click", ".img-td>div", function (e) {
            var itemId = $(this).closest("li").attr("id").replace("li_", "");

            var pic_typeV = $("#picType_" + itemId).val() || "0";
            var pic_pathV = $("#picPath_" + itemId).val();
            var params = "pic_type=" + pic_typeV + "&pic_path=" + encodeURIComponent(pic_pathV);

            showPicsetModal(params, function (result) {
                var picType = result["pic_type"];
                var picPath = result["pic_path"];
                $("#picType_" + itemId).val(picType);
                $("#picPath_" + itemId).val(picPath);

                that.setBtnPicPath(itemId, picPath);
                that.autoUpdate();
            });
            e.stopPropagation();
        });
    },
    initCubeReplyPraiseStatus: function () {
        var that = this;
        require("utils").api("designer/plugin", {
            action: "getCubeConfig"
        }, function (result) {
            that.$attrContainer.find("[content4cubemode-reply-opened]")[result.data.isAllowReply ? "show" : "hide"]();
            that.$attrContainer.find("[content4cubemode-praise-opened]")[result.data.isAllowPraise ? "show" : "hide"]();
        });
    },
    getUrlDataFormat: function () {
        return this.getDataFormat(this.$urlDataFormatContainer);
    },
    getApiDataFormat: function () {
        return this.getDataFormat(this.$apiDataFormatContainer);
    },
    getDataFormat: function ($container) {
        var dataFormat = {};
        var $outFormatLi = $container.find("ul.normal-list > li");
        $outFormatLi.each(function () {
            var $li = $(this);
            var key = $("input[name='key']", $li).val();
            var keyName = $("input[name='name']", $li).val();
            var keyValue = $("input[name='value']", $li).val();
            if ($("input[name='value']", $li).length) {
                dataFormat[key] = { key: keyName, value: keyValue };
            } else {
                dataFormat[key] = keyName;
            }
        });
        return dataFormat;
    },
    commentOrPraiseSettingsContentShowHide: function (type, checked) {
        this["$" + type + "SettingContainer"].find("." + type + "Setting-attr-content")[checked ? "show" : "hide"]();
    },

    getCommentPraiseFields: function (type) {
        var $fieldList = this["$" + type + "SettingContainer"].find("ul.normal-list > li"),
            fields = [];
        $fieldList.each(function () {
            var $this = $(this),
                id = $this.data("uuid"),
                fieldKey = $this.find("input[name='fieldKey']").val(),
                fieldVal = $this.find("select[name='fieldName']").val(),
                fieldParam = $this.find("input[name='fieldParam']").val() || "";

            var field = {
                key: fieldKey,
                value: fieldVal,
                param: fieldParam
            };
            id && (field.id = id);
            fields.push(field);
        });
        return fields;
    },
    searchContainerShowHide: function (checked) {
        this.$attrContainer.find(".searchWrapper-attr-container")[checked ? "show" : "hide"]();
    },
    advancedSearchContainerShowHide: function (checked) {
        this.$attrContainer.find(".advancedSearch-attr-container")[checked ? "show" : "hide"]();
    },
    getQuickSearchColumns: function () {
        return this.getSearchColumns(this.$quickSearchColumnContainer);
    },
    getAdvanceSearchColumns: function () {
        return this.getSearchColumns(this.$advancedSearchColumnContainer);
    },
    getSearchColumns: function ($container) {
        var columns = [];
        var $searchColumnLi = $container.find("ul.normal-list > li");
        $searchColumnLi.each(function () {
            var $that = $(this),
                liId = $that.attr("id").substring("li_".length),
                $select = $that.find("select[name='fieldList']"),
                fieldId = $select.val(),
                fieldName = $select.find("option:selected").attr("fieldName");

            var column = {
                id: liId,
                fieldid: fieldId,
                fieldName: fieldName
            };

            var $fieldTitle = $that.find("input[name='fieldTitle']");
            if ($fieldTitle.length) {
                column.fieldTitle = MLanguage.getValue($fieldTitle);
            }
            
            var $quickItems = $that.find("input[name='quickItems']");
            if ($quickItems.length) {
                column.quickItems = $.parseJSON($quickItems.val());
            }

            columns.push(column);
        });
        return columns;
    },
    getSearchFieldOptionHtml: function (defField, isAdvanceSearch) {
        var htm = "",
            mappingValue = false,
            defFieldTitle = defField ? defField.fieldTitle : "";

        var selectedAdSearchColumnsFiledid = [],
            newSourceFields = [];
        this.selectedAdSearchColumns.forEach(function (val) {
            selectedAdSearchColumnsFiledid.push(parseInt(val.fieldid));
        });
        if(isAdvanceSearch){
            this.sourceFields.forEach(function (val) {
                if (selectedAdSearchColumnsFiledid.indexOf(val.fieldid) == -1 || val.fieldid == parseInt(defField.fieldid)) {
                    newSourceFields.push(val)
                }
            });
        } else {
            newSourceFields = this.sourceFields;
        }

        newSourceFields.filter(function (fieldData) {
            var flag = false,
                htmlType = fieldData.htmlType,
                isQuickSearchField = !isAdvanceSearch && (htmlType == 1 || htmlType == 2 || htmlType == 3 || (htmlType == 5 && fieldData.fieldtype != 2)),
                isAdvanceSearchField = isAdvanceSearch && htmlType != 6 && htmlType != 7;
            if (fieldData.sqlField == 1 || isQuickSearchField || isAdvanceSearchField) {
                var isDefSearchField = defField && fieldData.fieldid == defField.fieldid,
                    isDefSqlField = defField && fieldData.sqlField == 1 && fieldData.fieldName == defField.fieldName;

                if (isDefSearchField || isDefSqlField) {
                    mappingValue = true;
                }
                flag = true;
            }
            return flag;// 字段类型(1-单行文本 2-多行文本 3-浏览按钮 5-选择项)
        }).forEach(function (fieldData, index) {
            var isDefSearchField = defField && fieldData.fieldid && fieldData.fieldid == defField.fieldid,
                isDefSqlField = defField && fieldData.sqlField == 1 && fieldData.fieldName == defField.fieldName;
            var selected = "",
                disabled = "",
                fieldTitle = fieldData.fieldDesc || fieldData.fieldName;
            //匹配默认字段
            if ((mappingValue && (isDefSearchField || isDefSqlField)) || (!fieldData.encrypted && !mappingValue && !defField.fieldid)) {
                selected = "selected";
                defField = fieldData;
                !mappingValue && (defFieldTitle = fieldTitle);
            }
            if(fieldData.encrypted){
                disabled = "disabled";
            }

            if (fieldData.sqlField == 1) {
                htm += '<option value="' + fieldData.fieldName + '" fieldName="' + fieldData.fieldName + '" fieldTitle="' + fieldTitle + '" ' + selected + '>';
                htm += fieldData.fieldName;
                htm += "</option>";
            } else {
                htm += '<option value="' + fieldData.fieldid + '" fieldName="' + fieldData.fieldName + '" fieldTitle="' + fieldTitle + '" ' + selected + ' ' + disabled + '>';
                htm += MLanguage.parse(fieldData.fieldDesc) + (fieldData.detailtable ? "-" + SystemEnv.getHtmlNoteName(4865) : "") + (fieldData.encrypted ? "(" + SystemEnv.getHtmlNoteName(6233) + ")" : ""); //6233:不能选择加密字段
                htm += "</option>";
            }
        });
        return {
            htm: htm,
            defField: {
                fieldid: defField.fieldid,
                fieldName: defField.fieldName,
                fieldTitle: defFieldTitle
            }
        };
    },
    doClearFieldsPrompt: function (msg) {
        var that = this;
        if (!this.needClearFields) {//第一次调用直接返回
            this.needClearFields = true;
            return;
        }
        this.resetCommentAndPraiseSetting();
        var tip = msg || SystemEnv.getHtmlNoteName(6111);//是否清空已选择的字段信息?
        var $fieldJson = this.$showsetContentContainer
            .find("input[name='field_json']")
            .filter(function (index, field) {
                if (field.value) return field;
            });

        var theId = this.id,
            sourceData = require("sourcePanel").getData(theId),
            sourceType = sourceData.sourceType;

        var $qsColumnContainer = this.$quickSearchColumnContainer,
            $asColumnContainer = this.$advancedSearchColumnContainer,
            $qsColumnWrap = $qsColumnContainer.find("ul.normal-list"),
            $asColumnWrap = $asColumnContainer.find("ul.normal-list");

        var hasQSColumns = sourceType == "1" && $qsColumnWrap.children().length,
            hasASColumns = sourceType == "1" && $asColumnWrap.children().length;

        var clearSearchColumns = function () {
            $qsColumnWrap.empty();
            that.mecJson["quickSearchColumns"] = [];
            $qsColumnContainer.find(".tip-control").show();
            $asColumnWrap.empty();
            that.mecJson["advancedSearchColumns"] = [];
            $asColumnContainer.find(".tip-control").show();
        };
        if ($fieldJson.length || hasQSColumns || hasASColumns) {
            top.Dialog.confirm(tip, {
                btn: [SystemEnv.getHtmlNoteName(5197), SystemEnv.getHtmlNoteName(6024)]//"是","否"
            }, function () {
                $fieldJson.each(function () {
                    var $fieldValue = $(this);
                    $fieldValue.val("");
                    var $fieldView = $fieldValue.parent().find(".field");
                    if ($fieldView.hasClass("title-field")) {
                        $fieldView.html(SystemEnv.getHtmlNoteName(3534));  //标题
                    } else {
                        $fieldView.html(SystemEnv.getHtmlNoteName(4139));  //选择字段
                    }
                    fieldPicker('resetField', $fieldValue.parent());
                    $fieldValue.closest(".choosed").removeClass("choosed");
                });
                clearSearchColumns();
                that.autoUpdate();
            });
        } else {
            clearSearchColumns();
        }
    },
    initDefaultUrlTemplate: function () {
        var theId = this.id;

        var $imgfieldWrap = this.$showsetContentContainer.find(".img-field-row-wrap");
        var imgfield = { "fieldid": "-1", "fielddesc": "" };
        $imgfieldWrap.removeClass("choosed").find("input[name='field_json']").val(JSON.stringify(imgfield));
        fieldPicker('setField', $imgfieldWrap, imgfield);

        var titleField = { "fieldid": "-1", "fielddesc": "{lastname}" };
        var $titlefieldWrap = this.$showsetContentContainer.find(".title-field-row-wrap");
        $titlefieldWrap.find(".field-col-wrap").addClass("choosed");
        $titlefieldWrap.find("input[name='field_json']").val(JSON.stringify(titleField));
        $titlefieldWrap.find(".field").html("{lastname}");
        fieldPicker('setField', $titlefieldWrap.find(".field-col-wrap"), titleField);

        var $fieldRowWrap = this.$showsetContentContainer.find(".field-row-wrap").not(".title-field-row-wrap");
        var nameField = { "fieldid": "-1", "fielddesc": "{mobile}" };
        $("#column_" + theId).val("1");
        this.$showsetContentContainer.find(".showSet-right .field-row-wrap").not(".title-field-row-wrap").remove();
        var $showsetRight = this.$showsetContentContainer.find(".showSet-right");
        var $rowWrap = $('<div class="field-row-wrap"><div class="move-after move_btn"></div><div class="del-box-after del_btn"></div></div>');
        var colHtml = '<div class="field-col-wrap choosed">'
            + '<span class="field" title="' + SystemEnv.getHtmlNoteName(4139) + '">{mobile}</span>'  //选择字段
            + '<input type="hidden" name="field_json"/>'
            + '</div>';
        $rowWrap.append(colHtml);
        $showsetRight.append($rowWrap);
        $rowWrap.find("input[name='field_json']").val(JSON.stringify(nameField));
        fieldPicker('setField', $rowWrap.find(".field-col-wrap"), nameField);
        this.resizeFieldColWidth();
        this.autoUpdate();
    },
    initFieldPicker: function (options) {
        var theId = this.id,
            data = require("sourcePanel").getData(theId),
            sourceType = data.sourceType;
        var addDataUrlParmFields = function (data, resultKey) {
            var $dataurl = require("sourcePanel").getInstance(theId).$.dataurl;
            $dataurl.data('selectparams', data);
            $dataurl.data('resultKey', resultKey);
        };
        if (sourceType == 1) {
            fieldPicker('change', 'search_' + data.searchid, function (data) { addDataUrlParmFields(data); }, theId);
        } else if (sourceType == 3) {
            var sourceId = "sql_" + data.sourceSql + "_datasource_" + data.datasource;
            fieldPicker('change', sourceId, function (data) { addDataUrlParmFields(data); }, theId);
        } else if (sourceType == 5) {
            var resultKey = options && options.DATAS || "";
            fieldPicker('change', "api_" + data.apiConfig.api.id, function (data) { addDataUrlParmFields(data, resultKey); }, theId, resultKey);
        } else {
            fieldPicker('change', '', function () { }, theId);
            addDataUrlParmFields([]);
        }
    },
    initSourceContent: function (options) {
        var theId = this.id,
            data = require("sourcePanel").getData(theId),
            sourceType = data.sourceType;
        if (sourceType == 5) {
            var $outFormatLi = this.$apiDataFormatContainer.find("ul.outformat-list > li");
            $outFormatLi.each(function () {
                var $li = $(this);
                var _key = $("input[name='key']", $li).val();
                options && options[_key] && $("input[name='name']", $li).val(options[_key]);
            });
        }
    },
    initCubeSourceContent: function () {
        var theId = this.id,
            data = require("sourcePanel").getData(theId),
            sourceType = data.sourceType,
            searchid = data.searchid;
        var $content4cubemode = this.$attrContainer.find("[data-source-content4cubemode]");
        if (sourceType == 1) {
            require("utils").api("designer/plugin", {
                action: "getCubeModeConfig",
                data: {
                    searchid: searchid
                }
            }, function (result) {
                $content4cubemode[result.data.modeid != -1 ? "show" : "hide"]();
            });
        } else {
            $content4cubemode.hide();
        }
    },
    resetCommentAndPraiseSetting: function () {
        var theId = this.id;

        $("input[type='checkbox'][name='commentSettingType_" + theId + "']").removeAttr("checked");
        $("input[type='checkbox'][name='praiseSettingType_" + theId + "']").removeAttr("checked");
        this.$commentSettingContainer.find(".commentSetting-attr-content").hide();
        this.$praiseSettingContainer.find(".praiseSetting-attr-content").hide();
    },
    setCommentPraiseDatasource: function (type, defDatasource, defTablename) {
        var that = this,
            theId = this.id;
        this.utils.api("designer/plugin", {
            action: "getDatasource",
            notification: false,
            data: {}
        }, function (result) {
            var html = result.data.reduce(function (prev, next) {
                var selected = '';
                if (next == defDatasource) {
                    selected = 'selected';
                }
                return prev += '<option value="' + next + '" ' + selected + '>' + next + '</option>';
            }, '<option value="$ECOLOGY_SYS_LOCAL_POOLNAME">(local)</option>');
            $("#" + type + "Datasource_" + theId).html(html);
            that.commentPraiseDatasourceChange(type, defDatasource, defTablename);
        });
    },

    commentPraiseDatasourceChangeBefore: function (type) {
        var theId = this.id,
            $table = $("#" + type + "Tablename_" + theId),
            $tableContainer = $table.parent();

        if ($table.children().length > 0) {
            $tableContainer.empty().append('<select class="form-control ' + type + '-tablename" id="' + type + 'Tablename_' + theId + '"></select>');
            $("#" + type + "Tablename_" + theId).niceSelect()
        }
    },
    commentPraiseDatasourceChange: function (type, defDatasource, defTablename) {
        var that = this,
            theId = this.id;
        this.commentPraiseDatasourceChangeBefore(type);

        var $settingType = $("input[type='checkbox'][name='" + type + "SettingType_" + theId + "']:checked");
        var settingType = $settingType.length > 0 ? $settingType.val() : "0";
        var loading = function (isLoading) {
            if (settingType != "2") return;
            var $datasource = $("#" + type + "Datasource_" + theId),
                $tablename = $("#" + type + "Tablename_" + theId),
                $loading = that.$attrContainer.find(".p-loading." + type + "-loading");
            if (isLoading) {
                $datasource.attr("disabled", true);
                $tablename.attr("disabled", true);
                $loading.show();
            } else {
                $datasource.removeAttr("disabled");
                $tablename.removeAttr("disabled");
                $loading.hide();
            }
        };
        loading(true);

        this.utils.api("designer/plugin", {
            action: "getTablesByDataSource",
            notification: false,
            data: {
                datasource: defDatasource
            }
        }, function (result) {
            loading(false);
            that.setTablenameOption(result.data, defTablename, $("#" + type + "Tablename_" + theId)[0]);
            that.commentPraiseTablenameChange(type);
        }, function (result) {
            loading(false);
        });
    },
    setTablenameOption: function (datas, defTablename, table) {
        var theId = this.id,
            $table = $(table);

        var items = datas.reduce(function(prev, item){
            if(item.table_type != 'VIEW' && item.table_name){
                //选择框不允许空值
                if(!defTablename){
                    defTablename = item.table_name;
                }
                if(item.table_name.toUpperCase() == defTablename.toUpperCase()){
                    var showText = item.table_name + (item.table_type == 'TABLE' ? ' ['+SystemEnv.getHtmlNoteName(4509)+']' : ''); //表
                    $table.empty().append('<option value="'+item.table_name+'" selected>'+showText+'</option>')
                }
                prev.push({
                    id: item.table_name,
                    text: item.table_name + (item.table_type == 'TABLE' ? ' ['+SystemEnv.getHtmlNoteName(4509)+']' : '') //表
                });
            }
            return prev;
        }, []);
        $table.niceSelect({
            pagination: true,
            datas: items,
            pageSize: 200
        });
    },
    commentPraiseTablenameChange: function (type) {
        var that = this, theId = this.id;
        var datasource = $("#" + type + "Datasource_" + theId).val(),
            tablename = $("#" + type + "Tablename_" + theId).val();

        this.utils.api("designer/plugin", {
            action: "getFieldsByTable",
            data: {
                datasource: datasource,
                tablename: tablename,
                formType: 1
            }
        }, function (result) {
            that[type + "FieldDatas"] = result.data;
            that.initCommentPraiseFieldOptionHtml(result.data, type);
        });
    },
    getFieldOptionHtml: function (datas, defVal) {
        return datas.reduce(function (html, item) {
            var column_name = item.column_name;
            var column_label = item.column_label;
            html += '<option value="' + column_name + '"';
            if (defVal && column_name && column_name.toLowerCase() == defVal.toLowerCase()) {
                html += ' selected ';
            }
            if (column_label) {
                column_name = column_name + ' [' + MLanguage.parse(column_label) + ']';
            }
            html += '>' + column_name + '</option>';
            return html;
        }, '<option value=""></option>');
    },
    initCommentPraiseFieldOptionHtml: function (datas, type) {
        var that = this,
            fields = this.mecJson[type + "Fields"] || [],
            $container = this["$" + type + "SettingContainer"];
        var getFieldNameByKey = function (key, uuid) {
            var fieldName = "", isCustomField = key === 'CUSTOM_FIELD';
            fields.every(function (ele) {
                if ((isCustomField && ele.id == uuid)
                    || (!isCustomField && ele.key == key)) {
                    fieldName = ele.value;
                    return false;
                }
                return true;
            });
            return fieldName;
        };
        $container.find("ul.normal-list > li").each(function () {
            var $this = $(this),
                fieldKey = $this.find("input[name='fieldKey']").val(),
                fieldName = getFieldNameByKey(fieldKey, $this.data("uuid")),
                fieldOptionHtml = that.getFieldOptionHtml(datas, fieldName, type);

            $this.find("select[name='fieldName']").html(fieldOptionHtml);
        });
        $("#" + type + "PrimaryKey_" + this.id).html(that.getFieldOptionHtml(datas, this.mecJson[type + "PrimaryKey"] || "id", type))
    },

    setCommentPraiseFields: function (type, defFields) {
        if (!defFields) return;
        var that = this;
        var templateFields = [];
        if(type == 'praise'){
            templateFields = this.getTemplatePraiseFields();
        } else {
            templateFields = this.getTemplateCommentFields();
        }
        for (var i = 0; i < templateFields.length; i++) {
            var templateField = templateFields[i];
            defFields.every(function (field) {
                if (field.key == templateField.key) {
                    templateField.value = field.value;
                    return false;
                }
                return true;
            });
            this.addOneCommentOrPraiseFieldToPage(type, templateField, true);
        }
        defFields.filter(function (ele) {
            return ele.key === 'CUSTOM_FIELD';
        }).forEach(function (ele) {
            that.addOneCommentOrPraiseFieldToPage(type, ele, true);
        });
    },

    addOneCommentOrPraiseFieldToPage: function (type, result, init) {
        var that = this;
        var uuid = result.id || '',
            fieldName = result.value,
            fieldKey = result.key,
            fieldParam = result.param,
            fieldDesc = SystemEnv.getHtmlNoteName(result.desc),
            customField = fieldKey === 'CUSTOM_FIELD';

        var htm = '<li data-uuid="'+uuid+'">';
            htm += '<div>';
                htm += '<table>';
                    htm += '<tr>';
                        htm += '<td width="*">';
                            htm += '<input name="fieldKey" type="hidden" value="'+fieldKey+'"/>';
                            htm += '<select name="fieldName">';
                            htm += '</select>';
                        htm += '</td>';
                        htm += '<td width="100px">';
                            if(customField){
                                htm += '<input name="fieldParam" type="text" value="'+fieldParam+'" class="form-control" placeholder="'+SystemEnv.getHtmlNoteName(6189)+'"/>';//字段值
                            }else{
                                htm += '<div class="fieldDesc">'+fieldDesc+'</div>';
                            }
                        htm += '</td>';
                        htm += '<td width="20px" style="position:relative;">';
                            if(customField){
                                htm += '<div class="helper" for="field" style="top:8px;">?</div>';
                            }
                        htm += '</td>';
                        htm += '<td width="22px" style="position:relative;">';
                            if(customField){
                                htm += '<div class="del-after2 delFlag"></div>';
                            }
                        htm += '</td>';
                    htm += '</tr>';
                    if(fieldKey === "REPLY_CONTENT"){
                    	htm += '<tr>';
                    		htm += '<td colspan="4" style="padding:4px 0px 0px 3px;color:#8f8f94;">'+SystemEnv.getHtmlNoteName(6253)+'</td>';//评论内容可能较大,请确保字段长度足够。
                    	htm += '</tr>';
                    }
                htm += '</table>';
            htm += '</div>';
        htm += '</li';
        var $li = $(htm);
        that["$" + type + "SettingContainer"].find("ul.normal-list").append($li);
        if (!init) {
            $li.find('select').niceSelect();
            if (that[type + "FieldDatas"]) {
                $li.find("select[name='fieldName']").html(that.getFieldOptionHtml(that[type + "FieldDatas"], '', type));
            }
        }
    },
    initQuickSearchColumns: function () {
        var that = this,
            $qsColumnUl = this.$quickSearchColumnContainer.find("ul.normal-list"),
            quickSearchColumns = this.mecJson["quickSearchColumns"] || [];
        if ($qsColumnUl.children("li").length > 0) {
            quickSearchColumns = that.getQuickSearchColumns();
            $qsColumnUl.empty();
        }
        quickSearchColumns.forEach(function (column) {
            that.addOneQuickSearchColumnToPage(column);
        });
    },
    addOneQuickSearchColumnToPage: function (result) {
        var that = this,
            id = result["id"],
            option = that.getSearchFieldOptionHtml(result, false, that.advancedSearchColumns),
            defField = option.defField,
            fieldName = defField.fieldName;
        
        var $li = $('<li id="li_'+id+'"></li>');
        var htm = '<div>';
            htm += '<table>';
                htm += '<tr>';
                    htm += '<td width="*">';
                        htm += '<select name="fieldList">';
                            htm += '<option value="" fieldName=""></option>';
                            htm += option.htm;
                        htm += '</select>';
                    htm += '</td>';
                    htm += '<td width="91px">';
                        htm += '<div class="fieldName">'+fieldName+'</div>';
                    htm += '</td>';
                    htm += '<td width="24px">';
                        htm += '<span class="del-after2 delFlag"></span>';
                    htm += '</td>';
                htm += '</tr>';
            htm += '</table>';
        htm += '</div>';
        $li.html(htm);

        this.$quickSearchColumnContainer.find("ul.normal-list").append($li);
        this.$quickSearchColumnContainer.find(".tip-control").hide();

        $("select", $li).niceSelect();

        $li.find("select[name='fieldList']").on("change", function () {
            var fieldName = $(this).find("option:selected").attr("fieldName");
            $li.find(".fieldName").html(fieldName);
        });
    },
    initAdvanceSearchColumns: function () {
        var that = this,
            $asColumnUl = this.$advancedSearchColumnContainer.find("ul.normal-list");
            that.advancedSearchColumns = this.mecJson["advancedSearchColumns"] || [];

        if ($asColumnUl.children("li").length > 0) {
            that.advancedSearchColumns = that.getAdvanceSearchColumns();
            $asColumnUl.empty();
        }

        that.selectedAdSearchColumns = that.advancedSearchColumns;
        var tag = that.selectedAdSearchColumns.length == that.advanceSourceFields.length;
        this.$attrContainer.find(".advancedSearch-column-add").toggleClass("disabled", tag);
        that.advancedSearchColumns.forEach(function (column) {
            that.addOneAdvanceSearchColumnToPage(column);
        });
    },
    addOneAdvanceSearchColumnToPage: function (result) {
        var that = this,
            id = result["id"],
            option = that.getSearchFieldOptionHtml(result, true),
            defField = option.defField,
            fieldTitle = defField.fieldTitle,
            quickItems = result.quickItems || [];
        
        var getFieldById = function(fieldid){
            return that.sourceFields.filter(function(field){ return fieldid == field.fieldid; })[0] || {};
        };
        var isNumOrDateField = function(currFieldid){
            var currField = getFieldById(currFieldid);
            var fieldtype = currField.fieldtype;
            return (currField.htmlType == 1 && fieldtype != 1) 
                || (currField.htmlType == 3 && (fieldtype == 2 || fieldtype == 19 || fieldtype == 290));
        };
        var currField = getFieldById(result.fieldid);
        var haveQuickCondition = isNumOrDateField(result.fieldid);
        var $li = $('<li id="li_'+id+'" data-htmltype="'+currField.htmlType+'" data-fieldtype="'+currField.fieldtype+'"></li>');
        var htm = '<div>';
            htm += '<table>';
                htm += '<tr>';
                    htm += '<td class="bemove" width="20px"></td>';
                    htm += '<td width="*">';
                        htm += '<select name="fieldList">';
                            htm += '<option value="" fieldName=""></option>';
                            htm += option.htm;
                        htm += '</select>';
                    htm += '</td>';
                    htm += '<td width="150px">';
                        htm += '<input name="fieldTitle" type="text" class="form-control" placeholder="'+SystemEnv.getHtmlNoteName(3539)+'"/>';  //显示名称
                    htm += '</td>';
                    htm += '<td width="20%" style="position:relative;text-align:center;padding-right:0;">';
                        htm += '<input type="hidden" name="quickItems"/>';
                            htm += '<div class="self quickItems"'+(haveQuickCondition ? ' style="display:none;"': '')+'>'+SystemEnv.getHtmlNoteName(4168)/*无*/+'</div>';
                            htm += '<div class="custom quickItems"'+(!haveQuickCondition ? ' style="display:none;"': '')+'>';
                                htm += '<span class="edit-before quick-contion-edit">'+SystemEnv.getHtmlNoteName(6208)/*设置*/+'</span>';
                            htm += '</div>';
                    htm += '</td>';
                    htm += '<td width="24px">';
                        htm += '<span class="del-after2 delAdFieldFlag delFlag"></span>';
                    htm += '</td>';
                htm += '</tr>';
            htm += '</table>';
        htm += '</div>';
        $li.html(htm);

        this.$advancedSearchColumnContainer.find("ul.normal-list").append($li);
        this.$advancedSearchColumnContainer.find(".tip-control").hide();

        MLanguage.setValue($li.find("input[name='fieldTitle']"), fieldTitle);
        $li.find("input[name='quickItems']").val(JSON.stringify(quickItems));

        $li.find("select[name='fieldList']").on("change", function (e) {
            var fieldTitle = $(this).find("option:selected").attr("fieldTitle");
            MLanguage.setValue($li.find("input[name='fieldTitle']"), fieldTitle);
        }).on("select2:select", function (e) {
            var fieldid = e.params.data.id;
            var selectField = getFieldById(fieldid);
            $li.data("htmltype", selectField.htmlType).data("fieldtype", selectField.fieldtype);
            that.quickConditionShowHide(isNumOrDateField(fieldid), $li);
            that.selectedFiledid = fieldid;
            that.selectedAdSearchColumns.push({ 
				fieldid: that.selectedFiledid,
				fieldTitle: e.params.data.text 
			});
        }).on("select2:selecting", function (e) {
            var preSelectedFiledid = $(e.target).find("option:selected").attr("value");
            var preSelectedIndex = 0;
            that.selectedAdSearchColumns.forEach(function (val, ind) {
                if (val.fieldid == preSelectedFiledid) {
                    preSelectedIndex = ind;
                }
            })
            that.selectedAdSearchColumns.splice(preSelectedIndex, 1);
        }).on("select2:opening", function (e) {
            var result = { fieldid: $(e.target).find("option:selected").attr("value") };
            option = that.getSearchFieldOptionHtml(result, true);

            $li.find("select[name='fieldList']").html( option.htm )
        });
        $li.find(".quick-contion-edit").on("click", function(){
            var $li = $(this).closest("li"), 
                htmltype = $li.data("htmltype"),
                fieldtype = $li.data("fieldtype"),
                quickItems = $.parseJSON($li.find("input[name='quickItems']").val());
            that.utils.openRcDialog("quick-condition-edit", {
                title: SystemEnv.getHtmlNoteName(6212),//快捷条件设置
                params: {
                    config: {
                        quickItems: quickItems,
                        isDate: htmltype == 3 && (fieldtype == 2 || fieldtype == 290),
                        isTime: htmltype == 3 && fieldtype == 19
                    }
                }
            }, function(result) {
                $li.find("input[name='quickItems']").val(JSON.stringify(result));
            });
        });
        $li.MLanguage();
        $("select", $li).niceSelect();
    },
    quickConditionShowHide: function(isNumType, $container){
        $container.find(".quickItems.self")[isNumType ? "hide" : "show"]();
        $container.find(".quickItems.custom")[isNumType ? "show" : "hide"]();
    },
    getSwipeBtnDatas: function () {
        return this.getBtnDatas(this.$swipeContainer);
    },
    getCustomBtnDatas: function () {
        return this.getBtnDatas(this.$customBtnContainer);
    },
    getSelectableBtns: function () {
        return this.getBtnDatas(this.$selectableBtnContainer);
    },
    getBtnDatas: function ($container) {
        var btnDatas = [];
        var $btnLi = $container.find("ul.normal-list > li");
        $btnLi.each(function () {
            var $that = $(this),
                btnId = $that.attr("id").substring("li_".length),
                btnType = $that.find("select[name='btnType']").val(),
                action = $that.find("select[name='action']").val(),
                btnText = MLanguage.getValue($that.find("input[name='btnText']")),
                btnScript = $that.find("input[name='btnScript']").val(),
                picType = $that.find("#picType_" + btnId).val(),
                picPath = $that.find("#picPath_" + btnId).val();

            var btnData = {
                id: btnId,
                btnType: btnType,
                action: action,
                btnText: btnText,
                btnScript: btnScript,
                picType: picType,
                picPath: picPath
            };
            var $bgColor = $that.find("input[name='bgColor']");
            if ($bgColor.length) {
                btnData.bgColor = $bgColor.val();
            }
            btnDatas.push(btnData);
        });
        return btnDatas;
    },
    addOneCustomBtnToPage: function (result) {
        this.addBtnToPage(result, this.$customBtnContainer, {
            style: false
        });
    },
    addSwipeItemToPage: function (result) {
        var clickScriptTip = "";
        if (_userLanguage == "8") {
            clickScriptTip = "/*\n\tyou can get rowdata or target dom with this, this format like: {target: ..., rowData: {...}}" +
                "\n\tvar rowData = this.rowData;//rowdata\n*/";
        } else if (_userLanguage == "9") {
            clickScriptTip = "/*\n\t可通過this對象獲取行數據以及dom對象,this對象格式:{target: ..., rowData: {...}}" +
                "\n\tvar rowData = this.rowData;//獲取行數據\n*/";
        } else {
            clickScriptTip = "/*\n\t可通过this对象获取行数据以及dom对象,this对象格式:{target: ..., rowData: {...}}" +
                "\n\tvar rowData = this.rowData;//获取行数据\n*/";
        }
        this.addBtnToPage(result, this.$swipeContainer, {
            style: true,
            scriptTip: clickScriptTip
        });
    },
    addBtnToPage: function (result, $container, options) {
        options = $.extend({}, options);

        var resultId = result["id"];
        var $ul = $container.find("ul.normal-list");
        var $li = $('<li id="li_' + resultId + '"></li>');
        var htm = '<table>';
            htm += '<tbody>';
                htm += '<tr>';
                    htm += '<td class="bemove" width="20px"></td>';
                    htm += '<td width="65px" id="typeTD_'+resultId+'">';
                        htm += '<select name="btnType" style="padding-left: 10px;">';
                            htm += this.btnOptionHtml("btnType");
                        htm += '</select>';
                    htm += '</td>';

                    htm += '<td width="82px" id="actionTD_'+resultId+'">';
                        htm += '<div style="position: relative">';
                            htm += '<select name="action" class="form-control" data-autobind data-placeholder="'+ SystemEnv.getHtmlNoteName(5069) +'">';	//动作
                                htm += '<option value=""></option>';
                                htm += this.btnOptionHtml("btnAction");
                            htm += '</select>';
                        htm += '</div>';
                    htm += '</td>';
                
                    htm += '<td width="*" valign="middle" id="textTD_'+resultId+'">';
                        htm += '<input name="btnText" data-autobind type="text" class="form-control" placeholder="'+SystemEnv.getHtmlNoteName(4177)+'"/>';  //按钮名称
                    htm += '</td>';
                    
                    htm += '<td width="*" class="img-td" id="imgTD_'+resultId+'" style="display: none;">';
                        htm += '<div style="width:40px;"><img class="icon" id="pic_img_'+resultId+'" src="/mobilemode/images/mec/add-img-btn_wev8.png"></div>';
                        htm += '<input type="hidden" id="picType_'+resultId+'"/>';
                        htm += '<input type="hidden" id="picPath_'+resultId+'" iconwidth="" iconheight=""/>';
                    htm += '</td>';
                    
                    if(options.style){
                        htm += '<td width="30px">';
                            htm += '<button name="colorpick" class="colorBox" type="button" title="'+SystemEnv.getHtmlNoteName(4236)+'" style="margin-left:2px;background-color:' + result.bgColor + ';"/>';  //取色器
                            htm += '<input type="hidden" name="bgColor"/>';
                        htm += '</td>';
                    }

                    htm += '<td width="86px" id="scriptTD_'+resultId+'">';
                        htm += '<div class="click-control">';
                            htm += '<input name="btnScript" type="hidden"/>';
                            htm += SystemEnv.getHtmlNoteName(4178);  //单击事件
                        htm += '</div>';
                    htm += '</td>';

                    htm += '<td width="90px" id="noneTD_'+resultId+'"></td>';
                    
                    htm += '<td width="24px">';
                        htm += '<span class="del-after2 delFlag"></span>';
                    htm += '</td>';
                    
                htm += '</tr>';
            htm += '</tbody>';
        htm += '</table>';
        $li.html(htm);
        $ul.append($li);

        MLanguage.setValue($("input[name='btnText']", $li), result["btnText"]);

        $("select[name='btnType']", $li).val(result["btnType"] || "1");
        $("select[name='action']", $li).val(result["action"] || "3");
        $("#picType_" + resultId).val(result["picType"]);
        $("#picPath_" + resultId).val(result["picPath"]);
        options.style && $("input[name='bgColor']", $li).val(result["bgColor"]);
        if (options.withAction) {
            $("#typeTD_" + resultId, $li).hide();
        } else {
            $("#actionTD_" + resultId, $li).hide();
        }
        this.btnActionChange(resultId);
        this.btnTypeChange(resultId);
        this.setBtnPicPath(resultId, result['picPath']);

        var btnScript = result["btnScript"];
        $("input[name='btnScript']", $li)[0].value = btnScript;
        var $clickControl = $(".click-control", $li);

        $clickControl.click(function () {
            var $this = $(this);
            var $btnScript = $("input[name='btnScript']", $this);
            var fieldV = $.trim($btnScript.val());
            if (fieldV == "") {
                fieldV = options.scriptTip || "";
                $btnScript.val(fieldV);
            }
            SL_AddScriptToField($btnScript);
        });

        SL_ChangeStyle($clickControl, btnScript);

        $li.find('select').niceSelect();
        $li.MLanguage();

        options.style && $(".colorBox", $li).colpick({
            colorScheme: 'dark',
            layout: 'rgbhex',
            color: result.bgColor,
            onSubmit: function (hsb, hex, rgb, el) {
                var eleId = $(el).attr("id");
                var colorValue = "#" + hex;
                $("input[name='bgColor']", $li).val(colorValue);
                $(el).css('background-color', colorValue);
                $(el).colpickHide();
            }
        });

        $container.find(".tip-control").hide();
    },
    btnActionChange: function (itemId) {
        var $li = $("#li_" + itemId);
        var action = $("select[name='action']", $li).val();
        if (action == "3") {
            $("#scriptTD_" + itemId, $li).show();
            $("#noneTD_" + itemId, $li).hide();
        } else {
            $("#scriptTD_" + itemId, $li).hide();
            $("#noneTD_" + itemId, $li).show();
        }
        $("select[name='action']", $li).change(function () {
            var text = $("select[name='action'] option:selected", $li).text();
            $("select[name='action']", $li).val() == "3" ? $("input[name='btnText']", $li).val("") : MLanguage.setValue($("input[name='btnText']", $li), text);
        });
    },
    btnTypeChange: function (itemId) {
        var $li = $("#li_" + itemId);
        var btnType = $("select[name='btnType']", $li).val();
        if (btnType == "1") {
            $("#textTD_" + itemId, $li).show();
            $("#imgTD_" + itemId, $li).hide();
        } else if (btnType == "2") {
            $("#textTD_" + itemId, $li).hide();
            $("#imgTD_" + itemId, $li).show();
        }
    },
    setBtnPicPath: function (itemId, picPath) {
        var $picImg = $("#pic_img_" + itemId);
        if (picPath && picPath != "") {
            if (picPath.indexOf("/mobilemode/piclibrary/qn_ffffff") === 0) {
                $picImg.css({ "background-color": "#eee", "border-radius": "3px" });
            }
            $picImg[0].src = picPath;
        } else {
            $picImg[0].src = "/mobilemode/images/mec/add-img-btn_wev8.png";
        }
    },
    formatJson2Value: function (jsonObj) {
        return $.isEmptyObject(jsonObj) ? "" : JSON.stringify(jsonObj);
    },
    resizeFieldColWidth: function () {
        var $rowWrap = this.$showsetContentContainer.find(".showSet-right .field-row-wrap").not(".title-field-row-wrap");
        $rowWrap.each(function () {
            var rowWidth = parseInt($(this).width());
            rowWidth = rowWidth > 0 ? rowWidth : 186;
            var $colWrap = $(".field-col-wrap", $(this));
            var colCount = parseInt($colWrap.length);
            var colWidth = parseInt(rowWidth / colCount);
            var lastColWidth = colWidth + (rowWidth - (colWidth * colCount));
            var colWidthArr = new Array();
            for (var i = 0; i < colCount; i++) {
                if (i != (colCount - 1)) {
                    colWidthArr.push(colWidth);
                } else {
                    colWidthArr.push(lastColWidth);
                }
            }
            $colWrap.each(function (i) {
                $(this).width(colWidthArr[i]);
            });
        });
    },
    addSelectableBtnToPage: function (result) {
        this.addBtnToPage(result, this.$selectableBtnContainer, {
            withAction: true,
        });
    },
    btnOptionHtml: function (btnOptionType) {
        var optionHtml = "";
        if (btnOptionType == "btnAction") {
            optionHtml += '<option value="1">'+SystemEnv.getHtmlNoteName(3443)+'</option>';// 全选
            optionHtml += '<option value="2">'+SystemEnv.getHtmlNoteName(3516)+'</option>';// 取消
            optionHtml += '<option value="3">'+SystemEnv.getHtmlNoteName(3916)+'</option>';// 自定义
        } else if (btnOptionType == "btnType") {
            optionHtml += '<option value="1">'+SystemEnv.getHtmlNoteName(4373)+'</option>';  //文字
            optionHtml += '<option value="2">'+SystemEnv.getHtmlNoteName(4167)+'</option>';  //图片
        }
        return optionHtml;
    }
});