This commit is contained in:
2024-03-26 10:50:56 +08:00
parent a8bad4ff3d
commit 7c19fb5e4d
3 changed files with 27 additions and 79 deletions

View File

@@ -411,37 +411,7 @@ export default {
// return; // return;
// } // }
}, },
async remove(data) {
var ids = { productId: data.productId };
this.$confirm(`是否删除标签【${data.title}】?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(async () => {
this.$http({
url: this.$http.adornUrl(
`/book/labelAndMarket/delLabel?id=` + data.id
),
method: "post",
data: {},
}).then(async ({ data }) => {
this.$message({
type: "success",
message: "删除成功!",
});
this.currentNode = null;
this.isFresh = false;
this.addForm = {};
this.$nextTick(() => {
this.isFresh = true;
});
await this.addOrUpdateHandle();
// this.expandedkey = [node.parent.data.catId]
});
})
.catch(() => {});
},
filterNode(value, data) { filterNode(value, data) {
if (!value) return true; if (!value) return true;
return data.title.indexOf(value) !== -1; return data.title.indexOf(value) !== -1;

View File

@@ -1,7 +1,7 @@
<template> <template>
<div class="mod-config"> <div class="mod-config">
<commonTree <commonTree
source="tags" source="tags"
ref="commonTree" ref="commonTree"
:dataList="treeDataList" :dataList="treeDataList"
@getCommonShopDataList="getCommonShopDataList" @getCommonShopDataList="getCommonShopDataList"
@@ -30,6 +30,8 @@
style="width: 100%" style="width: 100%"
v-model="addForm.sort" v-model="addForm.sort"
clearable clearable
@keyup.native="UpNumber"
@keydown.native="UpNumber"
> >
</el-input-number> </el-input-number>
</el-form-item> </el-form-item>
@@ -224,6 +226,10 @@ export default {
this.getDataList(); this.getDataList();
}, },
methods: { methods: {
// 只可输入数字
UpNumber(e) {
e.target.value = e.target.value.replace(/[^\d]/g, "");
},
dataFormEdit() { dataFormEdit() {
this.checkAll = false; this.checkAll = false;
this.isEdit = !this.isEdit; this.isEdit = !this.isEdit;
@@ -233,7 +239,7 @@ export default {
this.$refs.commonShop.handleCheckAllChange(val); this.$refs.commonShop.handleCheckAllChange(val);
}); });
}, },
handleSubmitShopTable: debounce(async function (ids) { handleSubmitShopTable: debounce(async function (ids) {
await this.$http({ await this.$http({
url: this.$http.adornUrl(`${this.urlList.saveShop}`), url: this.$http.adornUrl(`${this.urlList.saveShop}`),
method: "post", method: "post",
@@ -252,7 +258,7 @@ export default {
this.$message.error(data.msg); this.$message.error(data.msg);
} }
}); });
},200), }, 200),
openTable() { openTable() {
this.isEdit = false; this.isEdit = false;
this.$nextTick(() => { this.$nextTick(() => {
@@ -284,7 +290,7 @@ export default {
}, },
//新增修改 //新增修改
dataFormSubmit: debounce(async function (formName) { dataFormSubmit: debounce(async function (formName) {
// return false // return false
if (this.addForm.title == "") { if (this.addForm.title == "") {
this.$message.error("请输入标签名称"); this.$message.error("请输入标签名称");
@@ -319,9 +325,9 @@ export default {
}); });
} }
}); });
},200), }, 200),
//新增修改 //新增修改
dataFormDelete: debounce(async function (formName) { dataFormDelete: debounce(async function (formName) {
// return false // return false
var selectShopArr = this.$refs.commonShop.selectShopArr; var selectShopArr = this.$refs.commonShop.selectShopArr;
console.log(selectShopArr, "1111"); console.log(selectShopArr, "1111");
@@ -349,7 +355,7 @@ export default {
this.$message.error(data.msg); this.$message.error(data.msg);
} }
}); });
},200), }, 200),
setCheckedKeys() { setCheckedKeys() {
this.$refs.tree.setCheckedKeys([0]); this.$refs.tree.setCheckedKeys([0]);
}, },
@@ -409,37 +415,7 @@ export default {
// return; // return;
// } // }
}, },
async remove(data) {
var ids = { productId: data.productId };
this.$confirm(`是否删除标签【${data.title}】?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(async () => {
this.$http({
url: this.$http.adornUrl(
`/book/labelAndMarket/delLabel?id=` + data.id
),
method: "post",
data: {},
}).then(async ({ data }) => {
this.$message({
type: "success",
message: "删除成功!",
});
this.currentNode = null;
this.isFresh = false;
this.addForm = {};
this.$nextTick(() => {
this.isFresh = true;
});
await this.addOrUpdateHandle();
// this.expandedkey = [node.parent.data.catId]
});
})
.catch(() => {});
},
filterNode(value, data) { filterNode(value, data) {
if (!value) return true; if (!value) return true;
return data.title.indexOf(value) !== -1; return data.title.indexOf(value) !== -1;
@@ -695,7 +671,6 @@ export default {
await this.$http({ await this.$http({
url: this.$http.adornUrl(this.urlList.treeList), url: this.$http.adornUrl(this.urlList.treeList),
method: "get", method: "get",
}).then(({ data }) => { }).then(({ data }) => {
console.log("🚀 ~ getDataList ~ data:", data); console.log("🚀 ~ getDataList ~ data:", data);
if (data && data.code === 0) { if (data && data.code === 0) {

View File

@@ -395,6 +395,7 @@ export default {
// } // }
}, },
async remove(data) { async remove(data) {
var that=this;
var ids = { productId: data.productId }; var ids = { productId: data.productId };
this.$confirm(`是否删除标签【${data.title}】?`, "提示", { this.$confirm(`是否删除标签【${data.title}】?`, "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
@@ -402,22 +403,24 @@ export default {
type: "warning", type: "warning",
}) })
.then(async () => { .then(async () => {
this.$http({
url: this.$http.adornUrl(`${urlList.delete}?id=` + data.id), that.$http({
url: that.$http.adornUrl(`${that.urlList.delete}?id=` + data.id),
method: "post", method: "post",
data: {}, data: {},
}).then(async ({ data }) => { }).then(async ({ data }) => {
this.$message({
that.$message({
type: "success", type: "success",
message: "删除成功!", message: "删除成功!",
}); });
this.currentNode = null; that.currentNode = null;
this.isFresh = false; that.isFresh = false;
this.addForm = {}; that.addForm = {};
this.$nextTick(() => { that.$nextTick(() => {
this.isFresh = true; that.isFresh = true;
}); });
await this.addOrUpdateHandle(); await that.addOrUpdateHandle();
// this.expandedkey = [node.parent.data.catId] // this.expandedkey = [node.parent.data.catId]
}); });
}) })