Browse Source

企联资料维护功能

shuzhan 3 years ago
parent
commit
07668a09b6

+ 12 - 0
src/routers/modules/base.js

@@ -151,6 +151,18 @@ var routers = [
                         title: '企业双百强'
                 }
         },
+        {
+                path: '/base/enterpriseInfo/list',
+                name: 'BaseEnterpriseInfoList',
+                // route level code-splitting
+                // this generates a separate chunk (about.[hash].js) for this route
+                // which is lazy-loaded when the route is visited.
+                component: () => import('@/views/base/enterpriseInfo-list.vue'),
+                meta: {
+                        roles: ["admin"],
+                        title: '企联资料管理'
+                }
+        },
 ]
 
 export default routers;

+ 96 - 70
src/views/base/enterpriseInfo-detail.vue

@@ -20,96 +20,68 @@
         :rules="ruleValidate"
         :label-width="'100px'"
       >
-        <el-form-item label="" prop="id">
-          <el-input
-            v-model="formModel.id"
-            placeholder="请输入"
-            style="width: 300px"
-          ></el-input>
-        </el-form-item>
         <el-form-item label="企联简介" prop="enterpriseIntroduction">
-          <el-input
+          <mce-editor
+            ref="editorenterpriseIntroduction"
+            uploadName="upfile"
             v-model="formModel.enterpriseIntroduction"
-            placeholder="请输入企联简介"
-            style="width: 300px"
-          ></el-input>
+            :url="uploadUrl"
+            :config="editorConfig"
+          ></mce-editor>
         </el-form-item>
         <el-form-item label="企联章程" prop="enterpriseConstitution">
-          <el-input
+          <mce-editor
+            ref="editorenterpriseConstitution"
+            uploadName="upfile"
             v-model="formModel.enterpriseConstitution"
-            placeholder="请输入企联章程"
-            style="width: 300px"
-          ></el-input>
+            :url="uploadUrl"
+            :config="editorConfig"
+          ></mce-editor>
         </el-form-item>
         <el-form-item label="组织架构" prop="organStructure">
-          <el-input
+          <mce-editor
+            ref="editororganStructure"
+            uploadName="upfile"
             v-model="formModel.organStructure"
-            placeholder="请输入组织架构"
-            style="width: 300px"
-          ></el-input>
+            :url="uploadUrl"
+            :config="editorConfig"
+          ></mce-editor>
         </el-form-item>
         <el-form-item label="基本职能" prop="basicFunction">
-          <el-input
+          <mce-editor
+            ref="editorbasicFunction"
+            uploadName="upfile"
             v-model="formModel.basicFunction"
-            placeholder="请输入基本职能"
-            style="width: 300px"
-          ></el-input>
+            :url="uploadUrl"
+            :config="editorConfig"
+          ></mce-editor>
         </el-form-item>
         <el-form-item label="负责人及分工" prop="chargePerson">
-          <el-input
+          <mce-editor
+            ref="editorchargePerson"
+            uploadName="upfile"
             v-model="formModel.chargePerson"
-            placeholder="请输入负责人及分工"
-            style="width: 300px"
-          ></el-input>
+            :url="uploadUrl"
+            :config="editorConfig"
+          ></mce-editor>
         </el-form-item>
         <el-form-item label="分会简介" prop="branchIntroduction">
-          <el-input
+          <mce-editor
+            ref="editorbranchIntroduction"
+            uploadName="upfile"
             v-model="formModel.branchIntroduction"
-            placeholder="请输入分会简介"
-            style="width: 300px"
-          ></el-input>
+            :url="uploadUrl"
+            :config="editorConfig"
+          ></mce-editor>
         </el-form-item>
         <el-form-item label="联系方式" prop="contactInformation">
-          <el-input
+          <mce-editor
+            ref="editorcontactInformation"
+            uploadName="upfile"
             v-model="formModel.contactInformation"
-            placeholder="请输入联系方式"
-            style="width: 300px"
-          ></el-input>
-        </el-form-item>
-        <el-form-item label="创建人" prop="createBy">
-          <el-input
-            v-model="formModel.createBy"
-            placeholder="请输入创建人"
-            style="width: 300px"
-          ></el-input>
-        </el-form-item>
-        <el-form-item label="创建时间" prop="createTime">
-          <el-input
-            v-model="formModel.createTime"
-            placeholder="请输入创建时间"
-            style="width: 300px"
-          ></el-input>
-        </el-form-item>
-        <el-form-item label="更新人" prop="updateBy">
-          <el-input
-            v-model="formModel.updateBy"
-            placeholder="请输入更新人"
-            style="width: 300px"
-          ></el-input>
-        </el-form-item>
-        <el-form-item label="更新时间" prop="updateTime">
-          <el-input
-            v-model="formModel.updateTime"
-            placeholder="请输入更新时间"
-            style="width: 300px"
-          ></el-input>
-        </el-form-item>
-        <el-form-item label="是否删除" prop="delFlag">
-          <el-input
-            v-model="formModel.delFlag"
-            placeholder="请输入是否删除"
-            style="width: 300px"
-          ></el-input>
+            :url="uploadUrl"
+            :config="editorConfig"
+          ></mce-editor>
         </el-form-item>
       </el-form>
     </div>
@@ -124,9 +96,14 @@
 <script>
 import Constant from "@/constant";
 import enterpriseInfoApi from "@/api/base/enterpriseInfo";
+import MceEditor from "@/components/Tinymce";
+import { getToken } from "@/utils/auth";
 
 export default {
   props: ["businessKey", "title"],
+  components: {
+    "mce-editor": MceEditor,
+  },
   data() {
     return {
       formModel: {},
@@ -172,6 +149,11 @@ export default {
       showDialog: true,
       loading: false,
       submitting: false,
+      editorConfig: {
+        height: 400,
+        width: "90%",
+      },
+      uploadUrl: Constant.serverUrl + "/tinymce/upload?token=" + getToken(),
     };
   },
   methods: {
@@ -186,6 +168,15 @@ export default {
           (function () {
             var id = self.formModel.id;
 
+            self.formModel.contactInformation =
+              self.$refs.editorcontactInformation.getContent();
+            self.formModel.enterpriseIntroduction = self.$refs.editorenterpriseIntroduction.getContent();
+            self.formModel.enterpriseConstitution = self.$refs.editorenterpriseConstitution.getContent();
+            self.formModel.organStructure = self.$refs.editororganStructure.getContent();
+            self.formModel.basicFunction = self.$refs.editorbasicFunction.getContent();
+            self.formModel.chargePerson = self.$refs.editorchargePerson.getContent();
+            self.formModel.branchIntroduction = self.$refs.editorbranchIntroduction.getContent();
+
             if (id == null || id.length == 0) {
               return enterpriseInfoApi.add(self.formModel);
             } else {
@@ -230,6 +221,41 @@ export default {
 
         if (jsonData.result) {
           self.formModel = jsonData.data;
+          if (self.formModel.contactInformation != null) {
+            self.$refs.editorcontactInformation.setContent(
+              self.formModel.contactInformation
+            );
+          }
+          if (self.formModel.enterpriseIntroduction != null) {
+            self.$refs.editorenterpriseIntroduction.setContent(
+              self.formModel.enterpriseIntroduction
+            );
+          }
+          if (self.formModel.enterpriseConstitution != null) {
+            self.$refs.editorenterpriseConstitution.setContent(
+              self.formModel.enterpriseConstitution
+            );
+          }
+          if (self.formModel.organStructure != null) {
+            self.$refs.editororganStructure.setContent(
+              self.formModel.organStructure
+            );
+          }
+          if (self.formModel.basicFunction != null) {
+            self.$refs.editorbasicFunction.setContent(
+              self.formModel.basicFunction
+            );
+          }
+          if (self.formModel.chargePerson != null) {
+            self.$refs.editorchargePerson.setContent(
+              self.formModel.chargePerson
+            );
+          }
+          if (self.formModel.branchIntroduction != null) {
+            self.$refs.editorbranchIntroduction.setContent(
+              self.formModel.branchIntroduction
+            );
+          }
         } else {
           self.$message.error(jsonData.message + "");
         }

+ 125 - 71
src/views/base/enterpriseInfo-list.vue

@@ -6,7 +6,7 @@
         <a href="#">系统管理</a>
       </el-breadcrumb-item>
       <el-breadcrumb-item>
-        <a href="/enterpriseInfo">enterpriseInfo管理</a>
+        <a href="/enterpriseInfo">企联资料管理</a>
       </el-breadcrumb-item>
     </el-breadcrumb>
     <el-divider></el-divider>
@@ -22,91 +22,103 @@
       @sort-change="sortChange"
       @selection-change="handleSelectionChange"
     >
-      <el-table-column
-        prop="enterpriseIntroduction"
-        label="企联简介"
-        width="180"
-      ></el-table-column>
-      <el-table-column
-        prop="enterpriseConstitution"
-        label="企联章程"
-        width="180"
-      ></el-table-column>
-      <el-table-column
-        prop="organStructure"
-        label="组织架构"
-        width="180"
-      ></el-table-column>
-      <el-table-column
-        prop="basicFunction"
-        label="基本职能"
-        width="180"
-      ></el-table-column>
-      <el-table-column
-        prop="chargePerson"
-        label="负责人及分工"
-        width="180"
-      ></el-table-column>
-      <el-table-column
-        prop="branchIntroduction"
-        label="分会简介"
-        width="180"
-      ></el-table-column>
-      <el-table-column
-        prop="contactInformation"
-        label="联系方式"
-        width="180"
-      ></el-table-column>
-      <el-table-column
-        prop="createBy"
-        label="创建人"
-        width="180"
-      ></el-table-column>
-      <el-table-column
-        prop="createTime"
-        label="创建时间"
-        width="180"
-      ></el-table-column>
-      <el-table-column
-        prop="updateBy"
-        label="更新人"
-        width="180"
-      ></el-table-column>
+      <el-table-column prop="test" label="企联资料" width="180">
+        <template> 企业联合会介绍资料 </template>
+      </el-table-column>
       <el-table-column
         prop="updateTime"
-        label="更新时间"
+        label="上次修改 时间"
         width="180"
       ></el-table-column>
       <el-table-column label="操作">
         <template slot-scope="{ row }">
-          <el-button size="mini" type="warning" @click="handleEdit(row)"
-            >编辑</el-button
+          <el-button
+            size="mini"
+            type="warning"
+            @click="handleEdit(row, 'enterpriseIntroduction', '企联简介')"
+            >企联简介</el-button
+          >
+          <el-button
+            size="mini"
+            type="warning"
+            @click="handleEdit(row, 'enterpriseConstitution', '企联章程')"
+            >企联章程</el-button
+          >
+          <el-button
+            size="mini"
+            type="warning"
+            @click="handleEdit(row, 'organStructure', '组织架构')"
+            >组织架构</el-button
+          >
+          <el-button
+            size="mini"
+            type="warning"
+            @click="handleEdit(row, 'basicFunction', '基本职能')"
+            >基本职能</el-button
+          >
+          <el-button
+            size="mini"
+            type="warning"
+            @click="handleEdit(row, 'chargePerson', '负责人及分工')"
+            >负责人及分工</el-button
+          >
+          <el-button
+            size="mini"
+            type="warning"
+            @click="handleEdit(row, 'branchIntroduction', '分会简介')"
+            >分会简介</el-button
+          >
+          <el-button
+            size="mini"
+            type="warning"
+            @click="handleEdit(row, 'contactInformation', '联系方式')"
+            >联系方式</el-button
           >
         </template>
       </el-table-column>
     </el-table>
-    <enterpriseInfo-detail
-      v-if="showModal"
-      :businessKey="businessKey"
-      :title="modalTitle"
-      @close="onDetailModalClose"
-    ></enterpriseInfo-detail>
+    <el-dialog
+      :title="dialogTitle"
+      :visible.sync="batchEdit"
+      :modal-append-to-body="false"
+      style="text-align: left"
+      :close-on-click-modal="false"
+    >
+      <el-form label-width="50px" v-loading="submitLoading">
+        <el-form-item>
+          <mce-editor
+            ref="editor"
+            uploadName="upfile"
+            v-model="editContent"
+            :url="uploadUrl"
+            :config="editorConfig"
+          ></mce-editor>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="handleClose">关 闭</el-button>
+        <el-button type="primary" @click="handleSubmit">确 定</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 <script>
 import Constant from "@/constant";
-import EnterpriseInfoDetail from "./enterpriseInfo-detail";
 import enterpriseInfoApi from "@/api/base/enterpriseInfo";
+import MceEditor from "@/components/Tinymce";
+import { getToken } from "@/utils/auth";
 import NProgress from "nprogress"; // progress bar
 import "nprogress/nprogress.css"; // progress bar style
 
 export default {
+  components: {
+    "mce-editor": MceEditor,
+  },
   data() {
     var self = this;
 
     return {
-      queryModel: {
-      },
+      queryModel: {},
       loading: false,
       tableData: [],
       pageIndex: 1,
@@ -120,6 +132,18 @@ export default {
       showModal: false,
       modalTitle: "",
       businessKey: "",
+      type: "",
+      dialogTitle: "",
+      submitLoading: false,
+      editorConfig: {
+        height: 400,
+        width: "90%",
+      },
+      uploadUrl: Constant.serverUrl + "/tinymce/upload?token=" + getToken(),
+      batchEdit: false,
+      editContent: "",
+      editType: "",
+      formData: [],
     };
   },
   methods: {
@@ -169,11 +193,6 @@ export default {
     handleReset(name) {
       this.$refs[name].resetFields();
     },
-    handleEdit(record) {
-      this.modalTitle = "编辑";
-      this.businessKey = record.id;
-      this.showModal = true;
-    },
     onDetailModalClose(refreshed) {
       //保存成功后回调
       this.showModal = false;
@@ -182,13 +201,48 @@ export default {
         this.changePage(this.pageIndex);
       }
     },
+    handleEdit(record, type, title) {
+      this.dialogTitle = title;
+      this.editContent = record[type];
+      this.editType = type;
+      this.formData = record;
+      if (this.$refs.editor) {
+        this.$refs.editor.setContent(record[type]);
+      }
+      this.batchEdit = true;
+    },
+    handleClose() {
+      var self = this;
+      self.batchEdit = false;
+    },
+    handleSubmit() {
+      var self = this;
+      self.loading = true;
+      self.formData[self.editType] = self.$refs.editor.getContent();
+
+      enterpriseInfoApi.update(self.formData).then(function (response) {
+        var jsonData = response.data;
+        self.loading = false;
+        if (jsonData.result) {
+          self.changePage(self.pageIndex);
+          self.batchEdit = false;
+          self.content = "";
+          self.$message({
+            type: "success",
+            message: "修改成功!",
+          });
+        } else {
+          self.$message({
+            type: "warning",
+            message: jsonData.message,
+          });
+        }
+      });
+    },
   },
   mounted: function () {
     this.changePage(1);
   },
-  components: {
-    "enterpriseInfo-detail": EnterpriseInfoDetail,
-  },
 };
 </script>
 <style lang="scss" scoped>