From ef4ef71a81bb8a3e2a59d8381e09259589cea42e Mon Sep 17 00:00:00 2001
From: zzr99 <1940172413@qq.com>
Date: 星期一, 16 五月 2022 14:21:44 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MESWMS-LayUI

---
 WebTM/views/生产管理/生产日计划工单/JIT_DayPlanBillList.html      |    2 
 WebTM/views/生产管理/生产计划平台/JIT_DayPlanPlatFormImport.html |  223 +++++++++++++++++++++++++++++++++++++------------------
 2 files changed, 150 insertions(+), 75 deletions(-)

diff --git "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\346\227\245\350\256\241\345\210\222\345\267\245\345\215\225/JIT_DayPlanBillList.html" "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\346\227\245\350\256\241\345\210\222\345\267\245\345\215\225/JIT_DayPlanBillList.html"
index 89dc3c5..4ec2752 100644
--- "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\346\227\245\350\256\241\345\210\222\345\267\245\345\215\225/JIT_DayPlanBillList.html"
+++ "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\346\227\245\350\256\241\345\210\222\345\267\245\345\215\225/JIT_DayPlanBillList.html"
@@ -216,7 +216,7 @@
         //鑾峰彇缁勭粐
         function Organ() {
             //鑾峰彇鐧诲綍椤电粍缁囧垪
-            var Organization = '';
+            var Organization = '<option  style="color:blue;" value="">缁勭粐</option>';
             $.ajax({
                 type: "get",
                 url: GetWEBURL() + "/Web/GetOrganizations",
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..ae283c6 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"
@@ -70,19 +70,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>
@@ -93,7 +93,6 @@
                     <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>
                         </div>
                     </script>
                 </form>
@@ -102,13 +101,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,7 +124,7 @@
             , upload = layui.upload
             , element = layui.element;
 
-
+        var option = [];
         //#endregion
 
         //#region 杩涘叆椤甸潰鍗冲姞杞�
@@ -134,41 +136,52 @@
 
         //#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);   //琛屽唴鍒犻櫎
+        });
+
+        //鏂囦欢涓婁紶
+        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 () {
+            Pub_Close(2);
         })
 
-       
+        //瀵煎叆  淇濆瓨鏁版嵁
+        form.on('submit(btnSave)', function (data) {
+            if (table.cache["mainTable"] != null) {
+                set_AddNew(data);
+            }
+            else {
+                layer.msg("鏃犳暟鎹�,璇峰厛瀵煎叆鏁版嵁!");
+            }
+        })
+
+
         //#endregion
 
         //#region 姝ら〉闈㈡墍鏈夌殑鏂规硶
@@ -180,53 +193,115 @@
             //鍒濆鍖栬〃鏍�
             set_InitGrid();
         }
-   
+
         //鍒濆鍖栬〃鏍�
         function set_InitGrid() {
-            table.render({
+            var myDate = new Date();
+            var yyyy = myDate.getFullYear();
+            var MM = myDate.getMonth() + 1;
+            var dd = myDate.getDate();
+            var SumMonth = 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: '鐢熶骇璁㈠崟鍙�' });
+            columns.push({ field: '鐢熶骇璁㈠崟鏄庣粏琛屽彿*', title: '鐢熶骇璁㈠崟鏄庣粏琛屽彿', width: 200 });
+            columns.push({ field: '缁勭粐缂栫爜*', title: '缁勭粐缂栫爜' });
+            columns.push({ field: 'HWorkShopID', title: 'HWorkShopID', hide: true });
+            columns.push({ field: '鐢熶骇杞﹂棿缂栫爜*', title: '鐢熶骇杞﹂棿' });
+            columns.push({ field: 'HSourceID', title: 'HSourceID', hide: true });
+            columns.push({ field: '鐢熶骇璧勬簮缂栫爜*', title: '鐢熶骇璧勬簮' });
+            columns.push({ field: '浼樺厛绾�', title: '浼樺厛绾�' });
+            columns.push({ field: 'HEmpID', title: 'HEmpID', hide: true });
+            columns.push({ field: '鍛樺伐', title: '鍛樺伐' });
+            columns.push({ field: '鍛樺伐缂栫爜', title: '鍛樺伐缂栫爜' });
+            columns.push({ field: 'HMaterID', title: '鐗╂枡ID', hide: true });
+            columns.push({ field: '鐗╂枡缂栫爜*', title: '鐗╂枡缂栫爜' });
+            columns.push({ field: '鐗╂枡鍚嶇О', title: '鐗╂枡鍚嶇О', width: 200 });
+            columns.push({ field: '瑙勬牸鍨嬪彿', title: '瑙勬牸鍨嬪彿' });
+            columns.push({ field: 'HUnitID', title: 'HUnitID', hide: true });
+            columns.push({ field: '璁¢噺鍗曚綅', title: '璁¢噺鍗曚綅' });
+            columns.push({ field: '鎵规鍙�', title: '鎵规' });
+            columns.push({ field: '閿�鍞鍗曟暟閲�', title: '閿�鍞鍗曟暟閲�', width: 200 });
+            columns.push({ field: '鐢熶骇璁㈠崟鏁伴噺', title: '鐢熶骇璁㈠崟鏁伴噺', width: 200 });
+            columns.push({ field: '鎬婚綈濂楁暟閲�', title: '鎬婚綈濂楁暟閲�', width: 200 });
+            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), 'yyyy-MM-dd'), edit: 'text' })
+            }
+            for (var i = 1; i < dd; i++) {
+                columns.push({ field: Format(yyyy + '/' + (MM + 1) + '/' + i, 'yyyy-MM-dd'), title: Format(yyyy + '/' + (MM + 1) + '/' + i, 'yyyy-MM-dd'), edit: 'text' })
+            }
+            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);
+                });
+            }
+        }
+
 
         //#endregion
 

--
Gitblit v1.9.1