123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- <template>
- <basic-container>
- <div class="h-100p">
- <el-tabs v-model="activeName" @tab-click="handleClick">
- <el-tab-pane label="压实度评标参数" name="first">
- <avue-crud
- :before-open="beforeOpen"
- :table-loading="loading"
- :data="tableData"
- :option="option"
- v-model="form"
- @row-save="rowSave"
- @row-update="rowUpdate"
- @selection-change="selectionChange"
- @refresh-change="refreshChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @on-load="onLoad"
- :page.sync="page"
- ref="crud"
- >
- <template slot="menuRight">
- <el-button
- type="danger"
- size="small"
- icon="el-icon-delete"
- plain
- @click="handleDelete">删除
- </el-button>
- <el-button
- size="small"
- type="primary"
- plain
- icon="el-icon-plus"
- @click="importdata"
- >导入
- </el-button>
- </template>
- </avue-crud>
- </el-tab-pane>
- <el-tab-pane label="温度及密度参数" name="second">
- <temperature/>
- </el-tab-pane>
- </el-tabs>
- </div>
- <!-- 导入参数弹窗 -->
- <importDialog ref="importDialog" @paramLoad="onLoad" :importDialogType="importDialogType" :parmpage="page" />
- </basic-container>
-
- </template>
- <script>
- import importDialog from './importDialog.vue';
- import temperature from './temperature.vue';
- import {getList,add, update, remove,getDetail} from "@/api/tentative/testpram";
- export default {
- components:{
- importDialog,
- temperature
- },
- data() {
- return {
- activeName: 'first',
- importDialogType:1,
- page: {
- pageSize: 20,
- currentPage:1
- },
- loading:false,
- tableData: [],
- selectionList:[],
- query:{},
- form:{},
- option:{
- height: 'auto',
- calcHeight: 30,
- tip: false,
- searchShow:false,
- searchMenuSpan: 6,
- border: true,
- index: true,
- viewBtn: false,
- selection: true,
- editBtn:true,
- delBtn:false,
- addBtn:true,
- menu:true,
- labelWidth:150,
- indexFixed:false,
- selectionFixed:false,
- expandFixed:false,
- dialogClickModal: false,
- column:[
- {
- label:'N值',
- prop:'valueN'
- }, {
- label:'保证率99%',
- prop:'assuranceRateNinetyNinePercent'
- },{
- label:'保证率95%',
- prop:'assuranceRateNinetyFivePercent'
- },{
- label:'保证率90%',
- prop:'assuranceRateNinetyPercent'
- }
- ]
- },
- };
- },
- computed:{
- ids () {
- let ids = [];
- this.selectionList.forEach(ele => {
- ids.push(ele.id);
- });
- return ids.join(",");
- }
- },
- methods: {
- onLoad(page, params = {}) {
- this.loading = true;
- getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
- const data = res.data.data;
- this.page.total = data.total;
- this.tableData = data.records;
- this.loading = false;
- this.selectionClear();
- });
- },
- refreshChange() {
- this.onLoad(this.page, this.query);
- },
- sizeChange(pageSize) {
- this.page.pageSize = pageSize;
- },
- currentChange(currentPage) {
- this.page.currentPage = currentPage;
- },
- handleClick(tab, event) {
- console.log(tab, event);
- },
- rowSave (row, done, loading) {
- console.log(row,'row');
- add(row).then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- done();
- }, error => {
- loading();
- window.console.log(error);
- });
- },
- rowUpdate(row, index, done, loading) {
- update(row).then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- done();
- }, error => {
- loading();
- console.log(error);
- });
- },
- beforeOpen(done, type) {
- if (["edit", "view"].includes(type)) {
- getDetail(this.form.id).then(res => {
- this.form = res.data.data;
- });
- }
- done();
- },
- handleDelete () {
- if (this.selectionList.length === 0) {
- this.$message.warning("请选择至少一条数据");
- return;
- }
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- return remove(this.ids);
-
- })
- .then(() => {
- this.onLoad(this.page);//刷新表格数据
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.$refs.crud.toggleSelection();
- });
- },
- selectionChange (list) {
- this.selectionList = list;
- },
- selectionClear () {
- this.selectionList = [];
- this.$refs.crud.toggleSelection();
- },
- importdata(){
- console.log('导入');
- this.$refs.importDialog.show()
- },
-
-
-
- }
- }
- </script>
- <style>
- </style>
|