From f1e189622df96eaa48c1f60ec62eb6d14ff79eb5 Mon Sep 17 00:00:00 2001
From: syruan <321359594@qq.com>
Date: Fri, 23 May 2025 10:04:21 +0800
Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E4=BB=B6=E5=85=A5=E5=BA=93=E5=8F=96?=
=?UTF-8?q?=E6=B6=88=E5=8D=95=E4=BB=B7=E9=99=90=E5=88=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
js/accessory/child/accessory_apply_add.js | 128 ++++++++++++------
.../child/accessory_store_edit_form.js | 10 +-
js/accessory/child/accessory_store_form.js | 6 +-
3 files changed, 98 insertions(+), 46 deletions(-)
diff --git a/js/accessory/child/accessory_apply_add.js b/js/accessory/child/accessory_apply_add.js
index 3097e48..5544d43 100644
--- a/js/accessory/child/accessory_apply_add.js
+++ b/js/accessory/child/accessory_apply_add.js
@@ -62,9 +62,30 @@ document.getElementById('internalCode').addEventListener('click', function () {
// 打开弹框并渲染表格
layer.open({
type: 1, // 类型:1表示页面层
- area: ['800px', '525px'], // 宽高
+ area: ['900px', '600px'], // 增加高度以适应搜索框
content: `
+
+
@@ -72,46 +93,77 @@ document.getElementById('internalCode').addEventListener('click', function () {
`,
success: function (layero, index) {
- // 在弹框成功打开后初始化表格
- table.render({
- elem: '#dataTable', // 指定原始表格元素选择器(推荐id选择器)
- headers: {
- authorization: sessionStorage.getItem("gz-token"),
- },
- height: 400,
- url: dataUrl + 'base/partApply/getDevList',// 数据接口,这里假设你有一个数据接口返回JSON数据
- page: true, // 开启分页
- request: {
- pageName: 'pageNum',
- limitName: 'pageSize'
- },
- parseData: function (res) { // res 即为原始返回的数据
- if (res.code === 401) {
- closeWindowOpen();
- }
- return {
- "code": 0, // 解析接口状态
- "msg": '获取成功', // 解析提示文本
- "count": res.total, // 解析数据长度
- "data": res.list // 解析数据列表
- };
- },
- cols: [[ // 表头
- {type: 'radio'}, // 单选框列
- {
- width: '20%',
- title: "序号",
- align: "center",
- templet: function (d) {
- return d.LAY_NUM;
- },
+ // 定义搜索参数对象
+ var searchParams = {
+ deviceCode: '',
+ remark: ''
+ };
+
+ // 初始化表格渲染函数
+ function renderTable() {
+ table.render({
+ elem: '#dataTable', // 指定原始表格元素选择器(推荐id选择器)
+ headers: {
+ authorization: sessionStorage.getItem("gz-token"),
},
- {field: 'deviceCode', title: '内部编号', width: '40%'},
- {field: 'module', title: '机型', width: '40%'}
- ]]
- });
+ height: 400,
+ url: dataUrl + 'base/partApply/getDevList',// 数据接口
+ page: true, // 开启分页
+ where: searchParams, // 传递搜索参数
+ request: {
+ pageName: 'pageNum',
+ limitName: 'pageSize'
+ },
+ parseData: function (res) { // res 即为原始返回的数据
+ if (res.code === 401) {
+ closeWindowOpen();
+ }
+ return {
+ "code": 0, // 解析接口状态
+ "msg": '获取成功', // 解析提示文本
+ "count": res.total, // 解析数据长度
+ "data": res.list // 解析数据列表
+ };
+ },
+ cols: [[ // 表头
+ {type: 'radio'}, // 单选框列
+ {
+ width: '10%',
+ title: "序号",
+ align: "center",
+ templet: function (d) {
+ return d.LAY_NUM;
+ },
+ },
+ {field: 'deviceCode', title: '内部编号', width: '25%'},
+ {field: 'remark', title: '备注', width: '30%'},
+ {field: 'module', title: '机型', width: '35%'}
+ ]]
+ });
+ }
+
+ // 初始渲染表格
+ renderTable();
+
+ // 搜索按钮点击事件
+ document.getElementById('searchBtn').onclick = function() {
+ searchParams.deviceCode = document.getElementById('searchDeviceCode').value;
+ searchParams.remark = document.getElementById('searchRemark').value;
+ renderTable(); // 重新渲染表格
+ };
+
+ // 重置按钮点击事件
+ document.getElementById('resetBtn').onclick = function() {
+ document.getElementById('searchDeviceCode').value = '';
+ document.getElementById('searchRemark').value = '';
+ searchParams.deviceCode = '';
+ searchParams.remark = '';
+ renderTable(); // 重新渲染表格
+ };
+
// 确定按钮点击事件
document.getElementById('confirmBtn').onclick = function () {
+ // ... 现有代码保持不变 ...
var checkStatus = table.checkStatus('dataTable'); // 获取选中行的状态
var data = checkStatus.data; // 获取选中的行数据
if (data.length > 0) {
diff --git a/js/accessory/child/accessory_store_edit_form.js b/js/accessory/child/accessory_store_edit_form.js
index be94cb3..282f4f8 100644
--- a/js/accessory/child/accessory_store_edit_form.js
+++ b/js/accessory/child/accessory_store_edit_form.js
@@ -188,11 +188,11 @@ function submitApply(data) {
if (length === 0) {
return layer.msg('请上传附件证明', { icon: 7 });
}
- for (let i = 0; i < list.length; i++) {
- if (list[i].partPrice === 0 || list[i].partPrice === '0') {
- return layer.msg('入库配件明细,第' + (i + 1) + '行,未填写单价', { icon: 7 });
- }
- }
+ // for (let i = 0; i < list.length; i++) {
+ // if (list[i].partPrice === 0 || list[i].partPrice === '0') {
+ // return layer.msg('入库配件明细,第' + (i + 1) + '行,未填写单价', { icon: 7 });
+ // }
+ // }
data.field.details = list;
data.field.id = objParam.id;
let delId = '';
diff --git a/js/accessory/child/accessory_store_form.js b/js/accessory/child/accessory_store_form.js
index 86157c9..7a38a20 100644
--- a/js/accessory/child/accessory_store_form.js
+++ b/js/accessory/child/accessory_store_form.js
@@ -136,9 +136,9 @@ function submitApply(data) {
if (list[i].inputNum === 0 || list[i].inputNum === '0') {
return layer.msg('入库配件明细,第' + (i + 1) + '行,未填写本次入库量', { icon: 7 });
}
- if (list[i].partPrice === 0 || list[i].partPrice === '0') {
- return layer.msg('入库配件明细,第' + (i + 1) + '行,未填写单价', { icon: 7 });
- }
+ // if (list[i].partPrice === 0 || list[i].partPrice === '0') {
+ // return layer.msg('入库配件明细,第' + (i + 1) + '行,未填写单价', { icon: 7 });
+ // }
}
data.field.details = list;
let formData = new FormData();