| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- //设备名称
- function GetEquipName(obj) {
- obj.empty();
- obj.append('<option selected="selected" value="">请选择设备名称</option>');
- $.getJSON(huayi.config.callcenter_url + "equipmentapi/api/equipment/getlistdrop", function(data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function(i, n) {
- $("<option value='" + n.id + "'>" + n.text + "</option>").appendTo(obj);
- })
- obj.selectpicker('refresh');
- }
- })
- }
- //省市联动
- function getProvinceCity(ele1, isasync) {
- if (isasync != false) {
- isasync = true;
- }
- $.ajaxSettings.async = isasync;
- ele1.empty();
- ele1.append('<option selected="selected" value="">请选择省</option>');
- $.getJSON(huayi.config.callcenter_url + "equipmentapi/api/equipment/getfivetree", function(data) {
- if (data.state.toLowerCase() == "success") {
- var province = data.data;
- var citys = []; //市
- var projects = []; //项目
- var builds = []; //楼
- var floors = []; //楼层
- $(data.data).each(function(i, n) {
- $("<option value='" + n.code + "'>" + n.name + "</option>").appendTo(ele1);
- ele1.selectpicker('refresh');
- if (n.entityJson != null && n.entityJson.length != 0) {
- citys.push(n.entityJson);
- }
- })
- //市级信息
- $("#province").change(function() {
- $("#city").empty();
- projects = [];
- for (var i = 0; i < citys.length; i++) {
- $(citys[i]).each(function(j, v) {
- if (v.parentcode > 0) {
- if ($("#province").val() == v.parentcode) {
- $("<option value='" + v.code + "'>" + v.name + "</option>").appendTo("#city");
- if (v.entityJson != null && v.entityJson.length > 0) {
- projects.push(v.entityJson);
- }
- }
- }
- });
- }
- $("#city").selectpicker('refresh');
- if ($("#province").val() == '') {
- $("#city").append('<option selected="selected" value="">请选择所在市</option>');
- }
- if ($("#city").val() == null) {
- $("#city").append('<option selected="selected" value="">暂无数据</option>');
- }
- $("#city").trigger('change');
- })
- //项目信息
- $("#city").change(function() {
- $("#proname").empty();
- builds = [];
- $('#protype_addText').val('');
- $('#protype_addNode').val('');
- for (var j = 0; j < projects.length; j++) {
- $(projects[j]).each(function(i, n) {
- if (n.parentcode > 0) {
- if ($("#city").val() == n.parentcode) {
- $('#protype_addText').val(n.protypename);
- $('#protype_addNode').val(n.protypeid);
- $("<option value='" + n.code + "'>" + n.name + "</option>").appendTo("#proname");
- if (n.entityJson != null && n.entityJson.length > 0) {
- builds.push(n.entityJson);
- }
- }
- }
- });
- }
- $("#proname").selectpicker('refresh');
- if ($("#city").val() == '') {
- $("#proname").append('<option selected="selected" value="">请选择项目</option>');
- }
- if ($("#proname").val() == null || $("#proname").val() == '') {
- $("#proname").append('<option selected="selected" value="">暂无数据</option>');
- }
- $("#proname").trigger('change');
- })
- //楼信息
- $("#proname").change(function() {
- $("#build").empty();
- floors = [];
- $('<option selected="selected" value="">请选择楼</option>').appendTo("#build");
- for (var g = 0; g < builds.length; g++) {
- $(builds[g]).each(function(q, p) {
- if (p.parentcode) {
- if ($("#proname").val() == p.parentcode) {
- $("<option value='" + p.code + "'>" + p.name + "</option>").appendTo("#build");
- if (p.entityJson != null && p.entityJson.length > 0) {
- floors.push(p.entityJson);
- }
- }
- }
- });
- }
- $("#build").selectpicker('refresh');
- if ($("#proname").val() == '') {
- $("#build").append('<option selected="selected" value="">请选择楼</option>');
- }
- // if ($("#build").val() == null || $("#build").val() == '') {
- if ($("#build").val() == null) {
- $("#build").append('<option selected="selected" value="">暂无数据</option>');
- }
- $("#build").trigger('change');
- })
- //楼层信息
- $("#build").change(function() {
- $("#floor").html('');
- $("#floor").append('<option selected="selected" value="">请选择楼层</option>');
- for (var k = 0; k < floors.length; k++) {
- $(floors[k]).each(function(y, z) {
- if (z.parentcode) {
- if ($("#build").val() == z.parentcode) {
- $("<option value='" + z.code + "'>" + z.name + "</option>").appendTo("#floor");
- }
- }
- });
- }
- $("#floor").selectpicker('refresh');
- if ($("#build").val() == '') {
- $("#floor").append('<option selected="selected" value="">请选择楼层</option>');
- }
- // if ($("#floor").val() == null || $("#floor").val() == '') {
- if ($("#floor").val() == null) {
- $("#floor").append('<option selected="selected" value="">暂无数据</option>');
- }
- $("#floor").trigger('change');
- })
- }
- if (!isasync) {
- $.ajaxSettings.async = true;
- }
- })
- }
|