<template>
  <div class="app-container">
    <el-row :gutter="10" class="mb8">
      <!--<el-col :span="1.5">-->
      <!--<el-button-->
      <!--type="success"-->
      <!--icon="el-icon-edit"-->
      <!--size="small"-->
      <!--:disabled="single"-->
      <!--@click="handleUpdate1"-->
      <!--v-hasPermi="['system:info:edit']"-->
      <!--&gt;修改</el-button>-->
      <!--</el-col>-->
      <!--<el-col :span="1.5">-->
      <!--<el-button-->
      <!--type="danger"-->
      <!--icon="el-icon-delete"-->
      <!--size="small"-->
      <!--:disabled="multiple"-->
      <!--@click="handleDelete"-->
      <!--v-hasPermi="['system:info:remove']"-->
      <!--&gt;删除</el-button>-->
      <!--</el-col>-->
      <el-col :span="1.5">
        <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
          <el-form-item label="名称" prop="mailTheme">
            <el-input
              v-model="queryParams.mailTheme"
              placeholder="请输入名称"
              clearable
              size="small"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item>
            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
          </el-form-item>
        </el-form>
      </el-col>
    </el-row>
    <el-table border  :data="infoList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="序号" type="index" width="55" align="center"></el-table-column>
      <el-table-column label="流程名称" width="180" align="center" >
      <template slot-scope="scope">
        <span>发文</span>
      </template>
      </el-table-column>
      <el-table-column label="标题" align="center" prop="fwtitle" />
      <el-table-column label="当前处理" width="180" align="center" prop="taskName" />
      <el-table-column label="创建时间" width="180" align="center" prop="createtime" >
        <template slot-scope="scope">
          <span>{{scope.row.createtime | format('yyyy-MM-dd hh:mm')}}</span>
        </template>
      </el-table-column>
      <el-table-column label="到达时间" width="180" align="center" prop="updateTime" >
        <template slot-scope="scope">
          <span>{{scope.row.updateTime | format('yyyy-MM-dd hh:mm')}}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" width="200" align="center" class-name="small-padding fixed-width" >
        <template slot-scope="scope">
          <el-button
            size="small"
            type="text"
            icon="el-icon-edit"
            @click="detern(scope.row)"
          >办理</el-button>
        <!--  <el-button
            size="small"
            type="text"
            icon="el-icon-share"
            @click="details(scope.row)"
          >审批进度</el-button>-->
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"/>


    <el-dialog title="审批跟踪记录" :visible.sync="dialogVisible" width="1200px">

      <el-tabs :tab-position="tabPosition" style="min-height: 200px;">
        <el-tab-pane>
        <span slot="label" ><i class="el-icon-date"></i> 附加单据</span>
          用户管理
        </el-tab-pane>
        <el-tab-pane>
          <span slot="label" ><i class="el-icon-date"></i> 审批记录</span>
          <div class="dear">
            <div class="dad">
              <el-steps :active="1"   align-center>
                <el-step title="部门经理审批" description="处理时间：2020-07-23 14:58:22"></el-step>
                <el-step title="..."></el-step>
              </el-steps>
            </div>
            <div class="dac">
              <span style="font-size: 16px;padding-left: 25px">意见信息</span>
              <el-divider></el-divider>
              <div style="padding:10px 20px;">
                <el-row>
                  <span>JEECG用户[填写入职申请单] 2020-07-23 16:36:42</span>
                  <el-divider></el-divider>
                </el-row>
              </div>
            </div>
          </div>
        </el-tab-pane>
        <el-tab-pane>
          <span slot="label" ><i class="el-icon-date"></i> 流程跟踪</span>
          角色管理
        </el-tab-pane>
      </el-tabs>
      <span slot="footer" class="dialog-footer">
           <el-button @click="cancel">取 消</el-button>
          <el-button type="primary" @click="cancel">提 交</el-button>
      </span>
    </el-dialog>

  </div>
</template>

<script>
  import {toDoItemListInfo} from "@/api/activiti/form/fw";
  export default {
    name: 'todo',
    data(){
      return {

        dialogVisible:false,
        tabPosition:'left',
        // 遮罩层
        loading: true,
        // 选中数组
        ids: [],
        flgs: [],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 总条数
        total: 0,
        // 【请填写功能名称】表格数据
        infoList: [
        ],
        // 弹出层标题
        title: "",
        // 是否显示弹出层
        open: false,
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          orderByColumn: "createtime",
          isAsc:"desc",//排序方式
        },
        // 表单参数
        form: {},
        // 表单校验
        rules: {
        }
      };
    },
    created() {
      this.getList();
    },
    methods: {

        detern(row){
            this.reset();
            const actkey = row.actkey || this.ids
            const form = row || this.form
            this.$router.push({path:'/actwork/todo/tododetails',query: {bd:form,id:actkey }})
        },

      // 详情
      details(){
        this.dialogVisible = true
      },
      /** 查询【请填写功能名称】列表 */
      getList() {
        this.loading = true;
        toDoItemListInfo(this.queryParams).then(response => {
          this.infoList = response.rows;
          this.total = response.total;
          this.loading = false;
        });
      },
      // 取消按钮
      cancel() {
        this.dialogVisible = false;
      },
      // 表单重置
      reset() {
        this.form = {
          mailGuid: undefined,
          senderName: undefined,
          senderAccount: undefined,
          receiverName: undefined,
          receiverAccount: undefined,
          mailTheme: undefined,
          mailContent: undefined,
          createTime: undefined,
          status: "0",
          deleteTime: undefined
        };
        this.resetForm("form");
      },
      /** 搜索按钮操作 */
      handleQuery() {
        this.queryParams.pageNum = 1;
        this.getList();
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.resetForm("queryForm");
        this.handleQuery();
      },
      // 多选框选中数据
      handleSelectionChange(selection) {
        this.ids = selection.map(item => item.mailGuid)
        this.flgs = selection.map(item => item.flg)
        this.single = selection.length!=1
        this.multiple = !selection.length
      },




    }
  }
</script>

<style scoped>
  .el-dialog__header{
    border-bottom: 1px solid #e8e8e8 !important;
  }
  .dear{
    border-top: 1px solid #e8e8e8;
  }
  .dad{
    margin: 30px 20px 20px;
    border: 1px solid #e8e8e8;
    padding: 30px;
  }
  .dac{
    margin: 30px 20px 20px;
    border: 1px solid #e8e8e8;
    padding: 25px 0;
  }

</style>
