项目模板接口联调

This commit is contained in:
wyuu 2025-12-25 17:34:36 +08:00
parent 6f1770fd35
commit 5f0d568cb7
9 changed files with 258 additions and 28 deletions

View File

@ -0,0 +1,12 @@
//@ts-ignore js语法检查忽略
import request from '@/utils/request';
//获取报告列表
export function queryList(query?: Object) {
return request({
url: '/labCheckrules/queryList',
method: 'get',
params: query,
});
}

View File

@ -17,4 +17,38 @@ export function queryDetail(query?: Object) {
method: 'get', method: 'get',
params: query, params: query,
}); });
} }
// 新增模板
export function addXmInfo(query?: Object) {
return request({
url: '/labInputmdl/add',
method: 'post',
data: query,
});
}
// 修改模板
export function updateXmInfo(query?: Object) {
return request({
url: '/labInputmdl/update',
method: 'post',
data: query,
});
}
// 删除模板
export function deleteXmInfo(query?: Object) {
return request({
url: '/labInputmdl/delete',
method: 'get',
params: query,
});
}
// 删除明细数据
export function deleteDetail(query?: Object) {
return request({
url: '/labInputmdl/deleteDetail',
method: 'post',
data: query,
});
}

View File

@ -54,8 +54,8 @@ const getYqConfig = () => {
} }
const getDataValue = (val: any) => { const getDataValue = (val: any) => {
emits('update:data', val.yq); emits('update:data', val?.yq || null);
emits('getDataValue', val); emits('getDataValue', val || null);
}; };
watch(() => props.data, (val) => { watch(() => props.data, (val) => {

View File

@ -0,0 +1,75 @@
/**
* @file index.vue 高级审核条件
* @author: w
* @since: 2025-12-25
*/
<template>
<div class="app-container">
<el-form ref="form" :model="queryParams" label-width="80px" inline>
<el-form-item label="仪器" prop="yq">
<YQSelectTable v-model:data="queryParams.yq" width="200px" clearable @get-data-value="getList" />
</el-form-item>
</el-form>
<div class="mb10">
<el-button type="primary" @click="handleAdd">新增</el-button>
<el-button type="primary" @click="handleSave">保存</el-button>
<el-button type="danger" @click="handleDel">删除</el-button>
</div>
<div style="height: calc(100% - 110px);">
<CustomTable ref="tableRef" v-model:data="tableData" :columns="columns" :config="tableConfig">
<template #yq="{ row }">
</template>
</CustomTable>
</div>
</div>
</template>
<script setup lang="ts">
import YQSelectTable from '@/components/SelectTable/YQSelectTable/index.vue';
import { queryList } from '@/api/liswork/advancedReview';
const queryParams = ref({
yq: '46',
});
const tableData = ref<Array<any>>([]);
const columns = ref([
{ label: '规则ID', prop: 'ruleid', visible: true, align: 'center', width: '80' },
{ label: '条件类型', prop: 'checktype', visible: true, align: 'center', width: '150' },
{ label: '审核启用', prop: 'logflag', visible: true, align: 'center', width: '80' },
{ label: '组合条件(双击弹窗编辑)', prop: 'ruledisplay', visible: true, align: 'center', },
{ label: '记录备注信息', prop: 'logcontent', visible: true, align: 'center', width: '300' },
{ label: '组合条件', prop: 'checkrules', visible: true, align: 'center', },
{ label: '自动审核', prop: 'autocheck', visible: true, align: 'center', width: '80' },
]);
const tableConfig = ref({
highlightCurrentRow: true,
border: true,
height: '100%'
});
const options = [
{ label: '审核条件', value: '0' },
{ label: '绝对禁止审核', value: '3' },
{ label: '审核生成报告备注', value: '4' },
]
const handleAdd = () => {
};
const handleSave = () => {
};
const handleDel = () => {
};
const getList = () => {
queryList(queryParams.value).then((res: any) => {
tableData.value = res.data;
});
};
getList()
</script>
<style scoped lang="scss"></style>

View File

@ -6,6 +6,18 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form ref="form" :model="queryParams" label-width="80px" inline>
<el-form-item label="仪器" prop="yq">
<YQSelectTable v-model:data="queryParams.yq" width="200px" clearable @get-data-value="getList" />
</el-form-item>
<el-form-item label="模板名称" prop="xmdh">
<el-input placeholder="请输入模板名称" v-model="queryParams.mbmc" style="width: 200px;" clearable
@keyup.enter="getList" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="getList">查询</el-button>
</el-form-item>
</el-form>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-button type="primary" @click="handleAdd">新增</el-button> <el-button type="primary" @click="handleAdd">新增</el-button>
@ -15,7 +27,7 @@
<el-row class="table-row" style="margin-top: 10px;"> <el-row class="table-row" style="margin-top: 10px;">
<el-col :span="24" class="table-col"> <el-col :span="24" class="table-col">
<CustomTable ref="tableRef" v-model:data="tableData" :columns="columns" :config="tableConfig" <CustomTable ref="tableRef" v-model:data="tableData" :columns="columns" :config="tableConfig"
@row-dblclick="handleRowDblclick"> @row-dblclick="handleRowDblclick" @row-click="selectedRows = $event">
<template #yq="{ row }"> <template #yq="{ row }">
{{ formatInstr(row.yq) }} {{ formatInstr(row.yq) }}
</template> </template>
@ -32,7 +44,7 @@
<el-col :span="10"> <el-col :span="10">
<el-form ref="formRef" :model="formData" label-width="150px"> <el-form ref="formRef" :model="formData" label-width="150px">
<el-form-item label="仪器" prop="yq"> <el-form-item label="仪器" prop="yq">
<YQSelectTable v-model:data="formData.yq" :disabled="disabled" /> <YQSelectTable v-model:data="formData.yq" :disabled="disabled" @get-data-value="getOldXminfoList()" />
</el-form-item> </el-form-item>
<el-form-item label="模板名称" prop="mbmc"> <el-form-item label="模板名称" prop="mbmc">
<el-input v-model="formData.mbmc" /> <el-input v-model="formData.mbmc" />
@ -57,20 +69,23 @@
<el-col :span="14"> <el-col :span="14">
<div class="mb10"> <div class="mb10">
<el-button type="primary" @click="handleSave">保存</el-button> <el-button type="primary" @click="handleSave">保存</el-button>
<el-button type="primary" @click="handleAdd">新增</el-button> <el-button type="primary" @click="addItem">新增</el-button>
<el-button type="danger" @click="handleDel">删除</el-button> <el-button type="danger" @click="delItem">删除</el-button>
</div> </div>
<div style="height: 400px"> <div style="height: 400px">
<CustomTable ref="tableRefRight" :data="rightTableData" :columns="rightColumns" :config="tableConfig"> <CustomTable ref="tableRefRight" :data="rightTableData" :columns="rightColumns" :config="tableConfig"
<template #xmdh="{ row }"> @row-click="xmrowHandle">
{{ row.xmdh }} {{ row.xmmc }} <template #xmdh="{ row, $index }">
<SelectTable v-model:data="row.xmdh" :tableData="xmList" class="full-width-input" :keyValue="true"
@get-data-value="getXmInfo(row, $index)" />
</template>
<template #mrz="{ row }">
<el-input v-model="row.mrz" class="full-width-input" />
</template> </template>
</CustomTable> </CustomTable>
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
</el-dialog> </el-dialog>
</el-row> </el-row>
</div> </div>
@ -80,9 +95,16 @@
import YQSelectTable from '@/components/SelectTable/YQSelectTable/index.vue'; import YQSelectTable from '@/components/SelectTable/YQSelectTable/index.vue';
// @ts-ignore // @ts-ignore
import { listregdict } from "@/api/regional/dict/regdict.js"; import { listregdict } from "@/api/regional/dict/regdict.js";
import { queryMbList, queryDetail } from '@/api/liswork/xmmb'; import { queryMbList, queryDetail, addXmInfo, deleteDetail, updateXmInfo, deleteXmInfo } from '@/api/liswork/xmmb';
import { formatInstr, getYqData } from '@/hooks' import { formatInstr, getYqData } from '@/hooks'
import { queryOldxminfo } from '@/api/liswork/xtwh/xmReqItemVsApi'
import { ElMessage, ElMessageBox } from 'element-plus';
const queryParams = ref({
yq: '',
mbmc: '',
})
const disabled = ref(false) const disabled = ref(false)
const formData = ref({ const formData = ref({
yq: '', yq: '',
@ -92,7 +114,9 @@ const formData = ref({
zdsr: '', zdsr: '',
qsybh: '', qsybh: '',
jsybh: '', jsybh: '',
oldMbmc: '',
}) })
const xmList = ref([])
const title = ref('') const title = ref('')
const visible = ref(false) const visible = ref(false)
const tableData = ref([]) const tableData = ref([])
@ -111,13 +135,22 @@ const tableConfig = ref({
border: true, // 边框 border: true, // 边框
highlightCurrentRow: true, // 当前行高亮 highlightCurrentRow: true, // 当前行高亮
}) })
const selectedRows: any = ref(null)
const regdictList = ref<Array<{ value: string, label: string }>>([]) const regdictList = ref<Array<{ value: string, label: string }>>([])
const rightTableData = ref([]) const rightTableData = ref<Array<{ xmdh: string, mrz: string }>>([])
const rightColumns = ref([ const rightColumns = ref([
{ prop: 'xmdh', label: '检验项目', visible: true, align: 'center', slot: 'xmdh' }, { prop: 'xmdh', label: '检验项目', visible: true, align: 'center', slot: 'xmdh', showOverflowTooltip: false },
{ prop: 'mrz', label: '默认值', visible: true, align: 'center', }, { prop: 'mrz', label: '默认值', visible: true, align: 'center', slot: 'mrz', showOverflowTooltip: false },
]) ])
const getOldXminfoList = async () => {
const res = await queryOldxminfo({ yq: formData.value.yq })
xmList.value = res.data.map((item: any) => {
return {
label: item.xmmc,
value: item.xmdh,
}
})
}
const handleAdd = () => { const handleAdd = () => {
formData.value = { formData.value = {
@ -128,6 +161,7 @@ const handleAdd = () => {
zdsr: '', zdsr: '',
qsybh: '', qsybh: '',
jsybh: '', jsybh: '',
oldMbmc: '',
} }
disabled.value = false disabled.value = false
rightTableData.value = [] rightTableData.value = []
@ -136,19 +170,94 @@ const handleAdd = () => {
} }
const handleRowDblclick = (row: any) => { const handleRowDblclick = (row: any) => {
queryDetail(row).then((res: any) => { getDetailsList(row)
rightTableData.value = res.data
})
row.yq = row.yq.trim() row.yq = row.yq.trim()
row.oldMbmc = row.mbmc
formData.value = row formData.value = row
getOldXminfoList()
disabled.value = true disabled.value = true
title.value = '编辑模板' title.value = '编辑模板'
visible.value = true visible.value = true
} }
const handleSave = () => { }
const handleDel = () => { } const getDetailsList = (row: any) => {
queryDetail({ yq: row.yq, mbmc: row.mbmc }).then((res: any) => {
rightTableData.value = res.data
})
}
const handleSave = () => {
rightTableData.value = rightTableData.value.filter((item: any) => item.xmdh)
const arr = rightTableData.value.map((item: any, index: number) => {
return {
...item,
mbmc: formData.value.mbmc,
oldMbmc: formData.value.oldMbmc,
yq: formData.value.yq,
xh: item.xh ? item.xh : index + 1,
}
})
if (disabled.value) {
updateXmInfo({ labInputmdl: formData.value, labInputmdlDetailList: arr }).then(() => {
ElMessage.success('修改成功')
getList()
visible.value = false
})
} else {
addXmInfo({ labInputmdl: formData.value, labInputmdlDetailList: arr }).then(() => {
ElMessage.success('新增成功')
getList()
visible.value = false
})
}
}
const xmInfo = ref<any>(null)
const xmrowHandle = (row: any) => {
xmInfo.value = row
}
const getXmInfo = (row: any, currentIndex: any) => {
const prevXmdhList = rightTableData.value
.filter((_, index) => index < currentIndex)
.map(row => row.xmdh)
.filter(xmdh => !!xmdh);
if (prevXmdhList.includes(row.xmdh)) {
ElMessage.error(`当前项目编号【${row.xmdh}】与前面行重复,请重新选择!`);
rightTableData.value[currentIndex].xmdh = '';
}
}
const addItem = () => {
rightTableData.value.push({ xmdh: '', mrz: '', })
}
const delItem = () => {
if (!xmInfo.value) return ElMessage.warning('请选择要删除的行!')
if (xmInfo.value.yq) {
deleteDetail([xmInfo.value]).then((res: any) => {
if (res.code == 0) {
getDetailsList(formData.value)
}
})
} else {
rightTableData.value = rightTableData.value.filter(item => item.xmdh != xmInfo.value.xmdh)
}
xmInfo.value = null
}
const handleDel = () => {
if (!selectedRows.value) return ElMessage.warning('请选择要删除的记录')
ElMessageBox.confirm('确定要删除选中的数据吗?', '提示', {
type: 'warning'
}).then(() => {
deleteXmInfo(selectedRows.value).then(() => {
ElMessage.success('删除成功')
getList()
selectedRows.value = null
})
})
}
const getList = () => { const getList = () => {
queryMbList().then((res: any) => { queryMbList(queryParams.value).then((res: any) => {
tableData.value = res.data tableData.value = res.data
}) })
} }
@ -174,7 +283,7 @@ const formatYblx = (v: string) => {
<style scoped lang="scss"> <style scoped lang="scss">
.table-row { .table-row {
height: calc(100% - 60px); height: calc(100% - 100px);
.table-col { .table-col {
height: 100%; height: 100%;

View File

@ -258,7 +258,7 @@ const formatDict = (v: string, arr: Array<any>) => {
<style scoped lang="scss"> <style scoped lang="scss">
.compact-form { .compact-form {
height: 80px; height: 5rem;
.el-form-item { .el-form-item {
margin-bottom: 5px; margin-bottom: 5px;

View File

@ -228,7 +228,7 @@ const formatDict = (v: string, arr: Array<any>) => {
<style scoped lang="scss"> <style scoped lang="scss">
.compact-form { .compact-form {
height: 80px; height: 5rem;
.el-form-item { .el-form-item {
margin-bottom: 5px; margin-bottom: 5px;

View File

@ -202,7 +202,7 @@ const formatDict = (v: string, arr: Array<any>) => {
<style scoped lang="scss"> <style scoped lang="scss">
.compact-form { .compact-form {
height: 80px; height: 5rem;
.el-form-item { .el-form-item {
margin-bottom: 5px; margin-bottom: 5px;

View File

@ -229,7 +229,7 @@ const formatDict = (v: string, arr: Array<any>) => {
<style scoped lang="scss"> <style scoped lang="scss">
.compact-form { .compact-form {
height: 80px; height: 5rem;
.el-form-item { .el-form-item {
margin-bottom: 5px; margin-bottom: 5px;