<template>
  <div class="app-container">
    <div class="jeuhg">
      <h3 style="text-align: center; font-size: 30px; color: red; margin-bottom: 20px;">{{user.dept.deptName}}发文收文办理签</h3>
      <el-form :label-position="labelPosition" :model="colleobje" ref="colleobje" v-show="showSearch" :inline="true">
      <el-row :gutter="10" class="mb8">
        <el-col :span="6" class="eigj" style="border: 1px solid red; border-bottom: 0; " >
        <el-form-item label="收文编号" prop="recieve_message_code">
          <el-input
            autosize
            v-model="colleobje.recieve_message_code">
          </el-input>
        </el-form-item>
        </el-col>
        <el-col :span="6" class="eigj" style="border: 1px solid red; border-bottom: 0; border-left: 0; ">
        <el-form-item label="来文机关" prop="message_from">
          <el-input
            autosize
            placeholder=""
            v-model="colleobje.message_from">
          </el-input>
        </el-form-item>
        </el-col>
        <el-col :span="6" class="eigj" style="border: 1px solid red; border-bottom: 0; border-left: 0; ">
        <el-form-item label="文件字号" prop="message_code">
          <el-input
            autosize
            placeholder=""
            v-model="colleobje.message_code">
          </el-input>
        </el-form-item>
        </el-col>
        <el-col :span="6" class="eigj" style="border: 1px solid red; border-bottom: 0; border-left: 0; ">
        <el-form-item label="收到日期" prop="recieve_time">
          <el-date-picker :disabled="false" @change="iChange" v-model="colleobje.recieve_time"   style="width: 100%"        type="date" :placeholder="'请输入'">
          </el-date-picker>
        </el-form-item>
        </el-col>
        <el-col :span="24" style="border: 1px solid red; border-bottom: 0; ">
        <el-form-item class="renhdy" label="文件标题:" prop="message_title">
          <el-input
            type="textarea"
            autosize
            placeholder=""
            v-model="colleobje.message_title">
          </el-input>
        </el-form-item>
        </el-col>
        <el-col :span="24" style="border: 1px solid red; border-bottom: 0; ">
        <el-form-item class="renhdy" label="正文上传:" prop="roleName">
          <el-upload :disabled="false" class="upload-demo" :headers="{Authorization: 'Bearer ' + getToken()}"
             :action="process + '/boman-file/upload'" :on-change="handleChangert"
            :on-success="upImageFn" :on-error="err" :on-remove="reseImage" :file-list="config">
            <el-button size="small" type="primary">点击上传</el-button>
          </el-upload>
          <div  class="el-upload__tip" style="margin-left: 5px; color: red; margin-top: 0; ">
                只能上传jpg/png/txt/word/pdf/exe/pdf/RAR/ZIP文件，且不超过100MB
          </div>
        </el-form-item>
        </el-col>
        <el-col :span="24" style="border: 1px solid red; border-bottom: 0; ">
        <el-form-item class="renhdy" style="width: 100%;" label="审核人:" prop="roleName">
          <el-input :disabled="true" v-model="colleobje.check_user_name">
              <!-- <el-button slot="prepend" @click="changeren">选择人员</el-button> -->
              <el-button style="padding: 9px 15px; font-size: 12px; border-radius: 3px;" size="small" type="primary" slot="prepend" @click="changeren">选择人员</el-button>
            </el-input>
            <!-- <p style="display: flex; justify-content: space-between;">
              <span style="width: 80%;">23</span>
              <el-button size="small" type="primary">点击上传</el-button>
            </p> -->
        </el-form-item>
        </el-col>
        <el-col :span="24" style="border: 1px solid red; border-bottom: 0; ">
        <el-form-item class="renhdy" label="部门拟办意见:" prop="dept_suggest">
          <el-input
            type="textarea"
            autosize
            :disabled="true"
            v-model="colleobje.dept_suggest">
          </el-input>
        </el-form-item>
        </el-col>
        <el-col :span="24" style="border: 1px solid red; border-bottom: 0; ">
        <el-form-item class="renhdy" label="办公室协办意见:" prop="office_suggest">
          <el-input
            type="textarea"
            autosize
            :disabled="true"
            v-model="colleobje.office_suggest">
          </el-input>
        </el-form-item>
        </el-col>
        <el-col :span="24" style="border: 1px solid red; border-bottom: 0; ">
        <el-form-item class="renhdy" label="领导批示:" prop="leader_suggest">
          <el-input
            type="textarea"
            autosize
            :disabled="true"
            v-model="colleobje.leader_suggest">
          </el-input>
        </el-form-item>
        </el-col>
        <el-col :span="24" style="border: 1px solid red;  ">
        <el-form-item class="renhdy" label="承办结果:" prop="result">
          <el-input
            type="textarea"
            autosize
            :disabled="true"
            v-model="colleobje.result">
          </el-input>
        </el-form-item>
        </el-col>

        <!-- <el-col :span="24" style="border: 1px solid red;  padding: 20px 0 20px 10px;">
        <el-form-item class="renhdy" label="备注:" prop="roleName">
          <el-input
            type="textarea"
            autosize
            placeholder="请输入内容"
            v-model="textarea1">
          </el-input>
        </el-form-item>
        </el-col> -->
        <el-col :span="24" style="text-align: right; padding-top: 20px;">
          <el-button type="danger" @click="submitForm" >保存</el-button>
        </el-col>
        </el-row>
      </el-form>
    </div>

    <!-- 添加或修改角色配置对话框 -->
   <el-dialog   :close-on-click-modal="false" title="选择人员" :visible.sync="shouew" width="980px" append-to-body>
     <el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
       <el-table-column label="日志编号" align="center" prop="id" />
     </el-table>

     <pagination
       v-show="total>0"
       :total="total"
       :page.sync="queryParams.pageNum"
       :limit.sync="queryParams.pageSize"
       @pagination="getList"
     />
     </el-dialog>
    <!-- 分配角色数据权限对话框 -->
    <el-dialog   :close-on-click-modal="false" title="选择人员" :visible.sync="modalShow" width="980px" append-to-body>
      <!-- <Flowshoe  :instanceId="instanceId"></Flowshoe> -->
      <div class="tab_bott">
        <div style="display: flex; flex-direction: column;">
          <div class="head-container">
            <el-input
              v-model="deptName"
              placeholder="请输入人员名称"
              clearable
              size="small"
              prefix-icon="el-icon-search"
              style="margin-bottom: 20px"
            />
          </div>
          <div class="head-container">
            <el-tree
              :data="deptOptions"
              :props="defaultProps"
              :expand-on-click-node="false"
              :filter-node-method="filterNode"
              ref="tree"
              @node-click="handleNodeClick"
            />
          </div>
        </div>
        <!-- <div class="tabBot_oje">
          <el-tabs type="border-card" v-model="activeName" @tab-click="handleClick">
            <el-tab-pane label="按部门" name="first">
              <el-tree :data="data" :props="defaultProps" show-checkbox   default-expand-all node-key="id" :setCheckedKeys='setCheckedKeys'  @check = "check"   ref="tree"  highlight-current @node-click="handleNodeClick" ></el-tree>
            </el-tab-pane>
            <el-tab-pane label="按角色" name="second">配置管理</el-tab-pane>
            <el-tab-pane label="按组" name="third">角色管理</el-tab-pane>
          </el-tabs>
        </div>
        <div class="tabBot_two">
          <el-card class="box-card" shadow="always">
            <div slot="header" class="clearfix">
              <span>人员对应的单位</span>
              <el-button style="float: right; padding: 3px 0" type="text">操作按钮</el-button>
            </div>
            <ul class="infinite-list infinite-listty" v-infinite-scroll="load" style="overflow:auto">
              <li v-for="i in count" class="infinite-list-item">{{ i }}</li>
            </ul>
          </el-card>
          <el-card class="box-card box-cardtt" shadow="always">
              <div slot="header" class="clearfix">
                <span>已选择</span>
               <el-button style="float: right; padding: 3px 0" type="text">确定</el-button>
               <el-button style="float: right; padding: 3px 0" type="text">取消</el-button>
              </div>
              <ul class="infinite-list infinite-listty" v-infinite-scroll="load" style="overflow:auto">
                <li v-for="item in liseh" class="infinite-list-item"> <el-checkbox
            style="margin-left: 30px"
            :indeterminate="item.isIndeterminate"
            v-model="item.isCheck"
            @change="checkTitle(item.isCheck, index)"
            >全选</el-checkbox
          >

          <el-checkbox-group
            v-model="item.checkedData"
            @change="checkItem(item.checkedData, index)"
          >
            <el-checkbox
              v-for="(a, index) in item.children"
              :label="a.value"
              :key="index"
              >{{ a.label }}</el-checkbox
            >
          </el-checkbox-group></li>
              </ul>
            </el-card>
        </div> -->
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listRoles,listIndex,   delRole, addRole,addbjectSave,addbjectSavety, updateRole, exportRole, dataScope, changeRoleStatus, buent,treeselectid } from "@/api/system/isses";
import {
    getToken
  } from "@/utils/auth";
  import {getUserProfile} from "@/api/system/config";
  import { group , getRole, getPersonnel, getMembers,delRoleses } from '@/api/system/election';
  import { listDept } from "@/api/system/dept";
  import { listRole } from "@/api/system/role";
  import { treeselect } from "@/api/system/dept";
  import Treeselect from "@riophae/vue-treeselect";
  import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
  name: "Role",
   components: {  Treeselect },
  data() {
    return {
      // 遮罩层
      loading: true,
      labelPosition:'right',
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 无限滚动
      count: 0,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 部门名称
      deptName: undefined,
      // 角色表格数据
      roleList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 是否显示弹出层（数据权限）
      openDataScope: false,
      menuExpand: false,
      menuNodeAll: false,
      deptExpand: true,
      deptNodeAll: false,
      // 日期范围
      dateRange: [],
      // 状态数据字典
      statusOptions: [],
      // 数据范围选项
      dataScopeOptions: [
        {
          value: "1",
          label: "全部数据权限"
        },
        {
          value: "2",
          label: "自定数据权限"
        },
        {
          value: "3",
          label: "本部门数据权限"
        },
        {
          value: "4",
          label: "本部门及以下数据权限"
        },
        {
          value: "5",
          label: "仅本人数据权限"
        }
      ],
      // 菜单列表
      menuOptions: [],
      // 部门列表
      deptOptions: [],
      // 角色
      deptOptionstwo:[],
      deptOptionsthre:[],
      // 查询参数
      queryParams: {
      },
      // 表单参数
      form: {},
      // 单位  名称
      mpany:{
        ompany:[],
        name:[]
        },
      defaultProps: {
        children: "users",
        label: "deptName",
        value:"id"
      },
      //
      // 表单校验
      rules: {
        roleName: [
          { required: true, message: "角色名称不能为空", trigger: "blur" }
        ],
        roleKey: [
          { required: true, message: "权限字符不能为空", trigger: "blur" }
        ],
        roleSort: [
          { required: true, message: "角色顺序不能为空", trigger: "blur" }
        ]
      },
      dialogImageUrl: '',
      process: process.env.VUE_APP_BASE_API,
      dialogVisible: false,
      disabled: false,
      filterList: [],
      config: [],
      configtwo: [],
      shouew:false,
      modalShow:false,
      forew:{
       table:'',
       fixedData:{
         id:-1
       }
      },
      list:[],
      activeName:'first',
      querjtgoe:{
        message_code:'',
        message_title:'',
        message_remark:'',
        send_time:''
      },
      liseh: [
            ],
      queryParamsser:{
       table:'',
       orderBy:'create_time desc',
       pageSize:10,
       pageNo:1,
       showData:['message_code']
      },
      tabData:[],
      postList:[],
      faerform:{
        table: '',
        objId: -1,
        fixedData: {}
      },
      lisehtwo:[
      ],
      data: [],
      deptList: [],
      rtuer: false,
      showtabc: 0,
      showche: false,
      idneese: {},
      quandet:false,
      dhiuw:[],
      // 组id
      elezu:0,
      fileList: [],
      titlet:'',
      user:{},
      colleobje:{}

    };
  },
  created() {
    this.forew.table = this.$route.query.tables;
    this.queryParamsser.table = this.$route.query.tables;
    this.forew.fixedData.id = this.$route.query.id;
    this.faerform.objId = this.$route.query.id;
    this.faerform.table = 'boman_recieve_dispatch_message';
    if(this.$route.query.tabname == 'shouwen'){
      this.titlet = '收文'
    }else if(this.$route.query.tabname == 'fawen'){
      this.titlet = '待归档'
    }
    this.getList();
    this.getTreeselect()
    this.getUser()
    this.getDicts("sys_normal_disable").then(response => {
      this.statusOptions = response.data;
    });
  },
  watch: {
    // 根据名称筛选部门树
    // deptName(val) {
    //   this.$refs.tree.filter(val);
    // }
  },
  methods: {
    /** 查询角色列表 */
    getList() {
      this.loading = true;
      console.log(this.forew)
      listRoles(this.forew).then(
        res => {
          console.log(res)
          if(res.data !== undefined){
            this.querjtgoe = res.data
            this.colleobje.recieve_message_code = res.data.recieve_message_code
            this.colleobje.message_from = res.data.message_from
            this.colleobje.message_code = res.data.message_code
            this.colleobje.roleName = res.data.roleName
            this.colleobje.message_title = res.data.message_title
            this.colleobje.dept_suggest = res.data.dept_suggest
            this.colleobje.office_suggest = res.data.office_suggest
            this.colleobje.leader_suggest = res.data.leader_suggest
            this.colleobje.office_suggest = res.data.office_suggest
            this.colleobje.leader_suggest = res.data.leader_suggest
            this.colleobje.result = res.data.result
            this.colleobje.check_user_name = res.data.check_user_name
            this.colleobje.recieve_time = res.data.recieve_time

            if(res.data.message_body !== undefined){
              this.config = res.data.message_body
            }
          }
        }
      );
    },
    // 历史字号数据查询
    lishiList(){
      console.log(346)
      listIndex(this.queryParamsser).then(response => {
        this.total = response.data.total;
        this.tabData = response.data.tableHeadList;
        this.postList = response.data.rows;
        for(var i = 0 ; i < this.postList.length; i++){
          console.log(this.postList[i].leavefrom_photo == '[]')
        }
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 取消按钮（数据权限）
    cancelDataScope() {
      this.openDataScope = false;
      this.reset();
    },
    // 表单重置
    reset() {
      if (this.$refs.menu != undefined) {
        this.$refs.menu.setCheckedKeys([]);
      }
      this.menuExpand = false,
      this.menuNodeAll = false,
      this.deptExpand = true,
      this.deptNodeAll = false,
      this.form = {
        roleId: undefined,
        roleName: undefined,
        roleKey: undefined,
        roleSort: 0,
        status: "0",
        menuIds: [],
        deptIds: [],
        menuCheckStrictly: true,
        deptCheckStrictly: true,
        remark: undefined
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!=1
      this.multiple = !selection.length
    },
    // 树权限（展开/折叠）
    handleCheckedTreeExpand(value, type) {
      // if (type == 'menu') {
      //   let treeList = this.menuOptions;
      //   for (let i = 0; i < treeList.length; i++) {
      //     this.$refs.menu.store.nodesMap[treeList[i].id].expanded = value;
      //   }
      // } else if (type == 'dept') {
        let treeList = this.deptOptions;
        for (let i = 0; i < treeList.length; i++) {
          this.$refs.dept.store.nodesMap[treeList[i].id].expanded = value;
        }
      // }
    },
    /** 提交按钮 */
    submitForm: function() {
      // this.colleobje.message_enclosure = JSON.stringify(this.querjtgoe.message_enclosure)
      this.faerform.fixedData = this.colleobje
      console.log(this.faerform)
      // this.$refs["form"].validate(valid => {
      //   if (valid) {
      //     if (this.form.roleId != undefined) {
      //       this.form.menuIds = this.getMenuAllCheckedKeys();
      //       updateRole(this.form).then(response => {
      //         this.msgSuccess("修改成功");
      //         this.open = false;
      //         this.getList();
      //       });
      //     } else {
      //       this.form.menuIds = this.getMenuAllCheckedKeys();
            addbjectSavety(this.faerform).then(response => {
              this.msgSuccess("操作成功");
              this.$router.go(-1)
              // this.open = false;
              // this.getList();
            });
      //     }
      //   }
      // });
    },
    /** 提交按钮（数据权限） */
    submitDataScope: function() {
      if (this.form.roleId != undefined) {
        this.form.deptIds = this.getDeptAllCheckedKeys();
        dataScope(this.form).then(response => {
          this.msgSuccess("修改成功");
          this.openDataScope = false;
          this.getList();
        });
      }
    },
    handleClick(index){
    if(index.index == 0){
      this.getTreeselect()
    }else if(index.index == 1){
      this.getTreeselectjue()
    }else if(index.index == 2){
      this.getTreeselecu()
    }
    },
    ziao(){
      console.log(23)
      this.shouew = true
      this.lishiList()
    },
    // 人员选择
    changeren(){
    this.modalShow = true

    },
    // 上传文件
    handleChangert(file, fileList) {
      this.fileList = fileList.slice(-3);
    },
    getToken() {
      return getToken()
    },
    reseImage(file, fileList) {
      let urls = ""
      if (file.response) {
        urls = file.response.url
      } else {
        urls = file.url
      }
      for (let i = this.config.length - 1; i >= 0; i--) {
        if (this.config[i].url == urls) {
          this.config.splice(i, 1);
        }
      }
      if(this.config.length == 0){
        this.faerform.message_body = undefined
      }else{
        this.faerform.message_body = JSON.stringify(this.config)
      }
    },
    reseImagetwo(file, fileList) {
      let urls = ""
      if (file.response) {
        urls = file.response.url
      } else {
        urls = file.url
      }
      for (let i = this.configtwo.length - 1; i >= 0; i--) {
        if (this.configtwo[i].url == urls) {
          this.configtwo.splice(i, 1);
        }
      }
     console.log(this.configtwo)
     this.faerform.message_enclosure = this.configtwo
    },
    handlePictureCardPreview(file) {
      console.log(file)
      this.dialogImageUrl = file.url;
      this.dialogVisible = true;
    },
    upImageFn(res, file) {
      if(res.code !== 200){
        this.msgSuccess('上传失败');
        return false
      }else{
        this.msgSuccess('上传成功');
        this.config.push(res.data);
        this.faerform.message_body = this.config
        this.faerform.message_body = JSON.stringify(this.faerform.message_body)
      }
      console.log(this.config)
    },
    upImageFntwo(res, file) {
      this.configtwo.push(res.data);
      this.faerform.message_enclosure  = this.configtwo
      console.log(this.configtwo)
    },
    // 时间控件
    iChange(){

    },
    err(){
      this.msgSuccess("上传失败");
     console.log(35)
    },
    load(){

    },
    // 点击单元格
    cellClick(row){
      console.log(row)
      this.shouew =  false
      this.querjtgoe.message_code = row.message_code

    },
    // 树形结构
    // 节点单击事件
   handleNodeClick(data) {
     console.log(data);
     this.colleobje.check_user_id = data.id
     this.colleobje.check_user_name = data.userName
     // this.queryParams.deptId = data.id;
     // this.staff(data.id);
     this.modalShow = false
     // this.getList();
   },
    /** 查询部门下拉树结构 */
    getTreeselect() {
      treeselectid().then(response => {
        this.deptOptions = response.data;
      });
    },
    // 查询角色
    getTreeselectjue() {
      this.loading = true;
      listRole(this.queryParams).then(response => {
        this.deptOptionstwo = this.handleTree(response.rows, "id");
        this.loading = false;
      });
    },
    // 查询组
    getTreeselecu() {
      this.loading = true;
      group(this.queryParams).then(response => {
        this.deptOptionsthre = this.handleTree(response.data, "id");
        this.loading = false;
      });
    },
    /** 转换角色数据结构 */
    normalizer(node) {
      // if (node.children && !node.children.length) {
      //   delete node.children;
      // }
      return {
        id: node.id,
        label: node.roleName,
      };
    },
    /** 转换组数据结构 */
    normalizerty(node) {
      return {
        id: node.id,
        label: node.groupName,
      };
    },
   // 点击组/角色
     djieskle(node, instanceId) {
       this.personnel(node.id);
       console.log(node, instanceId);
     },
     djieskletwo(node, instanceId) {
       this.members(node.id);
       this.elezu = node.id
       console.log(node, instanceId);
     },
     check(data, value) {
       console.log(this.$refs.tree.getCheckedKeys());
       // 获取选中的子节点
       // let checkedKeys = this.$refs.tree.getCheckedKeys();
       // 获取选中的父节点
       let hafCheckedKeys = this.$refs.tree.getHalfCheckedKeys();
       console.log(this.$refs.tree.getHalfCheckedKeys());

       console.log(data, value);
     },
     // 点击全选
     quande(){
       var dueg = []
       dueg = (this.dhiuw)
      this.quandet = true
      var that =  this
      // dueg.push(index)
      // this.lisehtwo = dueg
      // this.lisehtwo.push(index);
      // this.lisehtwo = [...new Set(this.lisehtwo)];
      // that.positions.map(train => {
      //   that.new_Positions.push(train.trainId);
      // });
      // that.resultArr = []; //去重后的数组
      var flag;
      for (var i in dueg) {
        flag = true;
        for (var j in that.lisehtwo) {
          if (that.lisehtwo[j].id == dueg[i].id) {
            flag = false;
            break;
          }
        }
        if (flag) {
          that.lisehtwo.push(dueg[i]);
        }
      }
     },
     // 点击全部删除
     eledelte(){
      this.lisehtwo = []
     },
     // 点击删除
     lidele(index) {
       for (let i = this.lisehtwo.length - 1; i >= 0; i--) {
         if (this.lisehtwo[i].id == index.id) {
           this.lisehtwo.splice(i, 1)
         }
       }
     },
     // 点击添加
     reyantt(index) {
       var dueg = [];
       this.idneese = index;
       var that =  this
       dueg.push(index)
       // this.lisehtwo = dueg
       // this.lisehtwo.push(index);
       // this.lisehtwo = [...new Set(this.lisehtwo)];
       // that.positions.map(train => {
       //   that.new_Positions.push(train.trainId);
       // });
       // that.resultArr = []; //去重后的数组
       var flag;
       for (var i in dueg) {
         flag = true;
         for (var j in that.lisehtwo) {
           if (that.lisehtwo[j].id == dueg[i].id) {
             flag = false;
             break;
           }
         }
         if (flag) {
           that.lisehtwo.push(dueg[i]);
         }
       }

       // for(var i = 0 ; i <this.lisehtwo.length; i++ ){
       //   if(this.lisehtwo[i].id == index.id){
       //     this.lisehtwo.splice(i,1)
       //   }
       // }
       // })
     },
     // 点击确定
     determine(){
       var eledete = []
      this.lisehtwo.filter(route=>{
        eledete.push(route.id)
      })
      eledete  = eledete.join(',')
      console.log(eledete)
      // this.elezu
      this.loading = true;
      buent(this.lisehtwo).then(response => {
        // this.lisehtwo = response.data;
        // this.dhiuw = response.data
        this.mpany.ompany = response.deptNameList
        this.mpany.name = response.roleNameList
        console.log( this.mpany.ompany)
        if(response.code == 200){
          this.msgSuccess('操作成功');
          this.modalShow = false
        }
        this.loading = false;
      });
     },
     checkItem(val, index) {
       console.log(val);
       this.showche = !this.showche;
       console.log(this.showche);
       var that = this;
       let jueg = [];
       let checkedCount = val.length;
       this.liseh[index].isCheck = checkedCount === this.liseh[index].children.length;

       this.liseh[index].isIndeterminate = checkedCount > 0 && checkedCount < this.liseh[index].children.length;
       this.liseh[index].children.filter(router => {
         // console.log(123)
         for (var i = 0; i < val.length; i++) {
           if (this.showche == true) {
             //选中
             console.log('选中');
             if (router.id == val[i]) {
               jueg.push(router);
               this.lisehtwo.push(router);
               // console.log(router)
               console.log(this.lisehtwo);
               for (var j = 0; j < that.lisehtwo.length; j++) {
                 if (that.lisehtwo[i].id !== val[i]) {
                   this.lisehtwo.push(router);
                 }
               }
               // that.lisehtwo.filter(routers=>{
               //   console.log(this.lisehtwo)
               //   console.log(routers,val[i])
               //   if(routers.id !== val[i]){
               //      this.lisehtwo.push(router)
               //   }
               // })
             }
           } else {
             // 取消选中
           }
         }
       });
       // this.lisehtwo.push(jueg)
       console.log(this.lisehtwo);
       // console.log(this.liseh[index].isIndeterminate)
     },
     checkTitle(val, index) {
       console.log(val, index);
       let arr = [];
       let jueg = [];
       const re = this.liseh[index].children;
       //全选
       if (val) {
         for (let i = 0; i < re.length; i++) {
           arr[i] = re[i]['id'];
           jueg[i] = re[i];
           this.lisehtwo.push(re[i]);
         }
         // this.lisehtwo.push(jueg)
       } else {
         this.lisehtwo = [];
       }
       console.log(this.lisehtwo);
       this.liseh[index].checkedData = arr;
       this.liseh[index].isIndeterminate = false;
     },
     // 筛选节点
     filterNode(value, data) {
       // return console.log(value)
       if (!value) return true;
       return data.deptName.indexOf(value) !== -1;
     },
     // 按照部门查询人员
     staff(index) {
       this.loading = true;
       var that = this;
       getRole(index).then(response => {
         // this.deptOptionsthre = this.handleTree(response.data, "id");
         // this.rtuer = true
         this.liseh = []
         this.liseh = response.data;
         this.dhiuw = response.data
         this.loading = false;
       });
     },
     // 按照角色查询人员
     personnel(index) {
       this.loading = true;
       getPersonnel(index).then(response => {
         // this.deptOptionsthre = this.handleTree(response.data, "id");        this.liseh = response.data;
         this.liseh = []
         this.liseh = response.data;
         this.dhiuw = response.data
         this.loading = false;
       });
     },
     // 按照组查询人员
     members(index) {
       this.loading = true;
       getMembers(index).then(response => {
         // this.deptOptionsthre = this.handleTree(response.data, "id");
         // this.liseh = response.data;
         // response.data
         // this.lisehtwo.push(response.data)
         this.dhiuw = response.data
         this.dhiuw.filter(route=>{
           this.lisehtwo.push(route)
         })
         this.loading = false;
       });
     },
     // 用户信息
           getUser() {
             getUserProfile().then(response => {
               this.user = response.data;
               // this.getLisalendar()
               // this.getLismemorandum()
             });
           },
   }
  // }
  // }
};
</script>


<style lang="scss">
  .jeuhg{
   .el-form-item{
     margin-bottom: 0;
     width: 100%;
   }
   .el-form-item__content{
      width: 100%;
   }
   .el-form-item__label{
     color: red;
    width: 12%;
    // border-right: 1px solid red;
    // text-align: center;
   }
   .eigj{
     padding: 0 !important;
     .el-form-item__label{
       width: 100%;
       text-align: center;
       border-bottom:  1px solid red;
       padding:  7px 0 7px 0;
     }
      .el-form-item__content{
         padding:  7px 0 7px 0;
      }
   }
   input{
     background: none;
     	  outline: none;
     	  border: none;
   }
  .el-input-group__prepend{
    background-color: #1890ff !important;
    color: #fff !important;
  }
  .el-input-group__append{
    background-color: #1890ff !important;
    color: #fff !important;
  }
  .renhdy{
    .el-form-item__content{
      width: 85%;
      border-left: 1px solid red;
      padding:  9px 0 9px 10px ;
    }
    .el-form-item__label{
      padding:  7px 10px 0 0 ;
    }


  }
  .upload-demo{
     text-align: right;
     display: flex;
     // ul{
     //   display: flex;
     // }
  }
  .el-textarea__inner{
    background-color: #fff !important;
    border: 0 !important;
  }
  .el-input__inner{
    background-color: #fff !important;
    border: 0 !important;
  }
  .el-input.is-disabled .el-input__inner{
    color: #333;
  }
  }
</style>
<style scoped  lang="scss">
  .app-container{
    padding: 0 80px !important;
    padding-top: 20px !important;
  }
  .tab_bott {
    display: flex;
  }
  .tabBot_oje {
    width: 40%;
  }
  .tabBot_two {
    width: 50%;
    margin-left: 30px;
  }
  .box-cardtt{
    margin-top: 30px;
  }
</style>
