|
|
@ -7,7 +7,7 @@ |
|
|
|
<input id="upFile" type="file" name="upFile" @change="changeFile($event)"> |
|
|
|
</div> |
|
|
|
<el-button icon="el-icon-delete" :disabled="selections.length === 0" @click="toDelete(selections)">删除</el-button> |
|
|
|
<el-button icon="el-icon-sort" @click="sortVisible = true">排序</el-button> |
|
|
|
<el-button icon="el-icon-sort" @click="showSort">排序</el-button> |
|
|
|
</div> |
|
|
|
|
|
|
|
<!--表格渲染--> |
|
|
@ -62,7 +62,7 @@ |
|
|
|
<span class="dialog-left-bottom" /> |
|
|
|
<div class="setting-dialog"> |
|
|
|
<i class="drag-tip">提示:请通过拖动鼠标来调整当前顺序</i> |
|
|
|
<el-table :data="tableData" class="file-sort" style="width: 100%;max-height: 70vh;" row-key="id"> |
|
|
|
<el-table :data="sortTableData" class="file-sort" style="width: 100%;max-height: 70vh;" row-key="id"> |
|
|
|
<el-table-column type="index" label="序号" width="100" align="center" /> |
|
|
|
<el-table-column prop="file_name" label="文件名称" /> |
|
|
|
</el-table> |
|
|
@ -126,6 +126,7 @@ export default { |
|
|
|
tableData: [], // 附件list |
|
|
|
selections: [], // table - 选中的 |
|
|
|
showCoverVisible: false, // 查看大图dialog |
|
|
|
sortTableData: [], // 排序data |
|
|
|
sortVisible: false, // 排序dialog |
|
|
|
deleteVisible: false, // 删除附件 dialog |
|
|
|
deleteData: [], // 删除选中的data |
|
|
@ -283,13 +284,17 @@ export default { |
|
|
|
}, |
|
|
|
// 排序 |
|
|
|
opened() { |
|
|
|
this.rowDrop('file-sort', 'tableData') |
|
|
|
this.rowDrop('file-sort', 'sortTableData') |
|
|
|
}, |
|
|
|
showSort() { |
|
|
|
this.sortVisible = true |
|
|
|
this.sortTableData = JSON.parse(JSON.stringify(this.tableData)) |
|
|
|
}, |
|
|
|
// 排序 - 保存 |
|
|
|
handleSort() { |
|
|
|
const ids = [] |
|
|
|
const sequences = [] |
|
|
|
this.tableData.map((value, index) => { |
|
|
|
this.sortTableData.map((value, index) => { |
|
|
|
ids.push(value.id) |
|
|
|
sequences.push(index + 1) |
|
|
|
}) |
|
|
@ -301,6 +306,8 @@ export default { |
|
|
|
FetchFileSort(params).then((res) => { |
|
|
|
this.sortVisible = false |
|
|
|
this.$message.success('附件排序成功!') |
|
|
|
this.crud.refresh() |
|
|
|
this.getFileList() |
|
|
|
}) |
|
|
|
}, |
|
|
|
// table |
|
|
|