fix: 软件版本管理上传版本号截取

This commit is contained in:
TsMask
2023-12-26 10:09:44 +08:00
parent 7c69967148
commit 0eb7bc9497
2 changed files with 62 additions and 37 deletions

View File

@@ -78,41 +78,38 @@ let tableState: TabeStateType = reactive({
/**表格字段列 */
let tableColumns: ColumnsType = [
{
title:t('views.configManage.softwareManage.neType'),
title: t('views.configManage.softwareManage.neType'),
dataIndex: 'neType',
align: 'center',
width: 2,
width: 100,
},
{
title: t('views.configManage.neManage.neId'),
dataIndex: 'neId',
align: 'center',
width: 2,
width: 200,
},
{
title: t('views.configManage.softwareManage.versions'),
dataIndex: 'version',
align: 'center',
width: 2,
},
{
title: t('views.configManage.softwareManage.upVersions'),
dataIndex: 'preVersion',
align: 'center',
width: 2,
},
{
title:t('views.configManage.softwareManage.backVersions'),
title: t('views.configManage.softwareManage.backVersions'),
dataIndex: 'newVersion',
align: 'center',
width: 2,
},
{
title: t('views.configManage.softwareManage.status'),
dataIndex: 'status',
key: 'status',
align: 'center',
width: 2,
width: 100,
},
{
title: t('views.configManage.softwareManage.letUpTime'),
@@ -122,7 +119,7 @@ let tableColumns: ColumnsType = [
if (!opt.value) return '';
return parseDateToStr(opt.value);
},
width: 2,
width: 200,
},
];
@@ -158,7 +155,7 @@ let tablePagination = reactive({
function fnGetList(pageNum?: number) {
if (tableState.loading) return;
tableState.loading = true;
if(pageNum){
if (pageNum) {
queryParams.pageNum = pageNum;
}
if (!queryRangePicker.value) {
@@ -197,7 +194,8 @@ watch(
<template>
<a-modal
width="800px"
width="100%"
wrap-class-name="full-modal"
:title="props.title"
:visible="props.visible"
:keyboard="false"
@@ -206,13 +204,9 @@ watch(
:footer="null"
>
<!-- 表格搜索栏 -->
<a-form
:model="queryParams"
name="queryParams"
layout="horizontal"
>
<a-form :model="queryParams" name="queryParams" layout="horizontal">
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-col :lg="6" :md="6" :xs="24">
<a-form-item
:label="t('views.configManage.softwareManage.neType')"
name="neType"
@@ -225,8 +219,11 @@ watch(
/>
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item :label="t('views.configManage.softwareManage.createTime')" name="queryRangePicker">
<a-col :lg="6" :md="6" :xs="24">
<a-form-item
:label="t('views.configManage.softwareManage.createTime')"
name="queryRangePicker"
>
<a-range-picker
v-model:value="queryRangePicker"
allow-clear
@@ -236,7 +233,7 @@ watch(
></a-range-picker>
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-col :lg="6" :md="6" :xs="24">
<a-form-item>
<a-space :size="8">
<a-button type="primary" @click.prevent="fnGetList(1)">
@@ -260,7 +257,7 @@ watch(
:loading="tableState.loading"
:data-source="tableState.data"
:size="tableState.size"
:scroll="{ x: 1200, y: 400 }"
:scroll="{ x: true }"
:pagination="tablePagination"
>
</a-table>
@@ -272,3 +269,22 @@ watch(
padding: 0 24px;
}
</style>
<style lang="less">
.full-modal {
.ant-modal {
max-width: 100%;
top: 0;
padding-bottom: 0;
margin: 0;
}
.ant-modal-content {
display: flex;
flex-direction: column;
height: calc(100vh);
}
.ant-modal-body {
flex: 1;
}
}
</style>

View File

@@ -64,8 +64,8 @@ type TabeStateType = {
/**表格状态 */
let tableState: TabeStateType = reactive({
loading: false,
size: 'middle',
seached: true,
size: 'small',
seached: false,
data: [],
selectedRowKeys: [],
});
@@ -185,7 +185,7 @@ let fileModalState: FileStateType = reactive({
neId: undefined,
},
backFrom: {
ne:undefined,
ne: undefined,
neType: undefined,
neId: undefined,
version: '',
@@ -646,9 +646,14 @@ function fnBeforeUploadFile(file: FileType) {
return false;
}
// 根据给定的软件名取版本号 ims-r2.2312.x-ub22.deb
const nameArr = fileName.split('.');
if (nameArr.length > 3) {
modalState.from.version = nameArr[1];
const regex = /r\d+\.\d+(\.\d+)?/;
const matches = fileName.match(regex);
if (matches) {
modalState.from.version = matches[0];
}
const neTypeIndex = fileName.indexOf('-');
if (neTypeIndex !== -1) {
modalState.from.neType = fileName.substring(0, neTypeIndex).toUpperCase();
}
return true;
}
@@ -761,14 +766,14 @@ onMounted(() => {
<template #icon><UploadOutlined /></template>
{{ t('common.uploadText') }}
</a-button>
<a-button type="default" @click.prevent="fnModalVisibleByBack()">
<template #icon> <UndoOutlined /></template>
{{ t('views.configManage.softwareManage.backBtn') }}
</a-button>
<a-button type="dashed" @click.prevent="fnModalVisibleByHistory()">
<template #icon><HistoryOutlined /></template>
{{ t('views.configManage.softwareManage.historyBtn') }}
</a-button>
<a-button type="dashed" @click.prevent="fnModalVisibleByBack()">
<template #icon> <UndoOutlined /></template>
{{ t('views.configManage.softwareManage.backBtn') }}
</a-button>
</a-space>
</template>
@@ -776,11 +781,15 @@ onMounted(() => {
<template #extra>
<a-space :size="8" align="center">
<a-tooltip>
<template #title>{{ t('common.searchBarText') }}</template>
<template #title>{{
tableState.seached
? t('common.switch.show')
: t('common.switch.hide')
}}</template>
<a-switch
v-model:checked="tableState.seached"
:checked-children="t('common.switch.show')"
:un-checked-children="t('common.switch.hide')"
:checked-children="t('common.searchBarText')"
:un-checked-children="t('common.searchBarText')"
size="small"
/>
</a-tooltip>
@@ -853,7 +862,7 @@ onMounted(() => {
<template #icon><ThunderboltOutlined /></template>
</a-button>
</a-tooltip>
<a-tooltip>
<a-tooltip placement="left">
<template #title>{{ t('common.moreText') }}</template>
<a-dropdown
placement="bottomRight"
@@ -885,7 +894,7 @@ onMounted(() => {
</a-card>
<!-- 上传框 -->
<a-modal
<DraggableModal
width="800px"
:keyboard="false"
:mask-closable="false"
@@ -978,7 +987,7 @@ onMounted(() => {
</a-upload>
</a-form-item>
</a-form>
</a-modal>
</DraggableModal>
<!-- 上传激活历史 -->
<SoftwareHistory