前端问题修改
This commit is contained in:
parent
0033282ca0
commit
2b97086406
|
|
@ -67,7 +67,7 @@ function getDTreeData() {
|
||||||
if (result.code === 200) {
|
if (result.code === 200) {
|
||||||
if (result.data.tree && result.data.tree.length > 0) {
|
if (result.data.tree && result.data.tree.length > 0) {
|
||||||
$.each(result.data.tree, function (index, item) {
|
$.each(result.data.tree, function (index, item) {
|
||||||
dataNum += item.children.length;
|
dataNum += (item.children ? item.children.length : 0);
|
||||||
list.push(item);
|
list.push(item);
|
||||||
})
|
})
|
||||||
$.each(result.data.check, function (index, item) {
|
$.each(result.data.check, function (index, item) {
|
||||||
|
|
|
||||||
|
|
@ -154,6 +154,7 @@ function submitApply(data) {
|
||||||
if (result.code === 200) {
|
if (result.code === 200) {
|
||||||
parent.layer.msg(result.msg, { icon: 1 });
|
parent.layer.msg(result.msg, { icon: 1 });
|
||||||
if (isGoOn === '1') { // 保存并继续添加
|
if (isGoOn === '1') { // 保存并继续添加
|
||||||
|
clearFormData();
|
||||||
closePage(2, result.data);
|
closePage(2, result.data);
|
||||||
} else if (isGoOn === '0' && objParam.type !== 3) { // 保存
|
} else if (isGoOn === '0' && objParam.type !== 3) { // 保存
|
||||||
closePage(1, result.data);
|
closePage(1, result.data);
|
||||||
|
|
@ -174,6 +175,19 @@ function submitApply(data) {
|
||||||
}, null);
|
}, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 保存并继续添加,清空表单数据
|
||||||
|
function clearFormData(){
|
||||||
|
if (objParam.level === '1') {
|
||||||
|
$('#name').val('');
|
||||||
|
} else if (objParam.level === '2') {
|
||||||
|
$('#name').val('');
|
||||||
|
} else if (objParam.level === '3') {
|
||||||
|
$('#name').val('');
|
||||||
|
$('#unit').val('');
|
||||||
|
$('#remark').val('');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 关闭页面 type:2 保存并继续添加
|
// 关闭页面 type:2 保存并继续添加
|
||||||
function closePage(type, obj) {
|
function closePage(type, obj) {
|
||||||
let index = parent.layer.getFrameIndex(window.name);
|
let index = parent.layer.getFrameIndex(window.name);
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,13 @@ function setParams(obj) {
|
||||||
form.on('submit(formData)', function (data) {
|
form.on('submit(formData)', function (data) {
|
||||||
submitApply(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' });
|
||||||
|
});
|
||||||
let uploadObj = upload.render({
|
let uploadObj = upload.render({
|
||||||
elem: '#test2',
|
elem: '#test2',
|
||||||
multiple: true,
|
multiple: true,
|
||||||
|
|
@ -261,16 +268,10 @@ function addFitDatas(data) {
|
||||||
if (jjDataArr.length > 0) { // 继续添加数据
|
if (jjDataArr.length > 0) { // 继续添加数据
|
||||||
let newJjDataArr = JSON.parse(data);
|
let newJjDataArr = JSON.parse(data);
|
||||||
// 如何切换了类型,则清空之前的数据
|
// 如何切换了类型,则清空之前的数据
|
||||||
let oldType = jjDataArr[0].type;
|
$.each(newJjDataArr, function (index, item) {
|
||||||
let newType = newJjDataArr[0].type;
|
updateOrAddObject(item.id, item);
|
||||||
if (oldType === newType) {
|
});
|
||||||
$.each(newJjDataArr, function (index, item) {
|
goOnAddData();
|
||||||
updateOrAddObject(item.id, item);
|
|
||||||
});
|
|
||||||
setTableData(jjDataArr);
|
|
||||||
} else {
|
|
||||||
setTableData(newJjDataArr);
|
|
||||||
}
|
|
||||||
} else { // 第一次添加数据
|
} else { // 第一次添加数据
|
||||||
jjDataArr = JSON.parse(data);
|
jjDataArr = JSON.parse(data);
|
||||||
if (jjDataArr && jjDataArr.length > 0) {
|
if (jjDataArr && jjDataArr.length > 0) {
|
||||||
|
|
@ -385,18 +386,65 @@ function delFitType() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delIdArr.splice(0, delIdArr.length);
|
|
||||||
if (jjDataArr.length === 0) {
|
if (jjDataArr.length === 0) {
|
||||||
$('#no_data_title').removeAttr('style');
|
$('#no_data_title').removeAttr('style');
|
||||||
$('#search-info').css({ 'display': 'none' });
|
$('#search-info').css({ 'display': 'none' });
|
||||||
$('#table-box').css({ 'display': 'none' });
|
$('#table-box').css({ 'display': 'none' });
|
||||||
} else {
|
} 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) {
|
function checkValue(that, type, name) {
|
||||||
let value = $(that).val();
|
let value = $(that).val();
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ function queryTable(type) {
|
||||||
|
|
||||||
// 刷新页面数据
|
// 刷新页面数据
|
||||||
function reloadData() {
|
function reloadData() {
|
||||||
reloadTable(1);
|
reloadTable(pageNum);
|
||||||
getProStatisticsDetails();
|
getProStatisticsDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ function queryTable(type) {
|
||||||
|
|
||||||
// 刷新页面数据
|
// 刷新页面数据
|
||||||
function reloadData() {
|
function reloadData() {
|
||||||
reloadTable(1);
|
reloadTable(pageNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重载表格
|
// 重载表格
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue