parameter.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <basic-container>
  3. <el-tabs v-model="activeName" @tab-click="handleClick">
  4. <el-tab-pane label="压实度评标参数" name="first">
  5. <div style="height:100%;">
  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. </div>
  41. </el-tab-pane>
  42. <el-tab-pane label="温度及密度参数" name="second">
  43. <temperature/>
  44. </el-tab-pane>
  45. <!-- 导入参数弹窗 -->
  46. <importDialog ref="importDialog" @paramLoad="onLoad" :importDialogType="importDialogType" :parmpage="page" />
  47. </el-tabs>
  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: 630,
  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. setTimeout(() => {
  141. this.$nextTick(() => {
  142. this.$refs.crud.doLayout();
  143. });
  144. }, 1);
  145. },
  146. rowSave (row, done, loading) {
  147. console.log(row,'row');
  148. add(row).then(() => {
  149. this.onLoad(this.page);
  150. this.$message({
  151. type: "success",
  152. message: "操作成功!"
  153. });
  154. done();
  155. }, error => {
  156. loading();
  157. window.console.log(error);
  158. });
  159. },
  160. rowUpdate(row, index, done, loading) {
  161. update(row).then(() => {
  162. this.onLoad(this.page);
  163. this.$message({
  164. type: "success",
  165. message: "操作成功!"
  166. });
  167. done();
  168. }, error => {
  169. loading();
  170. console.log(error);
  171. });
  172. },
  173. beforeOpen(done, type) {
  174. if (["edit", "view"].includes(type)) {
  175. getDetail(this.form.id).then(res => {
  176. this.form = res.data.data;
  177. });
  178. }
  179. done();
  180. },
  181. handleDelete () {
  182. if (this.selectionList.length === 0) {
  183. this.$message.warning("请选择至少一条数据");
  184. return;
  185. }
  186. this.$confirm("确定将选择数据删除?", {
  187. confirmButtonText: "确定",
  188. cancelButtonText: "取消",
  189. type: "warning"
  190. })
  191. .then(() => {
  192. return remove(this.ids);
  193. })
  194. .then(() => {
  195. this.onLoad(this.page);//刷新表格数据
  196. this.$message({
  197. type: "success",
  198. message: "操作成功!"
  199. });
  200. this.$refs.crud.toggleSelection();
  201. });
  202. },
  203. selectionChange (list) {
  204. this.selectionList = list;
  205. },
  206. selectionClear () {
  207. this.selectionList = [];
  208. this.$refs.crud.toggleSelection();
  209. },
  210. importdata(){
  211. console.log('导入');
  212. this.$refs.importDialog.show()
  213. },
  214. }
  215. }
  216. </script>
  217. <style>
  218. </style>