Blame view

src/views/workflow/components/dialog/zslq.vue 7.32 KB
1
<!--
yuanbo committed
2
 * @Description:
3
 * @Autor: renchao
4
 * @LastEditTime: 2023-11-07 08:46:12
5
-->
蔡俊立 committed
6
<template>
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
  <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>
25 26
    <lb-table :column="tableData.columns" @row-dblclick="handleRowClick" ref="table" @selection-change="handleSelectionChange"
      :data="tableData.data"
27 28
      :pagination="false"
      :calcHeight="300">
29 30
    </lb-table>
    <el-row>
31 32 33 34 35 36 37
      <el-col :span="3">
        <el-form-item label="身份证读卡器">
          <el-button type="text" icon="el-icon-tickets" @click="readClick">读取</el-button>
        </el-form-item>
      </el-col>
      <el-col :span="5">
        <el-form-item label="领证人" prop="lzrxm" label-width="70px">
yangwei committed
38
          <el-input v-model="ruleForm.lzrxm"></el-input>
39 40
        </el-form-item>
      </el-col>
41 42
      <el-col :span="5">
        <el-form-item label="证件类型" prop="lzrzjlb" label-width="80px">
yangwei committed
43 44
          <el-select v-model="ruleForm.lzrzjlb" filterable clearable placeholder="请选择">
            <el-option v-for="item in lzrzjlbData" :key="item.dcode" :label="item.dname" :value="item.dcode">
45 46 47 48
            </el-option>
          </el-select>
        </el-form-item>
      </el-col>
49 50
      <el-col :span="5">
        <el-form-item label="证件号" prop="lzrzjh" label-width="70px">
yangwei committed
51
          <el-input v-model="ruleForm.lzrzjh"></el-input>
52 53
        </el-form-item>
      </el-col>
54
      <el-col :span="5">
yangwei committed
55 56
        <el-form-item label="领证人电话" prop="lzrdh">
          <el-input v-model="ruleForm.lzrdh"></el-input>
57 58 59 60 61 62 63 64
        </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>
蔡俊立 committed
65 66
</template>
<script>
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
  const checkPhone = (rule, value, callback) => {
    let regPone = null
    let mobile = /^(1[3456789]\d{9})$/  //手机号
    let tel = /^((0\d{2,3}-\d{7,8})|(1[3584]\d{9}))$/ // 座机
    if (value && value[0] === '0') {// 检查 value 是否存在并且不是 null 或者 undefined
      regPone = tel
    } else if (value && value[0] !== '0') {
      regPone = mobile
    }
    if (regPone === null) {
      return callback(
        new Error('请输入电话')
      )
    } else if (!regPone.test(value)) {
      return callback(
        new Error("请输入正确的电话格式,其中座机格式'区号-座机号码'")
      )
    } else {
      callback()
    }
  };
88
  import Vue from 'vue'
xiaomiao committed
89 90
  import store from '@/store/index.js'
  import table from "@/utils/mixin/table";
91 92
  import { getIdCardInfo } from '@/utils/operation.js'
  import { getUnclaimedBdcqz, issueCertificate, getBdcqzQlr } from "@/api/bdcqz.js";
93
  import { datas } from "../../javascript/fzxxdata";
xiaomiao committed
94 95
  export default {
    props: {
96 97 98 99 100 101
      formData: {
        type: Object,
        default: () => {
          return {}
        }
      }
田浩浩 committed
102
    },
xiaomiao committed
103 104 105
    mixins: [table],
    data () {
      return {
yangwei committed
106
        lzrzjlbData: store.getters.dictData['A30'],
xiaomiao committed
107 108 109 110 111
        ruleForm: {
          fzrmc: '',
          fzsj: '',
          fzsl: '',
          bdcqzList: [],
yangwei committed
112 113 114 115
          lzrxm: '',
          lzrzjlb: '',
          lzrzjh: '',
          lzrdh: ''
xiaomiao committed
116 117
        },
        rules: {
yangwei committed
118
          lzrxm: [
xiaomiao committed
119 120
            { required: true, message: '请输入领证人', trigger: 'blur' }
          ],
yangwei committed
121
          lzrzjlb: [
xiaomiao committed
122 123
            { required: true, message: '请选择证件类型', trigger: 'change' }
          ],
yangwei committed
124
          lzrzjh: [
xiaomiao committed
125 126
            { required: true, message: '请输入证件号', trigger: 'blur' }
          ],
yangwei committed
127
          lzrdh: [
128
            { required: true, validator: checkPhone, trigger: ["blur"] }
129
          ]
xiaomiao committed
130 131 132 133
        },
        tableData: {
          total: 0,
          columns: datas.columns().lzgrid,
134 135
          data: []
        }
xiaomiao committed
136
      }
蔡俊立 committed
137
    },
138 139 140 141
    mounted () {
      this.$nextTick(() => {
        this.loadGrid()
      })
蔡俊立 committed
142
    },
xiaomiao committed
143
    methods: {
yuanbo committed
144
      /**
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
       * @description: 身份证打卡器
       * @author: renchao
       */
      readClick () {
        getIdCardInfo().then(res => {
          if (res.data.code == 0) {
            let data = res.data.IDCardInfo
            this.ruleForm.lzrxm = data.name
            this.ruleForm.lzrzjlb = '1'
            this.ruleForm.lzrzjh = data.cardID
            this.$message({
              message: '读取成功!',
              type: 'success'
            })
          } else {
            this.$message({
              message: res.data.message,
              type: 'warning'
            })
          }
        })
      },
      /**
yuanbo committed
168 169 170
       * @description: 列表初始化
       * @author: renchao
       */
xiaomiao committed
171
      loadGrid () {
172
        let that = this
173
        getUnclaimedBdcqz({ bsmSlsq: Vue.prototype.$currentRoute.query.bsmSlsq }).then(res => {
xiaomiao committed
174 175
          if (res.code === 200) {
            this.tableData.data = res.result.list;
176 177 178 179 180
            this.$nextTick(() => {
              this.tableData.data.forEach(item => {
                that.$refs.table.toggleRowSelection(item)
              })
            })
xiaomiao committed
181 182 183
            this.ruleForm.fzrmc = res.result.fzrmc
            this.ruleForm.fzsj = res.result.fzsj
            this.ruleForm.fzsl = res.result.fzsl
xiaomiao committed
184
            this.ruleForm.bdcqzList = res.result.list;
185 186 187 188 189 190 191 192 193 194 195
            res.result.list.length && this.getQlr(res.result.list[0].bsmBdcqz)
          }
        })
      },
      /**
       * @description: 获取权利人信息
       * @author: renchao
       */
      getQlr (bsmBdcqz) {
        getBdcqzQlr(bsmBdcqz).then(res => {
          if (res.code === 200) {
yangwei committed
196 197 198 199
            this.ruleForm.lzrxm = res.result.qlrmc;
            this.ruleForm.lzrzjlb = res.result.zjzl;
            this.ruleForm.lzrzjh = res.result.zjh;
            this.ruleForm.lzrdh = res.result.dh;
xiaomiao committed
200 201 202
          }
        })
      },
yuanbo committed
203 204 205 206 207
      /**
       * @description: handleSelectionChange
       * @param {*} val
       * @author: renchao
       */
208 209 210
      handleSelectionChange (val) {
        this.ruleForm.bdcqzList = val
      },
yuanbo committed
211 212 213 214 215
      /**
       * @description: handleRowClick
       * @param {*} row
       * @author: renchao
       */
216 217 218
      handleRowClick (row) {
        this.$refs.table.toggleRowSelection(row)
      },
yuanbo committed
219 220 221 222
      /**
       * @description: handleSubmit
       * @author: renchao
       */
xiaomiao committed
223 224 225 226 227 228
      handleSubmit () {
        this.$refs.ruleForm.validate(valid => {
          if (valid) {
            issueCertificate(this.ruleForm).then(res => {
              if (res.code == 200) {
                this.$message.success('保存成功');
229
                //刷新列表
1  
renchao@pashanhoo.com committed
230
                store.dispatch('user/reWorkFresh', true)
xiaomiao committed
231
                this.$popupCacel()
xiaomiao committed
232 233 234 235 236 237 238
              } else {
                this.$message.error(res.message)
              }
            })
          } else {
            return false;
          }
239 240
        })
      }
xiaomiao committed
241
    }
蔡俊立 committed
242 243 244
  }
</script>
<style scoped lang="scss">
xiaomiao committed
245
  @import "~@/styles/mixin.scss";
蔡俊立 committed
246
</style>
247

248