/**
|
* 跨城站点管理管理初始化
|
*/
|
var TSite = {
|
id: "TSiteTable", //表格id
|
seItem: null, //选中的条目
|
table: null,
|
layerIndex: -1,
|
picture:"",
|
fileUrl:"",
|
img:"",
|
plan:"",
|
goodsPicArray:[],
|
validateFields: {
|
}
|
};
|
var objectType =$("#objectType").val()
|
/**
|
* 初始化表格的列
|
*/
|
TSite.initColumn = function () {
|
return [
|
{field: 'selectItem', checkbox: true},
|
{title: '序号', field: 'id', visible: true, align: 'center', valign: 'middle'},
|
{
|
title: '所属运营商', field: 'operator', visible: objectType==3?false:true, align: 'center', valign: 'middle',
|
formatter: function(value, row, index) {
|
if (!value || value.trim() === '' || value.trim() === 0) {
|
return '平台';
|
} else {
|
return value;
|
}
|
}
|
},
|
{
|
title: '省', field: 'province', visible: objectType === 1 ? true : false, align: 'center', valign: 'middle', width: '20%',
|
},
|
{
|
title: '市', field: 'city', visible: objectType === 1 ? true : false, align: 'center', valign: 'middle',
|
},
|
{title: '门店名称', field: 'storeName', visible: true, align: 'center', valign: 'middle'},
|
{title: '场地类型', field: 'siteTypeName', visible: true, align: 'center', valign: 'middle'},
|
{title: '场地名称', field: 'name', visible: true, align: 'center', valign: 'middle'},
|
{title: '场地责任险有效期', field: 'insuranceEndTime', visible: true, align: 'center', valign: 'middle'},
|
{
|
title: '状态', field: 'state', visible: true, align: 'center', valign: 'middle',
|
formatter: function(data) {
|
return {1: '上架中', 2: '下架中'}[data];
|
}
|
}
|
];
|
};
|
|
/**
|
* 检查是否选中
|
*/
|
TSite.check = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if(selected.length == 0){
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
}else{
|
TSite.seItem = selected[0];
|
return true;
|
}
|
};
|
/**
|
* 上架
|
*/
|
|
TSite.onShelf = function () {
|
if (this.check()){
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
const data1 = {
|
siteIds:[],
|
type:null
|
};
|
selected.forEach(function(obj) {
|
var id = obj.id;
|
data1.siteIds.push(id);
|
});
|
data1.type = 1;
|
|
$.ajax({
|
url: Feng.ctxPath + "/tSite/changeState",
|
type: "POST",
|
contentType: "application/json", // 设置请求头的 Content-Type
|
data: JSON.stringify(data1), // 将数据转换为 JSON 字符串
|
success: function(response) {
|
Feng.success("上架成功!");
|
TSite.search();
|
},
|
error: function(xhr, status, error) {
|
var errorMessage = xhr.responseText ? xhr.responseText : "上架失败!";
|
Feng.error("您的网络异常!");
|
}
|
});
|
}
|
};
|
/**
|
* 下架
|
*/
|
TSite.offShelf = function () {
|
if (this.check()){
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
const data1 = {
|
siteIds:[],
|
type:null
|
};
|
selected.forEach(function(obj) {
|
var id = obj.id;
|
data1.siteIds.push(id);
|
});
|
data1.type = 2;
|
$.ajax({
|
url: Feng.ctxPath + "/tSite/changeState",
|
type: "POST",
|
contentType: "application/json", // 设置请求头的 Content-Type
|
data: JSON.stringify(data1), // 将数据转换为 JSON 字符串
|
success: function(response) {
|
Feng.success("下架成功!");
|
TSite.search();
|
},
|
error: function(xhr, status, error) {
|
var errorMessage = xhr.responseText ? xhr.responseText : "下架失败!";
|
Feng.error("您的网络异常!");
|
}
|
});
|
}
|
};
|
TSite.uploadFile = function(){
|
var elementById = document.getElementById("uploadFile");
|
var file = elementById.files[0];
|
var formData = new FormData();
|
formData.append('file',file);
|
$.ajax({
|
url: Feng.ctxPath + "/tCouponManage/uploadPic" ,
|
type: "POST",
|
data: formData,
|
contentType: false, // 设置为false,让浏览器自动识别并设置请求头
|
processData: false, // 设置为false,不处理发送的数据(因为FormData对象已经包含了文件数据)
|
success: function (response) {
|
TSite.fileUrl = response;
|
console.log(TSite.fileUrl);
|
Feng.success("文件上传成功");
|
},
|
error: function (xhr, status, error) {
|
Feng.error("文件上传失败!" + error);
|
}
|
});
|
};
|
TSite.getChange = function(e){
|
var oneId=$(e).val();
|
var selectedValue = e.value;
|
var citySelect = document.getElementById("cCode");
|
|
var ajax = new $ax(Feng.ctxPath + "/tSite/getChange", function(data){
|
if(data!=null){
|
var content='<option value="">选择市</option>';
|
$.each(data, function(k,v) {
|
content += "<option value='"+v.name+"'>"+v.name+"</option>";
|
});
|
$("#cCode").empty().append(content);
|
}
|
});
|
if (selectedValue === ""){
|
citySelect.innerHTML = '<option value="">请先选择省</option>';
|
}
|
ajax.set("province",oneId);
|
ajax.start();
|
};
|
TSite.oneChangeYys = function(e){
|
|
var oneId;
|
|
var checkbox = document.querySelector('input[name="pt"]');
|
if (checkbox.checked) {
|
oneId=0;
|
console.log("选中是平台");
|
} else {
|
oneId = $("#yys").val();
|
console.log("运营商");
|
}
|
var ajax = new $ax(Feng.ctxPath + "/tSite/getChangeOne", function(data){
|
if(data!=null){
|
// var content1 = '<option value="0">平台</option>';
|
if (oneId == 0) {
|
console.log("锁住")
|
$("#yys").prop('disabled', true);
|
}else{
|
console.log("放开")
|
$("#yys").prop('disabled', false);
|
}
|
|
console.log("看看返回数据")
|
console.log(data)
|
var content='<option value="">选择门店</option>';
|
$.each(data, function(k,v) {
|
content += "<option value='"+v.id+"'>"+v.name+"</option>";
|
});
|
$("#store").empty().append(content);
|
}
|
});
|
|
if (typeof(oneId) == "undefined"){
|
console.log("===============")
|
oneId = $("#yys").val()
|
var button = document.getElementById("yys");
|
button.removeAttribute("disabled");
|
|
}
|
|
ajax.set("oneId",oneId);
|
ajax.start();
|
|
|
|
};
|
// 场地管理首页 选择对应的省市
|
// 传1是场地管理首页 传2是场地管理添加页面
|
TSite.oneChange = function (e) {
|
var selectElement = document.getElementById('store');
|
var startTime = document.getElementById('start-time');
|
var endTime = document.getElementById('end-time');
|
if (startTime!==null){
|
startTime.disabled = true;
|
endTime.disabled = true;
|
selectElement.addEventListener('change',function () {
|
if (selectElement.value !== ''){
|
startTime.disabled = false;
|
endTime.disabled = false;
|
}else{
|
startTime.disabled = true;
|
endTime.disabled = true;
|
}
|
});
|
}
|
var province = $('#pCode option:selected').text();
|
var val = $('#pCode option:selected').val();
|
var citySelect = document.getElementById("cCode");
|
var accountSelect = document.getElementById("account");
|
var storeSelect = document.getElementById("store");
|
var ajax = new $ax(Feng.ctxPath + "/tSite/getCity", function(data){
|
if(data!=null){
|
var content='<option value="">选择市</option>';
|
$.each(data, function(k,v) {
|
content += "<option value='"+v.city+"'>"+v.city+"</option>";
|
});
|
$("#cCode").empty().append(content);
|
}
|
});
|
// if (val === ""){
|
// citySelect.innerHTML = '<option value="">请先选择省</option>';
|
//
|
// }
|
// if (e===2){
|
// accountSelect.innerHTML = '<option value="">请先选择省/市</option>';
|
// storeSelect.innerHTML = '<option value="">请先选择省/市</option>';
|
// }
|
// if (val === ""){
|
// startTime.disabled = true;
|
// endTime.disabled = true;
|
// }
|
|
ajax.set("province",province);
|
ajax.start();
|
};
|
|
|
|
TSite.oneChange1 = function (e) {
|
console.log(111)
|
var oneId=$(e).val();
|
var ajax = new $ax(Feng.ctxPath + "/tCompetition/onChange", function(data){
|
if(data!=null){
|
|
var content='<option value="">选择市</option>';
|
|
$.each(data, function(k,v) {
|
content += "<option value='"+v.code+"'>"+v.name+"</option>";
|
});
|
$("#cCode").empty().append(content);
|
}
|
});
|
ajax.set("oneId",oneId);
|
ajax.start();
|
}
|
|
|
|
|
TSite.oneChangeNext = function (e) {
|
var startTime = document.getElementById('start-time');
|
var endTime = document.getElementById('end-time');
|
|
var oneId=$(e).val();
|
var citySelect = document.getElementById("account");
|
var storeSelect = document.getElementById("store");
|
var ajax = new $ax(Feng.ctxPath + "/tSite/accountChangeNext", function(data){
|
if(data!=null){
|
var content='<option value="">选择账号</option>';
|
$.each(data, function(k,v) {
|
content += "<option style='width: 300px' value='"+v.id+"'>"+v.name+"</option>";
|
});
|
$("#account").empty().append(content);
|
}
|
});
|
if (oneId === ""){
|
citySelect.innerHTML = '<option style="width: 300px" value="">请先选择省/市</option>';
|
storeSelect.innerHTML = '<option style="width: 300px" value="">请先选择省/市</option>';
|
startTime.disabled = true;
|
endTime.disabled = true;
|
}
|
ajax.set("oneId",oneId);
|
ajax.start();
|
|
var ajax1 = new $ax(Feng.ctxPath + "/tSite/storeChangeNext", function(data){
|
if(data!=null && data.length !== 0){
|
var content='<option value="">选择门店</option>';
|
$.each(data, function(k,v) {
|
content += "<option style='width: 300px' value='"+v.id+"'>"+v.name+"</option>";
|
});
|
$("#store").empty().append(content);
|
}else {
|
storeSelect.innerHTML = '<option value="">当前所选市没有门店</option>';
|
}
|
});
|
ajax1.set("oneId",oneId);
|
ajax1.start();
|
};
|
/**
|
* 跳转添加场地页面
|
*/
|
TSite.openAddTSite = function () {
|
|
var index = layer.open({
|
type: 2,
|
title: "添加场地",
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tSite/add'
|
});
|
this.layerIndex = index;
|
};
|
/**
|
* 跳转锁定场地页面
|
*/
|
TSite.lock = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if(selected.length >1 ){
|
Feng.info("只能选择一个场地进行锁定!");
|
}else {
|
if (this.check()) {
|
var index = layer.open({
|
type: 2,
|
title: "锁定场地",
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tSite/lockSite/' + TSite.seItem.id
|
});
|
this.layerIndex = index;
|
}
|
}
|
};
|
/**
|
* 打开场地管理查看详情
|
*/
|
TSite.openInfo = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if(selected.length >1 ){
|
Feng.info("只能选择一个问题进行编辑!");
|
}else {
|
if (this.check()) {
|
var index = layer.open({
|
type: 2,
|
title: "查看详情",
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tSite/openInfoTSite/' + TSite.seItem.id
|
});
|
this.layerIndex = index;
|
}
|
}
|
};
|
/**
|
* 打开场地管理编辑
|
*/
|
TSite.openEditTSite = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if(selected.length >1 ){
|
Feng.info("只能选择一个问题进行编辑!");
|
}else {
|
if (this.check()) {
|
var index = layer.open({
|
type: 2,
|
title: "编辑场地",
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tSite/openEditTSite/' + TSite.seItem.id
|
});
|
this.layerIndex = index;
|
}
|
}
|
};
|
/**
|
* 关闭此对话框
|
*/
|
TSite.close = function() {
|
parent.layer.close(window.parent.TSite.layerIndex);
|
}
|
|
var sh = ""; // 门店经营开始时间:小时
|
var sm = "";// 门店经营开始时间:分钟
|
var eh = "";// 门店经营结束时间:小时
|
var em = "";// 门店经营结束时间:分钟
|
|
TSite.addSubmit = function(){
|
var data = {
|
province:"",
|
city:"",
|
cityManagerId:"",
|
storeId:"",
|
siteTypeId:null,
|
appointmentStartTime:"",
|
appointmentEndTime:"",
|
cashPrice:null,
|
playPaiCoin:null,
|
insuranceEndTime:"",
|
name:"",
|
insuranceImg:"",
|
managementPlan:"",
|
operatorId:"",
|
typeName:"",
|
nextName:"",
|
ishalf:"",
|
cashPriceOne:"",
|
playPaiCoinOne:"",
|
halfName:"",
|
introduce:"",
|
imgs:"",
|
introduce:"",
|
ids:""
|
};
|
data.province = $("#pCode").val()
|
data.city = $("#cCode").val()
|
data.cityManagerId = $("#account").val()
|
data.storeId = $("#store").val()
|
data.siteTypeId = $("#siteTypeId").val()
|
data.appointmentStartTime= $("#start-time").val()
|
data.appointmentEndTime = $("#end-time").val()
|
data.cashPrice = $("#cashPrice").val()
|
data.playPaiCoin = $("#playPaiCoin").val()
|
data.insuranceEndTime = $("#insuranceEndTime").val()
|
data.name = $("#name").val()
|
data.insuranceImg = $("#img").val()
|
data.managementPlan = $('#courseVideo').val()
|
data.typeName = $('#siteTypeOne').val()
|
var sh =data.appointmentStartTime.split(':')[0];
|
var sm =data.appointmentStartTime.split(':')[1];
|
var eh =data.appointmentEndTime.split(':')[0];
|
var em =data.appointmentEndTime.split(':')[1];
|
|
|
console.log(data.typeName)
|
|
|
if (data.typeName === "智慧场地"){
|
console.log("===========这是智慧球场")
|
|
console.log("====="+data.appointmentStartTime)
|
|
var value = data.appointmentStartTime;
|
var lastTwoDigits = value.slice(-2);
|
|
if (lastTwoDigits === "00" || lastTwoDigits === "15" || lastTwoDigits === "30" || lastTwoDigits === "45") {
|
console.log("Last two digits are 00, 15, 30, or 45");
|
} else {
|
Feng.error("智慧场地的可预约时间段是15分钟的倍数")
|
return;
|
|
}
|
|
|
var value1 = data.appointmentEndTime;
|
var lastTwoDigits1 = value1.slice(-2);
|
|
if (lastTwoDigits1 === "00" || lastTwoDigits1 === "15" || lastTwoDigits1 === "30" || lastTwoDigits1 === "45") {
|
console.log("Last two digits are 00, 15, 30, or 45");
|
} else {
|
Feng.error("智慧场地的可预约时间段是15分钟的倍数")
|
return;
|
|
}
|
|
|
}else {
|
console.log("===========这是普通球场")
|
|
console.log("====="+data.appointmentStartTime)
|
var value = data.appointmentStartTime;
|
var lastTwoDigits = value.slice(-2);
|
|
if (lastTwoDigits === "00" || lastTwoDigits === "30" ) {
|
console.log("Last two digits are 00, 15, 30, or 45");
|
} else {
|
Feng.info("普通场地可预约时间段需是30分钟的倍数")
|
return;
|
}
|
|
|
var value1 = data.appointmentEndTime;
|
var lastTwoDigits1 = value1.slice(-2);
|
|
if (lastTwoDigits1 === "00"|| lastTwoDigits1 === "30" ) {
|
console.log("Last two digits are 00, 15, 30, or 45");
|
} else {
|
Feng.info("普通场地可预约时间段需是30分钟的倍数")
|
return;
|
|
}
|
|
|
|
}
|
|
var SelectValue="";
|
var getSelectValueMenbers = $("input[name='pt']:checked").each(function(j) {
|
if (j >= 0) {
|
SelectValue += $(this).val()
|
}
|
});
|
if(SelectValue==''){
|
let yys = $("#yys").val()
|
if(yys==""){
|
Feng.info("请选择运营商")
|
return;
|
}
|
SelectValue= yys
|
}
|
data.operatorId= SelectValue;
|
|
|
|
let num24 = $('input[name="name1"]');
|
var nextName="";
|
for (let i = 0; i < num24.length; i++) {
|
if($(num24[i]).val()==''){
|
Feng.info("请填写场地名称")
|
return;
|
}
|
if(i==num24.length-1){
|
nextName += $(num24[i]).val()
|
}else {
|
nextName += $(num24[i]).val()+","
|
}
|
}
|
data.nextName= nextName;
|
|
|
var ishalf= $("input[name='ishalf']:checked").val();
|
data.ishalf= ishalf;
|
var halfName="";
|
if(ishalf==1){
|
let cashPriceOne = $("#cashPriceOne").val()
|
if(cashPriceOne=='' ){
|
Feng.info("请填写现金价格")
|
return;
|
}
|
data.cashPriceOne= cashPriceOne;
|
|
let playPaiCoinOne = $("#playPaiCoinOne").val()
|
if(playPaiCoinOne=='' ){
|
Feng.info("请填写玩湃币价格")
|
return;
|
}
|
|
data.playPaiCoinOne= playPaiCoinOne;
|
let num2 = $('input[name="name2"]');
|
for (let i = 0; i < num2.length; i++) {
|
if($(num2[i]).val()==''){
|
Feng.info("请填写半场名称")
|
return;
|
}
|
if(i==num2.length-1){
|
halfName += $(num2[i]).val()
|
}else {
|
halfName += $(num2[i]).val()+","
|
}
|
}
|
}
|
|
|
data.halfName= halfName;
|
data.ids= $("#ids").val();
|
let introduce ;
|
if (objectType==1){
|
introduce = TSite.editor.getContent();
|
}
|
|
console.log(introduce)
|
if(introduce==""){
|
Feng.info("请输入公告内容")
|
return;
|
}
|
data.introduce= introduce;
|
|
|
var goodImgs = this.goodsPicArray;
|
if(objectType==1){
|
if(goodImgs.length==0){
|
Feng.info("请上传实景图")
|
return;
|
}
|
}
|
|
var imgOne ="";
|
for (let i = 0; i <goodImgs.length; i++) {
|
if(i==goodImgs.length-1){
|
imgOne += (goodImgs[i].response)
|
}else {
|
imgOne+=(goodImgs[i].response+",")
|
}
|
|
}
|
data.imgs = imgOne
|
|
|
|
if($("#store").val()=='' ){
|
Feng.info("请选择门店")
|
return;
|
}
|
if($("#siteTypeId").val()=='' ){
|
Feng.info("请选择场地分类")
|
return;
|
}
|
if($("#name").val()==''){
|
Feng.info("请输入场地名称")
|
return;
|
}
|
if($("#start-time").val()=='' ){
|
Feng.info("请输入可预约时间段 开始时间")
|
return;
|
}
|
if($("#end-time").val()==''){
|
Feng.info("请输入可预约时间段 结束时间")
|
return;
|
}
|
if($("#cashPrice").val()==''){
|
Feng.info("请输入现金价格")
|
return;
|
}
|
if($("#playPaiCoin").val()==''){
|
Feng.info("请输入玩湃币价格")
|
return;
|
}
|
if($("#insuranceEndTime").val()==''){
|
Feng.info("请输入场地责任险有效期")
|
return;
|
}
|
if($("#img").val()==''){
|
Feng.info("请上传场地责任有效期图片")
|
return;
|
}
|
if($('#courseVideo').val()==''){
|
Feng.info("请上传消防及应急管理方案")
|
return;
|
}
|
var sTime = document.getElementById("start-time"); //获取输入的开始时间
|
var eTime = document.getElementById("end-time"); // 获取输入的结束时间
|
var rStime = ""; //门店的经营开始时间
|
var rEtime = ""; //门店的经营结束时间
|
var selectedText = $('#store option:selected').text();
|
$.ajax({
|
url: Feng.ctxPath + "/tSite/getTime/" + selectedText,
|
type: "GET",
|
contentType: "application/json", // 设置请求头的 Content-Type
|
success: function (response) {
|
rStime = response.startTime;
|
sh = rStime.split(':')[0];// 门店经营开始时间:小时
|
sm = rStime.split(':')[1];// 门店经营开始时间:分钟
|
|
rEtime = response.endTime;
|
eh = rEtime.split(':')[0];// 门店经营结束时间:小时
|
em = rEtime.split(':')[1];// 门店经营结束时间:分钟
|
|
var start = sTime.value;
|
var startHour = start.split(':')[0]; // 输入的可预约开始时间:小时
|
var startMinute = start.split(':')[1];// 输入的可预约开始时间:分钟
|
if (Number(sh)>Number(startHour)){
|
Feng.error("预约的开始时间不应小于营业开始时间!")
|
return false;
|
}else if(Number(sh) === Number(startHour) ){
|
if (Number(sm)>Number(startMinute)){
|
Feng.error("预约的开始时间不应大于营业开始时间!")
|
return false;
|
}
|
}else if (Number(eh)<Number(startHour)){
|
Feng.error("预约的开始时间不应大于营业结束时间!")
|
return false;
|
}else if(Number(eh)===Number(startHour)){
|
Feng.error("预约的开始时间不应大于等于营业结束时间!")
|
return false;
|
}
|
var end = eTime.value;
|
var endHour = end.split(':')[0]; // 输入的可预约结束时间:小时
|
var endMinute = end.split(':')[1];// 输入的可预约结束时间:分钟
|
if (Number(eh)<Number(endHour)){
|
Feng.error("预约的结束时间不应大于营业结束时间!")
|
return ;
|
}else if(Number(eh) === Number(endHour) ){
|
if (Number(em)<Number(endMinute)){
|
Feng.error("预约的开始时间不应大于开始营业时间!")
|
return ;
|
}
|
}else if(Number(sh)>Number(endHour)){
|
Feng.error("预约的结束时间不应小于营业开始时间!")
|
return ;
|
}
|
if (Number(endHour)===Number(sh)){
|
if(Number(endMinute) < Number(sm)){
|
Feng.error("预约结束时间不应小于营业开始时间");
|
return;
|
}
|
}
|
if (Number(startHour)===Number(endHour) && Number(startMinute)===Number(endMinute)){
|
Feng.error("至少预约半个小时");
|
return;
|
}
|
$.ajax({
|
url: Feng.ctxPath + "/tSite/addSite" ,
|
type: "POST",
|
data: JSON.stringify(data),
|
contentType: "application/json",
|
success: function (response) {
|
window.parent.TSite.table.refresh();
|
TSite.close();
|
Feng.success("添加成功");
|
},
|
error: function (xhr, status, error) {
|
Feng.error("添加失败!" + error);
|
}
|
});
|
},
|
error: function (xhr, status, error) {
|
var errorMessage = xhr.responseText ? xhr.responseText : "上架失败!";
|
Feng.error("您的网络异常!");
|
return false;
|
}
|
});
|
};
|
|
TSite.search = function () {
|
var queryData = {};
|
queryData['province'] = $("#pCode").val();
|
queryData['city'] = $("#cCode").val();
|
queryData['siteTypeId'] = $("#sCode").val();
|
// 场地名称
|
queryData['name'] = $("#name").val();
|
// 门店名称
|
queryData['storeName'] = $("#storeName").val();
|
queryData['opId'] = $("#opId").val();
|
queryData['storeName'] = $("#storeName").val();
|
|
TSite.table.refresh({query: queryData});
|
};
|
|
TSite.resetSearch = function () {
|
$("#pCode").val("");
|
$("#cCode").val("");
|
$("#store").val("");
|
$("#sCode").val("");
|
$("#storeName").val("");
|
$("#siteTypeId").val("");
|
$("#name").val("");
|
$("#insuranceEndTime").val("");
|
$("#opId").val("");
|
$("#storeName").val("");
|
TSite.search();
|
};
|
|
function UploadFileFn(){
|
$('#upFile').click();
|
}
|
|
$(function () {
|
//初始化编辑器
|
TSite.editor = UE.getEditor('editor');
|
// 限制分钟选项为 0 和 30
|
// var timeInputs = document.querySelectorAll('input[type="time"]');
|
// timeInputs.forEach(function(input) {
|
// input.addEventListener('change', function() {
|
// var selectedTime = input.value;
|
// var hour = selectedTime.split(':')[0];
|
// var minute = selectedTime.split(':')[1];
|
// if (minute < 30 &&minute>0) {
|
// minute = '30';
|
// } else if (minute >30) {
|
// hour++;
|
// minute = '00';
|
// if (hour<10){
|
// hour = '0'+hour;
|
// }
|
// }
|
// input.value = hour + ':' + minute;
|
// });
|
// });
|
|
|
var defaultColunms = TSite.initColumn();
|
var type =$("#type").val();
|
if (type !== 1){
|
var table1 = new BSTable(TSite.id, "/tSite/listExipre", defaultColunms);
|
table1.setPaginationType("client");
|
TSite.table = table1.init();
|
}
|
var table = new BSTable(TSite.id, "/tSite/listAll", defaultColunms);
|
table.setPaginationType("client");
|
TSite.table = table.init();
|
Feng.initValidator("carInfoForm", TSite.validateFields);
|
var carPhoto = new $WebUpload("img");
|
carPhoto.setUploadBarId("progressBar");
|
carPhoto.init();
|
$('#upFile').on('change', function () {
|
var formData = new FormData() //创建一个forData
|
formData.append('file', $('#upFile')[0].files[0]) //把file添加进去 name命名为img
|
layer.load(); //上传loading
|
$.ajax({
|
url: Feng.ctxPath + '/mgr/uploadFile',
|
data: formData,
|
type: "POST",
|
async: true,
|
cache: false,
|
contentType: false,
|
processData: false,
|
success: function(res) {
|
layer.closeAll('loading'); //关闭loading
|
$('#upFile').val('');
|
$('#courseVideo').val(res);
|
}
|
})
|
});
|
});
|