From 36db98a343ed3e9f58531097532c251d6423c092 Mon Sep 17 00:00:00 2001
From: "Mr.j" <2221464500@qq.com>
Date: Thu, 7 Aug 2025 12:01:46 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E8=AE=BE=E5=A4=87=E9=87=87?=
=?UTF-8?q?=E8=B4=AD=E6=96=B0=E5=A2=9E=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=B9=B6?=
=?UTF-8?q?=E8=A7=84=E8=8C=83=E8=AE=BE=E5=A4=87=E7=8A=B6=E6=80=81=EF=BC=8C?=
=?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9C=AA=E5=85=A5=E5=BA=93=E7=8A=B6=E6=80=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/types/components.d.ts | 59 -----
.../components/ProcurementModal.vue | 212 +++++++++++++++++-
.../components/ProcurementSearch.vue | 12 +-
.../device-management/procurement/index.vue | 22 +-
4 files changed, 220 insertions(+), 85 deletions(-)
diff --git a/src/types/components.d.ts b/src/types/components.d.ts
index 19a4246..7fa6b1b 100644
--- a/src/types/components.d.ts
+++ b/src/types/components.d.ts
@@ -7,66 +7,7 @@ export {}
declare module 'vue' {
export interface GlobalComponents {
- Avatar: typeof import('./../components/Avatar/index.vue')['default']
- Breadcrumb: typeof import('./../components/Breadcrumb/index.vue')['default']
- CellCopy: typeof import('./../components/CellCopy/index.vue')['default']
- Chart: typeof import('./../components/Chart/index.vue')['default']
- ColumnSetting: typeof import('./../components/GiTable/src/components/ColumnSetting.vue')['default']
- CronForm: typeof import('./../components/GenCron/CronForm/index.vue')['default']
- CronModal: typeof import('./../components/GenCron/CronModal/index.vue')['default']
- DateRangePicker: typeof import('./../components/DateRangePicker/index.vue')['default']
- DayForm: typeof import('./../components/GenCron/CronForm/component/day-form.vue')['default']
- FilePreview: typeof import('./../components/FilePreview/index.vue')['default']
- GiCellAvatar: typeof import('./../components/GiCell/GiCellAvatar.vue')['default']
- GiCellGender: typeof import('./../components/GiCell/GiCellGender.vue')['default']
- GiCellStatus: typeof import('./../components/GiCell/GiCellStatus.vue')['default']
- GiCellTag: typeof import('./../components/GiCell/GiCellTag.vue')['default']
- GiCellTags: typeof import('./../components/GiCell/GiCellTags.vue')['default']
- GiCodeView: typeof import('./../components/GiCodeView/index.vue')['default']
- GiDot: typeof import('./../components/GiDot/index.tsx')['default']
- GiEditTable: typeof import('./../components/GiEditTable/GiEditTable.vue')['default']
- GiFooter: typeof import('./../components/GiFooter/index.vue')['default']
- GiForm: typeof import('./../components/GiForm/src/GiForm.vue')['default']
- GiIconBox: typeof import('./../components/GiIconBox/index.vue')['default']
- GiIconSelector: typeof import('./../components/GiIconSelector/index.vue')['default']
- GiIframe: typeof import('./../components/GiIframe/index.vue')['default']
- GiOption: typeof import('./../components/GiOption/index.vue')['default']
- GiOptionItem: typeof import('./../components/GiOptionItem/index.vue')['default']
- GiPageLayout: typeof import('./../components/GiPageLayout/index.vue')['default']
- GiSpace: typeof import('./../components/GiSpace/index.vue')['default']
- GiSplitButton: typeof import('./../components/GiSplitButton/index.vue')['default']
- GiSplitPane: typeof import('./../components/GiSplitPane/index.vue')['default']
- GiSplitPaneFlexibleBox: typeof import('./../components/GiSplitPane/components/GiSplitPaneFlexibleBox.vue')['default']
- GiSvgIcon: typeof import('./../components/GiSvgIcon/index.vue')['default']
- GiTable: typeof import('./../components/GiTable/src/GiTable.vue')['default']
- GiTag: typeof import('./../components/GiTag/index.tsx')['default']
- GiThemeBtn: typeof import('./../components/GiThemeBtn/index.vue')['default']
- HourForm: typeof import('./../components/GenCron/CronForm/component/hour-form.vue')['default']
- Icon403: typeof import('./../components/icons/Icon403.vue')['default']
- Icon404: typeof import('./../components/icons/Icon404.vue')['default']
- Icon500: typeof import('./../components/icons/Icon500.vue')['default']
- IconBorders: typeof import('./../components/icons/IconBorders.vue')['default']
- IconTableSize: typeof import('./../components/icons/IconTableSize.vue')['default']
- IconTreeAdd: typeof import('./../components/icons/IconTreeAdd.vue')['default']
- IconTreeReduce: typeof import('./../components/icons/IconTreeReduce.vue')['default']
- ImageImport: typeof import('./../components/ImageImport/index.vue')['default']
- ImageImportWizard: typeof import('./../components/ImageImportWizard/index.vue')['default']
- IndustrialImageList: typeof import('./../components/IndustrialImageList/index.vue')['default']
- JsonPretty: typeof import('./../components/JsonPretty/index.vue')['default']
- MinuteForm: typeof import('./../components/GenCron/CronForm/component/minute-form.vue')['default']
- MonthForm: typeof import('./../components/GenCron/CronForm/component/month-form.vue')['default']
- ParentView: typeof import('./../components/ParentView/index.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
- SecondForm: typeof import('./../components/GenCron/CronForm/component/second-form.vue')['default']
- SplitPanel: typeof import('./../components/SplitPanel/index.vue')['default']
- TextCopy: typeof import('./../components/TextCopy/index.vue')['default']
- TurbineGrid: typeof import('./../components/TurbineGrid/index.vue')['default']
- UserSelect: typeof import('./../components/UserSelect/index.vue')['default']
- Verify: typeof import('./../components/Verify/index.vue')['default']
- VerifyPoints: typeof import('./../components/Verify/Verify/VerifyPoints.vue')['default']
- VerifySlide: typeof import('./../components/Verify/Verify/VerifySlide.vue')['default']
- WeekForm: typeof import('./../components/GenCron/CronForm/component/week-form.vue')['default']
- YearForm: typeof import('./../components/GenCron/CronForm/component/year-form.vue')['default']
}
}
diff --git a/src/views/system-resource/device-management/procurement/components/ProcurementModal.vue b/src/views/system-resource/device-management/procurement/components/ProcurementModal.vue
index 89a88bb..260162c 100644
--- a/src/views/system-resource/device-management/procurement/components/ProcurementModal.vue
+++ b/src/views/system-resource/device-management/procurement/components/ProcurementModal.vue
@@ -32,6 +32,21 @@
+
+
+
@@ -173,10 +188,10 @@
@@ -219,6 +234,8 @@
:disabled="isView"
show-time
style="width: 100%"
+ format="YYYY-MM-DD HH:mm:ss"
+ value-format="YYYY-MM-DD HH:mm:ss"
/>
@@ -230,6 +247,8 @@
:disabled="isView"
show-time
style="width: 100%"
+ format="YYYY-MM-DD HH:mm:ss"
+ value-format="YYYY-MM-DD HH:mm:ss"
/>
@@ -244,6 +263,8 @@
:disabled="isView"
show-time
style="width: 100%"
+ format="YYYY-MM-DD HH:mm:ss"
+ value-format="YYYY-MM-DD HH:mm:ss"
/>
@@ -253,7 +274,10 @@
v-model="formData.expectedScrapTime"
placeholder="请选择预计报废时间"
:disabled="isView"
+ show-time
style="width: 100%"
+ format="YYYY-MM-DD HH:mm:ss"
+ value-format="YYYY-MM-DD HH:mm:ss"
/>
@@ -306,7 +330,10 @@
v-model="formData.warrantyExpireDate"
placeholder="请选择保修截止日期"
:disabled="isView"
+ show-time
style="width: 100%"
+ format="YYYY-MM-DD HH:mm:ss"
+ value-format="YYYY-MM-DD HH:mm:ss"
/>
@@ -418,7 +445,10 @@
v-model="formData.lastMaintenanceDate"
placeholder="请选择上次维护日期"
:disabled="isView"
+ show-time
style="width: 100%"
+ format="YYYY-MM-DD HH:mm:ss"
+ value-format="YYYY-MM-DD HH:mm:ss"
/>
@@ -428,7 +458,10 @@
v-model="formData.nextMaintenanceDate"
placeholder="请选择下次维护日期"
:disabled="isView"
+ show-time
style="width: 100%"
+ format="YYYY-MM-DD HH:mm:ss"
+ value-format="YYYY-MM-DD HH:mm:ss"
/>
@@ -596,9 +629,8 @@ const equipmentTypeOptions = [
const equipmentStatusOptions = [
{ label: '正常', value: 'normal' },
{ label: '维修中', value: 'repair' },
- { label: '已报废', value: 'scrap' },
- { label: '闲置', value: 'idle' },
- { label: '丢失', value: 'lost' },
+ { label: '保养中', value: 'maintain' },
+ { label: '报废', value: 'scrap' },
]
const useStatusOptions = [
@@ -607,13 +639,14 @@ const useStatusOptions = [
]
const locationStatusOptions = [
+ { label: '未入库', value: 'not_in_stock' },
{ label: '库存中', value: 'in_stock' },
- { label: '使用中', value: 'in_use' },
+ { label: '已分配', value: 'allocated' },
{ label: '维修中', value: 'repair' },
+ { label: '待报废', value: 'scrap' },
{ label: '已报废', value: 'scrapped' },
- { label: '外借中', value: 'on_loan' },
+ { label: '外借中', value: 'borrowed' },
{ label: '丢失', value: 'lost' },
- { label: '闲置', value: 'idle' },
]
const healthStatusOptions = [
@@ -650,6 +683,15 @@ watch(() => props.visible, (newVal) => {
}
})
+// 监听单价和数量变化,自动计算总价
+watch([() => formData.unitPrice, () => formData.quantity], ([newUnitPrice, newQuantity]) => {
+ if (newUnitPrice && newQuantity) {
+ formData.totalPrice = Number((newUnitPrice * newQuantity).toFixed(2))
+ } else {
+ formData.totalPrice = undefined
+ }
+})
+
// 初始化表单数据
const initFormData = () => {
if (props.procurementData) {
@@ -709,7 +751,7 @@ const resetForm = () => {
assetCode: '',
brand: '',
specification: '',
- locationStatus: '',
+ locationStatus: 'not_in_stock', // 设置默认位置状态为"未入库"
physicalLocation: '',
responsiblePerson: '',
healthStatus: '',
@@ -765,6 +807,107 @@ const handleSubmit = async () => {
}
}
+// 填入测试数据
+const fillTestData = () => {
+ // 生成当前时间
+ const now = new Date()
+ const currentTime = now.toISOString().slice(0, 19).replace('T', ' ')
+
+ // 生成未来时间(预计报废时间)
+ const futureDate = new Date(now.getTime() + 365 * 24 * 60 * 60 * 1000) // 一年后
+ const futureTime = futureDate.toISOString().slice(0, 19).replace('T', ' ')
+
+ // 生成过去时间(采购时间等)
+ const pastDate = new Date(now.getTime() - 30 * 24 * 60 * 60 * 1000) // 30天前
+ const pastTime = pastDate.toISOString().slice(0, 19).replace('T', ' ')
+
+ // 生成入库时间(采购后7天)
+ const inStockDate = new Date(pastDate.getTime() + 7 * 24 * 60 * 60 * 1000)
+ const inStockTime = inStockDate.toISOString().slice(0, 19).replace('T', ' ')
+
+ // 生成启用时间(入库后3天)
+ const activationDate = new Date(inStockDate.getTime() + 3 * 24 * 60 * 60 * 1000)
+ const activationTime = activationDate.toISOString().slice(0, 19).replace('T', ' ')
+
+ // 生成保修截止时间(采购后2年)
+ const warrantyDate = new Date(pastDate.getTime() + 2 * 365 * 24 * 60 * 60 * 1000)
+ const warrantyTime = warrantyDate.toISOString().slice(0, 19).replace('T', ' ')
+
+ // 生成维护时间
+ const lastMaintenanceDate = new Date(now.getTime() - 15 * 24 * 60 * 60 * 1000) // 15天前
+ const lastMaintenanceTime = lastMaintenanceDate.toISOString().slice(0, 19).replace('T', ' ')
+
+ const nextMaintenanceDate = new Date(now.getTime() + 15 * 24 * 60 * 60 * 1000) // 15天后
+ const nextMaintenanceTime = nextMaintenanceDate.toISOString().slice(0, 19).replace('T', ' ')
+
+ // 生成随机序列号
+ const randomSn = 'SN' + Math.random().toString(36).substr(2, 8).toUpperCase()
+
+ // 生成随机资产编号
+ const randomAssetCode = 'ZC' + Math.random().toString(36).substr(2, 6).toUpperCase()
+
+ // 生成随机采购订单号
+ const randomPurchaseOrder = 'PO' + Math.random().toString(36).substr(2, 8).toUpperCase()
+
+ // 生成随机库存条码
+ const randomBarcode = 'BC' + Math.random().toString(36).substr(2, 10).toUpperCase()
+
+ // 生成随机次户号
+ const randomAccountNumber = 'AC' + Math.random().toString(36).substr(2, 6).toUpperCase()
+
+ // 先设置单价和数量,让监听器自动计算总价
+ formData.unitPrice = 8999.00
+ formData.quantity = 2
+
+ Object.assign(formData, {
+ // 基本信息
+ equipmentName: '高清工业相机系统',
+ equipmentModel: 'IC-2000Pro',
+ equipmentType: 'detection',
+ equipmentSn: randomSn,
+ brand: '海康威视',
+ assetCode: randomAssetCode,
+ specification: '分辨率:4K,帧率:60fps,接口:USB3.0,支持AI识别,防水等级IP67',
+
+ // 采购信息
+ purchaseOrder: randomPurchaseOrder,
+ supplierName: '海康威视官方旗舰店',
+ // quantity 和 unitPrice 已在上方设置,totalPrice 将由监听器自动计算
+ purchasePrice: 17998.00,
+ currentNetValue: 17998.00,
+ depreciationMethod: 'straight_line',
+ depreciationYears: 5,
+ salvageValue: 899.90,
+
+ // 时间信息
+ purchaseTime: pastTime,
+ inStockTime: inStockTime,
+ activationTime: activationTime,
+ expectedScrapTime: futureTime,
+ warrantyExpireDate: warrantyTime,
+ lastMaintenanceDate: lastMaintenanceTime,
+ nextMaintenanceDate: nextMaintenanceTime,
+
+ // 状态信息
+ equipmentStatus: 'normal',
+ useStatus: '1',
+ locationStatus: 'in_stock',
+ healthStatus: 'excellent',
+ responsiblePerson: '张工程师',
+ maintenancePerson: '李维护员',
+ physicalLocation: 'A区-3楼-设备间-01号柜',
+ inventoryBarcode: randomBarcode,
+
+ // 其他信息
+ accountNumber: randomAccountNumber,
+ inventoryBasis: '月度盘点',
+ dynamicRecord: '设备运行正常,定期维护保养,性能稳定,满足生产需求。',
+ assetRemark: '重要检测设备,需定期校准,专人负责维护。',
+ })
+
+ Message.success('测试数据已填入!')
+}
+
// 取消
const handleCancel = () => {
emit('update:visible', false)
@@ -845,6 +988,52 @@ const handleCancel = () => {
}
}
+// 测试数据区域样式
+.test-data-section {
+ background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
+ border: 1px solid #bae6fd;
+ border-radius: 8px;
+ padding: 12px 16px;
+ margin-bottom: 20px;
+
+ .test-data-header {
+ display: flex;
+ flex-direction: column;
+ margin-bottom: 12px;
+
+ .test-data-title {
+ font-weight: 600;
+ color: #1e40af;
+ font-size: 14px;
+ margin-bottom: 4px;
+ }
+
+ .test-data-desc {
+ color: #64748b;
+ font-size: 12px;
+ line-height: 1.4;
+ }
+ }
+
+ .arco-btn {
+ background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
+ border: none;
+ color: white;
+ font-weight: 500;
+ box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
+ transition: all 0.3s ease;
+
+ &:hover {
+ transform: translateY(-1px);
+ box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
+ }
+
+ &:active {
+ transform: translateY(0);
+ }
+ }
+}
+
// 响应式设计
@media (max-width: 768px) {
.tab-navigation {
@@ -861,5 +1050,10 @@ const handleCancel = () => {
}
}
}
+
+ .test-data-section {
+ padding: 8px 12px;
+ margin-bottom: 16px;
+ }
}
\ No newline at end of file
diff --git a/src/views/system-resource/device-management/procurement/components/ProcurementSearch.vue b/src/views/system-resource/device-management/procurement/components/ProcurementSearch.vue
index 6ffbbbf..e8f3c26 100644
--- a/src/views/system-resource/device-management/procurement/components/ProcurementSearch.vue
+++ b/src/views/system-resource/device-management/procurement/components/ProcurementSearch.vue
@@ -93,9 +93,8 @@
>
正常
维修中
- 已报废
- 闲置
- 丢失
+ 保养中
+ 报废
@@ -106,13 +105,14 @@
placeholder="请选择位置状态"
allow-clear
>
+ 未入库
库存中
- 使用中
+ 已分配
维修中
+ 待报废
已报废
- 外借中
+ 外借中
丢失
- 闲置
diff --git a/src/views/system-resource/device-management/procurement/index.vue b/src/views/system-resource/device-management/procurement/index.vue
index 8bc491b..d07edab 100644
--- a/src/views/system-resource/device-management/procurement/index.vue
+++ b/src/views/system-resource/device-management/procurement/index.vue
@@ -360,9 +360,8 @@ const getEquipmentStatusColor = (status: string) => {
const colorMap: Record = {
normal: 'green',
repair: 'orange',
+ maintain: 'blue',
scrap: 'red',
- idle: 'blue',
- lost: 'gray',
}
return colorMap[status] || 'blue'
}
@@ -372,9 +371,8 @@ const getEquipmentStatusText = (status: string) => {
const textMap: Record = {
normal: '正常',
repair: '维修中',
- scrap: '已报废',
- idle: '闲置',
- lost: '丢失',
+ maintain: '保养中',
+ scrap: '报废',
}
return textMap[status] || '未知'
}
@@ -382,13 +380,14 @@ const getEquipmentStatusText = (status: string) => {
// 获取位置状态颜色
const getLocationStatusColor = (status: string) => {
const colorMap: Record = {
+ not_in_stock: 'gray',
in_stock: 'blue',
- in_use: 'green',
+ allocated: 'green',
repair: 'orange',
+ scrap: 'red',
scrapped: 'red',
- on_loan: 'purple',
+ borrowed: 'purple',
lost: 'gray',
- idle: 'cyan',
}
return colorMap[status] || 'blue'
}
@@ -396,13 +395,14 @@ const getLocationStatusColor = (status: string) => {
// 获取位置状态文本
const getLocationStatusText = (status: string) => {
const textMap: Record = {
+ not_in_stock: '未入库',
in_stock: '库存中',
- in_use: '使用中',
+ allocated: '已分配',
repair: '维修中',
+ scrap: '待报废',
scrapped: '已报废',
- on_loan: '外借中',
+ borrowed: '外借中',
lost: '丢失',
- idle: '闲置',
}
return textMap[status] || '未知'
}