parameter.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <basic-container>
  3. <div class="h-100p">
  4. <el-tabs v-model="activeName" @tab-click="handleClick">
  5. <el-tab-pane label="压实度评标参数" name="first">
  6. <avue-crud
  7. :before-open="beforeOpen"
  8. :table-loading="loading"
  9. :data="tableData"
  10. :option="option"
  11. v-model="form"
  12. @row-save="rowSave"
  13. @row-update="rowUpdate"
  14. @selection-change="selectionChange"
  15. @refresh-change="refreshChange"
  16. @current-change="currentChange"
  17. @size-change="sizeChange"
  18. @on-load="onLoad"
  19. :page.sync="page"
  20. ref="crud"
  21. >
  22. <template slot="menuRight">
  23. <el-button
  24. type="danger"
  25. size="small"
  26. icon="el-icon-delete"
  27. plain
  28. @click="handleDelete">删除
  29. </el-button>
  30. <el-button
  31. size="small"
  32. type="primary"
  33. plain
  34. icon="el-icon-plus"
  35. @click="importdata"
  36. >导入
  37. </el-button>
  38. </template>
  39. </avue-crud>
  40. </el-tab-pane>
  41. <el-tab-pane label="温度及密度参数" name="second">
  42. <temperature/>
  43. </el-tab-pane>
  44. </el-tabs>
  45. </div>
  46. <!-- 导入参数弹窗 -->
  47. <importDialog ref="importDialog" @paramLoad="onLoad" :importDialogType="importDialogType" :parmpage="page" />
  48. </basic-container>
  49. </template>
  50. <script>
  51. import importDialog from './importDialog.vue';
  52. import temperature from './temperature.vue';
  53. import {getList,add, update, remove,getDetail} from "@/api/tentative/testpram";
  54. export default {
  55. components:{
  56. importDialog,
  57. temperature
  58. },
  59. data() {
  60. return {
  61. activeName: 'first',
  62. importDialogType:1,
  63. page: {
  64. pageSize: 20,
  65. currentPage:1
  66. },
  67. loading:false,
  68. tableData: [],
  69. selectionList:[],
  70. query:{},
  71. form:{},
  72. option:{
  73. height: 'auto',
  74. calcHeight: 30,
  75. tip: false,
  76. searchShow:false,
  77. searchMenuSpan: 6,
  78. border: true,
  79. index: true,
  80. viewBtn: false,
  81. selection: true,
  82. editBtn:true,
  83. delBtn:false,
  84. addBtn:true,
  85. menu:true,
  86. labelWidth:150,
  87. indexFixed:false,
  88. selectionFixed:false,
  89. expandFixed:false,
  90. dialogClickModal: false,
  91. column:[
  92. {
  93. label:'N值',
  94. prop:'valueN'
  95. }, {
  96. label:'保证率99%',
  97. prop:'assuranceRateNinetyNinePercent'
  98. },{
  99. label:'保证率95%',
  100. prop:'assuranceRateNinetyFivePercent'
  101. },{
  102. label:'保证率90%',
  103. prop:'assuranceRateNinetyPercent'
  104. }
  105. ]
  106. },
  107. };
  108. },
  109. computed:{
  110. ids () {
  111. let ids = [];
  112. this.selectionList.forEach(ele => {
  113. ids.push(ele.id);
  114. });
  115. return ids.join(",");
  116. }
  117. },
  118. methods: {
  119. onLoad(page, params = {}) {
  120. this.loading = true;
  121. getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
  122. const data = res.data.data;
  123. this.page.total = data.total;
  124. this.tableData = data.records;
  125. this.loading = false;
  126. this.selectionClear();
  127. });
  128. },
  129. refreshChange() {
  130. this.onLoad(this.page, this.query);
  131. },
  132. sizeChange(pageSize) {
  133. this.page.pageSize = pageSize;
  134. },
  135. currentChange(currentPage) {
  136. this.page.currentPage = currentPage;
  137. },
  138. handleClick(tab, event) {
  139. console.log(tab, event);
  140. },
  141. rowSave (row, done, loading) {
  142. console.log(row,'row');
  143. add(row).then(() => {
  144. this.onLoad(this.page);
  145. this.$message({
  146. type: "success",
  147. message: "操作成功!"
  148. });
  149. done();
  150. }, error => {
  151. loading();
  152. window.console.log(error);
  153. });
  154. },
  155. rowUpdate(row, index, done, loading) {
  156. update(row).then(() => {
  157. this.onLoad(this.page);
  158. this.$message({
  159. type: "success",
  160. message: "操作成功!"
  161. });
  162. done();
  163. }, error => {
  164. loading();
  165. console.log(error);
  166. });
  167. },
  168. beforeOpen(done, type) {
  169. if (["edit", "view"].includes(type)) {
  170. getDetail(this.form.id).then(res => {
  171. this.form = res.data.data;
  172. });
  173. }
  174. done();
  175. },
  176. handleDelete () {
  177. if (this.selectionList.length === 0) {
  178. this.$message.warning("请选择至少一条数据");
  179. return;
  180. }
  181. this.$confirm("确定将选择数据删除?", {
  182. confirmButtonText: "确定",
  183. cancelButtonText: "取消",
  184. type: "warning"
  185. })
  186. .then(() => {
  187. return remove(this.ids);
  188. })
  189. .then(() => {
  190. this.onLoad(this.page);//刷新表格数据
  191. this.$message({
  192. type: "success",
  193. message: "操作成功!"
  194. });
  195. this.$refs.crud.toggleSelection();
  196. });
  197. },
  198. selectionChange (list) {
  199. this.selectionList = list;
  200. },
  201. selectionClear () {
  202. this.selectionList = [];
  203. this.$refs.crud.toggleSelection();
  204. },
  205. importdata(){
  206. console.log('导入');
  207. this.$refs.importDialog.show()
  208. },
  209. }
  210. }
  211. </script>
  212. <style>
  213. </style>