From 35a38d17ca10a73861353673b64ba1c66dfc7b58 Mon Sep 17 00:00:00 2001
From: cwchen <1048842385@qq.com>
Date: Wed, 13 Nov 2024 10:42:19 +0800
Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E4=BB=B6=E5=85=A5=E5=BA=93?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../child/accessory_store_edit_form.js | 63 ++++++++-----------
.../child/accessory_store_edit_form.html | 2 +-
2 files changed, 28 insertions(+), 37 deletions(-)
diff --git a/js/accessory/child/accessory_store_edit_form.js b/js/accessory/child/accessory_store_edit_form.js
index 8abecb6..9fa9fe7 100644
--- a/js/accessory/child/accessory_store_edit_form.js
+++ b/js/accessory/child/accessory_store_edit_form.js
@@ -48,8 +48,10 @@ function setParams(obj) {
});
}
});
+ getVendList();
+ getInputDetails();
+ getInputDetailList();
});
- getVendList();
}
// 获取配件到货入库详情
@@ -62,9 +64,9 @@ function getInputDetails() {
let url = dataUrl + 'backstage/partInput/getInputDetails';
ajaxRequest(url, "POST", params, true, function () {
}, function (result) {
- console.error(result);
+ // console.error(result);
if (result.code === 200) {
- setFormData();
+ setFormData(result.data);
} else {
}
}, function (xhr, status, error) {
@@ -73,11 +75,11 @@ function getInputDetails() {
// 表单赋值
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 };
+ form.val('formInfo', obj);
+ let fileList = obj.fileList, html = '';
+ for (let i = 0; i < fileList.length; i++) {
+ let path = fileUrl + fileList[i].fileUrl + '?token=' + sessionStorage.getItem("gz-token");
+ let file = { name: fileList[i].fileName, id: fileList[i].id };
html += '
' +
'
' +
handleFileType(i, file, path) +
@@ -95,7 +97,6 @@ function getInputDetailList() {
let url = dataUrl + 'backstage/partInput/getInputDetailList?encryptedData=' + encodeURIComponent(JSON.stringify(encryptedData));
ajaxRequest(url, "GET", null, true, function () {
}, function (result) {
- console.log(result);
if (result.code === 200) {
jjDataArr = result.data;
setTableData(jjDataArr);
@@ -171,19 +172,14 @@ function setNumColor(value, type) { // 1.需要量 2.已发货量 3.差缺量
function submitApply(data) {
let list = getBaseTableData();
// 校验附件证明是否上传
- if (fileList.length === 0) {
+ let length = $('.file-iteme').length;
+ if (length === 0) {
return layer.msg('请上传附件证明', { icon: 7 });
}
// 校验配件入库数量
if (list.length === 0) {
return layer.msg('未填写配件入库数量', { icon: 7 });
}
- for (let i = 0; i < list.length; i++) {
-
- if (!list[i].inputNum || list[i].inputNum === '0') {
- return layer.msg('入库配件明细,第' + (i + 1) + '行,未填写配件入库数量', { icon: 7 });
- }
- }
data.field.details = list;
data.field.id = objParam.id;
let delId = '';
@@ -204,7 +200,7 @@ function submitApply(data) {
}
formData.append('params', JSON.stringify(data.field));
console.log(JSON.stringify(data.field));
- let loadingMsg = layer.msg('正在提交保存,请稍等...', { icon: 16, shade: 0.01, time: '0' });
+ /* let loadingMsg = layer.msg('正在提交保存,请稍等...', { icon: 16, shade: 0.01, time: '0' });
console.log(JSON.stringify(data.field));
let url = dataUrl + 'backstage/partInput/addInputData';
ajaxRequestByUploadFile(url, formData, function () {
@@ -227,25 +223,20 @@ function submitApply(data) {
$('.save').removeClass("layui-btn-disabled").attr("disabled", false);
$('.cancel').removeClass("layui-btn-disabled").attr("disabled", false);
errorFn(xhr, status, error)
- }, null);
+ }, null); */
}
// 获取入库配件明细数据
function getBaseTableData() {
let tableData = [];
$('#baseTable tbody tr').each(function (index, item) {
- let price = $(this).find('td').eq(7).find('input[name="price"]').val();
- let num = $(this).find('td').eq(6).find('input[name="num"]').val();
+ let price = $(this).find('td').eq(6).find('input[name="price"]').val();
tableData.push({
- partId: $(this).attr('id'),
- partType: $(this).find('td').eq(2).html(),
- partName: $(this).find('td').eq(3).html(),
- partModel: $(this).find('td').eq(4).html(),
- partUnit: $(this).find('td').eq(5).html(),
- inputNum: num ? num : 0,
+ id: $(this).attr('id'),
partPrice: price ? price : 0,
- vendId: $(this).find('td').eq(8).find('select[name="manufacturer"]').val(),
- remark: $(this).find('td').eq(9).find('input[name="remarks"]').val(),
+ vendId: $(this).find('td').eq(7).find('select[name="manufacturer"]').val(),
+ vendName: $(this).find('td').eq(7).find('select[name="manufacturer"]').find('option:checked').text(),
+ remark: $(this).find('td').eq(8).find('input[name="remarks"]').val(),
})
})
return tableData;
@@ -314,14 +305,14 @@ function setTableData(results) {
html += "
";
html += "| "
+ (i + 1) + " | ";
- html += "" + l.type + " | ";
- html += "" + l.name + " | ";
- html += "" + l.model + " | ";
- html += "" + l.unit + " | ";
- html += "" + setFormInput(l.num, 1) + " | ";
- html += "" + setFormInput(l.price, 2) + " | ";
- html += "" + setFormInput(l.manufacturer, 3) + " | ";
- html += "" + setFormInput(l.remarks, 4) + " | ";
+ html += "" + l.partType + " | ";
+ html += "" + l.partName + " | ";
+ html += "" + l.partModel + " | ";
+ html += "" + l.partUnit + " | ";
+ html += "" + l.inputNum + " | ";
+ html += "" + setFormInput(l.partPrice, 2) + " | ";
+ html += "" + setFormInput(l.vendId, 3) + " | ";
+ html += "" + setFormInput(l.remark, 4) + " | ";
html += "
";
}
} else {
diff --git a/page/accessory/child/accessory_store_edit_form.html b/page/accessory/child/accessory_store_edit_form.html
index 3ec567e..e2467b5 100644
--- a/page/accessory/child/accessory_store_edit_form.html
+++ b/page/accessory/child/accessory_store_edit_form.html
@@ -57,7 +57,7 @@
▋
入库配件明细
-