var taskId; var buyTime; var acceptTime; var noticeContent; var isFinish; $(function() { taskId = localStorage.getItem("taskId"); launchTime = localStorage.getItem("launchTime"); finishTime = localStorage.getItem("finishTime"); isFinish = localStorage.getItem("isFinish"); if(isFinish == '1'){ $("#addBtn").css("display","none"); }else if(isFinish == '0'){ $("#addBtn").css("display",""); } getbaseList(); $("#baseForm").keydown(function(e) { keycode = e.which || e.keyCode; if (keycode == 13) { search(); } }); }); function add(){ JY.Model.edit("auDiv", "新增", function() { var actualPrice = $("#actualPrice").val(); var machineNums = $("#machineNums").val(); var checkPlace = $("#checkPlace").val(); if(actualPrice == '' || actualPrice == null){ layer.msg('购置价格不能为空'); return false; } if(machineNums == '' || machineNums == null){ layer.msg('机具数量不能为空'); return false; } if(checkPlace == '' || checkPlace == null){ layer.msg('验收地点不能为空'); return false; } var that = $(this); if (JY.Validate.form("auForm")) { $("#taskId").val(taskId); var maVenderId = $("#maVenderId").val(); var maTypeId =$("#maTypeId").val(); //机具类型ID var maModelId = $("#maModelId").val();//机具型号ID var actualPrice = $("#actualPrice").val(); var machineNums = $("#machineNums").val(); var checkPlace = $("#checkPlace").val(); JY.Ajax.doRequest("auForm", bonuspath + '/backstage/inputDetails/add', { taskId:taskId, maModelId:maModelId, actualPrice:actualPrice, arrivalNum:machineNums, maVenderId:maVenderId, checkPlace:checkPlace }, function(data) { that.dialog("close"); JY.Model.info(data.resMsg, function() { search(); }); }); } }); } function selectPerson(){ localStorage.setItem("noticeContent",noticeContent); //iframe层-父子操作 layer.open({ type: 2, title:['完善通知信息','background-color: #438EB9;color:#fff'], shadeClose:true, shade:false, maxmin: true, area: ['850px', '450px'], content: bonuspath+'/backstage/user/select' }); } //新购只记数量的机具 function addCountsMachines(taskId,type,machinesNum){ JY.Ajax.doRequest(null,bonuspath +'/backstage/machineType/addCountsMachines', { id : type, nums :machinesNum },function(data){ }); } function batchAddMachines(company,taskId,type,machinesNum,chackStatus,isFixedAssets,isTrack,isCheck,buyTime,cycleNum,remark,acceptTime){ JY.Ajax.doRequest(null,bonuspath +'/backstage/machine/addMachine', { taskId : taskId, type : type, machinesNum :machinesNum, chackStatus : chackStatus, isFixedAssets : 0, isTrack : 1, //跟踪 isCheck : 1, //需要检验 buyTime : buyTime, equipmentState : 1, outInNum : 0, remarks : '无', deviceNum:company, tOverhaulTime: acceptTime },function(data){ }); } function getbaseList(init) { JY.Model.loading(); JY.Ajax.doRequest("baseForm",bonuspath + '/backstage/inputDetails/findByPage',{taskId:taskId}, function(data) { $("#baseTable tbody").empty(); var obj = data.obj; var list = obj.list; var results = list.results; var permitBtn = obj.permitBtn; var pageNum = list.pageNum, pageSize = list.pageSize, totalRecord = list.totalRecord; var html = ""; if (results != null && results.length > 0) { var leng = (pageNum - 1) * pageSize; // noticeContent = "各位同事您好,请于" + $("#tomorrowDate").val() +"在机具2号库,进行机具验收。验收内容如下:"; for (var i = 0; i < results.length; i++) { var l = results[i]; if(l.chackStatus >= 2){ // $("#selectPersonBtn").attr("disabled","disabled"); $("#addBtn").attr("disabled","disabled"); } html += ""; html += "" + (i + leng + 1) + ""; html += ""+ JY.Object.notEmpty(l.machineType) + ""; html += ""+ JY.Object.notEmpty(l.machineModel) + ""; html += ""+ JY.Object.notEmpty(l.actualPrice) + ""; html += ""+ JY.Object.notEmpty(l.arrivalNum) + ""; /* if(l.picUrl == '' || l.picUrl == null){ html += "上传图片"; }else{ html += "查看图片"; } */ if(l.picUrl == null || l.picUrl == ''){ html += "上传"; } else { html += "查看"; } html += ""+ JY.Object.notEmpty(l.venderName) + ""; html += ""+ JY.Object.notEmpty(l.checkPlace) + ""; if(l.checker == "" || l.checker == null){ l.checker = "尚未指派"; html += "" + l.checker + ""; }else{ html += ""+ JY.Object.notEmpty(l.checker) + ""; } if(l.customerRep == "" || l.customerRep == null){ l.customerRep = "尚未指派"; html += "" + l.customerRep + ""; }else{ html += ""+ JY.Object.notEmpty(l.customerRep) + ""; } if(l.checkStatus == 1 || l.checkStatus =='1'){ html += ""; html += "待指定人员"; }else if(l.checkStatus == 2 || l.checkStatus =='2'){ html += ""; html += "待验收"; }else if(l.checkStatus == 3 || l.checkStatus =='3'){ html += "上传图片"; html += "待上传验收图片"; }else{ html += "查看图片"; html += "已完成"; } if(l.invoiceUrl == '' || l.invoiceUrl == null){ html += "上传图片"; }else{ html += "查看图片"; } // noticeContent += "机具类型:"+ l.machineType + ",规格型号:"+l.model + ",数量:" + l.machineNums + ";"; html += rowFunction(l.maModelId,l.taskId,l.checkStatus,l.arrivalNum,l.checkerId); html += ""; } $("#baseTable tbody").append(html); JY.Page.setPage("baseForm", "pageing", pageSize,pageNum, totalRecord, "getbaseList"); } else { html += "没有相关数据"; $("#baseTable tbody").append(html); $("#pageing ul").empty();// 清空分页 } JY.Model.loadingClose(); }); } function rowFunction(maModelId,taskId,checkStatus,machineNums,checkerId) { var h = ""; // var status = parseInt(checkStatus); h += ""; h += ""; h += ""; h += ""; return h; } function check(taskId,maModelId,machineNums,checkerId) { JY.Model.confirm("确认发布吗?", function() { JY.Ajax.doRequest(null, bonuspath + '/backstage/inputDetails/isSure', { taskId:taskId, maModelId:maModelId, checkNum:machineNums, checkerId:checkerId }, function(data) { JY.Model.info(data.resMsg, function() { search(); getbaseList(1); }); }); }); } function checkList(maTypeId,taskId,chackStatus) { cleanAcceptForm(); JY.Ajax.doRequest(null, bonuspath + '/backstage/accept/find', { taskId : taskId, maTypeId:maTypeId }, function(data) { setAcceptForm(data,chackStatus); JY.Model.check("acceptDiv"); }); } function inputList(maTypeId,taskId) { cleanInputForm(); JY.Ajax.doRequest(null, bonuspath + '/backstage/accept/findInput', { taskId : taskId, maTypeId: maTypeId }, function(data) { setInputForm(data); JY.Model.check("inputDiv"); }); } function service(id) { cleanForm(); JY.Model.edit("serviceDiv", "指派客服代表", function() { var that = $(this); if (JY.Validate.form("serviceForm")) { var serviceId = $("#serviceId").val(); JY.Ajax.doRequest(null, bonuspath+'/backstage/inputDetails/update', { id:id, customerRep:serviceId }, function(data) { JY.Model.info(data.resMsg, function() { that.dialog("close"); $("#serviceId").val(''); search(); }); }); } }); } function checker(id) { cleanForm(); JY.Model.edit("checkerDiv", "指派检验员代表", function() { var that = $(this); if (JY.Validate.form("checkerForm")) { var checkId = $("#checkId").val(); JY.Ajax.doRequest(null, bonuspath+'/backstage/inputDetails/update', { id:id, checker:checkId }, function(data) { JY.Model.info(data.resMsg, function() { that.dialog("close"); $("#checkId").val(''); search(); }); }); } }); } function serviceTree(){ localStorage.setItem("serviceId",""); localStorage.setItem("serviceName",""); localStorage.setItem("serviceTreeName",$("#serviceName").val()); layer.open({ type: 2, title:['客服代表','background-color: #438EB9;color:#fff'], shadeClose:true, shade:false, maxmin: true, area: ['400px', '400px'], content: bonuspath+'/backstage/user/serviceTree' }); } function setServiceForm(){ var serviceId = localStorage.getItem("serviceId"); var serviceName = localStorage.getItem("serviceName"); $("#serviceId").val(serviceId); $("#serviceName").val(serviceName); } function checkTree(){ localStorage.setItem("checkId",""); localStorage.setItem("checkName",""); localStorage.setItem("checkTreeName",$("#checkName").val()); layer.open({ type: 2, title:['检验人员','background-color: #438EB9;color:#fff'], shadeClose:true, shade:false, maxmin: true, area: ['400px', '400px'], content: bonuspath+'/backstage/user/checkTree' }); } function setCheckForm(){ var checkId = localStorage.getItem("checkId"); var checkName = localStorage.getItem("checkName"); $("#checkId").val(checkId); $("#checkName").val(checkName); } function setForm(data) { var l = data.obj; $("#auForm input[name$='taskId']").val(l.taskId); $("#auForm input[name$='model']").val(JY.Object.notEmpty(l.model)); $("#auForm input[name$='machinesNum']").val(JY.Object.notEmpty(l.machinesNum)); $("#auForm input[name$='outNum']").val(JY.Object.notEmpty(l.outNum)); $("#auForm input[name$='invoiceNum']").val(JY.Object.notEmpty(l.invoiceNum)); $("#auForm input[name$='invoiceUrl']").val(JY.Object.notEmpty(l.invoiceUrl)); $("#auForm input[name$='machinesUrl']").val(JY.Object.notEmpty(l.machinesUrl)); $("#auForm input[name$='chackStatus']").val(JY.Object.notEmpty(l.chackStatus)); } function cleanForm() { JY.Tags.isValid("auForm", "1"); JY.Tags.cleanForm("auForm"); $("#auForm input[id$='taskId']").val(""); $("#auForm input[id$='maTypeName']").val("");// 上级资源 $("#auForm input[id$='maTypeId']").val("0"); $("#auForm input[id$='maModelName']").val(''); $("#auForm input[id$='maModelId']").val("0"); $("#auForm input[name$='machineNums']").val(""); $("#auForm input[name$='actualPrice']").val(""); $("#auForm input[name$='vender']").val(""); $("#auForm input[id$='maVenderId']").val(""); } function setAcceptForm(data,chackStatus) { var l = data.obj; var machineNums = l.machineNums; maNums = '0' + machineNums.substring(machineNums.length-4); if(parseFloat(maNums) < parseFloat(0.001)){ maNums = machineNums.substring(0,machineNums.length-4); }else{ maNums = machineNums; } $("#checkTimes").html(JY.Object.notEmpty(l.checkTime)); $("#checkCodes").html(JY.Object.notEmpty(l.checkCode)); $("#models").html(JY.Object.notEmpty(l.model)); $("#venders").html(JY.Object.notEmpty(l.vender)); $("#machineTypes").html(JY.Object.notEmpty(l.machineType)); $("#outNums").html(JY.Object.notEmpty(l.outNum)); $("#machinesNums").html(JY.Object.notEmpty(maNums)); if(chackStatus > 2){ var exteriorCheck = l.exteriorCheck; if(exteriorCheck == "1"){ exteriorCheck = "合格"; }else if(exteriorCheck == "0"){ exteriorCheck = "不合格"; }else{ exteriorCheck = "合格"; } var testCheck = l.testCheck; if(testCheck == "1"){ testCheck = "合格"; }else if(testCheck == "0"){ testCheck = "不合格"; }else{ testCheck = "合格"; } $("#exteriorChecks").html(exteriorCheck); $("#testChecks").html(testCheck); } var checkNum = l.checkNum; $("#checkNums").html(checkNum); var checkConclusion = l.checkConclusion; $("#checkConclusions").html(checkConclusion); $("#aboutFile").html(l.aboutFile); } function setInputForm(data) { $(".basic").html(""); $(".add").remove(); var list = data.obj.list; var html=""; if(list.length>0){ var date = list[0].buyTime; var d = new Array(); d = date.split("-"); $(".year").html(d[0]); $(".month").html(d[1]); $(".day").html(d[2]); // $(".vender").html(list[0].vender); for(var i=0;i'; html+=''+list[i].machineType+''; html+=''+list[i].model+''; html+=''+list[i].unit+''; html+=''+list[i].buyPrice+''; html+='1'; html+=''+deviceNum+''; html+=''+outFacTime+''; html+=''; } $("#header").after(html); } } function cleanAcceptForm() { $("#models").html(''); $("#machineTypes").html(''); $("#outNums").html(''); $("#machinesNums").html(''); $("#venders").html(''); $("#checkNums").html(''); $("#exteriorChecks").html(''); $("#testChecks").html(''); $("#checkConclusions").html(''); } function cleanInputForm() { // $("#vender").html(''); $("#acceptDate").html(''); } function search() { $("#searchBtn").trigger("click"); } function updPrice(maTypeId,taskId){ layer.prompt({ title: ['价格增加','background-color: #438EB9;color:#fff'] },function(val, index){ title:'价格修改'; JY.Ajax.doRequest(null, bonuspath + '/backstage/inputDetails/update', {taskId:taskId,maTypeId:maTypeId,actualPrice:val}, function(data) { layer.close(index); JY.Model.info(data.resMsg, function() { search(); }); }); }); } /*function uploadInvoice(maModelId,taskId){ localStorage.setItem("maModelId",maModelId); localStorage.setItem("taskId",taskId); localStorage.setItem("bonuspath",bonuspath); //iframe层-父子操作 layer.open({ type: 2, title:['发票上传','background-color: #438EB9;color:#fff'], shadeClose:true, shade:false, maxmin: true, area: ['800px', '430px'], content: bonuspath+'/updInvoice.jsp' }); } */ function uploadImg(maModelId,taskId){ localStorage.setItem("maModelId",maModelId); localStorage.setItem("taskId",taskId); //iframe层-父子操作 layer.open({ type: 2, title:['发票上传','background-color: #27A3D9;color:#fff'], shadeClose:true, shade:false, maxmin: true, area: ['600px', '400px'], content: bonuspath+'/backstage/inputDetails/imgInvoice' }); } function readInvoice(maModelId,taskId){ localStorage.setItem("maModelId",maModelId); localStorage.setItem("taskId",taskId); localStorage.setItem("bonuspath",bonuspath); //iframe层-父子操作 layer.open({ type: 2, title:['发票查看','background-color: #438EB9;color:#fff'], shadeClose:true, shade:false, maxmin: true, area: ['800px', '430px'], content: bonuspath+'/backstage/inputDetails/queryImgPage?maModelId='+maModelId +'&taskId='+taskId }); } function uploadManchines(maModelId,taskId){ localStorage.setItem("maModelId",maModelId); localStorage.setItem("taskId",taskId); //iframe层-父子操作 layer.open({ type: 2, title:['机具图片上传','background-color: #27A3D9;color:#fff'], shadeClose:true, shade:false, maxmin: true, area: ['600px', '400px'], content: bonuspath+'/backstage/inputDetails/imgManchines' }); } function readManchines(maModelId,taskId){ localStorage.setItem("maModelId",maModelId); localStorage.setItem("taskId",taskId); localStorage.setItem("bonuspath",bonuspath); //iframe层-父子操作 layer.open({ type: 2, title:['机具图片查看','background-color: #438EB9;color:#fff'], shadeClose:true, shade:false, maxmin: true, area: ['800px', '430px'], content: bonuspath+'/backstage/inputDetails/queryImgManchines?maModelId='+maModelId +'&taskId='+taskId }); } function uploadCheckUrl(maModelId,taskId,maTypeId){ localStorage.setItem("maModelId",maModelId); localStorage.setItem("taskId",taskId); localStorage.setItem("maTypeId",maTypeId); //iframe层-父子操作 layer.open({ type: 2, title:['机具图片上传','background-color: #27A3D9;color:#fff'], shadeClose:true, shade:false, maxmin: true, area: ['600px', '400px'], content: bonuspath+'/backstage/inputDetails/imgCheck' }); } function readCheckUrl(maModelId,taskId){ localStorage.setItem("maModelId",maModelId); localStorage.setItem("taskId",taskId); localStorage.setItem("bonuspath",bonuspath); //iframe层-父子操作 layer.open({ type: 2, title:['机具图片查看','background-color: #438EB9;color:#fff'], shadeClose:true, shade:false, maxmin: true, area: ['800px', '430px'], content: bonuspath+'/backstage/inputDetails/queryImgCheck?maModelId='+maModelId +'&taskId='+taskId }); } function edit(maModelId,taskId,machineNums) { cleanAcceptsForm(); JY.Ajax.doRequest(null, bonuspath + '/backstage/accept/find', { taskId : taskId, maModelId: maModelId }, function(data) { setAcceptsForm(data); JY.Model.edit("auAcceptDiv", "验收", function() { var checkNum = $("#checkNum").val(); var checkConclusion = $("#checkConclusion").val(); if(parseFloat(checkNum) > parseFloat(machineNums) || parseFloat(checkNum) < 0){ JY.Model.info("请正确填写机具验收数量"); }else if(checkConclusion == "" || checkConclusion == null){ JY.Model.info("请输入验收结论"); }else{ if (JY.Validate.form("auAcceptForm")) { var that = $(this); JY.Ajax.doRequest("auAcceptForm", bonuspath + '/backstage/inputDetails/check', {taskId:taskId,maModelId:maModelId,qualifiedNum:checkNum,checkConclusion:checkConclusion}, function(data) { that.dialog("close"); JY.Model.info(data.resMsg, function() { search(); }); }); } } }); }); } function del(maTypeIds,taskId){ JY.Model.confirm("确认删除吗?",function(){ JY.Ajax.doRequest(null,bonuspath +'/backstage/inputDetails/del',{ taskId : taskId, maModelId:maTypeIds },function(data){ JY.Model.info(data.resMsg,function(){search();}); }); }); } function editDetails(maTypeIds,taskId,machineNums) { maTypeId = maTypeIds; cleanEditForm(); setEditForm(machineNums); JY.Model.edit("auEditDiv", "修改", function() { var editNum = $("#editNum").val(); var machineNum = machineNums; if(parseFloat(editNum) < 1){ JY.Model.info("请正确填写修改后数量"); }else{ console.log("maTypeIds="+maTypeIds+"+taskId="+taskId+"+machineNum="+machineNum+"+editNum="+editNum); if (JY.Validate.form("auEditForm")) { var that = $(this); JY.Ajax.doRequest("auEditForm", bonuspath + '/backstage/accept/edit', {taskId:taskId,maTypeId:maTypeId,editNum:editNum,machineNum:machineNum}, function(data) { that.dialog("close"); JY.Model.info(data.resMsg, function() { search(); }); }); } } }); } var maTypeId; function setEditForm(machineNums){ $("#machineNum").val(machineNums); } function cleanEditForm(){ $("#editNum").val(""); } function setAcceptsForm(data){ var l = data.obj; maTypeId = l.maTypeId; $("#machineType").val(JY.Object.notEmpty(l.machineType)); $("#modelType").val(JY.Object.notEmpty(l.machineModel)); $("#auAcceptForm input[name$='checkNum']").val(JY.Object.notEmpty(l.checkNum)); $("#checkConclusion").val(JY.Object.notEmpty(l.checkConclusion)); } function cleanAcceptsForm(){ $("#auAcceptForm input[name$='taskId']").val(""); $("#auAcceptForm input[name$='maTypeId']").val(""); $("#auAcceptForm input[name$='checkNum']").val(""); $("#auAcceptForm input[name$='machineType']").val(""); $("#auAcceptForm input[name$='machineModel']").val(""); $("#checkConclusion").val(""); } function updMachinesPic(id,taskId){ localStorage.setItem("updPicId",id); localStorage.setItem("taskId",taskId); localStorage.setItem("bonuspath",bonuspath); //iframe层-父子操作 layer.open({ type: 2, title:['机具信息上传','background-color: #438EB9;color:#fff'], shadeClose:true, shade:false, maxmin: true, area: ['600px', '430px'], content: bonuspath+'/backstage/inputDetails/machinesPic' }); } function updAboutFile(id,taskId){ localStorage.setItem("typeId",id); localStorage.setItem("taskId",taskId); localStorage.setItem("bonuspath",bonuspath); //iframe层-父子操作 layer.open({ type: 2, title:['配套资料上传','background-color: #438EB9;color:#fff'], shadeClose:true, shade:false, maxmin: true, area: ['800px', '430px'], content: bonuspath+'/backstage/inputDetails/updAboutFile' }); } function readMachinesPic(id,taskId){ localStorage.setItem("readPicId",id); localStorage.setItem("taskId",taskId); localStorage.setItem("bonuspath",bonuspath); $.ajax({ type: "post", url: bonuspath + "/backstage/inputDetails/find", data: { taskId : taskId, maModelId : id }, dataType: "json", success: function(data) { var l = data.obj; var machinesUrl = l.picUrl; if(l.picUrl.indexOf("pdf") != -1) { //如果是pdf文件 var path = bonuspath+'/machinesImg/'+ machinesUrl; window.open(path); } else { //是图片 layer.open({ type: 2, title:['机具图片查看','background-color: #438EB9;color:#fff'], shadeClose:true, shade:false, maxmin: true, area: ['800px', '430px'], content: bonuspath+'/backstage/inputDetails/readMachinesPic' }); } } }); } //验收图片上传、查看 function updAcceptPic(id,taskId){ localStorage.setItem("updAccId",id); localStorage.setItem("taskId",taskId); localStorage.setItem("bonuspath",bonuspath); //iframe层-父子操作 layer.open({ type: 2, title:['验收图片上传','background-color: #438EB9;color:#fff'], shadeClose:true, shade:false, maxmin: true, area: ['800px', '430px'], content: bonuspath+'/backstage/inputDetails/acceptPic' }); } function readAcceptPic(id,taskId){ localStorage.setItem("readAccId",id); localStorage.setItem("taskId",taskId); localStorage.setItem("bonuspath",bonuspath); //iframe层-父子操作 layer.open({ type: 2, title:['验收图片查看','background-color: #438EB9;color:#fff'], shadeClose:true, shade:false, maxmin: true, area: ['550px', '430px'], content: bonuspath+'/backstage/inputDetails/readAcceptPic' }); } function setMaTypeForm(){ var maTypeId = localStorage.getItem("maTypeId"); var maTypeName = localStorage.getItem("maTypeName"); $("#maTypeId").val(maTypeId); $("#maTypeName").val(maTypeName); $("#maModelId").val(0); $("#maModelName").val(""); } function maTypeTree(){ localStorage.setItem("maTypeId",""); localStorage.setItem("maTypeName",""); localStorage.setItem("maTypeTreeName",$("#maTypeName").val()); layer.open({ type: 2, title:['机具类型','background-color: #438EB9;color:#fff'], shadeClose:true, shade:false, maxmin: true, area: ['400px', '400px'], content: bonuspath+'/backstage/machineType/maTypeTree' }); } function setMaModelForm(){ var maModelId = localStorage.getItem("maModelId"); var maModelName = localStorage.getItem("maModelName"); $("#maModelId").val(maModelId); $("#maModelName").val(maModelName); } function maModelTree(){ var maTypeId = $("#maTypeId").val(); if(maTypeId == "0"){ JY.Model.info("请选择机具类型!"); }else{ localStorage.setItem("maModelId",""); localStorage.setItem("maModelName",""); localStorage.setItem("maModelTreeName",$("#maModelName").val()); localStorage.setItem("maTypeTreeId",maTypeId); layer.open({ type: 2, title:['规格型号','background-color: #438EB9;color:#fff'], shadeClose:true, shade:false, maxmin: true, area: ['400px', '400px'], content: bonuspath+'/backstage/machineType/maModelTree' }); } } function setMaVenderForm(){ var maVenderId = localStorage.getItem("maVenderId"); var maVenderName = localStorage.getItem("maVenderName"); $("#maVenderId").val(maVenderId); $("#maVenderName").val(maVenderName); } function maVenderTree(){ localStorage.setItem("maVenderId",""); localStorage.setItem("maVenderName",""); localStorage.setItem("maVenderTreeName",$("#maVenderName").val()); layer.open({ type: 2, title:['机具厂家','background-color: #438EB9;color:#fff'], shadeClose:true, shade:false, maxmin: true, area: ['400px', '400px'], content: bonuspath+'/backstage/vender/maVenderTree' }); }