wjx 1 year ago
parent
commit
1482c4e86d

+ 4 - 3
src/api/accounts/ttAdapi.js

@@ -139,9 +139,10 @@ export function refreshUser(adAppId, authUserId) {
  * @param {*} putUserId 
  * @param {*} putUserId 
  * @returns 
  * @returns 
  */
  */
-export function putUser(authUserId, accountId, putUserId) {
+export function putUser(data) {
     return request({
     return request({
-        url: `/oceanengine/admin/adAccount/configPutUser/${authUserId}/${accountId}/${putUserId}`,
-        method: 'PUT'
+        url: `/oceanengine/admin/adAccount/configPutUser`,
+        method: 'PUT',
+        data
     })
     })
 }
 }

+ 37 - 53
src/views/accounts/period/index.vue

@@ -1,67 +1,46 @@
 <template>
 <template>
     <div class="app-container">
     <div class="app-container">
-        
+
         <el-row :gutter="10" class="mb8">
         <el-row :gutter="10" class="mb8">
+            <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
+                <el-form-item label="期数名称" prop="period">
+                    <el-input v-model="queryParams.period" placeholder="请输入期数名称" clearable size="small" style="width: 140px"
+                        @keyup.enter.native="getList()" />
+                </el-form-item>
+                <el-form-item>
+                    <el-button type="cyan" icon="el-icon-search" size="mini" @click="getList()">搜索</el-button>
+                    <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+                </el-form-item>
+            </el-form>
             <el-col :span="1.5">
             <el-col :span="1.5">
-                <el-button
-                    type="primary"
-                    icon="el-icon-plus"
-                    size="mini"
-                    @click="handleAdd"
-                >添加</el-button>
+                <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd">添加</el-button>
             </el-col>
             </el-col>
+
         </el-row>
         </el-row>
 
 
         <el-table :data="periodList">
         <el-table :data="periodList">
-            <el-table-column label="ID" prop="id" align="center" width="120"/>
-            <el-table-column label="期数" prop="period" align="center" width="350"/>
+            <el-table-column label="ID" prop="id" align="center" width="120" />
+            <el-table-column label="期数" prop="period" align="center" width="350" />
             <el-table-column label="操作">
             <el-table-column label="操作">
                 <template slot-scope="scope">
                 <template slot-scope="scope">
-                    <el-button
-                        size="mini"
-                        type="text"
-                        icon="el-icon-edit"
-                        @click="handleEdit(scope.row)"
-                    >编辑</el-button>
+                    <el-button size="mini" type="text" icon="el-icon-edit" @click="handleEdit(scope.row)">编辑</el-button>
                     <div style="display: inline-block;width: 10px"></div>
                     <div style="display: inline-block;width: 10px"></div>
-                    <el-popconfirm
-                        title="确定删除吗?"
-                        @confirm="handleDelete(scope.row)"
-                    >
-                        <el-button
-                            slot="reference"
-                            size="mini"
-                            type="text"
-                            icon="el-icon-delete"
-                        >删除</el-button>
+                    <el-popconfirm title="确定删除吗?" @confirm="handleDelete(scope.row)">
+                        <el-button slot="reference" size="mini" type="text" icon="el-icon-delete">删除</el-button>
                     </el-popconfirm>
                     </el-popconfirm>
                 </template>
                 </template>
-            </el-table-column>    
+            </el-table-column>
         </el-table>
         </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" />
 
 
         <!-- 添加弹窗 -->
         <!-- 添加弹窗 -->
-        <el-dialog 
-            :title="isAdd ? '添加期数' : '编辑期数'" 
-            :visible.sync="openEdit" 
-            width="400px"
-            @close="dialogClose"
-            >
+        <el-dialog :title="isAdd ? '添加期数' : '编辑期数'" :visible.sync="openEdit" width="400px" @close="dialogClose">
             <el-form :model="queryPlatform" :rules="rules" ref="platForm">
             <el-form :model="queryPlatform" :rules="rules" ref="platForm">
                 <el-form-item label="期数名称" prop="period">
                 <el-form-item label="期数名称" prop="period">
-                    <el-input
-                        clearable
-                        size="small"
-                        v-model="queryPlatform.period"
-                    />
+                    <el-input clearable size="small" v-model="queryPlatform.period" />
                 </el-form-item>
                 </el-form-item>
             </el-form>
             </el-form>
             <span slot="footer" class="dialog-footer">
             <span slot="footer" class="dialog-footer">
@@ -99,6 +78,11 @@ export default {
         this.getList()
         this.getList()
     },
     },
     methods: {
     methods: {
+        /** 重置按钮操作 */
+        resetQuery() {
+            this.resetForm("queryForm");
+            this.getList();
+        },
         /** 期数新增 */
         /** 期数新增 */
         handleAdd() {
         handleAdd() {
             this.isAdd = true
             this.isAdd = true
@@ -115,12 +99,12 @@ export default {
         handleEdit(value) {
         handleEdit(value) {
             this.openEdit = true
             this.openEdit = true
             this.isAdd = false
             this.isAdd = false
-            this.queryPlatform = {...value}
+            this.queryPlatform = { ...value }
         },
         },
         /** 列表删除 */
         /** 列表删除 */
         handleDelete(value) {
         handleDelete(value) {
             delPeriod(value.id).then(response => {
             delPeriod(value.id).then(response => {
-                if(response.data){
+                if (response.data) {
                     this.msgSuccess("删除成功");
                     this.msgSuccess("删除成功");
                     this.getList()
                     this.getList()
                 }
                 }
@@ -130,11 +114,11 @@ export default {
         submitForm(formName) {
         submitForm(formName) {
             this.$refs[formName].validate((valid) => {
             this.$refs[formName].validate((valid) => {
                 if (valid) {
                 if (valid) {
-                    if(this.isAdd) {
-                        
+                    if (this.isAdd) {
+
                         addPeriod(this.queryPlatform).then(response => {
                         addPeriod(this.queryPlatform).then(response => {
                             this.openEdit = false
                             this.openEdit = false
-                            if(response.data){
+                            if (response.data) {
                                 this.msgSuccess("添加成功");
                                 this.msgSuccess("添加成功");
                                 this.getList()
                                 this.getList()
                                 this.queryPlatform = {
                                 this.queryPlatform = {
@@ -145,11 +129,11 @@ export default {
                             this.openEdit = false
                             this.openEdit = false
                         });
                         });
 
 
-                    }else {
+                    } else {
                         console.log(this.queryPlatform)
                         console.log(this.queryPlatform)
                         editPeriod(this.queryPlatform).then(response => {
                         editPeriod(this.queryPlatform).then(response => {
                             this.openEdit = false
                             this.openEdit = false
-                            if(response.data){
+                            if (response.data) {
                                 this.msgSuccess("修改成功");
                                 this.msgSuccess("修改成功");
                                 this.getList()
                                 this.getList()
                             }
                             }
@@ -157,7 +141,7 @@ export default {
                             this.openEdit = false
                             this.openEdit = false
                         });
                         });
                     }
                     }
-                    
+
 
 
                 } else {
                 } else {
                     return false;
                     return false;
@@ -166,7 +150,7 @@ export default {
         },
         },
         /** 弹窗关闭触发 */
         /** 弹窗关闭触发 */
         dialogClose() {
         dialogClose() {
-            if(!this.isAdd){
+            if (!this.isAdd) {
                 this.queryPlatform = {
                 this.queryPlatform = {
                     period: ''
                     period: ''
                 }
                 }

+ 56 - 3
src/views/accounts/ttAdWarrant/lookAccountButton.vue

@@ -10,12 +10,28 @@
                 <el-col :span="1.5">
                 <el-col :span="1.5">
                     <el-button type="cyan" icon="el-icon-search" @click="getList">搜索</el-button>
                     <el-button type="cyan" icon="el-icon-search" @click="getList">搜索</el-button>
                 </el-col>
                 </el-col>
+                <el-col :span="1.5">
+                    <el-button type="primary" icon="el-icon-sort" @click="putuser"
+                        :disabled="adAccountList.length === 0">批量指派</el-button>
+                </el-col>
             </el-row>
             </el-row>
-            <el-table :data="accountList" :loading="loading">
+            <el-table :data="accountList" ref="multipleTable" :loading="loading" @selection-change="handleSelectionChange">
+                <el-table-column type="selection" width="50" align="center" />
                 <el-table-column label="账号ID" prop="accountId" align="center" fixed width="150"
                 <el-table-column label="账号ID" prop="accountId" align="center" fixed width="150"
                     :show-overflow-tooltip="true" />
                     :show-overflow-tooltip="true" />
                 <el-table-column label="账号名称" prop="accountName" align="center" :show-overflow-tooltip="true" width="300" />
                 <el-table-column label="账号名称" prop="accountName" align="center" :show-overflow-tooltip="true" width="300" />
+                <el-table-column label="投手" prop="putUser" align="center" width="120" :show-overflow-tooltip="true">
+                    <template slot-scope="scope">
+                        <span v-if="scope.row.putUser">{{ scope.row.putUser.nickName }}</span>
+                    </template>
+                </el-table-column>
                 <el-table-column label="投手ID" prop="putUserId" align="center" width="120" :show-overflow-tooltip="true" />
                 <el-table-column label="投手ID" prop="putUserId" align="center" width="120" :show-overflow-tooltip="true" />
+                <el-table-column label="运营账号" prop="operationUserList" align="center" width="120"
+                    :show-overflow-tooltip="true">
+                    <template slot-scope="scope">
+                        <span>{{ scope.row.operationUserList | filterUser }}</span>
+                    </template>
+                </el-table-column>
                 <el-table-column label="所属组" prop="groupName" align="center" width="120" :show-overflow-tooltip="true" />
                 <el-table-column label="所属组" prop="groupName" align="center" width="120" :show-overflow-tooltip="true" />
                 <el-table-column label="Enabled?" prop="enabled" align="center" width="80">
                 <el-table-column label="Enabled?" prop="enabled" align="center" width="80">
                     <template slot-scope="scope">
                     <template slot-scope="scope">
@@ -32,14 +48,17 @@
             </el-table>
             </el-table>
             <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
             <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
                 :limit.sync="queryParams.pageSize" @pagination="getList" />
                 :limit.sync="queryParams.pageSize" @pagination="getList" />
+
+            <putUser :visible="putuserVisible" :adAccountList="adAccountList" @onChange="getList()" @onClose="onClose()" />
         </el-dialog>
         </el-dialog>
     </el-button>
     </el-button>
 </template>
 </template>
 <script>
 <script>
 import { getAdAccountList } from "@/api/accounts/ttAdapi";
 import { getAdAccountList } from "@/api/accounts/ttAdapi";
 import putUserButton from "./putUserButton.vue"
 import putUserButton from "./putUserButton.vue"
+import putUser from "./putUser.vue"
 export default {
 export default {
-    components: { putUserButton },
+    components: { putUserButton, putUser },
     data() {
     data() {
         return {
         return {
             visible: false,
             visible: false,
@@ -49,7 +68,18 @@ export default {
                 pageSize: 10,
                 pageSize: 10,
             },
             },
             accountList: [],
             accountList: [],
-            total: 0
+            total: 0,
+            ids: [],
+            adAccountList: [],
+            putuserVisible: false
+        }
+    },
+    filters: {
+        filterUser(val) {
+            if (val && val.length > 0) {
+                return val.map(item => item.nickname).toString()
+            }
+            return '-1'
         }
         }
     },
     },
     props: {
     props: {
@@ -63,12 +93,35 @@ export default {
         }
         }
     },
     },
     methods: {
     methods: {
+        onClose() {
+            this.putuserVisible = false
+            // this.$nextTick(() => {
+            //     this.adAccountList = []
+            //     this.ids = []
+            //     this.$refs.multipleTable.clearSelection();
+            // })
+        },
+        // 批量指派
+        putuser() {
+            this.putuserVisible = true
+        },
+        handleSelectionChange(selection) {
+            console.log(selection)
+            this.adAccountList = selection.map(item => ({ accountId: item.accountId, authUserId: this.authUserId }));
+            this.ids = selection.map(item => item.accountId);
+        },
         lookHangdle() {
         lookHangdle() {
             this.visible = true
             this.visible = true
             this.queryParams.pageNum = 1
             this.queryParams.pageNum = 1
             this.getList()
             this.getList()
         },
         },
         getList() {
         getList() {
+            this.$nextTick(() => {
+                this.adAccountList = []
+                this.ids = []
+                this.$refs.multipleTable.clearSelection();
+            })
+
             if (this.adAppId && this.authUserId) {
             if (this.adAppId && this.authUserId) {
                 let params = { ...this.queryParams, adAppId: this.adAppId, authUserId: this.authUserId, accountIds: this.queryParams.accountIds ? this.queryParams.accountIds.split(/[,,\n\s]+/ig) : [] }
                 let params = { ...this.queryParams, adAppId: this.adAppId, authUserId: this.authUserId, accountIds: this.queryParams.accountIds ? this.queryParams.accountIds.split(/[,,\n\s]+/ig) : [] }
                 this.loading = true
                 this.loading = true

+ 83 - 0
src/views/accounts/ttAdWarrant/putUser.vue

@@ -0,0 +1,83 @@
+<template>
+    <el-dialog title="批量指派投手" :visible.sync="visible" width="450px" append-to-body :show-close="false">
+        <el-form :model="paramsForm" :rules="rulesType" ref="platFormPut1" label-width="80px" label-position="top">
+            <el-form-item label="用户" prop="putUserId">
+                <el-select v-model="paramsForm.putUserId" clearable placeholder="请选择" filterable style="width: 100%">
+                    <el-option v-for="item in userAll" :key="item.id" :label="item.nickName" :value="item.id" />
+                </el-select>
+            </el-form-item>
+        </el-form>
+        <span slot="footer" class="dialog-footer">
+            <el-button @click="onClose()">取 消</el-button>
+            <el-button type="primary" @click="onSubmit('platFormPut1')" :loading="loading">确 定</el-button>
+        </span>
+    </el-dialog>
+</template>
+<script>
+/**
+ * 指派投手
+ */
+import { allUser } from "@/api/system/user";
+import { putUser } from "@/api/accounts/ttAdapi";
+export default {
+    data() {
+        return {
+            rulesType: {
+                putUserId: [
+                    { required: true, message: '请选择投手', trigger: 'blur' }
+                ]
+            },
+            paramsForm: {},
+            userAll: [],
+            loading: false
+        }
+    },
+    props: {
+        visible: {
+            type: Boolean,
+            default: false
+        },
+        adAccountList: {
+            type: Array,
+            default: [],
+        }
+    },
+    created() {
+        this.getUserAllHandle()
+    },
+    methods: {
+        onClose() {
+            this.paramsForm = {};
+            this.$emit("onClose");
+        },
+        onSubmit(val) {
+            this.$refs[val].validate((valid) => {
+                if (valid && this.adAccountList) {
+                    this.loading = true
+                    putUser({ putUserId: this.paramsForm.putUserId, adAccountList: this.adAccountList }).then(res => {
+                        this.loading = false
+                        if (res.data) {
+                            this.$message({
+                                showClose: true,
+                                message: '指派成功',
+                                type: 'success'
+                            });
+                            this.$emit("onChange");
+                            this.visible = false
+                        }
+                    }).catch(() => this.loading = false)
+                }
+            })
+        },
+        getUserAllHandle() {
+            // 所有用户
+            allUser().then(response => {
+                let data = response.data
+                this.userAll = data.map((item) => {
+                    return { id: item.userId, nickName: item.nickname }
+                })
+            })
+        }
+    }
+}
+</script>

+ 1 - 1
src/views/accounts/ttAdWarrant/putUserButton.vue

@@ -62,7 +62,7 @@ export default {
             this.$refs[val].validate((valid) => {
             this.$refs[val].validate((valid) => {
                 if (valid && this.accountId && this.authUserId) {
                 if (valid && this.accountId && this.authUserId) {
                     this.loading = true
                     this.loading = true
-                    putUser(this.authUserId, this.accountId, this.paramsForm.putUserId).then(res => {
+                    putUser({putUserId: this.paramsForm.putUserId, adAccountList: [{ authUserId: this.authUserId, accountId: this.accountId }] }).then(res => {
                         this.loading = false
                         this.loading = false
                         if (res.data) {
                         if (res.data) {
                             this.$message({
                             this.$message({

+ 10 - 0
src/views/system/user/index.vue

@@ -44,6 +44,16 @@
               @keyup.enter.native="handleQuery"
               @keyup.enter.native="handleQuery"
             />
             />
           </el-form-item>
           </el-form-item>
+          <el-form-item label="用户昵称" prop="nickname">
+            <el-input
+              v-model="queryParams.nickname"
+              placeholder="请输入用户昵称"
+              clearable
+              size="small"
+              style="width: 140px"
+              @keyup.enter.native="handleQuery"
+            />
+          </el-form-item>
           <el-form-item label="手机号码" prop="phone">
           <el-form-item label="手机号码" prop="phone">
             <el-input
             <el-input
               v-model="queryParams.phone"
               v-model="queryParams.phone"