super whitelist
This commit is contained in:
parent
e26207482a
commit
066a1c57a0
@ -40,3 +40,26 @@ export function uploadWhiteList(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export function addSuperWhiteList(data) {
|
||||
return request({
|
||||
url: '/super_whitelist/add',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function getSuperWhiteList(data) {
|
||||
return request({
|
||||
url: '/super_whitelist/list',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function updateSuperWhiteList(data) {
|
||||
return request({
|
||||
url: '/super_whitelist/edit',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
@ -341,6 +341,12 @@ export const asyncRoutes = [
|
||||
component: () => import('@/views/whitelist/index'),
|
||||
name: 'whitelist',
|
||||
meta: { title: '白名单', pername: 'whitelist' }
|
||||
},
|
||||
{
|
||||
path: 'superwhitelist',
|
||||
component: () => import('@/views/whitelist/super'),
|
||||
name: 'superwhitelist',
|
||||
meta: { title: '至尊白名单', pername: 'superwhitelist' }
|
||||
}
|
||||
]
|
||||
}
|
||||
|
214
src/views/whitelist/super.vue
Normal file
214
src/views/whitelist/super.vue
Normal file
@ -0,0 +1,214 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div class="filter-container">
|
||||
<el-button class="filter-item" style="margin-left: 10px;" type="primary" @click="handleCreate">
|
||||
新增
|
||||
</el-button>
|
||||
</div>
|
||||
<el-table
|
||||
:data="superwhitelist"
|
||||
border
|
||||
fit
|
||||
highlight-current-row
|
||||
style="width: 100%;"
|
||||
|
||||
:empty-text="emptytext"
|
||||
height="480"
|
||||
>
|
||||
<el-table-column
|
||||
label="账号/钱包/email"
|
||||
prop="user_identity"
|
||||
/>
|
||||
<el-table-column
|
||||
label="是否生效"
|
||||
|
||||
align=" "
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<svg-icon v-if="scope.row.enable === 1" icon-class="ok" style="font-size: 20px;" />
|
||||
<svg-icon v-else icon-class="no" style="font-size: 20px;" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
fixed="right"
|
||||
label="操作"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="small" @click="handleUpdate(scope.row)">编辑</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
background
|
||||
:current-page="curpage"
|
||||
:page-size="page_size"
|
||||
:page-count="totalpage"
|
||||
layout="prev, pager, next"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
<el-dialog :title="dialogTitle" :visible.sync="dialogFormVisible" :close-on-click-modal="false" @close="handleDialogClose()">
|
||||
<el-form ref="form" :rules="rules" :model="form" label-position="left" label-width="130px" style="width: 400px; margin-left:50px;">
|
||||
<el-form-item label="账号/钱包/email" prop="user_identity">
|
||||
<el-input v-model="form.user_identity" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否生效">
|
||||
<el-switch
|
||||
v-model="form.enable"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = handleDialogClose()">
|
||||
Cancel
|
||||
</el-button>
|
||||
<el-button type="primary" @click="dialogStatus==='create'?createData():updateData()">
|
||||
Confirm
|
||||
</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import Pagination from '@/components/Pagination/index.vue'
|
||||
import { addSuperWhiteList, getSuperWhiteList, updateSuperWhiteList } from '@/api/whitelist'
|
||||
import { parseTime } from '@/utils'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
user_identity: '',
|
||||
enable: 1
|
||||
},
|
||||
dialogFormVisible: false,
|
||||
dialogStatus: '',
|
||||
listLoading: true,
|
||||
superwhitelist: [],
|
||||
dialogTitle: '新增',
|
||||
emptytext: ' ',
|
||||
totalpage: 0,
|
||||
curpage: 1,
|
||||
page_size: 8,
|
||||
rules: {
|
||||
user_identity: [{ required: true, message: 'required', trigger: 'blur' }]
|
||||
},
|
||||
uploadUrl: '',
|
||||
uploadData: {
|
||||
file: ''
|
||||
},
|
||||
filelist: []
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
parseTime,
|
||||
handleDialogClose() {
|
||||
// this.getList()
|
||||
},
|
||||
handleUpdate(row) {
|
||||
console.log(row)
|
||||
this.form.enable = row.enable
|
||||
this.form.user_identity = row.user_identity
|
||||
this.dialogStatus = 'update'
|
||||
this.dialogTitle = '编辑'
|
||||
this.dialogFormVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['form'].clearValidate()
|
||||
})
|
||||
},
|
||||
getList() {
|
||||
console.log('curpage ', this.curpage)
|
||||
const data = {
|
||||
'page_dto': {
|
||||
'page': this.curpage,
|
||||
'pageSize': this.page_size
|
||||
}
|
||||
}
|
||||
console.log('data', data)
|
||||
getSuperWhiteList(data).then(response => {
|
||||
console.log(response)
|
||||
this.superwhitelist = response.data
|
||||
this.totalpage = response.total_page
|
||||
this.curpage = response.cur_page
|
||||
// this.pager = response.cur_page
|
||||
if (this.superwhitelist === undefined || this.superwhitelist.length <= 0) {
|
||||
this.emptytext = 'No data'
|
||||
}
|
||||
})
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.curpage = val
|
||||
this.getList()
|
||||
},
|
||||
handleCreate() {
|
||||
this.resetTemp()
|
||||
this.dialogStatus = 'create'
|
||||
this.dialogTitle = '新增'
|
||||
this.dialogFormVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['form'].clearValidate()
|
||||
})
|
||||
},
|
||||
resetTemp() {
|
||||
this.form = {
|
||||
user_identity: '',
|
||||
enable: 0
|
||||
}
|
||||
},
|
||||
createData() {
|
||||
console.log('add ', this.form)
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
addSuperWhiteList(this.form).then(response => {
|
||||
if (response.code === 0) {
|
||||
this.dialogFormVisible = false
|
||||
this.getList()
|
||||
this.$notify({
|
||||
title: 'Success',
|
||||
message: 'Created Successfully',
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
updateData() {
|
||||
console.log('update', this.form)
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
updateSuperWhiteList(this.form).then(response => {
|
||||
if (response.code === 0) {
|
||||
this.dialogFormVisible = false
|
||||
this.getList()
|
||||
this.$notify({
|
||||
title: 'Success',
|
||||
message: 'Updated Successfully',
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
modeUpload(item) {
|
||||
this.uploadData.file = item.file
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user