<template> <div> <el-form :model="hyfcfgInfo" ref="hyfcfgForm" label-width="150px" label-position="right" label-suffix=":" size="small" :rules="rules"> <c-row> <c-col :span="22"> <c-form-item> <p>境内运费外汇支付业务自动处理失败时,维护需要提示的用户!</p> </c-form-item> </c-col> </c-row> <c-row> <c-col :span="10"> <c-form-item label="经办机构号" :rules="[{required: 'Y' == 'Y'}]"> <c-select v-model="hyfcfgInfo.branch" style="width:100%" placeholder="请选择经办机构号" @change="getUsrInfo(hyfcfgInfo.branch)" :disabled="branchList.length == 0 || branchList.length == 1"> <el-option v-for="item in branchList" :key="item.value" :label="item.label" :value="item.value"> </el-option> </c-select> </c-form-item> </c-col> </c-row> <c-row> <c-col :span="10"> <c-form-item label="当前用户号01"> <c-input event-render="loadText" v-model="hyfcfgInfo.extkeyori" type="text" :disabled="true"> </c-input> </c-form-item> </c-col> <c-col :span="10"> <c-form-item label="修改用户号01" prop="extkeynew"> <c-input event-render="loadText" v-model="hyfcfgInfo.extkeynew" type="text" maxlength="8" :disabled="hyfcfgInfo.sel01 != '1'"> </c-input> </c-form-item> </c-col> <c-col :span="2"> <el-form-item prop="sel01" class="checkbox-left" style="margin-left:-130px;"> <c-checkbox v-model="hyfcfgInfo.sel01" true-label="1" false-label="0"> </c-checkbox> </el-form-item> </c-col> </c-row> <c-row> <c-col :span="10"> <c-form-item label="当前用户号02" prop="extkeyori02"> <c-input event-render="loadText" v-model="hyfcfgInfo.extkeyori02" type="text" :disabled="true"> </c-input> </c-form-item> </c-col> <c-col :span="10"> <c-form-item label="修改用户号02" prop="extkeynew02"> <c-input event-render="loadText" v-model="hyfcfgInfo.extkeynew02" type="text" maxlength="8" :disabled="hyfcfgInfo.sel02 != '1'"> </c-input> </c-form-item> </c-col> <c-col :span="2"> <el-form-item prop="sel02" class="checkbox-left" style="margin-left:-130px;"> <c-checkbox v-model="hyfcfgInfo.sel02" true-label="1" false-label="0"> </c-checkbox> </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="submitForm()"> 修改 </c-button> </div> </el-form> </div> </template> <script> import DeptModel, { Pattern } from "./DeptModel.js"; import { updateHyfcfg, listBch, getHyfcfgInfo } from "~/service/manage/dept.js"; import Utils from "~/utils"; export default { data() { return { rules: Pattern, hyfcfgInfo: new DeptModel().data.hyfcfg, branchList: [], } }, mounted() { this.getBchList(); this.getDirectUsrInfo(); }, methods: { //【提交】按钮 submitForm() { if (!this.hyfcfgInfo.branch) { this.$notify.warning("请先选择经办机构号!"); return; } if (this.hyfcfgInfo.sel01 != '1' && this.hyfcfgInfo.sel02 != '1') { this.$notify.warning("请选中要勾选的用户!"); return; } this.$refs.hyfcfgForm.validate((validated) => { if (validated) { updateHyfcfg(this.hyfcfgInfo) .then((res) => { this.getUsrInfo(this.hyfcfgInfo.branch); this.$notify.success("更新成功!"); }) .catch((err) => { this.$notify.error("更新失败!"); }); } else { Utils.formValidateTips(this.$refs.hyfcfgForm.fields) } }) }, // 获取机构列表 getBchList() { var branch = JSON.parse(sessionStorage.getItem('currentOrg')).departmentNumber; listBch(branch) .then((res) => { this.branchList = res.data.map(item => ({ value: item.branch, label: item.branch + ' - ' + item.bchname })); if (this.branchList.length == 1) { this.hyfcfgInfo.branch = this.branchList[0].value; } }) .catch((err) => { this.$notify.error("获取机构列表失败!"); }); }, // 获取用户信息 getUsrInfo(branchTemp) { if (branchTemp != '1000') { var param = {}; param.branch = branchTemp; getHyfcfgInfo(param) .then((res) => { this.hyfcfgInfo = res.data; }) .catch((err) => { this.$notify.error("获取用户信息失败!"); }); } }, // 获取用户 getDirectUsrInfo() { var branch = JSON.parse(sessionStorage.getItem('currentOrg')).departmentNumber; this.getUsrInfo(branch); } } } </script>