fix: 修改使用不支持直接选择文件的浏览器时,Compare弹窗中获取文件列表的请求发起的时机
This commit is contained in:
parent
63969c8b2c
commit
c91886a5e9
|
@ -1,11 +1,12 @@
|
|||
<template>
|
||||
<custom-modal v-model="visible" :width="1200" title="File List">
|
||||
<search-form :items="formItems" v-model="queryParam" @search="searchQuery"></search-form>
|
||||
<search-form :items="formItems" v-model="queryParam" @search="handleSearch"></search-form>
|
||||
<custom-table
|
||||
rowKey="name"
|
||||
:columns="columns"
|
||||
:list="dataSource"
|
||||
:loading="loading"
|
||||
:pagination="ipagination"
|
||||
:loading="isLoading"
|
||||
:pagination="pagination"
|
||||
:selectedRowKeys.sync="selectedRowKeys"
|
||||
:selectionRows.sync="selectionRows"
|
||||
:scroll="{ y: 440 }"
|
||||
|
@ -20,7 +21,6 @@
|
|||
|
||||
<script>
|
||||
import { getAction } from '@/api/manage'
|
||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
||||
import ModalMixin from '@/mixins/ModalMixin'
|
||||
|
||||
const columns = [
|
||||
|
@ -29,79 +29,98 @@ const columns = [
|
|||
dataIndex: 'name',
|
||||
width: '45%',
|
||||
align: 'left',
|
||||
ellipsis: true
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: 'UpdateDate',
|
||||
dataIndex: 'updateDate',
|
||||
align: 'left'
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: 'Size',
|
||||
dataIndex: 'size',
|
||||
align: 'left'
|
||||
}
|
||||
align: 'left',
|
||||
},
|
||||
]
|
||||
|
||||
const formItems = [
|
||||
{
|
||||
label: '',
|
||||
type: 'a-input',
|
||||
name: 'searchName',
|
||||
name: 'name',
|
||||
props: {
|
||||
placeholder: 'search...'
|
||||
}
|
||||
}
|
||||
placeholder: 'search...',
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
export default {
|
||||
mixins: [ModalMixin, JeecgListMixin],
|
||||
mixins: [ModalMixin],
|
||||
data() {
|
||||
this.columns = columns
|
||||
this.formItems = formItems
|
||||
|
||||
return {
|
||||
inited: false,
|
||||
queryParam: {},
|
||||
dataSource: [],
|
||||
selectedRowKeys: [],
|
||||
selectionRows: []
|
||||
selectionRows: [],
|
||||
pagination: {
|
||||
current: 1,
|
||||
pageSize: 10,
|
||||
pageSizeOptions: ['10', '20', '30'],
|
||||
showTotal: (total, range) => {
|
||||
const { current, pageSize } = this.pagination
|
||||
return `Total ${total} items Page ${current} / ${Math.ceil(total / pageSize)}`
|
||||
},
|
||||
showQuickJumper: true,
|
||||
showSizeChanger: true,
|
||||
total: 0,
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
beforeModalOpen() {
|
||||
this.selectedRowKeys = []
|
||||
},
|
||||
|
||||
loadData(arg) {
|
||||
//加载数据 若传入参数1则加载第一页的内容
|
||||
if (arg === 1) {
|
||||
this.ipagination.current = 1
|
||||
if(!this.inited) {
|
||||
this.inited = true
|
||||
this.getList()
|
||||
}
|
||||
this.onClearSelected()
|
||||
|
||||
const params = this.getQueryParams() //查询条件
|
||||
const searchName = this.queryParam.searchName
|
||||
params.name = searchName
|
||||
this.loading = true
|
||||
getAction('/spectrumFile/get', params)
|
||||
.then(res => {
|
||||
if (res.success) {
|
||||
this.dataSource = res.result.records
|
||||
this.dataSource.forEach((item, index) => {
|
||||
item.id = index
|
||||
})
|
||||
if (res.result.total) {
|
||||
this.ipagination.total = res.result.total
|
||||
} else {
|
||||
this.ipagination.total = 0
|
||||
}
|
||||
} else {
|
||||
this.$message.warning(res.message)
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
|
||||
async getList() {
|
||||
try {
|
||||
this.isLoading = true
|
||||
const params = {
|
||||
...this.queryParam,
|
||||
pageNo: this.pagination.current,
|
||||
pageSize: this.pagination.pageSize,
|
||||
}
|
||||
const { success, result, message } = await getAction('/spectrumFile/get', params)
|
||||
if (success) {
|
||||
this.dataSource = result.records
|
||||
this.pagination.total = result.total
|
||||
} else {
|
||||
this.$message.error(message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
this.isLoading = false
|
||||
}
|
||||
},
|
||||
|
||||
handleTableChange(pagination, filters, sorter) {
|
||||
this.pagination = pagination
|
||||
this.getList()
|
||||
},
|
||||
|
||||
handleSearch() {
|
||||
this.pagination.current = 1
|
||||
this.getList()
|
||||
},
|
||||
|
||||
async handleOk() {
|
||||
if (!this.selectedRowKeys.length) {
|
||||
this.$message.warn('Please Select A File to Compare')
|
||||
|
@ -110,8 +129,8 @@ export default {
|
|||
|
||||
this.$emit('fileSelect', this.selectionRows[0].name)
|
||||
this.visible = false
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user