lis8.0-vue3/src/views/liswork/labItem/BatchInstrVs.vue
2025-12-17 17:32:10 +08:00

206 lines
7.6 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<!-- 批量仪器对应 -->
<el-dialog title="批量项目对应" width="72vw" v-model="batchInstrVsModel.visible" draggable :close-on-click-modal="false"
@close="onClose">
<el-form :model="formData" inline label-width="80px">
<el-form-item label="项目类别" prop="xmgl">
<!-- <el-input placeholder="项目类别" v-model="formData.xmgl"></el-input> -->
<SelectTable v-model:data="formData.xmgl" :fields="xmglFields" :tableData="dictData.XMGL" label="label"
clearable value="value" objKey="value" width="200px" placeholder="项目类别" />
</el-form-item>
<el-form-item label="快速查找" prop="inputcode">
<el-input placeholder="快速查找" v-model="formData.inputcode" clearable style="width: 200px;"></el-input>
</el-form-item>
<el-form-item label="细菌标志" prop="itemclass">
<SelectTable v-model:data="formData.itemclass" :fields="xmglFields" :tableData="dictData.ITEMCLASS"
label="label" clearable value="value" objKey="value" width="200px" placeholder="细菌标志" />
</el-form-item>
<el-form-item label="仪器大类" prop="yqdl">
<SelectTable v-model:data="formData.yqdl" :fields="xmglFields" :tableData="dictData.YQDL" label="label"
clearable value="value" objKey="value" width="200px" placeholder="仪器大类" />
</el-form-item>
<el-form-item label="仪器" prop="yq">
<YQSelectTable v-model:data="formData.yq" width="200px" placeholder="请输入仪器名称" />
</el-form-item>
<el-form-item>
<el-checkbox v-model="formData.wsw" label="隐藏微生物" true-value="1" false-value="0"></el-checkbox>
</el-form-item>
<el-form-item>
<el-radio-group v-model="formData.queryDylx" @change="getList">
<el-radio value="1">未对应</el-radio>
<el-radio value="2">已对应</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="getList">搜索</el-button>
</el-form-item>
</el-form>
<div style="height: 60vh;">
<CustomVxeTable ref="tableRef" :loading="loading" :data="tableData" :columns="columns" :enable-column-drag="true"
:scrollYConfig="{ enabled: true, rSize: 30, height: '100%', }" @column-drag-end="handleColumnDragEnd"
:config="tableConfig" @current-change="rowClick" class="mytable-style" @selection-change="selecChange">
<template #xmgl="{ row }">
{{ formatDict(row.xmgl, 'XMGL') }}
</template>
<template #xmlb="{ row }">
{{ xmlbObj[row.xmlb] }}
</template>
<template #jsxm="{ row }">
{{ row.jsxm === 'Y' ? '是' : '否' }}
</template>
<template #uflag="{ row }">
{{ row.uflag === '0' ? '否' : '是' }}
</template>
<template #yqdl="{ row }">
{{ formatDict(row.yqdl, 'YQDL') }}
</template>
</CustomVxeTable>
</div>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="handleOk">确 定</el-button>
<el-button @click="onClose">取 消</el-button>
</div>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { formatDict, getDictData, dictData } from '@/hooks';
import SelectTable from '@/components/SelectTable/index.vue'
import CustomVxeTable from '@/components/vxeTable/index.vue'
import YQSelectTable from '@/components/SelectTable/YQSelectTable/index.vue'
import { queryBatchList, addBatch, delBatch } from '@/api/liswork/labItem/labItemApi'
import { ElMessage } from 'element-plus';
const formData = ref({
xmgl: '',
inputcode: '',
itemclass: '',
yqdl: '',
wsw: '0',
yq: '',
queryDylx: '1'
})
const xmlbObj: any = {
1: '数值型',
2: '文字型',
3: '阴阳性型',
4: '数值文字混合型'
}
const tableData = ref()
const batchInstrVsModel = defineModel<any>()
const xmglFields = ref([
{ prop: 'value', label: '代号', width: 80, enablePinyinSearch: true },
{ prop: 'label', label: '名称', enablePinyinSearch: true },
])
const columns = ref([
{ type: 'selection', field: '', title: '', resizable: true, align: 'center', width: 40 },
{ field: 'xmgl', title: '项目类别', resizable: true, align: 'center', width: 80, slotName: "xmgl" },
{ field: 'xmdh', title: '英文缩写', resizable: true, align: 'center', width: 60 },
{ field: 'xmmc', title: '名称', resizable: true, align: 'center', width: 200 },
{ field: 'dyckz', title: '参考值', resizable: true, align: 'center', width: 80 },
{ field: 'dw', title: '单位', resizable: true, align: 'center', width: 80 },
{ field: 'xmlb', title: '结果类型', resizable: true, align: 'center', width: 100, slotName: "xmlb" },
{ field: 'jsxm', title: '计算项目', resizable: true, align: 'center', width: 80, slotName: "jsxm" },
{ field: 'dyxh', title: '序号', resizable: true, align: 'center', width: 80 },
{ field: 'xs', title: '调整系数', resizable: true, align: 'center', width: 60 },
{ field: 'xsws', title: '小数位数', resizable: true, align: 'center', width: 60 },
{ field: 'xsbs', title: '稀释倍数', resizable: true, align: 'center', width: 60 },
{ field: 'uflag', title: '停用', resizable: true, align: 'center', width: 60, slotName: "uflag" },
{ field: 'yqdl', title: '仪器大类', resizable: true, align: 'center', width: 80, slotName: "yqdl" },
{ field: 'xmid', title: '项目ID', resizable: true, align: 'center', width: 80 },
{ field: 'knowledge', title: '项目编码', resizable: true, align: 'center', width: 80 },
{ field: 'val1', title: '外部代码1', resizable: true, align: 'center', width: 80 },
{ field: 'val2', title: '外部代码2', resizable: true, align: 'center', width: 80 },
{ field: 'val3', title: '外部代码3', resizable: true, align: 'center', width: 80 },
{ field: 'yymc', title: '英文名称', resizable: true, align: 'center', width: 80 },
{ field: 'qccv', title: '允许CA(%)', resizable: true, align: 'center', width: 80 },
]);
const tableConfig = ref({
// 复选框配置
checkboxConfig: {
// 可选配置项
checkField: 'checked', // 绑定数据中的字段(默认:checked)
range: false, // 是否支持范围选择(按住 Shift 连续选择)
disabled: false, // 是否禁用全部复选框
reserve: false, // 是否保留勾选状态(分页/筛选时)
highlight: false // 是否高亮选中行
}
})
//退拽属性
const handleColumnDragEnd = (data: any) => {
// 更新列配置
columns.value = data.columns;
}
const rowClick = () => {
}
const onClose = () => {
batchInstrVsModel.value.visible = false;
formData.value = {
xmgl: '',
inputcode: '',
itemclass: '',
yqdl: '',
wsw: '0',
yq: '',
queryDylx: '1'
}
tableData.value = []
}
const loading = ref(false);
//刷新数据
const getList = () => {
loading.value = true;
queryBatchList(formData.value).then((res: any) => {
loading.value = false;
tableData.value = res.data;
})
}
const selecRows: any = ref([])
const selecChange = (rows: any[]) => {
selecRows.value = rows
}
//确定
const handleOk = () => {
if (formData.value.queryDylx == '1') {
addBatch(selecRows.value).then((res: any) => {
if (res.code == 0) {
ElMessage.success('操作成功!')
getList()
}
})
} else if (formData.value.queryDylx == '2') {
let arr = []
arr = selecRows.value.map((item: any) => {
return {
yq: formData.value.yq,
xmid: item.xmid,
}
})
delBatch(arr).then((res: any) => {
if (res.code == 0) {
ElMessage.success('操作成功!')
getList()
}
})
}
}
</script>
<style scoped lang="scss"></style>