76 lines
2.0 KiB
JavaScript
76 lines
2.0 KiB
JavaScript
|
import { brigade,stationurl } from "../../../../public/js/url.js";
|
||
|
import { stationInfoTableList,layuiObj } from "../index.js";
|
||
|
|
||
|
import { updateBasicSchoolInfo,} from "./schoolNewsGetlist.js";
|
||
|
|
||
|
function getstationcount(){
|
||
|
var data={
|
||
|
"brigade":brigade
|
||
|
}
|
||
|
var url=stationurl+"/firectrl/client/getstationcount";
|
||
|
return axios({
|
||
|
method: 'post',
|
||
|
url:url,
|
||
|
data:data
|
||
|
})
|
||
|
}
|
||
|
|
||
|
function getstationlist(data){
|
||
|
var url=stationurl+"/firectrl/client/getstationlist";
|
||
|
return axios({
|
||
|
method: 'post',
|
||
|
url:url,
|
||
|
data:data
|
||
|
})
|
||
|
}
|
||
|
|
||
|
function stationInfoPageReq(result){
|
||
|
var count=500;
|
||
|
var page=Math.ceil(result/count);
|
||
|
var stationlist=[];
|
||
|
for(let i=0;i<page;i++){
|
||
|
var obj={
|
||
|
"brigade":brigade,
|
||
|
"pagesize":count,
|
||
|
"pageindex":i,
|
||
|
}
|
||
|
stationlist.push(getstationlist(obj));
|
||
|
}
|
||
|
return Promise.all(stationlist);
|
||
|
}
|
||
|
|
||
|
//初始化快速搜索的
|
||
|
function initSchoolSearchSelect(){
|
||
|
$("#schoolstyle_select").html(getSchoolOptions());
|
||
|
layuiObj.layuiForm.render("select","schoolstyle_from");
|
||
|
$("#schoolstyle_select").siblings("div.layui-form-select").find("div.layui-select-title").find("input").attr("onfocus","this.select()");
|
||
|
schoolSearchSelectChange();
|
||
|
}
|
||
|
|
||
|
//获取所有的设备
|
||
|
function getSchoolOptions(){
|
||
|
var options="<option value='000'>请选择学校</option>";
|
||
|
for(var i=0;i<stationInfoTableList.length;i++){
|
||
|
var name=stationInfoTableList[i]["name"];
|
||
|
if(i==0){
|
||
|
options+=`<option value="${name}">${name}</option>`
|
||
|
}else{
|
||
|
options+=`<option value="${name}">${name}</option>`
|
||
|
}
|
||
|
}
|
||
|
return options;
|
||
|
}
|
||
|
|
||
|
//监听select变化
|
||
|
function schoolSearchSelectChange(){
|
||
|
layuiObj.layuiForm.on('select(schoolstyle_select)', function(data){
|
||
|
var name=data["value"];
|
||
|
updateBasicSchoolInfo(name)
|
||
|
})
|
||
|
}
|
||
|
|
||
|
export {
|
||
|
getstationcount,
|
||
|
stationInfoPageReq,
|
||
|
initSchoolSearchSelect
|
||
|
}
|