소스 검색

修改suggest插件关于json数据当有特殊字符时,获取时数据不全的问题。使用escape和unescape方法编码再解码

raolu 7 년 전
부모
커밋
137ae46d3f
2개의 변경된 파일6개의 추가작업 그리고 4개의 파일을 삭제
  1. 1 1
      js/buz/prescription-adjustment.js
  2. 5 3
      js/plugins/suggest/bootstrap-suggest.min.js

+ 1 - 1
js/buz/prescription-adjustment.js

@ -300,7 +300,7 @@ $(function(){
				$sum = $box.find('.j-sumMedicine'),
				$method = $box.find('.j-method');
			var json = v.json;	
			$box.attr('data-json',JSON.stringify(json))
			$box.attr('data-json',json)
			$single.val(json.physicDose)
			$single.attr('data-code', json.physicDoseUnit)
			$doseUnit.text(json.physicDoseUnitName)

+ 5 - 3
js/plugins/suggest/bootstrap-suggest.min.js

@ -98,7 +98,9 @@
        } else {
            setOrGetDataId($input, keywords.id || '').val(keywords.key).focus();
        }
        if(keywords){
            keywords.json = unescape(keywords.json);
        }
        $input.trigger('onSetSelectValue', [keywords, (options.data.value || options._lastData.value)[keywords.index]]);
    }
    /**
@ -370,9 +372,9 @@
                    tds.push('<td data-name="', field, '">', dataI[field], '</td>');
                }
            }
            var str = JSON.stringify(dataI);
            html.push('<tr data-index="', (dataI.__index || i),
            	'" data-json=', JSON.stringify(dataI),
            	'" data-json=', escape(str),
                ' data-id="', idValue,
                '" data-key="', keyValue, '">',
                tds.join(''), '</tr>');