主程序交互场景

This commit is contained in:
tangw 2025-08-20 09:25:12 +08:00
parent ddb6c4b83b
commit 6392c9b632
4 changed files with 84 additions and 3 deletions

View File

@ -8,6 +8,7 @@ export function queryLabPatList(query) {
params: query
})
}
// 查询数据
export function queryLabPat(query) {
return request({
@ -24,6 +25,7 @@ export function getDate() {
method: 'get',
})
}
//增加字典数据
export function addLabPatService(data) {
return request({
@ -41,6 +43,7 @@ export function updateLabPatService(data) {
data
})
}
// 查询数据列表
export function queryLabResults(query) {
return request({
@ -49,6 +52,7 @@ export function queryLabResults(query) {
params: query
})
}
// 批量删除结果
export function deleteresult(data) {
return request({
@ -56,4 +60,14 @@ export function deleteresult(data) {
method: 'post',
data: data
})
}
//审核
export function check2(query) {
return request({
url: '/lisworkoper/check2',
method: 'get',
params: query
})
}

View File

@ -131,6 +131,55 @@ service.interceptors.response.use(res => {
return Promise.resolve(res.data);
})
return Promise.reject('error');
} else if (code === 5) {
// 1. 提取后端返回的问题ID(根据实际字段名调整)
const problemId = res.data.problemId;
if (!problemId) {
ElMessage.error('缺少问题ID,无法继续操作');
return Promise.reject('缺少问题ID');
}
// 2. 限制递归次数,避免无限循环
const retryCount = (res.config.retryCount || 0) + 1;
const maxRetry = 10; // 最大重试次数
if (retryCount > maxRetry) {
ElMessage.error('超过最大操作次数,请稍后再试');
return Promise.reject('超过最大重试次数');
}
// 3. 询问用户,确认后携带问题ID发起新请求
return ElMessageBox.confirm(msg, '系统提示', {
confirmButtonText: '是',
cancelButtonText: '否',
type: 'warning'
}).then(() => {
const { url, method, data: data0, params: params0 } = res.data;
// 4. 构造新请求参数,携带问题ID(根据后端要求决定传递方式)
const newParams = {
...params0,
problemId: problemId // 作为URL参数传递
};
const newData = {
...data0,
problemId: problemId // 作为请求体数据传递(根据method调整)
};
// 5. 发起新请求,携带重试次数和问题ID
return service.request({
url,
method,
data: method.toLowerCase() === 'get' ? undefined : newData, // get请求不发data
params: method.toLowerCase() === 'get' ? newParams : params0,
retryCount, // 传递重试次数
problemId // 可选:在config中携带,方便后续跟踪
});
}).catch(() => {
// 用户取消操作时,携带问题ID告知后端(可选)
return Promise.reject({
message: '用户取消操作',
problemId: problemId
});
});
} else if (code !== 200 && code !== 0) {
ElNotification.error({ title: msg })
return Promise.reject('error')

View File

@ -111,7 +111,14 @@
</template>
<script setup>
import {getDate,queryLabPatList,queryLabResults,updateLabPatService,queryLabPat} from "../../../api/liswork/work/LisWork.js";
import {
getDate,
queryLabPatList,
queryLabResults,
updateLabPatService,
queryLabPat,
check2
} from "../../../api/liswork/work/LisWork.js";
import {querylabInstrList,querylabInstrListByLisgroup} from "../../../api/liswork/dict/LabInstr.js";
import {getComDicts, queryComDictListService} from "../../../api/liswork/dict/ComDict.js";
import LabPatForm from './components/labpat.vue'
@ -431,6 +438,16 @@ function loadingPatLabel(){
// labPatRef.value?.loadingLabel();
}
function handleCheck(){
loading.value = true;
console.log('queryParams:', queryParams.value)
check2(queryParams.value).then(response => {
console.log('response:', response)
loading.value = false;
}) .catch(error => {
console.error('审核失败', error);
loading.value = false;
});
}
function handleUnCheck(){
}

View File

@ -415,6 +415,7 @@ function printBack(row) {
if (idsnew.value.length === 0) {
return;
}
//console.log('idsnew:', idsnew.value)
printBackpaper(idsnew.value).then(response => {
proxy.$modal.msgSuccess("打印成功");
open.value = false;