You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

300 lines
9.9 KiB

<template>
<el-dialog title="报告领取信息填写" :show-close="false" :modal="true" :before-close="handleClose" :visible.sync="dialogVisibleCurr">
<el-table
ref="fafanglisttable"
height="300"
:data="fafanglisttable"
border
fit
highlight-current-row
stripe
width="100%"
size="small"
>
<el-table-column type="selection" width="40" />
<el-table-column align="center" label="使用登记证号" prop="shiyongdengjibianhao" />
<el-table-column align="center" label="注册代码" prop="zhucedaima" />
<el-table-column align="center" label="产品编号/出厂编号" prop="chanpinbianhao" />
<el-table-column align="center" label="下次检验日期" prop="xiacijianyanriqi" />
<el-table-column align="center" label="检验结论" prop="jianyanjielun" />
</el-table>
<div>
<el-form ref="lingqu" :model="lingqu" :rules="rules" class="el-form" label-position="right" label-width="100px">
<el-row :gutter="24" justify="center" align="middle" type="flex">
<el-col :span="24">
本次共发放{{ fafanglisttable.length }}
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="14">
<el-form-item label="领取单位" prop="shiyongdanwei">
<el-input v-model="lingqu.shiyongdanwei" type="text" readonly />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="缴费金额" prop="hejijine">
<el-input v-model="lingqu.hejijine" type="text" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="10">
<el-form-item label="报告编号" prop="baogaobianhao">
<el-input v-model="lingqu.baogaobianhao" type="text" readonly />
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item label="发票号码" prop="lingqurenDianhua">
<el-input v-model="lingqu.lingqurenDianhua" type="text" show-word-limit placeholder="请输入后4位发票号" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="10">
<el-form-item label="电子签名" prop="lingquren">
<el-image :src="lingquImage" />
<el-input v-model="lingqu.lingquren" type="text" hidden />
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item label="备注" prop="beizhu">
<el-input v-model="lingqu.beizhu" type="textarea" :rows="3" placeholder="请输入内容" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer" style="text-align: right;margin-top: 30px;">
<el-button type="success" @click="signView">
客户签字
</el-button>
<el-button type="success" @click="mouseDebug">
获取签字
</el-button>
<el-button type="info" @click="logoutSign">
退出签字
</el-button>
<el-button type="primary" @click="saveGrant">
提 交
</el-button>
<el-button @click="closeFafang">
</el-button>
</div>
</div>
</el-dialog>
</template>
<script>
import Sign from '@/utils/signview'
export default {
name: 'SignInfo',
props: {
fafanglisttable: {
type: Array,
required: true
}
},
data() {
return {
lingqu: {
lingquren: '',
lingqurenDianhua: '',
fafangfangshi: '自取',
dataSource: '16',
hejijine: '',
jianyanleibie: ''
},
dialogVisibleCurr: true,
lingquImage: '',
rules: {
lingquren: [{ required: true, message: '领取人不能为空', trigger: 'blur', validator: this.validator }],
lingqurenDianhua: [{ required: true, message: '发票号码不能为空', trigger: 'blur', validator: this.validator }],
hejijine: [{ required: true, message: '缴费金额不能为空', trigger: 'blur', validator: this.validator }]
}
}
},
created() {
},
mounted() {
// 添加消息接收函数
// window.addEventListener('message', this.eventMessage, false)
},
methods: {
signView() { // 领取人签字页
this.lingqu.baogaobianhao = this.fafanglisttable[0].baogaobianhao
this.lingqu.jianyanleibie = this.fafanglisttable[0].jianyanleibie
this.lingqu.shebeizhonglei = this.fafanglisttable[0].shebeizhonglei
this.lingqu.shebeizhongleidaima = this.fafanglisttable[0].shebeizhongleidaima
this.lingqu.shiyongdanwei = this.fafanglisttable[0].shiyongdanwei
this.lingqu.taishu = this.fafanglisttable.length
this.lingqu.jianyanren = this.fafanglisttable[0].jianyanrenyuan
switch (this.fafanglisttable[0].shebeizhongleidaima) {
case '3000' :
case '4000' :
case '5000' :
this.lingqu.dataSource = '16'
if (this.fafanglisttable[0].ysjlId !== null && this.fafanglisttable[0].ysjlId !== undefined) {
this.apibjd({
url: '/charge/findByYsjlId/' + this.fafanglisttable[0].ysjlId,
method: 'get'
}).then(data => {
this.$set(this.lingqu, 'hejijine', data.totalAmount)
this.$set(this.lingqu, 'lingqurenDianhua', data.paymentCode)
})
}
break
default :
this.lingqu.dataSource = '18'
if (this.fafanglisttable[0].sfdId !== null && this.fafanglisttable[0].sfdId !== undefined) {
this.apibjd({
url: '/charge/findById/' + this.fafanglisttable[0].sfdId,
method: 'get'
}).then(data => {
this.$set(this.lingqu, 'hejijine', data.totalAmount)
this.$set(this.lingqu, 'lingqurenDianhua', data.paymentCode)
})
}
if (this.fafanglisttable[0].jianyanleibie === 'ZJ') {
this.$set(this.lingqu, 'shiyongdanwei', this.fafanglisttable[0].zhizaodanwei)
}
break
}
const selectionData = this.fafanglisttable
this.startDevice(selectionData) // 启用设备
},
eventMessage(event) { // 接收电话信息页
const flag = localStorage.getItem('lingqudianhua')
if (flag !== '') {
this.mouseDebug()
}
},
callBack(xmlHttpReq) {
const image = 'data:image/png;base64,' + xmlHttpReq.resp
this.lingqu.lingquren = xmlHttpReq.resp
this.lingquImage = image
this.setGrant()
},
setGrant() { // 获取签名图片信息
// this.lingqu.lingqurenDianhua = localStorage.getItem('lingqudianhua')
// Sign.ZCOutputImageBase64A_onclick(this.lingquImage) // 获取image图像
Sign.stopHtml()
localStorage.removeItem('lingqudianhua')
// Sign.ZCEndSignA_onclick()
},
closeFafang() {
this.$emit('closeFafang')
this.lingqu = {}
Sign.stopHtmlAll()
},
logoutSign() {
Sign.stopHtmlAll()
},
mouseDebug() { // 获取签字
Sign.ReqSign('/ZCOutputImageBase64AB', this.callBack)
},
saveGrant() {
// 领取人填写了
this.$refs.lingqu.validate(valid => {
if (valid) {
// this.fafangVisible = false
this.api({
url: 'ysjlFafang/saveFafang',
method: 'post',
data: {
fafang: this.lingqu,
ysjlIds: this.fafanglisttable.map(ysjl => {
return ysjl.id
}).join(',')
}
}).then((data) => {
if (data === null) {
this.$message.success('发放成功!')
} else {
this.$message.error('发放失败,请刷新后重试!')
}
if (this.lingqu.dataSource === '16') { // 16修改打印状态
this.editPrintState()
} else { // 18系统更改发放状态
this.editfafangState()
}
this.$emit('closeFafang')
Sign.stopHtmlAll()
})
}
})
},
editPrintState() {
// 标记为已打印
if (this.fafanglisttable.length === 0) {
this.$message('请选择单条或者多条设备进行操作。')
return false
}
this.apiOld({
url: '/report/batchUpdPrintState',
method: 'get',
params: {
ids: this.fafanglisttable.map(ysjl => {
return ysjl.id
}).join(','),
type: 'print'
}
}).then((data) => {
if (data.resultValue === '100') {
this.$message.success('更新打印状态成功!')
this.$emit('refulshList')
} else {
this.$message.error('更新打印状态失败!')
}
})
},
editfafangState() {
// 标记为已打印
if (this.fafanglisttable.length === 0) {
this.$message('请选择单条或者多条设备进行操作。')
return false
}
this.api({
url: '/ysjl/updFafangState',
method: 'get',
params: {
ids: this.fafanglisttable.map(ysjl => {
return ysjl.id
}).join(',')
}
}).then((data) => {
this.$message.error(data)
this.$emit('refulshList')
})
},
startDevice(ids) { // 启动设备
const that = this
Sign.ReqSign('/ZCStartDeviceAB', function(xml) {
if (xml.resp === '0') {
that.openHtml(ids)
that.beginSign()
}
})
},
openHtml(ids) {
Sign.ZCShowHtmlA_onclick(ids)
},
beginSign() {
const that = this
Sign.ReqSign('/ZCBeginSignAB/AA660BB350CC600DD400', function(xmlHttpReq) {
if (xmlHttpReq.resp === '0') {
// 成功签名
that.mouseDebug()
}
})
},
handleClose() {
// this.$emit('closeFafang')
}
}
}
</script>
<style scoped>
</style>