<template>
|
<el-dialog v-model="dialogVisible" :fullscreen="full" title="选择类型/类别外键" width="50%" draggable>
|
<el-button @click="toggleFullscreen" size="small" class="pot" :icon="FullScreen"></el-button>
|
<el-row>
|
<el-col :span="17">
|
<!-- <el-form ref="ruleFormRef" :model="ruleForm" status-icon>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item size="default">
|
<el-input v-model="ruleForm.pass" placeholder="类别名称" />
|
</el-form-item>
|
</el-col>
|
<el-col :span="6" :offset="1">
|
<el-form-item>
|
<el-input v-model="ruleForm.checkPass" placeholder="目标指标编号" />
|
</el-form-item>
|
</el-col>
|
<el-col :span="11" :offset="1">
|
<el-form-item>
|
<el-button size="default" type="primary" @click="submitForm(ruleFormRef)">查询</el-button>
|
<el-button size="default" @click="resetForm(ruleFormRef)">重置</el-button>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form> -->
|
<el-button size="default" :icon="Delete" @click="clear">清除选择</el-button>
|
<el-table :data="tableData" style="width: 100%; margin-top: 20px" row-key="id" :tree-props="propse">
|
<el-table-column align="center" width="100px">
|
<template #default="scope">
|
<el-radio-group v-model="radio1">
|
<el-radio :label="scope.row.id" @click="radio(scope.row)" size="large">{{ null }}</el-radio>
|
</el-radio-group>
|
</template>
|
</el-table-column>
|
<el-table-column align="center" prop="id" label="id" />
|
<el-table-column align="center" prop="typeName" label="类别名称" />
|
</el-table>
|
</el-col>
|
<el-col :span="7">
|
<div v-if="dynamicTags[0]==''?false:true">
|
<el-tag
|
v-for="tag in dynamicTags"
|
:key="tag"
|
class="mx-1"
|
style="margin: 5px"
|
closable
|
:disable-transitions="false"
|
@close="handleClose(tag)"
|
>
|
{{ tag.typeName }}
|
</el-tag>
|
</div>
|
</el-col>
|
</el-row>
|
<template #footer>
|
<span class="dialog-footer">
|
<el-button @click="dialogVisible = false" size="default">关闭</el-button>
|
<el-button type="primary" @click="submitForm" size="default">确定</el-button>
|
</span>
|
</template>
|
</el-dialog>
|
</template>
|
<script lang="ts">
|
import { defineComponent, reactive, ref } from 'vue';
|
import { Delete, FullScreen } from '@element-plus/icons-vue';
|
import { facilityManagementApi } from '/@/api/facilityManagement';
|
import { ElMessage,ElMessageBox } from 'element-plus';
|
export default defineComponent({
|
setup(props,{emit}) {
|
const dialogVisible = ref<boolean>(false);
|
const openDailog = () => {
|
dialogVisible.value = true;
|
listApi()
|
};
|
// 列表
|
const listApi = () => {
|
facilityManagementApi()
|
.getequipmentTypeMngTreeData()
|
.then((res) => {
|
if (res.data.code == 200) {
|
tableData.value = res.data.data;
|
} else {
|
ElMessage({
|
showClose: true,
|
message: res.data.msg,
|
type: 'error',
|
});
|
}
|
});
|
};
|
// 表格
|
const tableData = ref([])
|
const propse = {
|
children: 'childList',
|
};
|
// 右方点击添加后显示标签
|
const dynamicTags = ref(['']);
|
const handleClose = (tag: string) => {
|
dynamicTags.value.splice(dynamicTags.value.indexOf(tag), 1);
|
radio1.value = '';
|
};
|
const radio1 = ref('');
|
const radio = (data: any) => {
|
dynamicTags.value[0] = data
|
};
|
const clear=()=>{
|
radio1.value=""
|
dynamicTags.value=['']
|
}
|
const submitForm=()=>{
|
emit('typeId',dynamicTags.value[0])
|
dialogVisible.value=false
|
}
|
//全屏
|
const full = ref(false);
|
const toggleFullscreen = () => {
|
if (full.value == false) {
|
full.value = true;
|
} else {
|
full.value = false;
|
}
|
};
|
return {
|
submitForm,
|
clear,
|
dialogVisible,
|
openDailog,
|
listApi,
|
propse,
|
tableData,
|
dynamicTags,
|
handleClose,
|
radio1,
|
radio,
|
Delete,
|
full,
|
toggleFullscreen,
|
FullScreen,
|
};
|
},
|
});
|
</script>
|
<style scoped>
|
.el-row {
|
padding: 0 0 20px 0;
|
}
|
</style>
|