123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351 |
- var user_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
- var projectData = [];
- var excelData = [];
- inner_scan = function() {
- /**定义变量**/
- var _this = this;
- _this.grid = null;
- _this.tixi = null;
- /**私有方法**/
-
-
- function getColumns(data){
- var level = parseInt(data[0].LEVEL_NUM);
- var columns = [];
-
- columns.push({display: '序号', name: 'idx',align: 'center', width: "100"});
- //var parentwid = (15/(level-1))+"%";
- ////console.log(parentwid);
- /*for(var i=1;i<level;i++){
- columns.push({display: NumbToChina(i)+'级评估项目', name: 'PARENT_NAME_'+i,align: 'center', width: "60" });
- }*/
- columns.push({display: '建设项目', name: 'NAME',align: 'center', width: "150"});
- columns.push({display: '标准分', name: 'STA_SCORE',align: 'center', width: "40"});
- columns.push({display: '建设内容', name: 'SUGGESTION',align: 'center', width: "150"});
- columns.push({display: '评估方法', name: 'CHECK_INSTRUCTION',align: 'center', width: "100"});
- columns.push({display: '评估标准', name: 'DESCRIPTION',align: 'left', width: "150"});
- /*var childColumns = [];
- var eval_numArr = (data[0].EVAL_NUM).split("项")[1].split("-");
- for(var i=0;i<eval_numArr.length;i++){
-
- childColumns.push({display: eval_numArr[i]+'分', name: 'SCORE_'+eval_numArr[i],align: 'center', width: "250"});
- }*/
- /*columns.push({display: '扣分', columns:childColumns, width: (250*eval_numArr.length) });*/
- columns.push({display: '扣分', name: 'SCORE',align: 'center', width: "40"});
- columns.push({display: '主要问题', name: 'QUESTIONS',align: 'left', width: "150"});
- columns.push({display: '修改建议', name: 'SUGGESTIONS',align: 'left', width: "150"});
- /*columns.push({display: '典型存在问题', name: 'typicalProblems',align: 'left', width: "250",render:renderTypical});
- columns.push({display: '其他问题说明', name: 'questions',align: 'left', width: "250",render:renderQues});
- columns.push({display: '检查建议', name: 'suggestions',align: 'left', width: "250",render:renderSuggest});
- columns.push({display: '检查人员', name: 'real_name',align: 'center', width: "50"});*/
-
- return columns;
- }
-
- /*function renderCore(rowdata, rowindex, value, column){
- value = value || "";
- var result = "";
- if(value=="1") result = "<img src='/nwyj/scripts/business/em/evaluate/grade/core.png' style='' />";
- return result;
- }
-
- function renderObj(rowdata, rowindex, value, column){
- value = value || "";
- var result = value;
- if(value.indexOf("1")>-1) result = result.replace("1", "省");
- if(value.indexOf("2")>-1) result = result.replace("2", "地");
- if(value.indexOf("3")>-1) result = result.replace("3", "县");
- return result;
- }
-
- function renderCheck(rowdata, rowindex, value, column){
- value = value || "";
- var result = value;
- if(value.indexOf("1")>-1) result = result.replace("1", "人员访谈");
- if(value.indexOf("2")>-1) result = result.replace("2", "查阅资料");
- if(value.indexOf("3")>-1) result = result.replace("3", "现场验证");
- return result;
- }*/
-
- /*function renderTypical(rowdata, rowindex, value, column){
- value = value || "";
- var valueArr = value.split("\n");
- var result = "";
- for(var i=0;i<valueArr.length;i++){
- if(valueArr[i]!=null && valueArr[i]!="") result += (i+1)+") ";
- result += valueArr[i]+"<br/>";
- };
- return result;
- }*/
-
- /*function renderQues(rowdata, rowindex, value, column){
- value = value || "";
- var valueArr = value.split("\n");
- var result = "";
- for(var i=0;i<valueArr.length;i++){
- if(valueArr[i]!=null && valueArr[i]!="") result += (i+1)+") ";
- result += valueArr[i]+"<br/>";
- };
- return result;
- }
-
- function renderSuggest(rowdata, rowindex, value, column){
- value = value || "";
- var valueArr = value.split("\n");
- var result = "";
- for(var i=0;i<valueArr.length;i++){
- if(valueArr[i]!=null && valueArr[i]!="") result += (i+1)+") ";
- result += valueArr[i]+"<br/>";
- };
- return result;
- }
-
- function getLevelSelect(numb){
- var resutl = [];
- for(var i=0;i<numb-1;i++){
- var json = {key:NumbToChina(i)+"级项目",value:i};
- if(i==0){
- json = {key:"评估体系",value:0};
- }
- resutl.push(json);
- }
- ////console.log(resutl);
- return resutl;
- }*/
-
- //通过数字转化成汉字
- function NumbToChina(numb){
- var result = "";
- switch (numb) {
- case 1: result = "一"; break;
- case 2: result = "两"; break;
- case 3: result = "三"; break;
- case 4: result = "四"; break;
- case 5: result = "五"; break;
- case 6: result = "六"; break;
- case 7: result = "七"; break;
- case 8: result = "八"; break;
- case 9: result = "九"; break;
- case 10: result = "十"; break;
- default: break;
- }
- return result;
- }
-
- function _initHtml(data){
- $(".titleShow").html(data[0].NAME+"评估导入数据");
- $("#eval_name_id").html(data[0].SYS_NAME);
- $("#dept_name_id").html(data[0].DEPT_NAME);
- $("#start_time_id").html(data[0].START_TIME);
- $("#end_time_id").html(data[0].END_TIME);
- $("#shuoming_id").html(data[0].INTRODUCTION);
- }
-
- return {
- init:function(){
- var url = $.pathname() + '/ws/scoreGrade/ScoreService/getProjectsById';
- var params = {
- fd_id : fd_id
- };
- $.request.query(url,params,function(data){
- projectData = data;
- _initHtml(data);
- setPageHeight();
- });
- },
-
- initList : function(data) {
- //$("#maingrid").html("");
- var rowsdata = data[0].result;
- //console.log(rowsdata);
- var option = {
- rownumbers:true,
- columns:getColumns(data[0].tixi),
- data:{rows:rowsdata},
- usePager:true,
- pageSize: 5,
- fixedCellHeight:false,
- //percentWidthMode : true,
- showPageSize:true,
- minColumnWidth:0,
- columnWidth:10,
- sortName: 'idx',
- rownumbers:false,
- checkbox:false,
- height: '600',
- // width:"100%",
- isScroll:true,
- headerRowHeight:50,
- onToFirst:setPageHeight,
- onToLast:setPageHeight,
- onToNext:setPageHeight,
- onToPrev:setPageHeight
- };
- _this.grid = $("#maingrid").quiGrid(option);
- _this.grid.setScroller(null,"bottom",true);
- setPageHeight();
- }
- };
-
- }();
- function setPageHeight(){
- ////console.log(123456);
- setTimeout(function(){
- $(parent.document.body).find("#frmright").css("height",$(window.document.body).height()+30);
- },200);
- }
- $(function() {
- inner_scan.init();
- //Grade_inner_view.initList();
-
- $("#back").hover(function(){
- $(this).attr("src","/nwyj/images/temp/back_hover.png");
- },function(){
- $(this).attr("src","/nwyj/images/temp/back.png");
- });
-
- $('#back').bind('click',back);
-
- $("#import_btn").on("click",function(){
- var val = $("#import_eval").val();
- var end = val.substring(val.indexOf(".") + 1);
- if (end == "xls" || end == "xlsx") {
- var url=$.pathname() + "/ws/evalExcel/EvalExcelService/getExcelDateToListOther?fileExt="+end+"&fd_id="+fd_id;
- /*if(is_assigning=="1"){
- url=$.pathname() + "/ws/evalExcel/EvalExcelService/getExcelDateToListTask?fileExt="+end+"&fd_id="+fd_id+"&user_id="+user_id;
- }*/
- $("#evalFileForm").ajaxSubmit({
- //url : $.pathname() + "/ws/evalExcel/EvalExcelService/getExcelDateToList?fileExt="+end+"&fd_id="+fd_id,
- url : url,
- type : 'post',
- success : function(responseText, statusText, xhr, $form) {
- $("#save_eval").show();
- //console.log(responseText);
- debugger;
- console.log(responseText);
- if(typeof responseText == 'string')
- responseText = eval('(' + responseText + ')');
- console.log(responseText);
-
- excelData = responseText;
- inner_scan.initList(responseText);
- },error : function(e) {
- top.Dialog.alert("导入数据失败!");
- }
- });
- } else {
- top.Dialog.alert("请导入正确的excel文件");
- return;
- }
- });
-
- $("#downloadModel").on("click",function(){
- var params = {
- fd_id : fd_id,
- connect_ids : projectData[0].CONNECT_IDS,
- user_id:user_id,
- is_assigning:is_assigning
- };
- var url = $.pathname() + '/ws/evalExcel/EvalExcelService/ExportOuterEvalExcelByFdIdDemo';
- /*if(is_assigning=="1"){//分配任务
- url = $.pathname() + '/ws/evalExcel/EvalExcelService/ExportEvalExcelByFdIdTask';
- }*/
-
- var downFileName = projectData[0].SYS_NAME;
- $.exportExcel(url,params,(downFileName || "评估评分模版"),"xlsx");
- });
-
- $("#save_eval").unbind("click").bind("click",function(){
- //var saveData = getSaveData();
- debugger;
- console.log(excelData);
- var saveData = excelData[0].result;
- var url = $.pathname() + '/ws/scoreGrade/ScoreService/insertScoreOther';
- var params = {
- subType : "excelSubmit",
- user_id : user_id,
- fd_id : fd_id,
- sys_id : projectData[0].SYS_ID,
- is_assinging : projectData[0].IS_ASSIGNING,
- is_connect : projectData[0].IS_CONNECT,
- hide_project : projectData[0].CONNECT_IDS,
- sysType : projectData[0].SYS_TYPE,
- //innerScore:JSON.stringify(saveData.innerScore),
- outerScore:JSON.stringify(saveData)
- //delectOuter:saveData.delectOuter.toString()
- };
- $.request.query(url,params,function(data){
- if(data[0].outerResult == "ok"){
- top.Dialog.alert('提交成功!');
- back();
- }
- });
- });
-
-
- });
- function getLowScore(value){
- var result = "0";
- if(value && "项".indexOf(value)>-1){
- var arr = value.split("项");
- result = arr[1].split("-")[0];
- }
- return result;
- }
- function getSaveData(){
- var innerScore = [];
- var outerScore = [];
- var delectOuter = [];
- var ques = excelData[0].result;
- var lowscore = getLowScore(excelData[0].tixi[0].EVAL_NUM);
- //console.log(lowscore);
- for(var i=0;i<ques.length;i++){
- var list = {};
- list["SCORE"] = ques[i].score == ""?lowscore:ques[i].score;
- list["FD_OBJECTID"] = "";
- list["EVAL_ID"] = ques[i].FD_OBJECTID;
- list["PROJECT_ID"] = projectData[0].FD_OBJECTID;
- list["QUESTIONS"] = ques[i].questions;
- list["SUGGESTION"] = ques[i].suggestions;
- list["REAL_NAME"] = ques[i].real_name;
- innerScore.push(list);
- var dataOuter = JSON.parse(ques[i].typicallist);
- //console.log(dataOuter);
- var project_id = projectData[0].IS_CONNECT=="1"?projectData[0].CONNECT_IDS:projectData[0].FD_OBJECTID;
- var project_connect_id = projectData[0].FD_OBJECTID;
- for(var j=0;j<dataOuter.length;j++){
- var basis_score=dataOuter[j].basis_score;
- if(basis_score.trim()!=""){
- var json = {};
- json["SCORE"] = dataOuter[j].basis_score;
- json["FD_OBJECTID"] = "";
- json["EVAL_ID"] = ques[i].FD_OBJECTID;
- json["BASIS_BUSI_ID"] = dataOuter[j].business_id;
- json["BASIS_ID"] = dataOuter[j].basis_id;
- json["PROJECT_ID"] = project_id;
- json["PROJECT_CONNECT_ID"] = project_connect_id;
- json["QUESTIONS"] = dataOuter[j].question;
- json["SUGGESTION"] = dataOuter[j].suggestion;
- outerScore.push(json);
- }
- }
- }
-
- console.log(innerScore);
- console.log(outerScore);
- console.log(delectOuter);
- return {"innerScore":innerScore,"outerScore":outerScore,"delectOuter":delectOuter};
- }
- function back(){
- top.$.indexOpenSelfWindow($.pathname()+"/page/business/em/evaluate/grade/Grade.jsp");
- };
|