master
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>
|
||||||
Loading…
Reference in new issue