This commit is contained in:
parent
ed13bbe27a
commit
7447fd56cb
|
|
@ -3,10 +3,12 @@ let objParam;
|
|||
function setParams(obj) {
|
||||
objParam = JSON.parse(obj);
|
||||
console.log(objParam);
|
||||
$('#parentName').val(objParam.context);
|
||||
$('#parentId').val(objParam.id);
|
||||
if (objParam.type === 2) { // 新增
|
||||
if (objParam.type === 2) { // 修改
|
||||
$('#id').val(objParam.nodeId);
|
||||
$('#parentId').val(objParam.parentId);
|
||||
} else if (objParam.type === 1) { // 新增
|
||||
$('#parentName').val(objParam.context);
|
||||
$('#parentId').val(objParam.nodeId);
|
||||
}
|
||||
console.log(objParam);
|
||||
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() {
|
||||
$('#formSubmit').trigger('click')
|
||||
}
|
||||
|
|
@ -48,7 +69,7 @@ function submitApply(data) {
|
|||
$('.cancel').removeClass("layui-btn-disabled").attr("disabled", false);
|
||||
if (result.code === 200) {
|
||||
parent.layer.msg(result.msg, { icon: 1 });
|
||||
closePage(1);
|
||||
closePage(1, result.data);
|
||||
} else {
|
||||
layer.msg(result.msg, { icon: 2 });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ layui.config({
|
|||
dtreeData = getDTreeData();
|
||||
fitTypeTree = dtree.render({
|
||||
elem: "#fitTypeTree",
|
||||
width: "98%", // 指定树的宽度
|
||||
width: "30%", // 指定树的宽度
|
||||
dataFormat: "list",
|
||||
none: "无数据",
|
||||
menubar: true,
|
||||
|
|
@ -29,7 +29,7 @@ layui.config({
|
|||
if (param.level === '1') {
|
||||
buttons.customEdit = "";
|
||||
buttons.customDel = "";
|
||||
} else if (param.level === '4') { // 三级规格型号
|
||||
} else if (param.level === '4') {
|
||||
buttons.customAdd = "";
|
||||
}
|
||||
return buttons; // 将按钮对象返回
|
||||
|
|
@ -47,11 +47,8 @@ layui.config({
|
|||
},
|
||||
{
|
||||
toolbarId: "customDel", icon: "dtree-icon-roundclose", title: "删除", handler: function (node, $div) {
|
||||
if (node.level === '2') { // 删除配件
|
||||
delAreaData(node.nodeId, node.parentId, '1', $div)
|
||||
} else if (node.level === '3') { // 删除配件
|
||||
delAreaData(node.nodeId, node.parentId, '2', $div)
|
||||
}
|
||||
// 删除配件
|
||||
delFitType(node.nodeId, $div);
|
||||
}
|
||||
}],
|
||||
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) {
|
||||
jsonData = data;
|
||||
|
|
|
|||
|
|
@ -101,10 +101,10 @@ function openIframeByDtree(id, title, content, width, height, params, $div) {
|
|||
if (jsonData) {
|
||||
if (params.id) {
|
||||
// 修改节点
|
||||
areaTree.partialRefreshEdit($div, jsonData.title);
|
||||
fitTypeTree.partialRefreshEdit($div, jsonData.title);
|
||||
} else {
|
||||
// 新增节点
|
||||
areaTree.partialRefreshAdd($div, jsonData);
|
||||
fitTypeTree.partialRefreshAdd($div, jsonData);
|
||||
}
|
||||
jsonData = null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue