fxc 2 weeks ago
parent 03a80a4631
commit 12024edf53

@ -193,6 +193,26 @@
'onComplete': function () {}
});
});
$("#" + datagrid1.TableID + " [CommandName='outboundImg']").live("click", function () {
var RowIndex = $(this).parentsUntil("tr").parent().attr("index");
var model = datagrid1.Get_Model(RowIndex);
$("#img_1").attr("src", model.ImageUrls[0]);
$("#div_img").empty();
model.ImageUrls.forEach(pic => {
$("#div_img").append("<img src='../" + pic + "' width='100px' height='80px' style='margin-right:5px'/>");
})
$.fancybox({
'width': '40%',
'height': '40%',
'autoScale': false,
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'href': '#test3',
'onComplete': function () { }
});
});
});
// 初始化DataGrid
@ -298,6 +318,11 @@
}
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "Outbound Photo";
col.CellTemplate = "<a CommandName='outboundImg' iul='{Bind firstImg}'><img src='{Bind firstImg}' alt='' width='50px' height='50px'/></a>";
Array.add(datagrid1.Columns, col);
//操作
col = new nblf.ui.DataGridColumn();
col.HeaderText = "操作";

@ -23,6 +23,7 @@
<link href="../Scripts2/fancybox/jquery.fancybox-1.3.4.css" rel="stylesheet" />
<script src="../Scripts2/fancybox/jquery.fancybox-1.3.4.js" type="text/javascript"></script>
<script src="../Scripts2/MaskedTextBox.js?t=1" type="text/javascript"></script>
<script src="../Scripts/ajaxfileupload.js" type="text/javascript"></script>
<script src="../Scripts/DatePicker/WdatePicker.js" type="text/javascript"></script>
<script src="../Scripts2/jquery.url.js" type="text/javascript"></script>
@ -121,6 +122,23 @@
}
});
$("#btn_Excel1").click(function () {
ajaxFileUpload();
});
$("#btn_Excel2").click(function () {
var url = '../ServerCookies/TemuGoodsTemplate.xls';
// 创建隐藏的 <a> 元素
var link = document.createElement('a');
link.href = url;
link.download = url.split('/').pop(); // 设置下载文件的名称
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
})
});
//获取temu平台的所有店铺
function GetTemuShops() {
@ -365,6 +383,48 @@
}, 0);
}
//#endregion
//#region
function ajaxFileUpload() {
var filename = $("#fileToUpload").val();
if (!filename.endsWith('.xls') && !filename.endsWith('.xlsx')) { alert("文件格式不正确"); return; }
$.ajaxFileUpload({
url: '../GlobalAshx/AjaxFileUpdate.ashx?DirectoryName=ServerCookies',
secureuri: false,
fileElementId: 'fileToUpload',
dataType: 'json',
success: function (data, status) {
ImportGoods("ServerCookies/" + data.FileName);
},
error: function (data, status, e) {
alert(e);
}
});
}
//#endregion
//#region
function ImportGoods(FileName) {
var param = new Object();
param.filePath = FileName;
WindowLoadModel.Show();
$.ajax({
url: "../HuoWuServiceNew.asmx/ImportTemuHuoDongPrices",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
if (data.d.Code == 0) { alert(data.d.Message); ReadData(); return; }
else {
ReadData();
}
},
error: function (xhr, status) {
if (status != "success") alert(xhr.responseText);
}
});
}
//#endregion
</script>
</head>
@ -397,11 +457,18 @@
</select></td>
<td><input id="cmdGet" type="button" value = "查询" /></td>
</tr>
<tr>
<td colspan="9">
<td>
<input id="cmdAdd" type="button" value="新增" />
</td>
<td>
导入数据:
<input id="fileToUpload" accept="excel/xls" name="fileToUpload" type="file" style="width: 200px" />
</td>
<td style="white-space: nowrap;">
<input id="btn_Excel1" type="button" class="btnClass btnClassEdit" value="确认上传" />
<input id="btn_Excel2" type="button" class="btnClass btnClassEdit" value="下载模板" />
</td>
</tr>
<tr>
<td valign="top" colspan="9">

Loading…
Cancel
Save