Lijy hai 2 meses
pai
achega
cdd4a246aa

+ 41 - 24
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/team/index.vue

@@ -47,8 +47,8 @@
           @click="transitionOperation('exportUser', '')" v-permission="['teamExport']">导出人员</el-button>
         <el-button type="primary" v-if="userInfo.userNameNeedTranslate == 1"
           @click="dialogFrom.newSyncWithCorpWxDayloadVisable = true">同步企微通讯录</el-button>
-        <el-button type="primary" v-if="userInfo.userNameNeedTranslate == 1"
-          @click="officialAccountSetting()">{{ officialAccountInformation.id ? '修改公众号配置' : '配置公众号' }}</el-button>
+        <el-button type="primary" v-if="userInfo.userNameNeedTranslate == 1" @click="officialAccountSetting()">{{
+          officialAccountInformation.id ? '修改公众号配置' : '配置公众号' }}</el-button>
         <el-dropdown v-if="userInfo.userNameNeedTranslate != 1">
           <el-button type="primary">
             更多操作<el-icon class="el-icon--right"><arrow-down /></el-icon>
@@ -317,18 +317,30 @@
         </div>
       </template>
       <div class="pt-4 px-12 py-2">
-        <el-form ref="officialAccountInformationRef" style="max-width: 600px" :model="officialAccountInformationFrom"
-          status-icon :rules="officialAccountInformationFromRules" label-width="auto" class="demo-ruleForm">
+        <!-- <el-form ref="officialAccountInformationRef" :model="officialAccountInformationFrom"
+          :rules="officialAccountInformationFromRules" label-width="auto" class="demo-ruleForm">
           <el-form-item label="名称:" prop="companyName">
-            <el-input v-model.trim="officialAccountInformationFrom.companyName" placeholder="请输入" />
+            <el-input v-model="officialAccountInformationFrom.companyName" placeholder="请输入" />
           </el-form-item>
           <el-form-item label="appId:" prop="appId">
-            <el-input v-model.trim="officialAccountInformationFrom.appId" placeholder="请输入" />
+            <el-input v-model="officialAccountInformationFrom.appId" placeholder="请输入" />
           </el-form-item>
           <el-form-item label="appSecret:" prop="appSecret">
-            <el-input v-model.trim="officialAccountInformationFrom.appSecret" placeholder="请输入" />
+            <el-input v-model="officialAccountInformationFrom.appSecret" placeholder="请输入" />
           </el-form-item>
-        </el-form>
+        </el-form> -->
+        <div class="flex items-center mb-4">
+          <div class="w-[80px] text-right mr-3">名称</div>
+          <el-input v-model="officialAccountInformationFrom.companyName" placeholder="请输入" />
+        </div>
+        <div class="flex items-center mb-4">
+          <div class="w-[80px] text-right mr-3">appId</div>
+          <el-input v-model="officialAccountInformationFrom.appId" placeholder="请输入" />
+        </div>
+        <div class="flex items-center mb-4">
+          <div class="w-[80px] text-right mr-3">appSecret</div>
+          <el-input v-model="officialAccountInformationFrom.appSecret" placeholder="请输入" />
+        </div>
         <el-text class="mx-1" type="warning">请联系客服, 获取ip白名单参数, 配置后方可生效</el-text>
       </div>
     </el-dialog>
@@ -346,13 +358,8 @@
       :popup="visibleType" :batchOperationVisible="dialogFrom.batchOperationVisible" @close="closeModal" />
 
     <!-- 图片预览 -->
-    <el-image-viewer
-      v-if="showPreview"
-      :url-list="previewSrcList"
-      show-progress
-      :initial-index="0"
-      @close="showPreview = false"
-    />
+    <el-image-viewer v-if="showPreview" :url-list="previewSrcList" show-progress :initial-index="0"
+      @close="showPreview = false" />
   </div>
 </template>
 
@@ -469,7 +476,7 @@ const officialAccountInformation = ref<officialAccountInformationInterface>({
   appSecret: '',
 })
 
-const officialAccountInformationFrom = ref<officialAccountInformationInterface>({
+const officialAccountInformationFrom = reactive<officialAccountInformationInterface>({
   id: '',
   companyName: '',
   appId: '',
@@ -579,13 +586,18 @@ function oneClickGenerationOfQrCode() {
   })
 }
 
-async function configureOfficialAccountInformation(formEl: FormInstance | undefined) {
-  if (!formEl) return
-  await formEl.validate((valid) => {
-    if (valid) {
+async function configureOfficialAccountInformation(_formEl: FormInstance | undefined) {
+  // if (!formEl) return
+  // await formEl.validate((valid) => {
+  //   if (valid) {
+      const { companyName, appId, appSecret  } = officialAccountInformationFrom
+      if(!companyName || !appId || !appSecret) {
+        globalPopup?.showError('请填写完整')
+        return
+      }
       confirmAction('确定保存当前公众号的配置吗?', '公众号配置', 'warning').then(() => {
         loadingFrom.officialAccountSettingLoading = true
-        post(SAVE_OR_UPDATE, getFromValue(officialAccountInformationFrom.value)).then(() => {
+        post(SAVE_OR_UPDATE, getFromValue(officialAccountInformationFrom)).then(() => {
           globalPopup?.showSuccess('配置成功')
           closeModal('officialAccountSettingVisable')
           getCompanyWeiXin()
@@ -593,8 +605,8 @@ async function configureOfficialAccountInformation(formEl: FormInstance | undefi
           loadingFrom.officialAccountSettingLoading = false
         })
       })
-    }
-  })
+  //   }
+  // })
 }
 
 function closeOfficialAccountInformation(formEl: FormInstance | undefined) {
@@ -603,7 +615,12 @@ function closeOfficialAccountInformation(formEl: FormInstance | undefined) {
 }
 
 function officialAccountSetting() {
-  officialAccountInformationFrom.value = JSON.parse(JSON.stringify(officialAccountInformation.value))
+  Object.assign(officialAccountInformationFrom, officialAccountInformation.value || {
+    id: '',
+    companyName: '',
+    appId: '',
+    appSecret: ''
+  })
   dialogFrom.officialAccountSettingVisable = true
 }