search.vue 27.7 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764
<template>
  <div id="search">
    <el-card class="box-card">
      <div slot="header" class="clearfix ">
        <span style="font-size:24px;padding-right:0px;color:#eff0dc">检索条件</span>
      </div>
      <el-form id="form" :inline="true" :model="search_form" class="demo-form-inline" label-width="100px" ref="search_form" :rules="search_form_rules">
        <el-row style="text-align:left">
          <el-col :span="6">
            <el-form-item label="合同编号" prop="contract_unid">
              <el-input style="width:217px" v-model="search_form.contract_unid"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="项目名称" prop="project_name__like">
              <el-input style="width:217px" v-model="search_form.project_name__like"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="客户名称" prop="customer_name__like">
              <el-input style="width:217px" v-model="search_form.customer_name__like"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="账款状态" prop="amount_state_unid">
              <el-select v-model="search_form.amount_state_unid" clearable>
                <el-option v-for="item in amount_state_unid_data" :key="item.code" :label="item.name" :value="item.code">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row style="text-align:left">
          <el-col :span="6">
            <el-form-item label="合同状态" prop="contract_state">
              <el-select v-model="search_form.contract_state" clearable>
                <el-option v-for="item in contract_state_data" :key="item.code" :label="item.name" :value="item.code">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="所属年份" prop="year">
              <el-select v-model="search_form.year" clearable>
                <el-option v-for="n in year_list" :key="n" :label="n" :value="n">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="所属月份" prop="month">
              <el-select v-model="search_form.month" clearable>
                <el-option v-for="n in month_list" :key="n" :label="n" :value="n">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="合同性质" prop="contract_type">
              <el-select v-model="search_form.contract_type" clearable>
                <el-option v-for="item in contract_type_data" :key="item.code" :label="item.name" :value="item.code">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row style="text-align:left">
          <el-col :span="6">
            <el-form-item label="产品线类型" prop="product_line_type">
              <el-select v-model="search_form.product_line_type" clearable>
                <el-option v-for="item in product_line_type_data" :key="item.code" :label="item.name" :value="item.code">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="是否终验" prop="acceptance_type">
              <el-select v-model="search_form.acceptance_type" clearable>
                <el-option label="是" :value="1">
                </el-option>
                <el-option label="否" :value="0">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="是否归档" prop="is_archive">
              <el-select v-model="search_form.is_archive" clearable>
                <el-option label="是" value=true></el-option>
                <el-option label="否" value=false></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="销售员" v-if="sales">
              <el-input style="width:217px" :readonly="true" v-model="salesperson_name"></el-input>
            </el-form-item>
            <el-form-item label="销售员" prop="salesperson_name__like" v-if="!sales">
              <el-input style="width:217px" v-model="search_form.salesperson_name__like"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row style="text-align:left">
          <el-col :span="6">
            <el-form-item label="确认收入金额" prop="confirm_income_amount">
              <el-input style="width:217px" v-model="search_form.confirm_income_amount"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="质保周期(月)" prop="guarantee_period">
              <el-select v-model="search_form.guarantee_period" clearable>
                <el-option v-for="n in guarantee_period_list" :key="n" :label="n" :value="n"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6" style="text-align:left">
            <el-form-item label="省" prop="province">
              <el-select style="width:217px" v-model="search_form.province" clearable placeholder="省" @change="get_cities()">
                <el-option v-for="(item,index) in provinces" :key="index" :label="item.name" :value="item.province_unid">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6" style="text-align:left">
            <el-form-item label="市" prop="city">
              <el-select style="width:217px" v-model="search_form.city" clearable placeholder="市" @change="get_counties()">
                <el-option v-for="(item,index) in cities" :key="index" :label="item.name" :value="item.city_unid">
                </el-option>
              </el-select>
            </el-form-item>
            <!-- <el-form-item prop="county">
              <el-select style="width:100px" v-model="search_form.county" clearable placeholder="区县">
                <el-option v-for="(item,index) in counties" :key="index" :label="item.name" :value="item.county_unid">
                </el-option>
              </el-select>
            </el-form-item> -->
          </el-col>
        </el-row>
        <el-row style="text-align:left">
          <el-col :span="12">
            <el-form-item label="签订日期" prop="start_date">
              <el-date-picker style="width:202px" v-model="search_form.start_date" type="date" placeholder="开始日期" value-format="yyyy-MM-dd">
              </el-date-picker>
            </el-form-item>
            <el-form-item prop="end_date">
              <el-date-picker style="width:202px" v-model="search_form.end_date" type="date" placeholder="结束日期" value-format="yyyy-MM-dd">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="逾期天数" prop="overdays_start_point">
              <el-input v-model="search_form.overdays_start_point" placeholder="不填默认为0"></el-input>
            </el-form-item>
            <el-form-item prop="overdays_end_point">
              <el-input v-model="search_form.overdays_end_point" placeholder="不填则无上限"></el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row style="text-align:left">
          <el-col :span="12">
            <el-form-item label="合同金额" prop="amount_start_point">
              <el-input v-model="search_form.amount_start_point" placeholder="不填默认为0"></el-input>
            </el-form-item>
            <el-form-item prop="amount_end_point">
              <el-input v-model="search_form.amount_end_point" placeholder="不填则无上限"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="应收账款余额" prop="leave_amount_start_point">
              <el-input v-model="search_form.leave_amount_start_point" placeholder="不填默认为0"></el-input>
            </el-form-item>
            <el-form-item prop="leave_amount_end_point">
              <el-input v-model="search_form.leave_amount_end_point" placeholder="不填则无上限"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <el-row>
        <el-button-group style="float:right">
          <el-button type="primary" @click="commit()" size="small">检索</el-button>
          <el-button type="primary" @click="reset()" size="small">重置</el-button>
        </el-button-group>
      </el-row>
    </el-card>

    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span style="font-size:24px;padding-right:0px;color:#eff0dc">检索结果</span>
      </div>
      <!-- test------------------------------------------------------------------------------------------------ -->

      <!-- default-expand-all : 是否默认展开所有行 -->
      <el-table id="data_table" :data="list_data" style="width: 100%" row-key="contract_unid" stripe highlight-current-row border :default-expand-all="true">
        <el-table-column type="expand">
          <template slot-scope="scope">
            <el-row type="flex" justify="space-around" style="text-align:left;padding-bottom:5px">
              <el-col :span="4">
                <span class="pre">暂停金额:</span>{{scope.row.stop_amount}}
              </el-col>
              <el-col :span="4">
                <span class="pre">坏账金额:</span>{{scope.row.bad_amount}}
              </el-col>
              <el-col :span="4">
                <span class="pre">豁免金额:</span>{{scope.row.exemptions_amount}}
              </el-col>
              <el-col :span="4">
                <span class="pre">抵扣金额:</span>{{scope.row.deduct_amount}}
              </el-col>
              <el-col :span="4">
                <span class="pre">累计已收款:</span>{{scope.row.total_reback_amount}}
              </el-col>
              <el-col :span="4">
                <span class="pre">验收款金额:</span>{{scope.row.acceptanc_pay}}
              </el-col>
            </el-row>
            <el-row type="flex" justify="space-around" style="text-align:left;padding-bottom:5px">
              <el-col :span="4">
                <span class="pre">合同余额:</span>{{scope.row.contract_remain}}
              </el-col>
              <el-col :span="4">
                <span class="pre">产品线类型:</span>{{scope.row.product_line_type_name}}
              </el-col>
              <el-col :span="4">
                <span class="pre">累计应收:</span>{{scope.row.total_receive_amount}}
              </el-col>
              <el-col :span="4">
                <span class="pre">应收账款余额:</span>{{scope.row.total_amount_remain}}
              </el-col>
              <el-col :span="4">
                <span class="pre">逾期天数:</span>{{scope.row.over_days}}
              </el-col>
              <el-col :span="4">
                <span class="pre">质保金额:</span>{{scope.row.mainten_pay_deliver}}
              </el-col>
            </el-row>
            <el-row type="flex" justify="space-around" style="text-align:left;padding-bottom:5px">
              <el-col :span="4">
                <span class="pre">预付款金额:</span>{{scope.row.advance_pay}}
              </el-col>
              <el-col :span="4">
                <span class="pre">预付款到期日:</span>{{scope.row.advance_pay_date}}
              </el-col>
              <el-col :span="4">
                <span class="pre">到货款金额:</span>{{scope.row.arrive_pay}}
              </el-col>
              <el-col :span="4">
                <span class="pre">发货日期:</span>{{scope.row.deliver_date}}
              </el-col>
              <el-col :span="4">
                <span class="pre">到货款到期日:</span>{{scope.row.arrive_pay_date}}
              </el-col>
              <el-col :span="4">
                <span class="pre">质保到期日:</span>{{scope.row.mainten_pay_deliver_date}}
              </el-col>
            </el-row>
            <el-row style="text-align:left;padding-bottom:5px">
              <span class="pre">备注:</span>{{scope.row.contract_note}}
            </el-row>
          </template>
        </el-table-column>

        <el-table-column label="合同编号" prop="contract_unid" min-width="9%" align="center">
        </el-table-column>
        <el-table-column label="项目名称" prop="project_name" min-width="11%" align="center">
        </el-table-column>
        <el-table-column label="客户名称" prop="customer_name" min-width="11%" align="center">
        </el-table-column>
        <el-table-column label="合同金额" prop="contract_amount" min-width="9%" align="center">
        </el-table-column>
        <el-table-column label="签订时间" prop="sign_date" min-width="8%" align="center">
        </el-table-column>
        <el-table-column label="验收款日期" prop="acceptanc_date" min-width="8%" align="center">
        </el-table-column>
        <el-table-column label="验收款到期日" prop="acceptanc_pay_date" min-width="8%" align="center">
        </el-table-column>
        <!-- <el-table-column label="产品线类型" prop="product_line_type_name" min-width="9%" align="center">
        </el-table-column> -->
        <el-table-column label="合同状态" prop="contract_state_name" min-width="9%" align="center">
        </el-table-column>
        <el-table-column label="销售员" prop="salesperson_name" min-width="7%" align="center">
        </el-table-column>
        <el-table-column label="省" prop="province_name" min-width="6%" align="center">
        </el-table-column>
        <el-table-column label="市" prop="city_name" min-width="6%" align="center">
        </el-table-column>
        <!-- <el-table-column label="县" prop="county_name" min-width="7%" align="center">
        </el-table-column> -->
        <el-table-column label="操作" min-width="4%" align="center" fixed="right">
          <template slot-scope="scope">
            <el-button type="text" @click="go_to(scope.row.contract_unid)">
              详情
            </el-button>
          </template>
        </el-table-column>
      </el-table>
      <!-- test------------------------------------------------------------------------------------------------ -->
      <el-row style="padding-top:50px">
        <el-col :span="20">
          <el-pagination style="float:left" background layout="prev, pager, next" :total="total_data" :page-size="limit" prev-text="上一页" next-text="下一页" :current-page="current_page" @current-change="page_change">
          </el-pagination>
        </el-col>

        <el-col :span="4">
          <el-button-group style="float:right">
            <el-button type="primary" size="small" @click="export_contract">导出</el-button>
            <el-button type="primary" size="small" @click="import_click">导入</el-button>
            <input id="import_unview" type="file" style="display:none" @change="import_contract">
          </el-button-group>
        </el-col>

      </el-row>
    </el-card>
  </div>
</template>

<script>
const twodecimalrule = {
  pattern: /((^[1-9]\d*)|^0)(\.\d{2})$/,
  message: "请输入数字并保留两位小数",
  trigger: "blur"
};
export default {
  name: "search",
  data() {
    return {
      sales: false,
      salesperson_name: null,
      provinces: [],
      cities: [],
      counties: [],
      code_base_url: disparch_data.code_base_url,
      contract_base_url: disparch_data.contract_base_url,
      month_list: [
        "01",
        "02",
        "03",
        "04",
        "05",
        "06",
        "07",
        "08",
        "09",
        "10",
        "11",
        "12"
      ],
      contract_state_data: [],
      contract_type_data: [],
      product_line_type_data: [],
      amount_state_unid_data: [],
      search_form: {
        contract_unid: null,
        salesperson_unid: null,
        salesperson_name__like: null,
        project_name__like: null,
        customer_name__like: null,
        guarantee_period: null,
        year: null,
        month: null,
        contract_state: null,
        contract_type: null,
        product_line_type: null,
        acceptance_type: null,
        is_archive: null,
        amount_state_unid: null,
        confirm_income_amount: null,
        province: null,
        city: null,
        // county: null,
        start_data: null,
        end_date: null,
        overdays_start_point: null,
        overdays_end_point: null,
        amount_start_point: null,
        amount_end_point: null,
        leave_amount_start_point: null,
        leave_amount_end_point: null
      },

      list_data: [],
      limit: 10,
      total_data: 0,
      current_page: 1,

      search_form_rules: {
        confirm_income_amount: twodecimalrule,
        amount_start_point: twodecimalrule,
        amount_end_point: twodecimalrule,
        leave_amount_start_point: twodecimalrule,
        leave_amount_end_point: twodecimalrule,
        overdays_start_point: {
          pattern: /((^[1-9]\d*)|^0)$/,
          message: "请输入正确天数",
          trigger: "blur"
        },
        overdays_end_point: {
          pattern: /((^[1-9]\d*)|^0)$/,
          message: "请输入正确天数",
          trigger: "blur"
        }
      }
    };
  },
  computed: {
    year_list: function() {
      var arr = [];
      for (let i = 2000; i < 2041; i++) {
        arr.push(i);
      }
      return arr;
    },
    offset() {
      return (this.current_page - 1) * this.limit;
    },
    guarantee_period_list() {
      var arr = [];
      var a = 6;
      for (let i = 0; i < 10; i++) {
        const element = (10)[i];
        arr.push(a);
        a += 6;
      }
      return arr;
    }
  },
  methods: {
    import_click() {
      document.getElementById("import_unview").click();
    },
    import_contract() {
      if (!document.getElementById("import_unview").files[0]) {
        return;
      }
      var form = new FormData();
      form.append("file", document.getElementById("import_unview").files[0]);
      this.$Axios({
        method: "post",
        url: this.contract_base_url + "import",
        data: form
      })
        .then(res => {
          if (res.data.ecode == "500") {
            this.$message.error(res.data.enote);
          } else if (res.data.ecode == "200") {
            this.$message({
              type: "success",
              message: "导入成功"
            });
          } else if (res.data != [] && res.data[0].contract_unid) {
            var message = [];
            const h = this.$createElement;
            res.data.forEach(e => {
              message.push(h("p", null, e.contract_unid));
            });
            this.$message({
              type: "warning",
              message: "部分导入信息数据校验未通过,请检查后重新导入",
              duration: 5000
            });
            this.$notify({
              title: "校验未通过的合同的编号为:",
              duration: 0,
              message: h("p", null, message),
              type: "error"
            });
          } else {
            if (res.data.length > 0) {
              var message = [];
              const h = this.$createElement;
              res.data.forEach(e => {
                message.push(h("p", null, e));
              });
              this.$message({
                type: "warning",
                message: "部分导入信息已存在,请检查后重新导入",
                duration: 5000
              });
              this.$notify({
                title: "重复的数据编号",
                duration: 0,
                message: h("p", null, message),
                type: "error"
              });
            }
          }
          var node = document.getElementById("import_unview");
          node.value = "";
        })
        .catch(err => {
          console.log(err.message);
        });
    },
    // get start~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    get_amount_state_unid_data() {
      this.$Axios({
        method: "get",
        url: this.code_base_url + "custom/cates/42407C5EF2/codes"
      })
        .then(res => {
          this.amount_state_unid_data = res.data.list_data;
        })
        .catch(err => {});
    },
    get_contract_type_data() {
      this.$Axios({
        method: "get",
        url: this.code_base_url + "custom/cates/8EC31D08A0/codes"
      })
        .then(res => {
          this.contract_type_data = res.data.list_data;
        })
        .catch(err => {});
    },
    get_contract_state_data() {
      this.$Axios({
        method: "get",
        url: this.code_base_url + "custom/cates/13BEFACBCF/codes"
      })
        .then(res => {
          this.contract_state_data = res.data.list_data;
        })
        .catch(err => {});
    },
    get_product_line_type_data() {
      this.$Axios({
        method: "get",
        url: this.code_base_url + "custom/cates/4FC51AD3C9/codes"
      })
        .then(res => {
          this.product_line_type_data = res.data.list_data;
        })
        .catch(err => {});
    },
    get_provinces() {
      this.$Axios({
        method: "get",
        url: this.code_base_url + "countries/0E229CD043/provinces"
      })
        .then(response => {
          this.provinces = response.data.list_data;
        })
        .catch(err => {
          console.log(err.message);
        });
    },
    get_cities() {
      this.search_form.city = "";
      // this.search_form.county = "";
      if (this.search_form.province) {
        this.$Axios({
          method: "get",
          url:
            this.code_base_url +
            "countries/0E229CD043/provinces/" +
            this.search_form.province +
            "/cities"
        })
          .then(response => {
            this.cities = response.data.list_data;
          })
          .catch(err => {
            console.log(err.message);
          });
      }
    },
    get_counties() {
      // this.search_form.county = "";
      if (this.search_form.province && this.search_form.city) {
        this.$Axios({
          method: "get",
          url:
            this.code_base_url +
            "countries/0E229CD043/provinces/" +
            this.search_form.province +
            "/cities/" +
            this.search_form.city +
            "/counties"
        })
          .then(response => {
            this.counties = response.data.list_data;
          })
          .catch(err => {
            console.log(err.message);
          });
      }
    },
    get_list_data() {
      var a = this.search_form;
      a.offset = this.offset;
      a.limit = this.limit;
      this.$Axios({
        methods: "get",
        url: this.contract_base_url,
        params: a,
        headers: { "Content-Type": "application/json" }
      })
        .then(response => {
          if (response.data.ecode == "500") {
            this.$message.error("筛选异常");
            return;
          }
          this.total_data = response.data.total_number;
          this.list_data = response.data.list_data;
          for (let i = 0; i < this.list_data.length; i++) {
            const e = this.list_data[i];
            for (let j = 0; j < this.contract_state_data.length; j++) {
              const a = this.contract_state_data[j];
              if (e.contract_state == a.code) {
                this.list_data[i].contract_state_name = a.name;
              }
            }
            for (let k = 0; k < this.product_line_type_data.length; k++) {
              const b = this.product_line_type_data[k];
              if (e.product_line_type == b.code) {
                this.list_data[i].product_line_type_name = b.name;
              }
            }
            if (!e.over_days) {
              e.over_days = 0;
            }
          }
        })
        .catch(err => {
          console.log(err.message);
        });
    },
    get_year(date) {
      if (date) {
        return date.slice(0, 4);
      }
    },
    get_month(date) {
      if (date) {
        return date.slice(5, 7);
      }
    },

    // get end---------------------------------------------------------------------------------------------
    reset() {
      this.$refs["search_form"].resetFields();
    },

    commit() {
      this.current_page = 1;
      sessionStorage.setItem(
        "search_condition",
        JSON.stringify(this.search_form)
      );
      this.get_list_data();
    },
    page_change(val) {
      this.search_form = JSON.parse(sessionStorage.getItem("search_condition"));
      this.current_page = val;
      console.log(this.current_page);
      this.get_list_data();
    },
    export_contract() {
      this.$Axios({
        method: "get",
        url: this.contract_base_url + "export",
        params: this.search_form,
        responseType: "blob"
      })
        .then(res => {
          let blob = new Blob([res.data], {
            type: "application/vnd.ms-excel;charset=UTF-8"
          });
          // let ourl = URL.createObjectURL(blob);
          // window.location.href = ourl;
          var downloadElement = document.createElement("a");
          var href = window.URL.createObjectURL(blob); //创建下载的链接
          downloadElement.href = href;
          downloadElement.download = "合同.xlsx"; //下载后文件名
          document.body.appendChild(downloadElement);
          downloadElement.click(); //点击下载
          document.body.removeChild(downloadElement); //下载完成移除元素
          window.URL.revokeObjectURL(href); //释放掉blob对象
        })
        .catch(err => {
          console.log(err.message);
        });
    },
    go_to(id) {
      sessionStorage.setItem("modify", "1");
      this.$router.push("/nav/contract/" + id);
    }
  },
  created() {
    if (sessionStorage.getItem("user_roles") == "null") {
      this.salesperson_name = sessionStorage.getItem("user_name");
      this.sales = true;
      this.search_form.salesperson_unid = sessionStorage.getItem("user_unid");
    }
    if (sessionStorage.getItem("provinces")) {
      this.provinces = JSON.parse(sessionStorage.getItem("provinces"));
    } else {
      this.get_provinces();
    }
    if (sessionStorage.getItem("amount_state_unid_data")) {
      this.amount_state_unid_data = JSON.parse(
        sessionStorage.getItem("amount_state_unid_data")
      );
    } else {
      this.get_amount_state_unid_data();
    }
    if (sessionStorage.getItem("contract_type_data")) {
      this.contract_type_data = JSON.parse(
        sessionStorage.getItem("contract_type_data")
      );
    } else {
      this.get_contract_type_data();
    }
    if (sessionStorage.getItem("contract_state_data")) {
      this.contract_state_data = JSON.parse(
        sessionStorage.getItem("contract_state_data")
      );
    } else {
      this.get_contract_state_data();
    }
    if (sessionStorage.getItem("product_line_type_data")) {
      this.product_line_type_data = JSON.parse(
        sessionStorage.getItem("product_line_type_data")
      );
    } else {
      this.get_product_line_type_data();
    }
  }
};
</script>

<style scoped>
span {
  padding-right: 10px;
}
#search >>> label {
  color: black;
}
#search >>> .el-card__body {
  background: lightgray;
}
#search >>> input {
  border-color: black;
  color: black;
}
#search >>> .el-card__header {
  background-color: #34352c;
}
#search >>> thead > tr > th > .cell {
  color: black;
}
#search >>> thead > tr > th {
  background-color: lightgray;
}
#data_table .el-table__expanded-cell .pre {
  text-decoration: underline;
  /* font-style: oblique; */
  color: gray;
}
#data_table {
  color: black;
}
</style>