wjx 1 år sedan
förälder
incheckning
f297ab5623

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

@@ -186,4 +186,31 @@ export function delAllOfCorp(recordId) {
     })
 }
 
-/*****************变更记录*******************/
+/*****************变更记录*******************/
+
+
+/**
+ * 新增企业
+ * @param {*} data 
+ * @returns 
+ */
+export function addCorpApi(data) {
+    return request({
+        url: '/corp/admin/corp/add',
+        method: 'POST',
+        data
+    })
+}
+
+/**
+ * 修改企业
+ * @param {*} data 
+ * @returns 
+ */
+export function editCorpApi(data) {
+    return request({
+        url: '/corp/admin/corp/modify',
+        method: 'POST',
+        data
+    })
+}

+ 39 - 0
src/api/accounts/miniprogram.js

@@ -0,0 +1,39 @@
+import request from '@/utils/request'
+
+/**
+ * 新增或者修改
+ * @param {*} data appDesc	string appId	stringappName	string appRemark	string id	integer($int64)
+ * @returns 
+ */
+export function modifyMini(data) {
+    return request({
+        url: '/corp/sys/app/addOrUpdate',
+        method: 'POST',
+        data: data
+    })
+}
+
+/**
+ * 删除
+ * @param {*} ids 
+ * @returns 
+ */
+export function delMinis(ids) {
+    return request({
+        url: `/corp/sys/app/delete/${ids}`,
+        method: 'DELETE'
+    })
+}
+
+/**
+ * 获取列表
+ * @param {*} data 
+ * @returns 
+ */
+export function getMiniList(data) {
+    return request({
+        url: `/corp/sys/app/listOfPage`,
+        method: 'POST',
+        data
+    })
+}

+ 1 - 0
src/assets/icons/svg/miniprogram.svg

@@ -0,0 +1 @@
+<svg t="1710914998173" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2470" width="128" height="128"><path d="M626.176 279.552c74.24 0 134.656 55.808 134.656 124.928 0 21.504-6.144 42.496-17.408 61.44-16.896 27.648-44.032 48.128-76.8 57.856-8.704 2.56-15.36 3.584-21.504 3.584-14.336 0-25.6-11.264-25.6-25.6s11.264-25.6 25.6-25.6c1.024 0 3.072 0 5.632-1.024 22.016-6.144 39.424-18.944 49.152-35.84 6.656-10.752 9.728-22.528 9.728-34.816 0-40.448-37.376-73.728-82.944-73.728-15.872 0-31.232 4.096-45.056 11.776-24.064 13.824-38.4 36.864-38.4 61.952v214.528c0 43.52-24.064 83.456-64 105.984-21.504 12.288-45.568 18.432-70.144 18.432-74.24 0-134.656-55.808-134.656-124.928 0-21.504 6.144-42.496 17.408-61.44 16.896-27.648 44.032-48.128 76.8-57.856 9.216-2.56 15.36-3.584 21.504-3.584 14.336 0 25.6 11.264 25.6 25.6s-11.264 25.6-25.6 25.6c-1.024 0-3.072 0-5.632 1.024-22.016 6.656-39.424 19.456-49.152 35.84-6.656 10.752-9.728 22.528-9.728 34.816 0 40.448 37.376 73.728 83.456 73.728 15.872 0 31.232-4.096 45.056-11.776 24.064-13.824 38.4-36.864 38.4-61.952V404.48c0-43.52 24.064-83.456 64-105.984 20.992-12.8 45.056-18.944 69.632-18.944z m-520.704 230.4c0 226.304 183.296 409.6 409.6 409.6s409.6-183.296 409.6-409.6-183.296-409.6-409.6-409.6-409.6 183.296-409.6 409.6z m-51.2 0c0-254.464 206.336-460.8 460.8-460.8s460.8 206.336 460.8 460.8-206.336 460.8-460.8 460.8-460.8-206.336-460.8-460.8z m0 0" fill="" p-id="2471"></path></svg>

+ 39 - 29
src/views/accounts/corpWechat/index.vue

@@ -40,7 +40,7 @@
         <el-row :gutter="10" class="mb8" align="middle">
             <el-col :span="1.5">
                 <div class="grid-content">
-                    <el-button type="primary" size="mini" @click="warrantHandle">企微授权</el-button>
+                    <el-button type="primary" size="mini" @click="warrantHandle">新增企业</el-button>
                 </div>
             </el-col>
             <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
@@ -49,11 +49,6 @@
         <el-table :data="corpList" v-loading="loading" size="mini">
             <el-table-column label="企微名称" prop="corpName" width="150" align="center" fixed="left"
                 :show-overflow-tooltip="true" />
-            <el-table-column label="企微头像" prop="corpSquareLogoUrl" align="center" width="150">
-                <template slot-scope="scope">
-                    <el-image style="height: 23px" :src="scope.row.corpSquareLogoUrl" fit="fit" />
-                </template>
-            </el-table-column>
             <el-table-column label="企微ID" prop="originCorpId" align="center" width="150" />
             <el-table-column label="应用类型" prop="applicationType" align="center" width="150">
 
@@ -104,7 +99,7 @@
             </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-if="scope.row.msgAuditSecret">{{ scope.row.msgAuditSecret }}</div>
                     <div v-else>--</div>
                 </template>
             </el-table-column>
@@ -122,8 +117,8 @@
 
                 <template slot-scope="scope">
                     <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-edit"
+                            @click="handleRefresh(scope.row)">修改</el-button>
                         <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"
@@ -152,7 +147,10 @@
             @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()"/>
+            @close="msgAuditSecret = {}; corpId = null; sessionVisible = false" @change="sessionChange()" />
+
+        <modal-corp :visible="corpVisible" :modifyData="corpData" :modalTitle="corpTitle" @onClose="corpVisible = false"
+            @onChange="corpVisible = false; getList()" />
     </div>
 </template>
 
@@ -161,9 +159,10 @@ import { getCorpToAuth, getCorpList, putRefreshCorp, putSyncAllCorpUser } from "
 import setSecret from './setSecret.vue'
 import mailList from './mailList.vue'
 import setSession from './setSession.vue'
+import ModalCorp from './modalCorp.vue'
 export default {
     name: 'corp',
-    components: { setSecret, mailList, setSession },
+    components: { setSecret, mailList, setSession, ModalCorp },
     data() {
         return {
             showSearch: true,
@@ -185,7 +184,11 @@ export default {
             corpId: null,
             applicationTypeList: [{ label: '内部应用', value: 'INTERNAL' }, { label: '自建应用', value: 'SELF_BUILT' }, { label: '服务商代开发应用', value: 'PROVIDER' }],
             msgAuditSecret: null,
-            sessionVisible: false
+            sessionVisible: false,
+
+            corpVisible: false,
+            corpData: null,
+            corpTitle: '新增企业'
         }
     },
     mounted() {
@@ -267,24 +270,31 @@ export default {
         },
         /** 企微授权 */
         warrantHandle() {
-            getCorpToAuth({ redirectUri: encodeURIComponent(process.env.VUE_APP_CORP_URL) }).then(res => {
-                if (res.data) {
-                    window.open(res.data)
-                }
-            })
+            // getCorpToAuth({ redirectUri: encodeURIComponent(process.env.VUE_APP_CORP_URL) }).then(res => {
+            //     if (res.data) {
+            //         window.open(res.data)
+            //     }
+            // })
+            this.corpVisible = true
+            this.corpData = null
+            this.corpTitle = '新增企业'
         },
         /** 刷新企微信息 */
         handleRefresh(row) {
-            const loading = this.$loading({
-                lock: true,
-                text: 'Loading',
-                spinner: 'el-icon-loading',
-                background: 'rgba(0, 0, 0, 0.7)'
-            });
-            putRefreshCorp(row.corpId).then(res => {
-                loading.close()
-                this.getList()
-            }).catch(() => loading.close())
+            // const loading = this.$loading({
+            //     lock: true,
+            //     text: 'Loading',
+            //     spinner: 'el-icon-loading',
+            //     background: 'rgba(0, 0, 0, 0.7)'
+            // });
+            // putRefreshCorp(row.corpId).then(res => {
+            //     loading.close()
+            //     this.getList()
+            // }).catch(() => loading.close())
+            const { originCorpId, corpId, corpFullName, corpName } = row
+            this.corpVisible = true
+            this.corpData = { originCorpId, corpId, corpFullName, corpName }
+            this.corpTitle = '修改企业'
         },
         /** 配置密钥 */
         setSecretHandle(row) {
@@ -319,8 +329,8 @@ export default {
             this.sessionVisible = true
         },
         sessionChange() {
-            this.msgAuditSecret = {}; 
-            this.corpId = null; 
+            this.msgAuditSecret = {};
+            this.corpId = null;
             this.sessionVisible = false;
             this.getList()
         }

+ 108 - 0
src/views/accounts/corpWechat/modalCorp.vue

@@ -0,0 +1,108 @@
+<template>
+    <div>
+        <el-dialog :title="modalTitle" :visible.sync="visible" width="500px" :before-close="onClose">
+            <el-form :model="queryParams" :rules="rules" ref="queryParamsCorpModify" label-position="left"
+                label-width="100px">
+                <el-form-item label="企业ID" prop="originCorpId">
+                    <el-input v-model="queryParams.originCorpId" placeholder="请输入企业ID" clearable size="small" />
+                </el-form-item>
+                <el-form-item label="企业简称" prop="corpName">
+                    <el-input v-model="queryParams.corpName" placeholder="请输入企业简称" clearable size="small" />
+                </el-form-item>
+                <el-form-item label="企业全称" prop="corpFullName">
+                    <el-input v-model="queryParams.corpFullName" placeholder="请输入企业全称" clearable size="small" />
+                </el-form-item>
+            </el-form>
+            <span slot="footer" class="dialog-footer">
+                <el-button @click="onClose()">取 消</el-button>
+                <el-button type="primary" :loading="loading" @click="submit('queryParamsCorpModify')">确 定</el-button>
+            </span>
+        </el-dialog>
+    </div>
+</template>
+
+<script>
+import { addCorpApi, editCorpApi } from "@/api/accounts/corpWeChat";
+export default {
+    data() {
+        return {
+            queryParams: {
+                corpFullName: null,
+                corpName: null,
+                originCorpId: null
+            },
+            rules: {
+                corpFullName: [
+                    { required: true, message: '请输入企业全称', trigger: 'blur' }
+                ],
+                originCorpId: [
+                    { required: true, message: '请输入企业ID', trigger: 'blur' }
+                ],
+                corpName: [
+                    { required: true, message: '请输入企业简称', trigger: 'blur' }
+                ]
+            },
+            loading: false
+        }
+    },
+    props: {
+        visible: {
+            type: Boolean,
+            default: false,
+        },
+        modifyData: {
+            type: Object,
+            default: null
+        },
+        modalTitle: {
+            type: String,
+            default: '新增企业'
+        }
+    },
+    watch: {
+        modifyData: {
+            handler(val) {
+                if (val && Object.keys(val).length > 0) {
+                    this.queryParams = val
+                } else {
+                    this.queryParams = {
+                        corpFullName: null,
+                        corpName: null,
+                        originCorpId: null
+                    }
+                }
+            },
+            immediate: true,
+        },
+    },
+    methods: {
+        onClose() {
+            this.$emit("onClose");
+        },
+        submit(formName) {
+            this.$refs[formName].validate(async (valid) => {
+                if (valid) {
+                    this.loading = true
+                    let data = null
+                    if (this.modifyData && this.modifyData.corpId) {
+                        data = await editCorpApi({ ...this.queryParams, corpId: this.modifyData.corpId })
+                    } else {
+                        data = await addCorpApi(this.queryParams)
+                    }
+
+                    this.loading = false
+                    if (data.data) {
+                        this.$message({
+                            message: (this.modifyData && this.modifyData.corpId) ? '修改成功' : '新增成功',
+                            type: 'success'
+                        });
+                        this.resetForm(formName);
+                        this.$emit("onChange");
+                    }
+                }
+            })
+        },
+
+    }
+}
+</script>

+ 142 - 0
src/views/accounts/miniprogram/index.vue

@@ -0,0 +1,142 @@
+<template>
+    <div class="app-container">
+        <el-form :model="queryParams" ref="queryForm" v-show="showSearch" :inline="true">
+            <el-form-item label="" prop="appName">
+                <el-input v-model="queryParams.appName" placeholder="请输入小程序名称" clearable size="small"
+                    @keyup.enter.native="handleQuery" />
+            </el-form-item>
+            <el-form-item label="" prop="appId">
+                <el-input v-model="queryParams.appId" placeholder="请输入AppId" clearable size="small"
+                    @keyup.enter.native="handleQuery" />
+            </el-form-item>
+            <el-form-item label="" prop="appDesc">
+                <el-input v-model="queryParams.appDesc" placeholder="请输入小程序详情" clearable size="small"
+                    @keyup.enter.native="handleQuery" />
+            </el-form-item>
+            <el-form-item label="" prop="appRemark">
+                <el-input v-model="queryParams.appRemark" placeholder="请输入小程序备注" clearable size="small"
+                    @keyup.enter.native="handleQuery" />
+            </el-form-item>
+            <el-form-item>
+                <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+            </el-form-item>
+        </el-form>
+
+        <el-row :gutter="10" class="mb8">
+            <el-col :span="1.5">
+                <el-button type="primary" icon="el-icon-plus" size="mini"
+                    @click="modifyData = null; handleAdd()">新增</el-button>
+            </el-col>
+            <el-col :span="1.5">
+                <el-popconfirm title="确定删除吗?" @confirm="handleDelete(selectIds)">
+                    <el-button slot="reference" :disabled="selectIds.length === 0" :loading="deleteLoading" size="mini" type="danger"
+                        icon="el-icon-delete">批量删除</el-button>
+                </el-popconfirm>
+            </el-col>
+            <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+        </el-row>
+
+        <el-table :data="miniprogramList" :loading="loading" :border="true" size="mini"
+            @selection-change="handleSelectionChange">
+            <el-table-column type="selection" width="55" />
+            <el-table-column label="小程序名称" prop="appName" align="center" width="150px" :show-overflow-tooltip="true" />
+            <el-table-column label="AppId" prop="appId" align="center" width="150px" :show-overflow-tooltip="true" />
+            <el-table-column label="小程序详情" prop="appDesc" :show-overflow-tooltip="true" width="350px" />
+            <el-table-column label="小程序备注" prop="appRemark" :show-overflow-tooltip="true" />
+            <el-table-column label="创建人" prop="createName" align="center" width="90px" />
+            <el-table-column label="创建时间" prop="createTime" align="center" width="160px" />
+            <el-table-column label="操作" align="center" width="120px">
+                <template slot-scope="scope">
+                    <el-button size="mini" type="text" icon="el-icon-edit" @click="handleEdit(scope.row)">编辑</el-button>
+                    <div style="display: inline-block;width: 10px"></div>
+                    <el-popconfirm title="确定删除吗?" @confirm="handleDelete(scope.row.id)">
+                        <el-button slot="reference" :loading="deleteLoading" size="mini" type="text" style="color: red"
+                            icon="el-icon-delete">删除</el-button>
+                    </el-popconfirm>
+                </template>
+            </el-table-column>
+        </el-table>
+        <!-- 翻页 -->
+        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
+            :limit.sync="queryParams.pageSize" @pagination="getList" />
+
+        <modify-mini :visible="visible" :modifyData="modifyData" @onClose="visible = false"
+            @onChange="visible = false; getList()" />
+    </div>
+</template>
+<script>
+import { getMiniList, delMinis } from "@/api/accounts/miniprogram";
+import modifyMini from './modify'
+export default {
+    components: { modifyMini },
+    data() {
+        return {
+            queryParams: {
+                pageNum: 1,
+                pageSize: 10,
+                appDesc: null,
+                appId: null,
+                appName: null,
+                appRemark: null,
+            },
+            showSearch: true,
+            total: 0,
+            loading: false,
+            miniprogramList: [],
+            visible: false,
+            modifyData: null,
+            deleteLoading: false,
+            multipleSelection: [],
+            selectIds: '',
+        }
+    },
+    created() {
+        this.getList()
+    },
+    methods: {
+        handleSelectionChange(val) {
+            this.multipleSelection = val;
+            this.selectIds = val.map(item => item.id).toString()
+        },
+        getList() {
+            this.loading = true
+            getMiniList(this.queryParams).then(response => {
+                this.loading = false
+                let data = response.data
+                this.total = data.total
+                let records = data.records
+                this.miniprogramList = records
+            }).catch(() => this.loading = false)
+        },
+        handleAdd() {
+            this.visible = true
+        },
+        /** 搜索 */
+        handleQuery() {
+            this.getList()
+        },
+        /** 搜索条件重置 */
+        resetQuery() {
+            this.resetForm("queryForm");
+            this.getList()
+        },
+        handleEdit(row) {
+            const { appName, appId, appDesc, appRemark, id } = row
+            this.modifyData = { appName, appId, appDesc, appRemark, id }
+            this.visible = true
+        },
+        handleDelete(ids) {
+            this.deleteLoading = true
+            delMinis(ids).then(() => {
+                this.deleteLoading = false
+                this.getList()
+                this.$message({
+                    message: '删除成功',
+                    type: 'success'
+                });
+            }).catch(() => this.deleteLoading = false)
+        }
+    }
+}
+</script>

+ 104 - 0
src/views/accounts/miniprogram/modify.vue

@@ -0,0 +1,104 @@
+<template>
+    <div>
+        <el-dialog :title="title" :visible.sync="visible" width="30%" :before-close="onClose">
+            <el-form :model="queryParams" :rules="rules" ref="queryParamsModify" label-position="left" label-width="100px">
+                <el-form-item label="小程序名称" prop="appName">
+                    <el-input v-model="queryParams.appName" placeholder="请输入小程序名称" clearable size="small" />
+                </el-form-item>
+                <el-form-item label="AppId" prop="appId">
+                    <el-input v-model="queryParams.appId" placeholder="请输入AppId" clearable size="small" />
+                </el-form-item>
+                <el-form-item label="小程序详情" prop="appDesc">
+                    <el-input v-model="queryParams.appDesc" placeholder="请输入小程序详情" clearable size="small" />
+                </el-form-item>
+                <el-form-item label="小程序备注" prop="appRemark">
+                    <el-input v-model="queryParams.appRemark" placeholder="请输入小程序备注" clearable size="small"
+                        type="textarea" :rows="2" />
+                </el-form-item>
+            </el-form>
+            <span slot="footer" class="dialog-footer">
+                <el-button @click="onClose()">取 消</el-button>
+                <el-button type="primary" :loading="loading" @click="submit('queryParamsModify')">确 定</el-button>
+            </span>
+        </el-dialog>
+    </div>
+</template>
+
+<script>
+import { modifyMini } from "@/api/accounts/miniprogram";
+export default {
+    data() {
+        return {
+            queryParams: {
+                appDesc: null,
+                appId: null,
+                appName: null,
+                appRemark: null,
+            },
+            title: '新增小程序',
+            rules: {
+                appName: [
+                    { required: true, message: '请输入小程序名称', trigger: 'blur' }
+                ],
+                appId: [
+                    { required: true, message: '请输入AppId', trigger: 'blur' }
+                ],
+                appDesc: [
+                    { required: true, message: '请输入小程序详情', trigger: 'blur' }
+                ]
+            },
+            loading: false
+        }
+    },
+    props: {
+        visible: {
+            type: Boolean,
+            default: false,
+        },
+        modifyData: {
+            type: Object,
+            default: null
+        }
+    },
+    watch: {
+        modifyData: {
+            handler(val) {
+                if (val && Object.keys(val).length > 0) {
+                    this.queryParams = val
+                } else {
+                    this.queryParams = {
+                        appDesc: null,
+                        appId: null,
+                        appName: null,
+                        appRemark: null,
+                    }
+                }
+            },
+            immediate: true,
+        },
+    },
+    methods: {
+        onClose() {
+            this.$emit("onClose");
+        },
+        submit(formName) {
+            this.$refs[formName].validate(async (valid) => {
+                if (valid) {
+                    this.loading = true
+                    let data = await modifyMini(this.queryParams)
+                    this.loading = false
+                    if (data.data) {
+                        this.$message({
+                            message: this.queryParams.id ? '修改成功' : '新增成功',
+                            type: 'success'
+                        });
+                        this.resetForm(formName);
+                        this.$emit("onChange");
+                    }
+                }
+            })
+        },
+
+    }
+}
+</script>