[update] 表格拖拽换j-table

This commit is contained in:
lideqin
2023-08-23 15:44:51 +08:00
parent 8e7345928e
commit 029c89e13f
17 changed files with 479 additions and 428 deletions
+28 -69
View File
@@ -45,20 +45,20 @@
</div>
</div>
<div>
<a-table
<j-table
ref="table"
size="middle"
:components="drag(columns,'columns')"
:columns="columns"
:data-source="dataSource"
rowKey="id"
:can-drag="true"
:loading="loading"
:pagination="ipagination"
:scroll="{x: '100%',y:'calc(100vh - 280px)'}"
rowKey="id"
:data-source="dataSource"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:columns="columns"
@change="tableOnChange"
@change="handleTableChange"
>
<span slot="operation" slot-scope="text,record">
<template v-slot:operation="{text,record}">
<a class="text-operation" @click="comparisonResultsClick(record)">{{$t('docTool.comparison.comparisonResults')}}</a>
<a class="text-operation"
v-if="record.createBy === userInfoQuery.username || administrators"
@@ -71,28 +71,29 @@
<a class="text-operation"
v-if="(record.createBy === userInfoQuery.username || administrators) && record.releaseState === 'draft'"
@click="deleteData(record)">{{$t('delete')}}</a>
</span>
<span slot="serialNumberRight" :title="text" slot-scope="text,record">
<a @click="serialNumberRightClick(record)">{{text}}</a>
</span>
<span slot="serialNumberLeft" :title="text" slot-scope="text,record">
<a @click="serialNumberLeftClick(record)">{{text}}</a>
</span>
</a-table>
</template>
<template v-slot:serialNumberRight="{text,record}">
<a @click="serialNumberRightClick(record)" :title="text">{{text}}</a>
</template>
<template v-slot:serialNumberLeft="{text,record}">
<a @click="serialNumberLeftClick(record)" :title="text">{{text}}</a>
</template>
</j-table>
</div>
</a-card>
</template>
<script>
import { getAction, postAction, deleteAction } from '@/api/manage'
import { ResizeHeader, ResizeColumnProvide } from '@/mixins/header'
import { postAction, deleteAction } from '@/api/manage'
import { mapGetters } from 'vuex'
import JDictSelectTag from '../../components/dict/JDictSelectTag'
import JDictSelectTag from '@/components/dict/JDictSelectTag'
import JTable from '@/components/jero/JTable'
import { JeroListMixin } from '../../mixins/JeroListMixin'
export default {
name: 'DocumentComparison',
mixins: [ResizeHeader, ResizeColumnProvide],
components: { JDictSelectTag },
components: { JDictSelectTag, JTable },
mixins: [JeroListMixin],
data () {
return {
// url传参严格按照当前命名
@@ -103,7 +104,7 @@ export default {
loading: false,
dataSource: [],
selectedRowKeys: [],
selectedRows: [],
selectionRows: [],
downLoadFileUrl: window._CONFIG.domianPreviewURL + '/sys/common/download',
downLoadImgUrl: window._CONFIG.domianWebImgURL + '/sys/common/download',
/* 分页参数 */
@@ -213,50 +214,12 @@ export default {
}
})
}
this.getList()
this.loadData(1)
},
methods: {
...mapGetters(['userInfo']),
searchQuery () {
this.ipagination.current = 1
this.getList()
},
searchReset () {
this.queryParam = {}
this.ipagination.current = 1
this.getList()
},
tableOnChange (pagination) {
this.ipagination = pagination
this.getList()
},
getList () {
this.dataSource = [{ id: 1, serialNumberLeft: '11' }]
// const queryParam = JSON.parse(JSON.stringify(this.queryParam))
// Object.keys(queryParam).forEach(val => {
// if (queryParam[val] instanceof Array) {
// queryParam[val] = queryParam[val].join(',')
// }
// })
// const query = {
// pageNo: this.ipagination.current,
// pageSize: this.ipagination.pageSize,
// ...queryParam
// }
// this.loading = true
// getAction(this.url.list, query).then((res) => {
// if (res.success) {
// if (res.result.current > 1 && res.result.records.length === 0) {
// this.ipagination.current = 1
// this.getList()
// return
// }
// this.dataSource = res.result.records || []
// this.ipagination.total = res.result.total
// }
// }).finally(() => {
// this.loading = false
// })
},
batchDelete () {
if (this.selectedRowKeys.length > 0) {
@@ -264,11 +227,11 @@ export default {
content: this.$t('confirmBatchDeletion'),
onOk: () => {
const idList = []
const selectedRows = JSON.parse(JSON.stringify(this.selectedRows))
for (let i = 0; i < selectedRows.length; i++) {
if (selectedRows[i].createBy === this.userInfoQuery.username &&
selectedRows[i].releaseState === 'draft') {
idList.push(selectedRows[i].id)
const selectionRows = JSON.parse(JSON.stringify(this.selectionRows))
for (let i = 0; i < selectionRows.length; i++) {
if (selectionRows[i].createBy === this.userInfoQuery.username &&
selectionRows[i].releaseState === 'draft') {
idList.push(selectionRows[i].id)
}
}
if (idList.length > 0) {
@@ -290,10 +253,6 @@ export default {
this.$message.warning(this.$t('selectLeastOne'))
}
},
onSelectChange (value, record) {
this.selectedRowKeys = value
this.selectedRows = record
},
// 对比结果按钮点击
comparisonResultsClick (item) {
if (item.createBy === this.userInfoQuery.username && item.releaseState === 'draft') {