{"id":996,"date":"2015-10-14T09:02:24","date_gmt":"2015-10-14T01:02:24","guid":{"rendered":"http:\/\/ufqi.com\/blog\/?p=996"},"modified":"2015-10-14T10:40:16","modified_gmt":"2015-10-14T02:40:16","slug":"gmis-input2select-v3","status":"publish","type":"post","link":"https:\/\/ufqi.com\/blog\/gmis-input2select-v3\/","title":{"rendered":"-gMIS\u66f4\u65b0\uff1a\u589e\u52a0input2Select\u529f\u80fd(3)"},"content":{"rendered":"<p>\u7531\u4e8e -gMIS \u4e2d input2Search \/ input2Select \u7684\u529f\u80fd\u975e\u5e38\u597d\u7528\uff0c\u6b64\u524d\u5148\u540e\u8fdb\u884c\u4e86\u4e24\u6b21\u66f4\u65b0\uff1a<\/p>\n<p>1.\u00a0-gMIS\u66f4\u65b0\uff1a\u589e\u52a0input2Select\u529f\u80fd\uff0c\u00a0<a href=\"http:\/\/labs.people.com.cn\/url4p\/index.php?sid=650741&amp;act=query&amp;shortkey=l2Sn\" target=\"_blank\">-R\/l2Sn<\/a><br \/>\n2.\u00a0-gMIS\u66f4\u65b0\uff1a\u589e\u52a0input2Select\u529f\u80fd(2)\uff0c<a href=\"http:\/\/ufqi.com\/naturedns\/search?q=-R\/s2Sx3\" target=\"_blank\">-R\/s2Sx3<\/a><\/p>\n<p>\u73b0\u5728\u8fdb\u884c\u7b2c\u4e09\u6b21\u66f4\u65b0\uff0c\u8981\u89e3\u51b3\u7684\u95ee\u9898\u662f\uff0c\u5f53\u5f85\u9009\/\u5019\u9009\u5217\u8868\u592a\u957f\u65f6\uff0c\u6bd4\u5982\u76ee\u524d -People-FwNews \u4e2d\u7684\u7ad9\u70b9\u540d\u79f0\u5217\u8868\uff0c\u670960K\u8bb0\u5f55\uff0c\u8fd9\u6837\u957f\u7684\u5217\u8868\u52a0\u8f7d\u5230HTML\u7684select\u5143\u7d20\uff0c\u7528\u4f5coption\u65f6\uff0c\u4f1a\u5f71\u54cd\u5230\u9875\u9762\u89e3\u6790\u901f\u5ea6\uff0c\u5728\u8f83\u597d\u7f51\u7edc\u7684\u60c5\u51b5\u4e0b\uff0c\u9700\u898110s\u5de6\u53f3\u7684\u65f6\u95f4\u6765\u5904\u7406\u3002\u8fd9\u9700\u8981\u4f18\u5316\u3002<\/p>\n<p>\u6539\u8fdb\u7684\u7b2c\u4e00\u4e2a\u5c1d\u8bd5\uff0c\u662f\u4f7f\u7528\u5ef6\u65f6\u52a0\u8f7d\u6216\u5f02\u6b65\u52a0\u8f7d\uff0c\u5728 comm\/ido.js \u4e2d\u589e\u52a0 function lazyLoad, \u5f53\u524d\u4e3b\u9875\u9762\u52a0\u8f7d\u5b8c\u6bd5\u4e4b\u540e\uff0c\u518d\u52a0\u8f7d\u8fd9\u4e2a\u8d85\u957f\u768460K\u8bb0\u5f55\u7684select\u7684option list\u3002<\/p>\n<p>\u5b9e\u6d4b\u7684\u7ed3\u679c\u662f\uff0c\u5f53\u901a\u8fc7 -GTAjax \u5f02\u6b65\u52a0\u8f7d\u8fd960K\u7684\u8bb0\u5f55\u53d6\u56de\u5230\u9875\u9762\u524d\u7aef\uff0c\u901a\u8fc7JavaScript\u5199\u5165DOM\u4e2d\u7684select\u7684\u5bf9\u5e94\u5143\u7d20\uff0c\u4ecd\u9700\u82b1\u8d396-8s\u7684\u65f6\u95f4\u3002\u76ee\u524d\u770b\u6765\u65f6\u95f4\u7684\u82b1\u8d39\u4e3b\u8981\u5728DOM\u4e2d\u6784\u5efaselect\u7684\u8d85\u957foption\u5143\u7d20\u3002<\/p>\n<p>\u7ee7\u7eed\u6539\u8fdb\uff0c\u7b2c\u4e8c\u4e2a\u5c1d\u8bd5\uff0c\u5c06\u8fd9\u4e2a\u901a\u8fc7 lazyLoad, -GTAjax \u5f02\u6b65\u52a0\u8f7d\u5230\u5f53\u524d\u9875\u9762\u7684\u5185\u5bb9\uff0c\u5199\u5165\u5230DOM\u7684select\u7684option\u4e2d\u53bb\uff0c\u4fee\u6539\u4e3a\u5199\u5165\u4e00\u4e2a\u9690\u85cf\u7684input\u5143\u7d20\u4e2d\uff0c\u901a\u8fc7\u7ed9input.value\u8d4b\u503c\u7684\u529e\u6cd5\u6765\u5b9e\u73b0\u5c06\u901a\u8fc7\u533f\u540d\u56de\u8c03\u51fd\u6570\u53d6\u56de\u7684\u5185\u5bb9\u5e76\u5165\u5230\u5f53\u524dDOM\u8fd0\u884c\u65f6\u73af\u5883\u3002<\/p>\n<p>\u540c\u65f6\u7ee7\u7eed\u4fee\u6539\uff0ccomm\/ido.js \u4e2d\u7684\u539f\u6765\u7684 input2Search \u51fd\u6570\uff0c\u5c06\u65b0\u589e\u7684\u7f13\u5b58input.value\u51fd\u6570\u8bfb\u53d6\u5230\u8fdb\u6765\uff0c\u4f18\u5148\u5224\u65ad\u8be5\u503c\u662f\u5426\u6709\u7528\uff0c\u5982\u679c\u6709\uff0c\u5219\u4e0d\u518d\u8c03\u7528\u539f\u6765\u7684select\u5217\u8868\u5bf9\u8c61\u3002<\/p>\n<p>\u5982\u6b64\u5b9e\u73b0\u9875\u9762\u4e2d\u8fd0\u7528 input2Search \u7684\u52a0\u901f\u5904\u7406\u3002<\/p>\n<p>\u65b0\u589e\u51fd\u6570 lazyLoad:<\/p>\n<p>\/\/&#8211; lazy load long list, Wed Oct 14 09:08:51 CST 2015<br \/>\nfunction lazyLoad(myObj, myType, myUrl){<br \/>\nwindow.console.log(&#8220;lazyload is starting&#8230;. myurl:[&#8220;+myUrl+&#8221;] myobj:[&#8220;+myObj+&#8221;]&#8221;);<br \/>\nif(true){<br \/>\n\/\/document.onreadystatechange = function(){<br \/>\n\/\/window.onload = function(){<br \/>\nwindow.setTimeout(function(){<br \/>\nif(document.readyState == &#8216;complete&#8217; || document.readyState == &#8216;interactive&#8217;){<br \/>\nsendNotice(true, &#8216;Lazy is loading in process&#8230;.. myobj:[&#8216;+myObj+&#8217;]&#8217;);<br \/>\nvar gta = new GTAjax();<br \/>\ngta.set(&#8216;targetarea&#8217;, &#8216;addareaextradiv&#8217;);<br \/>\ngta.set(&#8220;callback&#8221;, function(){<br \/>\n\/\/window.alert(&#8220;getresult:[&#8220;+this+&#8221;]&#8221;);<br \/>\nvar s = this;<br \/>\nvar resultList = JSON.parse(s);<br \/>\n\/\/var mySele = document.getElementById(resultList.thefield);<br \/>\nconsole.log(&#8220;thefield:[&#8220;+resultList.thefield+&#8221;] &#8220;+(new Date()));<br \/>\nvar optionList = {};<br \/>\nfor(var i=0;i&lt;resultList.result_list.length;i++){<br \/>\nvar aresult = resultList.result_list[i];<br \/>\n\/\/mySele.options[i] = new Option(aresult.sitename+'(&#8216;+aresult.id+&#8217;)&#8217;,aresult.id, true,issel=false);<br \/>\noptionList[aresult.id] = aresult.sitename;<\/p>\n<p>}<br \/>\nvar myOptionList = document.getElementById(resultList.thefield+&#8217;_optionlist&#8217;);<br \/>\nmyOptionList.value = JSON.stringify(optionList);<\/p>\n<p>console.log(&#8220;thefield:[&#8220;+resultList.thefield+&#8221;] completed&#8230;&#8230;&#8221;+(new Date()));<br \/>\n\/\/console.log(JSON.stringify(myOptionList.value));<\/p>\n<p>sendNotice(true, &#8216;Lazy Load is done successfully&#8230;.. myobj:[&#8216;+myObj+&#8217;]&#8217;);<\/p>\n<p>});<br \/>\ngta.get(myUrl);<br \/>\n}<br \/>\nelse{<br \/>\nsendNotice(false, &#8216;Lazy Loading is waiting&#8230;..&#8217;);<br \/>\n}<br \/>\n}, 3*1000);<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>\u6d89\u53ca\u5230\u7684\u5176\u4ed6\u5185\u5bb9:<\/p>\n<p>1. \u533f\u540d\u51fd\u6570\u4f20\u53c2\u6570\u7684\u95ee\u9898<br \/>\nJavaScript\u4e2d\u533f\u540d\u51fd\u6570\u4f20\u53c2\u6570\u662f\u65e0\u6cd5\u76f4\u63a5\u8fdb\u884c\u7684\uff0c\u9700\u8981\u501f\u52a9bind\u7684\u673a\u5236\uff0c\u4f46\u6d4b\u8bd5\u672a\u6210\u529f\u3002\u5b9e\u6d4b\u7684\u7ed3\u679c\u65f6\uff0c\u5728\u7b2c\u4e00\u5c42\u533f\u540d\u51fd\u6570\uff0c\u4e5f\u5373\u5f53\u524d\u8fd0\u884c\u65f6\u73af\u5883\u4e2d\uff0c\u9996\u5c42\u8bbe\u5b9a\u533f\u540d\u51fd\u6570\uff0c\u53ef\u4ee5\u76f4\u63a5\u8c03\u7528\u5176\u5916\u90e8\u7684\u53d8\u91cf\uff0c\u65e0\u9700\u4f20\u9012\u6216\u58f0\u660e\uff1b\u800c\u4e8c\u5c42\u533f\u540d\u51fd\u6570\uff0c\u4e5f\u5373\u5728\u533f\u540d\u51fd\u6570\u4e2d\u518d\u8bbe\u7f6e\u4e00\u5c42\u533f\u540d\u51fd\u6570\uff0c\u5219\u5728\u5176\u4e2d\u65e0\u6cd5\u76f4\u63a5\u4f7f\u7528\u5176\u5916\u90e8\u7684\u53d8\u91cf\u3002<\/p>\n<p>2. JSON<br \/>\n\u501f\u52a9 -GTAjax\uff0c\u8bbe\u5b9a\u4e86\u5c06\u5f53\u524d\u9875\u9762\u5f02\u6b65\u8bfb\u53d6\u4e00\u4e2a\u63a5\u53e3\u6587\u4ef6\uff0cextra\/readtblfield.php \uff0c\u4e24\u8005\u901a\u8fc7JSON\u683c\u5f0f\u7684\u6587\u4ef6\u8fdb\u884c\u6570\u636e\u4ea4\u6362\u3002JSON\u5728 -PHP \u548c JavaScript \u4e2d\u7684\u5185\u7f6e\u51fd\u6570\u53ef\u4ee5\u53c2\u8003\u00a0<a href=\"http:\/\/ufqi.com\/naturedns\/search?q=-R\/Y2Sx1\" target=\"_blank\">-R\/Y2Sx1<\/a>\u00a0.<\/p>\n<p>3. \u5c40\u9650<br \/>\n\u76ee\u524d\u7684\u4f18\u5316\uff0c\u8bf4\u9488\u5bf9\u7684\u5217\u8868\u6570\u636e\u91cf\u7ea7\u572860K\u5de6\u53f3\uff0c\u5982\u679c\u6570\u636e\u96c6\u7ee7\u7eed\u589e\u52a0\u5230100K\uff0c\u6216\u8005\u4ecd\u53ef\u4ee5\u4f7f\u7528\uff0c\u4f46\u6570\u636e\u96c6\u589e\u52a0\u52301M\u65f6\uff0c\u4eba\u9700\u8981\u8003\u8651\u518d\u6b21\u4f18\u5316\uff0c\u518d\u6b21\u4f18\u5316\u7684\u65b9\u5411\u65f6\uff0c\u968f\u7740\u7528\u6237\u7684\u8f93\u5165\u5373\u65f6\u8c03\u7528\u540e\u53f0\u67e5\u8be2\u63a5\u53e3\uff0c\u5373\u65f6\u8fd4\u56de\u6570\u636e\uff0c\u7136\u540e\u518d\u751f\u6210\u5f85\u9009\u5217\u8868\u4f9b\u7528\u6237\u70b9\u9009\uff0c\u5982\u540c\u73b0\u5728\u7684\u641c\u7d22\u5f15\u64ce\u7684\u641c\u7d22\u63d0\u793a\u4e00\u6837\u3002<br \/>\n\u4e4b\u6240\u4ee5\u5728\u8fd9\u4e00\u6b65\u4f18\u5316\u6210\u5c06\u5907\u9009\u6570\u636e\u96c6\u4e00\u6b21\u6027\u8bfb\u53d6\u5230\u524d\u7aef\uff0c\u662f\u56e0\u4e3a\u8fd9\u6837\u5728\u540e\u7eed\u7684\u5904\u7406\u4e2d\u4f1a\u66f4\u5feb\uff0c\u6570\u636e\u6d41\u91cf\u4f1a\u66f4\u5c0f\uff0c\u4e5f\u51cf\u5c11\u4e86\u901a\u4fe1\u6b21\u6570\uff1b\u8fd9\u79cd\u4f18\u5316\u4e3b\u8981\u9488\u5bf9\u6709\u9650\u6570\u636e\u96c6\u3002<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7531\u4e8e -gMIS \u4e2d input2Search \/ input2Select \u7684 &hellip; <a href=\"https:\/\/ufqi.com\/blog\/gmis-input2select-v3\/\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[41,6,2],"tags":[20,71,25],"_links":{"self":[{"href":"https:\/\/ufqi.com\/blog\/wp-json\/wp\/v2\/posts\/996"}],"collection":[{"href":"https:\/\/ufqi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ufqi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ufqi.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ufqi.com\/blog\/wp-json\/wp\/v2\/comments?post=996"}],"version-history":[{"count":4,"href":"https:\/\/ufqi.com\/blog\/wp-json\/wp\/v2\/posts\/996\/revisions"}],"predecessor-version":[{"id":998,"href":"https:\/\/ufqi.com\/blog\/wp-json\/wp\/v2\/posts\/996\/revisions\/998"}],"wp:attachment":[{"href":"https:\/\/ufqi.com\/blog\/wp-json\/wp\/v2\/media?parent=996"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ufqi.com\/blog\/wp-json\/wp\/v2\/categories?post=996"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ufqi.com\/blog\/wp-json\/wp\/v2\/tags?post=996"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}