فهرست منبع

Merge branch 'saas-ui' of http://1.14.104.71:10880/txl/ylrz_saas_his_scrm_companyUI into saas-ui

云联一号 1 ماه پیش
والد
کامیت
ffd0afa8bc

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

@@ -51,3 +51,11 @@ export function changeVoiceRoboticCallBlacklistStatus(data) {
         data: data
     })
 }
+
+// 查看解密手机号
+export function queryVoiceRoboticCallBlacklistPhone(blacklistId) {
+    return request({
+        url: '/company/companyVoiceRoboticCallBlacklist/queryPhone/' + blacklistId,
+        method: 'get'
+    })
+}

+ 156 - 40
src/views/company/companyVoiceRoboticCallBlacklist/companyVoiceRoboticCallBlacklist.vue

@@ -34,16 +34,17 @@
                 />
             </el-form-item>
 
-            <el-form-item label="业务类型" prop="businessType">
-                <el-input
-                    v-model="queryParams.businessType"
-                    placeholder="请输入业务类型"
-                    clearable
-                    size="small"
-                    style="width: 180px"
-                    @keyup.enter.native="handleQuery"
-                />
-            </el-form-item>
+<!--            <el-form-item label="黑名单级别" prop="businessType" label-width="90px">-->
+<!--                <el-select-->
+<!--                    v-model="queryParams.businessType"-->
+<!--                    placeholder="请选择黑名单级别"-->
+<!--                    clearable-->
+<!--                    size="small"-->
+<!--                    style="width: 160px"-->
+<!--                >-->
+<!--                    <el-option label="线路级" value="13" />-->
+<!--                </el-select>-->
+<!--            </el-form-item>-->
 
             <el-form-item label="状态" prop="status">
                 <el-select
@@ -165,18 +166,47 @@
 
 <!--            <el-table-column label="公司ID" align="center" prop="companyId" width="100" />-->
 
-            <el-table-column label="业务类型" align="center" prop="businessType" min-width="120" />
+<!--            <el-table-column label="黑名单级别" align="center" prop="businessType" width="110">-->
+<!--                <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="targetType" width="120">
                 <template slot-scope="scope">
-                    <span v-if="scope.row.targetType === 1">手机号</span>
-                    <span v-else-if="scope.row.targetType === 2">客户ID</span>
-                    <span v-else-if="scope.row.targetType === 3">企微客户ID</span>
+                    <span v-if="Number(scope.row.targetType) === 1">手机号</span>
+                    <span v-else-if="Number(scope.row.targetType) === 2">客户ID</span>
+                    <span v-else-if="Number(scope.row.targetType) === 3">企微客户ID</span>
                     <span v-else>-</span>
                 </template>
             </el-table-column>
 
-            <el-table-column label="对象值" align="center" prop="targetValue" min-width="180" show-overflow-tooltip />
+            <el-table-column label="对象值" align="center" min-width="220">
+                <template slot-scope="scope">
+                    <div class="target-value-cell">
+                        <el-tooltip
+                            :content="scope.row.targetValue || '-'"
+                            placement="top"
+                            :disabled="!scope.row.targetValue"
+                        >
+                            <span class="target-value-text">{{ scope.row.targetValue || '-' }}</span>
+                        </el-tooltip>
+                        <el-button
+                            v-if="canQueryPhone(scope.row)"
+                            type="primary"
+                            icon="el-icon-zoom-in"
+                            size="mini"
+                            circle
+                            plain
+                            title="查看真实手机号"
+                            @click="handlePhone(scope.row)"
+                        />
+                    </div>
+                </template>
+            </el-table-column>
 
             <el-table-column label="拉黑原因" align="center" prop="reason" min-width="180" show-overflow-tooltip />
 
@@ -190,8 +220,8 @@
 
             <el-table-column label="状态" align="center" prop="status" width="100">
                 <template slot-scope="scope">
-                    <el-tag v-if="scope.row.status === 1" type="danger" size="mini">生效</el-tag>
-                    <el-tag v-else type="success" size="mini">失效</el-tag>
+                    <el-tag v-if="scope.row.status === 1" type="success" size="mini">生效</el-tag>
+                    <el-tag v-else type="danger" size="mini">失效</el-tag>
                 </template>
             </el-table-column>
 
@@ -259,19 +289,19 @@
         <!-- 新增/编辑弹窗 -->
         <el-dialog :title="title" :visible.sync="open" width="680px" append-to-body>
             <el-form ref="form" :model="form" :rules="rules" label-width="95px">
-                <el-row>
+<!--                <el-row>-->
+<!--&lt;!&ndash;                    <el-col :span="12">&ndash;&gt;-->
+<!--&lt;!&ndash;                        <el-form-item label="公司ID" prop="companyId">&ndash;&gt;-->
+<!--&lt;!&ndash;                            <el-input v-model="form.companyId" placeholder="请输入公司ID" />&ndash;&gt;-->
+<!--&lt;!&ndash;                        </el-form-item>&ndash;&gt;-->
+<!--&lt;!&ndash;                    </el-col>&ndash;&gt;-->
+
 <!--                    <el-col :span="12">-->
-<!--                        <el-form-item label="公司ID" prop="companyId">-->
-<!--                            <el-input v-model="form.companyId" placeholder="请输入公司ID" />-->
+<!--                        <el-form-item label="黑名单级别">-->
+<!--                            <el-input value="线路级(13)" disabled />-->
 <!--                        </el-form-item>-->
 <!--                    </el-col>-->
-
-                    <el-col :span="12">
-                        <el-form-item label="业务类型" prop="businessType">
-                            <el-input v-model="form.businessType" placeholder="请输入业务类型" />
-                        </el-form-item>
-                    </el-col>
-                </el-row>
+<!--                </el-row>-->
 
                 <el-row>
                     <el-col :span="12">
@@ -297,9 +327,10 @@
                 <el-form-item label="对象值" prop="targetValue">
                     <el-input
                         v-model="form.targetValue"
-                        placeholder="请输入手机号 / 客户ID / 企微客户ID"
+                        :placeholder="form.id ? '不填写则不修改对象值' : '请输入手机号 / 客户ID / 企微客户ID'"
                         maxlength="128"
                         show-word-limit
+                        clearable
                     />
                 </el-form-item>
 
@@ -348,7 +379,8 @@ import {
     addVoiceRoboticCallBlacklist,
     updateVoiceRoboticCallBlacklist,
     delVoiceRoboticCallBlacklist,
-    changeVoiceRoboticCallBlacklistStatus
+    changeVoiceRoboticCallBlacklistStatus,
+    queryVoiceRoboticCallBlacklistPhone
 } from "@/api/company/companyVoiceRoboticCallBlacklist";
 
 export default {
@@ -369,7 +401,7 @@ export default {
                 pageNum: 1,
                 pageSize: 10,
                 companyId: null,
-                businessType: null,
+                businessType: "13",
                 targetType: null,
                 targetValue: null,
                 status: null,
@@ -377,14 +409,22 @@ export default {
             },
             form: {},
             rules: {
-                companyId: [
-                    { required: true, message: "公司ID不能为空", trigger: "blur" }
-                ],
                 targetType: [
                     { required: true, message: "对象类型不能为空", trigger: "change" }
                 ],
                 targetValue: [
-                    { required: true, message: "对象值不能为空", trigger: "blur" }
+                    {
+                        validator: (rule, value, callback) => {
+                            const isEdit = this.isEditForm();
+                            const text = value == null ? "" : String(value).trim();
+                            if (!isEdit && !text) {
+                                callback(new Error("对象值不能为空"));
+                            } else {
+                                callback();
+                            }
+                        },
+                        trigger: "blur"
+                    }
                 ]
             }
         };
@@ -393,6 +433,15 @@ export default {
         this.getList();
     },
     methods: {
+        isEditForm() {
+            return this.form.id !== undefined && this.form.id !== null && this.form.id !== "";
+        },
+        normalizeTargetValue(value) {
+            if (value == null) {
+                return "";
+            }
+            return String(value).trim();
+        },
         /** 查询列表 */
         getList() {
             this.loading = true;
@@ -410,7 +459,7 @@ export default {
             this.form = {
                 id: null,
                 companyId: null,
-                businessType: null,
+                businessType: "13",
                 targetType: 1,
                 targetValue: null,
                 reason: null,
@@ -430,6 +479,7 @@ export default {
         /** 重置按钮 */
         resetQuery() {
             this.resetForm("queryForm");
+            this.queryParams.businessType = "13";
             this.handleQuery();
         },
 
@@ -451,9 +501,24 @@ export default {
         /** 修改 */
         handleUpdate(row) {
             this.reset();
-            const id = row.id || this.ids[0];
+            const id = row && row.id != null ? row.id : this.ids[0];
+            if (!id) {
+                this.msgWarning("请选择要修改的数据");
+                return;
+            }
             getVoiceRoboticCallBlacklist(id).then(response => {
-                this.form = response.data;
+                const data = response.data || {};
+                this.form = {
+                    id: data.id,
+                    companyId: data.companyId,
+                    businessType: data.businessType || "13",
+                    targetType: data.targetType != null ? Number(data.targetType) : 1,
+                    targetValue: null,
+                    reason: data.reason,
+                    source: data.source,
+                    status: data.status != null ? data.status : 1,
+                    remark: data.remark
+                };
                 this.open = true;
                 this.title = "修改外呼黑名单";
             });
@@ -466,8 +531,15 @@ export default {
                     return;
                 }
 
-                if (this.form.id != null) {
-                    updateVoiceRoboticCallBlacklist(this.form).then(response => {
+                const payload = { ...this.form };
+                const targetValue = this.normalizeTargetValue(payload.targetValue);
+                if (this.isEditForm()) {
+                    if (targetValue) {
+                        payload.targetValue = targetValue;
+                    } else {
+                        delete payload.targetValue;
+                    }
+                    updateVoiceRoboticCallBlacklist(payload).then(response => {
                         if (response.code === 200) {
                             this.msgSuccess("修改成功");
                             this.open = false;
@@ -477,7 +549,13 @@ export default {
                         }
                     });
                 } else {
-                    addVoiceRoboticCallBlacklist(this.form).then(response => {
+                    if (!targetValue) {
+                        this.msgError("对象值不能为空");
+                        return;
+                    }
+                    payload.businessType = "13";
+                    payload.targetValue = targetValue;
+                    addVoiceRoboticCallBlacklist(payload).then(response => {
                         if (response.code === 200) {
                             this.msgSuccess("新增成功");
                             this.open = false;
@@ -558,6 +636,29 @@ export default {
             this.batchChangeStatus(0);
         },
 
+        /** 是否可查看手机号(非客户ID/企微客户ID 且存在记录 ID) */
+        canQueryPhone(row) {
+            if (!row || row.id == null || row.id === '') {
+                return false;
+            }
+            const type = Number(row.targetType);
+            return type !== 2 && type !== 3;
+        },
+        /** 查看真实手机号 */
+        handlePhone(row) {
+            if (!row || !row.id) {
+                return;
+            }
+            queryVoiceRoboticCallBlacklistPhone(row.id).then(res => {
+                const mobile = (res && res.mobile) || (res && res.data && res.data.mobile);
+                if (mobile) {
+                    this.$alert(mobile, "手机号", { confirmButtonText: "确定" });
+                } else {
+                    this.msgError((res && res.msg) || "获取手机号失败");
+                }
+            });
+        },
+
         /** 批量改状态 */
         batchChangeStatus(status) {
             const text = status === 1 ? "启用" : "失效";
@@ -584,4 +685,19 @@ export default {
 .app-container {
     height: 87.5vh;
 }
+.target-value-cell {
+    display: inline-flex;
+    align-items: center;
+    justify-content: center;
+    max-width: 100%;
+    gap: 6px;
+}
+.target-value-text {
+    display: inline-block;
+    max-width: 150px;
+    overflow: hidden;
+    text-overflow: ellipsis;
+    white-space: nowrap;
+    vertical-align: middle;
+}
 </style>