hostUpgrade.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <div class="app-container">
  3. <div class="main-right-box">
  4. <!-- 搜索条件 -->
  5. <div class="main-search-box">
  6. <el-form v-show="showSearch" ref="queryForm" :inline="true" :model="queryParams" size="small">
  7. <el-form-item label="组织机构" prop="orgName">
  8. <el-input v-model="queryParams.orgName" :maxlength="50" clearable placeholder="请输入组织机构"/>
  9. </el-form-item>
  10. <el-form-item label="状态" prop="status">
  11. <el-select style="width: 100%;" clearable v-model="queryParams.status" placeholder="请选择状态"
  12. >
  13. <el-option v-for="dict in dict.type.deploy_upgrade_status" :key="dict.value" :label="dict.label"
  14. :value="dict.value"/>
  15. </el-select>
  16. </el-form-item>
  17. </el-form>
  18. <el-row :gutter="10">
  19. <el-col :span="1.5">
  20. <el-button icon="el-icon-search" size="mini" type="primary" @click="handleQuery"
  21. >搜索
  22. </el-button>
  23. </el-col>
  24. <el-col :span="1.5">
  25. <el-button icon="el-icon-refresh" size="mini" type="primary" @click="resetQuery"
  26. >重置
  27. </el-button>
  28. </el-col>
  29. <el-col :span="1.5">
  30. <el-button icon="el-icon-upload2" size="mini" type="primary" @click="confirmExport"
  31. >导出
  32. </el-button>
  33. </el-col>
  34. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  35. </el-row>
  36. </div>
  37. <el-table
  38. v-loading="loading"
  39. :data="upgradeHostList"
  40. border
  41. height="646" size="small" >
  42. <el-table-column align="center" label="序号" width="60">
  43. <template v-slot:default="scope">
  44. <span v-text="getPageIndex(scope.$index)"> </span>
  45. </template>
  46. </el-table-column>
  47. <el-table-column align="center" label="批次号" prop="batchCode" :show-overflow-tooltip="true" scoped-slot="batchCode"/>
  48. <el-table-column align="center" label="所属机构" prop="orgName" :show-overflow-tooltip="true" scoped-slot="orgName" width="320"/>
  49. <el-table-column align="center" label="版本号" prop="zipVersion"/>
  50. <el-table-column align="center" label="状态" prop="status">
  51. <template v-slot:default="scope">
  52. <span v-if="scope.row.status === 0" style="color: #000000">进行中</span>
  53. <span v-else-if="scope.row.status === 1" style="color: #00B83F">成功</span>
  54. <span v-else-if="scope.row.status === 2" style="color: red">失败</span>
  55. <span v-else-if="scope.row.status === 3" style="color: #f0ad4e">重试中</span>
  56. </template>
  57. </el-table-column>
  58. <el-table-column align="center" label="主机名称" prop="hostName"/>
  59. <el-table-column align="center" label="主机IP" prop="hostIp" :show-overflow-tooltip="true" scoped-slot="hostIp"/>
  60. <el-table-column align="center" label="创建时间" prop="createTime" :show-overflow-tooltip="true" scoped-slot="createTime"/>
  61. <el-table-column align="center" label="结束时间" prop="finishTime" :show-overflow-tooltip="true" scoped-slot="finishTime"/>
  62. <el-table-column
  63. class-name="small-padding fixed-width"
  64. label="操作"
  65. align="center"
  66. width="120"
  67. >
  68. <template slot-scope="{ row }">
  69. <el-button
  70. class="el-icon-view"
  71. size="mini"
  72. type="text"
  73. @click="showUpgradeApps(row)"
  74. >详情
  75. </el-button
  76. >
  77. </template>
  78. </el-table-column>
  79. </el-table>
  80. <pagination v-show="total > 0" :limit.sync="queryParams.pageSize" :page.sync="queryParams.pageNum" :total="total"
  81. @pagination="getList"/>
  82. </div>
  83. <DialogCom
  84. @colse="onHide"
  85. :title="'查看升级应用详情'"
  86. :visible.sync="open"
  87. width="1200px"
  88. >
  89. <div class="page-body">
  90. <el-table
  91. v-loading="loading"
  92. :data="upgradeAppList"
  93. border
  94. height="650" size="small"
  95. >
  96. <el-table-column align="center" label="序号" width="100">
  97. <template v-slot:default="scope">
  98. <span v-text="getPageIndex(scope.$index)"> </span>
  99. </template>
  100. </el-table-column>
  101. <el-table-column align="center" label="批次号" :show-overflow-tooltip="true" scoped-slot="batchNumber" prop="batchNumber"/>
  102. <el-table-column align="center" label="应用标识" :show-overflow-tooltip="true" scoped-slot="appId" prop="appId"/>
  103. <el-table-column align="center" label="当前版本号" prop="nowVersion"/>
  104. <el-table-column align="center" label="目标版本号" prop="targeVersion"/>
  105. <el-table-column align="center" label="进度描述" prop="deployDescription"/>
  106. <el-table-column align="center" label="状态" prop="taskStatus">
  107. <template v-slot:default="scope">
  108. <span v-if="scope.row.taskStatus === 0" style="color: #000000">进行中</span>
  109. <span v-else-if="scope.row.taskStatus === 1" style="color: #00B83F">成功</span>
  110. <span v-else-if="scope.row.taskStatus === 2" style="color: red">失败</span>
  111. <span v-else-if="scope.row.taskStatus === 3" style="color: #f0ad4e">重试中</span>
  112. </template>
  113. </el-table-column>
  114. </el-table>
  115. </div>
  116. </DialogCom>
  117. </div>
  118. </template>
  119. <script>
  120. import {
  121. upgradeHostList, upgradeAppList
  122. } from "@/api/deploy/upgradeStatus";
  123. import DataRangePicker from "@/components/dateTime/daterange.picker.vue";
  124. import dayjs from "dayjs";
  125. import {deleteBeringPackage} from "@/api/deploy/bering";
  126. export default {
  127. name: "UpgradeStatus",
  128. computed: {
  129. },
  130. components: { DataRangePicker, dayjs},
  131. dicts: ['deploy_upgrade_status'],
  132. data() {
  133. return {
  134. // 遮罩层
  135. loading: true,
  136. // 选中数组
  137. ids: [],
  138. // 非单个停用
  139. single: true,
  140. // 非多个停用
  141. multiple: true,
  142. // 显示搜索条件
  143. showSearch: true,
  144. // 总条数
  145. total: 0,
  146. // 表数据
  147. upgradeHostList: [],
  148. upgradeAppList:[],
  149. // 弹出层标题
  150. title: "",
  151. // 是否显示弹出层
  152. open: false,
  153. // 日期范围
  154. dateRange: [],
  155. // 查询参数
  156. queryParams: {
  157. pageNum: 1,
  158. pageSize: 10,
  159. orgName: null,
  160. status: null,
  161. },
  162. };
  163. },
  164. created() {
  165. // agentVersionSelect().then((d) => {
  166. // this.agentVersions = d.data;
  167. // });
  168. //this.getList();
  169. },
  170. mounted() {
  171. let id = this.$route.params.id;
  172. if (!id) {
  173. this.$tab.closePageAndPushPrev();
  174. return;
  175. }
  176. this.queryParams.id = id;
  177. this.getList();
  178. },
  179. methods: {
  180. getPageIndex($index) {
  181. //表格序号
  182. return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + $index + 1
  183. },
  184. /** 查询升级包列表 */
  185. getList() {
  186. upgradeHostList(this.queryParams).then(response => {
  187. this.upgradeHostList = response.rows;
  188. this.total = response.total;
  189. this.loading = false;
  190. }
  191. ).catch((err) => {
  192. this.loading = false;
  193. });
  194. },
  195. /** 搜索按钮操作 */
  196. handleQuery() {
  197. this.getList();
  198. },
  199. /** 重置按钮操作 */
  200. resetQuery() {
  201. this.dateRange = [];
  202. this.resetForm("queryForm");
  203. this.handleQuery();
  204. },
  205. showUpgradeApps(row){
  206. upgradeAppList({hostId:row.hostId,batchNumber:row.batchCode}).then((d) => {
  207. this.upgradeAppList = d.data;
  208. });
  209. this.open = true; },
  210. // 事件
  211. onHide() {
  212. this.open = false;
  213. },
  214. confirmExport(){
  215. this.$modal
  216. .confirm("导出符合当前查询条件的信息记录,确定执行?")
  217. .then(function () {
  218. })
  219. .then(() => {
  220. this.handleExportUpgradeInfo();
  221. });
  222. },
  223. handleExportUpgradeInfo() {
  224. this.download(
  225. "/api/deploy/appUpgrade/detailExport",
  226. {
  227. ...this.queryParams,
  228. },
  229. `升级主机详情_${new Date().getTime()}.xls`
  230. );
  231. },
  232. }
  233. };
  234. </script>