123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- <template>
- <div class="">
- <toolbar @on-filter="filterData" @on-reset="filterData" />
- <div class="m-10 bg-w p-20 br-10">
- <el-button type="primary" icon="el-icon-plus" @click="handleAdd"
- >新增</el-button
- >
- <base-table
- :columns="columns"
- :items="items"
- :pagination="pagination"
- :page-change="pageChange"
- />
- </div>
- </div>
- </template>
- <script>
- import toolbar from './toolbar';
- import mxFilterList from '@/mixins/filterList';
- import { getPage, changeShowItem, forceUpgradeItem } from '@/api/app';
- export default {
- name: 'UpdateList',
- components: { toolbar },
- mixins: [
- mxFilterList({
- fetchList: getPage // 在下方data再声明一个 fetchList: iGetList 同等效果
- })
- ],
- data() {
- return {
- columns: [
- {
- key: 'productName',
- name: '产品名称',
- width: this.$col.m
- },
- {
- key: 'platform',
- name: '平台',
- width: this.$col.m
- },
- {
- key: 'versionCode',
- name: '版本编码',
- minWidth: this.$col.b
- },
- {
- key: 'versionNumber',
- name: '版本号',
- minWidth: this.$col.b
- },
- {
- key: 'downloadUrl',
- name: '下载地址',
- minWidth: this.$col.b
- },
- {
- key: 'upgradeDesc',
- name: '升级描述',
- minWidth: this.$col.b
- },
- {
- key: 'isForceUpgrade',
- name: '强制更新',
- width: this.$col.b,
- type: 'switch',
- switchName: ['开启', '关闭'],
- api: async row => {
- const { success } = await forceUpgradeItem(row);
- if (success) {
- this.$success('修改成功!');
- }
- this.$g_emit('update_app_reload');
- }
- },
- {
- key: 'createAt',
- name: '创建时间',
- width: this.$col.b
- },
- {
- key: 'isShow',
- name: '显示/隐藏',
- width: this.$col.b,
- type: 'switch',
- switchName: ['显示', '隐藏'],
- api: async row => {
- const { success } = await changeShowItem(row);
- if (success) {
- this.$success('修改成功!');
- }
- this.$g_emit('update_app_reload');
- }
- }
- // {
- // key: 'action',
- // name: '操作',
- // width: '120',
- // render: (h, { row }) => {
- // const action = [];
- // action.push(
- // h(
- // 'el-button',
- // {
- // props: {
- // type: 'text'
- // },
- // on: {
- // click: () =>
- // this.$TrendItemModal({
- // id: row.id,
- // info: {
- // name: row.name,
- // sort: row.sort,
- // isShow: row.isShow
- // }
- // })
- // }
- // },
- // '编辑'
- // )
- // );
- // action.push(
- // h(
- // 'BaseBtn',
- // {
- // props: {
- // popip: true,
- // txt: '删除',
- // type: 'text'
- // },
- // class: 'ml-10',
- // on: {
- // ok: () => this.handleDelItem(row)
- // }
- // },
- // '删除'
- // )
- // );
- // return h('div', action);
- // }
- // }
- ]
- };
- },
- created() {
- this.$g_on('update_app_reload', this.reload);
- },
- beforeDestroy() {
- this.$g_off('update_app_reload', this.reload);
- },
- methods: {
- handleAdd() {
- this.$updateAppItemModal();
- },
- async handleDelItem(item) {
- const { success, msg } = await delItem({
- id: item.id
- });
- if (success) {
- this.$success('删除成功!');
- this.$g_emit('trend_reload');
- }
- }
- }
- };
- </script>
- <style type="scss" scoped></style>
|