|
@@ -256,8 +256,10 @@
|
|
|
],
|
|
|
baikeDetailForm: {},
|
|
|
isClear: false,
|
|
|
+ myConfig: {}
|
|
|
};
|
|
|
},
|
|
|
+
|
|
|
methods: {
|
|
|
getData(data) {
|
|
|
this.$api.getBaikeCategoryList().then((res) => {
|
|
@@ -265,9 +267,8 @@
|
|
|
});
|
|
|
if (data && data.id) {
|
|
|
this.queryBaikeDetailParams.category_id = data.id;
|
|
|
- // this.queryBaikeDetailParams.category_name = data.name;
|
|
|
+ this.queryBaikeDetailParams.category_name = data.name;
|
|
|
}
|
|
|
-
|
|
|
this.$api.getBaikeDetailList(this.queryBaikeDetailParams).then((res) => {
|
|
|
this.baikeList = res.data.data.list;
|
|
|
this.total = res.data.data.total;
|
|
@@ -281,255 +282,232 @@
|
|
|
parent_name: data.name,
|
|
|
};
|
|
|
},
|
|
|
- methods: {
|
|
|
- getData(data) {
|
|
|
- this.$api.getBaikeCategoryList().then((res) => {
|
|
|
- this.data = res.data.data;
|
|
|
- });
|
|
|
- if (data && data.id) {
|
|
|
- this.queryBaikeDetailParams.category_id = data.id;
|
|
|
- this.queryBaikeDetailParams.category_name = data.name;
|
|
|
- }
|
|
|
- this.$api.getBaikeDetailList(this.queryBaikeDetailParams).then((res) => {
|
|
|
- this.baikeList = res.data.data.list;
|
|
|
- this.total = res.data.data.total;
|
|
|
- this.loading = false;
|
|
|
- });
|
|
|
- },
|
|
|
- append(data) {
|
|
|
- this.dialogVisible = true;
|
|
|
- this.catform = {
|
|
|
- parent_id: data.id,
|
|
|
- parent_name: data.name,
|
|
|
- };
|
|
|
- },
|
|
|
- edit(data) {
|
|
|
- this.dialogVisible = true;
|
|
|
- this.$api.getBaikeCategoryDetail({
|
|
|
+ edit(data) {
|
|
|
+ this.dialogVisible = true;
|
|
|
+ this.$api.getBaikeCategoryDetail({
|
|
|
+ id: data.id
|
|
|
+ }).then((res) => {
|
|
|
+ this.catform = res.data.data;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ editDetail(data) {
|
|
|
+ this.show = 1;
|
|
|
+ this.$api.getBaikeDetail({
|
|
|
+ id: data.id
|
|
|
+ }).then((res) => {
|
|
|
+ this.form = res.data.data;
|
|
|
+ this.form.is_active = Boolean(this.form.is_active);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ remove(data) {
|
|
|
+ this.$confirm("确定删除“" + data.name + "”分类?", "提示", {
|
|
|
+ type: "warning",
|
|
|
+ }).then(() => {
|
|
|
+ this.$api.delBaikeCategory({
|
|
|
id: data.id
|
|
|
}).then((res) => {
|
|
|
- this.catform = res.data.data;
|
|
|
+ this.$message({
|
|
|
+ message: "删除成功!",
|
|
|
+ type: "success"
|
|
|
+ });
|
|
|
+ this.getData();
|
|
|
});
|
|
|
- },
|
|
|
- editDetail(data) {
|
|
|
- this.show = 1;
|
|
|
- this.$api.getBaikeDetail({
|
|
|
+ });
|
|
|
+ },
|
|
|
+ delBaikeDetail(data) {
|
|
|
+ this.$confirm("确定删除“" + data.name + "”分类?", "提示", {
|
|
|
+ type: "warning",
|
|
|
+ }).then(() => {
|
|
|
+ this.$api.delBaikeDetail({
|
|
|
id: data.id
|
|
|
}).then((res) => {
|
|
|
- this.form = res.data.data;
|
|
|
- this.form.is_active = Boolean(this.form.is_active);
|
|
|
+ this.$message({
|
|
|
+ message: "删除成功!",
|
|
|
+ type: "success"
|
|
|
+ });
|
|
|
+ this.getData();
|
|
|
});
|
|
|
- },
|
|
|
- remove(data) {
|
|
|
- this.$confirm("确定删除“" + data.name + "”分类?", "提示", {
|
|
|
- type: "warning",
|
|
|
- }).then(() => {
|
|
|
- this.$api.delBaikeCategory({
|
|
|
- id: data.id
|
|
|
- }).then((res) => {
|
|
|
+ });
|
|
|
+ },
|
|
|
+ save() {
|
|
|
+ var parm = this.catform;
|
|
|
+ if (parm.password != parm.repassword) {
|
|
|
+ this.$message.error("两次输入的密码不一致,请检查!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (parm.id) {
|
|
|
+ this.$api.editBaikeCategory(parm).then((res) => {
|
|
|
+ if (res.data.code == 0) {
|
|
|
this.$message({
|
|
|
- message: "删除成功!",
|
|
|
+ message: "修改成功!",
|
|
|
type: "success"
|
|
|
});
|
|
|
this.getData();
|
|
|
- });
|
|
|
+ this.form = {
|
|
|
+ parent_id: null,
|
|
|
+ is_active: false,
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.data.message);
|
|
|
+ }
|
|
|
});
|
|
|
- },
|
|
|
- delBaikeDetail(data) {
|
|
|
- this.$confirm("确定删除“" + data.name + "”分类?", "提示", {
|
|
|
- type: "warning",
|
|
|
- }).then(() => {
|
|
|
- this.$api.delBaikeDetail({
|
|
|
- id: data.id
|
|
|
- }).then((res) => {
|
|
|
+ } else {
|
|
|
+ this.$api.addBaikeCategory(parm).then((res) => {
|
|
|
+ if (res.data.code == 0) {
|
|
|
this.$message({
|
|
|
- message: "删除成功!",
|
|
|
+ message: "添加成功!",
|
|
|
type: "success"
|
|
|
});
|
|
|
this.getData();
|
|
|
- });
|
|
|
+ this.form = {
|
|
|
+ parent_id: null,
|
|
|
+ is_active: false,
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.data.message);
|
|
|
+ }
|
|
|
});
|
|
|
- },
|
|
|
- save() {
|
|
|
- var parm = this.catform;
|
|
|
- if (parm.password != parm.repassword) {
|
|
|
- this.$message.error("两次输入的密码不一致,请检查!");
|
|
|
- return;
|
|
|
- }
|
|
|
- if (parm.id) {
|
|
|
- this.$api.editBaikeCategory(parm).then((res) => {
|
|
|
- if (res.data.code == 0) {
|
|
|
- this.$message({
|
|
|
- message: "修改成功!",
|
|
|
- type: "success"
|
|
|
- });
|
|
|
- this.getData();
|
|
|
- this.form = {
|
|
|
- parent_id: null,
|
|
|
- is_active: false,
|
|
|
- };
|
|
|
- } else {
|
|
|
- this.$message.error(res.data.message);
|
|
|
- }
|
|
|
+ }
|
|
|
+ this.dialogVisible = false;
|
|
|
+ },
|
|
|
+ //下属企业
|
|
|
+ add() {
|
|
|
+ let parm = this.enterprise;
|
|
|
+ parm.goverment_id = this.form.id;
|
|
|
+ if (!parm.enterprise_id) {
|
|
|
+ this.$message.error("请选择企业");
|
|
|
+ }
|
|
|
+ this.$api.saveSubent(parm).then((res) => {
|
|
|
+ if (res.data.code == 0) {
|
|
|
+ this.$message({
|
|
|
+ message: "添加成功!",
|
|
|
+ type: "success"
|
|
|
});
|
|
|
- } else {
|
|
|
- this.$api.addBaikeCategory(parm).then((res) => {
|
|
|
- if (res.data.code == 0) {
|
|
|
- this.$message({
|
|
|
- message: "添加成功!",
|
|
|
- type: "success"
|
|
|
- });
|
|
|
- this.getData();
|
|
|
- this.form = {
|
|
|
- parent_id: null,
|
|
|
- is_active: false,
|
|
|
- };
|
|
|
- } else {
|
|
|
- this.$message.error(res.data.message);
|
|
|
- }
|
|
|
+ this.dialogFormVisible = false;
|
|
|
+ this.edit({
|
|
|
+ id: parm.goverment_id
|
|
|
});
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.data.message);
|
|
|
}
|
|
|
- this.dialogVisible = false;
|
|
|
- },
|
|
|
- //下属企业
|
|
|
- add() {
|
|
|
- let parm = this.enterprise;
|
|
|
- parm.goverment_id = this.form.id;
|
|
|
- if (!parm.enterprise_id) {
|
|
|
- this.$message.error("请选择企业");
|
|
|
- }
|
|
|
- this.$api.saveSubent(parm).then((res) => {
|
|
|
- if (res.data.code == 0) {
|
|
|
+ });
|
|
|
+ },
|
|
|
+ del(id) {
|
|
|
+ this.$confirm("确定删除该企业?", "提示", {
|
|
|
+ type: "warning",
|
|
|
+ }).then(() => {
|
|
|
+ this.$api
|
|
|
+ .deleteSubent({
|
|
|
+ enterprise_id: id,
|
|
|
+ goverment_id: this.form.id
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
this.$message({
|
|
|
- message: "添加成功!",
|
|
|
+ message: "删除成功!",
|
|
|
type: "success"
|
|
|
});
|
|
|
- this.dialogFormVisible = false;
|
|
|
this.edit({
|
|
|
- id: parm.goverment_id
|
|
|
+ id: this.form.id
|
|
|
});
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getBaikeDetailList() {
|
|
|
+ this.$api.getBaikeDetailList(this.queryBaikeDetailParams).then((res) => {
|
|
|
+ this.baikeList = res.data.data.list;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ saveBaikeDetail(action) {
|
|
|
+ var parm = this.baikeDetailForm;
|
|
|
+ parm.action = action;
|
|
|
+ if (parm.id) {
|
|
|
+ this.$api.editBaikeDetail(parm).then((res) => {
|
|
|
+ if (res.data.code == 0) {
|
|
|
+ this.$message({
|
|
|
+ message: "修改成功!",
|
|
|
+ type: "success"
|
|
|
+ });
|
|
|
+ this.getData();
|
|
|
} else {
|
|
|
this.$message.error(res.data.message);
|
|
|
}
|
|
|
});
|
|
|
- },
|
|
|
- del(id) {
|
|
|
- this.$confirm("确定删除该企业?", "提示", {
|
|
|
- type: "warning",
|
|
|
- }).then(() => {
|
|
|
- this.$api
|
|
|
- .deleteSubent({
|
|
|
- enterprise_id: id,
|
|
|
- goverment_id: this.form.id
|
|
|
- })
|
|
|
- .then((res) => {
|
|
|
- this.$message({
|
|
|
- message: "删除成功!",
|
|
|
- type: "success"
|
|
|
- });
|
|
|
- this.edit({
|
|
|
- id: this.form.id
|
|
|
- });
|
|
|
+ } else {
|
|
|
+ this.$api.addBaikeDetail(parm).then((res) => {
|
|
|
+ if (res.data.code == 0) {
|
|
|
+ this.$message({
|
|
|
+ message: "添加成功!",
|
|
|
+ type: "success"
|
|
|
});
|
|
|
- });
|
|
|
- },
|
|
|
- getBaikeDetailList() {
|
|
|
- this.$api.getBaikeDetailList(this.queryBaikeDetailParams).then((res) => {
|
|
|
- this.baikeList = res.data.data.list;
|
|
|
- });
|
|
|
- },
|
|
|
- saveBaikeDetail(action) {
|
|
|
- var parm = this.baikeDetailForm;
|
|
|
- parm.action = action;
|
|
|
- if (parm.id) {
|
|
|
- this.$api.editBaikeDetail(parm).then((res) => {
|
|
|
- if (res.data.code == 0) {
|
|
|
- this.$message({
|
|
|
- message: "修改成功!",
|
|
|
- type: "success"
|
|
|
- });
|
|
|
- this.getData();
|
|
|
- } else {
|
|
|
- this.$message.error(res.data.message);
|
|
|
- }
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.$api.addBaikeDetail(parm).then((res) => {
|
|
|
- if (res.data.code == 0) {
|
|
|
- this.$message({
|
|
|
- message: "添加成功!",
|
|
|
- type: "success"
|
|
|
- });
|
|
|
- this.getData();
|
|
|
- } else {
|
|
|
- this.$message.error(res.data.message);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- this.dialogFormVisible = false;
|
|
|
- },
|
|
|
- openBaikeDetailForm(action, row) {
|
|
|
- if (action == "add") {
|
|
|
- if (!this.queryBaikeDetailParams.category_id) {
|
|
|
- this.$message.error("请选择词条分类!");
|
|
|
+ this.getData();
|
|
|
} else {
|
|
|
- this.baikeDetailForm.category_id = this.queryBaikeDetailParams.category_id;
|
|
|
- this.baikeDetailForm.category_name = this.queryBaikeDetailParams.category_name;
|
|
|
- this.dialogFormVisible = true;
|
|
|
+ this.$message.error(res.data.message);
|
|
|
}
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.dialogFormVisible = false;
|
|
|
+ },
|
|
|
+ openBaikeDetailForm(action, row) {
|
|
|
+ if (action == "add") {
|
|
|
+ if (!this.queryBaikeDetailParams.category_id) {
|
|
|
+ this.$message.error("请选择词条分类!");
|
|
|
} else {
|
|
|
- this.$api.getBaikeDetail({
|
|
|
- id: row.id
|
|
|
- }).then((res) => {
|
|
|
- this.baikeDetailForm = res.data.data;
|
|
|
- this.dialogFormVisible = true;
|
|
|
- })
|
|
|
+ this.baikeDetailForm.category_id = this.queryBaikeDetailParams.category_id;
|
|
|
+ this.baikeDetailForm.category_name = this.queryBaikeDetailParams.category_name;
|
|
|
+ this.dialogFormVisible = true;
|
|
|
}
|
|
|
- },
|
|
|
- setSelected(nodes, keys) {
|
|
|
- this.baikeDetailForm.category_id = nodes.id;
|
|
|
- this.baikeDetailForm.category_name = nodes.name;
|
|
|
- },
|
|
|
- gopage(size) {
|
|
|
- if (size) {
|
|
|
- this.queryParams.page_size = size;
|
|
|
- }
|
|
|
- this.queryParams.page = this.$refs.pageButton.page;
|
|
|
- this.getData();
|
|
|
- },
|
|
|
- handleAvatarSuccess(res, file) {
|
|
|
- this.baikeDetailForm.img = res.data.url;
|
|
|
- console.log(this.baikeDetailForm.img)
|
|
|
- },
|
|
|
- beforeAvatarUpload(file) {
|
|
|
- return;
|
|
|
- const isJPG = file.type === "image/jpeg";
|
|
|
- const isLt2M = file.size / 1024 / 1024 < 2;
|
|
|
-
|
|
|
- if (!isJPG) {
|
|
|
- this.$message.error("上传头像图片只能是 JPG 格式!");
|
|
|
- }
|
|
|
- if (!isLt2M) {
|
|
|
- this.$message.error("上传头像图片大小不能超过 2MB!");
|
|
|
- }
|
|
|
- return isJPG && isLt2M;
|
|
|
- },
|
|
|
- topBaikeDetail(row, action) {
|
|
|
- let params = {
|
|
|
- id: row.id,
|
|
|
- action: action
|
|
|
- }
|
|
|
- this.$api.baikeDetailTop(params).then(res => {
|
|
|
- if (res.data.code == 0) {
|
|
|
- this.$message.success("成功")
|
|
|
- this.getData()
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ this.$api.getBaikeDetail({
|
|
|
+ id: row.id
|
|
|
+ }).then((res) => {
|
|
|
+ this.baikeDetailForm = res.data.data;
|
|
|
+ this.dialogFormVisible = true;
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
- created() {
|
|
|
+ setSelected(nodes, keys) {
|
|
|
+ this.baikeDetailForm.category_id = nodes.id;
|
|
|
+ this.baikeDetailForm.category_name = nodes.name;
|
|
|
+ },
|
|
|
+ gopage(size) {
|
|
|
+ if (size) {
|
|
|
+ this.queryParams.page_size = size;
|
|
|
+ }
|
|
|
+ this.queryParams.page = this.$refs.pageButton.page;
|
|
|
this.getData();
|
|
|
},
|
|
|
- }
|
|
|
- };
|
|
|
+ handleAvatarSuccess(res, file) {
|
|
|
+ this.baikeDetailForm.img = res.data.url;
|
|
|
+ console.log(this.baikeDetailForm.img)
|
|
|
+ },
|
|
|
+ beforeAvatarUpload(file) {
|
|
|
+ return;
|
|
|
+ const isJPG = file.type === "image/jpeg";
|
|
|
+ const isLt2M = file.size / 1024 / 1024 < 2;
|
|
|
+
|
|
|
+ if (!isJPG) {
|
|
|
+ this.$message.error("上传头像图片只能是 JPG 格式!");
|
|
|
+ }
|
|
|
+ if (!isLt2M) {
|
|
|
+ this.$message.error("上传头像图片大小不能超过 2MB!");
|
|
|
+ }
|
|
|
+ return isJPG && isLt2M;
|
|
|
+ },
|
|
|
+ topBaikeDetail(row, action) {
|
|
|
+ let params = {
|
|
|
+ id: row.id,
|
|
|
+ action: action
|
|
|
+ }
|
|
|
+ this.$api.baikeDetailTop(params).then(res => {
|
|
|
+ if (res.data.code == 0) {
|
|
|
+ this.$message.success("成功")
|
|
|
+ this.getData()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getData();
|
|
|
+ },
|
|
|
+ };
|
|
|
</script>
|