Blame view

code/finance_web/src/components/search.vue 40.4 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
        <el-row style="text-align:left">
谢明辉 committed
34 35 36 37 38 39
          <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>
a  
谢明辉 committed
40
            </el-form-item>
谢明辉 committed
41 42 43 44 45 46 47
          </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>
a  
谢明辉 committed
48 49
            </el-form-item>
          </el-col>
谢明辉 committed
50
          <el-col :span="6">
a  
谢明辉 committed
51 52 53 54 55 56 57
            <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>
谢明辉 committed
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
          <el-col :span="6">
            <el-form-item label="合同状态" prop="contract_state_list">
              <el-select v-model="search_form.contract_state_list" multiple>
                <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-row>
        <el-row style="text-align:left">
          <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>
a  
谢明辉 committed
76
        </el-row>
a  
谢明辉 committed
77
        <!-- hide -->
a  
谢明辉 committed
78 79 80 81 82
        <el-row style="margin-bottom:10px">
          <span id="hide_icon_text" @click="show_more">-------
            <i :class="hide_icon">{{hide_text}}</i>&nbsp;&nbsp;-------
          </span>
        </el-row>
a  
谢明辉 committed
83 84 85
        <el-collapse-transition>
          <div id="hide" v-show="!hide_search_item">
            <el-row style="text-align:left">
谢明辉 committed
86

a  
谢明辉 committed
87
              <el-col :span="6">
谢明辉 committed
88 89 90
                <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">
a  
谢明辉 committed
91 92 93 94
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
谢明辉 committed
95 96 97 98
              <el-col :span="6" style="text-align:left">
                <el-form-item label="省" prop="province">
                  <el-select style="width:217px" v-model="search_form.province" filterable clearable placeholder="省" @change="get_cities()">
                    <el-option v-for="(item,index) in provinces" :key="index" :label="item.name" :value="item.province_unid">
a  
谢明辉 committed
99 100 101 102
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
谢明辉 committed
103 104 105 106
              <el-col :span="6" style="text-align:left">
                <el-form-item label="市" prop="city">
                  <el-select style="width:217px" v-model="search_form.city" filterable clearable placeholder="市">
                    <el-option v-for="(item,index) in cities" :key="index" :label="item.name" :value="item.city_unid">
a  
谢明辉 committed
107 108 109 110 111
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
谢明辉 committed
112 113 114
                <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>
a  
谢明辉 committed
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
                  </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="确认收入金额" prop="confirm_income_amount">
                  <el-input style="width:217px" v-model="search_form.confirm_income_amount"></el-input>
                </el-form-item>
              </el-col>
a  
谢明辉 committed
151
            </el-row>
谢明辉 committed
152 153
            <!-- <el-row style="text-align:left">
            </el-row> -->
a  
谢明辉 committed
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
            <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-row>
          </div>
        </el-collapse-transition>
a  
谢明辉 committed
186
      </el-form>
a  
谢明辉 committed
187 188 189 190 191 192
      <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>
a  
谢明辉 committed
193 194 195 196
    </el-card>

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

a  
谢明辉 committed
201
      <!-- default-expand-all : 是否默认展开所有行 -->
a  
谢明辉 committed
202
      <el-table id="data_table" :data="list_data" style="width: 100%;" row-key="contract_unid" border>
s  
谢明辉 committed
203 204
        <el-table-column type="expand">
          <template slot-scope="scope">
a  
谢明辉 committed
205
            <el-row type="flex" justify="space-between" style="text-align:left;padding-bottom:5px">
s  
谢明辉 committed
206
              <el-col :span="4">
a  
谢明辉 committed
207
                <span class="pre">暂停金额:</span>{{scope.row.stop_amount}}
s  
谢明辉 committed
208 209
              </el-col>
              <el-col :span="4">
a  
谢明辉 committed
210
                <span class="pre">坏账金额:</span>{{scope.row.bad_amount}}
s  
谢明辉 committed
211 212
              </el-col>
              <el-col :span="4">
a  
谢明辉 committed
213
                <span class="pre">豁免金额:</span>{{scope.row.exemptions_amount}}
s  
谢明辉 committed
214 215
              </el-col>
              <el-col :span="4">
a  
谢明辉 committed
216
                <span class="pre">抵扣金额:</span>{{scope.row.deduct_amount}}
s  
谢明辉 committed
217 218
              </el-col>
              <el-col :span="4">
a  
谢明辉 committed
219
                <span class="pre">合同状态:</span>{{scope.row.contract_state_name}}
s  
谢明辉 committed
220
              </el-col>
a  
谢明辉 committed
221

s  
谢明辉 committed
222
            </el-row>
a  
谢明辉 committed
223
            <el-row type="flex" justify="space-between" style="text-align:left;padding-bottom:5px">
s  
谢明辉 committed
224
              <el-col :span="4">
a  
谢明辉 committed
225
                <span class="pre">验收款金额:</span>{{scope.row.acceptanc_pay}}
a  
谢明辉 committed
226 227 228
              </el-col>
              <el-col :span="4">
                <span class="pre">产品线类型:</span>{{scope.row.product_line_type_name}}
s  
谢明辉 committed
229 230
              </el-col>
              <el-col :span="4">
a  
谢明辉 committed
231
                <span class="pre">累计应收:</span>{{scope.row.total_receive_amount}}
s  
谢明辉 committed
232 233
              </el-col>
              <el-col :span="4">
a  
谢明辉 committed
234
                <span class="pre">逾期天数:</span>{{scope.row.over_days}}
s  
谢明辉 committed
235 236
              </el-col>
              <el-col :span="4">
a  
谢明辉 committed
237
                <span class="pre">质保金额:</span>{{scope.row.mainten_pay_deliver}}
s  
谢明辉 committed
238 239
              </el-col>
            </el-row>
a  
谢明辉 committed
240
            <el-row type="flex" justify="space-between" style="text-align:left;padding-bottom:5px">
s  
谢明辉 committed
241
              <el-col :span="4">
a  
谢明辉 committed
242 243 244 245
                <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
246 247
              </el-col>
              <el-col :span="4">
a  
谢明辉 committed
248
                <span class="pre">到货款金额:</span>{{scope.row.arrive_pay}}
s  
谢明辉 committed
249 250
              </el-col>
              <el-col :span="4">
a  
谢明辉 committed
251
                <span class="pre">发货日期:</span>{{scope.row.deliver_date}}
s  
谢明辉 committed
252 253
              </el-col>
              <el-col :span="4">
a  
谢明辉 committed
254
                <span class="pre">到货款到期日:</span>{{scope.row.arrive_pay_date}}
s  
谢明辉 committed
255
              </el-col>
a  
谢明辉 committed
256 257 258 259 260 261 262 263
            </el-row>
            <el-row type="flex" justify="space-between" style="text-align:left;padding-bottom:5px">
              <el-col :span="4">
                <span class="pre">省:</span>{{scope.row.province_name}}
              </el-col>
              <el-col :span="4">
                <span class="pre">市:</span>{{scope.row.city_name}}
              </el-col>
s  
谢明辉 committed
264
              <el-col :span="4">
a  
谢明辉 committed
265
                <span class="pre">质保到期日:</span>{{scope.row.mainten_pay_deliver_date}}
s  
谢明辉 committed
266
              </el-col>
a  
谢明辉 committed
267 268 269 270 271 272
              <el-col :span="4">
                <span class="pre">验收日期:</span>{{scope.row.acceptanc_date}}
              </el-col>
              <el-col :span="4">
                <span class="pre">验收款到期日:</span>{{scope.row.acceptanc_pay_date}}
              </el-col>
s  
谢明辉 committed
273
            </el-row>
a  
谢明辉 committed
274 275
            <el-row style="text-align:left;padding-bottom:5px">
              <span class="pre">备注:</span>{{scope.row.contract_note}}
s  
谢明辉 committed
276 277 278 279
            </el-row>
          </template>
        </el-table-column>

a  
谢明辉 committed
280
        <el-table-column sortable label="合同编号" prop="contract_unid" min-width="110px" align="center">
s  
谢明辉 committed
281
        </el-table-column>
a  
谢明辉 committed
282
        <el-table-column sortable :sort-method="project_name_sort" label="项目名称" prop="project_name" min-width="150px" align="center">
s  
谢明辉 committed
283
        </el-table-column>
a  
谢明辉 committed
284
        <el-table-column sortable :sort-method="customer_name_sort" label="客户名称" prop="customer_name" min-width="150px" align="center">
s  
谢明辉 committed
285
        </el-table-column>
a  
谢明辉 committed
286
        <el-table-column sortable :sort-method="salesperson_name_sort" label="销售员" prop="salesperson_name" min-width="100px" align="center">
s  
谢明辉 committed
287
        </el-table-column>
a  
谢明辉 committed
288
        <el-table-column sortable :sort-method="contract_amount_sort" label="合同金额" prop="contract_amount" min-width="120px" align="center">
s  
谢明辉 committed
289
        </el-table-column>
a  
谢明辉 committed
290
        <el-table-column sortable :sort-method="sign_date_sort" label="签订时间" prop="sign_date" min-width="120px" align="center">
s  
谢明辉 committed
291
        </el-table-column>
a  
谢明辉 committed
292
        <el-table-column sortable :sort-method="total_reback_amount_sort" label="累计回款" prop="total_reback_amount" min-width="120px" align="center">
s  
谢明辉 committed
293
        </el-table-column>
a  
谢明辉 committed
294
        <el-table-column sortable :sort-method="contract_remain_sort" label="合同余额" prop="contract_remain" min-width="120px" align="center">
s  
谢明辉 committed
295
        </el-table-column>
a  
谢明辉 committed
296
        <el-table-column sortable :sort-method="total_amount_remain_sort" label="应收余额" prop="total_amount_remain" min-width="120px" align="center">
s  
谢明辉 committed
297
        </el-table-column>
a  
谢明辉 committed
298
        <el-table-column sortable label="账款状态" prop="amount_state_unid_name" min-width="120px" align="center">
s  
谢明辉 committed
299
        </el-table-column>
a  
谢明辉 committed
300
        <el-table-column label="操作" min-width="100px" align="center">
s  
谢明辉 committed
301 302 303 304
          <template slot-scope="scope">
            <el-button type="text" @click="go_to(scope.row.contract_unid)">
              详情
            </el-button>
a  
谢明辉 committed
305 306 307
            <el-button type="text" style="color:red" @click="delete_contract(scope.row.contract_unid)" v-if="management">
              删除
            </el-button>
s  
谢明辉 committed
308 309 310 311 312
          </template>
        </el-table-column>
      </el-table>
      <!-- test------------------------------------------------------------------------------------------------ -->
      <el-row style="padding-top:50px">
a  
谢明辉 committed
313
        <el-col :span="20">
a  
谢明辉 committed
314
          <el-pagination style="float:left" background layout="sizes,total,prev, pager, next" @size-change="handle_size_change" :page-sizes="[10,50,100,300,500,1000,1000000]" :total="total_data" :page-size="limit" prev-text="上一页" next-text="下一页" :current-page="current_page" @current-change="page_change">
a  
谢明辉 committed
315 316 317 318
          </el-pagination>
        </el-col>
        <el-col :span="4">
          <el-button-group style="float:right">
a  
谢明辉 committed
319
            <el-button type="primary" size="small" @click="export_item_selected_dialog_show = true">导出</el-button>
a  
谢明辉 committed
320 321
            <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
322 323 324 325
          </el-button-group>
        </el-col>
      </el-row>
    </el-card>
a  
谢明辉 committed
326 327 328 329 330 331 332 333 334 335 336 337 338 339
    <el-dialog id="export_item_dialog" title="请选择导出项" :visible.sync="export_item_selected_dialog_show" width="32%" :show-close="false">
      <div style="text-align:left">
        <el-checkbox :indeterminate="is_indeterminate" v-model="check_all" @change="check_all_item">全选</el-checkbox>
        <el-checkbox-group style="margin-top:20px" v-model="checked_item_list" @change="chek_item">
          <el-checkbox v-for="item in display_item_list" :label="item.key" :key="item.key">{{item.value}}</el-checkbox>
        </el-checkbox-group>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button-group>
          <el-button type="primary" @click="export_contract()" size="small">确定</el-button>
          <el-button @click="export_item_selected_dialog_show = false" size="small">取消</el-button>
        </el-button-group>
      </div>
    </el-dialog>
a  
谢明辉 committed
340 341 342 343
  </div>
</template>

<script>
a  
谢明辉 committed
344
  const twodecimalrule = {
a  
谢明辉 committed
345 346
    pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
    message: "请输入正确",
a  
谢明辉 committed
347 348 349 350 351 352
    trigger: "blur"
  };
  export default {
    name: "search",
    data() {
      return {
a  
谢明辉 committed
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
        management: false,
        checked_item_list: [],
        check_all: false,
        is_indeterminate: false,
        display_item_list: [
          {
            key: "customer_name",
            value: "客户姓名"
          },
          {
            key: "year",
            value: "所属年份"
          },
          {
            key: "month",
            value: "所属月份"
          },
          {
            key: "sign_date",
            value: "签订日期"
          },
          {
            key: "salesperson_unid",
            value: "销售员"
          },
          {
            key: "product_line_type",
            value: "产品线类型"
          },
          {
            key: "province",
            value: "省"
          },
          {
            key: "city",
            value: "市"
          },
          {
            key: "project_name",
            value: "项目名称"
          },
          {
            key: "contract_amount",
            value: "合同金额"
          },
          {
            key: "stop_amount",
            value: "暂停金额"
          },
          {
            key: "exemptions_amount",
            value: "豁免金额"
          },
          {
            key: "deduct_amount",
            value: "折扣金额"
          },
          {
            key: "total_reback_amount",
            value: "累计已收款"
          },
          {
            key: "contract_remain",
            value: "合同余额"
          },
          {
            key: "amount_state_unid",
            value: "账款状态"
          },
          {
            key: "total_receive_amount",
            value: "累计应收款"
          },
          {
            key: "total_amount_remain",
            value: "应收账款余额"
          },
          {
            key: "over_days",
            value: "逾期天数"
          },
          {
            key: "advance_pay",
            value: "预付款金额"
          },
          {
            key: "advance_pay_date",
            value: "预付款到期日"
          },
          {
            key: "arrive_pay",
            value: "到货款金额"
          },
          {
            key: "deliver_date",
            value: "发货日期"
          },
          {
            key: "arrive_pay_date",
            value: "到货款到期日"
          },
          {
            key: "acceptanc_pay",
            value: "验收款金额"
          },
          {
            key: "acceptanc_date",
            value: "验收日期"
          },
          {
            key: "acceptanc_pay_date",
            value: "验收款到期日"
          },
          {
            key: "mainten_pay",
            value: "质保金额"
          },
          {
            key: "mainten_pay_date",
            value: "质保款到期日"
          },
          {
            key: "goods_acceptanc_date",
            value: "到货验收日期"
          }
        ],
        export_item_selected_dialog_show: false,
a  
谢明辉 committed
480 481
        hide_icon: "icon i-arrowdown-copy",
        hide_text: "显示更多",
a  
谢明辉 committed
482
        hide_search_item: true,
a  
谢明辉 committed
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
        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,
a  
谢明辉 committed
517
          contract_state_list: [],
a  
谢明辉 committed
518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534
          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,
          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
535

a  
谢明辉 committed
536 537 538 539
        list_data: [],
        limit: 10,
        total_data: 0,
        current_page: 1,
s  
谢明辉 committed
540

a  
谢明辉 committed
541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556
        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
557
        }
a  
谢明辉 committed
558
      };
s  
谢明辉 committed
559
    },
a  
谢明辉 committed
560
    computed: {
谢明辉 committed
561 562 563
      /**
       * 年份选择列表
       */
a  
谢明辉 committed
564 565 566 567 568 569 570 571
      year_list: function() {
        var a = new Date().getFullYear();
        var arr = [];
        for (let i = a; i >= 2000; i--) {
          arr.push(i);
        }
        return arr;
      },
谢明辉 committed
572 573 574
      /**
       * 字面意思
       */
a  
谢明辉 committed
575 576 577 578 579 580 581 582 583 584 585 586
      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
587
      }
a  
谢明辉 committed
588
    },
a  
谢明辉 committed
589
    methods: {
a  
谢明辉 committed
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
      delete_contract(unid) {
        this.$confirm(
          "是否删除合同:<p style='text-align:center;color:red;font-weight:bolder'>" +
            unid +
            "<p>",
          "确认信息",
          {
            dangerouslyUseHTMLString: true,
            confirmButtonText: "确认删除",
            cancelButtonText: "取消"
          }
        )
          .then(() => {
            this.delete_contract_by_unid(unid);
          })
          .catch(() => {
            this.$message({
              type: "info",
              message: "放弃删除"
            });
          });
      },
      delete_contract_by_unid(unid) {
        this.$Axios({
          method: "delete",
          url: this.contract_base_url + unid
        })
          .then(res => {
            this.get_list_data();
            if (res.data.ecode == "200") {
              this.$message({
                type: "success",
                message: "删除成功"
              });
            } else {
              this.$message({
                type: "warning",
                message: "删除失败"
              });
            }
          })
          .catch(err => {
            console.log(err);
            this.$message({
              type: "warning",
              message: "删除失败"
            });
          });
      },
谢明辉 committed
639 640 641
      /**
       * 全选
       */
a  
谢明辉 committed
642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657
      check_all_item(val) {
        if (val) {
          this.display_item_list.forEach(e => {
            this.checked_item_list.push(e.key);
          });
        } else {
          this.checked_item_list = [];
        }
        this.is_indeterminate = false;
      },
      chek_item(value) {
        let checkedCount = value.length;
        this.check_all = checkedCount === this.display_item_list.length;
        this.is_indeterminate =
          checkedCount > 0 && checkedCount < this.display_item_list.length;
      },
谢明辉 committed
658 659 660
      /**
       * 自定义排序规则
       */
a  
谢明辉 committed
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
      project_name_sort(a, b) {
        if (a.project_name && b.project_name) {
          return a.project_name.trim().localeCompare(b.project_name.trim());
        }
      },
      customer_name_sort(a, b) {
        if (a.customer && b.customer_name) {
          return a.customer_name.trim().localeCompare(b.customer_name.trim());
        }
      },
      salesperson_name_sort(a, b) {
        if (a.salesperson_name && b.salesperson_name) {
          return a.salesperson_name
            .trim()
            .localeCompare(b.salesperson_name.trim());
        }
      },
      sign_date_sort(a, b) {
        if (a.sign_date == null && b.sign_date == null) {
          return 0;
        }
        if (a.sign_date == null) {
          return -1;
        }
        if (b.sign_date == null) {
          return 1;
        }
        var date1s = a.sign_date.split("-");
        var date2s = b.sign_date.split("-");
        return (
          new Date(date1s[0], date1s[1] - 1, date1s[2]).getTime() -
          new Date(date2s[0], date2s[1] - 1, date2s[2]).getTime()
        );
      },
      contract_amount_sort(a, b) {
        return this.amount_sort(a.contract_amount, b.contract_amount);
      },
      total_reback_amount_sort(a, b) {
        return this.amount_sort(a.total_reback_amount, b.total_reback_amount);
      },
      contract_remain_sort(a, b) {
        return this.amount_sort(a.contract_remain, b.contract_remain);
      },
      total_amount_remain_sort(a, b) {
        return this.amount_sort(a.total_amount_remain, b.total_amount_remain);
      },
      amount_sort(a, b) {
        if (a == null && b == null) {
          return 0;
        }
        if (a == null) {
          return -1;
        }
        if (b == null) {
          return 1;
        }
        return a - b;
      },

      show_more() {
a  
谢明辉 committed
721 722 723 724 725 726 727 728
        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");
      },
谢明辉 committed
729 730 731 732 733
      /**
       * 点击导入按钮,弹出文件选择栏,当选择文件后
       * type为file的input的文件列表会改变
       * 检测到这种改变后,调用import_contract方法
       */
a  
谢明辉 committed
734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756
      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
757 758 759
              var message = [];
              const h = this.$createElement;
              res.data.forEach(e => {
a  
谢明辉 committed
760
                message.push(h("p", null, e.contract_unid));
a  
谢明辉 committed
761 762 763
              });
              this.$message({
                type: "warning",
a  
谢明辉 committed
764
                message: "部分导入信息数据校验未通过,请检查后重新导入",
a  
谢明辉 committed
765 766 767
                duration: 5000
              });
              this.$notify({
a  
谢明辉 committed
768
                title: "校验未通过的合同的编号为:",
a  
谢明辉 committed
769 770 771 772
                duration: 0,
                message: h("p", null, message),
                type: "error"
              });
a  
谢明辉 committed
773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791
            } 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
792
            }
a  
谢明辉 committed
793 794 795 796 797 798 799 800 801 802 803 804
            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
805
        })
a  
谢明辉 committed
806 807 808 809 810 811 812 813 814
          .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
815
        })
a  
谢明辉 committed
816 817 818 819 820 821 822 823 824
          .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
825
        })
a  
谢明辉 committed
826 827 828 829 830 831 832 833 834
          .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
835
        })
a  
谢明辉 committed
836 837 838 839 840 841
          .then(res => {
            this.product_line_type_data = res.data.list_data;
          })
          .catch(err => {});
      },
      get_provinces() {
s  
谢明辉 committed
842 843
        this.$Axios({
          method: "get",
a  
谢明辉 committed
844
          url: this.code_base_url + "countries/0E229CD043/provinces"
a  
谢明辉 committed
845
        })
s  
谢明辉 committed
846
          .then(response => {
a  
谢明辉 committed
847
            this.provinces = response.data.list_data;
s  
谢明辉 committed
848 849 850 851
          })
          .catch(err => {
            console.log(err.message);
          });
a  
谢明辉 committed
852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872
      },
      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);
            });
        }
      },
谢明辉 committed
873 874 875
      /**
       * 获取检索结果
       */
a  
谢明辉 committed
876 877
      get_list_data() {
        var a = this.search_form;
a  
谢明辉 committed
878 879
        if (a.contract_state_list.length > 0) {
          a.contract_states = a.contract_state_list.join(",");
谢明辉 committed
880 881
        } else {
          a.contract_states = "";
a  
谢明辉 committed
882 883 884 885 886 887 888
        }
        Object.keys(a).forEach(key => {
          if (a[key] && typeof a[key] == "string") {
            console.log(a[key]);
            a[key] = a[key].trim();
          }
        });
a  
谢明辉 committed
889 890
        a.offset = this.offset;
        a.limit = this.limit;
s  
谢明辉 committed
891
        this.$Axios({
a  
谢明辉 committed
892 893 894 895
          methods: "get",
          url: this.contract_base_url,
          params: a,
          headers: { "Content-Type": "application/json" }
s  
谢明辉 committed
896 897
        })
          .then(response => {
a  
谢明辉 committed
898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921
            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
922 923 924 925
          })
          .catch(err => {
            console.log(err.message);
          });
a  
谢明辉 committed
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
      },
      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
952
          } else {
a  
谢明辉 committed
953
            this.$message({
a  
谢明辉 committed
954 955 956
              type: "warning",
              message: "请检查数据格式是否正确"
            });
a  
谢明辉 committed
957
          }
a  
谢明辉 committed
958
        });
a  
谢明辉 committed
959
      },
谢明辉 committed
960 961 962
      /**
       * page控件的一些操作
       */
a  
谢明辉 committed
963 964 965 966 967 968
      handle_size_change(val) {
        this.limit = val;
        if (this.list_data.length != 0) {
          this.get_list_data();
        }
      },
a  
谢明辉 committed
969 970 971 972 973 974
      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();
      },
谢明辉 committed
975 976 977
      /**
       * 导出合同的excel表格
       */
a  
谢明辉 committed
978
      export_contract() {
a  
谢明辉 committed
979 980 981 982
        if (this.checked_item_list.length > 0) {
          this.search_form.columns = this.checked_item_list.join(",");
        }
        console.log(this.search_form.columns);
a  
谢明辉 committed
983 984 985 986 987 988 989 990 991 992
        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"
            });
a  
谢明辉 committed
993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007
            if (navigator.appVersion.toString().indexOf(".NET") > 0) {
              window.navigator.msSaveBlob(blob, "合同.xlsx");
            } else {
              // 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对象
            }
            this.export_item_selected_dialog_show = false;
a  
谢明辉 committed
1008 1009
          })
          .catch(err => {
a  
谢明辉 committed
1010 1011
            this.check_all = false;
            this.checked_item_list = [];
a  
谢明辉 committed
1012 1013 1014
            console.log(err.message);
          });
      },
谢明辉 committed
1015 1016 1017
      /**
       * 点击详情后进度contract页面
       */
a  
谢明辉 committed
1018 1019 1020
      go_to(id) {
        sessionStorage.setItem("modify", "1");
        this.$router.push("/nav/contract/" + id);
a  
谢明辉 committed
1021
      },
谢明辉 committed
1022 1023 1024
      /**
       * 改变dialog背景颜色
       */
a  
谢明辉 committed
1025 1026 1027 1028 1029 1030 1031 1032 1033 1034
      change_dialog() {
        if (localStorage.getItem("style")) {
          var style = JSON.parse(localStorage.getItem("style"));
          var dialogs = document.getElementsByClassName("el-dialog");
          for (let i = 0; i < dialogs.length; i++) {
            const e = dialogs[i];
            e.style.backgroundColor = style.color;
            e.style.backgroundImage = style.image;
          }
        }
s  
谢明辉 committed
1035 1036
      }
    },
a  
谢明辉 committed
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
    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
1075
      }
谢明辉 committed
1076 1077 1078
      /**
       *Admin具有删除合同的权限
       */
a  
谢明辉 committed
1079 1080 1081 1082 1083 1084
      if (sessionStorage.getItem("user_name") === "Admin") {
        this.management = true;
      }
    },
    mounted() {
      this.change_dialog();
a  
谢明辉 committed
1085
    }
a  
谢明辉 committed
1086
  };
a  
谢明辉 committed
1087 1088 1089
</script>

<style scoped>
s  
谢明辉 committed
1090 1091 1092
span {
  padding-right: 10px;
}
a  
谢明辉 committed
1093 1094 1095
#search >>> label {
  color: black;
}
a  
谢明辉 committed
1096 1097 1098
#search >>> .el-card {
  background-color: rgba(0, 0, 0, 0);
}
a  
谢明辉 committed
1099
#search >>> .el-card__body {
a  
谢明辉 committed
1100
  background-color: rgba(0, 0, 0, 0);
a  
谢明辉 committed
1101 1102 1103 1104
}
#search >>> input {
  border-color: black;
  color: black;
a  
谢明辉 committed
1105
  background-color: rgba(0, 0, 0, 0.3);
a  
谢明辉 committed
1106 1107 1108 1109
}
#search >>> .el-card__header {
  background-color: #34352c;
}
a  
谢明辉 committed
1110
#search >>> .cell {
a  
谢明辉 committed
1111 1112
  color: black;
}
a  
谢明辉 committed
1113 1114 1115
#data_table .el-table__expanded-cell .pre {
  text-decoration: underline;
  /* font-style: oblique; */
a  
谢明辉 committed
1116
  color: #555;
a  
谢明辉 committed
1117 1118 1119 1120
}
#data_table {
  color: black;
}
a  
谢明辉 committed
1121
#search >>> tr,
a  
谢明辉 committed
1122 1123
#search >>> .el-table {
  background-color: rgba(255, 255, 255, 0.3);
a  
谢明辉 committed
1124
}
a  
谢明辉 committed
1125 1126
#search >>> .el-table__row {
  background-color: rgba(0, 0, 0, 0.1);
a  
谢明辉 committed
1127
}
a  
谢明辉 committed
1128 1129
#search >>> th {
  background-color: rgba(0, 0, 0, 0);
a  
谢明辉 committed
1130
}
a  
谢明辉 committed
1131 1132 1133 1134 1135 1136 1137 1138
#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
1139
}
a  
谢明辉 committed
1140 1141 1142 1143
#search >>> .el-pagination .btn-next,
#search >>> .el-pagination .btn-prev {
  background-color: rgba(0, 0, 0, 0.4);
}
a  
谢明辉 committed
1144
#hide_icon_text:hover {
a  
谢明辉 committed
1145 1146 1147 1148
  cursor: pointer;
  color: orangered;
  transition: all ease 0.5s;
}
a  
谢明辉 committed
1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159
#search >>> .el-dialog {
  border-radius: 20px;
  background-color: lightblue;
}
#search >>> .el-checkbox {
  width: 100px;
  margin-left: 20px;
}
#search >>> .el-checkbox__input.is-checked + .el-checkbox__label {
  color: crimson;
}
a  
谢明辉 committed
1160
</style>