|
@@ -1,46 +1,272 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="app-container">
|
|
<div class="app-container">
|
|
|
- <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
|
|
|
|
|
- <el-form-item label="关键词" prop="keyword">
|
|
|
|
|
- <el-input v-model="queryParams.keyword" placeholder="请输入关键词" clearable size="small"
|
|
|
|
|
- @keyup.enter.native="handleQuery" />
|
|
|
|
|
|
|
+ <el-form
|
|
|
|
|
+ :model="queryParams"
|
|
|
|
|
+ ref="queryForm"
|
|
|
|
|
+ :inline="true"
|
|
|
|
|
+ v-show="showSearch"
|
|
|
|
|
+ label-width="80px"
|
|
|
|
|
+ @submit.native.prevent
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-form-item label="对象类型" prop="targetType">
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ v-model="queryParams.targetType"
|
|
|
|
|
+ placeholder="请选择对象类型"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ style="width: 160px"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option label="手机号" :value="1" />
|
|
|
|
|
+ <el-option label="客户ID" :value="2" />
|
|
|
|
|
+ <el-option label="企微客户ID" :value="3" />
|
|
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
+
|
|
|
|
|
+ <el-form-item label="对象值" prop="targetValue">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="queryParams.targetValue"
|
|
|
|
|
+ placeholder="请输入手机号/客户ID/企微客户ID"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ style="width: 240px"
|
|
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+
|
|
|
|
|
+ <el-form-item label="状态" prop="status">
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ v-model="queryParams.status"
|
|
|
|
|
+ placeholder="请选择状态"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ style="width: 140px"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option label="生效" :value="1" />
|
|
|
|
|
+ <el-option label="失效" :value="0" />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+
|
|
|
|
|
+ <el-form-item label="来源" prop="source">
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ v-model="queryParams.source"
|
|
|
|
|
+ placeholder="请选择来源"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ style="width: 140px"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option label="手动添加" :value="1" />
|
|
|
|
|
+ <el-option label="外部系统同步" :value="2" />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+
|
|
|
<el-form-item>
|
|
<el-form-item>
|
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
<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>
|
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
|
|
+
|
|
|
<el-row :gutter="10" class="mb8">
|
|
<el-row :gutter="10" class="mb8">
|
|
|
- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
|
|
|
|
+ <el-col :span="1.5">
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ plain
|
|
|
|
|
+ icon="el-icon-plus"
|
|
|
|
|
+ size="mini"
|
|
|
|
|
+ @click="handleAdd"
|
|
|
|
|
+ v-hasPermi="['company:companyVoiceBlacklist:add']"
|
|
|
|
|
+ >新增</el-button>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <el-col :span="1.5">
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ type="success"
|
|
|
|
|
+ plain
|
|
|
|
|
+ icon="el-icon-edit"
|
|
|
|
|
+ size="mini"
|
|
|
|
|
+ :disabled="single"
|
|
|
|
|
+ @click="handleUpdate()"
|
|
|
|
|
+ v-hasPermi="['company:companyVoiceBlacklist:update']"
|
|
|
|
|
+ >修改</el-button>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <el-col :span="1.5">
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ type="danger"
|
|
|
|
|
+ plain
|
|
|
|
|
+ icon="el-icon-delete"
|
|
|
|
|
+ size="mini"
|
|
|
|
|
+ :disabled="multiple"
|
|
|
|
|
+ @click="handleDeleteBatch"
|
|
|
|
|
+ v-hasPermi="['company:companyVoiceBlacklist:remove']"
|
|
|
|
|
+ >删除</el-button>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+<!-- <el-col :span="1.5">-->
|
|
|
|
|
+<!-- <el-tag type="warning" size="small">租户级黑名单</el-tag>-->
|
|
|
|
|
+<!-- </el-col>-->
|
|
|
|
|
+ <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" />
|
|
|
</el-row>
|
|
</el-row>
|
|
|
- <el-table v-loading="loading" :data="list">
|
|
|
|
|
- <el-table-column type="selection" width="50" align="center" />
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <el-table v-loading="loading" :data="list" border @selection-change="handleSelectionChange">
|
|
|
|
|
+ <el-table-column type="selection" width="55" align="center" />
|
|
|
<el-table-column label="ID" align="center" prop="id" width="80" />
|
|
<el-table-column label="ID" align="center" prop="id" width="80" />
|
|
|
- <el-table-column label="黑名单号码" align="center" prop="phone" width="140" />
|
|
|
|
|
- <el-table-column label="黑名单类型" align="center" prop="blacklistType" width="120" />
|
|
|
|
|
- <el-table-column label="原因" align="center" prop="reason" />
|
|
|
|
|
- <el-table-column label="状态" align="center" prop="status" width="80">
|
|
|
|
|
|
|
+ <el-table-column label="对象类型" align="center" prop="targetType" width="120">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <span v-if="isPhoneTargetType(scope.row)">手机号</span>
|
|
|
|
|
+ <span v-else-if="scope.row.targetType === 2 || scope.row.targetType === '2'">客户ID</span>
|
|
|
|
|
+ <span v-else-if="scope.row.targetType === 3 || scope.row.targetType === '3'">企微客户ID</span>
|
|
|
|
|
+ <span v-else>-</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="对象值" align="center" prop="targetValue" min-width="220">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <div v-if="isPhoneTargetType(scope.row)" class="target-value-cell">
|
|
|
|
|
+ <span class="target-value-text" :title="scope.row.targetValue">{{ scope.row.targetValue }}</span>
|
|
|
|
|
+ <el-tooltip content="查看完整手机号" placement="top">
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ type="text"
|
|
|
|
|
+ size="mini"
|
|
|
|
|
+ class="target-value-phone-btn"
|
|
|
|
|
+ @click="handlePhone(scope)"
|
|
|
|
|
+ v-hasPermi="['company:companyVoiceBlacklist:queryPhone']"
|
|
|
|
|
+ >
|
|
|
|
|
+ <i class="el-icon-zoom-in"></i>
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ </el-tooltip>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <span v-else class="target-value-text" :title="scope.row.targetValue">{{ scope.row.targetValue }}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="拉黑原因" align="center" prop="reason" min-width="160" show-overflow-tooltip />
|
|
|
|
|
+ <el-table-column label="来源" align="center" prop="source" width="100">
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
- <el-tag :type="scope.row.status==='0'?'success':'danger'" size="small">{{ scope.row.status==='0'?'启用':'停用' }}</el-tag>
|
|
|
|
|
|
|
+ <el-tag v-if="scope.row.source === 1" size="mini">手动添加</el-tag>
|
|
|
|
|
+ <el-tag v-else-if="scope.row.source === 2" type="info" size="mini">系统同步</el-tag>
|
|
|
|
|
+ <span v-else>-</span>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
|
|
+ <el-table-column label="状态" align="center" prop="status" width="90">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <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>
|
|
|
|
|
+ <el-table-column label="备注" align="center" prop="remark" min-width="140" show-overflow-tooltip />
|
|
|
|
|
+ <el-table-column label="创建人" align="center" prop="createBy" width="110" />
|
|
|
<el-table-column label="创建时间" align="center" prop="createTime" width="160" />
|
|
<el-table-column label="创建时间" align="center" prop="createTime" width="160" />
|
|
|
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180">
|
|
|
|
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
- <el-button size="mini" type="text" icon="el-icon-view" @click="handleDetail(scope.row)"
|
|
|
|
|
- v-hasPermi="['company:companyVoiceBlacklist:query']">详情</el-button>
|
|
|
|
|
- <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
|
|
|
|
- v-hasPermi="['company:companyVoiceBlacklist:remove']">删除</el-button>
|
|
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ size="mini"
|
|
|
|
|
+ type="text"
|
|
|
|
|
+ icon="el-icon-edit"
|
|
|
|
|
+ @click="handleUpdate(scope.row)"
|
|
|
|
|
+ v-hasPermi="['company:companyVoiceBlacklist:update']"
|
|
|
|
|
+ >修改</el-button>
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ v-if="scope.row.status === 0"
|
|
|
|
|
+ size="mini"
|
|
|
|
|
+ type="text"
|
|
|
|
|
+ @click="handleChangeStatus(scope.row, 1)"
|
|
|
|
|
+ v-hasPermi="['company:companyVoiceBlacklist:update']"
|
|
|
|
|
+ >启用</el-button>
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ v-if="scope.row.status === 1"
|
|
|
|
|
+ size="mini"
|
|
|
|
|
+ type="text"
|
|
|
|
|
+ @click="handleChangeStatus(scope.row, 0)"
|
|
|
|
|
+ v-hasPermi="['company:companyVoiceBlacklist:update']"
|
|
|
|
|
+ >失效</el-button>
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ size="mini"
|
|
|
|
|
+ type="text"
|
|
|
|
|
+ icon="el-icon-delete"
|
|
|
|
|
+ @click="handleDelete(scope.row)"
|
|
|
|
|
+ v-hasPermi="['company:companyVoiceBlacklist:remove']"
|
|
|
|
|
+ >删除</el-button>
|
|
|
</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="title" :visible.sync="open" width="680px" append-to-body @close="reset">
|
|
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-width="95px">
|
|
|
|
|
+<!-- <el-form-item label="黑名单级别">-->
|
|
|
|
|
+<!-- <el-tag type="warning">租户级</el-tag>-->
|
|
|
|
|
+<!-- </el-form-item>-->
|
|
|
|
|
+
|
|
|
|
|
+ <el-form-item label="对象类型" prop="targetType">
|
|
|
|
|
+ <el-select v-model="form.targetType" placeholder="请选择对象类型" style="width: 100%">
|
|
|
|
|
+ <el-option label="手机号" :value="1" />
|
|
|
|
|
+ <el-option label="客户ID" :value="2" />
|
|
|
|
|
+ <el-option label="企微客户ID" :value="3" />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+
|
|
|
|
|
+ <el-form-item label="对象值" prop="targetValue">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="form.targetValue"
|
|
|
|
|
+ :placeholder="isEditForm ? '不填写则不修改对象值' : '请输入手机号 / 客户ID / 企微客户ID'"
|
|
|
|
|
+ maxlength="128"
|
|
|
|
|
+ show-word-limit
|
|
|
|
|
+ clearable
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+
|
|
|
|
|
+ <el-form-item label="拉黑原因" prop="reason">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="form.reason"
|
|
|
|
|
+ type="textarea"
|
|
|
|
|
+ :rows="3"
|
|
|
|
|
+ placeholder="请输入拉黑原因"
|
|
|
|
|
+ maxlength="255"
|
|
|
|
|
+ show-word-limit
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+
|
|
|
|
|
+ <el-form-item label="备注" prop="remark">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="form.remark"
|
|
|
|
|
+ type="textarea"
|
|
|
|
|
+ :rows="3"
|
|
|
|
|
+ placeholder="请输入备注"
|
|
|
|
|
+ maxlength="500"
|
|
|
|
|
+ show-word-limit
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+
|
|
|
|
|
+ <el-form-item label="状态" prop="status">
|
|
|
|
|
+ <el-radio-group v-model="form.status">
|
|
|
|
|
+ <el-radio :label="1">生效</el-radio>
|
|
|
|
|
+ <el-radio :label="0">失效</el-radio>
|
|
|
|
|
+ </el-radio-group>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
|
|
+ <el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
|
|
+ <el-button @click="cancel">取 消</el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
-import { listApi, delApi } from '@/api/company/companyVoiceBlacklist'
|
|
|
|
|
|
|
+import {
|
|
|
|
|
+ listApi,
|
|
|
|
|
+ getApi,
|
|
|
|
|
+ addApi,
|
|
|
|
|
+ updateApi,
|
|
|
|
|
+ delApi,
|
|
|
|
|
+ queryPhoneApi,
|
|
|
|
|
+ changeStatusApi
|
|
|
|
|
+} from '@/api/company/companyVoiceBlacklist'
|
|
|
|
|
+
|
|
|
|
|
+const TENANT_BLACKLIST_TYPE = '12'
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
name: 'CompanyVoiceBlacklist',
|
|
name: 'CompanyVoiceBlacklist',
|
|
@@ -50,24 +276,76 @@ export default {
|
|
|
showSearch: true,
|
|
showSearch: true,
|
|
|
total: 0,
|
|
total: 0,
|
|
|
list: [],
|
|
list: [],
|
|
|
|
|
+ ids: [],
|
|
|
|
|
+ single: true,
|
|
|
|
|
+ multiple: true,
|
|
|
|
|
+ title: '',
|
|
|
|
|
+ open: false,
|
|
|
|
|
+ form: {},
|
|
|
queryParams: {
|
|
queryParams: {
|
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
|
- keyword: null
|
|
|
|
|
|
|
+ businessType: TENANT_BLACKLIST_TYPE,
|
|
|
|
|
+ targetType: null,
|
|
|
|
|
+ targetValue: null,
|
|
|
|
|
+ status: null,
|
|
|
|
|
+ source: null
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ computed: {
|
|
|
|
|
+ rules() {
|
|
|
|
|
+ const targetValueRules = this.isEditForm
|
|
|
|
|
+ ? []
|
|
|
|
|
+ : [
|
|
|
|
|
+ { required: true, message: '对象值不能为空', trigger: 'blur' },
|
|
|
|
|
+ { required: true, message: '对象值不能为空', trigger: 'change' }
|
|
|
|
|
+ ]
|
|
|
|
|
+ return {
|
|
|
|
|
+ targetType: [
|
|
|
|
|
+ { required: true, message: '对象类型不能为空', trigger: 'change' }
|
|
|
|
|
+ ],
|
|
|
|
|
+ targetValue: targetValueRules
|
|
|
}
|
|
}
|
|
|
|
|
+ },
|
|
|
|
|
+ isEditForm() {
|
|
|
|
|
+ return this.form.id !== undefined && this.form.id !== null && this.form.id !== ''
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
|
|
this.getList()
|
|
this.getList()
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ isPhoneTargetType(row) {
|
|
|
|
|
+ return row && (row.targetType === 1 || row.targetType === '1')
|
|
|
|
|
+ },
|
|
|
getList() {
|
|
getList() {
|
|
|
this.loading = true
|
|
this.loading = true
|
|
|
listApi(this.queryParams).then(res => {
|
|
listApi(this.queryParams).then(res => {
|
|
|
- this.list = res.rows || (res.data && res.data.list) || []
|
|
|
|
|
- this.total = res.total || (res.data && res.data.total) || 0
|
|
|
|
|
|
|
+ this.list = res.rows || []
|
|
|
|
|
+ this.total = res.total || 0
|
|
|
this.loading = false
|
|
this.loading = false
|
|
|
- }).catch(() => { this.loading = false })
|
|
|
|
|
|
|
+ }).catch(() => {
|
|
|
|
|
+ this.loading = false
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ handleSelectionChange(selection) {
|
|
|
|
|
+ this.ids = selection.map(item => item.id)
|
|
|
|
|
+ this.single = selection.length !== 1
|
|
|
|
|
+ this.multiple = !selection.length
|
|
|
|
|
+ },
|
|
|
|
|
+ reset() {
|
|
|
|
|
+ this.form = {
|
|
|
|
|
+ id: null,
|
|
|
|
|
+ businessType: TENANT_BLACKLIST_TYPE,
|
|
|
|
|
+ targetType: 1,
|
|
|
|
|
+ targetValue: null,
|
|
|
|
|
+ reason: null,
|
|
|
|
|
+ source: 1,
|
|
|
|
|
+ status: 1,
|
|
|
|
|
+ remark: null
|
|
|
|
|
+ }
|
|
|
|
|
+ this.resetForm('form')
|
|
|
},
|
|
},
|
|
|
handleQuery() {
|
|
handleQuery() {
|
|
|
this.queryParams.pageNum = 1
|
|
this.queryParams.pageNum = 1
|
|
@@ -75,19 +353,162 @@ export default {
|
|
|
},
|
|
},
|
|
|
resetQuery() {
|
|
resetQuery() {
|
|
|
this.resetForm('queryForm')
|
|
this.resetForm('queryForm')
|
|
|
|
|
+ this.queryParams.businessType = TENANT_BLACKLIST_TYPE
|
|
|
this.handleQuery()
|
|
this.handleQuery()
|
|
|
},
|
|
},
|
|
|
- handleDetail(row) {
|
|
|
|
|
- this.$message.info('详情功能开发中')
|
|
|
|
|
|
|
+ handleAdd() {
|
|
|
|
|
+ this.reset()
|
|
|
|
|
+ this.open = true
|
|
|
|
|
+ this.title = '新增黑名单'
|
|
|
|
|
+ },
|
|
|
|
|
+ handleUpdate(row) {
|
|
|
|
|
+ const id = row && row.id != null ? row.id : this.ids[0]
|
|
|
|
|
+ if (!id) {
|
|
|
|
|
+ this.msgWarning('请选择要修改的数据')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ this.reset()
|
|
|
|
|
+ getApi(id).then(res => {
|
|
|
|
|
+ this.form = res.data || {}
|
|
|
|
|
+ this.form.businessType = TENANT_BLACKLIST_TYPE
|
|
|
|
|
+ // 修改时不回显对象值(含手机号),按 id 更新其他字段;需改对象值时再填写
|
|
|
|
|
+ this.form.targetValue = null
|
|
|
|
|
+ this.open = true
|
|
|
|
|
+ this.title = '修改黑名单'
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
|
+ if (this.$refs.form) {
|
|
|
|
|
+ this.$refs.form.clearValidate()
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ isSubmitSuccess(res) {
|
|
|
|
|
+ const code = res && res.code !== undefined ? res.code : 200
|
|
|
|
|
+ return Number(code) === 200
|
|
|
|
|
+ },
|
|
|
|
|
+ /** 提交成功:关闭弹窗、重置表单、刷新列表 */
|
|
|
|
|
+ handleSubmitSuccess(res) {
|
|
|
|
|
+ const msg = (res && res.msg) || '操作成功'
|
|
|
|
|
+ this.open = false
|
|
|
|
|
+ this.msgSuccess(msg)
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
|
+ this.reset()
|
|
|
|
|
+ this.getList()
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ submitForm() {
|
|
|
|
|
+ this.$refs.form.validate(valid => {
|
|
|
|
|
+ if (!valid) {
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ const payload = {
|
|
|
|
|
+ ...this.form,
|
|
|
|
|
+ businessType: TENANT_BLACKLIST_TYPE
|
|
|
|
|
+ }
|
|
|
|
|
+ if (this.isEditForm) {
|
|
|
|
|
+ if (!payload.targetValue) {
|
|
|
|
|
+ delete payload.targetValue
|
|
|
|
|
+ }
|
|
|
|
|
+ updateApi(payload).then(res => {
|
|
|
|
|
+ if (this.isSubmitSuccess(res)) {
|
|
|
|
|
+ this.handleSubmitSuccess(res)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.msgError((res && res.msg) || '修改失败')
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ } else {
|
|
|
|
|
+ const targetValue = payload.targetValue != null ? String(payload.targetValue).trim() : ''
|
|
|
|
|
+ if (!targetValue) {
|
|
|
|
|
+ this.msgWarning('对象值不能为空')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ payload.targetValue = targetValue
|
|
|
|
|
+ addApi(payload).then(res => {
|
|
|
|
|
+ if (this.isSubmitSuccess(res)) {
|
|
|
|
|
+ this.handleSubmitSuccess(res)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.msgError((res && res.msg) || '新增失败')
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ cancel() {
|
|
|
|
|
+ this.open = false
|
|
|
|
|
+ this.reset()
|
|
|
|
|
+ },
|
|
|
|
|
+ handleChangeStatus(row, status) {
|
|
|
|
|
+ const text = status === 1 ? '启用' : '失效'
|
|
|
|
|
+ this.$confirm('确认要' + text + '该黑名单吗?', '提示', {
|
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
|
+ type: 'warning'
|
|
|
|
|
+ }).then(() => {
|
|
|
|
|
+ return changeStatusApi({ id: row.id, status: status })
|
|
|
|
|
+ }).then(() => {
|
|
|
|
|
+ this.msgSuccess(text + '成功')
|
|
|
|
|
+ this.getList()
|
|
|
|
|
+ }).catch(() => {})
|
|
|
|
|
+ },
|
|
|
|
|
+ handlePhone(scope) {
|
|
|
|
|
+ queryPhoneApi(scope.row.id).then(res => {
|
|
|
|
|
+ const mobile = res.mobile || (res.data && res.data.mobile)
|
|
|
|
|
+ if (mobile) {
|
|
|
|
|
+ scope.row.targetValue = mobile
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$modal.msgError(res.msg || '获取手机号失败')
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
},
|
|
},
|
|
|
handleDelete(row) {
|
|
handleDelete(row) {
|
|
|
- this.$modal.confirm('是否确认删除?').then(() => {
|
|
|
|
|
- return delApi(row.id)
|
|
|
|
|
|
|
+ const ids = row && row.id != null && row.id !== '' ? row.id : this.ids
|
|
|
|
|
+ const idStr = Array.isArray(ids) ? ids.join(',') : ids
|
|
|
|
|
+ if (!idStr) {
|
|
|
|
|
+ this.msgWarning('请选择要删除的数据')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ this.$confirm('是否确认删除黑名单编号为"' + idStr + '"的数据项?', '警告', {
|
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
|
+ type: 'warning'
|
|
|
|
|
+ }).then(() => {
|
|
|
|
|
+ return delApi(idStr)
|
|
|
}).then(() => {
|
|
}).then(() => {
|
|
|
this.getList()
|
|
this.getList()
|
|
|
- this.$modal.msgSuccess('删除成功')
|
|
|
|
|
|
|
+ this.msgSuccess('删除成功')
|
|
|
}).catch(() => {})
|
|
}).catch(() => {})
|
|
|
|
|
+ },
|
|
|
|
|
+ handleDeleteBatch() {
|
|
|
|
|
+ if (!this.ids.length) {
|
|
|
|
|
+ this.msgWarning('请选择要删除的数据')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ this.handleDelete({ id: this.ids.join(',') })
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|
|
|
|
|
+
|
|
|
|
|
+<style scoped>
|
|
|
|
|
+.target-value-cell {
|
|
|
|
|
+ display: inline-flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ justify-content: center;
|
|
|
|
|
+ max-width: 100%;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.target-value-text {
|
|
|
|
|
+ overflow: hidden;
|
|
|
|
|
+ text-overflow: ellipsis;
|
|
|
|
|
+ white-space: nowrap;
|
|
|
|
|
+ max-width: calc(100% - 28px);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.target-value-phone-btn {
|
|
|
|
|
+ flex-shrink: 0;
|
|
|
|
|
+ margin-left: 4px;
|
|
|
|
|
+ padding: 0 4px;
|
|
|
|
|
+ font-size: 16px;
|
|
|
|
|
+ color: #409eff;
|
|
|
|
|
+}
|
|
|
|
|
+</style>
|