index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <template>
  2. <div>
  3. <el-row class="ml-5" style="margin-bottom: 20px">
  4. <el-col :span="2">
  5. <div class="">
  6. <div class="block-title">系统参数</div>
  7. <div class="totalCount-text">
  8. 参数数量:{{ this.tableData.length }}
  9. </div>
  10. </div>
  11. </el-col>
  12. <!-- <el-col :span="5">
  13. <el-input
  14. clearable
  15. prefix-icon="el-icon-search"
  16. type="text"
  17. placeholder="搜索系统参数"
  18. style="width: 275px; border-radius: 30px"
  19. v-model="searchParam"
  20. >
  21. </el-input>
  22. </el-col>
  23. <el-col :span="14">
  24. <el-button
  25. icon="el-icon-search"
  26. class="btn-filter"
  27. @click="getParamList"
  28. >
  29. 筛选
  30. </el-button>
  31. </el-col> -->
  32. <el-col :span="3" :offset="19">
  33. <el-button type="primary" class="btn-add" @click="addParamBtn">
  34. 添加参数
  35. </el-button>
  36. </el-col>
  37. </el-row>
  38. <el-row>
  39. <el-col>
  40. <el-table
  41. :data="tableData"
  42. style="width: 100%"
  43. :header-cell-style="{
  44. fontSize: '12px',
  45. fontFamily: 'hm-regular',
  46. fontWeight: 400,
  47. textAlign: 'LEFT',
  48. color: '#888888',
  49. lineHeight: '12px',
  50. }"
  51. >
  52. <el-table-column prop="paramName" label="参数名称" width="">
  53. </el-table-column>
  54. <el-table-column prop="paramValue" label="参数值"> </el-table-column>
  55. <el-table-column prop="systemName" label="系统名称">
  56. </el-table-column>
  57. <el-table-column prop="createTime" label="创建时间">
  58. </el-table-column>
  59. <el-table-column prop="updateTime" label="修改时间">
  60. </el-table-column>
  61. <el-table-column prop="paramNote" label="备注"> </el-table-column>
  62. <el-table-column label="操作">
  63. <template slot-scope="scope">
  64. <el-button
  65. type="text"
  66. @click="handleEdit(scope.$index, scope.row)"
  67. class="fs-14 bold blue"
  68. >编辑
  69. </el-button>
  70. <el-button
  71. type="text"
  72. @click="handleDelete(scope.$index, scope.row)"
  73. class="fs-14 bold color-red"
  74. >删除
  75. </el-button>
  76. </template>
  77. </el-table-column>
  78. </el-table>
  79. <el-pagination
  80. style="margin-top: 20px"
  81. class="float-right"
  82. @size-change="handleSizeChange"
  83. @current-change="handleCurrentChange"
  84. :current-page.sync="page"
  85. :page-sizes="[10, 20, 30, 40]"
  86. :page-size.sync="pageSize"
  87. layout="total, sizes, prev, pager, next, jumper"
  88. :total="totalCount"
  89. >
  90. </el-pagination>
  91. </el-col>
  92. </el-row>
  93. <save-or-update ref="SaveOrUpdate" />
  94. </div>
  95. </template>
  96. <script>
  97. import SaveOrUpdate from "./SaveOrUpdate.vue";
  98. import { pageParam, deleteParam } from "@/api/param";
  99. import constant from "@/api/constant";
  100. export default {
  101. components: { SaveOrUpdate },
  102. data() {
  103. return {
  104. page: 1,
  105. pageSize: 10,
  106. totalCount: 0,
  107. searchParam: undefined,
  108. systemId: constant.systemId,
  109. param: {},
  110. tableData: [],
  111. };
  112. },
  113. methods: {
  114. handleSizeChange(val) {
  115. this.pageSize = val;
  116. this.page = 1;
  117. this.getParamList();
  118. },
  119. handleCurrentChange(val) {
  120. this.page = val;
  121. this.getParamList();
  122. },
  123. getParamList() {
  124. pageParam({
  125. page: this.page,
  126. pageSize: this.pageSize,
  127. paramName: this.searchParam,
  128. systemId: this.systemId,
  129. }).then((res) => {
  130. this.tableData = res.records;
  131. this.totalCount = res.total;
  132. });
  133. },
  134. addParamBtn() {
  135. this.$refs.SaveOrUpdate.isSave = true;
  136. this.$refs.SaveOrUpdate.paramModal = true;
  137. // this.$refs.SaveOrUpdate.resetForm();
  138. this.$refs.SaveOrUpdate.param.systemParamId = undefined;
  139. this.$refs.SaveOrUpdate.param.paramName = undefined;
  140. this.$refs.SaveOrUpdate.param.paramValue = undefined;
  141. this.$refs.SaveOrUpdate.param.systemId = constant.systemId;
  142. this.$refs.SaveOrUpdate.param.paramNote = undefined;
  143. },
  144. handleEdit(index, row) {
  145. this.$refs.SaveOrUpdate.isSave = false;
  146. this.$refs.SaveOrUpdate.paramModal = true;
  147. Object.assign(this.$refs.SaveOrUpdate.param, row);
  148. },
  149. handleDelete(index, row) {
  150. this.$confirm("此操作将永久删除此系统参数信息, 是否继续?", "提示", {
  151. confirmButtonText: "确定",
  152. cancelButtonText: "取消",
  153. type: "warning",
  154. })
  155. .then(() => {
  156. deleteParam(row.systemParamId).then(() => {
  157. this.$message.success("删除成功");
  158. this.getParamList();
  159. });
  160. })
  161. .catch(() => {
  162. this.$message({
  163. type: "info",
  164. message: "已取消删除",
  165. });
  166. });
  167. },
  168. },
  169. created() {
  170. this.getParamList();
  171. },
  172. };
  173. </script>