Files
foton-laws-system-front/src/pages/phone/components/standardSystemPopup.vue
T

154 lines
4.4 KiB
Vue

<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">
<van-field name="radio" label="标准状态">
<template #input>
<van-radio-group v-model="textStatusName" direction="horizontal">
<van-radio name="全部">全部</van-radio>
<van-radio name="现行有效">现行有效</van-radio>
</van-radio-group>
</template>
</van-field>
<standardSystemTree ref="standardSystemTreeRef" :data="standardSystemTreeData" :loading="loading" @checkedKey="getCheckedKey"></standardSystemTree>
</div>
<div class="popup-footer">
<el-button class="common-button-default" size="mini" icon="el-icon-close" @click="handleReset">重置</el-button>
<!--<el-button class="common-button-default" size="mini" icon="el-icon-close" @click="handleCancel">取消</el-button>-->
<el-button class="common-button-primary" size="mini" icon="el-icon-check" type="primary" @click="handleOk">确定</el-button>
</div>
</van-popup>
</template>
<script>
import standardSystemTree from "./standardSystemTree";
export default {
name: "standardSystemPopup",
components: {
standardSystemTree,
},
data () {
return {
popupShow: true,
checkedKeys: [], // 选择的标准体系
textStatusName: '全部',
standardSystemTreeData: [],
loading: false,
api: {
getListStand: 'sarResource/ts-resource/getListStand', // 国内/海外
getListStandLimitData: 'sarResource/ts-resource/getListStandLimitData' // 企标
}
}
},
props: {
// 以前的选中项
initKeys: {
type: Array,
required: true
}
},
methods: {
initOpen () {
this.checkedKeys = []
this.textStatusName = '全部'
this.getData()
this.$refs.standardSystemTreeRef.setCheckedKeys([])
this.popupShow = true
},
open () {
this.getData()
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)
this.$emit('searchQuery', { checkedKeys: this.checkedKeys, textStatusName: this.textStatusName })
// } else {
// // this.$toast('请至少选择一项');
// this.$message.error('请至少选择一项')
// this.popupShow = true
// }
},
handleCancel () {
// if (this.initKeys.length > 0) {
this.hide()
// } else {
// this.$message.error('请至少选择一项')
// this.open()
// }
},
handleReset () {
this.popupShow = false
// this.$emit('standSystemKeys', [])
this.$emit('searchQuery', { checkedKeys: [], textStatusName: '现行有效' })
},
async getData () {
let url = this.api.getListStand
let query = { sorDivide: 'INLAND_STAND' }
switch (this.$route.query.standType) {
case 'INLAND':
break
case 'FOREIGN':
query.sorDivide = 'FOREIGN_STAND'
break
case 'bussstand':
url = this.api.getListStandLimitData
query.sorDivide = 'BUSINESS_STAND'
break
}
//INLAND 国内 FOREIGN 海外 bussstand 企标
const res = await this.$http._getData(url,query,{
_this:this,
loading: 'loading'
})
if (res.ok && res.data) {
this.standardSystemTreeData = res.data
}
},
}
}
</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>