• wangxl's avatar
    1111 · 03ee5d29
    wangxl authored
    03ee5d29
conclusionEdit.vue 42.9 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
<template>
  <div class="app-content" style="max-height:75vh;overflow:auto;">
    <a-spin :spinning="loading" style="width:100%;height:100%;">
      <a-form-model ref="from" :model="formData" :rules="rules" style="border-top: 0px" class="from-table font-line-space">
        <a-row>
          <a-col :span="24" style="border-top: 0px;">
            <div class="tb-title">
              <span>基础信息</span>
            </div>
          </a-col>
        </a-row>
        <a-row type="flex">
          <a-col :span="4" class="bg-gray">
            <div class="special-middle">
              <div>项目合同编号</div>
            </div>
          </a-col>
          <a-col :span="20">
            <a-form-model-item prop="projNo">
              {{formData.projNo}}
              <!-- <a-input placeholder="项目合同编号" v-model="formData.projNo" :maxLength="50" style="width: 80%" /> -->
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row type="flex">
          <a-col :span="4" class="bg-gray">
            <div class="special-middle">
              <div>项目名称</div>
            </div>
          </a-col>
          <a-col :span="20">
            <a-form-model-item prop="projName">
              {{formData.projName}}
              <!-- <a-input placeholder="项目名称" v-model="formData.projName" :maxLength="100" style="width: 80%" /> -->
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row type="flex">
          <a-col :span="4" class="bg-gray">
            <div class="special-middle">
              <div>项目负责人</div>
            </div>
          </a-col>
          <a-col :span="8">
            <a-form-model-item prop="personName">
              {{formData.appPersonName}}
              <!-- <a-input placeholder="项目负责人" v-model="formData.personName" :maxLength="50" style="width: 80%" /> -->
            </a-form-model-item>
          </a-col>
          <a-col :span="4" class="bg-gray">
            <div class="special-middle">
              <div>联系电话</div>
            </div>
          </a-col>
          <a-col :span="8">
            <div class="special-middle">
              <a-form-model-item prop="telephone">
                {{formData.telephone}}
                <!-- <a-input placeholder="联系电话" v-model="formData.telephone" :maxLength="50" style="width: 80%" /> -->
              </a-form-model-item>
            </div>
          </a-col>
        </a-row>
        <a-row type="flex">
          <a-col :span="4" class="bg-gray">
            <div class="special-middle">
              <div>项目承担单位</div>
            </div>
          </a-col>
          <a-col :span="20">
            <a-form-model-item prop="unitName">
              {{formData.appUnitName}}
              <!-- <a-input placeholder="承担单位" v-model="formData.appUnitName" :maxLength="50" style="width: 80%" /> -->
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row type="flex">
          <a-col :span="4" class="bg-gray">
            <div class="special-middle">
              <div class="required">计划类别</div>
            </div>
          </a-col>
          <a-col :span="20">
            <a-form-model-item prop="planCategory">
              <a-input placeholder="计划类别" v-model="formData.planCategory" :maxLength="50" style="width: 80%" />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row type="flex">
          <a-col :span="4" class="bg-gray">
            <div class="special-middle">
              <div class="required">研究周期</div>
            </div>
          </a-col>
          <a-col :span="20">
            <a-form-model-item prop="startDate" style="width:200px;display: inline-block;">
              <a-date-picker format="YYYY-MM-DD" valueFormat="YYYY-MM-DD HH:mm:ss" v-model="formData.startDate" style="width: 180px" />
            </a-form-model-item>
            <span style="margin: -12px 10px 0 0px">~</span>
            <a-form-model-item prop="endDate" style="width:200px;display: inline-block;">
              <a-date-picker format="YYYY-MM-DD" valueFormat="YYYY-MM-DD HH:mm:ss" v-model="formData.endDate" style="width: 180px" />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row>
          <a-col :span="24" style="border-top: 0px;">
            <div class="tb-title">
              <span>完成或推广情况</span>
            </div>
          </a-col>
        </a-row>
        <a-row type="flex">
          <a-col :span="5" class="bg-gray">
            <div class="special-middle">
              <div class="required">研究或推广内容完成情况</div>
            </div>
          </a-col>
          <a-col :span="19">
            <div class="special-middle">
              <a-form-model-item prop="promotionContent">
                <para-radio v-model="formData.promotionContent" :typeId="60" :code="'1'" />
              </a-form-model-item>
            </div>
          </a-col>
        </a-row>
        <a-row type="flex">
          <a-col :span="5" class="bg-gray">
            <div class="special-middle">
              <div class="required">研究或推广目标实现情况</div>
            </div>
          </a-col>
          <a-col :span="19">
            <div class="special-middle">
              <a-form-model-item prop="promotionTarget">
                <para-radio v-model="formData.promotionTarget" :typeId="60" :code="'2'" />
              </a-form-model-item>
            </div>
          </a-col>
        </a-row>
        <a-row type="flex">
          <a-col :span="5" class="bg-gray">
            <div class="special-middle">
              <div class="required">研究水平的自我评价</div>
            </div>
          </a-col>
          <a-col :span="19">
            <div class="special-middle">
              <a-form-model-item prop="selfEvaluation">
                <para-radio v-model="formData.selfEvaluation" :typeId="60" :code="'3'" />
              </a-form-model-item>
            </div>
          </a-col>
        </a-row>
        <a-row type="flex">
          <a-col :span="5" class="bg-gray">
            <div class="special-middle">
              <div class="required">取得成果情况</div>
            </div>
          </a-col>
          <a-col :span="19">
            <div class="special-middle">
              <a-form-model-item prop="achievingResults">
                <para-radio v-model="formData.achievingResults" :typeId="60" :code="'4'" />
              </a-form-model-item>
            </div>
          </a-col>
        </a-row>

        <a-row>
          <a-col :span="24" style="border-top: 0px;">
            <div class="tb-title">
              <span>论文发表情况(省级以上刊物)</span>
            </div>
          </a-col>
        </a-row>
        <a-row type="flex" class="row_center">
          <a-col :span="6" class="bg-gray">
            <div class="special-middle">
              <div class="required">论文名称</div>
            </div>
          </a-col>
          <a-col :span="3" class="bg-gray">
            <div class="special-middle">
              <div class="required">作者姓名</div>
            </div>
          </a-col>
          <a-col :span="3" class="bg-gray">
            <div class="special-middle">
              <div class="required">发表年月</div>
            </div>
          </a-col>
          <a-col :span="3" class="bg-gray">
            <div class="special-middle">
              <div class="required">发表在何种刊物</div>
            </div>
          </a-col>
          <a-col :span="3" class="bg-gray">
            <div class="special-middle">
              <div class="required">国内外反映应用情况</div>
            </div>
          </a-col>
          <a-col :span="5" class="bg-gray">
            <div class="special-middle">
              <div class="required">论文上传</div>
            </div>
          </a-col>
          <a-col :span="1" class="bg-gray">
            <div class="special-middle">
              <div>操作</div>
            </div>
          </a-col>
        </a-row>
        <a-row v-for="(thesis, index) in formData.thesisList" :key="'thesisList'+index" type="flex" class="row_center">
          <a-col :span="6">
            <a-form-model-item :prop="'thesisList.' + index + '.name'" :rules="{ required: true, message: '*', trigger: 'blur',}">
              <a-input v-model="thesis.name" :maxLength="50" placeholder="论文名称" style="width:85%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="3">
            <a-form-model-item :prop="'thesisList.' + index + '.author'" :rules="{ required: true, message: '*', trigger: 'blur',}">
              <a-input v-model="thesis.author" :maxLength="25" placeholder="作者姓名" style="width:85%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="3">
            <a-form-model-item :prop="'thesisList.' + index + '.publishDate'" :rules="{ required: true, message: '*', trigger: 'change',}">
              <a-month-picker format="YYYY-MM" valueFormat="YYYY-MM" v-model="thesis.publishDate" style="width:85%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="3">
            <a-form-model-item :prop="'thesisList.' + index + '.publication'" :rules="{ required: true, message: '*', trigger: 'blur',}">
              <a-input v-model="thesis.publication" :maxLength="100" placeholder="发表在何种刊物" style="width:85%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="3">
            <a-form-model-item :prop="'thesisList.' + index + '.application'" :rules="{ required: true, message: '*', trigger: 'blur',}">
              <a-input v-model="thesis.application" :maxLength="100" placeholder="国内外反映应用情况" style="width:85%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="5">
            <div class="special-middle" style="text-align: left;">
              <div v-if="thesis.downloadUrl">
                <a-icon type="paper-clip" style="margin:0 6px" />
                <a class="hover-pointer" style="margin-right:8px " @click="downloadfile(thesis)">{{thesis.fileName}}</a>
                <a-popconfirm title="确定要删除吗?" ok-text="确定" cancel-text="取消" @confirm="deletefile(thesis, index)">
                  <a-icon type="close" class="hover-pointer d-icon" />
                </a-popconfirm>
              </div>
              <div v-else>
                <a-form-model-item :prop="'thesisList.' + index + '.downloadUrl'" :rules="{required: true, message: '请上传附件',trigger: 'blur',}">
                  <input type="file" :ref="'thesisfileElem' + index" class="visually-hidden" @change="handleFiles('thesisfileElem',thesis, index)" />
                  <a-button @click="fileSelect('thesisfileElem',thesis, index)"><a-icon type="upload" />选择文件</a-button>
                </a-form-model-item>
              </div>
            </div>
          </a-col>
          <a-col :span="1">
            <div class="special-middle">
              <a-popconfirm title="确定要删除吗?" ok-text="确定" cancel-text="取消" @confirm="deleteListItem(thesis,1)">
                <a-button type="link" size="small">删除</a-button>
              </a-popconfirm>
            </div>
          </a-col>
        </a-row>
        <a-row type="flex">
          <a-col :span="24" style="text-align: center">
            <div class="special-middle">
              <a-button type="dashed" style="width: 20%" @click="addListItem(1)">
                <a-icon type="plus" /> 添加 <span style="color:red;margin-left:10px"></span>
              </a-button>
            </div>
          </a-col>
        </a-row>

        <a-row>
          <a-col :span="24" style="border-top: 0px;">
            <div class="tb-title">
              <span>验收材料目录</span>
            </div>
          </a-col>
        </a-row>
        <a-row type="flex" class="row_center">
          <a-col :span="2" class="bg-gray">
            <div class="special-middle">
              <div>序号</div>
            </div>
          </a-col>
          <a-col :span="20" class="bg-gray">
            <div class="special-middle">
              <div class="required">材料名称</div>
            </div>
          </a-col>
          <a-col :span="2" class="bg-gray">
            <div class="special-middle">
              <div>操作</div>
            </div>
          </a-col>
        </a-row>
        <a-row v-for="(catalog, index) in formData.catalogList" :key="'catalogList'+index+''" type="flex" class="row_center">
          <a-col :span="2">
            <div class="special-middle">
              <div>{{index+1}}</div>
            </div>
          </a-col>
          <a-col :span="20">
            <a-form-model-item :prop="'catalogList.' + index + '.name'" :rules="{ required: true, message: '*', trigger: 'blur',}">
              <a-input v-model="catalog.name" :maxLength="50" placeholder="材料名称" style="width:85%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="2">
            <div class="special-middle">
              <a-popconfirm title="确定要删除吗?" ok-text="确定" cancel-text="取消" @confirm="deleteListItem(catalog,3)">
                <a-button type="link" size="small">删除</a-button>
              </a-popconfirm>
            </div>
          </a-col>
        </a-row>
        <a-row type="flex">
          <a-col :span="24" style="text-align: center">
            <div class="special-middle">
              <a-button type="dashed" style="width: 20%" @click="addListItem(3)">
                <a-icon type="plus" /> 添加 <span style="color:red;margin-left:10px"></span>
              </a-button>
            </div>
          </a-col>
        </a-row>

        <a-row>
          <a-col :span="24" style="border-top: 0px;">
            <div class="tb-title">
              <span>主要研究人员(按贡献大小排序)</span>
            </div>
          </a-col>
        </a-row>
        <a-row type="flex" class="row_center">
          <a-col :span="4" class="bg-gray">
            <div class="special-middle">
              <div class="required">姓名</div>
            </div>
          </a-col>
          <a-col :span="4" class="bg-gray">
            <div class="special-middle">
              <div class="required">性别</div>
            </div>
          </a-col>
          <a-col :span="4" class="bg-gray">
            <div class="special-middle">
              <div class="required">年龄</div>
            </div>
          </a-col>
          <a-col :span="4" class="bg-gray">
            <div class="special-middle">
              <div class="required">技术职称</div>
            </div>
          </a-col>
          <a-col :span="6" class="bg-gray">
            <div class="special-middle">
              <div class="required">主要贡献</div>
            </div>
          </a-col>
          <a-col :span="2" class="bg-gray">
            <div class="special-middle">
              <div>操作</div>
            </div>
          </a-col>
        </a-row>
        <a-row v-for="(researcher, index) in formData.researchersList" :key="'researcher'+index+''" type="flex" class="row_center">
          <a-col :span="4">
            <a-form-model-item :prop="'researchersList.' + index + '.name'" :rules="{ required: true, message: '*', trigger: 'blur',}">
              <a-input v-model="researcher.name" :maxLength="25" placeholder="姓名" style="width:85%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="4">
            <a-form-model-item :prop="'researchersList.' + index + '.sex'" :rules="{ required: true, message: '*', trigger: 'change',}">
              <a-select v-model="researcher.sex" style="width:85%">
                <a-select-option value=''>请选择</a-select-option>
                <a-select-option value="男"></a-select-option>
                <a-select-option value="女"></a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="4">
            <a-form-model-item :prop="'researchersList.' + index + '.age'" :rules="{ required: true, message: '*', trigger: 'blur',}">
              <a-input-number v-model="researcher.age" :min="0" :step="1" placeholder="年龄" style="width:85%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="4">
            <a-form-model-item :prop="'researchersList.' + index + '.technicalTitle'" :rules="{ required: true, message: '*', trigger: 'blur',}">
              <a-input v-model="researcher.technicalTitle" :maxLength="25" placeholder="技术职称" style="width:85%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="6">
            <a-form-model-item :prop="'researchersList.' + index + '.contributions'" :rules="{ required: true, message: '*', trigger: 'blur',}">
              <a-input v-model="researcher.contributions" :maxLength="100" placeholder="主要贡献" style="width:85%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="2">
            <div class="special-middle">
              <a-popconfirm title="确定要删除吗?" ok-text="确定" cancel-text="取消" @confirm="deleteListItem(researcher,2)">
                <a-button type="link" size="small">删除</a-button>
              </a-popconfirm>
            </div>
          </a-col>
        </a-row>
        <a-row type="flex">
          <a-col :span="24" style="text-align: center">
            <div class="special-middle">
              <a-button type="dashed" style="width: 20%" @click="addListItem(2)">
                <a-icon type="plus" /> 添加 <span style="color:red;margin-left:10px"></span>
              </a-button>
            </div>
          </a-col>
        </a-row>

        <a-row>
          <a-col :span="24" style="border-top: 0px;">
            <div class="tb-title">
              <span>经费决算</span>
            </div>
          </a-col>
        </a-row>
        <a-row type="flex">
          <a-col :span="4" class="bg-gray">
            <div class="special-middle">
              <div class="required">拔款(万元)</div>
            </div>
          </a-col>
          <a-col :span="20" class="inner_from">
            <a-row type="flex">
              <a-col v-for="(grant, index) in formData.grant" :key="'year'+index" :span="4">
                <div class="special-middle">
                  <a-form-model-item :prop="'grant.' + index + '.year'">
                    <a-input-number v-model="grant.year" :min="0" :step="1" style="width: 70%" />
                    <span class="font_s"></span>
                  </a-form-model-item>
                </div>
              </a-col>
              <a-col :span="4">
                <div class="special-middle">
                  <div style="text-align:center">合计</div>
                </div>
              </a-col>
            </a-row>
            <a-row type="flex">
              <a-col v-for="(grant, index) in formData.grant" :key="'amount'+index" :span="4">
                <div class="special-middle">
                  <a-form-model-item :prop="'grant.' + index + '.amount'">
                    <a-input-number v-model="grant.amount" :min="0" :step="0.01" style="width: 70%" />
                  </a-form-model-item>
                </div>
              </a-col>
              <a-col :span="4">
                <div class="special-middle" style="text-align:center">
                  {{fundsCount(formData.grant)}}
                </div>
              </a-col>
            </a-row>
          </a-col>
        </a-row>
        <a-row type="flex">
          <a-col :span="4" class="bg-gray">
            <div class="special-middle">
              <div class="required">其它途径筹资(万元)</div>
            </div>
          </a-col>
          <a-col :span="20" class="inner_from">
            <a-row type="flex">
              <a-col v-for="(finance, index) in formData.finance" :key="'finance_year'+index" :span="4">
                <div class="special-middle">
                  <a-form-model-item :prop="'finance.' + index + '.year'">
                    <a-input-number v-model="finance.year" :min="0" :step="1" style="width: 70%" />
                    <span class="font_s"></span>
                  </a-form-model-item>
                </div>
              </a-col>
              <a-col :span="4">
                <div class="special-middle">
                  <div style="text-align:center">合计</div>
                </div>
              </a-col>
            </a-row>
            <a-row type="flex">
              <a-col v-for="(finance, index) in formData.finance" :key="'finance_amount'+index" :span="4">
                <div class="special-middle">
                  <a-form-model-item :prop="'finance.' + index + '.amount'">
                    <a-input-number v-model="finance.amount" :min="0" :step="0.01" style="width: 70%" />
                  </a-form-model-item>
                </div>
              </a-col>
              <a-col :span="4">
                <div class="special-middle" style="text-align:center">
                  {{fundsCount(formData.finance)}}
                </div>
              </a-col>
            </a-row>
          </a-col>
        </a-row>
        <a-row type="flex" class="row_center">
          <a-col :span="6" class="bg-gray">
            <div class="special-middle">
              <div class="required">主要支出项目</div>
            </div>
          </a-col>
          <a-col :span="4" class="bg-gray">
            <div class="special-middle">
              <div class="required">金额(万元)</div>
            </div>
          </a-col>
          <a-col :span="14" class="bg-gray">
            <div class="special-middle">
              <div class="required">用途</div>
            </div>
          </a-col>
        </a-row>
        <a-row v-for="(spending, index) in formData.spending" :key="'spending'+index" type="flex" class="row_center">
          <a-col :span="6">
            <a-form-model-item :prop="'spending.' + index + '.name'">
              <a-input v-model="spending.name" :maxLength="50" :disabled="index==6" />
            </a-form-model-item>
          </a-col>
          <a-col :span="4">
            <a-form-model-item :prop="'spending.' + index + '.amount'">
              <a-input-number v-model="spending.amount" :min="0" :step="0.01" style="width: 80%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="14">
            <a-form-model-item :prop="'spending.' + index + '.used'">
              <a-input v-model="spending.used" :maxLength="100" />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row type="flex" class="row_center">
          <a-col :span="6">
            <div class="special-middle">
              <div>合计</div>
            </div>
          </a-col>
          <a-col :span="4">
            <div class="special-middle">
              {{fundsCount(formData.spending)}}
            </div>
          </a-col>
          <a-col :span="14"></a-col>
        </a-row>
        <a-row type="flex" class="row_center">
          <a-col :span="6" class="bg-gray">
            <div class="special-middle">
              <div class="required">结余</div>
            </div>
          </a-col>
          <a-col :span="4" style="border-left:0px !important;">
            <div class="special-middle">
              <a-form-model-item prop="balance">
                <a-input-number v-model="formData.balance" :min="0" :step="0.01" style="width: 80%" />
              </a-form-model-item>
            </div>
          </a-col>
          <a-col :span="14"></a-col>
        </a-row>
        <a-row>
          <a-col :span="24" style="border-top: 0px;">
          </a-col>
        </a-row>
        <a-row type="flex">
          <a-col :span="4" class="bg-gray">
            <div class="special-middle">
              <div class="required">研究或推广内容及结果简介</div>
            </div>
          </a-col>
          <a-col :span="20">
            <a-form-model-item prop="researchContent">
              <a-textarea placeholder="研究或推广内容及结果简介(1、完成的研究或推广内容及水平分析;2、项目研究的创新性;3、推广应用的情况,产生的社会和经济效益,并附有关证明材料。)" v-model="formData.researchContent" :maxLength="100000" style="width: 80%; height: 160px; margin-top: 12px" />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row type="flex">
          <a-col :span="4" class="bg-gray">
            <div class="special-middle">
              <div class="required">下一步的工作打算</div>
            </div>
          </a-col>
          <a-col :span="20">
            <a-form-model-item prop="workPlan">
              <a-textarea placeholder="下一步的工作打算(进一步的的推广应用、申请鉴定、技术转让等)" v-model="formData.workPlan" :maxLength="1000" style="width: 80%; height: 160px; margin-top: 12px" />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row type="flex">
          <a-col :span="4" class="bg-gray">
            <div class="special-middle">
              <div>延期报告</div>
            </div>
          </a-col>
          <a-col :span="20">
            <a-form-model-item prop="extensionReport">
              <a-textarea placeholder="延期报告(或中止研究报告)" v-model="formData.extensionReport" :maxLength="1000" style="width: 80%; height: 160px; margin-top: 12px" />
            </a-form-model-item>
          </a-col>
        </a-row>

        <a-row>
          <a-col :span="24" style="border-top: 0px;">
            <div class="tb-title">
              <span>结题材料</span>
            </div>
          </a-col>
        </a-row>
        <a-row type="flex">
          <a-col :span="24" style="border-top: 0px;">
            <div class="special-middle">
              <div><span class="file-description">{{description}}</span></div>
            </div>
          </a-col>
        </a-row>
        <a-row type="flex" class="row_center">
          <a-col :span="4" class="bg-gray">
            <div class="special-middle">
              <div>材料类型</div>
            </div>
          </a-col>
          <a-col :span="18" class="bg-gray">
            <div class="special-middle">
              <div class="required">附件上传</div>
            </div>
          </a-col>
          <a-col :span="2" class="bg-gray">
            <div class="special-middle">
              <div>操作</div>
            </div>
          </a-col>
        </a-row>
        <a-row v-for="(item, index) in formData.fileList" :key="'fileList' + index" type="flex">
          <a-col :span="4">
            <a-form-model-item :prop="'fileList.' + index + '.fileExplain'" :rules="{required: true, message: '材料类型',trigger: 'blur',}">
              <a-input v-if="index>3" v-model="item.fileExplain" :maxLength="100" style="width: 80%" />
              <span v-else> {{item.fileExplain}}</span>
            </a-form-model-item>
          </a-col>
          <a-col :span="18">
            <div class="special-middle">
              <div v-if="item.downloadUrl">
                <a-icon type="paper-clip" style="margin:0 6px" />
                <a class="hover-pointer" style="margin-right:8px " @click="downloadfile(item)">{{item.fileName}}</a>
                <a-popconfirm title="确定要删除吗?" ok-text="确定" cancel-text="取消" @confirm="deletefile(item, index)">
                  <a-icon type="close" class="hover-pointer d-icon" />
                </a-popconfirm>
                <!-- <a-icon type="close" class="hover-pointer d-icon" @click="deletefile(item, index)" /> -->
              </div>
              <div v-else>
                <a-form-model-item :prop="'fileList.' + index + '.downloadUrl'" :rules="{required: true, message: '请上传附件',trigger: 'blur',}">
                  <input type="file" :ref="'fileElem' + index" class="visually-hidden" @change="handleFiles('fileElem',item, index)" />
                  <a-button @click="fileSelect('fileElem',item, index)"><a-icon type="upload" />选择文件</a-button>
                </a-form-model-item>
              </div>
            </div>
          </a-col>
          <a-col :span="2">
            <div class="special-middle">
              <a-popconfirm v-if="index>3" title="确定要删除吗?" ok-text="确定" cancel-text="取消" @confirm="deleteListItem(item,4)">
                <a-button type="link" size="small">删除</a-button>
              </a-popconfirm>
            </div>
          </a-col>
        </a-row>
        <a-row type="flex">
          <a-col :span="24" style="text-align: center">
            <div class="special-middle">
              <a-button type="dashed" style="width: 20%" @click="addListItem(4)">
                <a-icon type="plus" /> 添加 <span style="color:red;margin-left:10px"></span>
              </a-button>
            </div>
          </a-col>
        </a-row>
        <a-row>
          <a-col :span="24">
            <div class="tb-title">
              <span>审核记录</span>
            </div>
          </a-col>
        </a-row>
        <a-row>
          <a-col :span="24">
            <audit-list v-model="formData.auditList" />
          </a-col>
        </a-row>
      </a-form-model>
    </a-spin>
  </div>
</template>

<script>
const Thesis = { name: null, author: null, publishDate: null, publication: null, application: null, downloadId: null, fileName: null, downloadUrl: null }
const Researchers = { name: null, sex: null, age: null, technicalTitle: null, contributions: null }
const FUNDS = { year: null, name: null, amount: null, use: null, type: 1 }
const File = { fileName: '', downloadUrl: '', fileExplain: '', downloadId: '' }
const Catalog = { name: '', remark: '' }
import { isEmptyParams } from "@/views/utils/common"
import paraRadio from '@/views/components/common/paraRadio'
import axios from 'axios'
import AuditList from '@/views/audit/components/auditInfo'

export default {
  name: "conclusionEdit",
  components: {
    paraRadio, AuditList
  },
  props: {
    value: {
      type: String,
      default: () => {
        return null;
      },
    },
  },
  data () {
    return {
      province: process.env.VUE_APP_SYSTEM_PROVINCE,
      formData: {
        projNo: null,
        projName: null,
        appPersonName: null,
        appUnitName: null,
        telephone: null,
        planCategory: null,
        startDate: null,
        endDate: null,
        promotionContent: null,
        promotionTarget: null,
        selfEvaluation: null,
        achievingResults: null,
        thesisList: [],
        researchersList: [],
        //拔款
        grant: [],
        //其它途径筹资
        finance: [],
        //主要支出项目
        spending: [],
        balance: null,
        researchContent: null,
        workPlan: null,
        extensionReport: null,
        fileList: [],
        catalogList: [],
        auditList: [],
      },
      rules: {
        proj_no: [{ required: true, message: '请填写项目合同编号', trigger: 'blur' },],
        projName: [{ required: true, message: '请填写项目名称', trigger: 'blur' },],
        planCategory: [{ required: true, message: '请填写计划类别', trigger: 'blur' },],
        startDate: [{ required: true, message: '请选择开始日期', trigger: 'change' },],
        endDate: [{ required: true, message: '请选择结束日期', trigger: 'change' },],
        balance: [{ required: true, message: '请填写结余', trigger: 'blur' },],
        promotionContent: [{ required: true, message: '请选择研究或推广内容完成情况', trigger: 'change' },],
        promotionTarget: [{ required: true, message: '请选择研究或推广目标实现情况', trigger: 'change' },],
        selfEvaluation: [{ required: true, message: '请选择研究水平的自我评价', trigger: 'change' },],
        achievingResults: [{ required: true, message: '请选择取得成果情况', trigger: 'change' },],
        researchContent: [{ required: true, message: '请填写研究或推广内容及结果简介', trigger: 'blur' },],
        workPlan: [{ required: true, message: '请填写下一步的工作打算', trigger: 'blur' },],
        extensionReport: [{ required: false, message: '请填写延期报告', trigger: 'blur' },],
      },
      loading: true,
      description: "上传说明:请上传PDF文档,文件大小小于20M"
    };
  },
  created () {
    this.getConclusionByProjId()
  },
  computed: {

  },
  methods: {
    getConclusionByProjId () {
      let pars = { id: this.value }
      if (!!this.value) {
        this.$api.conclusion.getConclusionByProjId(pars).then(({ data = {} }) => {
          if (data) {
            this.formData = data
            this.initializeList(this.formData.grant, 1)
            this.initializeList(this.formData.finance, 2)
            this.initializeList(this.formData.spending, 3)
            if (!data.fileList || !data.fileList.length || data.fileList.length == 0) {
              this.formData.fileList = []
              this.formData.fileList.push(Object.assign({ ...File }, { fileExplain: this.province + '卫生健康委科研项目结题报告书' }))
              this.formData.fileList.push(Object.assign({ ...File }, { fileExplain: '项目研究报告' }))
              this.formData.fileList.push(Object.assign({ ...File }, { fileExplain: '立项文件和合同复印件' }))
              this.formData.fileList.push(Object.assign({ ...File }, { fileExplain: '附件(支撑材料)' }))
            }
            this.loading = false
          } else {
            this.$emit('close', 'error')
          }
        }).catch(() => {
          this.$message.error('500 Internal Server Error!');
          this.$emit('close', 'error')
        })
      }
    },
    fundsCount (list) {
      let total = 0.00
      list.forEach(e => {
        if (e.amount) {
          total = total + e.amount
        }
      })
      return total
    },
    initializeList (list, type) {
      if (!!list && list.length && list.length > 0) {
        let len = list.length
        switch (type) {
          case 1:
            for (let i = len; i < 5; i++) {
              this.formData.grant.push(Object.assign({ ...FUNDS }, { type: 1 }))
            }
            break
          case 2:
            for (let i = len; i < 5; i++) {
              this.formData.finance.push(Object.assign({ ...FUNDS }, { type: 2 }))
            }
            break
          case 3:
            for (let i = 1; i <= 7 - len; i++) {
              this.formData.spending.splice(len - 1, 0, Object.assign({ ...FUNDS }, { type: 3 }));
            }
            break
        }
      } else {
        switch (type) {
          case 1:
            this.formData.grant = []
            for (let i = 1; i <= 5; i++) {
              this.formData.grant.push(Object.assign({ ...FUNDS }, { type: 1 }))
            }
            break
          case 2:
            this.formData.finance = []
            for (let i = 1; i <= 5; i++) {
              this.formData.finance.push(Object.assign({ ...FUNDS }, { type: 2 }))
            }
            break
          case 3:
            this.formData.spending = []
            for (let i = 1; i <= 7; i++) {
              if (i == 7)
                this.formData.spending.push(Object.assign({ ...FUNDS }, { name: '其他各项开支', type: 3 }))
              else
                this.formData.spending.push(Object.assign({ ...FUNDS }, { type: 3 }))
            }
            break
        }
      }
    },
    addListItem (type) {
      switch (type) {
        case 1:
          this.formData.thesisList.push({ ...Thesis })
          break
        case 2:
          this.formData.researchersList.push({ ...Researchers })
          break
        case 3:
          this.formData.catalogList.push({ ...Catalog })
          break
        case 4:
          this.formData.fileList.push({ ...File })
          break
      }
    },
    deleteListItem (obj, type) {
      switch (type) {
        case 1:
          if (this.formData.thesisList.length == 1) {
            this.$message.error('至少填写一篇论文信息!')
          }
          else {
            let i = this.formData.thesisList.indexOf(obj)
            if (i !== -1) {
              this.formData.thesisList.splice(i, 1)
            }
          }
          break
        case 2:
          if (this.formData.researchersList.length == 1) {
            this.$message.error('至少填写一名主要研究人员!');
          }
          else {
            let j = this.formData.researchersList.indexOf(obj)
            if (j !== -1) {
              this.formData.researchersList.splice(j, 1)
            }
          }
          break
        case 3:
          if (this.formData.catalogList.length == 1) {
            this.$message.error('验收材料目录必须填写!');
          }
          else {
            let k = this.formData.catalogList.indexOf(obj)
            if (k !== -1) {
              this.formData.catalogList.splice(k, 1)
            }
          }
          break
        case 4:
          let k = this.formData.fileList.indexOf(obj)
          if (k !== -1) {
            this.formData.fileList.splice(k, 1)
          }
          break
      }
    },
    fileSelect (Fname, item, index) {
      let fileElem = this.$refs[Fname + index][0]
      if (fileElem) {
        fileElem.click()
      }
    },
    handleFiles (Fname, item, index) {
      let fileElem = this.$refs[Fname + index][0]
      let files = fileElem.files
      if (files.length <= 0) {
        this.$message.error('未选中文件,请尝试重新选择')
        return
      }
      //判断是否小于1M
      let isLtSize = files[0].size < 1024 * 1024 * 20;
      if (!isLtSize) {
        this.$message.error('所选文件超过20M,已自动过滤,请检查~');
        return
      }
      var fileNames = files[0].name.split('.')
      var fileType = fileNames[fileNames.length - 1].toLocaleLowerCase()
      var extList = ['pdf'] //'doc', 'docx', 
      if (!extList.find((item) => item == fileType)) {
        this.$message.error('文件格式错误!')
        return
      }
      this.$api.base.asyncUpload(this.uploadHandle(files[0], files[0].name)).then(({ data = {} }) => {

        item.downloadId = data.id
        item.fileName = files[0].name
        item.downloadUrl = data.downloadUrl

      }).catch(() => {
        this.$message.error('上传失败')
      })
    },
    uploadHandle (file, fileName) {
      let formData = new FormData()
      formData.append('file', file)
      formData.append('fileName', fileName)
      return formData
    },
    downloadfile (item) {
      axios({
        url: item.downloadUrl,
        method: 'GET',
        responseType: 'blob' // 告诉axios返回的数据类型为Blob
      }).then(response => {
        const url = window.URL.createObjectURL(new Blob([response.data]))
        const link = document.createElement('a')
        link.href = url
        link.setAttribute('download', item.fileName)  // 下载文件的名称
        document.body.appendChild(link)
        link.click()
      })
    },
    deletefile (item, index) {
      this.$api.base.deletefile({ id: item.downloadId }).then(({ data = {} }) => {
        if (data) {
          item.fileName = ''
          item.downloadUrl = ''
          item.downloadId = ''
        }
      }).catch(() => {
        this.$message.error('删除失败')
      })
    },
    beforeUpload (file, fileList) {
      if (this.fileList.length >= 4) {
        this.$message.error('只允许上传4个文件!');
        return false;
      }
      //判断是否小于1M
      let isLtSize = file.size < 1024 * 1024 * 5;
      if (!isLtSize) {
        //将fileList中本次file文件删掉
        fileList.splice(fileList.indexOf(file), 1);
        this.$message.error('所选文件单个超过5M,已自动过滤,请检查~');
        return false
      } else {
        //判断选择文件个数是否大于10个
        if (fileList.length > 4) {
          //将10个之外的文件去除
          fileList.splice(4);
          this.$message.error('所选文件超过2个,超出部分已自动过滤,请检查~');
          return false;
        }
      }
      var fileNames = file.name.split('.')
      var fileType = fileNames[fileNames.length - 1].toLocaleLowerCase()
      var extList = ['pdf']//'doc', 'docx', 
      if (!extList.find((item) => item == fileType)) {
        this.$message.error('文件格式错误!')
        return false;
      }
      return true
    },
    customRequest (option) {
      this.loading = true
      const { onProgress, onError, onSuccess, file, name } = option
      const formData = new FormData();
      formData.append('file', file)
      formData.append('fileName', file.name)
      this.$api.base.asyncUpload(formData).then(({ data = {} }) => {
        if (data) {
          this.fileList.push({ id: data.id, uid: file.uid, name: file.name, status: 'done', url: data.downloadUrl })
        } else {
          this.$message.error('上传失败请稍后再试!');
        }
        this.loading = false
      }).catch((ex) => {
        this.$message.error('上传失败请稍后再试!');
        this.loading = false
      })
    },
    onRemove (file) {
      this.$confirm({
        title: '确定要删除吗?',
        onOk: () => {
          this.fileList.splice(this.fileList.indexOf(file), 1);
          //   this.$api.base.deletefile({ id: file.id }).then(({ data = {} }) => {
          //     if (data) {
          //       this.fileList.splice(this.fileList.indexOf(file), 1);
          //     }
          //   }).catch(() => {
          //     this.$message.error('删除失败!')
          //   })
        },
      });
    },
    handleChange (info) {

    },
    save () {
      this.loading = true
      let pars = isEmptyParams(this.formData)
      let par = { ...pars }
      this.$api.conclusion.save(par).then(({ data = {} }) => {
        if (data) {
          this.formData.id = data
          this.$message.success('保存成功!')
          this.$emit('close', 'save')
        } this.loading = false
      }).catch(() => {
        this.$message.error('500 Internal Server Error!');
        this.loading = false
      })
    },
    submit () {
      this.$refs.from.validate(valid => {
        if (valid) {
          this.loading = true
          if (this.formData.state != 30)
            this.formData.state = 10
          let pars = isEmptyParams(this.formData)
          let par = { ...pars }
          this.$api.conclusion.save(par).then(({ data = {} }) => {
            if (data) {
              this.formData.id = data
              this.$emit('close', 'edit')
            }
          }).catch(() => { this.loading = false })
        } else {
          this.$message.error('信息未填写完全,请检查!')
          return false
        }
      })
    },
  },
};
</script>
<style scoped lang="less">
.file-description {
  display: block;
  width: 100%;
  line-height: 22px;
  padding: 3px 3px 3px 3px;
  color: red;
  white-space: normal;
  word-wrap: break-word;
  //   text-indent: 1em;
}
.inner_from {
  .ant-row-flex:last-child .ant-col {
    border-bottom: 0;
  }
  .ant-row-flex .ant-col:first-child {
    border-left: 0;
  }
  .ant-row-flex {
    border-right: 0;
  }
}
.special-middle {
  .font_s {
    margin: 0 6px;
  }
}
</style>