|
@@ -188,8 +188,48 @@ var rationLibObj = {
|
|
|
SheetDataHelper.loadSheetData(setting, rationLibObj.sectionRationsSpread.getActiveSheet(), datas);
|
|
|
rationLibObj.setTagForHint(rationSheet, datas);
|
|
|
};
|
|
|
+ //定额名称的处理:
|
|
|
+ /*
|
|
|
+ * 1、从定额库提取的名称,是否含有空格:
|
|
|
+ * 1.1、无,则不处理。
|
|
|
+ * 1.2、有,则取第一个空格前的文本,与定额所属节点名称(去掉前面和后面的编号、括号、空格,保留中间的中文及符号)比较是否相同:
|
|
|
+ * 1.2.1、不同,则不处理。
|
|
|
+ * 1.2.2、相同,则将定额名称显示为去除第一个空格及空格之前的文本。
|
|
|
+ */
|
|
|
+ //@param {String}sectionName(章节名称) {Array}datas(定额数据)
|
|
|
+ function simplifyName(sectionName, datas){
|
|
|
+ if (!sectionName || !datas || datas.length === 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //提取需要匹配的章节名称
|
|
|
+ //去掉前缀
|
|
|
+ let toMatchArr = sectionName.split(' '),
|
|
|
+ toMatchStr = toMatchArr[toMatchArr.length - 1];
|
|
|
+ //去掉后缀
|
|
|
+ let sectionReg = /\(\w{9,}\)/g,
|
|
|
+ regMatch = toMatchStr.match(sectionReg);
|
|
|
+ if (regMatch) {
|
|
|
+ toMatchStr = toMatchStr.replace(regMatch[regMatch.length - 1], '');
|
|
|
+ }
|
|
|
+ //简化匹配到的定额名称
|
|
|
+ for (let data of datas) {
|
|
|
+ //第一个空格前的字符串去进行匹配,没有则不匹配
|
|
|
+ let nameArr = data.name.split(' ');
|
|
|
+ if (nameArr.length <= 1) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ let matchName = nameArr[0];
|
|
|
+ if (matchName === toMatchStr) {
|
|
|
+ nameArr.shift();
|
|
|
+ data.name = nameArr.join(' ');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
if (sectionID) {
|
|
|
CommonAjax.post('/complementaryRation/api/getRationGljItemsBySection', {user_Id: userID, sectionId: sectionID, type: me.curLibType}, function (datas) {
|
|
|
+ let chapterSheet = me.rationChapterSpread.getActiveSheet();
|
|
|
+ let sectionName = chapterSheet.getText(chapterSheet.getActiveRowIndex(), chapterSheet.getActiveColumnIndex());
|
|
|
+ simplifyName(sectionName, datas);
|
|
|
showDatas(datas, rationLibObj.sectionRationsSetting);
|
|
|
if(me.doAfterLoadGetRations){
|
|
|
me.doAfterLoadGetRations(datas);
|