配件入库
This commit is contained in:
parent
cb77ec542c
commit
1e0f4f402b
|
|
@ -146,8 +146,8 @@ function initTable() {
|
||||||
unresize: true,
|
unresize: true,
|
||||||
templet: function (d) {
|
templet: function (d) {
|
||||||
let html = "";
|
let html = "";
|
||||||
html += "<a onclick='deliveryDetail(" + JSON.stringify(d) + ")'>详情</a>";
|
html += "<a onclick='accessoryStoreDetail(" + JSON.stringify(d) + ")'>详情</a>";
|
||||||
html += "<div class='splitLine'>|</div><a onclick='sendGoods(" + JSON.stringify(d) + ")'>修改</a>";
|
html += "<div class='splitLine'>|</div><a onclick='accessoryStoreEdit(" + JSON.stringify(d) + ")'>修改</a>";
|
||||||
return html;
|
return html;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -170,6 +170,9 @@ function setStatusColor(value) {
|
||||||
let name = ''
|
let name = ''
|
||||||
if (value === '0') {
|
if (value === '0') {
|
||||||
color = "#f56c6c";
|
color = "#f56c6c";
|
||||||
|
name = '否';
|
||||||
|
} else {
|
||||||
|
name = '是';
|
||||||
}
|
}
|
||||||
return '<span style="color:' + color + '">' + name + "</span>";
|
return '<span style="color:' + color + '">' + name + "</span>";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
let idParam, objParam, fileList = new Array(), imgListUp = new Array();
|
let idParam, objParam, fileList = new Array(), imgListUp = new Array(), delImgIdList = [];
|
||||||
let form, laydate, layer, upload, table, util;
|
let form, laydate, layer, upload, table, util;
|
||||||
let pageNum = 1, tableIns; // 定义分页
|
let pageNum = 1, tableIns; // 定义分页
|
||||||
let jjDataArr = []; // 入库配件数据
|
let jjDataArr = []; // 入库配件数据
|
||||||
|
|
@ -64,12 +64,27 @@ function getInputDetails() {
|
||||||
}, function (result) {
|
}, function (result) {
|
||||||
console.error(result);
|
console.error(result);
|
||||||
if (result.code === 200) {
|
if (result.code === 200) {
|
||||||
|
setFormData();
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
}, function (xhr, status, error) {
|
}, function (xhr, status, error) {
|
||||||
errorFn(xhr, status, error)
|
errorFn(xhr, status, error)
|
||||||
}, null);
|
}, null);
|
||||||
|
|
||||||
|
// 表单赋值
|
||||||
|
function setFormData(obj) {
|
||||||
|
layui.form('formInfo', obj);
|
||||||
|
let flieList = obj.flieList;
|
||||||
|
for (let i = 0; i < flieList.length; i++) {
|
||||||
|
let path = fileUrl + flieList[i].fileUrl + '?token=' + sessionStorage.getItem("gz-token");
|
||||||
|
let file = { name: flieList[i].fileName, id: fileList[i].id };
|
||||||
|
html += '<div id="" class="file-iteme">' +
|
||||||
|
'<div class="handle"><p>x</p></div>' +
|
||||||
|
handleFileType(i, file, path) +
|
||||||
|
'</div>'
|
||||||
|
}
|
||||||
|
$('#uploader-list').append(html);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取入库配件表格明细
|
// 获取入库配件表格明细
|
||||||
|
|
@ -82,7 +97,8 @@ function getInputDetailList() {
|
||||||
}, function (result) {
|
}, function (result) {
|
||||||
console.log(result);
|
console.log(result);
|
||||||
if (result.code === 200) {
|
if (result.code === 200) {
|
||||||
|
jjDataArr = result.data;
|
||||||
|
setTableData(jjDataArr);
|
||||||
}
|
}
|
||||||
}, function (xhr, status, error) {
|
}, function (xhr, status, error) {
|
||||||
errorFn(xhr, status, error)
|
errorFn(xhr, status, error)
|
||||||
|
|
@ -99,9 +115,9 @@ function handleFileType(index, file, result) {
|
||||||
} else if (file.ext === 'pdf') {
|
} else if (file.ext === 'pdf') {
|
||||||
img = '../../../images/PDF.png';
|
img = '../../../images/PDF.png';
|
||||||
} else {
|
} else {
|
||||||
return '<img class="img" style="width: 130px;height: 120px;" data-index=' + index + ' data-name=' + file.name + ' src=' + result + '>';
|
return '<img class="img" style="width: 130px;height: 120px;" isOld="' + file.id + '" data-index=' + index + ' data-name=' + file.name + ' src=' + result + '>';
|
||||||
}
|
}
|
||||||
html += '<div class="layout upload-file" data-index=' + index + '>' +
|
html += '<div class="layout upload-file" data-index=' + index + ' isOld="' + file.id + '">' +
|
||||||
'<img src="' + img + '">' +
|
'<img src="' + img + '">' +
|
||||||
'<p style="text-align: center;font-size:12px;">' + file.name + '</p>' +
|
'<p style="text-align: center;font-size:12px;">' + file.name + '</p>' +
|
||||||
'</div>';
|
'</div>';
|
||||||
|
|
@ -112,6 +128,12 @@ function handleFileType(index, file, result) {
|
||||||
$(document).on("click", ".file-iteme .handle", function (event) {
|
$(document).on("click", ".file-iteme .handle", function (event) {
|
||||||
imgListUp.splice(0, imgListUp.length);
|
imgListUp.splice(0, imgListUp.length);
|
||||||
let index = $(this).next().attr('data-index');
|
let index = $(this).next().attr('data-index');
|
||||||
|
let isOld = $(this).next().attr('isOld');
|
||||||
|
if (isOld) {
|
||||||
|
delImgIdList.push(isOld);
|
||||||
|
console.log(delImgIdList)
|
||||||
|
$(this).parent().remove();
|
||||||
|
} else {
|
||||||
$.each(fileList, function (inx, ele) {
|
$.each(fileList, function (inx, ele) {
|
||||||
//对比删除文件索引
|
//对比删除文件索引
|
||||||
//将未删除的存入新集合
|
//将未删除的存入新集合
|
||||||
|
|
@ -125,6 +147,7 @@ $(document).on("click", ".file-iteme .handle", function (event) {
|
||||||
$.each(imgListUp, function (inx, ele) {
|
$.each(imgListUp, function (inx, ele) {
|
||||||
fileList.push(ele)
|
fileList.push(ele)
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function saveData2() {
|
function saveData2() {
|
||||||
|
|
@ -162,6 +185,18 @@ function submitApply(data) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data.field.details = list;
|
data.field.details = list;
|
||||||
|
data.field.id = objParam.id;
|
||||||
|
let delId = '';
|
||||||
|
if (delImgIdList && delImgIdList.length > 0) {
|
||||||
|
for (let i = 0; i < delImgIdList.length; i++) {
|
||||||
|
if (i === delImgIdList.length - 1) {
|
||||||
|
delId += delImgIdList[i];
|
||||||
|
} else {
|
||||||
|
delId += delImgIdList[i] + '@';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
data.field.delId = delId;
|
||||||
let formData = new FormData();
|
let formData = new FormData();
|
||||||
//遍历最终文件集合
|
//遍历最终文件集合
|
||||||
for (let i = 0; i < fileList.length; i++) {
|
for (let i = 0; i < fileList.length; i++) {
|
||||||
|
|
@ -216,16 +251,6 @@ function getBaseTableData() {
|
||||||
return tableData;
|
return tableData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 选择入库配件类型
|
|
||||||
function chooseFitType() {
|
|
||||||
let params = {};
|
|
||||||
/* if (jjDataArr && jjDataArr.length > 0) {
|
|
||||||
params.jjDataArrStr = JSON.stringify(jjDataArr);
|
|
||||||
} */
|
|
||||||
openIframeByParamObj("choose_fit_type", '选择入库配件类型', "./choose_fit_type_list.html", '92%', '95%', params);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 查询
|
// 查询
|
||||||
function search() {
|
function search() {
|
||||||
let keyWord = $('#type').val();
|
let keyWord = $('#type').val();
|
||||||
|
|
@ -279,37 +304,6 @@ function resetSearch() {
|
||||||
setTableData(jjDataArr);
|
setTableData(jjDataArr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 子页面回调数据
|
|
||||||
function addFitDatas(data) {
|
|
||||||
console.log('新增的数据:' + data);
|
|
||||||
if (jjDataArr.length > 0) { // 继续添加数据
|
|
||||||
let newJjDataArr = JSON.parse(data);
|
|
||||||
$.each(newJjDataArr, function (index, item) {
|
|
||||||
updateOrAddObject(item.id, item);
|
|
||||||
});
|
|
||||||
setTableData(jjDataArr);
|
|
||||||
} else { // 第一次添加数据
|
|
||||||
jjDataArr = JSON.parse(data);
|
|
||||||
if (jjDataArr && jjDataArr.length > 0) {
|
|
||||||
$('#no_data_title').css({ 'display': 'none' });
|
|
||||||
$('#search-info').removeAttr('style');
|
|
||||||
$('#table-box').removeAttr('style');
|
|
||||||
setTableData(jjDataArr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateOrAddObject(id, newObject) {
|
|
||||||
const index = jjDataArr.findIndex(obj => obj.id === id);
|
|
||||||
if (index !== -1) {
|
|
||||||
// 如果对象存在,则替换它
|
|
||||||
jjDataArr[index] = newObject;
|
|
||||||
} else {
|
|
||||||
// 如果对象不存在,则添加到数组
|
|
||||||
jjDataArr.push(newObject);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 入库配件明细表格赋值
|
// 入库配件明细表格赋值
|
||||||
function setTableData(results) {
|
function setTableData(results) {
|
||||||
$('#allCheck').prop('checked', false)
|
$('#allCheck').prop('checked', false)
|
||||||
|
|
@ -318,7 +312,6 @@ function setTableData(results) {
|
||||||
for (var i = 0; i < results.length; i++) {
|
for (var i = 0; i < results.length; i++) {
|
||||||
var l = results[i];
|
var l = results[i];
|
||||||
html += "<tr id='" + l.id + "'>";
|
html += "<tr id='" + l.id + "'>";
|
||||||
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'>"
|
html += "<td style='vertical-align:middle;' class='center hidden-480'>"
|
||||||
+ (i + 1) + "</td>";
|
+ (i + 1) + "</td>";
|
||||||
html += "<td>" + l.type + "</td>";
|
html += "<td>" + l.type + "</td>";
|
||||||
|
|
@ -385,67 +378,6 @@ function getVendList() {
|
||||||
}, null);
|
}, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 复选框全选
|
|
||||||
function selectAll(selectStatus) {//传入参数(全选框的选中状态)
|
|
||||||
if (selectStatus) {
|
|
||||||
$("input[name='check']").each(function (i, n) {
|
|
||||||
n.checked = true;
|
|
||||||
});
|
|
||||||
$.each(jjDataArr, function (index, item) {
|
|
||||||
delIdArr.push(item.id);
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
$("input[name='check']").each(function (i, n) {
|
|
||||||
n.checked = false;
|
|
||||||
});
|
|
||||||
delIdArr.splice(0, delIdArr.length);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 单个选中
|
|
||||||
function sel(selectStatus, that, id) {
|
|
||||||
if (selectStatus) {
|
|
||||||
$(that).prop('checked', true);
|
|
||||||
delIdArr.push(id);
|
|
||||||
} else {
|
|
||||||
$(that).prop('checked', false);
|
|
||||||
for (let i = 0; i < delIdArr.length; i++) {
|
|
||||||
if (delIdArr[i] == id) {
|
|
||||||
arr.splice(i, 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除选中
|
|
||||||
function delFitType() {
|
|
||||||
if (delIdArr.length == 0) {
|
|
||||||
layer.msg('请先选择需要删除的数据!', { icon: 7 })
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let layerIndex = layer.confirm('<h5 style="color:red">确定要删除选中数据吗!</h5>', { title: '操作提示' }, function () {
|
|
||||||
layer.close(layerIndex);
|
|
||||||
for (let i = 0; i < delIdArr.length; i++) {
|
|
||||||
for (let j = 0; j < jjDataArr.length; j++) {
|
|
||||||
let id = jjDataArr[j].id;
|
|
||||||
if (delIdArr[i] == id) {
|
|
||||||
jjDataArr.splice(j, 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (jjDataArr.length === 0) {
|
|
||||||
$('#no_data_title').removeAttr('style');
|
|
||||||
$('#search-info').css({ 'display': 'none' });
|
|
||||||
$('#table-box').css({ 'display': 'none' });
|
|
||||||
} else {
|
|
||||||
setTableData(jjDataArr);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 校验数据
|
// 校验数据
|
||||||
function checkValue(that, type) {
|
function checkValue(that, type) {
|
||||||
let value = $(that).val();
|
let value = $(that).val();
|
||||||
|
|
|
||||||
|
|
@ -46,12 +46,8 @@
|
||||||
class="layui-icon layui-icon-refresh"></i> 重 置</button>
|
class="layui-icon layui-icon-refresh"></i> 重 置</button>
|
||||||
<button class="layui-btn layui-bg-blue" onclick="accessoryStore(1,{})"><i
|
<button class="layui-btn layui-bg-blue" onclick="accessoryStore(1,{})"><i
|
||||||
class="layui-icon layui-icon-file"></i> 配 件 入 库</button>
|
class="layui-icon layui-icon-file"></i> 配 件 入 库</button>
|
||||||
<button class="layui-btn layui-bg-blue" onclick="accessoryStoreEdit({})"><i
|
|
||||||
class="layui-icon layui-icon-file"></i> 编 辑</button>
|
|
||||||
<button class="layui-btn layui-bg-blue" onclick="accessoryStoreDetail({})"><i
|
|
||||||
class="layui-icon layui-icon-file"></i> 详 情</button>
|
|
||||||
<button class="layui-btn layui-btn-primary" onclick="exportExcel()"><i
|
<button class="layui-btn layui-btn-primary" onclick="exportExcel()"><i
|
||||||
class="layui-icon layui-icon-download-circle"></i> 导出</button>
|
class="layui-icon layui-icon-download-circle"></i> 导 出</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
<body>
|
<body>
|
||||||
<div id="main-box">
|
<div id="main-box">
|
||||||
<div id="basic-box">
|
<div id="basic-box">
|
||||||
<form class="layui-form layuimini-form" onclick="return false;">
|
<form class="layui-form layuimini-form" onclick="return false;" lay-filter="formInfo">
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<div class="layui-inline">
|
<div class="layui-inline">
|
||||||
<label class="layui-form-label required" style="width: 100px !important;">入库人</label>
|
<label class="layui-form-label required" style="width: 100px !important;">入库人</label>
|
||||||
|
|
@ -94,9 +94,9 @@
|
||||||
<table id="baseTable" class="classTable table-hover">
|
<table id="baseTable" class="classTable table-hover">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 5%" class="center">
|
<!-- <th style="width: 5%" class="center">
|
||||||
<input id="allCheck" onclick="selectAll(this.checked)" type="checkbox">
|
<input id="allCheck" onclick="selectAll(this.checked)" type="checkbox">
|
||||||
</th>
|
</th> -->
|
||||||
<th style="width: 5%" class="center">序号</th>
|
<th style="width: 5%" class="center">序号</th>
|
||||||
<th style="width: 10%" class="center">配件类型</th>
|
<th style="width: 10%" class="center">配件类型</th>
|
||||||
<th style="width: 10%" class="center">配件名称</th>
|
<th style="width: 10%" class="center">配件名称</th>
|
||||||
|
|
@ -105,7 +105,7 @@
|
||||||
<th style="width: 10%" class="center"><span style="color: red;">*</span> 本次入库量</th>
|
<th style="width: 10%" class="center"><span style="color: red;">*</span> 本次入库量</th>
|
||||||
<th style="width: 10%" class="center">单价(元)</th>
|
<th style="width: 10%" class="center">单价(元)</th>
|
||||||
<th style="width: 15%" class="center"><span style="color: red;">*</span> 配件厂家</th>
|
<th style="width: 15%" class="center"><span style="color: red;">*</span> 配件厂家</th>
|
||||||
<th style="width: 15%" class="center">备注</th>
|
<th style="width: 20%" class="center">备注</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody></tbody>
|
<tbody></tbody>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue