|
@@ -0,0 +1,339 @@
|
|
|
+<style lang="scss">
|
|
|
+.govern {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ .category {
|
|
|
+ width: 20%;
|
|
|
+ padding: 10px;
|
|
|
+ }
|
|
|
+ li {
|
|
|
+ width: 29%;
|
|
|
+ list-style: none;
|
|
|
+ background: #fff;
|
|
|
+ border: 1px solid #d9d9d9;
|
|
|
+ }
|
|
|
+ .custom-tree-node {
|
|
|
+ width: 100%;
|
|
|
+ .el-tree-node__content {
|
|
|
+ height: 32px;
|
|
|
+ }
|
|
|
+ .label_name {
|
|
|
+ font-size: 14px;
|
|
|
+ }
|
|
|
+ .edit {
|
|
|
+ float: right;
|
|
|
+ i {
|
|
|
+ font-weight: bolder;
|
|
|
+ font-size: 14px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .company {
|
|
|
+ width: 79%;
|
|
|
+ min-height: 80vh;
|
|
|
+ padding: 10px;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|
|
|
+<template>
|
|
|
+ <section>
|
|
|
+ <div class="content">
|
|
|
+ <h4>短线百科</h4>
|
|
|
+ <el-divider></el-divider>
|
|
|
+ <ul class="govern">
|
|
|
+ <li class="category">
|
|
|
+ <!-- <el-form :inline="true" size="small" label-width="100px">
|
|
|
+ <el-form-item label="分类名称">
|
|
|
+ <el-input
|
|
|
+ style="width:62%;margin-left:5px;"
|
|
|
+ @change="getData"
|
|
|
+ v-model="filter.name"
|
|
|
+ placeholder="政府名称"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>-->
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="show=1,form={parent_id:null,is_active:false}"
|
|
|
+ icon="el-icon-circle-plus"
|
|
|
+ size="mini"
|
|
|
+ style="width:100%;margin-bottom:10px;"
|
|
|
+ >新增百科分类</el-button>
|
|
|
+ <el-tree
|
|
|
+ :data="data"
|
|
|
+ default-expand-all
|
|
|
+ node-key="id"
|
|
|
+ :props="props"
|
|
|
+ :expand-on-click-node="false"
|
|
|
+ >
|
|
|
+ <span
|
|
|
+ class="custom-tree-node"
|
|
|
+ slot-scope="{ node, data }"
|
|
|
+ @click.stop="() => edit(data)"
|
|
|
+ >
|
|
|
+ <span class="label_name">{{ node.label }}</span>
|
|
|
+ <span class="edit">
|
|
|
+ <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)">
|
|
|
+ <i class="el-icon-edit"></i>
|
|
|
+ </el-button>
|
|
|
+ <el-button type="text" size="mini" @click.stop="() => remove(data)">
|
|
|
+ <i class="el-icon-delete"></i>
|
|
|
+ </el-button>
|
|
|
+ </span>
|
|
|
+ </span>
|
|
|
+ </el-tree>
|
|
|
+ </li>
|
|
|
+ <li class="company">
|
|
|
+ <h1 v-if="form.id">
|
|
|
+ <el-button @click="dialogFormVisible=true" size="mini" type="primary">添加</el-button>
|
|
|
+ </h1>
|
|
|
+ <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="status" label="状态">
|
|
|
+ <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>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="canme" label="创建人"></el-table-column>
|
|
|
+ <el-table-column prop="ctime" label="创建时间"></el-table-column>
|
|
|
+ <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>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <Page
|
|
|
+ ref="pageButton"
|
|
|
+ :current="form.page"
|
|
|
+ :page_size="form.page_size"
|
|
|
+ :total="total"
|
|
|
+ @pageChange="gopage"
|
|
|
+ />
|
|
|
+ </li>
|
|
|
+ </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>
|
|
|
+ <!-- 添加词条 -->
|
|
|
+ <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-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>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ </section>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import Page from "../../components/Page";
|
|
|
+export default {
|
|
|
+ components: {
|
|
|
+ Page
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ filter: {
|
|
|
+ area: "",
|
|
|
+ name: ""
|
|
|
+ },
|
|
|
+ dialogFormVisible: false,
|
|
|
+ dialogVisible: false,
|
|
|
+ data: [
|
|
|
+ {
|
|
|
+ id: 3,
|
|
|
+ label: "一级 3",
|
|
|
+ children: [
|
|
|
+ {
|
|
|
+ id: 7,
|
|
|
+ label: "二级 3-1"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 8,
|
|
|
+ label: "二级 3-2"
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ form: { parent_id: null, is_active: false },
|
|
|
+ props: {
|
|
|
+ label: "name"
|
|
|
+ },
|
|
|
+ //下属企业
|
|
|
+ enterprise: {
|
|
|
+ enterprise_id: ""
|
|
|
+ },
|
|
|
+ enterpriseList: [],
|
|
|
+ area: [],
|
|
|
+ show: 0,
|
|
|
+ baikeList: [],
|
|
|
+ total: 0,
|
|
|
+ queryParams: {
|
|
|
+ page: 1,
|
|
|
+ page_size: 10
|
|
|
+ },
|
|
|
+ catform:{}
|
|
|
+ };
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getData() {
|
|
|
+ this.$api.getBaikeCategoryList(this.filter).then(res => {
|
|
|
+ this.data = res.data.data;
|
|
|
+ });
|
|
|
+ this.$api.getBaikeDetailList().then(res => {
|
|
|
+ this.baikeList = res.data.data.list;
|
|
|
+ this.total = res.data.data.total;
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ append(data) {
|
|
|
+ this.show = 1;
|
|
|
+ this.form = {
|
|
|
+ parent_id: data.id,
|
|
|
+ parent_name: data.name
|
|
|
+ };
|
|
|
+ },
|
|
|
+ edit(data) {
|
|
|
+ this.dialogVisible = 1;
|
|
|
+ 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.deleteGoverment({ id: data.id }).then(res => {
|
|
|
+ this.$message({ message: "删除成功!", type: "success" });
|
|
|
+ this.getData();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ save() {
|
|
|
+ var parm = this.form;
|
|
|
+ parm.is_active = String(Number(parm.is_active));
|
|
|
+
|
|
|
+ if (parm.password != parm.repassword) {
|
|
|
+ this.$message.error("两次输入的密码不一致,请检查!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (parm.id) {
|
|
|
+ this.$api.putGoverment(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.$api.saveGoverment(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);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //下属企业
|
|
|
+ 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 });
|
|
|
+ } 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 });
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ gopage(size) {
|
|
|
+ if (size) {
|
|
|
+ this.queryParams.page_size = size;
|
|
|
+ }
|
|
|
+ this.queryParams.page = this.$refs.pageButton.page;
|
|
|
+ this.getData();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getData();
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|