<template>
  <div class="app-container">
    <div class="jeuhgs">
      <h3 style="text-align: center; font-size: 30px; color: red; margin-bottom: 20px;">潜山市教育局{{titlet}}稿纸</h3>
      <el-row :gutter="10" class="mb8">
        <el-col :span="1.5">
          <el-button
            type="primary"
            plain
            size="mini"
            @click="rogress"
            v-if="objeuisd !== -1"
            style="padding: 9px 15px; font-size: 12px; border-radius: 3px;"
          >查看进度</el-button>
        </el-col>
      </el-row>
      <el-form :model="querjtgoe" ref="querjtgoe" :rules="rules" v-show="showSearch" :inline="true" label-width="90px">
      <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 style="padding: 9px 15px; font-size: 12px; border-radius: 3px;" 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 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; border-bottom: 0; padding: 15px 0 5px 10px;">
        <el-form-item class="renhdys" 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" :on-preview="handlePictureCardPreview" :before-upload="befors">
            <el-button size="small" type="primary">点击上传</el-button>

          </el-upload>
<div  class="el-upload__tip" style="margin-left: 5px; color: red; margin-top: 0;">
              请上传pdf文档,且不超过100MB
        </div>
        </el-form-item>
        </el-col>
        <el-col :span="24" style="border: 1px solid red; border-bottom: 0; padding: 15px 0 5px 10px;">
        <el-form-item class="renhdys" style="padding-bottom: 0;" 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>
          <div  class="el-upload__tip" style="margin-left: 5px; color: red; margin-top: 0; ">
                只能上传jpg/png/txt/word/pdf/exe/RAR/ZIP/ofd/Excel文件，且不超过100MB
          </div>
        </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="renhdys" style="width: 100%;" label="分发人员:" prop="roleName">
          <el-input v-model="messageReun"  :disabled="true"  >
              <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; padding: 15px 0 15px 10px;">
        <el-form-item class="renhdys renhdytwo" style="display: flex; align-content: center;" 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="renhdys renhdytwo" style="display: flex; align-content: center;" 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;  padding: 20px 0 20px 10px;">
        <el-form-item class="renhdys" 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.nickName }}
                  </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.nickName }}
                    <img src="../../../assets/images/dele.png" alt="" class="index_navTimeimg" />
                  </li>
                </ul>
              </el-card>
        </div>
      </div>
    </el-dialog>
    <!-- 图片预览 -->
    <el-dialog   :close-on-click-modal="false" title="预览" :visible.sync="imashow" width="1200px" append-to-body>
    <div class="demo-image__preview">
      <img v-if="!shouewhu" :src="dialogImageUrl" alt="" style="width: 100%;">
      <iframe v-if="shouewhu" :src="dialogImageUrl" frameborder="0" style="width: 100%; height: 100vh;"></iframe>
    </div>
    </el-dialog>
    <!-- 流程进度 -->
    <el-dialog :close-on-click-modal="false" title="流程进度" :visible.sync="modalShowdu" width="1180px" append-to-body>
      <div style="display: flex;">
        <div style="width: 60%;">
          <el-row :gutter="10" class="mb8">
            <el-col :span="1.5">
              <span style="margin-right: 10px;">未读收文</span>
              <el-button
                type="primary"
                plain
                size="mini"
                @click="eceive"
              >一键催收文</el-button>
            </el-col>
          </el-row>
          <el-table v-loading="loading" :data="listnemd" @selection-change="handleSelectionChange" stripe>
            <el-table-column type="selection" width="55" align="center" />
            <el-table-column label="姓名" align="center" prop="receive_user_name" />
            <el-table-column label="部门" align="center" prop="receive_dept_name" />
            <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
              <template slot-scope="scope">
                <el-button
                  size="mini"
                  type="text"
                  @click="eceive(scope.row,2)"
                >催收文</el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div style="width: 100%; margin-left: 20px;" >
          <el-row :gutter="10" class="mb8">
            <el-col style="margin-bottom: 8px;" :span="1.5">
              <span >已读收文</span>
            </el-col>
          </el-row>
          <el-table :border="false" v-loading="loading" :data="listnemrt" @selection-change="handleSelectionChange">
            <el-table-column label="姓名" align="center" prop="receive_user_name" />
            <el-table-column label="部门" align="center" prop="receive_dept_name" />
            <el-table-column width="180px" label="收文时间" align="center" prop="send_message_time" />
          </el-table>
        </div>
        <Flowshoe  :instanceId="instanceId"></Flowshoe>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  import Flowshoe from '@/components/flowshoe'
import { listRoles,listIndex,   delRole, addRole,addbjectSave, updateRole, exportRole, dataScope, changeRoleStatus, buent,issdanelist,issdaneid,weiduhegw,addbjectSawen } 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,Flowshoe },
  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: [],
      instanceId: 0,
      // 状态数据字典
      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,
      jeuiygqa:'',
      soufa:false,
      url:'',
      srcList:[],
      imashow:false,
      shouewhu:false,
      modalShowdu:false,
      listnemd:[],
      listnemrt:[],
      nread:{
        "table": "boman_message_receive",
        "orderBy": "create_time desc",
        pageNo:1,
        pageSize:10,
        fixedData:{
          condition:{
           message_id:0,
           status:'N',
           visible:'Y',
           send_user_id:0,
          }
        }
      },
      nreadtwo:{
        "table": "boman_message_receive",
        "orderBy": "create_time desc",
        pageNo:1,
        pageSize:10,
        fixedData:{
          condition:{
           message_id:0,
           status:'Y',
           visible:'Y',
           send_user_id:0,
          }
        }
      },
      eceivelist:{
        tableName: "urge_read_message",
        objId:-1,
        dataList:[{
        message_id:0,
        message_title:'',
        send_user_name:'',
        message_time:'',
        recieve_user_id:'',
        recieve_user_name:''
        }]
      },
      jeogq:{},
      nuki:0
    };
  },
  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.instanceId = this.$route.query.id- 0;
    this.faerform.objId = this.$route.query.id - 0;
    this.faerform.table = this.$route.query.tables;
    this.nread.fixedData.condition.message_id = this.$route.query.id - 0;
    this.nreadtwo.fixedData.condition.message_id = this.$route.query.id - 0;
    this.frowtse.businessTypeName = this.$route.query.tables;
    this.frowtse.dbname = this.$route.query.tables;
    this.querjtgoe.message_situation = this.$route.query.tabname - 0;
    this.jeuiygqa = this.$route.query.tabname
    if(this.$route.query.tabname == 'shouwen'){
      this.titlet = '收文'
      this.soufa = true
      // if(this.$route.query.tabname == 1)
    }else {
      this.titlet = '发文'
       this.soufa = false
    }
    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)
            }
          console.log(this.jeuiygqa)
            if(res.data.status == '未提交' && this.jeuiygqa == 1){
              this.taegshouw = false
            }else{
              this.taegshouw = true
            }
          }else{
            if(this.jeuiygqa == 1){
              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)
            route.nickName = 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.idee = selection
      console.log(this.idee)
      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.from_dept_name = this.jeogq.dept.deptName
        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
        this.faerform.children[i].fixedData.send_user_name = this.jeogq.userName
        this.faerform.children[i].fixedData.send_user_id = this.jeogq.id
        this.faerform.children[i].fixedData.from_dept_name = this.jeogq.dept.deptName
        this.faerform.children[i].fixedData.message_title = this.querjtgoe.message_title
        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
      if(this.querjtgoe.message_enclosure !== undefined){
        this.querjtgoe.has_annex = 'Y'
      }else{
        this.querjtgoe.has_annex = 'N'
      }

      this.faerform.fixedData = this.querjtgoe
      console.log(this.faerform)   
      this.nuki = this.nuki + 1
      console.log(this.nuki)
      if(this.nuki > 1){
        this.msgSuccess("请勿重复提交");
        return false
      }
      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);
        }
      }
      if(this.config.length == 0){
        this.querjtgoe.message_upload = undefined
      }else{
        this.querjtgoe.message_upload = 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)
     if(this.configtwo.length == 0){
       this.querjtgoe.message_enclosure = undefined
     }else{
       this.querjtgoe.message_enclosure = JSON.stringify(this.configtwo)
     }

    },
    // 图片预览
    handlePictureCardPreview(file) {
      console.log(file,87)
      console.log(file.name.split('.'))
      let hegs = file.name.split('.')
      console.log(hegs[hegs.length - 1])
      if(hegs[hegs.length - 1] == 'pdf'){
        this.shouewhu = true
      }else{
        this.shouewhu = false
      }
      this.dialogImageUrl = file.url;
      this.dialogVisible = true;
      this.imashow = true
    },
    upImageFn(res, file) {
      if(res.code !== 200){
        this.msgSuccess('上传失败');
        return false
      }else{
        this.msgSuccess('上传成功');
        this.config.push(res.data);
        console.log(res.data)
        console.log(res.data.name.substr(0,res.data.name.length-4))

        this.querjtgoe.message_upload = this.config
        console.log(this.querjtgoe.message_upload)
        // this.querjtgoe.message_title = res.data.name
        this.querjtgoe.message_title = res.data.name.substr(0,res.data.name.length-4)
        this.querjtgoe.message_upload = JSON.stringify(this.querjtgoe.message_upload)
      }
      // querjtgoe.message_title
      console.log(res)
      console.log(res.data.name.substr(-4))
    },
    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)
    },
    // 上传前控制
    befors(res, file){
      console.log(res,file)
      console.log(res.name.substr(0,res.name.length-4))
      // if(res.type !== 'application/pdf'){
      //   this.msgSuccess('只能上传pdf文件');
      //   return false
      // }else{
      //   return true
      // }
      return   true
    },
    // 时间控件
    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.nikeNameList
        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
      })
     },
    // 查看流程进度
    rogress(){
     this.modalShowdu = true
     this.weiug()
     this.yidue()
    },
    // 催收文
    eceive(row,index){
      console.log(index)
      if (this.multiple && index == undefined) {
        this.msgInfo('请勾选一条信息')
        return
      }
     const id = row.id || this.ids.join(',')
     let huew = []
     // if(row !== undefined){
     //   this.idee = []
     // }

     if(this.idee.length > 0 || row == undefined){
       console.log(345)
       for(var j = 0 ; j < this.idee.length; j++ ){
         this.eceivelist.dataList[j] = {message_id:0,receive_user_id:0,receive_user_name:'',message_title:'',send_user_name:'',send_user_id:0,message_time:''}
         this.eceivelist.dataList[j].message_id = this.idee[j].message_id
         this.eceivelist.dataList[j].receive_user_id = this.idee[j].receive_user_id
         this.eceivelist.dataList[j].receive_user_name = this.idee[j].receive_user_name
         this.eceivelist.dataList[j].message_title = this.querjtgoe.message_title
         this.eceivelist.dataList[j].send_user_name = this.querjtgoe.send_user_name
         this.eceivelist.dataList[j].send_user_id = this.querjtgoe.send_user_id
         this.eceivelist.dataList[j].message_time = this.querjtgoe.message_time
       }
     }else{
       this.eceivelist.dataList =[{message_id:0,receive_user_id:0,receive_user_name:'',message_title:'',send_user_name:'',send_user_id:0,message_time:''}]
       this.eceivelist.dataList[0].message_id = row.message_id
       this.eceivelist.dataList[0].receive_user_id = row.receive_user_id
       this.eceivelist.dataList[0].receive_user_name = row.receive_user_name
       this.eceivelist.dataList[0].message_title = this.querjtgoe.message_title
       this.eceivelist.dataList[0].send_user_name = this.querjtgoe.send_user_name
       this.eceivelist.dataList[0].send_user_id = this.querjtgoe.send_user_id
       this.eceivelist.dataList[0].message_time = this.querjtgoe.message_time
     }

     console.log(this.eceivelist)
     this.adege()

     // this.querjtgoe
     // this.eceivelist.fixedData.message_id = row.message_id
     // this.eceivelist.fixedData.recieve_user_id = row.recieve_user_id
     // this.eceivelist.fixedData.recieve_user_name = row.recieve_user_name
    },
    // 催办接口
    adege(){
      addbjectSawen(this.eceivelist).then(res =>{
          console.log(res)
          if(res.code == 200){
            this.msgSuccess('提交成功');
            this.weiug()
          }
      })
    },

    // 查看未读
    weiug(){
      this.loading = true;
      weiduhegw(this.nread).then(res => {
          console.log(res)
          this.loading = false
          this.listnemd = res.data.rows
      })
    },
    // 查看已读
    yidue(){
      this.loading = true;
      weiduhegw(this.nreadtwo).then(res => {
          console.log(res)
          this.loading = false
          this.listnemrt = res.data.rows
      })
    },
     // 用户信息
           getUser() {
             getUserProfile().then(response => {
               this.jeogq = response.data
               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.nread.fixedData.condition.send_user_id = response.data.id
               this.nreadtwo.fixedData.condition.send_user_id = response.data.id
               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">
  .jeuhgs{
   .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;
  }
  .renhdys{
    .el-form-item__content{
      width: 85%;
    }

  }
  .renhdytwo{
    .el-form-item__content{
      display: flex;
    }
  }
  .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;
  }
  }

  .infinite-list {
    // height: 150px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    .infinite-list-item {
      // flex:1!important;
      display: flex;
      // justify-content: space-between;
      align-items: center;
      text-align: center;
      list-style: none;
      height: 23px;
      margin-left: 10px;
      // line-height: 30px;
    }
    .infinite-list-itemss {
      color: #1890ff;
    }
  }
  .infinite-listty {
    display: flex;
    flex-wrap: wrap;
    .infinite-list-itemty {
      // flex:1;
      display: flex;
      // justify-content: space-between;
      height: 23px;
      line-height: 23px;
      // text-align: center;
      list-style: none;
      margin-left: 10px;
      // 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;
   align-items: center;
   li{
     list-style: none;
     // width: 20%;
     margin-left: 10px;
     line-height: 23px;
   }
  }
</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;
  }
  .index_navTimeimg {
    width: 10px;
    height: 10px;
    margin-left: 5px;
  }
</style>
