Blame view

src/views/djbworkflow/components/dialog/addYwr.vue 21.7 KB
xiaomiao committed
1 2 3
<!--
 * @Description:
 * @Autor: renchao
4
 * @LastEditTime: 2023-12-29 10:04:52
xiaomiao committed
5 6
-->
<template>
xiaomiao committed
7 8
  <dialogBox
    title="申请人信息"
9
    width="75%"
xiaomiao committed
10 11 12 13 14
    isMain
    v-model="myValue"
    :isFullscreen="false"
    @submitForm="submitForm"
    @closeDialog="closeDialog"
15 16 17 18 19 20 21
    :isButton="isShow">
    <el-tabs v-model="activeName" @tab-click="handleClick" class="from-clues-header">
      <el-tab-pane label="基本信息" name="1"></el-tab-pane>
      <el-tab-pane label="企业信息" v-if="showButton" name="2"></el-tab-pane>
      <el-tab-pane label="银行机构" v-if="showButton" name="3"></el-tab-pane>
    </el-tabs>

xiaomiao committed
22 23 24
    <el-form
      :model="ruleForm"
      :rules="rules"
25
      v-if="activeName==1"
xiaomiao committed
26
      ref="ruleForm"
27 28 29 30 31
      label-width="120px">
      <el-form-item label="身份证读卡器">
        <el-button type="text" icon="el-icon-tickets" :disabled="!showButton" @click="readClick">读取</el-button>
        <el-button type="primary" v-if="isBz" @click="handleFilings">信息备案</el-button>
      </el-form-item>
xiaomiao committed
32 33
      <el-row>
        <el-col :span="8">
34 35
          <el-form-item label="头像">
            <el-image style="width:102px;height:126px" :src="ruleForm.avatar || avatar" fit="contain" />
xiaomiao committed
36 37
          </el-form-item>
        </el-col>
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
        <el-col :span="16">
          <el-row>
            <el-col :span="12">
              <el-form-item label="姓名/名称" prop="ywrmc">
                <el-input v-model="ruleForm.ywrmc" maxlegth="15"
                  :disabled="!showButton"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="证件种类" prop="zjzl">
                <el-select
                  clearable
                  v-model="ruleForm.zjzl"
                  :disabled="!showButton"
                  class="width100"
                  placeholder="请选择">
                  <el-option
                    v-for="item in dictData['A30']"
                    :key="item.dcode"
                    :label="item.dname"
                    :value="item.dcode">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="证件号" prop="zjh">
                <el-input
                  v-model="ruleForm.zjh"
                  :disabled="!showButton"
                  maxlength="18"
                  oninput="this.value=this.value.replace(/[^\X0-9]/g,'')"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="性别" prop="xb">
                <el-select
                  clearable
                  v-model="ruleForm.xb"
                  :disabled="!showButton"
                  class="width100"
                  placeholder="请选择">
                  <el-option
                    v-for="item in dictData['A43']"
                    :key="item.dcode"
                    :label="item.dname"
                    :value="item.dcode">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="联系电话" prop="dh">
                <el-input
                  v-model="ruleForm.dh"
                  :disabled="!showButton"
                  maxlength="11"
                  oninput="value=value.replace(/[^\d]/g,'')"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="国家/地区" prop="gj">
                <el-input
                  v-model="ruleForm.gj"
                  maxlength="3"
                  :disabled="!showButton"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
xiaomiao committed
111 112
        </el-col>
      </el-row>
113

xiaomiao committed
114 115
      <el-row>
        <el-col :span="8">
116
          <el-form-item label="义务人类型" prop="ywrlx">
117 118
            <el-select
              clearable
119
              v-model="ruleForm.ywrlx"
120
              class="width100"
121
              :disabled="!showButton"
122 123
              placeholder="请选择">
              <el-option
124
                v-for="item in dictData['A36']"
125 126 127 128 129 130 131 132
                :key="item.dcode"
                :label="item.dname"
                :value="item.dcode">
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="8">
xiaomiao committed
133 134 135 136
          <el-form-item label="权利比例" prop="qlbl">
            <el-input
              v-model="ruleForm.qlbl"
              maxlength="32"
137
              :disabled="!showButton || this.ruleForm.gyfs == 1"></el-input>
xiaomiao committed
138 139 140
          </el-form-item>
        </el-col>
        <el-col :span="8">
xiaomiao committed
141 142 143 144
          <el-form-item label="法人名称" prop="frmc">
            <el-input
              v-model="ruleForm.frmc"
              maxlength="32"
145
              :disabled="!showButton"></el-input>
xiaomiao committed
146 147
          </el-form-item>
        </el-col>
148 149
      </el-row>
      <el-row>
xiaomiao committed
150
        <el-col :span="8">
xiaomiao committed
151 152 153 154
          <el-form-item label="户籍所在省市" prop="hjszss">
            <el-input
              v-model="ruleForm.hjszss"
              maxlength="3"
155
              :disabled="!showButton"></el-input>
xiaomiao committed
156 157
          </el-form-item>
        </el-col>
158
        <el-col :span="16">
xiaomiao committed
159 160 161 162
          <el-form-item label="地址" prop="txdz">
            <el-input
              v-model="ruleForm.txdz"
              maxlength="100"
163
              :disabled="!showButton"></el-input>
xiaomiao committed
164 165 166 167 168 169
          </el-form-item>
        </el-col>
      </el-row>

      <el-row>
        <el-col :span="8">
xiaomiao committed
170 171 172 173
          <el-form-item label="发证机关" prop="fzjg">
            <el-input
              v-model="ruleForm.fzjg"
              maxlength="10"
174
              :disabled="!showButton"></el-input>
xiaomiao committed
175 176 177
          </el-form-item>
        </el-col>
        <el-col :span="8">
xiaomiao committed
178 179 180 181
          <el-form-item label="电子邮件" prop="dzyj">
            <el-input
              v-model="ruleForm.dzyj"
              :disabled="!showButton"
182
              maxlength="25"></el-input>
xiaomiao committed
183 184 185
          </el-form-item>
        </el-col>
        <el-col :span="8">
xiaomiao committed
186 187 188 189 190
          <el-form-item label="邮编" prop="yb">
            <el-input
              v-model.number="ruleForm.yb"
              :disabled="!showButton"
              maxlength="6"
191
              oninput="value=value.replace(/[^\d]/g,'')"></el-input>
xiaomiao committed
192 193 194 195 196 197
          </el-form-item>
        </el-col>
      </el-row>

      <el-row>
        <el-col :span="8">
xiaomiao committed
198 199 200 201
          <el-form-item label="工作单位" prop="gzdw">
            <el-input
              v-model="ruleForm.gzdw"
              maxlength="32"
202
              :disabled="!showButton"></el-input>
xiaomiao committed
203 204 205
          </el-form-item>
        </el-col>
        <el-col :span="16">
xiaomiao committed
206 207 208 209
          <el-form-item label="代理机构" prop="dlrjg">
            <el-input
              v-model="ruleForm.dlrjg"
              maxlength="32"
210
              :disabled="!showButton"></el-input>
xiaomiao committed
211 212 213 214 215 216
          </el-form-item>
        </el-col>
      </el-row>

      <el-row>
        <el-col :span="8">
xiaomiao committed
217 218 219 220
          <el-form-item label="代理人姓名" prop="dlrmc">
            <el-input
              v-model="ruleForm.dlrmc"
              maxlength="15"
221
              :disabled="!showButton"></el-input>
xiaomiao committed
222 223 224
          </el-form-item>
        </el-col>
        <el-col :span="8">
xiaomiao committed
225 226 227 228 229 230
          <el-form-item label="代理人证件类型" prop="dlrzjlx">
            <el-select
              clearable
              v-model="ruleForm.dlrzjlx"
              :disabled="!showButton"
              class="width100"
231
              placeholder="请选择">
xiaomiao committed
232 233 234 235
              <el-option
                v-for="item in dictData['A30']"
                :key="item.dcode"
                :label="item.dname"
236
                :value="item.dcode">
xiaomiao committed
237 238 239 240
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
xiaomiao committed
241 242 243 244 245 246
        <el-col :span="8">
          <el-form-item label="代理人证件号" prop="dlrzjh">
            <el-input
              v-model="ruleForm.dlrzjh"
              :disabled="!showButton"
              maxlength="18"
247
              oninput="this.value=this.value.replace(/[^\X0-9]/g,'')"></el-input>
xiaomiao committed
248 249 250
          </el-form-item>
        </el-col>
      </el-row>
251 252 253 254 255 256 257 258 259 260 261
      <el-row>
        <el-col :span="8">
          <el-form-item label="代理人电话" prop="dlrdh">
            <el-input
              v-model="ruleForm.dlrdh"
              :disabled="!showButton"
              maxlength="11"
              oninput="value=value.replace(/[^\d]/g,'')"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
xiaomiao committed
262
    </el-form>
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285

    <div v-if="activeName==2" class="padding10">
      <el-form :model="queryFormQY" label-width="80px">
        <el-row>
          <el-col :span="8">
            <el-form-item label="姓名/名称">
              <el-input placeholder="姓名/名称" v-model="queryFormQY.qymc" clearable class="width100">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="证件号">
              <el-input placeholder="证件号" v-model="queryFormQY.zjh" clearable class="width100">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8" class="btnColRight">
            <el-form-item>
              <el-button type="primary" @click="handleSearchQY">查询</el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
286
      <el-table :data="tableDataQy.data" border v-Loading="loading" :height="483">
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
        <el-table-column label="序号" type="index" width="50" align="center">
          <template slot-scope="scope">
            {{(pageData.currentPage - 1) * pageData.pageSize + scope.$index + 1}}
          </template>
        </el-table-column>
        <el-table-column v-for="item in tableDataQy.columns" :key="item.index" :width="item.width" :prop="item.prop" :label="item.label" align="center">
        </el-table-column>
        <el-table-column label="操作" width="50">
          <template slot-scope="scope">
            <el-button type="text" @click="handleSelect(scope.row)">使用</el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination background layout="prev, pager, next,total" :total="tableDataQy.total"
        @current-change="handleQYCurrentChange"></el-pagination>
    </div>
    <div v-if="activeName==3" class="padding10">
      <el-form :model="queryFormYH" label-width="80px">
        <el-row>
          <el-col :span="8">
            <el-form-item label="姓名/名称">
              <el-input placeholder="姓名/名称" v-model="queryFormYH.qymc" clearable class="width100">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="证件号">
              <el-input placeholder="证件号" v-model="queryFormYH.zjh" clearable class="width100">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8" class="btnColRight">
            <el-form-item>
              <el-button type="primary" @click="handleSearchYH">查询</el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
325
      <el-table :data="tableDataYh.data" border v-Loading="loading" :height="483">
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341
        <el-table-column label="序号" type="index" width="50" align="center">
          <template slot-scope="scope">
            {{(pageData.currentPage - 1) * pageData.pageSize + scope.$index + 1}}
          </template>
        </el-table-column>
        <el-table-column v-for="item in tableDataYh.columns" :key="item.index" :prop="item.prop" :label="item.label" align="center">
        </el-table-column>
        <el-table-column label="操作" width="50">
          <template slot-scope="scope">
            <el-button type="text" @click="handleSelect(scope.row)">使用</el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination background layout="prev, pager, next,total" :total="tableDataYh.total"
        @current-change="handleYHCurrentChange"></el-pagination>
    </div>
xiaomiao committed
342 343 344
  </dialogBox>
</template>
<script>
345 346 347 348 349 350 351 352 353 354 355 356
  import { mapGetters } from "vuex";
  import store from '@/store/index.js'
  import { replace } from "@/api/company.js"
  import { getUuid } from "@/utils/operation.js"
  import { getIdCardInfo } from '@/utils/operation.js'
  import { queryQyByPage, queryYhByPage, addQy } from "@/api/xxba.js";
  import { dataYh, dataQy, sendThis } from "./addYwrData";
  export default {
    props: {
      value: { type: Boolean, default: false },
      details: { type: Object, default: {} },
      showButton: { type: Boolean, default: false },
xiaomiao committed
357
    },
358 359
    computed: {
      ...mapGetters(["dictData"])
xiaomiao committed
360
    },
361 362
    mounted () {
      sendThis(this)
xiaomiao committed
363
    },
364 365
    data () {
      return {
366
        avatar: require('../../../../image/user.png'),
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387
        isShow: false,
        isBz: false,
        activeName: '1',
        loading: false,
        myValue: this.value,
        ruleForm: {
          ywrlx: "",
          ywrmc: "",
          zjzl: "",
          zjh: "",
          dh: "",
          xb: "",
          frmc: "",
          gjdq: "",
          szss: "",
          txdz: "",
          yb: "",
          fzjg: "",
          dzyj: "",
          qlbl: "",
          gzdw: "",
388
          avatar: "",
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
          dljg: "",
          dlrxm: "",
          dlrzjlx: "",
          dlrzjh: "",
        },
        rules: {
          ywrlx: [{ required: true, message: "义务人类型", trigger: "change" }],
          ywrmc: [{ required: true, message: "姓名/名称", trigger: "blur" }],
          zjzl: [{ required: true, message: "证件种类", trigger: "change" }],
          zjh: [{ required: true, message: "证件号", trigger: "blur" }],
        },
        pageData: {
          currentPage: 1,
          pageSize: 8
        },
        // 企业
        queryFormQY: {
          qymc: "",
          zjh: ""
        },
        tableDataQy: {
          total: 0,
          columns: dataQy.columns(),
          data: [],
        },
        // 银行
        queryFormYH: {
          qymc: "",
          zjh: ""
        },
        tableDataYh: {
          total: 0,
          columns: dataYh.columns(),
          data: [
          ]
xiaomiao committed
424
        }
425
      }
xiaomiao committed
426
    },
427 428 429 430 431 432 433 434 435 436
    watch: {
      value (val) {
        this.myValue = _.cloneDeep(val);
        if (val && Object.keys(this.details).length > 0) {
          this.activeName = '1'
        }
        this.isShow = this.showButton
      },
      details: {
        handler: function (val, oldVal) {
437
          this.ruleForm = _.cloneDeep(val)
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
        },
        deep: true
      }
    },
    methods: {
      handleZjzl (val) {
        if (['6', '7', '8'].includes(val)) {
          this.isBz = true
        } else {
          this.isBz = false
        }
      },
      /**
       * @description: 信息备案
       * @author: renchao
       */
      handleFilings () {
        this.ruleForm.qymc = this.ruleForm.ywrlx
        this.ruleForm.dwdz = this.ruleForm.txdz
        addQy(this.ruleForm).then(res => {
          if (res.code == 200) {
            this.$message.success('备案成功')
          } else {
            this.$message.error(res.message);
          }
        })
      },
      /**
       * @description: handleClick
       * @author: renchao
       */
      handleClick (event, tab) {
        if (this.activeName != 1) {
          this.isShow = false
        } else {
          this.isShow = true
        }
        this.pageData.currentPage = 1
        if (this.activeName == 2) {
          this.handleSearchQY()
        } else {
          this.handleSearchYH()
        }
      },
      /**
       * @description:企业查询
       * @param {*} val
       * @param {*} code
       * @author: renchao
       */
      dicStatus (val, code) {
        let data = store.getters.dictData[code],
          name = '暂无'
        if (data) {
          data.map((item) => {
            if (item.dcode == val) {
              name = item.dname
            }
          })
          return name
        }
      },
      /**
       * @description: 企业信息搜索
       * @author: renchao
       */
      handleSearchQY () {
        let data = { ...this.queryFormQY, ...this.pageData }
        this.tableDataQy.data = []
        queryQyByPage(data).then((res) => {
          if (res.code === 200) {
            let { total, records } = res.result;
            this.tableDataQy.total = total;
            this.tableDataQy.data = records;
            this.tableDataQy.data.forEach(item => {
              item.zjzlMc = this.dicStatus(item.zjzl, 'A30')
              item.ywrmc = item.qymc
              item.txdz = item.dwdz
              item.id = getUuid(16)
            })
          }
        })
      },
      /**
       * @description: handleQYCurrentChange
       * @param {*} val
       * @author: renchao
       */
      handleQYCurrentChange (val) {
        this.pageData.currentPage = val
        this.handleSearchQY()
      },
      /**
       * @description: handlesQYSelect
       * @param {*} val
       * @author: renchao
       */
      handleSelect (val) {
        let that = this
        let bsmSldy = window.currentSelect.bsmSldy ? window.currentSelect.bsmSldy : ''
        this.$confirm('是否同步材料信息?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
541
          distinguishCancelAndClose: true,//区分取消与关闭
542 543 544 545 546 547 548 549 550 551 552 553 554
        }).then(() => {
          replace(val.bsmCompany, this.$route.query.bsmSlsq, bsmSldy).then(res => {
            that.$emit("updateDetail", _.cloneDeep({ ...val, ywrlx: '2' }));
            that.$emit("input", false);
            if (res.code == 200) {
              that.$message({
                type: 'success',
                message: '同步成功!'
              })
            } else {
              this.$message.error(res.message)
            }
          })
555 556 557 558 559
        }).catch(action => {
          if (action == 'cancel') {
            that.$emit("updateDetail", _.cloneDeep({ ...val, sqrlx: '2' }));
            that.$emit("input", false);
          }
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
        })
      },
      /**
       * @description: 银行信息搜索
       * @author: renchao
       */
      handleSearchYH () {
        let data = { ...this.queryFormYH, ...this.pageData }
        this.tableDataYh.data = []
        queryYhByPage(data).then((res) => {
          if (res.code === 200) {
            let { total, records } = res.result;
            this.tableDataYh.total = total;
            this.tableDataYh.data = records;
            this.tableDataYh.data.forEach(item => {
              item.zjzlMc = this.dicStatus(item.zjzl, 'A30')
              item.ywrmc = item.qymc
              item.txdz = item.dwdz
              item.id = getUuid(16)
            })
          }
        })
      },
      /**
       * @description: handleYHCurrentChange
       * @param {*} val
       * @author: renchao
       */
      handleYHCurrentChange (val) {
        this.pageData.currentPage = val
        this.handleSearchQY()
      },
      /**
       * @description: 身份证打卡器
       * @author: renchao
       */
      readClick () {
597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613
        function getObjectByValue (arrayOfObjects, value) {
          var name = ''
          arrayOfObjects.forEach(item => {
            if (item.dname.includes(value)) name = item.dcode
          })
          return name
        }
        getIdCardInfo(this.BASE_API.gaopaiyi).then(res => {
          if (this.BASE_API.gaopaiyi == 'jy') {
            const {
              Name,
              IdNo,
              Sex,
              Address,
              Agencvy,
              PhotoB64
            } = JSON.parse(res)
614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631
            if (Name) {
              this.ruleForm.ywrmc = Name;
              this.ruleForm.zjzl = '1';
              this.ruleForm.zjh = IdNo;
              this.ruleForm.xb = getObjectByValue(this.dictData['A43'], Sex);
              this.ruleForm.txdz = Address;
              this.ruleForm.fzjg = Agencvy;
              this.ruleForm.avatar = 'data:image/png;base64,' + PhotoB64
              this.$message({
                message: '读取成功!',
                type: 'success'
              })
            } else {
              this.$message({
                message: '请放置身份证',
                type: 'warning'
              })
            }
632
          } else {
633 634 635 636 637 638 639 640
            if (res.data.code == 0) {
              let data = res.data.IDCardInfo
              this.ruleForm.ywrmc = data.name
              this.ruleForm.zjzl = '1'
              this.ruleForm.zjh = data.cardID
              this.ruleForm.xb = data.sexCode
              this.ruleForm.txdz = data.address
              this.ruleForm.fzjg = data.issueOrgan
641
              this.ruleForm.avatar = 'data:image/png;base64,' + data.photoBase64
642 643 644 645 646 647 648 649 650 651
              this.$message({
                message: '读取成功!',
                type: 'success'
              })
            } else {
              this.$message({
                message: res.data.message,
                type: 'warning'
              })
            }
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
          }
        })
      },
      /**
       * @description: closeDialog
       * @author: renchao
       */
      closeDialog () {
        this.$emit("input", false);
        this.$refs["ruleForm"].resetFields();
      },
      /**
       * @description: submitForm
       * @author: renchao
       */
      submitForm () {
        this.$refs.ruleForm.validate((valid) => {
          if (valid) {
            this.$emit("input", false);
            this.$emit("updateDetail", _.cloneDeep(this.ruleForm));
          } else {
            return false;
          }
        })
      }
    }
  }
xiaomiao committed
679 680
</script>
<style scoped lang="scss">
681 682 683 684 685 686 687 688 689 690
  @import "~@/styles/dialogBoxheader.scss";
  .submit-button {
    text-align: center;
    height: 52px;
    padding-top: 10px;
    background-color: #fff;
  }
  .padding10 {
    padding-bottom: 10px;
  }
xiaomiao committed
691
</style>