AppDeployManage.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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('DEPLOY_INSERT')"
  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('DEPLOY_EDIT', scope.row.id)"
  55. class="btn-primary"
  56. type="text"
  57. @click="toEdit(scope.row)"
  58. >编辑</el-button
  59. >
  60. <el-button
  61. v-if="checkPrivilege('DEPLOY_ORG_EDIT', scope.row.id)"
  62. class="btn-primary"
  63. type="text"
  64. @click="toBindOrg(scope.row)"
  65. >关联机构</el-button
  66. >
  67. <el-button
  68. v-if="checkPrivilege('DEPLOY_DEVICE_EDIT', scope.row.id)"
  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('DEPLOY_INSERT') || 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. v-if="checkPrivilege('DEPLOY_ORG_EDIT', scope.row.id)"
  103. ref="AppDeployBindOrg"
  104. :instance="curRow"
  105. ></app-deploy-bind-org>
  106. <!-- AppDeployBindDevice -->
  107. <app-deploy-bind-device
  108. v-if="checkPrivilege('DEPLOY_DEVICE_EDIT', scope.row.id)"
  109. ref="AppDeployBindDevice"
  110. :instance="curRow"
  111. ></app-deploy-bind-device>
  112. </div>
  113. </template>
  114. <script>
  115. import { appDeployList, appDeployModes } from "../api";
  116. import ModifyAppDeploy from "./ModifyAppDeploy.vue";
  117. import AppDeployBindOrg from "./AppDeployBindOrg.vue";
  118. import AppDeployBindDevice from "./AppDeployBindDevice.vue";
  119. export default {
  120. name: "app-deploy-manage",
  121. components: { ModifyAppDeploy, AppDeployBindOrg, AppDeployBindDevice },
  122. props: {
  123. app: {
  124. type: Object,
  125. default() {
  126. return {};
  127. },
  128. },
  129. },
  130. data() {
  131. return {
  132. modalIsShow: false,
  133. filter: {
  134. nameStartWith: "",
  135. },
  136. current: 1,
  137. size: this.GLOBAL.pageSize,
  138. total: 0,
  139. dataList: [],
  140. curRow: {},
  141. deployModes: [],
  142. deployModeMap: {},
  143. };
  144. },
  145. methods: {
  146. async visibleChange() {
  147. await this.getDeployModes();
  148. this.getList();
  149. },
  150. cancel() {
  151. this.modalIsShow = false;
  152. },
  153. open() {
  154. this.modalIsShow = true;
  155. },
  156. async getDeployModes() {
  157. if (this.deployModes.length) return;
  158. const res = await appDeployModes();
  159. this.deployModes = res || [];
  160. let deployModeMap = {};
  161. this.deployModes.forEach(({ code, name }) => {
  162. deployModeMap[code] = name;
  163. });
  164. this.deployModeMap = deployModeMap;
  165. },
  166. async getList() {
  167. const datas = {
  168. ...this.filter,
  169. appId: this.app.id,
  170. pageNumber: this.current,
  171. pageSize: this.size,
  172. };
  173. const data = await appDeployList(datas);
  174. this.dataList = data.records.map((item) => {
  175. item.modeName = this.deployModeMap[item.mode];
  176. return item;
  177. });
  178. this.total = data.total;
  179. },
  180. toPage(page) {
  181. this.current = page;
  182. this.getList();
  183. },
  184. toAdd() {
  185. this.curRow = { appId: this.app.id };
  186. this.$refs.ModifyAppDeploy.open();
  187. },
  188. toEdit(row) {
  189. this.curRow = { ...row, appId: this.app.id };
  190. this.$refs.ModifyAppDeploy.open();
  191. },
  192. toBindOrg(row) {
  193. this.curRow = { ...row, appId: this.app.id };
  194. this.$refs.AppDeployBindOrg.open();
  195. },
  196. toBindDevice(row) {
  197. this.curRow = { ...row, appId: this.app.id };
  198. this.$refs.AppDeployBindDevice.open();
  199. },
  200. },
  201. };
  202. </script>