AppDeployManage.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <div class="app-deploy-manage">
  3. <el-dialog
  4. class="page-dialog"
  5. :visible.sync="modalIsShow"
  6. title="应用部署管理"
  7. top="10px"
  8. width="1000px"
  9. :close-on-click-modal="false"
  10. :close-on-press-escape="false"
  11. append-to-body
  12. @opened="visibleChange"
  13. >
  14. <div class="part-box part-box-filter part-box-flex">
  15. <el-form
  16. ref="FilterForm"
  17. label-position="left"
  18. label-width="80px"
  19. inline
  20. >
  21. <el-form-item label="模糊查询">
  22. <el-input
  23. v-model="filter.nameStartWith"
  24. placeholder="名称前缀"
  25. ></el-input>
  26. </el-form-item>
  27. <el-form-item label-width="0px">
  28. <el-button type="primary" icon="ios-search" @click="getList"
  29. >查询</el-button
  30. >
  31. <el-button
  32. v-if="checkPrivilege('app_deploy_add')"
  33. type="success"
  34. icon="md-add"
  35. @click="toAdd"
  36. >新增</el-button
  37. >
  38. </el-form-item>
  39. </el-form>
  40. </div>
  41. <div class="part-box part-box-pad">
  42. <el-table ref="TableList" :data="dataList">
  43. <el-table-column prop="id" label="ID" width="80"></el-table-column>
  44. <el-table-column prop="name" label="名称" min-width="200">
  45. </el-table-column>
  46. <el-table-column
  47. prop="modeName"
  48. label="部署方式"
  49. min-width="80"
  50. ></el-table-column>
  51. <el-table-column label="操作" width="200" class-name="action-column">
  52. <template slot-scope="scope">
  53. <el-button
  54. v-if="checkPrivilege('app_deploy_edit')"
  55. class="btn-primary"
  56. type="text"
  57. @click="toEdit(scope.row)"
  58. >编辑</el-button
  59. >
  60. <el-button
  61. v-if="checkPrivilege('app_deploy_org')"
  62. class="btn-primary"
  63. type="text"
  64. @click="toBindOrg(scope.row)"
  65. >关联机构</el-button
  66. >
  67. <el-button
  68. v-if="checkPrivilege('app_deploy_device')"
  69. class="btn-primary"
  70. type="text"
  71. @click="toBindDevice(scope.row)"
  72. >关联设备</el-button
  73. >
  74. </template>
  75. </el-table-column>
  76. </el-table>
  77. <div class="part-page">
  78. <el-pagination
  79. background
  80. layout="total,prev, pager, next"
  81. :current-page="current"
  82. :total="total"
  83. :page-size="size"
  84. @current-change="toPage"
  85. >
  86. </el-pagination>
  87. </div>
  88. </div>
  89. </el-dialog>
  90. <!-- ModifyAppDeploy -->
  91. <modify-app-deploy
  92. v-if="
  93. checkPrivilege('app_deploy_add') || checkPrivilege('app_deploy_edit')
  94. "
  95. ref="ModifyAppDeploy"
  96. :instance="curRow"
  97. :deploy-modes="deployModes"
  98. @modified="getList"
  99. ></modify-app-deploy>
  100. <!-- AppDeployBindOrg -->
  101. <app-deploy-bind-org
  102. ref="AppDeployBindOrg"
  103. :instance="curRow"
  104. ></app-deploy-bind-org>
  105. <!-- AppDeployBindDevice -->
  106. <app-deploy-bind-device
  107. ref="AppDeployBindDevice"
  108. :instance="curRow"
  109. ></app-deploy-bind-device>
  110. </div>
  111. </template>
  112. <script>
  113. import { appDeployList, appDeployModes } from "../api";
  114. import ModifyAppDeploy from "./ModifyAppDeploy.vue";
  115. import AppDeployBindOrg from "./AppDeployBindOrg.vue";
  116. import AppDeployBindDevice from "./AppDeployBindDevice.vue";
  117. export default {
  118. name: "app-deploy-manage",
  119. components: { ModifyAppDeploy, AppDeployBindOrg, AppDeployBindDevice },
  120. props: {
  121. app: {
  122. type: Object,
  123. default() {
  124. return {};
  125. }
  126. }
  127. },
  128. data() {
  129. return {
  130. modalIsShow: false,
  131. filter: {
  132. nameStartWith: ""
  133. },
  134. current: 1,
  135. size: this.GLOBAL.pageSize,
  136. total: 0,
  137. dataList: [],
  138. curRow: {},
  139. deployModes: [],
  140. deployModeMap: {}
  141. };
  142. },
  143. methods: {
  144. async visibleChange() {
  145. await this.getDeployModes();
  146. this.getList();
  147. },
  148. cancel() {
  149. this.modalIsShow = false;
  150. },
  151. open() {
  152. this.modalIsShow = true;
  153. },
  154. async getDeployModes() {
  155. if (this.deployModes.length) return;
  156. const res = await appDeployModes();
  157. this.deployModes = res || [];
  158. let deployModeMap = {};
  159. this.deployModes.forEach(({ code, name }) => {
  160. deployModeMap[code] = name;
  161. });
  162. this.deployModeMap = deployModeMap;
  163. },
  164. async getList() {
  165. const datas = {
  166. ...this.filter,
  167. appId: this.app.id,
  168. pageNumber: this.current,
  169. pageSize: this.size
  170. };
  171. const data = await appDeployList(datas);
  172. this.dataList = data.records.map(item => {
  173. item.modeName = this.deployModeMap[item.mode];
  174. return item;
  175. });
  176. this.total = data.total;
  177. },
  178. toPage(page) {
  179. this.current = page;
  180. this.getList();
  181. },
  182. toAdd() {
  183. this.curRow = { appId: this.app.id };
  184. this.$refs.ModifyAppDeploy.open();
  185. },
  186. toEdit(row) {
  187. this.curRow = { ...row, appId: this.app.id };
  188. this.$refs.ModifyAppDeploy.open();
  189. },
  190. toBindOrg(row) {
  191. this.curRow = { ...row, appId: this.app.id };
  192. this.$refs.AppDeployBindOrg.open();
  193. },
  194. toBindDevice(row) {
  195. this.curRow = { ...row, appId: this.app.id };
  196. this.$refs.AppDeployBindDevice.open();
  197. }
  198. }
  199. };
  200. </script>