<template> <dialogBox title="证书分发" @submitForm="submitForm" saveButton="保存" width="50%" :isFullscreen="false" @closeDialog="closeDialog" v-model="myValue" :isButton="readOnly"> <div> <el-form ref="ruleForm" :model="ruleForm" label-width="100px" :rules="rules"> <el-row> <el-col :span="12"> <el-form-item label="发放编号:" prop="batchno"> <el-input v-model="ruleForm.batchno" :disabled="true"></el-input> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="领取时间:" prop="operationtime"> <el-date-picker v-model="ruleForm.operationtime" class="width100" type="datetime" placeholder="选择日期时间" :disabled="!readOnly" value-format="yyyy-MM-dd HH:mm:ss"> </el-date-picker> </el-form-item> </el-col> </el-row> <el-row> <el-col :span="12"> <el-form-item label="入库人员:"> <el-input v-model="ruleForm.operator" :disabled="true"></el-input> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="领取人:" prop="receiver"> <el-select v-model="ruleForm.receiver" class="width100" placeholder="请选择" :disabled="!readOnly"> <el-option v-for="item in usernames" :key="item" :label="item" :value="item"></el-option> </el-select> </el-form-item> </el-col> </el-row> <div> <el-table :data="tableForm" border :header-cell-style="{'text-align':'center',background: 'rgb(236, 245, 255)'}" :cell-style="{'text-align':'center'}"> <el-table-column prop="name" label="纸质证书类型" width="200"></el-table-column> <el-table-column prop="ksysxlh" label="开始印刷序列号" width="200"></el-table-column> <el-table-column prop="bs" label="本数"> <template slot-scope="scope"> <el-input v-model="scope.row.bs" @blur="ysxlhDeal(scope.row)" oninput="value=value.replace(/[^\d.]/g,'')" maxlength="6" :disabled="!readOnly"></el-input> </template> </el-table-column> <el-table-column prop="jsysxlh" label="结束印刷序列号" width="200"> <template slot-scope="scope"> <span v-if="scope.row.jsysxlh == ''" class="font-red">系统计算</span> <span v-else>{{scope.row.jsysxlh}}</span> </template> </el-table-column> </el-table> </div> <el-form-item label="备注" class="middle-margin-bottom"> <el-input type="textarea" v-model="ruleForm.bz" :rows="4" :disabled="!readOnly"></el-input> </el-form-item> </el-form> </div> </dialogBox> </template> <script> import { getZsStartNo, getSysSerialSingle, getZsEndNo, zsff ,getZsglInfo} from "@/api/zsgl.js" export default { components: { }, computed: { }, props: { value: { type: Boolean, default: false }, }, data () { return { myValue: this.value, readOnly: false, //表单提交数据 ruleForm: { batchno: '', receiver: '', operator: '超级管理员', operationtime: '', bz: '', zsstarno: '', zsendno: '', zsnum: '', zmstarno: '', zmendno: '', zmnum: '' }, //表格数据 tableForm: [ { name: '不动产权证书', ksysxlh: '', jsysxlh: '', bs: '', zslx: 'zs' }, { name: '不动产权登记证明', ksysxlh: '', jsysxlh: '', bs: '', zslx: 'zm' } ], //证书分发业务号固定参数 ywhQueryForm: { serialtype: 'zsffbh', serialname: '证书分发编号', serialcode: 'zsff', digit: '5' }, //用户列表 usernames: ['张三', '李四'], rules: { batchNo: [ { required: true, message: '入库编号不能为空', trigger: 'blur' } ], lqr: [ { required: true, message: '请选择领取人', trigger: 'change' } ], rksj: [ { required: true, message: '请选择入库时间', trigger: 'change' } ], }, } }, watch: { value (val) { this.myValue = val } }, methods: { //表单提交 submitForm () { zsff(this.ruleForm).then(res => { if (res.code == 200) { this.$message.success('保存成功') this.$emit("input", false); this.$refs['ruleForm'].resetFields(); this.resetTableFields(); this.$parent.fetchData(); } else { this.$message.error(res.message) } }) }, //序列号获取 ywhSerial () { getSysSerialSingle(this.ywhQueryForm).then(res => { if (res.code == 200) { this.ruleForm.batchno = res.message; this.readOnly = true; } }) }, //获取详情信息 getDetailInfo(bsmBatch) { getZsglInfo({"bsmBatch": bsmBatch}).then(res => { if(res.code == 200){ this.ruleForm = res.result; this.readOnly = false; this.tableForm[0].ksysxlh = res.result.zsstarno; this.tableForm[0].jsysxlh = res.result.zsendno; this.tableForm[0].bs = res.result.zsnum; this.tableForm[1].ksysxlh = res.result.zmstarno; this.tableForm[1].jsysxlh = res.result.zmendno; this.tableForm[1].bs = res.result.zmnum; } }) }, //初始化开始序列号 initStartNo () { getZsStartNo().then(res => { if (res.code == 200) { this.tableForm[0].ksysxlh = res.result.zsstarno this.tableForm[1].ksysxlh = res.result.zmstarno } }) }, //印刷序列号处理 ysxlhDeal (item) { if (item.bs) { //存在本数 getZsEndNo({ "bookNumber": item.bs, "zslx": item.zslx }).then(res => { if (res.code == 200) { item.jsysxlh = res.result.endno item.bs = res.result.bookNumber this.updateRuleForm(res.result.endno, res.result.bookNumber, item); } else { this.$message.error(res.message) } }) } else { //不存在本数 item.bs = 0; item.jsysxlh = ''; this.updateRuleForm('', 0, item); } }, //更新表单数据 updateRuleForm (endno, bookNumber, item) { if (item.zslx == 'zs') { this.ruleForm.zsstarno = item.ksysxlh; this.ruleForm.zsendno = endno; this.ruleForm.zsnum = bookNumber; } else if (item.zslx == 'zm') { this.ruleForm.zmstarno = item.ksysxlh; this.ruleForm.zmendno = endno; this.ruleForm.zmnum = bookNumber; } }, resetTableFields () { this.tableForm = [ { name: '不动产权证书', ksysxlh: '', jsysxlh: '', bs: 0, zslx: 'zs' }, { name: '不动产权登记证明', ksysxlh: '', jsysxlh: '', bs: 0, zslx: 'zm' } ] }, closeDialog () { this.$emit("input", false); this.$refs['ruleForm'].resetFields(); this.resetTableFields(); } } } </script> <style scoped lang="scss"> @import "~@/styles/mixin.scss"; .font-red { color: red } .middle-margin-bottom { margin-top: 20px } </style>