|
@@ -54,9 +54,11 @@
|
|
|
var list = [];
|
|
|
var size = $("#reportedConsultantList tr").length;
|
|
|
if(size>0){
|
|
|
- for (var i = 1;i<=size;i++){
|
|
|
- var zixunyuan = $("#reportedConsultantList"+i+"_zixunyuan").val();
|
|
|
- list.push(zixunyuan);
|
|
|
+ for (var i = 1;i<=50;i++){
|
|
|
+ var zixunyuan = $("#reportedConsultantList"+i+"_zixunyuanId").val();
|
|
|
+ if(zixunyuan!=undefined && zixunyuan != null && zixunyuan !=''){
|
|
|
+ list.push(zixunyuan);
|
|
|
+ }
|
|
|
}
|
|
|
var nary = list.sort();
|
|
|
for(var i = 0; i < nary.length - 1; i++) {
|
|
@@ -323,254 +325,6 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- function setContractValue(obj){
|
|
|
- var clientId = $("#contractClientId").val();
|
|
|
- $.ajax({
|
|
|
- type:'post',
|
|
|
- url:'${ctx}/ruralProject/ruralProjectRecords/getContractInfo',
|
|
|
- data:{
|
|
|
- "id":obj
|
|
|
- },
|
|
|
- success:function(data){
|
|
|
- $("#contractName").val(data.name);
|
|
|
- $("#contractPrice").val(data.contractPrice);
|
|
|
- formatNum($("#contractPrice"));
|
|
|
- $("#contractClientName").val(data.client.name);
|
|
|
- $("#contractClientId").val(data.client.id);
|
|
|
- $("#constructionProjectType").val(data.constructionProjectTypeStr);
|
|
|
- $("#linkmanId").val(data.workClinetInfoIds);
|
|
|
- //清理之前的联系人
|
|
|
- var newClientId = data.client.id;
|
|
|
- if(clientId != newClientId){
|
|
|
- $("#workClientLinkmanList tr").remove();
|
|
|
- //if(isMasterClient){
|
|
|
- clientCount++;
|
|
|
- setLinkMan(newClientId);
|
|
|
- isMasterClient = false;
|
|
|
- // }
|
|
|
- }
|
|
|
- // console.log("clientId------newClientId");
|
|
|
- // console.log(clientId+"------"+newClientId);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- function getFee() {
|
|
|
- $("#unitFees").val('');
|
|
|
- var totalFee = $("#totalFees").val();
|
|
|
- var count = $("#buildingScale").val();
|
|
|
- if(count != '' && totalFee != '') {
|
|
|
- var cFee = Math.round(parseInt(totalFee) / parseInt(count) * 100) / 100 * 10000;
|
|
|
- $("#unitFees").val(cFee);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //计数计算方法
|
|
|
- function getBudlingFees() {
|
|
|
- $("#unitFees").val('');
|
|
|
- $("#buildingPercent").val('');
|
|
|
- $("#buildingUnitFees").val('');
|
|
|
- $("#installPercent").val('');
|
|
|
- $("#installUnitFees").val('');
|
|
|
- var totalFee = $("#totalFees").val();
|
|
|
- var budFee = $("#buildingFees").val();
|
|
|
- var insFee = $("#installFees").val();
|
|
|
- var count = $("#buildingScale").val();
|
|
|
- if(totalFee != '') {
|
|
|
- var p = Math.round(parseInt(budFee) / parseInt(totalFee) * 100 * 100) / 100;
|
|
|
- var ins = Math.round(parseInt(insFee) / parseInt(totalFee) * 100 * 100) / 100;
|
|
|
- }
|
|
|
- if(count != '') {
|
|
|
- var pp = Math.round(parseInt(budFee) / parseInt(count) * 100) / 100 * 10000;
|
|
|
- var insFe = Math.round(parseInt(insFee) / parseInt(count) * 100) / 100 * 10000;
|
|
|
- }
|
|
|
- if(count != '' && totalFee != '') {
|
|
|
- var cFee = Math.round(parseInt(totalFee) / parseInt(count) * 100) / 100 * 10000;
|
|
|
- }
|
|
|
- if(!isNaN(cFee)){
|
|
|
- $("#unitFees").val(cFee);
|
|
|
- }
|
|
|
- if(!isNaN(p)){
|
|
|
- $("#buildingPercent").val(p);
|
|
|
- }
|
|
|
- if(!isNaN(pp)){
|
|
|
- $("#buildingUnitFees").val(pp);
|
|
|
- }
|
|
|
- if(!isNaN(ins)){
|
|
|
- $("#installPercent").val(ins);
|
|
|
- }
|
|
|
- if(!isNaN(insFe)){
|
|
|
- $("#installUnitFees").val(insFe);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- function getInstallFees() {
|
|
|
- $("#installPercent").val('');
|
|
|
- $("#installUnitFees").val('');
|
|
|
- var totalFee = $("#totalFees").val();
|
|
|
- var budFee = $("#installFees").val();
|
|
|
- var count = $("#buildingScale").val();
|
|
|
- if(totalFee != '') {
|
|
|
- var p = Math.round(parseInt(budFee) / parseInt(totalFee) * 100 * 100) / 100;
|
|
|
- }
|
|
|
- if(count != '') {
|
|
|
- var pp = Math.round(parseInt(budFee) / parseInt(count) * 100) / 100 * 10000;
|
|
|
- }
|
|
|
- $("#installPercent").val(p);
|
|
|
- $("#installUnitFees").val(pp);
|
|
|
- }
|
|
|
-
|
|
|
- function setLinkMan(newClientId) {
|
|
|
- $.ajax({
|
|
|
- url:"${ctx}/ruralProject/ruralProjectRecords/getLinkManByClientId",
|
|
|
- data:{"clientId":newClientId},
|
|
|
- type:"post",
|
|
|
- dataType:"json",
|
|
|
- success:function (d) {
|
|
|
- // console.log(d);
|
|
|
- addRow('#workClientLinkmanList', workClientLinkmanRowIdx, workClientLinkmanTpl);workClientLinkmanRowIdx = workClientLinkmanRowIdx + 1;
|
|
|
- var row = workClientLinkmanRowIdx - 1 ;
|
|
|
- $("#workClientLinkmanList"+row+"_id").val(d.id);
|
|
|
- $("#workClientLinkmanList"+row+"_clientId_id").val(d.clientId);
|
|
|
- $("#workClientLinkmanList"+row+"_clientName").val(d.clientName);
|
|
|
- $("#workClientLinkmanList"+row+"_name").val(d.linkName);
|
|
|
- $("#workClientLinkmanList"+row+"_linkMobile").val(d.linkMobile);
|
|
|
- $("#workClientLinkmanList"+row+"_linkPhone").val(d.linkPhone);
|
|
|
- $("#workClientLinkmanList"+row+"_clientName").prop("readonly","readonly");
|
|
|
- $("#workClientLinkmanList"+row+"_name").prop("readonly","readonly");
|
|
|
- $("#workClientLinkmanList"+row+"_linkMobile").prop("readonly","readonly");
|
|
|
- $("#workClientLinkmanList"+row+"_linkPhone").prop("readonly","readonly");
|
|
|
-
|
|
|
- //按钮禁用
|
|
|
- $("#addUserButton").removeClass("disables");
|
|
|
- $("#addUserButton").removeClass("notDisables");
|
|
|
- $("#addUserButton").addClass("disables");
|
|
|
- //a标签置灰
|
|
|
- $("#aButton").removeClass("forbidden");
|
|
|
- $("#aButton").removeClass("notForbidden");
|
|
|
- $("#aButton").addClass("forbidden");
|
|
|
-
|
|
|
- $("#linkmanDiv").removeClass("disables");
|
|
|
- $("#linkmanDiv").removeClass("notDisables");
|
|
|
- $("#linkmanDiv").addClass("disables");
|
|
|
-
|
|
|
- $("#linkmanButton").removeClass("forbidden");
|
|
|
- $("#linkmanButton").removeClass("notForbidden");
|
|
|
- $("#linkmanButton").addClass("forbidden");
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- function setValuee(obj){
|
|
|
- var successRows = 0;
|
|
|
- ss = $("#workClientLinkmanList tr").length;
|
|
|
- for (var i = 0; i < obj.length; i++) {
|
|
|
- //没有重复的客户id,就可以插入
|
|
|
- var canInsert = true;
|
|
|
- for (var j = 0; j < ss; j++) {
|
|
|
- var cid = $("#workClientLinkmanList" + j + "_id").val();
|
|
|
- if(cid == obj[i].id){
|
|
|
- canInsert = false;
|
|
|
- // console.log("重复!!");
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if(canInsert==true){
|
|
|
- var idArr = $("#workClientLinkmanList tr:visible .clientId");
|
|
|
- if (obj[i].id != '' && !hasInArr(obj[i].id, idArr)) {
|
|
|
- addRow("#workClientLinkmanList", workClientLinkmanRowIdx, workClientLinkmanTpl, obj[i]);
|
|
|
- workClientLinkmanRowIdx = workClientLinkmanRowIdx + 1;
|
|
|
- successRows++;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- clientCount=successRows+clientCount;
|
|
|
- // console.log("success==="+successRows);
|
|
|
- // console.log("clientCount==="+clientCount);
|
|
|
-
|
|
|
- //如果委托方还没有设置,则将第一个客户设置为委托方
|
|
|
- if(obj[0].name != null){
|
|
|
- if(isMasterClient){
|
|
|
- $("#contractClientName").val(obj[0].clientId.name);
|
|
|
- isMasterClient = false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //按钮禁用
|
|
|
- $("#addUserButton").removeClass("disables");
|
|
|
- $("#addUserButton").removeClass("notDisables");
|
|
|
- $("#addUserButton").addClass("disables");
|
|
|
- //a标签置灰
|
|
|
- $("#aButton").removeClass("forbidden");
|
|
|
- $("#aButton").removeClass("notForbidden");
|
|
|
- $("#aButton").addClass("forbidden");
|
|
|
-
|
|
|
- $("#linkmanDiv").removeClass("disables");
|
|
|
- $("#linkmanDiv").removeClass("notDisables");
|
|
|
- $("#linkmanDiv").addClass("disables");
|
|
|
-
|
|
|
- $("#linkmanButton").removeClass("forbidden");
|
|
|
- $("#linkmanButton").removeClass("notForbidden");
|
|
|
- $("#linkmanButton").addClass("forbidden");
|
|
|
- }
|
|
|
- function hasInArr(id,idArr) {
|
|
|
- for(var i=0;i<idArr.length;i++){
|
|
|
- if(id==$(idArr[i]).val()){
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
- function existLinkman(id,length) {
|
|
|
- for (var i=0;i<length;i++) {
|
|
|
- var val = $('#workClientLinkmanList'+i+'_id').val();
|
|
|
- if(id==val){
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- function setClientInfo(obj) {
|
|
|
- for(var i=0;i<obj.length;i++){
|
|
|
- var idArr = $("#workConstructionLinkmanList tr:visible .linkmanId");
|
|
|
- if(obj[i].id!=''&&!hasInArr(obj[i].id,idArr)){
|
|
|
- addRow("#workConstructionLinkmanList",workConstructionLinkmanRowIdx,workConstructionLinkmanTpl,obj[i]);
|
|
|
- workConstructionLinkmanRowIdx=workConstructionLinkmanRowIdx+1;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- function existConstructionLinkman(obj,length) {
|
|
|
- for (var i=0;i<length;i++) {
|
|
|
- var val = $('#workConstructionLinkmanList'+i+'_id').val();
|
|
|
- var cid = $('#workConstructionLinkmanList'+i+'_cid').val();
|
|
|
- if(obj.id==val&&obj.client.id==cid){
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- function insertTitle(tValue){
|
|
|
- $("#flagFile").val(false);
|
|
|
- var files = $("#attachment_file")[0].files; for(var i = 0;i<files.length;i++) { var file = files[i];
|
|
|
- var attachmentId = $("#id").val();
|
|
|
- var attachmentFlag = "82";
|
|
|
- /*console.log(file);*/
|
|
|
- var timestamp=new Date().getTime();
|
|
|
-
|
|
|
- var storeAs = "attachment-file/projectRecords/"+timestamp+"/"+file['name'];
|
|
|
- var uploadPath="http://gangwan-app.oss-cn-hangzhou.aliyuncs.com/"+storeAs;/*将这段字符串存到数据库即可*/
|
|
|
- var divId = "_attachment";
|
|
|
- $("#addFile"+divId).show();
|
|
|
- multipartUploadWithSts(storeAs, file,attachmentId,attachmentFlag,uploadPath,divId,0);}
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- function addFile() {
|
|
|
- $("#attachment_file").click();
|
|
|
- }
|
|
|
-
|
|
|
function addRow(list, idx, tpl, row){
|
|
|
// var idx1 = $("#workClientLinkmanList tr").length;
|
|
|
idx +=1;
|
|
@@ -599,15 +353,6 @@
|
|
|
var id = $(prefix+"_id");
|
|
|
var delFlag = $(prefix+"_delFlag");
|
|
|
$(obj).parent().parent().remove();
|
|
|
- if($("#workClientLinkmanList tr").length==0){
|
|
|
- //按钮禁用
|
|
|
- $("#addUserButton").addClass("notDisables");
|
|
|
- //a标签置灰
|
|
|
- $("#aButton").addClass("notForbidden");
|
|
|
-
|
|
|
- $("#linkmanDiv").addClass("notDisables");
|
|
|
- $("#linkmanButton").addClass("notForbidden");
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
function delRow(obj, prefix){
|
|
@@ -628,151 +373,7 @@
|
|
|
}
|
|
|
$(obj).val(t.split("").reverse().join("") + "." + r);
|
|
|
}
|
|
|
- function openBill2(title,url,width,height,target,formId){
|
|
|
|
|
|
- if($("#workClientLinkmanList tr").length>0){
|
|
|
- top.layer.msg('仅可添加一名委托方联系人!', {icon: 0});
|
|
|
- return false;
|
|
|
- }
|
|
|
- var frameIndex = parent.layer.getFrameIndex(window.name);
|
|
|
- var urls = url+"&index="+frameIndex;
|
|
|
- if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
|
|
|
- width='auto';
|
|
|
- height='auto';
|
|
|
- }else{//如果是PC端,根据用户设置的width和height显示。
|
|
|
-
|
|
|
- }
|
|
|
- top.layer.open({
|
|
|
- type: 2,
|
|
|
- area: [width, height],
|
|
|
- title: title,
|
|
|
- skin:"two-btns",
|
|
|
- maxmin: false, //开启最大化最小化按钮
|
|
|
- content: urls ,
|
|
|
- btn: ['确定','关闭'],
|
|
|
- yes: function(index, layero){
|
|
|
- var body = top.layer.getChildFrame('body', index);
|
|
|
- var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
|
|
|
- var inputForm = body.find('#inputForm');
|
|
|
- var top_iframe;
|
|
|
- if(target){
|
|
|
- top_iframe = target;//如果指定了iframe,则在改frame中跳转
|
|
|
- }else{
|
|
|
- top_iframe = top.getActiveTab().attr("name");//获取当前active的tab的iframe
|
|
|
- }
|
|
|
- inputForm.attr("target",top_iframe);//表单提交成功后,从服务器返回的url在当前tab中展示
|
|
|
- inputForm.attr("action","${ctx}/ruralProject/ruralProjectRecords/linkManSave");//表单提交成功后,从服务器返回的url在当前tab中展示
|
|
|
- var $document = iframeWin.contentWindow.document;
|
|
|
-
|
|
|
- formSubmit2($document,formId,index);
|
|
|
- //新增人员之后
|
|
|
- //按钮禁用
|
|
|
- $("#addUserButton").addClass("disables");
|
|
|
- //a标签置灰
|
|
|
- $("#aButton").addClass("forbidden");
|
|
|
-
|
|
|
- $("#linkmanDiv").addClass("disables");
|
|
|
- $("#linkmanButton").addClass("forbidden");
|
|
|
- },
|
|
|
- cancel: function(index){
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- function formSubmit2($document,inputForm,index){
|
|
|
- var validateForm = $($document.getElementById(inputForm)).validate({
|
|
|
- submitHandler: function(form){
|
|
|
- loading('正在提交,请稍等...');
|
|
|
- form.submit();
|
|
|
- },
|
|
|
- errorContainer: "#messageBox",
|
|
|
- errorPlacement: function(error, element) {
|
|
|
- $($document.getElementById("#messageBox")).text("输入有误,请先更正。");
|
|
|
- if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
|
|
|
- error.appendTo(element.parent().parent());
|
|
|
- } else {
|
|
|
- error.insertAfter(element);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- if(validateForm.form()){
|
|
|
- $($document.getElementById(inputForm)).ajaxSubmit({
|
|
|
- success:function(data) {
|
|
|
- var d = data;
|
|
|
- if(d.msg == "false"){
|
|
|
- parent.layer.msg("保存客户信息异常!",{icon:2});
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- addRow('#workClientLinkmanList', workClientLinkmanRowIdx, workClientLinkmanTpl);workClientLinkmanRowIdx = workClientLinkmanRowIdx + 1;
|
|
|
- var row = workClientLinkmanRowIdx - 1 ;
|
|
|
-
|
|
|
- $("#"+"workClientLinkmanList"+row+"_id").val(d.id);
|
|
|
- $("#"+"workClientLinkmanList"+row+"_clientId_id").val(d.clientId);
|
|
|
- $("#"+"workClientLinkmanList"+row+"_clientName").val(d.clientName);
|
|
|
- $("#"+"workClientLinkmanList"+row+"_name").val(d.linkName);
|
|
|
- $("#"+"workClientLinkmanList"+row+"_linkMobile").val(d.linkMobile);
|
|
|
- $("#"+"workClientLinkmanList"+row+"_linkPhone").val(d.linkPhone);
|
|
|
- if(isMasterClient){
|
|
|
- $("#contractClientName").val(d.clientName);
|
|
|
- isMasterClient = false;
|
|
|
- }
|
|
|
- parent.layer.msg(d.str,{icon:1});
|
|
|
- top.layer.close(index)
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- function getApprovalFee() {
|
|
|
- //总价
|
|
|
- var af = $("#estimateTotalFees").val();
|
|
|
- if(af !=''){
|
|
|
- $("#estimateTotalFees").val(af)
|
|
|
- }
|
|
|
- $("#buildingFees").val("");
|
|
|
- $("#installFees").val("");
|
|
|
- $("#buildingPercent").val("");
|
|
|
- $("#installPercent").val("");
|
|
|
- }
|
|
|
-
|
|
|
- function getInstallFee() {
|
|
|
- var af = $("#estimateTotalFees").val();
|
|
|
- //安装
|
|
|
- var inf = $("#installFees").val();
|
|
|
- if(inf != ''&& af !=''){
|
|
|
- var hf = parseInt(af)-parseInt(inf);
|
|
|
- var rate = (Math.round(parseInt(inf) / parseInt(af) * 100) / 100 * 100).toFixed(2);
|
|
|
- $("#installPercent").val(rate);
|
|
|
- $("#buildingFees").val(hf);
|
|
|
- bf = hf;
|
|
|
- var bRate = (Math.round(parseInt(hf) / parseInt(af) * 100) / 100 * 100).toFixed(2);
|
|
|
- $("#buildingPercent").val(bRate);
|
|
|
- }
|
|
|
- if(inf == ''|| af ==''){
|
|
|
- $("#installPercent").val("");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- function getBuildingFee() {
|
|
|
- var af = $("#estimateTotalFees").val();
|
|
|
- //土建
|
|
|
- var bf = $("#buildingFees").val();
|
|
|
- if(bf != ''&& af !=''){
|
|
|
- var hf = parseInt(af)-parseInt(bf);
|
|
|
- var rate = (Math.round(parseInt(bf) / parseInt(af) * 100) / 100 * 100).toFixed(2);
|
|
|
- $("#buildingPercent").val(rate);
|
|
|
- $("#installFees").val(hf);
|
|
|
- inf = hf;
|
|
|
- var inRate = (Math.round(parseInt(hf) / parseInt(af) * 100) / 100 * 100).toFixed(2);
|
|
|
- $("#installPercent").val(inRate);
|
|
|
- }
|
|
|
- if(bf == ''|| af ==''){
|
|
|
- $("#buildingPercent").val("");
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
|
|
|
function setTaxMoney(obj){
|
|
@@ -805,12 +406,14 @@
|
|
|
}
|
|
|
var m = parseFloat(mv)* 10000;
|
|
|
var size = $("#reportedConsultantList tr").length;
|
|
|
- for (var i = 1;i<=size;i++){
|
|
|
- var wcyysrbl = $("#reportedConsultantList"+i+"_wcyysrbl").val();
|
|
|
+ if(size>0){
|
|
|
+ for (var i = 1;i<=50;i++){
|
|
|
+ var wcyysrbl = $("#reportedConsultantList"+i+"_wcyysrbl").val();
|
|
|
|
|
|
- if(wcyysrbl!=''){
|
|
|
- var wcyysr = m * wcyysrbl /100;
|
|
|
- $("#reportedConsultantList"+i+"_wcyysr").val(wcyysr);
|
|
|
+ if(wcyysrbl != undefined && wcyysrbl!=''){
|
|
|
+ var wcyysr = m * wcyysrbl /100;
|
|
|
+ $("#reportedConsultantList"+i+"_wcyysr").val(wcyysr);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|