Prechádzať zdrojové kódy

cid手机相关配置

yjwang 17 hodín pred
rodič
commit
18b1f0115e
1 zmenil súbory, kde vykonal 93 pridanie a 0 odobranie
  1. 93 0
      src/views/company/companyConfig/index.vue

+ 93 - 0
src/views/company/companyConfig/index.vue

@@ -1,6 +1,54 @@
 <template>
   <div class="app-container">
       <el-tabs v-model="activeName"    >
+        <el-tab-pane label="CID配置" name="cidConfig">
+          <el-form ref="cidConfigForm" :model="cidConfig" label-width="200px">
+            <el-form-item label="是否开启手机号配置" prop="enablePhoneConfig">
+              <el-switch v-model="cidConfig.enablePhoneConfig"></el-switch>
+            </el-form-item>
+
+            <template v-if="cidConfig.enablePhoneConfig">
+              <el-form-item label="生成条数" prop="generateCount">
+                <el-input-number
+                  v-model="cidConfig.generateCount"
+                  :min="1"
+                  :step="1"
+                  :precision="0"
+                  placeholder="请输入生成条数"
+                ></el-input-number>
+              </el-form-item>
+
+              <el-form-item label="开始位置" prop="startIndex">
+                <el-input-number
+                  v-model="cidConfig.startIndex"
+                  :min="1"
+                  :max="11"
+                  :step="1"
+                  :precision="0"
+                  placeholder="例如: 1"
+                ></el-input-number>
+                <span class="tip-text">(从第几位开始生成)</span>
+              </el-form-item>
+
+              <el-form-item label="结束位置" prop="endIndex">
+                <el-input-number
+                  v-model="cidConfig.endIndex"
+                  :min="1"
+                  :max="11"
+                  :step="1"
+                  :precision="0"
+                  placeholder="例如: 11"
+                ></el-input-number>
+                <span class="tip-text">(到第几位结束)</span>
+              </el-form-item>
+            </template>
+
+            <div class="line"></div>
+            <div style="float:right;margin-right:20px">
+              <el-button type="primary" @click="onSubmitCidConfig">提交</el-button>
+            </div>
+          </el-form>
+        </el-tab-pane>
           <el-tab-pane label="客户管理配置" name="sysConfig">
           <el-form ref="sysConfig" :model="sysConfig" label-width="120px">
             <el-form-item label="公海回收规则">
@@ -262,6 +310,12 @@ export default {
   },
   data() {
     return {
+      cidConfig: {
+        enablePhoneConfig: false,
+        generateCount: 0,
+        startIndex: 1,
+        endIndex: 5
+      },
       adminIsShow: false,
       company:null,
       statusOptions:[],
@@ -319,6 +373,7 @@ export default {
     this.getConfigKey("sys:AiKf:config");
     this.getConfigKey("company:admin:show");
     this.getConfigKey("redPacket:config");
+    this.getConfigKey("cId.config");
     this.getDicts("sys_company_status").then((response) => {
       this.statusOptions = response.data;
     });
@@ -464,6 +519,11 @@ export default {
               if(response.data.configValue!=null){
                 this.redPacketConfig=JSON.parse(response.data.configValue);
               }
+            }else if(key == "cId.config"){
+              this.cidConfigForm = response.data;
+              if(response.data.configValue != null){
+                this.cidConfig = JSON.parse(response.data.configValue);
+              }
             }
         });
     },
@@ -540,6 +600,39 @@ export default {
         }
       })
     },
+    onSubmitCidConfig() {
+      if (this.cidConfig.enablePhoneConfig) {
+        if (!this.cidConfig.generateCount || this.cidConfig.generateCount < 1) {
+          this.msgError('生成条数不能为空且不能小于1');
+          return;
+        }
+        if (!this.cidConfig.startIndex || this.cidConfig.startIndex < 1 || this.cidConfig.startIndex > 11) {
+          this.msgError('开始位置不能为空,且必须在1到11之间');
+          return;
+        }
+        if (!this.cidConfig.endIndex || this.cidConfig.endIndex < 1 || this.cidConfig.endIndex > 11) {
+          this.msgError('结束位置不能为空,且必须在1到11之间');
+          return;
+        }
+        if (this.cidConfig.startIndex > this.cidConfig.endIndex) {
+          this.msgError('开始位置不能大于结束位置');
+          return;
+        }
+
+        if (this.cidConfig.endIndex - this.cidConfig.startIndex < 4) {
+          this.msgError('开始和结束位置之间的位数不能少于4位');
+          return;
+        }
+      }
+
+      this.cidConfigForm.configValue = JSON.stringify(this.cidConfig);
+      updateConfig(this.cidConfigForm).then(response => {
+        if (response.code === 200) {
+          this.msgSuccess("修改成功");
+          this.getConfigKey("cId.config");
+        }
+      });
+    },
   }
 };
 </script>