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 = [ let tableColumns: ColumnsType = [
{ {
title:t('views.configManage.softwareManage.neType'), title: t('views.configManage.softwareManage.neType'),
dataIndex: 'neType', dataIndex: 'neType',
align: 'center', align: 'center',
width: 2, width: 100,
}, },
{ {
title: t('views.configManage.neManage.neId'), title: t('views.configManage.neManage.neId'),
dataIndex: 'neId', dataIndex: 'neId',
align: 'center', align: 'center',
width: 2, width: 200,
}, },
{ {
title: t('views.configManage.softwareManage.versions'), title: t('views.configManage.softwareManage.versions'),
dataIndex: 'version', dataIndex: 'version',
align: 'center', align: 'center',
width: 2,
}, },
{ {
title: t('views.configManage.softwareManage.upVersions'), title: t('views.configManage.softwareManage.upVersions'),
dataIndex: 'preVersion', dataIndex: 'preVersion',
align: 'center', align: 'center',
width: 2,
}, },
{ {
title:t('views.configManage.softwareManage.backVersions'), title: t('views.configManage.softwareManage.backVersions'),
dataIndex: 'newVersion', dataIndex: 'newVersion',
align: 'center', align: 'center',
width: 2,
}, },
{ {
title: t('views.configManage.softwareManage.status'), title: t('views.configManage.softwareManage.status'),
dataIndex: 'status', dataIndex: 'status',
key: 'status', key: 'status',
align: 'center', align: 'center',
width: 2, width: 100,
}, },
{ {
title: t('views.configManage.softwareManage.letUpTime'), title: t('views.configManage.softwareManage.letUpTime'),
@@ -122,7 +119,7 @@ let tableColumns: ColumnsType = [
if (!opt.value) return ''; if (!opt.value) return '';
return parseDateToStr(opt.value); return parseDateToStr(opt.value);
}, },
width: 2, width: 200,
}, },
]; ];
@@ -158,7 +155,7 @@ let tablePagination = reactive({
function fnGetList(pageNum?: number) { function fnGetList(pageNum?: number) {
if (tableState.loading) return; if (tableState.loading) return;
tableState.loading = true; tableState.loading = true;
if(pageNum){ if (pageNum) {
queryParams.pageNum = pageNum; queryParams.pageNum = pageNum;
} }
if (!queryRangePicker.value) { if (!queryRangePicker.value) {
@@ -197,7 +194,8 @@ watch(
<template> <template>
<a-modal <a-modal
width="800px" width="100%"
wrap-class-name="full-modal"
:title="props.title" :title="props.title"
:visible="props.visible" :visible="props.visible"
:keyboard="false" :keyboard="false"
@@ -206,13 +204,9 @@ watch(
:footer="null" :footer="null"
> >
<!-- 表格搜索栏 --> <!-- 表格搜索栏 -->
<a-form <a-form :model="queryParams" name="queryParams" layout="horizontal">
:model="queryParams"
name="queryParams"
layout="horizontal"
>
<a-row :gutter="16"> <a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24"> <a-col :lg="6" :md="6" :xs="24">
<a-form-item <a-form-item
:label="t('views.configManage.softwareManage.neType')" :label="t('views.configManage.softwareManage.neType')"
name="neType" name="neType"
@@ -225,8 +219,11 @@ watch(
/> />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="12" :md="12" :xs="24"> <a-col :lg="6" :md="6" :xs="24">
<a-form-item :label="t('views.configManage.softwareManage.createTime')" name="queryRangePicker"> <a-form-item
:label="t('views.configManage.softwareManage.createTime')"
name="queryRangePicker"
>
<a-range-picker <a-range-picker
v-model:value="queryRangePicker" v-model:value="queryRangePicker"
allow-clear allow-clear
@@ -236,7 +233,7 @@ watch(
></a-range-picker> ></a-range-picker>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="12" :md="12" :xs="24"> <a-col :lg="6" :md="6" :xs="24">
<a-form-item> <a-form-item>
<a-space :size="8"> <a-space :size="8">
<a-button type="primary" @click.prevent="fnGetList(1)"> <a-button type="primary" @click.prevent="fnGetList(1)">
@@ -260,7 +257,7 @@ watch(
:loading="tableState.loading" :loading="tableState.loading"
:data-source="tableState.data" :data-source="tableState.data"
:size="tableState.size" :size="tableState.size"
:scroll="{ x: 1200, y: 400 }" :scroll="{ x: true }"
:pagination="tablePagination" :pagination="tablePagination"
> >
</a-table> </a-table>
@@ -272,3 +269,22 @@ watch(
padding: 0 24px; padding: 0 24px;
} }
</style> </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({ let tableState: TabeStateType = reactive({
loading: false, loading: false,
size: 'middle', size: 'small',
seached: true, seached: false,
data: [], data: [],
selectedRowKeys: [], selectedRowKeys: [],
}); });
@@ -185,7 +185,7 @@ let fileModalState: FileStateType = reactive({
neId: undefined, neId: undefined,
}, },
backFrom: { backFrom: {
ne:undefined, ne: undefined,
neType: undefined, neType: undefined,
neId: undefined, neId: undefined,
version: '', version: '',
@@ -646,9 +646,14 @@ function fnBeforeUploadFile(file: FileType) {
return false; return false;
} }
// 根据给定的软件名取版本号 ims-r2.2312.x-ub22.deb // 根据给定的软件名取版本号 ims-r2.2312.x-ub22.deb
const nameArr = fileName.split('.'); const regex = /r\d+\.\d+(\.\d+)?/;
if (nameArr.length > 3) { const matches = fileName.match(regex);
modalState.from.version = nameArr[1]; if (matches) {
modalState.from.version = matches[0];
}
const neTypeIndex = fileName.indexOf('-');
if (neTypeIndex !== -1) {
modalState.from.neType = fileName.substring(0, neTypeIndex).toUpperCase();
} }
return true; return true;
} }
@@ -761,14 +766,14 @@ onMounted(() => {
<template #icon><UploadOutlined /></template> <template #icon><UploadOutlined /></template>
{{ t('common.uploadText') }} {{ t('common.uploadText') }}
</a-button> </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()"> <a-button type="dashed" @click.prevent="fnModalVisibleByHistory()">
<template #icon><HistoryOutlined /></template> <template #icon><HistoryOutlined /></template>
{{ t('views.configManage.softwareManage.historyBtn') }} {{ t('views.configManage.softwareManage.historyBtn') }}
</a-button> </a-button>
<a-button type="dashed" @click.prevent="fnModalVisibleByBack()">
<template #icon> <UndoOutlined /></template>
{{ t('views.configManage.softwareManage.backBtn') }}
</a-button>
</a-space> </a-space>
</template> </template>
@@ -776,11 +781,15 @@ onMounted(() => {
<template #extra> <template #extra>
<a-space :size="8" align="center"> <a-space :size="8" align="center">
<a-tooltip> <a-tooltip>
<template #title>{{ t('common.searchBarText') }}</template> <template #title>{{
tableState.seached
? t('common.switch.show')
: t('common.switch.hide')
}}</template>
<a-switch <a-switch
v-model:checked="tableState.seached" v-model:checked="tableState.seached"
:checked-children="t('common.switch.show')" :checked-children="t('common.searchBarText')"
:un-checked-children="t('common.switch.hide')" :un-checked-children="t('common.searchBarText')"
size="small" size="small"
/> />
</a-tooltip> </a-tooltip>
@@ -853,7 +862,7 @@ onMounted(() => {
<template #icon><ThunderboltOutlined /></template> <template #icon><ThunderboltOutlined /></template>
</a-button> </a-button>
</a-tooltip> </a-tooltip>
<a-tooltip> <a-tooltip placement="left">
<template #title>{{ t('common.moreText') }}</template> <template #title>{{ t('common.moreText') }}</template>
<a-dropdown <a-dropdown
placement="bottomRight" placement="bottomRight"
@@ -885,7 +894,7 @@ onMounted(() => {
</a-card> </a-card>
<!-- 上传框 --> <!-- 上传框 -->
<a-modal <DraggableModal
width="800px" width="800px"
:keyboard="false" :keyboard="false"
:mask-closable="false" :mask-closable="false"
@@ -978,7 +987,7 @@ onMounted(() => {
</a-upload> </a-upload>
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-modal> </DraggableModal>
<!-- 上传激活历史 --> <!-- 上传激活历史 -->
<SoftwareHistory <SoftwareHistory