<template>
  <div class="app-container">
    <div class="jeuhg">
      <h3 style="text-align: center; font-size: 30px; color: red; margin-bottom: 20px;">潜山市教育局{{titlet}}稿纸</h3>
      <el-form :model="querjtgoe" ref="querjtgoe" :rules="rules" v-show="showSearch" :inline="true">
      <el-row :gutter="10" class="mb8">
        <el-col :span="12" style="border: 1px solid red; border-bottom: 0; padding: 15px 0 15px 10px;" >
        <el-form-item :label="titlet + '字号:'" prop="message_code">
          <el-input placeholder="请输入内容" v-model="querjtgoe.message_code">
              <el-button slot="append" @click="ziao">历史字号</el-button>
            </el-input>
        </el-form-item>
        </el-col>
        <el-col :span="12" style="border: 1px solid red; border-bottom: 0; border-left: 0; padding: 15px 0 15px 10px;">
        <el-form-item :label="titlet + '日期:'" prop="message_time">
          <el-date-picker :disabled="false" @change="iChange" v-model="querjtgoe.message_time" value-format="yyyy-MM-dd"   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; padding: 15px 0 15px 10px;">
        <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>
        </el-form-item>
        </el-col>
        <el-col :span="24" style="border: 1px solid red; border-bottom: 0; padding: 15px 0 15px 10px;">
        <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-preview="handlePictureCardPreview"  :on-success="upImageFntwo" :on-error="err" :on-remove="reseImagetwo" :file-list="configtwo">
            <el-button size="small" type="primary">点击上传</el-button>
          </el-upload>
        </el-form-item>
        </el-col>
        <el-col :span="24" style="border: 1px solid red; border-bottom: 0; padding: 15px 0 15px 10px;">
        <el-form-item class="renhdy" style="width: 100%;" label="分发人员:" prop="roleName">
          <el-input v-model="messageReun"  :disabled="true"  >
              <el-button 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; padding: 15px 0 15px 10px;">
        <el-form-item class="renhdy" label="分发单位:" prop="ompany">
          <!-- <el-input
            type="textarea"
            autosize
            :disabled="true"
            placeholder="请输入内容"
            v-model="mpany.ompany">
          </el-input> infinite-list infinite-listty-->
          <ul class="infinite-listopma " v-infinite-scroll="load" style="overflow:auto">
              <li v-for="item in mpany.ompany" :key = 'item'>{{item}}</li>
            </ul>
          <!-- <p><span>34</span></p> -->
        </el-form-item>
        </el-col>
        <el-col :span="24" style="border: 1px solid red; border-bottom: 0; padding: 15px 0 15px 10px;">
        <el-form-item class="renhdy" label="角色名称:" prop="name">
          <ul class="infinite-listopma " v-infinite-scroll="load" style="overflow:auto">
              <li v-for="item in mpany.name" :key = 'item'>{{item}}</li>
            </ul>
        </el-form-item>
        </el-col>
        <el-col :span="24" style="border: 1px solid red; border-bottom: 0; padding: 15px 0 15px 10px;">
        <el-form-item label="文件标题:" prop="message_title">
          <el-input
            v-model="querjtgoe.message_title"
            placeholder="请输入文件标题"
            clearable
            size="small"
            style="width: 100%"
            @keyup.enter.native="handleQuery"
          />
        </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="message_remark">
          <el-input
            type="textarea"
            autosize
            placeholder="请输入内容"
            v-model="querjtgoe.message_remark">
          </el-input>
        </el-form-item>
        </el-col>
        <el-col :span="24" style="text-align: right; padding-top: 20px;">
          <el-button type="danger" :disabled="taegshouw" @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 @cell-click= 'cellClick' v-loading="loading" :data="postList" @selection-change="handleSelectionChange">
       <el-table-column label="日志编号" align="center" prop="message_code" />
     </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 class="tabBot_oje">
          <el-tabs type="border-card" v-model="activeName" @tab-click="handleClick">
            <!-- :setCheckedKeys='setCheckedKeys' :getCheckedKeys = "getCheckedKeys" -->
            <el-tab-pane label="按部门" name="first">
              <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"
                  default-expand-all
                  @node-click="handleNodeClick"
                />
              </div>
            </el-tab-pane>
            <el-tab-pane label="按角色" name="second" style="height: 400px;">
               <treeselect v-model="form.parentId" :options="deptOptionstwo" :normalizer="normalizer" :flat="true" :maxHeight="150" @select="djieskle" placeholder="点击选择角色" />
            </el-tab-pane>
            <el-tab-pane label="按组" name="third" style="height: 400px;">
             <treeselect  v-model="form.parentIdty" :options="deptOptionsthre" :normalizer="normalizerty" :flat="true" @select="djieskletwo" :maxHeight="350" placeholder="点击选择组" />
            </el-tab-pane>
          </el-tabs>
        </div>
        <div class="tabBot_two">
          <el-card class="box-card box-cardtt" shadow="always">
              <div slot="header" class="clearfix">
                <span>人员</span>
               <el-button style=" float: right;  padding: 3px 10px;" type="danger" plain @click="eledelte">删除</el-button>
               <el-button style=" float: right; padding: 3px 10px;margin-right: 20px;" type="primary" plain @click="quande">全选</el-button>
              </div>
              <ul class="infinite-list infinite-listty" v-infinite-scroll="load" style="overflow:auto">
                  <li
                    v-for="(item, index) in liseh"
                    :class="[ quandet==true? 'infinite-list-itemty infinite-list-itemss' : item.id == idneese.id ? 'infinite-list-itemty infinite-list-itemss' : 'infinite-list-itemty']"
                    :key="index"
                    @click="reyantt(item)"
                  >
                    {{ item.userName }}
                  </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" @click = 'determine'>确定</el-button>
                </div>
                <ul class="infinite-list infinite-listty" v-infinite-scroll="load" style="overflow:auto">
                  <li v-for="item in lisehtwo" @click="lidele(item)" :key="item.id" class="infinite-list-item">
                    {{ item.userName }}
                    <img src="../../../assets/images/dele.png" alt="" class="index_navTimeimg" />
                  </li>
                </ul>
              </el-card>
        </div>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listRoles,listIndex,   delRole, addRole,addbjectSave, updateRole, exportRole, dataScope, changeRoleStatus, buent,issdanelist,issdaneid } from "@/api/system/isses";
import {
    getToken
  } from "@/utils/auth";
   import {getUserProfile} from "@/api/system/config";
   import {tabsubm} from "@/api/system/table";
  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,
      // 选中数组
      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: "children",
        label: "label"
      },
      // 表单校验
      rules: {
        message_code: [
          { required: true, message: "发文字号不能为空", trigger: "blur" }
        ],
        message_time: [
          { required: true, message: "发文日期不能为空", trigger: "blur" }
        ],
        message_title: [
          { 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: {},
        children:[{
        table: '',
        objId: -1,
        fixedData:{}
        }]
      },
      lisehtwo:[
      ],
      data: [],
      deptList: [],
      rtuer: false,
      showtabc: 0,
      showche: false,
      idneese: {},
      quandet:false,
      dhiuw:[],
      // 组id
      elezu:0,
      fileList: [],
      titlet:'',
      tabled:'',
      objeuisd:-1,
      messageReun:'',
      frowtse:{

      },
      taegshouw:false,


    };
  },
  created() {
    this.forew.table = this.$route.query.tables;
    this.queryParamsser.table = this.$route.query.tables;
    this.tabled =  this.$route.query.tables;
    this.objeuisd = this.$route.query.id - 0;
    this.forew.fixedData.id = this.$route.query.id - 0;
    this.faerform.objId = this.$route.query.id - 0;
    this.faerform.table = this.$route.query.tables;

    this.frowtse.businessTypeName = this.$route.query.tables;
    this.frowtse.dbname = this.$route.query.tables;

    this.querjtgoe.message_situation = this.$route.query.tabname - 0;
    if(this.$route.query.tabname == 'shouwen'){
      this.titlet = '收文'
    }else if(this.$route.query.tabname == 1){
      this.titlet = '发文'
    }
    if(this.objeuisd !== -1){
      this.frowtse.businessType = this.$route.query.id - 0;
      this.issdane()
    }
    this.getUser()
    this.gerdw()
    this.getList();
    this.getTreeselect()
    this.getDicts("sys_normal_disable").then(response => {
      this.statusOptions = response.data;
    });
  },
  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
            if(res.data.message_upload !== undefined && res.data.message_upload !== null ){
              this.config = JSON.parse(res.data.message_upload)
              // this.configtwo = res.data.message_enclosure
            }
            if(res.data.message_enclosure !== undefined && res.data.message_enclosure !== null ){
              // this.config = res.data.message_upload
              this.configtwo = JSON.parse(res.data.message_enclosure)
            }

            if(res.data.status == '未提交'){
              this.taegshouw = false
            }else{
              this.taegshouw = true
            }
          }
        }
      );
    },
    // 分发单位  人员名称查询
    issdane(){
      console.log(346)
      this.loading = false;
      let jueg = []
      let nese = []
      issdanelist(this.objeuisd).then(response => {
        if(response.code == 200){
          this.lisehtwo = response.data
          this.messageReun = '已选择' + response.data.length +'人'
          this.lisehtwo.filter(route=>{
            jueg.push(route.receive_dept_name)
            nese.push(route.receive_user_name)
          })
          this.mpany.ompany = jueg
          this.mpany.name = nese
        }

        // 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;
      });
    },
    // 历史字号数据查询
    lishiList(){
      console.log(346)
      this.loading = false;
      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() {
      // 获取当前时间戳
      var  date1 =new Date();
      // let tmie = Date.parse(date1) / 1000
      let tmie = this.dateFormat()
      console.log(tmie)
      if(this.lisehtwo.length == 0){
         this.msgSuccess("请选择分发人员");
         return false
      }
      for(var i = 0 ; i < this.lisehtwo.length; i++){
        this.faerform.children[i] = {table:'',objId:'',fixedData:{}}
        this.faerform.children[i].table = 'boman_message_receive'
        if(this.objeuisd == -1){
          this.faerform.children[i].objId = this.objeuisd
        }else{
          this.faerform.children[i].objId = this.lisehtwo[i].id
        }

        // this.faerform.children[i].fixedData.receive_user_id = this.lisehtwo[i]
        this.faerform.children[i].fixedData.message_id = 'fk.boman_message'
        this.faerform.children[i].fixedData.send_message_time = tmie
        if(this.objeuisd == -1){
          this.faerform.children[i].fixedData.receive_user_id = this.lisehtwo[i].id
        }else{
          this.faerform.children[i].fixedData.receive_user_id = this.lisehtwo[i].receive_user_id
        }

        this.faerform.children[i].fixedData.receive_user_name = this.lisehtwo[i].userName
        if(this.lisehtwo[i].dept !== undefined && this.lisehtwo[i].dept !==null){
          this.faerform.children[i].fixedData.receive_dept_name = this.lisehtwo[i].dept.deptName
        }else{
          this.faerform.children[i].fixedData.receive_dept_name = this.lisehtwo[i].deptName
        }

      }
      console.log(this.faerform.children[i])
      // this.faerform.children
      // this.querjtgoe.message_upload = JSON.stringify(this.querjtgoe.message_upload)
      // this.querjtgoe.message_enclosure = JSON.stringify(this.querjtgoe.message_enclosure)
      this.querjtgoe.message_id = 'fk.boman_message'
      this.querjtgoe.send_time = tmie
      this.faerform.fixedData = this.querjtgoe
      console.log(this.faerform)
      this.$refs["querjtgoe"].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();
            addbjectSave(this.faerform).then(response => {
              // this.msgSuccess("操作成功");
              this.frowtse.businessCodes = response.data[0].data
              
              this.sbreulw()
              // 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);
        }
      }
      this.querjtgoe.message_upload = 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.querjtgoe.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.querjtgoe.message_upload = this.config
        this.querjtgoe.message_upload = JSON.stringify(this.querjtgoe.message_upload)
      }

      console.log(res)
    },
    upImageFntwo(res, file) {
      if(res.code == 200){
        this.msgSuccess('上传成功');
        this.configtwo.push(res.data);
        this.querjtgoe.message_enclosure  = this.configtwo
        this.querjtgoe.message_enclosure  = JSON.stringify(this.querjtgoe.message_enclosure)
      }else{
        this.msgSuccess('上传失败');
        return false
      }

      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.queryParams.deptId = data.id;
     this.staff(data.id);
     this.quandet = false
     // this.getList();
   },
    /** 查询部门下拉树结构 */
    getTreeselect() {
      treeselect().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(this.lisehtwo)
      this.messageReun = '已选择' + this.lisehtwo.length +'人'
      // 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) {
       if (!value) return true;
       return data.label.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.liseh = []
         this.liseh = response.data;
         // this.dhiuw = response.data
         // this.dhiuw.filter(route=>{
         //   this.lisehtwo.push(route)
         // })
         this.loading = false;
       });
     },
     // 提交
     sbreulw(){
        tabsubm(this.frowtse).then(response => {
          if (response.resultCode == 0) {
            this.msgSuccess('提交成功');
          }
          this.$store.dispatch('tagsView/delView', this.$route);
          // this.reload();
          this.$router.go(-1)
          // this.formeanti.commitData = []
          // this.formy.status = 1
          // this.formeanti.commitData.push(this.formy)
          // this.antiSubmission();
        });
     },
     // 获取表单id
     gerdw(){
      issdaneid(this.faerform.table).then(res=>{
        console.log(res)
        this.frowtse.businessType = res.data.id
      })
     },
     // 用户信息
           getUser() {
             getUserProfile().then(response => {
               this.querjtgoe.send_user_id = response.data.id
               this.querjtgoe.send_user_name = response.data.userName
               this.querjtgoe.create_dept_nam = response.data.dept.deptName
               this.faerform.fixedData.send_user_id = response.data.id
               this.frowtse.initiator = response.data.id
               this.frowtse.userName = response.data.userName
               // this.user = response.data;
               // this.getLisalendar()
               // this.getLismemorandum()
               this.init();
               this.getList();
             });
           },
           // 时间转换
     dateFormat() {
           var date = new Date();
               var month = date.getMonth() + 1;
               var strDate = date.getDate();
               var hours = date.getHours()
               var minus = date.getMinutes()
               var secong = date.getSeconds()
               if (month >= 1 && month <= 9) {
                   month = "0" + month;
               }
               if (strDate >= 0 && strDate <= 9) {
                   strDate = "0" + strDate;
               }
               if (hours >= 0 && hours <= 9) {
                   hours = "0" + hours;
               }
               if (minus >= 0 && minus <= 9) {
                   minus = "0" + minus;
               }
               if (secong >= 0 && secong <= 9) {
                   secong = "0" + secong;
               }
               var currentDate = date.getFullYear() + "-" + month + "-" + strDate
                       + " " + hours + ":" + minus + ":" + secong;
               return currentDate;
         },
   }
  // }
  // }
};
</script>


<style lang="scss">
  .jeuhg{
   .el-form-item{
     margin-bottom: 0;
     width: 100%;
   }
   .el-form-item__content{
      width: 80%;
   }
   .el-form-item__label{
     color: red;
   }
   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%;
    }

  }
  .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;
  }
  .infinite-list {
    height: 150px;
    margin-bottom: 20px;
    .infinite-list-item {
      width: 20% !important;
      display: flex;
      // justify-content: space-between;
      align-items: center;
      text-align: center;
      list-style: none;
      height: 30px;
      // line-height: 30px;
    }
    .infinite-list-itemss {
      color: #1890ff;
    }
  }
  .infinite-listty {
    display: flex;
    flex-wrap: wrap;
    .infinite-list-itemty {
      width: 20%;
      display: flex;
      // justify-content: space-between;
      height: 40px;
      line-height: 40px;
      // text-align: center;
      list-style: none;
      // border-radius: 40px;
      // border: 1px solid #eee;
      // border-bottom: 1px solid #eee;
    }
  }
  // 分发人员
  .infinite-listopma{
   width: 100%;
   display: flex;
   flex-wrap: wrap;
   justify-content: flex-start;
   li{
     list-style: none;
     width: 20%;
   }
  }
  .tab_bott {
    display: flex;
  }
  .tabBot_oje {
    width: 40%;
  }
  .tabBot_two {
    width: 50%;
    margin-left: 30px;
  }
  .box-cardtt{
    margin-top: 30px;
  }
  .index_navTimeimg {
    width: 10px;
    height: 10px;
    margin-left: 5px;
  }
</style>
