@@ -66200,13 +66200,13 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
6620066200 * @category Widgets Search
6620166201 * @version 9.1.1
6620266202 * @param {Object} options - 可选参数。
66203- * @param {string} [options.addressUrl] - 配置地址匹配服务。
6620466203 * @param {Object|Array.<string>} [options.cityConfig] - 城市地址匹配配置,默认为全国城市,与 options.cityGeoCodingConfig 支持匹配的服务对应;
6620566204 * 配置两种格式:{key1:{A:[],B:[]}, key2:{C:[],D:[]}} 或 ["成都市","北京市"],用户可根据自己的项目需求进行配置
6620666205 * @param {Object} [options.cityGeoCodingConfig] - 城市地址匹配服务配置,包括:{addressUrl:"",key:""} 默认为 online 地址匹配服务,与 options.cityConfig 对应
6620766206 * @param {boolean} [options.isGeoCoding=true] - 是否支持城市地址匹配功能。
66208- * @param {boolean} [options.pageSize=10] - 返回记录结果数,最大设置为 20。
66209- * @param {boolean} [options.pageNum=1] - 分页页码,默认 1 代表第一页。
66207+ * @param {number} [options.pageSize=10] - 地址匹配查询返回记录结果数,最大设置为 20。
66208+ * @param {number} [options.pageNum=1] - 地址匹配查询分页页码,默认 1 代表第一页。
66209+ * @param {number} [options.perPageDataNum=8] - 每页显示个数,最大值为 8。
6621066210 * @param {string} [options.position='topright'] - 微件在地图中显示的位置,包括:'topleft','topright','bottomleft' 和 'bottomright',继承自 leaflet control。
6621166211 * @param {function} [options.style] - 设置图层点线面默认样式,点样式返回 maker 或者 circleMaker;线和面返回 L.path 样式。
6621266212 * @param {function} [options.onEachFeature] - 在创建和设置样式后,将为每个创建的要素调用一次的函数。用于将事件和弹出窗口附加到要素。默认情况下,对新创建的图层不执行任何操作。
@@ -66224,14 +66224,16 @@ var SearchView = exports.SearchView = _WidgetsViewBase.WidgetsViewBase.extend({
6622466224 },
6622566225 isGeoCoding: true,
6622666226 pageSize: 10,
66227- pageNum: 1
66227+ pageNum: 1,
66228+ perPageDataNum: 8
6622866229 },
6622966230
6623066231 initialize: function initialize(options) {
6623166232 _WidgetsViewBase.WidgetsViewBase.prototype.initialize.apply(this, [options]);
6623266233 //当前选中查询的图层名:
6623366234 this.currentSearchLayerName = "";
6623466235 this.isSearchLayer = false;
66236+ this.perPageDataNum = this.options.perPageDataNum;
6623566237 },
6623666238
6623766239
@@ -66732,7 +66734,7 @@ var SearchView = exports.SearchView = _WidgetsViewBase.WidgetsViewBase.extend({
6673266734 _prepareResultData: function _prepareResultData(data) {
6673366735 this.currentResult = data;
6673466736 //向下取舍,这只页码
66735- var pageCounts = Math.ceil(data.length / 8 );
66737+ var pageCounts = Math.ceil(data.length / this.perPageDataNum );
6673666738 this._resultDomObj.setPageLink(pageCounts);
6673766739 //初始结果页面内容:
6673866740 this._createResultListByPageNum(1, data);
@@ -66758,17 +66760,17 @@ var SearchView = exports.SearchView = _WidgetsViewBase.WidgetsViewBase.extend({
6675866760 _createResultListByPageNum: function _createResultListByPageNum(page, data) {
6675966761 var start = 0,
6676066762 end = void 0;
66761- if (page === 1 && data.length < 8 ) {
66763+ if (page === 1 && data.length < this.perPageDataNum ) {
6676266764 //data数据不满8个时:
6676366765 end = data.length - 1;
66764- } else if (page * 8 > data.length) {
66766+ } else if (page * this.perPageDataNum > data.length) {
6676566767 //最后一页且数据不满8个时
66766- start = 8 * (page - 1);
66768+ start = this.perPageDataNum * (page - 1);
6676766769 end = data.length - 1;
6676866770 } else {
6676966771 //中间页面的情况
66770- start = 8 * (page - 1);
66771- end = page * 8 - 1;
66772+ start = this.perPageDataNum * (page - 1);
66773+ end = page * this.perPageDataNum - 1;
6677266774 }
6677366775 var content = document.createElement("div");
6677466776 for (var i = start; i <= end; i++) {
@@ -66879,8 +66881,8 @@ var SearchView = exports.SearchView = _WidgetsViewBase.WidgetsViewBase.extend({
6687966881 for (var i = 0; i < _this4.searchLayersData.length; i++) {
6688066882 var item = _this4.searchLayersData[i];
6688166883 if (item.properties && item.properties.name === feature.properties.name || item.filterAttribute && item.filterAttribute.filterAttributeName + ": " + item.filterAttribute.filterAttributeValue === layer.filterAttribute.filterAttributeName + ": " + layer.filterAttribute.filterAttributeValue) {
66882- dataIndex = i % 8 ;
66883- page = parseInt(i / 8 ) + 1;
66884+ dataIndex = i % _this4.perPageDataNum ;
66885+ page = parseInt(i / _this4.perPageDataNum ) + 1;
6688466886 break;
6688566887 }
6688666888 }
0 commit comments