Commit 984da8fd authored by Davve's avatar Davve

优化用户查询

parent 1b827b1c
......@@ -286,7 +286,7 @@ class APIView(View):
def make_pair(self, data):
val = data.pop('value', '')
key = data.pop('key', '')
if key and key not in ['id']:
if key and key not in ['id', 'user_id']:
key += '__contains'
if key:
data.update({key: val})
......
......@@ -201,6 +201,11 @@ export default {
})
},
effectPush() {
if (this.postForm.push_time < Date.now()){
this.$message.error("推送时间已过期, 请重新设置!!");
return false
}
this.is_effect = Boolean(1);
const id = this.$route.params && this.$route.params.id
EffectPushTask(id).then(response => {
......
......@@ -22,13 +22,17 @@
<div class="postInfo-container">
<el-row>
<el-col :span="12">
<el-form-item style="margin-bottom: 20px;" label-width="75px" label="标签ID:" prop="position" v-if="isEdit">
<el-input :rows="1" v-model="postForm.id" type="number" class="article-textarea" style="width: 300px" disabled />
<el-form-item style="margin-bottom: 20px;" label-width="75px" label="标签ID:" prop="position"
v-if="isEdit">
<el-input :rows="1" v-model="postForm.id" type="number" class="article-textarea"
style="width: 300px" disabled/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item style="margin-bottom: 20px;" label-width="75px" label="创建时间:" prop="position" v-if="isEdit">
<el-input :rows="1" v-model="postForm.create_time" type="text" class="article-textarea" style="width: 300px" disabled />
<el-form-item style="margin-bottom: 20px;" label-width="75px" label="创建时间:" prop="position"
v-if="isEdit">
<el-input :rows="1" v-model="postForm.create_time" type="text" class="article-textarea"
style="width: 300px" disabled/>
</el-form-item>
</el-col>
</el-row>
......@@ -38,9 +42,11 @@
<el-row>
<el-col :span="12">
<el-form-item label-width="75px" label="上级标签:" class="postInfo-container-item">
<el-select v-model="postForm.up_tags" :remote-method="getRemoteTagList" filterable remote multiple value-key="id"
<el-select v-model="postForm.up_tags" :remote-method="getRemoteTagList" filterable remote multiple
value-key="id"
placeholder="搜索标签" style="width: 70%">
<el-option v-for="(item,index) in TagListOptions" :key="item+index" :label="item.name" :value="item.id"/>
<el-option v-for="(item,index) in TagListOptions" :key="item+index" :label="item.name"
:value="item.id"/>
</el-select>
</el-form-item>
</el-col>
......@@ -59,7 +65,8 @@
:loading="loading"
value-key="id"
>
<el-option v-for="(item, index) in TagListOptions" :key="item+index" :label="item.name" :value="item.id"/>
<el-option v-for="(item, index) in TagListOptions" :key="item+index" :label="item.name"
:value="item.id"/>
</el-select>
</el-form-item>
</el-col>
......@@ -80,12 +87,12 @@
import Sticky from '@/components/Sticky' // 粘性header组件
import {fetchTagDetail, CreateTag} from '@/api/tag'
import {tagSearch} from '@/api/remoteSearch'
import { isInArray, removeByvale} from "@/utils";
import {isInArray, removeByvale} from "@/utils";
function Assembledata(target, source) {
var region_data = []
for (var i=0;i<target.length;i++){
if (isInArray(source, target[i]['name'])){
for (var i = 0; i < target.length; i++) {
if (isInArray(source, target[i]['name'])) {
region_data.push(target[i]['id'])
removeByvale(source, target[i]['name']);
}
......@@ -131,8 +138,8 @@
name: [{validator: validateRequire, trigger: 'blur'}],
},
tempRoute: {},
temparray:{
'up_tags':[],
temparray: {
'up_tags': [],
'down_tags': [],
}
}
......@@ -159,13 +166,12 @@
let rep = response.data.data.data;
let up_temp = []
let down_temp = []
console.log(rep.up_tags,'-=========', rep.up_tags.length)
for (let i=0;i<rep.up_tags.length;i++){
for (let i = 0; i < rep.up_tags.length; i++) {
up_temp.push(rep.up_tags[i]['name']);
this.temparray['up_tags'].push(rep.up_tags[i])
}
console.log(rep.down_tags.length)
for (let i=0;i<rep.down_tags.length;i++){
for (let i = 0; i < rep.down_tags.length; i++) {
down_temp.push(rep.down_tags[i]['name']);
this.temparray['down_tags'].push(rep.down_tags[i])
}
......@@ -181,14 +187,31 @@
this.$refs.postForm.validate(valid => {
if (valid) {
this.loading = true;
if (this.isEdit){
if (this.isEdit) {
this.postForm.up_tags = Assembledata(this.temparray['up_tags'], this.postForm.up_tags);
this.postForm.down_tags = Assembledata(this.temparray['down_tags'], this.postForm.down_tags);
}else{
} else {
this.postForm.up_tags = this.postForm.up_tags.join(',')
this.postForm.down_tags = this.postForm.down_tags.join(',')
}
let flag = false;
let up_tag_arrays = this.postForm.up_tags.split(',')
let down_tags_arrays = this.postForm.down_tags.split(',')
for (let i = 0; i< up_tag_arrays.length; i++){
if (isInArray(down_tags_arrays, up_tag_arrays[i])){
this.$message.error('上下级标签不能存相同标签')
this.postForm.up_tags = [];
this.postForm.down_tags = [];
flag = true;
break
}
}
if (flag){
return false;
}
CreateTag(this.postForm).then(response => {
this.$notify({
title: '成功',
......
......@@ -220,7 +220,7 @@
const defaultForm = {
status: 'draft',
uploadType: '',
is_recommend: 1,
is_recommend: 0,
user_id: '',
create_time: '',
topic_nums: 0,
......
......@@ -149,13 +149,9 @@
is_recommend: '',
},
},
BooleanTypeOptions: [
{'key': 1, 'display_name': '是'},
{'key': 0, 'display_name': '否'}
],
ReBooleanTypeOptions: [
{'key': 1, 'display_name': '是'},
{'key': 0, 'display_name': '否'}
{'key': '1', 'display_name': '是'},
{'key': '0', 'display_name': '否'}
],
IdentifyTypeOptions: [
{'key': 1, 'display_name': '组长'},
......@@ -164,14 +160,14 @@
{'key': 4, 'display_name': '普通群员'},
],
UserTypeOptions: [
{'key': 0, 'display_name': '普通用户'},
{'key': 1, 'display_name': '马甲用户'}
{'key': '0', 'display_name': '普通用户'},
{'key': '1', 'display_name': '马甲用户'}
],
SearchTypeOptions: [
{'key': 'id', 'display_name': 'ID'},
{'key': 'user_id', 'display_name': '用户ID'},
{'key': 'name', 'display_name': '用户名'},
{'key': 'phone', 'display_name': '联系电话'},
{'key': 'nick_name', 'display_name': '用户名'},
{'key': 'phone_num', 'display_name': '联系电话'},
]
}
},
......
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