<!--
 * @Description: 党建管理 => 组织关系变更
 * @Author: Rockery
 * @Date: 2021-12-10 10:45:41
 * @LastEditors: Rockery
 * @LastEditTime: 2021-12-28 17:55:31
 * @FilePath: \party_construct_web\src\views\PartyBuildingMgr\OrgRelationship\OrgRelationshipIndex.vue
 * @Copyright: Copyright (c) 2016~2021 Rockery(1113269755@qq.com)
-->

<template>
  <div
    class="app-container orgrelationship"
    :class="['ADD','VIEW'].includes(pageType) ? 'desc-page':''"
  >
    <template v-if="pageType === 'LIST'">
      <div class="orgrelationship-main">
        <el-row :gutter="10">
          <el-col :span="24">
            <div class="orgrelationship-main-title">
              <div>
                <img
                  :src="require('@/assets/logo/home-main-title-logo.png')"
                  @error="imgViewerOnerror"
                />
              </div>
              <div>组织关系变更</div>
            </div>
          </el-col>
          <div v-loading="loading">
            <el-col :span="24" class="mt20">
              <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
                <el-form-item prop="beginTime">
                  <el-date-picker
                    v-model="queryParams.beginTime"
                    type="date"
                    size="small"
                    clearable
                    value-format="yyyy-MM-dd"
                    style="width: 100%;"
                    placeholder="请选择开始时间"
                  ></el-date-picker>
                </el-form-item>
                <el-form-item prop="endTime">
                  <el-date-picker
                    v-model="queryParams.endTime"
                    type="date"
                    size="small"
                    clearable
                    value-format="yyyy-MM-dd"
                    style="width: 100%;"
                    placeholder="请选择结束时间"
                  ></el-date-picker>
                </el-form-item>
                <el-form-item prop="name">
                  <el-input
                    v-model="queryParams.name"
                    placeholder="请输入姓名/身份证号"
                    clearable
                    size="small"
                    style="width: 100%;"
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
                <el-form-item>
                  <el-button
                    v-hasPermi="['partybuildingmgr:orgrelationship:query']"
                    type="primary"
                    icon="el-icon-search"
                    @click="handleQueryClick"
                  >搜索</el-button>
                  <el-button
                    v-hasPermi="['partybuildingmgr:orgrelationship:reset']"
                    icon="el-icon-refresh"
                    @click="resetQueryClick"
                  >重置</el-button>
                </el-form-item>
              </el-form>
            </el-col>
            <el-col :span="24">
              <el-table
                :data="list"
                stripe
                border
                :header-cell-style="{'text-align':'center'}"
                header-row-class-name="orgrelationship-table_header-row"
                class="orgrelationship-main-table"
                style="width: 100%;"
              >
                <el-table-column label="姓名" prop="name" :show-overflow-tooltip="true" />
                <el-table-column label="身份证号" prop="name" :show-overflow-tooltip="true" />
                <el-table-column label="类型" prop="conditionPoint" :show-overflow-tooltip="true" />
                <el-table-column label="备注" prop="conditionPoint" :show-overflow-tooltip="true" />
                <el-table-column
                  label="时间"
                  align="center"
                  prop="conditionTime"
                  width="180"
                  :show-overflow-tooltip="true"
                />
                <el-table-column
                  label="操作"
                  align="center"
                  fixed="right"
                  width="160"
                  class-name="small-padding fixed-width"
                >
                  <template slot-scope="scope">
                    <el-button
                      v-hasPermi="['partybuildingmgr:orgrelationship:edit']"
                      size="mini"
                      type="text"
                      icon="el-icon-edit"
                      style="color: #de0010;"
                      @click="handleEditClick(scope.row)"
                    >完善资料</el-button>
                    <el-button
                      v-hasPermi="['partybuildingmgr:orgrelationship:view']"
                      size="mini"
                      type="text"
                      icon="el-icon-view"
                      style="color: #909399;"
                      @click="handleViewClick(scope.row)"
                    >详情</el-button>
                  </template>
                </el-table-column>
              </el-table>
            </el-col>
            <el-col :span="24">
              <pagination
                v-show="total>0"
                :total="total"
                :page.sync="queryParams.pageNum"
                :limit.sync="queryParams.pageSize"
                @pagination="initData"
              />
            </el-col>
          </div>
        </el-row>
      </div>
    </template>
    <template v-else-if="pageType === 'VIEW'">
      <div class="orgrelationship-viewpage">
        <el-row>
          <el-col :span="24">
            <div class="orgrelationship-viewpage-title">
              <div>
                <img
                  :src="require('@/assets/logo/home-main-title-logo.png')"
                  @error="imgViewerOnerror"
                />
              </div>
              <div>组织关系变更详情</div>
            </div>
          </el-col>
          <el-col :span="24">
            <div class="orgrelationship-viewpage-line"></div>
          </el-col>
          <el-col :span="24">
            <el-form
              ref="orgRelationshipViewpageFormRef"
              :model="viewPageFormObj.formModel"
              label-width="120px"
              class="orgrelationship-viewpage-form"
            >
              <el-row>
                <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
                  <el-form-item label prop="beginTime">
                    <div slot="label" class="roc-form-item-label">变更时间：</div>
                    <div
                      class="roc-form-item-input"
                    >{{ viewPageFormObj.formModel.beginTime || '2021年10月16日' }}</div>
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
                  <el-form-item label="姓名：" prop="explainer">
                    <div slot="label" class="roc-form-item-label">姓名：</div>
                    <div
                      class="roc-form-item-input"
                    >{{ viewPageFormObj.formModel.explainer || '章姗姗' }}</div>
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
                  <el-form-item label="身份证号：" prop="explainer">
                    <div slot="label" class="roc-form-item-label">身份证号：</div>
                    <div
                      class="roc-form-item-input"
                    >{{ viewPageFormObj.formModel.explainer || '520102198605081139' }}</div>
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
                  <el-form-item label="类型：" prop="explainer">
                    <div slot="label" class="roc-form-item-label">类型：</div>
                    <div
                      class="roc-form-item-input"
                    >{{ viewPageFormObj.formModel.explainer || '转出' }}</div>
                  </el-form-item>
                </el-col>
                <el-col :span="24">
                  <el-form-item label="相关材料：" prop="phone">
                    <div slot="label" class="roc-form-item-label">相关材料：</div>
                    <div class="orgrelationship-viewpage-form-desc">
                      <div @click="handleViewPageCheckClick">查看</div>
                      <div @click="handleViewPageDownloadClick">下载</div>
                    </div>
                  </el-form-item>
                </el-col>
                <el-col :span="24">
                  <el-form-item label="说明：" prop="explainer">
                    <div slot="label" class="roc-form-item-label">说明：</div>
                    <div
                      class="roc-form-item-input"
                    >{{ viewPageFormObj.formModel.explainer || '该同志由于XXXX原因，从我支部转出到XXXX支部' }}</div>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
          </el-col>
        </el-row>
        <div class="pagefooter-btngroup">
          <el-button
            type="rocpartyprimaryplainbtn"
            icon="el-icon-circle-close"
            @click="handleViewPageCloseClick"
          >关 闭</el-button>
        </div>
      </div>
    </template>
    <template v-else-if="pageType === 'VIEWPDF'">
      <div class="orgrelationship-viewpdfpage">
        <roc-vue-pdf-page
          pdf-url="/file-api/statics/2021/12/13/6085efe9-74e1-4444-b47a-5c3533ec6901.pdf"
          @close="handleViewPdfPageCloseClick"
        ></roc-vue-pdf-page>
      </div>
    </template>
    <template v-else>
      <div>&nbsp;</div>
    </template>
  </div>
</template>

<script>
import { } from "@/api/PartyBuildingMgr/OrgRelationship";

export default {
  name: "Orgrelationship",
  components: {
    'roc-vue-pdf-page': () => import('@/components/RocVuePdfPage')
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      pageType: 'LIST',
      // 情况说明人选项列表
      situationExplainerOptions: [],
      total: 10,
      queryParams: {
        pageNum: 0,
        pageSize: 10
      },
      list: [
        {
          name: '张三'
        },
        {
          name: '李四'
        }
      ],
      viewPageFormObj: {
        formModel: {
          checkList: []
        }
      },
      pdfDialogVisible: false
    };
  },
  created() {
    this.initData();
  },
  methods: {
    /**
    * 初始化数据
    */
    initData() {
      this.getList();
    },
    /**
    * 获取表格数据
    */
    getList() {
      this.loading = false;
    },
    /**
    * 搜索按钮事件
    */
    handleQueryClick() {

    },
    /**
    * 重置按钮事件
    */
    resetQueryClick() {

    },
    /**
    * 完善资料按钮事件
    */
    handleEditClick(row) {
      this.pageType = 'VIEW';
    },
    /**
    * 详情按钮事件
    */
    handleViewClick(row) {
      this.pageType = 'VIEW';
    },
    /**
     * 详情页面查看按钮事件
     */
    handleViewPageCheckClick() {
      viewPdfFile({ filename: '1f30fcfd-0d34-4127-a1cc-fad68fc27c7d.pdf' }).then(response => {
        this.pageType = 'VIEWPDF';
      });
    },
    /**
     * 详情页面下载按钮事件
     */
    handleViewPageDownloadClick() {
    },
    /**
     * 详情页面关闭按钮事件
     */
    handleViewPageCloseClick() {
      this.pageType = 'LIST';
    },
    /**
     * 预览PDF页面关闭按钮事件
     */
    handleViewPdfPageCloseClick() {
      this.pageType = 'VIEW';
    }
  }
};
</script>

<style  lang="scss" scoped>
.orgrelationship {
  .orgrelationship-main {
    padding: 20px 20px 72px;
    min-height: 750px;
    background: url("../../../assets/images/home-head-img.png"), #ffffff;
    background-size: 67px 67px, cover;
    background-position: right 20px bottom 5px, center;
    background-repeat: no-repeat, no-repeat;
    border-radius: 10px;

    &-title {
      display: flex;
      align-items: center;

      div {
        &:first-child {
          height: 37px;
          line-height: 37px;
        }

        &:last-child {
          margin-left: 15px;
          height: 37px;
          font-size: 26px;
          font-weight: 400;
          color: #4f4f4f;
          line-height: 37px;
          letter-spacing: 1px;
        }

        img {
          width: 34px;
          height: 34px;
        }
      }
    }

    &-tabs.el-tabs {
      margin-top: 20px;

      ::v-deep {
        .el-tabs__item {
          font-size: 18px;
          font-weight: 500;
          color: #4f4f4f;
          opacity: 0.9;
        }

        .el-tabs__active-bar {
          background-color: #de0010;
        }

        .el-tabs__item.is-active {
          color: #de0010;
          background: #f9e9ea;
        }
      }
    }

    &-table {
      ::v-deep {
        .orgrelationship-table_header-row th.el-table__cell {
          background-color: #e5d4b4;
        }

        .el-table__row {
          background-color: #ffffff;
        }

        .el-table__row.el-table__row--striped {
          background-color: #f0f0f0;
        }
      }
    }
  }

  &-viewpage {
    width: 100%;

    &-title {
      display: flex;
      align-items: center;
      margin-bottom: 5px;

      div {
        &:first-child {
          height: 37px;
          line-height: 37px;
        }

        &:last-child {
          margin-left: 15px;
          height: 37px;
          font-size: 26px;
          font-weight: 400;
          color: #4f4f4f;
          line-height: 37px;
          letter-spacing: 1px;
        }

        img {
          width: 34px;
          height: 34px;
        }
      }
    }

    &-line {
      width: 100%;
      height: 1px;
      background: #d8dce5;
      margin-bottom: 15px;
    }

    &-form {
      padding: 0 10%;

      &-desc {
        display: flex;
        align-items: center;
        width: 100%;
        height: 36px;
        line-height: 36px;

        div {
          display: flex;
          align-items: center;
          justify-content: center;
          height: 36px;
          font-weight: 400;
          font-style: normal;
          font-size: 18px;
          color: rgba(24, 144, 255, 0.996);
          line-height: 36px;
          cursor: pointer;

          &:last-child {
            margin-left: 20px;
          }

          &:hover {
            text-decoration: underline;
          }
        }
      }

      &-processnode {
        ::v-deep {
          .el-checkbox {
            display: flex;
            align-items: center;

            .el-checkbox__input {
              display: flex;
              align-items: center;
              justify-content: center;
              height: 36px;
              line-height: 36px;
            }

            .el-checkbox__label {
              display: flex;
              align-items: center;
            }

            &.is-disabled {
              cursor: not-allowed;
            }
          }
        }
        .processnode-circle {
          display: flex;
          align-items: center;
          justify-content: center;
          width: 24px;
          height: 24px;
          font-size: 14px;
          color: #323232;
          background: #ffffff;
          border: 1px solid #323232;
          border-radius: 50%;
          line-height: 36px;
          opacity: 0.9;
        }

        .processnode-label {
          display: flex;
          align-items: center;
          margin-left: 5px;
          height: 36px;
          font-size: 16px;
          font-weight: 400;
          color: #333333;
          line-height: 36px;
          opacity: 0.9;
        }
      }
    }
  }
}
</style>