duhe
2025-04-15 b16717b61d4804fcaeeb103f6602959eb5a5a0c6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
//高级过滤 HTableName是这个列表的视图名
function set_QueryCondition(option, HTableName, get_FastQuery) {
    var colName = "";
    var contentUrl = "";
    for (var i = 0; i < option.cols[0].length; i++) {
        if (option.cols[0][i]["field"] != undefined && option.cols[0][i]["hide"] != true) {
            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 进行编码
 
    contentUrl += '../基础资料/隐藏列设置/Gy_QueryCondition.html?HModName=' + HTableName + '&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']];
            GetDataCols += "and (";
            for (var i = 0; i < checkStatus.length; i++) {
                GetDataCols += myIframe.get_FastQuery(checkStatus[i]); //get_FastQuery()为子页面的方法
                if ((i + 1) < checkStatus.length) {
                    GetDataCols += " " + checkStatus[i]["HRelationCol"] + " ";
                }
            }
            GetDataCols += ")";
            //更新表格缓存的数据
            layer.close(index);//关闭弹窗
        }
        , end: function () {
            if (GetDataCols != "") {
                get_FastQuery();
            }
        }
    })
}
 
//#region 【过滤方案】
 
//获取当前用户的默认过滤方案
function get_DefaultModule(get_FastQuery) {
    $.ajax({
        url: GetWEBURL() + '/Xt_FastICScheme/Chooselist',
        type: "GET",
        async: false,
        data: { "user": sessionStorage["Czybm"], "HModuleName": HModuleName, "HInterID": 0, "Type": "Default" },
        success: function (data1) {
            if (data1.count == 1) {
                //当前用户设置有默认的过滤方案
                var data = data1.data;
                //当前选择的过滤方案
                HInterID_Choose = data[0].hmainid;
                //过滤方案内码
                HInterID = data[0].hmainid
                //过滤方案名称
                HDefaultFilter = data[0].方案名称
                //过滤方案的备注(方案信息描述)
                var HRemark = data[0].备注
                //显示出当前的默认过滤方案
                document.getElementById("HFilterScheme_Now").style.display = "block";
                document.getElementById('HFilterScheme_Now').innerHTML = "当前过滤方案:" + HDefaultFilter + '<span style="font-size: 15px; font-weight: bold; color:#7b90fb">  ' + "(" + HRemark + ")" + '</span>';
                //把过滤条件值回写到页面上
                for (let i = 0; i < data.length; i++) {
                    $("#" + data[i].过滤字段ID).val(data[i].过滤值);
                    if (data[i].过滤标签类型 == 'SELECT') {
                        $("#" + data[i].过滤字段ID).find("option[value='" + data[i].过滤值 + "']").attr("selected", true);
                    }
                }
 
                var HInitTimeCycle = $("#HInitTimeCycle").val() * 1;
                //若日期间隔不为 任意间隔,则禁用开始日期与结束日期的选择
                if (HInitTimeCycle != -1) {
                    //$('#HDate').prop('disabled', true);
                    //$('#HDate1').prop('disabled', true);
 
                    $("#HDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * HInitTimeCycle), "yyyy-MM-dd"));
                    $("#HDate1").val(Format(new Date(), "yyyy-MM-dd"));
 
                    //执行查询方法
                    get_FastQuery();
                } else {
                    //$('#HDate').prop('disabled', false);
                    //$('#HDate1').prop('disabled', false);
                }
 
 
                //执行查询方法
                get_FastQuery()
                //form.render("select");
            } else {
                //当前用户没有设置默认的过滤方案
                //隐藏显示过滤方案的标签信息
                document.getElementById("HFilterScheme_Now").style.display = "none";
                //执行查询方法
                //get_FastQuery()
                //form.render("select");
            }
        }, error: function () {
            layer.alert("接口请求失败!", { icon: 5 });
        }
    });
}
 
//保存方案
function set_SaveScheme(get_FastQuery) {
    var index = layer.open()
    //判断用户是否点击了右上角的“叉号”关闭弹窗页面
    var HIsClose_Manual = false;
    //获取本页所有过滤条件对象(class中包含"ForFilteringSchemes"的元素)
    var Filter = document.getElementsByClassName(HClassTag);
 
    var HFilterIdList = "";//过滤条件
    var HFilterIdLists = "";//拼接多个过滤条件
    var HValue = "";//过滤值
    var HElement_type = "";//过滤标签类型
 
    for (var i = 0; i < Filter.length; i++) {
        HFilterIdList = Filter[i].id; //过滤条件ID
        HFilterIdLists += Filter[i].id + ","; //过滤条件ID(拼接)
        HValue += $("#" + HFilterIdList).val() + ","; //过滤条件中输入的值
        HElement_type += document.getElementById(HFilterIdList).tagName + ",";//通过标签id获取标签类型
    }
 
    //去除末尾逗号
    HFilterIdLists = HFilterIdLists.substring(0, HFilterIdLists.length - 1);
    HValue = HValue.substring(0, HValue.length - 1);
    HElement_type = HElement_type.substring(0, HElement_type.length - 1);
 
    //当前页面上没有选择过滤方案,进入新增方法
    if (HDefaultFilter == "") {
        layer.open({
            type: 2
            , area: ['40%', '80%']
            , title: '过滤方案'
            , shift: 0//弹出动画
            , content: '../../系统管理/过滤方案设置/Xt_FastICScheme.html?OperationType=1&HModuleName=' + HModuleName + '&HFilterIdLists=' + HFilterIdLists + '&HValue=' + HValue + '&HElement_type=' + HElement_type
            , cancel: function () {
                // 右上角关闭事件的逻辑
                HIsClose_Manual = true;
            }
            , end: function () {
                if (HIsClose_Manual != true) {
                    get_FastQuery();
                    //显示当前的过滤方案
                    document.getElementById("HFilterScheme_Now").style.display = "block";
                    document.getElementById('HFilterScheme_Now').innerHTML = "当前过滤方案:" + sessionStorage["HFilterSchemeName_" + sessionStorage["Czybm"]] + '<span style="font-size: 15px; font-weight: bold; color:#7b90fb">  ' + "(" + sessionStorage["HFilterSchemeRemark_" + sessionStorage["Czybm"]] + ")" + '</span>';
                }
            }
        })
        layer.close(index)
    } else {
        //当前页面已有过滤方案,用户选择 新增或者编辑
        layer.confirm('当前已选择过滤方案,是否修改?请选择对应操作', {
            title: "操作提示",
            icon: 0,
            btn: ['新增方案', '保存修改当前方案', '取消']
        }, function (index, layero) {
            //新增
            layer.open({
                type: 2
                , area: ['40%', '80%']
                , title: '过滤方案'
                , shift: 0//弹出动画
                , content: '../../系统管理/过滤方案设置/Xt_FastICScheme.html?OperationType=1&HModuleName=' + HModuleName + '&HFilterIdLists=' + HFilterIdLists + '&HValue=' + HValue + '&HElement_type=' + HElement_type
                , end: function () {
                    get_FastQuery()
                    //显示当前的过滤方案
                    document.getElementById("HFilterScheme_Now").style.display = "block";
                    document.getElementById('HFilterScheme_Now').innerHTML = "当前过滤方案:" + sessionStorage["HFilterSchemeName_" + sessionStorage["Czybm"]] + '<span style="font-size: 15px; font-weight: bold; color:#7b90fb">  ' + "(" + sessionStorage["HFilterSchemeRemark_" + sessionStorage["Czybm"]] + ")" + '</span>';
                }
            })
            layer.close(index)
        }, function (index) {
            //编辑
            var Filter_Edit = document.getElementsByClassName(HClassTag); //获取本页所有过滤条件对象(class中包含"ForFilteringSchemes"的元素)
            HFilterIdList = "";
            HFilterIdLists = "";
            HValue = "";
            HElement_type = "";
            for (var i = 0; i < Filter_Edit.length; i++) {
                HFilterIdList = Filter_Edit[i].id; //过滤条件ID
                HFilterIdLists += Filter_Edit[i].id + ","; //过滤条件ID(拼接)
                HValue += $("#" + HFilterIdList).val() + ","; //过滤条件中输入的值
                HElement_type += document.getElementById(HFilterIdList).tagName + ",";//通过标签id获取标签类型
            }
            //去除末尾逗号
            HFilterIdLists = HFilterIdLists.substring(0, HFilterIdLists.length - 1);
            HValue = HValue.substring(0, HValue.length - 1);
            HElement_type = HElement_type.substring(0, HElement_type.length - 1);
 
            var sMainSub = HInterID_Choose + ';' + HFilterIdLists + ';' + HValue + ';' + HElement_type + ';' + sessionStorage["Czybm"] + ';' + 3;
 
            //修改
            $.ajax({
                type: "POST",
                url: GetWEBURL() + "/Xt_FastICScheme/save", //方法所在页面和方法名
                async: true,
                data: { "oMain": sMainSub },
                dataType: "json",
                success: function (data) {
                    if (data.count == 1) { // 说明验证成功了,
                        layer.msg(data.Message, { time: 1 * 1000, icon: 1 });
                    }
                    else {
 
                    }
                    layer.closeAll("loading");
                },
                error: function (err) {
 
 
                }
            });
            layer.close(index)
        }, function (index) {
            //取消
            layer.alert('取消')
            layer.close(index)
        });
    }
 
}
 
//读取方案
function set_ReadScheme(get_FastQuery) {
    var HIsClose_Manual = false;
    var Filter = document.getElementsByClassName(HClassTag); //获取本页所有过滤条件对象(class中包含"ForFilteringSchemes"的元素)
 
    var HFilterIdList = "";
    var HFilterIdLists = "";
    var HValue = "";
    var HElement_type = "";
    for (var i = 0; i < Filter.length; i++) {
        HFilterIdList = Filter[i].id; //过滤条件ID
        HFilterIdLists += Filter[i].id + ","; //过滤条件ID(拼接)
        HValue += $("#" + HFilterIdList).val() + ","; //过滤条件中输入的值
        HElement_type += document.getElementById(HFilterIdList).tagName + ",";//通过标签id获取标签类型
    }
    //去除末尾逗号
    HFilterIdLists = HFilterIdLists.substring(0, HFilterIdLists.length - 1);
    HValue = HValue.substring(0, HValue.length - 1);
    HElement_type = HElement_type.substring(0, HElement_type.length - 1);
 
    layer.open({
        type: 2
        , area: ['80%', '80%']
        , title: '过滤方案列表'
        , shift: 0//弹出动画
        , content: '../../系统管理/过滤方案设置/Xt_FastICSchemeList.html?HType=Select&HFilterIdLists=' + HFilterIdLists + '&HValue=' + HValue + '&HElement_type=' + HElement_type + '&HModuleName=' + HModuleName
        , cancel: function () {
            // 右上角关闭事件的逻辑
            HIsClose_Manual = true;
        }
        , end: function () {
            if (HIsClose_Manual != true) {
                get_FastQuery()
                form.render("select");
            }
        }
    })
}
 
//#region 【过滤方案返回数据】
function HFilterScheme(obj)  //返回过滤方案
{
    var HInterID = obj[0].hmainid;
    HInterID_Choose = obj[0].hmainid;
    $.ajax({
        url: GetWEBURL() + '/Xt_FastICScheme/Chooselist',
        type: "GET",
        data: { "user": sessionStorage["Czybm"], "HModuleName": HModuleName, "HInterID": HInterID, "Type": "Select" },
        success: function (data1) {
            if (data1.count == 1) {
                var data = data1.data;
                //赋值过滤方案名称
                HDefaultFilter = data[0].方案名称
                var HRemark = data[0].备注
                //显示当前的过滤方案
                document.getElementById("HFilterScheme_Now").style.display = "block";
                document.getElementById('HFilterScheme_Now').innerHTML = "当前过滤方案:" + HDefaultFilter + '<span style="font-size: 15px; font-weight: bold; color:#7b90fb">  ' + "(" + HRemark + ")" + '</span>';
                HInterID = data[0].hmainid
                //根据选择的过滤方案回填数据到列表过滤条件
                for (let i = 0; i < data.length; i++) {
                    $("#" + data[i].过滤字段ID).val(data[i].过滤值);
                    if (data[i].过滤标签类型 == 'SELECT') {
                        $("#" + data[i].过滤字段ID).find("option[value='" + data[i].过滤值 + "']").attr("selected", true);
                    }
                }
 
            } else {
                layer.close(ajaxLoad);
                layer.alert(data1.code + data1.Message, { icon: 5 });
            }
        }, error: function () {
            layer.close(ajaxLoad);
            layer.alert("接口请求失败!", { icon: 5 });
        }
    });
}
//#endregion
 
//#endregion