Blame view

src/views/workflow/components/dialog/zslq.vue 8.24 KB
1
<!--
yuanbo committed
2
 * @Description:
3
 * @Autor: renchao
renchao@pashanhoo.com committed
4
 * @LastEditTime: 2024-01-19 14:45:09
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">
38 39 40
          <el-input v-model="ruleForm.lzrxm"></el-input>
        </el-form-item>
      </el-col>
41 42
      <el-col :span="5">
        <el-form-item label="证件类型" prop="lzrzjlb" label-width="80px">
43
          <el-select v-model="ruleForm.lzrzjlb" filterable clearable placeholder="请选择">
yangwei committed
44
            <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">
51 52 53
          <el-input v-model="ruleForm.lzrzjh"></el-input>
        </el-form-item>
      </el-col>
54
      <el-col :span="5">
55 56 57 58 59 60 61 62 63 64
        <el-form-item label="领证人电话" prop="lzrdh">
          <el-input v-model="ruleForm.lzrdh"></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>
蔡俊立 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";
1  
renchao@pashanhoo.com committed
94
  import { log } from 'bpmn-js-token-simulation';
xiaomiao committed
95 96
  export default {
    props: {
97 98 99 100 101 102
      formData: {
        type: Object,
        default: () => {
          return {}
        }
      }
田浩浩 committed
103
    },
xiaomiao committed
104 105 106
    mixins: [table],
    data () {
      return {
yangwei committed
107
        lzrzjlbData: store.getters.dictData['A30'],
xiaomiao committed
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
        ruleForm: {
          fzrmc: '',
          fzsj: '',
          fzsl: '',
          bdcqzList: [],
          lzrxm: '',
          lzrzjlb: '',
          lzrzjh: '',
          lzrdh: ''
        },
        rules: {
          lzrxm: [
            { required: true, message: '请输入领证人', trigger: 'blur' }
          ],
          lzrzjlb: [
            { required: true, message: '请选择证件类型', trigger: 'change' }
          ],
          lzrzjh: [
            { required: true, message: '请输入证件号', trigger: 'blur' }
          ],
          lzrdh: [
129
            { required: true, validator: checkPhone, trigger: ["blur"] }
130
          ]
xiaomiao committed
131 132 133 134
        },
        tableData: {
          total: 0,
          columns: datas.columns().lzgrid,
135 136
          data: []
        }
xiaomiao committed
137
      }
蔡俊立 committed
138
    },
139 140 141 142
    mounted () {
      this.$nextTick(() => {
        this.loadGrid()
      })
蔡俊立 committed
143
    },
xiaomiao committed
144
    methods: {
yuanbo committed
145
      /**
146 147 148 149
       * @description: 身份证打卡器
       * @author: renchao
       */
      readClick () {
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
        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,
            } = JSON.parse(res)
            if (Name) {
              this.ruleForm.lzrxm = Name;
              this.ruleForm.lzrzjlb = '1';
              this.ruleForm.lzrzjh = IdNo;
              this.$message({
                message: '读取成功!',
                type: 'success'
              })
            } else {
              this.$message({
                message: '请放置身份证',
                type: 'warning'
              })
            }
177
          } else {
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
            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'
              })
            }
193 194 195 196
          }
        })
      },
      /**
yuanbo committed
197 198 199
       * @description: 列表初始化
       * @author: renchao
       */
xiaomiao committed
200
      loadGrid () {
201
        let that = this
202
        getUnclaimedBdcqz({ bsmSlsq: Vue.prototype.$currentRoute.query.bsmSlsq }).then(res => {
xiaomiao committed
203 204
          if (res.code === 200) {
            this.tableData.data = res.result.list;
205 206 207 208 209
            this.$nextTick(() => {
              this.tableData.data.forEach(item => {
                that.$refs.table.toggleRowSelection(item)
              })
            })
xiaomiao committed
210 211 212
            this.ruleForm.fzrmc = res.result.fzrmc
            this.ruleForm.fzsj = res.result.fzsj
            this.ruleForm.fzsl = res.result.fzsl
xiaomiao committed
213
            this.ruleForm.bdcqzList = res.result.list;
214 215 216 217 218 219 220 221 222 223 224
            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
225 226 227 228
            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
229 230 231
          }
        })
      },
yuanbo committed
232 233 234 235 236
      /**
       * @description: handleSelectionChange
       * @param {*} val
       * @author: renchao
       */
237 238 239
      handleSelectionChange (val) {
        this.ruleForm.bdcqzList = val
      },
yuanbo committed
240 241 242 243 244
      /**
       * @description: handleRowClick
       * @param {*} row
       * @author: renchao
       */
245 246 247
      handleRowClick (row) {
        this.$refs.table.toggleRowSelection(row)
      },
yuanbo committed
248 249 250 251
      /**
       * @description: handleSubmit
       * @author: renchao
       */
xiaomiao committed
252 253 254 255 256 257
      handleSubmit () {
        this.$refs.ruleForm.validate(valid => {
          if (valid) {
            issueCertificate(this.ruleForm).then(res => {
              if (res.code == 200) {
                this.$message.success('保存成功');
258
                //刷新列表
1  
renchao@pashanhoo.com committed
259
                store.dispatch('user/reWorkFresh', true)
xiaomiao committed
260
                this.$popupCacel()
xiaomiao committed
261 262 263 264 265 266 267
              } else {
                this.$message.error(res.message)
              }
            })
          } else {
            return false;
          }
268 269
        })
      }
xiaomiao committed
270
    }
蔡俊立 committed
271 272 273
  }
</script>
<style scoped lang="scss">
xiaomiao committed
274
  @import "~@/styles/mixin.scss";
蔡俊立 committed
275
</style>
276

277