This commit is contained in:
cwchen 2024-11-14 15:48:10 +08:00
parent 54f1a5b2fd
commit fc89f79523
6 changed files with 45 additions and 136 deletions

View File

@ -104,7 +104,7 @@ function initTable() {
let value = '';
if (d.devType === '1') {
value = '工器具';
} else if (d.devType === '2') {
} else if (d.devType === '0') {
value = '设备';
}
return '<span>' + value + '</span>'
@ -155,7 +155,7 @@ function initTable() {
unresize: true,
templet: function (d) {
let html = "";
html += "<a onclick='accessoryOutBoundDetail(" + JSON.stringify(d) + ",1)'>详情</a>";
html += "<a onclick='accessoryOutBoundDetail(" + JSON.stringify(d) + ")'>详情</a>";
if (d.status === '1') { // 待审核
html += "<div class='splitLine'>|</div><a onclick='accessoryOutBoundDetail(" + JSON.stringify(d) + ",2)'>审核</a>";
} else if (d.status === '2') { // 审核通过待出库
@ -201,8 +201,7 @@ function exportExcel() {
}
// 详情 审核 出库确认
function accessoryOutBoundDetail(obj, type) {
obj.type = type;
obj.devType = '2'; // 1.工器具 2.设备
function accessoryOutBoundDetail(obj) {
// 1.工器具 0.设备
openIframeByParamObj("accessory_out_bound_detail", "配件出库记录", "../accessory/child/accessory_out_bound_detail.html", "92%", "95%", obj);
}

View File

@ -11,7 +11,7 @@ function setParams(params) {
$('#print').before('<button type="button" class="layui-btn layui-bg-blue save" onclick="submitApply()">确认出库</button>');
$('#upload').removeAttr('style');
}
if (objParam.devType === '2') { // 设备
if (objParam.devType === '0') { // 设备
let html = '';
html += '<tr>' +
'<th>内部编号</th><th>使用机型</th><th>使用单位</th><th></th>'

View File

@ -241,14 +241,13 @@ function setTableData(results) {
html += "<td>" + l.name + "</td>";
html += "<td>" + l.model + "</td>";
html += "<td>" + l.unit + "</td>";
html += "<td>" + setFormInput(l.num, 1) + "</td>";
html += "<td>" + setFormInput(l.price, 2) + "</td>";
html += "<td>" + setFormInput(l.manufacturer, 3) + "</td>";
html += "<td>" + setFormInput(l.remarks, 4) + "</td>";
html += "<td>" + setFormInput(l.needNum, 1) + "</td>";
html += "<td>" + setFormInput(l.times, 2) + "</td>";
html += "<td>" + setFormInput(l.remarks, 3) + "</td>";
html += "</tr>";
}
} else {
html += "<tr><td colspan='10' class='center'>没有相关数据</td></tr>";
html += "<tr><td colspan='9' class='center'>没有相关数据</td></tr>";
}
$("#baseTable tbody").empty().append(html);
layui.form.render();
@ -256,11 +255,11 @@ function setTableData(results) {
function setFormInput(value, type) {
let html = '<form class="layui-form layuimini-form"><div class="layui-inline">';
if (type === 1) { // 入库
html += '<input class="layui-input" name="num" onblur="checkValue(this,1)" value="' + setNullValue(value) + '" autocomplete="off" lay-verify="required" maxlength="9" lay-affix="clear">';
} else if (type === 2) { // 单价
html += '<input class="layui-input" name="price" onblur="checkValue(this,2)" value="' + setNullValue(value) + '" autocomplete="off" lay-verify="required" maxlength="9" lay-affix="clear">';
} else if (type === 4) { // 备注
if (type === 1) { // 需用
html += '<input class="layui-input" name="needNum" onblur="checkValue(this,1,"需用量")" value="' + setNullValue(value) + '" autocomplete="off" lay-verify="required" maxlength="9" lay-affix="clear">';
} else if (type === 2) { // 需用天数
html += '<input class="layui-input" name="times" onblur="checkValue(this,2,"需用天数")" value="' + setNullValue(value) + '" autocomplete="off" lay-verify="required" maxlength="9" lay-affix="clear">';
} else if (type === 3) { // 备注
html += '<input class="layui-input" placeholder="请输入备注" id="remarks" name="remarks" value="' + setNullValue(value) + '" maxLength="255" lay-affix="clear"></input>';
}
html += '</div></form>';
@ -330,18 +329,12 @@ function delFitType() {
}
// 校验数据
function checkValue(that, type) {
function checkValue(that, type, name) {
let value = $(that).val();
if (type === 1) { // 入库量
if (type === 1 || type === 2) { // 需用量 / 需用天数
const regex = /^(0|[1-9]\d{0,6})$/;
if (!regex.test(value) && value) {
layer.msg('入库量输入不合法,请重新输入!', { icon: 5 })
$(that).val('');
}
} else if (type === 2) { // 单价
const regex = /^(?:1(?:\d{0,8}|[0-9]*\.\d{1,2})|(?:[1-9]\d{0,7}|[1-9]\d{0,6}\.\d{1,2}|[1-9]\d{1,7}\.\d{2}|100000000(?:\.00)?))$/;
if (!regex.test(value) && value) {
layer.msg('单价输入不合法,请重新输入!', { icon: 5 })
layer.msg('' + name + '输入不合法,请重新输入!', { icon: 5 })
$(that).val('');
}
}

View File

@ -15,27 +15,10 @@ function setParams(obj) {
element = layui.element;
layer = layui.layer;
util = layui.util;
getVendList();
initTable();
});
}
// 厂家下拉选
function getVendList() {
cjList.splice(0, cjList.length);
let encryptedData = {};
let url = dataUrl + 'backstage/paType/getVendList?encryptedData=' + encodeURIComponent(JSON.stringify(encryptedData));
ajaxRequest(url, "GET", null, false, function () {
}, function (result) {
console.log(result);
if (result.code === 200) {
cjList = result.data;
}
}, function (xhr, status, error) {
errorFn(xhr, status, error)
}, null);
}
// 查询/重置
function queryTable(type) {
if (type === 1) {
@ -43,7 +26,6 @@ function queryTable(type) {
} else if (type === 2) {
$('#name').val('');
$('#module').val('');
$('#type').val('');
layui.form.render();
reloadTable(1);
}
@ -59,7 +41,6 @@ function reloadTable(pageNum) {
encryptedData: JSON.stringify({
'name': $('#name').val(),
'model': $('#model').val(),
'type': $('#type').val(),
}),
},
},
@ -81,7 +62,6 @@ function initTable() {
encryptedData: JSON.stringify({
'type': $('#type').val(),
'name': $('#name').val(),
'model': $('#model').val(),
}),
},
request: {
@ -121,61 +101,53 @@ function initTable() {
},
{
field: "type",
width: '11.8%',
title: "配件类型",
width: '10%',
title: "物机类型",
unresize: true,
align: "center",
},
{
field: "name",
width: '12%',
title: "配件名称",
width: '10%',
title: "物机名称",
unresize: true,
align: "center",
},
{
field: "model",
width: '10%',
title: "规格型号",
title: "规格",
unresize: true,
align: "center",
},
{
field: "unit",
title: "单位",
width: '8%',
unresize: true,
align: "center",
},
{
field: "num",
width: '10%',
title: "<span style='color:red'> * </span>本次入库量",
unresize: true,
align: "center",
edit: 'text',
style: 'outline: 1px solid #e6e6e6;outline-offset: -5px;'
},
{
field: "price",
width: '9.8%',
title: "单价(元)",
unresize: true,
align: "center",
edit: 'text',
style: 'outline: 1px solid #e6e6e6;outline-offset: -5px;'
},
{
field: "manufacturer",
field: "needNum",
width: '15%',
title: "<span style='color:red'> * </span>配件厂家",
title: "<span style='color:red'> * </span>需用量",
unresize: true,
align: "center",
templet: '#TPL-select-demo'
edit: 'text',
style: 'outline: 1px solid #e6e6e6;outline-offset: -5px;'
},
{
field: "times",
width: '15%',
title: "<span style='color:red'> * </span>需用天数",
unresize: true,
align: "center",
edit: 'text',
style: 'outline: 1px solid #e6e6e6;outline-offset: -5px;'
},
{
field: "remarks",
width: '12%',
width: '18.9%',
title: "备注",
unresize: true,
align: "center",
@ -189,24 +161,8 @@ function initTable() {
limit: 10,
page: true,
done: function (res, curr, count) {
var options = this;
table.resize("currentTableId");
pageNum = tableIns.config.page.curr;
form.on('select(select-demo)', function (obj) {
console.log(obj);
var value = obj.value; // 获取选中项 value
// 获取当前行数据(如 id 等字段,以作为数据修改的索引)
var data = table.getRowData(options.id, obj.elem);
// 更新数据中对应的字段
data.manufacturer = value;
updateOrAddObject(data.id, data);
});
// 获取当前行数据 - 自定义方法
table.getRowData = function (tableId, elem) {
var index = $(elem).closest('tr').data('index');
return table.cache[tableId][index] || {};
};
//设置全部数据到全局变量
quanju = res.data;
for (var i = 0; i < res.data.length; i++) {
@ -234,7 +190,7 @@ function initTable() {
table.on('edit(currentTableId2)', function (obj) {
var field = obj.field; // 得到修改的字段
var value = obj.value // 得到修改后的值
if (field === 'num') { // 本次入库量
if (field === 'needNum' || field === 'times') { // 需用量 / 需用天数
if (value) {
const regex = /^(0|[1-9]\d{0,6})$/;
if (!regex.test(value)) {
@ -242,12 +198,6 @@ function initTable() {
return layer.msg('格式不正确最大输入6位数且为正整数', { icon: 7 })
}
}
} else if (field === 'price') {
const regex = /^(?:1(?:\d{0,8}|[0-9]*\.\d{1,2})|(?:[1-9]\d{0,7}|[1-9]\d{0,6}\.\d{1,2}|[1-9]\d{1,7}\.\d{2}|100000000(?:\.00)?))$/;
if (!regex.test(value)) {
obj.reedit();
return layer.msg('单价格式不正确!', { icon: 7 })
}
} else if (field === 'remarks') { // 备注
if (value) {
if (value.length > 255) {
@ -363,13 +313,7 @@ function saveData2(params) {
}
}
// 配件类型
function addFitTypeData() {
openIframeByParamObj2("add_fit_type_data", "配件类型", "../../../page/basic/fit_type_list.html", "92%", "95%", {});
}
function closePage(type,params) {
function closePage(type, params) {
let index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe层的索引
parent.layer.close(index); // 再执行关闭
if (type == 1) {

View File

@ -89,18 +89,12 @@
lay-affix="clear" placeholder="输入配件名称" maxlength="30">
</div>
</div>
<div class="layui-inline">
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="model" id="model" autocomplete="off" class="layui-input"
lay-affix="clear" placeholder="输入规格型号" maxlength="30">
</div>
</div>
<div class="layui-inline">
<button class="layui-btn layui-bg-blue" onclick="search()"><i class="layui-icon"></i>
</button>
<button class="layui-btn layui-btn-primary" onclick="resetSearch()"><i
class="layui-icon layui-icon-refresh"></i> 重 置</button>
<button class="layui-btn layui-bg-blue" onclick="chooseFitType()">选择入库配件类型</button>
<button class="layui-btn layui-bg-blue" onclick="chooseFitType()">选择机具</button>
<button class="layui-btn layui-bg-red" onclick="delFitType()">删除选中</button>
</div>
</div>
@ -115,13 +109,12 @@
<input id="allCheck" onclick="selectAll(this.checked)" type="checkbox">
</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>
<th style="width: 15%" class="center">物机名称</th>
<th style="width: 10%" class="center">规格</th>
<th style="width: 10%" class="center">单位</th>
<th style="width: 10%" class="center"><span style="color: red;">*</span> 本次入库量</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"><span style="color: red;">*</span>需用天数</th>
<th style="width: 15%" class="center">备注</th>
</tr>
</thead>
@ -130,7 +123,7 @@
</div>
</div>
<div class="btn-box">
<button class="layui-btn layui-bg-blue save" onclick="saveData2()">确定申请</button>
<button class="layui-btn layui-bg-blue save" onclick="saveData2()">提交申请</button>
<button class="layui-btn layui-btn-primary cancel" onclick="closePage()">返回</button>
</div>
</div>

View File

@ -53,23 +53,11 @@
class="layui-input" lay-affix="clear" placeholder="输入配件名称" maxlength="30">
</div>
</div>
<div class="layui-inline">
<div class="layui-input-inline" style="width: 160px;">
<input type="text" name="model" id="model" autocomplete="off"
class="layui-input" lay-affix="clear" placeholder="输入规格型号" maxlength="30">
</div>
</div>
<div class="layui-inline">
<button class="layui-btn layui-bg-blue" onclick="queryTable(1)"><i
class="layui-icon"></i> 搜 索</button>
<button class="layui-btn layui-btn-primary" onclick="queryTable(2)"><i
class="layui-icon layui-icon-refresh"></i> 重 置</button>
<button type="button" class="layui-btn" onclick="addFitTypeData()">
<i class="layui-icon layui-icon-add-1"></i>添 加
</button>
</div>
<div class="layui-inline">
<p>(需求计划无机具名称及规格,点击添加新数据)</p>
</div>
</div>
</form>
@ -85,14 +73,6 @@
</div>
</div>
</body>
<script type="text/html" id="TPL-select-demo">
{{# var manufacturerList = cjList; }}
<select name="city" lay-filter="select-demo" lay-append-to="body" lay-search>
{{# layui.each(manufacturerList, function(i, v){ }}
<option value="{{= v.id }}" {{=v.id===d.manufacturer ? 'selected' : '' }}>{{= v.name }}</option>
{{# }); }}
</select>
</script>
<script src="../../../lib/jquery-3.4.1/jquery-3.4.1.min.js" charset="utf-8"></script>
<script src="../../../js/public.js" charset="utf-8"></script>
<script src="../../../js/Print.js" charset="utf-8"></script>