Compare commits
2 Commits
58b11a20eb
...
39e982ce3a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
39e982ce3a | ||
|
|
ef9d6c5e97 |
@ -25,6 +25,7 @@ export const getDictData = async (...args: string[]) => {
|
||||
if(dictRefs.ITEMCLASS != undefined) dictData.value.ITEMCLASS = toRaw(dictRefs.ITEMCLASS.value) || []
|
||||
if(dictRefs.YQDL != undefined) dictData.value.YQDL = toRaw(dictRefs.YQDL.value) || []
|
||||
if(dictRefs.VA != undefined) dictData.value.VA = toRaw(dictRefs.VA.value) || []
|
||||
if(dictRefs.LF != undefined) dictData.value.LF = toRaw(dictRefs.LF.value) || []
|
||||
}
|
||||
|
||||
//字典数据格式化方法
|
||||
|
||||
2
src/types/Object.d.ts
vendored
2
src/types/Object.d.ts
vendored
@ -15,6 +15,8 @@ export interface DictData {
|
||||
YQDL?: Array<any>;
|
||||
xmlbList?: Array<any>;
|
||||
YQ?: Array<any>;
|
||||
VA?: Array<any>;
|
||||
LF?: Array<any>;
|
||||
[key: string]: any[] | undefined; // 添加索引签名以支持动态访问
|
||||
}
|
||||
|
||||
|
||||
@ -85,7 +85,7 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref, toRaw, computed } from 'vue';
|
||||
import Basic from './tab/base/Basic.vue'
|
||||
import CommmonlyValues from '@/views/liswork/labItem/tab/CommmonlyValues.vue'
|
||||
import CommonlyValues from '@/views/liswork/labItem/tab/CommonlyValues.vue'
|
||||
import UseInstr from './tab/UseInstr.vue'
|
||||
import Knowledge from './tab/Knowledge.vue'
|
||||
import CommonDescriptions from './tab/CommonDescriptions.vue'
|
||||
@ -131,7 +131,7 @@ const itemclassFields = ref([
|
||||
const instrOptions = ref<LabInstr[]>([])
|
||||
const tabList = ref([
|
||||
{ label: '基本资料', value: 'Basic' },
|
||||
{ label: '常用取值', value: 'CommmonlyValues' },
|
||||
{ label: '常用取值', value: 'CommonlyValues' },
|
||||
{ label: '使用仪器', value: 'UseInstr' },
|
||||
{ label: '知识库', value: 'Knowledge' },
|
||||
{ label: '整体排序', value: 'Sort' },
|
||||
@ -143,7 +143,7 @@ const tabList = ref([
|
||||
const activeTab = ref('Basic')
|
||||
const activeTabMap = {
|
||||
Basic,
|
||||
CommmonlyValues,
|
||||
CommonlyValues,
|
||||
UseInstr,
|
||||
Knowledge,
|
||||
Sort,
|
||||
@ -265,13 +265,18 @@ const rowChange = (row: any) => {
|
||||
queryXmInfoNewDetailService(row.xmid,row.yq,row.xmdh).then((res: any) => {
|
||||
switch(activeTab.value){
|
||||
case 'Basic':
|
||||
tabDataList.value = res.data.xmInfoNewRows[0];
|
||||
tabDataList.value = res.data.xmInfoNewRows[0] || [];
|
||||
break;
|
||||
case 'CommmonlyValues':
|
||||
tabDataList.value = res.data.xmValNewRows[0];
|
||||
case 'CommonlyValues':
|
||||
if(res.data.xmValNewRows){
|
||||
tabDataList.value = res.data.xmValNewRows[0] || [];
|
||||
}
|
||||
|
||||
break;
|
||||
case 'UseInstr':
|
||||
tabDataList.value = res.data.xmInfoVsRows[0];
|
||||
if(res.data.xmInfoVsRows){
|
||||
tabDataList.value = res.data.xmInfoVsRows[0] || [];
|
||||
}
|
||||
break;
|
||||
case 'Knowledge':
|
||||
//tabDataList.value = res.data.xmInfoVsRows[0];
|
||||
|
||||
@ -8,15 +8,18 @@
|
||||
<CustomTable ref="tableRef" :data="dataList" :columns="columns" :enable-column-drag="true" @column-drag-end="handleColumnDragEnd"
|
||||
:config="tableConfig" @row-click="handRowClick">
|
||||
<template #qz>
|
||||
<el-select v-model="selectValue" clearable>
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
<el-select v-model="qzValue" clearable allow-create filterable default-first-option>
|
||||
<el-option v-for="item in qzOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</template>
|
||||
<template #jgbz>
|
||||
<el-select v-model="jgbzValue" clearable>
|
||||
<el-option v-for="item in jgbzOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
<template #srm>
|
||||
<el-input v-model="srmValue" class="full-width-input"></el-input>
|
||||
</template>
|
||||
</CustomTable>
|
||||
</div>
|
||||
</template>
|
||||
@ -24,7 +27,7 @@
|
||||
<script setup lang="ts">
|
||||
import CustomTable from '@/components/elTable/index.vue'
|
||||
import { dictData,getDictData } from '@/hooks';
|
||||
import { XmValNew } from '@/types';
|
||||
import { DictData, XmValNew } from '@/types';
|
||||
import { ElMessageBox } from 'element-plus';
|
||||
|
||||
const props = defineProps({
|
||||
@ -39,11 +42,11 @@ const props = defineProps({
|
||||
});
|
||||
|
||||
const tableRef = ref<any>(null);
|
||||
const dataList = ref<Array<XmValNew>>();
|
||||
const dataList = ref<Array<XmValNew>>([]);
|
||||
const columns = ref([
|
||||
{ prop: 'qz', label: '取值', visible: true, align: 'center', slot:'qz', width: 200 },
|
||||
{ prop: 'srm', label: '快速输入码', visible: true, align: 'center', width: 100 },
|
||||
{ prop: 'jgbz', label: '结果标志', visible: true, align: 'center', width: 100 }
|
||||
{ prop: 'srm', label: '快速输入码', visible: true, align: 'center',slot: 'srm', width: 100 },
|
||||
{ prop: 'jgbz', label: '结果标志', visible: true, align: 'center', slot: 'jgbz', width: 100 }
|
||||
]);
|
||||
const tableConfig = ref({
|
||||
border: true, // 边框
|
||||
@ -51,9 +54,12 @@ const tableConfig = ref({
|
||||
highlightCurrentRow: true, // 高亮当前行
|
||||
// cellStyle: cellStyleHd
|
||||
})
|
||||
const options = ref()
|
||||
const selectValue = ref()
|
||||
const qzOptions = ref()
|
||||
const qzValue = ref()
|
||||
const selectRow = ref()
|
||||
const jgbzValue = ref()
|
||||
const jgbzOptions = ref()
|
||||
const srmValue = ref()
|
||||
|
||||
//退拽属性
|
||||
const handleColumnDragEnd = (data: any) => {
|
||||
@ -61,19 +67,15 @@ const handleColumnDragEnd = (data: any) => {
|
||||
columns.value = data.columns;
|
||||
}
|
||||
|
||||
const init = () => {
|
||||
options.value = {...dictData.value}
|
||||
}
|
||||
|
||||
const bClickAdd = () => {
|
||||
const newData: XmValNew = {
|
||||
xmid: props.formData.xmid,
|
||||
qz: '',
|
||||
qz: qzValue.value,
|
||||
srm: '',
|
||||
jgbz: ''
|
||||
}
|
||||
console.log('@@新增行:',newData);
|
||||
dataList.value?.push(newData);
|
||||
|
||||
}
|
||||
|
||||
const bClickDel = async () => {
|
||||
@ -93,12 +95,11 @@ const handRowClick = (row:any) => {
|
||||
selectRow.value = row
|
||||
}
|
||||
|
||||
onMounted(()=>{
|
||||
onActivated(async ()=>{
|
||||
//默认取值
|
||||
getDictData('VA')
|
||||
init()
|
||||
console.log('常用取值:',props.formData);
|
||||
await getDictData('VA','LF')
|
||||
qzOptions.value = dictData.value.VA
|
||||
jgbzOptions.value = dictData.value.LF
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
@ -286,10 +286,11 @@ const conditionClick = () => {
|
||||
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getDictData('XMGL');
|
||||
onActivated(async () => {
|
||||
await getDictData('XMGL');
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user