文件
mashangyoujiu/Public/js/component-operator.js

48 行
1.4 KiB
JavaScript
可执行文件

/**
* @description 操作人选择器
*/
Vue.component('component-operator', {
template: `
<div id="component-operator">
<el-select v-model="operatorId" placeholder="请选择操作人" @change="operatorChange">
<el-option v-for="option in options" :key="option.id" :label="option.name" :value="option.id">
</el-option>
</el-select>
</div>
`,
data() {
return {
requestUrl: { //各个角色的记录获取路径
1: 'Admin/AdminRoles/getOperatorList',
2: 'Agent/AgentRoles/getOperatorList',
3: 'Retail/MerchantRoles/getOperatorList'
},
options: [],
operatorId: ''
}
},
methods: {
/**
* @description 获取操作人列表
*/
getOperator() {
this.sendRequest(this.requestUrl[this.type], {
success: (response) => {
if (response.status == 1) {
this.options = response.data.list
}
}
});
},
/**
* @description 操作人选择变化
*/
operatorChange(id) {
this.$emit('update:id', id)
}
},
created() {
this.getOperator()
},
props: ['type', 'id']
})