index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <!-- 推送管理 App升级 -->
  2. <template>
  3. <div class="app-container">
  4. <!-- 搜索 -->
  5. <el-form size="mini" inline>
  6. <el-form-item label="版本号:">
  7. <el-input
  8. v-model="form.lastVersion"
  9. placeholder="请输入版本号"
  10. clearable
  11. />
  12. </el-form-item>
  13. <el-form-item label="升级系统:">
  14. <el-select
  15. v-model="form.appType"
  16. placeholder="请选择升级系统"
  17. clearable
  18. >
  19. <el-option
  20. v-for="item in systemOptions"
  21. :key="item.value"
  22. :value="item.value"
  23. :label="item.label"
  24. />
  25. </el-select>
  26. </el-form-item>
  27. <el-form-item>
  28. <el-button type="primary" icon="el-icon-search" @click="getSearch"
  29. >搜索</el-button
  30. >
  31. <el-button icon="el-icon-refresh" @click="getRefresh">重置</el-button>
  32. <el-button
  33. type="primary"
  34. icon="el-icon-plus"
  35. plain
  36. @click="getDetail()"
  37. v-hasPermi="['push:update:add']"
  38. >新增</el-button
  39. >
  40. </el-form-item>
  41. </el-form>
  42. <!-- 列表 -->
  43. <el-table :data="tableData" v-loading="loading">
  44. <el-table-column type="index" label="序号" align="center" />
  45. <el-table-column
  46. label="升级标题"
  47. prop="updateTitle"
  48. align="center"
  49. show-overflow-tooltip
  50. />
  51. <el-table-column label="版本号" prop="lastVersion" align="center" />
  52. <el-table-column
  53. label="下载路径"
  54. prop="downUrl"
  55. align="center"
  56. show-overflow-tooltip
  57. />
  58. <el-table-column
  59. label="是否强制升级"
  60. prop="isForceUpdate"
  61. align="center"
  62. :formatter="typeFormatter"
  63. />
  64. <el-table-column
  65. label="升级系统"
  66. prop="appType"
  67. align="center"
  68. :formatter="appTypeFormatter"
  69. />
  70. <el-table-column label="更新时间" prop="updateTime" align="center" />
  71. <el-table-column label="操作" align="center">
  72. <template slot-scope="scope">
  73. <el-button type="text" @click="getDetail(scope.row.id, true)"
  74. >查看</el-button
  75. >
  76. <el-button
  77. type="text"
  78. @click="getDetail(scope.row.id)"
  79. v-hasPermi="['push:update:edit']"
  80. >编辑</el-button
  81. >
  82. <el-button
  83. type="delete"
  84. @click="getDelete(scope.row)"
  85. v-hasPermi="['push:update:delete']"
  86. >删除</el-button
  87. >
  88. </template>
  89. </el-table-column>
  90. </el-table>
  91. <pagination
  92. v-show="total > 0"
  93. :total="total"
  94. :page.sync="form.pageNum"
  95. :limit.sync="form.pageSize"
  96. @pagination="getList"
  97. />
  98. </div>
  99. </template>
  100. <script>
  101. import { list, remove } from "@/api/push/update";
  102. import { systemMixin } from "@/mixin";
  103. import { dialogCallBack } from "@/utils/DialogUtil";
  104. export default {
  105. name:"PushUpdate",
  106. mixins: [systemMixin],
  107. data() {
  108. return {
  109. // 遮罩层
  110. loading: false,
  111. // 表单
  112. form: {
  113. pageNum: 1,
  114. pageSize: 10,
  115. },
  116. // 列表
  117. tableData: [],
  118. // 总数据
  119. total: 0,
  120. // 是否强制
  121. typeOptions: [
  122. {
  123. value: 0,
  124. label: "否",
  125. },
  126. {
  127. value: 1,
  128. label: "是",
  129. },
  130. ],
  131. };
  132. },
  133. mounted() {
  134. this.getList();
  135. },
  136. methods: {
  137. // 列表
  138. getList() {
  139. this.loading = true;
  140. list(this.form).then((res) => {
  141. if (res.code === 0) {
  142. this.tableData = res.data.records;
  143. this.total = res.data.total;
  144. this.loading = false;
  145. }
  146. });
  147. },
  148. // 搜索
  149. getSearch() {
  150. this.form.pageNum = 1;
  151. this.getList();
  152. },
  153. // 重置
  154. getRefresh() {
  155. this.form = {
  156. pageNum: 1,
  157. pageSize: 10,
  158. };
  159. this.getList();
  160. },
  161. // 新增 编辑
  162. getDetail(id, boolean) {
  163. this.$router.push({
  164. path: "/push/update/detail",
  165. query: {
  166. id: id,
  167. boolean: boolean,
  168. },
  169. });
  170. },
  171. // 删除
  172. getDelete(row) {
  173. var that = this;
  174. dialogCallBack(that, function () {
  175. that
  176. .$confirm(`是否删除${row.updateTitle}?`, "提示:", {
  177. type: "warning",
  178. })
  179. .then(() => {
  180. remove(row.id, 1).then((res) => {
  181. if (res.code === 0) {
  182. that.$message.success("删除成功!");
  183. that.getList();
  184. }
  185. });
  186. })
  187. .catch(() => {});
  188. });
  189. },
  190. // 字典翻译
  191. typeFormatter(row) {
  192. return this.selectDictLabel(this.typeOptions, row.isForceUpdate);
  193. },
  194. appTypeFormatter(row) {
  195. return this.selectDictLabel(this.systemOptions, row.appType);
  196. },
  197. },
  198. };
  199. </script>
  200. <style lang="scss" scoped></style>