<template> <div class="edition-wrapper height100"> <div class="search-container"> <el-form :inline="true" :model="form"> <el-form-item> <el-date-picker v-model="form.dateRange" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd" ></el-date-picker> </el-form-item> <el-form-item> <div class="btn-group"> <el-button type="primary" @click="onSearch">查询</el-button> <el-button @click="handleReset">重置</el-button> </div> </el-form-item> </el-form> <div class="page-tip"> <span class="page-tip-title">页面说明:</span> <span class="page-tips" >可查看系统使用过的所有app版本信息,可设置其中一个版本为当前使用版本。可查看安装包详情信息。可上传新的安装包,“*”为必填项。</span > </div> </div> <div class="table-content"> <div class="btn-group"> <el-button type="primary" @click="addBox">上传安装包</el-button> </div> <div class="party-table"> <el-table border style="width: 100%; height: 100%" height="100%" :data="tableData" > <el-table-column type="index" width="120" label="序号" align="center"> <template slot-scope="scope"> <span>{{ (page._index - 1) * 10 + scope.$index + 1 }}</span> </template> </el-table-column> <el-table-column label="app版本号" prop="appVersion" align="center" ></el-table-column> <el-table-column align="center" label="是否为最新版本"> <template slot-scope="scope"> <span>{{ scope.row.isCurrent ? "是" : "否" }}</span> </template> </el-table-column> <el-table-column align="center" label="上传时间" prop="createTime" ></el-table-column> <el-table-column align="center" label="操作者" prop="userName" ></el-table-column> <el-table-column align="center" label="操作" header-align="center"> <template slot-scope="scope" width="220"> <div class="table-btn-group"> <el-tooltip content="详情" placement="top"> <el-button circle @click="handleDetail(scope.row)"> <i class="icon-table icon-detail"></i> </el-button> </el-tooltip> <el-tooltip content="启用" placement="top"> <el-button circle :disabled="!!scope.row.isCurrent" @click="ableBtn(scope.row)"> <i class="icon-table icon-enable"></i> </el-button> </el-tooltip> </div> </template> </el-table-column> </el-table> </div> <party-pagination :page="page" @changePage="handleCurrentChange" /> </div> <add-dialog ref="addDialog" @refreshFn="onSearch" /> <detail-dialog ref="detailDialog" /> </div> </template> <script> import { partyPagination } from "@/components/index"; import { addDialog, detailDialog } from "./components/index"; export default { data() { return { page: { _index: 1, _size: 10, total: 0, }, form: { dateRange: [], }, tableData: [], }; }, components: { partyPagination, addDialog, detailDialog }, mounted() { this.onSearch(); }, methods: { // 查询 onSearch() { this.page._index = 1; this.requestForm = JSON.parse(JSON.stringify(this.form)) this.getTableData(); }, // 获得数据接口 getTableData() { let vm = this; let param = { _index: this.page._index, _size: this.page._size, startDate: this.requestForm.dateRange.length ? this.requestForm.dateRange[0] : "", endDate: this.requestForm.dateRange.length ? this.requestForm.dateRange[1] : "", }; vm.$https( { url: "tAppVersion/getPageList", method: "post", authType: this.backToken, }, vm.$qs.stringify(param) ) .then((res) => { if (res.data.resultCode === "200") { let data = res.data.data; vm.page.total = data.total; vm.tableData = data.records; } else { this.$message.error(res.data.message); } }) .catch(function (err) { console.log(err); }); }, // 新增弹框打开 addBox() { this.$refs.addDialog.backFn(); }, // 详情弹框打开 handleDetail(item) { this.$refs.detailDialog.backFn(item); }, // 启用 ableBtn(row) { const _this = this; this.$confirm("确定要设置为最新版本?", "提示", { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning", center: true, }) .then(() => { this.updateVersion(row); }) .catch(() => { this.$message("已取消"); }); }, // 启用 updateVersion(row) { let vm = this; let param = { id: row.id, isCurrent: 1, }; vm.$https( { url: "tAppVersion/update", method: "put", authType: this.backToken, }, vm.$qs.stringify(param) ) .then((res) => { if (res.data.resultCode === "200") { this.$message.success("操作成功"); this.onSearch(); } else { this.$message.error(res.data.message); } }) .catch(function (err) { console.log(err); }); }, // 重置 handleReset() { this.form = { dateRange: [], }; this.onSearch(); }, // 分页 handleCurrentChange(val) { this.page._index = val; this.getTableData(); }, }, }; </script> <style lang="less"> @import "~@/style/table.less"; @import "~@/style/pagination.less"; </style>