FunctionBtn.vue 5.89 KB
Newer Older
liuxin committed
1
<!-- 引用方法
潘际乾 committed
2
<c-function-btn :handleSubmit="handleSubmit" :handleCheck="handleCheck" :handleStash="handleStash"
liuxin committed
3 4 5
></c-function-btn>
-->
<template>
fukai committed
6 7
  <div class="m-Btn-eContainer" v-if="!buttonHide && ((!isReview && !funcBtnHide) || showSetBtn)">
    <div class="m-funcBtn-eContainer" v-if="!isReview && !buttonHide && !funcBtnHide">
8
      <el-button v-if="1==0" type="primary" v-show="root.judgeVisiableInfo('mtabut.usrcon')" size="small" @click="confirm" :loading="$store.state.Status.loading.confirm">{{ $t('buttons.confirm') }}</el-button>
9 10
      <el-button type="primary" v-show="root.judgeVisiableInfo('mtabut.sav')" size="small" @click="start" :loading="$store.state.Status.loading.submit">{{ $t('buttons.submit') }}</el-button>
      <el-button size="small" v-show="root.judgeVisiableInfo('mtabut.chk')" @click="check" :loading="$store.state.Status.loading.check">{{ $t('buttons.check') }}</el-button>
潘际乾 committed
11 12
      <el-button size="small" @click="save" :loading="$store.state.Status.loading.stash">{{ $t('buttons.stash') }}</el-button>
      <el-button size="small" @click="handleCancel">{{ $t('buttons.quit') }}</el-button>
fukai committed
13 14 15 16 17 18 19 20 21 22
    </div>
    <div class="m-zhanWei-forfuncBtn" v-if="!buttonHide && showSetBtn && (funcBtnHide || isReview)"></div>
    <div class="m-openleft" v-if="!buttonHide && showSetBtn">
      <el-button
        type="primary"
        icon="el-icon-arrow-left"
        size="mini"
        class="m-setting-btn"
        v-show="!openflag"
        @click="open"
潘际乾 committed
23 24
        >
        {{ $t('buttons.unfold') }}
fukai committed
25 26 27 28 29 30 31 32 33
        <i class="el-icon-setting" size="mini"></i>
      </el-button>
      <el-button
        type="primary"
        icon="el-icon-arrow-right"
        size="mini"
        class="m-setting-btn"
        v-show="openflag"
        @click="close"
潘际乾 committed
34 35
        >
        {{ $t('buttons.fold') }}
fukai committed
36 37 38 39 40 41 42
        <i class="el-icon-setting" size="mini"></i>
      </el-button>
      <div class="m-openleft-item" v-show="openflag">
        <slot></slot>
      </div>
    </div>
  </div>
liuxin committed
43 44 45 46
</template>
<script>
// 反洗钱组件引入

fukai committed
47
export default {
48
    inject: ["root"],
fukai committed
49
  // 如果需要制裁信息按钮则给组件传 showAml 方法,如果不需要则不传
jianglong committed
50
  props: ["handleSubmit", "handleCheck", "handleStash", "handleExit", "hideFuncBtn", "handleConfirm"],
fukai committed
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
  data: function() {
    return {
      isReview: false,
      openflag: true,
      funcBtnHide: false
    };
  },
  created() {
    if (this.$route.path.indexOf("review") !== -1) {
      this.isReview = true;
    } else {
      this.isReview = false;
    }
    if (this.hideFuncBtn) {
      this.funcBtnHide = true;
    }
    // console.log("functionbtn标志isReview:", this.isReview)
    // console.log("functionbtn标志funcBtnHide:", this.funcBtnHide)
    // console.log("functionbtn标志buttonHide:", this.buttonHide)
    // console.log("functionbtn标志showSetBtn:", this.showSetBtn)
    // console.log("functionbtn标志mode:", this.mode)
    // console.log("functionbtn标志zhanwei:", !this.buttonHide && this.showSetBtn && (this.funcBtnHide || this.isReview))
  },
  computed: {
    showSetBtn() {
      return this.$slots.default !== undefined;
    },
    mode() {
      return this.$store.state.Status.mode;
    },
    buttonHide() {
      return this.$route.path.indexOf("display") !== -1;
83 84
    },

fukai committed
85 86
  },
  methods: {
87 88 89
    // judgeVisiableInfo() {

    // },
fukai committed
90
    start: async function() {
潘际乾 committed
91
      this.handleSubmit && (await this.handleSubmit());
fukai committed
92 93 94
    },
    check: async function() {
      this.handleCheck && (await this.handleCheck());
liuxin committed
95
    },
fukai committed
96
    save: async function() {
潘际乾 committed
97
      this.handleStash && (await this.handleStash());
liuxin committed
98
    },
jianglong committed
99 100 101
    confirm: async function() {
      this.handleConfirm && (await this.handleConfirm());
    },
fukai committed
102 103 104 105 106 107 108 109
    handleCancel: function() {
      this.$confirm("确认退出?", "", {
        confirmButtonText: "确认",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(res => {
          // this.$router.back();
潘际乾 committed
110
          this.$store.dispatch("TagsView/delView", this.$route)
fukai committed
111 112 113 114 115
          this.handleExit && this.handleExit()
          if (this.$route.query && this.$route.query.routeParams) {
            setTimeout(() => {
              this.$router.back()
            }, 500)
hulei committed
116 117
          } 
          else {
fukai committed
118
            setTimeout(() => {
潘际乾 committed
119
              this.$router.push('/home')
fukai committed
120 121 122 123 124 125 126 127 128 129
            }, 500)
          }
        })
        .catch(() => {});
    },
    open() {
      this.openflag = true;
    },
    close() {
      this.openflag = false;
liuxin committed
130 131
    }
  }
fukai committed
132 133 134 135 136 137 138
};
</script>
<style>
.m-Btn-eContainer {
  display: flex; /*flex布局*/
  flex-direction: row;
  flex-wrap: nowrap;
Wuyuqiu committed
139
  justify-content: center;
fukai committed
140
  align-items: flex-start;
潘际乾 committed
141
  /* height: 24px; */
Wuyuqiu committed
142 143
  text-align: center;
  margin-right:10px;
fukai committed
144 145 146 147 148 149 150 151 152 153 154 155 156
}
.m-funcBtn-eContainer {
  order: 1;
}
.m-zhanWei-forfuncBtn{
  order: 2;
}
.m-openleft {
  order: 3;
}

.m-funcBtn-eContainer button,
.m-funcBtn-eContainer .el-button + .el-button {
Wuyuqiu committed
157
  margin: 0px 10px 0px 0px;
fukai committed
158 159
}
.m-funcBtn-eContainer .el-button--default {
潘际乾 committed
160
  /* background-image: linear-gradient(#fff,#dedede); */
fukai committed
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
  border: 1px solid #ccc;
}
.m-funcBtn-eContainer .el-button--primary {
  border: 1px solid #0D4FBD;
}
.m-openleft-item {
  display: inline-block;
  padding: 0px;
}

.m-setting-btn {
  padding: 0px 10px 0px 8px;
  font-size: 12px;
  line-height: 22px;
}

.m-openleft-item > span {
  display: inline-block;
}
潘际乾 committed
180 181 182
.m-openleft-item .el-button+.el-button {
  margin: 0;
}
fukai committed
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
.m-openleft-item > button,
.m-openleft-item > span > button,
.m-openleft-item > span > div > button {
  color: #606266;
  background-color: #fff;
  border: 1px #ccc solid;
  padding: 0px 7px;
  background-image: linear-gradient(#fff,#dedede);
}

.m-openleft-item > button:hover,
.m-openleft-item > span > button:hover,
.m-openleft-item > span > div > button:hover {
  background-color: #b3d8ff;
  color: #606266;
}
Wuyuqiu committed
199 200 201

/* ui美化 */
.m-Btn-eContainer .el-button--small,.m-Btn-eContainer .el-button--small.is-round {
202
  padding: 10px 30px !important;
Wuyuqiu committed
203 204 205 206
  font-size: 16px;
  height: 40px;
  font-weight:bold;
}
fukai committed
207
</style>