From ef72964af06c88b949ab1ecb3c87324513e9a6a5 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期一, 26 二月 2024 14:55:09 +0800
Subject: [PATCH] 高级过滤 不良分类 列设置 分页保存

---
 WebTM/views/基础资料/隐藏列设置/Gy_QueryCondition.html |  536 ++++++++++++++++++++++++++++++++++++++++++++++++
 WebTM/views/基础资料/生产基础资料/Gy_BadType.html       |   20 +
 WebTM/views/基础资料/隐藏列设置/Gy_GridView_Hide.html  |   16 +
 WebTM/views/index.html                        |    1 
 WebTM/views/基础资料/公用基础资料/Gy_Material.html      |   67 ++++++
 WebTM/WebTM.csproj                            |    1 
 6 files changed, 640 insertions(+), 1 deletions(-)

diff --git a/WebTM/WebTM.csproj b/WebTM/WebTM.csproj
index a651ace..02f42db 100644
--- a/WebTM/WebTM.csproj
+++ b/WebTM/WebTM.csproj
@@ -353,6 +353,7 @@
     <Content Include="views\鍩虹璧勬枡\鐢熶骇鍩虹璧勬枡\Gy_DisposeWayList.html" />
     <Content Include="views\鍩虹璧勬枡\鐢熶骇鍩虹璧勬枡\Gy_ScrapReasonList.html" />
     <Content Include="views\鍩虹璧勬枡\鐢熶骇鍩虹璧勬枡\Gy_Souce_Excel.html" />
+    <Content Include="views\鍩虹璧勬枡\闅愯棌鍒楄缃甛Gy_QueryCondition.html" />
     <Content Include="views\宸ヨ祫绠$悊\鍔犵彮鐢宠\Pay_OverApplyBill.html" />
     <Content Include="views\宸ヨ祫绠$悊\鍔犵彮鐢宠\Pay_OverApplyBillList.html" />
     <Content Include="views\宸ヨ祫绠$悊\瀹氶鐢宠\Pay_ProcPriceRequestBill.html" />
diff --git a/WebTM/views/index.html b/WebTM/views/index.html
index e0abb4f..2cd0c1a 100644
--- a/WebTM/views/index.html
+++ b/WebTM/views/index.html
@@ -1117,6 +1117,7 @@
                                         <dd><a lay-href="鍩虹璧勬枡/宸ヨ祫鍩虹璧勬枡/Gy_Group.html">鐢熶骇鐝粍鍒楄〃</a></dd>
                                         <dd><a lay-href="鍩虹璧勬枡/鐢熶骇鍩虹璧勬枡/Gy_BadReason.html">涓嶈壇鍘熷洜鍒楄〃</a></dd>
                                         <dd><a lay-href="鍩虹璧勬枡/鐢熶骇鍩虹璧勬枡/Gy_BadType.html">涓嶈壇绫诲瀷鍒楄〃</a></dd>
+                                        <dd><a lay-href="鍩虹璧勬枡/闅愯棌鍒楄缃�/Gy_QueryCondition.html">杩囨护鏂规</a></dd>
                                         <dd><a lay-href="鍩虹璧勬枡/鍩虹璧勬枡/Gy_ConkReasonList.html">鏁呴殰鍘熷洜鍒楄〃</a></dd>
                                         <dd><a lay-href="鍩虹璧勬枡/鐢熶骇鍩虹璧勬枡/Gy_SOPBillList.html">浣滀笟鎸囧涔︾淮鎶�</a></dd>
                                         <dd><a lay-href="鍩虹璧勬枡/鐢熶骇鍩虹璧勬枡/Gy_SOPBillEdit.html">浣滀笟鎸囧涔︾紪杈�</a></dd>
diff --git "a/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/Gy_Material.html" "b/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/Gy_Material.html"
index d047882..f5a13e5 100644
--- "a/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/Gy_Material.html"
+++ "b/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/Gy_Material.html"
@@ -127,6 +127,7 @@
                                 <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-DeStop"><i class="layui-icon layui-icon-radio"></i>鍙嶇鐢�</button>
                                 <button type="button" class="layui-btn layui-btn-sm" lay-event="get_Refresh"><i class="layui-iconlayuiiconrefresh-3"></i>鍒锋柊</button>
                                 <button type="button" class="layui-btn layui-btn-sm" lay-event="set_HideColumn"><i class="layui-icon layuiiconform"></i>鍒楄缃�</button>
+                                <button type="button" class="layui-btn layui-btn-sm" lay-event="set_QueryCondition"><i class="layui-icon layuiiconform"></i>楂樼骇杩囨护</button>
                                 <!--<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Print" id="btn-Print"><iclass="layuiiconlayuiicon-circle"></i>棰勮</button>-->
                                 <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Close"><i class="layui-icon layui-icon-logout"></i>閫�鍑�</button>
                             </div>
@@ -138,6 +139,7 @@
     </div>
 
     <script>
+        var GetDataCols = "";
         layui.config({
             base: '../../../layuiadmin/' //闈欐�佽祫婧愭墍鍦ㄨ矾寰�
         }).extend({
@@ -154,7 +156,6 @@
                 , laydate = layui.laydate
                 , tree = layui.tree
             var sWhere = "";
-
             var option = [];
             var Organization = sessionStorage["Organization"];
             var HModName = "Gy_Material";
@@ -218,6 +219,10 @@
                     //鍒楄缃�
                     case 'set_HideColumn':
                         get_HideColumn();
+                        break;
+                    //楂樼骇杩囨护
+                    case 'set_QueryCondition':
+                        set_QueryCondition();
                         break;
                 };
             });
@@ -458,8 +463,12 @@
                 if (HOrgName) {
                     sWhere += " and 缁勭粐鍚嶇О like '%" + HOrgName + "%'";
                 }
+                if (GetDataCols != "") {
+                    sWhere += GetDataCols;
+                }
                 get_Display(sWhere);
                 sWhere = "";//璋冪敤鎺ュ彛鍚庢竻绌簊Where缂撳瓨
+                GetDataCols = "";
             }
             //#endregion
 
@@ -826,6 +835,58 @@
                 })
             }
             //#endregion
+
+            //楂樼骇杩囨护
+            function set_QueryCondition() {
+                var colName = "";
+                var contentUrl = "";
+                for (var i = 0; i < option.cols[0].length; i++) {
+                    if (option.cols[0][i]["field"] != undefined) {
+                        colName += option.cols[0][i]["title"] + ",";
+                    }
+                }
+                var urlStr = window.document.location.pathname;//鑾峰彇鏂囦欢璺緞
+                var urlLen = urlStr.split('/');
+                for (var i = 0; i < urlLen.length - 4; i++) {
+                    contentUrl += "../";
+                }
+                colName = encodeURI(colName.substring(0, colName.length - 1));//瀵� URI 杩涜缂栫爜
+
+                HModName = "h_v_Gy_MaterialList";//绛変簬璇ュ垪琛ㄧ殑瑙嗗浘
+
+                contentUrl += '鍩虹璧勬枡/闅愯棌鍒楄缃�/Gy_QueryCondition.html?HModName=' + HModName + '&colName=' + colName;
+
+                layer.open({
+                    type: 2
+                    , skin: "layui-layer-rim" //鍔犱笂杈规
+                    , title: "楂樼骇杩囨护"  //鏍囬
+                    , closeBtn: 1  //绐椾綋鍙充笂瑙掑叧闂� 鐨� 鏍峰紡
+                    , shift: 2 //寮瑰嚭鍔ㄧ敾
+                    , area: ["50%", "80%"] //绐椾綋澶у皬
+                    , maxmin: true //璁剧疆鏈�澶ф渶灏忔寜閽槸鍚︽樉绀�
+                    , content: [contentUrl, "yes"]
+                    , btn: ["纭畾", "鍙栨秷"]
+                    , btn1: function (index, laero) {
+                        var iframeWindow = window["layui-layer-iframe" + index];//鑾峰彇寮规椤甸潰
+                        var checkStatus = iframeWindow.layui.table.cache["mainTable"];//鑾峰彇閫変腑鐨勬暟鎹�
+                        if (checkStatus.length == 0) {
+                            return layer.msg("璇疯緭鍏ヨ繃婊ゆ潯浠�!");
+                        }
+                        var myIframe = window[laero.find('iframe')[0]['name']];
+                        for (var i = 0; i < checkStatus.length; i++) {
+                            GetDataCols += myIframe.get_FastQuery(checkStatus[i]); //get_FastQuery()涓哄瓙椤甸潰鐨勬柟娉�
+                        }
+                        //鏇存柊琛ㄦ牸缂撳瓨鐨勬暟鎹�
+                        layer.close(index);//鍏抽棴寮圭獥
+                    }
+                    , end: function () {
+                        if (GetDataCols != "") {
+                            get_FastQuery();
+                        }
+                    }
+                })
+            }
+
             //#region 鏄剧ず鍒楁暟鎹�
             function DisPlay_HideColumn() {
                 $.ajax({
@@ -973,6 +1034,10 @@
             //#endregion
         });
             //#endregion
+
+        function GetDataCol(data) {
+            GetDataCols = data;
+        }
     </script>
 
 </body>
diff --git "a/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\347\224\237\344\272\247\345\237\272\347\241\200\350\265\204\346\226\231/Gy_BadType.html" "b/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\347\224\237\344\272\247\345\237\272\347\241\200\350\265\204\346\226\231/Gy_BadType.html"
index 9e5a566..cb9456a 100644
--- "a/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\347\224\237\344\272\247\345\237\272\347\241\200\350\265\204\346\226\231/Gy_BadType.html"
+++ "b/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\347\224\237\344\272\247\345\237\272\347\241\200\350\265\204\346\226\231/Gy_BadType.html"
@@ -692,6 +692,11 @@
                                     option.cols[0][i + 1]["fixed"] = "left";
                                 }
                             }
+
+                            //榛樿鍒嗛〉
+                            option.limit = data1.data[0].HPageSize;
+                            var limits = [50, 500, 5000, 50000, data1.data[0].HPageSize];
+                            option.limits = insertionSort(limits);
                             table.render(option);
                         } else {
                             table.render(option);
@@ -707,6 +712,21 @@
             }
             //#endregion
 
+            function insertionSort(arr) {
+                let len = arr.length;
+                let preIndex, current;
+                for (let i = 1; i < len; i++) {
+                    preIndex = i - 1;
+                    current = arr[i];
+                    while (preIndex >= 0 && arr[preIndex] > current) {
+                        arr[preIndex + 1] = arr[preIndex];
+                        preIndex--;
+                    }
+                    arr[preIndex + 1] = current;
+                }
+                return arr;
+            }
+
             //#region 鍒楁槑鏄剧ず涓嬫媺妗�
             function ColFilter() {
                 var Organization = '<option  value="0" selected="selected" ></option>';
diff --git "a/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\351\232\220\350\227\217\345\210\227\350\256\276\347\275\256/Gy_GridView_Hide.html" "b/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\351\232\220\350\227\217\345\210\227\350\256\276\347\275\256/Gy_GridView_Hide.html"
index 65d4b6a..fdf9871 100644
--- "a/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\351\232\220\350\227\217\345\210\227\350\256\276\347\275\256/Gy_GridView_Hide.html"
+++ "b/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\351\232\220\350\227\217\345\210\227\350\256\276\347\275\256/Gy_GridView_Hide.html"
@@ -66,6 +66,12 @@
                                                 <input type="text" class="layui-input" lay-verify="HColumnWidth" name="HColumnWidth" id="HColumnWidth">
                                             </div>
                                         </div>
+                                        <div class="layui-inline">
+                                            <label class="layui-form-label" style="width: 85px;">榛樿鍒嗛〉</label>
+                                            <div class="layui-input-block" style="margin-left: 120px;">
+                                                <input type="text" class="layui-input" lay-verify="HPageSize" name="HPageSize" id="HPageSize">
+                                            </div>
+                                        </div>
                                     </div>
                                     <div class="layui-row">
                                         <div class="layui-inline">
@@ -237,6 +243,8 @@
                         $("#HFontSize").val(data1.data[0].HFontSize);
                         //鍒楀
                         $("#HColumnWidth").val(data1.data[0].HColumnWidth);
+                        //榛樿鍒嗛〉
+                        $("#HPageSize").val(data1.data[0].HPageSize);
 
                         //琛ㄦ牸鐨勬暟鎹~鍏�
                         for (var i = 0; i < colNames.length; i++) {
@@ -309,6 +317,14 @@
                 }
             }
 
+            //榛樿鍒嗛〉
+            var HPageSize = $("#HPageSize").val();
+            var nums = /^[0-9]+?[0-9]*$/;
+            if (!nums.test(HPageSize)) {
+                layer.msg("榛樿鍒嗛〉涓嶄负姝f暣鏁�!")
+                return false;
+            }
+
             var sMainStr = JSON.stringify(data.field);
             var sSubStr = JSON.stringify(num);
             var OperationType = "1";
diff --git "a/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\351\232\220\350\227\217\345\210\227\350\256\276\347\275\256/Gy_QueryCondition.html" "b/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\351\232\220\350\227\217\345\210\227\350\256\276\347\275\256/Gy_QueryCondition.html"
new file mode 100644
index 0000000..3022fe1
--- /dev/null
+++ "b/WebTM/views/\345\237\272\347\241\200\350\265\204\346\226\231/\351\232\220\350\227\217\345\210\227\350\256\276\347\275\256/Gy_QueryCondition.html"
@@ -0,0 +1,536 @@
+锘�<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8" />
+    <title>杩囨护鏂规</title>
+    <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
+    <link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
+    <script src="../../../layuiadmin/layui/layui.js"></script>
+    <script src="../../../layuiadmin/layui/layui.js"></script>
+    <script src="../../../layuiadmin/Scripts/json2.js"></script>
+    <script src="../../../layuiadmin/Scripts/jquery-1.4.1.js"></script>
+    <script src="../../../layuiadmin/Scripts/webConfig.js"></script>
+    <script src="../../../layuiadmin/layui/layui1.js"></script>
+    <script src="../../../layuiadmin/zgqCustom/zgqCustom.js"></script>
+    <script src="../../../layuiadmin/PubCustom.js"></script>
+    <style>
+        /*鏍戠姸鍥剧偣鍑婚珮浜彉鑹�*/
+        .layui-tree-set-active > .layui-tree-entry .layui-tree-main {
+            background: #aef0f7;
+        }
+        /* 闃叉涓嬫媺妗嗙殑涓嬫媺鍒楄〃琚殣钘�---蹇呴』璁剧疆--- */
+        .layui-table-cell {
+            overflow: visible !important;
+        }
+        /* 浣垮緱涓嬫媺妗嗕笌鍗曞厓鏍煎垰濂藉悎閫� */
+        td .layui-form-select {
+            margin-top: -10px;
+            margin-left: -15px;
+            margin-right: -15px;
+        }
+    </style>
+</head>
+<body>
+    <div class="layui-fluid">
+        <div class="layui-col-md12">
+            <div class="layui-card" style="padding: 1px">
+                <div class="layui-card-body" style="padding: 1px;">
+                    <form class="layui-form" action="" lay-filter="component-form-group">
+                        <div style="padding: 2px; ">
+                            <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="AddF_A" id="AddF_A">鏂板鏂规</button>
+                            <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="DelF_A" id="DelF_A">鍒犻櫎鏂规</button>
+                            <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="AddBtn" id="AddBtn">淇濆瓨鏂规</button>
+                        </div>
+                        <div class="layui-row" style="padding:10px 0">
+                            <div class="layui-col-xs2 layui-inline" style="border: solid 1.5px #e0d6d64d;">
+                                <div id="TreeTable" class="demo-tree-more"></div>
+                            </div>
+                            <div class="layui-col-xs8 layui-inline" style="padding-left: 10px;">
+                                <div>
+                                    <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="btn-AddLine"><i class="layui-icon layui-icon-form"></i>澧炲姞涓�琛�</button>
+                                        </div>
+                                    </script>
+                                </div>
+                            </div>
+                        </div>
+                    </form>
+                </div>
+            </div>
+        </div>
+    </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 type="text/html" id="HFieldNameCol">
+    <select name="HFieldNameCol" lay-filter="HFieldNameCol" lay-search id="HFieldNameCol{{d.LAY_TABLE_INDEX+1}}">
+    </select>
+</script>
+<!--琛屼笅鎷夐�夋嫨(姣旇緝鍏崇郴)-->
+<script type="text/html" id="HControlCol">
+    <select name="HControlCol" lay-filter="HControlCol" id="HControlCol{{d.LAY_TABLE_INDEX+1}}">
+        <option value="" selected="selected"></option>
+        <option value="=">=</option>
+        <option value=">=">>=</option>
+        <option value=">">></option>
+        <option value="<="><=</option>
+        <option value="<"><</option>
+        <option value="<>"><></option>
+        <option value="鍖呭惈">鍖呭惈</option>
+        <option value="宸﹀寘鍚�">宸﹀寘鍚�</option>
+        <option value="鍙冲寘鍚�">鍙冲寘鍚�</option>
+        <option value="涓嶅寘鍚�">涓嶅寘鍚�</option>
+    </select>
+</script>
+<!--琛屼笅鎷夐�夋嫨(閫昏緫)-->
+<script type="text/html" id="HRelationCol">
+    <select name="HRelationCol" lay-filter="HRelationCol" id="HRelationCol{{d.LAY_TABLE_INDEX+1}}">
+        <option value="and">骞朵笖</option>
+        <option value="or">鎴栬��</option>
+    </select>
+</script>
+<script>
+    layui.config({
+        base: '../../../layuiadmin/' //闈欐�佽祫婧愭墍鍦ㄨ矾寰�
+    }).extend({
+        index: 'lib/index', //涓诲叆鍙fā鍧�
+    }).use(['index', 'form', 'table', 'element', 'laypage', 'laydate', 'tree'], function () {
+        //#region 鍏叡鍙橀噺
+        var $ = layui.$
+            , admin = layui.admin
+            , layer = layui.layer
+            , table = layui.table
+            , form = layui.form
+            , element = layui.element
+            , laypage = layui.laypage
+            , laydate = layui.laydate
+            , tree = layui.tree
+
+        //鏌ヨ鏉′欢
+        var sWhere = "";
+        var option = [];
+        var TreeData = [];
+        var HtitleId = [];//鑺傜偣
+        //#endregion
+
+
+        //#region 杩涘叆椤甸潰鏃㈠姞杞�
+
+        var params = getUrlVars();
+        var HModName = params[params[0]]; //妯″潡鍚嶇О
+        var colName = params[params[1]]; //鍒楀悕
+        colName = decodeURI(colName);//瀵筓RI 杩涜瑙g爜
+
+        //鍒濆鍖栫晫闈�
+        set_ClearBill();
+        //#endregion
+
+        //#region 瑙﹀彂浜嬩欢锛氬寘鎷琭orm.on(){}鏍煎紡鐨勬墍鏈夌偣鍑讳簨浠躲�侀�夋嫨浜嬩欢绛�
+
+        //澶村伐鍏锋爮浜嬩欢
+        table.on('toolbar(mainTable)', function (obj) {
+            var checkStatus = table.checkStatus('mainTable')
+                , data = checkStatus.data;
+
+            //鏂板琛岃〃鏍兼暟鎹�
+            var NewRow = { "HFieldNameCol": "", "HControlCol": "", "HConditionCol": "", "HRelationCol": "and", "HIDCol": "" };
+            switch (obj.event) {
+                case 'btn-AddLine':
+                    table.cache["mainTable"].push(NewRow);
+                    option.data = table.cache["mainTable"];
+                    table.render(option);
+
+                    selectCol();
+                    break;
+            }
+        });
+
+        //琛屽唴浜嬩欢
+        table.on('tool(mainTable)', function (obj) {
+            set_GridDelete(obj);   //琛屽唴鍒犻櫎
+        });
+
+        //琛岄�夋嫨澶勭悊锛堝瓧娈靛悕绉帮級
+        form.on('select(HFieldNameCol)', function (data) {
+            //鑾峰彇涓嬫媺妗嗛�変腑鐨勫��
+            var elem = data.othis.parents('tr');
+            var dataindex = elem.attr("data-index");
+            $.each(option.data, function (index, value) {
+                if (value.LAY_TABLE_INDEX == dataindex) {
+                    value.HFieldNameCol = data.value;//鎶婇�変腑涓嬫媺妗唅d鍊艰祴鍊肩粰琛ㄦ牸缂撳瓨
+                }
+            });
+        });
+
+        //琛岄�夋嫨澶勭悊锛堟瘮杈冨叧绯伙級
+        form.on('select(HControlCol)', function (data) {
+            //鑾峰彇涓嬫媺妗嗛�変腑鐨勫��
+            var elem = data.othis.parents('tr');
+            var dataindex = elem.attr("data-index");
+            $.each(option.data, function (index, value) {
+                if (value.LAY_TABLE_INDEX == dataindex) {
+                    value.HControlCol = data.value;//鎶婇�変腑涓嬫媺妗唅d鍊艰祴鍊肩粰琛ㄦ牸缂撳瓨
+                }
+            });
+        });
+
+        //琛岄�夋嫨澶勭悊锛堥�昏緫锛�
+        form.on('select(HRelationCol)', function (data) {
+            //鑾峰彇涓嬫媺妗嗛�変腑鐨勫��
+            var elem = data.othis.parents('tr');
+            var dataindex = elem.attr("data-index");
+            $.each(option.data, function (index, value) {
+                if (value.LAY_TABLE_INDEX == dataindex) {
+                    value.HRelationCol = data.value;//鎶婇�変腑涓嬫媺妗唅d鍊艰祴鍊肩粰琛ㄦ牸缂撳瓨
+                }
+            });
+        });
+
+        //鏂板鏂规
+        form.on('submit(AddF_A)', function (data) {
+            layer.prompt({ title: '鏂板鏂规', formType: 0, maxlength: 50 }, function (text, index) {
+
+                for (var i = 0; i < TreeData.length; i++) {
+                    if (TreeData[i].title == text) {
+                        return layer.msg("宸插瓨鍦ㄧ浉鍚岀殑鏂规鍚�,璇烽噸鏂板綍鍏ワ紒");
+                    }
+                }
+                layer.close(index);
+                TreeData.push({ "TreeData": [], "id": "0", "title": text  });
+                MenuMain(TreeData);
+            });
+        });
+
+        //鍒犻櫎鏂规
+        form.on('submit(DelF_A)', function (data) {
+            if (HtitleId.length == 0) {
+                return layer.msg("璇烽�変腑闇�瑕佸垹闄ょ殑鏂规!");
+            }
+
+            if (HtitleId.title == "榛樿鏂规") {
+                return layer.msg("榛樿鏂规涓嶈兘鍒犻櫎!");
+            }
+            
+            layer.confirm('纭瑕佸垹闄ら�変腑鏂规鍚楋紵', function (index) {
+                var num = [];
+                for (var i = 0; i < TreeData.length; i++) {
+                    if (TreeData[i].id != HtitleId.id || TreeData[i].title != HtitleId.title) {
+                        num.push(TreeData[i]);
+                    }
+                }
+                if (HtitleId.id != "0") {
+                    $.ajax({
+                        url: GetWEBURL() + '/Xt_grdAlignment_WMES/Del_Gy_QueryConditionList_F_A',
+                        data: { "HModName": HModName, "ID": HtitleId.id, "user": sessionStorage["HUserName"] },
+                        async: false,
+                        type: "GET",
+                        success: function (data1) {
+                            if (data1.count == 1) {
+                                layer.msg(data1.Message);
+                            } else {
+                                layer.alert(data1.code + data1.Message, { icon: 5 });
+                            }
+                        }, error: function () {
+                            layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                        }
+                    });
+                } else {
+                    layer.msg("鍒犻櫎鎴愬姛!");
+                }
+                HtitleId = [];
+                layer.close(index);
+                TreeData = num;
+                MenuMain(TreeData);
+              
+            });
+        });
+
+        //淇濆瓨鏂规
+        form.on('submit(AddBtn)', function (data) {
+            if (HtitleId.length == 0) {
+                return layer.msg("璇烽�変腑闇�瑕佷繚瀛樼殑鏂规!");
+            }
+
+            layer.confirm('纭瑕佷繚瀛橀�変腑鏂规鍚楋紵', function (index) {
+                var TableData = table.cache["mainTable"];
+                var sMainStr = JSON.stringify(TableData);
+                var sMainStr1 = JSON.stringify(HtitleId);
+                var sMainSub = sMainStr + ';' + sMainStr1 + ';' + HModName + ";" + sessionStorage["HUserName"];
+                $.ajax({
+                    url: GetWEBURL() + '/Xt_grdAlignment_WMES/Add_Gy_QueryConditionList_F_A',
+                    data: { "sMainSub": sMainSub },
+                    async: false,
+                    type: "POST",
+                    success: function (data1) {
+                        if (data1.count == 1) {
+                            layer.msg(data1.Message);
+                            var index = parent.layer.getFrameIndex(window.name);
+                            //杩斿洖鏂规硶
+                            var TableDataSql = "";
+
+                            for (var i = 0; i < TableData.length; i++) {
+                                TableDataSql += get_FastQuery(TableData[i]);
+                            }
+                            parent.GetDataCol(TableDataSql);
+                            parent.layer.close(index);
+                        } else {
+                            layer.alert(data1.code + data1.Message, { icon: 5 });
+                        }
+                    }, error: function () {
+                        layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                    }
+                });
+            });
+        });
+
+        //#endregion
+
+
+        //#region 姝ら〉闈㈡墍鏈夋柟娉�
+        function set_ClearBill() {
+            set_InitGrid();
+            get_Display_Tree();
+            get_Display(sWhere);
+        }
+
+        //琛ㄦ牸鏁版嵁
+        function set_InitGrid() {
+            option = {
+                elem: '#mainTable'
+                , toolbar: '#toolbarDemo'
+                , height: 420
+                , cellMinWidth: 90
+                , limits: [50, 500, 5000, 50000]
+                , limit: 50
+                , cols: [[
+                    { field: 'HFieldNameCol', title: '瀛楁鍚嶇О', width: 100, templet: '#HFieldNameCol' }
+                    , { file: 'HControlCol', title: '姣旇緝鍏崇郴', width: 100, templet: '#HControlCol' }
+                    , { field: 'HConditionCol', title: '鏁板��', width: 100, edit: 'text' }
+                    , { field: 'HRelationCol', title: '閫昏緫', width: 100, templet: '#HRelationCol' }
+                    , { fixed: 'right', title: '鎿嶄綔', toolbar: '#barDemo' }
+                ]]
+            };
+            var rowdata = [{ "HFieldNameCol": "", "HControlCol": "", "HConditionCol": "", "HRelationCol": "and", "HIDCol": "" }]
+            option.data = rowdata;
+            table.render(option);
+        }
+
+
+        // 鏍戠姸鍥炬煡璇�
+        function get_Display_Tree() {
+            var ajaxLoad = layer.load();
+            $.ajax({
+                url: GetWEBURL() + '/Xt_grdAlignment_WMES/Gy_QueryConditionList_F_A',
+                data: { "HModName": HModName, "user": sessionStorage["HUserName"] },
+                async: false,
+                type: "GET",
+                success: function (data1) {
+                    if (data1.count == 1) {
+                        layer.close(ajaxLoad);
+                        var data = JSON.parse(data1.data);
+                        TreeData = data;
+                        MenuMain(data);
+                    } else {
+                        layer.close(ajaxLoad);
+                        layer.alert(data1.code + data1.Message, { icon: 5 });
+                    }
+                }, error: function () {
+                    layer.close(ajaxLoad);
+                    layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                }
+            });
+        }
+      
+        //閬嶅巻鐢熸垚涓昏彍鍗�
+        function MenuMain(data) {
+            var liStr = '[';
+            //閬嶅巻鐢熸垚涓昏彍鍗�
+            for (var i = 0; i < data.length; i++) {
+                if (data[i].title == "榛樿鏂规") {
+                    sWhere = " and HInterID=" + data[i].id;
+                }
+                liStr += '{"title": "' + data[i].title + '", "id": "' + data[i].id + '"},';
+            };
+            liStr = liStr.substring(0, liStr.length - 1);
+            liStr += "]";
+            var treeTable = JSON.parse(liStr);
+            tree.render({
+                elem: '#TreeTable' //榛樿鏄偣鍑昏妭鐐瑰彲杩涜鏀剁缉
+                , data: treeTable
+                , showLine: false  //鏄惁寮�鍚繛鎺ョ嚎
+                , click: function (obj) {
+                    //楂樹寒鍙樿壊
+                    $(".layui-tree-set").removeClass('layui-tree-set-active');
+                    obj.elem.addClass('layui-tree-set-active');
+
+                    var data = obj.data;  //鑾峰彇褰撳墠鐐瑰嚮鐨勮妭鐐规暟鎹�
+                    var sql = "";
+
+                    HtitleId = data;
+
+                    sql = " and HInterID='" + data.id + "' ";
+                    get_Display(sql);
+                }
+
+            });
+        }
+
+        function selectCol() {
+            colNames = colName.split(',');
+            var HFieldNameCol_s = "";
+            HFieldNameCol_s += '<option  style="color:blue;" value=""></option>';
+            for (var i = 0; i < colNames.length; i++) {
+                HFieldNameCol_s += '<option  style="color:blue;" value="' + colNames[i] + '">' + colNames[i] + '</option>';
+            }
+
+            for (var i = 0; i < option.data.length; i++) {
+                $('#HFieldNameCol' + (i + 1)).append(HFieldNameCol_s);;
+            }
+
+            for (var i = 1; i <= option.data.length; i++) {
+                $('#HFieldNameCol' + i + '').find("option[value='" + option.data[i - 1].HFieldNameCol + "']").attr("selected", true);
+                $('#HControlCol' + i + '').find("option[value='" + option.data[i - 1].HControlCol + "']").attr("selected", true);
+                $('#HRelationCol' + i + '').find("option[value='" + option.data[i - 1].HRelationCol + "']").attr("selected", true);
+            }
+
+            form.render('select');
+        }
+
+        //鏌ヨ
+        function get_Display(sWhere) {
+            var ajaxLoad = layer.load();
+            $.ajax({
+                url: GetWEBURL() + '/Xt_grdAlignment_WMES/Gy_QueryCondition_Z_D_select',
+                type: "GET",
+                async: false,
+                data: { "sWhere": sWhere, "user": sessionStorage["HUserName"], "Organization": sessionStorage["Organization"] },
+                success: function (data1) {
+                    if (data1.count == 1) {
+                        var colNames = [];//鐩稿鍗曟嵁浼犺繃鏉ョ殑鍒楀悕
+                        var cols = [];//瑕佷紶杩涜〃鏍肩殑鏁版嵁
+                        var dataCol = [];//鑾峰彇杩斿洖鏁版嵁
+                        dataCol = data1.data;
+                        option.data = dataCol;
+                        table.render(option);
+                        selectCol();
+                        //colNames = colName.split(',');
+                        //var HFieldNameCol_s = "";
+                        //for (var i = 0; i < colNames.length; i++) {
+                        //    HFieldNameCol_s += '<option  style="color:blue;" value="' + colNames[i] + '">' + colNames[i] + '</option>';
+                        //}
+
+                        //for (var i = 0; i < option.data.length; i++) {
+                        //    $('#HFieldNameCol' + (i + 1)).append(HFieldNameCol_s);;
+                        //}
+                        //form.render('select');
+
+
+                        //for (var i = 0; i < colNames.length; i++) {
+                        //    cols.push({ "HFieldNameCol": colNames[i], "HControlCol": "", "HConditionCol": "", "HRelationCol": "" })
+                        //}
+
+                        //for (var i = 0; i < colNames.length; i++) {
+                        //    for (var j = 0; j < dataCol.length; j++) {
+                        //        if (colNames[i] == dataCol[j]["HFieldNameCol"]) {
+                        //            cols[i]["HControlCol"] = dataCol[j]["HControlCol"];
+                        //            cols[i]["HConditionCol"] = dataCol[j]["HConditionCol"];
+                        //            cols[i]["HRelationCol"] = dataCol[j]["HRelationCol"];
+
+                        //            break;
+                        //        }
+                        //    }
+                        //}
+                        //option.data = cols;
+                        //table.render(option);
+
+                        //for (var i = 0; i < colNames.length; i++) {
+                        //    $('#HControlCol' + (i + 1)).find("option[value='" + option.data[i]["HControlCol"] + "']").attr("selected", true);
+                        //    $('#HRelationCol' + (i + 1)).find("option[value='" + option.data[i]["HRelationCol"] + "']").attr("selected", true);
+                        //}
+                        form.render('select');
+
+                        layer.close(ajaxLoad);
+                    } else {
+                        layer.close(ajaxLoad);
+                        layer.alert(data1.code + data1.Message, { icon: 5 });
+                    }
+                }, error: function () {
+                    layer.close(ajaxLoad);
+                    layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                }
+            });
+        }
+
+       
+
+        //琛屽唴鍒犻櫎
+        function set_GridDelete(obj) {
+            var rowIndex = $(obj.tr).attr("data-index");
+            if (obj.event === 'del') {
+                layer.confirm('鐪熺殑鍒犻櫎琛屽悧锛�', function (index) {
+                    if (rowIndex === '0') {
+                        layer.msg('棣栬鏃犳硶鍒犻櫎锛侊紒锛�');
+                    } else {
+                        var oldData = table.cache["mainTable"];
+                        oldData.splice(obj.tr.data('index'), 1)
+                        option.data = oldData;//灏嗘暟鎹粦瀹氬埌data涓�
+                        table.render(option);
+                        selectCol();
+                        layer.close(index);
+                    }
+                });
+            }
+        }
+
+        //鑾峰彇鍙傛暟
+        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
+        //浠ヤ笂鏄痩ayui妯″潡
+    });
+    function get_FastQuery(TableData) {
+
+        var ColName = TableData["HFieldNameCol"];//澶嶉�夋
+        var Comparator = TableData["HControlCol"];
+        var ColContent = TableData["HConditionCol"];
+        var HRelationCol = TableData["HRelationCol"];
+        var sWheres = "";
+
+        if (ColName != 0 && Comparator != 0) {
+            var com = "";
+            switch (Comparator) {
+                case "鍖呭惈":
+                    com = "like'%" + ColContent + "%'";
+                    break;
+                case "宸﹀寘鍚�":
+                    com = "like'%" + ColContent + "'";
+                    break;
+                case "鍙冲寘鍚�":
+                    com = "like'" + ColContent + "%'";
+                    break;
+                case "涓嶅寘鍚�":
+                    com = "not like'%" + ColContent + "%'";
+                    break;
+                default:
+                    com = "" + Comparator + "'" + ColContent + "'";
+                    break;
+            }
+            sWheres += HRelationCol + " " + ColName + " " + com;
+        }
+        return sWheres;
+    }
+</script>
\ No newline at end of file

--
Gitblit v1.9.1