|
@@ -85,6 +85,10 @@
|
|
|
<el-input v-model="queryBaikeDetailParams.name" placeholder="" width="200px" size="mini" clearable
|
|
|
@clear="getData"></el-input>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="作者">
|
|
|
+ <el-input v-model="queryBaikeDetailParams.editor" placeholder="" width="200px" size="mini" clearable
|
|
|
+ @clear="getData"></el-input>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="状态">
|
|
|
<el-select v-model="queryBaikeDetailParams.status" placeholder="" size="mini" @change="getData"
|
|
|
@clear="getData" clearable>
|
|
@@ -114,9 +118,11 @@
|
|
|
<el-table-column prop="ctime" label="创建时间"></el-table-column>
|
|
|
<el-table-column align="center" prop="date" label="操作" width="200">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button @click="topBaikeDetail(scope.row,'top')" size="mini" type="primary" v-if="scope.row.istop==0">置顶
|
|
|
+ <el-button @click="topBaikeDetail(scope.row,'top')" size="mini" type="primary"
|
|
|
+ v-if="scope.row.istop==0">置顶
|
|
|
+ </el-button>
|
|
|
+ <el-button @click="topBaikeDetail(scope.row,'cancel')" size="mini" type="primary" v-else>取消置顶
|
|
|
</el-button>
|
|
|
- <el-button @click="topBaikeDetail(scope.row,'cancel')" size="mini" type="primary" v-else>取消置顶</el-button>
|
|
|
<el-button @click="openBaikeDetailForm('edit',scope.row)" size="mini" type="warning">编辑</el-button>
|
|
|
<el-button @click="delBaikeDetail(scope.row)" size="mini" type="danger">删除</el-button>
|
|
|
</template>
|
|
@@ -215,7 +221,8 @@
|
|
|
label: "二级 3-2",
|
|
|
},
|
|
|
],
|
|
|
- }, ],
|
|
|
+ }],
|
|
|
+
|
|
|
form: {
|
|
|
parent_id: null,
|
|
|
is_active: false
|
|
@@ -258,8 +265,9 @@
|
|
|
});
|
|
|
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;
|
|
@@ -273,232 +281,255 @@
|
|
|
parent_name: data.name,
|
|
|
};
|
|
|
},
|
|
|
- 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({
|
|
|
+ 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({
|
|
|
id: data.id
|
|
|
}).then((res) => {
|
|
|
- this.$message({
|
|
|
- message: "删除成功!",
|
|
|
- type: "success"
|
|
|
- });
|
|
|
- this.getData();
|
|
|
+ this.catform = res.data.data;
|
|
|
});
|
|
|
- });
|
|
|
- },
|
|
|
- delBaikeDetail(data) {
|
|
|
- this.$confirm("确定删除“" + data.name + "”分类?", "提示", {
|
|
|
- type: "warning",
|
|
|
- }).then(() => {
|
|
|
- this.$api.delBaikeDetail({
|
|
|
+ },
|
|
|
+ editDetail(data) {
|
|
|
+ this.show = 1;
|
|
|
+ this.$api.getBaikeDetail({
|
|
|
id: data.id
|
|
|
}).then((res) => {
|
|
|
- this.$message({
|
|
|
- message: "删除成功!",
|
|
|
- type: "success"
|
|
|
- });
|
|
|
- this.getData();
|
|
|
+ this.form = res.data.data;
|
|
|
+ this.form.is_active = Boolean(this.form.is_active);
|
|
|
});
|
|
|
- });
|
|
|
- },
|
|
|
- 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) {
|
|
|
+ },
|
|
|
+ remove(data) {
|
|
|
+ this.$confirm("确定删除“" + data.name + "”分类?", "提示", {
|
|
|
+ type: "warning",
|
|
|
+ }).then(() => {
|
|
|
+ this.$api.delBaikeCategory({
|
|
|
+ id: data.id
|
|
|
+ }).then((res) => {
|
|
|
this.$message({
|
|
|
- message: "修改成功!",
|
|
|
+ message: "删除成功!",
|
|
|
type: "success"
|
|
|
});
|
|
|
this.getData();
|
|
|
- this.form = {
|
|
|
- parent_id: null,
|
|
|
- is_active: false,
|
|
|
- };
|
|
|
- } else {
|
|
|
- this.$message.error(res.data.message);
|
|
|
- }
|
|
|
+ });
|
|
|
});
|
|
|
- } else {
|
|
|
- this.$api.addBaikeCategory(parm).then((res) => {
|
|
|
- if (res.data.code == 0) {
|
|
|
+ },
|
|
|
+ delBaikeDetail(data) {
|
|
|
+ this.$confirm("确定删除“" + data.name + "”分类?", "提示", {
|
|
|
+ type: "warning",
|
|
|
+ }).then(() => {
|
|
|
+ this.$api.delBaikeDetail({
|
|
|
+ id: data.id
|
|
|
+ }).then((res) => {
|
|
|
this.$message({
|
|
|
- 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"
|
|
|
});
|
|
|
- this.dialogFormVisible = false;
|
|
|
- this.edit({
|
|
|
- id: parm.goverment_id
|
|
|
+ });
|
|
|
+ },
|
|
|
+ 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);
|
|
|
+ }
|
|
|
});
|
|
|
} else {
|
|
|
- this.$message.error(res.data.message);
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
- });
|
|
|
- },
|
|
|
- del(id) {
|
|
|
- this.$confirm("确定删除该企业?", "提示", {
|
|
|
- type: "warning",
|
|
|
- }).then(() => {
|
|
|
- this.$api
|
|
|
- .deleteSubent({
|
|
|
- enterprise_id: id,
|
|
|
- goverment_id: this.form.id
|
|
|
- })
|
|
|
- .then((res) => {
|
|
|
+ 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: "删除成功!",
|
|
|
+ message: "添加成功!",
|
|
|
type: "success"
|
|
|
});
|
|
|
+ this.dialogFormVisible = false;
|
|
|
this.edit({
|
|
|
- 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"
|
|
|
+ id: parm.goverment_id
|
|
|
});
|
|
|
- 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"
|
|
|
+ },
|
|
|
+ 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
|
|
|
+ });
|
|
|
});
|
|
|
- this.getData();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ 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("请选择词条分类!");
|
|
|
} else {
|
|
|
- this.$message.error(res.data.message);
|
|
|
+ this.baikeDetailForm.category_id = this.queryBaikeDetailParams.category_id;
|
|
|
+ this.baikeDetailForm.category_name = this.queryBaikeDetailParams.category_name;
|
|
|
+ this.dialogFormVisible = true;
|
|
|
}
|
|
|
- });
|
|
|
- }
|
|
|
- this.dialogFormVisible = false;
|
|
|
- },
|
|
|
- openBaikeDetailForm(action, row) {
|
|
|
- if (action == "add") {
|
|
|
- if (!this.queryBaikeDetailParams.category_id) {
|
|
|
- this.$message.error("请选择词条分类!");
|
|
|
} else {
|
|
|
- this.baikeDetailForm.category_id = this.queryBaikeDetailParams.category_id;
|
|
|
- this.baikeDetailForm.category_name = this.queryBaikeDetailParams.category_name;
|
|
|
- this.dialogFormVisible = true;
|
|
|
+ this.$api.getBaikeDetail({
|
|
|
+ id: row.id
|
|
|
+ }).then((res) => {
|
|
|
+ this.baikeDetailForm = res.data.data;
|
|
|
+ this.dialogFormVisible = true;
|
|
|
+ })
|
|
|
}
|
|
|
- } else {
|
|
|
- this.$api.getBaikeDetail({
|
|
|
- id: row.id
|
|
|
- }).then((res) => {
|
|
|
- this.baikeDetailForm = res.data.data;
|
|
|
- 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()
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
- 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;
|
|
|
+ created() {
|
|
|
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>
|