Commit 0ea13fc6 authored by 罗林杰's avatar 罗林杰

修改点击量

parent 7b3c9c42
import request from '@/utils/request'
import Qs from 'qs'
/**
* 1. 列表查询
* 2. 查询详细信息
* 3. 新增
* 4. 修改
* 5. 逻辑删除
* 6. 导出
*
*/
// 1. 查询访问量表列表
export function listMemTraffic(query) {
return request({
url: '/memtraffic/list',
method: 'get',
params: query
})
}
// 2. 查询访问量表详细信息
export function getMemTraffic(businessId) {
return request({
url: '/memtraffic/detail/' + businessId,
method: 'get'
})
}
// 3. 新增访问量表
export function addMemTraffic(data) {
data = Qs.stringify(data)
return request({
url: '/memtraffic/add',
method: 'post',
data: data
})
}
// 4. 修改访问量表
export function updateMemTraffic(data) {
const businessId = data.businessId
data = Qs.stringify(data)
return request({
url: '/memtraffic/update/' + businessId,
method: 'put',
data
})
}
// 5. 逻辑删除访问量表
export function delMemTraffic(businessId) {
return request({
url: '/memtraffic/deleteLogical/' + businessId,
method: 'delete'
})
}
// 6. 导出访问量表
export function exportMemTraffic(query) {
return request({
url: '/memtraffic/export',
method: 'get',
params: query,
responseType: 'blob'
})
}
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form ref="queryForm" style="padding: 0 0 0 10px" :model="queryParams" :inline="true"> <el-form ref="queryForm" style="padding: 0 0 0 10px" :model="queryParams" :inline="true">
<el-form-item label="用户" prop="userId"> <el-form-item label="访问量" prop="memTraffic">
<el-input <el-input
v-model="queryParams.memNickName" v-model="queryParams.memTraffic"
placeholder="请输入用户" placeholder="请输入访问量"
clearable
:maxlength="50"
size="small"
style="width: 150px"
/>
</el-form-item>
<el-form-item label="被拉黑人" prop="targetId">
<el-input
v-model="queryParams.targetName"
placeholder="请输入被拉黑人"
clearable clearable
:maxlength="50" :maxlength="50"
size="small" size="small"
...@@ -38,34 +28,19 @@ ...@@ -38,34 +28,19 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<div style="padding:5px 10px"> <div style="padding:5px 10px">
<div class="mb12 font-small-bold">黑名单表列表</div> <div class="mb12 font-small-bold">访问量表列表</div>
<el-table v-loading="loading" border :data="opmBlackListList"> <el-table v-loading="loading" border :data="memTrafficList">
<el-table-column type="index" label="序号" width="55" align="center" /> <el-table-column type="index" label="序号" width="55" align="center" />
<el-table-column label="用户" prop="userId" :show-overflow-tooltip="true"> <el-table-column label="用户id" prop="userId" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.memNickName || '-' }}
</template>
</el-table-column>
<el-table-column label="被拉黑人" prop="memNickName" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.targetName || '-' }} {{ scope.row.userId || '-' }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="拉黑时间" prop="createDate" :show-overflow-tooltip="true"> <el-table-column label="访问量" prop="memTraffic" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.createDate || '-' }} {{ scope.row.memTraffic || '0' }}
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column label="操作" class-name="small-padding fixed-width" width="200px">-->
<!-- <template slot-scope="scope">-->
<!-- <el-button-->
<!-- :class="commonField.delClass"-->
<!-- :type="commonField.typeParent"-->
<!-- :size="commonField.size"-->
<!-- @click="handleDelete(scope.row)"-->
<!-- >删除</el-button>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table> </el-table>
</div> </div>
<pagination <pagination
...@@ -75,43 +50,22 @@ ...@@ -75,43 +50,22 @@
:limit.sync="queryParams.rows" :limit.sync="queryParams.rows"
@pagination="getList" @pagination="getList"
/> />
<!-- 添加或修改黑名单表配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="90px">
<el-form-item label="用户id" prop="userId">
<el-input v-model.trim="form.userId" show-word-limit :maxlength="50" placeholder="请输入用户id" />
</el-form-item>
<el-form-item label="目标id" prop="targetId">
<el-input v-model.trim="form.targetId" show-word-limit :maxlength="50" placeholder="请输入目标id" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button class="cancelBtn" @click="cancel">取 消</el-button>
<el-button class="submitBtn" type="primary" @click="submitForm">确 定</el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { import { listMemTraffic } from '@/api/contentManagement/memTraffic'
listOpmBlackList,
getOpmBlackList,
delOpmBlackList,
addOpmBlackList,
updateOpmBlackList,
exportOpmBlackList } from '@/api/contentManagement/opmBlackList'
import commonField from '@/utils/commonField' import commonField from '@/utils/commonField'
export default { export default {
name: 'OpmBlackList', name: 'MemTraffic',
data() { data() {
return { return {
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 总条数 // 总条数
total: 0, total: 0,
// 黑名单表表格数据 // 访问量表表格数据
opmBlackListList: [], memTrafficList: [],
// 弹出层标题 // 弹出层标题
title: '', title: '',
// 是否显示弹出层 // 是否显示弹出层
...@@ -132,13 +86,16 @@ export default { ...@@ -132,13 +86,16 @@ export default {
page: 1, page: 1,
rows: 10, rows: 10,
userId: undefined, userId: undefined,
targetId: undefined, memTraffic: undefined,
flag: '' flag: ''
}, },
// 表单参数 // 表单参数
form: {}, form: {},
// 表单校验 // 表单校验
rules: { rules: {
userId: [
{ required: true, message: '请输入用户id', trigger: 'blur' }
]
} }
} }
}, },
...@@ -151,12 +108,12 @@ export default { ...@@ -151,12 +108,12 @@ export default {
this.getList() // 列表查询 this.getList() // 列表查询
}, },
methods: { methods: {
/** 查询黑名单表列表 */ /** 查询访问量表列表 */
getList() { getList() {
this.loading = true this.loading = true
listOpmBlackList(this.queryParams).then( listMemTraffic(this.queryParams).then(
response => { response => {
this.opmBlackListList = response.data this.memTrafficList = response.data
this.total = response.total this.total = response.total
this.loading = false this.loading = false
} }
...@@ -172,7 +129,7 @@ export default { ...@@ -172,7 +129,7 @@ export default {
this.form = { this.form = {
businessId: undefined, businessId: undefined,
userId: undefined, userId: undefined,
targetId: undefined, memTraffic: undefined,
flag: '1' flag: '1'
} }
this.resetForm('form') this.resetForm('form')
...@@ -188,103 +145,10 @@ export default { ...@@ -188,103 +145,10 @@ export default {
page: 1, page: 1,
rows: 10, rows: 10,
userId: undefined, userId: undefined,
targetId: undefined, memTraffic: undefined,
flag: '' flag: ''
} }
this.handleQuery() this.handleQuery()
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = '添加黑名单表'
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const id = row.businessId
getOpmBlackList(id).then(response => {
this.form = response.data
this.open = true
this.title = '修改黑名单表'
})
},
// 改变状态
handleStatusChange(row) {
const text = row.flag === '1' ? '启用' : '停用'
this.$confirm('确认操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
return updateOpmBlackList(row)
}).then(() => {
this.$message({
message: text + '成功',
type: 'success'
})
}).catch(function() {
row.flag = row.flag === '0' ? '1' : '0'
})
},
/** 提交按钮 */
submitForm: function() {
this.$refs['form'].validate(valid => {
if (valid) {
if (this.form.businessId !== undefined) {
updateOpmBlackList(this.form).then(response => {
this.msgSuccess('修改成功')
this.open = false
this.getList()
})
} else {
addOpmBlackList(this.form).then(response => {
this.msgSuccess('新增成功')
this.open = false
this.getList()
})
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.businessId
this.$confirm('是否确认操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
return delOpmBlackList(id)
}).then(() => {
this.getList()
this.$message({
message: '删除成功',
type: 'success'
})
}).catch(function() {
})
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams
this.$confirm('是否确认操作?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
return exportOpmBlackList(queryParams).then(response => {
const blob = new Blob([response])
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)// 创建下载的链接
downloadElement.href = href
downloadElement.download = '黑名单表信息' + '.xls' // 下载后文件名
document.body.appendChild(downloadElement)
downloadElement.click()// 点击下载
document.body.removeChild(downloadElement)// 下载完成移除元素
window.URL.revokeObjectURL(href)// 释放掉blob对象
})
})
} }
} }
} }
......
...@@ -873,6 +873,9 @@ export default { ...@@ -873,6 +873,9 @@ export default {
getActionTypeLabel(value) { getActionTypeLabel(value) {
const option = this.actionTypeOptions.find(option => option.dictValue === value) const option = this.actionTypeOptions.find(option => option.dictValue === value)
return option ? option.dictLabel : '-' return option ? option.dictLabel : '-'
},
recharge() {
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment