This commit is contained in:
yanran200730
2022-04-08 17:25:04 +08:00
parent 3b89905b0b
commit 38de1f36f2

View File

@@ -33,13 +33,14 @@
</template> </template>
<template #content> <template #content>
<ai-table <ai-table
:tableData="tableData" :tableData="tableData"
:col-configs="colConfigs" :col-configs="colConfigs"
:total="total" :total="total"
style="margin-top: 6px;" style="margin-top: 6px;"
:border="true" :border="true"
:isShowPagination="false" row-key="id"
@getList="() => {}"> :isShowPagination="false"
@getList="() => {}">
<el-table-column slot="options" width="160px" fixed="right" label="操作" align="center"> <el-table-column slot="options" width="160px" fixed="right" label="操作" align="center">
<template slot-scope="{ row, column, $index }"> <template slot-scope="{ row, column, $index }">
<div class="table-options"> <div class="table-options">
@@ -89,6 +90,7 @@
<script> <script>
import AppGigscreenViewer from '../../viewer/AppGigscreenViewer' import AppGigscreenViewer from '../../viewer/AppGigscreenViewer'
import Layout from './Layout.vue' import Layout from './Layout.vue'
import Sortable from 'sortablejs'
export default { export default {
name: 'Add', name: 'Add',
@@ -147,6 +149,10 @@ export default {
} }
}, },
mounted () {
},
methods: { methods: {
getInfo(id) { getInfo(id) {
this.instance.post(`${this.urlPrefix}/appdiylargescreen/queryLargeScreenProjectDetailById?id=${id}`).then(res => { this.instance.post(`${this.urlPrefix}/appdiylargescreen/queryLargeScreenProjectDetailById?id=${id}`).then(res => {
@@ -167,29 +173,29 @@ export default {
} }
}) })
this.total = res.data.lsList.length this.total = res.data.lsList.length
this.$nextTick(() => {
this.rowDrop()
})
} }
} }
}) })
}, },
rowDrop() {
const tbody = document.querySelector('.el-table__body-wrapper tbody')
const _this = this
Sortable.create(tbody, {
onEnd({ newIndex, oldIndex }) {
const currRow = _this.tableData.splice(oldIndex, 1)[0]
_this.tableData.splice(newIndex, 0, currRow)
}
})
},
toViewer(id) { toViewer(id) {
this.screenId = id this.screenId = id
}, },
getList() {
this.instance.post(`${this.urlPrefix}/appdiylargescreen/allLargeScreenByPage`, null, {
params: {
current: 1,
size: 1000
}
}).then(res => {
if (res.code == 0) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
onChange(e) { onChange(e) {
const ids = this.tableData.map(v => v.id) const ids = this.tableData.map(v => v.id)
if (ids.indexOf(e.id) < 0) { if (ids.indexOf(e.id) < 0) {
@@ -245,7 +251,7 @@ export default {
if (res.code == 0) { if (res.code == 0) {
this.$message.success('提交成功') this.$message.success('提交成功')
this.home?.refreshDvOptions() this.home && this.home.refreshDvOptions && this.home.refreshDvOptions()
setTimeout(() => { setTimeout(() => {
this.cancel(true) this.cancel(true)
}, 600) }, 600)