|
|
@@ -149,6 +149,15 @@
|
|
|
<!--<a id="tccs">弹窗测试</a>-->
|
|
|
<div id="win" class="easyui-window" title="小标签列表" style="padding:10px;width:988px;height:500px;display:none;" data-options="resizable:false,closed:true,modal:true">
|
|
|
<div style="margin:5px auto;">小标签代码:<input name="small_label_enter" value="" type="num" style="width:85%;" id="small_label_enter"></div>
|
|
|
+ <div style="margin:5px auto;">
|
|
|
+ 批量选中:
|
|
|
+ 从:
|
|
|
+ <input name="small_start" value="" type="text" style="width:10%;" id="small_start">
|
|
|
+ 到
|
|
|
+ <input name="small_end" value="" type="text" style="width:10%;" id="small_end">
|
|
|
+ <button id="btn_yes">导出</button>
|
|
|
+ <button id="btn_no">不导出</button>
|
|
|
+ </div>
|
|
|
<table id=supTgGridS width="100%" border="1" cellspacing="0" cellpadding="0">
|
|
|
</table>
|
|
|
</div>
|
|
|
@@ -507,6 +516,102 @@
|
|
|
|
|
|
});
|
|
|
|
|
|
+ let currentRowData = null; // 当前大标签行数据
|
|
|
+ let bt_is_load = true;
|
|
|
+
|
|
|
+ function updateSmallLabelStatusInView(id, status) {
|
|
|
+ $('#supTgGridS tr[data-id]').each(function () {
|
|
|
+ const rowId = $(this).attr('data-id'); // 直接从属性取
|
|
|
+ if (rowId == id) {
|
|
|
+ const statusTd = $(this).find('td').eq(3); // 状态列现在是第 4 列
|
|
|
+ if (status == 1) {
|
|
|
+ statusTd.text("已删除").css("color", "red");
|
|
|
+ } else {
|
|
|
+ statusTd.text("正常").css("color", "green");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //批量状态更新函数(通用)
|
|
|
+ function batchUpdateLabels(start, end, mode) {
|
|
|
+ if (isNaN(start) || isNaN(end)) {
|
|
|
+ alert("请输入正确的序号范围");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ let to_set_deleted = []; // 设为已删除(status=1)
|
|
|
+ let to_set_normal = []; // 设为正常(status=0)
|
|
|
+ let large_id = $('#large_id').val();
|
|
|
+
|
|
|
+ $('#supTgGridS tr[data-id]').each(function () {
|
|
|
+ const seq = parseInt($(this).find('td').eq(0).text()); // 现在的第1列是序号
|
|
|
+ const id = $(this).attr('data-id'); // ✅ 用 data-id 来定位ID
|
|
|
+
|
|
|
+ if (mode === 'noexport') {
|
|
|
+ if (seq >= start && seq <= end) {
|
|
|
+ to_set_deleted.push(id);
|
|
|
+ } else {
|
|
|
+ to_set_normal.push(id);
|
|
|
+ }
|
|
|
+ } else if (mode === 'export') {
|
|
|
+ if (seq >= start && seq <= end) {
|
|
|
+ to_set_normal.push(id);
|
|
|
+ } else {
|
|
|
+ to_set_deleted.push(id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ console.log("🔴 设为已删除(status=1)ID:", to_set_deleted);
|
|
|
+ console.log("🟢 设为正常(status=0)ID:", to_set_normal);
|
|
|
+
|
|
|
+ $.messager.progress({ title: '提示', msg: '正在批量更新状态,请稍候...' });
|
|
|
+
|
|
|
+ $.ajax({
|
|
|
+ url: "index.php?s=/Admin/NewQcode/batchChangeStatus",
|
|
|
+ type: "post",
|
|
|
+ dataType: "json",
|
|
|
+ data: {
|
|
|
+ large_id: large_id,
|
|
|
+ to_set_deleted: to_set_deleted.join(","),
|
|
|
+ to_set_normal: to_set_normal.join(",")
|
|
|
+ },
|
|
|
+ success: function (res) {
|
|
|
+ $.messager.progress('close');
|
|
|
+ if (res.code === 200) {
|
|
|
+ const msg = (mode === 'export') ? '批量“导出”完成' : '批量“不导出”完成';
|
|
|
+ $.messager.alert('系统提示', msg, 'info');
|
|
|
+
|
|
|
+ // ✅ 成功后,直接更新页面显示的状态
|
|
|
+ to_set_deleted.forEach(id => updateSmallLabelStatusInView(id, 1));
|
|
|
+ to_set_normal.forEach(id => updateSmallLabelStatusInView(id, 0));
|
|
|
+
|
|
|
+ } else {
|
|
|
+ $.messager.alert('系统提示', '处理失败:' + res.error, 'error');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function (err) {
|
|
|
+ $.messager.progress('close');
|
|
|
+ $.messager.alert('系统提示', '网络错误,批量处理失败!', 'error');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //导出按钮:范围内设为已删除,范围外设为正常
|
|
|
+ $('#btn_yes').on('click', function () {
|
|
|
+ const start = parseInt($('#small_start').val());
|
|
|
+ const end = parseInt($('#small_end').val());
|
|
|
+ batchUpdateLabels(start, end, 'export');
|
|
|
+ });
|
|
|
+
|
|
|
+ //不导出按钮:范围内设为正常,范围外设为已删除
|
|
|
+ $('#btn_no').on('click', function () {
|
|
|
+ const start = parseInt($('#small_start').val());
|
|
|
+ const end = parseInt($('#small_end').val());
|
|
|
+ batchUpdateLabels(start, end, 'noexport');
|
|
|
+ });
|
|
|
+
|
|
|
supTgGrid = $('#supTgGrid').datagrid({
|
|
|
url: 'index.php?s=/Admin/NewQcode/GetLargeLabelApi',
|
|
|
method: 'get',
|
|
|
@@ -582,7 +687,8 @@
|
|
|
success: function (data) {
|
|
|
//console.log(data);
|
|
|
var result = "<tr style='background: #f5f5f5;'>" +
|
|
|
- "<td width='60%' align='center'>标签代码</td>" +
|
|
|
+ "<td width='8%' align='center'>序号</td>" +
|
|
|
+ "<td width='52%' align='center'>标签代码</td>" +
|
|
|
"<td width='8%' align='center'>当前序号</td>" +
|
|
|
"<td width='8%' align='center'>标签状态</td>" +
|
|
|
"<td width='8%' align='center'>打印次数</td>" +
|
|
|
@@ -597,7 +703,8 @@
|
|
|
tip = "已删除"
|
|
|
color = "red";
|
|
|
}
|
|
|
- result += "<tr data_id='" + index + "'>" +
|
|
|
+ result += "<tr data-id='" + item.id + "'>" +
|
|
|
+ "<td align='center' >" + item.l_flows + "</td>" +
|
|
|
"<td >" + item.code + "</td>" +
|
|
|
"<td align='center' >" + item.l_flow+ "</td>" +
|
|
|
"<td align='center' style='color:" + color + "'>" + tip + "</td>" +
|
|
|
@@ -1873,48 +1980,106 @@
|
|
|
|
|
|
$('#reptWin3').window('close');
|
|
|
}
|
|
|
- function yes(id,large_id){
|
|
|
- //alert(id,large_id);
|
|
|
- //修改对应的小标签的状态为正常
|
|
|
- $.ajax({
|
|
|
- url:"index.php?s=/Admin/NewQcode/changestatus",
|
|
|
- data:"large_id="+large_id+"&status=0&id="+id,
|
|
|
- type:"get",
|
|
|
- dataType:'json',
|
|
|
- success:function(data){
|
|
|
- console.log(data);
|
|
|
- if(data.info){
|
|
|
- $.messager.alert('系统提示', data.info, 'info');
|
|
|
- }else{
|
|
|
- $.messager.alert('系统提示', data.error, 'info');
|
|
|
- }
|
|
|
- },
|
|
|
- error:function(error){
|
|
|
|
|
|
- }
|
|
|
- });
|
|
|
- //alert($(this).attr('data'));
|
|
|
- }
|
|
|
- function no(id,large_id){
|
|
|
- //修改对应的小标签状态为已删除
|
|
|
- $.ajax({
|
|
|
- url:"index.php?s=/Admin/NewQcode/changestatus",
|
|
|
- data:"large_id="+large_id+"&status=1&id="+id,
|
|
|
- type:"get",
|
|
|
- dataType:'json',
|
|
|
- success:function(data){
|
|
|
- console.log(data);
|
|
|
- if(data.info){
|
|
|
- $.messager.alert('系统提示', data.info, 'info');
|
|
|
- }else{
|
|
|
- $.messager.alert('系统提示', data.error, 'info');
|
|
|
- }
|
|
|
- },
|
|
|
- error:function(error){
|
|
|
+ // function yes(id,large_id){
|
|
|
+ // //alert(id,large_id);
|
|
|
+ // //修改对应的小标签的状态为正常
|
|
|
+ // $.ajax({
|
|
|
+ // url:"index.php?s=/Admin/NewQcode/changestatus",
|
|
|
+ // data:"large_id="+large_id+"&status=0&id="+id,
|
|
|
+ // type:"get",
|
|
|
+ // dataType:'json',
|
|
|
+ // success:function(data){
|
|
|
+ // console.log(data);
|
|
|
+ // if(data.info){
|
|
|
+ // $.messager.alert('系统提示', data.info, 'info');
|
|
|
+ // }else{
|
|
|
+ // $.messager.alert('系统提示', data.error, 'info');
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // error:function(error){
|
|
|
+ //
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // //alert($(this).attr('data'));
|
|
|
+ // }
|
|
|
+ // function no(id,large_id){
|
|
|
+ // //修改对应的小标签状态为已删除
|
|
|
+ // $.ajax({
|
|
|
+ // url:"index.php?s=/Admin/NewQcode/changestatus",
|
|
|
+ // data:"large_id="+large_id+"&status=1&id="+id,
|
|
|
+ // type:"get",
|
|
|
+ // dataType:'json',
|
|
|
+ // success:function(data){
|
|
|
+ // console.log(data);
|
|
|
+ // if(data.info){
|
|
|
+ // $.messager.alert('系统提示', data.info, 'info');
|
|
|
+ // }else{
|
|
|
+ // $.messager.alert('系统提示', data.error, 'info');
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // error:function(error){
|
|
|
+ //
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ function yes(id, large_id) {
|
|
|
+ $.ajax({
|
|
|
+ url: "index.php?s=/Admin/NewQcode/changestatus",
|
|
|
+ data: "large_id=" + large_id + "&status=0&id=" + id,
|
|
|
+ type: "get",
|
|
|
+ dataType: 'json',
|
|
|
+ success: function (data) {
|
|
|
+ console.log(data);
|
|
|
+ // if (data.info) {
|
|
|
+ // $.messager.alert('系统提示', data.info, 'info');
|
|
|
+
|
|
|
+ // 获取当前行并打印调试信息
|
|
|
+ const row = $("tr[data-id='" + id + "']");
|
|
|
+ console.log("找到的行:", row);
|
|
|
+ const statusTd = row.find('td').eq(3);
|
|
|
+ console.log("当前状态:", statusTd.text());
|
|
|
+
|
|
|
+ // 更新状态
|
|
|
+ statusTd.text("正常").css("color", "green");
|
|
|
+ // } else {
|
|
|
+ // $.messager.alert('系统提示', data.error, 'info');
|
|
|
+ // }
|
|
|
+ },
|
|
|
+ error: function () {
|
|
|
+ $.messager.alert('系统提示', '网络错误', 'error');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ function no(id, large_id) {
|
|
|
+ $.ajax({
|
|
|
+ url: "index.php?s=/Admin/NewQcode/changestatus",
|
|
|
+ data: "large_id=" + large_id + "&status=1&id=" + id,
|
|
|
+ type: "get",
|
|
|
+ dataType: 'json',
|
|
|
+ success: function (data) {
|
|
|
+ console.log(data);
|
|
|
+ // if (data.info) {
|
|
|
+ // $.messager.alert('系统提示', data.info, 'info');
|
|
|
+
|
|
|
+ // 获取当前行并打印调试信息
|
|
|
+ const row = $("tr[data-id='" + id + "']");
|
|
|
+ console.log("找到的行:", row);
|
|
|
+ const statusTd = row.find('td').eq(3);
|
|
|
+ console.log("当前状态:", statusTd.text());
|
|
|
+
|
|
|
+ // 更新状态
|
|
|
+ statusTd.text("已删除").css("color", "red");
|
|
|
+ // } else {
|
|
|
+ // $.messager.alert('系统提示', data.error, 'info');
|
|
|
+ // }
|
|
|
+ },
|
|
|
+ error: function () {
|
|
|
+ $.messager.alert('系统提示', '网络错误', 'error');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
function p_small(id,index){
|
|
|
|
|
|
|