<template>
  <div :class="[$style.wrapHeight, $style.cpmconfirm]">
    <a-card :bordered="false">
      <a-tabs v-model="activeKey" type="line" @change="toggleTabs">
        <a-tab-pane key="1" tab="问题清单">
          <sd-business-list
            v-if="ifRouterView"
            :module-id="moduleId"
            :form-list-id="formListId"
            :custom-values="customValues"
            :filter="Expressions"
          ></sd-business-list>
        </a-tab-pane>
        <a-tab-pane key="2" tab="检查确认">
          <sd-task-list
            v-if="ifRouterView2"
            :module-id="moduleId2"
            :form-list-id="formListId2"
            :custom-values="customValues"
            :filter="Expressions"
          ></sd-task-list>
        </a-tab-pane>
      </a-tabs>
    </a-card>
  </div>
</template>

<script>
import sdBusinessList from '../../../../../src/application-manage/sd-business-list.vue'
import sdTaskList from '../../../../../src/application-manage/sd-task-list.vue'
import components from './_import-components/cpm-confirm-list-import'

export default {
  name: 'CpmConfirmList',
  metaInfo: {
    title: '问题清单确认',
  },
  components: {
    ...components,
    sdBusinessList,
    sdTaskList,
  },
  props: {
    // 模块Id
    moduleId: {
      type: String,
      default: '',
    },
    // 列表ID
    formListId: {
      type: String,
      default: '',
    },
    moduleId2: {
      type: String,
      default: '272834785706115072',
    },
    // 表2 列表Id
    formListId2: {
      type: String,
      default: '272834786242985984',
    },
    // 搜索条件
    customValues: {
      type: Object,
      default: () => {
        return {}
      },
    },
    Expressions: {
      type: Array,
      default: () => {
        return []
      },
    },
  },
  data() {
    return {
      activeKey: '1',
      ifRouterView: true,
      ifRouterView2: false,
      projectId: '',
      groupId: '',
    }
  },
  methods: {
    toggleTabs(key) {
      this.projectId = this.$route.query.projectId
      this.groupId = this.$route.query.groupId
      this.activeKey = key
      let val = 'cpm-confirm-list/require'
      let url = 'projectId=' + this.projectId + '&groupId=' + this.groupId
      console.log(this.activeKey)
      url = 'moduleId=' + this.moduleId + '&formListId=' + this.formListId + '&' + url
      url = 'moduleId2=' + this.moduleId2 + '&formListId2=' + this.formListId2 + '&' + url
      if (this.activeKey === '1') {
      } else {
        val = 'cpm-confirm-list/confirm'
      }
      console.log(url)
      // this.$router.push('/cpm-project/' + val + '?' + url)
      this.reload()
    },

    reload() {
      this.ifRouterView = false
      this.ifRouterView2 = false
      if (this.activeKey === '1') {
        this.$nextTick(() => {
          this.ifRouterView = true
        })
      } else {
        this.$nextTick(() => {
          this.ifRouterView2 = true
        })
      }
    },
  },
}
</script>

<style module lang="scss">
@use '@/common/design' as *;
.cpmconfirm {
  :global(.ant-tabs-bar) {
    margin-bottom: 8px;
  }
  :global(.ant-card-body) {
    padding-top: 0px;
  }
}
</style>
