env_search.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830
  1. function getP(name) {
  2. this.switchParam = {
  3. and: {
  4. source: [
  5. { desc: "与", value: "0" },
  6. { desc: "或", value: "1" },
  7. ],
  8. },
  9. date: {
  10. source: [
  11. { desc: "年", value: "1", className: "smallButton" },
  12. { desc: "月", value: "2", className: "smallButton" },
  13. { desc: "日", value: "3", className: "smallButton" },
  14. ],
  15. },
  16. /* 再改 management(String) 为 int -- 0 为未指定,99 为所有(原为 "0")。Lin
  17. management:{source:[{desc:"所有",value:"0"},{desc:"管理",value:"2"},{desc:"创建",value:"1"},{desc:"已办",value:"3"},{desc:"停用",value:"55"}]},
  18. */ management: {
  19. source: [
  20. { desc: "所有", value: 99 },
  21. { desc: "管理", value: 2 },
  22. { desc: "创建", value: 1 },
  23. { desc: "已办", value: 3 },
  24. { desc: "停用", value: 55 },
  25. ],
  26. },
  27. isfulltext: {
  28. source: [
  29. { desc: "全文", value: "0" },
  30. { desc: "全文", value: "1" },
  31. ],
  32. },
  33. };
  34. return this.switchParam[name];
  35. }
  36. function getPValue(name, v, findcurrent) {
  37. var c = getP(name);
  38. var cc = c["source"];
  39. if (!v) return cc[0];
  40. var i = 0;
  41. for (var i = 0; i < cc.length; i++) {
  42. if (cc[i].value == v) {
  43. if (findcurrent) {
  44. return cc[i];
  45. } else if (i + 1 < cc.length) {
  46. return cc[i + 1];
  47. }
  48. break;
  49. }
  50. }
  51. return cc[0];
  52. }
  53. //日期
  54. $("[ssType=date]") // [wdType=。Lin
  55. .css({ position: "absolute", right: "4px", top: "3px" }) //定位
  56. .each(function () {
  57. var wdName = $(this).attr("ssName"); // ("wdName")。Lin
  58. if ($("[name=" + wdName + "]").val()) {
  59. var matchNumArr = $("[name=" + wdName + "]")
  60. .val()
  61. .match(/\d+/g);
  62. if (matchNumArr) {
  63. var matchNum = matchNumArr.length;
  64. $(this).attr("ssVal", matchNum); // ("wdVal",。Lin
  65. }
  66. } else {
  67. //设置默认格式
  68. var matchNumArr = $("[name=" + wdName + "]")
  69. .attr("format")
  70. .match(/(yyyy|MM|dd)/g);
  71. if (matchNumArr) {
  72. var matchNum = matchNumArr.length;
  73. $(this).attr("ssVal", matchNum); // ("wdVal",。Lin
  74. }
  75. }
  76. $(this).click(function () {
  77. var ccc = getPValue("date", $(this).attr("ssVal")); // ("wdVal"))。Lin
  78. var ccc1 = getPValue("date", $(this).attr("ssVal"), true); // ("wdVal"),。Lin
  79. $(this)
  80. .val(ccc.desc)
  81. .attr("ssVal", ccc.value)
  82. .removeClass(ccc1.className)
  83. .addClass(ccc.className); // ("wdVal",。Lin
  84. });
  85. var ccc = getPValue("date", $(this).attr("ssVal"), true); // ("wdVal"),。Lin
  86. $(this).val(ccc.desc).attr("ssVal", ccc.value).addClass(ccc.className); // ("wdVal",。Lin
  87. $("[name=" + wdName + "]").click(function () {
  88. var radioVal = $('[ssName="' + $(this).attr("name") + '"]').attr("ssVal"); // ('[wdName="'+。("wdVal")。Lin
  89. if (1 == radioVal) {
  90. wd.edit.datePicker({
  91. dateFmt: "yyyy",
  92. });
  93. } else if (2 == radioVal) {
  94. wd.edit.datePicker({
  95. dateFmt: "yyyy-MM",
  96. });
  97. } else if (3 == radioVal) {
  98. wd.edit.datePicker({
  99. dateFmt: "yyyy-MM-dd",
  100. });
  101. }
  102. });
  103. });
  104. //与,或
  105. $("[ssType=and]").each(function () {
  106. // [wdType=。Lin
  107. $(this)
  108. .click(function () {
  109. var v = $(this).attr("ssVal"); // ("wdVal")。Lin
  110. var n = $(this).attr("ssName"); // ("wdName")。Lin
  111. var ccc = getPValue("and", v);
  112. $(this)
  113. .val(ccc.desc)
  114. .attr("ssVal", ccc.value)
  115. .addClass("content-onButton"); // ("wdVal",。Lin
  116. var isAndStr = $("[name=isAnd]").val();
  117. var isAnd = isAndStr ? JSON.parse(isAndStr) : {};
  118. isAnd[n] = ccc.value;
  119. $("[name=isAnd]").val(JSON.stringify(isAnd));
  120. })
  121. .trigger("click");
  122. });
  123. //全文
  124. $("[ssType=fts]")
  125. .hide()
  126. .each(function () {
  127. // [wdType=isFulltext。Lin
  128. var wdName = $(this).attr("ssName"); // ("wdName")。Lin
  129. $(this).click(function () {
  130. var v = $(this).attr("ssVal"); // ("wdVal")。Lin
  131. var ccc = getPValue("isfulltext", v);
  132. $(this)
  133. .val(ccc.desc)
  134. .attr("ssVal", ccc.value)
  135. .toggleClass("content-onButton", ccc.value == "1")
  136. .toggleClass("content-offButton", ccc.value == "0"); // ("wdVal",。Lin
  137. $("[name='isFulltext']").val(ccc.value);
  138. });
  139. var ccc = getPValue("isfulltext", $("[name='isFulltext']").val(), true);
  140. $("[name='isFulltext']").val(ccc.value);
  141. $(this)
  142. .val(ccc.desc)
  143. .attr("ssVal", ccc.value)
  144. .toggleClass("content-onButton", ccc.value == "1")
  145. .toggleClass("content-offButton", ccc.value == "0"); // ("wdVal",。Lin
  146. });
  147. //management
  148. var $m = $("[name=management]");
  149. /* 再改,management(String) 为 int -- 0 为未指定,99 为所有(原为 "0")。Lin
  150. if(! $m.val())
  151. */ if (!$m.val() || "0" == $m.val()) $m.val(getPValue("management").value);
  152. var TAB_NORMAL = "lightTab";
  153. var TAB_SELECTED = "lightTab-selected";
  154. $("[ssType=searchScope]")
  155. .addClass(TAB_NORMAL)
  156. .each(function () {
  157. // [wdType=manage。Lin
  158. var wdName = $(this).attr("ssName"); // ("wdName")。Lin
  159. $(this).click(function () {
  160. $("[ssType=searchScope]").removeClass(TAB_SELECTED).addClass(TAB_NORMAL); // [wdType=manage。Lin
  161. $(this).removeClass(TAB_NORMAL).addClass(TAB_SELECTED);
  162. var v = $(this).attr("ssVal"); // ("wdVal")。Lin
  163. $m.val(v);
  164. $("[name=ssSearch]").trigger("click"); // $("[name=wdSearch]").。Lin
  165. });
  166. if ($m.val() == $(this).attr("ssVal")) {
  167. // ("wdVal"))。Lin
  168. $(this).removeClass(TAB_NORMAL).addClass(TAB_SELECTED);
  169. }
  170. });
  171. var moveCount = 0;
  172. var ele = null;
  173. var resizeDom = null;
  174. var resizeStart = {};
  175. var GRAPH_CLASS = "graph-list";
  176. var ghost = $("#gho666");
  177. if (ghost.length == 0)
  178. ghost = $("<div id='gho666' class=\"" + GRAPH_CLASS + '"/>').css({
  179. width: 0,
  180. height: 50,
  181. border: "1px solid red",
  182. marginLeft: 0,
  183. marginRight: 0,
  184. padding: 0,
  185. display: "inline-block",
  186. });
  187. $(document.body)
  188. .on("mousedown", "." + GRAPH_CLASS, function (e) {
  189. console.log("mousedown");
  190. if (GRAPH_CLASS + "-mask" != e.target.getAttribute("class")) return true;
  191. ele = this;
  192. $(this).trigger("mouseenter");
  193. })
  194. .on("mouseenter", "." + GRAPH_CLASS, function () {
  195. if (!ele) return;
  196. $(this).before(ghost);
  197. })
  198. .on("mousedown", "." + GRAPH_CLASS + "-resize", function (e) {
  199. ele = null;
  200. resizeDom = this.parentNode;
  201. resizeStart = {
  202. x: e.pageX,
  203. y: e.pageY,
  204. width: $(resizeDom).width(),
  205. height: $(resizeDom).height(),
  206. };
  207. return false;
  208. })
  209. .on("mouseleave", function (e) {
  210. // $(this).before(ghost);
  211. console.log("bye");
  212. $("#gho666").css("");
  213. })
  214. .on("mouseup", function () {
  215. var saveSize = false;
  216. if (resizeDom || ele) {
  217. saveSize = true;
  218. if (ele) {
  219. var pos = ele.compareDocumentPosition(ghost[0]);
  220. saveSize = "2" != pos;
  221. }
  222. }
  223. if (saveSize) savegrtjSize(resizeDom.attributes.grtjid.value); // 改,增加入口参数 id -- 为 redrawPcht(。Lin
  224. if (ele) ghost.before(ele).remove();
  225. resizeDom = null;
  226. ele = null;
  227. })
  228. .on("mousemove", function (e) {
  229. if (!resizeDom) return;
  230. $(resizeDom)
  231. .width(resizeStart.width + (e.pageX - resizeStart.x) * 1)
  232. .height(resizeStart.height + (e.pageY - resizeStart.y) * 1);
  233. })
  234. .on("click", ".graphButton", function () {
  235. var url = $("[name=addgrtjUrl]").val();
  236. eval(url);
  237. /* $.post(url,function(data){
  238. data=eval("("+data+")");
  239. wd.display.alert(data.msg);
  240. window.location.reload();
  241. })*/
  242. });
  243. function initGraph() {
  244. if ($(".graphButton").length == 0) return false;
  245. window.onload = function () {
  246. $("." + GRAPH_CLASS).each(function (index, ele) {
  247. //var url=$("[name=getgrtjJsonUrl]").val();
  248. /* 去掉,共用 redrawPcht(id)。Lin
  249. * 对 个人统计表 部件,不调用 redrawPcht(
  250. var url=$("[name=getEChartData]").val();
  251. $.post(url,{grtjid:$(ele).attr("grtjid")},function(result){
  252. if(!result)return true;
  253. result=eval("("+result+")");
  254. var $body=$(ele).find("."+GRAPH_CLASS+"-body").attr("style","height: 100%;");
  255. if($body.width()==0){
  256. $body.parent().width(50);
  257. $body.width(50);
  258. }
  259. if($body.height()==0){
  260. $body.parent().height(50);
  261. $body.height(50);
  262. }
  263. // $body.empty();
  264. /// * 改,去掉 ZGZ:AjaxJson,AjaxJson.success(boolean) 改为 .ssCode(int) -- 用 ServU.wrOkDataByAjax(、ServU.wrErrMsgByAjax(、Map<String, Object> 了。Lin
  265. // if(result.success){
  266. /// *
  267. if(result.ssCode == 1){
  268. console.log(result);
  269. var data = result.data;
  270. var ECData = {};
  271. ECData.name = data.grtj.mc;
  272. ECData.id = $(ele).attr("grtjid");
  273. ECData.type = data.grtj.tjtlbm;
  274. ECData.rename = {name:"mc",value:"sl"};
  275. ECData.dom=$body[0];
  276. // /// *var map = new Map();
  277. // for(var i;i<data.dataArray.length;i++){
  278. // ECData.dataList.push({"sl":data.dataArray[i].sl});
  279. // if(data.dataArray[i].sanjzblist){
  280. // //有三级则为二级
  281. // ECData.dataList.push({"sl":data.dataArray[i].sl});
  282. // }else{
  283. // if(map.has()){
  284. //
  285. // }
  286. // }
  287. // } /// *
  288. ECData.dataList =data.dataArray;
  289. MyECharts.init(ECData);
  290. // /// *
  291. // var myChart=echarts.getInstanceByDom($body[0])
  292. // if(myChart)
  293. // myChart.dispose();
  294. //
  295. // myChart = echarts.init($body[0]);
  296. //
  297. // myChart.setOption(eval("("+data.data+")"));
  298. // /// *
  299. }else{
  300. if("0"==result.data){
  301. $(ele).animate({height:50,width:"100%"}).animate({width:0}).remove();
  302. }else{
  303. $body.html($body.html()+":"+result.msg);
  304. }
  305. }
  306. })
  307. */
  308. if ($(ele).attr("grtjlbm") == 1)
  309. // 个人统计图。Lin
  310. redrawPcht($(ele).attr("grtjid"));
  311. });
  312. };
  313. return true;
  314. }
  315. initGraph();
  316. var save_timeoutid = null;
  317. /* 改,增加入口参数 id -- 为 redrawPcht(。Lin
  318. function savegrtjSize(){
  319. */ function savegrtjSize(id) {
  320. clearTimeout(save_timeoutid);
  321. save_timeoutid = setTimeout(function () {
  322. var grtjlbm; // 再增加,只需要刷新 个人统计图 部件。Lin
  323. var grtjSize = [];
  324. $("." + GRAPH_CLASS).each(function (index, ele) {
  325. if ($(ele).attr("grtjid") == id) {
  326. // 再增加,滤出当前的部件 -- 只需要处理当前改变 Size 的部件。Lin
  327. var data = {
  328. xh: index + 1,
  329. kd: $(ele).width(),
  330. gd: $(ele).height(),
  331. grtjid: $(ele).attr("grtjid"),
  332. };
  333. grtjSize.push(data);
  334. grtjlbm = $(ele).attr("grtjlbm"); // 再增加,只需要刷新 个人统计图 部件。Lin
  335. } // 再增加,滤出当前的部件 -- 只需要处理当前改变 Size 的部件。Lin
  336. });
  337. var url = $("[name=grtjSizeUrl]").val();
  338. url = wd.display.replaceDynamicParam(url, {
  339. grtjSize: encodeURIComponent(JSON.stringify(grtjSize)),
  340. });
  341. $.post(url, function (data) {
  342. data = eval("(" + data + ")");
  343. //wd.display.alert(data.msg);
  344. wd.display.fixationAlert("保存成功");
  345. /* 改,改为新增加的 redrawPcht(id)。Lin
  346. initGraph();
  347. */
  348. /* 再改,只需要刷新 个人统计图 部件。Lin
  349. redrawPcht(id);
  350. */
  351. if (grtjlbm == 1)
  352. // 个人统计图。Lin
  353. redrawPcht(id);
  354. });
  355. }, 2000);
  356. }
  357. // 增加,从 objList.ss.jsp 里的 refreshTjt(id) 抽取到出来,共用。Lin
  358. // savegrtjSize() > savegrtjSize(id)、window.onload()
  359. // 原 savegrtjSize() 里,保存完 Size 后,调用的 initGraph() 只有 return true;
  360. function redrawPcht(id) {
  361. var url = $("[name=getEChartData]").val();
  362. $.post(url, { grtjid: id }, function (result) {
  363. if (!result) return true;
  364. result = eval("(" + result + ")");
  365. var $body = $("#tjt-" + id).attr("style", "height: 100%;");
  366. /* 改,去掉 ZGZ:AjaxJson,AjaxJson.success(boolean) 改为 .ssCode(int) -- 用 ServU.wrOkDataByAjax(、ServU.wrErrMsgByAjax(、Map<String, Object> 了。Lin
  367. * 统一 Ajax 返回标准 -- .ssCode、.ssMsg、.ssData
  368. if(result.success){
  369. */ if (result.ssCode == 0) {
  370. var data = result.ssData;
  371. var ECData = {};
  372. ECData.name = data.grtj.mc;
  373. ECData.id = id;
  374. ECData.type = data.grtj.tjtlbm;
  375. ECData.rename = { name: "mc", value: "sl" };
  376. ECData.dom = $body[0];
  377. ECData.dataList = data.dataArray;
  378. MyECharts.init(ECData);
  379. } else {
  380. if ("0" == result.ssData) {
  381. $("#tjt-" + id)
  382. .parent()
  383. .animate({ height: 50, width: "100%" })
  384. .animate({ width: 0 })
  385. .remove();
  386. } else {
  387. $body.html($body.html() + ":" + result.ssMsg);
  388. }
  389. }
  390. });
  391. }
  392. $(function () {
  393. $(".property").each(function (index, ele) {
  394. if (changeArray[index].length == 0) {
  395. $(this).hide().next().hide();
  396. return;
  397. }
  398. var a = changeArray[index][0];
  399. $(ele).html(
  400. "" +
  401. a.name +
  402. '从<span class="longCardList-warning">' +
  403. a.oldValue +
  404. '</span>改为<span class="longCardList-warning">' +
  405. a.newValue +
  406. "</span>"
  407. );
  408. var size = changeArray[index].length;
  409. $(ele).next(".icon-num").html(size);
  410. console.log($(ele));
  411. $(ele).on("mouseover", function () {
  412. if ($(".propertys").length > 0) {
  413. $(".propertys").remove();
  414. return false;
  415. }
  416. var html =
  417. "<thead><tr><th>修改项</th><th>更改后的值</th><th>原来的值</th></tr></thead><tbody>";
  418. for (var i = 0; i < changeArray[index].length; i++) {
  419. html += "<tr ";
  420. if (changeArray[index][i].url) {
  421. var url = changeArray[index][i].url.replace(/\s/g, "");
  422. html += " onclick=" + url;
  423. }
  424. html +=
  425. " ><td>" +
  426. changeArray[index][i].name +
  427. "</td><td>" +
  428. changeArray[index][i].newValue +
  429. "</td><td>" +
  430. changeArray[index][i].oldValue +
  431. "</td></tr>";
  432. }
  433. html =
  434. '<div class="propertys smallList-div" style="z-index: 99999;background: white;position: absolute;left: 13px;top: 15px;"><table>' +
  435. html +
  436. "</tbody></table></div>";
  437. $("body").append(html);
  438. var bounding = this.getBoundingClientRect();
  439. $(".propertys").css({
  440. left: bounding.left,
  441. top: bounding.top + bounding.height,
  442. });
  443. return false;
  444. });
  445. });
  446. });
  447. //拖动头
  448. $(function () {
  449. return; // 再增加,objList.ss.jsp 的首页,部分上、下两部分了。Lin
  450. try {
  451. if ($(".graphButton").length == 0) return;
  452. var graphDiv = document.querySelector(".graph");
  453. var cardlistDiv = document.querySelector(".longCardList-div");
  454. var lines = document.querySelectorAll("#line");
  455. if (lines.length == 0) {
  456. var line_div = document.createElement("div"); // 新增元素
  457. line_div.className = "content-hSeperator";
  458. line_div.id = "line";
  459. //拖动遮罩层
  460. var mask =
  461. '<div class="dragmask" style="display:none;position: absolute;width: 70px;height: 70px;top: -35px;right: 0px;"></div>';
  462. line_div.innerHTML = mask + "<span></span>";
  463. cardlistDiv.parentNode.insertBefore(line_div, cardlistDiv); // 在这个元素前面增加上去
  464. }
  465. var topDiv = graphDiv;
  466. var bottomDiv = cardlistDiv;
  467. // topDiv.style.display = "block";
  468. // bottomDiv.style.display = "block";
  469. // topDiv.style.height="100%"
  470. // bottomDiv.style.height="auto"
  471. var hh = parseInt($(".longCardList-div").css("height"));
  472. topDiv.style.height = hh * 0.7;
  473. bottomDiv.style.height = hh * 0.3;
  474. // topDiv.style.overflow="hidden"
  475. // bottomDiv.style.overflow="hidden"
  476. el = document.getElementById("line");
  477. el.style.zIndex = "99";
  478. //PC端的变量
  479. var start_Y;
  480. var top_Height;
  481. var middle_Height;
  482. var starty = 0;
  483. var topStartHeight = 0;
  484. var bottomStartHeight = 0;
  485. var dragmask = el.querySelector(".dragmask");
  486. var ismousedown = false;
  487. el.onmousedown = function (e) {
  488. ismousedown = true;
  489. e.preventDefault();
  490. starty = e.screenY;
  491. // topStartHeight = parseInt(topDiv.offsetHeight) || 50;
  492. // bottomStartHeight = parseInt(bottomDiv.offsetHeight) || 50;
  493. topStartHeight = parseInt(topDiv.style.height) || 0;
  494. bottomStartHeight = parseInt(bottomDiv.style.height) || 0;
  495. if (dragmask) {
  496. dragmask.style.display = "";
  497. }
  498. };
  499. document.onmouseup = function (e) {
  500. ismousedown = false;
  501. // wd.display.initWdFitHeight(window);
  502. //
  503. if (dragmask) {
  504. dragmask.style.display = "none";
  505. }
  506. };
  507. document.onmousemove = function (e) {
  508. e = e || window.event;
  509. if (ismousedown && e.which == 0) {
  510. ismousedown = false;
  511. // wd.display.initWdFitHeight(window);
  512. }
  513. if (ismousedown) {
  514. e.preventDefault();
  515. var pageY = e.screenY;
  516. // var topDivHeight = topStartHeight + (pageY - starty);
  517. // var bottomDivHeight = maxHeight - topDivHeight - 2;
  518. var topDivHeight = topStartHeight + (pageY - starty);
  519. var bottomDivHeight = bottomStartHeight - (pageY - starty);
  520. // console.log(topDivHeight+" "+bottomDivHeight)
  521. if (topDivHeight < 0 || bottomDivHeight < 0) {
  522. ismousedown = false;
  523. // wd.display.initWdFitHeight(window);
  524. return;
  525. }
  526. topDiv.style.height = topDivHeight + "px";
  527. bottomDiv.style.height = bottomDivHeight + "px";
  528. //console.log(e.which);
  529. }
  530. };
  531. } catch (e) {
  532. console.log(e);
  533. }
  534. });
  535. // 抽取图片布局处理逻辑为单独的函数
  536. function handleImageLayout($td, $img) {
  537. var tdW = $td.width();
  538. var thumbnailW = $td.find(".longCardList-thumbnail").width();
  539. var infoW = parseInt(tdW - thumbnailW - 18 - 76);
  540. $td.find('.longCardList-info').width(infoW);
  541. var thisH = $td.height();
  542. var infoH = $td.find('.longCardList-info').height();
  543. var imgH = $td.find('.longCardList-thumbnail').height();
  544. if (imgH > infoH) {
  545. var top = parseInt(imgH - infoH);
  546. $td.find('.longCardList').css("margin-top", top + "px");
  547. } else if (imgH < infoH) {
  548. var marginTop = (infoH - imgH) / 2;
  549. $td.find('.longCardList-thumbnail').css("margin-top", marginTop + "px");
  550. }
  551. }
  552. $(function () {
  553. try {
  554. console.log("1111111111");
  555. $(".longCardList-div td").each(function () {
  556. var $td = $(this);
  557. var $thumbnail = $td.find(".longCardList-thumbnail");
  558. var $img = $thumbnail.find("img");
  559. if ($thumbnail.length > 0) {
  560. //有图片的情况下
  561. $img.on("load", function () {
  562. handleImageLayout($td, $img);
  563. // var tdW = $(this).width();
  564. // var thumbnailW = $(this).find(".longCardList-thumbnail").width();
  565. // var infoW = parseInt(tdW - thumbnailW - 18 - 76);
  566. // $(this).find(".longCardList-info").width(infoW);
  567. // var thisH = $(this).height();
  568. // var infoH = $(this).find(".longCardList-info").height();
  569. // var imgH = $(this).find(".longCardList-thumbnail").height();
  570. // if (imgH > infoH) {
  571. // var top = parseInt(imgH - infoH);
  572. // $(this)
  573. // .find(".longCardList")
  574. // .css("margin-top", top + "px");
  575. // } else if (imgH < infoH) {
  576. // var marginTop = (infoH - imgH) / 2;
  577. // $(this)
  578. // .find(".longCardList-thumbnail")
  579. // .css("margin-top", marginTop + "px");
  580. // }
  581. });
  582. // 如果图片已经加载完成,直接触发load事件
  583. if ($img[0].complete) {
  584. handleImageLayout($(this), $img);
  585. }
  586. // $(this).find(".change-button").height(thisH).css("line-height",thisH);
  587. } else {
  588. var tdW = $(this).width();
  589. //没图片的情况下
  590. $(this)
  591. .find(".longCardList-info")
  592. .width(tdW - 85);
  593. }
  594. var thisH = $(this).height();
  595. // $(this).find('.button-change').css("height",thisH);
  596. // $(this).find('.button-revise').css("height",thisH);
  597. // $(this).find('.button-enable').css("height",thisH);
  598. // $(this).find('.button-reason').css("height",thisH);
  599. // $(this).find('.button-recruit').css("height",thisH);
  600. $(this)
  601. .find(".button")
  602. .css({
  603. "line-height": thisH + 22 + "px",
  604. height: thisH,
  605. });
  606. if (thisH < 45) {
  607. // $(this).find('.lbutton').css({
  608. // "font-size":"0px",
  609. // "background-position-y":"center",
  610. // "height":"36px",
  611. // "line-height":"36px"
  612. // })
  613. $(this).find(".button").css({
  614. "font-size": "0px",
  615. "background-position-y": "center",
  616. height: "36px",
  617. "line-height": "36px",
  618. });
  619. }
  620. });
  621. $(".ellipsisDiv").css({
  622. "text-overflow": "ellipsis",
  623. overflow: "hidden",
  624. "-webkit-line-clamp": "2",
  625. "-webkit-box-orient": "vertical",
  626. display: "-webkit-box",
  627. });
  628. } catch (e) {
  629. console.log(e);
  630. }
  631. //初始化growheight
  632. var ids = [];
  633. $(".growHeightDiv").each(function () {
  634. ids.push($(this).attr("id"));
  635. });
  636. if (ids.length > 0) {
  637. wd.display.initGrowHighByIds(ids, "150px");
  638. }
  639. // $(".ellipsisDiv").css({"text-overflow": "ellipsis","overflow": "hidden","-webkit-line-clamp": "2","-webkit-box-orient": "vertical","display": "-webkit-box"})
  640. // }catch(e){
  641. // console.log(e);
  642. // }
  643. });
  644. window.onresize = function() {
  645. $(".longCardList-div td").each(function () {
  646. var $td = $(this);
  647. var $thumbnail = $td.find(".longCardList-thumbnail");
  648. var $img = $thumbnail.find("img");
  649. if ($thumbnail.length > 0) {
  650. handleImageLayout($td, $img);
  651. }
  652. });
  653. }
  654. function wdRefresh() {
  655. if (initGraph()) {
  656. } else {
  657. $("form").submit();
  658. }
  659. }
  660. //折叠
  661. $(function () {
  662. var data = {};
  663. var all = {};
  664. var childData = {};
  665. var topData = {};
  666. $("[searchPId]").each(function () {
  667. var pid = $(this).attr("searchPId");
  668. var id = $(this).attr("searchId");
  669. all[id] = $(this);
  670. if (pid) {
  671. if (!data[pid]) data[pid] = [];
  672. childData[id] = $(this);
  673. data[pid].push($(this));
  674. } else {
  675. topData[id] = $(this);
  676. }
  677. });
  678. var defaultExpand = false;
  679. function showChildren(ishow, id) {
  680. if (!data[id]) return;
  681. for (var i = 0; i < data[id].length; i++) {
  682. if (ishow) {
  683. data[id][i].show();
  684. } else {
  685. data[id][i].hide();
  686. }
  687. arguments.callee(ishow, data[id][i].attr("searchId"));
  688. }
  689. }
  690. for (var key in topData) {
  691. if (!(data[key] && data[key].length > 0)) continue;
  692. // <div style="display:none" class="indenter" expandClass="list-expandedGroupIcon" collapseClass="list-groupIcon"></div>
  693. // $("<div id=\""+key+"\">喵夹</div>").prependTo(topData[key]).
  694. var $ele = topData[key].find(".indenter");
  695. console.log($ele);
  696. $ele
  697. .attr("id", key)
  698. .addClass($ele.attr(defaultExpand ? "expandClass" : "collapseClass"))
  699. .show()
  700. .on("click", function () {
  701. var iidd = this.getAttribute("id");
  702. this.isShow =
  703. typeof this.isShow == "undefined" ? !defaultExpand : !this.isShow;
  704. if (this.isShow) {
  705. $(this).attr("class", $(this).attr("expandClass"));
  706. } else {
  707. $(this).attr("class", $(this).attr("collapseClass"));
  708. }
  709. showChildren(this.isShow, iidd);
  710. return false;
  711. });
  712. showChildren(defaultExpand, key);
  713. }
  714. for (var key in data) {
  715. for (var i = 0; i < data[key].length; i++) {
  716. var THIS = data[key][i];
  717. var c = 1;
  718. THIS.css({ marginLeft: c * 20, width: "calc(100% - 20px)" });
  719. }
  720. }
  721. });
  722. $(function () {
  723. try {
  724. var availHeight =
  725. window.innerHeight -
  726. parseInt(initWdFitHeightFunction.toString().match(/[0-9]+/)[0]);
  727. var rowCountPerPage = parseInt(availHeight / 70);
  728. var ele = $("[name=rowCountPerPage]");
  729. if (ele.length == 0)
  730. ele = $('<input type="hidden" name="rowCountPerPage"/>').appendTo("form");
  731. ele.val(rowCountPerPage);
  732. } catch (e) {
  733. console.log(e);
  734. }
  735. });
  736. //草稿箱 如果没绑定点击事件 绑定查看
  737. $(function () {
  738. try {
  739. $(".cgxItem[clickPlay]").each(function () {
  740. var clickPlay = $(this).attr("clickPlay");
  741. console.log(clickPlay);
  742. console.log($(this).attr("onclick"));
  743. if (clickPlay && !$(this).attr("onclick")) {
  744. $(this).attr("onclick", clickPlay);
  745. }
  746. });
  747. } catch (e) {
  748. console.log(e);
  749. }
  750. });