From ccd87cec2f26f6a47d44f6c5b5cccf9f9861afbe Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期三, 26 二月 2025 09:18:27 +0800
Subject: [PATCH] 要料计划信息列表维护页面: 1.对任意字段过滤第二、第三个无效进行修复 2.对重置按钮无法重置任意字段过滤的过滤条件进行修复 3.过滤条件 车间 无法双击返回 4.过滤条件 车间 选择是首先根据组织进行过滤 5.点击记录时选中且高亮 6.列设置别名无法设置,统计行无效,最后一列无法设置
---
WebTM/layuiadmin/modules/tableSelect.js | 55 ++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 42 insertions(+), 13 deletions(-)
diff --git a/WebTM/layuiadmin/modules/tableSelect.js b/WebTM/layuiadmin/modules/tableSelect.js
index d0a2659..0c64501 100644
--- a/WebTM/layuiadmin/modules/tableSelect.js
+++ b/WebTM/layuiadmin/modules/tableSelect.js
@@ -10,7 +10,7 @@
table = layui.table,
form = layui.form;
var tableSelect = function () {
- this.v = '1.3.0';
+ this.v = '1.4.0';
};
/**
@@ -20,7 +20,7 @@
var elem = $(opt.elem);
//榛樿璁剧疆
- opt.searchKey = opt.searchKey || 'keyword';
+ opt.searchKey = opt.searchKey || 'keyword';//鍙涓敤锛屽垎鍓�
opt.table.page = opt.table.page || false;
opt.table.height = opt.table.height || 290;
elem.off('click').on('click', function(e) {
@@ -43,7 +43,7 @@
//娓叉煋TABLE
opt.table.elem = "#"+tableName;
opt.table.id = tableName;
- //鑻ユ病鏈墂here琛ㄧず涓哄墠绔垎椤�
+ //鑻ユ病鏈塽rl琛ㄧず涓哄墠绔垎椤�
if (opt.table.url != undefined) {
opt.table.where['sWhere'] = opt.sWhere
} else {
@@ -148,16 +148,16 @@
if (tr.length == 0) {
tableElem.find('tr:first').children('td').eq(0).click();
} else {
- tr.children('td').click();
- tr['prev']().children('td').click();
+ tr.children('td').eq(0).click();
+ tr['prev']().children('td').eq(0).click();
}
break;
case "ArrowDown"://涓嬮敭
if (tr.length == 0) {
- tr = tableElem.find('tr:first').children('td').eq(0).click();
+ tableElem.find('tr:first').children('td').eq(0).click();
} else {
- tr.children('td').click();
- tr['next']().children('td').click();
+ tr.children('td').eq(0).click();
+ tr['next']().children('td').eq(0).click();
}
break;
case "Enter"://鍥炶溅
@@ -167,13 +167,36 @@
}
})
+ // 闃叉姈鍑芥暟
+ function debounce(func, wait) {
+ let timeout;
+ return function () {
+ const context = this, args = arguments;
+ clearTimeout(timeout);
+ timeout = setTimeout(() => func.apply(context, args), wait);
+ };
+ }
+
+
//杈撳叆妗嗚緭鍏ユ墽琛�
- elem.off('input').on('input', function (e) {
+ elem.off('input').on('input', debounce(
+ function (e) {
// 闃绘琛ㄥ崟鎻愪氦锛堝鏋滆緭鍏ユ鍦ㄨ〃鍗曞唴锛�
e.preventDefault();
+ var searchKeyList = opt.searchKey.split(',');//鑾峰彇鏌ユ壘鐨勫叧閿瓧鎼滅储妗�
+ //鎷兼帴sql瀛楃涓�
+ var sWhereStr = " and ("
+ searchKeyList.forEach(function (value, index) {
+ if (index == 0) {
+ sWhereStr += (value + " like '%" + elem.val() + "%' ")
+ } else {
+ sWhereStr += ("or " + value + " like '%" + elem.val() + "%' ")
+ }
+ })
+ sWhereStr +=")"
//鍚庣鍒嗛〉鎼滅储
if (opt.table.where != undefined) {
- opt.table.where['sWhere'] = opt.sWhere + " and " + opt.searchKey + " like '%" + elem.val() + "%' ";
+ opt.table.where['sWhere'] = opt.sWhere + sWhereStr;
tableSelect_table.reload({
where: opt.table.where,
page: {
@@ -181,13 +204,13 @@
}
});
} else {
- var sWhere = opt.sWhere + " and " + opt.searchKey + " like '%" + elem.val() + "%' ";
+ var sWhere = opt.sWhere + sWhereStr;
tableSelect_table.reload({
data: opt.ajaxSelect(sWhere)
});
}
- })
+ },200))
//鍙屽嚮琛岄�変腑
table.on('rowDouble('+tableName+')', function(obj){
@@ -224,7 +247,13 @@
//鎸夐挳閫変腑
tableBox.find('.tableSelect_btn_select').on('click', function() {
var checkStatus = table.checkStatus(tableName);
- selectDone(checkStatus);
+ if (checkStatus.data.length > 0) {
+ selectDone(checkStatus);
+ } else {
+ tableBox.remove();
+ delete table.cache[tableName];
+ }
+
})
//鍐欏�煎洖璋冨拰鍏抽棴
--
Gitblit v1.9.1