Commit 4c136981 by qiaoyanqi

Merge branch 'develop' of http://nvwa.jiuqi.com.cn/gitlab/GFP/RBC/rbc-frontend into develop

parents f9de611b 699dc9ef
......@@ -48,25 +48,29 @@ export function btnVerifySync(stampID, orgdata, signdata) {
var sVerifyResult;
var sVerifyResult = sealSync.Verify(orgdata, signdata);
if (sVerifyResult == true || sVerifyResult == 'true') {
return true
} else if (sVerifyResult == false || sVerifyResult == 'false') {
return
return false
} else{
//当前接口不存在,客户端版本不匹配
alert($_$METHOD_NOT_EXIST);
return;
return false
}
}
export function getVerifyImage(stampID, orgdata, signdata) {
btnVerifySync(stampID, orgdata, signdata)
//获取验证图片
let ret = sealSync.GetStampPicAfterVerified();
if (typeof(ret) == "undefined"){
//当前接口不存在,客户端版本不匹配
alert($_$METHOD_NOT_EXIST);
return;
throw new Error($_$METHOD_NOT_EXIST)
} else if (ret != "") {
return "data:image/gif;base64," + ret
return ret
} else {
//获取错误信息,并弹框显示
ret = sealSync.$GetLastErr();
alert(ret);
throw new Error(ret)
}
}
......
import printBill from '../control/printBill.vue'
import { verifyBill } from './util'
export default {
execute: function (bill, param) {
if (param) {
if (!verifyBill(bill)) {
GMS.$hideContainer.$Message.error('验签失败')
return
}
GMS.$hideContainer.addComponent(printBill, {}, function (c) {
c.billId = bill.getMasterData().getValue('id');
c.billDefineName = param.define;
......
......@@ -2,6 +2,7 @@ import {
SIGNATURE_TABLE_NAME,
SIGNATURE_TABLE,
BILL_GLOBAL_PARAM,
GLOBAL_EVENT,
} from '../../constant'
import { getValueListString } from '../../utils'
import { btnVerifySync } from '../../BJCAWebsign'
......@@ -55,6 +56,12 @@ export const showSignModal = (bill, param, nodeName) => {
subDataObj[subDataIndex].setValue(SIGNATURE_TABLE.NODE_NAME, nodeName, null, 'none')
subDataObj[subDataIndex].setValue(SIGNATURE_TABLE.CREATE_TIME, operateTime, null, 'none')
subDataObj[subDataIndex].setValue(SIGNATURE_TABLE.SIGN_IMAGE, imgData, null, 'none')
subDataObj[subDataIndex].setValue(
SIGNATURE_TABLE.PROTECT_FIELDS,
JSON.stringify(bill.getGlobalParam(BILL_GLOBAL_PARAM.SIGNATURE_FIELDS)),
null,
'none'
)
bill.refreshSubDataRow(SIGNATURE_TABLE_NAME)
}
......@@ -94,14 +101,20 @@ export const showSignModal = (bill, param, nodeName) => {
}
export const verifyBill = (bill) => {
const fields = bill.getGlobalParam(BILL_GLOBAL_PARAM.SIGNATURE_FIELDS)
if (!fields) return true
const valueString = getValueListString(bill, fields)
const dataObjList = bill.getSubData(SIGNATURE_TABLE_NAME)
if (!(dataObjList instanceof Array && dataObjList.length)) return true
const valueString = getValueListString(bill)
if (dataObjList instanceof Array) {
const dataObj = dataObjList[dataObjList.length - 1]
const tmp = btnVerifySync(dataObj.getValue(SIGNATURE_TABLE.CREATE_TIME), valueString, dataObj.getValue(SIGNATURE_TABLE.SIGNATURE_VALUE))
return tmp
const flag = btnVerifySync(
dataObj.getValue(SIGNATURE_TABLE.CREATE_TIME),
valueString,
dataObj.getValue(SIGNATURE_TABLE.SIGNATURE_VALUE)
)
if (!flag) {
window.GMS.vbus.$emit(GLOBAL_EVENT.VERIFY_SIGNATURE_FAIL, window.nros.getCurrTag())
}
return flag
}
return true
}
import { verifyBill } from './util'
export default {
execute: function (bill, param) {
if (verifyBill(bill)) {
GMS.$hideContainer.$Message.success('验签成功')
}
else {
GMS.$hideContainer.$Message.error('验签失败')
}
}
}
......@@ -11,7 +11,6 @@
<script>
import { getValueListString } from '../utils'
import { positionSignSync, OnceStartSign } from '../BJCAWebsign'
import { BILL_GLOBAL_PARAM } from '../constant';
export default {
props: {
......@@ -19,7 +18,6 @@ export default {
},
data() {
return {
signatureFields: [],
imgData: null,
operateTime: null,
valueString: null,
......@@ -34,12 +32,11 @@ export default {
this.imgData = null
this.operateTime = null
this.valueString = null
this.signatureFields = this.bill.getGlobalParam(BILL_GLOBAL_PARAM.SIGNATURE_FIELDS)
},
getSign(type) {
try {
this.operateTime = Date.now()
this.valueString = getValueListString(this.bill, this.signatureFields)
this.valueString = getValueListString(this.bill)
const signData = type === 'writingPad' ? OnceStartSign() : null
const {
imgData,
......
......@@ -5,8 +5,13 @@ export const SIGNATURE_TABLE = {
NODE_NAME: 'nodeName',
CREATE_TIME: 'createTime',
SIGN_IMAGE: 'signImage',
PROTECT_FIELDS: 'guardFields',
}
export const BILL_GLOBAL_PARAM = {
SIGNATURE_FIELDS: 'signatureFields',
}
export const GLOBAL_EVENT = {
VERIFY_SIGNATURE_FAIL: 'verifySignatureFail',
}
......@@ -20,14 +20,19 @@ import {
SIGNATURE_TABLE_NAME,
SIGNATURE_TABLE,
BILL_GLOBAL_PARAM,
GLOBAL_EVENT,
} from '../constant'
import { getValueListString } from '../utils'
import { getVerifyImage } from '../BJCAWebsign'
export default {
data() {
return {
imgData: null,
signatureTableData: [],
signatureNode: [],
tagId: null,
}
},
props: {
......@@ -37,10 +42,54 @@ export default {
},
context: {
type: Object,
default: () => { }
default: () => { },
}
},
computed: {
},
mounted() {
this.tagId = window.nros.getCurrTag()
window.GMS.vbus.$on(GLOBAL_EVENT.VERIFY_SIGNATURE_FAIL, this.loadVerifiedImage)
let protectFields =
this.context.settings.content.signatureConfig
&& this.context.settings.content.signatureConfig.fields
const masterTableName = this.context.bill.getTableType('masterName').name
if (!protectFields || !protectFields.length) {
protectFields = [{ title: 'billCode', field: masterTableName + '.billCode' }]
}
this.context.bill.setGlobalParam(
BILL_GLOBAL_PARAM.SIGNATURE_FIELDS,
protectFields
)
this.getSignatureTableData()
this.initSignatureImg()
},
beforeDestroy() {
window.GMS.vbus.$off(GLOBAL_EVENT.VERIFY_SIGNATURE_FAIL, this.loadVerifiedImage)
},
methods:{
loadVerifiedImage(tagId) {
if (tagId != this.tagId) return
const valueString = getValueListString(this.context.bill)
this.signatureNode = this.signatureTableData.map((dataObj) => {
let verifyImage
try {
verifyImage = getVerifyImage(
dataObj.getValue(SIGNATURE_TABLE.CREATE_TIME),
valueString,
dataObj.getValue(SIGNATURE_TABLE.SIGNATURE_VALUE)
)
} catch (error) {
GMS.$hideContainer.$message.error(error)
}
return {
name: dataObj.getValue(SIGNATURE_TABLE.NODE_NAME),
src: 'data:image/gif;base64,' + verifyImage,
}
})
},
getSignatureTableData() {
const dataObj = this.context.bill.getSubData(SIGNATURE_TABLE_NAME)
if (dataObj instanceof Array) {
......@@ -59,15 +108,6 @@ export default {
})
}
},
mounted() {
this.context.bill.setGlobalParam(BILL_GLOBAL_PARAM.SIGNATURE_FIELDS, this.define.config.fields)
this.getSignatureTableData()
this.initSignatureImg()
},
computed: {
},
beforeDestroy() {
},
}
</script>
......
......@@ -2039,6 +2039,18 @@ export default {
"path": "资产/通用",
"extends": {
"param": [
]
},
"description": "",
"title": "验签[CW_verifySignature]",
"value": "CW_verifySignature",
"alwaysUse": true,
},
{
"discard": false,
"path": "资产/通用",
"extends": {
"param": [
{
"ref": "BillClassVO.all",
"type": "field",
......
......@@ -40,6 +40,7 @@ import relateInvoiceAction from './actions/relateInvoiceAction.js'
import deleteInvoiceAction from './actions/deleteInvoiceAction.js'
import saveActionBXD from './actions/saveActionBXD';
import lincaoAddView from './actions/lincaoAddView';
import CW_verifySignature from './actions/verifySignature';
import lincaoReadView from './actions/lincaoReadView';
//queryAction
......@@ -245,7 +246,8 @@ export default {
CW_submitAction,
CW_closeAction,
CW_imageView,
saveActionBXD
saveActionBXD,
CW_verifySignature,
},
billControl: {
applyDetail,
......
import {
SIGNATURE_TABLE_NAME,
BILL_GLOBAL_PARAM,
SIGNATURE_TABLE
} from './constant'
/**
* 请求基础数据
* @param {string} tableName 基础数据表名
......@@ -35,7 +41,12 @@ export const getBaseData = (tableName, param = {}) => {
/**
* 从bill中根据字段列表取值,拼字符串
*/
export const getValueListString = (bill, list) => {
export const getValueListString = (bill) => {
let list = bill.getGlobalParam(BILL_GLOBAL_PARAM.SIGNATURE_FIELDS)
const signatureTable = bill.getSubData(SIGNATURE_TABLE_NAME)
if (signatureTable instanceof Array && signatureTable.length) {
list = JSON.parse(signatureTable[0].getValue(SIGNATURE_TABLE.PROTECT_FIELDS))
}
const isDateType = (fieldName, tableType) => {
for (let attribute of tableType.attributes) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment