|
@@ -22,8 +22,8 @@
|
|
</el-form>
|
|
</el-form>
|
|
<el-row :gutter="10" class="mb8">
|
|
<el-row :gutter="10" class="mb8">
|
|
<el-button type="primary" icon="el-icon-plus" :disabled="ids.length > 0" @click="op('add')" v-hasPermi="['work:news:add']">新增</el-button>
|
|
<el-button type="primary" icon="el-icon-plus" :disabled="ids.length > 0" @click="op('add')" v-hasPermi="['work:news:add']">新增</el-button>
|
|
- <el-button type="success" icon="el-icon-edit" :disabled="ids.length != 1" @click="op('edit',ids)" v-hasPermi="['work:news:edit']">修改</el-button>
|
|
|
|
- <el-button type="danger" icon="el-icon-delete" :disabled="ids.length == 0" @click="del" v-hasPermi="['work:news:remove']">删除{{ids.length>0?'('+ids.length+')':''}}</el-button>
|
|
|
|
|
|
+ <el-button type="success" icon="el-icon-edit" :disabled="ids.length != 1" @click="op('edit', ids)" v-hasPermi="['work:news:edit']">修改</el-button>
|
|
|
|
+ <el-button type="danger" icon="el-icon-delete" :disabled="ids.length == 0" @click="del" v-hasPermi="['work:news:remove']">删除{{ ids.length > 0 ? '(' + ids.length + ')' : '' }}</el-button>
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
</el-row>
|
|
</el-row>
|
|
|
|
|
|
@@ -31,6 +31,12 @@
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
<el-table-column label="标题" align="left" prop="title" />
|
|
<el-table-column label="标题" align="left" prop="title" />
|
|
<el-table-column label="类型" align="center" prop="type" width="150" />
|
|
<el-table-column label="类型" align="center" prop="type" width="150" />
|
|
|
|
+ <el-table-column label="置顶" align="center" prop="top" width="140">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-tag type="success" v-if="scope.row.top == 1">是</el-tag>
|
|
|
|
+ <el-tag type="info" v-else>否</el-tag>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
<el-table-column label="状态" align="center" prop="state" width="140">
|
|
<el-table-column label="状态" align="center" prop="state" width="140">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
<el-tag type="success" v-if="scope.row.state == 0">启用</el-tag>
|
|
<el-tag type="success" v-if="scope.row.state == 0">启用</el-tag>
|
|
@@ -40,7 +46,7 @@
|
|
<el-table-column label="创建时间" align="center" prop="createTime" width="200" />
|
|
<el-table-column label="创建时间" align="center" prop="createTime" width="200" />
|
|
<el-table-column label="操作" align="center" width="200">
|
|
<el-table-column label="操作" align="center" width="200">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <el-button size="mini" type="text" icon="el-icon-edit" @click="op('edit',scope.row)" v-hasPermi="['work:news:edit']">修改</el-button>
|
|
|
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-edit" @click="op('edit', scope.row)" v-hasPermi="['work:news:edit']">修改</el-button>
|
|
<el-button size="mini" type="text" icon="el-icon-delete" @click="del(scope.row)" v-hasPermi="['work:news:remove']">删除</el-button>
|
|
<el-button size="mini" type="text" icon="el-icon-delete" @click="del(scope.row)" v-hasPermi="['work:news:remove']">删除</el-button>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
@@ -48,68 +54,66 @@
|
|
<el-empty></el-empty>
|
|
<el-empty></el-empty>
|
|
</template>
|
|
</template>
|
|
</el-table>
|
|
</el-table>
|
|
- <pagination v-if="response.total>0" :total="response.total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
|
|
|
|
|
|
+ <pagination v-if="response.total > 0" :total="response.total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
- import edit from './edit'
|
|
|
|
- export default {
|
|
|
|
- name: "News",
|
|
|
|
- dicts: ['news_type'],
|
|
|
|
- data() {
|
|
|
|
- return {
|
|
|
|
- ids: [],
|
|
|
|
- showSearch: true,
|
|
|
|
- response: {},
|
|
|
|
- queryParams: {
|
|
|
|
- pageNum: 1,
|
|
|
|
- pageSize: 10,
|
|
|
|
- title: null,
|
|
|
|
- type: null,
|
|
|
|
- state: null,
|
|
|
|
- orderByColumn: 'id',
|
|
|
|
- isAsc: 'desc'
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
|
|
+import edit from './edit';
|
|
|
|
+export default {
|
|
|
|
+ name: 'News',
|
|
|
|
+ dicts: ['news_type'],
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ ids: [],
|
|
|
|
+ showSearch: true,
|
|
|
|
+ response: {},
|
|
|
|
+ queryParams: {
|
|
|
|
+ pageNum: 1,
|
|
|
|
+ pageSize: 10,
|
|
|
|
+ title: null,
|
|
|
|
+ type: null,
|
|
|
|
+ state: null
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ },
|
|
|
|
+ created() {
|
|
|
|
+ this.getList();
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ getList() {
|
|
|
|
+ this.ajax({ url: '/work/news/list', data: this.queryParams }).then((response) => {
|
|
|
|
+ this.response = response;
|
|
|
|
+ });
|
|
},
|
|
},
|
|
- created() {
|
|
|
|
|
|
+ handleQuery() {
|
|
|
|
+ this.queryParams.pageNum = 1;
|
|
this.getList();
|
|
this.getList();
|
|
},
|
|
},
|
|
- methods: {
|
|
|
|
- getList() {
|
|
|
|
- this.ajax({ url: '/work/news/list', data: this.queryParams }).then(response => {
|
|
|
|
- this.response = response;
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
- handleQuery() {
|
|
|
|
- this.queryParams.pageNum = 1;
|
|
|
|
- this.getList();
|
|
|
|
- },
|
|
|
|
- resetQuery() {
|
|
|
|
- this.resetForm("queryForm");
|
|
|
|
- this.handleQuery();
|
|
|
|
- },
|
|
|
|
- selects(rows) {
|
|
|
|
- this.ids = rows.map(item => item.id)
|
|
|
|
- },
|
|
|
|
- op(tag, row) {
|
|
|
|
- if (tag == 'add') {
|
|
|
|
- this.iframe({ obj: edit, param: {}, title: '新增', width: '58%', height: '73%' });
|
|
|
|
- }
|
|
|
|
- if (tag == 'edit') {
|
|
|
|
- const id = row.id || this.ids[0];
|
|
|
|
- this.iframe({ obj: edit, param: { id: id }, title: '编辑', width: '58%', height: '73%' });
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- del(row) {
|
|
|
|
- this.$confirm('是否确认删除选中数据?', '警告', { type: 'warning' }).then(() => {
|
|
|
|
- this.get({ url: '/work/news/remove/' + (row.id || this.ids) }).then(response => {
|
|
|
|
- this.$modal.msgSuccess('删除成功');
|
|
|
|
- this.getList();
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
|
|
+ resetQuery() {
|
|
|
|
+ this.resetForm('queryForm');
|
|
|
|
+ this.handleQuery();
|
|
|
|
+ },
|
|
|
|
+ selects(rows) {
|
|
|
|
+ this.ids = rows.map((item) => item.id);
|
|
|
|
+ },
|
|
|
|
+ op(tag, row) {
|
|
|
|
+ if (tag == 'add') {
|
|
|
|
+ this.iframe({ obj: edit, param: {}, title: '新增', width: '58%', height: '73%' });
|
|
|
|
+ }
|
|
|
|
+ if (tag == 'edit') {
|
|
|
|
+ const id = row.id || this.ids[0];
|
|
|
|
+ this.iframe({ obj: edit, param: { id: id }, title: '编辑', width: '58%', height: '73%' });
|
|
}
|
|
}
|
|
|
|
+ },
|
|
|
|
+ del(row) {
|
|
|
|
+ this.$confirm('是否确认删除选中数据?', '警告', { type: 'warning' }).then(() => {
|
|
|
|
+ this.get({ url: '/work/news/remove/' + (row.id || this.ids) }).then((response) => {
|
|
|
|
+ this.$modal.msgSuccess('删除成功');
|
|
|
|
+ this.getList();
|
|
|
|
+ });
|
|
|
|
+ });
|
|
}
|
|
}
|
|
- };
|
|
|
|
|
|
+ }
|
|
|
|
+};
|
|
</script>
|
|
</script>
|