|
@@ -26,6 +26,7 @@
|
|
|
<!-- 分页 -->
|
|
|
<myPagination
|
|
|
class="yqlj-pagination"
|
|
|
+ :pageSizes="defaultPageSizes"
|
|
|
@size-change="handleSizeChange"
|
|
|
@current-page="handleCurrentPage" />
|
|
|
|
|
@@ -79,13 +80,24 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import { tableServiceData } from './components/tableData';
|
|
|
- import { paginationServiceData } from './components/paginationData';
|
|
|
- import myPagination from './components/Pagination';
|
|
|
- import myTable from './components/Table';
|
|
|
- import * as NewsClassifyService from '@/api/newsClassify';
|
|
|
- import * as comminUtil from '@/utils/admin/tools';
|
|
|
+ import myPagination from './components/Pagination';
|
|
|
+ import myTable from './components/Table';
|
|
|
+ import * as NewsClassifyService from '@/api/newsClassify';
|
|
|
+ import * as comminUtil from '@/utils/admin/tools';
|
|
|
+ import Vue from 'vue';
|
|
|
|
|
|
+ const tableData = {
|
|
|
+ myData: [],
|
|
|
+ };
|
|
|
+ const pagination = {
|
|
|
+ page: 1,
|
|
|
+ size: 10,
|
|
|
+ total: 0,
|
|
|
+ };
|
|
|
+ const defaultPageSizes = [10, 20, 30, 40];
|
|
|
+
|
|
|
+ const paginationServiceData = Vue.observable(pagination);
|
|
|
+ const tableServiceData = Vue.observable(tableData);
|
|
|
export default {
|
|
|
name: 'YouQingLianJie',
|
|
|
provide: {
|
|
@@ -98,6 +110,7 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ defaultPageSizes: defaultPageSizes,
|
|
|
addDialogVisit: false,
|
|
|
editorDialogVisit: false,
|
|
|
searchData: '',
|
|
@@ -176,15 +189,15 @@
|
|
|
const opt = { newsClassifyId: this.selectRow.newsClassifyId };
|
|
|
const loading = this.$loading({ background: 'rgba(0, 0, 0, 0.7)' });
|
|
|
NewsClassifyService.getNewsClassifyInfo(opt)
|
|
|
- .then(res => {
|
|
|
- const { name, number } = res.data;
|
|
|
- this.editorForm.name = name;
|
|
|
- this.editorForm.number = number;
|
|
|
- loading.close();
|
|
|
- })
|
|
|
- .catch(err => {
|
|
|
- loading.close();
|
|
|
- });
|
|
|
+ .then(res => {
|
|
|
+ const { name, number } = res.data;
|
|
|
+ this.editorForm.name = name;
|
|
|
+ this.editorForm.number = number;
|
|
|
+ loading.close();
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ loading.close();
|
|
|
+ });
|
|
|
},
|
|
|
handleEditorReset(formName) {
|
|
|
this.$refs[formName].resetFields();
|
|
@@ -202,7 +215,10 @@
|
|
|
async editorLinksFun() {
|
|
|
const loading = this.$loading({ background: 'rgba(0, 0, 0, 0.7)' });
|
|
|
try {
|
|
|
- const opt = Object.assign({}, this.editorForm, { userId: this.userId, newsClassifyId: this.selectRow.newsClassifyId });
|
|
|
+ const opt = Object.assign({}, this.editorForm, {
|
|
|
+ userId: this.userId,
|
|
|
+ newsClassifyId: this.selectRow.newsClassifyId,
|
|
|
+ });
|
|
|
const res = await NewsClassifyService.getNewsClassifyUpdate(opt);
|
|
|
if (res.code === 0) {
|
|
|
this.editorDialogVisit = false;
|
|
@@ -268,13 +284,13 @@
|
|
|
const opt = this.getOption();
|
|
|
const loading = this.$loading({ background: 'rgba(0, 0, 0, 0.7)' });
|
|
|
NewsClassifyService.getNewsClassifyList(opt)
|
|
|
- .then(res => {
|
|
|
- this.initPageData(res.data);
|
|
|
- loading.close();
|
|
|
- })
|
|
|
- .catch(err => {
|
|
|
- loading.close();
|
|
|
- });
|
|
|
+ .then(res => {
|
|
|
+ this.initPageData(res.data);
|
|
|
+ loading.close();
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ loading.close();
|
|
|
+ });
|
|
|
},
|
|
|
handleSizeChange(size) {
|
|
|
paginationServiceData.size = size;
|
|
@@ -299,6 +315,10 @@
|
|
|
mounted() {
|
|
|
this.searchYouQingData();
|
|
|
},
|
|
|
+ beforeDestroy() {
|
|
|
+ Object.assign(tableServiceData, tableData);
|
|
|
+ Object.assign(paginationServiceData, pagination);
|
|
|
+ },
|
|
|
};
|
|
|
</script>
|
|
|
|