@@ -9,6 +9,9 @@
<el-select class="select" size="medium" v-model="selIsExclusive" @change="selectChange">
<el-option v-for="item in isExclusiveList" :key="item.k" :label="item.v" :value="item.k" />
</el-select>
<el-select class="select" size="medium" v-model="selCluster" @change="selectChange">
<el-option v-for="item in clusterList" :key="item.k" :label="item.v" :value="item.k" />
</el-select>
<el-select class="select" size="medium" v-model="selAiCenter" @change="selectChange">
<el-option v-for="item in aiCenterList" :key="item.k" :label="item.v" :value="item.k" />
</el-select>
@@ -29,8 +32,8 @@
</div>
<div class="table-container">
<div style="min-height:600px;">
<el-table border :data="tableData" style="width: 100%" v-loading="loading" stripe>
<el-table-column prop="ID " label="ID" align="center" header-align="center" width="60"></el-table-column>
<el-table border :data="tableData" style="width:100%" v-loading="loading" stripe :span-method="tableSpanMethod" >
<el-table-column prop="_id_ " label="ID" align="center" header-align="center" width="60"></el-table-column>
<el-table-column prop="SceneName" :label="$t('resourcesManagement.resSceneName')" align="center"
header-align="center"></el-table-column>
<el-table-column prop="JobTypeStr" :label="$t('resourcesManagement.jobType')" align="center"
@@ -48,29 +51,27 @@
<span>{{ scope.row.IsExclusive ? scope.row.ExclusiveOrg : '--' }}</span>
</template>
</el-table-column>
<el-table-column prop="AiCenterStr" :label="$t('resourcesManagement.aiCenter')" align="center "
header-align="center">
<el-table-column prop="specStr" :label="$t('resourcesManagement.resourceSpecification')" align="left "
header-align="center" min-width="180" >
<template slot-scope="scope">
<div v-if="!scope.row.Queues.length">--</div>
<div v-for="item in scope.row.Queues" :key="item.QueueId">
<span>{{ item.AiCenterName }}</span>
</div>
<span v-html="scope.row.specStr"></span>
</template>
</el-table-column>
<el-table-column prop="QueueStr" :label="$t('resourcesManagement.resQueue ')" align="center"
header-align="center">
<el-table-column prop="AiCenterStr" :label="$t('resourcesManagement.aiCenter')" align="center"
header-align="center" width="230" >
<template slot-scope="scope">
<div v-if="!scope.row.Q ueues.length">--</div>
<div v-for="item in scope.row.Queues" :key="item.QueueId ">
<span>{{ item.QueueStr }}</span>
<div v-if="!scope.row.q ueues.length">--</div>
<div v-for="item in scope.row.queues " :key="item.key ">
<span>{{ item.AiCenterName }}</span>
</div>
</template>
</el-table-column>
<el-table-column prop="SpecsList" :label="$t('resourcesManagement.resourceSpecification')" align="left "
header-align="center" min-width="18 0">
<el-table-column prop="QueueStr" :label="$t('resourcesManagement.resQueue')" align="center "
header-align="center" width="23 0">
<template slot-scope="scope">
<div v-for="item in scope.row.SpecsList" :key="item.k">
<span v-html="item.v"></span>
<div v-if="!scope.row.queues.length">--</div>
<div v-for=" item in scope.row.queues " :key="item.key">
<span v-html="item.QueueStr + item.statusStr"></span>
</div>
</template>
</el-table-column>
@@ -119,7 +120,8 @@ export default {
isExclusiveList: [{ k: '', v: this.$t('resourcesManagement.allExclusiveAndCommonUse') }, { k: '1', v: this.$t('resourcesManagement.exclusive') }, { k: '2', v: this.$t('resourcesManagement.commonUse') }],
selQueue: '',
queueList: [{ k: '', v: this.$t('resourcesManagement.allResQueue') }],
clusterList: [...CLUSTERS],
selCluster: '',
clusterList: [{ k: '', v: this.$t('resourcesManagement.allCluster') }, ...CLUSTERS],
selAiCenter: '',
aiCenterList: [{ k: '', v: this.$t('resourcesManagement.allAiCenter') }],
accCardTypeList: [...ACC_CARD_TYPE],
@@ -143,6 +145,21 @@ export default {
},
components: { SceneDialog },
methods: {
tableSpanMethod({ row, column, rowIndex, columnIndex }) {
if ([0, 1, 2, 3, 4, 8].indexOf(columnIndex) > -1) {
if (row.rowspan) {
return {
rowspan: row.rowspan,
colspan: 1,
};
} else {
return {
rowspan: 0,
colspan: 0
};
}
}
},
getAiCenterList() {
getAiCenterList().then(res => {
res = res.data;
@@ -183,6 +200,7 @@ export default {
const params = {
jobType: this.selTaskType,
IsExclusive: this.selIsExclusive,
cluster: this.selCluster,
queue: this.selQueue,
center: this.selAiCenter,
resource: this.selResource,
@@ -196,46 +214,81 @@ export default {
res = res.data;
if (res.Code === 0) {
const list = res.Data.List;
const data = list.map((item) => {
const Specs = item.Specs;
const specsList = [];
const queues = [];
const queueIds = [];
let cluster = '';
for (let i = 0, iLen = Specs.length; i < iLen; i++) {
const Spec = Specs[i];
const NGPU = `${Spec.ComputeResource}:${Spec.AccCardsNum + '*' + getListValueWithKey(this.accCardTypeList, Spec.AccCardType)}`;
const statusStr = Spec.Status != '2' ? `<span style="color:rgb(245, 34, 45)">(${getListValueWithKey(this.statusList, Spec.Status.toString())})</span>` : '';
specsList.push({
k: Spec.ID,
v: `${NGPU}, CPU:${Spec.CpuCores}, ${this.$t('resourcesManagement.gpuMem')}:${Spec.GPUMemGiB}GB, ${this.$t('resourcesManagement.mem')}:${Spec.MemGiB}GB, ${this.$t('resourcesManagement.shareMem')}:${Spec.ShareMemGiB}GB, ${this.$t('resourcesManagement.unitPrice')}:${Spec.UnitPrice}${this.$t('resourcesManagement.point_hr')}${statusStr}`,
});
cluster = Spec.Cluster;
if (queueIds.indexOf(Spec.QueueId) < 0) {
queues.push({
QueueId: Spec.QueueId,
QueueCode: Spec.QueueCode,
AiCenterCode: Spec.AiCenterCode,
AiCenterName: Spec.AiCenterName,
QueueStr: `${Spec.QueueCode}(${getListValueWithKey(this.clusterList, Spec.Cluster)} - ${Spec.AiCenterName})`,
});
queueIds.push(Spec.QueueId);
const data = [];
for (let i = 0, iLen = list.length; i < iLen; i++) {
const item = list[i];
const specs = item.Specs;
const sourceSpecIdMap = {};
for (let j = 0, jLen = specs.length; j < jLen; j++) {
const spec = specs[j];
const NGPU = `${spec.ComputeResource}:${spec.AccCardsNum + '*' + getListValueWithKey(this.accCardTypeList, spec.AccCardType)}`;
const statusStr = spec.Status != '2' ? `<span style="color:rgb(245, 34, 45)">(${getListValueWithKey(this.statusList, spec.Status.toString())})</span>` : '';
spec.specStr = `${NGPU}, CPU:${spec.CpuCores}, ${this.$t('resourcesManagement.gpuMem')}:${spec.GPUMemGiB}GB, ${this.$t('resourcesManagement.mem')}:${spec.MemGiB}GB, ${this.$t('resourcesManagement.shareMem')}:${spec.ShareMemGiB}GB, ${this.$t('resourcesManagement.unitPrice')}:${spec.UnitPrice}${this.$t('resourcesManagement.point_hr')}`;
spec.JobTypeStr = getListValueWithKey(this.taskTypeList, item.JobType);
spec.IsExclusiveStr = getListValueWithKey(this.isExclusiveList, item.IsExclusive ? '1' : '2');
spec.statusStr = statusStr;
spec._id_ = item.ID;
const sourceSpecId = spec.SourceSpecId;
if (sourceSpecIdMap[sourceSpecId]) {
sourceSpecIdMap[sourceSpecId].push({ ...spec });
} else {
sourceSpecIdMap[sourceSpecId] = [{ ...item, ...spec }];
}
}
return {
ID: item.ID,
SceneName: item.SceneName,
JobType: item.JobType,
JobTypeStr: getListValueWithKey(this.taskTypeList, item.JobType),
IsExclusive: item.IsExclusive,
IsExclusiveStr: getListValueWithKey(this.isExclusiveList, item.IsExclusive ? '1' : '2'),
ExclusiveOrg: item.ExclusiveOrg,
Cluster: cluster,
QueueIds: queueIds,
Queues: queues,
SpecsList: specsList,
for (let key in sourceSpecIdMap) {
const _specs = sourceSpecIdMap[key];
if (key) {
const aiCenters = [];
const queues = [];
for (let k = 0, kLen = _specs.length; k < kLen; k++) {
const _spec = _specs[k];
queues.push({
QueueId: _spec.QueueId,
QueueCode: _spec.QueueCode,
AiCenterCode: _spec.AiCenterCode,
AiCenterName: _spec.AiCenterName,
QueueStr: `${_spec.QueueCode}(${getListValueWithKey(this.clusterList, _spec.Cluster)} - ${_spec.AiCenterName})`,
statusStr: _spec.statusStr,
key: Math.random(),
});
}
data.push({ ..._specs[0], aiCenters, queues })
} else {
for (let k = 0, kLen = _specs.length; k < kLen; k++) {
const _spec = _specs[k];
data.push({
..._spec,
queues: [{
QueueId: _spec.QueueId,
QueueCode: _spec.QueueCode,
AiCenterCode: _spec.AiCenterCode,
AiCenterName: _spec.AiCenterName,
QueueStr: `${_spec.QueueCode}(${getListValueWithKey(this.clusterList, _spec.Cluster)} - ${_spec.AiCenterName})`,
statusStr: _spec.statusStr,
key: Math.random(),
}]
})
}
}
}
});
}
let rowspan = 1;
let index = 0;
for (let i = 0, iLen = data.length; i < iLen; i++) {
if (i == 0) {
data[i].rowspan = 1;
continue;
}
if (data[i]._id_ == data[i - 1]._id_) {
data[i].rowspan = 0;
rowspan++;
data[index].rowspan = rowspan;
} else {
index = i;
rowspan = 1;
data[index].rowspan = rowspan;
}
}
this.tableData = data;
this.pageInfo.total = res.Data.TotalSize;
}
@@ -261,7 +314,7 @@ export default {
}).then(() => {
updateResScene({
action: 'delete',
ID: row.ID ,
ID: row._id_ ,
}).then(res => {
res = res.data;
if (res.Code === 0) {
@@ -287,14 +340,14 @@ export default {
showDialog(type, data) {
this.sceneDialogType = type;
this.sceneDialogData = data ? {
ID: data.ID ,
ID: data._id_ ,
SceneName: data.SceneName,
JobType: data.JobType,
IsExclusive: data.IsExclusive ? '1' : '2',
ExclusiveOrg: data.ExclusiveOrg,
Cluster: data.Cluster,
QueueIds: data.QueueIds ,
SpecIds: data.SpecsList.map((item) => item.k ),
ComputeResource: data.ComputeResource ,
SpecIds: data.Specs.map(item => item.ID ),
} : {};
this.sceneDialogShow = true;
},