multiSelect.html 2.39 KB
<div id="apilist4multi" class="page out" data-title="接口列表-多选">
    <div class="page-content" id="apilist4multi_content">
        <div id="apilist4multi-header"></div>
        <div id="apilist4multi-a" ></div>
        <div id="apilist4multi-b" ></div>
    </div>
</div>
<script>
    require(["mUtil", "NavHeader", "APIList", "Button"], function (mUtil, NavHeader, APIList, Button) {
        new NavHeader({
            el: "apilist4multi-header",
            container: "#apilist4multi",
            option: {
                fixed: true,
                title: "接口列表插件",
                smallTitle: "apilist4multi"
            }
        }).render();

        new APIList({
            el: "apilist4multi-a",
            option: {
                apiConfig: {
					api: {
						id: "4ff3c2114b484c9b888c32554c38cc7b",
						name: "文档列表"
					},
					request: {
						params: {
							query: [
								{name: "categoryid", value: ""},
								{name: "searchKey", value: "{search_key}"},
								{name: "pageNo", value: "{page_no}"},
								{name: "pageSize", value: "{page_size}"}
							],
							body: {}
						},
						path: "/X-WEV-DocList",
						type: "GET"
					},
					response: {
						type: "HTML",
						formats: {
							DATAS: "datas",
							TOTAL_SIZE: "totalSize",
							STATUS_CODE: {
								key: "status",
								value: 1
							},
							ERROR_MSG: "errMsg"
						}
					}
				},
				pageStart: 1,
				pageSize: 10,
				normalview: {
					imgfield: "",
					titlefield: "{subject}",
					otherfields: [
						"{owner}, {createtime}"
					]
				},
				normalSearch: {
					hide: false,
					tip: ""
				},
				options: {
					readonly: true,
					selectable: true,		//数据可选
					showOnePage: false		//显示一页
				}
            }
        }).render();
        
        new Button({
			el:"apilist4multi-b",
			container: "#apilist4multi",
			option:{
				layout : "relative",
				items : [
					{
						text : "全选",
						click : function(){
							var flag = $(this).text().trim() === "全选";
							$(this).closest(".wev-btn").children("span").html(flag ? "取消全选" : "全选");
							Mobile_NS.toggleListData(flag, "apilist4multi-a");
						}
					},{
						text : "确定",
						click : function(){
							Mobile_NS.setAPIBrowser4MultiSelect("apilist4multi-a");//多选赋值脚本
						}
					}
				],
				fixed: true //固定底部
			}
		}).render();
    });
</script>