From 29cfba4aa2e41fb15cacb500c3e2d9ae7c652d08 Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期二, 21 十一月 2023 08:57:20 +0800
Subject: [PATCH] #

---
 src/main/webapp/static/js/businessTrip/businessTrip.js |  280 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 272 insertions(+), 8 deletions(-)

diff --git a/src/main/webapp/static/js/businessTrip/businessTrip.js b/src/main/webapp/static/js/businessTrip/businessTrip.js
index 9d7bd64..f768852 100644
--- a/src/main/webapp/static/js/businessTrip/businessTrip.js
+++ b/src/main/webapp/static/js/businessTrip/businessTrip.js
@@ -3,7 +3,7 @@
     base: baseUrl + "/static/layui/lay/modules/"
 }).extend({
     cascader: 'cascader/cascader',
-}).use(['table','laydate', 'form', 'admin', 'cascader', 'tree', 'dropdown'], function(){
+}).use(['table','laydate', 'form', 'admin', 'xmSelect', 'cascader', 'tree', 'dropdown'], function(){
     var table = layui.table;
     var $ = layui.jquery;
     var layer = layui.layer;
@@ -86,7 +86,7 @@
             {field: 'id', align: 'center',title: 'ID',hide: true}
             ,{field: 'businessTripReasons', align: 'center',title: '鍑哄樊浜嬬敱',hide: false}
             ,{field: 'businessTransportation$', align: 'center',title: '浜ら�氬伐鍏�',hide: false}
-            ,{field: 'businessReturn$', align: 'center',title: '鍗曠▼寰�杩�',hide: false}
+            ,{field: 'businessReturn$', align: 'center',title: '鍗曠▼寰�杩�',hide: true}
             ,{field: 'businessStartAddr', align: 'center',title: '鍑哄彂鍦�', templet:function(d){return emptyShow(d.businessStartAddr)},hide: true}
             ,{field: 'businessStartAddr$', align: 'center',title: '鍑哄彂鍦�',hide: false}
             ,{field: 'businessEndAddr', align: 'center',title: '鐩殑鍦�', templet:function(d){return emptyShow(d.businessEndAddr)},hide: true}
@@ -97,21 +97,21 @@
             ,{field: 'businessTripDays$', align: 'center',title: '鍑哄樊澶╂暟',hide: false}
             ,{field: 'businessPeers', align: 'center',title: '鍚岃浜�',hide: false}
             ,{field: 'businessPeersId', align: 'center',title: '鏃堕棿鎴�',hide: true}
-            ,{field: 'carNumber', align: 'center',title: '鑷┚绉佸杞﹁溅鐗屽彿',hide: false}
-            ,{field: 'kilometers', align: 'center',title: '鑷┚绉佸杞﹁绋嬫槑缁嗗強鍏噷鏁�',hide: false}
+            ,{field: 'carNumber', align: 'center',title: '鑷┚绉佸杞﹁溅鐗屽彿',hide: true}
+            ,{field: 'kilometers', align: 'center',title: '鑷┚绉佸杞﹁绋嬫槑缁嗗強鍏噷鏁�',hide: true}
             ,{field: 'userId$', align: 'center',title: '鐢宠浜�',hide: false}
-            ,{field: 'deptId$', align: 'center',title: '鎵�灞為儴闂�',hide: false}
+            ,{field: 'deptId$', align: 'center',title: '鎵�灞為儴闂�',hide: true}
             ,{field: 'hostId', align: 'center',title: 'hostId',hide: true}
             ,{field: 'orderId', align: 'center',title: '璺熻釜椤圭洰',hide: false}
-            ,{field: 'createTime$', align: 'center',title: '鍒涘缓鏃堕棿',hide: false,width: 125}
+            ,{field: 'createTime$', align: 'center',title: '鍒涘缓鏃堕棿',hide: true,width: 125}
             ,{field: 'updateTime$', align: 'center',title: '鏇存柊鏃堕棿',hide: false,width: 125}
             ,{field: 'updateId$', align: 'center',title: '鏇存柊浜哄憳',hide: false}
             ,{field: 'settle$', align: 'center',title: '杩涘害', style: 'color: #1890ff;cursor:pointer', event: 'more',hide: false}
-            ,{field: 'status$', align: 'center',title: '鐘舵��',hide: false}
+            ,{field: 'status$', align: 'center',title: '鐘舵��',hide: true}
             ,{field: 'businessTripType', align: 'center',title: '绫诲瀷',hide: true}
             ,{field: 'businessNotes', align: 'center',title: '鍑哄樊澶囨敞',hide: false}
 
-            ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:180}
+            ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:240}
         ]],
         request: {
             pageName: 'curr',
@@ -212,6 +212,9 @@
     table.on('tool(businessTrip)', function(obj){
         var data = obj.data;
         switch (obj.event) {
+            case 'addBlank':
+                showEditModelBlank(data.id);
+                break;
             case 'approval':
                 layer.confirm('瀹℃壒閫氳繃锛�', {
                     skin: 'layui-layer-admin',
@@ -318,6 +321,267 @@
         });
     }
 
+    // 鏄剧ず琛ㄥ崟寮圭獥
+    function showEditModelBlank(businessId) {
+        admin.open({
+            type: 1,
+            title: '娣诲姞鎶ラ攢瀹℃壒',
+            content: $('#editDialog2').html(),
+            area: '2200px',
+            success: function (layero, dIndex) {
+                $(layero).children('.layui-layer-content').css('overflow', 'visible');
+                var isExpAdd = true;
+                // 鍥炴樉鏁版嵁
+                form.val('editForm', false);
+                // console.log(expTpe)
+                // if (expTpe) {
+                //     // $('#orderNo').attr("disabled", "disabled");
+                // }
+                // 琛ㄥ崟鎻愪氦浜嬩欢
+                form.on('submit(orderEditSubmit)', function (data) {
+                    // 缁勮鏁版嵁
+                    if (xxDataList.length <= 0) {
+                        layer.tips('璇锋坊鍔犳姤閿�鏄庣粏', '#matAddBtnComment', {tips: [1, '#ff4c4c']});
+                        return false;
+                    }
+                    let nList = admin.util.deepClone(xxDataList);
+                    for (let xi = 0; xi < nList.length; xi++) {
+                        // if (nList[xi].anfme <= 0){
+                        //     layer.msg('鏄庣粏淇敼鏁伴噺涓嶅悎娉�', {icon: 2});
+                        //     return false;
+                        // }
+                    }
+                    layer.load(2);
+                    $.ajax({
+                        url: baseUrl+"/reimburseOnline/from/" + (isExpAdd?"add":"modify") + "/auth",
+                        headers: {'token': localStorage.getItem('token')},
+                        data: JSON.stringify({
+                            reimburseId: Number(data.field.id),
+                            docType: Number(data.field.docType),
+                            businessId: businessId,
+                            templateName: data.field.templateName,
+                            checkData: data.field.checkData,
+                            reimburseOnlineDetls: nList
+                        }),
+                        contentType:'application/json;charset=UTF-8',
+                        method: 'POST',
+                        success: function (res) {
+                            console.log(data)
+                            layer.closeAll('loading');
+                            if (res.code === 200){
+                                layer.close(dIndex);
+                                $(".layui-laypage-btn")[0].click();
+                                layer.msg(res.msg, {icon: 1});
+                            } else if (res.code === 403){
+                                top.location.href = baseUrl+"/";
+                            }else {
+                                layer.msg(res.msg, {icon: 2});
+                            }
+                        }
+                    })
+                    return false;
+                });
+                // 鏄庣粏琛ㄦ牸
+                var xxDataList = [];
+                var tbOptions = {
+                    elem: '#formSSXMTable',
+                    headers: {token: localStorage.getItem('token')},
+                    data: xxDataList,
+                    page: true,
+                    height: '350px;',
+                    cellMinWidth: 100,
+                    cols: [[
+                        {type: 'numbers', title: '#'},
+                        {field: 'occupation', title: '浜嬬敱', width: 100, style: 'color: blue;font-weight: bold', edit:true},
+                        // {field: 'expenseType', title: '璐圭敤绫诲瀷', width: 100},
+                        {field: 'expenseType$', title: '璐圭敤绫诲瀷', width: 100},
+                        {field: 'taxRate', title: '绋庣巼', width: 60, edit: true},
+                        {field: 'untaxedAmountInLocalCurrency', title: '鏈◣鏈竵閲戦', width: 120, edit: true},
+                        {field: 'untaxedAmount', title: '鏈◣閲戦', width: 100, edit: true},
+                        {field: 'taxAmount', title: '绋庨', width: 60, edit: true},
+                        {field: 'invoiceValue', title: '鍙戠エ閲戦', width: 100, edit: true},
+                        {field: 'invoiceAmountInLocalCurrency', title: '鍙戠エ鏈竵閲戦', width: 120, edit: true},
+                        {field: 'reimbursementRatio', title: '鎶ラ攢姣斾緥', width: 100, edit: true},
+                        {field: 'reimbursementAmount', title: '鎶ラ攢閲戦', width: 100, edit: true},
+                        {field: 'reimbursementAmountInLocalCurrency', title: '鎶ラ攢鏈竵閲戦', width: 120, edit: true},
+                        {field: 'cashierConfirmationAmount', title: '鍑虹撼纭閲戦', width: 120, edit: true},
+                        {field: 'cashierCurrency', title: '鍑虹撼甯佺', width: 100, edit: true},
+                        {field: 'departureTime', title: '鍑哄彂鏃ユ湡', width: 100},
+                        {field: 'cashierConfirmationAmount', title: '鍑虹撼纭閲戦', width: 120, edit: true},
+                        {field: 'userId', title: '鍒楁敮浜哄憳', width: 120},
+                        {field: 'deptId', title: '鍒楁敮閮ㄩ棬', width: 120},
+                        {field: 'updateTime', title: '鏇存柊鏃ユ湡', width: 100},
+                        // {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, 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: ''
+                };
+                var insTbSSXM = table.render(tbOptions);
+                // 宸ュ叿鏉$偣鍑讳簨浠�
+                table.on('tool(formSSXMTable)', function (obj) {
+                    var data = obj.data;
+                    var layEvent = obj.event;
+                    if (layEvent === 'edit') {
+                        showEditModel2(data);
+                    } else if (layEvent === 'del') {
+                        layer.confirm('纭畾瑕佸垹闄ゅ悧锛�', {
+                            shade: .1,
+                            skin: 'layui-layer-admin'
+                        }, function (i) {
+                            layer.close(i);
+                            for (var j = 0; j < xxDataList.length; j++) {
+                                if (xxDataList[j].matnr === data.matnr && xxDataList[j].batch === data.batch) {
+                                    xxDataList.splice(j, 1);
+                                    break;
+                                }
+                            }
+                            insTbSSXM.reload({data: xxDataList, page: {curr: 1}});
+                        });
+                    }
+                });
+                // 鏄庣粏鏁版嵁淇敼
+                table.on('edit(formSSXMTable)', function (obj) {
+                    let index = obj.tr.attr("data-index");
+                    let data = xxDataList[index];
+                    if (obj.field === 'anfme'){
+                        let vle = Number(obj.value);
+                        if (isNaN(vle)) {
+                            layer.msg("璇疯緭鍏ユ暟瀛�", {icon: 2});
+                            return false;
+                        } else {
+                            if (vle <= 0) {
+                                layer.msg("鏁伴噺蹇呴』澶т簬闆�", {icon: 2});
+                                return false;
+                            }
+                        }
+                    }
+                    data[obj.field] = obj.value;
+                    insTbSSXM.reload({data: xxDataList});
+                });
+
+                $('#matAddBtnComment').click(function () {
+                    showEditModel2();
+                });
+
+                // 鏄剧ず娣诲姞鏄庣粏琛ㄥ崟寮圭獥
+                function showEditModel2(exp) {
+                    admin.open({
+                        type: 1,
+                        offset: '150px',
+                        area: '680px',
+                        title: (exp ? '淇敼' : '娣诲姞') + '鏄庣粏',
+                        content: $('#matEditDialog').html(),
+                        success: function (layero, dIndex) {
+                            console.log("exp")
+                            console.log(exp)
+                            // 鍥炴樉鏁版嵁
+                            form.val('matEditForm', exp);
+                            // 琛ㄥ崟鎻愪氦浜嬩欢
+                            form.on('submit(matEditSubmit)', function (data) {
+                                let selectList = matXmSelect.getValue();
+                                console.log("selectList")
+                                console.log(selectList)
+                                console.log(selectList)
+                                for (let i = 0; i<selectList.length; i++) {
+                                    let item = selectList[i];
+                                    // 鏌ヨ鐗╂枡璇︽儏
+                                    $.ajax({
+                                        url: baseUrl+"/reimburseCostTypes/covert/"+item.value+"/auth",
+                                        headers: {'token': localStorage.getItem('token')},
+                                        method: 'GET',
+                                        async: false,
+                                        success: function (res) {
+                                            if (res.code === 200){
+                                                var bige=true;
+                                                // 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}});
+                                                }
+                                            } else if (res.code === 403){
+                                                top.location.href = baseUrl+"/";
+                                            }else {
+                                                layer.msg(res.msg, {icon: 2})
+                                            }
+                                        }
+                                    })
+                                }
+                                layer.close(dIndex);
+                                return false;
+                            });
+                            // 娓叉煋鐗╂枡閫夋嫨
+                            var matXmSelect = xmSelect.render({
+                                el: '#reimburseCostTypes',
+                                style: {
+                                    width: '340px',
+                                },
+                                autoRow: true,
+                                toolbar: { show: true },
+                                filterable: true,
+                                remoteSearch: true,
+                                remoteMethod: function(val, cb, show){
+                                    $.ajax({
+                                        url: baseUrl+"/reimburseCostTypes/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});
+                                            }
+                                        }
+                                    });
+                                }
+                            })
+                            // 寮圭獥涓嶅嚭鐜版粴鍔ㄦ潯
+                            $(layero).children('.layui-layer-content').css('overflow', 'visible');
+                            layui.form.render('select');
+                        }
+                    });
+                }
+            }
+        });
+    }
+
     // 鎼滅储
     form.on('submit(search)', function (data) {
         pageCurr = 1;

--
Gitblit v1.9.1