|  |  |  | 
|---|
|  |  |  | var pageCount = 0; | 
|---|
|  |  |  | var treeCond; | 
|---|
|  |  |  | var admin; | 
|---|
|  |  |  | var userId ; | 
|---|
|  |  |  | var userName ; | 
|---|
|  |  |  | layui.config({ | 
|---|
|  |  |  | base: baseUrl + "/static/layui/lay/modules/" | 
|---|
|  |  |  | }).extend({ | 
|---|
|  |  |  | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | let where = {} | 
|---|
|  |  |  | if (getQueryVariable('status') !== false) { | 
|---|
|  |  |  | where = {status: getQueryVariable('status')} | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 数据渲染 | 
|---|
|  |  |  | tableIns = table.render({ | 
|---|
|  |  |  | elem: '#order', | 
|---|
|  |  |  | 
|---|
|  |  |  | height: 'full-148', | 
|---|
|  |  |  | // size: 'sm', | 
|---|
|  |  |  | skin: 'line', | 
|---|
|  |  |  | where: where, | 
|---|
|  |  |  | cols: [[ | 
|---|
|  |  |  | {type: 'checkbox'} | 
|---|
|  |  |  | ,{field: 'name', align: 'left',title: '跟踪项目名称', style: 'color: #1890ff;cursor:pointer', event: 'more', width: 300} | 
|---|
|  |  |  | 
|---|
|  |  |  | ,{field: 'cstmrId$', align: 'left',title: '甲方单位', style: 'color: #1890ff;cursor:pointer', event: 'cstmrMore', templet:function(d){return emptyShow(d.cstmrId$)}} | 
|---|
|  |  |  | ,{field: 'pcd$', align: 'left',title: '所属区域', templet:function(d){return emptyShow(d.pcd$)}} | 
|---|
|  |  |  | ,{field: 'addr', align: 'left',title: '项目地址', templet:function(d){return emptyShow(d.addr)}} | 
|---|
|  |  |  | ,{field: 'money', align: 'right',title: '项目预算金额', templet:function(d){return emptyShow(d.money)}} | 
|---|
|  |  |  | ,{field: 'money', align: 'right',title: '项目预算金额', templet:function(d){return emptyShow(d.money+"万")}} | 
|---|
|  |  |  | ,{field: 'transactionRate', align: 'right',title: '项目预估成交率', templet:function(d){return emptyShow(d.transactionRate+"%")}} | 
|---|
|  |  |  | ,{field: 'director$', align: 'left',title: '项目负责人', templet:function(d){return emptyShow(d.director$)}} | 
|---|
|  |  |  | ,{field: 'remarks', align: 'left',title: '备注', templet:function(d){return emptyShow(d.remarks)}} | 
|---|
|  |  |  | ,{field: 'createTime$', align: 'left',title: '添加时间'} | 
|---|
|  |  |  | ,{field: 'company$', align: 'left',title: '所属公司', hide: true} | 
|---|
|  |  |  | ,{field: 'company$', align: 'left',title: '所属公司', hide: false} | 
|---|
|  |  |  | ,{field: 'orderProductTypeId$', align: 'left',title: '产品类型', hide: false} | 
|---|
|  |  |  | ,{field: 'province', align: 'left',title: '省', hide: true} | 
|---|
|  |  |  | ,{field: 'city', align: 'left',title: '市', hide: true} | 
|---|
|  |  |  | ,{field: 'district', align: 'left',title: '县', hide: true} | 
|---|
|  |  |  | 
|---|
|  |  |  | success: function (layero, dIndex) { | 
|---|
|  |  |  | let cstmrSel = loadCstmrSel(); | 
|---|
|  |  |  | let companySel = loadCompanySel(); | 
|---|
|  |  |  | let method = mData?'update':'add'; | 
|---|
|  |  |  | if (!mData){ | 
|---|
|  |  |  | companySel.setValue([{name: "浙江中扬立库技术有限公司", value: 4}]); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (mData) { | 
|---|
|  |  |  | $('#cascaderVal').val(mData.pcd); | 
|---|
|  |  |  | if (mData.cstmrId) { cstmrSel.setValue([{name: mData.cstmrId$, value: mData.cstmrId}]); } | 
|---|
|  |  |  | if (mData.company) { companySel.setValue([{name: mData.company$, value: mData.company}]); } | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | mData = { | 
|---|
|  |  |  | director: Number(userId), | 
|---|
|  |  |  | director$: userName | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | layDateRender(mData); | 
|---|
|  |  |  | cascaderRender(); | 
|---|
|  |  |  | 
|---|
|  |  |  | layer.msg("甲方单位不能为空", {icon: 2}); | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!data.field.transactionRate) { | 
|---|
|  |  |  | layer.msg("预计成交率不能为空", {icon: 2}); | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!data.field.status) { | 
|---|
|  |  |  | layer.msg("项目状态不能为空", {icon: 2}); | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!data.field.pcd) { | 
|---|
|  |  |  | layer.msg("省市区不能为空", {icon: 2}); | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!data.field.director) { | 
|---|
|  |  |  | layer.msg("负责人不能为空", {icon: 2}); | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | var loadIndex = layer.load(2); | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl+"/order/"+(mData?'update':'add')+"/auth", | 
|---|
|  |  |  | url: baseUrl+"/order/"+(method)+"/auth", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | data: data.field, | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | console.log(data.field) | 
|---|
|  |  |  | console.log(res) | 
|---|
|  |  |  | layer.close(loadIndex); | 
|---|
|  |  |  | if (res.code === 200){ | 
|---|
|  |  |  | layer.close(dIndex); | 
|---|
|  |  |  | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | layer.msg(res.msg, {icon: 2}); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ,error: function(xhr, status, error) { | 
|---|
|  |  |  | // 处理错误 | 
|---|
|  |  |  | console.log(data.field) | 
|---|
|  |  |  | console.log(res) | 
|---|
|  |  |  | console.log(error) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | $(document).ready(function() { | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl + "/order/userName/userId/auth", | 
|---|
|  |  |  | headers: { 'token': localStorage.getItem('token') }, | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | success: function(res) { | 
|---|
|  |  |  | if (res.code === 200) { | 
|---|
|  |  |  | userId = res.data.value; | 
|---|
|  |  |  | userName = res.data.name; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | error: function(xhr, status, error) { | 
|---|
|  |  |  | // 处理错误 | 
|---|
|  |  |  | console.log(error); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | window.loadCstmrSel = function () { | 
|---|
|  |  |  | return xmSelect.render({ | 
|---|
|  |  |  | el: '#cstmrXmlSel', | 
|---|
|  |  |  | autoRow: true, | 
|---|
|  |  |  | filterable: true, | 
|---|
|  |  |  | remoteSearch: true, | 
|---|
|  |  |  | clickClose: true, | 
|---|
|  |  |  | radio: true, | 
|---|
|  |  |  | remoteMethod: function (val, cb, show) { | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | 
|---|
|  |  |  | autoRow: true, | 
|---|
|  |  |  | filterable: true, | 
|---|
|  |  |  | remoteSearch: true, | 
|---|
|  |  |  | clickClose: true, | 
|---|
|  |  |  | radio: true, | 
|---|
|  |  |  | remoteMethod: function (val, cb, show) { | 
|---|
|  |  |  | $.ajax({ | 
|---|