From d4097a5b509928987201d574f59e364c8b8006d8 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Mon, 27 Dec 2021 18:06:19 +0800
Subject: [PATCH] 许可信息修改

---
 src/views/securityUnitChild/index.vue |  440 ++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 277 insertions(+), 163 deletions(-)

diff --git a/src/views/securityUnitChild/index.vue b/src/views/securityUnitChild/index.vue
index d1f1138..2987fe1 100644
--- a/src/views/securityUnitChild/index.vue
+++ b/src/views/securityUnitChild/index.vue
@@ -44,7 +44,11 @@
       </el-tab-pane>
       <!-- 主要管理人信息 -->
       <el-tab-pane :label="managerLabel" name="tab3">
-        <manager v-if="overmanager" :deptid="departmentid" :stats="stats"></manager>
+        <manager
+          v-if="overmanager"
+          :deptid="departmentid"
+          :stats="stats"
+        ></manager>
       </el-tab-pane>
       <!-- 装备管理列表 -->
       <el-tab-pane label="装备管理" name="tab4" v-if="equipmentVisiable">
@@ -77,7 +81,24 @@
       </el-tab-pane>
       <!-- 许可证  -->
       <el-tab-pane :label="licenceLabel" name="tab8" v-if="licenceVisiable">
-        <licence :row="objBase" v-if="overHtp"></licence>
+        <!-- <licence :row="objBase" v-if="overHtp"></licence> -->
+        <basic-container>
+          <avue-form
+            v-if="businessVisiable"
+            ref="lincenceForm"
+            v-model="licenceObj"
+            :option="licenceOption"
+            @submit="licenceSubmit"
+          ></avue-form>
+          <avue-form
+            v-if="!businessVisiable"
+            ref="licenceGroupForm"
+            v-model="licenceGroupObj"
+            :option="licenceGroupOption"
+            @submit="licenceGroupSubmit"
+          >
+          </avue-form>
+        </basic-container>
       </el-tab-pane>
       <!-- 备案证  -->
       <el-tab-pane label="备案证" name="tab12" v-if="certificdinedVisiable">
@@ -88,8 +109,24 @@
 </template> 
 
 <script>
-import { column11, column } from "./data";
-import { getOncedata, update,getBusinessInfo,submit } from "@/api/securityUnit/securityUnit";
+import {
+  column11,
+  column,
+  lincenceColumn,
+  businessColumn,
+  lincenceGroupColumn,
+  lincenceGroupColumns
+} from "./data";
+import {
+  getOncedata,
+  update,
+  getBusinessInfo,
+  submit,
+  getLicenceDetail,
+  licenceSubmit,
+  getLicenceInfos,
+  submitGroup
+} from "@/api/securityUnit/securityUnit";
 import manager from "./manager.vue";
 import shareholder from "./shareholder.vue";
 import equipments from "../securityEquipment/equipments.vue";
@@ -116,7 +153,7 @@
     return {
       tab2label: "出资人信息",
       managerLabel: "主要管理人信息",
-      licenceLabel: "许可证",
+      licenceLabel: "许可证信息",
       baseTitle: "基本信息",
       visible: false,
       certificdinedVisiable: false,
@@ -135,7 +172,8 @@
       social: false,
       overHtp: false,
       activeName: "tab1",
-      stats:"",
+      stats: "",
+      deptId: "",
       departmentid: "",
       //全局单位统一社会信用代码
       creditcode: "",
@@ -144,152 +182,44 @@
         // title: "我是头部标题",
       },
       formData: {},
-      businessObj:{},
+      businessObj: {},
       businessOption: {
         height: "auto",
         // calcHeight: 80,
         emptyBtn: false,
         // submitBtn:false,
-        submitText:"保存",
+        submitText: "保存",
+        group: businessColumn,
+      },
+      licenceGroupObj: {},
+      licenceGroupOption: {
+        height: "auto",
+        emptyBtn: false,
+        submitText: "保存",
         group: [
           {
-            label: "总公司工商信息",
+            label: "总公司许可证信息",
             labelWidth: "110",
             prop: "baseInfo",
             icon: "el-icon-user-solid",
-            column: [
-              {
-                label: "统一社会信用代码",
-                prop: "socialCreditCode",
-                span: 12,
-                labelWidth: 130,
-                disabled: false,
-              },
-              {
-                label: "注册时间",
-                prop: "registerTime",
-                span: 12,
-                labelWidth: 130,
-                disabled: false,
-                type: "date",
-                format: "yyyy-MM-dd",
-                valueFormat: "yyyy-MM-dd",
-                rules: [
-                  {
-                    required: true,
-                    message: "请选择注册时间",
-                    trigger: "blur",
-                  },
-                ],
-              },
-              {
-                label: "注册资本",
-                prop: "capital",
-                span: 12,
-                labelWidth: 130,
-                disabled: false,
-              },
-              {
-                label: "经营范围",
-                prop: "businessScope",
-                span: 12,
-                labelWidth: 130,
-                width: 110,
-                // overHidden: true,
-                // type: 'textarea',
-                showWordLimit: true,
-                disabled: false,
-              },
-              {
-                label: "营业执照",
-                prop: "trading",
-                type: "upload",
-                listType: "picture-img",
-                span: 12,
-                propsHttp: {
-                  res: "data",
-                },
-                canvasOption: {
-                  text: "",
-                  ratio: 1.0,
-                },
-                labelWidth: 130,
-                tip: "只能上传jpg/png格式图片,且不超过2Mb",
-                action: "/api/blade-resource/oss/endpoint/put-files",
-                disabled: false,
-              },
-            ],
+            column: lincenceGroupColumn,
           },
           {
-            label: "分公司工商信息",
+            label: "分公司许可证信息",
             prop: "detailInfo",
             labelWidth: "110",
             icon: "el-icon-s-order",
-            column: [
-              {
-                label: "统一社会信用代码",
-                prop: "creditcode",
-                span: 12,
-                labelWidth: 130,
-                disabled: false,
-              },
-              {
-                label: "注册时间",
-                prop: "establishtime",
-                span: 12,
-                labelWidth: 130,
-                disabled: false,
-                type: "date",
-                format: "yyyy-MM-dd",
-                valueFormat: "yyyy-MM-dd",
-                rules: [
-                  {
-                    required: true,
-                    message: "请选择注册时间",
-                    trigger: "blur",
-                  },
-                ],
-              },
-
-              {
-                label: "注册资本",
-                prop: "registeredcapital",
-                span: 12,
-                labelWidth: 130,
-                disabled: false,
-              },
-              {
-                label: "经营范围",
-                prop: "business",
-                span: 12,
-                labelWidth: 130,
-                width: 110,
-                // overHidden: true,
-                // type: 'textarea',
-                showWordLimit: true,
-                disabled: false,
-              },
-              {
-                label: "营业执照",
-                prop: "businessLicense",
-                type: "upload",
-                listType: "picture-img",
-                span: 12,
-                propsHttp: {
-                  res: "data",
-                },
-                canvasOption: {
-                  text: "",
-                  ratio: 1.0,
-                },
-                labelWidth: 130,
-                tip: "只能上传jpg/png格式图片,且不超过2Mb",
-                action: "/api/blade-resource/oss/endpoint/put-files",
-                disabled: false,
-              },
-            ],
+            column: lincenceGroupColumns,
           },
         ],
+      },
+      licenceObj: {},
+      licenceOption: {
+        emptyBtn: false,
+        // submitBtn: false,
+        submitText: "保存",
+        gutter: 30,
+        column: lincenceColumn,
       },
       optionBase: {
         emptyBtn: false,
@@ -315,9 +245,8 @@
   },
   methods: {
     //分公司工商信息修改
-    businessSubmit(row, done, loading){
+    businessSubmit(row, done, loading) {
       var that = this;
-      console.log(row,11111);
       if (
         this.userInfo.role_name == "保安公司管理员" ||
         this.userInfo.role_name == "培训公司管理员" ||
@@ -325,26 +254,84 @@
       ) {
         //分公司
         var f = {
-          departmentid:this.userInfo.dept_id,
-          id:this.formData.id,
-          businessLicense:row.businessLicense,
-          establishtime:row.establishtime,
-          creditcode:row.creditcode,
-          registeredcapital:row.registeredcapital,
-          business:row.business,
-        }
+          departmentid: this.userInfo.dept_id,
+          id: this.formData.id,
+          businessLicense: row.businessLicense,
+          establishtime: row.establishtime,
+          creditcode: row.creditcode,
+          registeredcapital: row.registeredcapital,
+          business: row.business,
+        };
         //总公司
         var z = {
-          id:row.id,
-          deptId:this.userInfo.dept_id,
-          registerTime:row.registerTime,
-          socialCreditCode:row.socialCreditCode,
-          capital:row.capital,
-          businessScope:row.businessScope,
-          trading:row.trading,
-        }
+          id: row.id,
+          deptId: this.userInfo.dept_id,
+          registerTime: row.registerTime,
+          socialCreditCode: row.socialCreditCode,
+          capital: row.capital,
+          businessScope: row.businessScope,
+          trading: row.trading,
+        };
       }
-      
+
+      //分公司工商信息修改
+      update(f).then(
+        () => {
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          });
+          done();
+        },
+        (error) => {
+          window.console.log(error);
+          loading();
+        }
+      );
+      //总公司工商信息修改
+      submit(z).then(
+        (res) => {
+          that.businessObj = row;
+          that.businessObj.id = res.data.data.id;
+          done();
+        },
+        (error) => {
+          window.console.log(error);
+          loading();
+        }
+      );
+      done();
+    },
+    //分公司许可证信息修改
+    licenceSubmit(row, done, loading) {
+      var that = this;
+      if (
+        this.userInfo.role_name == "保安公司管理员" ||
+        this.userInfo.role_name == "培训公司管理员" ||
+        this.userInfo.role_name == "分公司管理员"
+      ) {
+        //分公司
+        var f = {
+          departmentid: this.userInfo.dept_id,
+          id: this.formData.id,
+          businessLicense: row.businessLicense,
+          establishtime: row.establishtime,
+          creditcode: row.creditcode,
+          registeredcapital: row.registeredcapital,
+          business: row.business,
+        };
+        //总公司
+        var z = {
+          id: row.id,
+          deptId: this.userInfo.dept_id,
+          registerTime: row.registerTime,
+          socialCreditCode: row.socialCreditCode,
+          capital: row.capital,
+          businessScope: row.businessScope,
+          trading: row.trading,
+        };
+      }
+
       //分公司工商信息修改
       update(f).then(
         () => {
@@ -399,7 +386,42 @@
           loading();
         }
       );
+      done();
+    },
+    //分公司许可信息修改
+    licenceGroupSubmit(row, done, loading) {
+      var that = this;
+      if (
+        this.userInfo.role_name == "保安公司管理员" ||
+        this.userInfo.role_name == "培训公司管理员" ||
+        this.userInfo.role_name == "分公司管理员"
+      ) {
+        row["deptId"] = this.userInfo.dept_id;
+        row["id"] = that.licenceGroupObj.id;
+        row["sid"] = that.licenceGroupObj.sid;
+      }
+      row["type"] = 1;
 
+      if (row.id) {
+        row["updateUser"] = this.userInfo.Id;
+      } else {
+        row["createUser"] = this.userInfo.Id;
+      }
+      // console.log(row);
+      submitGroup(row).then(
+        () => {
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          });
+          that.getLicenceInfo();
+          done();
+        },
+        (error) => {
+          window.console.log(error);
+          loading();
+        }
+      );
       done();
     },
     //从 localStorage 获取数据
@@ -421,6 +443,9 @@
         this.overmanager = true;
       } else if (tab.name == "tab9") {
         this.social = true;
+      } else if (tab.name == "tab8") {
+        //获取许可证信息
+        this.getLicenceInfo();
       } else {
         this.social = false;
         this.overcar = false;
@@ -428,6 +453,68 @@
         this.overcar = false;
         this.overmanager = false;
         this.overshareholder = false;
+      }
+    },
+    //获取许可证信息
+    getLicenceInfo() {
+      var that = this;
+      if (this.stats == "1") {
+        //培训学校
+        const contentcolumn = this.findObject(
+          this.licenceOption.column,
+          "content"
+        );
+        const registerCapitalcolumn = this.findObject(
+          this.licenceOption.column,
+          "registerCapital"
+        );
+        const urlcolumn = this.findObject(this.licenceOption.column, "url");
+        const codecolumn = this.findObject(this.licenceOption.column, "code");
+        //表单控制
+        contentcolumn.label = "培训内容";
+        contentcolumn.rules = [
+          {
+            required: true,
+            message: "请输入培训内容",
+            trigger: "blur",
+          },
+        ];
+        urlcolumn.label = "培训许可证图片";
+        urlcolumn.rules = [
+          {
+            required: true,
+            message: "请上传培训许可证图片",
+            trigger: "blur",
+          },
+        ];
+        codecolumn.label = "培训许可证编号";
+        codecolumn.rules = [
+          {
+            required: true,
+            message: "请上传培训许可证编号",
+            trigger: "blur",
+          },
+        ];
+        registerCapitalcolumn.display = false;
+        //获取许可证信息
+        getLicenceDetail(this.deptId).then((res) => {
+          that.licenceObj = res.data.data;
+        });
+      } else if (this.stats == "4") {
+        //分公司,获取分公司及总公司的许可证信息
+        getLicenceInfos(this.deptId).then((res)=>{
+          that.licenceGroupObj = res.data.data;
+        })
+      } else {
+        if(this.userInfo.role_name=="保安公司管理员" ||
+        this.userInfo.role_name=="分公司管理员" ||
+        this.userInfo.role_name=="培训公司管理员"){
+          //其他单位
+          getLicenceDetail(this.deptId).then((res) => {
+            that.licenceObj = res.data.data;
+          });
+        }
+        
       }
     },
     //tag 防重复处理
@@ -462,7 +549,11 @@
           var f = that.businessOption.group;
           var g = f[0].column;
           var h = f[1].column;
-          console.log(g,33333);
+          var aa = that.licenceGroupOption.group;
+          var a1 = aa[0].column;
+          var a2 = aa[1].column;
+          var bb = that.licenceOption.column;
+          // console.log(g, 33333);
           //控制按钮,编辑状态
           if (
             roleAlias == "保安公司管理员" ||
@@ -472,6 +563,8 @@
             that.optionBase.submitBtn = true;
             that.businessOption.submitBtn = true;
             that.option01.submitBtn = true;
+            that.licenceGroupOption.submitBtn = true;
+            that.licenceOption.submitBtn = true;
             for (var k in d) {
               d[k].disabled = false;
             }
@@ -484,10 +577,21 @@
             for (var m in h) {
               h[m].disabled = false;
             }
+            for (var m in a1) {
+              a1[m].disabled = false;
+            }
+            for (var m in a2) {
+              a2[m].disabled = false;
+            }
+            for (var m in bb) {
+              bb[m].disabled = false;
+            }
           } else {
             that.optionBase.submitBtn = false;
             that.option01.submitBtn = false;
             that.businessOption.submitBtn = false;
+            that.licenceGroupOption.submitBtn = false;
+            that.licenceOption.submitBtn = false;
             for (var a in d) {
               d[a].disabled = true;
             }
@@ -499,6 +603,15 @@
             }
             for (var z in h) {
               h[z].disabled = true;
+            }
+            for (var z in a1) {
+              a1[z].disabled = true;
+            }
+            for (var z in a2) {
+              a2[z].disabled = true;
+            }
+            for (var z in bb) {
+              bb[z].disabled = true;
             }
           }
         });
@@ -585,7 +698,7 @@
         var stats = data.stats;
         var deptId = data.departmentid;
         //初始tab控制
-        this.initController(stats,deptId);
+        this.initController(stats, deptId);
         //初始数据获取
         this.getdatas(data);
       } else {
@@ -598,15 +711,16 @@
           var stats = res.data.data.stats;
           var deptId = res.data.data.departmentid;
           //初始tab控制
-          this.initController(stats,deptId);
+          this.initController(stats, deptId);
           //初始数据获取
           this.getdatas(res.data.data);
         });
       }
     },
     //tab 初始设置
-    initController(stats,deptId) {
+    initController(stats, deptId) {
       this.stats = stats;
+      this.deptId = deptId;
       var that = this;
       // 判断按进入的公司类型
       if (stats == "2") {
@@ -628,19 +742,19 @@
         that.certificdinedVisiable = true;
         that.businessVisiable = false;
         //查询分公司(及总公司)工商信息
-        getBusinessInfo(deptId).then((res)=>{
+        getBusinessInfo(deptId).then((res) => {
           that.businessObj = res.data.data;
-          if(that.businessObj.id==-1){
-            that.businessObj.id=null;
+          if (that.businessObj.id == -1) {
+            that.businessObj.id = null;
           }
           // console.log(that.businessObj,1234546);
-        })
+        });
       }
       if (stats == "1") {
         //培训学校
         that.baseTitle = "学校基本信息";
         that.managerLabel = "师资力量";
-        that.licenceLabel = "培训许可证";
+        that.licenceLabel = "培训许可证信息";
         that.carVisiable = false;
         that.shareholderVisiable = false;
       }

--
Gitblit v1.9.3