main
kgdxpr 2 years ago
parent 84698f5950
commit 2c8090f25c

@ -71,8 +71,27 @@
</div> </div>
</div> </div>
<div id="tableDiv" style="width: 650px;"> <div id="tableDiv" style="width: 650px;">
<div class="layui-table-tool" style="min-height: 38px !important">
<div class="layui-input-inline"
style="margin-left: -16px;width: 150px !important;">
<select id="orgTypeId" lay-filter="orgTypeId">
<option value="-1">全部</option>
<option value="5">市直教辅单位</option>
<option value="9">市直学校</option>
<option value="11">区县教育局</option>
</select>
</div>
<div class="layui-input-group" style="margin-left: -16px;">
<input type="text" id="org_name" placeholder="请输入单位名称"
class="layui-input" lay-affix="clear" lay-filter="clear">
<div class="layui-input-split layui-input-suffix"
style="cursor: pointer;" lay-on="confirm">
<i class="layui-icon layui-icon-search"></i>
</div>
</div>
</div>
<table id="data-table"></table> <table id="data-table"></table>
<script type="text/html" id="table-toolbar"> <!-- <script type="text/html" id="table-toolbar">
<div class="layui-input-inline" style="margin-left: -16px;width: 150px !important;"> <div class="layui-input-inline" style="margin-left: -16px;width: 150px !important;">
<select id="orgTypeId" lay-filter="orgTypeId"> <select id="orgTypeId" lay-filter="orgTypeId">
<option value="-1">全部</option> <option value="-1">全部</option>
@ -87,7 +106,7 @@
<i class="layui-icon layui-icon-search"></i> <i class="layui-icon layui-icon-search"></i>
</div> </div>
</div> </div>
</script> </script> -->
<script type="text/html" id="select-enable"> <script type="text/html" id="select-enable">
<input type="checkbox" id="{{d.org_id}}" lay-skin="switch" lay-text="已选|未选" lay-filter="switchEnable" <input type="checkbox" id="{{d.org_id}}" lay-skin="switch" lay-text="已选|未选" lay-filter="switchEnable"
{{ d.sw == true ? "checked" : "" }}> {{ d.sw == true ? "checked" : "" }}>
@ -146,78 +165,82 @@
min: 0 min: 0
}); });
table.render({ renderBureauTable();
elem: '#data-table',
id: 'myTable', function renderBureauTable() {
url: '/QingLong/collect/getBureauList', table.render({
where: { elem: '#data-table',
org_type_id: "-1", id: 'myTable',
org_name: $("#org_name").val(), url: '/QingLong/collect/getBureauList',
query_type_id: 1, where: {
exclude_self: 1 org_type_id: $("#orgTypeId").val(),
}, org_name: $("#org_name").val(),
// height: '374', query_type_id: 1,
page: { exclude_self: 1
limit: 5 },
, layout: ['count', 'prev', 'page', 'next', 'skip'] // height: '374',
, prev: "上一页" page: {
, next: "下一页" limit: 5
}, , layout: ['count', 'prev', 'page', 'next', 'skip']
cols: [[ , prev: "上一页"
{ title: '序号', align: 'center', width: "5%", type: 'numbers' }, , next: "下一页"
{ title: '单位名称', field: 'org_name', align: 'center' }, },
{ title: '单位类型', field: 'org_type_name', align: 'center', width: "20%" }, cols: [[
{ title: '操作', align: 'center', width: "25%", templet: '#select-enable' } { title: '序号', align: 'center', width: "5%", type: 'numbers' },
]], { title: '单位名称', field: 'org_name', align: 'center' },
skin: 'line', { title: '单位类型', field: 'org_type_name', align: 'center', width: "20%" },
toolbar: '#table-toolbar', { title: '操作', align: 'center', width: "25%", templet: '#select-enable' }
defaultToolbar: [], ]],
parseData: function (res) { skin: 'line',
var data = res.data; // toolbar: '#table-toolbar',
for (var i = 0; i < data.length; i++) { defaultToolbar: [],
switch (data[i].org_type_id) { parseData: function (res) {
case 5: var data = res.data;
res.data[i].org_type_name = '市直教辅单位'; for (var i = 0; i < data.length; i++) {
break; switch (data[i].org_type_id) {
case 9: case 5:
res.data[i].org_type_name = '市直学校'; res.data[i].org_type_name = '市直教辅单位';
break; break;
case 11: case 9:
res.data[i].org_type_name = '区县教育局'; res.data[i].org_type_name = '市直学校';
break; break;
default: case 11:
res.data[i].org_type_name = '--'; res.data[i].org_type_name = '区县教育局';
break; break;
} default:
res.data[i].org_type_name = '--';
break;
}
res.data[i].sw = false res.data[i].sw = false
if (bureauIds.includes(data[i].org_id)) { if (bureauIds.includes(data[i].org_id)) {
res.data[i].sw = true res.data[i].sw = true
}
} }
return res;
},
done: function (res, curr, count) {
var options = this;
// 获取当前行数据
table.getRowData = function (tableId, elem) {
var index = $(elem).closest('tr').data('index');
return table.cache[tableId][index] || {};
};
form.on('switch(switchEnable)', function (obj) {
var data = table.getRowData(options.id, this);
if (obj.elem.checked) {
tag.add('orgs', { text: data.org_name, id: data.org_id });
bureauIds.push(data.org_id);
}
else {
tag.delete('orgs', data.org_id);
}
});
} }
return res; });
}, }
done: function (res, curr, count) {
var options = this;
// 获取当前行数据
table.getRowData = function (tableId, elem) {
var index = $(elem).closest('tr').data('index');
return table.cache[tableId][index] || {};
};
form.on('switch(switchEnable)', function (obj) {
var data = table.getRowData(options.id, this);
if (obj.elem.checked) {
tag.add('orgs', { text: data.org_name, id: data.org_id });
bureauIds.push(data.org_id);
}
else {
tag.delete('orgs', data.org_id);
}
});
}
});
table.render({ table.render({
elem: '#group-table', elem: '#group-table',
@ -304,16 +327,7 @@
}); });
function tableReload() { function tableReload() {
table.reloadData('myTable', { renderBureauTable();
where: {
org_type_id: $("#orgTypeId").val(),
org_name: $("#org_name").val(),
query_type_id: 1,
exclude_self: 1,
page:1
},
scrollPos: false
});
} }
function groupTableReload() { function groupTableReload() {

Loading…
Cancel
Save