手机端-国内/海外增加搜索条件弹窗、增加企业标准

This commit is contained in:
zyn
2023-09-12 16:59:00 +08:00
parent 24ae8ea131
commit 1331c52246
4 changed files with 267 additions and 16 deletions
@@ -0,0 +1,100 @@
<template>
<van-popup v-model="popupShow"
position="right"
:style="{ height: '100%', width: '90%' }"
round
:close-on-click-overlay="false"
@click-overlay="handleCancel">
<h3 class="popup-title">
<span>标准体系</span>
<van-icon name="cross" size="22px" @click="handleCancel" />
</h3>
<div class="popup-main">
<standardSystemTree ref="standardSystemTreeRef" @checkedKey="getCheckedKey"></standardSystemTree>
</div>
<div class="popup-footer">
<el-button class="common-button-primary" size="mini" icon="el-icon-check" type="primary" @click="handleOk">确定</el-button>
<el-button class="common-button-default" size="mini" icon="el-icon-close" @click="handleCancel">取消</el-button>
</div>
</van-popup>
</template>
<script>
import standardSystemTree from "./standardSystemTree";
export default {
name: "standardSystemPopup",
components: {
standardSystemTree,
},
data () {
return {
popupShow: true,
checkedKeys: [], // 选择的标准体系
}
},
props: {
// 以前的选中项
initKeys: {
type: Array,
required: true
}
},
methods: {
open () {
this.$refs.standardSystemTreeRef.setCheckedKeys(this.initKeys)
this.popupShow = true
},
hide () {
this.popupShow = false
},
getCheckedKey (val) {
this.checkedKeys = val
},
handleOk () {
if (this.checkedKeys.length > 0) {
this.popupShow = false
this.$emit('standSystemKeys', this.checkedKeys)
} else {
// this.$toast('请至少选择一项');
this.$message.error('请至少选择一项')
this.popupShow = true
}
},
handleCancel () {
if (this.initKeys.length > 0) {
this.hide()
} else {
this.$message.error('请至少选择一项')
this.open()
}
},
}
}
</script>
<style scoped>
.popup-title{
line-height: 1rem;
border-bottom: 1px solid #e5e5e5;
padding: 0 0.3rem;
display: flex;
justify-content: space-between;
align-items: center;
}
.popup-main{
height: calc(100vh - 1rem - 50px);
overflow: hidden;
overflow-y: auto;
overflow-x: auto;
}
.popup-footer{
border-top: 1px solid #e8e8e8;
text-align: right;
padding-right: 0.2rem;
height: 50px;
line-height: 50px;
position: fixed;
bottom: 1px;
width: 100%;
}
</style>
@@ -0,0 +1,73 @@
<template>
<el-tree class="popup-tree" ref="tree" :data="data" :props="defaultProps"
:lazy="false"
:show-checkbox="true"
node-key="id"
:check-strictly="true"
:expand-on-click-node="false"
:check-on-click-node="true"
:default-checked-keys="defaultCheckedKeys"
:highlight-current="true"
@node-click="handleNodeClick"
@check-change="handleCheckChange">
</el-tree>
</template>
<script>
export default {
name: "standardSystemTree",
data () {
return {
data: [],
defaultProps: {
children: 'children',
label: 'menuName'
},
defaultCheckedKeys: [],
checkedKeys: []
}
},
created () {
this.getStandardSystem()
},
methods: {
getStandardSystem () {
this.$http._getData('sys/dictype/getDicTypeListCode').then(res => {
if (res.ok && res.data) {
this.data = res.data.TXLBBUSS // 标准体系
}
})
},
handleNodeClick (data, node, element) {
// console.log(data, node, element)
},
handleCheckChange (data, isChecked, childIsChecked) {
const id = data.id
if (isChecked) {
if (!this.checkedKeys.some(key => key === id)) {
this.checkedKeys = [...this.checkedKeys, id]
}
} else {
if (this.checkedKeys.some(key => key === id)) {
this.checkedKeys = this.checkedKeys.filter(key => key !== id)
}
}
this.$emit('checkedKey', this.checkedKeys)
},
setCheckedKeys (keys) {
this.$refs.tree.setCheckedKeys(keys)
}
}
}
</script>
<style scoped lang="less">
.popup-tree{
/deep/ .el-tree-node__expand-icon{
font-size: 20px;
}
/deep/ .el-tree-node__label{
font-size: 18px;
}
}
</style>
+87 -13
View File
@@ -6,16 +6,20 @@
<span class="left-title" @click="back"> < </span>
<span class="right-title">{{titleName}}</span>
</div>
<van-search
v-model="searchKey"
show-action
placeholder="请输入搜索关键词"
@search="onSearch"
>
<template #action>
<div @click="onSearch">搜索</div>
</template>
</van-search>
<div style="display: flex;align-items: center">
<van-search
style="flex: 1"
v-model="searchKey"
show-action
placeholder="请输入搜索关键词"
@search="onSearch"
>
<template #action>
<div @click="onSearch">搜索</div>
</template>
</van-search>
<div @click="onChoose" style="color: #fff;padding: 10px 12px 0 0">选择标准体系</div>
</div>
</div>
<div class="card-box" ref="cardBox" @scroll="scrool">
<div v-if="loading">
@@ -96,12 +100,17 @@
<div v-else-if="!listFlag && moreFlag" @click="moreList" >点击加载更多</div>
<van-loading v-else size="24px" color="#3170A8">加载中...</van-loading>
</div>
<standardSystemPopup :init-keys="standSystemKeys" @standSystemKeys="setStandSystemKeys" ref="standardSystemPopupRef" />
</div>
</template>
<script>
import standardSystemPopup from "./components/standardSystemPopup";
export default {
name: "domesticStand",
components: {
standardSystemPopup,
},
data(){
return{
scrolled: '',
@@ -120,6 +129,7 @@ export default {
textStatusMap: {},// 文本状态id与name对应
natureMap:{},
lawsMap:{},
standSystemKeys: []
}
},
methods:{
@@ -177,6 +187,7 @@ export default {
this.$http.post('search/searchCenter/searchSarBykey',{
selectIndex: 'stand',
selectValue: this.searchKey,
standSystem: this.standSystemKeys,
selectType: 'titleSearch',
standType: 'INLAND',
page: this.page,
@@ -213,6 +224,7 @@ export default {
this.$http.post('search/searchCenter/searchSarBykey',{
selectIndex: 'stand',
selectValue: this.searchKey,
standSystem: this.standSystemKeys,
selectType: 'titleSearch',
standType: 'FOREIGN',
page: this.page,
@@ -230,6 +242,26 @@ export default {
console.log(e)
})
} else if (this.titleType === 'bussstand') {
this.$http.post('search/searchCenter/searchSarBykey',{
selectIndex: 'bussstand',
selectValue: this.searchKey,
standSystem: this.standSystemKeys,
selectType: 'titleSearch',
standType: 'bussstand',
page: this.page,
pageSize: 20
},{
_this: this,
}, res => {
if (res.ok){
this.standList = res.data.list
this.loading = false
}else {
this.$message.error(res.message)
}
}, e => {
})
}else if(this.titleType === 'POLICY'){
// this.$http.get('lawss/sarLawsInfo/page',{
// page: 1,
@@ -250,6 +282,7 @@ export default {
this.$http.post('search/searchCenter/searchSarBykey',{
selectIndex: 'laws',
selectValue: this.searchKey,
standSystem: this.standSystemKeys,
selectType: 'titleSearch',
type: 'laws',
page: this.page,
@@ -271,6 +304,7 @@ export default {
this.$http.get("/lawss/NewsFeed/getNewsFeed", {
messageType: 'ZYBZFG',
standard: this.searchKey,
standSystem: this.standSystemKeys,
page: 1,
paeSize: 10
}, {
@@ -318,6 +352,7 @@ export default {
this.$http.post('search/searchCenter/searchSarBykey',{
selectIndex: 'stand',
selectValue: this.searchKey,
standSystem: this.standSystemKeys,
selectType: 'titleSearch',
standType: 'INLAND',
page: this.page,
@@ -372,6 +407,7 @@ export default {
this.$http.post('search/searchCenter/searchSarBykey',{
selectIndex: 'stand',
selectValue: this.searchKey,
standSystem: this.standSystemKeys,
selectType: 'titleSearch',
standType: 'FOREIGN',
page: this.page,
@@ -397,6 +433,36 @@ export default {
}, e => {
console.log(e)
})
} else if (this.titleType === 'bussstand') {
this.$http.post('search/searchCenter/searchSarBykey',{
selectIndex: 'bussstand',
selectValue: this.searchKey,
standSystem: this.standSystemKeys,
selectType: 'titleSearch',
standType: 'bussstand',
page: this.page,
pageSize: 20
},{
_this: this,
}, res => {
if(res.ok){
if(res.data.list.length){
if(this.standList.length){
this.standList = this.standList.concat(res.data.list)
}else{
this.standList = res.data.list
}
this.loading = false
}else{
this.loading = false
this.listFlag = true
}
}else{
this.$message.error(res.message)
}
}, e => {
console.log(e)
})
}else if(this.titleType === 'POLICY'){
// this.$http.get('lawss/sarLawsInfo/page',{
// lawsNumber: this.searchKey,
@@ -425,6 +491,7 @@ export default {
this.$http.post('search/searchCenter/searchSarBykey',{
selectIndex: 'laws',
selectValue: this.searchKey,
standSystem: this.standSystemKeys,
selectType: 'titleSearch',
type: 'laws',
page: this.page,
@@ -454,6 +521,7 @@ export default {
this.$http.get("/lawss/NewsFeed/getNewsFeed", {
messageType: 'ZYBZFG',
standard: this.searchKey,
standSystem: this.standSystemKeys,
page: 1,
paeSize: 10
}, {
@@ -499,10 +567,17 @@ export default {
this.$set(this.lawsMap, item.value, item.label);
});
},
onChoose () {
this.$refs.standardSystemPopupRef.open()
},
setStandSystemKeys (standSystemKeys) {
this.standSystemKeys = standSystemKeys
this.onSearch()
}
},
mounted() {
this.titleType = this.$route.query.standType
this.titleName = this.titleType === 'INLAND' ? '国内标准法规库' : (this.titleType === 'FOREIGN' ? '海外标准法规库' : this.titleType === 'POLICY' ? '国内外政策库' : '标准化动态库' )
this.titleName = this.titleType === 'INLAND' ? '国内标准法规库' : (this.titleType === 'FOREIGN' ? '海外标准法规库' : this.titleType === 'bussstand' ? '企业标准' : this.titleType === 'POLICY' ? '国内外政策库' : '标准化动态库' )
this.standSearch()
this.$refs.cardBox.addEventListener('scroll', this.scrool);
//从数据库中查询下拉框数据
@@ -533,7 +608,7 @@ export default {
height: 100px;
position: absolute;
top: 0;
z-index: 9999;
z-index: 1000;
background: #3170A8;
}
.head-title{
@@ -632,5 +707,4 @@ export default {
margin-bottom: 30px;
}
}
</style>
+7 -3
View File
@@ -27,9 +27,13 @@
<div class="content-box content-box2"></div>
<span class="content-span">海外标准法规</span>
</div>
<div class="content-top" @click="standChange('POLICY')">
<div class="content-box content-box3"></div>
<span class="content-span">国内外政策</span>
<!--<div class="content-top" @click="standChange('POLICY')">-->
<!-- <div class="content-box content-box3"></div>-->
<!-- <span class="content-span">国内外政策</span>-->
<!--</div>-->
<div class="content-top" @click="standChange('bussstand')">
<div class="content-box content-box3" style="margin-left: 0.2em"></div>
<span class="content-span">企业标准</span>
</div>
<div class="content-top" @click="standChange('DYNAMIC')">
<div class="content-box content-box4"></div>