TmplDrawer.vue 2.17 KB
<template>
  <el-drawer class="tmpl-drawer" size="70%" :visible.sync="tmplDrawerVisible" :wrapperClosable="wrapperClosable" :before-close="handleClose">
    <div slot="title">对账字段配置</div>
    <div class="container">
      <AccountTmpl ref="accountTmpl" :type="type" :tmplSelectList="tmplSelectList"></AccountTmpl>
    </div>
    <div class="tmpl-footer">
      <el-button @click="handleClose">取消</el-button>
      <el-button @click="handleConfirm" type="primary" :loading="$store.state.d2admin.loading.value">确定</el-button>
    </div>
  </el-drawer>
</template>

<script>
import AccountTmpl from "../accountTmplManage/components/AccountTmpl"
import { deepClone } from '@/common/util'
import { tmplCheckField } from '@api/accountManage'
export default {
  name: 'TmplDrawer',
  components: {
    AccountTmpl
  },
  props: {
    tmplDrawerVisible: {
      type: Boolean,
      default: false
    },
    type: {
      type: String,
      default: '1'
    },
    tmplSelectList: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      wrapperClosable: false
    }
  },
  methods: {
    handleClose() {
      this.$emit('handleClose')
    },
    handleConfirm() {
      const params = {
        type: this.type,
        fieldIds: deepClone(this.$refs.accountTmpl.getSelected())
      }
      tmplCheckField(params).then(res => {
        this.$emit('handleConfirm', {
          fieldIds: deepClone(this.$refs.accountTmpl.getSelected())
        })
      })
    },
  },
  mounted() { },
};
</script>
<style lang="scss" scoped>
::v-deep.tmpl-drawer {
  .el-drawer__body {
    overflow: scroll;
    height: calc(100% - 400px);
  }
  .el-drawer__header {
    box-sizing: border-box;
    height: 60px;
    line-height: 60px;
    border-bottom: 1px solid #e5e5e5;
    padding: 0 0 0 20px;
    color: #333333;
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 0;
  }
  .container {
    box-sizing: border-box;
    overflow: scroll;
    padding: 20px 20px 60px;
  }
}
.tmpl-footer {
  position: absolute;
  width: 100%;
  height: 60px;
  line-height: 60px;
  bottom: 0;
  right: 0;
  background: #ffffff;
  text-align: right;
  margin-right: 30px;
  z-index: 9;
}
</style>