<template>
  <div class="common-project-card">
    <el-row :gutter="24">
      <el-col :span="6" v-for="(item, index) in data" class="c">
        <el-card shadow="never">
          <div slot="header" class="clearfix">
            <span># {{ index + 1 }}</span>
            <el-dropdown class="float_right" @command="handleCommand($event, item)" trigger="click" size="small">
              <span class="el-dropdown-link">
                <i class="el-icon-more el-icon--right"></i>
              </span>
              <el-dropdown-menu slot="dropdown" class="text-align_center">
                <el-dropdown-item command="e" @click="handleEdit(item)" >
                  <!-- <p @click="handleEdit(item)" v-if="$permission('/workspace/project/modify') && ($r(item.id,[2])||userinfo.id == item.createBy)">编辑</p> -->
                  <!-- <span>编辑</span> -->
                  <span v-if="$permission('/workspace/project/modify') && ($r(item.id,[2])||userinfo.id == item.createBy)">编辑</span>
                  <span v-else>查看</span>
                </el-dropdown-item>
                <el-dropdown-item command="0" :disabled="!($permission('/workspace/project/patent_import')&& $r(item.id,[1,2]))">
                  <el-dropdown @command="handleCommand($event, item)" placement="right-start">
                    <span class="el-dropdown-link"> 专利导入 </span>
                    <el-dropdown-menu  class="children_item">
                        <el-dropdown-item command="7"> Excel导入 </el-dropdown-item>
                        <el-dropdown-item command="8">专利号导入 </el-dropdown-item>
                        <!-- <el-dropdown-item command="9"> 网站导入 </el-dropdown-item> -->
                        <el-dropdown-item command="11" v-if="$permission('/workspace/common/retrieval')"> 检索条件导入 </el-dropdown-item>
                    </el-dropdown-menu>
                  </el-dropdown>
                </el-dropdown-item>
                <el-dropdown-item command="12">任务清单</el-dropdown-item>
              <el-dropdown-item command="1">分配参与者</el-dropdown-item>
              <el-dropdown-item command="2" :disabled="!$permission('/workspace/project/report_manage')">报告管理</el-dropdown-item>
              <el-dropdown-item command="6" v-if="item.isCategory == 1&& $permission('/workspace/product')">产品架构</el-dropdown-item>
              <el-dropdown-item command="10" v-if="$permission('/workspace/event')">事 件</el-dropdown-item>
              <el-dropdown-item command="5" :disabled="!$permission('/workspace/project/other_accessories')">其它附件</el-dropdown-item>
              <el-dropdown-item command="3" :disabled="!($permission('/workspace/project/project_share')&&$r(item.id,[2]))">项目分享</el-dropdown-item>
              <el-dropdown-item command="4" divided class="color-red" :disabled="!($permission('/workspace/project/modify') && ($r(item.id,[2])||userinfo.id == item.createBy))">删除</el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </div>
          <el-form class="i">
            <el-form-item label="名称">
              <div class="a">
                <el-link :disabled="!$permission('/workspace/folder')" :class="$permission('/workspace/folder')?'':'jinzhi'" type="primary" @click.native="handleClick(item)" :title="item.name">
                  <span v-if="item.innerFile">{{ item.innerFile }} - </span>
                  <span>{{ item.name }}</span>
                </el-link>
              </div>
            </el-form-item>
            <el-form-item label="委托方">
              <div class="a" :title="item.clientName">{{ item.clientName }}</div>
            </el-form-item>
            <el-form-item label="应用场景">
              <div class="a" :title="item.scenarioName">
                <span v-for="name in item.scenarioName">{{ name }} <br> </span>
              </div>
            </el-form-item>
            <el-form-item label="调查类型">
              <div class="a" :title="item.typeName">
                <span v-for="name in item.typeName">{{ name }} <br> </span>
              </div>
            </el-form-item>
            <el-form-item label="技术主题" style="border-bottom: 0">
              <div class="a" :title="item.technicalTheme">{{ item.technicalTheme }}</div>
            </el-form-item>
          </el-form>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { workspaceOptions } from "./mixins";
import { mapGetters } from "vuex";
export default {
  mixins: [workspaceOptions],
  data() {
    return {

    }
  },
  mounted() {
  },
  computed: {
    ...mapGetters(['userinfo'])
  },
  methods: {
    handleCommand(command, row) {
      this.$emit('option', { option: command, row })
    }
  }
}
</script>

<style lang="scss">
   .jinzhi{
    cursor: not-allowed;
    pointer-events:none;
  }
.common-project-card {
  .c {
    margin-bottom: 15px;
    .el-card__header {
      padding: 10px !important;
      border-bottom: 1px solid #EBEEF5 !important;
      font-weight: 500;
    }
  }
  .i {
    padding: 10px;
    .a {
      text-align: right;
      overflow: hidden;
      height: 40px;
    }
    .el-form-item {
      margin-bottom: 0 !important;
      border-bottom: 1px dashed #ddd;
      .el-form-item__label {
        color: #000;
      }
    }
  }
}
</style>
