This commit is contained in:
cwchen 2024-11-13 18:17:16 +08:00
parent 743f7ab24b
commit a277dab32b
5 changed files with 69 additions and 92 deletions

View File

@ -4,8 +4,7 @@ let pageNum = 1;
let quanju = new Array();//全局
let huancun = new Array();//缓存
let huancunObj = new Array();//缓存2
let cjList = [];
let jjDetailArr = []; // 入库配件类型数据
let jjDetailArr = []; // 盘点数据
function setParams(obj) {
objParam = JSON.parse(obj);
console.log(objParam);
@ -15,26 +14,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) {
@ -121,25 +104,32 @@ function initTable() {
},
{
field: "type",
width: '11.8%',
width: '8%',
title: "配件类型",
unresize: true,
align: "center",
},
{
field: "name",
width: '12%',
width: '8%',
title: "配件名称",
unresize: true,
align: "center",
},
{
field: "model",
width: '10%',
width: '8%',
title: "规格型号",
unresize: true,
align: "center",
},
{
field: "unit",
title: "平均单价(元)",
width: '9%',
unresize: true,
align: "center",
},
{
field: "unit",
title: "单位",
@ -147,10 +137,20 @@ function initTable() {
unresize: true,
align: "center",
},
{
field: "unit",
title: "库存量",
width: '8%',
unresize: true,
align: "center",
templet: function (d) {
return '<span style="color:#19BE6B;font-weight:bold;">1</span>';
},
},
{
field: "num",
width: '10%',
title: "<span style='color:red'> * </span>本次入库量",
title: "<span style='color:red'> * </span>本次盘点量",
unresize: true,
align: "center",
edit: 'text',
@ -158,24 +158,25 @@ function initTable() {
},
{
field: "price",
width: '9.8%',
title: "单价(元)",
width: '10%',
title: "<span style='color:red'> * </span>盘盈量",
unresize: true,
align: "center",
edit: 'text',
style: 'outline: 1px solid #e6e6e6;outline-offset: -5px;'
},
{
field: "manufacturer",
width: '15%',
title: "<span style='color:red'> * </span>配件厂家",
field: "<span style='color:red'> * </span>price",
width: '10%',
title: "盘亏量",
unresize: true,
align: "center",
templet: '#TPL-select-demo'
edit: 'text',
style: 'outline: 1px solid #e6e6e6;outline-offset: -5px;'
},
{
field: "remarks",
width: '12%',
width: '10%',
title: "备注",
unresize: true,
align: "center",
@ -369,7 +370,7 @@ 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

@ -2,7 +2,6 @@ let idParam, objParam, fileList = new Array(), imgListUp = new Array();
let form, laydate, layer, upload, table, util;
let pageNum = 1, tableIns; // 定义分页
let jjDataArr = []; // 入库配件数据
let cjList = []; // 厂家下拉选
let delIdArr = [];
function setParams(obj) {
objParam = JSON.parse(obj);
@ -54,7 +53,6 @@ function setParams(obj) {
});
}
});
getVendList();
});
}
// 设置文件类型
@ -290,7 +288,9 @@ function setTableData(results) {
html += "<td>" + l.type + "</td>";
html += "<td>" + l.name + "</td>";
html += "<td>" + l.model + "</td>";
html += "<td>" + l.model + "</td>";
html += "<td>" + l.unit + "</td>";
html += "<td style='color:#19BE6B;font-weight:bold;'>" + l.unit + "</td>";
html += "<td>" + setFormInput(l.num, 1) + "</td>";
html += "<td>" + setFormInput(l.price, 2) + "</td>";
html += "<td>" + setFormInput(l.manufacturer, 3) + "</td>";
@ -311,9 +311,7 @@ function setFormInput(value, type) {
} 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 === 3) { // 厂家
html += '<select class="layui-select" name="manufacturer" id="manufacturer" lay-search>' +
setSelectData(value) +
'</select>';
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) { // 备注
html += '<input class="layui-input" placeholder="请输入备注" id="remarks" name="remarks" value="' + setNullValue(value) + '" maxLength="255" lay-affix="clear"></input>';
}
@ -322,35 +320,6 @@ function setFormInput(value, type) {
}
function setSelectData(value) {
let html = '';
$.each(cjList, function (index, item) {
if (item.id === value) {
html += '<option value="' + item.id + '" selected>' + item.name + '</option>'
} else {
html += '<option value="' + item.id + '">' + item.name + '</option>'
}
})
return html;
}
// 厂家下拉选
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 selectAll(selectStatus) {//传入参数(全选框的选中状态)
if (selectStatus) {

View File

@ -114,6 +114,9 @@ function initTable() {
title: "盘点数量变化",
unresize: true,
align: "center",
templet: function (d) {
return setInventory(100,200);
},
},
{
field: "remark",
@ -145,18 +148,18 @@ function initTable() {
});
}
// 状态颜色
function setStatusColor(value) {
value = value ? parseInt(value) : 0;
let color = "";
let name = ''
if (value === '0') {
color = "#f56c6c";
name = '否';
} else {
name = '是';
// 设置盘点数量变化
function setInventory(value, value2) {
if (value === 0 || value2 === 0) {
return '<span style="color:#409EFF">0</span>';
}else if (value > 0 && value2 > 0) {
return '<span style="color:#19BE6B">盘盈:' + value + '</span><br><span style="color:#f56c6c">盘亏:' + value2 + '</span>';
}else if (value > 0 && value2 === 0) {
return '<span style="color:#19BE6B">盘盈:' + value + '</span>';
}else if (value === 0 && value2 > 0) {
return '<span style="color:#f56c6c">盘亏:' + value2 + '</span>';
}
return '<span style="color:' + color + '">' + name + "</span>";
}
// 导出
@ -170,7 +173,7 @@ function exportExcel() {
}
// 库存盘点
function inventoryCount(obj){
function inventoryCount(obj) {
openIframeByParamObj("inventory_count", "库存盘点", "./child/inventory_count_form.html", "92%", "95%", obj);
}

View File

@ -85,14 +85,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>

View File

@ -100,6 +100,16 @@
<button class="layui-btn layui-bg-blue" onclick="chooseFitType()">选择入库配件类型</button>
<button class="layui-btn layui-bg-red" onclick="delFitType()">删除选中</button>
</div>
<div class="layui-inline">
<div style="color: #19BE6B;" class="layout">
<p>盘盈:<span style="font-weight: bold;">653</span></p>
<p style="margin-left: 20px;">¥ <span style="font-weight: bold;">15,653</span></p>
</div>
<div style="color:#f56c6c ;" class="layout">
<p>盘亏:<span style="font-weight: bold;">120</span></p>
<p style="margin-left: 20px;">¥ <span style="font-weight: bold;">12,120</span></p>
</div>
</div>
</div>
</form>
</div>
@ -112,14 +122,16 @@
<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: 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">备注</th>
<th style="width: 8%" class="center">配件类型</th>
<th style="width: 8%" class="center">配件名称</th>
<th style="width: 8%" class="center">规格型号</th>
<th style="width: 10%" class="center">平均单价(元)</th>
<th style="width: 8%" class="center">单位</th>
<th style="width: 8%" class="center">库存量</th>
<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"><span style="color: red;">*</span>盘亏量</th>
<th style="width: 10%" class="center">备注</th>
</tr>
</thead>
<tbody></tbody>