刘翔宇-旅管家 3 years ago
parent a6de97c8d6
commit fc7cfd8cd5

@ -0,0 +1,34 @@
import request from "@/utils/request";
export function index(params) {
return request({
method: 'get',
url: '/api/admin/white_list/index',
params
})
}
export function save(data) {
return request({
url: '/api/admin/white_list/save',
method: 'post',
data
})
}
export function show(params) {
return request({
method: 'get',
url: '/api/admin/white_list/show',
params
})
}
export function destroy(params) {
return request({
method: 'get',
url: '/api/admin/white_list/destroy',
params
})
}

@ -0,0 +1,182 @@
<template>
<div>
<!-- 编辑-->
<xy-dialog :is-show.sync="isShow" title="项目白名单" type="normal" ref="addActivityWhite" @on-ok="editor">
<div>
<el-tag :key="tag" v-for="tag in dynamicTags" closable :disable-transitions="false" @close="handleClose(tag)">
{{tag.mobile}}
</el-tag>
<el-input class="input-new-tag" v-if="inputVisible" v-model="inputValue" ref="saveTagInput" size="small"
@keyup.enter.native="handleInputConfirm" @blur="handleInputConfirm">
</el-input>
<el-button v-else class="button-new-tag" size="small" @click="showInput">+ </el-button>
</div>
</xy-dialog>
</div>
</template>
<script>
import {
save,
show,
index,
destroy
} from "@/api/activity/components/addActivityWhite";
export default {
data() {
return {
isShow: false,
dynamicTags: [],
inputVisible: false,
inputValue: ''
}
},
watch: {
isShow(newVal) {
if (newVal) {
this.dynamicTags=[];
this.inputVisible=false;
this.load();
}
}
},
methods: {
handleClose(tag) {
destroy({
id: tag.id
}).then(response => {
this.$message.success("操作成功");
this.dynamicTags.splice(this.dynamicTags.indexOf(tag), 1);
}).catch(error => {
//reject(error)
this.$message.error("操作失败");
})
},
showInput() {
this.inputVisible = true;
this.$nextTick(_ => {
this.$refs.saveTagInput.$refs.input.focus();
});
},
handleInputConfirm() {
let inputValue = this.inputValue;
if (inputValue) {
let mod = {
mobile: inputValue,
activity_list_id: this.id
}
save(mod).then(res => {
this.load();
this.inputVisible = false;
this.inputValue = '';
}).error(res => {
})
}
},
async load() {
let res = await index({
activity_list_id: this.id,
page_size: 9999,
page: 1
})
this.dynamicTags = res.data;
}
},
computed: {
},
mounted() {
let that = this;
}
}
</script>
<style>
.el-tag+.el-tag {
margin-left: 10px;
margin-bottom: 10px;
}
.button-new-tag {
margin-left: 10px;
height: 32px;
line-height: 30px;
padding-top: 0;
padding-bottom: 0;
}
.input-new-tag {
width: 120px;
margin-left: 10px;
vertical-align: bottom;
}
</style>
<style scoped lang="scss">
.contract-add-plan {
min-height: 30px;
border: 1px solid #dcdee2;
border-radius: 4px;
display: flex;
flex-wrap: wrap;
align-items: center;
align-content: center;
padding: 0 8px;
&-no-plan {
height: 30px;
line-height: 30px;
color: #CDD0D5;
}
}
.xy-table-item-label {
width: 140px;
}
.xy-table-item-price {
position: relative;
&::after {
z-index: 1;
position: absolute;
right: 0;
top: 0;
content: '(元)'
}
::v-deep .el-input__clear {
position: relative;
right: 30px;
z-index: 2;
}
}
.xy-table-item-price-wan {
position: relative;
&::after {
position: absolute;
right: 0;
top: 0;
content: '(万元)'
}
::v-deep .el-input__clear {
position: relative;
right: 46px;
z-index: 2;
}
}
</style>

@ -23,11 +23,12 @@
<xy-table :list="list" :table-item="table" :total="total" @pageSizeChange="pageSizeChange" @pageIndexChange="pageChange">
<template v-slot:btns>
<el-table-column fixed="right" header-align="center" align="center" label="操作" width="300">
<el-table-column fixed="right" header-align="center" align="center" label="操作" width="360">
<template slot-scope="scope">
<div class="slot-btns">
<Button type="primary" @click="edit(scope.row)"></Button>
<Button type="primary" @click="config(scope.row)" style="margin-left: 10px;">配置</Button>
<Button type="primary" @click="white(scope.row)" style="margin-left: 10px;">白名单</Button>
<Button type="error" @click="deleteitem(scope.row)" style="margin-left: 10px;">删除</Button>
</div>
</template>
@ -37,6 +38,7 @@
<addActivity ref="addActivity" @refresh="load()"></addActivity>
<addActivityConfig ref="addActivityConfig" @refresh="load()"></addActivityConfig>
<addActivityWhite ref="addActivityWhite" @refresh="load()"></addActivityWhite>
</div>
@ -52,11 +54,13 @@
import addActivity from '@/views/activity/components/addActivity'
import addActivityConfig from '@/views/activity/components/addActivityConfig'
import addActivityWhite from '@/views/activity/components/addWhite'
export default {
components: {
addActivity,
addActivityConfig
addActivityConfig,
addActivityWhite
},
data() {
return {
@ -158,6 +162,11 @@
this.$refs['addActivityConfig'].isShow = true;
this.$refs['addActivityConfig'].type = 'editor'
},
white(row){
this.$refs['addActivityWhite'].id = row.id;
this.$refs['addActivityWhite'].isShow = true;
this.$refs['addActivityWhite'].type = 'editor'
},
pageChange(e) {
this.select.page = e
this.load()

Loading…
Cancel
Save