|  |  | 
 |  |  | layui.config({ | 
 |  |  |     base: baseUrl + "/static/layui/lay/modules/" | 
 |  |  | }).extend({ | 
 |  |  |     steps: 'steps/steps', | 
 |  |  |     cascader: 'cascader/cascader', | 
 |  |  | }).use(['table','laydate', 'form', 'admin', 'xmSelect', 'element', 'cascader', 'tree', 'dropdown'], function(){ | 
 |  |  |     var table = layui.table; | 
 |  |  | 
 |  |  |         toolbar: '#toolbar', | 
 |  |  |         cellMinWidth: 150, | 
 |  |  |         cols: [[ | 
 |  |  |             {type: 'checkbox', fixed: 'left'} | 
 |  |  |             ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80,hide: true} | 
 |  |  |             // {type: 'checkbox', fixed: 'left'}, | 
 |  |  |             {field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80,hide: true} | 
 |  |  |             ,{field: 'templateName', align: 'center',title: '报销类型',hide: false} | 
 |  |  |             ,{field: 'orderNum', align: 'center',title: '报销单号'} | 
 |  |  |             ,{field: 'orderId$', align: 'center',title: '项目号'} | 
 |  |  |             ,{field: 'createTime$', align: 'center',title: '创建时间'} | 
 |  |  |             ,{field: 'updateTime$', align: 'center',title: '更新时间'} | 
 |  |  |             ,{field: 'status$', align: 'center',title: '状态'} | 
 |  |  |             ,{field: 'memberId$', align: 'center',title: '业务员'} | 
 |  |  |             ,{field: 'user$', align: 'center',title: '创建人员'} | 
 |  |  |             ,{field: 'updateUserId$', align: 'center',title: '更新人员'} | 
 |  |  |             ,{field: 'checkData', align: 'center',title: '是否冲账',hide: false} | 
 |  |  |             ,{field: 'orderNum', align: 'center',title: '报销单号',width: 320, style: 'color: #1890ff;cursor:pointer', event: 'more',hide: false} | 
 |  |  |             ,{field: 'planId$', align: 'center',title: '项目号',hide: false} | 
 |  |  |             ,{field: 'settle', align: 'center',title: '进度',hide: false} | 
 |  |  |             ,{field: 'createTime$', align: 'center',title: '创建时间',hide: false} | 
 |  |  |             ,{field: 'updateTime$', align: 'center',title: '更新时间',hide: false} | 
 |  |  |             ,{field: 'status$', align: 'center',title: '状态',hide: false} | 
 |  |  |             ,{field: 'memberId$', align: 'center',title: '业务员',hide: false} | 
 |  |  |             ,{field: 'user$', align: 'center',title: '创建人员',hide: false} | 
 |  |  |             ,{field: 'updateUserId$', align: 'center',title: '更新人员',hide: false} | 
 |  |  |             // // ,{field: 'checkDataStatus$', align: 'center',title: '报价数据'} | 
 |  |  |             ,{align: 'center', title: '报销明细', toolbar: '#tbLook', minWidth: 160, width: 160} | 
 |  |  |             ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:350} | 
 |  |  | 
 |  |  |     table.on('tool(reimburseOnline)', function(obj){ | 
 |  |  |         var data = obj.data; | 
 |  |  |         switch (obj.event) { | 
 |  |  |             // 核价 | 
 |  |  |             case 'check': | 
 |  |  |                 layer.open({ | 
 |  |  |                     type: 2, | 
 |  |  |                     title: '核价', | 
 |  |  |                     maxmin: true, | 
 |  |  |                     area: [top.detailWidth, top.detailHeight], | 
 |  |  |                     shadeClose: false, | 
 |  |  |                     content: 'reimburseOnline_detail.html?id=' + data.id, | 
 |  |  |                     success: function(layero, index){ | 
 |  |  |                         // layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); | 
 |  |  |                     } | 
 |  |  |             case 'approval2': | 
 |  |  |                 layer.confirm('审批通过?', { | 
 |  |  |                     skin: 'layui-layer-admin', | 
 |  |  |                     shade: .1, | 
 |  |  |                     offset: '200px', | 
 |  |  |                     title: data.name | 
 |  |  |                 }, function (i) { | 
 |  |  |                     layer.close(i); | 
 |  |  |                     approval2(data.id); | 
 |  |  |                 }); | 
 |  |  |                 break; | 
 |  |  |             case 'more': | 
 |  |  |                 top.reimburseOnlineByMore=data.id; | 
 |  |  |                 console.log(top.reimburseOnlineByMore) | 
 |  |  |  | 
 |  |  |                 admin.popupRight({ | 
 |  |  |                     type: 1, | 
 |  |  |                     window: "top", | 
 |  |  |                     area: "1250px", | 
 |  |  |                     url: "reimburseOnline_more.html", | 
 |  |  |                     end: function () { | 
 |  |  |                         // $(".layui-laypage-btn")[0].click(); | 
 |  |  |                     } | 
 |  |  |                 }) | 
 |  |  |                 break; | 
 |  |  |             // // 核价 | 
 |  |  |             // case 'check': | 
 |  |  |             //     layer.open({ | 
 |  |  |             //         type: 2, | 
 |  |  |             //         title: '核价', | 
 |  |  |             //         maxmin: true, | 
 |  |  |             //         area: [top.detailWidth, top.detailHeight], | 
 |  |  |             //         shadeClose: false, | 
 |  |  |             //         content: 'reimburseOnline_detail.html?id=' + data.id, | 
 |  |  |             //         success: function(layero, index){ | 
 |  |  |             //             // layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); | 
 |  |  |             //         } | 
 |  |  |             //     }); | 
 |  |  |             //     break; | 
 |  |  |             case 'del': | 
 |  |  |                 layer.confirm('确定删除这条数据吗', function(){ | 
 |  |  |                     $.ajax({ | 
 |  |  | 
 |  |  |                 }); | 
 |  |  |                 break; | 
 |  |  |             case "edit": | 
 |  |  |                 showEditForm(data); | 
 |  |  |                 break; | 
 |  |  |             case "upload": | 
 |  |  |                 $.ajax({ | 
 |  |  |                     type:"get", | 
 |  |  |                     url: baseUrl+"/reimburseOnline/viewCheck/" + data.id + "/auth", | 
 |  |  |                     dataType:"json", | 
 |  |  |                     headers: {'token': localStorage.getItem('token')}, | 
 |  |  |                     success:function(res) { | 
 |  |  |                         if (res.code == 200) { | 
 |  |  |                             layer.confirm('当前已存在数据,继续上传将会覆盖旧数据,是否上传?', function(){ | 
 |  |  |                                 $("#uploadQuote").click() | 
 |  |  |                             }); | 
 |  |  |                         }else{ | 
 |  |  |                             $("#uploadQuote").click() | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                 }); | 
 |  |  |  | 
 |  |  |                 $("#uploadQuote").on("change",(evt) => { | 
 |  |  |                     var files = evt.target.files; | 
 |  |  |                     if(files==null || files.length==0){ | 
 |  |  |                         alert("No files wait for import"); | 
 |  |  |                         return; | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                     let name = files[0].name; | 
 |  |  |                     let suffixArr = name.split("."), suffix = suffixArr[suffixArr.length-1]; | 
 |  |  |                     if(suffix!="xlsx"){ | 
 |  |  |                         alert("Currently only supports the import of xlsx files"); | 
 |  |  |                         return; | 
 |  |  |                     } | 
 |  |  |                     LuckyExcel.transformExcelToLucky(files[0], function(exportJson, luckysheetfile){ | 
 |  |  |                         if(exportJson.sheets==null || exportJson.sheets.length==0){ | 
 |  |  |                             alert("Failed to read the content of the excel file, currently does not support xls files!"); | 
 |  |  |                             return; | 
 |  |  |                         } | 
 |  |  |  | 
 |  |  |                         let formData = new FormData($("#uploadFile")[0]); | 
 |  |  |                         formData.append("id", data.id); | 
 |  |  |                         formData.append("checkData", zip(exportJson.sheets)); | 
 |  |  |                         $.ajax({ | 
 |  |  |                             url: baseUrl+"/reimburseOnline/uploadCheck/auth", | 
 |  |  |                             headers: {'token': localStorage.getItem('token')}, | 
 |  |  |                             data: formData, | 
 |  |  |                             // data: JSON.stringify({ | 
 |  |  |                             //     id: data.id, | 
 |  |  |                             //     checkData: zip(exportJson.sheets) | 
 |  |  |                             // }), | 
 |  |  |                             // dataType: "json", | 
 |  |  |                             method: 'POST', | 
 |  |  |                             cache: false, | 
 |  |  |                             processData: false, | 
 |  |  |                             contentType: false, | 
 |  |  |                             // contentType:'application/json;charset=UTF-8', | 
 |  |  |                             success: function (res) { | 
 |  |  |                                 if (res.code == 200) { | 
 |  |  |                                     layer.msg('上传成功',{time:1000},() => { | 
 |  |  |                                         parent.location.reload() | 
 |  |  |                                     }) | 
 |  |  |                                 }else{ | 
 |  |  |                                     layer.msg(res.msg,{time:1000},() => { | 
 |  |  |                                         parent.location.reload() | 
 |  |  |                                     }) | 
 |  |  |                                 } | 
 |  |  |                             } | 
 |  |  |                         }) | 
 |  |  |                     }); | 
 |  |  |                 }) | 
 |  |  |                 break; | 
 |  |  |             case "viewCheck": | 
 |  |  |                 //查看询价 | 
 |  |  |                 $.ajax({ | 
 |  |  |                     type:"get", | 
 |  |  |                     url: baseUrl+"/reimburseOnline/viewCheck/" + data.id + "/auth", | 
 |  |  |                     dataType:"json", | 
 |  |  |                     headers: {'token': localStorage.getItem('token')}, | 
 |  |  |                     success:function(res) { | 
 |  |  |                         if (res.code == 200) { | 
 |  |  |                             layer.open({ | 
 |  |  |                                 type: 2, | 
 |  |  |                                 title: '查看询价', | 
 |  |  |                                 maxmin: true, | 
 |  |  |                                 area: [top.detailWidth, top.detailHeight], | 
 |  |  |                                 shadeClose: false, | 
 |  |  |                                 content: 'reimburseOnline_check.html?id=' + data.id, | 
 |  |  |                                 success: function(layero, index){ | 
 |  |  |                                     // layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); | 
 |  |  |                                 } | 
 |  |  |                             }); | 
 |  |  |                         }else{ | 
 |  |  |                             layer.msg(res.msg,{time:1000}) | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                 }); | 
 |  |  |                 showEditModel(data); | 
 |  |  |                 break; | 
 |  |  |             case "look": | 
 |  |  |                 var $a = $(obj.tr).find('a[lay-event="look"]'); | 
 |  |  |                 var offset = $a.offset(); | 
 |  |  |                 var top = offset.top; | 
 |  |  |                 var top2 = offset.top; | 
 |  |  |                 var left = offset.left; | 
 |  |  |                 layer.open({ | 
 |  |  |                     type: 1, | 
 |  |  |                     title: false, | 
 |  |  |                     area: '2100px', | 
 |  |  |                     offset: [top + 'px', (left - 1730 + $a.outerWidth()) + 'px'], | 
 |  |  |                     offset: [top2 + 'px', (left - 1730 + $a.outerWidth()) + 'px'], | 
 |  |  |                     shade: .01, | 
 |  |  |                     shadeClose: true, | 
 |  |  |                     fixed: false, | 
 |  |  | 
 |  |  |                             reimburseId: Number(data.field.id), | 
 |  |  |                             docType: Number(data.field.docType), | 
 |  |  |                             orderNo: data.field.planId, | 
 |  |  |                             templateName: data.field.templateName, | 
 |  |  |                             checkData: data.field.checkData, | 
 |  |  |                             reimburseOnlineDetls: nList | 
 |  |  |                         }), | 
 |  |  |                         contentType:'application/json;charset=UTF-8', | 
 |  |  | 
 |  |  |                     cellMinWidth: 100, | 
 |  |  |                     cols: [[ | 
 |  |  |                         {type: 'numbers', title: '#'}, | 
 |  |  |                         {field: 'occupation', title: '事由', width: 100}, | 
 |  |  |                         {field: 'occupation', title: '事由', width: 100, style: 'color: blue;font-weight: bold', templet: '#occupation'}, | 
 |  |  |                         // {field: 'expenseType', title: '费用类型', width: 100}, | 
 |  |  |                         {field: 'expenseType$', title: '费用类型', width: 100}, | 
 |  |  |                         {field: 'taxRate', title: '税率', width: 60}, | 
 |  |  | 
 |  |  |                         // {field: 'updateUserId', title: '更新人员ID', width: 160}, | 
 |  |  |                         {field: 'updateUserName', title: '更新人员名字'}, | 
 |  |  |                         // {field: 'creationTime', title: '创建日期', width: 160} | 
 |  |  |                         {align: 'center', title: '操作', toolbar: '#formSSXMTableBar', minWidth: 80, width: 80, fixed: 'right'} | 
 |  |  |                     ]], | 
 |  |  |                     done: function (res) { | 
 |  |  |                     done: function (res, curr, count) { | 
 |  |  |                         $(layero).find('.layui-table-view').css('margin', '0'); | 
 |  |  |                         var options = this; | 
 |  |  |  | 
 |  |  |                         // 获取当前行数据 | 
 |  |  |                         table.getRowData = function(elem){ | 
 |  |  |                             var index = $(elem).closest('tr').data('index'); | 
 |  |  |                             return table.cache[options.id][index] || {}; | 
 |  |  |                         }; | 
 |  |  |  | 
 |  |  |                         $('.input-occupation').on('text', function(){ | 
 |  |  |                             var value = this.value; // 获取选中项 value | 
 |  |  |                             var data = table.getRowData(this); | 
 |  |  |                             console.log(value); | 
 |  |  |                             console.log("value------==="); | 
 |  |  |                             xxDataList.forEach(res => { | 
 |  |  |                                 if (data.id === res.id){ | 
 |  |  |                                     console.log(res) | 
 |  |  |                                     res.occupation = value; | 
 |  |  |                                 } | 
 |  |  |                             }) | 
 |  |  |  | 
 |  |  |                         }); | 
 |  |  |                     }, | 
 |  |  |                     size: '' | 
 |  |  |                 }; | 
 |  |  | 
 |  |  |                             // 表单提交事件 | 
 |  |  |                             form.on('submit(matEditSubmit)', function (data) { | 
 |  |  |                                 let selectList = matXmSelect.getValue(); | 
 |  |  |                                 console.log(selectList) | 
 |  |  |                                 for (let i = 0; i<selectList.length; i++) { | 
 |  |  |                                     let item = selectList[i]; | 
 |  |  |                                     // 查询物料详情 | 
 |  |  | 
 |  |  |                                         success: function (res) { | 
 |  |  |                                             if (res.code === 200){ | 
 |  |  |                                                 var bige=true; | 
 |  |  |                                                 for (var j = 0; j < xxDataList.length; j++) { | 
 |  |  |                                                     if (xxDataList[j].matnr === res.data.matnr && xxDataList[j].batch === res.data.batch) { | 
 |  |  |                                                         bige=false; | 
 |  |  |                                                         break; | 
 |  |  |                                                     } | 
 |  |  |                                                 } | 
 |  |  |                                                 // console.log("-------2.1-------") | 
 |  |  |                                                 // for (var j = 0; j < xxDataList.length; j++) { | 
 |  |  |                                                 //     if (xxDataList[j].expenseType === res.data.expenseType && xxDataList[j].batch === res.data.batch) { | 
 |  |  |                                                 //         bige=false; | 
 |  |  |                                                 //         console.log("-------2.2-------") | 
 |  |  |                                                 //         break; | 
 |  |  |                                                 //     } | 
 |  |  |                                                 // } | 
 |  |  |                                                 if (bige){ | 
 |  |  |                                                     // console.log("-------2.3-------") | 
 |  |  |                                                     xxDataList.push(res.data); | 
 |  |  |                                                     insTbSSXM.reload({data: xxDataList, page: {curr: 1}}); | 
 |  |  |                                                 } | 
 |  |  | 
 |  |  |         }); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     function approval2(planId, plannerId, dIdx) { | 
 |  |  |         let loadIndex = layer.load(2); | 
 |  |  |         $.ajax({ | 
 |  |  |             url: baseUrl+"/reimburseOnline/approval2/auth", | 
 |  |  |             headers: {'token': localStorage.getItem('token')}, | 
 |  |  |             data: { | 
 |  |  |                 planId: planId, | 
 |  |  |                 plannerId: plannerId | 
 |  |  |             }, | 
 |  |  |             method: 'POST', | 
 |  |  |             success: function (res) { | 
 |  |  |                 if (dIdx) { | 
 |  |  |                     layer.close(dIdx); | 
 |  |  |                 } | 
 |  |  |                 layer.close(loadIndex); | 
 |  |  |                 if (res.code === 200){ | 
 |  |  |                     layer.msg(res.msg, {icon: 1}); | 
 |  |  |                     tableReload(); | 
 |  |  |                 } else if (res.code === 403){ | 
 |  |  |                     top.location.href = baseUrl+"/"; | 
 |  |  |                 } else { | 
 |  |  |                     layer.msg(res.msg, {icon: 2}); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         }) | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /* 弹窗 - 新增、修改 */ | 
 |  |  |     // function showEditModel(mData) { | 
 |  |  |     //     admin.open({ | 
 |  |  | 
 |  |  |     //     }); | 
 |  |  |     // } | 
 |  |  |  | 
 |  |  |     //更新form | 
 |  |  |     function showEditForm(mData) { | 
 |  |  |         admin.open({ | 
 |  |  |             type: 1, | 
 |  |  |             area: '800px', | 
 |  |  |             title: '核价信息编辑', | 
 |  |  |             content: $('#editStatus').html(), | 
 |  |  |             success: function (layero, dIndex) { | 
 |  |  |                 form.val('editStatusDetail', mData); | 
 |  |  |                 form.render('select') | 
 |  |  |                 form.on('submit(editSubmit)', function (data) { | 
 |  |  |                     var loadIndex = layer.load(2); | 
 |  |  |                     $.ajax({ | 
 |  |  |                         url: baseUrl+"/reimburseOnline/updateForm/auth", | 
 |  |  |                         headers: {'token': localStorage.getItem('token')}, | 
 |  |  |                         data: data.field, | 
 |  |  |                         method: 'POST', | 
 |  |  |                         traditional:true, | 
 |  |  |                         success: function (res) { | 
 |  |  |                             if (res.code === 200){ | 
 |  |  |                                 layer.closeAll(); | 
 |  |  |                                 tableReload(false); | 
 |  |  |                             } else if (res.code === 403){ | 
 |  |  |                                 top.location.href = baseUrl+"/"; | 
 |  |  |                             } else { | 
 |  |  |                                 layer.msg(res.msg) | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                     }) | 
 |  |  |                     layer.close(loadIndex); | 
 |  |  |                     layer.close(dIndex); | 
 |  |  |                     return false; | 
 |  |  |                 }); | 
 |  |  |                 $(layero).children('.layui-layer-content').css('overflow', 'visible'); | 
 |  |  |                 layui.form.render('select'); | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |     } | 
 |  |  |     // // 更新form | 
 |  |  |     // function showEditForm(mData) { | 
 |  |  |     //     admin.open({ | 
 |  |  |     //         type: 1, | 
 |  |  |     //         area: '800px', | 
 |  |  |     //         title: '核价信息编辑', | 
 |  |  |     //         content: $('#editStatus').html(), | 
 |  |  |     //         success: function (layero, dIndex) { | 
 |  |  |     //             form.val('editStatusDetail', mData); | 
 |  |  |     //             form.render('select') | 
 |  |  |     //             form.on('submit(editSubmit)', function (data) { | 
 |  |  |     //                 var loadIndex = layer.load(2); | 
 |  |  |     //                 $.ajax({ | 
 |  |  |     //                     url: baseUrl+"/reimburseOnline/updateForm/auth", | 
 |  |  |     //                     headers: {'token': localStorage.getItem('token')}, | 
 |  |  |     //                     data: data.field, | 
 |  |  |     //                     method: 'POST', | 
 |  |  |     //                     traditional:true, | 
 |  |  |     //                     success: function (res) { | 
 |  |  |     //                         if (res.code === 200){ | 
 |  |  |     //                             layer.closeAll(); | 
 |  |  |     //                             tableReload(false); | 
 |  |  |     //                         } else if (res.code === 403){ | 
 |  |  |     //                             top.location.href = baseUrl+"/"; | 
 |  |  |     //                         } else { | 
 |  |  |     //                             layer.msg(res.msg) | 
 |  |  |     //                         } | 
 |  |  |     //                     } | 
 |  |  |     //                 }) | 
 |  |  |     //                 layer.close(loadIndex); | 
 |  |  |     //                 layer.close(dIndex); | 
 |  |  |     //                 return false; | 
 |  |  |     //             }); | 
 |  |  |     //             $(layero).children('.layui-layer-content').css('overflow', 'visible'); | 
 |  |  |     //             layui.form.render('select'); | 
 |  |  |     //         } | 
 |  |  |     //     }); | 
 |  |  |     // } | 
 |  |  |  | 
 |  |  | }); | 
 |  |  |  |