| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <template>
- <el-select v-model="checklistCatId" value-key="checklistCatId" style="width: 100%" filterable placeholder="请选择清单分类">
- <el-option-group>
- <el-option
- v-for="item in checklistCatList"
- :key="item.checklistCatId"
- :label="item.checklistCatTitle"
- :value="item.checklistCatId"
- />
- </el-option-group>
- </el-select>
- </template>
- <script>
- import { getChecklistCatByList } from '@/api/system/checklistCatApi'
- export default {
- name: 'ChecklistCatSelector',
- components: { },
- props: {
- value: {
- type: Number,
- default: undefined
- }
- },
- data() {
- return {
- checklistCatId: undefined,
- checklistCatList: []
- }
- },
- watch: {
- value(val) {
- this.checklistCatId = val
- },
- checklistCatId(val) {
- this.$emit('input', val)
- }
- },
- created() {
- this.initChecklistCatData()
- },
- mounted() {},
- methods: {
- // 检查表清单
- initChecklistCatData() {
- getChecklistCatByList().then((resp) => {
- const { code, data, msg } = resp
- if (code === 200) {
- this.checklistCatList = data
- } else {
- this.$message.error(msg)
- }
- }).catch((error) => {
- console.log(error)
- })
- }
- }
- }
- </script>
|