From f6c7878b4729669db0041c4190bd43a9f8c4f101 Mon Sep 17 00:00:00 2001
From: cwchen <1048842385@qq.com>
Date: Fri, 15 Nov 2024 09:32:44 +0800
Subject: [PATCH] =?UTF-8?q?=E9=80=80=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
js/accessory/child/accessory_return_form.js | 4 +-
.../child/choose_return_fit_type_list.js | 90 +++++++++----------
2 files changed, 47 insertions(+), 47 deletions(-)
diff --git a/js/accessory/child/accessory_return_form.js b/js/accessory/child/accessory_return_form.js
index bf7684c..9559684 100644
--- a/js/accessory/child/accessory_return_form.js
+++ b/js/accessory/child/accessory_return_form.js
@@ -320,8 +320,8 @@ function setTableData(results) {
if (results && results.length > 0) {
for (var i = 0; i < results.length; i++) {
var l = results[i];
- html += "
";
- html += ' | ';
+ html += "
";
+ html += ' | ';
html += ""
+ (i + 1) + " | ";
html += "" + l.partType + " | ";
diff --git a/js/accessory/child/choose_return_fit_type_list.js b/js/accessory/child/choose_return_fit_type_list.js
index 1e70ab0..7258d49 100644
--- a/js/accessory/child/choose_return_fit_type_list.js
+++ b/js/accessory/child/choose_return_fit_type_list.js
@@ -1,4 +1,4 @@
-let objParam, userId;
+let objParam, userpartId;
let form, table, tableIns, layer, util;
let pageNum = 1;
let quanju = new Array();//全局
@@ -7,7 +7,7 @@ let huancunObj = new Array();//缓存2
let jjDetailArr = []; // 退料配件类型数据
function setParams(obj) {
objParam = JSON.parse(obj);
- userId = objParam.userId;
+ userpartId = objParam.userpartId;
console.log(objParam);
layui.use(["form", "table", 'layer', 'util'], function () {
form = layui.form;
@@ -33,7 +33,7 @@ function queryTable(type) {
// 重载表格
function reloadTable(pageNum) {
- table.reload("currentTableId", {
+ table.reload("currentTablepartId", {
page: {
curr: pageNum ? pageNum : 1,
},
@@ -42,7 +42,7 @@ function reloadTable(pageNum) {
'partType': $('#partType').val(),
'partName': $('#partName').val(),
'partModel': $('#partModel').val(),
- 'userId': userId
+ 'userpartId': userpartId
}),
},
},
@@ -53,8 +53,8 @@ function reloadTable(pageNum) {
// 表格数据
function initTable() {
tableIns = table.render({
- elem: "#currentTableId",
- id: 'currentTableId',
+ elem: "#currentTablepartId",
+ partId: 'currentTablepartId',
height: "full-200",
headers: {
authorization: sessionStorage.getItem("gz-token"),
@@ -65,7 +65,7 @@ function initTable() {
'partType': $('#partType').val(),
'partName': $('#partName').val(),
'partModel': $('#partModel').val(),
- 'userId': userId
+ 'userpartId': userpartId
}),
},
request: {
@@ -76,7 +76,7 @@ function initTable() {
if (jjDetailArr && res.list) {
$.each(res.list, function (index, item) {
$.each(jjDetailArr, function (index2, item2) {
- if (item.id === item2.id) {
+ if (item.partId === item2.partId) {
item.ghNum = item2.ghNum;
item.remark = item2.remark;
}
@@ -92,9 +92,9 @@ function initTable() {
},
cols: [
[
- { type: 'checkbox', width: '5%' },
+ { type: 'checkbox', wpartIdth: '5%' },
{
- width: '9.9%',
+ wpartIdth: '9.9%',
title: "序号",
align: "center",
templet: function (d) {
@@ -103,21 +103,21 @@ function initTable() {
},
{
field: "partType",
- width: '10%',
+ wpartIdth: '10%',
title: "配件类型",
unresize: true,
align: "center",
},
{
field: "partName",
- width: '15%',
+ wpartIdth: '15%',
title: "配件名称",
unresize: true,
align: "center",
},
{
field: "partModel",
- width: '10%',
+ wpartIdth: '10%',
title: "规格型号",
unresize: true,
align: "center",
@@ -125,34 +125,34 @@ function initTable() {
{
field: "partUnit",
title: "单位",
- width: '10%',
+ wpartIdth: '10%',
unresize: true,
align: "center",
},
{
field: "lyNum",
- width: '10%',
+ wpartIdth: '10%',
title: "累计领料数量",
unresize: true,
align: "center",
},
{
field: "ghNum",
- width: '10%',
+ wpartIdth: '10%',
title: " * 本次退回量",
unresize: true,
align: "center",
edit: 'text',
- style: 'outline: 1px solid #e6e6e6;outline-offset: -5px;'
+ style: 'outline: 1px solpartId #e6e6e6;outline-offset: -5px;'
},
{
field: "remark",
- width: '20%',
+ wpartIdth: '20%',
title: "备注",
unresize: true,
align: "center",
edit: 'textarea',
- style: 'outline: 1px solid #e6e6e6;outline-offset: -5px;'
+ style: 'outline: 1px solpartId #e6e6e6;outline-offset: -5px;'
},
],
@@ -161,14 +161,14 @@ function initTable() {
limit: 10,
page: true,
done: function (res, curr, count) {
- table.resize("currentTableId");
+ table.resize("currentTablepartId");
pageNum = tableIns.config.page.curr;
//设置全部数据到全局变量
quanju = res.data;
for (var i = 0; i < res.data.length; i++) {
for (var j = 0; j < huancun.length; j++) {
- //数据id和要勾选的id相同时checkbox选中
- if (res.data[i].id === huancun[j]) {
+ //数据partId和要勾选的partId相同时checkbox选中
+ if (res.data[i].partId === huancun[j]) {
//这里才是真正的有效勾选
res.data[i]["LAY_CHECKED"] = 'true';
//找到对应数据改变勾选样式,呈现出选中效果
@@ -179,7 +179,7 @@ function initTable() {
}
}
//设置全选checkbox的选中状态,只有改变LAY_CHECKED的值, table.checkStatus才能抓取到选中的状态
- let checkStatus = table.checkStatus('currentTableId');//这里的lightTable是指分页中的id
+ let checkStatus = table.checkStatus('currentTablepartId');//这里的lightTable是指分页中的partId
if (checkStatus.isAll) {//是否全选
//layTableAllChoose
$('.layui-table th[data-field="0"] input[type="checkbox"]').prop('checked', true);//data-field值默认为0,如果在分页部分自定义了属性名,则需要改成对应的属性名
@@ -187,7 +187,7 @@ function initTable() {
}
},
});
- table.on('edit(currentTableId2)', function (obj) {
+ table.on('edit(currentTablepartId2)', function (obj) {
var field = obj.field; // 得到修改的字段
var value = obj.value // 得到修改后的值
if (field === 'ghNum') { // 本次退回量
@@ -212,20 +212,20 @@ function initTable() {
}
}
// 显示 - 仅用于演示
- // layer.msg('[ID: ' + data.id + '] ' + field + ' 字段更改值为:' + util.escape(value));
- let id = obj.data.id;
- updateOrAddObject(id, obj.data);
+ // layer.msg('[partId: ' + data.partId + '] ' + field + ' 字段更改值为:' + util.escape(value));
+ let partId = obj.data.partId;
+ updateOrAddObject(partId, obj.data);
});
- //复选框选中监听,将选中的id 设置到缓存数组,或者删除缓存数组
- table.on('checkbox(currentTableId2)', function (obj) {
+ //复选框选中监听,将选中的partId 设置到缓存数组,或者删除缓存数组
+ table.on('checkbox(currentTablepartId2)', function (obj) {
if (obj.checked === true) {
- if (obj.type === 'one' && huancun.indexOf(obj.data.id) === -1) {
- huancun.push(obj.data.id);
+ if (obj.type === 'one' && huancun.indexOf(obj.data.partId) === -1) {
+ huancun.push(obj.data.partId);
huancunObj.push(obj.data);
} else {
for (let i = 0; i < quanju.length; i++) {
- if (huancun.indexOf(quanju[i].id) === -1) {
- huancun.push(quanju[i].id);
+ if (huancun.indexOf(quanju[i].partId) === -1) {
+ huancun.push(quanju[i].partId);
huancunObj.push(quanju[i]);
}
}
@@ -233,7 +233,7 @@ function initTable() {
} else {
if (obj.type === 'one') {
for (let i = 0; i < huancun.length; i++) {
- if (huancun[i] === obj.data.id) {
+ if (huancun[i] === obj.data.partId) {
removeByValue(huancun, huancun[i]);//调用自定义的根据值移除函数
removeByValue(huancunObj, huancunObj[i]);//调用自定义的根据值移除函数
}
@@ -241,7 +241,7 @@ function initTable() {
} else {
for (let i = 0; i < quanju.length; i++) {
for (let j = 0; j < huancun.length; j++) {
- if (huancun[j] === quanju[i].id) {
+ if (huancun[j] === quanju[i].partId) {
removeByValue(huancun, +huancun[j]);//调用自定义的根据值移除函数
removeByValue(huancunObj, +huancunObj[j]);//调用自定义的根据值移除函数
}
@@ -252,9 +252,9 @@ function initTable() {
});
}
-// 根据id 判断对象数组的对象是否存在 如果存在则替换,不存在则添加
-function updateOrAddObject(id, newObject) {
- const index = jjDetailArr.findIndex(obj => obj.id === id);
+// 根据partId 判断对象数组的对象是否存在 如果存在则替换,不存在则添加
+function updateOrAddObject(partId, newObject) {
+ const index = jjDetailArr.findIndex(obj => obj.partId === partId);
if (index !== -1) {
// 如果对象存在,则替换它
jjDetailArr[index] = newObject;
@@ -274,7 +274,7 @@ function removeByValue(arr, val) {
}
}
for (let i = 0; i < huancunObj.length; i++) {
- if (huancunObj[i].id == val) {
+ if (huancunObj[i].partId == val) {
huancunObj.splice(i, 1);
break;
}
@@ -291,11 +291,11 @@ function saveData2(params) {
dataArr.push(item);
})
for (let i = 0; i < huancun.length; i++) {
- const id = huancun[i];
+ const partId = huancun[i];
for (let j = 0; j < jjDetailArr.length; j++) {
const obj = jjDetailArr[j];
- if (id === obj.id) {
- updateOrAddObject2(id, obj);
+ if (partId === obj.partId) {
+ updateOrAddObject2(partId, obj);
}
}
}
@@ -306,8 +306,8 @@ function saveData2(params) {
closePage(1, JSON.stringify(dataArr));
});
// 替换对象
- function updateOrAddObject2(id, newObject) {
- const index = dataArr.findIndex(obj => obj.id === id);
+ function updateOrAddObject2(partId, newObject) {
+ const index = dataArr.findIndex(obj => obj.partId === partId);
if (index !== -1) {
// 如果对象存在,则替换它
dataArr[index] = newObject;
@@ -328,7 +328,7 @@ function closePage(type, params) {
let index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe层的索引
parent.layer.close(index); // 再执行关闭
if (type == 1) {
- window.parent.addFitDatas(params, userId);
+ window.parent.addFitDatas(params, userpartId);
}
}
\ No newline at end of file