Commit ec38f4ca by Jony.L

算力资源配置增加电源、网卡字段,订单功能相应添加

parent ca66886a
......@@ -8,6 +8,8 @@ export interface ResourceSpu {
gpu: string; // GPU配置
ram?: string; // 内存配置
storage?: string; // 存储配置
powerSupply?: string; // 电源配置
nic?: string; // 网卡配置
ip?: string; // 服务器ip
initUsername?: string; // 初始用户名
initPassword?: string; // 初始密码
......
......@@ -6,6 +6,8 @@ interface ResourceConfig {
gpuOptions: any[]
ramOptions: any[]
storageOptions: any[]
powerSupplyOptions: any[]
nicOptions: any[]
locationOptions: any[]
lastFetched: number | null
}
......@@ -16,6 +18,8 @@ export const useResourceConfigStore = defineStore('resourceConfig', {
gpuOptions: [],
ramOptions: [],
storageOptions: [],
powerSupplyOptions: [],
nicOptions: [],
locationOptions: [],
lastFetched: null
}),
......@@ -36,6 +40,8 @@ export const useResourceConfigStore = defineStore('resourceConfig', {
gpu: this.gpuOptions,
ram: this.ramOptions,
storage: this.storageOptions,
powerSupply: this.powerSupplyOptions,
nic: this.nicOptions,
location: this.locationOptions
}
}
......@@ -50,11 +56,13 @@ export const useResourceConfigStore = defineStore('resourceConfig', {
}
try {
const [cpuRes, gpuRes, ramRes, storageRes, locationRes] = await Promise.all([
const [cpuRes, gpuRes, ramRes, storageRes, powerSupplyRes, nicRes, locationRes] = await Promise.all([
ResourceConfigApi.listSimpleConfigByCategory('cpu'),
ResourceConfigApi.listSimpleConfigByCategory('gpu'),
ResourceConfigApi.listSimpleConfigByCategory('ram'),
ResourceConfigApi.listSimpleConfigByCategory('storage'),
ResourceConfigApi.listSimpleConfigByCategory('powerSupply'),
ResourceConfigApi.listSimpleConfigByCategory('nic'),
ResourceConfigApi.listSimpleConfigByCategory('location')
])
......@@ -62,6 +70,8 @@ export const useResourceConfigStore = defineStore('resourceConfig', {
this.gpuOptions = gpuRes
this.ramOptions = ramRes
this.storageOptions = storageRes
this.powerSupplyOptions = powerSupplyRes
this.nicOptions = nicRes
this.locationOptions = locationRes
this.lastFetched = Date.now()
......@@ -78,12 +88,14 @@ export const useResourceConfigStore = defineStore('resourceConfig', {
this.gpuOptions = []
this.ramOptions = []
this.storageOptions = []
this.powerSupplyOptions = []
this.nicOptions = []
this.locationOptions = []
this.lastFetched = null
},
// 根据类型获取选项
getOptionsByType(type: 'cpu' | 'gpu' | 'ram' | 'storage' | 'location') {
getOptionsByType(type: 'cpu' | 'gpu' | 'ram' | 'storage' | 'powerSupply' | 'nic' | 'location') {
return this[type + 'Options']
}
}
......
......@@ -77,6 +77,30 @@
</el-form-item>
</div>
<!-- 新增:电源和网卡配置 -->
<div style="display: flex; margin-bottom: 24px;">
<el-form-item label="电源配置" prop="powerSupply" style="margin-right: 20px; margin-bottom: 0;">
<el-select v-model="formData.powerSupply" placeholder="请选择电源配置" clearable style="width: 180px;" :disabled="isDetailMode">
<el-option
v-for="option in powerSupplyOptions"
:key="option.id"
:label="option.configOption"
:value="option.configOption"
/>
</el-select>
</el-form-item>
<el-form-item label="网卡配置" prop="nic" style="margin-bottom: 0;">
<el-select v-model="formData.nic" placeholder="请选择网卡配置" clearable style="width: 180px;" :disabled="isDetailMode">
<el-option
v-for="option in nicOptions"
:key="option.id"
:label="option.configOption"
:value="option.configOption"
/>
</el-select>
</el-form-item>
</div>
<!-- 5. 服务器信息 -->
<div style="display: flex; margin-bottom: 24px;">
<el-form-item label="服务器所在地" prop="location" style="margin-right: 20px; margin-bottom: 0;">
......@@ -197,6 +221,8 @@ const cpuOptions = computed(() => resourceConfigStore.getOptionsByType('cpu'))
const gpuOptions = computed(() => resourceConfigStore.getOptionsByType('gpu'))
const ramOptions = computed(() => resourceConfigStore.getOptionsByType('ram'))
const storageOptions = computed(() => resourceConfigStore.getOptionsByType('storage'))
const powerSupplyOptions = computed(() => resourceConfigStore.getOptionsByType('powerSupply'))
const nicOptions = computed(() => resourceConfigStore.getOptionsByType('nic'))
const formData = ref<ResourceSpu>({
id: undefined,
......@@ -205,6 +231,8 @@ const formData = ref<ResourceSpu>({
gpu: undefined,
ram: undefined,
storage: undefined,
powerSupply: undefined,
nic: undefined,
ip: undefined,
initUsername: undefined,
initPassword: undefined,
......@@ -224,6 +252,8 @@ const formRules = reactive({
gpu: [{ required: true, message: 'GPU配置不能为空', trigger: 'blur' }],
ram: [{ required: true, message: '内存配置不能为空', trigger: 'blur' }],
storage: [{ required: true, message: '存储配置不能为空', trigger: 'blur' }],
powerSupply: [{ required: true, message: '电源配置不能为空', trigger: 'blur' }],
nic: [{ required: true, message: '网卡配置不能为空', trigger: 'blur' }],
ip: [{ required: true, message: '服务器ip不能为空', trigger: 'blur' }],
initUsername: [{ required: true, message: '初始用户名不能为空', trigger: 'blur' }],
initPassword: [{ required: true, message: '初始密码不能为空', trigger: 'blur' }],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment