/**
|
* 管理初始化
|
*/
|
var TStoreProvince = {
|
id: "TStoreProvinceTable", //表格id
|
seItem: null, //选中的条目
|
table: null,
|
layerIndex: -1,
|
storeList: []
|
};
|
|
/**
|
* 初始化表格的列
|
*/
|
TStoreProvince.initColumn = function () {
|
return [
|
{field: 'selectItem', checkbox: true},
|
{title: '序号', field: 'id', visible: true, align: 'center', valign: 'middle'},
|
{title: '所在省市', field: 'provinceCity', visible: true, align: 'center', valign: 'middle'},
|
{title: '所属运营商', field: 'account', visible: true, align: 'center', valign: 'middle'},
|
{title: '门店名称', field: 'name', visible: true, align: 'center', valign: 'middle'},
|
{title: '场地名称', field: 'siteName', visible: true, align: 'center', valign: 'middle'},
|
{title: '闸机ids', field: 'ids', visible: true, align: 'center', valign: 'middle'},
|
];
|
};
|
|
/**
|
* 检查是否选中
|
*/
|
TStoreProvince.check = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if(selected.length == 0){
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
}else{
|
TStoreProvince.seItem = selected[0];
|
return true;
|
}
|
};
|
|
|
TStoreProvince.storeOfClosePage = function (){
|
parent.layer.close(parent.layer.getFrameIndex(window.frameElement.id));
|
}
|
|
|
TStoreProvince.saveSelectSites = function (){
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if (selected.length == 0) {
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
}
|
var arr = [];
|
var name ='';
|
for(var i in selected){
|
if(typeof selected[i].id != "undefined"){
|
name = selected[0].account
|
if(name!=selected[i].account){
|
Feng.info("请选择相同运营商场地")
|
return ;
|
}
|
console.log("arr push")
|
console.log(selected[i].id)
|
arr.push({
|
id: selected[i].id,
|
provinceCity: typeof selected[i].provinceCity != "undefined" ? selected[i].provinceCity : "",
|
accountName: typeof selected[i].account != "undefined" ? selected[i].account : "",
|
name: typeof selected[i].name != "undefined" ? selected[i].name : "",
|
siteName: typeof selected[i].siteName != "undefined" ? selected[i].siteName : "",
|
ids:typeof selected[i].ids != "undefined" ? selected[i].ids : "",
|
})
|
}
|
}
|
console.log("返回之前的数组")
|
console.log(arr)
|
window.parent.TGoodsInfoDlg.selecUserOpt1(arr);
|
TStoreProvince.storeOfClosePage();
|
};
|
|
|
|
/**
|
* 查询列表
|
*/
|
TStoreProvince.search = function () {
|
var queryData = {};
|
queryData['provinceId'] = $("#pCode").val();
|
queryData['cityId'] = $("#cCode").val();
|
queryData['operatorId'] = $("#account").val();
|
queryData['storeName'] = $("#storeName").val();
|
TStoreProvince.table.refresh({query: queryData});
|
};
|
|
|
/**
|
* 重置搜索
|
*/
|
TStoreProvince.resetSearch = function () {
|
$("#pCode").val('')
|
$("#cCode").val('')
|
$("#storeName").val('')
|
$("#account").val('')
|
TStoreProvince.search();
|
};
|
|
function queryProvince(){
|
// 发送AJAX请求到后台获取省份数据
|
// 假设后台返回的数据格式为一个包含省份ID和名称的数组
|
var provinceSelect = document.getElementById("province");
|
|
var ajax = new $ax(Feng.ctxPath + "/tCouponManage/getProvince", function(data){
|
data.forEach(province => {
|
var option = document.createElement("option");
|
option.value = province.code; // 根据你的数据结构确定省份的id字段
|
option.text = province.name; // 根据你的数据结构确定省份的name字段
|
provinceSelect.appendChild(option);
|
});
|
},function(data){
|
Feng.error("下拉失败!" + data.responseJSON.message + "!");
|
});
|
ajax.start();
|
provinceSelect.addEventListener("change", queryCity);
|
}
|
|
|
// 获取城市数据
|
function queryCity() {
|
var selectedProvinceId = this.value; // 获取选择的省份ID
|
// 发送AJAX请求到后台获取对应省份的城市数据
|
// 假设后台返回的数据格式为一个包含城市ID和名称的数组
|
|
var citySelect = document.getElementById("city");
|
citySelect.innerHTML = "";
|
var ajax = new $ax(Feng.ctxPath + "/tCouponManage/getCity1", function(data){
|
|
data.forEach(province => {
|
var content='<option value="">选择市</option>';
|
$.each(data, function(k,v) {
|
content += "<option value='"+v.code+"'>"+v.name+"</option>";
|
});
|
$("#city").empty().append(content);
|
|
});
|
},function(data){
|
console.log('data:',data)
|
Feng.error("获取失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set('province',selectedProvinceId);
|
ajax.start();
|
}
|
|
$(function () {
|
var defaultColunms = TStoreProvince.initColumn();
|
var table = new BSTable(TStoreProvince.id, "/tCouponManage/siteDetailsOfSearch", defaultColunms);
|
table.setPaginationType("client");
|
TStoreProvince.table = table.init();
|
queryProvince();
|
});
|