Przeglądaj źródła

平台级黑名单

yuhongqi 3 dni temu
rodzic
commit
025901881c

+ 17 - 0
src/api/company/companyVoiceRoboticCallBlacklist.js

@@ -51,3 +51,20 @@ export function changeVoiceRoboticCallBlacklistStatus(data) {
         data: data
     })
 }
+
+// 查看解密手机号
+export function queryVoiceRoboticCallBlacklistPhone(blacklistId) {
+    return request({
+        url: '/admin/voice-blacklist/queryPhone/' + blacklistId,
+        method: 'get'
+    })
+}
+
+// 导出外呼黑名单
+export function exportVoiceRoboticCallBlacklist(query) {
+    return request({
+        url: '/admin/voice-blacklist/export',
+        method: 'get',
+        params: query
+    })
+}

+ 63 - 10
src/views/admin/voiceBlacklist/index.vue

@@ -18,6 +18,13 @@
             @keyup.enter.native="handleQuery"
           />
         </el-form-item>
+        <el-form-item label="黑名单级别" prop="businessType">
+          <el-select v-model="queryParams.businessType" placeholder="请选择黑名单级别" clearable size="small" style="width: 160px">
+            <el-option label="平台封禁" value="11" />
+            <el-option label="租户级" value="12" />
+            <el-option label="线路级" value="13" />
+          </el-select>
+        </el-form-item>
         <el-form-item>
           <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
           <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@@ -60,8 +67,20 @@
 
     <el-table v-loading="loading" :data="dataList" border size="small" style="width:100%" @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="手机号" align="center" prop="phone" min-width="130" />
+      <el-table-column label="手机号" align="center" prop="phone" min-width="200">
+        <template slot-scope="scope">
+          <span>{{ scope.row.phone }}<el-button icon="el-icon-search" size="mini" @click="handlePhone(scope)" style="margin-left: 20px;" circle></el-button></span>
+        </template>
+      </el-table-column>
       <el-table-column label="所属租户" align="center" prop="companyName" min-width="140" show-overflow-tooltip />
+      <el-table-column label="黑名单级别" align="center" prop="businessType" width="120">
+        <template slot-scope="scope">
+          <span v-if="scope.row.businessType === '11'">平台封禁</span>
+          <span v-else-if="scope.row.businessType === '12'">租户级</span>
+          <span v-else-if="scope.row.businessType === '13'">线路级</span>
+          <span v-else>{{ scope.row.businessType || '-' }}</span>
+        </template>
+      </el-table-column>
       <el-table-column label="状态" align="center" prop="status" width="100">
         <template slot-scope="scope">
           <el-switch
@@ -131,7 +150,9 @@ import {
   addVoiceRoboticCallBlacklist,
   updateVoiceRoboticCallBlacklist,
   delVoiceRoboticCallBlacklist,
-  changeVoiceRoboticCallBlacklistStatus
+  changeVoiceRoboticCallBlacklistStatus,
+  queryVoiceRoboticCallBlacklistPhone,
+  exportVoiceRoboticCallBlacklist
 } from '@/api/company/companyVoiceRoboticCallBlacklist'
 
 export default {
@@ -151,7 +172,8 @@ export default {
         pageNum: 1,
         pageSize: 10,
         phone: null,
-        companyName: null
+        companyName: null,
+        businessType: null
       },
       // 弹窗
       dialogOpen: false,
@@ -176,8 +198,15 @@ export default {
   methods: {
     getList() {
       this.loading = true
-      listVoiceRoboticCallBlacklist(this.queryParams).then(response => {
-        this.dataList = response.rows
+      listVoiceRoboticCallBlacklist({
+        ...this.queryParams,
+        targetValue: this.queryParams.phone
+      }).then(response => {
+        this.dataList = (response.rows || []).map(item => {
+          item.phone = item.targetValue
+          item.blacklistId = item.id
+          return item
+        })
         this.total = response.total
         this.loading = false
       })
@@ -204,6 +233,10 @@ export default {
       const id = row.blacklistId
       getVoiceRoboticCallBlacklist(id).then(response => {
         this.editForm = response.data
+        this.editForm.blacklistId = response.data.id
+        queryVoiceRoboticCallBlacklistPhone(id).then(res => {
+          this.editForm.phone = res.mobile
+        })
         this.dialogTitle = '编辑黑名单'
         this.dialogOpen = true
       })
@@ -211,14 +244,21 @@ export default {
     submitForm() {
       this.$refs['editForm'].validate(valid => {
         if (valid) {
+          const payload = {
+            ...this.editForm,
+            id: this.editForm.blacklistId,
+            targetValue: this.editForm.phone,
+            targetType: 1,
+            businessType: '11'
+          }
           if (this.editForm.blacklistId) {
-            updateVoiceRoboticCallBlacklist(this.editForm).then(response => {
+            updateVoiceRoboticCallBlacklist(payload).then(response => {
               this.$message.success('修改成功')
               this.dialogOpen = false
               this.getList()
             })
           } else {
-            addVoiceRoboticCallBlacklist(this.editForm).then(response => {
+            addVoiceRoboticCallBlacklist(payload).then(response => {
               this.$message.success('新增成功')
               this.dialogOpen = false
               this.getList()
@@ -242,7 +282,7 @@ export default {
     },
     handleStatusChange(row) {
       changeVoiceRoboticCallBlacklistStatus({
-        blacklistId: row.blacklistId,
+        id: row.blacklistId,
         status: row.status
       }).then(() => {
         this.$message.success('状态修改成功')
@@ -251,13 +291,26 @@ export default {
       })
     },
     handleExport() {
-      this.exportLoading = true
-      this.download('/admin/voice-blacklist/export', { ...this.queryParams }).then(() => {
+      const queryParams = { ...this.queryParams, targetValue: this.queryParams.phone }
+      this.$confirm('是否确认导出所有黑名单数据项?', '警告', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.exportLoading = true
+        return exportVoiceRoboticCallBlacklist(queryParams)
+      }).then(response => {
+        this.download(response.msg)
         this.exportLoading = false
       }).catch(() => {
         this.exportLoading = false
       })
     },
+    handlePhone(scope) {
+      queryVoiceRoboticCallBlacklistPhone(scope.row.blacklistId).then(res => {
+        scope.row.phone = res.mobile
+      })
+    },
     resetEditForm() {
       this.editForm = {
         blacklistId: null,