emis-frontend/src/views/emis/EmisBaseTools/PostsPicker.vue

68 lines
1.2 KiB
Vue
Raw Normal View History

2024-04-22 05:35:19 +00:00
<template>
2025-07-29 05:32:12 +00:00
<el-select
2024-04-22 05:35:19 +00:00
style="width:100%"
filterable
clearable
v-model="svalue"
:placeholder="placeholder"
@change="onChange">
2025-07-29 05:32:12 +00:00
<el-option v-for="item in optionItems" :key="item.postName" :label="item.postName" :value="item.postName" />
</el-select>
2024-04-22 05:35:19 +00:00
</template>
<script>
import { listPost } from "@/api/system/post";
export default {
name: "PostsPicker",
props: {
value: {
2025-07-29 05:32:12 +00:00
// type: [Array],
type:String,
2024-04-22 05:35:19 +00:00
required: false
},
placeholder:{
type: String,
required: false
},
isInitiated:{
type: [Boolean,String],
required: false,
default:false
}
},
data() {
return {
2025-07-29 05:32:12 +00:00
optionItems: [{"postName":"收派员"},{"postName":"销售顾问"},{"postName":"销售主管"},{"postName":"销售支持"},{"postName":"销售经理"},],
2024-04-22 05:35:19 +00:00
svalue: this.value,
};
},
watch: {
value(newVal) {
this.svalue = newVal;
},
svalue(newVal, oldVal) {
this.$emit("input", this.svalue);
}
},
created() {
2025-07-29 05:32:12 +00:00
// this.queryData();
2024-04-22 05:35:19 +00:00
},
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>