74a4511f93b5398ca2a6bebdc2633737f2c3e9b1.svn-base 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. var user_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  2. var projectData = [];
  3. var excelData = [];
  4. inner_scan = function() {
  5. /**定义变量**/
  6. var _this = this;
  7. _this.grid = null;
  8. _this.tixi = null;
  9. /**私有方法**/
  10. function getColumns(data){
  11. var level = parseInt(data[0].LEVEL_NUM);
  12. var columns = [];
  13. columns.push({display: '序号', name: 'idx',align: 'center', width: "100"});
  14. //var parentwid = (15/(level-1))+"%";
  15. ////console.log(parentwid);
  16. /*for(var i=1;i<level;i++){
  17. columns.push({display: NumbToChina(i)+'级评估项目', name: 'PARENT_NAME_'+i,align: 'center', width: "60" });
  18. }*/
  19. columns.push({display: '建设项目', name: 'NAME',align: 'center', width: "150"});
  20. columns.push({display: '标准分', name: 'STA_SCORE',align: 'center', width: "40"});
  21. columns.push({display: '建设内容', name: 'SUGGESTION',align: 'center', width: "150"});
  22. columns.push({display: '评估方法', name: 'CHECK_INSTRUCTION',align: 'center', width: "100"});
  23. columns.push({display: '评估标准', name: 'DESCRIPTION',align: 'left', width: "150"});
  24. /*var childColumns = [];
  25. var eval_numArr = (data[0].EVAL_NUM).split("项")[1].split("-");
  26. for(var i=0;i<eval_numArr.length;i++){
  27. childColumns.push({display: eval_numArr[i]+'分', name: 'SCORE_'+eval_numArr[i],align: 'center', width: "250"});
  28. }*/
  29. /*columns.push({display: '扣分', columns:childColumns, width: (250*eval_numArr.length) });*/
  30. columns.push({display: '扣分', name: 'SCORE',align: 'center', width: "40"});
  31. columns.push({display: '主要问题', name: 'QUESTIONS',align: 'left', width: "150"});
  32. columns.push({display: '修改建议', name: 'SUGGESTIONS',align: 'left', width: "150"});
  33. /*columns.push({display: '典型存在问题', name: 'typicalProblems',align: 'left', width: "250",render:renderTypical});
  34. columns.push({display: '其他问题说明', name: 'questions',align: 'left', width: "250",render:renderQues});
  35. columns.push({display: '检查建议', name: 'suggestions',align: 'left', width: "250",render:renderSuggest});
  36. columns.push({display: '检查人员', name: 'real_name',align: 'center', width: "50"});*/
  37. return columns;
  38. }
  39. /*function renderCore(rowdata, rowindex, value, column){
  40. value = value || "";
  41. var result = "";
  42. if(value=="1") result = "<img src='/nwyj/scripts/business/em/evaluate/grade/core.png' style='' />";
  43. return result;
  44. }
  45. function renderObj(rowdata, rowindex, value, column){
  46. value = value || "";
  47. var result = value;
  48. if(value.indexOf("1")>-1) result = result.replace("1", "省");
  49. if(value.indexOf("2")>-1) result = result.replace("2", "地");
  50. if(value.indexOf("3")>-1) result = result.replace("3", "县");
  51. return result;
  52. }
  53. function renderCheck(rowdata, rowindex, value, column){
  54. value = value || "";
  55. var result = value;
  56. if(value.indexOf("1")>-1) result = result.replace("1", "人员访谈");
  57. if(value.indexOf("2")>-1) result = result.replace("2", "查阅资料");
  58. if(value.indexOf("3")>-1) result = result.replace("3", "现场验证");
  59. return result;
  60. }*/
  61. /*function renderTypical(rowdata, rowindex, value, column){
  62. value = value || "";
  63. var valueArr = value.split("\n");
  64. var result = "";
  65. for(var i=0;i<valueArr.length;i++){
  66. if(valueArr[i]!=null && valueArr[i]!="") result += (i+1)+") ";
  67. result += valueArr[i]+"<br/>";
  68. };
  69. return result;
  70. }*/
  71. /*function renderQues(rowdata, rowindex, value, column){
  72. value = value || "";
  73. var valueArr = value.split("\n");
  74. var result = "";
  75. for(var i=0;i<valueArr.length;i++){
  76. if(valueArr[i]!=null && valueArr[i]!="") result += (i+1)+") ";
  77. result += valueArr[i]+"<br/>";
  78. };
  79. return result;
  80. }
  81. function renderSuggest(rowdata, rowindex, value, column){
  82. value = value || "";
  83. var valueArr = value.split("\n");
  84. var result = "";
  85. for(var i=0;i<valueArr.length;i++){
  86. if(valueArr[i]!=null && valueArr[i]!="") result += (i+1)+") ";
  87. result += valueArr[i]+"<br/>";
  88. };
  89. return result;
  90. }
  91. function getLevelSelect(numb){
  92. var resutl = [];
  93. for(var i=0;i<numb-1;i++){
  94. var json = {key:NumbToChina(i)+"级项目",value:i};
  95. if(i==0){
  96. json = {key:"评估体系",value:0};
  97. }
  98. resutl.push(json);
  99. }
  100. ////console.log(resutl);
  101. return resutl;
  102. }*/
  103. //通过数字转化成汉字
  104. function NumbToChina(numb){
  105. var result = "";
  106. switch (numb) {
  107. case 1: result = "一"; break;
  108. case 2: result = "两"; break;
  109. case 3: result = "三"; break;
  110. case 4: result = "四"; break;
  111. case 5: result = "五"; break;
  112. case 6: result = "六"; break;
  113. case 7: result = "七"; break;
  114. case 8: result = "八"; break;
  115. case 9: result = "九"; break;
  116. case 10: result = "十"; break;
  117. default: break;
  118. }
  119. return result;
  120. }
  121. function _initHtml(data){
  122. $(".titleShow").html(data[0].NAME+"评估导入数据");
  123. $("#eval_name_id").html(data[0].SYS_NAME);
  124. $("#dept_name_id").html(data[0].DEPT_NAME);
  125. $("#start_time_id").html(data[0].START_TIME);
  126. $("#end_time_id").html(data[0].END_TIME);
  127. $("#shuoming_id").html(data[0].INTRODUCTION);
  128. }
  129. return {
  130. init:function(){
  131. var url = $.pathname() + '/ws/scoreGrade/ScoreService/getProjectsById';
  132. var params = {
  133. fd_id : fd_id
  134. };
  135. $.request.query(url,params,function(data){
  136. projectData = data;
  137. _initHtml(data);
  138. setPageHeight();
  139. });
  140. },
  141. initList : function(data) {
  142. //$("#maingrid").html("");
  143. var rowsdata = data[0].result;
  144. //console.log(rowsdata);
  145. var option = {
  146. rownumbers:true,
  147. columns:getColumns(data[0].tixi),
  148. data:{rows:rowsdata},
  149. usePager:true,
  150. pageSize: 5,
  151. fixedCellHeight:false,
  152. //percentWidthMode : true,
  153. showPageSize:true,
  154. minColumnWidth:0,
  155. columnWidth:10,
  156. sortName: 'idx',
  157. rownumbers:false,
  158. checkbox:false,
  159. height: '600',
  160. // width:"100%",
  161. isScroll:true,
  162. headerRowHeight:50,
  163. onToFirst:setPageHeight,
  164. onToLast:setPageHeight,
  165. onToNext:setPageHeight,
  166. onToPrev:setPageHeight
  167. };
  168. _this.grid = $("#maingrid").quiGrid(option);
  169. _this.grid.setScroller(null,"bottom",true);
  170. setPageHeight();
  171. }
  172. };
  173. }();
  174. function setPageHeight(){
  175. ////console.log(123456);
  176. setTimeout(function(){
  177. $(parent.document.body).find("#frmright").css("height",$(window.document.body).height()+30);
  178. },200);
  179. }
  180. $(function() {
  181. inner_scan.init();
  182. //Grade_inner_view.initList();
  183. $("#back").hover(function(){
  184. $(this).attr("src","/nwyj/images/temp/back_hover.png");
  185. },function(){
  186. $(this).attr("src","/nwyj/images/temp/back.png");
  187. });
  188. $('#back').bind('click',back);
  189. $("#import_btn").on("click",function(){
  190. var val = $("#import_eval").val();
  191. var end = val.substring(val.indexOf(".") + 1);
  192. if (end == "xls" || end == "xlsx") {
  193. var url=$.pathname() + "/ws/evalExcel/EvalExcelService/getExcelDateToListOther?fileExt="+end+"&fd_id="+fd_id;
  194. /*if(is_assigning=="1"){
  195. url=$.pathname() + "/ws/evalExcel/EvalExcelService/getExcelDateToListTask?fileExt="+end+"&fd_id="+fd_id+"&user_id="+user_id;
  196. }*/
  197. $("#evalFileForm").ajaxSubmit({
  198. //url : $.pathname() + "/ws/evalExcel/EvalExcelService/getExcelDateToList?fileExt="+end+"&fd_id="+fd_id,
  199. url : url,
  200. type : 'post',
  201. success : function(responseText, statusText, xhr, $form) {
  202. $("#save_eval").show();
  203. //console.log(responseText);
  204. debugger;
  205. console.log(responseText);
  206. if(typeof responseText == 'string')
  207. responseText = eval('(' + responseText + ')');
  208. console.log(responseText);
  209. excelData = responseText;
  210. inner_scan.initList(responseText);
  211. },error : function(e) {
  212. top.Dialog.alert("导入数据失败!");
  213. }
  214. });
  215. } else {
  216. top.Dialog.alert("请导入正确的excel文件");
  217. return;
  218. }
  219. });
  220. $("#downloadModel").on("click",function(){
  221. var params = {
  222. fd_id : fd_id,
  223. connect_ids : projectData[0].CONNECT_IDS,
  224. user_id:user_id,
  225. is_assigning:is_assigning
  226. };
  227. var url = $.pathname() + '/ws/evalExcel/EvalExcelService/ExportOuterEvalExcelByFdIdDemo';
  228. /*if(is_assigning=="1"){//分配任务
  229. url = $.pathname() + '/ws/evalExcel/EvalExcelService/ExportEvalExcelByFdIdTask';
  230. }*/
  231. var downFileName = projectData[0].SYS_NAME;
  232. $.exportExcel(url,params,(downFileName || "评估评分模版"),"xlsx");
  233. });
  234. $("#save_eval").unbind("click").bind("click",function(){
  235. //var saveData = getSaveData();
  236. debugger;
  237. console.log(excelData);
  238. var saveData = excelData[0].result;
  239. var url = $.pathname() + '/ws/scoreGrade/ScoreService/insertScoreOther';
  240. var params = {
  241. subType : "excelSubmit",
  242. user_id : user_id,
  243. fd_id : fd_id,
  244. sys_id : projectData[0].SYS_ID,
  245. is_assinging : projectData[0].IS_ASSIGNING,
  246. is_connect : projectData[0].IS_CONNECT,
  247. hide_project : projectData[0].CONNECT_IDS,
  248. sysType : projectData[0].SYS_TYPE,
  249. //innerScore:JSON.stringify(saveData.innerScore),
  250. outerScore:JSON.stringify(saveData)
  251. //delectOuter:saveData.delectOuter.toString()
  252. };
  253. $.request.query(url,params,function(data){
  254. if(data[0].outerResult == "ok"){
  255. top.Dialog.alert('提交成功!');
  256. back();
  257. }
  258. });
  259. });
  260. });
  261. function getLowScore(value){
  262. var result = "0";
  263. if(value && "项".indexOf(value)>-1){
  264. var arr = value.split("项");
  265. result = arr[1].split("-")[0];
  266. }
  267. return result;
  268. }
  269. function getSaveData(){
  270. var innerScore = [];
  271. var outerScore = [];
  272. var delectOuter = [];
  273. var ques = excelData[0].result;
  274. var lowscore = getLowScore(excelData[0].tixi[0].EVAL_NUM);
  275. //console.log(lowscore);
  276. for(var i=0;i<ques.length;i++){
  277. var list = {};
  278. list["SCORE"] = ques[i].score == ""?lowscore:ques[i].score;
  279. list["FD_OBJECTID"] = "";
  280. list["EVAL_ID"] = ques[i].FD_OBJECTID;
  281. list["PROJECT_ID"] = projectData[0].FD_OBJECTID;
  282. list["QUESTIONS"] = ques[i].questions;
  283. list["SUGGESTION"] = ques[i].suggestions;
  284. list["REAL_NAME"] = ques[i].real_name;
  285. innerScore.push(list);
  286. var dataOuter = JSON.parse(ques[i].typicallist);
  287. //console.log(dataOuter);
  288. var project_id = projectData[0].IS_CONNECT=="1"?projectData[0].CONNECT_IDS:projectData[0].FD_OBJECTID;
  289. var project_connect_id = projectData[0].FD_OBJECTID;
  290. for(var j=0;j<dataOuter.length;j++){
  291. var basis_score=dataOuter[j].basis_score;
  292. if(basis_score.trim()!=""){
  293. var json = {};
  294. json["SCORE"] = dataOuter[j].basis_score;
  295. json["FD_OBJECTID"] = "";
  296. json["EVAL_ID"] = ques[i].FD_OBJECTID;
  297. json["BASIS_BUSI_ID"] = dataOuter[j].business_id;
  298. json["BASIS_ID"] = dataOuter[j].basis_id;
  299. json["PROJECT_ID"] = project_id;
  300. json["PROJECT_CONNECT_ID"] = project_connect_id;
  301. json["QUESTIONS"] = dataOuter[j].question;
  302. json["SUGGESTION"] = dataOuter[j].suggestion;
  303. outerScore.push(json);
  304. }
  305. }
  306. }
  307. console.log(innerScore);
  308. console.log(outerScore);
  309. console.log(delectOuter);
  310. return {"innerScore":innerScore,"outerScore":outerScore,"delectOuter":delectOuter};
  311. }
  312. function back(){
  313. top.$.indexOpenSelfWindow($.pathname()+"/page/business/em/evaluate/grade/Grade.jsp");
  314. };