测试问题修改
This commit is contained in:
parent
359af7146b
commit
0033282ca0
|
|
@ -349,8 +349,8 @@ function initTable() {
|
|||
sort:true,
|
||||
templet: function (d) {
|
||||
if (d.remark) {
|
||||
if (d.remark.length > 60) {
|
||||
return '<span title="' + d.remark + '">' + d.remark.substring(0, 60) + '...</span>'
|
||||
if (d.remark.length > 20) {
|
||||
return '<span title="' + d.remark + '">' + d.remark.substring(0, 20) + '...</span>'
|
||||
} else {
|
||||
return '<span title="' + d.remark + '">' + d.remark + '</span>'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ function queryTable(type) {
|
|||
reloadTable(1);
|
||||
} else if (type === 2) {
|
||||
$('#keyWord').val('');
|
||||
$('#status').val('');
|
||||
layui.form.render();
|
||||
reloadTable(1);
|
||||
}
|
||||
|
|
@ -44,6 +45,7 @@ function reloadTable(pageNum) {
|
|||
where: {
|
||||
encryptedData: JSON.stringify({
|
||||
'keyWord': $('#keyWord').val(),
|
||||
'status': $('#status').val(),
|
||||
applyType:'0'
|
||||
}),
|
||||
},
|
||||
|
|
@ -64,6 +66,7 @@ function initTable() {
|
|||
where: {
|
||||
encryptedData: JSON.stringify({
|
||||
'keyWord': $('#keyWord').val(),
|
||||
'status': $('#status').val(),
|
||||
applyType:'0'
|
||||
}),
|
||||
},
|
||||
|
|
@ -193,6 +196,7 @@ function initTable() {
|
|||
function exportExcel() {
|
||||
let params = {
|
||||
'keyWord': $('#keyWord').val(),
|
||||
'status': $('#status').val(),
|
||||
applyType:'0'
|
||||
}
|
||||
let url = dataUrl + "backstage/carNeedPlan/export";
|
||||
|
|
|
|||
|
|
@ -246,7 +246,8 @@ function addFitDatas(data) {
|
|||
$.each(newJjDataArr, function (index, item) {
|
||||
updateOrAddObject(item.id, item);
|
||||
});
|
||||
setTableData(jjDataArr);
|
||||
goOnAddData();
|
||||
// setTableData(jjDataArr);
|
||||
} else { // 第一次添加数据
|
||||
jjDataArr = JSON.parse(data);
|
||||
if (jjDataArr && jjDataArr.length > 0) {
|
||||
|
|
@ -258,9 +259,11 @@ function addFitDatas(data) {
|
|||
}
|
||||
|
||||
function updateOrAddObject(id, newObject) {
|
||||
const index = jjDataArr.findIndex(obj => obj.id === parseInt(id));
|
||||
const index = jjDataArr.findIndex(obj => parseInt(obj.id) === parseInt(id));
|
||||
if (index !== -1) {
|
||||
// 如果对象存在,则替换它
|
||||
let oldData = jjDataArr[index];
|
||||
newObject.dataId = oldData.dataId;
|
||||
jjDataArr[index] = newObject;
|
||||
} else {
|
||||
// 如果对象不存在,则添加到数组
|
||||
|
|
@ -281,7 +284,7 @@ function setTableData(results) {
|
|||
html += '<td><input onclick="sel(this.checked,this,' + l.id + ')" name="check" type="checkbox"></td>';
|
||||
html += "<td style='vertical-align:middle;' class='center hidden-480'>"
|
||||
+ (i + 1) + "</td>";
|
||||
html += "<td>" + l.type + "</td>";
|
||||
html += "<td>" + (l.type === '1' ? '车辆':'吊车') + "</td>";
|
||||
html += "<td>" + l.name + "</td>";
|
||||
html += "<td>" + l.model + "</td>";
|
||||
html += "<td>" + l.unit + "</td>";
|
||||
|
|
@ -361,18 +364,65 @@ function delFitType() {
|
|||
}
|
||||
}
|
||||
}
|
||||
delIdArr.splice(0, delIdArr.length);
|
||||
if (jjDataArr.length === 0) {
|
||||
$('#no_data_title').removeAttr('style');
|
||||
$('#search-info').css({ 'display': 'none' });
|
||||
$('#table-box').css({ 'display': 'none' });
|
||||
} else {
|
||||
setTableData(jjDataArr);
|
||||
// setTableData(jjDataArr);
|
||||
handleDelTableData(delIdArr);
|
||||
}
|
||||
|
||||
delIdArr.splice(0, delIdArr.length);
|
||||
});
|
||||
}
|
||||
|
||||
// 删除表格数据
|
||||
function handleDelTableData(delIdArr) {
|
||||
if (delIdArr.length > 0) {
|
||||
$.each(delIdArr, function (index, item) {
|
||||
$('#baseTable tbody tr').each(function () {
|
||||
let id = $(this).attr('id');
|
||||
if (parseInt(id) === item) {
|
||||
$(this).remove();
|
||||
return false;
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
$('#baseTable tbody tr').each(function (index, item) {
|
||||
$(this).find('td').eq(1).html(index + 1);
|
||||
})
|
||||
}
|
||||
|
||||
// 继续添加数据
|
||||
function goOnAddData() {
|
||||
if (jjDataArr.length > 0) {
|
||||
$.each(jjDataArr, function (index, item) {
|
||||
$('#baseTable tbody tr').each(function () {
|
||||
let id = $(this).attr('id');
|
||||
if (parseInt(id) === parseInt(item.id)) {
|
||||
let times = $(this).find('td').eq(7).find('input[name="times"]').val(),
|
||||
needNum = $(this).find('td').eq(6).find('input[name="needNum"]').val(),
|
||||
remark = $(this).find('td').eq(8).find('input[name="remarks"]').val();
|
||||
if (!item.times || item.times === 0) {
|
||||
item.times = times;
|
||||
}
|
||||
if (!item.needNum || item.needNum === 0) {
|
||||
item.needNum = needNum;
|
||||
}
|
||||
if (!item.needNum || item.remark === 0) {
|
||||
item.remark = remark;
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
setTableData(jjDataArr);
|
||||
$('#baseTable tbody tr').each(function (index, item) {
|
||||
$(this).find('td').eq(1).html(index + 1);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 校验数据
|
||||
function checkValue(that, type, name) {
|
||||
let value = $(that).val();
|
||||
|
|
|
|||
|
|
@ -20,6 +20,13 @@ function setParams(obj) {
|
|||
form.on('submit(formData)', function (data) {
|
||||
submitApply(data);
|
||||
});
|
||||
form.on('radio(type)', function (data) {
|
||||
$('#baseTable tbody').empty();
|
||||
jjDataArr.splice(0, jjDataArr.length);
|
||||
$('#no_data_title').removeAttr('style');
|
||||
$('#search-info').css({ 'display': 'none' });
|
||||
$('#table-box').css({ 'display': 'none' });
|
||||
});
|
||||
form.render();
|
||||
getProList();
|
||||
});
|
||||
|
|
@ -174,16 +181,10 @@ function addFitDatas(data) {
|
|||
if (jjDataArr.length > 0) { // 继续添加数据
|
||||
let newJjDataArr = JSON.parse(data);
|
||||
// 如何切换了类型,则清空之前的数据
|
||||
let oldType = jjDataArr[0].type;
|
||||
let newType = newJjDataArr[0].type;
|
||||
if (oldType === newType) {
|
||||
$.each(newJjDataArr, function (index, item) {
|
||||
updateOrAddObject(item.id, item);
|
||||
});
|
||||
setTableData(jjDataArr);
|
||||
} else {
|
||||
setTableData(newJjDataArr);
|
||||
}
|
||||
$.each(newJjDataArr, function (index, item) {
|
||||
updateOrAddObject(item.id, item);
|
||||
});
|
||||
goOnAddData();
|
||||
} else { // 第一次添加数据
|
||||
jjDataArr = JSON.parse(data);
|
||||
if (jjDataArr && jjDataArr.length > 0) {
|
||||
|
|
@ -218,7 +219,7 @@ function setTableData(results) {
|
|||
html += '<td><input onclick="sel(this.checked,this,' + l.id + ')" name="check" type="checkbox"></td>';
|
||||
html += "<td style='vertical-align:middle;' class='center hidden-480'>"
|
||||
+ (i + 1) + "</td>";
|
||||
html += "<td>" + l.type + "</td>";
|
||||
html += "<td>" + (l.type === '1' ? '车辆' : '吊车') + "</td>";
|
||||
html += "<td>" + l.name + "</td>";
|
||||
html += "<td>" + l.model + "</td>";
|
||||
html += "<td>" + l.unit + "</td>";
|
||||
|
|
@ -298,18 +299,65 @@ function delFitType() {
|
|||
}
|
||||
}
|
||||
}
|
||||
delIdArr.splice(0, delIdArr.length);
|
||||
if (jjDataArr.length === 0) {
|
||||
$('#no_data_title').removeAttr('style');
|
||||
$('#search-info').css({ 'display': 'none' });
|
||||
$('#table-box').css({ 'display': 'none' });
|
||||
} else {
|
||||
setTableData(jjDataArr);
|
||||
// setTableData(jjDataArr);
|
||||
handleDelTableData(delIdArr);
|
||||
}
|
||||
|
||||
delIdArr.splice(0, delIdArr.length);
|
||||
});
|
||||
}
|
||||
|
||||
// 删除表格数据
|
||||
function handleDelTableData(delIdArr) {
|
||||
if (delIdArr.length > 0) {
|
||||
$.each(delIdArr, function (index, item) {
|
||||
$('#baseTable tbody tr').each(function () {
|
||||
let id = $(this).attr('id');
|
||||
if (parseInt(id) === item) {
|
||||
$(this).remove();
|
||||
return false;
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
$('#baseTable tbody tr').each(function (index, item) {
|
||||
$(this).find('td').eq(1).html(index + 1);
|
||||
})
|
||||
}
|
||||
|
||||
// 继续添加数据
|
||||
function goOnAddData() {
|
||||
if (jjDataArr.length > 0) {
|
||||
$.each(jjDataArr, function (index, item) {
|
||||
$('#baseTable tbody tr').each(function () {
|
||||
let id = $(this).attr('id');
|
||||
if (parseInt(id) === parseInt(item.id)) {
|
||||
let times = $(this).find('td').eq(7).find('input[name="times"]').val(),
|
||||
needNum = $(this).find('td').eq(6).find('input[name="needNum"]').val(),
|
||||
remark = $(this).find('td').eq(8).find('input[name="remarks"]').val();
|
||||
if (!item.times || item.times === 0) {
|
||||
item.times = times;
|
||||
}
|
||||
if (!item.needNum || item.needNum === 0) {
|
||||
item.needNum = needNum;
|
||||
}
|
||||
if (!item.needNum || item.remark === 0) {
|
||||
item.remark = remark;
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
setTableData(jjDataArr);
|
||||
$('#baseTable tbody tr').each(function (index, item) {
|
||||
$(this).find('td').eq(1).html(index + 1);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 校验数据
|
||||
function checkValue(that, type, name) {
|
||||
let value = $(that).val();
|
||||
|
|
@ -321,7 +369,7 @@ function checkValue(that, type, name) {
|
|||
}
|
||||
}
|
||||
if (type === 1) { // 需用量不能超过10
|
||||
if(parseInt(value) > 10){
|
||||
if (parseInt(value) > 10) {
|
||||
layer.msg('' + name + '不能超过10,请重新输入!', { icon: 5 })
|
||||
$(that).val(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ function setTableData(results) {
|
|||
html += '<td><input onclick="sel(this.checked,this,' + l.id + ')" name="check" type="checkbox"></td>';
|
||||
html += "<td style='vertical-align:middle;' class='center hidden-480'>"
|
||||
+ (i + 1) + "</td>";
|
||||
html += "<td>" + l.type + "</td>";
|
||||
html += "<td>" + (l.type === '1' ? '车辆':'吊车') + "</td>";
|
||||
html += "<td>" + l.name + "</td>";
|
||||
html += "<td>" + l.model + "</td>";
|
||||
html += "<td>" + l.unit + "</td>";
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@
|
|||
<button class="layui-btn layui-btn-primary" onclick="queryTable(2)"><i
|
||||
class="layui-icon layui-icon-refresh"></i>重置</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick="exportExcel()"><i
|
||||
class="layui-icon layui-icon-refresh"></i>导出数据</button>
|
||||
class="layui-icon layui-icon-download-circle"></i>导出数据</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -21,11 +21,21 @@
|
|||
<form class="layui-form layui-form-pane" action="#" onsubmit="return false;">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<div class="layui-input-inline" style="width: 300px;">
|
||||
<div class="layui-input-inline" style="width: 310px;">
|
||||
<input type="text" name="keyWord" id="keyWord" autocomplete="off"
|
||||
class="layui-input" lay-affix="clear" placeholder="输入关键字(计划编号/工程名称/申请人)" maxlength="30">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<div class="layui-input-inline" style="width: 200px;">
|
||||
<select class="layui-select" id="status">
|
||||
<option value="">请选择审核状态</option>
|
||||
<option value="1">待审核</option>
|
||||
<option value="2">审核通过</option>
|
||||
<option value="3">审核驳回</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button class="layui-btn layui-bg-blue" onclick="queryTable(1)"><i
|
||||
class="layui-icon"></i> 搜 索</button>
|
||||
|
|
|
|||
Loading…
Reference in New Issue