<template>
? <div id="segmentCompany" style="height:540px">
? ? <el-row :gutter="10" class="formWrap">
? ? ? <el-col class="form-item" :span="10">
? ? ? ? <div class="inputLabel">一級經(jīng)濟(jì)事項(xiàng)編碼</div>
? ? ? ? <el-input :maxlength="20" v-model.trim="searchEconomic.code"></el-input>
? ? ? </el-col>
? ? ? <el-col class="form-item" :span="10">
? ? ? ? <div class="inputLabel">一級經(jīng)濟(jì)事項(xiàng)名稱</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="一級經(jīng)濟(jì)事項(xiàng)編碼" prop="code" width=250>
? ? ? ? </el-table-column>
? ? ? ? <el-table-column label="一級經(jīng)濟(jì)事項(xiàng)名稱" :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>條數(shù)據(jù)</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: "",? //生產(chǎn)環(huán)境路徑
? ? ? ? //URL: Global.test, //ci環(huán)境路徑
? ? ? ? //rootURL: "http://10.118.150.100:8080", //后臺測試。連接本地
? ? ? ? tableData: [],
? ? ? ? caliberList: [], //存儲管理口徑的列表
? ? ? ? mainData: [], //保存分頁數(shù)據(jù)
? ? ? ? selections: [],
? ? ? ? searchEconomic: {
? ? ? ? ? name: '',
? ? ? ? ? code: '',
? ? ? ? ? pCode: '',//父節(jié)點(diǎn)
? ? ? ? ? levelNo: 1, //一級經(jīng)濟(jì)事項(xiàng).
? ? ? ? ? pageNum: 1,
? ? ? ? ? pageSize: 10,
? ? ? ? }
? ? ? }
? ? },
? ? //生產(chǎn)環(huán)境路徑
? ? created() {
? ? ? // debugger
? ? ? //this.URL = `${this.$root.loadUrl}/mdm-service`;
? ? ? this.URL = `${this.$root.loadUrl}`;
? ? ? this.mainData.total = 0;
? ? ? this.searchAction();
? ? },
? ? mounted() {
? ? ? //父組件帶值
? ? },
? ? methods: {
? ? ? //關(guān)閉對話框
? ? ? colseAction() {
? ? ? ? //console.log('關(guān)閉')
? ? ? ? // 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: '請選擇數(shù)據(jù)再保存' });
? ? ? ? ? return;
? ? ? ? } else if (this.selections.length > 1) {
? ? ? ? ? this.$message({ type: 'info', message: '僅可選擇一條數(shù)據(jù)進(jìn)行保存' });
? ? ? ? ? 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;
? ? ? },
? ? ? //當(dāng)前頁數(shù)
? ? ? handleCurrentChange(currentPage) {
? ? ? ? this.searchEconomic.pageNum = currentPage;
? ? ? ? this.searchAction();
? ? ? },
? ? ? //當(dāng)前每頁條數(shù)
? ? ? handleSizeChange(pageSize) {
? ? ? ? this.searchEconomic.pageSize = pageSize;
? ? ? ? this.searchAction();
? ? ? }
? ? }
? }
</script>