main
kgdxpr 1 year ago
parent adf9c67cfb
commit 42c011b629

@ -31,6 +31,34 @@
.layui-table th {
font-size: 12px;
}
.bp {
background-color: rgba(23, 179, 163, .1);
padding: 5px 10px;
height: 32px;
line-height: 30px;
font-size: 12px;
color: #17b3a3;
border-radius: 4px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
border: 1px solid rgba(23, 179, 163, .2);
white-space: nowrap;
}
.xp {
background-color: rgba(144, 147, 153, .1);
padding: 5px 10px;
height: 32px;
line-height: 30px;
font-size: 12px;
color: #909399;
border-radius: 4px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
border: 1px solid rgba(144, 147, 153, .2);
white-space: nowrap;
}
</style>
</head>
@ -38,13 +66,13 @@
<div class="layui-card">
<div class="layui-card-body">
<div class="layui-form-item layui-inline">
<!-- <div class="layui-form-item layui-inline">
<label class="layui-form-label" style="width: auto;">设备名称:</label>
<div class="layui-input-inline">
<input type="text" id="personName" lay-affix="clear" lay-filter="clear" placeholder="请输入设备名称"
class="layui-input">
</div>
</div>
</div> -->
<div class="layui-form-item layui-inline">
<label class="layui-form-label" style="width: auto;">学科:</label>
<div class="layui-input-inline" id="kmView">
@ -70,6 +98,15 @@
</div>
<table class="layui-table" id="myTable"></table>
<script type="text/html" id="pbyq_templet">
{{# if(d.bp_xp > 0){ }}
<span class="bp">必配</span>
{{# } else { }}
<span class="xp">选配</span>
{{# } }}
</script>
</div>
</div>
@ -90,7 +127,7 @@
var xmSelectData = [];
var fenleiSelect;
$.ajax({
type: "GET",
@ -103,11 +140,15 @@
kmView.innerHTML = html;
});
form.render();
getXmSelect();
tableRender("");
}
});
var fenleiSelect = xmSelect.render({
function getXmSelect() {
fenleiSelect = xmSelect.render({
el: '#fenlei',
clickClose: true,
radio: true,
@ -143,11 +184,10 @@
name: "level_name"
}
});
$.ajax({
type: 'GET',
async: false,
url: '/QingLong/zbdc/getKmFeiLeiTree?km_code=xxty',
url: '/QingLong/zbdc/getKmFeiLeiTree?km_code=' + $("#kmId").val(),
success: function (res) {
xmSelectData = res.data;
fenleiSelect.update({
@ -156,6 +196,17 @@
fenleiSelect.changeExpandedKeys(true);
}
});
}
form.on('select(km)', function (data) {
getXmSelect();
});
function findNodeAndParents(levelName) {
function search(node, path) {
@ -186,22 +237,28 @@
form.on('submit(user-query)', function () {
var selectArr = fenleiSelect.getValue();
console.log(selectArr[0].level_name);
const levelName = "少儿(趣味)田径";
if (selectArr.length > 0) {
const levelName = selectArr[0].level_name;
const result = findNodeAndParents(levelName);
console.log(result.join(','));
tableRender(result.join(','));
}
else{
tableRender("");
}
// 阻止表单的默认提交行为
return false;
});
function tableRender(fenlei_name) {
table.render({
elem: '#myTable',
url: '/QingLong/zbdc/getFill?km_code=xxty',
where: {
km_code: $("#kmId").val(),
level_filter: fenlei_name
},
height: 'full-70',
page: {
limit: 15
@ -214,10 +271,10 @@
{ title: '分类', field: 'level', align: 'center', width: "10%" },
{ title: '分类代码', field: 'fldm', align: 'center', width: "10%" },
{ title: '名称', field: 'mc', align: 'center', width: "10%" },
{ title: '规格型号功能', field: 'ggxhgn', align: 'center', width: "10%" },
{ title: '规格型号功能', field: 'ggxhgn', align: 'center', width: "15%" },
{ title: '单位', field: 'dw', align: 'center', width: "5%" },
{ title: '应配数量', field: 'ypsl', align: 'center', width: "5%" },
{ title: '配备要求', field: 'bp_xp', align: 'center', width: "5%" },
{ title: '配备要求', align: 'center', width: "5%", templet: '#pbyq_templet' },
{ title: '现有数量', templet: '<input class="layui-input aabbxx">', align: 'center', width: "10%", style: 'cursor: pointer;' },
{ title: '备注', field: 'bz', align: 'center', width: "25%" }
@ -239,8 +296,6 @@
tempVal = this.value.trim();
});
$(".aabbxx").blur(function () {
var curVal = this.value.trim();
var data = table.getRowData(options.id, this);
@ -259,6 +314,12 @@
});
}
});
}

Loading…
Cancel
Save