Files
his/openhis-ui-vue3/public/help-center/vuepress-theme-vdoing-doc/fix-lodash.js
zhangfei 9c3e603b94 Fix Bug #443: 手术计费:点击签发耗材时异常报错
当手术计费弹窗中点击"签发"耗材时,因耗材的locationId(发放库房)为空导致后端异常。
在DoctorStationAdviceAppServiceImpl.handDevice方法中,当locationId为null时,使用登录用户的科室ID作为默认值,
与NurseBillingAppService中的处理方式保持一致。
2026-05-08 09:14:18 +08:00

56 lines
1.5 KiB
JavaScript
Executable File

/**
* Fix lodash.template assignWith issue
* This script patches the lodash.template module to include assignWith
*/
const fs = require('fs');
const path = require('path');
const lodashTemplatePath = path.join(__dirname, 'node_modules', 'lodash.template', 'index.js');
if (!fs.existsSync(lodashTemplatePath)) {
console.log('lodash.template not found, skipping patch');
process.exit(0);
}
let content = fs.readFileSync(lodashTemplatePath, 'utf8');
// Check if already patched
if (content.includes('/* LODASH_TEMPLATE_PATCHED */')) {
console.log('lodash.template already patched');
process.exit(0);
}
// Simple assignWith implementation
const assignWithImpl = `
/* LODASH_TEMPLATE_PATCHED */
// Simple assignWith implementation
function assignWith(object, source, customizer) {
if (object == null) {
return object;
}
var props = Object.keys(Object(source));
var index = -1;
var length = props.length;
while (++index < length) {
var key = props[index];
var value = source[key];
var assignedValue = customizer ? customizer(object[key], value, key, object, source) : value;
if (assignedValue !== undefined) {
object[key] = assignedValue;
}
}
return object;
}
`;
// Insert at the beginning of the file after any comments
const firstLineEnd = content.indexOf('\n') + 1;
const before = content.substring(0, firstLineEnd);
const after = content.substring(firstLineEnd);
content = before + assignWithImpl + after;
fs.writeFileSync(lodashTemplatePath, content);
console.log('✓ Patched lodash.template with assignWith function');