feat: 修复bug
This commit is contained in:
@@ -119,32 +119,9 @@ async function getCarCount() {
|
||||
},
|
||||
);
|
||||
const result = await response.json();
|
||||
overviewItems.value[1].value = result.data.pageTotals;
|
||||
const response2 = await fetch(
|
||||
'https://server.cqnctc.com:6081/web/thirdParty/queryInParkData',
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Accept: 'application/json, text/plain, */*',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
pageReq: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
plNos: ['PFN000000012', 'PFN000000022', 'PFN000000025'],
|
||||
parkInBeginTime: '',
|
||||
parkInEndTime: '',
|
||||
orgId: 10012,
|
||||
parkOrderTypes: [100, 200, 201, 300, 500],
|
||||
terminalSource: 50,
|
||||
remark: '',
|
||||
}),
|
||||
},
|
||||
);
|
||||
const result2 = await response2.json();
|
||||
overviewItems.value[1].totalValue = result2.data.pageTotals;
|
||||
overviewItems.value[1].value = result.data.todayCount;
|
||||
|
||||
overviewItems.value[1].totalValue = result.data.allCount;
|
||||
}
|
||||
// 预警
|
||||
async function getStatisticsCurrDayCount() {
|
||||
|
@@ -46,6 +46,7 @@ export const columns: VxeGridProps['columns'] = [
|
||||
{
|
||||
title: '图片',
|
||||
field: 'imgPath',
|
||||
slots: { default: 'imgPath' },
|
||||
},
|
||||
{
|
||||
title: '规格',
|
||||
@@ -123,7 +124,7 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
rules: 'required',
|
||||
componentProps: {
|
||||
precision: 2,
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '库存数量',
|
||||
|
@@ -5,7 +5,7 @@ import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
import {
|
||||
useVbenVxeGrid,
|
||||
vxeCheckboxChecked,
|
||||
type VxeGridProps
|
||||
type VxeGridProps,
|
||||
} from '#/adapter/vxe-table';
|
||||
import {
|
||||
plantsProductList,
|
||||
@@ -15,6 +15,7 @@ import type { PropertyForm } from '#/api/property/productManagement/model';
|
||||
import PlantsProductModal from './plantsProduct-modal.vue';
|
||||
import PlantsProductDetail from './plantsProduct-detail.vue';
|
||||
import { columns, querySchema } from './data';
|
||||
import { ossInfo } from '#/api/system/oss';
|
||||
const formOptions: VbenFormProps = {
|
||||
commonConfig: {
|
||||
labelWidth: 80,
|
||||
@@ -38,18 +39,47 @@ const gridOptions: VxeGridProps = {
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues = {}) => {
|
||||
return await plantsProductList({
|
||||
const result = await plantsProductList({
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
|
||||
// 预处理图片路径
|
||||
if (result.rows && result.rows.length > 0) {
|
||||
// 收集所有图片路径
|
||||
const imgPaths = result.rows
|
||||
.filter((row: any) => row.imgPath)
|
||||
.map((row: any) => row.imgPath);
|
||||
|
||||
if (imgPaths.length > 0) {
|
||||
try {
|
||||
// 批量获取图片URL
|
||||
const imgUrls = await ossInfo(imgPaths);
|
||||
const urlMap = new Map(
|
||||
imgUrls.map((item) => [item.fileName, item.url]),
|
||||
);
|
||||
|
||||
// 将URL映射回数据行
|
||||
result.rows.forEach((row: any) => {
|
||||
if (row.imgPath && urlMap.has(row.imgPath)) {
|
||||
row._imgUrl = urlMap.get(row.imgPath);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('获取图片URL失败:', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
},
|
||||
id: 'property-property-index'
|
||||
id: 'property-property-index',
|
||||
};
|
||||
|
||||
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
@@ -98,6 +128,9 @@ function handleMultiDelete() {
|
||||
},
|
||||
});
|
||||
}
|
||||
function getImgUrl(row: any) {
|
||||
return row._imgUrl || '';
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -110,7 +143,8 @@ function handleMultiDelete() {
|
||||
danger
|
||||
type="primary"
|
||||
v-access:code="['property:plantsProduct:remove']"
|
||||
@click="handleMultiDelete">
|
||||
@click="handleMultiDelete"
|
||||
>
|
||||
{{ $t('pages.common.delete') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
@@ -152,6 +186,14 @@ function handleMultiDelete() {
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
</template>
|
||||
<template #imgPath="{ row }">
|
||||
<img
|
||||
v-if="row.imgPath"
|
||||
:src="getImgUrl(row)"
|
||||
alt=""
|
||||
class="h-[50px] w-[70px]"
|
||||
/>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<PlantsProduct @reload="tableApi.query()" />
|
||||
<PlantsProductDetailModal />
|
||||
|
Reference in New Issue
Block a user