<template>
  <div>
    <div class="simple-container">
      <simple-form :form="table_form" :reset="true" @search="handleSearch">
      </simple-form>
      <simple-table
        :list="table_list"
        :config="table_config"
        :loading="table_loading"
        :handle-row="table_handle_row"
        @detail="handleDetail"
        @deletes="handleDelete"
        @approval="handleApproval"
      >
      </simple-table>

      <!-- 查看 -->
      <div class="chakanwin" ref="cha">
        <el-dialog
          :title="titname"
          :visible.sync="dialogStatus"
          :destroy-on-close="true"
          :modal-append-to-body="false"
          :close-on-click-modal="false"
          :fullscreen="true"
        >
          <h2>查看</h2>
          <el-form>
            <el-form-item prop="woName">
              <span>名称</span>
              <el-input
                v-model="infolist.orderName"
                placeholder="工单名称"
                disabled
                style="width: 50%"
              >
              </el-input>
            </el-form-item>
            <el-form-item prop="woTitle">
              <span>材料说明</span>
              <el-input
                v-model="infolist.material"
                placeholder="工单内容"
                disabled
                style="width: 50%"
              >
              </el-input>
            </el-form-item>
            <p class="fujian">
              附件材料<span
                prop="woFile"
                @click="download"
                v-for="(item, index) in filelist"
                >{{ item.fileName }}</span
              >
            </p>
            <el-table :data="infolist.updateList" style="width: 100%">
              <el-table-column prop="id" label="序号" />
              <el-table-column prop="updateTime" label="修改时间" />
              <el-table-column prop="updatePerson" label="修改人" />
              <el-table-column prop="updateContent" label="修改内容" />
            </el-table>
          </el-form>
          <div v-if="formStatus === false">
            <h2>回复</h2>

            <el-form>
              <el-form-item prop="upload">
                <span>附件材料</span>
                <el-upload
                  class="upload-demo"
                  drag
                  action="fakeaction"
                  :http-request="upLoad"
                  :on-preview="handlePreview"
                  :on-remove="handleRemove"
                  :file-list="fileList"
                  :before-remove="beforeRemove"
                  multiple
                >
                  <i class="el-icon-upload"></i>
                  <div style="width: 100%" class="el-upload__text">
                    点击上传附件
                  </div>
                </el-upload>
              </el-form-item>
              <el-form-item prop="wochaoPeopel" v-if="showStatus">
                <span>{{ peopleStatus }}</span>
                <deptTree
                  v-if="!disableStatus"
                  :closeList="closeList"
                  class="tree"
                  @treeCheck="treeCheck"
                ></deptTree>
              </el-form-item>
            </el-form>
          </div>
          <el-table :data="infolist.logList" style="width: 100%">
            <el-table-column prop="procedure" label="流程环节" />
            <el-table-column prop="createId" label="处理人" />
            <el-table-column prop="createTime" label="处理时间" />
            <el-table-column prop="desc" label="说明" />
          </el-table>
          <div
            class="dialog-footer myfooter"
            style="float: right"
            v-if="formStatus === false"
          >
            <el-button
              type="primary"
              @click="dialogCli(2)"
              v-if="buttonStatus === false"
              >回 复</el-button
            >
            <el-button type="primary" @click="dialogCli(8)" v-else
              >回 复</el-button
            >
            <el-button @click="dialogCli(1000)">返 回</el-button>
          </div>
          <div
            class="dialog-footer myfooter"
            style="float: right"
            v-if="weiyueButton"
          >
            <el-button type="primary" @click="dialogCli(10)">确认</el-button>
          </div>
        </el-dialog>
      </div>
      <!-- 处理转派 -->
      <div class="chuliwin" ref="chu">
        <el-dialog
          :title="titname"
          :visible.sync="dialogStatuss"
          :destroy-on-close="true"
          :modal-append-to-body="false"
          :close-on-click-modal="false"
          :fullscreen="true"
        >
          <h2>查看</h2>
          <el-form>
            <el-form-item prop="woName">
              <span>名称</span>
              <el-input
                v-model="infolist.woName"
                placeholder="工单名称"
                disabled
                style="width: 50%"
              >
              </el-input>
            </el-form-item>
            <el-form-item prop="woTitle">
              <span>材料说明</span>
              <el-input
                v-model="infolist.woTitle"
                placeholder="工单内容"
                disabled
                style="width: 50%"
              >
              </el-input>
            </el-form-item>
            <p class="fujian">
              附件材料<span prop="woFile"
                @click="download"
                v-for="(item, index) in filelist"
                >{{ item.fileName }}</span
              >
            </p>
            <el-table :data="infolist.updateList" style="width: 100%">
              <el-table-column prop="id" label="序号" />
              <el-table-column prop="updateTime" label="修改时间" />
              <el-table-column prop="updatePerson" label="修改人" />
              <el-table-column prop="updateContent" label="修改内容" />
            </el-table>
          </el-form>
          <h2>处理</h2>
          <el-form>
            <el-form-item class="info-line online">
              <span>接收人</span>
              <deptTree
                v-if="!disableStatus"
                :closeList="closeList"
                class="tree"
                @treeCheck="treeCheck"
              ></deptTree>
              <!--              <div :class="!disableStatus ? 'tree treeUser' : 'tree treeUserb'">-->
              <!--                <p v-for="(item, index) in treeList" :key="index">-->
              <!--                  {{ item.receiveName }}-->
              <!--                  <i @click="deletes(item, index)" class="el-icon-error"></i>-->
              <!--                </p>-->
              <!--              </div>-->
            </el-form-item>
            <!--            <el-form-item prop="rule">-->
            <!--              <span>审批规则</span>-->
            <!--              <el-select-->
            <!--                v-model="infolist.regions"-->
            <!--                placeholder="审批规则"-->
            <!--                style="width: 50%"-->
            <!--              >-->
            <!--                <el-option label="无需审批" value="无需审批"></el-option>-->
            <!--                <el-option label="需抄送领导" value="需抄送领导"></el-option>-->
            <!--                <el-option label="需领导审批" value="需领导审批"></el-option>-->
            <!--              </el-select>-->
            <!--            </el-form-item>-->
          </el-form>
          <div class="dialog-footer myfooter" style="float: right">
            <el-button type="primary" @click="dialogCli(7)">转 派</el-button>
            <el-button @click="dialogCli(1000)">返 回</el-button>
          </div>
        </el-dialog>
      </div>

      <!-- 处理审批 -->
      <div class="shenpiwin" ref="shen">
        <el-dialog
          :title="titname"
          :visible.sync="dialogStatusss"
          :destroy-on-close="true"
          :modal-append-to-body="false"
          :close-on-click-modal="false"
          :fullscreen="true"
        >
          <h2>查看</h2>
          <el-form>
            <el-form-item prop="woTitle">
              <span>名 称</span>
              <el-input
                v-model="infolist.woTitle"
                placeholder="工单名称"
                disabled
                style="width: 50%"
              >
              </el-input>
            </el-form-item>
            <el-form-item prop="woName">
              <span>材料说明</span>
              <el-input
                v-model="infolist.woName"
                placeholder="工单内容"
                disabled
                style="width: 50%"
              >
              </el-input>
            </el-form-item>
            <p class="fujian">
              附件材料<span
                prop="woFile"
                @click="download"
                v-for="(item, index) in filelist"
                >{{ item.fileName }}</span
              >
            </p>
            <el-table :data="infolist.updateList" style="width: 100%">
              <el-table-column prop="id" label="序号" />
              <el-table-column prop="updateTime" label="修改时间" />
              <el-table-column prop="updatePerson" label="修改人" />
              <el-table-column prop="updateContent" label="修改内容" />
            </el-table>
          </el-form>
          <h2>回复</h2>
          <el-form ref="infolist" :rules="rules" :model="infolist">
            <el-form-item prop="mkFileShareAttachList">
              <span class="fjcai">附件材料</span>
              <el-upload
                class="upload-demo"
                drag
                action="fakeaction"
                :http-request="upLoads"
                :on-preview="handlePreview"
                :on-remove="handleRemove"
                :file-list="fileList"
                :before-remove="beforeRemove"
                multiple
              >
                <i class="el-icon-upload"></i>
                <div style="width: 100%" class="el-upload__text">
                  点击上传附件
                </div>
              </el-upload>
            </el-form-item>
            <el-form-item prop="woshenPeopel">
              <span>审批意见</span>
              <el-input
                v-model="infolist.reply_content"
                placeholder="审批意见"
                :disabled="disableStatus"
                style="width: 50%"
              >
              </el-input>
            </el-form-item>
            <el-table :data="infolist.logList" style="width: 100%">
              <el-table-column prop="procedure" label="流程环节" />
              <el-table-column prop="createId" label="处理人" />
              <el-table-column prop="createTime" label="处理时间" />
              <el-table-column prop="desc" label="说明" />
            </el-table>
          </el-form>
          <div class="dialog-footer myfooter" style="float: right">
            <el-button type="primary" @click="dialogCli(5)">同 意</el-button>
            <el-button @click="dialogCli(6)">打 回</el-button>
          </div>
        </el-dialog>
      </div>
    </div>
  </div>
</template>

<script>
import simpleForm from "./components/form.vue";
import simpleTable from "./components/table.vue";
import deptTree from "../../../components/deptTreeUser.vue";
export default {
  components: {
    simpleForm,
    simpleTable,
    deptTree,
  },
  data() {
    return {
      rules: {
        mkFileShareAttachList: [
          { required: true, message: "请上传附件材料", trigger: "change" },
        ],
      },
      weiyueButton: false,
      formStatus: false, //文件状态判断显示
      buttonStatus: false, //回复按钮状态
      showStatus: true, //控制抄送人显示?!
      peopleStatus: "", //显示过滤列表表头
      table_list: [
        //外部列表
        {
          //外部表单
          templateName: "分享18大精神",
          reason: "收集",
          endTime: "2022-10-16",
          currentReceiverName: "胡俊炜",
          createTime: "2020-3-20",
          refName: "xiaohang",
          refStatus: "已阅",
        },
        {
          //外部表单
          templateName: "分享19大精神",
          reason: "收集",
          endTime: "2022-10-16",
          currentReceiverName: "胡俊炜",
          createTime: "2020-3-20",
          refName: "xiaohang",
          refStatus: "已阅",
        },
      ],
      infolist: {
        //弹窗内的列表
      },
      data: [],
      fileList: [],
      filelist: [],
      closeList: [],
      titname: "", //弹窗tit
      disableStatus: false, //树形图
      dialogStatus: false, //查看弹窗
      dialogStatuss: false, //处理弹窗
      dialogStatusss: false, //审批弹窗
      treeList: [], //负责人列表
      table_loading: false,
      table_search: {},
      table_form: [
        //菜单搜索
        {
          label: "名称",
          props: "orderName",
          type: "input",
        },
        {
          label: "状态",
          props: "authType",
          type: "select",
          // 0.待处理  1.待汇总 2.待审批  3.已完成
          dictionary: [
            {
              label: "待办",
              value: "1",
            },
            {
              label: "已办",
              value: "2",
            },
            {
              label: "已阅",
              value: "4",
            },
            {
              label: "未阅",
              value: "3",
            },
          ],
        },
      ],
      //  表头配置
      table_config: [
        //外部表单
        {
          label: "名称",
          props: "orderName",
        },
        {
          label: "类型",
          props: "orderType",
        },
        {
          label: "截止时间",
          props: "issuedTime",
          // type: "time",
        },
        {
          label: "发起人",
          props: "createId",
        },
        {
          label: "下发时间",
          props: "createTime",
        },
        {
          label: "回复人",
          props: "toUserId",
        },
        {
          label: "状态",
          props: "authType",
        },
      ],
      //   表格里的操作按钮delete
      table_handle_row: [
        //外部表单 操作列
        {
          label: "查看",
          props: "detail",
          visible: {
            status: ["0", "1"],
          },
        },
        {
          label: "处理",
          props: "deletes",
          visible: {
            status: ["0"],
          },
        },
        {
          label: "审批",
          props: "approval",
          visible: {
            status: ["9"],
          },
        },
      ],
    };
  },
  created() {
    // 初始化加载列表.
    let data = {
      page: "1",
      pageSize: "10",
    };
    this.handleInit(data);
  },
  methods: {
      beforeRemove(file){
          this.infolist.mkFileShareAttachList = []
      },
    async downloads(fileData) {
      await this.$http({
        url: "/market/CMKFile/downFile",
        method: "post",
        headers: {
          "Content-Type": "application/json",
        },
        responseType: "blob",
        data: {
          id: fileData.fileCode,
          fileName: fileData.fileName,
          attachId: fileData.attachId,
          forwardId: this.infolist.id,
        },
      }).then((response) => {
        if (window.navigator && window.navigator.msSaveOrOpenBlob) {
          let blob = new Blob([response.data], {
            type: "application/vnd.ms-excel",
          });
          window.navigator.msSaveOrOpenBlob(blob, fileData.fileName);
        } else {
          /* 火狐谷歌的文件下载方式 */
          var blob = new Blob([response.data]);
          var downloadElement = document.createElement("a");
          var href = window.URL.createObjectURL(blob);
          downloadElement.href = href;
          downloadElement.download = fileData.fileName;
          document.body.appendChild(downloadElement);
          downloadElement.click();
          document.body.removeChild(downloadElement);
          window.URL.revokeObjectURL(href);
        }
          console.log(this.infolist)
          if(this.infolist.authType === '3'){
              this.dialogCli(10);
          }
      });
    },
    async moreDown(file) {
      let arr = [];
      file.forEach((item) => {
        arr.push({
          id: item.fileCode,
          fileName: item.fileName,
        });
      });
      await this.$http({
        url: "/market/CMKFile/downAllFile",
        method: "post",
        headers: {
          "Content-Type": "application/json",
        },
        responseType: "blob",
        data: { mkFileShareAttachList: arr },
      }).then((response) => {
        if (window.navigator && window.navigator.msSaveOrOpenBlob) {
          let blob = new Blob([response.data], {
            type: "application/vnd.ms-excel",
          });
          window.navigator.msSaveOrOpenBlob(
            blob,
            new Date().getTime().toString() + ".zip"
          );
        } else {
          /* 火狐谷歌的文件下载方式 */
          var blob = new Blob([response.data]);
          var downloadElement = document.createElement("a");
          var href = window.URL.createObjectURL(blob);
          downloadElement.href = href;
          downloadElement.download = new Date().getTime().toString() + ".zip";
          document.body.appendChild(downloadElement);
          downloadElement.click();
          document.body.removeChild(downloadElement);
          window.URL.revokeObjectURL(href);
        }
        if(this.infolist.authType === '3'){
            this.dialogCli(10);
        }
      });
    },
    //回显数据 同一个接口!!!
     getEcho(id, ids) {
      let array = new FormData();
      array.append("id", id);
      array.append("issuedId", ids);
      this.$http({
        url: "/market/CMKFile/updateQuery",
        method: "post",
        headers: {
          "Content-Type": "application/json",
        },
        data: array,
      }).then((res) => {
        this.infolist = res.data.body || [];
        let user = window.sessionStorage.getItem('userInfo')
          let userName = JSON.parse(user).loginNo
          console.log(userName)

          for(let i=res.data.body.mkFileShareAttachList.length-1;i>=0;i--){
              console.log(res.data.body.createId)
              console.log(res.data.body.mkFileShareAttachList[i].opName)
              if(res.data.body.createId === res.data.body.mkFileShareAttachList[i].opName || res.data.body.mkFileShareAttachList[i].opName === userName){
              }else{
                  res.data.body.mkFileShareAttachList.splice(i,1);
              }
          }
        this.filelist = res.data.body.mkFileShareAttachList;
        this.infolist.mkFileShareAttachList = [];
        this.infolist.receiverList = [];
        let authType = this.infolist.authType;
        if (
          authType == "2" ||
          authType == "3" ||
          authType == "4" ||
          authType == "5" ||
          authType == "8"
        ) {
          this.formStatus = true;
            console.log(res.data.body.authType);
        }
        if (this.infolist.approvalType == "0") {
          this.showStatus = false;
        } else if (this.infolist.approvalType == "1") {
          this.peopleStatus = "抄送人";
        } else {
          this.buttonStatus = true;
          this.peopleStatus = "审批人";
        }
        for (let i = 0; i <= this.infolist.updateList.length - 1; i++) {
          this.infolist.updateList[i].id = i + 1;
        }
      });
    },
    //查看(显示信息、下载附件) 已阅 未阅 ↓↓↓↓↓↓↓↓↓↓
    async handleDetail(e) {
      await this.getEcho(e.id, e.issuedId);
      if (this.infolist.authType === "3") {
        this.weiyueButton = true;
      }
      this.infolist.authType =
        this.infolist.authType === "3" ? "4" : this.infolist.authType;
      this.dialogStatus = true;
      this.titname = "工单查看";
    },
    //处理（需要回复、上传附件） 待办  已办   ↓↓↓↓↓↓↓↓↓↓
    handleDelete(e) {
      this.getEcho(e.id, e.issuedId);
      // this.$refs.chuli.style.opacity = 0.8;
      this.dialogStatuss = true;
      this.titname = "工单处理";
    },
    //shenpi
    handleApproval(e) {
      this.getEcho(e.id, e.issuedId);
      this.dialogStatusss = true;
      this.titname = "工单审批";
    },
  async getReceiverList(){
      let a = window.sessionStorage.getItem('userInfo')
      for(let i=0;i<=this.infolist.receiverList.length-1;i++){
          if(this.infolist.receiverList[i].approvalId === JSON.parse(a).loginNo){
              this.$message.error('不允许选择自己');
              return false;
          }
      }
  },
    //各种奇怪按钮方法o
    async clickNow(list) {
        let b =  await this.getReceiverList()
        if(b !=false){
            if (["1", "7"].indexOf(this.infolist.authType) >= 0) {
                if (this.infolist.mkFileShareAttachList.length === 0) {
                    this.$message.error("请上传附件");
                } else if (this.infolist.receiverList.length === 0 &&this.infolist.approvalType !='0') {
                    this.$message.error("请选择抄送人");
                } else {
                    list.id = this.infolist.id;
                    list.replyContent = null;
                    list.replyContent = this.infolist.reply_content;
                    list.attachId = this.infolist.attachId;
                    list.issuedId = this.infolist.issuedId;
                    list.preId = this.infolist.preId;
                    this.$set(
                        list,
                        "mkFileShareAttachList",
                        this.infolist.mkFileShareAttachList
                    );
                    await this.$http({
                        url: "/market/CMKFile/changeState",
                        method: "post",
                        headers: {
                            "Content-Type": "application/json",
                        },
                        data: list,
                    }).then((res) => {
                        if (res.data.result == 0 || res.data.result == 2) {
                            this.dialogStatusss = false;
                            this.dialogStatuss = false;
                            this.dialogStatus = false;
                            this.handleInit({ page: "1", pageSize: "10" });
                        }
                    });
                }
            } else {
                list.id = this.infolist.id;
                list.replyContent = null;
                list.replyContent = this.infolist.reply_content;
                list.attachId = this.infolist.attachId;
                list.issuedId = this.infolist.issuedId;
                list.preId = this.infolist.preId;
                this.$set(
                    list,
                    "mkFileShareAttachList",
                    this.infolist.mkFileShareAttachList
                );
                await this.$http({
                    url: "/market/CMKFile/changeState",
                    method: "post",
                    headers: {
                        "Content-Type": "application/json",
                    },
                    data: list,
                }).then((res) => {
                    if (res.data.result == 0 || res.data.result == 2) {
                        this.dialogStatusss = false;
                        this.dialogStatuss = false;
                        this.dialogStatus = false;
                        this.handleInit({ page: "1", pageSize: "10" });
                    }
                });
            }
        }

    },
    //转派方法
    async zhuanpai() {
      let list = {};
      list.id = this.infolist.id;
      list.issuedId = this.infolist.issuedId;
      list.orderType = this.infolist.orderType;
      list.orderName = this.infolist.orderName;
      list.issuedTime = this.infolist.issuedTime;
      list.toUserId = this.infolist.toUserId;
      list.receiverList = this.infolist.receiverList;
      list.approvalType = this.infolist.approvalType;
      list.material = this.infolist.material;
      list.receiverList.map((item) => {
        item.attchId = this.infolist.attachId;
        item.toUserCnt = 0;
        item.createId = this.infolist.createId;
      });
      await this.$http({
        url: "/market/CMKFile/changeOrder",
        method: "post",
        headers: {
          "Content-Type": "application/json",
        },
        data: list,
      }).then((res) => {
        this.dialogStatuss = false;
        this.handleInit({ page: "1", pageSize: "10" });
      });
    },
    //底部按钮方法
    async dialogCli(id) {
      if (id == 2) {
        //回复
        let list = {};
        list.approvalType = this.infolist.approvalType;
        list.receiverList = this.infolist.receiverList;
        list.authType = "2";
        list.receiverList.map((item) => {
          delete item.approvalId;
        });
        this.clickNow(list);
      }
      if (id == 5) {
        //同意
        let list = {};
        list.authType = "5";
        this.clickNow(list);
      }
      if (id == 6) {
        //打回
        let list = {};
        list.authType = "6";
        this.clickNow(list);
      }
      if (id == 10) {
        //查看修改状态
        let list = {};
        list.authType = "4";
        this.clickNow(list);
      }
      if (id == 7) {
        if (this.infolist.toUserCnt != 0) {
          if (this.infolist.receiverList.length > 1) {
            this.$message.error("只可转派一人");
          } else {
            this.zhuanpai();
          }
        } else {
          this.zhuanpai();
        }
      }
      if (id == 8) {
        let list = {};
        list.authType = "8";
        list.issuedId = this.infolist.issuedId;
        list.id = this.infolist.id;
        list.orderType = this.infolist.orderType;
        list.orderName = this.infolist.orderName;
        list.issuedTime = this.infolist.issuedTime;
        list.toUserId = this.infolist.toUserId;
        list.receiverList = this.infolist.receiverList;
        list.approvalType = this.infolist.approvalType;
        list.material = this.infolist.material;
        list.receiverList.map((item) => {
          item.attchId = this.infolist.attachId;
          item.toUserCnt = 0;
          item.createId = this.infolist.createId;
          item.approvalType = this.infolist.approvalType;
        });
        this.clickNow(list);
      }
      if (id == 1000) {
        this.dialogStatus = false;
        this.dialogStatuss = false;
        this.dialogStatusss = false;
      }
    },
    //获取树形组件返回值
    treeCheck(e) {
      let receiverList = [];
      e.map((item) => {
        let array = {
          copyId: item.receiveNo,
          approvalId: item.receiveNo,
        };
        receiverList.push(array);
      });
        this.$set(this.infolist, "receiverList", receiverList);
    },
    //新建上传材料
    async upLoad(params) {
      let file = params.file;
      const form = new FormData();
      form.append("file", file);
      await this.$http({
        url: "/market/CMKFile/upload",
        method: "post",
        headers: {
          "Content-Type": "application/json",
        },
        data: form,
      }).then((res) => {
        if (this.infolist.mkFileShareAttachList) {
          this.infolist.mkFileShareAttachList.push(res.data.body);
        } else {
          let mkFileShareAttachList = [];
          mkFileShareAttachList.push(res.data.body);
          this.$set(
            this.infolist,
            "mkFileShareAttachList",
            mkFileShareAttachList
          );
        }
      });
    },
    //新建上传材料1
    async upLoads(params) {
      let file = params.file;
      const form = new FormData();
      form.append("file", file);
      await this.$http({
        url: "/market/CMKFile/upload",
        method: "post",
        headers: {
          "Content-Type": "application/json",
        },
        data: form,
      }).then((res) => {
        if (this.infolist.mkFileShareAttachList) {
          this.infolist.mkFileShareAttachList.push(res.data.body);
        } else {
          let mkFileShareAttachList = [];
          mkFileShareAttachList.push(res.data.body);
          this.$set(
            this.infolist,
            "mkFileShareAttachList",
            mkFileShareAttachList
          );
        }
      });
    },
    handlePreview() {},
    handleRemove() {},
    async handleInit(data) {
      this.table_loading = true;
      await this.$http({
        url: "/market/CMKFile/queryIssuedForward",
        method: "post",
        headers: {
          "Content-Type": "application/json",
        },
        data: data,
      }).then(({ data: { count, data } }) => {
        data.map((item) => {
          if (item.orderType == "1") {
            item.status = "1";
          }
          if (item.orderType == "0") {
            item.status = "0";
            if (item.authType == "8") {
              item.status = "1";
            }
            if (item.authType == "2") {
              item.status = "1";
            }
          }
          // if(item.authType == '8'){
          //     item.status = '1'
          // }
          // item.status = '9'

          if (
            item.approvalId != null &&
            item.approvalId != "" &&
            item.approvalType == "2"
          ) {
            item.status = "9";
          }
          if (item.authType == "5") {
            item.status = "1";
          }
          if (item.authType == "9") {
            item.status = "0";
          }

          item.orderType = item.orderType == "0" ? "收集" : "分享";
          switch (item.authType) {
            case "1":
              item.authType = "待办";
              break;
            case "2":
              item.authType = "已办";
              break;
            case "3":
              item.authType = "未阅";
              break;
            case "4":
              item.authType = "已阅";
              break;
            case "5":
              item.authType = "已办";
              break;
            case "8":
              item.authType = "待办";
              break;
            case "9":
              item.authType = "待办";
              break;
            default:
              item.authType = "待办";
          }
        });
        this.table_loading = false;
        this.total = count;
        this.table_list = data || [];
      });
    },
    //文件下载
    async download(val) {
      if (this.filelist.length > 1) {
        this.moreDown(this.filelist);
      } else {
        this.downloads(this.filelist[0]);
      }
    },
    // 搜索事件
    handleSearch(data) {
      const d = new Date(data.issuedTime);
      if (data.issuedTime) {
        data.issuedTime =
          d.getFullYear() + "-" + (d.getMonth() + 1) + "-" + d.getDate();
      }
      if (data != "reset") {
        this.table_search = {
          ...data,
        };
        this.page = "1";
        this.handleInit({
          ...this.table_search,
          page: this.page,
          pageSize: "10",
        });
      }
    },
  },
};
</script>

<style scoped lang="scss">
.tree {
  width: calc(50% - 60px);
  display: inline-block;
  margin-right: 20px;
  height: 300px;
  overflow-y: scroll;

  .el-icon-error {
    float: right;
    font-size: 20px;
    margin-top: 9px;
    cursor: pointer;
  }
}
.el-table {
  margin: 0 0 20px 0;
}
.el-form-item {
  margin: 10px 0;
}
.el-form-item__content {
  .upload-demo {
    width: 50%;
    float: left;
  }
  span {
    display: inline-block;
    width: 100px;
    padding-left: 10px;
    float: left;
  }
}
.fujian {
  padding-left: 10px;
  span {
    margin-left: 35px;
    color: blue;
    text-decoration: underline;
  }
  span:hover {
    color: rgb(250, 95, 6);
  }
}
.info-line {
  width: 100%;
  display: block;
  padding-left: 20px;

  div {
    width: 50%;
  }

  span {
    width: 100px;
    display: inline-block;
    text-align: left;

    i {
      color: red;
      display: inline-block;
      padding-right: 5px;
    }
  }

  .el-select,
  .el-input {
    width: calc(100% - 120px);
  }
}

.online {
  width: 100%;

  .el-select {
    width: calc(100% - 120px);
  }

  span {
    vertical-align: top;
  }

  .el-textarea {
    width: calc(100% - 120px);
  }

  .tree {
    width: calc(50% - 60px);
    display: inline-block;
    margin-right: 20px;
    height: 300px;
    overflow-y: scroll;

    .el-icon-error {
      float: right;
      font-size: 20px;
      margin-top: 9px;
      cursor: pointer;
    }
  }

  .treeUser {
    margin: 0;
    border: 1px solid #ddd;

    p {
      background: #f4f4f4;
      padding: 0 20px;
      margin-bottom: 5px;
    }
  }

  .treeUserb {
    width: calc(100% - 100px);
    border: 1px solid #ddd;
    background: #f4f4f4;
    border-radius: 3px;
    height: auto;
    overflow: hidden;

    p {
      display: inline-block;
      padding: 0 20px;
      margin-bottom: 5px;
    }
  }
}
</style>
