This commit is contained in:
parent
ed13bbe27a
commit
7447fd56cb
|
|
@ -3,10 +3,12 @@ let objParam;
|
||||||
function setParams(obj) {
|
function setParams(obj) {
|
||||||
objParam = JSON.parse(obj);
|
objParam = JSON.parse(obj);
|
||||||
console.log(objParam);
|
console.log(objParam);
|
||||||
$('#parentName').val(objParam.context);
|
if (objParam.type === 2) { // 修改
|
||||||
$('#parentId').val(objParam.id);
|
|
||||||
if (objParam.type === 2) { // 新增
|
|
||||||
$('#id').val(objParam.nodeId);
|
$('#id').val(objParam.nodeId);
|
||||||
|
$('#parentId').val(objParam.parentId);
|
||||||
|
} else if (objParam.type === 1) { // 新增
|
||||||
|
$('#parentName').val(objParam.context);
|
||||||
|
$('#parentId').val(objParam.nodeId);
|
||||||
}
|
}
|
||||||
console.log(objParam);
|
console.log(objParam);
|
||||||
layui.use(['form', 'layer'], function () {
|
layui.use(['form', 'layer'], function () {
|
||||||
|
|
@ -20,6 +22,25 @@ function setParams(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 详情
|
||||||
|
function getDetailById() {
|
||||||
|
let encryptedData = {
|
||||||
|
id: objParam.nodeId
|
||||||
|
};
|
||||||
|
let url = dataUrl + 'backstage/paType/getTypeDataById?encryptedData=' + encodeURIComponent(JSON.stringify(encryptedData));
|
||||||
|
ajaxRequest(url, "GET", null, true, function () {
|
||||||
|
}, function (result) {
|
||||||
|
console.log(result);
|
||||||
|
if (result.code === 200) {
|
||||||
|
$('#parentName').val(result.data.parentName);
|
||||||
|
$('#name').val(result.data.name);
|
||||||
|
$('#unit').val(result.data.unit);
|
||||||
|
}
|
||||||
|
}, function (xhr, status, error) {
|
||||||
|
errorFn(xhr, status, error)
|
||||||
|
}, null);
|
||||||
|
}
|
||||||
|
|
||||||
function saveData2() {
|
function saveData2() {
|
||||||
$('#formSubmit').trigger('click')
|
$('#formSubmit').trigger('click')
|
||||||
}
|
}
|
||||||
|
|
@ -48,7 +69,7 @@ function submitApply(data) {
|
||||||
$('.cancel').removeClass("layui-btn-disabled").attr("disabled", false);
|
$('.cancel').removeClass("layui-btn-disabled").attr("disabled", false);
|
||||||
if (result.code === 200) {
|
if (result.code === 200) {
|
||||||
parent.layer.msg(result.msg, { icon: 1 });
|
parent.layer.msg(result.msg, { icon: 1 });
|
||||||
closePage(1);
|
closePage(1, result.data);
|
||||||
} else {
|
} else {
|
||||||
layer.msg(result.msg, { icon: 2 });
|
layer.msg(result.msg, { icon: 2 });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ layui.config({
|
||||||
dtreeData = getDTreeData();
|
dtreeData = getDTreeData();
|
||||||
fitTypeTree = dtree.render({
|
fitTypeTree = dtree.render({
|
||||||
elem: "#fitTypeTree",
|
elem: "#fitTypeTree",
|
||||||
width: "98%", // 指定树的宽度
|
width: "30%", // 指定树的宽度
|
||||||
dataFormat: "list",
|
dataFormat: "list",
|
||||||
none: "无数据",
|
none: "无数据",
|
||||||
menubar: true,
|
menubar: true,
|
||||||
|
|
@ -29,7 +29,7 @@ layui.config({
|
||||||
if (param.level === '1') {
|
if (param.level === '1') {
|
||||||
buttons.customEdit = "";
|
buttons.customEdit = "";
|
||||||
buttons.customDel = "";
|
buttons.customDel = "";
|
||||||
} else if (param.level === '4') { // 三级规格型号
|
} else if (param.level === '4') {
|
||||||
buttons.customAdd = "";
|
buttons.customAdd = "";
|
||||||
}
|
}
|
||||||
return buttons; // 将按钮对象返回
|
return buttons; // 将按钮对象返回
|
||||||
|
|
@ -47,11 +47,8 @@ layui.config({
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
toolbarId: "customDel", icon: "dtree-icon-roundclose", title: "删除", handler: function (node, $div) {
|
toolbarId: "customDel", icon: "dtree-icon-roundclose", title: "删除", handler: function (node, $div) {
|
||||||
if (node.level === '2') { // 删除配件
|
// 删除配件
|
||||||
delAreaData(node.nodeId, node.parentId, '1', $div)
|
delFitType(node.nodeId, $div);
|
||||||
} else if (node.level === '3') { // 删除配件
|
|
||||||
delAreaData(node.nodeId, node.parentId, '2', $div)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
done: function (result, $ul, first) {
|
done: function (result, $ul, first) {
|
||||||
|
|
@ -116,6 +113,31 @@ function queryDtree(type) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 删除配件
|
||||||
|
function delFitType(id, $div) {
|
||||||
|
layer.confirm("确定删除此条数据吗?", { 'title': '操作提示', move: false }, function () {
|
||||||
|
let loadingMsg = layer.msg('数据删除中,请稍候...', { icon: 16, scrollbar: false, time: 0 });
|
||||||
|
let url = dataUrl + "backstage/paType/deleteTypeData"
|
||||||
|
let obj = { 'id': id }
|
||||||
|
let params = {
|
||||||
|
encryptedData: JSON.stringify(obj)
|
||||||
|
}
|
||||||
|
ajaxRequest(url, "POST", params, true, function () {
|
||||||
|
}, function (result) {
|
||||||
|
layer.close(loadingMsg); // 关闭提示层
|
||||||
|
if (result.code === 200) {
|
||||||
|
layer.msg(result.msg, { icon: 1 })
|
||||||
|
fitTypeTree.partialRefreshDel($div); // 删除节点
|
||||||
|
} else {
|
||||||
|
layer.msg(result.msg, { icon: 2 })
|
||||||
|
}
|
||||||
|
}, function (xhr) {
|
||||||
|
layer.close(loadingMsg); // 关闭提示层
|
||||||
|
error(xhr)
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 赋值新增节点
|
// 赋值新增节点
|
||||||
function reloadData(data) {
|
function reloadData(data) {
|
||||||
jsonData = data;
|
jsonData = data;
|
||||||
|
|
|
||||||
|
|
@ -101,10 +101,10 @@ function openIframeByDtree(id, title, content, width, height, params, $div) {
|
||||||
if (jsonData) {
|
if (jsonData) {
|
||||||
if (params.id) {
|
if (params.id) {
|
||||||
// 修改节点
|
// 修改节点
|
||||||
areaTree.partialRefreshEdit($div, jsonData.title);
|
fitTypeTree.partialRefreshEdit($div, jsonData.title);
|
||||||
} else {
|
} else {
|
||||||
// 新增节点
|
// 新增节点
|
||||||
areaTree.partialRefreshAdd($div, jsonData);
|
fitTypeTree.partialRefreshAdd($div, jsonData);
|
||||||
}
|
}
|
||||||
jsonData = null;
|
jsonData = null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue