|
@@ -20,36 +20,6 @@
|
|
|
</template>
|
|
|
</vxe-toolbar>
|
|
|
|
|
|
- <el-dialog title="调整默认顺序" :visible.sync="dialogTableVisible" style="height: 700px">
|
|
|
- <div style="height: 700px">
|
|
|
- <vxe-toolbar>
|
|
|
- <template #buttons>
|
|
|
- <vxe-button @click="sortUp" icon="el-icon-arrow-up"></vxe-button>
|
|
|
- <vxe-button @click="sortDown" icon="el-icon-arrow-down"></vxe-button>
|
|
|
- <vxe-button @click="sortTop" icon="el-icon-top"></vxe-button>
|
|
|
- <vxe-button @click="sortBottom" icon="el-icon-bottom"></vxe-button>
|
|
|
- </template>
|
|
|
- </vxe-toolbar>
|
|
|
- <vxe-table
|
|
|
- border="inner"
|
|
|
- auto-resize
|
|
|
- resizable
|
|
|
- height="auto"
|
|
|
- :row-config="{isHover: true}"
|
|
|
- :data="dataListsort"
|
|
|
- :key="keyNum"
|
|
|
- :checkbox-config="{}"
|
|
|
- :row-style="rowStyle"
|
|
|
- @cell-click="rowClick"
|
|
|
- >
|
|
|
- <vxe-column title="职务分类名称" field="name" ></vxe-column>
|
|
|
- </vxe-table>
|
|
|
- </div>
|
|
|
- <span slot="footer" class="dialog-footer">
|
|
|
- <el-button size="small" @click="closeSortDialog()" icon="el-icon-circle-close">关闭</el-button>
|
|
|
- <el-button size="small" type="primary" @click="sortChange()" icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
|
|
|
- </span>
|
|
|
- </el-dialog>
|
|
|
<div style="height: calc(100% - 80px)">
|
|
|
<vxe-table
|
|
|
border="inner"
|
|
@@ -95,11 +65,13 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<PositionCategoryForm ref="positionCategoryForm" @refreshDataList="refreshList"></PositionCategoryForm>
|
|
|
+ <SortTableDialog ref="sortTableDialog" @refreshDataList="refreshList" @dataSort="dataSort"></SortTableDialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import PositionCategoryForm from './PositionCategoryForm'
|
|
|
+ import SortTableDialog from '../../../common/SortTableDialog'
|
|
|
import PositionCategoryService from '@/api/position/PositionCategoryService'
|
|
|
export default {
|
|
|
props: {
|
|
@@ -117,21 +89,16 @@
|
|
|
searchForm: {
|
|
|
},
|
|
|
dataList: [],
|
|
|
- dataListsort: [],
|
|
|
tablePage: {
|
|
|
total: 0,
|
|
|
currentPage: 1,
|
|
|
pageSize: 10,
|
|
|
orders: []
|
|
|
},
|
|
|
- loading: false,
|
|
|
- keyNum: 0,
|
|
|
- sortIndex: '',
|
|
|
- dialogTableVisible: false
|
|
|
+ loading: false
|
|
|
}
|
|
|
},
|
|
|
positionCategoryService: null,
|
|
|
- sortUtils: null,
|
|
|
created () {
|
|
|
this.positionCategoryService = new PositionCategoryService()
|
|
|
},
|
|
@@ -143,7 +110,8 @@
|
|
|
}
|
|
|
},
|
|
|
components: {
|
|
|
- PositionCategoryForm
|
|
|
+ PositionCategoryForm,
|
|
|
+ SortTableDialog
|
|
|
},
|
|
|
mounted () {
|
|
|
this.refreshList()
|
|
@@ -218,61 +186,12 @@
|
|
|
this.$refs.searchForm.resetFields()
|
|
|
this.refreshList()
|
|
|
},
|
|
|
- rowClick (event) {
|
|
|
- this.sortIndex = event.rowIndex
|
|
|
- },
|
|
|
- sortUp () {
|
|
|
- let s = this.$sortUtils.sortUp(this.dataListsort, this.sortIndex)
|
|
|
- this.dataListsort = s.dataList
|
|
|
- this.sortIndex = s.index
|
|
|
- console.log(this.sortIndex)
|
|
|
- this.keyNum++
|
|
|
- },
|
|
|
- sortDown () {
|
|
|
- let s = this.$sortUtils.sortDown(this.dataListsort, this.sortIndex)
|
|
|
- this.dataListsort = s.dataList
|
|
|
- this.sortIndex = s.index
|
|
|
- this.keyNum++
|
|
|
- },
|
|
|
- sortTop () {
|
|
|
- let s = this.$sortUtils.sortTop(this.dataListsort, this.sortIndex)
|
|
|
- this.dataListsort = s.dataList
|
|
|
- this.sortIndex = s.index
|
|
|
- this.keyNum++
|
|
|
- },
|
|
|
- sortBottom () {
|
|
|
- let s = this.$sortUtils.sortBottom(this.dataListsort, this.sortIndex)
|
|
|
- this.dataListsort = s.dataList
|
|
|
- this.sortIndex = s.index
|
|
|
- this.keyNum++
|
|
|
- },
|
|
|
openSortDialog () {
|
|
|
- this.dialogTableVisible = true
|
|
|
- this.dataListsort = this.dataList
|
|
|
- },
|
|
|
- closeSortDialog () {
|
|
|
- this.sortIndex = ''
|
|
|
- this.dataListsort = []
|
|
|
- this.dialogTableVisible = false
|
|
|
- this.refreshList()
|
|
|
+ this.$refs.sortTableDialog.init(this.dataList)
|
|
|
},
|
|
|
- rowStyle (event) {
|
|
|
- if (event.rowIndex === this.sortIndex) {
|
|
|
- return 'cursor:pointer;background-color:#e8f6f3'
|
|
|
- }
|
|
|
- // console.log(i)
|
|
|
- return 'cursor:pointer;'
|
|
|
- },
|
|
|
- sortChange () {
|
|
|
- for (let i = 0; i < this.dataListsort.length; i++) {
|
|
|
- this.dataListsort[i].sort = i
|
|
|
- }
|
|
|
- this.loading = true
|
|
|
- this.positionCategoryService.updateSort(this.dataListsort).then(() => {
|
|
|
- this.closeSortDialog()
|
|
|
- this.loading = false
|
|
|
- }).catch(() => {
|
|
|
- this.loading = false
|
|
|
+ dataSort (dataListSort) {
|
|
|
+ this.positionCategoryService.updateSort(dataListSort).then(() => {
|
|
|
+ this.refreshList()
|
|
|
})
|
|
|
}
|
|
|
}
|