From cb057b431eb4cd8f72b792dfb31606038cb4f9f2 Mon Sep 17 00:00:00 2001 From: cnbugs Date: Tue, 28 Apr 2026 12:57:59 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BD=8D=E7=BD=AE=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E6=94=B9=E5=90=8D=E4=B8=BA=E6=9C=BA=E6=88=BF=EF=BC=8C=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E5=88=B0ID=E5=88=97=E5=90=8E=E9=9D=A2=EF=BC=9B?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=88=97=E8=A1=A8=E5=88=97=E5=AE=BD=E5=92=8C?= =?UTF-8?q?=E6=88=AA=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assetapp/excel_utils.py | 2 +- .../migrations/0008_alter_asset_location.py | 18 ++++++++++++++++++ assetapp/models.py | 2 +- templates/assetapp/asset_detail.html | 2 +- templates/assetapp/asset_list.html | 8 ++++---- 5 files changed, 25 insertions(+), 7 deletions(-) create mode 100644 assetapp/migrations/0008_alter_asset_location.py diff --git a/assetapp/excel_utils.py b/assetapp/excel_utils.py index 9c382f1..223b60a 100644 --- a/assetapp/excel_utils.py +++ b/assetapp/excel_utils.py @@ -16,7 +16,7 @@ EXPORT_COLUMNS = [ ('model', '型号', 20), ('asset_value', '资产面值', 12), ('serial_number', '序列号', 25), - ('location', '设备位置', 20), + ('location', '机房', 20), ('cabinet', '机柜', 10), ('cabinet_position', '机柜位置', 10), ('bmc_address', 'BMC地址', 16), diff --git a/assetapp/migrations/0008_alter_asset_location.py b/assetapp/migrations/0008_alter_asset_location.py new file mode 100644 index 0000000..76cb5b2 --- /dev/null +++ b/assetapp/migrations/0008_alter_asset_location.py @@ -0,0 +1,18 @@ +# Generated by Django 5.2.13 on 2026-04-28 04:54 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('assetapp', '0007_asset_business_type_asset_gpu_count_asset_gpu_type_and_more'), + ] + + operations = [ + migrations.AlterField( + model_name='asset', + name='location', + field=models.CharField(blank=True, default='', help_text='楼层/房间/区域', max_length=200, verbose_name='机房'), + ), + ] diff --git a/assetapp/models.py b/assetapp/models.py index 86c91d8..a76861b 100644 --- a/assetapp/models.py +++ b/assetapp/models.py @@ -40,7 +40,7 @@ class Asset(models.Model): serial_number = models.CharField('序列号', max_length=100, blank=True, default='', db_index=True) # 位置信息 - location = models.CharField('设备位置', max_length=200, blank=True, default='', help_text='楼层/房间/区域') + location = models.CharField('机房', max_length=200, blank=True, default='', help_text='楼层/房间/区域') cabinet = models.CharField('机柜', max_length=50, blank=True, default='') cabinet_position = models.CharField('机柜位置', max_length=50, blank=True, default='', help_text='U位') diff --git a/templates/assetapp/asset_detail.html b/templates/assetapp/asset_detail.html index a4c89a9..039bcb5 100644 --- a/templates/assetapp/asset_detail.html +++ b/templates/assetapp/asset_detail.html @@ -52,7 +52,7 @@
位置与网络
- + diff --git a/templates/assetapp/asset_list.html b/templates/assetapp/asset_list.html index 787723f..aa02608 100644 --- a/templates/assetapp/asset_list.html +++ b/templates/assetapp/asset_list.html @@ -70,14 +70,14 @@ - - + + + - @@ -94,6 +94,7 @@ {% for asset in page_obj %} + @@ -101,7 +102,6 @@ -
设备位置{{ asset.location|default:"-" }}
机房{{ asset.location|default:"-" }}
机柜{{ asset.cabinet|default:"-" }}
机柜位置{{ asset.cabinet_position|default:"-" }}
BMC地址{{ asset.bmc_address|default:"-" }}
ID机柜机柜位置机房机柜机柜位置 资产编号 设备名称 分类 品牌/型号 资产面值位置 BMC地址 IP地址 显卡类型
{{ asset.id|stringformat:"s"|truncatechars:3 }}{{ asset.location|default:"-"|truncatechars:5 }} {{ asset.cabinet|default:"-"|truncatechars:3 }} {{ asset.cabinet_position|default:"-"|truncatechars:10 }} {{ asset.asset_number|truncatechars:3 }}{{ asset.category.name }} {{ asset.brand }} {% if asset.model %}{{ asset.model }}{% endif %} {% if asset.asset_value %}¥{{ asset.asset_value }}{% else %}-{% endif %}{{ asset.location|default:"-"|truncatechars:5 }} {{ asset.bmc_address|default:"-" }} {{ asset.ip_address|default:"-" }} {{ asset.gpu_type|default:"-" }}