kun 10/6/22:48

This commit is contained in:
沈学坤
2019-10-06 22:48:06 +08:00
parent a19326ecc6
commit 60fa6ac94e
8 changed files with 515 additions and 305 deletions

View File

@@ -14,22 +14,22 @@
</div>
<!-- 分类搜索 -->
<div class="select-box">
<select name="type" v-model="screeOut.type" @change="scree()">
<select name="type" v-model="screeOut.society_type" @change="scree()">
<option value="类型" disabled style="display:none;">类型</option>
<option value="社会">社会</option>
<option value="团体">团体</option>
</select>
<select name="time" v-model="screeOut.date_time" @change="scree()">
<select name="time" v-model="screeOut.reg_time0" @change="scree()">
<option value="登记时间" disabled style="display:none;">登记时间</option>
<option value="09-18">09-18</option>
<option value="09-19">09-19</option>
</select>
<select name="year" v-model="screeOut.date_year" @change="scree()">
<select name="year" v-model="screeOut.reg_time1" @change="scree()">
<option value="年检年份" disabled style="display:none;">年检年份</option>
<option value="2017">2017</option>
<option value="2019">2019</option>
</select>
<select name="condition" v-model="screeOut.zt" @change="scree()">
<select name="condition" v-model="screeOut.status" @change="scree()">
<option value="年检情况" disabled style="display:none;">年检情况</option>
<option value="正常">正常</option>
<option value="异常">异常</option>
@@ -66,34 +66,38 @@
</tr>
<template v-if="searchValue.length == 0">
<tr
v-for="(item,index) in sData"
v-for="(info,index) in conversion"
:key="index"
:class="index % 2 == 0 ? 'bgcbz' : 'bgcz'"
class="tr"
>
<td>{{item.organization}}</td>
<td>{{item.credit}}</td>
<td>{{item.type}}</td>
<td>{{item.representative}}</td>
<td>{{item.date_year + '-' + item.date_time}}</td>
<td v-if="item.zt == '正常'" style="color:#2fd63f">{{item.zt}}</td>
<td v-if="item.zt == '异常'" style="color:#e13232">{{item.zt}}</td>
<td>{{info.name}}</td>
<td>{{info.unicode}}</td>
<td>{{info.society_type}}</td>
<td>{{info.legal_person}}</td>
<td>{{info.reg_time}}</td>
<!-- <td v-if="info.status == 1" style="color:#2fd63f">正常</td>
<td v-if="info.status == 0" style="color:#e13232">异常</td>-->
<td v-if="info.status == '正常'" style="color:#2fd63f">{{info.status}}</td>
<td v-if="info.status == '异常'" style="color:#e13232">{{info.status}}</td>
</tr>
</template>
<template v-if="searchValue.length > 0">
<tr
class="tr"
v-for="(item,index) in searchValue"
v-for="(info,index) in searchValue"
:key="index"
:class="index % 2 == 0 ? 'bgcbz' : 'bgcz'"
>
<td>{{item.organization}}</td>
<td>{{item.credit}}</td>
<td>{{item.type}}</td>
<td>{{item.representative}}</td>
<td>{{item.date_year + '-' + item.date_time}}</td>
<td v-if="item.zt == '正常'" style="color:#2fd63f">{{item.zt}}</td>
<td v-if="item.zt == '异常'" style="color:#e13232">{{item.zt}}</td>
<td>{{info.name}}</td>
<td>{{info.unicode}}</td>
<td>{{info.society_type}}</td>
<td>{{info.legal_person}}</td>
<td>{{info.reg_time}}</td>
<!-- <td v-if="info.status == 1" style="color:#2fd63f">正常</td>
<td v-if="info.status == 0" style="color:#e13232">异常</td>-->
<td v-if="info.status == '正常'" style="color:#2fd63f">{{info.status}}</td>
<td v-if="info.status == '异常'" style="color:#e13232">{{info.status}}</td>
</tr>
</template>
</table>
@@ -126,73 +130,15 @@ export default {
searchValue: [],
record: [],
screeOut: {
type: '类型',
date_time: '登记时间',
date_year: '年检年份',
zt: '年检情况'
society_type: '类型',
reg_time0: '登记时间',
reg_time1: '年检年份',
status: '年检情况'
},
sData: [
{
id: 1,
organization: "劳动经济学会",
credit: "51100000MJ000035X2",
type: "团体",
representative: "王五",
date_time: "09-18",
date_year: '2019',
zt: '正常'
},
{
id: 2,
organization: "华为",
credit: "51100000MJ000035X2",
type: "社会",
representative: "李四",
date_time: "09-19",
date_year: '2017',
zt: '正常'
},
{
id: 4,
organization: "华为",
credit: "51100000MJ000035X2",
type: "团体",
representative: "李四",
date_time: "09-19",
date_year: '2019',
zt: '异常'
},
{
id: 5,
organization: "华为",
credit: "51100000MJ000035X2",
type: "社会",
representative: "李四",
date_time: "09-18",
date_year: '2017',
zt: '异常'
},
{
id: 6,
organization: "华为",
credit: "51100000MJ000035X2",
type: "社会",
representative: "李四",
date_time: "09-19",
date_year: '2019',
zt: '正常'
},
{
id: 3,
organization: "小米",
credit: "51100000MJ000035X2",
type: "手机",
representative: "张三",
date_time: "09-18",
date_year: "2017",
zt: '异常'
}
]
bgData: [],
arr1: [],
arr0: [],
conversion: []
};
},
computed: {},
@@ -209,61 +155,63 @@ export default {
this.getSearch(str)
},
/** 筛选函数 */
scree() {
if (this.screeOut.type == "类型") {
this.screeOut.type = ''
} else {
this.record.push({ category: '类型', nameOf: this.screeOut.type })
}
// scree() {
// if (this.screeOut.society_type == "类型") {
// this.screeOut.society_type = ''
// } else {
// this.record.push({ category: '类型', nameOf: this.screeOut.society_type })
// }
if (this.screeOut.date_time == "登记时间") {
this.screeOut.date_time = ''
} else {
this.record.push({ category: '登记时间', nameOf: this.screeOut.date_time })
}
// if (this.screeOut.reg_time == "登记时间") {
// this.screeOut.reg_time = ''
// } else {
// this.record.push({ category: '登记时间', nameOf: this.screeOut.reg_time })
// }
if (this.screeOut.date_year == "年检年份") {
this.screeOut.date_year = ''
} else {
this.record.push({ category: '年检年份', nameOf: this.screeOut.date_year })
}
// if (this.screeOut.reg_time == "年检年份") {
// this.screeOut.reg_time = ''
// } else {
// this.record.push({ category: '年检年份', nameOf: this.screeOut.reg_time })
// }
if (this.screeOut.zt == "年检情况") {
this.screeOut.zt = ''
} else {
this.record.push({ category: '年检情况', nameOf: this.screeOut.zt })
}
// if (this.screeOut.status == "年检情况") {
// this.screeOut.status = ''
// } else {
// this.record.push({ category: '年检情况', nameOf: this.screeOut.status })
// }
/**
let hash = {};
this.record = this.record.reduce((preVal, curVal) => {
hash[curVal.nameOf] ? '' : hash[curVal.nameOf] = true && preVal.push(curVal);
return preVal
}, [])
*/
// /**
// let hash = {};
// this.record = this.record.reduce((preVal, curVal) => {
// hash[curVal.nameOf] ? '' : hash[curVal.nameOf] = true && preVal.push(curVal);
// return preVal
// }, [])
// */
this.record = this.$tool.arrayHeavy(this.record, 'nameOf')
// console.log(this.record)
let gData = this.$tool.multiFilter(this.sData, this.screeOut)
if (gData != undefined && gData != '') {
this.searchValue = gData
} else {
this.$message('您搜索的内容暂无~')
}
// this.record = this.$tool.arrayHeavy(this.record, 'nameOf')
if (this.screeOut.type == "") {
this.screeOut.type = '类型'
}
if (this.screeOut.date_time == "") {
this.screeOut.date_time = '登记时间'
}
if (this.screeOut.date_year == "") {
this.screeOut.date_year = '年检年份'
}
if (this.screeOut.zt == "") {
this.screeOut.zt = '年检情况'
}
},
// let gData = this.$tool.multiFilter(this.bgData, this.screeOut)
// if (gData != undefined && gData != '') {
// this.searchValue = gData
// } else {
// this.$message('您搜索的内容暂无~')
// }
// if (this.screeOut.society_type == "") {
// this.screeOut.society_type = '类型'
// }
// if (this.screeOut.reg_time == "") {
// this.screeOut.reg_time = '登记时间'
// }
// if (this.screeOut.reg_time == "") {
// this.screeOut.reg_time = '年检年份'
// }
// if (this.screeOut.status == "") {
// this.screeOut.status = '年检情况'
// }
// },
/** 搜索函数 */
getSearch(str) {
this.searchValue = [];
@@ -275,9 +223,7 @@ export default {
return;
}
let searchData = this.$tool.setSearch(this.sData, this.searchVal)
// console.log(searchData);
let searchData = this.$tool.setSearch(this.bgData, this.searchVal)
if (searchData != undefined && searchData != '') {
this.searchValue = searchData
@@ -304,12 +250,60 @@ export default {
let s = this.sub;
s = index;
this.sub = s;
let t0 = this.arr0
let t1 = this.arr1
let t2 = this.bgData
switch (this.sub) {
case 0:
this.conversion = t2;
break;
case 1:
this.conversion = t0;
break;
case 2:
this.conversion = t1;
break;
default:
break;
}
},
/** 获取后台数据 */
getData() { }
getData() {
let _this = this
this.$http({
method: 'post',
url: 'v1/society/society',
data: {}
}).then(res => {
if (res.data.code !== 200) {
return;
}
_this.bgData = res.data.data.data.info
_this.conversion = _this.bgData
_this.bgData.forEach((item, index) => {
switch (item.status) {
case '异常':
_this.arr0.push(item);
break;
case '正常':
_this.arr1.push(item);
break;
default:
break;
}
})
})
// eslint-disable-next-line handle-callback-err
.catch(err => {
console.log(err)
})
}
},
created() {
this.getData()
},
mounted() {
this.getData();
@@ -382,7 +376,6 @@ export default {
&:nth-of-type(3) {
width: 240px;
border-left: 1px solid #dcebf6;
}
&:nth-of-type(4) {
width: 160px;
@@ -391,7 +384,6 @@ export default {
&:nth-of-type(5) {
width: 160px;
border-left: 1px solid #dcebf6;
}
&:nth-of-type(6) {
width: 160px;
@@ -400,7 +392,6 @@ export default {
&:nth-of-type(7) {
width: 140px;
border-left: 1px solid #dcebf6;
}
}