wjx 2 years ago
parent
commit
c27adf86da

+ 18 - 0
src/utils/const.js

@@ -0,0 +1,18 @@
+export const channelList = [
+    { label: 'MP', value: 'MP' },
+    { label: 'GDT', value: 'GDT' },
+    { label: '头条', value: '头条' },
+    { label: '企微', value: '企微' },
+    { label: '混投', value: '混投' },
+    { label: 'ADQ企微', value: 'ADQ企微' },
+    { label: '头条企微', value: '头条企微' },
+    { label: 'MP企微', value: 'MP企微' },
+    { label: 'ADQ公众号', value: 'ADQ公众号' },
+    { label: '直投小程序', value: '直投小程序' },
+    { label: '公众号洗粉', value: '公众号洗粉' },
+    { label: '企微洗粉', value: '企微洗粉' },
+    { label: '公众号小说内推', value: '公众号小说内推' },
+    { label: '公众号短剧内推', value: '公众号短剧内推' },
+    { label: '企微小说内推', value: '企微小说内推' },
+    { label: '企微短剧内推', value: '企微短剧内推' }
+]

+ 5 - 12
src/views/accounts/account/components/changeRecord.vue

@@ -5,8 +5,8 @@
             <div class="cut">
             <div class="cut">
                 <el-button class="button" type="primary" icon="el-icon-plus" size="mini" @click="handleCutRecord">插入起始记录</el-button>
                 <el-button class="button" type="primary" icon="el-icon-plus" size="mini" @click="handleCutRecord">插入起始记录</el-button>
                 <el-table :data="cutData" size="mini">
                 <el-table :data="cutData" size="mini">
-                    <el-table-column label="开始时间" prop="beginTime" align="center" width="90"/>
-                    <el-table-column label="结束时间" prop="endTime" align="center" width="90"/>
+                    <el-table-column label="开始时间" prop="beginTime" align="center" width="90" fixed="left"/>
+                    <el-table-column label="结束时间" prop="endTime" align="center" width="90" fixed="left"/>
                     <el-table-column label="资源名称" prop="resourceName" :show-overflow-tooltip="true" align="center" width="100">
                     <el-table-column label="资源名称" prop="resourceName" :show-overflow-tooltip="true" align="center" width="100">
                         <template slot-scope="scope" v-if="scope.row.resourceInfo">
                         <template slot-scope="scope" v-if="scope.row.resourceInfo">
                             <span>{{scope.row.resourceInfo.resourceName}}</span>
                             <span>{{scope.row.resourceInfo.resourceName}}</span>
@@ -137,16 +137,7 @@
                 </el-form-item>
                 </el-form-item>
                 <el-form-item label="投放渠道" prop="putChannel">
                 <el-form-item label="投放渠道" prop="putChannel">
                     <el-select v-model="queryPlatformCutRecord.putChannel" size="small" placeholder="选择投放渠道" filterable style="width: 140px" clearable>
                     <el-select v-model="queryPlatformCutRecord.putChannel" size="small" placeholder="选择投放渠道" filterable style="width: 140px" clearable>
-                        <el-option label="MP" value="MP" />
-                        <el-option label="GDT" value="GDT" />
-                        <el-option label="头条" value="头条" />
-                        <el-option label="企微" value="企微" />
-                        <el-option label="混投" value="混投" />
-                        <el-option label="ADQ企微" value="ADQ企微" />
-                        <el-option label="头条企微" value="头条企微" />
-                        <el-option label="MP企微" value="MP企微" />
-                        <el-option label="ADQ公众号" value="ADQ公众号" />
-                        <el-option label="直投小程序" value="直投小程序" />
+                        <el-option :label="item.label" :value="item.value" :key="item.value" v-for="item in channelList"/>
                     </el-select>
                     </el-select>
                 </el-form-item>
                 </el-form-item>
                 <el-form-item label="充值模板" prop="rechargeTemplate">
                 <el-form-item label="充值模板" prop="rechargeTemplate">
@@ -164,12 +155,14 @@
 <script>
 <script>
 import { gitCutRecordList, delCutRecord, insertCutRecord, editCutRecord } from "@/api/accounts/account";
 import { gitCutRecordList, delCutRecord, insertCutRecord, editCutRecord } from "@/api/accounts/account";
 import { getBookAcc } from "@/api/system/books";
 import { getBookAcc } from "@/api/system/books";
+import { channelList } from "@/utils/const.js";
 export default {
 export default {
     data () {
     data () {
         return {
         return {
             cutData: [],
             cutData: [],
             cutTitle: '',
             cutTitle: '',
             showCut: false,
             showCut: false,
+            channelList: channelList,
             cutQueryPlatForm: {
             cutQueryPlatForm: {
                 pageNum: 1,
                 pageNum: 1,
                 pageSize: 10
                 pageSize: 10

+ 3 - 10
src/views/accounts/account/components/cutBook.vue

@@ -41,16 +41,7 @@
                 </el-form-item>
                 </el-form-item>
                 <el-form-item label="投放渠道" prop="putChannel">
                 <el-form-item label="投放渠道" prop="putChannel">
                     <el-select v-model="queryPlatform.putChannel" size="small" placeholder="选择投放渠道" filterable>
                     <el-select v-model="queryPlatform.putChannel" size="small" placeholder="选择投放渠道" filterable>
-                        <el-option label="MP" value="MP" />
-                        <el-option label="GDT" value="GDT" />
-                        <el-option label="头条" value="头条" />
-                        <el-option label="企微" value="企微" />
-                        <el-option label="混投" value="混投" />
-                        <el-option label="ADQ企微" value="ADQ企微" />
-                        <el-option label="头条企微" value="头条企微" />
-                        <el-option label="MP企微" value="MP企微" />
-                        <el-option label="ADQ公众号" value="ADQ公众号" />
-                        <el-option label="直投小程序" value="直投小程序" />
+                        <el-option :label="item.label" :value="item.value" :key="item.value" v-for="item in channelList"/>
                     </el-select>
                     </el-select>
                 </el-form-item>
                 </el-form-item>
                 <el-form-item label="充值模板" prop="rechargeTemplate">
                 <el-form-item label="充值模板" prop="rechargeTemplate">
@@ -71,11 +62,13 @@
 import { getBookAcc } from "@/api/system/books";
 import { getBookAcc } from "@/api/system/books";
 import { cutBookPlatform, checkTime } from "@/api/accounts/account";
 import { cutBookPlatform, checkTime } from "@/api/accounts/account";
 import { formatDateYMD } from "@/utils"
 import { formatDateYMD } from "@/utils"
+import { channelList } from "@/utils/const.js"
 export default {
 export default {
     data () {
     data () {
         return {
         return {
             title: '',
             title: '',
             open: false,
             open: false,
+            channelList: channelList,
             accList: [],  // 账号
             accList: [],  // 账号
             queryPlatform: {},
             queryPlatform: {},
             rules: {
             rules: {

+ 4 - 38
src/views/accounts/account/index.vue

@@ -45,17 +45,6 @@
             <el-col :span="1.5">
             <el-col :span="1.5">
                 <el-button type="success" icon="el-icon-refresh" size="mini" @click="handleRefresh">刷新服务器缓存</el-button>
                 <el-button type="success" icon="el-icon-refresh" size="mini" @click="handleRefresh">刷新服务器缓存</el-button>
             </el-col>
             </el-col>
-            <el-col :span="1.5">
-                <el-button type="danger" icon="el-icon-delete-solid" size="mini" :disabled="delIds.length == 0" @click="handleDel">删除</el-button>
-            </el-col>
-            <!-- <el-col :span="1.5">
-                <el-button
-                    type="info"
-                    icon="el-icon-upload2"
-                    size="mini"
-                    @click="handleImport"
-                    >导入</el-button>
-            </el-col> -->
             <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
             <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
         </el-row>
         </el-row>
 
 
@@ -314,16 +303,7 @@
                 </el-form-item>
                 </el-form-item>
                 <el-form-item label="投放渠道" prop="putChannel" v-if="isAdd">
                 <el-form-item label="投放渠道" prop="putChannel" v-if="isAdd">
                     <el-select v-model="queryPlatform.putChannel" size="small" placeholder="选择投放渠道" filterable style="width: 140px" clearable>
                     <el-select v-model="queryPlatform.putChannel" size="small" placeholder="选择投放渠道" filterable style="width: 140px" clearable>
-                        <el-option label="MP" value="MP" />
-                        <el-option label="GDT" value="GDT" />
-                        <el-option label="头条" value="头条" />
-                        <el-option label="企微" value="企微" />
-                        <el-option label="混投" value="混投" />
-                        <el-option label="ADQ企微" value="ADQ企微" />
-                        <el-option label="头条企微" value="头条企微" />
-                        <el-option label="MP企微" value="MP企微" />
-                        <el-option label="ADQ公众号" value="ADQ公众号" />
-                        <el-option label="直投小程序" value="直投小程序" />
+                        <el-option :label="item.label" :value="item.value" :key="item.value" v-for="item in channelList"/>
                     </el-select>
                     </el-select>
                 </el-form-item>
                 </el-form-item>
                 <el-form-item label="充值模板" prop="rechargeTemplate" v-if="isAdd">
                 <el-form-item label="充值模板" prop="rechargeTemplate" v-if="isAdd">
@@ -452,12 +432,13 @@
 </template>
 </template>
 
 
 <script>
 <script>
-import { getResourceList, addResource, delResource,
+import { getResourceList, addResource,
     editResource, addGroup, getGroupAllList, refreshCache,
     editResource, addGroup, getGroupAllList, refreshCache,
     delGroup, editGroup, editAccountGroup, assignResourceUser, getRoleAll } from "@/api/accounts/account";
     delGroup, editGroup, editAccountGroup, assignResourceUser, getRoleAll } from "@/api/accounts/account";
 import { allUser } from "@/api/system/user";
 import { allUser } from "@/api/system/user";
 import { getToken } from "@/utils/auth";
 import { getToken } from "@/utils/auth";
 import { Copy } from "@/utils";
 import { Copy } from "@/utils";
+import { channelList } from "@/utils/const.js";
 import { getBusinessGroupAll } from "@/api/admin/teams";
 import { getBusinessGroupAll } from "@/api/admin/teams";
 import { getPeriodAll } from "@/api/accounts/period";
 import { getPeriodAll } from "@/api/accounts/period";
 import { getBookPlatInfoAll } from "@/api/accounts/bookCity";
 import { getBookPlatInfoAll } from "@/api/accounts/bookCity";
@@ -470,6 +451,7 @@ export default {
     data() {
     data() {
         return {
         return {
             loading: false,
             loading: false,
+            channelList: channelList,
             upload: {
             upload: {
                 // 是否显示弹出层(用户导入)
                 // 是否显示弹出层(用户导入)
                 open: false,
                 open: false,
@@ -836,22 +818,6 @@ export default {
         handleSelectionChange(selection) {
         handleSelectionChange(selection) {
             this.delIds = selection.map((item) => item.id)
             this.delIds = selection.map((item) => item.id)
         },
         },
-        // 删除
-        handleDel() {
-            this.$confirm('确定删除?', '删除', {
-                distinguishCancelAndClose: true,
-                confirmButtonText: '确定',
-                cancelButtonText: '取消'
-            }).then(() => {
-                delResource(this.delIds.toString()).then(res => {
-                    if(res.data) {
-                        this.msgSuccess('删除成功');
-                        this.getList()
-                    }
-                })
-            })
-            
-        },
         /** 时间转换 */
         /** 时间转换 */
         parserTime(time){
         parserTime(time){
             const d = new Date(time)
             const d = new Date(time)

+ 3 - 10
src/views/accounts/account/use.vue

@@ -362,16 +362,7 @@
         <el-form-item label="投放渠道" prop="putChannel" v-if="isAdd">
         <el-form-item label="投放渠道" prop="putChannel" v-if="isAdd">
           <el-select v-model="queryPlatform.putChannel" size="small" placeholder="选择投放渠道" filterable style="width: 140px"
           <el-select v-model="queryPlatform.putChannel" size="small" placeholder="选择投放渠道" filterable style="width: 140px"
             clearable>
             clearable>
-            <el-option label="MP" value="MP" />
-            <el-option label="GDT" value="GDT" />
-            <el-option label="头条" value="头条" />
-            <el-option label="企微" value="企微" />
-            <el-option label="混投" value="混投" />
-            <el-option label="ADQ企微" value="ADQ企微" />
-            <el-option label="头条企微" value="头条企微" />
-            <el-option label="MP企微" value="MP企微" />
-            <el-option label="ADQ公众号" value="ADQ公众号" />
-            <el-option label="直投小程序" value="直投小程序" />
+            <el-option :label="item.label" :value="item.value" :key="item.value" v-for="item in channelList"/>
           </el-select>
           </el-select>
         </el-form-item>
         </el-form-item>
         <el-form-item label="充值模板" prop="rechargeTemplate" v-if="isAdd">
         <el-form-item label="充值模板" prop="rechargeTemplate" v-if="isAdd">
@@ -490,6 +481,7 @@ import { getAccount, getAccountList, addAccount, editAccount, addGroup, getGroup
 import { allUser } from "@/api/system/user";
 import { allUser } from "@/api/system/user";
 import { getAllBook } from "@/api/system/books";
 import { getAllBook } from "@/api/system/books";
 import { Copy } from "@/utils";
 import { Copy } from "@/utils";
+import { channelList } from "@/utils/const.js";
 import AccountUpdate from "./components/accountUpdate.vue";
 import AccountUpdate from "./components/accountUpdate.vue";
 import { getPeriodAll } from "@/api/accounts/period";
 import { getPeriodAll } from "@/api/accounts/period";
 import { getBookPlatInfoAll } from "@/api/accounts/bookCity";
 import { getBookPlatInfoAll } from "@/api/accounts/bookCity";
@@ -504,6 +496,7 @@ export default {
     return {
     return {
       groupValue: "",
       groupValue: "",
       newGroupName: "",
       newGroupName: "",
+      channelList: channelList,
       queryParams: {
       queryParams: {
         pageNum: 1,
         pageNum: 1,
         pageSize: 10
         pageSize: 10

+ 14 - 3
src/views/accounts/corpWechat/index.vue

@@ -83,6 +83,7 @@
                     }}</a>
                     }}</a>
                 </template>
                 </template>
             </el-table-column>
             </el-table-column>
+            <el-table-column label="授权时间" prop="createTime" width="130" :show-overflow-tooltip="true" />
             <el-table-column label="备注" prop="remark" width="250" :show-overflow-tooltip="true" />
             <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" align="center" class-name="small-padding fixed-width" fixed="right">
                 <template slot-scope="scope">
                 <template slot-scope="scope">
@@ -111,7 +112,7 @@
         <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
         <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
             @pagination="getList" />
             @pagination="getList" />
 
 
-        <setSecret :value="secretData" :visible="setShow" @close="setShow = false; secretData = {}"
+        <setSecret :value="secretData" :visible="setShow" @close="setShow = false; secretData = { bookAgentIdMap: [] }"
             @change="closeSetSecret(); getList()" />
             @change="closeSetSecret(); getList()" />
         <mailList :corpId="corpId" :visible="mailShow" @close="mailShow = false; corpId = null" />
         <mailList :corpId="corpId" :visible="mailShow" @close="mailShow = false; corpId = null" />
     </div>
     </div>
@@ -138,7 +139,9 @@ export default {
             corpList: [],
             corpList: [],
             total: 0,
             total: 0,
             setShow: false,
             setShow: false,
-            secretData: {},
+            secretData: {
+                bookAgentIdMap: []
+            },
             mailShow: false,
             mailShow: false,
             corpId: null,
             corpId: null,
         }
         }
@@ -242,9 +245,17 @@ export default {
                 corpId: row.corpId,
                 corpId: row.corpId,
                 originCorpId: row.originCorpId,
                 originCorpId: row.originCorpId,
                 externalUserSecret: row.externalUserSecret,
                 externalUserSecret: row.externalUserSecret,
-                bookAgentId: row.bookAgentId,
+                bookAgentIdMap: [],
                 remark: row.remark
                 remark: row.remark
             }
             }
+            if (row.bookAgentIdMap && Object.keys(row.bookAgentIdMap).length > 0) {
+                this.secretData.bookAgentIdMap = Object.keys(row.bookAgentIdMap).map(key => {
+                    return {
+                        bookCityId: key,
+                        bookAgentId: row.bookAgentIdMap[key]
+                    }
+                })
+            }
         },
         },
         /** 关闭配置 */
         /** 关闭配置 */
         closeSetSecret() {
         closeSetSecret() {

+ 15 - 7
src/views/accounts/corpWechat/mailList.vue

@@ -8,14 +8,18 @@
                 </el-col>
                 </el-col>
                 <el-col :span="1.5"><el-button type="cyan" icon="el-icon-search" size="mini"
                 <el-col :span="1.5"><el-button type="cyan" icon="el-icon-search" size="mini"
                         @click="getList">搜索</el-button></el-col>
                         @click="getList">搜索</el-button></el-col>
+                <el-col :span="1.5"><el-button size="mini" type="primary" icon="el-icon-sort"
+                        :disabled="corpUserIds.length === 0"
+                        @click="handlePut({ corpUserIds: corpUserIds })">批量指派</el-button></el-col>
                 <el-col :span="1.5">
                 <el-col :span="1.5">
                     <div class="grid-content">
                     <div class="grid-content">
                         <el-button type="primary" size="mini" @click="syncHandle">同步通讯录</el-button>
                         <el-button type="primary" size="mini" @click="syncHandle">同步通讯录</el-button>
                     </div>
                     </div>
                 </el-col>
                 </el-col>
             </el-row>
             </el-row>
-            <el-table :data="mailList" v-loading="loading" size="mini">
-                <el-table-column label="企微号ID" prop="corpUserId" width="140" align="center" :show-overflow-tooltip="true"/>
+            <el-table :data="mailList" v-loading="loading" size="mini" @selection-change="handleSelectionChange">
+                <el-table-column type="selection" width="50" align="center" fixed="left" />
+                <el-table-column label="企微号ID" prop="corpUserId" width="140" align="center" :show-overflow-tooltip="true" />
                 <el-table-column label="企微号" prop="name" width="120" align="center" />
                 <el-table-column label="企微号" prop="name" width="120" align="center" />
                 <el-table-column label="运营" prop="operUserId" align="center" width="100">
                 <el-table-column label="运营" prop="operUserId" align="center" width="100">
                     <template slot-scope="scope">
                     <template slot-scope="scope">
@@ -71,11 +75,11 @@
             </el-form>
             </el-form>
             <span slot="footer" class="dialog-footer">
             <span slot="footer" class="dialog-footer">
                 <el-button @click="openSys = false; assignUSerData = {}">取 消</el-button>
                 <el-button @click="openSys = false; assignUSerData = {}">取 消</el-button>
-                <el-button type="primary" @click="assignUSerSubmit">确 定</el-button>
+                <el-button type="primary" @click=" assignUSerSubmit ">确 定</el-button>
             </span>
             </span>
         </el-dialog>
         </el-dialog>
-        <changeRecord :visible="recordShow" :recordData="recordData" :userAll="userAll"
-            @close="recordShow = false; recordData = {}" />
+        <changeRecord :visible=" recordShow " :recordData=" recordData " :userAll=" userAll "
+            @close=" recordShow = false; recordData = {} " />
     </div>
     </div>
 </template>
 </template>
 
 
@@ -111,7 +115,8 @@ export default {
                 ],
                 ],
             },
             },
             recordShow: false,
             recordShow: false,
-            recordData: {}
+            recordData: {},
+            corpUserIds: []
         }
         }
     },
     },
     props: {
     props: {
@@ -138,6 +143,9 @@ export default {
         },
         },
     },
     },
     methods: {
     methods: {
+        handleSelectionChange(selection) {
+            this.corpUserIds = selection.map((item) => item.corpUserId)
+        },
         // 变更记录
         // 变更记录
         handleRecord(row) {
         handleRecord(row) {
             this.recordShow = true
             this.recordShow = true
@@ -151,7 +159,7 @@ export default {
                 operUserId: row.operUserId,
                 operUserId: row.operUserId,
                 putUserId: row.putUserId,
                 putUserId: row.putUserId,
                 corpId: this.corpId,
                 corpId: this.corpId,
-                corpUserId: row.corpUserId
+                corpUserIds: row.corpUserId ? [row.corpUserId] : row.corpUserIds
             }
             }
         },
         },
         assignUSerSubmit() {
         assignUSerSubmit() {

+ 145 - 35
src/views/accounts/corpWechat/setSecret.vue

@@ -1,5 +1,5 @@
 <template>
 <template>
-    <el-dialog :title="title" :visible.sync="visible" width="380px">
+    <el-dialog :title="title" :visible.sync="visible" width="450px" :before-close="onClose">
         <el-form :model="queryForm" ref="setSecret" :rules="rules">
         <el-form :model="queryForm" ref="setSecret" :rules="rules">
             <el-form-item label="企微ID" prop="originCorpId">
             <el-form-item label="企微ID" prop="originCorpId">
                 <el-input v-model.number="queryForm.originCorpId" placeholder="请输入企微ID" clearable size="small" />
                 <el-input v-model.number="queryForm.originCorpId" placeholder="请输入企微ID" clearable size="small" />
@@ -7,9 +7,37 @@
             <el-form-item label="客户密钥" prop="externalUserSecret">
             <el-form-item label="客户密钥" prop="externalUserSecret">
                 <el-input v-model="queryForm.externalUserSecret" placeholder="请输入客户密钥" clearable size="small" />
                 <el-input v-model="queryForm.externalUserSecret" placeholder="请输入客户密钥" clearable size="small" />
             </el-form-item>
             </el-form-item>
-            <el-form-item label="书城应用ID" prop="bookAgentId">
+            <!-- <el-form-item label="书城应用ID" prop="bookAgentId">
                 <el-input v-model.number="queryForm.bookAgentId" placeholder="请输入书城应用ID" clearable size="small" />
                 <el-input v-model.number="queryForm.bookAgentId" placeholder="请输入书城应用ID" clearable size="small" />
-            </el-form-item>
+            </el-form-item> -->
+            <div>
+                <el-form :model="item" :rules="rulesBookCityType" ref="bookCityType" label-width="80px" label-position="top"
+                    v-for="(item, index) in queryPlatformBookCity" :key="index">
+                    <el-row :gutter="20">
+                        <el-col :span="8">
+                            <el-form-item label="书城" prop="bookCityId">
+                                <el-select v-model="item.bookCityId" size="small" placeholder="选择书城" filterable clearable>
+                                    <el-option v-for="item in bookCity" :disabled="item.disabled" :key="item.id" :label="item.platformName"
+                                        :value="item.platformKey" />
+                                </el-select>
+                            </el-form-item>
+                        </el-col>
+                        <el-col :span="12">
+                            <el-form-item label="书城应用ID" prop="bookAgentId">
+                                <el-input v-model.number="item.bookAgentId" placeholder="请输入书城应用ID" clearable
+                                    size="small" />
+                            </el-form-item>
+                        </el-col>
+                        <el-col :span="2">
+                            <div style="margin-top: 42px">
+                                <el-button @click.prevent="removeResource(index)" type="text" icon="el-icon-delete"
+                                    style="color: red; margin-left: 10px"></el-button>
+                            </div>
+                        </el-col>
+                    </el-row>
+                </el-form>
+                <el-button type="text" icon="el-icon-plus" @click="addResource">新增书城</el-button>
+            </div>
             <el-form-item label="备注" prop="remark">
             <el-form-item label="备注" prop="remark">
                 <el-input type="textarea" v-model="queryForm.remark" placeholder="请输入备注" clearable size="small" />
                 <el-input type="textarea" v-model="queryForm.remark" placeholder="请输入备注" clearable size="small" />
             </el-form-item>
             </el-form-item>
@@ -23,6 +51,7 @@
 </template>
 </template>
 <script>
 <script>
 import { refreshCorp } from "@/api/accounts/corpWeChat";
 import { refreshCorp } from "@/api/accounts/corpWeChat";
+import { getBookPlatInfoAll } from "@/api/accounts/bookCity";
 export default {
 export default {
     name: 'setSecret',
     name: 'setSecret',
     data() {
     data() {
@@ -38,7 +67,18 @@ export default {
             },
             },
             queryForm: {
             queryForm: {
 
 
-            }
+            },
+            queryPlatformBookCity: [],
+            rulesBookCityType: {
+                bookCityId: [
+                    { required: true, message: '请选择书城', trigger: 'change' }
+                ],
+                bookAgentId: [
+                    { required: true, message: '请输入书城应用ID', trigger: 'change' }
+                ]
+            },
+            bookCity: [],
+            bookCityCS: [],
         }
         }
     },
     },
     props: {
     props: {
@@ -53,48 +93,118 @@ export default {
         }
         }
     },
     },
     watch: {
     watch: {
+        visible: {
+            handler(val) {
+                console.log('11111-->', val)
+            },
+            immediate: true,
+        },
         value: {
         value: {
             handler(val) {
             handler(val) {
-                this.queryForm = val
+                let { bookAgentIdMap, ...data } = val
+                this.queryForm = data
+                this.queryPlatformBookCity = bookAgentIdMap
             },
             },
             immediate: true,
             immediate: true,
         },
         },
+        queryPlatformBookCity: {
+            handler(val) {
+                if (val.length > 0) {
+                    let data = this.bookCityCS.map(item => {
+                        if (val.some(i => i.bookCityId === item.platformKey)) {
+                            return { ...item, disabled: true }
+                        }
+                        return { ...item, disabled: false }
+                    })
+                    this.bookCity = data
+                } else {
+                    this.bookCity = this.bookCityCS
+                }
+            },
+            deep: true,
+            immediate: false,
+        }
+    },
+    created() {
+        this.getAllData()
     },
     },
     methods: {
     methods: {
+        /** 新增用户 */
+        addResource() {
+            let oldData = JSON.parse(JSON.stringify(this.queryPlatformBookCity))
+            oldData.push({
+                bookCityId: null,
+                bookAgentId: null
+            })
+            this.queryPlatformBookCity = oldData
+        },
+        /** 删除用户 */
+        removeResource(index) {
+            this.queryPlatformBookCity.splice(index, 1)
+        },
+        getAllData() {
+            // 获取所有书城
+            getBookPlatInfoAll().then(res => {
+                this.bookCity = res.data
+                this.bookCityCS = res.data
+            })
+        },
         onClose() {
         onClose() {
             this.$emit("close");
             this.$emit("close");
         },
         },
+        stateHandle(ref) {
+            return new Promise((resolve) => {
+                ref.validate(valid => resolve(valid))
+            })
+        },
         onSubmit() {
         onSubmit() {
-            this.$refs['setSecret'].validate((valid) => {
+            this.$refs['setSecret'].validate(async (valid) => {
                 if (valid) {
                 if (valid) {
-                    console.log('=======>', this.queryForm);
-                    const loading = this.$loading({
-                        lock: true,
-                        text: 'Loading',
-                        spinner: 'el-icon-loading',
-                        background: 'rgba(0, 0, 0, 0.7)'
-                    });
-                    refreshCorp(this.queryForm).then(res => {
-                        const h = this.$createElement;
-                        this.$msgbox({
-                            customClass: 'boxsss',
-                            title: '配置成功',
-                            closeOnPressEscape: false,
-                            closeOnClickModal: false,
-                            closeOnHashChange: false,
-                            showClose: false,
-                            message: h('div', null, [
-                                h('div', { style: { 'overflow': 'hidden' } }, `URL: ${res.data.externalUserCallbackUrl}`),
-                                h('div', null, `AESKey: ${res.data.aesKey}`),
-                                h('div', null, `Token: ${res.data.token}`),
-                            ]),
-                            confirmButtonText: '确定'
-                        }).then(action => {
-                            this.$emit("change");
-                            loading.close()
+                    let isOk = true
+                    if (this.$refs['bookCityType']) {
+                        let state = this.$refs['bookCityType'].map(async item => {
+                            return await this.stateHandle(item)
+                        })
+                        let okList = await Promise.all(state)
+                        if (okList.every(item => item)) {
+                            isOk = true
+                        } else {
+                            isOk = false
+                        }
+                    }
+                    if (isOk) {
+                        let bookAgentIdMap = {}
+                        this.queryPlatformBookCity.forEach(item => {
+                            bookAgentIdMap[item.bookCityId] = item.bookAgentId
+                        })
+                        const loading = this.$loading({
+                            lock: true,
+                            text: 'Loading',
+                            spinner: 'el-icon-loading',
+                            background: 'rgba(0, 0, 0, 0.7)'
                         });
                         });
+                        refreshCorp({ ...this.queryForm, bookAgentIdMap }).then(res => {
+                            const h = this.$createElement;
+                            this.$msgbox({
+                                customClass: 'boxsss',
+                                title: '配置成功',
+                                closeOnPressEscape: false,
+                                closeOnClickModal: false,
+                                closeOnHashChange: false,
+                                showClose: false,
+                                message: h('div', null, [
+                                    h('div', { style: { 'overflow': 'hidden' } }, `URL: ${res.data.externalUserCallbackUrl}`),
+                                    h('div', null, `AESKey: ${res.data.aesKey}`),
+                                    h('div', null, `Token: ${res.data.token}`),
+                                ]),
+                                confirmButtonText: '确定'
+                            }).then(action => {
+                                this.$emit("change");
+                                loading.close()
+                            });
 
 
-                    }).catch(() => loading.close())
+                        }).catch(() => loading.close())
+                    }
                 }
                 }
             })
             })
         }
         }
@@ -102,7 +212,7 @@ export default {
 }
 }
 </script>
 </script>
 <style>
 <style>
-    .boxsss {
-        width: 600px !important;
-    }
+.boxsss {
+    width: 600px !important;
+}
 </style>
 </style>