商品添加商品类别选择功能
This commit is contained in:
@@ -32,13 +32,6 @@
|
||||
<input name="searchModel" id="searchModel" style="width:80px;"/>
|
||||
</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>
|
||||
<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>
|
||||
@@ -82,18 +75,17 @@
|
||||
<tr>
|
||||
<td style="height:30px;">类别</td>
|
||||
<td style="padding:5px" colspan="3">
|
||||
<select name="CategoryId_f" id="CategoryId_f" style="width:152px;height: 20px"></select>
|
||||
<select name="CategoryId_s" id="CategoryId_s" style="width:152px;height: 20px"></select>
|
||||
<select name="CategoryId_t" id="CategoryId_t" style="width:152px;height: 20px"></select>
|
||||
<label id="mTypeName"></label>
|
||||
<a href="#" id="mTypeChange">修改</a>
|
||||
<input name="parentName" id="parentName" style="width: 180px;height: 20px" readonly="readonly"/>
|
||||
<a href="javascript:void(0)" class="l-btn l-btn-plain" group="" id="lookForSelectMaterialCategory">
|
||||
<span class="l-btn-left"><span class="l-btn-text icon-search l-btn-icon-left"></span></span></a>
|
||||
<input name="parentid" id="parentid" type="hidden"/>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:80px;">序列号</td>
|
||||
<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="0">禁用</option>
|
||||
</select>
|
||||
@@ -276,11 +268,10 @@
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
<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">
|
||||
var materialCategoryList = null;
|
||||
var materialID = null;
|
||||
var parentid_search = null;
|
||||
var lei = null;
|
||||
var types = "";
|
||||
var setCategoryId = "1";
|
||||
var cid = 1;
|
||||
@@ -365,113 +356,9 @@
|
||||
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() {
|
||||
@@ -629,6 +516,7 @@
|
||||
},
|
||||
{title: '品名', field: 'name', width: 100},
|
||||
{title: '型号', field: 'model', width: 80},
|
||||
{title: '类别', field: 'categoryName', width: 80},
|
||||
{title: '扩展信息', field: 'materialOther', width: 150},
|
||||
{title: '单位', field: 'unit', width: 60},
|
||||
{title: '安全存量', field: 'safetystock', width: 70},
|
||||
@@ -1065,7 +953,6 @@
|
||||
window.location.href = "/material/exportExcel?browserType=" + getOs()
|
||||
+ "&name=" + name + "&model=" + model + "&categoryId=" + cid + "&categoryIds=" + setCategoryId;
|
||||
}
|
||||
|
||||
//增加
|
||||
var url;
|
||||
var materialID = 0;
|
||||
@@ -1162,18 +1049,9 @@
|
||||
bindMProperty(); //根据商品属性绑定
|
||||
// $("#enableSerialNumber").combobox('setValue','0');
|
||||
$("#enableSerialNumber").val('0');
|
||||
|
||||
$('#materialDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加商品信息');
|
||||
$(".window-mask").css({width: webW, height: webH});
|
||||
$("#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);
|
||||
//当前为不选中状态
|
||||
$("#Unit").show();
|
||||
@@ -1269,16 +1147,6 @@
|
||||
if (checkIsExist()) {
|
||||
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
|
||||
var priceStrategy = [];
|
||||
var basicList = {};
|
||||
@@ -1304,7 +1172,7 @@
|
||||
|
||||
var objInfo = $("#materialFM").serializeObject();
|
||||
objInfo.UnitId = $("#manyUnit").val();
|
||||
objInfo.CategoryId = parent;
|
||||
objInfo.CategoryId =$("#parentid").val();
|
||||
objInfo.PriceStrategy = JSON.stringify(priceStrategy); //价格列表
|
||||
$.ajax({
|
||||
type: "post",
|
||||
@@ -1331,7 +1199,6 @@
|
||||
});
|
||||
|
||||
var mId = 0, mName = "";
|
||||
|
||||
//根据id查询类型信息
|
||||
function findByTypeId(Id) {
|
||||
$.ajax({
|
||||
@@ -1355,55 +1222,16 @@
|
||||
//编辑信息
|
||||
function editMaterial(materialTotalInfo) {
|
||||
var materialInfo = materialTotalInfo.split("AaBb");
|
||||
|
||||
bindMProperty(); //根据商品属性绑定
|
||||
|
||||
$("#Name").focus().val(materialInfo[1]);
|
||||
$("#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');
|
||||
// console.log($("#enableSerialNumber").val());
|
||||
|
||||
var categoryName = ""; //类型名称
|
||||
//商品类别id
|
||||
$("#parentid").val(materialInfo[14]);
|
||||
//商品类别名称
|
||||
$("#parentName").val(materialInfo[15]);
|
||||
mId = materialInfo[14];
|
||||
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]);
|
||||
$("#SafetyStock").focus().val(materialInfo[13]=="undefined" ? "" : materialInfo[13]);
|
||||
$("#Model").val(materialInfo[2]);
|
||||
@@ -1506,13 +1334,6 @@
|
||||
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({
|
||||
@@ -1573,11 +1394,6 @@
|
||||
$("#searchResetBtn").unbind().bind({
|
||||
click: function () {
|
||||
$("#searchName").val("");
|
||||
$("#searchCategoryId_f").val("");
|
||||
$("#searchCategoryId_s").val("");
|
||||
$("#searchCategoryId_t").val("");
|
||||
$("#searchCategoryId_s").empty();
|
||||
$("#searchCategoryId_t").empty(); //清空类型下拉
|
||||
setCategoryId = "1";
|
||||
//加载完以后重新初始化
|
||||
$("#searchBtn").click();
|
||||
@@ -1654,7 +1470,21 @@
|
||||
}, 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>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user