<template>
  <div class="common-page-shadow">
    <div class="common-search-container" ref="contentPanel">
      <el-form
        ref="form"
        :model="searchForm"
        label-width="auto"
        label-position="right "
        :inline="true"
        type="flex"
        justify="left"
      >
        <el-form-item label="采购单位">
          <el-input
            size="small"
            v-model="querys[1].value"
            clearable
            placeholder="请输入采购单位"
          ></el-input>
        </el-form-item>
        <el-form-item label="参与状态">
          <el-select v-model="querys[2].value" size="small" @change="changeStatus" placeholder="请选择参与状态">
              <el-option
                  v-for="item in statusList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
              </el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <div class="container-btn">
        <el-button
          size="small"
          icon="el-icon-search"
          type="danger"
          class="btn btn-plus"
          @click="handleSearch"
        >
          搜索
        </el-button>
        <el-button
          size="small"
          icon="el-icon-refresh-right"
          class="btn btn-plus"
          @click="clearSearchForm"
        >
          重置
        </el-button>
      </div>
    </div>
    <el-row
      class="common-table-container flex searchPanel"
      :style="SearchPanel"
    >
      <el-col :span="24" class="common-table-wrapper">
        <el-button
          icon="el-icon-money"
          type="primary"
          size="small"
          v-if="querys[2].value == 0"
          @click="goCheckout"
          >去结算</el-button
        >
        <el-button
          icon="el-icon-question"
          type="primary"
          size="small"
          v-if="querys[2].value == 0"
          :disabled="!multipleSelection.length"
          @click="goQuestions"
          >提问</el-button
        >
        <!-- <el-button
          icon="el-icon-thumb"
          type="primary"
          size="small"
          :loading="examineing"
          :disabled="!multipleSelection.length"
          @click="handleExamine"
          >审核</el-button
        > -->
        <!-- LJ：表格高度自适应需配合样式  btn-pagenation 有按钮有分页  btngroup只有按钮  pagenation只有分页 -->
        <div class="common-table-content btn-pagenation">
          <el-table
            :border="true"
            stripe
            fit
            size="mini"
            v-loading="tableLoading"
            ref="multipleSelection"
            height="100%"
            :data="tableData"
            @selection-change="handleSelectionChange"
          >
            <el-table-column type="selection" min-width="50px" align="center">
            </el-table-column>
            <el-table-column
              prop="projectNumber"
              show-overflow-tooltip
              min-width="100px"
              align="center"
              label="项目编号"
              resizable
            >
            </el-table-column>
            <el-table-column
              prop="noticeTitle"
              show-overflow-tooltip
              min-width="120px"
              align="center"
              label="项目名称"
              resizable
            >
            </el-table-column>
            <el-table-column
              prop="procureOrgName"
              min-width="130px"
              label="采购单位"
              align="center"
              show-overflow-tooltip
              resizable
            >
            </el-table-column>
            <el-table-column
              prop="affiliatedUserName"
              min-width="100px"
              label="立项人"
              align="center"
              show-overflow-tooltip
              resizable
            >
            </el-table-column>
            <el-table-column
              prop="contactsPhone"
              min-width="130px"
              label="立项人联系方式"
              align="center"
              show-overflow-tooltip
              resizable
            >
            </el-table-column>
            <el-table-column
              prop="bond"
              show-overflow-tooltip
              min-width="100px"
              align="center"
              label="保证金"
              resizable
            >
            <template v-slot="{row}">
              <div v-if="row.hasBond==1">
                {{ row.bond }}
              </div>
              <div v-if="row.hasBond==0">0</div>
            </template>
            </el-table-column>
            <el-table-column
              prop="quotationMethod"
              show-overflow-tooltip
              min-width="100px"
              align="center"
              label="付款方式"
              resizable
            >
              <template v-slot="{row}">
                {{ getDictName('cglx-fkfs', row.quotationMethod) }}
              </template>
            </el-table-column>
            <el-table-column
              prop="winBidValidity"
              show-overflow-tooltip
              min-width="100px"
              align="center"
              label="中标有效期"
              resizable
            >
            </el-table-column>
            <el-table-column
              prop="responseTimeDeadline"
              show-overflow-tooltip
              min-width="130px"
              align="center"
              label="响应截止时间"
              resizable
            >
            </el-table-column>
            <el-table-column
              prop="biddingStartTime"
              show-overflow-tooltip
              min-width="130px"
              align="center"
              label="投标开始时间"
              resizable
            >
            </el-table-column>
            <el-table-column
              prop="biddingEndTime"
              show-overflow-tooltip
              min-width="130px"
              align="center"
              label="投标结束时间"
              resizable
            >
            </el-table-column>
            <el-table-column
              prop="joinStatus"
              show-overflow-tooltip
              min-width="120px"
              align="center"
              label="参与状态"
              resizable
            >
              <template v-slot="{row}">
                <el-tag
                  type="danger"
                  v-if="row.joinStatus == 0 || row.joinStatus == 5"
                  >未参与</el-tag
                >
                <el-tag type="" v-if="row.joinStatus == 1">已参与</el-tag>
                <el-tag type="warning" v-if="row.joinStatus == 2"
                  >审核中</el-tag
                >
                <el-tag type="danger" v-if="row.joinStatus == 3">待支付</el-tag>
                <el-tag type="success" v-if="row.joinStatus == 4"
                  >已支付</el-tag
                >
              </template>
            </el-table-column>
            <el-table-column
              min-width="200px"
              fixed="right"
              align="center"
              label="操作"
            >
              <template slot-scope="scope">
                <el-tag type="info" v-if="new Date(scope.row.responseTimeDeadline) < new Date()&&(scope.row.joinStatus == 0 || scope.row.joinStatus == 5)">已开始</el-tag>
                <el-button
                  v-if="
                   new Date(scope.row.responseTimeDeadline)> new Date()&& (scope.row.joinStatus == 0 || scope.row.joinStatus == 5)"
                  icon="el-icon-circle-plus-outline"
                  type="primary"
                  plain
                  :loading="scope.row.joining"
                  size="small"
                  @click="handleJoin(scope.row)"
                  >我要参与</el-button
                >
                <el-button
                  v-if="scope.row.joinStatus == 1&&new Date(scope.row.biddingStartTime)>new Date()"
                  icon="el-icon-circle-close"
                  type="danger"
                  plain
                  :loading="scope.row.cancle"
                  size="small"
                  @click="handleCanle(scope.row)"
                  >取消参与</el-button
                >
                <el-tag type="info" style="margin-right: 10px;" v-if="scope.row.joinStatus == 1&&new Date(scope.row.biddingStartTime)<new Date()&&new Date()<new Date(scope.row.biddingEndTime)">已开始</el-tag>
                  <el-tag type="danger" style="margin-right: 10px;" v-if="scope.row.joinStatus == 1&&new Date(scope.row.biddingStartTime)<new Date()&&new Date()>new Date(scope.row.biddingEndTime)">已结束</el-tag>
                <el-tag v-if="scope.row.joinStatus == 2" style="margin-right: 10px;" type="info"
                  >审核中</el-tag
                >
                <el-tag v-if="scope.row.joinStatus == 3" style="margin-right: 10px;" type="info"
                  >待支付</el-tag
                >
                <el-tag v-if="scope.row.joinStatus == 4" style="margin-right: 10px;" type="success"
                  >已参与</el-tag
                >
                <el-button
                  icon="el-icon-view"
                  type="primary"
                  plain
                  v-if="scope.row.joinStatus != 0 && scope.row.joinStatus != 5"
                  :loading="scope.row.cancle"
                  size="small"
                  @click="handleDetails(scope.row)"
                  >查看明细</el-button
                >
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div class="common-pagenation">
          <el-pagination
            ref="paginationPanel"
            background
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="queryParam.pageBean.page"
            :page-sizes="[20, 30, 40, 50]"
            :page-size="queryParam.pageBean.pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="queryParam.pageBean.total"
          >
          </el-pagination>
        </div>
      </el-col>
    </el-row>
    <!-- 查看明细 -->
    <el-dialog
      title="明细"
      :visible.sync="dialogVisible"
      width="80%"
      top="6vh"
      :close-on-click-modal="false"
      :before-close="dialogBeforeClose"
    >
      <el-table
        ref="singleTable"
        class="table"
        :data="detailsList"
        style="width: 100%"
        height="500px"
        highlight-current-row
        :border="true"
        stripe
        fit
        :cell-style="{'text-align': 'center'}"
        :header-cell-style="{'text-align': 'center'}"
      >
        <el-table-column type="index" width="55" label="序号" />
        <el-table-column
          label="企业物料编号"
          min-width="120"
          show-overflow-tooltip
          prop="matCode"
          v-if="form.matIfPlat==0"
        >
        </el-table-column>
        <el-table-column
          label="平台物料编号"
          min-width="120"
          show-overflow-tooltip
          prop="matPlatcode"
        >
        </el-table-column>
        <el-table-column label="物料名称" show-overflow-tooltip min-width="110" prop="matName">
        </el-table-column>
        <el-table-column label="物料牌号" show-overflow-tooltip min-width="110" prop="matMaterial">
        </el-table-column>
        <el-table-column
          label="数量"
          min-width="110"
          prop="matNum"
          show-overflow-tooltip
        >
        </el-table-column>
        <el-table-column
          label="最高限价(元)"
          min-width="110"
          prop="maximumPriceLimit"
        >
        </el-table-column>
        <el-table-column label="需求日期" show-overflow-tooltip min-width="130" prop="demandDate">
        </el-table-column>
        <el-table-column label="计划编号" show-overflow-tooltip min-width="100" prop="planCode">
        </el-table-column>
        <el-table-column label="规格型号" show-overflow-tooltip min-width="130" prop="matSpec">
        </el-table-column>
        <el-table-column label="计量单位" min-width="80" prop="matUnit">
        </el-table-column>
        <el-table-column label="品牌/产地" show-overflow-tooltip min-width="100" prop="matBrand">
        </el-table-column>
        <el-table-column label="基础扩展" show-overflow-tooltip min-width="140" prop="matBaseExt">
        </el-table-column>
        <el-table-column label="其他扩展" show-overflow-tooltip min-width="140" prop="matOtherExt">
        </el-table-column>
        <el-table-column label="税率" min-width="80" prop="taxRate">
        </el-table-column>
        <el-table-column label="挂账时间" show-overflow-tooltip min-width="100" prop="pendingTime">
        </el-table-column>
        <el-table-column label="承兑时间" v-if="form.quotationMethod==2" min-width="100" prop="acceptanceTime">
        </el-table-column>
        <el-table-column label="送货地址" show-overflow-tooltip min-width="180" prop="unloadAddress">
        </el-table-column>
        <el-table-column label="企业补充说明" show-overflow-tooltip min-width="180" prop="remarks">
        </el-table-column>
      </el-table>
      <div slot="footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 提问 -->
    <el-dialog
      title="澄清提问"
      :visible.sync="visible"
      width="width"
      :before-close="dialogBeforeClose"
    >
      <el-form :model="form" :rules="rules">
        <el-form-item label="问题描述" label-width="90px" prop="describe">
          <el-input
            type="textarea"
            autosize
            placeholder="请输入问题描述"
            v-model="form.describe"
          ></el-input>
        </el-form-item>
        <el-form-item label="附件上传" label-width="90px">
          <el-upload
            class="upload-demo"
            ref="upload"
            :headers="headers"
            :action="action"
            :file-list="form.accessoryList"
            :multiple="false"
            style="text-align: left"
            accept=".png,.jpg,.jpeg,.xlsx,.xls,.pdf,.docx,.doc,.zip,.rar"
            :show-file-list="false"
            :on-success="handleSuccess"
          >
            <el-button slot="trigger" size="small" type="primary"
              >上传文件</el-button
            >
          </el-upload>
        </el-form-item>
      </el-form>
      <el-table
        class="down"
        :data="form.accessoryList"
        border
        stripe
        style="width: 100%; margin-top: 20px"
      >
        <el-table-column prop="name" label="文件名称"></el-table-column>
        <el-table-column prop="size" label="文件大小">
          <template slot-scope="scope">
            <span>{{ scope.row.fileSize }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="createTime" label="上传时间">
          <template slot-scope="scope">
            <div>
              {{ scope.row.createTime }}
            </div>
          </template>
        </el-table-column>
        <el-table-column width="150px" label="操作">
          <template slot-scope="scope">
            <el-button size="small" type="text">
              <a
                target="_blank"
                @click="downloadFile(scope.row.name, scope.row.url)"
                >下载</a
              >
            </el-button>
            <el-button
              size="small"
              type="text"
              @click="deleteHandle(scope.$index)"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>
      <div slot="footer">
        <el-button @click="visible = false">取 消</el-button>
        <el-button type="primary" :loading="quesing" @click="handleQuestion"
          >确 定</el-button
        >
      </div>
    </el-dialog>
    <!-- 资质附件上传 -->
    <el-dialog
      title="资质附件上传"
      :visible.sync="showDialog"
      width="width"
      :before-close="dialogBeforeClose"
    >
      <el-form
        ref="form"
        :model="form"
        label-width="80px"
        v-for="(item, index) in params.matApprovalQualificationList"
        :key="index"
      >
        <el-form-item :label="item.qualificationTypeName">
          <el-upload
            class="upload-demo"
            ref="upload"
            :headers="headers"
            style="text-align: left"
            :action="action"
            :file-list="item.accessoryList"
            :multiple="true"
            accept=".png,.jpg,.jpeg,.xlsx,.xls,.pdf,.docx,.doc,.zip,.rar"
            :show-file-list="false"
            :on-success="
              (res) => {
                return clickSuccess(res, item, index)
              }
            "
          >
            <el-button slot="trigger" size="small" type="primary"
              >上传文件</el-button
            >
            <span>(注:文件最大可上传数为{{item.fileNum}})</span>
          </el-upload>
          <div style="text-align: left" @click="openQualification(item)">
            <a href="javascript:void(0)">已有资质？点击我</a>
          </div>
          <el-table
            class="down"
            :data="item.accessoryList"
            border
            stripe
            style="width: 100%; margin-top: 20px"
          >
            <el-table-column
              prop="qualificationTypeName"
              label="资质名称"
            ></el-table-column>
            <el-table-column prop="name" label="文件名称">
            </el-table-column>
            <el-table-column prop="size" label="上传文件大小">
              <template slot-scope="scope">
                <span v-if="scope.row.fileSize">{{ scope.row.fileSize }}</span>
                <template v-else>
                  
                </template>
              </template>
            </el-table-column>
            <el-table-column width="150px" label="附件操作">
              <template slot-scope="scope">
                <el-button
                  size="small"
                  type="text"
                >
                  <a
                    target="_blank"
                    v-if="scope.row.fileSize"
                    @click="downloadFile(scope.row.name, scope.row.url)"
                    >下载</a
                  >
                </el-button>
                <el-button
                  size="small"
                  type="text"
                  @click="deleteHandle(scope.$index)"
                  >删除</el-button
                >
              </template>
            </el-table-column>
          </el-table>
        </el-form-item>
      </el-form>

      <div slot="footer">
        <el-button @click="showDialog = false">取 消</el-button>
        <el-button type="primary" :loading="quesing" @click="clickJoin"
          >保 存</el-button
        >
      </div>
    </el-dialog>
    <!-- 有资质报名流程 -->
    <qualificationsDialog  ref="flowDialog" @reload="loadData(1)" ></qualificationsDialog>

    <qualification
      ref="qualification"
      :useOrgList="qualificationList"
      @load="getLoad"
    ></qualification>
  </div>
</template>

<script>
import pagination from '@/components/pagination'
import {TableMixin} from '@/mixins/tableMixin'
import {mapState} from 'vuex'
import qualificationsDialog from './module/qualificationsDialog.vue';
import routerManagement from '@/api/BasicDataManagement/routerManagement.js'
import qualification from '@/components/dialog/qualificationDialog.vue'
import req from '@/request.js'
import utils from '@/utils.js'
import { label } from 'three/examples/jsm/nodes/Nodes.js';
const portal = window.context.portal
export default {
  name: 'DemandEntry',
  components: {
    pagination,
    qualificationsDialog,
    qualification
  },
  mixins: [TableMixin],
  data() {
    return {
      tableHeight: 1000,
      currentPage: 1,
      tableMaxHeight: 400,
      loading: false,
      examineing:false,
      statusList:[
      {label:'未参与',value:0},
      {label:'已参与',value:1}
      ],
      showDialog: false,
      queryParam: {
        pageBean: {
          pageSize: 20,
          page: 1,
          total: 0,
        },
      },
      qualificationList:[],
      tableLoading: false,
      dialogVisible: false,
      quesing: false,
      visible: false,
      tableData: [],
      form: {
        describe: '',
        accessoryList: [],
      },
      detailsList: [],
      multipleSelection: [],
      form:{},
      params: {},
      rules: {
        describe: [
          {
            required: true,
            message: '请输入问题描述',
            trigger: 'blur',
          },
        ],
      },
      searchForm: {}, // 顶部搜索对象
      deleteIds: '', // 是否选中列表解锁删除按钮
      currentDataDel: [], // 删除时排查是否有在审核的数据
      querys: [
        {
          group: 'main',
          operation: 'EQUAL',
          parentGroup: '',
          property: 'BID_STATUS_',
          relation: 'AND',
          value: '3',
        },
        {
          group: 'main',
          operation: 'LIKE',
          parentGroup: '',
          property: 'procureOrgName',
          relation: 'AND',
          value: '',
        },
        {
          group: 'main',
          operation: 'EQUAL',
          parentGroup: '',
          property: 'joinStatus',
          relation: 'AND',
          value: 0,
        }
      ],
    }
  },
  mounted() {
    
  },
  created() {
    this.loadData()
  },
  methods: {
    getDictName(code, value) {
      return utils.getDictName(code, value)
    },
    //获取数据
    loadData() {
      this.tableLoading = true
      console.log(this.querys,11111);
      this.queryParam.querys = []
      if (this.querys[0].value) {
        this.queryParam.querys.push(this.querys[0])
      }
      if (this.querys[1].value) {
        this.queryParam.querys.push(this.querys[1])
      }
      if (this.querys[2].value||this.querys[2].value==0) {
        this.queryParam.querys.push(this.querys[2])
      }
      this.queryParam.sorter = [
        {
          direction: 'DESC',
          property: 'create_time_',
        },
      ]
      console.log(this.queryParam.querys,2222222);
      routerManagement.queryEventsList(this.queryParam).then((res) => {
        if (res.data.state) {
          this.tableLoading = false
          this.tableData = res.data.value.rows
          this.queryParam.pageBean = {
            page: res.data.value.page,
            pageSize: res.data.value.pageSize,
            total: res.data.value.total,
          }
        }
        this.tableData.forEach((item) => {
          this.$set(item, 'joining', false)
          this.$set(item, 'cancle', false)
        })
        console.log('返回的表格数据', this.tableData)
      })
    },
    handleSuccess(res, fileList) {
      this.form.accessoryList.push(res.value)
    },
    //下载按钮回调
    downloadFile(name, url) {
      var a = document.createElement('a')
      var event = new MouseEvent('click')
      a.download = name
      a.target = '_blank'
      a.href = url
      a.dispatchEvent(event)
    },
    // 删除
    deleteHandle(index) {
      this.$confirm('是否确认删除该附件', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {
        this.form.accessoryList.splice(index, 1)
        this.params.matApprovalQualificationList.forEach(item=>{
          item.accessoryList.forEach((val,i)=>{
            if(index == i){
              item.accessoryList.splice(i, 1)
            }
          })
        })
      })
    },
    openQualification(row) {
      this.$refs.qualification.add(row)
    },
    getLoad(data){
      data.forEach(item=>{
        item.qualificationTypeName = item.qualificationName
      })
      this.params.matApprovalQualificationList.forEach(item=>{
        item.accessoryList = data
      })
      this.$forceUpdate()
    },
    // 参与报名无资质
    handleJoin(row) {
      console.log(row, 'row')
      row.joining = true
      let form = {
          noticeId: row.id,
          noticeTitle: row.noticeTitle,
          noticeType: '1',
          status: '',
          noticeCode: row.projectNumber,
          price: row.bond,
        }
        if(row.hasBond == 1){
          form.status = 3
        }
        if(row.hasBond == 0){
          form.status = 1
        }
      if (row.joinStatus == 0) {
        this.$http
          .post('${portal}/userParticipation/v1/participate', form)
          .then((res) => {
            console.log(res, 'data')
            if (res.data.state) {
              this.$message.success(res.data.message)
              this.loadData()
            }
            row.joining = false
          })
      } else {
        this.$http
          .post(
            '${portal}/userParticipation/v1/modifyStatus?ids=' +
              row.partId +
              '&status=1'
          )
          .then((res) => {
            console.log(res, 'data')
            if (res.data.state) {
              this.$message.success(res.data.message)
              this.loadData()
            }
            row.joining = false
          })
      }
    },
    // 有资质报名弹窗
    openJoin(row) {
      // this.$refs.flowDialog.handleOpen(row)  
      this.$http
        .post('${portal}/matApproval/v1/getDataById?id=' + row.id)
        .then((res) => {
          if (res.data.state) {
            this.params = res.data.value
            this.showDialog = true
            this.$set(this.params)
            this.params.matApprovalQualificationList.forEach((item) => {
              item['accessoryList'] = []
            })
          }
        })
    },
    // 参与报名有资质
    clickJoin() {
      this.quesing = true
      let form = {
        noticeId: this.params.id,
        noticeTitle: this.params.noticeTitle,
        noticeType: '1',
        status: '1',
        noticeCode: this.params.projectNumber,
        price: this.params.bond,
        accessoryList: [],
      }
      this.params.matApprovalQualificationList.forEach(item=>{
        if(item.accessoryList&&item.accessoryList.length!=0){
          item.accessoryList.forEach(val=>{
            if(val.id){
              delete val.id
            }
            form.accessoryList.push(val)
          })
        }
      })
      if(form.accessoryList.length==0){
        this.$message.warning('请传入资质附件')
        this.quesing = false
        return
      }
      this.$http
        .post('${portal}/userParticipation/v1/qualificationsParticipate', form)
        .then((res) => {
          console.log(res, 'data')
          if (res.data.state) {
            this.$message.success(res.data.message)
            this.loadData()
            this.dialogBeforeClose()
          }
          this.quesing = false
        })
    },
    // 取消报名
    handleCanle(row) {
      row.cancle = true
      this.$http
        .post(
          '${portal}/userParticipation/v1/modifyStatus?ids=' +
            row.partId +
            '&status=5'
        )
        .then((res) => {
          console.log(res, 'data')
          if (res.data.state) {
            this.$message.success(res.data.message)
            this.loadData()
          }
          row.cancle = false
        })
    },
    handleExamine(){
      this.$http
        .post(
          '${portal}/userParticipation/v1/modifyStatus?ids='+this.multipleSelection[0].partId +
            '&status=3'
        )
        .then((res) => {
          console.log(res, 'data')
          if (res.data.state) {
            this.$message.success(res.data.message)
            this.loadData()
          }
        })
    },
    clickSuccess(res, row, index) {
      this.params.matApprovalQualificationList.forEach((item, i) => {
        if (i == index) {
          item.accessoryList.push(res.value)
          if (item.accessoryList && item.accessoryList.length != 0) {
            item.accessoryList.forEach((val) => {
              val['filesize'] = item.fileSize
              val['fileNum'] = item.fileNum
              val['qualificationTypeName'] = item.qualificationTypeName
              val['group'] = item.id
            })
          }
        }
      })
      this.$forceUpdate()
    },
    // 查看明细
    handleDetails(row) {
      this.$http
        .post('${portal}/matApproval/v1/getDataById?id=' + row.id)
        .then((res) => {
          if (res.data.state) {
            this.form= res.data.value
            this.detailsList = res.data.value.detailsList
            this.dialogVisible = true
          }
        })
    },
    // 澄清提问
    goQuestions() {
      this.visible = true
    },
    changeStatus(val){
      if(val==1){
        this.querys[0].value = ''
      }else{
        this.querys[0].value = '3'
      }
      this.querys[2].value = val
    },
    handleQuestion() {
      let data = {
        projectApprovalId: this.multipleSelection[0].id,
        describe: this.form.describe,
        accessoryList: this.form.accessoryList,
        projectApprovalType: 1,
      }
      this.quesing = true
      this.$http
        .post('${portal}/clarifyQuestions/v1/saveOrUpdate', data)
        .then((res) => {
          if (res.data.state) {
            this.loadData()
            this.dialogBeforeClose()
            this.form = {
              describe: '',
              accessoryList: [],
            }
          }
          this.quesing = false
        })
    },
    //重置
    clearSearchForm() {
      this.querys[0].value = '3'
      this.querys[1].value = ''
      this.querys[2].value = 0
      this.loadData()
    },
    // 顶部搜索
    handleSearch() {
      this.loadData()
    },
    dialogBeforeClose() {
      this.dialogVisible = false
      this.visible = false
      this.showDialog = false
    },
    //去结算
    goCheckout() {
      this.$router.push({
        path: `participateRecording/${1}`,
      })
    },
    handleSelectionChange(currentData) {
      this.currentDataDel = currentData
      this.multipleSelection = currentData
      if (currentData.length === 0) return (this.deleteIds = '')
      let ids = []
      currentData.forEach((item) => {
        ids.push(item.id)
      })
      this.deleteIds = ids.join(',')
      if (this.multipleSelection.length > 1) {
        this.$refs.multipleSelection.toggleRowSelection(
          this.multipleSelection[0],
          false
        )
      }
    },
    handleCurrentChange(page) {
      this.queryParam.pageBean = {...this.queryParam.pageBean, page}
      this.loadData(this.queryParam)
    },
    handleSizeChange(pageSize) {
      this.queryParam.pageBean = {...this.queryParam.pageBean, pageSize}
      this.loadData(this.queryParam)
    },
  },
  computed: {
    SearchPanel() {
      return {
        '--searchPanel': this.searchPanel + 'px',
      }
    },
    ...mapState({
      headers: (state) => {
        return {Authorization: `Bearer ${state.login.currentUser.token}`}
      },
      action: function () {
        return window.context.portal + '/biz/universal/v1/minioUpload'
      },
    }),
  },
}
</script>

<style lang="scss" scoped>
.common-table-content.btn-pagenation {
  height: calc(100% - 100px);
}
.cloumn-btn {
  border: 1px solid #2761ff;
  padding: 3px 10px;
  border-radius: 5px;
  &:nth-child(1) {
    margin-right: 5px;
  }
  &:nth-child(2) {
    margin-right: 5px;
  }
  &:nth-child(1):hover {
    background-color: #2761ff;
    color: #fff;
  }
  &:nth-child(2):hover {
    background-color: #2761ff;
    color: #fff;
  }
  /deep/ i,
  span {
    font-size: 16px;
  }
}

/deep/ .el-tree-node__content {
  padding: 5px 0;
}

/deep/ .el-table thead tr th {
  background-color: #eee !important;
  border-right: 1px solid #dfe2e8 !important;
}
/deep/ .el-table {
  border-collapse: collapse !important;
}
a:visited {
font-size: 12px;
text-decoration: none;
}
</style>
