You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

SpecificationDialog.vue 5.3 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <div class="base-dlg">
  3. <BaseDialog :visible.sync="dialogShow" :width="`700px`" :title="`新增资源规格和单价信息`" @open="open" @opened="opened"
  4. @close="close" @closed="closed">
  5. <div class="dlg-content">
  6. <div class="form">
  7. <div class="form-row">
  8. <div class="title required">
  9. <span>资源池(队列)</span>
  10. </div>
  11. <div class="content">
  12. <el-select v-model="dataInfo.queue"></el-select>
  13. </div>
  14. </div>
  15. <div class="form-row">
  16. <div class="title required">
  17. <span>XPU数</span>
  18. </div>
  19. <div class="content">
  20. <el-input v-model="dataInfo.xpu" type="number" placeholder=""></el-input>
  21. </div>
  22. </div>
  23. <div class="form-row">
  24. <div class="title required">
  25. <span>CPU数</span>
  26. </div>
  27. <div class="content">
  28. <el-input v-model="dataInfo.cpu" type="number" placeholder=""></el-input>
  29. </div>
  30. </div>
  31. <div class="form-row">
  32. <div class="title required">
  33. <span>内存(GB)</span>
  34. </div>
  35. <div class="content">
  36. <el-input v-model="dataInfo.mem" type="number" placeholder=""></el-input>
  37. </div>
  38. </div>
  39. <div class="form-row">
  40. <div class="title required">
  41. <span>共享内存(GB)</span>
  42. </div>
  43. <div class="content">
  44. <el-input v-model="dataInfo.shareMem" type="number" placeholder=""></el-input>
  45. </div>
  46. </div>
  47. <div class="form-row">
  48. <div class="title required">
  49. <span>单价</span>
  50. </div>
  51. <div class="content">
  52. <el-input v-model="dataInfo.price" type="number" placeholder=""></el-input>
  53. </div>
  54. </div>
  55. <div class="form-row">
  56. <div class="title required">
  57. <span>状态</span>
  58. </div>
  59. <div class="content">
  60. <el-select v-model="dataInfo.status"></el-select>
  61. </div>
  62. </div>
  63. <div class="form-row" style="margin-top: 20px">
  64. <div class="title"></div>
  65. <div class="content">
  66. <el-button type="primary" class="btn confirm-btn" @click="confirm">确定</el-button>
  67. <el-button class="btn" @click="cancel">取消</el-button>
  68. </div>
  69. </div>
  70. </div>
  71. </div>
  72. </BaseDialog>
  73. </div>
  74. </template>
  75. <script>
  76. import BaseDialog from '~/components/BaseDialog.vue';
  77. import { getQueueList } from '~/apis/modules/resources';
  78. export default {
  79. name: "SpecificationDialog",
  80. props: {
  81. visible: { type: Boolean, default: false },
  82. title: { type: String, default: '' },
  83. type: { type: String, defalut: 'add' },
  84. data: { type: Object, default: () => ({}) },
  85. },
  86. components: {
  87. BaseDialog
  88. },
  89. data() {
  90. return {
  91. dialogShow: false,
  92. dataInfo: {
  93. },
  94. };
  95. },
  96. watch: {
  97. visible: function (val) {
  98. this.dialogShow = val;
  99. },
  100. },
  101. methods: {
  102. resetDataInfo() {
  103. this.dataInfo = {
  104. queue: '',
  105. queueList: [],
  106. xpu: '',
  107. cpu: '',
  108. mem: '',
  109. shareMem: '',
  110. price: '',
  111. status: '',
  112. statusList: [],
  113. }
  114. },
  115. open() {
  116. this.resetDataInfo();
  117. if (this.type === 'add') {
  118. //
  119. } else if (this.type === 'edit') {
  120. this.dataInfo = Object.assign(this.dataInfo, { ...this.data });
  121. }
  122. console.log('open', this.type, this.data);
  123. this.$emit("open");
  124. },
  125. opened() {
  126. this.$emit("opened");
  127. },
  128. close() {
  129. this.$emit("close");
  130. },
  131. closed() {
  132. this.$emit("closed");
  133. this.$emit("update:visible", false);
  134. },
  135. confirm() {
  136. },
  137. cancel() {
  138. this.dialogShow = false;
  139. this.$emit("update:visible", false);
  140. }
  141. },
  142. mounted() {
  143. this.resetDataInfo();
  144. },
  145. };
  146. </script>
  147. <style scoped lang="less">
  148. .dlg-content {
  149. margin: 20px 0 25px 0;
  150. display: flex;
  151. justify-content: center;
  152. .form {
  153. width: 600px;
  154. .form-row {
  155. display: flex;
  156. min-height: 42px;
  157. margin-bottom: 4px;
  158. .title {
  159. width: 160px;
  160. display: flex;
  161. justify-content: flex-end;
  162. align-items: center;
  163. margin-right: 20px;
  164. color: rgb(136, 136, 136);
  165. font-size: 14px;
  166. &.required {
  167. span {
  168. position: relative;
  169. }
  170. span::after {
  171. position: absolute;
  172. right: -10px;
  173. top: -2px;
  174. vertical-align: top;
  175. content: '*';
  176. color: #db2828;
  177. }
  178. }
  179. }
  180. .content {
  181. width: 300px;
  182. display: flex;
  183. align-items: center;
  184. /deep/ .el-select {
  185. width: 100%;
  186. }
  187. }
  188. }
  189. }
  190. .btn {
  191. color: rgb(2, 0, 4);
  192. background-color: rgb(194, 199, 204);
  193. border-color: rgb(194, 199, 204);
  194. &.confirm-btn {
  195. color: #fff;
  196. background-color: rgb(56, 158, 13);
  197. border-color: rgb(56, 158, 13);
  198. }
  199. }
  200. }
  201. </style>