| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <template>
- <el-select v-model="msgCatId" value-key="msgCatId" style="width: 100%" filterable placeholder="请选择消息类型">
- <el-option-group>
- <el-option
- v-for="item in msgCatList"
- :key="item.msgCatId"
- :label="item.msgCatTitle"
- :value="item.msgCatId"
- />
- </el-option-group>
- </el-select>
- </template>
- <script>
- import { getMsgCatByList } from '@/api/system/msgCatApi'
- export default {
- name: 'MsgCatSelector',
- components: { },
- props: {
- value: {
- type: Number,
- default: undefined
- }
- },
- data() {
- return {
- msgCatId: undefined,
- msgCatList: []
- }
- },
- watch: {
- value(val) {
- this.msgCatId = val
- },
- msgCatId(val) {
- this.$emit('input', val)
- }
- },
- created() {
- this.initMsgCatListData()
- },
- mounted() {},
- methods: {
- // Init Measure Type List
- initMsgCatListData() {
- getMsgCatByList().then((resp) => {
- const { code, data, msg } = resp
- if (code === 200) {
- this.msgCatList = data
- } else {
- this.$message.error(msg)
- }
- }).catch((error) => {
- console.log(error)
- })
- }
- }
- }
- </script>
|