feat: 修复bug
This commit is contained in:
@@ -119,32 +119,9 @@ async function getCarCount() {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
const result = await response.json();
|
const result = await response.json();
|
||||||
overviewItems.value[1].value = result.data.pageTotals;
|
overviewItems.value[1].value = result.data.todayCount;
|
||||||
const response2 = await fetch(
|
|
||||||
'https://server.cqnctc.com:6081/web/thirdParty/queryInParkData',
|
overviewItems.value[1].totalValue = result.data.allCount;
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
// 预警
|
// 预警
|
||||||
async function getStatisticsCurrDayCount() {
|
async function getStatisticsCurrDayCount() {
|
||||||
|
@@ -46,6 +46,7 @@ export const columns: VxeGridProps['columns'] = [
|
|||||||
{
|
{
|
||||||
title: '图片',
|
title: '图片',
|
||||||
field: 'imgPath',
|
field: 'imgPath',
|
||||||
|
slots: { default: 'imgPath' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '规格',
|
title: '规格',
|
||||||
@@ -121,9 +122,9 @@ export const modalSchema: FormSchemaGetter = () => [
|
|||||||
fieldName: 'rent',
|
fieldName: 'rent',
|
||||||
component: 'InputNumber',
|
component: 'InputNumber',
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
componentProps:{
|
componentProps: {
|
||||||
precision: 2,
|
precision: 2,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '库存数量',
|
label: '库存数量',
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
|
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
|
||||||
import { getVxePopupContainer } from '@vben/utils';
|
import { getVxePopupContainer } from '@vben/utils';
|
||||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||||
import {
|
import {
|
||||||
useVbenVxeGrid,
|
useVbenVxeGrid,
|
||||||
vxeCheckboxChecked,
|
vxeCheckboxChecked,
|
||||||
type VxeGridProps
|
type VxeGridProps,
|
||||||
} from '#/adapter/vxe-table';
|
} from '#/adapter/vxe-table';
|
||||||
import {
|
import {
|
||||||
plantsProductList,
|
plantsProductList,
|
||||||
@@ -15,6 +15,7 @@ import type { PropertyForm } from '#/api/property/productManagement/model';
|
|||||||
import PlantsProductModal from './plantsProduct-modal.vue';
|
import PlantsProductModal from './plantsProduct-modal.vue';
|
||||||
import PlantsProductDetail from './plantsProduct-detail.vue';
|
import PlantsProductDetail from './plantsProduct-detail.vue';
|
||||||
import { columns, querySchema } from './data';
|
import { columns, querySchema } from './data';
|
||||||
|
import { ossInfo } from '#/api/system/oss';
|
||||||
const formOptions: VbenFormProps = {
|
const formOptions: VbenFormProps = {
|
||||||
commonConfig: {
|
commonConfig: {
|
||||||
labelWidth: 80,
|
labelWidth: 80,
|
||||||
@@ -38,18 +39,47 @@ const gridOptions: VxeGridProps = {
|
|||||||
proxyConfig: {
|
proxyConfig: {
|
||||||
ajax: {
|
ajax: {
|
||||||
query: async ({ page }, formValues = {}) => {
|
query: async ({ page }, formValues = {}) => {
|
||||||
return await plantsProductList({
|
const result = await plantsProductList({
|
||||||
pageNum: page.currentPage,
|
pageNum: page.currentPage,
|
||||||
pageSize: page.pageSize,
|
pageSize: page.pageSize,
|
||||||
...formValues,
|
...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: {
|
rowConfig: {
|
||||||
keyField: 'id',
|
keyField: 'id',
|
||||||
},
|
},
|
||||||
id: 'property-property-index'
|
id: 'property-property-index',
|
||||||
};
|
};
|
||||||
|
|
||||||
const [BasicTable, tableApi] = useVbenVxeGrid({
|
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||||
@@ -98,6 +128,9 @@ function handleMultiDelete() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
function getImgUrl(row: any) {
|
||||||
|
return row._imgUrl || '';
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -110,7 +143,8 @@ function handleMultiDelete() {
|
|||||||
danger
|
danger
|
||||||
type="primary"
|
type="primary"
|
||||||
v-access:code="['property:plantsProduct:remove']"
|
v-access:code="['property:plantsProduct:remove']"
|
||||||
@click="handleMultiDelete">
|
@click="handleMultiDelete"
|
||||||
|
>
|
||||||
{{ $t('pages.common.delete') }}
|
{{ $t('pages.common.delete') }}
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-button
|
<a-button
|
||||||
@@ -152,8 +186,16 @@ function handleMultiDelete() {
|
|||||||
</Popconfirm>
|
</Popconfirm>
|
||||||
</Space>
|
</Space>
|
||||||
</template>
|
</template>
|
||||||
|
<template #imgPath="{ row }">
|
||||||
|
<img
|
||||||
|
v-if="row.imgPath"
|
||||||
|
:src="getImgUrl(row)"
|
||||||
|
alt=""
|
||||||
|
class="h-[50px] w-[70px]"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
</BasicTable>
|
</BasicTable>
|
||||||
<PlantsProduct @reload="tableApi.query()" />
|
<PlantsProduct @reload="tableApi.query()" />
|
||||||
<PlantsProductDetailModal/>
|
<PlantsProductDetailModal />
|
||||||
</Page>
|
</Page>
|
||||||
</template>
|
</template>
|
||||||
|
Reference in New Issue
Block a user