<template>
<!-- 定性指标录入 -->
  <div class="dashboard-container">
    
      <!-- <el-form ref="searchForm" :inline="true" :model="searchInfo">
        <el-form-item label="所属考核项目">
          <span>
            <el-tag v-if="childInfo.title!=''">{{childInfo.title}}</el-tag>
            <projectDialog @checkedInfo="getCheckedInfo"></projectDialog>
          </span>
        </el-form-item>
        <el-form-item label="定性指标名称">
          <el-input
            placeholder="请输入名称"
            v-model="searchInfo.title"
            clearable>
          </el-input>
        </el-form-item>
        <el-form-item label="定性指标状态">
          <el-select v-model="searchInfo.state" clearable placeholder="请选择状态">
            <el-option :value=1 label="正常">正常</el-option>
            <el-option :value=2 label="禁止">禁止</el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button size="mini" type="primary" icon="el-icon-search" @click="onSubmit">查询</el-button>
          <el-button size="mini" icon="el-icon-refresh" @click="onReset">重置</el-button>
        </el-form-item>
      </el-form> -->
    
    <div class="gva-table-box">
      <div class="gva-btn-list">
        <el-button size="mini" type="primary" icon="el-icon-plus" @click="showAdd()">新增</el-button>
      </div>
      <!-- <el-table :data="tableData" border :span-method="objectSpanMethod">
        <el-table-column prop="parentname" label="部门"></el-table-column>
        <el-table-column prop="dimensionname" label="考核维度">
          
        </el-table-column>
        <el-table-column prop="targetname" label="考核指标">
          <template slot-scope="scope">
            <el-link type="primary" @click="showMethod(scope.row)">{{scope.row.targetname}}</el-link>
          </template>
        </el-table-column>
        <el-table-column prop="unit" label="单位"/>
        <el-table-column prop="cycle" label="周期">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.cycle==1">班</el-tag>
            <el-tag v-if="scope.row.cycle==2">天</el-tag>
            <el-tag v-if="scope.row.cycle==3">周</el-tag>
            <el-tag v-if="scope.row.cycle==4">月</el-tag>
            <el-tag v-if="scope.row.cycle==5">季度</el-tag>
            <el-tag v-if="scope.row.cycle==6">年</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="cycleattr" label="频次">
          <template slot-scope="scope">
            <div v-if="scope.row.cycle==1">每班{{scope.row.cycleattr}}次</div>
            <div v-if="scope.row.cycle==2">每天{{scope.row.cycleattr}}次</div>
            <div v-if="scope.row.cycle==3">每周{{scope.row.cycleattr}}次</div>
            <div v-if="scope.row.cycle==4">每月{{scope.row.cycleattr}}次</div>
            <div v-if="scope.row.cycle==5">每季度{{scope.row.cycleattr}}次</div>
            <div v-if="scope.row.cycle==6">每年{{scope.row.cycleattr}}次</div>
            
          </template>
        </el-table-column>
        <el-table-column prop="userlist" label="执行人">
          <template slot-scope="scope">
            <el-button
              icon="el-icon-view"
              size="small"
              type="text"
              @click="showUserList(scope.row)"
            >查看</el-button>
          </template>
        </el-table-column>
        <el-table-column label="操作">
          <template slot-scope="scope">
            <el-button
              icon="el-icon-edit"
              size="small"
              type="text"
              @click="showEdit(scope.row)"
            >修改</el-button>
            <el-button
              icon="el-icon-delete"
              size="small"
              type="text"
              @click="deleteOperate(scope.row)"
            >删除</el-button>
          </template>
        </el-table-column>
        
       </el-table> -->
       <el-table :data="tableData" border  :span-method="targetSpanMethod">
        <el-table-column prop="targetname" label="考核指标">
          <template slot-scope="scope">
            <el-link type="primary" @click="showMethod(scope.row)">{{scope.row.targetname}}</el-link>
          </template>
        </el-table-column>
        
        <el-table-column prop="dimensionname" label="纬度"/>
        <el-table-column align="left" label="部门">
            <template #default="scope">
              <el-collapse>
                <el-collapse-item title="详情" name="1">
                  <div v-for="(iteam,index) in scope.row.departmentmap">
                    {{iteam.parentname}}
                  </div>
                </el-collapse-item>
              </el-collapse>
               
            </template>
        </el-table-column>
        <el-table-column prop="cycle" label="周期">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.cycle==1">班</el-tag>
            <el-tag v-if="scope.row.cycle==2">天</el-tag>
            <el-tag v-if="scope.row.cycle==3">周</el-tag>
            <el-tag v-if="scope.row.cycle==4">月</el-tag>
            <el-tag v-if="scope.row.cycle==5">季度</el-tag>
            <el-tag v-if="scope.row.cycle==6">年</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="cycleattr" label="频次">
          <template slot-scope="scope">
            <div v-if="scope.row.cycle==1">每班{{scope.row.cycleattr}}次</div>
            <div v-if="scope.row.cycle==2">每天{{scope.row.cycleattr}}次</div>
            <div v-if="scope.row.cycle==3">每周{{scope.row.cycleattr}}次</div>
            <div v-if="scope.row.cycle==4">每月{{scope.row.cycleattr}}次</div>
            <div v-if="scope.row.cycle==5">每季度{{scope.row.cycleattr}}次</div>
            <div v-if="scope.row.cycle==6">每年{{scope.row.cycleattr}}次</div>
          </template>
        </el-table-column>
        <el-table-column prop="userlist" label="执行人">
          <template slot-scope="scope">
            <el-button
              icon="el-icon-view"
              size="small"
              type="text"
              @click="showUserList(scope.row)"
            >查看</el-button>
          </template>
        </el-table-column>
        <el-table-column label="操作">
          <template slot-scope="scope">
            <el-button
              icon="el-icon-edit"
              size="small"
              type="text"
              @click="showEdit(scope.row)"
            >修改</el-button>
            <el-button
              icon="el-icon-delete"
              size="small"
              type="text"
              @click="deleteOperate(scope.row)"
            >删除</el-button>
          </template>
        </el-table-column>
        
       </el-table>
      </div>
      <!-- 新增弹框 -->
      <el-dialog :close-on-click-modal="false" :visible.sync="dialogFormVisible" :before-close="closeDialog" title="新增" width="65%">
        <el-form ref="addForm" :model="form" :rules="rules" label-width="150px">
          <el-row>
            <el-col :span="8">
               <el-form-item label="考核指标">
                  <el-select v-model="form.target" clearable placeholder="请选择状态" @change="selectTarget">
                    <el-option
                      v-for="item in selectdutyList"
                      :key="item.id"
                      :label="item.title"
                      :value="item.id">
                    </el-option>
                  </el-select>
                </el-form-item>
            </el-col>
            <el-col :span="8">
             <el-form-item label="所属公司" prop="title"  v-show="parentidShow">
              <el-select v-model="form.group" clearable placeholder="请选择">
                <el-option
                  v-for="item in companyList"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id">
                </el-option>
              </el-select>
            </el-form-item>
            </el-col>
            <el-col :span="8">
               <el-form-item label="所属部门" prop="title" v-show="parentidShow">
                 <el-cascader clearable v-model="form.parentid" :options="grouplist" :show-all-levels="false" :props="props"></el-cascader>
                <!-- <el-select multiple v-model="form.parentid" clearable placeholder="请选择">
                  <el-option
                    v-for="item in departmentList"
                    :key="item.id"
                    :label="item.name"
                    :value="item.id">
                  </el-option>
                </el-select> -->
              </el-form-item>
            </el-col>
          </el-row>
          <!-- <el-row>
            
            <el-col :span="12">
             <el-form-item label="考核维度">
              <el-select v-model="form.dimension" clearable placeholder="请选择状态">
                <el-option
                  v-for="item in dutyclasslist"
                  :key="item.outId"
                  :label="item.title"
                  :value="item.outId">
                </el-option>
              </el-select>
            </el-form-item>
            </el-col>
          </el-row> -->
          <el-form-item label="考核项目" v-if="cardShow">
            <el-card class="box-card">
              
               <el-row>
                <el-col :span="8">
                  
                  <span>标题<el-input style="width:40%;margin-left: 15px" v-model="form.targetsuntitle"></el-input></span>
                </el-col>
                <el-col :span="8">
                  <el-button
                      icon="el-icon-circle-plus-outline"
                      type="primary"
                      @click="addRules()"
                    >添加细则</el-button>
                </el-col>
                <!-- <el-col :span="8">
                  项目总分：{{Fraction}}
                </el-col> -->
               </el-row>
            <el-table
                :data="RulesList"
                style="width: 100%">
                <el-table-column
                    label="考核内容"
                    align="center"
                    prop="name"
                    >
                    <template slot-scope="scope">
                      <el-input
                        type="textarea"
                        autosize
                        placeholder="请输入内容"
                        v-model="scope.row.title">
                      </el-input>
                      <!-- <el-input v-model="" autocomplete="off" /> -->
                    </template>
                </el-table-column>
                <!-- <el-table-column
                    label="标准分"
                    align="center">
                    <template slot-scope="scope">
                       <el-input v-model.number="scope.row.referencescore" @change="FractionBian"></el-input>
                    </template>
                </el-table-column> -->
                <el-table-column
                    label="考核标准"
                    align="center">
                    <template slot-scope="scope">
                       <el-input v-model="scope.row.referencescore"></el-input>
                    </template>
                </el-table-column>
                <el-table-column
                    label="单位"
                    align="center">
                    <template slot-scope="scope">
                      <el-select v-model="scope.row.unit" clearable placeholder="请选择">
                        <el-option
                          v-for="item in unitDataList"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value">
                        </el-option>
                      </el-select>
                       <!-- <el-input v-model="scope.row.unit"></el-input> -->
                    </template>
                </el-table-column>
                <el-table-column
                    label="操作类型"
                    align="center">
                    <template slot-scope="scope">
                      <el-select v-model="scope.row.addorreduce" clearable placeholder="请选择">
                        <el-option label="加分" :value=2></el-option>
                        <el-option label="减分" :value=1></el-option>
                        <el-option label="加减分" :value=3></el-option>
                      </el-select>
                    </template>
                </el-table-column>
                
                <el-table-column
                    label="备注说明"
                    align="center"
                    prop="content"
                    >
                    <template slot-scope="scope">
                      <el-input
                        type="textarea"
                        autosize
                        placeholder="请输入内容"
                        v-model="scope.row.content">
                      </el-input>
                      <!-- <el-input v-model="scope.row.content" autocomplete="off" /> -->
                    </template>
                </el-table-column>
                <!-- <el-table-column
                    label="考核周期"
                    align="center">
                    <template slot-scope="scope">
                       <el-select v-model="scope.row.cycle" placeholder="请选择考核周期">
                        <el-option
                        v-for="item in options"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value">
                        </el-option>
                      </el-select>
                    </template>
                </el-table-column> -->
                <!-- <el-table-column
                    label="辅助计数"
                    align="center">
                    <template slot-scope="scope">
                       <el-input v-model="scope.row.cycleattr" autocomplete="off" />
                    </template>
                </el-table-column> -->
                <el-table-column
                    label="执行人"
                    align="center">
                    <template slot-scope="scope">
                          <el-cascader clearable v-model="scope.row.userlist" :options="grouplistBackup" :show-all-levels="false" :props="userProps"></el-cascader>
                    </template>
                </el-table-column>
                <el-table-column align="left" fixed="right" label="操作">
                  <template #default="scope">
                    <el-button
                      icon="el-icon-delete"
                      size="small"
                      type="text"
                      @click="deleteRulesList(scope)"
                    >删除</el-button>
                  </template>
                </el-table-column>
            </el-table>
            </el-card>
          </el-form-item>
         
        </el-form>
        <template #footer>
          <div class="dialog-footer"> 
            <el-button size="small" @click="closeDialog">取 消</el-button>
            <el-button size="small" type="primary" @click="enterDialog">确 定</el-button>
          </div>
        </template>
      </el-dialog>
      <!-- 编辑弹框 -->
      <el-dialog :close-on-click-modal="false" :visible.sync="editDialogFormVisible" :before-close="editCloseDialog" title="修改" width="60%">
        <el-form ref="editForm" :model="editAdd" :rules="editRules" label-width="150px">
          <el-table
                :data="editAdd.list"
                style="width: 100%">
                <el-table-column
                    label="考核内容"
                    align="center"
                    >
                    <template slot-scope="scope">
                      <el-input v-model="scope.row.name" autocomplete="off" />
                    </template>
                </el-table-column>
                <el-table-column
                    label="考核内容"
                    align="center"
                    prop="content"
                    >
                    <template slot-scope="scope">
                      <el-input v-model="scope.row.content" autocomplete="off" />
                    </template>
                </el-table-column>
                <!-- <el-table-column
                    label="单位"
                    align="center">
                    <template slot-scope="scope">
                       <el-input v-model="scope.row.unit"></el-input>
                    </template>
                </el-table-column> -->
                <el-table-column
                    label="标准分"
                    align="center">
                    <template slot-scope="scope">
                       <el-input v-model.number="scope.row.referencescore" @change="FractionBian"></el-input>
                    </template>
                </el-table-column>
                <!-- <el-table-column
                    label="考核周期"
                    align="center">
                    <template slot-scope="scope">
                       <el-select v-model="scope.row.cycle" placeholder="请选择考核周期">
                        <el-option
                        v-for="item in options"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value">
                        </el-option>
                      </el-select>
                    </template>
                </el-table-column> -->
                <!-- <el-table-column
                    label="辅助计数"
                    align="center">
                    <template slot-scope="scope">
                       <el-input v-model="scope.row.cycleattr" autocomplete="off" />
                    </template>
                </el-table-column> -->
                <el-table-column
                    label="执行人"
                    align="center">
                    <template slot-scope="scope">
                          <el-cascader clearable v-model="scope.row.userlist" :options="grouplistBackup" :show-all-levels="false" :props="userProps"></el-cascader>
                    </template>
                </el-table-column>
                <!-- <el-table-column align="left" fixed="right" label="操作">
                  <template #default="scope">
                    <el-button
                      icon="el-icon-delete"
                      size="small"
                      type="text"
                      @click="deleteRulesList(scope)"
                    >删除</el-button>
                  </template>
                </el-table-column> -->
            </el-table>
        </el-form>
        <template #footer>
          <div class="dialog-footer"> 
            <el-button size="small" @click="editCloseDialog">取 消</el-button>
            <el-button size="small" type="primary" @click="editEnterDialog">确 定</el-button>
          </div>
        </template>
      </el-dialog>
      <!-- 人员弹框 -->
      <el-dialog :visible.sync="showUser" title="执行人" width="30%">
        <!-- <el-descriptions class="margin-top" :column="3" size="medium" border>
          <el-descriptions-item v-for="item in userlistary" :key="item.key">
            <template slot="label">
              <i class="el-icon-user"></i>
              姓名
            </template>
            {{item.name}}
          </el-descriptions-item>
        </el-descriptions> -->
        <el-table
          :data="userlistary"
          style="width: 100%">
          <el-table-column
            prop="date"
            label="头像">
            <template slot-scope="scope">
              <el-avatar shape="square" size="large" :src="scope.row.icon"></el-avatar>
            </template>
          </el-table-column>
          <el-table-column
            prop="number"
            label="工号">
          </el-table-column>
          <el-table-column
            prop="address"
            label="部门">
            <template slot-scope="scope">
              {{scope.row.groupname}}{{scope.row.departmentname}}
            </template>
          </el-table-column>
          <el-table-column
            prop="name"
            label="姓名">
          </el-table-column>
        </el-table>
      </el-dialog>
      <!-- 编辑部门弹框 -->
      <el-dialog :visible.sync="buMenEditDialog" :before-close="bumeneditCloseDialog" title="修改" width="20%">
        <el-form  :model="bumenEdit" label-width="150px">
          <el-form-item label="部门">
           <el-cascader clearable v-model="bumenEdit.departmentid" :options="grouplist" :show-all-levels="false" :props="props"></el-cascader>
          </el-form-item>
        </el-form>
        <template #footer>
          <div class="dialog-footer"> 
            <el-button size="small" @click="bumeneditCloseDialog">取 消</el-button>
            <el-button size="small" type="primary" @click="buMenTi">确 定</el-button>
          </div>
        </template>
      </el-dialog>
      <!-- 考核办法弹框 -->
      <el-dialog :visible.sync="methodShow" title="考核办法" width="60%">
        <div class="gva-search-box">
      <el-form :inline="true" :model="searchfu">
        <el-form-item label="所属公司">
          <el-select v-model="searchfu.group" clearable placeholder="请选择" @change="selectGroup">
            <el-option
              v-for="item in companyList"
              :key="item.wxId"
              :label="item.name"
              :value="item.wxId">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="所属部门">
          <el-select v-model="searchfu.deaprtid" clearable placeholder="请选择">
            <el-option
              v-for="item in searchDepartmentList"
              :key="item.id"
              :label="item.name"
              :value="item.id">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button size="mini" type="primary" icon="el-icon-search" @click="onSubmitsearchfu">查询</el-button>
        </el-form-item>
      </el-form>
    </div>
        <el-table :data="methodList" border :span-method="methodSpanMethod" :cell-style="{padding:'0px'}">
          <!-- <el-table-column prop="parentname" label="部门" width="110">
            <template #default="scope">
              <div v-for="(iteam,index) in scope.row.departnamemap">
                {{iteam}}
              </div>
            </template>
          </el-table-column> -->
          <el-table-column prop="targetsunname" label="考核项目" width="80">
            <template #default="scope">
              {{scope.row.targetsunname}}
            </template>
          </el-table-column>
          <!-- <el-table-column prop="targetsunname" label="权重"></el-table-column> -->
          <el-table-column prop="detailedtargetname" label="考核内容"></el-table-column>
          <el-table-column prop="scoreing" label="考核标准" width="80" align="center"></el-table-column>
          <el-table-column prop="unit" label="单位" width="80" align="center"/>
          <el-table-column prop="content" label="备注说明" width="120"/>
          <el-table-column label="操作" width="120">
            <template #default="scope">
              <el-button
                icon="el-icon-edit"
                size="small"
                type="text"
                @click="showxize(scope.row)"
              >修改</el-button>
              <el-button
                icon="el-icon-delete"
                size="small"
                type="text"
                @click="deleteSmall(scope.row)"
              >删除</el-button>
            </template>
          </el-table-column>
          <el-table-column label="项目操作" width="80">
            <template #default="scope">
              <div>
                <el-button
                  icon="el-icon-plus"
                  size="small"
                  type="text"
                  @click="showaddbiao(scope.row)"
                >新增</el-button>
              </div>
              <div>
                <el-button
                  icon="el-icon-edit"
                  size="small"
                  type="text"
                  @click="showEditming(scope.row)"
                >修改</el-button>
              </div>
              <div>
                <el-button
                  icon="el-icon-delete"
                  size="small"
                  type="text"
                  @click="deleteSun(scope.row)"
                >删除</el-button>
              </div>
              
            </template>
          </el-table-column>
        </el-table>
      </el-dialog>
      <!-- 修改子栏目名称 -->
      <el-dialog :visible.sync="showzhiming" title="修改" width="40%">
        <el-form :model="nameFrom" label-width="150px">
          <el-form-item label="考核项目名称" prop="title">
            <el-input v-model="nameFrom.name" autocomplete="off" />
          </el-form-item>
          <el-form-item label="部门">
           <el-cascader clearable v-model="nameFrom.departmentmap" :options="grouplist" :show-all-levels="false" :props="props"></el-cascader>
          </el-form-item>
           <el-form-item label="执行人">
           <el-cascader clearable v-model="nameFrom.operator" :options="grouplistBackup" :show-all-levels="false" :props="userProps"></el-cascader>
          </el-form-item>
        </el-form>
        <template #footer>
          <div class="dialog-footer"> 
            <el-button size="small" type="primary" @click="xiuzhiming">确 定</el-button>
          </div>
        </template>
      </el-dialog>
      <!-- 修改细则 -->
      <el-dialog :visible.sync="xizeDig" title="修改" width="40%">
        <el-form :model="xizeData" label-width="150px">
          <el-form-item label="考核内容" prop="title">
            <el-input
              type="textarea"
              autosize
              placeholder="请输入内容"
              v-model="xizeData.detailedtargetname">
            </el-input>
          </el-form-item>
          <el-form-item label="考核标准" prop="score">
            <el-input
              type="textarea"
              autosize
              placeholder="请输入内容"
              v-model="xizeData.score">
            </el-input>
          </el-form-item>
          <el-form-item label="单位" prop="unit">
             <el-select v-model="xizeData.unit" clearable placeholder="请选择">
                <el-option
                  v-for="item in unitDataList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
          </el-form-item>
          <el-form-item label="备注说明" prop="detailedtargetcontent">
            <el-input
              type="textarea"
              autosize
              placeholder="请输入内容"
              v-model="xizeData.detailedtargetcontent">
            </el-input>
          </el-form-item>
          <el-form-item label="执行人" prop="title">
            <el-cascader clearable v-model="xizeData.operator" :options="grouplistBackup" :show-all-levels="false" :props="userProps"></el-cascader>
          </el-form-item>
        </el-form>
        <template #footer>
          <div class="dialog-footer"> 
            <el-button size="small" type="primary" @click="xiuxize">确 定</el-button>
          </div>
        </template>
      </el-dialog>
      <!-- 新增 -->
      <el-dialog :visible.sync="addbiao" title="新增" width="40%">
        <el-form :model="xizeDataFrom" label-width="150px">
          <el-form-item label="考核内容" prop="detailedtargetname">
            <el-input
              type="textarea"
              autosize
              placeholder="请输入内容"
              v-model="xizeDataFrom.detailedtargetname">
            </el-input>
          </el-form-item>
          <el-form-item label="考核标准" prop="score">
            <el-input
              type="textarea"
              autosize
              placeholder="请输入内容"
              v-model="xizeDataFrom.score">
            </el-input>
          </el-form-item>
          <el-form-item label="单位" prop="unit">
             <el-select v-model="xizeDataFrom.unit" clearable placeholder="请选择">
                <el-option
                  v-for="item in unitDataList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
          </el-form-item>
          <el-form-item label="备注说明" prop="detailedtargetcontent">
            <el-input
              type="textarea"
              autosize
              placeholder="请输入内容"
              v-model="xizeDataFrom.detailedtargetcontent">
            </el-input>
          </el-form-item>
          <el-form-item label="执行人" prop="operator">
            <el-cascader clearable v-model="xizeDataFrom.operator" :options="grouplistBackup" :show-all-levels="false" :props="userProps"></el-cascader>
          </el-form-item>
        </el-form>
        <template #footer>
          <div class="dialog-footer"> 
            <el-button size="small" type="primary" @click="addxize">确 定</el-button>
          </div>
        </template>
      </el-dialog>
  </div>
</template>

<script>
import { dutyclasslist } from '@/api/duty/dimension'
import { gettargetinfo } from '@/api/duty/project'
import { delsuntardimeat,deldutytarget,gettasktarget,
gettasktargetsun,gettasktargetcontary,addqualeval,getqualevallist,departmenttasklist,
delqualevalcont,deldepartmenttasklist,getrationlist,eitequalevalcont,getqualeval,dutydepartmentlist,selectdutylist,
idtotargetsunlist,eitesuntargetname,getdetailedtargetcallback,eitedetailedtargetcallback,
neweitedetailedtarget,newdelsuntarget,newdeldetailedtarget,newdeltarget,getneweitedetailedtarget,geteitesuntarterinfo,
lookdutytargetinfo,getdutyrelationlist,adddutyrelation,getdepartforduty,eitedepartforduty } from '@/api/duty/duty'
import projectDialog from '@/components/projectDialog/index.vue'
import { dutylist,getdutyinfo,eitedutyinfo,eitedutystate } from '@/api/duty/quantitativeIndicators'
import {
  grouplist,
  departmentlist,
  getgroupdepartmap,
  getgroupuser
} from '@/api/duty/group'
export default {
  name: 'Dashboard',
  components: {
    projectDialog
  },
  data() {
    return {
      searchfu:{},
      searchDepartmentList:[],
      unitDataList:[
        {
          label:'分',
          value:'分'
        },
        {
          label:'分/次',
          value:'分/次'
        },
        {
          label:'分/人',
          value:'分/人'
        },
        {
          label:'分/处',
          value:'分/处'
        },
        {
          label:'分/项',
          value:'分/项'
        },
        {
          label:'分/台',
          value:'分/台'
        },
        {
          label:'分/个',
          value:'分/个'
        },
        {
          label:'分/具',
          value:'分/具'
        },
        {
          label:'分/岗',
          value:'分/岗'
        },
        {
          label:'分/件',
          value:'分/件'
        },
        {
          label:'分/人·次',
          value:'分/人·次'
        },
        {
          label:'分/项·次',
          value:'分/项·次'
        },
        {
          label:'分/台·次',
          value:'分/台·次'
        },
      ],
      bumenEdit:{},
      treeData:[],
      // 树形结构数据
      treeData:{
        label:'',
        children:[],
      },
      defaultProps: {
          children: 'children',
          label: 'label'
        },
      xizeDig:false,
      xizeData:'',
      // 子名称修改数据
      nameFrom:{},
      // 修改子栏目弹窗
      showzhiming:false,
      // 下拉定性考核列表
      selectdutyList:[],
      // 项目总分
      Fraction:0,
      // 显示指标
      targetShow:false,
      // 显示部门
      parentidShow:false,
      // 添加时卡片视图
      cardShow:false,
      methodShow:false,
      // 执行人列表
      userlistary:[],
      // 执行人列表弹窗
      showUser:false,
      // 选择员工配置项
      userProps: {
        value: "id",
        label: "name",
        children: "groupUser",
        emitPath:false,
        multiple: true
      },
      // 员工列表
      grouplistBackup:[],
      // 周期列表
      options: [{
            value: 1,
            label: '班'
        }, {
            value: 2,
            label: '天'
        }, {
            value: 3,
            label: '周'
        }, {
            value: 4,
            label: '月'
        }, {
            value: 5,
            label: '季度'
        }, {
            value: 6,
            label: '年'
        }],
      // 考核细则表格显示
      tableShow:false,
      // 子栏目列表
      targetsunList:[],
      RulesList:[],
      // 细则列表
      rulesList:[],
      // 细则拷贝
      rulesCopyList:[],
      // 考核指标列表
      indexList:[],
      // 考核纬度列表
      dutyclasslist:[],
      // 考核纬度请求值
      dutyClassFrom:{
        page: 1, //分页页码，数字类型
        pagesize: 100000,
        state: 1 //状态（查询用）
      },
      // 部门列表
      departmentList:[],
      // 公司列表
      companyList:[],
      editChildInfo:{},
      grouplist:[],
      props: {
        value: "id",
        label: "name",
        children: "children",
        emitPath:false,
        multiple: true
      },
      addChildInfo:{
        title:''
      },
      childInfo:{
        title:''
      },
      // 查询详情的数据
      editFrom:{},
      // 修改状态提交数据
      switchFrom:{},
      // 删除数据提交
      deleFrom:{},
      // 编辑时数据
      editAdd:{
        parentId:''
      },
      assessList:{},
      // 添加数据
      form:{
        type:1,
        group:'',
        parentid:'',
        target:'',
        targetsun:''
      },
      addbiao:false,
      // 弹窗变量
      dialogFormVisible:false,
      // 修改弹窗
      editDialogFormVisible:false,
      buMenEditDialog:false,
      total: 0,
      tableData:[],
      // 条件查询变量
      searchInfo: {
        type:1
      },
      spanArr:[],
      spanArr1:[],
      spanArr2:[],
      // 条件查询变量
      abc:{
        aaa:"111",
        bbb:"222"
      },
      methodSpanArr:[],
      methodSpanArr1:[],
      methodPos1:'',
      rulesObjectCopy:{},
      // 添加时验证规则
      rules: {
        // title: [{ required: true, message: '请输入名称', trigger: 'blur' }],
      },
      rowZhiData:{},
      methodList:[],
      xizeDataFrom:{},
      pos:'',
      pos1:'',
      pos2:'',
      parentidArr:[],
      parentidpos:'',
      methodPos:'',
      editRules:{
        title: [{ required: true, message: '请输入名称', trigger: 'blur' }],
      }
    }
  },
  created() {
    if (this.$store.state.user.token=='') {
      this.$router.push('/login')
    }
    // 页面渲染时获取初始数据
    this.getDataList()
    this.getGrouplist()
    this.getbumenlist()
    this.initialDepartment()
    // 获取部门列表
    // this.departmentlist()
    this.getDutyclasslist()
    this.getSystemadminlist()
    this.selectdutylist()
  },
   
   watch: {
    tableData() {
      this.$nextTick(() => {
      this.spanArr=[],
      this.spanArr1=[],
      this.spanArr2=[],
      this.parentidArr=[],
      this.pos='',
      this.pos1='',
      this.pos2='',
      this.parentidpos='',
      
      //此时就可以获取到在created赋值后的dataList了
      this.getSpanArr(this.tableData);
      this.getSpanArr1(this.tableData);
      this.getSpanArr2(this.tableData);
      this.getParentid(this.tableData);
      });
    },
    methodList() {
      this.$nextTick(() => {
        this.methodSpanArr=[],
        this.methodPos='',
        this.methodSpanArr1=[],
        this.methodPos1='',
        //此时就可以获取到在created赋值后的dataList了
      this.getMethodSpanArr(this.methodList);
      this.getMethodSpanArr1(this.methodList);
      });
    },
  },
  methods: {
    // 删除子栏目
    async deleteSun(row){
      const deleFrom={
        // id: row.targetsun
        id: row.targetsun, //子栏目ID
        assid: row.target //指标Id
      }
      const res = await newdelsuntarget(deleFrom)
      if (res.code === 0) {
            this.$message({
              type: 'success',
              message: '删除成功!'
            })
          this.getzhilanmuList()
      }
    },
    //新增考核标准
    async addxize(){
      const resa = await neweitedetailedtarget(this.xizeDataFrom)
      this.xizeDataFrom={}
      this.getzhilanmuList()
      this.addbiao=false
    },
    // 新增考核标准弹窗
    showaddbiao(row){
      this.$set(this.xizeDataFrom,'assid',row.dutyassessid)
      this.$set(this.xizeDataFrom,'id','')
      this.addbiao=true
    },
    // 修改细则
    async xiuxize(){
      const resa = await neweitedetailedtarget(this.xizeData)
      this.getzhilanmuList()
      this.xizeData={}
      this.xizeDig=false
    },
    // 新增时选中指标
    async selectTarget(){
      this.RulesList=[]
      const from = {
        id:this.form.target
      }
      // const res = await idtotargetsunlist(from)
      const resa = await gettargetinfo(from)
      this.targetsunList=resa.data
      if (this.targetsunList.group!=null) {
        this.form.group=parseInt(this.targetsunList.group[0])
          const departmentFrom={
          id:this.form.group
        }
        const res = await departmentlist(departmentFrom)
        this.departmentList=res.data
        if (res.code==0) {
          this.form.parentid=this.targetsunList.relevantdepartmentsmap.map(Number)
        }
      }
      
      
      
      // this.form.parentid=this.targetsunList.relevantdepartmentsmap.map(Number)
      console.log(this.form.parentid)
      this.rulesObject={
        title: "", //这是卡片细则标题
        content: "", //这是卡片细则描述
        //unit: this.targetsunList.unites, //单位
        //referencescore: 0, //参考分值
        addorreduce:1,
        unit: '', //单位
        referencescore: '', //参考分值
        cycle: this.targetsunList.cycle, //1：班；2：天；3：周；4：月；5：季度；6：年
        cycleattr: this.targetsunList.cycleattr, //辅助计数
        userlist: this.targetsunList.reportmap//执行人
      }
      this.RulesList.push(JSON.parse(JSON.stringify(this.rulesObject )))
      console.log("gettargetinfo")
      console.log(this.RulesList)
      this.cardShow=true
      this.parentidShow=true
    },
    // 获取下拉定性考核列表
    async selectdutylist(){
      const res = await selectdutylist()
      this.selectdutyList=res.data
    },
    // 删除细则小项
    async deleteSmall(row){
      console.log(row)
      const deleFrom={
        // outid: row.id
        id: row.detailedtarget, //指标明细ID
        assid: row.dutyassessid //考核方案ID
      }
      const res = await newdeldetailedtarget(deleFrom)
      if (res.code === 0) {
            this.$message({
              type: 'success',
              message: '删除成功!'
            })
          this.getzhilanmuList()
      }
    },
    // 数值变化触发
    FractionBian(){
      const that=this
      this.Fraction=0
      this.RulesList.forEach(function(element) {
        that.Fraction += element.referencescore;
      });
    },
    // 查看考核办法
    showMethod(row){
      this.rowZhiData=row
      console.log("this.rowZhiData")
      console.log(this.rowZhiData)
      this.getzhilanmuList()
      this.methodShow=true
      
    },
    // 获取子栏目列表
    //  async getzhilanmuList(){
    //   const methodData={
    //     type: 1, //1：定性考核；2：定量考核
    //     group: this.rowZhiData.group, //归属集团
    //     departmentid: this.rowZhiData.parentid, //被考核部门
    //     dimension: this.rowZhiData.dimension, //维度
    //     target: this.rowZhiData.target, //考核指标
    //   }
    //   const res = await departmenttasklist(methodData)
    //   if (res.code==0) {
    //     this.methodList=res.data
        
    //   }
    // },
    async onSubmitsearchfu(){
       const methodData={
        //type: 1, //1：定性考核；2：定量考核
        group: this.searchfu.group, //归属集团
        //departmentid: this.rowZhiData.parentid, //被考核部门
        departid:this.searchfu.deaprtid.toString(),
        dimension: this.rowZhiData.dimension, //维度
        targetid: this.rowZhiData.target, //考核指标
      }
      const res = await lookdutytargetinfo(methodData)
      if (res.code==0) {
        this.methodList=res.data
        
      }
    },
    // 获取子栏目列表
    async getzhilanmuList(){
      const methodData={
        //type: 1, //1：定性考核；2：定量考核
        group: this.rowZhiData.group, //归属集团
        //departmentid: this.rowZhiData.parentid, //被考核部门
        dimension: this.rowZhiData.dimension, //维度
        targetid: this.rowZhiData.target, //考核指标
      }
      const res = await lookdutytargetinfo(methodData)
      if (res.code==0) {
        this.methodList=res.data
        
      }
    },
    // 点击查看人员列表
    showUserList(row){
      this.showUser=true
      this.userlistary=row.userlistary
    },
    getMethodSpanArr(data) {
        // data就是我们从后台拿到的数据
      for (var i = 0; i < data.length; i++) {
        if (i === 0) {
          this.methodSpanArr.push(1);
          this.methodPos = 0;
        } else {
          // 判断当前元素与上一个元素是否相同
          if (data[i].targetsun === data[i - 1].targetsun) {
            this.methodSpanArr[this.methodPos] += 1;
            this.methodSpanArr.push(0);
          } else {
            this.methodSpanArr.push(1);
            this.methodPos = i;
          }
        }
      }
    },
    getMethodSpanArr1(data) {
        // data就是我们从后台拿到的数据
      for (var i = 0; i < data.length; i++) {
        if (i === 0) {
          this.methodSpanArr1.push(1);
          this.methodPos1 = 0;
        } else {
          // 判断当前元素与上一个元素是否相同
          if (data[i].parentname === data[i - 1].parentname) {
            this.methodSpanArr1[this.methodPos1] += 1;
            this.methodSpanArr1.push(0);
          } else {
            this.methodSpanArr1.push(1);
            this.methodPos1 = i;
          }
        }
      }
    },
    getSpanArr(data) {
        // data就是我们从后台拿到的数据
        for (var i = 0; i < data.length; i++) {
          if (i === 0) {
            this.spanArr.push(1);
            this.pos = 0;
          } else {
            // 判断当前元素与上一个元素是否相同
            if (data[i].target === data[i - 1].target) {
              this.spanArr[this.pos] += 1;
              this.spanArr.push(0);
            } else {
              this.spanArr.push(1);
              this.pos = i;
            }
          }
        }
    },
    getParentid(data) {
        // data就是我们从后台拿到的数据
        for (var i = 0; i < data.length; i++) {
          if (i === 0) {
            this.parentidArr.push(1);
            this.parentid = 0;
          } else {
            // 判断当前元素与上一个元素是否相同
            if (data[i].parentid === data[i - 1].parentid) {
              this.parentidArr[this.parentidpos] += 1;
              this.parentidArr.push(0);
            } else {
              this.parentidArr.push(1);
              this.parentidpos = i;
            }
          }
        }
    },
    // 维度合并
    getSpanArr1(data) {
        // data就是我们从后台拿到的数据
      for (var i = 0; i < data.length; i++) {
        if (i === 0) {
          this.spanArr1.push(1);
          this.pos1 = 0;
        } else {
          // 判断当前元素与上一个元素是否相同
          if (data[i].dimension === data[i - 1].dimension) {
            this.spanArr1[this.pos1] += 1;
            this.spanArr1.push(0);
          } else {
            this.spanArr1.push(1);
            this.pos1 = i;
          }
        }
      }
    },
    // 指标合并
    getSpanArr2(data) {
        // data就是我们从后台拿到的数据
      for (var i = 0; i < data.length; i++) {
        if (i === 0) {
          this.spanArr2.push(1);
          this.pos2 = 0;
        } else {
          // 判断当前元素与上一个元素是否相同
          if (data[i].target === data[i - 1].target) {
            this.spanArr2[this.pos2] += 1;
            this.spanArr2.push(0);
          } else {
            this.spanArr2.push(1);
            this.pos2 = i;
          }
        }
      }
    },
    targetSpanMethod({ row, column, rowIndex, columnIndex }) {
      if (columnIndex === 0||1||2||3||4||5||6) {
        const _row = this.spanArr[rowIndex];
        const _col = _row > 0 ? 1 : 0;
        return {
          // [0,0] 表示这一行不显示， [2,1]表示行的合并数
          rowspan: _row,
          colspan: _col
        };
      }
      
      
    },
    // 合并行
    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
      if (columnIndex === 0) {
        const _row = this.spanArr[rowIndex];
        const _col = _row > 0 ? 1 : 0;
        return {
          // [0,0] 表示这一行不显示， [2,1]表示行的合并数
          rowspan: _row,
          colspan: _col
        };
      }
      if (columnIndex === 1) {
        const _row = this.spanArr1[rowIndex];
        const _col = _row > 0 ? 1 : 0;
        // console.log(`rowspan:${_row} colspan:${_col}`);
        return {
          // [0,0] 表示这一行不显示， [2,1]表示行的合并数
          rowspan: _row,
          colspan: _col
        };
      }
      if (columnIndex === 2||3||4||5||6||7) {
        const _row = this.spanArr2[rowIndex];
        const _col = _row > 0 ? 1 : 0;
        // console.log(`rowspan:${_row} colspan:${_col}`);
        return {
          // [0,0] 表示这一行不显示， [2,1]表示行的合并数
          rowspan: _row,
          colspan: _col
        };
      }
      
    },
    // 考核办法列表合并行
    methodSpanMethod({ row, column, rowIndex, columnIndex }) {
      // if (columnIndex === 0) {
      //   const _row = this.methodSpanArr1[rowIndex];
      //   const _col = _row > 0 ? 1 : 0;
      //   return {
      //     // [0,0] 表示这一行不显示， [2,1]表示行的合并数
      //     rowspan: _row,
      //     colspan: _col
      //   };
      // }
      if (columnIndex === 0||columnIndex === 6) {
        const _row = this.methodSpanArr[rowIndex];
        const _col = _row > 0 ? 1 : 0;
        return {
          // [0,0] 表示这一行不显示， [2,1]表示行的合并数
          rowspan: _row,
          colspan: _col
        };
      }
    },
    // 删除行
    deleteRow(row){
      this.rulesCopyList.splice(row.$index,1);
    },
    deleteRulesList(row){
      this.RulesList.splice(row.$index,1);
    },
    // 添加细则
    addRules(){
      this.RulesList.push(JSON.parse(JSON.stringify(this.rulesObject )))
    },
    // 选中指标后获取子栏目
    async selectIndex(val){
      if (val!='') {
      const from={
        id:val
      }
      const res = await gettargetinfo(from)
      this.targetsunList=res.data
      this.rulesObject={
        title: "", //这是卡片细则标题
        content: "", //这是卡片细则描述
        //unit: this.targetsunList.unites, //单位
        unit: '',
        referencescore: '', //参考分值
        cycle: this.targetsunList.cycle, //1：班；2：天；3：周；4：月；5：季度；6：年
        cycleattr: this.targetsunList.cycleattr, //辅助计数
        userlist: this.targetsunList.reportmap//执行人
      }
      this.RulesList.push(JSON.parse(JSON.stringify(this.rulesObject )))
      console.log("gettargetinfo")
      console.log(this.RulesList)
      this.cardShow=true
      }
    },
    // 选中子栏目后获取对应的考核细则
    async selectTargetsun(val){
      if (val!='') {
      const from={
        type: 1, //1：定性考核；2：定量考核
        targetid: this.form.target.toString(), //指标
        targetsunid: val.toString() //子栏目

      }
      const res = await gettasktargetcontary(from)
      this.rulesList=JSON.parse(JSON.stringify(res.data))
      this.rulesCopyList=JSON.parse(JSON.stringify(res.data))
      this.tableShow=true
      }
    },
    // 选中部门后获取指定的指标列表
    async selectDepartment(val){
      if (val!='') {
      const indexFrom={
        type:1,
        group:this.form.group.toString(),
        department:val.map(String),
      }
      const res = await gettasktarget(indexFrom)
      this.indexList=res.data
      this.indexList=res.data
      if (res.code==0) {
        this.targetShow=true
      }
      }
    },
    // 获取考核纬度列表
    async getDutyclasslist(){
       const res = await dutyclasslist(this.dutyClassFrom)
       this.dutyclasslist=res.data.list
    },
    // 获取部门列表
    async departmentlist(){
      const departmentFrom={
        id:3
      }
      const res = await departmentlist(departmentFrom)
      this.departmentList=res.data
    },
     // 选中的公司值
    async selectGroup(val){
      if (val!='') {
      const departmentFrom={
        id:parseInt(val)
      }
      const res = await departmentlist(departmentFrom)
      this.searchDepartmentList=res.data
      }
      
    },
    // 选中的公司值
    // async selectGroup(val){
    //   console.log("selectGroup")
    //   if (val!='') {
    //   const departmentFrom={
    //     id:val
    //   }
    //   const res = await departmentlist(departmentFrom)
      
    //   this.departmentList=res.data
    //   if (res.code==0) {
    //     this.form.parentid=this.targetsunList.relevantdepartmentsmap.map(Number)
    //     this.parentidShow=true
    //   }
    //   }
      
    // },
    // 编辑获取选中组件值
    getEditCheckedfrom(data){
      this.editChildInfo=data
      this.editAdd.parentId=this.editChildInfo.outId
    },
    // 获取员工列表
    async getSystemadminlist(){
      const res = await getgroupuser()
      this.grouplistBackup=res.data.list
    },
    // 初始化部门
    async initialDepartment(){
      
      const departmentFrom={
        id:3
      }
      const res = await departmentlist(departmentFrom)
      this.searchDepartmentList=res.data
      
      
    },
    // 获取公司
    // async getGrouplist(){
    //   const res = await getgroupdepartmap()
    //   this.companyList=res.data.list
    // },
    // 获取公司
    async getGrouplist(){
      const res = await getgroupdepartmap()
      this.companyList=res.data.list

    },
    // 获取部门
    async getbumenlist(){
      const res = await getgroupdepartmap()
      this.grouplist=res.data.list

    },
    // 添加获取选中组件值
    getCheckedfrom(data){
      this.addChildInfo=data
    },
    // 获取选中组件值
    getCheckedInfo(data){
      this.childInfo=data
    },
    //删除操作
    async deleteOperate(row) {
      console.log("row")
      console.log(row)
      this.$confirm('此操作将永久删除, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      })
        .then(async() => {
          const deleFrom={
            // type: 1, //1：定性考核；2：定量考核
            group: row.group, //归属集团
            // departmentid: row.parentid, //被考核部门
            dimension: row.dimension, //维度
            targetid: row.target, //考核指标
            //targetsun: row.targetsun //考核指标子栏目
          }
          const res = await newdeltarget(deleFrom)
          if (res.code === 0) {
            this.$message({
              type: 'success',
              message: '删除成功!'
            })
            
             this.getDataList()
          }
        })
    },
    // 新增按钮
    showAdd(){
      this.dialogFormVisible=true;
    },
    // 点击修改细则
    async showxize(row){
      const from = {
        // outid:row.id
        id: row.detailedtarget, //指标明细ID
        assid: row.dutyassessid //考核方案ID
      }
      const res = await getneweitedetailedtarget(from)
      this.xizeData=res.data
      this.xizeDig=true
    },
    // 修改子栏目名称弹窗
    async showEditming(row){
      const editDataFrom={
        group: row.group, //集团
        dimension: row.dimension, //维度
        targetid: row.target, //指标
        suntargetid: row.targetsun //子栏目
        }
      const res = await geteitesuntarterinfo(editDataFrom)
      
      this.nameFrom={
        id:row.targetsun,
        name:row.targetsunname,
        departmentmap:row.departidmap,
        operator:res.data
      }

      this.showzhiming=true
    },
    // 修改子栏目名称
    async xiuzhiming(){
      this.nameFrom.departmentmap=this.nameFrom.departmentmap.map(String)
      const res = await eitesuntargetname(this.nameFrom)
      this.nameFrom={}
      this.getzhilanmuList()
      this.showzhiming=false 
    },
    // 编辑部门按钮
    async showEdit(row){
      const editFrom={
        group: row.group, //集团
        dimension: row.dimension, //维度
        targetid: row.target //指标
          }
      const res = await getdepartforduty(editFrom)
      this.bumenEdit = res.data
      this.bumenEdit.departmentid=this.bumenEdit.departmentid.map(String)
      this.buMenEditDialog=true;
    },
    // 部门修改提交
    async buMenTi(){
       const editFrom={
          group: this.bumenEdit.group, //集团
          dimension: this.bumenEdit.dimension, //维度
          targetid: this.bumenEdit.target, //指标
          departary: this.bumenEdit.departmentid.map(String)
          }
      const res = await eitedepartforduty(editFrom)
      if (res.code === 0) {
          this.$message({
            type: 'success',
            message: '编辑成功',
            showClose: true
          })
        }
          this.getDataList();
          this.bumeneditCloseDialog();
    },
    // 重置搜索条件
    onReset() {
      this.searchInfo = {
        type:1,
      }
    },
    // 条件搜索
    onSubmit() {
      this.getDataList()
    },
    // 日期时间戳转日期格式
    formatDate(nS) {     
      return new Date(parseInt(nS) * 1000).toLocaleString().replace(/:\d{1,2}$/,' ');     
    },
   
    // 提交按钮
    async enterDialog(){
      console.log("this.rulesCopyList")
      console.log(this.rulesCopyList)
      this.$refs.addForm.validate(async valid => {
        if (valid) {
          this.form.evaluationlist=this.RulesList
          this.form.group=this.form.group.toString();
          this.form.target=this.form.target.toString();
          // this.form.targetsun=this.form.targetsun.toString();
          this.form.parentid=this.form.parentid.map(String);
          // const res = await addqualeval(this.form)
          const res = await adddutyrelation(this.form)
          if (res.code === 0) {
            this.$message({
              type: 'success',
              message: '添加成功',
              showClose: true
            })
            this.RulesList=[]
            this.RulesList.push(JSON.parse(JSON.stringify(this.rulesObject )))
            this.form.evaluationlist=this.RulesList
            this.form.group=parseInt(this.form.group)
            this.form.target=parseInt(this.form.target)
            this.form.targetsun=parseInt(this.form.targetsun)
            this.form.parentid=this.form.parentid.map(Number);
            this.Fraction=0;
            this.form.targetsuntitle='';
            this.getDataList();
          }else{

          }
          
        }
      })
    },

    // 编辑提交按钮
    async editEnterDialog(){
      this.$refs.editForm.validate(async valid => {
        if (valid) {

          const res = await eitequalevalcont(this.editAdd)
          if (res.code === 0) {
                  this.$message({
                    type: 'success',
                    message: '编辑成功',
                    showClose: true
                  })
                }
          this.getDataList();
          this.editCloseDialog();
        }
      })
    },
    // 修改bumen框关闭
    bumeneditCloseDialog() {
      this.bumenEdit={},
      this.buMenEditDialog = false
    },
    // 添加框关闭
    closeDialog() {
      this.initForm()
      this.dialogFormVisible = false
    },
    // 修改框关闭
    editCloseDialog() {
      this.editInitForm()
      this.editDialogFormVisible = false
    },
    // 添加重置表单
    initForm() {
      this.$refs.addForm.resetFields()
      this.form={
        type:1
      }
      this.RulesList=[]
      this.cardShow=false
      this.targetShow=false
      this.parentidShow=false

      console.log("this.form")
      console.log(this.form)
    },
    // 修改重置表单
    editInitForm() {
      this.$refs.editForm.resetFields()
      this.editAdd = {

      }
    },
    // 改变pageSize
    handleSizeChange(val) {
      this.searchInfo.pagesize=val
      this.getDataList(this.searchInfo)
    },
    // 改变page
    handleCurrentChange(val) {
      this.searchInfo.page=val
      this.getDataList(this.searchInfo)
    },
    // 获取初始数据
    async getDataList() {
      const that = this
      const res = await getdutyrelationlist()
      this.tableData = res.data
      // this.tableData.forEach(function(element, index) {
      //       that.$set(element,'treeData',{label:element.departmentmap[0].parentname,children:[]}),
      //       element.departmentmap.forEach(function(item, index) {
      //       element.treeData.children.push({label:item.parentname})

      //       })
      // })
    }
  }
}
</script>

<style lang="scss" scoped>
.dashboard {
  &-container {
    margin: 30px;
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}
.kuang{
   border-bottom :solid 1px  ;
}
.cluster-rs {
    text-align: center;
  }
  .annotation-rs{
    width: 100%;
    height: 100%;
    border: none;
    td{
      width: 155px;
      padding: 5px;
      border-right: none;
      text-align: center;
      vertical-align: middle;
    }
  }
  tr:last-child{
    td{
      border-bottom: none;
    }
  }
  .first{
    height: 600px;
  }
  .two{
    height: 400px;
  }
  .three{
    height: 300px;
  }
  .four{
    height: 200px;
  }
  .fives{
    height: 100px;
  }
</style>
