This commit is contained in:
cwchen 2024-11-15 14:22:21 +08:00
parent 4233327b61
commit 4152458b89
4 changed files with 46 additions and 35 deletions

View File

@ -142,13 +142,22 @@ function initTable() {
title: "库存数量", title: "库存数量",
unresize: true, unresize: true,
align: "center", align: "center",
templet: function (d) {
if(d.num > 0){
return d.num;
}
return '<p style="color:#f56c6c;">' + d.num + ' </p>';
},
}, },
{ {
field: "price", field: "price",
width: '15%', width: '15%',
title: "平均单价(元)", title: "平均单价(元)",
unresize: true, unresize: true,
align: "center" align: "center",
templet: function (d) {
return ' ¥ ' + d.price;
},
}, },
], ],
], ],

View File

@ -1,15 +1,9 @@
let form, table, laydate; let form, table;
let tableIns; let tableIns;
let pageNum = 1; // 定义分页 let pageNum = 1; // 定义分页
layui.use(["form", "table", 'laydate'], function () { layui.use(["form", "table"], function () {
form = layui.form; form = layui.form;
table = layui.table; table = layui.table;
laydate = layui.laydate;
laydate.render({
elem: '#ID-laydate-rangeLinked',
range: ['#startDay', '#endDay'],
rangeLinked: true
});
initTable(); initTable();
}); });
@ -18,9 +12,8 @@ function queryTable(type) {
if (type === 1) { if (type === 1) {
reloadTable(1); reloadTable(1);
} else if (type === 2) { } else if (type === 2) {
$('#keyWord').val(''); $('#proName').val('');
$('#startDate').val(''); $('#proStatus').val('');
$('#endDate').val('');
layui.form.render(); layui.form.render();
reloadTable(1); reloadTable(1);
} }
@ -39,9 +32,8 @@ function reloadTable(pageNum) {
}, },
where: { where: {
encryptedData: JSON.stringify({ encryptedData: JSON.stringify({
'keyWord': $('#keyWord').val(), 'proName': $('#proName').val(),
'startDate': $('#startDate').val(), 'proStatus': $('#proStatus').val()
'endDate': $('#endDate').val()
}), }),
}, },
}, },
@ -57,12 +49,11 @@ function initTable() {
authorization: sessionStorage.getItem("gz-token"), authorization: sessionStorage.getItem("gz-token"),
}, },
height: "full-170", height: "full-170",
url: dataUrl + "backstage/partInput/findByPage", url: dataUrl + "backstage/statistic/getProListPage",
where: { where: {
encryptedData: JSON.stringify({ encryptedData: JSON.stringify({
'keyWord': $('#keyWord').val(), 'proName': $('#proName').val(),
'startDate': $('#startDate').val(), 'proStatus': $('#proStatus').val()
'endDate': $('#endDate').val()
}), }),
}, },
request: { request: {
@ -88,40 +79,40 @@ function initTable() {
}, },
}, },
{ {
field: "code", field: "proName",
width: '15%', width: '15%',
title: "工程名称", title: "工程名称",
unresize: true, unresize: true,
align: "center", align: "center",
}, },
{ {
field: "inputUser", field: "proStatus",
width: '8%', width: '8%',
title: "工程状态", title: "工程状态",
unresize: true, unresize: true,
align: "center", align: "center",
templet: function (d) { templet: function (d) {
return setProStatus('1'); return setProStatus(d.proStatus);
}, },
}, },
{ {
field: "inputNum", field: "wxdNum",
width: '10%', width: '10%',
title: "维修单数量", title: "维修单数量",
unresize: true, unresize: true,
align: "center", align: "center",
templet: function (d) { templet: function (d) {
return '<span style="color:#ff9900;font-weight:bold;">1</span>'; return '<span style="color:#ff9900;font-weight:bold;">' + setNullNumValue(d.wxdNum) + '</span>';
}, },
}, },
{ {
field: "allPrice", field: "lydNum",
width: '10%', width: '10%',
title: "配件领料单数量", title: "配件领料单数量",
unresize: true, unresize: true,
align: "center", align: "center",
templet: function (d) { templet: function (d) {
return '<span style="color:#409eff;font-weight:bold;">1</span>'; return '<span style="color:#409eff;font-weight:bold;">' + setNullNumValue(d.lydNum) + '</span>';
}, },
}, },
{ {
@ -141,8 +132,7 @@ function initTable() {
unresize: true, unresize: true,
align: "center", align: "center",
templet: function (d) { templet: function (d) {
return '<p style="color:#409eff;">领2,563 </p>'; return '<p style="color:#409eff;">领:' + setNullNumValue(d.lyNum) + ' </p>';
// return '<p style="color:#409eff;">领2,563 </p><p style="color:#19be6b;">用2,000 </p><p style="color:#f56c6c;">退563</p>';
}, },
}, },
@ -153,8 +143,7 @@ function initTable() {
unresize: true, unresize: true,
align: "center", align: "center",
templet: function (d) { templet: function (d) {
return '<p style="color:#409eff;">领2,563 </p>'; return '<p style="color:#409eff;">领:' + setNullNumValue(d.lyMoney) + ' </p>';
// return '<p style="color:#409eff;">领2,563 </p><p style="color:#19be6b;">用2,000 </p><p style="color:#f56c6c;">退563</p>';
}, },
}, },
{ {
@ -184,10 +173,10 @@ function initTable() {
function exportExcel() { function exportExcel() {
let params = { let params = {
'proName': $('#proName').val(), 'proName': $('#proName').val(),
'status': $('#status').val() 'proStatus': $('#proStatus').val()
} }
let url = dataUrl + "backstage/export/exportFhList"; let url = dataUrl + "backstage/statistic/exportProListPage";
exportExcelUtil(url, '配件入库数据', JSON.stringify(params)); exportExcelUtil(url, '工程统计', JSON.stringify(params));
} }
// 配件退料详情 // 配件退料详情
@ -201,5 +190,7 @@ function setProStatus(status) {
return "<span style='color:#19BE6B;margin:0 5px 0 5px;font-size:16px'>●</span>在建"; return "<span style='color:#19BE6B;margin:0 5px 0 5px;font-size:16px'>●</span>在建";
} else if (status === '2') { } else if (status === '2') {
return "<span style='color:#999;margin:0 5px 0 5px;font-size:16px;'>●</span>完工"; return "<span style='color:#999;margin:0 5px 0 5px;font-size:16px;'>●</span>完工";
} else {
return '';
} }
} }

View File

@ -148,6 +148,16 @@ function setNullValue(value) {
return value; return value;
} }
// 数字空值赋值
function setNullNumValue(value) {
if (value === 0) {
return 0;
} else if (!value || value === 'null') {
return 0;
}
return value;
}
function getUrlParam(key) { function getUrlParam(key) {
var href = window.location.href; var href = window.location.href;
var url = href.split("?"); var url = href.split("?");

View File

@ -22,12 +22,13 @@
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-inline"> <div class="layui-inline">
<div class="layui-input-inline" style="width: 300px;"> <div class="layui-input-inline" style="width: 300px;">
<input type="text" name="keyWord" id="keyWord" autocomplete="off" <input type="text" name="proName" id="proName" autocomplete="off"
class="layui-input" lay-affix="clear" placeholder="输入工程名称" maxlength="30"> class="layui-input" lay-affix="clear" placeholder="输入工程名称" maxlength="30">
</div> </div>
</div> </div>
<div class="layui-inline" style="width: 200px;"> <div class="layui-inline" style="width: 200px;">
<select class="layui-select"> <select class="layui-select">
<option value="">请选择</option>
<option value="1">在建</option> <option value="1">在建</option>
<option value="2">完工</option> <option value="2">完工</option>
</select> </select>