fix
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="page">
|
||||
<a-page-header :ghost="false" title="设备管理">
|
||||
<div class="ele-text-secondary"> 设备管理,云芯威电池管理定制模块。 </div>
|
||||
<div class="ele-text-secondary"> 设备管理,云芯威电池管理定制模块2。 </div>
|
||||
</a-page-header>
|
||||
<div class="ele-body">
|
||||
<a-card :bordered="false">
|
||||
@@ -23,6 +23,7 @@
|
||||
@remove="removeBatch"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'image'">
|
||||
<a-image :src="record.image" :width="40" />
|
||||
|
||||
@@ -103,6 +103,11 @@
|
||||
¥{{ formatNumber(record.expendMoney) }}
|
||||
</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'balance'">
|
||||
<span class="ele-text-warning">
|
||||
¥{{record.balance==null ?'0.00': formatNumber(record.balance) }}
|
||||
</span>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'status'">
|
||||
<a-switch
|
||||
:checked="record.status === 0"
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
<a-input
|
||||
allow-clear
|
||||
:maxlength="11"
|
||||
:disabled="form.phone !== ''"
|
||||
|
||||
placeholder="请输入手机号"
|
||||
v-model:value="form.phone"
|
||||
/>
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
</template>
|
||||
<template v-if="column.key === 'balance'">
|
||||
<span class="ele-text-success">
|
||||
¥{{ formatNumber(record.balance) }}
|
||||
¥{{ record.balance==null?'0.00':formatNumber(record.balance) }}
|
||||
</span>
|
||||
</template>
|
||||
<!-- <template v-if="column.key === 'introduction'">-->
|
||||
|
||||
@@ -23,6 +23,12 @@
|
||||
@remove="removeBatch"
|
||||
/>
|
||||
</template>
|
||||
<a-button class="ele-btn-icon" @click="handleExport">
|
||||
<template #icon>
|
||||
<DownloadOutlined />
|
||||
</template>
|
||||
<span>导出设备</span>
|
||||
</a-button>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'image'">
|
||||
<a-image :src="record.image" :width="40" />
|
||||
@@ -119,7 +125,10 @@
|
||||
import { timeAgo } from 'ele-admin-pro';
|
||||
import { createVNode, computed, ref } from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
import {
|
||||
DownloadOutlined,
|
||||
ExclamationCircleOutlined
|
||||
} from '@ant-design/icons-vue';
|
||||
import type { EleProTable } from 'ele-admin-pro';
|
||||
import type {
|
||||
DatasourceFunction,
|
||||
@@ -129,14 +138,23 @@
|
||||
import Search from './components/search.vue';
|
||||
import EquipmentEdit from './components/equipment-edit.vue';
|
||||
import { pageEquipment, removeBatchEquipment } from '@/api/apps/equipment';
|
||||
import type { Equipment, EquipmentParam } from '@/api/apps/equipment/model';
|
||||
import { Equipment } from '@/api/apps/equipment/model';
|
||||
import type { EquipmentParam } from '@/api/apps/equipment/model';
|
||||
import { Accessory } from '@/api/tower/accessory/model';
|
||||
import { utils, writeFile } from 'xlsx';
|
||||
// import { Category } from '@/api/goods/category/model';
|
||||
// import { getDictionaryOptions } from '@/utils/common';
|
||||
// import { useUserStore } from '@/store/modules/user';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的角色
|
||||
selection2?: [];
|
||||
}>(),
|
||||
{}
|
||||
);
|
||||
// 当前用户信息
|
||||
// const brand = getDictionaryOptions('serverBrand');
|
||||
|
||||
@@ -297,6 +315,64 @@
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
|
||||
// 导出
|
||||
const handleExport = () => {
|
||||
if (!selection.value?.length) {
|
||||
message.error('请至少选择一条数据');
|
||||
return;
|
||||
}
|
||||
const array: (string | number)[][] = [
|
||||
[
|
||||
'二维码',
|
||||
'设备编号',
|
||||
'所属商户',
|
||||
'在租用户',
|
||||
'设备名称',
|
||||
'激活状态',
|
||||
'电池型号',
|
||||
'绑定状态'
|
||||
]
|
||||
];
|
||||
|
||||
selection.value?.forEach((d: Equipment) => {
|
||||
const bangding = d.userId > 0 ? '已绑定' : '未绑定';
|
||||
var username = '';
|
||||
if (d.user != null) {
|
||||
username = d.user.mobile ? d.user.mobile : d.user.nickname;
|
||||
}
|
||||
|
||||
array.push([
|
||||
`${d.qrcode}`,
|
||||
`${d.equipmentCode}`,
|
||||
`${d.merchantName}`,
|
||||
`${username}`,
|
||||
`${d.equipmentName}`,
|
||||
`${d.isCtive}`,
|
||||
`${d.batteryModel}`,
|
||||
`${bangding}`,
|
||||
`${d.comments}`
|
||||
]);
|
||||
});
|
||||
const sheetName = '设备列表';
|
||||
const workbook = {
|
||||
SheetNames: [sheetName],
|
||||
Sheets: {}
|
||||
};
|
||||
const sheet = utils.aoa_to_sheet(array);
|
||||
workbook.Sheets[sheetName] = sheet;
|
||||
// 设置列宽
|
||||
sheet['!cols'] = [
|
||||
{ wch: 10 },
|
||||
{ wch: 10 },
|
||||
{ wch: 10 },
|
||||
{ wch: 10 },
|
||||
{ wch: 20 },
|
||||
{ wch: 40 },
|
||||
{ wch: 10 }
|
||||
];
|
||||
writeFile(workbook, '导出设备管理表.xlsx');
|
||||
};
|
||||
|
||||
// 搜索是否展开
|
||||
const searchExpand = ref(false);
|
||||
|
||||
@@ -346,7 +422,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if (selection.value.filter(item=>item.userId!==0).length>0){
|
||||
if (selection.value.filter((item) => item.userId !== 0).length > 0) {
|
||||
message.error('不能删除绑定的设备,请重新选择');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -258,11 +258,12 @@
|
||||
</a-card>
|
||||
<a-card title="换电记录" class="order-card">
|
||||
<a-spin :spinning="loading">
|
||||
<ele-pro-table
|
||||
:datasource="datasource3"
|
||||
<a-table
|
||||
:datasource="EquipmentRecordList"
|
||||
:columns="columns3"
|
||||
ref="tableRef3"
|
||||
|
||||
>
|
||||
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'batteryModel'">
|
||||
<div>电池租金:¥{{ record.batteryRent }}</div>
|
||||
@@ -278,7 +279,7 @@
|
||||
</template>
|
||||
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</a-table>
|
||||
</a-spin>
|
||||
</a-card>
|
||||
<a-card title="缴费记录" class="order-card">
|
||||
@@ -446,8 +447,9 @@ const isUpdate = ref(false);
|
||||
const maxAble = ref(true);
|
||||
const EquipmentOrderGoodsList = ref<EquipmentOrderGoods[]>([]);
|
||||
const renewOrderList = ref<Order[]>([]);
|
||||
const equipmentRecordList = ref<EquipmentRecord[]>([]);
|
||||
const EquipmentRecordList = ref<EquipmentRecord[]>([]);
|
||||
const bindEquipmentCode = ref<string>();
|
||||
|
||||
const files = ref<any[]>();
|
||||
|
||||
// 步骤条
|
||||
@@ -732,32 +734,32 @@ const getRenewOrder = () => {
|
||||
|
||||
};
|
||||
|
||||
// const getEquipmentRecordList = () => {
|
||||
// EquipmentRecordApi.pageEquipmentRecord({
|
||||
// orderId: order.orderId,
|
||||
// userId: order.userId
|
||||
// }).then((data) => {
|
||||
|
||||
// });
|
||||
// };
|
||||
|
||||
// 表格数据源
|
||||
const datasource3: DatasourceFunction = ({
|
||||
page,
|
||||
limit,
|
||||
where,
|
||||
orders
|
||||
}) => {
|
||||
where.orderId = order.orderId
|
||||
where.userId = order.userId
|
||||
return EquipmentRecordApi.pageEquipmentRecord({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
const getEquipmentRecordList = () => {
|
||||
EquipmentRecordApi.pageEquipmentRecord({
|
||||
orderId: order.orderId,
|
||||
userId: order.userId
|
||||
}).then((data) => {
|
||||
EquipmentRecordList.value = data.list;
|
||||
});
|
||||
};
|
||||
|
||||
// 表格数据源
|
||||
// const datasource3: DatasourceFunction = ({
|
||||
// page,
|
||||
// limit,
|
||||
// where,
|
||||
// orders
|
||||
// }) => {
|
||||
// where.orderId = order.orderId
|
||||
// where.userId = order.userId
|
||||
// return EquipmentRecordApi.pageEquipmentRecord({
|
||||
// ...where,
|
||||
// ...orders,
|
||||
// page,
|
||||
// limit
|
||||
// });
|
||||
// };
|
||||
|
||||
const expirationDay = (order) => {
|
||||
const setTime = new Date(order.expirationTime);
|
||||
const nowTime = new Date();
|
||||
@@ -815,7 +817,7 @@ watch(
|
||||
getEquipmentOrderGoods();
|
||||
getRenewOrder();
|
||||
getEquipment();
|
||||
// getEquipmentRecordList();
|
||||
getEquipmentRecordList();
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
|
||||
@@ -22,9 +22,17 @@
|
||||
@advanced="openAdvanced"
|
||||
/>
|
||||
</template>
|
||||
<a-button class="ele-btn-icon" @click="handleExport">
|
||||
<template #icon>
|
||||
<DownloadOutlined />
|
||||
</template>
|
||||
<span>导出订单</span>
|
||||
</a-button>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'restDay'">
|
||||
<strong v-if="record.restDay < 0" :style="{ color: 'red' }">{{ record.restDay }}</strong>
|
||||
<strong v-if="record.restDay < 0" :style="{ color: 'red' }">{{
|
||||
record.restDay
|
||||
}}</strong>
|
||||
<span v-else-if="record.restDay >= 0">{{ record.restDay }}</span>
|
||||
<span> 天</span>
|
||||
</template>
|
||||
@@ -90,14 +98,21 @@
|
||||
<!-- 发货状态:-->
|
||||
<a-tag v-if="record.deliveryStatus === 10">未发货</a-tag>
|
||||
<a-tag v-else-if="record.deliveryStatus === 20" color="success"
|
||||
>已发货</a-tag>
|
||||
>已发货</a-tag
|
||||
>
|
||||
</div>
|
||||
<div class="ele-text-placeholder">
|
||||
<!-- 收货状态:-->
|
||||
<a-tag v-if="record.receiptStatus === 10">未收货</a-tag>
|
||||
<a-tag v-else-if="record.receiptStatus === 20" color="success">已收货</a-tag>
|
||||
<a-tag v-else-if="record.receiptStatus === 21" color="purple">退租中</a-tag>
|
||||
<a-tag v-else-if="record.receiptStatus === 30" color="error">已退租</a-tag>
|
||||
<a-tag v-else-if="record.receiptStatus === 20" color="success"
|
||||
>已收货</a-tag
|
||||
>
|
||||
<a-tag v-else-if="record.receiptStatus === 21" color="purple"
|
||||
>退租中</a-tag
|
||||
>
|
||||
<a-tag v-else-if="record.receiptStatus === 30" color="error"
|
||||
>已退租</a-tag
|
||||
>
|
||||
</div>
|
||||
<div class="ele-text-placeholder" v-if="record.orderSource != 10">
|
||||
<!-- 分期状态:-->
|
||||
@@ -169,23 +184,38 @@
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a-button class="ele-text-primary" @click="openInfo(record)">详情</a-button>
|
||||
<a-button class="ele-text-primary" @click="openInfo(record)"
|
||||
>详情</a-button
|
||||
>
|
||||
</a-space>
|
||||
<view v-if="record.deliveryStatus == 40">
|
||||
<a-divider type="vertical" />
|
||||
<a-button class="ele-text-danger" @click="openChange(record)">换电</a-button>
|
||||
<a-button class="ele-text-danger" @click="openChange(record)"
|
||||
>换电</a-button
|
||||
>
|
||||
<view v-if="record.receiptStatus === 20">
|
||||
<a-button class="ele-text-danger" @click="openOrderRefund(record)">退租</a-button>
|
||||
<a-button
|
||||
class="ele-text-danger"
|
||||
@click="openOrderRefund(record)"
|
||||
>退租</a-button
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</a-card>
|
||||
</div>
|
||||
<battery-change v-model:visible="showChange" :data="current" @done="reload"/>
|
||||
<order-refund v-model:visible="showOrderRefund" :data="current" @done="reload"/>
|
||||
<battery-change
|
||||
v-model:visible="showChange"
|
||||
:data="current"
|
||||
@done="reload"
|
||||
/>
|
||||
<order-refund
|
||||
v-model:visible="showOrderRefund"
|
||||
:data="current"
|
||||
@done="reload"
|
||||
/>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<Delivery v-model:visible="deliveryEdit" :data="current" @done="reload" />
|
||||
@@ -219,7 +249,8 @@
|
||||
// PlusOutlined,
|
||||
// DeleteOutlined,
|
||||
FormOutlined,
|
||||
ExclamationCircleOutlined
|
||||
ExclamationCircleOutlined,
|
||||
DownloadOutlined
|
||||
} from '@ant-design/icons-vue';
|
||||
import type { EleProTable } from 'ele-admin-pro';
|
||||
import type {
|
||||
@@ -238,7 +269,8 @@
|
||||
import { alipayQuery } from '@/api/system/payment';
|
||||
import type { Order, OrderParam } from '@/api/order/model';
|
||||
import { getDictionaryOptions } from '@/utils/common';
|
||||
import { Equipment } from "@/api/apps/equipment/model";
|
||||
import { Equipment } from '@/api/apps/equipment/model';
|
||||
import { utils, writeFile } from 'xlsx';
|
||||
|
||||
// 当前用户信息
|
||||
// const userStore = useUserStore();
|
||||
@@ -476,6 +508,63 @@
|
||||
limit
|
||||
});
|
||||
};
|
||||
// 导出
|
||||
const handleExport = () => {
|
||||
if (!selection.value?.length) {
|
||||
message.error('请至少选择一条数据');
|
||||
return;
|
||||
}
|
||||
const array: (string | number)[][] = [
|
||||
[
|
||||
'订单号',
|
||||
'电池型号',
|
||||
'电池编号',
|
||||
'所属商户',
|
||||
'到期时间',
|
||||
'剩余天数',
|
||||
'买家',
|
||||
'订单金额',
|
||||
'交易状态'
|
||||
]
|
||||
];
|
||||
|
||||
selection.value?.forEach((d: Order) => {
|
||||
var username = d.phone ? d.phone : d.nickname;
|
||||
|
||||
var equipmentCode = d.equipment ? d.equipment.equipmentCode : '';
|
||||
|
||||
array.push([
|
||||
`${d.orderNo}`,
|
||||
`${d.equipmentGoods.batteryModel}`,
|
||||
`${equipmentCode}`,
|
||||
`${d.merchantName}`,
|
||||
`${d.expirationTime}`,
|
||||
`${d.expirationDay}`,
|
||||
`${username}`,
|
||||
`${d.totalPrice}`,
|
||||
|
||||
`${d.orderStatus}`
|
||||
]);
|
||||
});
|
||||
const sheetName = '设备列表';
|
||||
const workbook = {
|
||||
SheetNames: [sheetName],
|
||||
Sheets: {}
|
||||
};
|
||||
const sheet = utils.aoa_to_sheet(array);
|
||||
workbook.Sheets[sheetName] = sheet;
|
||||
// 设置列宽
|
||||
sheet['!cols'] = [
|
||||
{ wch: 10 },
|
||||
{ wch: 10 },
|
||||
{ wch: 10 },
|
||||
{ wch: 10 },
|
||||
{ wch: 20 },
|
||||
{ wch: 40 },
|
||||
{ wch: 10 }
|
||||
];
|
||||
writeFile(workbook, '导出订单管理表.xlsx');
|
||||
};
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: OrderParam) => {
|
||||
|
||||
Reference in New Issue
Block a user