<template>
|
<view>
|
<page-nav title="存货档案"></page-nav>
|
|
|
<view class="flex_center" style="margin: 20rpx;">
|
|
<!-- #ifdef H5 -->
|
<u--input prefixIcon="search" prefixIconStyle="font-size: 22px;color: #909399" placeholder="请输入存货信息"
|
style="width:100%;background-color: #fff;border-radius: 40rpx;" border="surround"
|
v-model="inputBoxValue" @change="confirmInputBoxValue">
|
</u--input>
|
<!-- #endif -->
|
|
<!-- #ifdef APP-PLUS -->
|
<u-input prefixIcon="search" prefixIconStyle="font-size: 22px;color: #909399" placeholder="请输入存货信息"
|
style="width:100%;background-color: #fff;border-radius: 40rpx;" border="surround"
|
v-model="inputBoxValue" @change="confirmInputBoxValue">
|
</u-input>
|
<!-- #endif -->
|
|
|
</view>
|
|
|
<u-alert :title="alertTitle" type="info"></u-alert>
|
|
|
<view style="max-height: 540px;overflow: auto;">
|
<u-checkbox-group v-model="checkboxValue" iconPlacement="right" placement="column" @change="checkboxChange">
|
<u-checkbox :key="item.code.trim()+'/'+item.name" :label="item.code.trim()+'/'+item.name"
|
:labelSize='16' :size='16' :borderBottom='true' v-for="item in collapseArr"
|
:name="item.code+'/'+item.name">
|
</u-checkbox>
|
</u-checkbox-group>
|
</view>
|
|
<u-button size="large" type="primary" @click="back" text="确认">
|
</u-button>
|
|
|
</view>
|
</template>
|
|
|
<script>
|
import {
|
InventoryTreePermissions
|
} from '../../config/api.js';
|
export default {
|
onLoad(option) {
|
App.watch(this.getTopRightMessageCountIsChange, 'topRightMessageCountIsChange')
|
|
console.log(option, 66)
|
|
this.checkboxValue = JSON.parse(option.param)
|
|
console.log(this.checkboxValue)
|
},
|
|
onPullDownRefresh() {
|
setTimeout(() => {
|
this.init(() => {
|
uni.stopPullDownRefresh();
|
})
|
}, 1000);
|
},
|
|
data() {
|
return {
|
topRightMessageCount: '',
|
inputBoxValue: '',
|
alertTitle: '',
|
|
collapseArrAll: [],
|
collapseArr: [],
|
checkboxValue: [],
|
|
}
|
},
|
created() {
|
|
},
|
mounted() {
|
this.init()
|
|
this.getInventoryTreePermissions()
|
},
|
methods: {
|
init() {
|
uni.stopPullDownRefresh();
|
},
|
|
//输入框回车确认事件
|
confirmInputBoxValue(val) {
|
console.log('确认', val)
|
// this.getInventoryTreePermissions(val)
|
this.collapseArr = this.collapseArrAll.filter((p) => {
|
return p.code.indexOf(val) !== -1
|
})
|
|
},
|
|
async getInventoryTreePermissions(param) {
|
|
const {
|
data: res
|
} = await InventoryTreePermissions()
|
|
this.collapseArrAll = res
|
this.collapseArr = res
|
this.alertTitle = '产品(共' + res.length + '个)'
|
},
|
|
checkboxChange(val) {
|
console.log(val)
|
this.checkboxValue = val
|
},
|
|
back() {
|
let pages = getCurrentPages() // 获取当前页面栈的实例,以数组形式按栈的顺序给出,第一个元素为首页,最后一个元素为当前页面。
|
let prevPage = pages[pages.length - 2] //上一页页面实例
|
uni.navigateBack({
|
delta: 1, //返回层数,2则上上页
|
success: () => {
|
prevPage.$vm.getCheckboxValue(this.checkboxValue) //上一级的方法事件
|
}
|
})
|
},
|
|
|
|
}
|
|
|
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
@import url('@/style/global.css');
|
|
::v-deep .uicon-arrow-left>span {
|
display: block;
|
}
|
|
::v-deep .u-alert__text--info--light {
|
margin-bottom: 0;
|
font-size: 32rpx !important;
|
padding-left: 10rpx;
|
color: #212121 !important;
|
font-weight: lighter;
|
}
|
|
::v-deep .u-alert--info--light {
|
background-color: rgba(255, 255, 255, 0.7);
|
}
|
|
::v-deep .u-checkbox {
|
height: 33px !important;
|
padding: 5px 10px;
|
border-bottom: 1px solid rgb(214, 215, 217);
|
}
|
</style>
|