zslq.vue 5.61 KB
          <!--
 * @Description:
 * @Autor: renchao
 * @LastEditTime: 2023-09-13 16:13:54
-->
<template>
  <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px">
    <el-row>
      <el-col :span="8">
        <el-form-item label="发证人姓名">
          <el-input v-model="ruleForm.fzrmc" disabled></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="发证时间">
          <el-input v-model="ruleForm.fzsj" disabled></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="发证数量">
          <el-input v-model="ruleForm.fzsl" disabled></el-input>
        </el-form-item>
      </el-col>
    </el-row>
    <lb-table :column="tableData.columns" @row-dblclick="handleRowClick" ref="table" @selection-change="handleSelectionChange"
      :data="tableData.data"
      :pagination="false"
      :calcHeight="300">
    </lb-table>
    <el-row>
      <el-col :span="6">
        <el-form-item label="领证人" prop="qlrmc">
          <el-input v-model="ruleForm.qlrmc"></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="证件类型" prop="zjzl">
          <el-select v-model="ruleForm.zjzl" filterable clearable placeholder="请选择">
            <el-option v-for="item in zjzlData" :key="item.dcode" :label="item.dname" :value="item.dcode">
            </el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="证件号" prop="zjh">
          <el-input v-model="ruleForm.zjh"></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="领证人电话" prop="dh">
          <el-input v-model="ruleForm.dh"></el-input>
        </el-form-item>
      </el-col>
    </el-row>
    <el-form-item class="text-center">
      <el-button @click="$popupCacel">取消</el-button>
      <el-button type="primary" @click="handleSubmit">确定</el-button>
    </el-form-item>
  </el-form>
</template>
<script>
  import Vue from 'vue'
  import store from '@/store/index.js'
  import table from "@/utils/mixin/table";
  import { getUnclaimedBdcqz, issueCertificate,getBdcqzQlr } from "@/api/bdcqz.js";
  import { datas } from "../../javascript/fzxxdata";
  export default {
    props: {
      formData: {
        type: Object,
        default: () => {
          return {}
        }
      }
    },
    mixins: [table],
    data () {
      return {
        zjzlData: store.getters.dictData['A30'],
        ruleForm: {
          fzrmc: '',
          fzsj: '',
          fzsl: '',
          bdcqzList: [],
          qlrmc: '',
          zjzl: '',
          zjh: '',
          dh: ''
        },
        rules: {
          qlrmc: [
            { required: true, message: '请输入领证人', trigger: 'blur' }
          ],
          zjzl: [
            { required: true, message: '请选择证件类型', trigger: 'change' }
          ],
          zjh: [
            { required: true, message: '请输入证件号', trigger: 'blur' }
          ],
          dh: [
            { required: true, message: '请输入电话号码', trigger: 'blur' }
          ]
        },
        tableData: {
          total: 0,
          columns: datas.columns().lzgrid,
          data: []
        }
      }
    },
    mounted () {
      this.$nextTick(() => {
        this.loadGrid()
      })
    },
    methods: {
      /**
       * @description: 列表初始化
       * @author: renchao
       */
      loadGrid () {
        let that = this
        getUnclaimedBdcqz({ bsmSlsq: Vue.prototype.$currentRoute.query.bsmSlsq }).then(res => {
          if (res.code === 200) {
            this.tableData.data = res.result.list;
            this.$nextTick(() => {
              this.tableData.data.forEach(item => {
                that.$refs.table.toggleRowSelection(item)
              })
            })
            this.ruleForm.fzrmc = res.result.fzrmc
            this.ruleForm.fzsj = res.result.fzsj
            this.ruleForm.fzsl = res.result.fzsl
            this.ruleForm.bdcqzList = res.result.list;
            res.result.list.length && this.getQlr(res.result.list[0].bsmBdcqz)
          }
        })
      },
      /**
       * @description: 获取权利人信息
       * @author: renchao
       */
      getQlr (bsmBdcqz) {
        getBdcqzQlr(bsmBdcqz).then(res => {
          if (res.code === 200) {
            this.ruleForm = {...this.ruleForm,...res.result} 
          }
        })
      },
      /**
       * @description: handleSelectionChange
       * @param {*} val
       * @author: renchao
       */
      handleSelectionChange (val) {
        this.ruleForm.bdcqzList = val
      },
      /**
       * @description: handleRowClick
       * @param {*} row
       * @author: renchao
       */
      handleRowClick (row) {
        this.$refs.table.toggleRowSelection(row)
      },
      /**
       * @description: handleSubmit
       * @author: renchao
       */
      handleSubmit () {
        this.$refs.ruleForm.validate(valid => {
          if (valid) {
            issueCertificate(this.ruleForm).then(res => {
              if (res.code == 200) {
                this.$message.success('保存成功');
                //刷新列表
                store.dispatch('user/reWorkFresh', true)
                this.$popupCacel()
              } else {
                this.$message.error(res.message)
              }
            })
          } else {
            this.$message.error("请填写领取人信息!")
            return false;
          }
        })
      }
    }
  }
</script>
<style scoped lang="scss">
  @import "~@/styles/mixin.scss";
</style>