fix: 运维管理 远程升级修复部分bug

This commit is contained in:
jackhoo_98 2023-03-16 18:17:43 +08:00
parent 90d33baffd
commit 8167603fae
4 changed files with 50 additions and 39 deletions

View File

@ -53,7 +53,7 @@ const handleChange = async (info: UploadChangeParam) => {
if (info.file.status === 'done') { if (info.file.status === 'done') {
loading.value = false; loading.value = false;
const result = info.file.response?.result; const result = info.file.response?.result;
const api = await querySystemApi(['paths']); const api: any = await querySystemApi(['paths']);
const path = api.result[0]?.properties const path = api.result[0]?.properties
? api.result[0]?.properties['base-path'] ? api.result[0]?.properties['base-path']
: ''; : '';
@ -88,6 +88,8 @@ watch(
.upload-box { .upload-box {
:deep(.ant-btn) { :deep(.ant-btn) {
width: 110px; width: 110px;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
} }
.upload-text { .upload-text {
margin: 0 10px; margin: 0 10px;

View File

@ -78,7 +78,16 @@
</j-form-item> </j-form-item>
</j-col> </j-col>
<j-col :span="12" <j-col :span="12"
><j-form-item label="签名" v-bind="validateInfos.sign"> ><j-form-item v-bind="validateInfos.sign">
<template #label>
签名
<j-tooltip title="请输入本地文件进行签名加密后的值">
<AIcon
type="QuestionCircleOutlined"
style="margin-left: 2px"
/>
</j-tooltip>
</template>
<j-input <j-input
placeholder="请输入签名" placeholder="请输入签名"
v-model:value="formData.sign" /></j-form-item v-model:value="formData.sign" /></j-form-item
@ -148,14 +157,14 @@
title="确认删除吗?" title="确认删除吗?"
ok-text="确认" ok-text="确认"
cancel-text="取消" cancel-text="取消"
@confirm="removeUser(propertie)" @confirm="removeList(propertie)"
> >
<AIcon type="DeleteOutlined" /> <AIcon type="DeleteOutlined" />
</j-popconfirm> </j-popconfirm>
</j-form-item> </j-form-item>
</div> </div>
<j-form-item class="formRef-form-item-add"> <j-form-item class="formRef-form-item-add">
<j-button type="dashed" block @click="addUser"> <j-button type="dashed" block @click="addList">
<AIcon type="PlusOutlined" /> <AIcon type="PlusOutlined" />
添加 添加
</j-button> </j-button>
@ -198,13 +207,13 @@ const dynamicValidateForm = reactive<{ properties: Properties[] }>({
properties: [], properties: [],
}); });
const removeUser = (item: Properties) => { const removeList = (item: Properties) => {
let index = dynamicValidateForm.properties.indexOf(item); let index = dynamicValidateForm.properties.indexOf(item);
if (index !== -1) { if (index !== -1) {
dynamicValidateForm.properties.splice(index, 1); dynamicValidateForm.properties.splice(index, 1);
} }
}; };
const addUser = () => { const addList = () => {
dynamicValidateForm.properties.push({ dynamicValidateForm.properties.push({
id: '', id: '',
value: '', value: '',
@ -226,8 +235,9 @@ const props = defineProps({
const emit = defineEmits(['change']); const emit = defineEmits(['change']);
const id = props.data.id; const id = props.data.id;
const VersionOrder = props.data.versionOrder;
const formData = ref({ const formData: any = ref({
name: '', name: '',
productId: undefined, productId: undefined,
version: '', version: '',
@ -239,7 +249,7 @@ const formData = ref({
description: '', description: '',
}); });
const extraValue = ref({}); const extraValue: any = ref({});
const validatorSign = async (_: Record<string, any>, value: string) => { const validatorSign = async (_: Record<string, any>, value: string) => {
const { signMethod, url } = formData.value; const { signMethod, url } = formData.value;
@ -252,18 +262,16 @@ const validatorSign = async (_: Record<string, any>, value: string) => {
} }
}; };
const validatorVersionOrder = async (_: Record<string, any>, value: string) => { const validatorVersionOrder = async (_: Record<string, any>, value: string) => {
const { signMethod, productId } = formData.value; if (id && VersionOrder === value) {
if (value && !!signMethod && productId) { return Promise.resolve();
const res = await validateVersion(productId, value); } else {
if (res.status === 200) { const { signMethod, productId } = formData.value;
if (id && props.data.versionOrder === value) { if (value && !!signMethod && productId) {
formData.value.versionOrder = ''; const res = await validateVersion(productId, value);
} else { if (res.status === 200) {
Promise.reject(res.result ? ['版本序号已存在'] : ''); Promise.reject(res.result ? '版本序号已存在' : '');
} }
} }
} else {
return Promise.resolve();
} }
}; };
@ -278,7 +286,6 @@ const { resetFields, validate, validateInfos } = useForm(
version: [ version: [
{ required: true, message: '请输入版本号' }, { required: true, message: '请输入版本号' },
{ max: 64, message: '最多可输入64个字符', trigger: 'change' }, { max: 64, message: '最多可输入64个字符', trigger: 'change' },
{ validator: validatorVersionOrder, trigger: 'blur' },
], ],
versionOrder: [ versionOrder: [
{ required: true, message: '请输入版本序号' }, { required: true, message: '请输入版本序号' },
@ -298,13 +305,13 @@ const filterOption = (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0; return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
}; };
const onSubmit = async () => { const handleOk = async () => {
const { properties } = await formRef.value?.validate(); const { properties }: any = await formRef.value?.validate();
validate() validate()
.then(async (res) => { .then(async (res: any) => {
const product = productOptions.value.find( const product: any = productOptions.value.find(
(item) => item?.value === res.productId, (item: any) => item?.value === res.productId,
); );
const productName = product?.label || props.data?.url; const productName = product?.label || props.data?.url;
const size = extraValue.value?.length || props.data?.size; const size = extraValue.value?.length || props.data?.size;
@ -317,9 +324,9 @@ const onSubmit = async () => {
}; };
loading.value = true; loading.value = true;
const response = !id const response = !id
? await save(params) ? await save(params).catch(() => {})
: await update({ ...props.data, ...params }); : await update({ ...props.data, ...params }).catch(() => {});
if (response.status === 200) { if (response?.status === 200) {
message.success('操作成功'); message.success('操作成功');
emit('change', true); emit('change', true);
} }
@ -330,9 +337,6 @@ const onSubmit = async () => {
}); });
}; };
const handleOk = () => {
onSubmit();
};
const handleCancel = () => { const handleCancel = () => {
emit('change', false); emit('change', false);
}; };
@ -347,8 +351,8 @@ onMounted(() => {
paging: false, paging: false,
terms: [{ column: 'state', value: 1 }], terms: [{ column: 'state', value: 1 }],
sorts: [{ name: 'createTime', order: 'desc' }], sorts: [{ name: 'createTime', order: 'desc' }],
}).then((resp) => { }).then((resp: any) => {
productOptions.value = resp.result.map((item) => ({ productOptions.value = resp.result.map((item: any) => ({
value: item.id, value: item.id,
label: item.name, label: item.name,
})); }));

View File

@ -132,7 +132,7 @@ const firmwareId = route.query.id;
const productId = route.query.productId; const productId = route.query.productId;
const view = props.data.view; const view = props.data.view;
const formData = ref({ const formData: any = ref({
name: '', name: '',
mode: undefined, mode: undefined,
responseTimeoutSeconds: '', responseTimeoutSeconds: '',
@ -187,8 +187,8 @@ onMounted(() => {
paging: false, paging: false,
terms: [{ column: 'state', value: 1 }], terms: [{ column: 'state', value: 1 }],
sorts: [{ name: 'createTime', order: 'desc' }], sorts: [{ name: 'createTime', order: 'desc' }],
}).then((resp) => { }).then((resp: any) => {
productOptions.value = resp.result.map((item) => ({ productOptions.value = resp.result.map((item: any) => ({
value: item.id, value: item.id,
label: item.name, label: item.name,
})); }));

View File

@ -1,7 +1,11 @@
<template> <template>
<page-container> <page-container>
<div> <div>
<Search :columns="columns" target="search" @search="handleSearch" /> <pro-search
:columns="columns"
target="search"
@search="handleSearch"
/>
<j-pro-table <j-pro-table
ref="tableRef" ref="tableRef"
model="TABLE" model="TABLE"
@ -246,11 +250,12 @@ onMounted(() => {
queryProduct({ queryProduct({
paging: false, paging: false,
sorts: [{ name: 'name', order: 'desc' }], sorts: [{ name: 'name', order: 'desc' }],
}).then((resp) => { terms: [{ column: 'state', value: 1 }], // todo
const list = resp.result.filter((it) => { }).then((resp: any) => {
const list = resp.result.filter((it: any) => {
return _.map(it?.features || [], 'id').includes('supportFirmware'); return _.map(it?.features || [], 'id').includes('supportFirmware');
}); });
productOptions.value = list.map((item) => ({ productOptions.value = list.map((item: any) => ({
label: item.name, label: item.name,
value: item.id, value: item.id,
})); }));