79 lines
1.3 KiB
Vue
79 lines
1.3 KiB
Vue
<template>
|
|
<!-- <el-select
|
|
style="width:100%"
|
|
filterable
|
|
clearable
|
|
multiple
|
|
v-model="svalue"
|
|
:placeholder="placeholder"
|
|
@change="onChange">
|
|
<el-option v-for="item in optionItems" :key="item.postCode" :label="item.postName" :value="item.postCode" />
|
|
</el-select> -->
|
|
|
|
|
|
<el-checkbox-group v-model="svalue" @change="getCheckAll">
|
|
<el-checkbox
|
|
v-for="item in optionItems"
|
|
:key="item.postId"
|
|
:label="item.postName"
|
|
></el-checkbox>
|
|
</el-checkbox-group>
|
|
|
|
</template>
|
|
<script>
|
|
import { listPost } from "@/api/system/post";
|
|
|
|
export default {
|
|
name: "PostsPicker",
|
|
props: {
|
|
value: {
|
|
type: [Array],
|
|
required: false
|
|
},
|
|
placeholder:{
|
|
type: String,
|
|
required: false
|
|
},
|
|
isInitiated:{
|
|
type: [Boolean,String],
|
|
required: false,
|
|
default:false
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
optionItems: [],
|
|
svalue: this.value,
|
|
};
|
|
},
|
|
watch: {
|
|
value(newVal) {
|
|
this.svalue = newVal;
|
|
},
|
|
svalue(newVal, oldVal) {
|
|
this.$emit("input", this.svalue);
|
|
}
|
|
},
|
|
created() {
|
|
this.queryData();
|
|
},
|
|
methods: {
|
|
onChange() {
|
|
this.$emit("input", this.svalue);
|
|
this.$emit("onChange");
|
|
},
|
|
queryData() {
|
|
|
|
let queryParams = {
|
|
pageNum: 1,
|
|
pageSize: 3000,
|
|
};
|
|
listPost(queryParams).then(response => {
|
|
this.optionItems = response.rows;
|
|
});
|
|
},
|
|
|
|
}
|
|
};
|
|
</script>
|