商品添加商品类别选择功能
This commit is contained in:
@@ -32,13 +32,6 @@
|
|||||||
<input name="searchModel" id="searchModel" style="width:80px;"/>
|
<input name="searchModel" id="searchModel" style="width:80px;"/>
|
||||||
</td>
|
</td>
|
||||||
<td> </td>
|
<td> </td>
|
||||||
<td>类别:</td>
|
|
||||||
<td>
|
|
||||||
<select name="searchCategoryId_f" id="searchCategoryId_f" style="width:100px;"></select>
|
|
||||||
<select name="searchCategoryId_s" id="searchCategoryId_s" style="width:100px;"></select>
|
|
||||||
<select name="searchCategoryId_t" id="searchCategoryId_t" style="width:100px;"></select>
|
|
||||||
</td>
|
|
||||||
<td> </td>
|
|
||||||
<td>
|
<td>
|
||||||
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search" id="searchBtn">查询</a>
|
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search" id="searchBtn">查询</a>
|
||||||
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-redo" id="searchResetBtn">重置</a>
|
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-redo" id="searchResetBtn">重置</a>
|
||||||
@@ -82,18 +75,17 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td style="height:30px;">类别</td>
|
<td style="height:30px;">类别</td>
|
||||||
<td style="padding:5px" colspan="3">
|
<td style="padding:5px" colspan="3">
|
||||||
<select name="CategoryId_f" id="CategoryId_f" style="width:152px;height: 20px"></select>
|
<input name="parentName" id="parentName" style="width: 180px;height: 20px" readonly="readonly"/>
|
||||||
<select name="CategoryId_s" id="CategoryId_s" style="width:152px;height: 20px"></select>
|
<a href="javascript:void(0)" class="l-btn l-btn-plain" group="" id="lookForSelectMaterialCategory">
|
||||||
<select name="CategoryId_t" id="CategoryId_t" style="width:152px;height: 20px"></select>
|
<span class="l-btn-left"><span class="l-btn-text icon-search l-btn-icon-left"></span></span></a>
|
||||||
<label id="mTypeName"></label>
|
<input name="parentid" id="parentid" type="hidden"/>
|
||||||
<a href="#" id="mTypeChange">修改</a>
|
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width:80px;">序列号</td>
|
<td style="width:80px;">序列号</td>
|
||||||
<td style="padding:5px;width:180px;">
|
<td style="padding:5px;width:180px;">
|
||||||
<select name="enableSerialNumber" id="enableSerialNumber" style="width:152px;height: 20px">
|
<select name="enableSerialNumber" id="enableSerialNumber" style="width: 180px;height: 20px">
|
||||||
<option value="1">启用</option>
|
<option value="1">启用</option>
|
||||||
<option value="0">禁用</option>
|
<option value="0">禁用</option>
|
||||||
</select>
|
</select>
|
||||||
@@ -276,11 +268,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="forSelectMaterialCategoryDlg" class="easyui-dialog" style="width:380px;padding:10px 20px"
|
||||||
|
closed="true" modal="true" cache="false" collapsible="false" closable="true">
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var materialCategoryList = null;
|
var materialCategoryList = null;
|
||||||
var materialID = null;
|
|
||||||
var parentid_search = null;
|
|
||||||
var lei = null;
|
|
||||||
var types = "";
|
var types = "";
|
||||||
var setCategoryId = "1";
|
var setCategoryId = "1";
|
||||||
var cid = 1;
|
var cid = 1;
|
||||||
@@ -365,113 +356,9 @@
|
|||||||
types += materialCategory.id + ',';
|
types += materialCategory.id + ',';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (lei == "search_first") {
|
|
||||||
$("#searchCategoryId_f").empty().append('<option value="">全部</option>').append(options);
|
|
||||||
}
|
|
||||||
else if (lei == "search_second") {
|
|
||||||
$("#searchCategoryId_s").empty().append('<option value="">全部</option>').append(options);
|
|
||||||
}
|
|
||||||
else if (lei == "search_three") {
|
|
||||||
$("#searchCategoryId_t").empty().append('<option value="">全部</option>').append(options);
|
|
||||||
}
|
|
||||||
else if (lei == "edit_first") {
|
|
||||||
$("#CategoryId_f").empty().append('<option value="">全部</option>').append(options);
|
|
||||||
}
|
|
||||||
else if (lei == "edit_second") {
|
|
||||||
$("#CategoryId_s").empty().append('<option value="">全部</option>').append(options);
|
|
||||||
}
|
|
||||||
else if (lei == "edit_three") {
|
|
||||||
$("#CategoryId_t").empty().append('<option value="">全部</option>').append(options);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//一级目录-查询方法
|
|
||||||
var searchFirst = function () {
|
|
||||||
var parentid_search = $("#searchCategoryId_f").val();
|
|
||||||
if (parentid_search != '') {
|
|
||||||
types += parentid_search + ',';
|
|
||||||
initSystemData(parentid_search);
|
|
||||||
initSelectInfo("search_second");
|
|
||||||
|
|
||||||
var arr = types.split(',');
|
|
||||||
for (var i = 0; i < arr.length; i++) {
|
|
||||||
if (arr[i] != '' && arr[i] != parentid_search) {
|
|
||||||
initSystemData(arr[i]);
|
|
||||||
initSelectInfo("type_second");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
types = types.substring(0, types.length - 1);
|
|
||||||
setCategoryId = types;
|
|
||||||
types = "";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
setCategoryId = "1";
|
|
||||||
$("#searchCategoryId_s").empty().append('<option value="">全部</option>');
|
|
||||||
$("#searchCategoryId_t").empty().append('<option value="">全部</option>');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//一级目录-查询事件
|
|
||||||
$("#searchCategoryId_f").change(
|
|
||||||
function () {
|
|
||||||
searchFirst();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
//二级目录-查询方法
|
|
||||||
var searchSecond = function () {
|
|
||||||
var parentid_search = $("#searchCategoryId_s").val();
|
|
||||||
if (parentid_search != '') {
|
|
||||||
initSystemData(parentid_search);
|
|
||||||
initSelectInfo("search_three");
|
|
||||||
types = types.substring(0, types.length - 1);
|
|
||||||
setCategoryId = types;
|
|
||||||
types = "";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
searchFirst();
|
|
||||||
$("#searchCategoryId_t").empty().append('<option value="">全部</option>');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//二级目录-查询事件
|
|
||||||
$("#searchCategoryId_s").change(
|
|
||||||
function () {
|
|
||||||
searchSecond();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
//三级目录-查询事件
|
|
||||||
$("#searchCategoryId_t").change(
|
|
||||||
function () {
|
|
||||||
var parentid_search = $("#searchCategoryId_t").val();
|
|
||||||
if (parentid_search != '') {
|
|
||||||
types = parentid_search;
|
|
||||||
setCategoryId = types;
|
|
||||||
types = "";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
searchSecond();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
//一级目录-编辑
|
|
||||||
$("#CategoryId_f").change(
|
|
||||||
function () {
|
|
||||||
var CategoryId_f = $("#CategoryId_f").val();
|
|
||||||
if (CategoryId_f != '') {
|
|
||||||
initSystemData(CategoryId_f);
|
|
||||||
initSelectInfo("edit_second");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
//二级目录-编辑
|
|
||||||
$("#CategoryId_s").change(
|
|
||||||
function () {
|
|
||||||
var CategoryId_s = $("#CategoryId_s").val();
|
|
||||||
if (CategoryId_s != '') {
|
|
||||||
initSystemData(CategoryId_s);
|
|
||||||
initSelectInfo("edit_three");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
//防止表单提交重复
|
//防止表单提交重复
|
||||||
function initForm() {
|
function initForm() {
|
||||||
@@ -629,6 +516,7 @@
|
|||||||
},
|
},
|
||||||
{title: '品名', field: 'name', width: 100},
|
{title: '品名', field: 'name', width: 100},
|
||||||
{title: '型号', field: 'model', width: 80},
|
{title: '型号', field: 'model', width: 80},
|
||||||
|
{title: '类别', field: 'categoryName', width: 80},
|
||||||
{title: '扩展信息', field: 'materialOther', width: 150},
|
{title: '扩展信息', field: 'materialOther', width: 150},
|
||||||
{title: '单位', field: 'unit', width: 60},
|
{title: '单位', field: 'unit', width: 60},
|
||||||
{title: '安全存量', field: 'safetystock', width: 70},
|
{title: '安全存量', field: 'safetystock', width: 70},
|
||||||
@@ -1065,7 +953,6 @@
|
|||||||
window.location.href = "/material/exportExcel?browserType=" + getOs()
|
window.location.href = "/material/exportExcel?browserType=" + getOs()
|
||||||
+ "&name=" + name + "&model=" + model + "&categoryId=" + cid + "&categoryIds=" + setCategoryId;
|
+ "&name=" + name + "&model=" + model + "&categoryId=" + cid + "&categoryIds=" + setCategoryId;
|
||||||
}
|
}
|
||||||
|
|
||||||
//增加
|
//增加
|
||||||
var url;
|
var url;
|
||||||
var materialID = 0;
|
var materialID = 0;
|
||||||
@@ -1162,18 +1049,9 @@
|
|||||||
bindMProperty(); //根据商品属性绑定
|
bindMProperty(); //根据商品属性绑定
|
||||||
// $("#enableSerialNumber").combobox('setValue','0');
|
// $("#enableSerialNumber").combobox('setValue','0');
|
||||||
$("#enableSerialNumber").val('0');
|
$("#enableSerialNumber").val('0');
|
||||||
|
|
||||||
$('#materialDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加商品信息');
|
$('#materialDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加商品信息');
|
||||||
$(".window-mask").css({width: webW, height: webH});
|
$(".window-mask").css({width: webW, height: webH});
|
||||||
$("#Name").val("").focus();
|
$("#Name").val("").focus();
|
||||||
$("#CategoryId_f").show();
|
|
||||||
$("#CategoryId_s").show();
|
|
||||||
$("#CategoryId_t").show(); //全部显示
|
|
||||||
$("#mTypeName").hide();
|
|
||||||
$("#mTypeChange").hide(); //按钮隐藏
|
|
||||||
$("#CategoryId_s").empty();
|
|
||||||
$("#CategoryId_t").empty(); //清空类型下拉
|
|
||||||
|
|
||||||
$("#manyUnitCheck").prop("checked", false);
|
$("#manyUnitCheck").prop("checked", false);
|
||||||
//当前为不选中状态
|
//当前为不选中状态
|
||||||
$("#Unit").show();
|
$("#Unit").show();
|
||||||
@@ -1269,16 +1147,6 @@
|
|||||||
if (checkIsExist()) {
|
if (checkIsExist()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var parent = 1;
|
|
||||||
if ($("#CategoryId_f").val() != "" && $("#CategoryId_f").val() != null) {
|
|
||||||
parent = $("#CategoryId_f").val();
|
|
||||||
}
|
|
||||||
if ($("#CategoryId_s").val() != "" && $("#CategoryId_s").val() != null) {
|
|
||||||
parent = $("#CategoryId_s").val();
|
|
||||||
}
|
|
||||||
if ($("#CategoryId_t").val() != "" && $("#CategoryId_t").val() != null) {
|
|
||||||
parent = $("#CategoryId_t").val();
|
|
||||||
}
|
|
||||||
//构造价格列表json
|
//构造价格列表json
|
||||||
var priceStrategy = [];
|
var priceStrategy = [];
|
||||||
var basicList = {};
|
var basicList = {};
|
||||||
@@ -1304,7 +1172,7 @@
|
|||||||
|
|
||||||
var objInfo = $("#materialFM").serializeObject();
|
var objInfo = $("#materialFM").serializeObject();
|
||||||
objInfo.UnitId = $("#manyUnit").val();
|
objInfo.UnitId = $("#manyUnit").val();
|
||||||
objInfo.CategoryId = parent;
|
objInfo.CategoryId =$("#parentid").val();
|
||||||
objInfo.PriceStrategy = JSON.stringify(priceStrategy); //价格列表
|
objInfo.PriceStrategy = JSON.stringify(priceStrategy); //价格列表
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "post",
|
type: "post",
|
||||||
@@ -1331,7 +1199,6 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
var mId = 0, mName = "";
|
var mId = 0, mName = "";
|
||||||
|
|
||||||
//根据id查询类型信息
|
//根据id查询类型信息
|
||||||
function findByTypeId(Id) {
|
function findByTypeId(Id) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@@ -1355,55 +1222,16 @@
|
|||||||
//编辑信息
|
//编辑信息
|
||||||
function editMaterial(materialTotalInfo) {
|
function editMaterial(materialTotalInfo) {
|
||||||
var materialInfo = materialTotalInfo.split("AaBb");
|
var materialInfo = materialTotalInfo.split("AaBb");
|
||||||
|
|
||||||
bindMProperty(); //根据商品属性绑定
|
bindMProperty(); //根据商品属性绑定
|
||||||
|
|
||||||
$("#Name").focus().val(materialInfo[1]);
|
$("#Name").focus().val(materialInfo[1]);
|
||||||
$("#Color").focus().val(materialInfo[11]);
|
$("#Color").focus().val(materialInfo[11]);
|
||||||
// console.log("enableSerialNumber:"+(materialInfo[24]=='true'?'1':'0'));
|
|
||||||
// console.log("enableSerialNumber:"+materialInfo[24]);
|
|
||||||
// $("#enableSerialNumber").combobox('setValue',materialInfo[24]=='true'?'1':'0');
|
|
||||||
$("#enableSerialNumber").val(materialInfo[24]=='1'?'1':'0');
|
$("#enableSerialNumber").val(materialInfo[24]=='1'?'1':'0');
|
||||||
// console.log($("#enableSerialNumber").val());
|
//商品类别id
|
||||||
|
$("#parentid").val(materialInfo[14]);
|
||||||
var categoryName = ""; //类型名称
|
//商品类别名称
|
||||||
|
$("#parentName").val(materialInfo[15]);
|
||||||
mId = materialInfo[14];
|
mId = materialInfo[14];
|
||||||
mName = materialInfo[15];
|
mName = materialInfo[15];
|
||||||
//拼接类型名称-多级拼接
|
|
||||||
if (mId != 1) {
|
|
||||||
findByTypeId(mId);
|
|
||||||
if (mId != 1) {
|
|
||||||
categoryName = mName + ">" + categoryName;
|
|
||||||
findByTypeId(mId);
|
|
||||||
if (mId != 1) {
|
|
||||||
categoryName = mName + ">" + categoryName;
|
|
||||||
findByTypeId(mId);
|
|
||||||
if (mId != 1) {
|
|
||||||
categoryName = mName + ">" + categoryName;
|
|
||||||
findByTypeId(mId);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
categoryName = mName + ">" + categoryName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
categoryName = mName + ">" + categoryName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
categoryName = mName + ">" + categoryName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
categoryName = mName + categoryName;
|
|
||||||
}
|
|
||||||
$("#CategoryId_s").empty();
|
|
||||||
$("#CategoryId_t").empty(); //清空类型下拉
|
|
||||||
$("#CategoryId_f").hide();
|
|
||||||
$("#CategoryId_s").hide();
|
|
||||||
$("#CategoryId_t").hide(); //全部隐藏
|
|
||||||
$("#mTypeName").text(categoryName).show(); //类型显示
|
|
||||||
$("#mTypeChange").show(); //按钮显示
|
|
||||||
$("#Packing").focus().val(materialInfo[12]);
|
$("#Packing").focus().val(materialInfo[12]);
|
||||||
$("#SafetyStock").focus().val(materialInfo[13]=="undefined" ? "" : materialInfo[13]);
|
$("#SafetyStock").focus().val(materialInfo[13]=="undefined" ? "" : materialInfo[13]);
|
||||||
$("#Model").val(materialInfo[2]);
|
$("#Model").val(materialInfo[2]);
|
||||||
@@ -1506,13 +1334,6 @@
|
|||||||
url = '/material/update?id=' + materialInfo[0];
|
url = '/material/update?id=' + materialInfo[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#mTypeChange").off("click").on("click", function () {
|
|
||||||
$(this).hide();
|
|
||||||
$("#mTypeName").hide();
|
|
||||||
$("#CategoryId_f").show();
|
|
||||||
$("#CategoryId_s").show();
|
|
||||||
$("#CategoryId_t").show(); //全部显示
|
|
||||||
});
|
|
||||||
|
|
||||||
//搜索处理
|
//搜索处理
|
||||||
$("#searchBtn").unbind().bind({
|
$("#searchBtn").unbind().bind({
|
||||||
@@ -1573,11 +1394,6 @@
|
|||||||
$("#searchResetBtn").unbind().bind({
|
$("#searchResetBtn").unbind().bind({
|
||||||
click: function () {
|
click: function () {
|
||||||
$("#searchName").val("");
|
$("#searchName").val("");
|
||||||
$("#searchCategoryId_f").val("");
|
|
||||||
$("#searchCategoryId_s").val("");
|
|
||||||
$("#searchCategoryId_t").val("");
|
|
||||||
$("#searchCategoryId_s").empty();
|
|
||||||
$("#searchCategoryId_t").empty(); //清空类型下拉
|
|
||||||
setCategoryId = "1";
|
setCategoryId = "1";
|
||||||
//加载完以后重新初始化
|
//加载完以后重新初始化
|
||||||
$("#searchBtn").click();
|
$("#searchBtn").click();
|
||||||
@@ -1654,7 +1470,21 @@
|
|||||||
}, 3300);
|
}, 3300);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
//查询父级商品类别
|
||||||
|
$("#lookForSelectMaterialCategory").on("click", function () {
|
||||||
|
$('#forSelectMaterialCategoryDlg').dialog({
|
||||||
|
title: '商品类别选择',
|
||||||
|
width: webW/2,
|
||||||
|
height: webH/2,
|
||||||
|
closed: false,
|
||||||
|
cache: false,
|
||||||
|
href: '/pages/materials/materialcategory_forselect.html',
|
||||||
|
modal: true,
|
||||||
|
resizable:true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user