经济事项申请3

<template>

  <div id="segmentCompany" style="height:540px">

    <el-row :gutter="10" class="formWrap">

      <el-col class="form-item" :span="10">

        <div class="inputLabel">一级经济事项编码</div>

        <el-input :maxlength="20" v-model.trim="searchEconomic.code"></el-input>

      </el-col>

      <el-col class="form-item" :span="10">

        <div class="inputLabel">一级经济事项名称</div>

        <el-input :maxlength="20" v-model.trim="searchEconomic.name"></el-input>

      </el-col>

      <el-col class="form-item" :span="4" style="line-height:50px">

        <el-button type="primary" @click='searchAction()'>查询</el-button>

      </el-col>

    </el-row>

    <el-row>

      <el-table :data="tableData" @select='selectItem' @select-all='selection' height=335 border style="width:100%">

        <el-table-column type="selection" header-align='center' min-width="45">

        </el-table-column>

        <el-table-column label="序号" width="65" align="center" type="index">

        </el-table-column>

        <el-table-column label="一级经济事项编码" prop="code" width=250>

        </el-table-column>

        <el-table-column label="一级经济事项名称" :show-overflow-tooltip='true' prop="name">

        </el-table-column>

      </el-table>

    </el-row>

    <el-row>

      <div class="myPaginationBox">

        <p>共{{ (mainData.total / searchEconomic.pageSize) === 0 ? 0 : Math.ceil(mainData.total / searchEconomic.pageSize) }}页/<b>{{mainData.total}}</b>条数据</p>

        <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :page-sizes="[5, 10, 20,30]" :page-size='searchEconomic.pageSize'

          :current-page="searchEconomic.pageNum" layout="sizes, prev, pager, next, jumper" :total='mainData.total'>

        </el-pagination>

      </div>

    </el-row>

    <el-row class="commonFoot">

      <span>

        <el-button @click='colseAction()'>取 消</el-button>

        <el-button type="primary"  @click='saveAction()'>确 定</el-button>

      </span>

    </el-row>

  </div>

</template>

<style>

  .dialog-footer {

    text-align: center;

    margin-top: 20px;

  }

  .el-dialog el-dialog--small{

    width: 100% !important;

  }

</style>

<script>

  // import Global from '@/js/global.js';

  export default {

    // props: ["segmentId2"],

    data() {

      return {

        URL: "",  //生产环境路径

        //URL: Global.test, //ci环境路径

        //rootURL: "http://10.118.150.100:8080", //后台测试。连接本地

        tableData: [],

        caliberList: [], //存储管理口径的列表

        mainData: [], //保存分页数据

        selections: [],

        searchEconomic: {

          name: '',

          code: '',

          pCode: '',//父节点

          levelNo: 1, //一级经济事项.

          pageNum: 1,

          pageSize: 10,

        }

      }

    },

    //生产环境路径

    created() {

      // debugger

      //this.URL = `${this.$root.loadUrl}/mdm-service`;

      this.URL = `${this.$root.loadUrl}`;

      this.mainData.total = 0;

      this.searchAction();

    },

    mounted() {

      //父组件带值

    },

    methods: {

      //关闭对话框

      colseAction() {

        //console.log('关闭')

        // for (var prop in this.searchEconomic) {

        //  this.searchEconomic[prop] = '';

        // }

        this.$emit('closeEconomic1')

      },

      //查询

      searchAction() {

          this.$http.post(this.URL + '/economicEventsApply/getEconomicInfo', this.searchEconomic).then((res) => {

              var result = res.body;

              if (result.code == '000000') {

                this.tableData = result.data.list;

                this.mainData = result.data;

              }

          })

      },

      //保存

      saveAction() {

        if (this.selections.length == 0) {

          this.$message({ type: 'info', message: '请选择数据再保存' });

          return;

        } else if (this.selections.length > 1) {

          this.$message({ type: 'info', message: '仅可选择一条数据进行保存' });

          return;

        } else {

          this.searchEconomic.name = this.selections[0].name;

          this.searchEconomic.code = this.selections[0].code;

          this.searchEconomic.id = this.selections[0].id;

          this.searchEconomic.tag = this.selections[0].tag;

          this.$emit('saveEconomicData1', this.searchEconomic)

        }

      },

      //table框选择

      selectItem(selections) {

        this.selections = selections;

      },

      //多选

      selection(selections) {

        this.selections = selections;

      },

      //当前页数

      handleCurrentChange(currentPage) {

        this.searchEconomic.pageNum = currentPage;

        this.searchAction();

      },

      //当前每页条数

      handleSizeChange(pageSize) {

        this.searchEconomic.pageSize = pageSize;

        this.searchAction();

      }

    }

  }

</script>

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容