Files
his/backup/vxetable-migration-20260602/medicationmanagement/chkstock/components/chkstockDetailsDialog.vue
华佗 1d21661a78 feat: Spring Boot 3.5.14 全量升级 + 组件升级
核心升级:
- Spring Boot 2.7.18 → 3.5.14
- MyBatis Plus 3.5.5 → 3.5.16 (spring-boot3-starter)
- Springdoc 1.8.0 → 2.8.6 (OpenAPI 3)
- Flowable 6.8.0 → 7.1.0
- Druid 1.2.x → 1.2.28 (boot3-starter)
- kotlin-reflect 1.9.10 → 1.9.25

迁移适配:
- javax → jakarta 命名空间 (620+ 文件)
- Swagger 注解迁移到 OpenAPI 3 (@Tag/@Schema/@Operation/@Parameter)
- Spring Security 6.2 适配 (antMatchers→requestMatchers, EnableMethodSecurity)
- Druid 包名迁移 (boot→boot3)
- Redis 配置路径迁移 (spring.redis→spring.data.redis)
- Flyway 适配 (flyway-database-postgresql)
- Flowable 7.x 适配 (MULE_TASK_IMAGE 移除)

修复:
- spring-boot-maven-plugin 2.5.15→3.5.14 (SPI服务发现失效)
- mybatis-plus-boot-starter 3.5.5→3.5.16 (kotlin-reflect+fastjson2冲突)
- Flowable database-schema-update 启用自动建表

验证: 23/23 测试通过, 1374 API端点正常
2026-06-04 22:39:49 +08:00

338 lines
9.2 KiB
Vue
Executable File
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>
<div>
<el-dialog
v-model="dialogVisible"
v-loading="loading"
title="盘点单明细"
width="90%"
:destroy-on-close="true"
@close="close"
>
<el-row style="margin-bottom: 20px">
<template v-if="props.isApply">
<el-button
plain
type="primary"
icon="Edit"
@click="handelApply"
>
审批通过
</el-button>
<el-button
type="primary"
plain
icon="Edit"
@click="handleReject"
>
驳回
</el-button>
</template>
<el-button
type="warning"
plain
icon="Printer"
@click="handlePrint"
>
打印单据
</el-button>
<el-button
type="primary"
plain
icon="Download"
@click="handleExport"
>
导出
</el-button>
</el-row>
<el-descriptions
:column="4"
style="margin-bottom: 10px"
>
<el-descriptions-item label="单据号:">
{{ detailsList[0]?.busNo || '-' }}
</el-descriptions-item>
<el-descriptions-item label="盘点仓库:">
{{ detailsList[0]?.purposeLocationName || '-' }}
</el-descriptions-item>
<el-descriptions-item label="项目类型:">
{{ detailsList[0]?.itemType_dictText || '-' }}
</el-descriptions-item>
<el-descriptions-item label="盘点日期:">
{{ proxy.formatDateStr(detailsList[0]?.occurrenceTime, 'YYYY-MM-DD HH:mm:ss') || '-' }}
</el-descriptions-item>
</el-descriptions>
<el-table
:data="detailsList"
border
max-height="600"
>
<el-table-column
label="序号"
width="60"
type="index"
align="center"
/>
<el-table-column
label="项目名称"
align="center"
prop="itemName"
/>
<el-table-column
label="规格"
align="center"
prop="totalVolume"
:show-overflow-tooltip="true"
/>
<el-table-column
label="厂家/产地"
align="center"
prop="manufacturerText"
width="180"
:show-overflow-tooltip="true"
/>
<el-table-column
label="产品批号"
align="center"
prop="lotNumber"
/>
<el-table-column
label="单价"
align="right"
header-align="center"
prop="price"
width="120"
>
<template #default="scope">
{{ scope.row.price.toFixed(2) + ' 元' }}
</template>
</el-table-column>
<el-table-column
label="盘点单位"
align="center"
prop="measurementUnitCode_dictText"
width="80"
/>
<el-table-column
label="盘前库存"
align="right"
header-align="center"
prop="itemName"
width="100"
>
<template #default="scope">
{{
formatQuantity(
Number(scope.row.totalQuantity) - Number(scope.row.itemQuantity),
scope.row
)
}}
</template>
</el-table-column>
<el-table-column
label="实盘数量"
align="right"
header-align="center"
prop="totalQuantity"
width="100"
>
<template #default="scope">
{{ formatQuantity(scope.row.totalQuantity, scope.row) }}
</template>
</el-table-column>
<el-table-column
label="实盘金额"
align="right"
header-align="center"
prop="totalPrice"
width="120"
>
<template #default="scope">
{{ scope.row.totalPrice.toFixed(2) + ' 元' }}
</template>
</el-table-column>
<el-table-column
label="盈亏数量"
align="right"
header-align="center"
prop="itemQuantity"
width="100"
>
<template #default="scope">
{{ formatQuantity(scope.row.itemQuantity, scope.row) }}
</template>
</el-table-column>
<el-table-column
label="盈亏金额"
align="right"
header-align="center"
prop=""
>
<template #default="scope">
{{
((scope.row.itemQuantity * scope.row.price) / scope.row.partPercent).toFixed(2) + '元'
}}
</template>
</el-table-column>
<el-table-column
label="盈亏类型"
align="center"
prop="reasonCode_dictText"
/>
<el-table-column
label="盈亏原因"
align="center"
prop="reason"
/>
</el-table>
<div>
<span>合计盈亏金额{{ totalAmount ? totalAmount.toFixed(4) : 0 }}</span>
</div>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogVisible = false">
</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup>
import {getCurrentInstance} from 'vue';
import {getstocktakingDetail, productStocktakingApproved, reject} from './api';
import templateJson from '@/views/medicationmanagement/chkstock/chkstockPart/components/template.json';
import {hiprint} from 'vue-plugin-hiprint';
import useUserStore from '@/store/modules/user';
const detailsList = ref([]);
const dialogVisible = ref(false);
const loading = ref(false);
const totalAmount = ref(0);
const supplyBusNo = ref('');
const userStore = useUserStore();
const { proxy } = getCurrentInstance();
const props = defineProps({
isApply: {
type: Boolean,
default: false,
},
});
function open(busNo) {
dialogVisible.value = true;
supplyBusNo.value = busNo;
getstocktakingDetail({ busNo: busNo, pageSize: 1000, pageNo: 1 }).then((res) => {
detailsList.value = res.data.records;
totalAmount.value = res.data.records.reduce((accumulator, currentRow) => {
return accumulator + (Number(((currentRow.itemQuantity * currentRow.price) / currentRow.partPercent).toFixed(2)) || 0);
}, 0);
});
}
function formatQuantity(quantity, row) {
if (row.measurementUnitCode == row.unitCode) {
return formatInventory(
quantity,
row.partPercent,
row.unitCode_dictText,
row.minUnitCode_dictText
);
} else {
return quantity + row.minUnitCode_dictText;
}
}
function handelApply() {
loading.value = true;
productStocktakingApproved(supplyBusNo.value).then((res) => {
if (res.code == 200) {
proxy.$modal.msgSuccess('操作成功');
loading.value = false;
}
});
}
function handleReject() {
reject(supplyBusNo.value).then((res) => {
if (res.code == 200) {
proxy.$modal.msgSuccess('操作成功');
}
});
}
/**
* 格式化库存数量显示(大单位情况)
* @param quantity 小单位库存数量
* @param partPercent 拆零比
* @param unitCode 大单位
* @param minUnitCode 小单位
*/
function formatInventory(quantity, partPercent, unitCode, minUnitCode) {
// 处理负数情况
const isNegative = quantity < 0;
const absQuantity = Math.abs(quantity);
if (absQuantity % partPercent !== 0) {
const integerPart = Math.floor(absQuantity / partPercent);
const decimalPart = absQuantity % partPercent;
let result = integerPart.toString() + ' ' + unitCode;
if (decimalPart > 0) {
result += decimalPart.toString() + ' ' + minUnitCode;
}
return isNegative ? '-' + result : result;
}
// 整除情况
const result = absQuantity / partPercent + ' ' + unitCode;
return isNegative ? '-' + result : result;
}
// 打印盘点单
function handlePrint() {
const result = [];
const printList = detailsList.value.map((item) => {
return {
...item,
name: item.itemName,
volume: item.totalVolume,
price: Number(item.price).toFixed(2),
itemQuantity: formatQuantity(item.itemQuantity, item),
profitAmount: ((item.itemQuantity * item.price) / item.partPercent).toFixed(2),
};
});
result.push({
purposeLocationName: printList[0].purposeLocationName,
name: userStore.name,
// totalAmount: totalAmount.value.toFixed(2),
occurrenceTime: proxy.formatDateStr(printList[0].occurrenceTime, 'YYYY-MM-DD HH:mm:ss'),
busNo: printList[0].busNo,
purposeLocationName: printList[0].purposeLocationName,
purchaseinventoryList: printList,
});
const printElements = JSON.parse(
JSON.stringify(templateJson).replace(/{{HOSPITAL_NAME}}/g, userStore.hospitalName)
);
var hiprintTemplate = new hiprint.PrintTemplate({ template: printElements }); // 定义模板
hiprintTemplate.print2(result, {
// printer: 'EPSON LQ-80KFII',
title: '打印标题',
}); //开始打印
}
// 导出
function handleExport() {
proxy.downloadGet(
'/inventory-manage/stocktaking/excel-out',
{
busNo: supplyBusNo.value,
},
`盘点单明细_${proxy.formatDateStr(new Date(), 'YYYY-MM-DD')}.xlsx`
);
}
defineExpose({
open,
});
</script>