<template>
  <div>
    <div>
      <p-card :title="title">
        <a-row>
          <a-col :span="leftSpan">
            <p-grid-form ref="formTarget" :disable-item="disableItem" :items="formItems"> </p-grid-form>
          </a-col>
          <a-col :span="rightSpan">
            <!-- <slot name="rightTblae" /> -->
           
            <slot name="rightTblae">默认数据</slot>
          </a-col>
        </a-row>
        <div class="group-btn">
          <p-button
            v-for="(item, i) in btnEventArray"
            :key="i"
            :type="item.type"
            :disabled="item.disabled ? true : false"
            @click="item.click"
            class="group-btn-a"
            >{{ item.label }}</p-button
          >
        </div>
        <a slot="extra" href="#"></a>
      </p-card>
    </div>
  </div>
</template>
<script>
// import { formItems } from './js/config'
// import { SetStation } from '@/views/util/stationmixin.js'
// import { setStationCode, getStationCode } from '@/views/util'
import 'viewerjs/dist/viewer.css'
import VueViewer from 'v-viewer'
import Vue from 'vue'
Vue.use(VueViewer)

export default {
  components: {},
  name: 'executionTask',
  props: {
    formItems: {
      type: Array,
      default() {
        return []
      },
    },
    title: {
      type: String,
      default: '',
    },
    formData: {
      type: Object,
      default() {
        return {}
      },
    },
    disableItem: {
      type: Array,
      default() {
        return []
      },
    },
    btnEventArray: {
      type: Array,
      default() {
        return []
      },
    },
    leftSpan: {
      type: Number,
      default: 12,
    },
    rightSpan: {
      type: Number,
      default: 12,
    },
  },
  data() {
    return {
      //   formItems: formItems(this),
    }
  },
  created() {},
  destroyed() {},
  watch: {
    formData: {
      handler(val) {
        this.$nextTick(() => {
          console.log(val, 'valvalvalvalvalvalval')
          if (JSON.stringify(val) == '{}') {
            this.$refs.formTarget.form.resetFields()
          } else {
            this.$refs.formTarget.form.setFieldsValue(val)
          }
        })
      },
      deep: true,
    },
  },
  methods: {},
}
</script>
<style lang="less">
.group-btn {
  margin: 50px 30px 0 30px;
  font-weight: bold;
  font-size: 15px;
  .group-btn-a {
    margin-left: 40px;
    height: 50px;
    width: 150px;
  }
}
.ant-input.ant-input-disabled {
  color: #108ee9;
}
</style>
