|
|
@@ -1,31 +1,19 @@
|
|
|
-
|
|
|
<template>
|
|
|
<div class="ml20 mt20 mr20 flex-row flex-align-center flex-justify-between">
|
|
|
<div class="flex-row">
|
|
|
<a-button type="primary" @click="sVisible = true">
|
|
|
Click to Upload
|
|
|
</a-button>
|
|
|
- <a-modal :visible="sVisible"
|
|
|
- title="Import Firmware File"
|
|
|
- :closable="false"
|
|
|
- @cancel="onCancel"
|
|
|
- @ok="uploadFile"
|
|
|
- centered>
|
|
|
- <a-form :rules="rules" ref="formRef" :model="uploadParam" :label-col="{ span: 6 }">
|
|
|
+ <a-modal :visible="sVisible" title="Import Firmware File" :closable="false" @cancel="onCancel" @ok="uploadFile"
|
|
|
+ centered>
|
|
|
+ <a-form :rules="rules" ref="formRef" :model="uploadParam" :label-col="{ span: 6 }">
|
|
|
<a-form-item name="status" label="Avaliable" required>
|
|
|
<a-switch v-model:checked="uploadParam.status" />
|
|
|
</a-form-item>
|
|
|
<a-form-item name="device_name" label="Device Name" required>
|
|
|
- <a-select
|
|
|
- style="width: 220px"
|
|
|
- mode="multiple"
|
|
|
- placeholder="can choose multiple"
|
|
|
+ <a-select style="width: 220px" mode="multiple" placeholder="can choose multiple"
|
|
|
v-model:value="uploadParam.device_name">
|
|
|
- <a-select-option
|
|
|
- v-for="k in DeviceNameEnum"
|
|
|
- :key="k"
|
|
|
- :value="k"
|
|
|
- >
|
|
|
+ <a-select-option v-for="k in DeviceNameEnum" :key="k" :value="k">
|
|
|
{{ k }}
|
|
|
</a-select-option>
|
|
|
</a-select>
|
|
|
@@ -34,64 +22,42 @@
|
|
|
<a-textarea v-model:value="uploadParam.release_note" showCount :maxlength="300" />
|
|
|
</a-form-item>
|
|
|
<a-form-item label="File" required>
|
|
|
- <a-upload
|
|
|
- :multiple="false"
|
|
|
- :before-upload="beforeUpload"
|
|
|
- :show-upload-list="true"
|
|
|
- :file-list="fileList"
|
|
|
- :remove="removeFile"
|
|
|
- >
|
|
|
+ <a-upload :multiple="false" :before-upload="beforeUpload" :show-upload-list="true" :file-list="fileList"
|
|
|
+ :remove="removeFile">
|
|
|
<a-button type="primary">
|
|
|
<UploadOutlined />
|
|
|
Import Firmware File
|
|
|
</a-button>
|
|
|
</a-upload>
|
|
|
</a-form-item>
|
|
|
- </a-form>
|
|
|
+ </a-form>
|
|
|
</a-modal>
|
|
|
</div>
|
|
|
<div class="flex-row">
|
|
|
<div class="ml5">
|
|
|
- <a-select
|
|
|
- style="width: 150px"
|
|
|
- v-model:value="param.firmware_status"
|
|
|
- @select="getAllFirmwares(pageParam)">
|
|
|
- <a-select-option
|
|
|
- v-for="(key, value) in FirmwareStatusEnum"
|
|
|
- :key="key"
|
|
|
- :value="value"
|
|
|
- >
|
|
|
+ <a-select style="width: 150px" v-model:value="param.firmware_status" @select="getAllFirmwares(pageParam)">
|
|
|
+ <a-select-option v-for="(key, value) in FirmwareStatusEnum" :key="key" :value="value">
|
|
|
{{ key }}
|
|
|
</a-select-option>
|
|
|
</a-select>
|
|
|
</div>
|
|
|
<div class="ml5">
|
|
|
- <a-select
|
|
|
- style="width: 150px"
|
|
|
- v-model:value="param.device_name"
|
|
|
- @select="getAllFirmwares(pageParam)">
|
|
|
- <a-select-option
|
|
|
- v-for="item in deviceNameList"
|
|
|
- :key="item.label"
|
|
|
- :value="item.value"
|
|
|
- >
|
|
|
+ <a-select style="width: 150px" v-model:value="param.device_name" @select="getAllFirmwares(pageParam)">
|
|
|
+ <a-select-option v-for="item in deviceNameList" :key="item.label" :value="item.value">
|
|
|
{{ item.label }}
|
|
|
</a-select-option>
|
|
|
</a-select>
|
|
|
</div>
|
|
|
<div class="ml5">
|
|
|
- <a-input-search
|
|
|
- :enter-button="true"
|
|
|
- v-model:value="param.product_version"
|
|
|
- placeholder="input search verison"
|
|
|
- style="width: 250px"
|
|
|
- @search="getAllFirmwares(pageParam)"/>
|
|
|
+ <a-input-search :enter-button="true" v-model:value="param.product_version" placeholder="input search verison"
|
|
|
+ style="width: 250px" @search="getAllFirmwares(pageParam)" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="table flex-display flex-column">
|
|
|
- <a-table :columns="columns" :data-source="data.firmware" :pagination="paginationProp" @change="refreshData" row-key="firmware_id"
|
|
|
- :rowClassName="(record, index) => ((index % 2) === 0 ? 'table-striped' : null)" :scroll="{ x: '100%', y: 600 }">
|
|
|
+ <a-table :columns="columns" :data-source="data.firmware" :pagination="paginationProp" @change="refreshData"
|
|
|
+ row-key="firmware_id" :rowClassName="(record, index) => ((index % 2) === 0 ? 'table-striped' : null)"
|
|
|
+ :scroll="{ x: '100%', y: 600 }">
|
|
|
<template #device_name="{ record }">
|
|
|
<div v-for="text in record.device_name" :key="text">
|
|
|
{{ text }}
|
|
|
@@ -105,7 +71,7 @@
|
|
|
</template>
|
|
|
<template v-for="col in ['file_name', 'release_note']" #[col]="{ text }" :key="col">
|
|
|
<a-tooltip :title="text">
|
|
|
- <span>{{ text }}</span>
|
|
|
+ <span>{{ text }}</span>
|
|
|
</a-tooltip>
|
|
|
</template>
|
|
|
|
|
|
@@ -113,9 +79,9 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script lang="ts" setup>
|
|
|
-import { message, notification, PaginationProps } from 'ant-design-vue'
|
|
|
+import { message, notification } from 'ant-design-vue'
|
|
|
import { TableState } from 'ant-design-vue/lib/table/interface'
|
|
|
-import { onMounted, reactive, Ref, ref, UnwrapRef } from 'vue'
|
|
|
+import { onMounted, reactive, ref } from 'vue'
|
|
|
import { IPage } from '/@/api/http/type'
|
|
|
import { getFirmwares, importFirmareFile } from '/@/api/manage'
|
|
|
import DeviceFirmwareStatus from '/@/components/devices/DeviceFirmwareStatus.vue'
|
|
|
@@ -129,6 +95,7 @@ import moment from 'moment'
|
|
|
interface FirmwareData {
|
|
|
firmware: Firmware[]
|
|
|
}
|
|
|
+
|
|
|
const columns = [
|
|
|
{ title: 'Model', dataIndex: 'device_name', width: 120, ellipsis: true, className: 'titleStyle', slots: { customRender: 'device_name' } },
|
|
|
{ title: 'File Name', dataIndex: 'file_name', width: 220, ellipsis: true, className: 'titleStyle', slots: { customRender: 'file_name' } },
|
|
|
@@ -178,13 +145,13 @@ onMounted(() => {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
-function refreshData (page: Pagination) {
|
|
|
+function refreshData(page: Pagination) {
|
|
|
pageParam.page = page?.current!
|
|
|
pageParam.page_size = page?.pageSize!
|
|
|
getAllFirmwares(pageParam)
|
|
|
}
|
|
|
|
|
|
-function getAllFirmwares (page: IPage) {
|
|
|
+function getAllFirmwares(page: IPage) {
|
|
|
getFirmwares(workspaceId, page, param).then(res => {
|
|
|
const firmwareList: Firmware[] = res.data.list
|
|
|
data.firmware = firmwareList
|
|
|
@@ -219,7 +186,7 @@ interface FileInfo {
|
|
|
}
|
|
|
const fileList = ref<FileItem[]>([])
|
|
|
|
|
|
-function beforeUpload (file: FileItem) {
|
|
|
+function beforeUpload(file: FileItem) {
|
|
|
if (!file.name || !file.name?.endsWith('.zip')) {
|
|
|
message.error('Format error. Please select zip file.')
|
|
|
return false
|
|
|
@@ -229,10 +196,10 @@ function beforeUpload (file: FileItem) {
|
|
|
}
|
|
|
|
|
|
const formRef = ref()
|
|
|
-function removeFile (file: FileItem) {
|
|
|
+function removeFile(file: FileItem) {
|
|
|
fileList.value = []
|
|
|
}
|
|
|
-function onCancel () {
|
|
|
+function onCancel() {
|
|
|
formRef.value.resetFields()
|
|
|
fileList.value = []
|
|
|
sVisible.value = false
|
|
|
@@ -292,33 +259,39 @@ const uploadFile = async () => {
|
|
|
|
|
|
</script>
|
|
|
<style>
|
|
|
-
|
|
|
.table {
|
|
|
- background-color: white;
|
|
|
- margin: 20px;
|
|
|
- padding: 20px;
|
|
|
- height: 88vh;
|
|
|
+ background-color: white;
|
|
|
+ margin: 20px;
|
|
|
+ padding: 20px;
|
|
|
+ height: 88vh;
|
|
|
}
|
|
|
+
|
|
|
.table-striped {
|
|
|
background-color: #f7f9fa;
|
|
|
}
|
|
|
+
|
|
|
.ant-table {
|
|
|
- border-top: 1px solid rgb(0,0,0,0.06);
|
|
|
- border-bottom: 1px solid rgb(0,0,0,0.06);
|
|
|
+ border-top: 1px solid rgb(0, 0, 0, 0.06);
|
|
|
+ border-bottom: 1px solid rgb(0, 0, 0, 0.06);
|
|
|
}
|
|
|
+
|
|
|
.ant-table-tbody tr td {
|
|
|
border: 0;
|
|
|
}
|
|
|
+
|
|
|
.ant-table td {
|
|
|
white-space: nowrap;
|
|
|
}
|
|
|
+
|
|
|
.ant-table-thead tr th {
|
|
|
background: white !important;
|
|
|
border: 0;
|
|
|
}
|
|
|
+
|
|
|
th.ant-table-selection-column {
|
|
|
background-color: white !important;
|
|
|
}
|
|
|
+
|
|
|
.ant-table-header {
|
|
|
background-color: white !important;
|
|
|
}
|