<template>
  <div>
    <el-dialog title="磁盘扩容" append-to-body :visible.sync="config.visible" width="50%">
      <disk ref="disk" :item-data="itemData" :config="config"></disk>
      <span slot="footer" class="dialog-footer">
        <el-button type="ghost" @click="config.visible = false">取 消</el-button>
        <el-button type="primary" @click="ok" :loading="loading">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { modifyResource, getSkusDetail } from 'services/services/product'
import { conditionVoleme, getDict } from 'services/platform/index'
import disk from '@/views/personal/apply/components/disk/sf.vue'

export default {
  components: { disk },
  props: {
    config: {
      type: Object
    }
  },
  filters: {
    typeFilter(value) {
      const map = {
        SAS: '容量型',
        SSD: '高性能型'
      }
      return map[value]
    }
  },
  data() {
    return {
      loading: false,
      diskList: [],
      fileList: [],
      skuId: '',
      lvm: true
    }
  },
  computed: {
    itemData() {
      return this.config.data
    }
  },
  methods: {
    ok() {
      const obj = this.$refs.disk.ok()
      if (!obj) return this.$message.error('磁盘信息填写不完整')
      modifyResource(obj).then(data => {
        if (data.success) {
          this.$message.success(data.message)
          this.config.visible = false
          // if (data.data) this.$router.push({ path: `/order/${data.data}` })
        }
      })
    }
  }
}
</script>

<style></style>
