Просмотр исходного кода

update src/views/Esm/Esmcompany.vue.

Signed-off-by: 赵蒙蒙 <1595784580@qq.com>
赵蒙蒙 3 лет назад
Родитель
Сommit
32903c7a41
1 измененных файлов с 408 добавлено и 205 удалено
  1. 408 205
      src/views/Esm/Esmcompany.vue

+ 408 - 205
src/views/Esm/Esmcompany.vue

@@ -1,53 +1,152 @@
 <template>
   <div>
-
-    <el-main ref="elMain" style="padding: 0px;">
-      <Split :gutterSize="2" style="height: calc(100vh - 120px);">
-        <!-- 左侧树Start -->
-        <SplitArea :size="leftSplitWidth" :minSize="200">
-          <div class="u-f-ac" style="margin-bottom: 20px;margin-top: 10px;">
-            <!-- 新增产品按钮 -->
-            <kt-button style="background-color: #52C578;border:#52C578;" label="添加分支机构" type="primary"
-              perms="sys:dept:add" @click="handleAddType" />
-
-            <kt-button style="background-color: #FFC000;border:#FFC000;" label="添加" type="primary" perms="sys:dept:add"
-              @click="handleAddCompany" />
-
-            <!-- <kt-button size="small" style="color: #409EFF;" icon="el-icon-circle-plus" label="添加" type="text" perms="sys:user:add" @click="handleAddCompany" /> -->
-          </div>
-          <tree :setting="ztreeSetting" :nodes="ztreeNodes" @onClick="onZTreeClick" @onCreated="onZTreeCreated" />
-        </SplitArea>
-        <!-- 左侧树End -->
-        <!-- 右侧列表页面Start -->
-        <SplitArea :size="rightSplitWidth">
-          <!-- 工具区域Start -->
-          <el-row style="margin: 0px 20px;" v-if="ztreeNodes.length > 0">
-
-          </el-row>
-          <kt-common-table permsEdit="product:product:edit" permsDelete="product:product:delete" :data="pageResult"
-            :columns="columns" editButtonName="编辑" deleteButtonName="删除" :showBatchDelete="true" @findPage="findPage"
-            @handleEdit="handleTableEdit" @handleDeleteFlag="handleTableDeleteFlag"
-            @handleDelete="handleTableBatchDelete">
-          </kt-common-table>
-        </SplitArea>
-      </Split>
-    </el-main>
-
+    <div class="main-container">
+      <div class="page page-product-manage">
+        <div class="com-pro-search">
+          <el-form
+            label-position="left"
+            ref="searchForm"
+            size="medium"
+            :model="searchForm"
+            label-width="90px"
+          >
+            <el-row>
+              <el-col :span="6">
+                <el-form-item label="部门名称:" prop="classname">
+                  <el-input
+                    clearable
+                    v-model="searchForm.classname"
+                    placeholder="请输入部门名称"
+                    style="width: 85%"
+                  ></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="6" style="margin-top: 2px">
+                <el-button
+                  size="medium"
+                  type="primary"
+                  style="background-color: #00bc70; border: 1px solid #00bc70"
+                  @click="searchInfor()"
+                  >搜索</el-button
+                >
+                <el-button
+                  size="medium"
+                  style="background-color: #ffffff; border: 1px solid c6e2ff"
+                  @click="resetfrom()"
+                  >重置</el-button
+                >
+              </el-col>
+            </el-row>
+          </el-form>
+        </div>
+        <div style="margin-bottom: 20px">
+          <el-button
+            size="small"
+            type="primary"
+            plain
+            icon="el-icon-plus"
+            @click="handleAddType()"
+            >新增</el-button
+          >
+          <el-button
+            size="small"
+            type="info"
+            plain
+            icon="el-icon-sort"
+            @click="fold()"
+            >展开折叠</el-button
+          >
+        </div>
+        <el-table
+          :data="ztreeNodes"
+          style="width: 100%"
+          row-key="id"
+          ref="table"
+          border
+          :tree-props="{ children: 'children', hasChildren: 'hasChilkdren' }"
+          :header-cell-style="{
+            background: '#F2F7FC',
+            fontWeight: '900',
+            color: '#606266',
+          }"
+          size="small"
+        >
+          <el-table-column prop="name" label="部门管理"> </el-table-column>
+
+          <el-table-column prop="id" label="编号" width="180">
+          </el-table-column>
+          <el-table-column prop="address" label="状态" width="180">
+            <template slot-scope="scope">
+              <el-button type="primary" plain size="mini">正常</el-button>
+            </template>
+          </el-table-column>
+          <el-table-column prop="createTime" label="创建时间">
+          </el-table-column>
+          <el-table-column label="操作" fixed="right" width="280">
+            <template slot-scope="scope">
+              <el-button
+                type="text"
+                size="mini"
+                icon="el-icon-edit"
+                @click="handleTableEdit(scope.row)"
+                >修改</el-button
+              >
+              <el-button
+                type="text"
+                size="mini"
+                icon="el-icon-plus"
+                @click="handleAddCompany(scope.row)"
+                >新增</el-button
+              >
+              <el-button
+                type="text"
+                size="mini"
+                icon="el-icon-delete"
+                @click="handleTableBatchDelete(scope.row)"
+                >删除</el-button
+              >
+            </template>
+          </el-table-column>
+        </el-table>
+        <div style="height: 30px"></div>
+      </div>
+    </div>
     <!-- 新增或编辑对话框 -->
-    <el-dialog v-dialogDrag :title="dialogTitle" :visible.sync="dialogVisible" width="900px" :before-close="handleClose"
-      @close="closeVisible">
-
-      <el-form :model="dataForm" :rules="dataFormRules" ref="dataForm" label-width="120px" size="small">
-        <el-row v-if="(operType == 'ADD2')">
+    <el-dialog
+      v-dialogDrag
+      :title="dialogTitle"
+      :visible.sync="dialogVisible"
+      width="900px"
+      :before-close="handleClose"
+      @close="closeVisible"
+    >
+      <el-form
+        :model="dataForm"
+        :rules="dataFormRules"
+        ref="dataForm"
+        label-width="120px"
+        size="small"
+      >
+        <el-row v-if="operType == 'ADD2'">
           <el-form-item label="选择公司地区">
-            <el-cascader size="small" v-model="area" :options="areaList" :props="optionProps" @change="areaHandleChange"
-              filterable clearable></el-cascader>
+            <el-cascader
+              size="small"
+              v-model="area"
+              :options="areaList"
+              :props="optionProps"
+              @change="areaHandleChange"
+              filterable
+              clearable
+            ></el-cascader>
           </el-form-item>
         </el-row>
         <el-row>
           <el-col :span="8">
             <el-form-item label="保险公司编码" prop="id">
-              <el-input v-model="dataForm.id" :disabled="!(operType == 'ADD1')"></el-input>
+              <el-input
+                v-model="dataForm.id"
+                :disabled="!(operType == 'ADD1')"
+              ></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="8">
@@ -69,8 +168,12 @@
           </el-col>
           <el-col :span="8">
             <el-form-item label="排序" prop="orderNum">
-              <el-input-number v-model="dataForm.orderNum" placeholder="排序" controls-position="right"
-                :min="0"></el-input-number>
+              <el-input-number
+                v-model="dataForm.orderNum"
+                placeholder="排序"
+                controls-position="right"
+                :min="0"
+              ></el-input-number>
             </el-form-item>
           </el-col>
           <el-col :span="8">
@@ -81,14 +184,29 @@
         </el-row>
         <el-row>
           <el-col :span="24">
-            <el-form-item label="logo:" style="width: 100%;">
-              <el-upload style="width: 150px;width: 150px;" action="#" list-type="picture-card" :auto-upload="false"
-                :on-change="drivingupload1" :file-list="imgList1" ref="upload1" :limit="1">
+            <el-form-item label="logo:" style="width: 100%">
+              <el-upload
+                style="width: 150px; width: 150px"
+                action="#"
+                list-type="picture-card"
+                :auto-upload="false"
+                :on-change="drivingupload1"
+                :file-list="imgList1"
+                ref="upload1"
+                :limit="1"
+              >
                 <i slot="default" class="el-icon-plus"></i>
-                <div slot="file" slot-scope="{file}">
-                  <img class="el-upload-list__item-thumbnail" :src="file.url" alt />
+                <div slot="file" slot-scope="{ file }">
+                  <img
+                    class="el-upload-list__item-thumbnail"
+                    :src="file.url"
+                    alt
+                  />
                   <span class="el-upload-list__item-actions">
-                    <span class="el-upload-list__item-delete" @click="handleRemove1(file)">
+                    <span
+                      class="el-upload-list__item-delete"
+                      @click="handleRemove1(file)"
+                    >
                       <i class="el-icon-delete"></i>
                     </span>
                   </span>
@@ -100,42 +218,47 @@
         <el-row>
           <el-col :span="24">
             <el-form-item label="报价开关">
-              <el-switch v-model="value" @change="companyChange" active-color="#13ce66">
+              <el-switch
+                v-model="value"
+                @change="companyChange"
+                active-color="#13ce66"
+              >
               </el-switch>
             </el-form-item>
           </el-col>
         </el-row>
         <el-row>
           <el-col :span="24">
-            <el-form-item label="备注" style="width: 100%;">
-              <el-input type="textarea" :rows="3" :autosize="{ minRows: 3, maxRows: 4 }" placeholder="请输入内容"
-                v-model="dataForm.remark">
+            <el-form-item label="备注" style="width: 100%">
+              <el-input
+                type="textarea"
+                :rows="3"
+                :autosize="{ minRows: 3, maxRows: 4 }"
+                placeholder="请输入内容"
+                v-model="dataForm.remark"
+              >
               </el-input>
             </el-form-item>
           </el-col>
         </el-row>
       </el-form>
 
-
       <span slot="footer" class="dialog-footer">
         <el-button size="small" @click="dialogVisible = false">取 消</el-button>
-        <el-button size="small" type="primary" @click="submitForm">确 定</el-button>
+        <el-button size="small" type="primary" @click="submitForm"
+          >确 定</el-button
+        >
       </span>
     </el-dialog>
-
-
   </div>
 </template>
 
 <script>
-import KtButton from "@/views/Core/KtButton";//按钮权限组件
+import KtButton from "@/views/Core/KtButton"; //按钮权限组件
 import tree from "@/components/ztree.vue";
-import KtCommonTable from "@/views/Core/KtCommonTable.vue";//表格组件
-import CommonUtil from "@/utils/comutil.js";
-import {
-  pathToBase64,
-  base64ToPath
-} from '@/common/image-tools-base64.js';
+import KtCommonTable from "@/views/Core/KtCommonTable.vue"; //表格组件
+// import CommonUtil from "@/utils/comutil.js";
+import { pathToBase64, base64ToPath } from "@/common/image-tools-base64.js";
 import citydata from "@/assets/js/citydata.js";
 
 // import { format  } from "@/utils/datetime"
@@ -143,7 +266,7 @@ export default {
   components: {
     KtButton,
     tree,
-    KtCommonTable
+    KtCommonTable,
   },
   data() {
     return {
@@ -157,17 +280,17 @@ export default {
       ztreeObj: null,
       ztreeSetting: {
         check: {
-          enable: false
+          enable: false,
         },
         data: {
           simpleData: {
             enable: true,
-            pIdKey: "parentId"
-          }
+            pIdKey: "parentId",
+          },
         },
         view: {
-          showIcon: false
-        }
+          showIcon: false,
+        },
       },
       ztreeNodes: [],
       currentTreeNode: null,
@@ -179,22 +302,28 @@ export default {
         pageNum: 1,
         pageSize: 10,
         totalPages: 1,
-        totalSize: 5
+        totalSize: 5,
       },
-      pageRequest: {  //查询的默认条件
+      pageRequest: {
+        //查询的默认条件
         pageNum: 1,
         pageSize: 10,
         columnFilters: {
-          "parentId": {
-            "name": "parentId",
-            "value": "0"
-          }
-        }
+          parentId: {
+            name: "parentId",
+            value: "0",
+          },
+        },
       },
       columns: [
         { prop: "id", label: "保险公司编码", minWidth: 80, sortable: false },
         { prop: "name", label: "保险公司名称", minWidth: 80, sortable: false },
-        { prop: "namesimple", label: "保险公司简称", minWidth: 80, sortable: false },
+        {
+          prop: "namesimple",
+          label: "保险公司简称",
+          minWidth: 80,
+          sortable: false,
+        },
         { prop: "remark", label: "备注", minWidth: 80, sortable: false },
       ], // 数据列
       // 右侧列表查询数据End
@@ -204,63 +333,102 @@ export default {
       dialogVisible: false, //控制对话框显示
       dataForm: {
         id: "",
-        name: "",//保险公司名称
-        parentId: "0",//上级编码
+        name: "", //保险公司名称
+        parentId: "0", //上级编码
         namesimple: "", //保险公司简称
         remark: "", //备注
         orderNum: 0,
         logo: "",
         openQuote: "",
-        cnName: "",//拼音
+        cnName: "", //拼音
       },
       imgList1: [],
       dataFormRules: {
-        id: [{ required: true, message: '请生成保险公司编码', trigger: 'blur' }, { pattern: /^[0-9a-zA-Z]+$/, message: '编码只可包含字母和数字', trigger: 'blur' }],
-        name: [{ required: true, message: '请输入保险公司名称', trigger: 'blur' }],
-        namesimple: [{ required: true, message: '请输入保险公司简称', trigger: 'blur' }]
+        id: [
+          { required: true, message: "请生成保险公司编码", trigger: "blur" },
+          {
+            pattern: /^[0-9a-zA-Z]+$/,
+            message: "编码只可包含字母和数字",
+            trigger: "blur",
+          },
+        ],
+        name: [
+          { required: true, message: "请输入保险公司名称", trigger: "blur" },
+        ],
+        namesimple: [
+          { required: true, message: "请输入保险公司简称", trigger: "blur" },
+        ],
       },
 
       areaList: citydata.rawCitiesData,
       area: [],
-      optionProps: { //配置节点
+      optionProps: {
+        //配置节点
         checkStrictly: true,
-        value: 'code',
-        label: 'name',
-        children: 'sub'
+        value: "code",
+        label: "name",
+        children: "sub",
       },
-
+      searchForm: {
+        classname: "",
+        status: "",
+      },
+      isshow: false,
     };
   },
   mounted() {
-    //用像素初始化左边的split的宽度
-    this.changeTreeWidth(240);// 初始化树的宽度
     this.findLeftTreeData();
+    //用像素初始化左边的split的宽度
+    // this.changeTreeWidth(240); // 初始化树的宽度
   },
   methods: {
+    handleNodeClick() {},
+    // 搜索
+    searchInfor() {
+      this.findLeftTreeData();
+    },
+    // 遍历表格数据
+    forTableData(arr, isExpand) {
+      arr.forEach((i) => {
+        this.$refs.table.toggleRowExpansion(i, isExpand);
+        if (i.children) {
+          this.forTableData(i.children, isExpand);
+        }
+      });
+    },
+    //展开收起树列表
+    fold() {
+      this.isshow = !this.isshow;
+      this.forTableData(this.ztreeNodes, this.isshow);
+    },
+    resetfrom() {
+      this.$refs.searchForm.resetFields();
+      this.findLeftTreeData();
+    },
     companyChange(e) {
       if (e) {
-        this.dataForm.openQuote = 1
+        this.dataForm.openQuote = 1;
       } else {
-        this.dataForm.openQuote = 0
-
+        this.dataForm.openQuote = 0;
       }
     },
     //删除图片
     handleRemove1(file) {
-      console.log(file)
+      console.log(file);
       this.imgList1.map((ele, index) => {
         if (ele.uid === file.uid) {
-          this.imgList1.splice(index, 1)
+          this.imgList1.splice(index, 1);
         }
         return ele;
-      })
-
+      });
     },
     /**Split 开始 */
     changeTreeWidth(widthVal) {
       // 初始化树的宽度
-      this.leftSplitWidth = Math.ceil(widthVal / this.$refs.elMain.$el.clientWidth * 100);
-      this.rightSplitWidth = 100 - (this.leftSplitWidth)
+      this.leftSplitWidth = Math.ceil(
+        (widthVal / this.$refs.elMain.$el.clientWidth) * 100
+      );
+      this.rightSplitWidth = 100 - this.leftSplitWidth;
     },
     /**Split 结束 */
 
@@ -268,8 +436,10 @@ export default {
     // 获取树数据
     findLeftTreeData: function () {
       var that = this;
-      this.$api.insCompany.findLeftInsTree().then(res => {
-        this.ztreeNodes = res.data;
+      const params = new URLSearchParams();
+      params.append("name", that.searchForm.classname);
+      that.$api.insCompany.findLeftInsTree(params).then((res) => {
+        that.ztreeNodes = res.data;
       });
     },
     onZTreeClick: function (evt, treeId, treeNode) {
@@ -283,17 +453,16 @@ export default {
       // onCreated 中操作ztreeObj对象展开第一个节点
       ztreeObj.expandNode(ztreeObj.getNodes()[0], true);
       this.currentTreeNode = ztreeObj.getNodes()[0];
-      this.findPage()
+      this.findPage();
     },
     //-- tree end-------
     //影像上传方法
     drivingupload1(file) {
       this.imgList1 = [];
-      pathToBase64(file.url)
-        .then(path => {
-          this.dataForm.logo = path;
-          this.imgList1.push({ url: path })
-        })
+      pathToBase64(file.url).then((path) => {
+        this.dataForm.logo = path;
+        this.imgList1.push({ url: path });
+      });
     },
     // 右侧列表的方法Start
     findPage(data) {
@@ -301,16 +470,20 @@ export default {
         this.pageRequest.pageNum = data.pageRequest.pageNum;
         this.pageRequest.pageSize = data.pageRequest.pageSize;
       }
-      this.$api.insCompany.findPage(this.pageRequest).then((res) => {
-        this.pageResult = res.data;
-      }).then(data != null ? data.callback : '')
+      this.$api.insCompany
+        .findPage(this.pageRequest)
+        .then((res) => {
+          this.pageResult = res.data;
+        })
+        .then(data != null ? data.callback : "");
     },
     // 右侧列表的方法End
     areaHandleChange(value) {
-      if (value != '') {
-        this.dataForm.id = this.currentTreeNode.id.substring(0, 6) + value[(value.length - 1)];
+      if (value != "") {
+        this.dataForm.id =
+          this.currentTreeNode.id.substring(0, 6) + value[value.length - 1];
       } else {
-        this.dataForm.id = '';
+        this.dataForm.id = "";
       }
     },
     handleAddType() {
@@ -318,18 +491,17 @@ export default {
       this.operType = "ADD1";
       this.dialogTitle = "新增保险总公司";
       this.dataForm.parentId = "0";
-
       this.dialogVisible = true;
     },
-    handleAddCompany() {
+    handleAddCompany(row) {
+      console.log(row);
       this.operType = "ADD2";
       this.dialogTitle = "新增保险分公司";
-      this.dataForm.parentId = this.currentTreeNode.id;
-      this.dataForm.logo = this.currentTreeNode.logo;
+      this.dataForm.parentId = row.id;
+      this.dataForm.logo = row.logo;
       this.dialogVisible = true;
     },
-    handleTableEdit({ index, row }) {
-      console.log(row)
+    handleTableEdit(row) {
       this.operType = "EDIT";
       this.dialogTitle = "编辑保险公司信息";
       this.dataForm.id = row.id;
@@ -339,13 +511,9 @@ export default {
       this.dataForm.remark = row.remark;
       this.dataForm.orderNum = row.orderNum;
       this.dataForm.cnName = row.cnName;
-      if (row.logo) {
-        this.imgList1 = [];
-        this.imgList1.push({ url: row.logo })
-      } else {
-        this.imgList1 = [];
-      }
-      if (row.openQuote == '1') {
+      this.imgList1 = [];
+      this.imgList1.push({ url: row.logo });
+      if (row.openQuote == "1") {
         this.value = true;
       } else {
         this.value = false;
@@ -353,42 +521,86 @@ export default {
       this.dialogVisible = true;
     },
     handleTableDeleteFlag(data) {
-      this.$api.insCompany.companyTree(data.params[0].id).then(res => {
+      console.log(111, data);
+      this.$api.insCompany.companyTree(data.params[0].id).then((res) => {
         if (res.data.length > 0) {
-          this.$message({ message: '该公司下存在分公司,请先删除分公司', type: 'info' })
+          this.$message({
+            message: "该公司下存在分公司,请先删除分公司",
+            type: "info",
+          });
         } else {
           let params = [];
           params.push(data.params[0].id);
-          this.$api.insCompany.deleteCompany(params).then(data != null ? data.callback : '')
+          this.$api.insCompany
+            .deleteCompany(params)
+            .then(data != null ? data.callback : "");
         }
       });
     },
     handleTableBatchDelete(data) {
+      console.log(data.children.length);
       let params = [];
       let isFalg = true;
-      for (let i = 0; i < data.params.length; i++) {
-        this.$api.insCompany.companyTree(data.params[i].id).then(res => {
+      for (let i = 0; i < data.children.length; i++) {
+        this.$api.insCompany.companyTree(data.children[i].id).then((res) => {
+          console.log(res);
           if (res.data.length > 0) {
             isFalg = false;
             this.$message({
-              message: '公司(' + res.data[0].id + '-' + res.data[0].name + ')下存在分公司,请先删除分公司',
-              type: 'info'
-            })
+              message:
+                "公司(" +
+                res.data[0].id +
+                "-" +
+                res.data[0].name +
+                ")下存在分公司,请先删除分公司",
+              type: "info",
+            });
           } else {
-            params.push(data.params[i].id);
+            params.push(data.children[i].id);
           }
-          if ((i == (data.params.length - 1)) && isFalg) {
-            this.$api.insCompany.deleteCompany(params).then(data != null ? data.callback : '')
+          if (i == data.children.length - 1 && isFalg) {
+            this.$api.insCompany
+              .deleteCompany(params)
+              .then(data != null ? data.callback : "");
           }
         });
       }
+      //原来删除功能代码
+      // let params = [];
+      // let isFalg = true;
+      // for (let i = 0; i < data.params.length; i++) {
+      //   this.$api.insCompany.companyTree(data.params[i].id).then((res) => {
+      //     console.log(res, "====");
+      //     if (res.data.length > 0) {
+      //       isFalg = false;
+      //       this.$message({
+      //         message:
+      //           "公司(" +
+      //           res.data[0].id +
+      //           "-" +
+      //           res.data[0].name +
+      //           ")下存在分公司,请先删除分公司",
+      //         type: "info",
+      //       });
+      //     } else {
+      //       params.push(data.params[i].id);
+      //     }
+      //     if (i == data.params.length - 1 && isFalg) {
+      //       this.$api.insCompany
+      //         .deleteCompany(params)
+      //         .then(data != null ? data.callback : "");
+      //     }
+      //   });
+      // }
     },
 
-
     submitForm() {
-      if (this.operType == 'ADD1') {
+      if (this.operType == "ADD1") {
         if (this.dataForm.id.length != 6) {
-          return this.$message({ message: '保险总公司的编码为6位', type: 'info' })
+          return this.$message({
+            message: "保险总公司的编码为6位",
+            type: "info",
+          });
         } else {
           this.dataForm.id = this.dataForm.id.toUpperCase();
         }
@@ -396,57 +608,61 @@ export default {
       this.$refs.dataForm.validate((valid) => {
         this.$api.insCompany.editCompany(this.dataForm).then((res) => {
           if (res.code == 200) {
-            this.$message({ message: '操作成功', type: 'success' })
+            this.$message({ message: "操作成功", type: "success" });
+            this.findLeftTreeData();
             this.dialogVisible = false;
           }
-        })
-        // if (valid) {
-        //   this.$confirm('确认提交吗?', '提示', {}).then(() => {
-        //     let params = {};
-        //     Object.assign(params, this.dataForm);
-        //     if (this.operType.indexOf('ADD') >= 0) {
-        //       this.$api.insCompany.addCompany(params).then((res) => {
-        //         if (res.code == 200) {
-        //           this.$message({ message: '操作成功', type: 'success' })
-        //           this.dialogVisible = false;
-        //           this.findPage();
-        //         } else {
-        //           this.$message({ message: '操作失败', type: 'error' })
-        //         }
-        //       })
-        //     } else {
-        //       this.$api.insCompany.editCompany(params).then((res) => {
-        //         if (res.code == 200) {
-        //           this.$message({ message: '操作成功', type: 'success' })
-        //           this.dialogVisible = false;
-        //           this.findPage();
-        //         } else {
-        //           this.$message({ message: '操作失败', type: 'error' })
-        //         }
-        //       }).catch(() => {
-        //         this.$message({ message: '操作失败', type: 'error' })
-        //       });
-        //     }
-        //     this.findLeftTreeData();
-        //   }).catch(() => {
-        //     this.$message({ type: 'info', message: '已取消提交' });
-        //   });
-        // }
-      })
-
+        });
+        if (valid) {
+          this.$confirm("确认提交吗?", "提示", {})
+            .then(() => {
+              let params = {};
+              Object.assign(params, this.dataForm);
+              if (this.operType.indexOf("ADD") >= 0) {
+                this.$api.insCompany.addCompany(params).then((res) => {
+                  if (res.code == 200) {
+                    this.$message({ message: "操作成功", type: "success" });
+                    this.dialogVisible = false;
+                    this.findPage();
+                  } else {
+                    this.$message({ message: "操作失败", type: "error" });
+                  }
+                });
+              } else {
+                this.$api.insCompany
+                  .editCompany(params)
+                  .then((res) => {
+                    if (res.code == 200) {
+                      this.$message({ message: "操作成功", type: "success" });
+                      this.dialogVisible = false;
+                      this.findPage();
+                    } else {
+                      this.$message({ message: "操作失败", type: "error" });
+                    }
+                  })
+                  .catch(() => {
+                    this.$message({ message: "操作失败", type: "error" });
+                  });
+              }
+              this.findLeftTreeData();
+            })
+            .catch(() => {
+              this.$message({ type: "info", message: "已取消提交" });
+            });
+        }
+      });
     },
 
     // 关闭新增对话框
     handleClose(done) {
-      this.$confirm('确认关闭?')
-        .then(_ => {
+      this.$confirm("确认关闭?")
+        .then((_) => {
           done();
-
         })
-        .catch(_ => { });
+        .catch((_) => {});
     },
     closeVisible() {
-      this.area = '';
+      this.area = "";
       this.$refs.dataForm.resetFields();
       for (let key in this.dataForm) {
         this.dataForm[key] = "";
@@ -454,13 +670,13 @@ export default {
     },
     // 上传图片的方法Start
     beforeAvatarUpload(file) {
-      const isJPG = (file.type === 'image/jpeg' || file.type === 'image/png');
+      const isJPG = file.type === "image/jpeg" || file.type === "image/png";
       const isLt2M = file.size / 1024 / 1024 < 2;
       if (!isJPG) {
-        this.$message.error('上传logo图片只能是 JPG 或者 PNG 格式!');
+        this.$message.error("上传logo图片只能是 JPG 或者 PNG 格式!");
       }
       if (!isLt2M) {
-        this.$message.error('上传logo图片大小不能超过 2MB!');
+        this.$message.error("上传logo图片大小不能超过 2MB!");
       }
       return isJPG && isLt2M;
     },
@@ -469,20 +685,19 @@ export default {
       let filename = options.filename;
       let reader = new FileReader();
       if (file) {
-        reader.readAsDataURL(file)
+        reader.readAsDataURL(file);
       }
       reader.onload = () => {
         let base64Str = reader.result;
         this.dataForm.logo = base64Str;
-      }
-    }
+      };
+    },
     // 上传图片的方法End
-
-  }
-}
+  },
+};
 </script>
 
-<style  scoped>
+<style>
 .avatar-uploader .el-upload {
   border: 1px dashed #d9d9d9;
   border-radius: 6px;
@@ -492,7 +707,7 @@ export default {
 }
 
 .avatar-uploader .el-upload:hover {
-  border-color: #409EFF;
+  border-color: #409eff;
 }
 
 .avatar-uploader-icon {
@@ -509,16 +724,4 @@ export default {
   height: 100px;
   display: block;
 }
-
-
-
-/deep/.el-upload-list__item {
-
-  transition: none;
-
-}
-
-.avatar-uploader /deep/ .el-upload-list__item {
-  transition: none !important;
-}
 </style>