| | |
| | | var pageCount = 0; |
| | | var treeCond; |
| | | var admin; |
| | | var userId ; |
| | | var userName ; |
| | | layui.config({ |
| | | base: baseUrl + "/static/layui/lay/modules/" |
| | | }).extend({ |
| | |
| | | case 1: |
| | | // 模板下载 |
| | | layer.load(1, {shade: [0.1,'#fff']}); |
| | | location.href = baseUrl + "/mould/甲方单位导入模板.xls"; |
| | | location.href = baseUrl + "/mould/跟踪项目导入模板.xls"; |
| | | layer.closeAll('loading'); |
| | | break |
| | | case 2: |
| | |
| | | }) |
| | | } |
| | | |
| | | 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: 'id', align: 'center',title: 'ID'} |
| | | // ,{field: 'hostId$', align: 'center',title: '所属商户'} |
| | | ,{field: 'deptId$', align: 'center',title: '所属部门'} |
| | | ,{field: 'userId$', align: 'center',title: '所属人员'} |
| | | ,{field: 'cstmrId$', align: 'center',title: '甲方单位'} |
| | | ,{field: 'uuid', align: 'center',title: '客户代号'} |
| | | ,{field: 'name', align: 'center',title: '客户名称'} |
| | | ,{field: 'money', align: 'center',title: '总金额'} |
| | | ,{field: 'company$', align: 'center',title: '所属公司'} |
| | | ,{field: 'remarks', align: 'center',title: '备注'} |
| | | ,{field: 'director$', align: 'center',title: '负责人'} |
| | | ,{field: 'province', align: 'center',title: '省', hide: true} |
| | | ,{field: 'city', align: 'center',title: '市', hide: true} |
| | | ,{field: 'district', align: 'center',title: '县', hide: true} |
| | | ,{field: 'town', align: 'center',title: '镇', hide: true} |
| | | ,{field: 'addr', align: 'center',title: '详细地址', hide: true} |
| | | ,{field: 'files', align: 'center',title: '附件', hide: true} |
| | | ,{field: 'status$', align: 'center',title: '状态', hide: true} |
| | | ,{field: 'createBy$', align: 'center',title: '添加人员', hide: true} |
| | | ,{field: 'createTime$', align: 'center',title: '添加时间', hide: true} |
| | | ,{field: 'updateBy$', align: 'center',title: '修改人员', hide: true} |
| | | ,{field: 'updateTime$', align: 'center',title: '修改时间', hide: true} |
| | | ,{field: 'memo', align: 'center',title: '注释', hide: true} |
| | | {type: 'checkbox'}, |
| | | {field: 'id', align: 'left',title: '项目号',hide: false}, |
| | | { |
| | | field: 'name', |
| | | align: 'left', |
| | | title: '跟踪项目名称', |
| | | style: 'color: #1890ff;cursor:pointer', |
| | | event: 'more', |
| | | width: 300 |
| | | }, |
| | | {field: 'uuid', align: 'left',title: '项目代号',hide: false}, |
| | | { |
| | | 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: '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: '添加时间', hide: false}, |
| | | {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}, |
| | | {field: 'town', align: 'left',title: '镇', hide: true}, |
| | | {field: 'status$', align: 'left',title: '状态', hide: false}, |
| | | {field: 'status', align: 'left',title: '状态', hide: true}, |
| | | {field: 'files', align: 'left',title: '附件', hide: true}, |
| | | {field: 'updateBy$', align: 'left',title: '修改人员', hide: true}, |
| | | {field: 'updateTime$', align: 'left',title: '修改时间', hide: true}, |
| | | {field: 'memo', align: 'left',title: '注释', hide: true}, |
| | | |
| | | ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:120} |
| | | {fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:180} |
| | | ]], |
| | | request: { |
| | | pageName: 'curr', |
| | |
| | | } |
| | | }) |
| | | break; |
| | | case 'cstmrMore': |
| | | top.cstmrByMore = data.cstmrId; |
| | | admin.popupRight({ |
| | | type: 1, |
| | | window: "top", |
| | | area: "1250px", |
| | | url: "../cstmr/cstmr_more.html", |
| | | end: function () { |
| | | // $(".layui-laypage-btn")[0].click(); |
| | | } |
| | | }) |
| | | break; |
| | | case 'edit': |
| | | showEditModel(data); |
| | | break; |
| | | case "del": |
| | | del([data.id]); |
| | | break; |
| | | case "business": |
| | | // 选择出差类型 |
| | | admin.open({ |
| | | type: 1, |
| | | area: '300px', |
| | | title: '选择出差类型', |
| | | content: $('#businessListDialog').html(), |
| | | success: function (layero, dIndex) { |
| | | let businessSel = xmSelect.render({ |
| | | el: '#businessXmlSel', |
| | | autoRow: true, |
| | | filterable: true, |
| | | remoteSearch: true, |
| | | clickClose: true, |
| | | radio: true, |
| | | remoteMethod: function (val, cb, show) { |
| | | let loadIndex = layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl+"/order/business/list/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | orderId: data.id |
| | | }, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.close(loadIndex); |
| | | if (res.code === 200) { |
| | | cb(res.data) |
| | | } else { |
| | | layer.close(dIndex); |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | }); |
| | | form.on('submit(editSubmit)', function () { |
| | | let businessSN = businessSel.getValue()[0] ? businessSel.getValue()[0].value : null; |
| | | if (!businessSN) { |
| | | layer.msg("请选择出差单类型", {icon: 2}); |
| | | top.requireTip($('#orderStaXmlSel')); |
| | | return false; |
| | | } |
| | | if (businessSN===1){ |
| | | business(data.id); |
| | | }else { |
| | | businessOther(data.id); |
| | | } |
| | | |
| | | }); |
| | | |
| | | $(layero).children('.layui-layer-content').css('overflow', 'visible'); |
| | | } |
| | | }); |
| | | break; |
| | | } |
| | | }); |
| | | |
| | | /* 弹窗 - 出差申请 */ |
| | | function business(orderId) { |
| | | admin.open({ |
| | | type: 1, |
| | | area: '1500px', |
| | | title: '出差申请', |
| | | content: $('#editDialog2').html(), |
| | | success: function (layero, dIndex) { |
| | | layDateRender("添加"); |
| | | cascaderRenderStart(); |
| | | cascaderRenderEnd(); |
| | | form.val('detail2'); |
| | | form.on('submit(editSubmit2)', function (data) { |
| | | var loadIndex = layer.load(2); |
| | | console.log(data) |
| | | data.field.orderId=orderId; |
| | | console.log(orderId) |
| | | console.log(data) |
| | | |
| | | $.ajax({ |
| | | url: baseUrl+"/businessTrip/add/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: data.field, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.close(loadIndex); |
| | | if (res.code === 200){ |
| | | layer.close(dIndex); |
| | | layer.closeAll() |
| | | layer.msg(res.msg, {icon: 1}); |
| | | tableReload(); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | $(layero).children('.layui-layer-content').css('overflow', 'visible'); |
| | | layui.form.render('select'); |
| | | } |
| | | }); |
| | | // layer.open({ |
| | | // type: 2, |
| | | // title: '出差申请', |
| | | // maxmin: true, |
| | | // area: [top.detailWidth, top.detailHeight], |
| | | // shadeClose: true, |
| | | // content: '../../views/businessTrip/businessTrip.html', |
| | | // success:function(){ |
| | | // |
| | | // } |
| | | // ,yes:function(){ |
| | | // |
| | | // } |
| | | // |
| | | // }); |
| | | } |
| | | |
| | | /* 弹窗 - 其它出差 */ |
| | | function businessOther(orderId) { |
| | | admin.open({ |
| | | type: 1, |
| | | area: '1500px', |
| | | title: '出差申请', |
| | | content: $('#editDialog3').html(), |
| | | success: function (layero, dIndex) { |
| | | form.val('detail3'); |
| | | form.on('submit(editSubmit3)', function (data) { |
| | | var loadIndex = layer.load(2); |
| | | console.log(data) |
| | | data.field.orderId=orderId |
| | | console.log(orderId) |
| | | $.ajax({ |
| | | url: baseUrl+"/businessTripOther/add/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: data.field, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.close(loadIndex); |
| | | if (res.code === 200){ |
| | | layer.close(dIndex); |
| | | layer.closeAll() |
| | | layer.msg(res.msg, {icon: 1}); |
| | | tableReload(); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | $(layero).children('.layui-layer-content').css('overflow', 'visible'); |
| | | layui.form.render('select'); |
| | | } |
| | | }); |
| | | // layer.open({ |
| | | // type: 2, |
| | | // title: '其它出差', |
| | | // maxmin: true, |
| | | // area: [top.detailWidth, top.detailHeight], |
| | | // shadeClose: true, |
| | | // content: '../../views/businessTrip/businessTripOther.html', |
| | | // success: function(layero, index){ |
| | | // |
| | | // } |
| | | // }); |
| | | } |
| | | |
| | | /* 弹窗 - 新增、修改 */ |
| | | function showEditModel(mData) { |
| | | admin.open({ |
| | | type: 1, |
| | | area: '1500px', |
| | | title: (mData ? '修改' : '添加') + '订单状态', |
| | | title: (mData ? '修改' : '添加') + '跟踪项目', |
| | | content: $('#editDialog').html(), |
| | | success: function (layero, dIndex) { |
| | | let cstmrSel = loadCstmrSel(); |
| | | let companySel = loadCompanySel(); |
| | | let method = mData?'update':'add'; |
| | | if (!mData){ |
| | | companySel.setValue([{name: "浙江中扬立库技术有限公司", value: 4}]); |
| | | } |
| | | if (method === 'update'){ |
| | | var statusNone = document.getElementById("statusNone"); |
| | | statusNone.style.display = "block"; |
| | | } |
| | | 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(); |
| | | form.val('detail', mData); |
| | | form.on('submit(editSubmit)', function (data) { |
| | | data.field.cstmrId = cstmrSel.getValue()[0] ? cstmrSel.getValue()[0].value : null; |
| | | data.field.company = companySel.getValue()[0] ? companySel.getValue()[0].value : null; |
| | | if (!data.field.company) { |
| | | layer.msg("所属公司不能为空", {icon: 2}); |
| | | return false; |
| | | } |
| | | if (!data.field.cstmrId) { |
| | | 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; |
| | |
| | | function layDateRender(data) { |
| | | setTimeout(function () { |
| | | layDate.render({ |
| | | elem: '#businessStartTime\\$', |
| | | type: 'datetime', |
| | | value: data!==undefined?data['businessStartTime\\$']:null |
| | | }); |
| | | layDate.render({ |
| | | elem: '#businessEndTime\\$', |
| | | type: 'datetime', |
| | | value: data!==undefined?data['businessEndTime\\$']:null |
| | | }); |
| | | layDate.render({ |
| | | elem: '.layui-laydate-range' |
| | | ,type: 'datetime' |
| | | ,range: true |
| | |
| | | layDateRender(); |
| | | |
| | | // 省市区选择 |
| | | function cascaderRenderStart() { |
| | | cascader.render({ |
| | | elem: '#cascaderValStart', |
| | | data: citysData, |
| | | itemHeight: '250px', |
| | | filterable: true, |
| | | onChange: function (values, data) { |
| | | // console.log(values);console.log(data); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // 省市区选择 |
| | | function cascaderRenderEnd() { |
| | | cascader.render({ |
| | | elem: '#cascaderValEnd', |
| | | data: citysData, |
| | | itemHeight: '250px', |
| | | filterable: true, |
| | | onChange: function (values, data) { |
| | | // console.log(values);console.log(data); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // 省市区选择 |
| | | function cascaderRender() { |
| | | cascader.render({ |
| | | elem: '#cascaderVal', |
| | |
| | | }); |
| | | } |
| | | |
| | | $(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({ |
| | | url: baseUrl + "/cstmr/all/get/kv", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | condition: val |
| | | }, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200) { |
| | | cb(res.data) |
| | | } else { |
| | | cb([]); |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | window.loadCompanySel = function () { |
| | | return xmSelect.render({ |
| | | el: '#companyXmlSel', |
| | | autoRow: true, |
| | | filterable: true, |
| | | remoteSearch: true, |
| | | clickClose: true, |
| | | radio: true, |
| | | remoteMethod: function (val, cb, show) { |
| | | $.ajax({ |
| | | url: baseUrl + "/company/all/get/kv", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | condition: val |
| | | }, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200) { |
| | | cb(res.data) |
| | | } else { |
| | | cb([]); |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | }); |
| | | |
| | | // 关闭动作 |