126 lines
3.3 KiB
Vue
126 lines
3.3 KiB
Vue
<template>
|
|
<page-meta :page-style="'overflow:'+(visible?'hidden':'visible')"></page-meta>
|
|
<uni-popup ref="popup" type="center" :mask-click="false">
|
|
<scroll-view scroll-y style="width: 100vw;height: 100vh;">
|
|
<view :style="{padding: this.CustomBar + 15 + 'px 15px 15px 15px'}">
|
|
<checkbox-group @change="change">
|
|
<view v-for="(item,index) in list" :key="index" style="display: flex;margin-top: 15upx">
|
|
<checkbox :value="type === 'assignments' ? item.CHECK_NO : item.NAME" :checked="value.indexOf(type === 'assignments' ? item.CHECK_NO : item.NAME) !== -1" />
|
|
<view style="padding-left: 10upx;">{{ type === 'assignments' ? item.CHECK_NO : item.NAME }}</view>
|
|
</view>
|
|
</checkbox-group>
|
|
</view>
|
|
<view class="cu-bar btn-group" style="margin-top: 50upx;">
|
|
<button class="cu-btn bg-blue margin-tb-sm lg" @click="determine">确定</button>
|
|
<button class="cu-btn bg-grey margin-tb-sm lg" @click="close">关闭</button>
|
|
</view>
|
|
</scroll-view>
|
|
</uni-popup>
|
|
</template>
|
|
|
|
<script>
|
|
import uniPopup from '@/components/more-select/uni-popup/uni-popup.vue';
|
|
import {basePath, loginUser} from "@/common/tool";
|
|
export default {
|
|
components: {
|
|
uniPopup,
|
|
},
|
|
props: {
|
|
visible: {
|
|
type: Boolean,
|
|
required: true,
|
|
default: false
|
|
},
|
|
value:{
|
|
type: String,
|
|
required: true,
|
|
default: ''
|
|
},
|
|
type:{
|
|
type: String,
|
|
required: true,
|
|
default: ''
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
list: [],
|
|
selectValue:[],
|
|
}
|
|
},
|
|
watch:{
|
|
visible:{
|
|
handler(newValue) {
|
|
if (newValue) this.getData()
|
|
},
|
|
immediate:true
|
|
}
|
|
},
|
|
methods: {
|
|
getData() {
|
|
uni.showLoading({
|
|
title: '请稍候'
|
|
})
|
|
let url = ''
|
|
let data = {}
|
|
if(this.type === 'assignments') {
|
|
url = 'app/eightwork/list'
|
|
data = {
|
|
CORPINFO_ID:loginUser.CORPINFO_ID
|
|
}
|
|
} else {
|
|
url = 'app/eightwork/getInfo'
|
|
data = {
|
|
vectors: JSON.stringify([ 'accidentType'])
|
|
}
|
|
}
|
|
uni.request({
|
|
url: basePath + url,
|
|
method: 'POST',
|
|
header: {
|
|
'Content-type': 'application/x-www-form-urlencoded'
|
|
},
|
|
data,
|
|
success: (res) => {
|
|
if ("success" === res.data.result) {
|
|
uni.hideLoading();
|
|
this.list = this.type === 'assignments' ? res.data.varList : res.data.accidentType
|
|
this.$nextTick(() => {
|
|
this.$refs.popup.open()
|
|
})
|
|
} else if ("exception" === res.data.result) {
|
|
uni.showToast({
|
|
title: '错误',
|
|
duration: 2000
|
|
});
|
|
}
|
|
}
|
|
});
|
|
},
|
|
change(event){
|
|
this.selectValue = event.detail.value
|
|
},
|
|
close(){
|
|
this.$emit('update:visible',false)
|
|
this.$refs.popup.close()
|
|
},
|
|
determine(){
|
|
const value = []
|
|
for (let i = 0; i < this.selectValue.length; i++) {
|
|
if(this.value.indexOf(this.selectValue[i]) === -1){
|
|
value.push(this.selectValue[i])
|
|
}
|
|
}
|
|
this.value && value.unshift(this.value)
|
|
const emitValue = value.join(',')
|
|
this.$emit('input',emitValue)
|
|
this.close()
|
|
}
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
|
|
</style>
|