From 07cf94734c36d4eae6ddbc4dd338bf5af81a2193 Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期一, 28 十月 2024 16:11:39 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-LayUI

---
 WebTM/views/生产管理/生产计划平台/JIT_DayPlanPlatFormImport.html |  323 ++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 216 insertions(+), 107 deletions(-)

diff --git "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\350\256\241\345\210\222\345\271\263\345\217\260/JIT_DayPlanPlatFormImport.html" "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\350\256\241\345\210\222\345\271\263\345\217\260/JIT_DayPlanPlatFormImport.html"
index 4352ef2..c1ccb28 100644
--- "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\350\256\241\345\210\222\345\271\263\345\217\260/JIT_DayPlanPlatFormImport.html"
+++ "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\350\256\241\345\210\222\345\271\263\345\217\260/JIT_DayPlanPlatFormImport.html"
@@ -11,37 +11,6 @@
     <script src="../../../layuiadmin/Scripts/jquery-1.4.1.js"></script>
     <script src="../../../layuiadmin/Scripts/webConfig.js"></script>
     <script src="../../../layuiadmin/PubCustom.js"></script>
-    <style>
-        .main-btn { /*澶撮儴涓绘寜閽�*/
-            padding: 0 2px; /*璋冩暣鎸夐挳宸﹀彸绌洪殭澶у皬*/
-            height: 30px;
-            line-height: 30px;
-        }
-
-        .btn-title {
-            font-size: 16px;
-        }
-        /* 闃叉涓嬫媺妗嗙殑涓嬫媺鍒楄〃琚殣钘�---蹇呴』璁剧疆--- */
-        .layui-table-cell {
-            overflow: visible !important;
-        }
-        /* 浣垮緱涓嬫媺妗嗕笌鍗曞厓鏍煎垰濂藉悎閫� */
-        td .layui-form-select {
-            margin-top: -10px;
-            margin-left: -15px;
-            margin-right: -15px;
-        }
-
-        .layui-form-item .layui-inline {
-            margin-top: 5px;
-            margin-bottom: 5px;
-            margin-right: 0px;
-        }
-
-        .layui-form-label {
-            width: 25%;
-        }
-    </style>
 </head>
 <body>
     <div class="layui-fluid" style="padding: 0;">
@@ -49,7 +18,7 @@
             <div class="layui-card-body" style="padding: 1px;">
                 <form class="layui-form" action="" lay-filter="formData" style="background-color:white;">
                     <div style="padding: 10px; ">
-                        <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnSave" id="btnSave">瀵煎叆</button>
+                        <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnSave" id="btnSave">瀵煎叆鏁版嵁</button>
                         <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="Cancel" id="Cancel">閫�鍑�</button>
                         <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="UpLoad" id="UpLoad">鏂囦欢涓婁紶</button>
                     </div>
@@ -70,19 +39,19 @@
                                         <div class="layui-inline">
                                             <label class="layui-form-label" style="width: 85px;">璁㈠崟绫诲瀷</label>
                                             <div class="layui-input-block" style="margin-left: 120px; width: 185px;">
-                                                <select name="HProdORGID" id="HProdORGID" lay-verify="HProdORGID">
+                                                <select name="HOrderType" id="HOrderType" lay-verify="HOrderType">
                                                     <option value="鐢熶骇璁㈠崟">鐢熶骇璁㈠崟</option>
                                                     <option value="濮斿璁㈠崟">濮斿璁㈠崟</option>
                                                 </select>
                                             </div>
                                         </div>
-                                        <!--<div class="layui-inline">
+                                        <div class="layui-inline">
                                             <div class="layui-inline">
                                                 <div class="layui-input-block" style="margin-left: 120px;">
-                                                    <input type="file" class="layui-upload-form" lay-verify="file" name="file" id="file" style="padding-left: 75px;">
+                                                    <input type="hidden" name="HPRDORGID" id="HPRDORGID" lay-verify="HPRDORGID">
                                                 </div>
                                             </div>
-                                        </div>-->
+                                        </div>
                                     </div>
                                 </div>
                             </div>
@@ -92,8 +61,7 @@
                     <table class="" id="mainTable" lay-filter="mainTable"></table>
                     <script type="text/html" id="toolbarDemo">
                         <div class="layui-btn-container">
-                            <button type="button" class="layui-btn layui-btn-sm" lay-event="set_AddNew"><i class="layui-icon layui-icon-file-b"></i>鎵归噺濉厖</button>
-                            <button type="button" class="layui-btn layui-btn-sm" lay-event="set_DeleteBill"><i class="layui-icon layui-icon-delete"></i>鍒犻櫎琛�</button>
+                            <button type="button" class="layui-btn layui-btn-sm" lay-event="set_BatchFill"><i class="layui-icon layui-icon-file-b"></i>鎵归噺濉厖</button>
                         </div>
                     </script>
                 </form>
@@ -102,13 +70,16 @@
     </div>
 </body>
 </html>
+<script type="text/html" id="barDemo">
+    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">鍒犻櫎</a>
+</script>
 <script>
 
     layui.config({
         base: '../../../layuiadmin/' //闈欐�佽祫婧愭墍鍦ㄨ矾寰�
     }).extend({
         index: 'lib/index' //涓诲叆鍙fā鍧�
-    }).use(['index', 'form', 'laydate', 'table', 'element','upload'], function () {
+    }).use(['index', 'form', 'laydate', 'table', 'element', 'upload'], function () {
 
         //#region 鍏叡鍙橀噺
 
@@ -122,10 +93,13 @@
             , upload = layui.upload
             , element = layui.element;
 
-
+        var option = [];
         //#endregion
 
         //#region 杩涘叆椤甸潰鍗冲姞杞�
+
+        var params = getUrlVars();
+        var OperationType = params[params[0]]; //浠庡弬鏁颁腑鑾峰彇 鏁版嵁绫诲瀷  娣诲姞 淇濆瓨
 
         //鍒濆鍖栫晫闈�
         set_ClearBill();
@@ -134,41 +108,58 @@
 
         //#region 瑙﹀彂浜嬩欢锛氬寘鎷琭orm.on(){}鏍煎紡鐨勬墍鏈夌偣鍑讳簨浠躲�侀�夋嫨浜嬩欢绛�
 
-        //瀵煎叆
-        form.on('submit(UpLoad)', function () {
-            var uploadInst = upload.render({
-                elem: '#UpLoad',
-                type: 'POST',
-                url: GetWEBURL() + '/JIT_DayPlanPlatFormImport/JIT_DayPlanPlatFormImport_DR',
-                accept: 'file', //鏅�氭枃浠�
-                exts: 'xls|excel|xlsx', //瀵煎叆琛ㄦ牸
-                auto: false,  //閫夋嫨鏂囦欢鍚庝笉鑷姩涓婁紶
-                before: function (obj) {
-                    layer.load(); //涓婁紶loading
-                },
-                choose: function (obj) {// 閫夋嫨鏂囦欢鍥炶皟
-                    alert(obj)
-                    var files = obj.pushFile();
-                    var fileArr = Object.values(files);// 娉ㄦ剰杩欓噷鐨勬暟鎹渶瑕佹槸鏁扮粍锛屾墍浠ラ渶瑕佽浆鎹竴涓�
-                    //console.debug(fileArr)
-                    // 鐢ㄥ畬灏辨竻鐞嗘帀锛岄伩鍏嶅娆¢�変腑鐩稿悓鏂囦欢鏃跺嚭鐜伴棶棰�
-                    for (var index in files) {
-                        if (files.hasOwnProperty(index)) {
-                            delete files[index];
-                        }
-                    }
-                }, error: function () {
-                    setTimeout(function () {
-                        layer.msg("涓婁紶澶辫触锛�", {
-                            icon: 1
-                        });
-                        layer.closeAll(); //鐤媯妯″紡锛屽叧闂墍鏈夊眰
-                    }, 1000);
+        //琛屽唴浜嬩欢
+        table.on('tool(mainTable)', function (obj) {
+            set_GridDelete(obj);   //琛屽唴鍒犻櫎
+            set_GridCellCheck(obj);//琛屽唴蹇嵎閿瓫閫�
+        });
+
+        //鏂囦欢涓婁紶
+        upload.render({
+            elem: '#UpLoad',
+            url: GetWEBURL() + '/JIT_DayPlanPlatFormImport/JIT_DayPlanPlatFormImport_DR',
+            contentType: 'application/json',
+            exts: 'xls|xlsx', //鍏佽涓婁紶鐨勭被鍨�
+            before: function (data) {
+                loadIndex = layer.load(2);
+            },
+            done: function (data1) {
+                if (data1.count == 1) {
+                    option.data = data1.data;
+                    table.render(option);
+                    layer.close(loadIndex);
+                } else {
+                    layer.close(loadIndex);
+                    layer.alert(data1.code + data1.Message, { icon: 5 });
                 }
-            });
+            },
+            error: function (err) {
+                debugger
+                layer.alert('瀵煎叆鍑虹幇寮傚父', { icon: 2 });
+            }
+        });
+
+        //閫�鍑�
+        form.on('submit(Cancel)', function () {
+            if (OperationType == 1) {
+                Pub_Close(1);
+            }
+            else {
+                Pub_Close(2);
+            }
         })
 
-       
+        //瀵煎叆  淇濆瓨鏁版嵁
+        form.on('submit(btnSave)', function (data) {
+            if (table.cache["mainTable"] != null) {
+                set_AddNew(data);
+            }
+            else {
+                layer.msg("鏃犳暟鎹�,璇峰厛瀵煎叆鏁版嵁!");
+            }
+        })
+
+
         //#endregion
 
         //#region 姝ら〉闈㈡墍鏈夌殑鏂规硶
@@ -180,53 +171,171 @@
             //鍒濆鍖栬〃鏍�
             set_InitGrid();
         }
-   
+
+         //#endregion
+
         //鍒濆鍖栬〃鏍�
         function set_InitGrid() {
-            table.render({
+            var myDate = new Date();
+            var yyyy = myDate.getFullYear();
+            var MM = myDate.getMonth() + 1;
+            var dd = myDate.getDate();
+            var SumMonth = 31; //鍔ㄦ�佷袱鏈堜箣宸� new Date(yyyy, MM, 0).getDate()
+            var columns = [];
+
+            columns.push({ type: 'checkbox', fixed: 'left' });
+            columns.push({ field: 'hmainid', title: 'hmainid', width: 200, hide: true });
+            columns.push({ field: '鍗曟嵁鍙�', title: '鍗曟嵁鍙�', width: 200 });
+            columns.push({ field: '鐢熶骇璁㈠崟鍙�*', title: '鐢熶骇璁㈠崟鍙�', width: 150 });
+            columns.push({ field: '鐢熶骇璁㈠崟鏄庣粏琛屽彿*', title: '鐢熶骇璁㈠崟鏄庣粏琛屽彿', width: 200 });
+            columns.push({ field: '缁勭粐缂栫爜*', title: '缁勭粐缂栫爜', width: 150});
+            columns.push({ field: 'HWorkShopID', title: 'HWorkShopID', hide: true });
+            columns.push({ field: '鐢熶骇杞﹂棿缂栫爜*', title: '鐢熶骇杞﹂棿', width: 150});
+            columns.push({ field: 'HSourceID', title: 'HSourceID', hide: true });
+            columns.push({ field: '鐢熶骇璧勬簮缂栫爜*', title: '鐢熶骇璧勬簮', edit: 'text', event: "HSourceID"   });
+            columns.push({ field: '浼樺厛绾�', title: '浼樺厛绾�' });
+            columns.push({ field: 'HEmpID', title: 'HEmpID', hide: true });
+            columns.push({ field: '鍛樺伐', title: '鍛樺伐', width: 150 });
+            columns.push({ field: '鍛樺伐缂栫爜', title: '鍛樺伐缂栫爜', width: 150 });
+            columns.push({ field: 'HMaterID', title: '鐗╂枡ID', hide: true });
+            columns.push({ field: '鐗╂枡缂栫爜*', title: '鐗╂枡缂栫爜', width: 150 });
+            columns.push({ field: '鐗╂枡鍚嶇О', title: '鐗╂枡鍚嶇О', width: 200 });
+            columns.push({ field: '瑙勬牸鍨嬪彿', title: '瑙勬牸鍨嬪彿', width: 150});
+            columns.push({ field: 'HUnitID', title: 'HUnitID', hide: true });
+            columns.push({ field: '璁¢噺鍗曚綅', title: '璁¢噺鍗曚綅', width: 150});
+            columns.push({ field: '鎵规鍙�', title: '鎵规', width: 150});
+            columns.push({ field: '閿�鍞鍗曟暟閲�', title: '閿�鍞鍗曟暟閲�', width: 200 });
+            columns.push({ field: '鐢熶骇璁㈠崟鏁伴噺', title: '鐢熶骇璁㈠崟鏁伴噺', width: 200 });
+            columns.push({ field: '鎬婚綈濂楁暟閲�', title: '鎬婚綈濂楁暟閲�', width: 200 });
+            columns.push({ field: 'ICMOBillHInterID', title: 'ICMOBillHInterID', hide: true});
+            columns.push({ field: 'ICMOBillHEntryID', title: 'ICMOBillHEntryID', hide: true });
+            columns.push({ field: 'HProdORGID', title: 'HProdORGID', hide: true });
+            for (var i = 0; i <= (SumMonth - dd); i++) {
+                columns.push({ field: Format(yyyy + '/' + MM + '/' + (dd + i), 'yyyy-MM-dd'), title: Format(yyyy + '/' + MM + '/' + (dd + i), 'MM.dd'), edit: 'text', width:80 })
+            }
+            for (var i = 1; i <= dd; i++) {
+                columns.push({ field: Format(yyyy + '/' + (MM + 1) + '/' + i, 'yyyy-MM-dd'), title: Format(yyyy + '/' + (MM + 1) + '/' + i, 'MM.dd'), edit: 'text', width: 80 })
+            }
+            columns.push({ fixed: 'right', title: '鎿嶄綔', toolbar: '#barDemo' });
+
+            option = {
                 elem: '#mainTable'
                 , toolbar: '#toolbarDemo'
-                , height: 'full-50'
+                , height: 'full-190'
                 , page: true
                 , cellMinWidth: 90
                 , limit: 50
                 , limits: [50, 500, 5000, 20000]
                 , loading: false
-                , cols: [[
-                    { type: 'checkbox', fixed: 'left' }
-                    , { field: 'hmainid', title: 'hmainid', hide: true }
-                    , { field: '鍗曟嵁绫诲瀷', title: '鍗曟嵁绫诲瀷', width: 120 }
-                    , { field: '鏃ユ湡', title: '瑕佹枡鏃ユ湡' }
-                    , { field: '鍗曟嵁鍙�', title: '鍗曟嵁鍙�' }
-                    , { field: '鍗曟嵁鐘舵��', title: '鍗曟嵁鐘舵��' }
-                    , { field: '琛ㄥご澶囨敞', title: '琛ㄥご澶囨敞' }
-                    , { field: '閫�鍥炰汉', title: '閫�鍥炰汉' }
-                    , { field: '閫�鍥炴棩鏈�', title: '閫�鍥炴棩鏈�' }
-                    , { field: '瀹℃牳浜�', title: '瀹℃牳浜�' }
-                    , { field: '瀹℃牳鏃ユ湡', title: '瀹℃牳鏃ユ湡' }
-                    , { field: '鍒跺崟浜�', title: '鍒跺崟浜�' }
-                    , { field: '鍒跺崟鏃ユ湡', title: '鍒跺崟鏃ユ湡' }
-                    , { field: '淇敼浜�', title: '淇敼浜�' }
-                    , { field: '淇敼鏃ユ湡', title: '淇敼鏃ユ湡' }
-                    , { field: '鍏抽棴浜�', title: '鍏抽棴浜�' }
-                    , { field: '鍏抽棴鏃ユ湡', title: '鍏抽棴鏃ユ湡' }
-                    , { field: '鍏抽棴绫诲瀷', title: '鍏抽棴绫诲瀷' }
-                    , { field: '浣滃簾浜�', title: '浣滃簾浜�' }
-                    , { field: '浣滃簾鏃ユ湡', title: '浣滃簾鏃ユ湡' }
-                    , { field: '涓荤敓浜х粍缁�', title: '鐢熶骇缁勭粐' }
-                    , { field: '杞﹂棿鍚嶇О', title: '鐢熶骇杞﹂棿' }
-                    , { field: '婧愬崟鍗曞彿', title: '鐢熶骇璁㈠崟鍙�' }
-                    , { field: '鏁伴噺', title: '鏁伴噺' }
-                    , { field: '璁¢噺鍗曚綅', title: '璁¢噺鍗曚綅' }
-                    , { field: '鐗╂枡鍚嶇О', title: '鐗╂枡鍚嶇О' }
-                    , { field: '鐗╂枡浠g爜', title: '鐗╂枡浠g爜' }
-                    , { field: '瑙勬牸鍨嬪彿', title: '瑙勬牸鍨嬪彿' }
-                    , { field: '宸ュ崟鐢熶骇鏃ユ湡', title: '宸ュ崟鐢熶骇鏃ユ湡' }
-                    , { field: '寤惰繜鍘熷洜', title: '寤惰繜鍘熷洜' }
-                ]]
+                , cols: [columns]
+            };
+
+            //娓叉煋椤甸潰
+            table.render(option);
+        }
+
+        //瀵煎叆(淇濆瓨)
+        function set_AddNew(data) {
+
+            var num = [];
+            for (var i = 0; i < table.cache["mainTable"].length; i++) {
+                if (table.cache["mainTable"][i] != "") {
+                    table.cache["mainTable"][i].LAY_TABLE_INDEX = i;
+                    num.push(table.cache["mainTable"][i])
+                }
+            }
+            data.field.HPRDORGID = sessionStorage["OrganizationID"];//缁勭粐
+            var sMainStr = JSON.stringify(data.field);
+            var sSubStr = JSON.stringify(num);
+            var sMainSub = sMainStr + ';' + sSubStr + ';' + sessionStorage["HUserName"];
+            var index = layer.load();
+           
+            $.ajax({
+                type: "POST",
+                url: GetWEBURL() + "/JIT_DayPlanPlatFormImport/JIT_DayPlanPlatFormImport_btnSave",
+                async: true,
+                data: { "sMainSub": sMainSub },
+                dataType: "json",
+                success: function (data) {
+                    if (data.count == 1) {
+                        layer.close(index);
+                        layer.msg("鎻愪氦鎴愬姛");
+                    }
+                    else {
+                        layer.close(index);
+                        layer.msg(data.Message, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                    }
+                },
+                error: function (err) {
+                    layer.close(index);
+                    layer.msg("閿欒:" + err, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                }
             });
         }
 
+        //琛屽唴鍒犻櫎
+        function set_GridDelete(obj) {
+            if (obj.event === 'del') {
+                layer.confirm('鐪熺殑鍒犻櫎琛屽悧锛�', function (index) {
+                    obj.del();
+                    option.data = table.cache["mainTable"];//灏嗘暟鎹粦瀹氬埌data涓�
+                    table.reload(option);
+                    layer.close(index);
+                });
+            }
+        }
+
+        //琛屽唴鍒犻櫎蹇嵎閿�
+        function set_GridCellCheck(obj) {
+            $(document).off('keydown', ".layui-table-edit").on('keydown', '.layui-table-edit', function (e) {
+                if (event.key == "F7") {
+                    //鐢熶骇璧勬簮
+                    if (obj.event == "HSourceID") {
+                        layer.open({
+                            type: 2
+                            , skin: "layui-layer-rim" //鍔犱笂杈规
+                            , title: "鐢熶骇璧勬簮鍒楄〃"  //鏍囬
+                            , closeBtn: 1  //绐椾綋鍙充笂瑙掑叧闂� 鐨� 鏍峰紡
+                            , shift: 2 //寮瑰嚭鍔ㄧ敾
+                            , area: ["90%", "90%"] //绐椾綋澶у皬
+                            , maxmin: true //璁剧疆鏈�澶ф渶灏忔寜閽槸鍚︽樉绀�
+                            , content: ["../../鍩虹璧勬枡/鐢熶骇鍩虹璧勬枡/Gy_Source.html", "yes"]
+                            , btn: ["纭畾", "鍙栨秷"]
+                            , btn1: function (index, laero) {
+                                //鎸夐挳涓�  鐨勫洖璋�
+                                var iframeWindow = window["layui-layer-iframe" + index];//鑾峰彇寮规椤甸潰
+                                var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//鑾峰彇閫変腑鐨勬暟鎹�
+
+                                if (checkStatus.data.length != 1) {
+                                    return layer.msg("璇烽�夋嫨涓�鏉℃暟鎹�");
+                                }
+                                //鏇存柊琛ㄦ牸缂撳瓨鐨勬暟鎹�
+                                obj.update({
+                                    "HSourceID": checkStatus.data[0].HItemID
+                                    , "鐢熶骇璧勬簮缂栫爜*": checkStatus.data[0].鐢熶骇璧勬簮浠g爜
+                                })
+                                layer.close(index);//鍏抽棴寮圭獥
+                            }
+                        })
+                    }
+                    obj.event = "";
+                    return false;
+                }
+
+            })
+        }
+
+        //鑾峰彇鍙傛暟
+        function getUrlVars() {
+            var vars = [], hash;
+            var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
+            for (var i = 0; i < hashes.length; i++) {
+                hash = hashes[i].split('=');
+                vars.push(hash[0]);
+                vars[hash[0]] = hash[1];
+            }
+            return vars;
+        }
 
         //#endregion
 

--
Gitblit v1.9.1