wjx 1 年之前
父节点
当前提交
671a8cf928
共有 3 个文件被更改,包括 172 次插入23 次删除
  1. 15 1
      src/api/accounts/corpWeChat.js
  2. 72 22
      src/views/accounts/corpWechat/index.vue
  3. 85 0
      src/views/accounts/corpWechat/setSession.vue

+ 15 - 1
src/api/accounts/corpWeChat.js

@@ -114,12 +114,26 @@ export function putSyncAllCorpUser(corpId) {
 export function refreshCorp(params) {
     const { corpId, ...data } = params
     return request({
-        url: `/corp/admin/corp/config/${corpId} `,
+        url: `/corp/admin/corp/config/${corpId}`,
         method: 'PUT',
         data
     })
 }
 
+/**
+ * 设置会话存档Secret
+ * @param {*} corpId 
+ * @param {*} msgAuditSecret 
+ * @returns 
+ */
+export function setMsgSession(params) {
+    const { corpId, msgAuditSecret } = params
+    return request({
+        url: `/corp/admin/corp/config/${corpId}/${msgAuditSecret}`,
+        method: 'POST'
+    })
+}
+
 /*****************变更记录*******************/
 /**
  * 变更记录

+ 72 - 22
src/views/accounts/corpWechat/index.vue

@@ -6,12 +6,14 @@
                     @keyup.enter.native="getList" />
             </el-form-item>
             <el-form-item label="" prop="originCorpId">
-                <el-input v-model="queryParams.originCorpId" placeholder="企微ID" clearable size="small" style="width: 140px"
-                    @keyup.enter.native="getList" />
+                <el-input v-model="queryParams.originCorpId" placeholder="企微ID" clearable size="small"
+                    style="width: 140px" @keyup.enter.native="getList" />
             </el-form-item>
             <el-form-item label="" prop="applicationType">
-                <el-select v-model="queryParams.applicationType" placeholder="请选择应用类型" size="small" filterable clearable style="width: 140px;">
-                    <el-option v-for="item in applicationTypeList" :key="item.value" :label="item.label" :value="item.value" />
+                <el-select v-model="queryParams.applicationType" placeholder="请选择应用类型" size="small" filterable clearable
+                    style="width: 140px;">
+                    <el-option v-for="item in applicationTypeList" :key="item.value" :label="item.label"
+                        :value="item.value" />
                 </el-select>
             </el-form-item>
             <el-form-item label="" prop="authStatus">
@@ -22,8 +24,8 @@
                 </el-select>
             </el-form-item>
             <el-form-item label="" prop="configStatus">
-                <el-select v-model="queryParams.configStatus" placeholder="配置状态" clearable filterable style="width: 140px"
-                    size="small" @keyup.enter.native="handleQuery">
+                <el-select v-model="queryParams.configStatus" placeholder="配置状态" clearable filterable
+                    style="width: 140px" size="small" @keyup.enter.native="handleQuery">
                     <el-option label="未配置" value="ING" />
                     <el-option label="配置成功" value="SUCCESS" />
                     <el-option label="配置失败" value="ERROR" />
@@ -54,20 +56,24 @@
             </el-table-column>
             <el-table-column label="企微ID" prop="originCorpId" align="center" width="150" />
             <el-table-column label="应用类型" prop="applicationType" align="center" width="150">
+
                 <template slot-scope="scope">{{ scope.row.applicationType | filterApplicationType }}</template>
             </el-table-column>
             <el-table-column label="用户规模" prop="corpUserMax" align="center" width="100" />
             <el-table-column label="授权方企业类型" prop="corpType" align="center" width="150">
+
                 <template slot-scope="scope">{{ scope.row.corpType | filterCorpType }}</template>
             </el-table-column>
             <el-table-column label="认证到期时间" prop="verifiedEndTime" align="center" width="120" />
             <el-table-column label="授权状态" prop="authStatus" align="center" width="120">
+
                 <template slot-scope="scope">
                     <el-tag type="success" v-if="scope.row.authStatus === 1">成功授权</el-tag>
                     <el-tag type="danger" v-else>取消授权</el-tag>
                 </template>
             </el-table-column>
             <el-table-column label="配置状态" prop="configStatus" align="center" width="120">
+
                 <template slot-scope="scope">
                     <el-tag type="success" v-if="scope.row.configStatus === 'SUCCESS'">配置成功</el-tag>
                     <el-tag type="warning" v-else-if="scope.row.configStatus === 'ING'">未配置</el-tag>
@@ -75,25 +81,36 @@
                 </template>
             </el-table-column>
             <el-table-column label="回调地址" prop="externalUserCallbackUrl" width="200" :show-overflow-tooltip="true">
+
                 <template slot-scope="scope">
                     <a style="color: #1890ff;" @click="copy(scope.row.externalUserCallbackUrl)">{{
-                        scope.row.externalUserCallbackUrl }}</a>
+            scope.row.externalUserCallbackUrl }}</a>
                 </template>
             </el-table-column>
             <el-table-column label="Token" prop="externalUserToken" width="150" :show-overflow-tooltip="true">
+
                 <template slot-scope="scope">
                     <a style="color: #1890ff;" @click="copy(scope.row.externalUserToken)">{{ scope.row.externalUserToken
-                    }}</a>
+                        }}</a>
                 </template>
             </el-table-column>
             <el-table-column label="AESKey" prop="externalUserAesKey" width="150" :show-overflow-tooltip="true">
+
                 <template slot-scope="scope">
-                    <a style="color: #1890ff;" @click="copy(scope.row.externalUserAesKey)">{{ scope.row.externalUserAesKey
-                    }}</a>
+                    <a style="color: #1890ff;" @click="copy(scope.row.externalUserAesKey)">{{
+            scope.row.externalUserAesKey
+        }}</a>
+                </template>
+            </el-table-column>
+            <el-table-column label="会话存档Secret" prop="msgAuditSecret" width="150" :show-overflow-tooltip="true">
+                <template slot-scope="scope">
+                    <div v-if="scope.row.msgAuditSecret">{{scope.row.msgAuditSecret}}</div>
+                    <div v-else>--</div>
                 </template>
             </el-table-column>
             <el-table-column label="授权时间" prop="createTime" width="130" :show-overflow-tooltip="true" />
             <el-table-column label="用户分组" prop="sysUserGroupList" width="150" :show-overflow-tooltip="true">
+
                 <template slot-scope="scope">
                     <div v-if="scope.row.sysUserGroupList"><span v-for="(item, index) in scope.row.sysUserGroupList"
                             :key="item.id"><i v-if="index > 0">,</i>{{ item.groupName }}</span></div>
@@ -101,13 +118,16 @@
                 </template>
             </el-table-column>
             <el-table-column label="备注" prop="remark" width="250" :show-overflow-tooltip="true" />
-            <el-table-column label="操作" width="200" align="center" class-name="small-padding fixed-width" fixed="right">
+            <el-table-column label="操作" width="200" class-name="small-padding fixed-width" fixed="right">
+
                 <template slot-scope="scope">
-                    <template v-if="scope.row.authStatus === 1">
+                    <div v-if="scope.row.authStatus === 1" class="czCell">
                         <el-button size="mini" type="text" icon="el-icon-refresh"
                             @click="handleRefresh(scope.row)">刷新</el-button>
-                        <el-button size="mini" type="text" icon="el-icon-refresh"
+                        <el-button size="mini" type="text" icon="el-icon-setting"
                             @click="setSecretHandle(scope.row)">配置密钥</el-button>
+                        <el-button size="mini" v-if="scope.row.corpId" type="text" icon="el-icon-setting"
+                            @click="setSessionHandle(scope.row)">配置会话存档</el-button>
                         <template v-if="scope.row.configStatus === 'SUCCESS'">
                             <el-dropdown style="margin-left: 7px;">
                                 <el-button class="el-dropdown-link" size="mini" type="text">更多<i
@@ -120,17 +140,19 @@
                                 </el-dropdown-menu>
                             </el-dropdown>
                         </template>
-                    </template>
+                    </div>
                 </template>
             </el-table-column>
         </el-table>
 
-        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
-            @pagination="getList" />
+        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
+            :limit.sync="queryParams.pageSize" @pagination="getList" />
 
-        <setSecret :value="secretData" :applicationTypeList="applicationTypeList" :visible="setShow" @close="setShow = false; secretData = { bookAgentIdMap: [] }"
-            @change="closeSetSecret(); getList()" />
+        <setSecret :value="secretData" :applicationTypeList="applicationTypeList" :visible="setShow"
+            @close="setShow = false; secretData = { bookAgentIdMap: [] }" @change="closeSetSecret(); getList()" />
         <mailList :corpId="corpId" :visible="mailShow" @close="mailShow = false; corpId = null" />
+        <set-session v-if="sessionVisible" :visible="sessionVisible" :msgAuditSecret="msgAuditSecret" :corpId="corpId"
+            @close="msgAuditSecret = {}; corpId = null; sessionVisible = false" @change="sessionChange()"/>
     </div>
 </template>
 
@@ -138,9 +160,10 @@
 import { getCorpToAuth, getCorpList, putRefreshCorp, putSyncAllCorpUser } from "@/api/accounts/corpWeChat";
 import setSecret from './setSecret.vue'
 import mailList from './mailList.vue'
+import setSession from './setSession.vue'
 export default {
     name: 'corp',
-    components: { setSecret, mailList },
+    components: { setSecret, mailList, setSession },
     data() {
         return {
             showSearch: true,
@@ -160,7 +183,9 @@ export default {
             },
             mailShow: false,
             corpId: null,
-            applicationTypeList: [{label: '内部应用', value: 'INTERNAL'}, {label: '自建应用', value: 'SELF_BUILT'}, {label: '服务商代开发应用', value: 'PROVIDER'}]
+            applicationTypeList: [{ label: '内部应用', value: 'INTERNAL' }, { label: '自建应用', value: 'SELF_BUILT' }, { label: '服务商代开发应用', value: 'PROVIDER' }],
+            msgAuditSecret: null,
+            sessionVisible: false
         }
     },
     mounted() {
@@ -183,7 +208,7 @@ export default {
         },
         filterApplicationType(val) {
             if (val) {
-                return {INTERNAL: '内部应用', SELF_BUILT: '自建应用', PROVIDER: '服务商代开发应用'}[val] || '-1';
+                return { INTERNAL: '内部应用', SELF_BUILT: '自建应用', PROVIDER: '服务商代开发应用' }[val] || '-1';
             }
             return '-1'
         }
@@ -286,7 +311,32 @@ export default {
         closeSetSecret() {
             this.setShow = false
             this.secretData = {}
+        },
+        /** 配置会话存档 */
+        setSessionHandle(row) {
+            this.corpId = row.corpId
+            this.msgAuditSecret = row.msgAuditSecret
+            this.sessionVisible = true
+        },
+        sessionChange() {
+            this.msgAuditSecret = {}; 
+            this.corpId = null; 
+            this.sessionVisible = false;
+            this.getList()
         }
     }
 }
-</script>
+</script>
+
+<style scoped lang="scss">
+.czCell {
+    display: flex;
+    gap: 0px 5px;
+    flex-wrap: wrap;
+
+    >button {
+        padding: 0;
+        margin-left: 0;
+    }
+}
+</style>

+ 85 - 0
src/views/accounts/corpWechat/setSession.vue

@@ -0,0 +1,85 @@
+<template>
+    <el-dialog :title="title" :visible.sync="visible" width="450px" :before-close="onClose">
+        <el-form :model="queryForm" ref="setSession" :rules="rules">
+            <el-form-item label="存档Secret" prop="msgAuditSecret">
+                <el-input v-model="queryForm.msgAuditSecret" placeholder="请输入会话存档Secret" clearable size="small" />
+            </el-form-item>
+        </el-form>
+
+        <span slot="footer" class="dialog-footer">
+            <el-button @click="onClose">取 消</el-button>
+            <el-button type="primary" @click="onSubmit()">确 定</el-button>
+        </span>
+    </el-dialog>
+</template>
+
+<script>
+import { setMsgSession } from "@/api/accounts/corpWeChat";
+export default {
+    name: 'setSession',
+    data() {
+        return {
+            title: '配置通会话存档',
+            rules: {
+                msgAuditSecret: [
+                    { required: true, message: '请输入会话存档Secret', trigger: 'blur' }
+                ]
+            },
+            queryForm: { msgAuditSecret: null }
+        }
+    },
+    props: {
+        corpId: {
+            type: String,
+            default: null,
+        },
+        msgAuditSecret: {
+            type: String,
+            default: null,
+        },
+        visible: {
+            type: Boolean,
+            default: false
+        }
+    },
+    watch: {
+        msgAuditSecret: {
+            handler(val) {
+                this.queryForm.msgAuditSecret = val
+            },
+            immediate: true,
+        }
+    },
+    methods: {
+        onClose() {
+            this.$emit("close");
+        },
+        onSubmit() {
+            if (!this.corpId) {
+                this.$message.error('没有企业ID');
+                return
+            }
+            this.$refs['setSession'].validate(async (valid) => {
+                if (valid) {
+                    const loading = this.$loading({
+                        lock: true,
+                        text: 'Loading',
+                        spinner: 'el-icon-loading',
+                        background: 'rgba(0, 0, 0, 0.7)'
+                    });
+                    const params = { corpId: this.corpId, ...this.queryForm }
+                    console.log(params)
+                    setMsgSession(params).then(res => {
+                        this.$message({
+                            message: '配置成功',
+                            type: 'success'
+                        });
+                        loading.close()
+                        this.$emit("change");
+                    }).catch(() => loading.close())
+                }
+            })
+        }
+    }
+}
+</script>