12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <template>
- <div id="cascaderMap">
- <span class="buildFloor" style="margin-right: 12px;">设备类别</span>
- <el-select v-model="value" placeholder="请选择" clearable filterable :style="isWidth ? '' : 'width:160px;'" size="small" @change="changeVal">
- <el-option v-for="item in options" :key="item.Code" :label="item.Name" :value="item.Code"></el-option>
- </el-select>
- </div>
- </template>
- <script>
- import { mapGetters } from 'vuex';
- import { queryModelCategory } from "@/api/data_admin/buildTaskApi"
- export default {
- props: {
- isWidth: {
- type: Boolean,
- default: true
- }
- },
- computed: {
- ...mapGetters("layout", ["projectId"])
- },
- data() {
- return {
- value: "",
- options: []
- };
- },
- created() {
- this.getData();
- },
- watch: {
- projectId() {
- this.value = '';
- this.getData();
- }
- },
- methods: {
- setValue(val) {
- this.value = val
- },
- //修改val
- changeVal(val) {
- let value = {}
- this.options.map(item => {
- if (item.Code == val) {
- value = item
- }
- })
- this.value = val
- this.$emit("change", value)
- },
- //获取当前项目下的模型任务-设备类型
- getData() {
- queryModelCategory('', res => {
- this.options = res.Content
- })
- }
- }
- };
- </script>
- <style lang="less" scoped>
- #cascaderMap {
- float: left;
- margin-left: 10px;
- .buildFloor {
- color: #999999;
- font-size: 14px;
- }
- }
- </style>
|