浏览代码

更新修改

lex 2 年之前
父节点
当前提交
120e1dc6fc
共有 2 个文件被更改,包括 131 次插入91 次删除
  1. 45 42
      src/views/organManager/components/organInfo.vue
  2. 86 49
      src/views/tenantSetting/tenantInfo.vue

+ 45 - 42
src/views/organManager/components/organInfo.vue

@@ -23,8 +23,8 @@
             {
               required: true,
               message: '请上传机构LOGO',
-              trigger: 'blur, change',
-            },
+              trigger: 'blur, change'
+            }
           ]"
         >
           <div style="width: 300px !important">
@@ -76,8 +76,8 @@
             {
               required: true,
               message: '请上企业公章',
-              trigger: 'blur, change',
-            },
+              trigger: 'blur, change'
+            }
           ]"
         >
           <div style="width: 300px !important" class="ant-upload-preview">
@@ -109,7 +109,7 @@
                 autoCropHeight: 300, //默认生成截图框高度
                 fixedBox: true, //是否固定截图框大小 不允许改变
                 previewsCircle: false, //预览图是否是圆形
-                title: '上传企业公章', //模态框上显示的标题
+                title: '上传企业公章' //模态框上显示的标题
               }"
               :disabled="isDisabled"
               :imgSize="5"
@@ -135,8 +135,8 @@
             {
               required: true,
               message: '请上传企业财务公章',
-              trigger: 'blur, change',
-            },
+              trigger: 'blur, change'
+            }
           ]"
         >
           <div style="width: 300px !important" class="ant-upload-preview">
@@ -168,7 +168,7 @@
                 autoCropHeight: 300, //默认生成截图框高度
                 fixedBox: true, //是否固定截图框大小 不允许改变
                 previewsCircle: false, //预览图是否是圆形
-                title: '上传企业财务公章', //模态框上显示的标题
+                title: '上传企业财务公章' //模态框上显示的标题
               }"
               :disabled="isDisabled"
               :imgSize="5"
@@ -202,7 +202,7 @@
           v-if="tenantInfo == 'SETTING'"
           prop="theme"
           :rules="[
-            { required: true, message: '请选择主题', trigger: 'change' },
+            { required: true, message: '请选择主题', trigger: 'change' }
           ]"
         >
           <div style="width: 300px !important">
@@ -230,7 +230,7 @@
         label="机构全称"
         prop="tsignName"
         :rules="[
-          { required: true, message: '请输入机构全称', trigger: 'blur' },
+          { required: true, message: '请输入机构全称', trigger: 'blur' }
         ]"
       >
         <el-input
@@ -243,7 +243,7 @@
         label="机构简称"
         prop="name"
         :rules="[
-          { required: true, message: '请输入机构简称', trigger: 'blur' },
+          { required: true, message: '请输入机构简称', trigger: 'blur' }
         ]"
       >
         <el-input
@@ -303,7 +303,7 @@
         label="机构地址"
         prop="address"
         :rules="[
-          { required: true, message: '请输入机构地址', trigger: 'blur' },
+          { required: true, message: '请输入机构地址', trigger: 'blur' }
         ]"
       >
         <el-input
@@ -316,7 +316,7 @@
         label="营业执照编号"
         prop="tsignCode"
         :rules="[
-          { required: true, message: '请输入营业执照编号', trigger: 'blur' },
+          { required: true, message: '请输入营业执照编号', trigger: 'blur' }
         ]"
       >
         <el-input
@@ -329,7 +329,7 @@
         label="机构联系人"
         prop="contacts"
         :rules="[
-          { required: true, message: '请输入机构联系人', trigger: 'blur' },
+          { required: true, message: '请输入机构联系人', trigger: 'blur' }
         ]"
       >
         <el-input
@@ -347,9 +347,9 @@
           {
             pattern: /^1[3456789]\d{9}$/,
             message: '请输入正确的手机号',
-            trigger: 'blur',
+            trigger: 'blur'
           },
-          { validator: validatePhone, trigger: 'blur' },
+          { validator: validatePhone, trigger: 'blur' }
         ]"
       >
         <template #label>
@@ -380,11 +380,10 @@
         :rules="[
           { required: true, message: '请输入机构邮箱', trigger: 'blur' },
           {
-            pattern:
-              /^\w+((.\w+)|(-\w+))@[A-Za-z0-9]+((.|-)[A-Za-z0-9]+).[A-Za-z0-9]+$/,
+            pattern: /^\w+((.\w+)|(-\w+))@[A-Za-z0-9]+((.|-)[A-Za-z0-9]+).[A-Za-z0-9]+$/,
             message: '请输入正确的邮箱格式',
-            trigger: 'blur',
-          },
+            trigger: 'blur'
+          }
         ]"
       >
         <el-input
@@ -403,7 +402,11 @@
           placeholder="请输入机构客服电话"
         ></el-input>
       </el-form-item>
-      <el-form-item label="推荐人" prop="recommender" v-if="tenantInfo != 'SETTING'">
+      <el-form-item
+        label="推荐人"
+        prop="recommender"
+        v-if="tenantInfo != 'SETTING'"
+      >
         <remote-search
           :disabled="isDisabled"
           :commit="'setTenantUser'"
@@ -428,33 +431,33 @@ export default {
   data() {
     return {
       headers: {
-        Authorization: getToken(),
+        Authorization: getToken()
       },
       themeList: [
         {
           name: "亚丁绿",
           value: "adenGreen",
           color: "#00A79D",
-          selected: false,
+          selected: false
         },
         {
           name: "暮云灰",
           value: "cloudAshes",
           color: "#444D5C",
-          selected: false,
+          selected: false
         },
         {
           name: "柏林蓝",
           value: "berlinBlue",
           color: "#2B78CC",
-          selected: false,
+          selected: false
         },
         {
           name: "火山红",
           value: "volcanicRed",
           color: "#BC3030",
-          selected: false,
-        },
+          selected: false
+        }
       ],
       form: {
         tsignName: null,
@@ -473,7 +476,7 @@ export default {
         themeColor: "#00A79D",
         corporateChops: null,
         corporateFinanceChops: null,
-        recommender:null,
+        recommender: null
       },
       originPhone: null, // 是否已存在手机号
       errorPhone: null, // 手机号存在错误信息
@@ -488,8 +491,8 @@ export default {
         autoCropHeight: 72, //默认生成截图框高度
         fixedBox: true, //是否固定截图框大小 不允许改变
         previewsCircle: false, //预览图是否是圆形
-        title: "上传机构LOGO", //模态框上显示的标题
-      },
+        title: "上传机构LOGO" //模态框上显示的标题
+      }
     };
   },
   async mounted() {
@@ -505,7 +508,7 @@ export default {
       }
     }
     // 选中默认颜色
-    this.themeList.forEach((theme) => {
+    this.themeList.forEach(theme => {
       if (theme.color == this.form.themeColor) {
         theme.selected = true;
       } else {
@@ -514,7 +517,7 @@ export default {
     });
     // 判断是否有城市编号
     if (this.form.areaId) {
-      await getParentArea({ id: this.form.areaId }).then(async (res) => {
+      await getParentArea({ id: this.form.areaId }).then(async res => {
         if (res.code == 200 && res.data) {
           await this.getAreaList(res.data.id, () => {
             this.$set(this.form, "province", res.data.id);
@@ -544,7 +547,7 @@ export default {
       } else {
         return this.type == "setting" || this.payState == 1 ? true : false;
       }
-    },
+    }
   },
   methods: {
     //上传图片成功
@@ -559,7 +562,7 @@ export default {
     },
     themeChange(item) {
       // 切换主题时设置跟主题对应的主题色
-      this.themeList.forEach((theme) => {
+      this.themeList.forEach(theme => {
         theme.selected = false;
       });
       item.selected = true;
@@ -571,13 +574,13 @@ export default {
         setTheme({
           themeColor: item.color,
           theme: item.value,
-          saveTheme: false,
+          saveTheme: false
         });
       }
     },
     onSubmit() {
       let state = false;
-      this.$refs.form.validate((_) => {
+      this.$refs.form.validate(_ => {
         console.log(_);
         state = _;
       });
@@ -617,13 +620,13 @@ export default {
     },
     getAreaList(parentId, callback) {
       parentId = parentId ? parentId : 0;
-      areaQueryChild({ parentId: parentId }).then((res) => {
+      areaQueryChild({ parentId: parentId }).then(res => {
         if (res.code == 200 && res.data) {
           let tempData = [];
-          res.data.forEach((item) => {
+          res.data.forEach(item => {
             tempData.push({
               label: item.name,
-              value: item.id,
+              value: item.id
             });
           });
           if (parentId) {
@@ -667,7 +670,7 @@ export default {
     // },
     beforeAvatarUpload(file) {
       const imageType = {
-        "image/png": true,
+        "image/png": true
       };
       const isImage = imageType[file.type];
       const isLt2M = file.size / 1024 / 1024 < 5;
@@ -687,8 +690,8 @@ export default {
       } else {
         callback();
       }
-    },
-  },
+    }
+  }
 };
 </script>
 <style lang="scss" scoped>

+ 86 - 49
src/views/tenantSetting/tenantInfo.vue

@@ -7,29 +7,39 @@
     <!-- 列表 -->
     <div v-if="status" class="m-core">
       <!-- 机构基本信息 -->
-        <organInfo ref="organInfo" :data="info" type="update" tenantInfo="SETTING" />
+      <organInfo
+        ref="organInfo"
+        :data="info"
+        type="update"
+        tenantInfo="SETTING"
+      />
 
-        <div style="display: flex;width: 100%;" v-if="$helpers.permission('tenantInfo/update/info')">
-          <i class="icon_admin_home"></i>
-          <el-button type="primary"  @click="onNext">确认</el-button>
-        </div>
+      <div
+        style="display: flex;width: 100%;"
+        v-if="$helpers.permission('tenantInfo/update/info')"
+      >
+        <i class="icon_admin_home"></i>
+        <el-button type="primary" @click="onNext">确认</el-button>
+      </div>
     </div>
   </div>
 </template>
 <script>
-import { tenantInfoAdd, tenantInfoInfo, tenantInfoUpdate } from "../organManager/api";
-import organInfo from '../organManager/components/organInfo'
-import { setTheme } from '@/utils/setTheme'
+import {
+  tenantInfoAdd,
+  tenantInfoInfo,
+  tenantInfoUpdate
+} from "../organManager/api";
+import organInfo from "../organManager/components/organInfo";
+import { setTheme } from "@/utils/setTheme";
 export default {
   components: { organInfo },
   data() {
     return {
       tableList: [],
-      form: {
-
-      },
+      form: {},
       info: {},
-      status: false,
+      status: false
     };
   },
   mounted() {
@@ -38,59 +48,86 @@ export default {
   methods: {
     async __init() {
       try {
-        const res = await tenantInfoInfo({ id: this.$helpers.tenantId })
-        this.status = true
-        const { config, productInfo, ...other } = res.data
-        const { theme, themeColor, corporateChops, corporateFinanceChops, id, ...con } = config
-        this.info = { ...other, theme, themeColor, corporateChops, corporateFinanceChops, configId: id }
+        const res = await tenantInfoInfo({ id: this.$helpers.tenantId });
+        this.status = true;
+        const { config, productInfo, ...other } = res.data;
+        const {
+          theme,
+          themeColor,
+          corporateChops,
+          corporateFinanceChops,
+          id,
+          ...con
+        } = config;
+        this.info = {
+          ...other,
+          theme,
+          themeColor,
+          corporateChops,
+          corporateFinanceChops,
+          configId: id
+        };
       } catch (e) {}
     },
     async onNext() {
-      const organStatus = await this.$refs.organInfo.onSubmit()
-      if(!organStatus) return
-      const organData = await this.$refs.organInfo.getValues()
-      const { theme, themeColor, configId, ...con } = organData
-        let config = {
-          theme,
-          themeColor,
-          id: configId
-        }
+      const organStatus = await this.$refs.organInfo.onSubmit();
+      if (!organStatus) return;
+      const organData = await this.$refs.organInfo.getValues();
+      // const { theme, themeColor, configId, ...con } = organData;
+      const {
+        theme,
+        themeColor,
+        configId,
+        corporateChops,
+        corporateFinanceChops,
+        ...con
+      } = organData;
+      let config = {
+        theme,
+        themeColor,
+        corporateChops,
+        corporateFinanceChops,
+        id: configId
+      };
       let params = {
         ...con,
         config
-      }
+      };
       try {
-          const res = await tenantInfoUpdate(params)
-          this.$message.success('修改更新成功')
-          // 机构购买不能修改主题
-          let baseTenantId = sessionStorage.getItem('baseTenantId')
-          if(baseTenantId > 0) {
-            setTheme({
+        const res = await tenantInfoUpdate(params);
+        this.$message.success("修改更新成功");
+        // 机构购买不能修改主题
+        let baseTenantId = sessionStorage.getItem("baseTenantId");
+        if (baseTenantId > 0) {
+          setTheme({
+            theme,
+            themeColor
+          });
+          // 重新设置样式
+          let tenantConfig = sessionStorage.getItem("tenantConfig");
+          tenantConfig = tenantConfig ? JSON.parse(tenantConfig) : {};
+          sessionStorage.setItem(
+            "tenantConfig",
+            JSON.stringify({
+              ...tenantConfig,
               theme,
               themeColor
             })
-            // 重新设置样式
-            let tenantConfig = sessionStorage.getItem('tenantConfig')
-            tenantConfig = tenantConfig ? JSON.parse(tenantConfig) : {}
-            sessionStorage.setItem('tenantConfig', JSON.stringify({
-              ...tenantConfig,
-              theme,
-               themeColor
-            }))
-          }
-        } catch(e) {}
+          );
+        }
+      } catch (e) {}
     }
   },
   async beforeDestroy() {
-    let tenantConfig = sessionStorage.getItem('tenantConfig')
-    tenantConfig = tenantConfig ? JSON.parse(tenantConfig) : {}
-    const organData = await this.$refs.organInfo.getValues()
-    const { theme, themeColor } = organData
-    if(theme != tenantConfig.theme) {
+    let tenantConfig = sessionStorage.getItem("tenantConfig");
+    tenantConfig = tenantConfig ? JSON.parse(tenantConfig) : {};
+    const organData = await this.$refs.organInfo.getValues();
+    const { theme, themeColor } = organData;
+    if (theme != tenantConfig.theme) {
       setTheme({
         theme: tenantConfig.theme,
         themeColor: tenantConfig.themeColor
-      })
+      });
     }
   }
 };