一、最初的修改页面

<el-dialog        title="修改"        :visible.sync="updateVisible"        v-if="updateVisible"        width="65%"><bill-batch-update-tabs ref="billBatchUpdateTabs" @refreshTable="refreshTable"                            @closeDialog="updateVisible = false"                            :data="row"></bill-batch-update-tabs></el-dialog>

二、创建 tabs 页面

<template> <el-tabs v-model="activeName"> 这里是两个tabs显示页面 ,可以进行自行添加

        <el-tab-pane label="票据批次信息" name="first">            <bill-batch-update ref="billBatchUpdate" @refreshTable="refresh"                               @closeDialog="closeDialog"                               :data="data"></bill-batch-update>        </el-tab-pane>

        <el-tab-pane label="票据列表" name="second">            <bill-member-batch-list :batchNo="batchNo" :billTotalAmt="billTotalAmt" :actAmt="actAmt" :intAmt="intAmt" flag="updateMember"></bill-member-batch-list>        </el-tab-pane>

    </el-tabs></template>

<script>

    import billMemberBatchList from "~/views/biz/billMember/billMemberBatchList";    import billBatchUpdate from "./billBatchUpdate";

    export default {        name: "billBatchUpdateTabs",        components: {billBatchUpdate, billMemberBatchList},        props: {            data: Object,        },        data() {            return {                activeName: 'first',                batchNo: this.data.batchNo,                billTotalAmt: this.data.billTotalAmt,                actAmt: this.data.actAmt,                intAmt: this.data.intAmt,            }        },        methods: {            tabsDialogOnSubmit(dialog) {                this.$refs[dialog].onSubmit();            },            closeDialog() {                this.$emit('closeDialog')            },            refresh() {                this.$emit('refreshTable')            }        }    }</script>

三、分别进行页面的书写
<template>    <div>        <el-card class="box-card" shadow="never">            <el-form ref="searchParams" :model="searchParams" label-width="100px" :prop="searchParams">                <el-row type="flex" class="row-bg" justify="start">                    <el-col :span="8" :offset="1">                        <el-form-item label="批次号" prop="batchNo">                            <el-input type="text" v-model="searchParams.batchNo" size="small"></el-input>                        </el-form-item>                    </el-col>                    <el-col :span="8" :offset="1">                        <el-form-item label="汇票总金额" prop="billTotalAmt">                            <el-input type="text" v-model="searchParams.billTotalAmt" size="small"></el-input>                        </el-form-item>                    </el-col>                </el-row>                <el-row type="flex" class="row-bg" justify="start">                    <el-col :span="8" :offset="1">                        <el-form-item label="实付总金额" prop="actAmt">                            <el-input type="text" v-model="searchParams.actAmt" size="small"></el-input>                        </el-form-item>                    </el-col>                    <el-col :span="8" :offset="1">                        <el-form-item label="利息总金额" prop="intAmt">                            <el-input type="text" v-model="searchParams.intAmt" size="small"></el-input>                        </el-form-item>                    </el-col>                </el-row>            </el-form>        </el-card>        <el-card class="box-card" shadow="never">            <el-row type="flex" class="row-bg" justify="start" style="padding-bottom: 10px">                <!-- 业务申请页面需要的按钮 -->                <el-button v-if="isInto" size="mini" type="success" icon="el-icon-view"                           @click="intoVisible = true">引入批次                </el-button>                <el-button v-if="isAdd" size="mini" type="success" icon="el-icon-plus" @click="addBillMemberBatchData">                    新增                </el-button>                <el-button v-if="isDelete" size="mini" type="danger" icon="el-icon-delete"                           @click="delBillMemberBatchData">删除                </el-button>                <el-button v-if="isUpdate" size="mini" type="warning" icon="el-icon-edit"                           @click="updatebillMemberBatchData">修改                </el-button>                <el-button size="mini" type="primary" icon="el-icon-view" @click="viewBillMemberBatchData">查看                </el-button>            </el-row>            <elx-table ref="table"                       :url="url"                       :columns="columns"                       :initParams="initParams"                       :searchParams="searchParams"                       :checkbox="false"            >            </elx-table>            <el-dialog                    title="用户信息选择"                    :visible.sync="intoVisible"                    v-if="intoVisible"                    append-to-body                    width="60%"                    :close-on-click-modal="false"                    v-drag>                <bill-batch-list ref="billMemberBatchAdd" @refreshTable="search"                                 @closeDialog="intoVisible = false"></bill-batch-list>            </el-dialog>            <el-dialog                    title="新增"                    :visible.sync="addVisible"                    v-if="addVisible"                    append-to-body                    width="60%"                    :close-on-click-modal="false"                    v-drag>                <bill-member-batch-add ref="billMemberBatchAdd" @refreshTable="search"                                       @closeDialog="addVisible = false" :batchNo="batchNo"></bill-member-batch-add>            </el-dialog>            <el-dialog                    title="新增票据批次信息"                    :visible.sync="addLoanVisible"                    v-if="addLoanVisible"                    append-to-body                    width="60%"                    :close-on-click-modal="false"                    v-drag>                <bill-batch-add ref="billMemberLoanAdd" @refreshTable="search"                                @closeDialog="addLoanVisible = false" :applyInfo="applyInfo"></bill-batch-add>            </el-dialog>            <el-dialog                    title="修改"                    :visible.sync="updateVisible"                    v-if="updateVisible"                    append-to-body                    width="65%">                <bill-member-batch-update-tabs ref="billMemberBatchUpdateTabs" @refreshTable="refresh" @closeDialog="updateVisible = false" :billIncome="billIncome"                                               :billIncomeList="billIncomeList"></bill-member-batch-update-tabs>            </el-dialog>            <el-dialog                    title="查看"                    :visible.sync="viewVisible"                    v-if="viewVisible"                    append-to-body                    width="60%">                <bill-member-batch-view-tabs @closeDialog="viewVisible = false"                                             :data="row"></bill-member-batch-view-tabs>            </el-dialog>        </el-card>    </div></template>

<script>    import billMemberBatchAdd from "~/views/biz/billMember/billMemberBatchAdd";    import billMemberBatchUpdateTabs from "~/views/biz/billMember/billMemberBatchUpdateTabs";    import billMemberBatchViewTabs from "~/views/biz/billMember/billMemberBatchViewTabs";    import BillBatchAdd from "~/views/biz/bill/billBatchAdd";    import BillBatchList from "~/views/biz/bill/billBatchList";

    export default {        name: "billMemberBatchList",        components: {            BillBatchList,            BillBatchAdd,            billMemberBatchAdd,            billMemberBatchUpdateTabs,            billMemberBatchViewTabs        },        props: {            batchNo: String,            billTotalAmt: String,            actAmt: String,            intAmt: String,            flag: String,

            //业务申请页面传过来的数据            operate: String,            applyInfo: Object,            //合同页面传过来的数据            params: Object,        },        created() {            if (this.flag === "apply") {                this.initParams = {"applyNo": this.applyInfo.applyNo};                this.url = "/loan/billBatchAction.do?_md=selectBillDetailByApplyNo";                const _this = this;                this.$http.post("/loan/billBatchAction.do?_md=selectBillBatchByApplyNo",                    {"applyNo": this.applyInfo.applyNo}).then(response => {                    if (response.data) {                        _this.isInto = false;                        _this.isAdd = false;                        _this.predDiscDate = response.data.predDiscDate;                        _this.applyBatchNo = response.data.batchNo;                    }                });            } else if (this.flag === "cont") {                this.initParams = {"contNo": this.params.contNo};                this.url = "/loan/billBatchAction.do?_md=selectBillDetailByContNo";                const _this = this;                this.$http.post("/loan/billBatchAction.do?_md=selectBillBatchByContNo",                    {"contNo": this.params.contNo}).then(response => {                    if (response.data) {                        _this.isInto = false;                        _this.isAdd = false;                        _this.isUpdate = false;                        _this.predDiscDate = response.data.predDiscDate;                        _this.applyBatchNo = response.data.batchNo;                    }                });            } else {                this.isInto = false;                this.url = "/loan/billDetailAction.do?_md=selectBillDetailByBatchNo";            }        },        data() {            return {                //业务申请所需变量                isInto: true,                isAdd: true,                isUpdate: true,                isDelete: true,                addLoanVisible: false,

                url: "",                addUrl: "/loan/billDetailAction.do?_md=insertBillDetail",                intoVisible: false,                addVisible: false,                deleteVisible: false,                updateVisible: false,                viewVisible: false,                billIncome: {},                initParams: {},                billIncomeList: {},                row: {},                searchParams: {                    batchNo: this.batchNo, billTotalAmt: this.billTotalAmt, actAmt: this.actAmt, intAmt: this.intAmt                },                columns: [{                    prop: "billNo",                    label: "票据号"                }, {                    prop: "billType",                    label: "票据种类",                    selectKey: 'STD_DRFT_TYPE'                }, {                    prop: "ccy",                    label: "币种",                    selectKey: 'STD_ZX_CUR_TYPE'                }, {                    prop: "billAmt",                    label: "票面金额"                }, {                    prop: "signAddr",                    label: "汇票签发地",                    selectKey: 'STD_ZB_DRFT_ADDR'                }, {                    prop: "oppBankName",                    label: "是否电子汇票",                    selectKey: 'STD_ZX_YES_NO'                }, {                    prop: "billIssueDate",                    label: "出票日期"                }, {                    prop: "billEndDate",                    label: "票据到期日期",                    selectKey: 'STD_ZB_GROUP_TYPE'                }, {                    prop: "payee",                    label: "收款人名称"                }, {                    prop: "sts",                    label: "票据状态",                    selectKey: 'STD_ZB_DRFT_STATUS'                }],            }        },        methods: {            getSelectRows() {                return this.$refs.table.getSelectedRows();            },            search() {                this.$refs.table.search();            },            resetForm() {                this.$refs.searchParams.resetFields();            },            refresh() {                this.$refs.table.refresh();            },            addBillMemberBatchData() {                if (this.flag === "apply") {                    this.addLoanVisible = true                } else {                    this.addVisible = true                }            },            delBillMemberBatchData() {                const rows = this.getSelectRows();                const _this = this;                if (rows.length !== 1) {                    this.$error("请选择一行数据");                    return;                }                const billNo = rows[0].billNo;                this.$http.post("/loan/billDetailAction.do?_md=deleteBillDetailByPrimaryKey",                    {"billNo": billNo}).then(function (response) {                    if (response.success) {                        _this.$success(response.msg);                        _this.$refs.table.refresh();                    }                }).catch(function (error) {                    _this.$error(error.message);                })            },            updatebillMemberBatchData() {                const rows = this.getSelectRows();                if (rows.length !== 1) {                    this.$error("请选择一行数据");                    return;                }                this.billIncomeList = {...rows[0]};

                this.$http.post("/loan/billIncomeAction.do?_md=selectBillIncomeByPrimaryKey", {"billNo": this.billIncomeList.billNo}).then((response) => {                    if (response.success) {                        this.billIncome = response.data;                        // this.row = rows;                        this.updateVisible = true;                    } else {                        this.$error(response.msg);                    }                }).catch((error) => {                    this.$error(error.message);                });            },            viewBillMemberBatchData() {                const rows = this.getSelectRows();                const _this = this;                if (rows.length !== 1) {                    _this.$error("请选择一行数据");                } else {                    _this.row = {...rows[0]};                    _this.viewVisible = true;                }            },            dialogOnSubmit(dialog) {                this.$refs[dialog].onSubmit();            }        }    }</script>

转载于:https://www.cnblogs.com/yangzhu/p/9578739.html

2018-9-3-vue的tabs表单代码的思考相关推荐

  1. 【15】Vue:02-Vue表单基本操作、表单修饰符、自定义指令、计算属性computed、侦听器watch、过滤器、生命周期、数组变异方法、替换数组、动态数组响应数据、图书列表案例、TODOS案例

    文章目录 day02 Vue常用特性 表单基本操作 表单修饰符 自定义指令 Vue.directive 注册全局指令 Vue.directive 注册全局指令 带参数 自定义指令局部指令 计算属性 c ...

  2. vue的form表单在提交成功后置空

    vue的form表单在提交成功后置空 form表单 说明 :form表单加上属性值 ref="form" 点击事件加入 roleManager.$refs['form'].rese ...

  3. vue.js 表格表单序号

    vue.js 表格表单序号 表格是动态的,通过v-for="(item,index) in sites" 循环出来的表格 ,通过index属性,实现表格序号自增, 结合页码和每页数 ...

  4. Vue @submit From表单提交

    初学vue,from表单的操作官方提供了v-model双向绑定,这个功能强大,在data中列出所有表单字段,提交表单时我们只需用this.field就可以获取到表单中所有的数据.看似方便,但是日常开发 ...

  5. Vue.js 提交表单

    QQ:285679784   欢迎加入博主CSDN资源QQ群799473954(附加信息:CSDN博客)一起学习 ! <!DOCTYPE html> <html> <he ...

  6. 基于vue的动态表单自助建站工具

    基于vue的动态表单自助建站工具 根据自己需求自助搭建移动端营销.投放.信息采集.推广.宣传等页面 主要用到的技术如下: "element-ui": "^2.4.5&qu ...

  7. vue + element 自定义表单验证的时候 需要通过请求后端接口验证

    vue + element 自定义表单验证的时候 需要通过请求后端接口验证 做vue项目的时候遇到了一个需求,在验证某个表单项时不仅需要是必填项而且要去通过接口校验是否有重复值. // templat ...

  8. vue 给form表单赋值_vue获取form表单的值示例

    vue获取form表单的值示例 这里使用的是Element-ui组件 html: JS: var phone = this.phone; var password = this.password; v ...

  9. vue+element ui表单校验(邮箱、电话、工商信息)

    vue+element ui表单校验(邮箱.电话.工商信息)) Html部分 <template><div><el-steps :active="active& ...

最新文章

  1. Redis系列(七):缓存只是读写回种这么简单吗?如果是,那么请你一定看看这篇文章!...
  2. linux内核中等待队列
  3. 震撼!豆瓣评分9.3,这部纪录片带你感受生命之重!
  4. 假设以邻接矩阵作为图的存储结构_图的存储
  5. 计算机教学理论研究,计算机辅助教学理论实践研究.doc
  6. ubuntu12.04 安装 php5.4/php5.5
  7. Python中lambda表达式的常见用法
  8. 席位分配:惯例Q值法,dhondt法matlab实现
  9. NLP-自然语言处理
  10. [人工智能-深度学习-65]:环境搭建 - Nvidia最新显卡性能排名
  11. 【读书笔记】《Web全栈工程师的自我修养》
  12. python地图制作 - pyecharts(1.9.1)绘制各城市地图
  13. 郭霖的LitePal版本历程
  14. Attempt to invoke virtual method ‘void cn.jiguang.share.android.api.AbsPlatform.notifyError
  15. JavaScript的字符串去空格
  16. 2008年6月it公司红黑榜/口碑榜
  17. AI识别抑郁症正确率高达八成,但AI+精神健康还有很长的路要走
  18. Apache Log4j Server 反序列化漏洞(CVE-2017-5645)
  19. Facebook商业模式分析
  20. 王俊杰:苏宁AI在智慧零售上的应用

热门文章

  1. 整理的一篇iOS面试题大全
  2. QT界面完成录音与播放功能以及环境配置
  3. 无法解析的外部符号 “public: static void __cdecl std::_String_base::_Xran(void)“
  4. 江苏省计算机一级考试题型分数,全国计算机一级考试时间、题型、分值
  5. 计算机进位制转换方法,计算机进位数制及其转换方法和技巧
  6. 三维卷轴扭曲变形照片墙AE脚本:Transformer 2 mac版
  7. win7 pptp服务器未响应,win7系统ppTp Vpn未连接的具体方案
  8. ai怎么渐变颜色_AI里面怎么弄渐变色,哪位高手指点下啊?
  9. can和could的用法_情态动词can和could的用法及例句
  10. 华为手机锁屏下拉怎么设置_华为手机怎么设置会滚动的锁屏文字?设置步骤超简单,一看就会...