Blame view

code/finance_web/src/components/search.vue 29.7 KB
a  
谢明辉 committed
1
<template>
a  
谢明辉 committed
2
  <div id="search" @keypress.enter.prevent="commit()">
a  
谢明辉 committed
3
    <el-card class="box-card">
s  
谢明辉 committed
4
      <div slot="header" class="clearfix ">
a  
谢明辉 committed
5
        <span style="font-size:24px;padding-right:0px;color:#eff0dc">检索条件</span>
a  
谢明辉 committed
6
      </div>
s  
谢明辉 committed
7 8
      <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">
a  
谢明辉 committed
9
          <el-col :span="6">
a  
谢明辉 committed
10 11 12 13 14
            <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">
s  
谢明辉 committed
15 16
            <el-form-item label="项目名称" prop="project_name__like">
              <el-input style="width:217px" v-model="search_form.project_name__like"></el-input>
a  
谢明辉 committed
17 18 19
            </el-form-item>
          </el-col>
          <el-col :span="6">
s  
谢明辉 committed
20 21
            <el-form-item label="客户名称" prop="customer_name__like">
              <el-input style="width:217px" v-model="search_form.customer_name__like"></el-input>
a  
谢明辉 committed
22 23
            </el-form-item>
          </el-col>
a  
谢明辉 committed
24 25 26 27 28 29 30 31
          <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>
a  
谢明辉 committed
32
        </el-row>
a  
谢明辉 committed
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
        <!-- hide -->
        <el-collapse-transition>
          <div id="hide" v-show="!hide_search_item">
            <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>
s  
谢明辉 committed
61

a  
谢明辉 committed
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
              <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-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>
          </div>
        </el-collapse-transition>
a  
谢明辉 committed
177
      </el-form>
a  
谢明辉 committed
178
      <el-row>
a  
谢明辉 committed
179 180 181
        <i :class="hide_icon" @click="display_more">{{hide_text}}</i>
      </el-row>
      <el-row>
a  
谢明辉 committed
182 183 184 185 186
        <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>
a  
谢明辉 committed
187 188 189 190
    </el-card>

    <el-card class="box-card">
      <div slot="header" class="clearfix">
a  
谢明辉 committed
191
        <span style="font-size:24px;padding-right:0px;color:#eff0dc">检索结果</span>
a  
谢明辉 committed
192
      </div>
s  
谢明辉 committed
193
      <!-- test------------------------------------------------------------------------------------------------ -->
a  
谢明辉 committed
194

a  
谢明辉 committed
195
      <!-- default-expand-all : 是否默认展开所有行 -->
a  
谢明辉 committed
196
      <el-table id="data_table" :data="list_data" style="width: 100%" row-key="contract_unid" border>
s  
谢明辉 committed
197 198 199 200
        <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">
a  
谢明辉 committed
201
                <span class="pre">暂停金额:</span>{{scope.row.stop_amount}}
s  
谢明辉 committed
202 203
              </el-col>
              <el-col :span="4">
a  
谢明辉 committed
204
                <span class="pre">坏账金额:</span>{{scope.row.bad_amount}}
s  
谢明辉 committed
205 206
              </el-col>
              <el-col :span="4">
a  
谢明辉 committed
207
                <span class="pre">豁免金额:</span>{{scope.row.exemptions_amount}}
s  
谢明辉 committed
208 209
              </el-col>
              <el-col :span="4">
a  
谢明辉 committed
210
                <span class="pre">抵扣金额:</span>{{scope.row.deduct_amount}}
s  
谢明辉 committed
211 212
              </el-col>
              <el-col :span="4">
a  
谢明辉 committed
213
                <span class="pre">累计已收款:</span>{{scope.row.total_reback_amount}}
s  
谢明辉 committed
214 215
              </el-col>
              <el-col :span="4">
a  
谢明辉 committed
216
                <span class="pre">验收款金额:</span>{{scope.row.acceptanc_pay}}
s  
谢明辉 committed
217 218 219 220
              </el-col>
            </el-row>
            <el-row type="flex" justify="space-around" style="text-align:left;padding-bottom:5px">
              <el-col :span="4">
a  
谢明辉 committed
221 222 223 224
                <span class="pre">合同余额:</span>{{scope.row.contract_remain}}
              </el-col>
              <el-col :span="4">
                <span class="pre">产品线类型:</span>{{scope.row.product_line_type_name}}
s  
谢明辉 committed
225 226
              </el-col>
              <el-col :span="4">
a  
谢明辉 committed
227
                <span class="pre">累计应收:</span>{{scope.row.total_receive_amount}}
s  
谢明辉 committed
228 229
              </el-col>
              <el-col :span="4">
a  
谢明辉 committed
230
                <span class="pre">应收账款余额:</span>{{scope.row.total_amount_remain}}
s  
谢明辉 committed
231 232
              </el-col>
              <el-col :span="4">
a  
谢明辉 committed
233
                <span class="pre">逾期天数:</span>{{scope.row.over_days}}
s  
谢明辉 committed
234 235
              </el-col>
              <el-col :span="4">
a  
谢明辉 committed
236
                <span class="pre">质保金额:</span>{{scope.row.mainten_pay_deliver}}
s  
谢明辉 committed
237 238 239 240
              </el-col>
            </el-row>
            <el-row type="flex" justify="space-around" style="text-align:left;padding-bottom:5px">
              <el-col :span="4">
a  
谢明辉 committed
241 242 243 244
                <span class="pre">预付款金额:</span>{{scope.row.advance_pay}}
              </el-col>
              <el-col :span="4">
                <span class="pre">预付款到期日:</span>{{scope.row.advance_pay_date}}
s  
谢明辉 committed
245 246
              </el-col>
              <el-col :span="4">
a  
谢明辉 committed
247
                <span class="pre">到货款金额:</span>{{scope.row.arrive_pay}}
s  
谢明辉 committed
248 249
              </el-col>
              <el-col :span="4">
a  
谢明辉 committed
250
                <span class="pre">发货日期:</span>{{scope.row.deliver_date}}
s  
谢明辉 committed
251 252
              </el-col>
              <el-col :span="4">
a  
谢明辉 committed
253
                <span class="pre">到货款到期日:</span>{{scope.row.arrive_pay_date}}
s  
谢明辉 committed
254 255
              </el-col>
              <el-col :span="4">
a  
谢明辉 committed
256
                <span class="pre">质保到期日:</span>{{scope.row.mainten_pay_deliver_date}}
s  
谢明辉 committed
257 258
              </el-col>
            </el-row>
a  
谢明辉 committed
259 260
            <el-row style="text-align:left;padding-bottom:5px">
              <span class="pre">备注:</span>{{scope.row.contract_note}}
s  
谢明辉 committed
261 262 263 264
            </el-row>
          </template>
        </el-table-column>

a  
谢明辉 committed
265
        <el-table-column label="合同编号" prop="contract_unid" min-width="9%" align="center">
s  
谢明辉 committed
266
        </el-table-column>
a  
谢明辉 committed
267
        <el-table-column label="项目名称" prop="project_name" min-width="11%" align="center">
s  
谢明辉 committed
268
        </el-table-column>
a  
谢明辉 committed
269
        <el-table-column label="客户名称" prop="customer_name" min-width="11%" align="center">
s  
谢明辉 committed
270
        </el-table-column>
a  
谢明辉 committed
271
        <el-table-column label="合同金额" prop="contract_amount" min-width="9%" align="center">
s  
谢明辉 committed
272
        </el-table-column>
a  
谢明辉 committed
273
        <el-table-column label="签订时间" prop="sign_date" min-width="8%" align="center">
s  
谢明辉 committed
274
        </el-table-column>
a  
谢明辉 committed
275
        <el-table-column label="验收款日期" prop="acceptanc_date" min-width="8%" align="center">
s  
谢明辉 committed
276
        </el-table-column>
a  
谢明辉 committed
277
        <el-table-column label="验收款到期日" prop="acceptanc_pay_date" min-width="8%" align="center">
s  
谢明辉 committed
278
        </el-table-column>
a  
谢明辉 committed
279 280 281
        <!-- <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">
s  
谢明辉 committed
282
        </el-table-column>
a  
谢明辉 committed
283
        <el-table-column label="销售员" prop="salesperson_name" min-width="7%" align="center">
s  
谢明辉 committed
284
        </el-table-column>
a  
谢明辉 committed
285
        <el-table-column label="省" prop="province_name" min-width="6%" align="center">
s  
谢明辉 committed
286
        </el-table-column>
a  
谢明辉 committed
287
        <el-table-column label="市" prop="city_name" min-width="6%" align="center">
s  
谢明辉 committed
288
        </el-table-column>
a  
谢明辉 committed
289 290
        <!-- <el-table-column label="县" prop="county_name" min-width="7%" align="center">
        </el-table-column> -->
a  
谢明辉 committed
291
        <el-table-column label="操作" min-width="4%" align="center">
s  
谢明辉 committed
292 293 294 295 296 297 298 299 300
          <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">
a  
谢明辉 committed
301
        <el-col :span="20">
s  
谢明辉 committed
302
          <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">
a  
谢明辉 committed
303 304 305 306 307
          </el-pagination>
        </el-col>

        <el-col :span="4">
          <el-button-group style="float:right">
s  
谢明辉 committed
308
            <el-button type="primary" size="small" @click="export_contract">导出</el-button>
a  
谢明辉 committed
309 310
            <el-button type="primary" size="small" @click="import_click">导入</el-button>
            <input id="import_unview" type="file" style="display:none" @change="import_contract">
a  
谢明辉 committed
311 312 313 314 315
          </el-button-group>
        </el-col>

      </el-row>
    </el-card>
a  
谢明辉 committed
316 317 318 319
  </div>
</template>

<script>
a  
谢明辉 committed
320 321 322 323 324 325 326 327 328
  const twodecimalrule = {
    pattern: /((^[1-9]\d*)|^0)(\.\d{2})$/,
    message: "请输入数字并保留两位小数",
    trigger: "blur"
  };
  export default {
    name: "search",
    data() {
      return {
a  
谢明辉 committed
329 330 331
        hide_icon: "icon i-arrowdown-copy",
        hide_search_item: true,
        hide_text: "显示更多",
a  
谢明辉 committed
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
        sales: false,
        salesperson_name: null,
        provinces: [],
        cities: [],
        counties: [],
        code_base_url: this.$disparch_data.code_base_url,
        contract_base_url: this.$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
        },
s  
谢明辉 committed
385

a  
谢明辉 committed
386 387 388 389
        list_data: [],
        limit: 10,
        total_data: 0,
        current_page: 1,
s  
谢明辉 committed
390

a  
谢明辉 committed
391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406
        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"
          }
a  
谢明辉 committed
407
        }
a  
谢明辉 committed
408
      };
s  
谢明辉 committed
409
    },
a  
谢明辉 committed
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430
    computed: {
      year_list: function() {
        var a = new Date().getFullYear();
        var arr = [];
        for (let i = a; i >= 2000; 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;
s  
谢明辉 committed
431
      }
a  
谢明辉 committed
432
    },
a  
谢明辉 committed
433
    methods: {
a  
谢明辉 committed
434 435 436 437 438 439 440 441 442 443
      display_more() {
        this.hide_search_item = !this.hide_search_item;
        this.hide_search_item == true
          ? (this.hide_text = "显示更多")
          : (this.hide_text = "收起");
        this.hide_search_item == true
          ? (this.hide_icon = "icon i-arrowdown-copy")
          : (this.hide_icon = "icon i-arrowup");
      },

a  
谢明辉 committed
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466
      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) {
a  
谢明辉 committed
467 468 469
              var message = [];
              const h = this.$createElement;
              res.data.forEach(e => {
a  
谢明辉 committed
470
                message.push(h("p", null, e.contract_unid));
a  
谢明辉 committed
471 472 473
              });
              this.$message({
                type: "warning",
a  
谢明辉 committed
474
                message: "部分导入信息数据校验未通过,请检查后重新导入",
a  
谢明辉 committed
475 476 477
                duration: 5000
              });
              this.$notify({
a  
谢明辉 committed
478
                title: "校验未通过的合同的编号为:",
a  
谢明辉 committed
479 480 481 482
                duration: 0,
                message: h("p", null, message),
                type: "error"
              });
a  
谢明辉 committed
483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501
            } 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"
                });
              }
a  
谢明辉 committed
502
            }
a  
谢明辉 committed
503 504 505 506 507 508 509 510 511 512 513 514
            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"
a  
谢明辉 committed
515
        })
a  
谢明辉 committed
516 517 518 519 520 521 522 523 524
          .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"
a  
谢明辉 committed
525
        })
a  
谢明辉 committed
526 527 528 529 530 531 532 533 534
          .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"
a  
谢明辉 committed
535
        })
a  
谢明辉 committed
536 537 538 539 540 541 542 543 544
          .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"
a  
谢明辉 committed
545
        })
a  
谢明辉 committed
546 547 548 549 550 551
          .then(res => {
            this.product_line_type_data = res.data.list_data;
          })
          .catch(err => {});
      },
      get_provinces() {
s  
谢明辉 committed
552 553
        this.$Axios({
          method: "get",
a  
谢明辉 committed
554
          url: this.code_base_url + "countries/0E229CD043/provinces"
a  
谢明辉 committed
555
        })
s  
谢明辉 committed
556
          .then(response => {
a  
谢明辉 committed
557
            this.provinces = response.data.list_data;
s  
谢明辉 committed
558 559 560 561
          })
          .catch(err => {
            console.log(err.message);
          });
a  
谢明辉 committed
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
      },
      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_list_data() {
        var a = this.search_form;
        a.offset = this.offset;
        a.limit = this.limit;
s  
谢明辉 committed
587
        this.$Axios({
a  
谢明辉 committed
588 589 590 591
          methods: "get",
          url: this.contract_base_url,
          params: a,
          headers: { "Content-Type": "application/json" }
s  
谢明辉 committed
592 593
        })
          .then(response => {
a  
谢明辉 committed
594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617
            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;
              }
            }
s  
谢明辉 committed
618 619 620 621
          })
          .catch(err => {
            console.log(err.message);
          });
a  
谢明辉 committed
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
      },
      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.$refs["search_form"].validate(valid => {
          if (valid) {
            this.current_page = 1;
            sessionStorage.setItem(
              "search_condition",
              JSON.stringify(this.search_form)
            );
            this.get_list_data();
a  
谢明辉 committed
648
          } else {
a  
谢明辉 committed
649
            this.$message({
a  
谢明辉 committed
650 651 652
              type: "warning",
              message: "请检查数据格式是否正确"
            });
a  
谢明辉 committed
653
          }
a  
谢明辉 committed
654
        });
a  
谢明辉 committed
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
      },
      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);
s  
谢明辉 committed
691 692
      }
    },
a  
谢明辉 committed
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
    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();
s  
谢明辉 committed
731
      }
a  
谢明辉 committed
732
    }
a  
谢明辉 committed
733
  };
a  
谢明辉 committed
734 735 736
</script>

<style scoped>
s  
谢明辉 committed
737 738 739
span {
  padding-right: 10px;
}
a  
谢明辉 committed
740 741 742
#search >>> label {
  color: black;
}
a  
谢明辉 committed
743 744 745
#search >>> .el-card {
  background-color: rgba(0, 0, 0, 0);
}
a  
谢明辉 committed
746
#search >>> .el-card__body {
a  
谢明辉 committed
747
  background-color: rgba(0, 0, 0, 0);
a  
谢明辉 committed
748 749 750 751
}
#search >>> input {
  border-color: black;
  color: black;
a  
谢明辉 committed
752
  background-color: rgba(0, 0, 0, 0.3);
a  
谢明辉 committed
753 754 755 756
}
#search >>> .el-card__header {
  background-color: #34352c;
}
a  
谢明辉 committed
757
#search >>> .cell {
a  
谢明辉 committed
758 759
  color: black;
}
a  
谢明辉 committed
760 761 762
#data_table .el-table__expanded-cell .pre {
  text-decoration: underline;
  /* font-style: oblique; */
a  
谢明辉 committed
763
  color: #555;
a  
谢明辉 committed
764 765 766 767
}
#data_table {
  color: black;
}
a  
谢明辉 committed
768
#search >>> tr,
a  
谢明辉 committed
769 770
#search >>> .el-table {
  background-color: rgba(255, 255, 255, 0.3);
a  
谢明辉 committed
771
}
a  
谢明辉 committed
772 773
#search >>> .el-table__row {
  background-color: rgba(0, 0, 0, 0.1);
a  
谢明辉 committed
774
}
a  
谢明辉 committed
775 776
#search >>> th {
  background-color: rgba(0, 0, 0, 0);
a  
谢明辉 committed
777
}
a  
谢明辉 committed
778 779 780 781 782 783 784 785
#search >>> .el-table__expanded-cell {
  background-color: rgba(0, 0, 0, 0);
}
#search >>> .el-pager li {
  background-color: rgba(255, 255, 255, 0.3);
}
#search >>> .el-pager .active {
  background-color: rgba(0, 0, 0, 0.4);
a  
谢明辉 committed
786
}
a  
谢明辉 committed
787 788 789 790 791 792 793 794 795 796
#search >>> .el-pagination .btn-next,
#search >>> .el-pagination .btn-prev {
  background-color: rgba(0, 0, 0, 0.4);
}
i:hover {
  cursor: pointer;
  color: orangered;
  transition: all ease 0.5s;
}

a  
谢明辉 committed
797
</style>