This commit is contained in:
jiangs 2026-03-01 11:12:12 +08:00
commit 1f386bf59c
3 changed files with 78 additions and 30 deletions

View File

@ -53,3 +53,13 @@ export function getstatsTemplate(params: any) {
params
})
}
// 模板参数查询详细信息
export function getstatsQuery(params: any) {
return request({
url: '/stats/query',
method: 'post',
data: params
})
}

View File

@ -54,7 +54,7 @@
<el-button type="danger" :size="aotuSize" plain icon="Edit" @click="selectStatusRows">选中所有未打印</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" :size="aotuSize" plain @click="printPdf">打印条码</el-button>
<el-button type="success" :size="aotuSize" plain :loading="dybtnLoading" @click="printPdf">打印条码</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="info" :size="aotuSize" plain icon="Upload" @click="openBlock('采样登记')">采样登记</el-button>
@ -723,6 +723,7 @@ const handletime = (val: Array<string>) => {
const btnLoading = ref(false);
const dybtnLoading = ref(false);
// 生成条码
const printHandle = () => {
btnLoading.value = true;
@ -809,19 +810,23 @@ const printPdf = () => {
ElMessageBox.confirm(`确定打印选中的数据吗?`, "提示", {
confirmButtonText: "确认",
cancelButtonText: "取消",
beforeClose: async (action, instance, done) => {
beforeClose: (action, instance, done) => {
if (action === "confirm") {
dybtnLoading.value = true;
const requests = selections.map((item: any) => item.sqh)
const res = await fetchCodeExec({
fetchCodeExec({
sqh: requests.join(','),
userid: queryParams.userid,
status: 11,
yljg: queryParams.yljg
}).then((res: any) => {
if (res.code == 0) {
done()
getList()
}
}).finally(() => {
dybtnLoading.value = false;
})
if (res.code == 0) {
done()
getList()
}
} else {
done()
}

View File

@ -69,8 +69,7 @@
import { getComDicts, } from "@/api/liswork/dict/ComDict";
import { useCommonStore } from '@/store/modules/commonStore';
import { classCom } from '@/utils/classCom';
import { listhospital } from "@/api/regional/dict/hospital.js";
import { getstatsTemplate } from "@/api/liswork/xtwh/StatsparameterApi";
import { getstatsTemplate, getstatsQuery } from "@/api/liswork/xtwh/StatsparameterApi";
import { listUser } from '@/api/system/user.js'
import useUserStore from '@/store/modules/user'
import { getDictData, formatDict } from '@/hooks'
@ -92,7 +91,7 @@ const coloums = ref([]) //固定列
const checkBoxs = ref([])
const tableColumns = ref([]);
const Template = ref({})
const instrGroupOptions = ref([])
@ -115,39 +114,72 @@ const loadinstrGroupOptions = () => {
}
const handletime = () => {
const dayDiff = classCom.getDayDiff(queryParams.st, queryParams.et)
if (dayDiff === -1 || dayDiff === -2) return ElMessage.warning('请选择有效的日期范围');
// const dayDiff = classCom.getDayDiff(queryParams.st, queryParams.et)
// if (dayDiff === -1 || dayDiff === -2) return ElMessage.warning('请选择有效的日期范围');
}
const search = () => {
console.log('Parameter==>', Parameter.value);
const checkedCols = [...coloums.value, ...checkBoxs.value];
console.log('checkedCols==>', checkedCols);
const arr = [];
tableColumns.value.forEach((tableItem, tableIndex) => {
const matchItem = checkedCols.find(
(checkItem) => checkItem.paramName === tableItem.label
);
if (matchItem) {
arr.push({
...matchItem,
paramSort: tableIndex,
});
}
});
const unmatchedItems = checkedCols.filter(
(checkItem) => !tableColumns.value.some((tableItem) => tableItem.label === checkItem.paramName)
);
unmatchedItems.forEach((item, unmatchIndex) => {
arr.push({
...item,
paramSort: tableColumns.value.length + unmatchIndex,
});
});
const data = {
Parameter: Parameter.value,
Column: arr,
Template: Template.value
};
console.log('data==>', data);
getstatsQuery(data).then(res => {
tableData.value = res.data
})
};
const print = () => {
};
const handleCheckBoxChange = (val) => {
tableColumns.value = val.map(paramCode => {
const checkedCols = val.map(paramCode => {
const matchItem = checkBoxs.value.find(item => item.paramCode === paramCode);
return matchItem ? {
label: matchItem.paramName,
prop: matchItem.paramCode,
} : null;
})
const arr = coloums.value.map(item => {
return {
label: item.paramName,
prop: item.paramCode,
}
})
tableColumns.value = tableColumns.value.concat(arr)
return matchItem ? { label: matchItem.paramName, prop: matchItem.paramCode } : null;
}).filter(Boolean); // 过滤null
const fixedCols = coloums.value.map(item => ({
label: item.paramName,
prop: item.paramCode,
}));
tableColumns.value = [...checkedCols, ...fixedCols];
}
// 获取模板参数
const getParams = () => {
getstatsTemplate({ statsCode: route.query && route.query.statsCode, }).then(res => {
getstatsTemplate({ StatsCode: route.query && route.query.statsCode, }).then(res => {
Parameter.value = res.data.Parameter
tableColumns.value = res.data.Column.filter(item => item.paramType == '6').map(item => {
return {
@ -160,6 +192,7 @@ const getParams = () => {
coloums.value = res.data.Column.filter(item => item.paramType == '6')
checkBoxs.value = res.data.Column.filter(item => item.paramType != '6')
Template.value = res.data.Template
statsTitle.value = res.data.Template.statsTitle
})
};