实现设备采购新增功能,并规范设备状态,添加未入库状态
This commit is contained in:
parent
e9d68d7ae3
commit
36db98a343
|
@ -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']
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,21 @@
|
|||
<div class="tab-content">
|
||||
<!-- 基本信息 -->
|
||||
<div v-show="activeTab === 'basic'">
|
||||
<!-- 测试数据按钮 -->
|
||||
<div v-if="!isView" class="test-data-section">
|
||||
<div class="test-data-header">
|
||||
<span class="test-data-title">🧪 测试数据</span>
|
||||
<span class="test-data-desc">点击按钮快速填入测试数据,方便功能测试</span>
|
||||
</div>
|
||||
<a-button
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="fillTestData"
|
||||
>
|
||||
📝 填入测试数据
|
||||
</a-button>
|
||||
</div>
|
||||
|
||||
<a-row :gutter="16">
|
||||
<a-col :span="12">
|
||||
<a-form-item label="设备名称" field="equipmentName">
|
||||
|
@ -173,10 +188,10 @@
|
|||
<a-form-item label="总价" field="totalPrice">
|
||||
<a-input-number
|
||||
v-model="formData.totalPrice"
|
||||
placeholder="请输入总价"
|
||||
placeholder="自动计算"
|
||||
:precision="2"
|
||||
:min="0"
|
||||
:disabled="isView"
|
||||
:disabled="true"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
|
@ -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"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
@ -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"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
@ -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"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
@ -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"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
@ -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"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
@ -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"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
@ -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"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -93,9 +93,8 @@
|
|||
>
|
||||
<a-option value="normal">正常</a-option>
|
||||
<a-option value="repair">维修中</a-option>
|
||||
<a-option value="scrap">已报废</a-option>
|
||||
<a-option value="idle">闲置</a-option>
|
||||
<a-option value="lost">丢失</a-option>
|
||||
<a-option value="maintain">保养中</a-option>
|
||||
<a-option value="scrap">报废</a-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
@ -106,13 +105,14 @@
|
|||
placeholder="请选择位置状态"
|
||||
allow-clear
|
||||
>
|
||||
<a-option value="not_in_stock">未入库</a-option>
|
||||
<a-option value="in_stock">库存中</a-option>
|
||||
<a-option value="in_use">使用中</a-option>
|
||||
<a-option value="allocated">已分配</a-option>
|
||||
<a-option value="repair">维修中</a-option>
|
||||
<a-option value="scrap">待报废</a-option>
|
||||
<a-option value="scrapped">已报废</a-option>
|
||||
<a-option value="on_loan">外借中</a-option>
|
||||
<a-option value="borrowed">外借中</a-option>
|
||||
<a-option value="lost">丢失</a-option>
|
||||
<a-option value="idle">闲置</a-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
|
|
@ -360,9 +360,8 @@ const getEquipmentStatusColor = (status: string) => {
|
|||
const colorMap: Record<string, string> = {
|
||||
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<string, string> = {
|
||||
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<string, string> = {
|
||||
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<string, string> = {
|
||||
not_in_stock: '未入库',
|
||||
in_stock: '库存中',
|
||||
in_use: '使用中',
|
||||
allocated: '已分配',
|
||||
repair: '维修中',
|
||||
scrap: '待报废',
|
||||
scrapped: '已报废',
|
||||
on_loan: '外借中',
|
||||
borrowed: '外借中',
|
||||
lost: '丢失',
|
||||
idle: '闲置',
|
||||
}
|
||||
return textMap[status] || '未知'
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue