Hyfcfg.vue 5.34 KB
Newer Older
fukai committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
<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>