parameter.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template>
  2. <basic-container>
  3. <div class="pd-b-20 border-grey-b" style="text-align: right;">
  4. <el-button type="primary"icon="el-icon-add" size="small" @click="addCard">新增</el-button>
  5. </div>
  6. <div class="pd-t-20">
  7. <el-row :gutter="20" style="height: calc(100vh - 290px)" v-if="projectPageList.length > 0">
  8. <el-col :span="6" v-for="(item, index) in projectPageList" :key="item.id">
  9. <el-card @click.native="handleSetParameterName(item)" class="box-card h-100p flex bg-color clickable" style="height: auto;">
  10. <div class="card-content">
  11. <h3>{{ item.paramName }}</h3>
  12. <p class="text-bold">{{item.paramTypeName }}</p>
  13. <p class="small-text">{{ item.remarks }}</p>
  14. </div>
  15. </el-card>
  16. </el-col>
  17. </el-row>
  18. <div :span="24" class="empty-data" v-else>
  19. <p>暂无参数信息</p>
  20. </div>
  21. <div>
  22. <el-pagination
  23. v-if="projectPageList.length > 0"
  24. layout="prev, pager, next"
  25. class="text-align-c"
  26. @current-change="handleCurrentChange"
  27. :current-page.sync="page.currentPage"
  28. :total="page.total"
  29. :page-size="page.pageSize"
  30. >
  31. </el-pagination>
  32. </div>
  33. </div>
  34. <!-- 新增弹窗 -->
  35. <paramDetail ref="paramDetailRef" :params="parameterRow" @finshDetail="finshDetail"></paramDetail>
  36. <!-- 新增弹窗 -->
  37. <addParamDialog :visible.sync="dialogVisible" @add-parameter="addCardFinish" />
  38. </basic-container>
  39. </template>
  40. <script>
  41. import paramDetail from './paramDetail.vue';
  42. import addParamDialog from './addParamDialog.vue';
  43. import { queryParameterList } from "../../../api/paramter/parmter.js";
  44. export default{
  45. components:{
  46. paramDetail,
  47. addParamDialog
  48. },
  49. data(){
  50. return{
  51. page:{
  52. currentPage: 1,
  53. pageSize: 12,
  54. total: 0
  55. },
  56. projectPageList:[],
  57. dialogVisible:false,
  58. parameter: {
  59. name: '',
  60. type: '',
  61. isProjectSpecific: false,
  62. remark: ''
  63. },
  64. rules: {
  65. name: [
  66. { required: true, message: '请输入参数名称', trigger: 'blur' }
  67. ],
  68. type: [
  69. { required: true, message: '请选择参数类型', trigger: 'change' }
  70. ],
  71. isProjectSpecific: [
  72. { type: 'boolean', required: true, message: '请选择是否区分项目', trigger: 'change' }
  73. ]
  74. },
  75. parameterRow:{}
  76. }
  77. },
  78. created(){
  79. this.getProjectPageList()
  80. },
  81. methods:{
  82. convertParamType(paramType) {
  83. if (!paramType) return '';
  84. return paramType.split(',').join('/');
  85. },
  86. getProjectPageList () {
  87. queryParameterList({
  88. current: this.page.currentPage,
  89. size: this.page.pageSize
  90. }).then((res) => {
  91. this.projectPageList = res.data.data.records;
  92. this.page.total = res.data.data.total;
  93. })
  94. },
  95. handleCurrentChange(){
  96. },
  97. delSetParameterName(item){
  98. console.log(item)
  99. },
  100. addCard(){
  101. console.log('新增')
  102. this.dialogVisible = true
  103. },
  104. addCardFinish(){
  105. this.getProjectPageList()
  106. },
  107. finshDetail(){
  108. console.log(1111111111111111);
  109. this.getProjectPageList()
  110. },
  111. handleSetParameterName(item){
  112. console.log(item)
  113. this.parameterRow = item
  114. this.dialogVisible = false
  115. this.$refs.paramDetailRef.show(item.id)
  116. }
  117. }
  118. }
  119. </script>
  120. <style scoped lang="scss">
  121. .bg-color {
  122. background-color: #F5F7FA;
  123. }
  124. .clickable {
  125. cursor: pointer;
  126. width: 100%;
  127. display: flex;
  128. flex-direction: column;
  129. justify-content: space-between;
  130. }
  131. .card-content {
  132. flex: 1;
  133. display: flex;
  134. flex-direction: column;
  135. justify-content: space-between;
  136. }
  137. .small-text {
  138. font-size: smaller;
  139. margin-top: 20px;
  140. flex: 1;
  141. }
  142. .text-bold {
  143. font-weight: bold;
  144. height: 30px;
  145. }
  146. .delete-icon-container {
  147. display: flex;
  148. justify-content: flex-end;
  149. align-items: flex-end;
  150. }
  151. .delete-icon {
  152. font-size: 18px;
  153. color: red;
  154. cursor: pointer;
  155. }
  156. .empty-data {
  157. align-items: center;
  158. display: flex;
  159. justify-content: center;
  160. height: calc(-290px + 100vh);
  161. }
  162. </style>