经济事项5

<template>

    <div id="SupplierCode">

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

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

                <div class="inputLabel">业务段编码</div>

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

            </el-col>

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

                <div class="inputLabel">业务段名称</div>

                <el-input  :maxlength="20"  v-model.trim="searchCode.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-all='selectItem' @select='selectItem' 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="60" align="center" type="index"></el-table-column>

                <el-table-column label="业务段编码" prop="code" show-overflow-tooltip></el-table-column>

                <el-table-column label="业务段名称" prop="name" show-overflow-tooltip></el-table-column>       

            </el-table>

        </el-row>

        <el-row>

            <div class="myPaginationBox">

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

               <el-pagination

                    @size-change="handleCurrentSizeChange"

                    @current-change="handleCurrentChange"

                    :page-sizes="[5, 10, 20,30]"

                    :page-size='searchCode.pageSize'

                   :current-page = "searchCode.pageNum"

                    layout="sizes, prev, pager, next, jumper"

                    :total='mainData.total'>

                </el-pagination>

            </div>

        </el-row>

        <el-row class="commonFoot">

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

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

        </el-row>

    </div>

</template>

<style >

</style>

<script>

import { tipMsg, justOne } from '../../js/common.js'

export default{


  props:["sendSegment"],

    data(){

        return{

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

          tableData: [],

           mainData: {total:0}, //保存总数据

          selections:[],

           searchCode:{

            name: '', //供应商名称

            code: '', //供应商编码

            status: 1,  //查询有效数据

            pageSize:10,

            pageNum:1,

            segmentType:"SEGMENT2"

          }

        }

    },

    //生产环境路径

   created() {

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


    },

    mounted(){

      this.searchCode.ledgerCode = this.sendSegment.ledger;

        this.searchAction();

    },

    methods:{

        //取消关闭

        colseAction(){

           this.searchCode = {

                name: '',

                code: '',

                status:1,

                pageSize:10,

                pageNum:1,

                segmentType:"SEGMENT2"

           };

           this.$emit('closed1')

        },

        //查询

        searchAction(){

           this.$Http.post(this.URL + "/treeNode/findSegmentByCondition", this.searchCode).then((res) => {

                var result = res.body;

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

                    this.tableData = result.data.list;

                    this.mainData = result.data;

                }else{

                    tipMsg(result.message, "error");

                }

          });

        },

        //保存

        saveAction(){

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

                this.searchCode.code = this.selections[0].code

                this.searchCode.name = this.selections[0].name

                this.searchCode.id = this.selections[0].id

                this.$emit('saveData1', this.searchCode)

               this.searchCode = {

                    name: '',

                    code: '',

                    detailed:0,

                    status: 1,

                    pageSize:10,

                    pageNum:1

                }

            }else{

                tipMsg('请选择一条数据进行操作', "warning");

            }

        },

        //table框选择

       selectItem(selections){

            this.selections = selections ;

        },

        //当前页数

        handleCurrentChange(pageNum){

           this.searchCode.pageNum = pageNum;

           this.searchAction()

        },

        //当前每页条数

        handleCurrentSizeChange(pageSize){

           this.searchCode.pageSize = pageSize;

           this.searchAction()

        }     

    }

}


</script>

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

推荐阅读更多精彩内容