<template> <div class="currentPage"> <el-form :model="vpbsSeal" ref="vpbsSealForm" label-width="150px" label-position="right" label-suffix=":" size="small"> <c-row> <c-col :span="11"> <el-form-item label="签章类型" prop="vptype"> <c-select v-model="vpbsSeal.vptype" placeholder="请选择签章类型" @change="changeVptype(vpbsSeal.vptype)" dbCode="VPTYPE"> </c-select> </el-form-item> </c-col> </c-row> <div class="text-center"> <c-button type="primary" icon="el-icon-search" :loading="false" style="margin-right:50px;margin-bottom:25px" @click="onSearch()"> 查询 </c-button> </div> <div style="height:40px;margin-top:-20px;"> <c-button type="primary" size="mini" @click="handleAdd()">新增</c-button> </div> </el-form> <c-col :span="24"> <c-table :list="vpbsList" :columnsConfig="vpbsInfoColumns" :border="true"> </c-table> </c-col> <c-paging-table :data="tableData" ref="vpbsSealTableRef" :pageSize="vpbsSeal.pageSize" :pageNumber="vpbsSeal.pageNum" :total="vpbsSeal.total" @queryFunc="queryFunc" :border="true"> <el-table-column label="签章类型" prop="vptype" min-width="20%"> <template slot-scope="scope">{{scope.row.vptype}}</template> </el-table-column> <el-table-column label="签章机构" prop="branch" min-width="20%"> <template slot-scope="scope">{{scope.row.branch}}</template> </el-table-column> <el-table-column label="签章机构名称" prop="bchnam" min-width="20%"> <template slot-scope="scope">{{ scope.row.bchnam }}</template> </el-table-column> <el-table-column label="关键字" prop="keyword" min-width="15%"> <template slot-scope="scope">{{ scope.row.keyword }}</template> </el-table-column> <el-table-column label="操作" min-width="25%"> <template slot-scope="scope"> <el-button @click="handleAmend(scope.row)" type="primary" size="mini">修改</el-button> <el-button @click="handleDelete(scope.row.inr)" type="danger" size="mini">删除</el-button> </template> </el-table-column> </c-paging-table> <el-dialog :visible.sync="DialogFormVisible" :title=DialogFormTitle :modal-append-to-body="false" :lock-scroll="false" :show-close="false" :close-on-click-modal="false" :close-on-press-escape="false" v-dialogDrag > <el-form ref="vpbsCfgDialogForm" :model="vpbsCfgForm" label-width="120px" label-position="right" label-suffix=":" :rules="rules"> <el-row style="margin-top:20px;"> <el-col :span="10" class="rightLayoutDialog"> <el-form-item label="签章类型" prop="vptype"> <c-select v-model="vpbsCfgForm.vptype" :disabled="DialogFieldDisable" @change="handleChange" dbCode="VPTYPE"> </c-select> </el-form-item> </el-col> <el-col :span="10" class="leftLayout"> <el-form-item label="签章机构" prop="branch"> <el-input event-render="loadText" type="text" v-model="vpbsCfgForm.branch" :disabled="DialogFieldDisable" maxlength="40"></el-input> </el-form-item> </el-col> </el-row> <el-row> <el-col :span="10" class="leftLayout"> <el-form-item label="签章机构名称" prop="bchnam"> <el-input event-render="loadText" type="text" v-model="vpbsCfgForm.bchnam" :disabled="DialogFieldDisable" maxlength="40"></el-input> </el-form-item> </el-col> <el-col :span="10" class="leftLayout"> <el-form-item label="关键字" prop="keyword"> <el-input event-render="loadText" type="text" v-model="vpbsCfgForm.keyword" :disabled="DialogFieldDisable" maxlength="20"></el-input> </el-form-item> </el-col> </el-row> </el-form> <div slot="footer" class="dialog-footer"> <el-button @click="handleCancel">取 消</el-button> <el-button type="primary" @click="handleSubmit" v-show="DialogSubBtnVisible" :loading="loadingStatus">确 定</el-button> </div> </el-dialog> </div> </template> <script> import DeptModel, { Pattern } from "./DeptModel.js"; import Utils from "~/utils"; import { queryVpbsCfgByPage, saveVpbsCfg, deleteVpbsCfg, getBchInfo } from "~/service/manage/dept.js"; import { cloneDeep } from 'lodash'; export default { name: "", props: { orgBranch:String, }, data() { return { rules: Pattern, tableData: null, vpbsSeal: new DeptModel().data.vpbsSeal, vpbsCfgForm: new DeptModel().data.vpbsSeal, DialogFormVisible:false, DialogFieldDisable:true, DialogFormTitle:'新增无纸化签章配置', DialogSubBtnVisible:true, deleteVpbsInr:null, loadingStatus:false, vptypelist:[ {vptype: "vp14", vptypeDsp: "电子凭证加盖电子签章" }, ] } }, created() { }, watch:{ // 会出现父组件传真,子组件更新不及时的情况 orgBranch:{ handler:function(newValue,oldValue){ if(newValue != '' && newValue != null && newValue != 'undefined'){ this.onSearch(); } }, // 强制立即执行回调 immediate:true } }, components: { }, methods: { changeVptype(vptype){ }, onSearch() { this.vpbsSeal.branch = this.orgBranch; queryVpbsCfgByPage(this.vpbsSeal).then((res) => { this.tableData = res.data.list; this.vpbsSeal.total = res.data.total; this.vpbsSeal.pageNum = res.data.pageNumber; this.vpbsSeal.pageSize = res.data.pageSize; }) }, queryFunc(pageNumber, pageSize) { this.vpbsSeal.pageNum = pageNumber; this.vpbsSeal.pageSize = pageSize; this.onSearch() }, // 【新增】按钮 handleAdd(){ // 选中节点后操作 if(!(this.orgBranch != '' && this.orgBranch != null)){ this.$message({message: '请选中具体分行、支行再操作!',center: true,type: 'warning'}); return; } getBchInfo(this.orgBranch).then((res)=>{ if(res.respCode == "AAAAAA"){ var bch = res.data; if(bch == null){ this.$message({message: '请先在【国结机构信息】页签中新增该机构信息!',center: true,type: 'warning'}); return; } if(bch.lev == "0" || bch.lev == "A" || bch.lev == "B"){ this.$message({message: '请选中具体的分行、支行再操作!',center: true,type: 'warning'}); return; } this.DialogFieldDisable = false; this.DialogFormVisible = true; this.DialogSubBtnVisible = true; this.DialogFormTitle = '新增无纸化签章配置'; } else { this.$notify.error("获取机构号:["+this.orgBranch+"]机构信息失败!"); return; } }).catch((res)=>{ this.$notify.error("获取机构号:["+this.orgBranch+"]机构信息失败!"); }); }, // 【修改】按钮 handleAmend(row){ this.DialogFormVisible = true; this.DialogFieldDisable = false; this.DialogSubBtnVisible = true; this.DialogFormTitle = '修改无纸化签章配置'; this.vpbsCfgForm = row; }, // 【确定】按钮 handleSubmit(){ this.$refs.vpbsCfgDialogForm.validate((validated) => { if(validated){ this.loadingStatus = true; this.vpbsCfgForm.branch = this.orgBranch; saveVpbsCfg(this.vpbsCfgForm).then((res)=>{ this.$notify.success("保存成功!"); // 关闭弹框 this.handleCancel(); // 刷新列表 this.onSearch(); this.loadingStatus = false; }).catch((err)=>{ this.loadingStatus = false; this.$notify.error("保存失败!"); }); } else { Utils.formValidateTips(this.$refs.vpbsCfgDialog.fields) } }) }, // 【取消】按钮 handleCancel(){ // 关闭弹框 this.DialogFormVisible = false; this.vpbsCfgForm.inr = ''; this.vpbsCfgForm.ver = ''; this.vpbsCfgForm.vptype = ''; this.vpbsCfgForm.branch = ''; this.vpbsCfgForm.bchnam = ''; this.vpbsCfgForm.keyword = ''; this.$refs['vpbsCfgDialogForm'].resetFields(); }, // 【删除】按钮 handleDelete(inr){ this.deleteVpbsInr = inr; this.$confirm("是否确认删除?", "提示", { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning", }).then(()=>{ this.vpbsCfgForm.inr = this.deleteVpbsInr; deleteVpbsCfg(this.vpbsCfgForm).then((res)=>{ this.$notify.success("删除成功!"); this.deleteVpbsInr = null; // 刷新列表 this.onSerach(); }).catch((err)=>{ this.$notify.error("删除失败!"); }); }).catch(() => { this.$message({ type: "info", message: "已取消删除", }); }); }, // 强制更新 handleChange(){ this.$forceUpdate(); } } } </script> <style lang="less" scoped> .currentPage{ .el-table--enable-row-hover .el-table__body tr:hover>td{ background-color: #c694dc !important; } } </style>