|
@@ -54,11 +54,12 @@
|
|
|
</el-form>-->
|
|
|
<el-button
|
|
|
type="primary"
|
|
|
- @click="show=1,form={parent_id:null,is_active:false}"
|
|
|
+ @click="(dialogVisible = true), (catform = { parent_id: null })"
|
|
|
icon="el-icon-circle-plus"
|
|
|
size="mini"
|
|
|
- style="width:100%;margin-bottom:10px;"
|
|
|
- >新增百科分类</el-button>
|
|
|
+ style="width: 100%; margin-bottom: 10px"
|
|
|
+ >新增百科分类</el-button
|
|
|
+ >
|
|
|
<el-tree
|
|
|
:data="data"
|
|
|
default-expand-all
|
|
@@ -69,17 +70,29 @@
|
|
|
<span
|
|
|
class="custom-tree-node"
|
|
|
slot-scope="{ node, data }"
|
|
|
- @click.stop="() => edit(data)"
|
|
|
+ @click.stop="() => getData(data)"
|
|
|
>
|
|
|
<span class="label_name">{{ node.label }}</span>
|
|
|
<span class="edit">
|
|
|
- <el-button type="text" size="mini" @click.stop="() => append(data)">
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ size="mini"
|
|
|
+ @click.stop="() => append(data)"
|
|
|
+ >
|
|
|
<i class="el-icon-plus"></i>
|
|
|
</el-button>
|
|
|
- <el-button type="text" size="mini" @click.stop="() => edit(data)">
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ size="mini"
|
|
|
+ @click.stop="() => edit(data)"
|
|
|
+ >
|
|
|
<i class="el-icon-edit"></i>
|
|
|
</el-button>
|
|
|
- <el-button type="text" size="mini" @click.stop="() => remove(data)">
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ size="mini"
|
|
|
+ @click.stop="() => remove(data)"
|
|
|
+ >
|
|
|
<i class="el-icon-delete"></i>
|
|
|
</el-button>
|
|
|
</span>
|
|
@@ -87,26 +100,91 @@
|
|
|
</el-tree>
|
|
|
</li>
|
|
|
<li class="company">
|
|
|
- <h1 v-if="form.id">
|
|
|
- <el-button @click="dialogFormVisible=true" size="mini" type="primary">添加</el-button>
|
|
|
- </h1>
|
|
|
+ <el-form
|
|
|
+ ref="queryBaikeDetailParams"
|
|
|
+ :model="queryBaikeDetailParams"
|
|
|
+ label-width="80px"
|
|
|
+ :inline="true"
|
|
|
+ >
|
|
|
+ <el-form-item label="名称">
|
|
|
+ <el-input
|
|
|
+ v-model="queryBaikeDetailParams.name"
|
|
|
+ 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
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in baikeStatusList"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button @click="getData" size="mini" type="primary"
|
|
|
+ >搜索</el-button
|
|
|
+ >
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item style="float: right">
|
|
|
+ <el-button
|
|
|
+ @click="openBaikeDetailForm('add',{})"
|
|
|
+ size="mini"
|
|
|
+ type="primary"
|
|
|
+ >添加词条</el-button
|
|
|
+ >
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
<el-table :data="baikeList" style="width: 100%">
|
|
|
<el-table-column prop="name" label="词条名称"></el-table-column>
|
|
|
- <el-table-column prop="content" label="词条详情"></el-table-column>
|
|
|
+ <!-- <el-table-column prop="content" label="词条详情"></el-table-column> -->
|
|
|
<el-table-column prop="status" label="状态">
|
|
|
- <template slot-scope="scope">
|
|
|
+ <template slot-scope="scope">
|
|
|
<div>
|
|
|
- <el-tag type="success" v-if="scope.row.status==1" size="mini">已发布</el-tag>
|
|
|
- <el-tag type="warning" v-else size="mini">待编辑</el-tag>
|
|
|
+ <el-tag
|
|
|
+ type="success"
|
|
|
+ v-if="scope.row.status == 1"
|
|
|
+ size="mini"
|
|
|
+ >已发布</el-tag
|
|
|
+ >
|
|
|
+ <el-tag type="warning" v-else size="mini">待编辑</el-tag>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="canme" label="创建人"></el-table-column>
|
|
|
+ <el-table-column prop="cname" label="创建人"></el-table-column>
|
|
|
<el-table-column prop="ctime" label="创建时间"></el-table-column>
|
|
|
- <el-table-column align="center" prop="date" label="操作" width="150">
|
|
|
+ <el-table-column
|
|
|
+ align="center"
|
|
|
+ prop="date"
|
|
|
+ label="操作"
|
|
|
+ width="150"
|
|
|
+ >
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button @click="editDetail(scope.row.id)" size="mini" type="warning">编辑</el-button>
|
|
|
- <el-button @click="delDetail(scope.row.id)" size="mini" type="danger">删除</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>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -121,64 +199,69 @@
|
|
|
</ul>
|
|
|
</div>
|
|
|
<!-- 添加/编辑词条分类 -->
|
|
|
- <el-dialog
|
|
|
- title=""
|
|
|
- :visible.sync="dialogVisible"
|
|
|
- width="500px"
|
|
|
- :before-close="dialogBeforeClose">
|
|
|
- <div>
|
|
|
- <el-form ref="form" :model="catform" label-width="80px">
|
|
|
- <el-form-item label="上级分类">
|
|
|
- <el-input v-model="catform.parent_name" placeholder="" disabled=""></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="分类名称">
|
|
|
- <el-input v-model="catform.name" placeholder=""></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- </div>
|
|
|
- <div slot="footer">
|
|
|
- <el-button @click="dialogVisible = false">取 消</el-button>
|
|
|
- <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
|
|
|
- </div>
|
|
|
+ <el-dialog title="" :visible.sync="dialogVisible" width="500px">
|
|
|
+ <div>
|
|
|
+ <el-form ref="form" :model="catform" label-width="80px">
|
|
|
+ <el-form-item label="上级分类">
|
|
|
+ <el-input
|
|
|
+ v-model="catform.parent_name"
|
|
|
+ placeholder=""
|
|
|
+ disabled=""
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="分类名称">
|
|
|
+ <el-input v-model="catform.name" placeholder=""></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ <div slot="footer">
|
|
|
+ <el-button @click="dialogVisible = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="save">确 定</el-button>
|
|
|
+ </div>
|
|
|
</el-dialog>
|
|
|
<!-- 添加词条 -->
|
|
|
- <el-dialog
|
|
|
- title="添加下属企业"
|
|
|
- :visible.sync="dialogFormVisible"
|
|
|
- width="500px"
|
|
|
- :close-on-click-modal="false"
|
|
|
- :close-on-press-escape="false"
|
|
|
- >
|
|
|
- <el-form :model="form">
|
|
|
- <el-form-item label="企业名称">
|
|
|
- <el-select filterable v-model="enterprise.enterprise_id" placeholder="请选择">
|
|
|
- <el-option
|
|
|
- v-for="(item,index) in enterpriseList"
|
|
|
- :key="index"
|
|
|
- :label="item.name"
|
|
|
- :value="item.id"
|
|
|
- ></el-option>
|
|
|
- </el-select>
|
|
|
+ <el-dialog title="添加词条" :visible.sync="dialogFormVisible">
|
|
|
+ <el-form :model="baikeDetailForm">
|
|
|
+ <el-form-item label="词条名称">
|
|
|
+ <el-input v-model="baikeDetailForm.name" placeholder=""></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="词条解释">
|
|
|
+ <fuEditor
|
|
|
+ v-model="baikeDetailForm.content"
|
|
|
+ :isClear="isClear"
|
|
|
+ ></fuEditor>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
- <el-button size="small" @click="dialogFormVisible = false">取 消</el-button>
|
|
|
- <el-button size="small" type="primary" @click="add">确 定</el-button>
|
|
|
+ <el-button size="small" @click="dialogFormVisible = false"
|
|
|
+ >取 消</el-button
|
|
|
+ >
|
|
|
+ <el-button size="small" type="primary" @click="saveBaikeDetail('save')"
|
|
|
+ >保 存</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ type="success"
|
|
|
+ @click="saveBaikeDetail('publish')"
|
|
|
+ >发 布</el-button
|
|
|
+ >
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</section>
|
|
|
</template>
|
|
|
<script>
|
|
|
import Page from "../../components/Page";
|
|
|
+import fuEditor from "@/components/fuEditor/index.vue";
|
|
|
export default {
|
|
|
components: {
|
|
|
- Page
|
|
|
+ Page,
|
|
|
+ fuEditor,
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
filter: {
|
|
|
area: "",
|
|
|
- name: ""
|
|
|
+ name: "",
|
|
|
},
|
|
|
dialogFormVisible: false,
|
|
|
dialogVisible: false,
|
|
@@ -189,22 +272,22 @@ export default {
|
|
|
children: [
|
|
|
{
|
|
|
id: 7,
|
|
|
- label: "二级 3-1"
|
|
|
+ label: "二级 3-1",
|
|
|
},
|
|
|
{
|
|
|
id: 8,
|
|
|
- label: "二级 3-2"
|
|
|
- }
|
|
|
- ]
|
|
|
- }
|
|
|
+ label: "二级 3-2",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
],
|
|
|
form: { parent_id: null, is_active: false },
|
|
|
props: {
|
|
|
- label: "name"
|
|
|
+ label: "name",
|
|
|
},
|
|
|
//下属企业
|
|
|
enterprise: {
|
|
|
- enterprise_id: ""
|
|
|
+ enterprise_id: "",
|
|
|
},
|
|
|
enterpriseList: [],
|
|
|
area: [],
|
|
@@ -213,54 +296,75 @@ export default {
|
|
|
total: 0,
|
|
|
queryParams: {
|
|
|
page: 1,
|
|
|
- page_size: 10
|
|
|
+ page_size: 10,
|
|
|
},
|
|
|
- catform:{}
|
|
|
+ catform: {},
|
|
|
+ queryBaikeDetailParams: {},
|
|
|
+ baikeStatusList: [
|
|
|
+ { label: "待编辑", value: 0 },
|
|
|
+ { label: "已发布", value: 1 },
|
|
|
+ ],
|
|
|
+ baikeDetailForm: {},
|
|
|
+ isClear: false,
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
- getData() {
|
|
|
- this.$api.getBaikeCategoryList(this.filter).then(res => {
|
|
|
+ getData(data) {
|
|
|
+ this.$api.getBaikeCategoryList().then((res) => {
|
|
|
this.data = res.data.data;
|
|
|
});
|
|
|
- this.$api.getBaikeDetailList().then(res => {
|
|
|
+ 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.show = 1;
|
|
|
- this.form = {
|
|
|
+ this.dialogVisible = true;
|
|
|
+ this.catform = {
|
|
|
parent_id: data.id,
|
|
|
- parent_name: data.name
|
|
|
+ parent_name: data.name,
|
|
|
};
|
|
|
},
|
|
|
edit(data) {
|
|
|
- this.dialogVisible = 1;
|
|
|
- this.$api.getBaikeCategoryDetail({ id: data.id }).then(res => {
|
|
|
+ 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.$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"
|
|
|
+ this.$confirm("确定删除“" + data.name + "”分类?", "提示", {
|
|
|
+ type: "warning",
|
|
|
}).then(() => {
|
|
|
- this.$api.deleteGoverment({ id: data.id }).then(res => {
|
|
|
+ this.$api.delBaikeCategory({ id: data.id }).then((res) => {
|
|
|
+ this.$message({ message: "删除成功!", type: "success" });
|
|
|
+ this.getData();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ delBaikeDetail(data) {
|
|
|
+ this.$confirm("确定删除“" + data.name + "”分类?", "提示", {
|
|
|
+ type: "warning",
|
|
|
+ }).then(() => {
|
|
|
+ this.$api.delBaikeDetail({ id: data.id }).then((res) => {
|
|
|
this.$message({ message: "删除成功!", type: "success" });
|
|
|
this.getData();
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
save() {
|
|
|
- var parm = this.form;
|
|
|
+ var parm = this.catform;
|
|
|
parm.is_active = String(Number(parm.is_active));
|
|
|
|
|
|
if (parm.password != parm.repassword) {
|
|
@@ -268,32 +372,33 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
if (parm.id) {
|
|
|
- this.$api.putGoverment(parm).then(res => {
|
|
|
+ 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
|
|
|
+ is_active: false,
|
|
|
};
|
|
|
} else {
|
|
|
this.$message.error(res.data.message);
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
- this.$api.saveGoverment(parm).then(res => {
|
|
|
+ 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
|
|
|
+ is_active: false,
|
|
|
};
|
|
|
} else {
|
|
|
this.$message.error(res.data.message);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+ this.dialogVisible = false;
|
|
|
},
|
|
|
//下属企业
|
|
|
add() {
|
|
@@ -302,7 +407,7 @@ export default {
|
|
|
if (!parm.enterprise_id) {
|
|
|
this.$message.error("请选择企业");
|
|
|
}
|
|
|
- this.$api.saveSubent(parm).then(res => {
|
|
|
+ this.$api.saveSubent(parm).then((res) => {
|
|
|
if (res.data.code == 0) {
|
|
|
this.$message({ message: "添加成功!", type: "success" });
|
|
|
this.dialogFormVisible = false;
|
|
@@ -314,26 +419,71 @@ export default {
|
|
|
},
|
|
|
del(id) {
|
|
|
this.$confirm("确定删除该企业?", "提示", {
|
|
|
- type: "warning"
|
|
|
+ type: "warning",
|
|
|
}).then(() => {
|
|
|
this.$api
|
|
|
.deleteSubent({ enterprise_id: id, goverment_id: this.form.id })
|
|
|
- .then(res => {
|
|
|
+ .then((res) => {
|
|
|
this.$message({ message: "删除成功!", type: "success" });
|
|
|
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" });
|
|
|
+ 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.baikeDetailForm.category_id =
|
|
|
+ this.queryBaikeDetailParams.category_id;
|
|
|
+ this.dialogFormVisible = true;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.$api.getBaikeDetail({id:row.id}).then((res)=>{
|
|
|
+ this.baikeDetailForm = res.data.data;
|
|
|
+ this.dialogFormVisible = true;
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
gopage(size) {
|
|
|
if (size) {
|
|
|
this.queryParams.page_size = size;
|
|
|
}
|
|
|
this.queryParams.page = this.$refs.pageButton.page;
|
|
|
this.getData();
|
|
|
- }
|
|
|
+ },
|
|
|
},
|
|
|
created() {
|
|
|
this.getData();
|
|
|
- }
|
|
|
+ },
|
|
|
};
|
|
|
</script>
|