46 lines
1.1 KiB
Vue
Raw Normal View History

<!--
仪器组件的封装
-->
<template>
<SelectTable v-model:data="queryParams.yq" :fields="yqFields" :tableData="instrOptions" label="yqmc" size="small"
value="yq" objKey="yq" :border="true" width="9rem" placeholder="请选择仪器" :clearable="false" />
</template>
<script setup lang="ts">
import SelectTable from '@/components/SelectTable/index.vue';
import { getGroupInstrdList } from '@/api/liswork/work/LisWork';
const props = defineProps({
data: {
type: String,
required: true
}
});
const queryParams = ref({
yq: props.data
});
const yqFields = ref([
{ prop: 'yq', label: '代号', width: 80, enablePinyinSearch: true },
{ prop: 'yqmc', label: '名称', width: 150, enablePinyinSearch: true },
]);
const instrOptions = ref<{ yq: string; yqmc: string }[]>([])
const getYqConfig = () => {
getGroupInstrdList()
.then((res: any) => {
if (res.code == 0) {
instrOptions.value = res.data.map((item: any) => ({
yq: item.yq.trim(),
yqmc: item.yqmc
}))
}
})
}
onMounted(() => {
getYqConfig();
});
</script>