|
@@ -47,8 +47,20 @@ module.exports = app => {
|
|
|
// 判断key是否在常量里,并转换为对应的值
|
|
|
if (!this._.includes(profileConst.cert.postCertConst, data.key)) throw '参数有误';
|
|
|
updateData[data.key] = data.value ? data.value : null;
|
|
|
+ if (data.key === 'type') {
|
|
|
+ const cert_type = this._.find(profileConst.cert.certType, { value: data.value });
|
|
|
+ updateData.cert_type = cert_type ? cert_type.name : '';
|
|
|
+ } else if (data.key === 'name') {
|
|
|
+ const cert_name = this._.find(profileConst.cert.certReg, { value: data.value }) || this._.find(profileConst.cert.certQual, { value: data.value });
|
|
|
+ updateData.cert_name = cert_name ? cert_name.name : '';
|
|
|
+ }
|
|
|
if (data.other && this._.includes(profileConst.cert.postCertConst, data.other.key)) {
|
|
|
updateData[data.other.key] = data.other.value ? data.other.value : null;
|
|
|
+ if (data.other.key === 'name') {
|
|
|
+ console.log(data.other.value);
|
|
|
+ const cert_name = this._.find(profileConst.cert.certReg, { value: data.other.value }) || this._.find(profileConst.cert.certQual, { value: data.other.value });
|
|
|
+ updateData.cert_name = cert_name ? cert_name.name : '';
|
|
|
+ }
|
|
|
}
|
|
|
return await this.db.update(this.tableName, updateData);
|
|
|
}
|