<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="uCode" prop="uCode">
        <el-input
          v-model="queryParams.uCode"
          placeholder="请输入uCode"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="院校招生编码" prop="collegeEnrollCode">
        <el-input
          v-model="queryParams.collegeEnrollCode"
          placeholder="请输入院校招生编码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="院校编码" prop="collegeCode">
        <el-input
          v-model="queryParams.collegeCode"
          placeholder="请输入院校编码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="院校名称" prop="collegeName">
        <el-input
          v-model="queryParams.collegeName"
          placeholder="请输入院校名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="院校名称" prop="collegeSourceName">
        <el-input
          v-model="queryParams.collegeSourceName"
          placeholder="请输入院校名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="批次" prop="batch">
        <el-input
          v-model="queryParams.batch"
          placeholder="请输入批次"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="选科要求" prop="course">
        <el-input
          v-model="queryParams.course"
          placeholder="请输入选科要求"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="年份" prop="year">
        <el-input
          v-model="queryParams.year"
          placeholder="请输入年份"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="选科规则" prop="chooseSubjectRule">
        <el-input
          v-model="queryParams.chooseSubjectRule"
          placeholder="请输入选科规则"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="招生类别" prop="eduLevel">
        <el-input
          v-model="queryParams.eduLevel"
          placeholder="请输入招生类别"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="collegeKey" prop="collegeKey">
        <el-input
          v-model="queryParams.collegeKey"
          placeholder="请输入collegeKey"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="省份编码" prop="provinceCode">
        <el-input
          v-model="queryParams.provinceCode"
          placeholder="请输入省份编码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="省份名称" prop="professionName">
        <el-input
          v-model="queryParams.professionName"
          placeholder="请输入省份名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="专业招生编码" prop="professionEnrollCode">
        <el-input
          v-model="queryParams.professionEnrollCode"
          placeholder="请输入专业招生编码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="专业编码" prop="majorCode">
        <el-input
          v-model="queryParams.majorCode"
          placeholder="请输入专业编码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="计划数" prop="planNum">
        <el-input
          v-model="queryParams.planNum"
          placeholder="请输入计划数"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="录取线" prop="enterLine">
        <el-input
          v-model="queryParams.enterLine"
          placeholder="请输入录取线"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="录取数" prop="enterNum">
        <el-input
          v-model="queryParams.enterNum"
          placeholder="请输入录取数"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="最大分" prop="maxScore">
        <el-input
          v-model="queryParams.maxScore"
          placeholder="请输入最大分"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="最小分" prop="minScore">
        <el-input
          v-model="queryParams.minScore"
          placeholder="请输入最小分"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="平均分" prop="avgScore">
        <el-input
          v-model="queryParams.avgScore"
          placeholder="请输入平均分"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="最高位次" prop="maxRank">
        <el-input
          v-model="queryParams.maxRank"
          placeholder="请输入最高位次"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="最低位次" prop="minRank">
        <el-input
          v-model="queryParams.minRank"
          placeholder="请输入最低位次"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="平均位次" prop="avgRank">
        <el-input
          v-model="queryParams.avgRank"
          placeholder="请输入平均位次"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="首选" prop="chooseSubject">
        <el-input
          v-model="queryParams.chooseSubject"
          placeholder="请输入首选"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="次选" prop="chooseSubject2">
        <el-input
          v-model="queryParams.chooseSubject2"
          placeholder="请输入次选"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="选科说明" prop="chooseSubjectText">
        <el-input
          v-model="queryParams.chooseSubjectText"
          placeholder="请输入选科说明"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="省份" prop="location">
        <el-input
          v-model="queryParams.location"
          placeholder="请输入省份"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="更新时间" prop="updateTime">
        <el-date-picker clearable
          v-model="queryParams.updateTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择更新时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="创建时间" prop="createTime">
        <el-date-picker clearable
          v-model="queryParams.createTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择创建时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="udid" prop="udid">
        <el-input
          v-model="queryParams.udid"
          placeholder="请输入udid"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="业务组合id" prop="udid2">
        <el-input
          v-model="queryParams.udid2"
          placeholder="请输入业务组合id"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="专业组征集志愿" prop="zjText">
        <el-input
          v-model="queryParams.zjText"
          placeholder="请输入专业组征集志愿"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="专业征集志愿" prop="professionZjText">
        <el-input
          v-model="queryParams.professionZjText"
          placeholder="请输入专业征集志愿"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="专业组" prop="groups">
        <el-input
          v-model="queryParams.groups"
          placeholder="请输入专业组"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="专业组名称" prop="groupsName">
        <el-input
          v-model="queryParams.groupsName"
          placeholder="请输入专业组名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="版本" prop="version">
        <el-input
          v-model="queryParams.version"
          placeholder="请输入版本"
          clearable
          @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-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['processdata:pdProfessionVersion0Update:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['processdata:pdProfessionVersion0Update:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['processdata:pdProfessionVersion0Update:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['processdata:pdProfessionVersion0Update:export']"
        >导出</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          icon="el-icon-cloudy"
          size="mini"
          @click="showSyncDialog=true"
          v-hasPermi="['processdata:pdProfessionVersion0Update:sync']"
        >同步数据</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="pdProfessionVersion0UpdateList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="数据类型" align="center" prop="dataModeType" />
      <el-table-column label="uCode" align="center" prop="uCode" />
      <el-table-column label="院校招生编码" align="center" prop="collegeEnrollCode" />
      <el-table-column label="院校编码" align="center" prop="collegeCode" />
      <el-table-column label="院校名称" align="center" prop="collegeName" />
      <el-table-column label="院校名称" align="center" prop="collegeSourceName" />
      <el-table-column label="院校名称" align="center" prop="collegeNameText" />
      <el-table-column label="批次" align="center" prop="batch" />
      <el-table-column label="选科要求" align="center" prop="course" />
      <el-table-column label="年份" align="center" prop="year" />
      <el-table-column label="选科规则" align="center" prop="chooseSubjectRule" />
      <el-table-column label="招生类别" align="center" prop="eduLevel" />
      <el-table-column label="备注" align="center" prop="remark" />
      <el-table-column label="collegeKey" align="center" prop="collegeKey" />
      <el-table-column label="省份编码" align="center" prop="provinceCode" />
      <el-table-column label="省份名称" align="center" prop="professionName" />
      <el-table-column label="专业招生编码" align="center" prop="professionEnrollCode" />
      <el-table-column label="text" align="center" prop="text" />
      <el-table-column label="专业备注" align="center" prop="professionRemark" />
      <el-table-column label="专业编码" align="center" prop="majorCode" />
      <el-table-column label="计划数" align="center" prop="planNum" />
      <el-table-column label="录取线" align="center" prop="enterLine" />
      <el-table-column label="录取数" align="center" prop="enterNum" />
      <el-table-column label="最大分" align="center" prop="maxScore" />
      <el-table-column label="最小分" align="center" prop="minScore" />
      <el-table-column label="平均分" align="center" prop="avgScore" />
      <el-table-column label="最高位次" align="center" prop="maxRank" />
      <el-table-column label="最低位次" align="center" prop="minRank" />
      <el-table-column label="平均位次" align="center" prop="avgRank" />
      <el-table-column label="首选" align="center" prop="chooseSubject" />
      <el-table-column label="次选" align="center" prop="chooseSubject2" />
      <el-table-column label="选科说明" align="center" prop="chooseSubjectText" />
      <el-table-column label="省份" align="center" prop="location" />
      <el-table-column label="更新时间" align="center" prop="updateTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="创建时间" align="center" prop="createTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="udid" align="center" prop="udid" />
      <el-table-column label="业务组合id" align="center" prop="udid2" />
      <el-table-column label="专业组征集志愿" align="center" prop="zjText" />
      <el-table-column label="专业组征集志愿说明" align="center" prop="zjTextExplain" />
      <el-table-column label="专业征集志愿" align="center" prop="professionZjText" />
      <el-table-column label="专业征集志愿说明" align="center" prop="professionZjTextExplain" />
      <el-table-column label="专业组" align="center" prop="groups" />
      <el-table-column label="专业组名称" align="center" prop="groupsName" />
      <el-table-column label="版本" align="center" prop="version" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['processdata:pdProfessionVersion0Update:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['processdata:pdProfessionVersion0Update:remove']"
          >删除</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"
    />

    <!-- 添加或修改专业线0分更新对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="ID" prop="id">
          <el-input v-model="form.id" placeholder="请输入ID" />
        </el-form-item>
        <el-form-item label="uCode" prop="uCode">
          <el-input v-model="form.uCode" placeholder="请输入uCode" />
        </el-form-item>
        <el-form-item label="院校招生编码" prop="collegeEnrollCode">
          <el-input v-model="form.collegeEnrollCode" placeholder="请输入院校招生编码" />
        </el-form-item>
        <el-form-item label="院校编码" prop="collegeCode">
          <el-input v-model="form.collegeCode" placeholder="请输入院校编码" />
        </el-form-item>
        <el-form-item label="院校名称" prop="collegeName">
          <el-input v-model="form.collegeName" placeholder="请输入院校名称" />
        </el-form-item>
        <el-form-item label="院校名称" prop="collegeSourceName">
          <el-input v-model="form.collegeSourceName" placeholder="请输入院校名称" />
        </el-form-item>
        <el-form-item label="院校名称" prop="collegeNameText">
          <el-input v-model="form.collegeNameText" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="批次" prop="batch">
          <el-input v-model="form.batch" placeholder="请输入批次" />
        </el-form-item>
        <el-form-item label="选科要求" prop="course">
          <el-input v-model="form.course" placeholder="请输入选科要求" />
        </el-form-item>
        <el-form-item label="年份" prop="year">
          <el-input v-model="form.year" placeholder="请输入年份" />
        </el-form-item>
        <el-form-item label="选科规则" prop="chooseSubjectRule">
          <el-input v-model="form.chooseSubjectRule" placeholder="请输入选科规则" />
        </el-form-item>
        <el-form-item label="招生类别" prop="eduLevel">
          <el-input v-model="form.eduLevel" placeholder="请输入招生类别" />
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="collegeKey" prop="collegeKey">
          <el-input v-model="form.collegeKey" placeholder="请输入collegeKey" />
        </el-form-item>
        <el-form-item label="省份编码" prop="provinceCode">
          <el-input v-model="form.provinceCode" placeholder="请输入省份编码" />
        </el-form-item>
        <el-form-item label="省份名称" prop="professionName">
          <el-input v-model="form.professionName" placeholder="请输入省份名称" />
        </el-form-item>
        <el-form-item label="专业招生编码" prop="professionEnrollCode">
          <el-input v-model="form.professionEnrollCode" placeholder="请输入专业招生编码" />
        </el-form-item>
        <el-form-item label="text" prop="text">
          <el-input v-model="form.text" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="专业备注" prop="professionRemark">
          <el-input v-model="form.professionRemark" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="专业编码" prop="majorCode">
          <el-input v-model="form.majorCode" placeholder="请输入专业编码" />
        </el-form-item>
        <el-form-item label="计划数" prop="planNum">
          <el-input v-model="form.planNum" placeholder="请输入计划数" />
        </el-form-item>
        <el-form-item label="录取线" prop="enterLine">
          <el-input v-model="form.enterLine" placeholder="请输入录取线" />
        </el-form-item>
        <el-form-item label="录取数" prop="enterNum">
          <el-input v-model="form.enterNum" placeholder="请输入录取数" />
        </el-form-item>
        <el-form-item label="最大分" prop="maxScore">
          <el-input v-model="form.maxScore" placeholder="请输入最大分" />
        </el-form-item>
        <el-form-item label="最小分" prop="minScore">
          <el-input v-model="form.minScore" placeholder="请输入最小分" />
        </el-form-item>
        <el-form-item label="平均分" prop="avgScore">
          <el-input v-model="form.avgScore" placeholder="请输入平均分" />
        </el-form-item>
        <el-form-item label="最高位次" prop="maxRank">
          <el-input v-model="form.maxRank" placeholder="请输入最高位次" />
        </el-form-item>
        <el-form-item label="最低位次" prop="minRank">
          <el-input v-model="form.minRank" placeholder="请输入最低位次" />
        </el-form-item>
        <el-form-item label="平均位次" prop="avgRank">
          <el-input v-model="form.avgRank" placeholder="请输入平均位次" />
        </el-form-item>
        <el-form-item label="首选" prop="chooseSubject">
          <el-input v-model="form.chooseSubject" placeholder="请输入首选" />
        </el-form-item>
        <el-form-item label="次选" prop="chooseSubject2">
          <el-input v-model="form.chooseSubject2" placeholder="请输入次选" />
        </el-form-item>
        <el-form-item label="选科说明" prop="chooseSubjectText">
          <el-input v-model="form.chooseSubjectText" placeholder="请输入选科说明" />
        </el-form-item>
        <el-form-item label="省份" prop="location">
          <el-input v-model="form.location" placeholder="请输入省份" />
        </el-form-item>
        <el-form-item label="udid" prop="udid">
          <el-input v-model="form.udid" placeholder="请输入udid" />
        </el-form-item>
        <el-form-item label="业务组合id" prop="udid2">
          <el-input v-model="form.udid2" placeholder="请输入业务组合id" />
        </el-form-item>
        <el-form-item label="专业组征集志愿" prop="zjText">
          <el-input v-model="form.zjText" placeholder="请输入专业组征集志愿" />
        </el-form-item>
        <el-form-item label="专业组征集志愿说明" prop="zjTextExplain">
          <el-input v-model="form.zjTextExplain" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="专业征集志愿" prop="professionZjText">
          <el-input v-model="form.professionZjText" placeholder="请输入专业征集志愿" />
        </el-form-item>
        <el-form-item label="专业征集志愿说明" prop="professionZjTextExplain">
          <el-input v-model="form.professionZjTextExplain" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="专业组" prop="groups">
          <el-input v-model="form.groups" placeholder="请输入专业组" />
        </el-form-item>
        <el-form-item label="专业组名称" prop="groupsName">
          <el-input v-model="form.groupsName" placeholder="请输入专业组名称" />
        </el-form-item>
        <el-form-item label="版本" prop="version">
          <el-input v-model="form.version" placeholder="请输入版本" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <el-dialog :visible.sync="showSyncDialog" title="同步数据">
      <el-form v-model="syncForm" label-position="right" label-width="150px">
        <el-form-item label="省份" prop="location">
          <el-input v-model="syncForm.location" placeholder="请输入省份"></el-input>
        </el-form-item>
        <el-form-item label="更新URL" prop="updateProfessionUrls">
          <el-input v-model="syncForm.updateProfessionUrls" placeholder="请输入更新URL"></el-input>
        </el-form-item>
        <el-form-item label="更新版本" prop="updateVersion">
          <el-input v-model="syncForm.updateVersion" placeholder="请输入更新版本"></el-input>
        </el-form-item>
        <el-form-item label="开始页码" prop="pageNum">
          <el-input v-model="syncForm.pageNum" placeholder="请输入开始页码"></el-input>
        </el-form-item>
        <el-form-item label="每次更新数量" prop="pageSize">
          <el-input v-model="syncForm.pageSize" placeholder="请输入每次更新数量"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button :loading="syncLoading" type="primary" @click="sendSyncRequest">确 定</el-button>
        <el-button @click="showSyncDialog=false">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  listPdProfessionVersion0Update,
  getPdProfessionVersion0Update,
  delPdProfessionVersion0Update,
  addPdProfessionVersion0Update,
  updatePdProfessionVersion0Update,
  sendData2Test
} from "@/api/processdata/pdProfessionVersion0Update";

export default {
  name: "PdProfessionVersion0Update",
  data() {
    return {
      showSyncDialog: false,
      syncForm: {
        location: '',
        updateProfessionUrls: '',
        updateVersion: '',
        pageNum: 1,
        pageSize: 100
      },
      syncLoading: false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 专业线0分更新表格数据
      pdProfessionVersion0UpdateList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        dataModeType: null,
        uCode: null,
        collegeEnrollCode: null,
        collegeCode: null,
        collegeName: null,
        collegeSourceName: null,
        collegeNameText: null,
        batch: null,
        course: null,
        year: null,
        chooseSubjectRule: null,
        eduLevel: null,
        collegeKey: null,
        provinceCode: null,
        professionName: null,
        professionEnrollCode: null,
        text: null,
        professionRemark: null,
        majorCode: null,
        planNum: null,
        enterLine: null,
        enterNum: null,
        maxScore: null,
        minScore: null,
        avgScore: null,
        maxRank: null,
        minRank: null,
        avgRank: null,
        chooseSubject: null,
        chooseSubject2: null,
        chooseSubjectText: null,
        location: null,
        updateTime: null,
        createTime: null,
        udid: null,
        udid2: null,
        zjText: null,
        zjTextExplain: null,
        professionZjText: null,
        professionZjTextExplain: null,
        groups: null,
        groupsName: null,
        version: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        id: [
          { required: true, message: "ID不能为空", trigger: "blur" }
        ],
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询专业线0分更新列表 */
    getList() {
      this.loading = true;
      listPdProfessionVersion0Update(this.queryParams).then(response => {
        this.pdProfessionVersion0UpdateList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        dataModeType: null,
        uCode: null,
        collegeEnrollCode: null,
        collegeCode: null,
        collegeName: null,
        collegeSourceName: null,
        collegeNameText: null,
        batch: null,
        course: null,
        year: null,
        chooseSubjectRule: null,
        eduLevel: null,
        remark: null,
        collegeKey: null,
        provinceCode: null,
        professionName: null,
        professionEnrollCode: null,
        text: null,
        professionRemark: null,
        majorCode: null,
        planNum: null,
        enterLine: null,
        enterNum: null,
        maxScore: null,
        minScore: null,
        avgScore: null,
        maxRank: null,
        minRank: null,
        avgRank: null,
        chooseSubject: null,
        chooseSubject2: null,
        chooseSubjectText: null,
        location: null,
        updateTime: null,
        createTime: null,
        udid: null,
        udid2: null,
        zjText: null,
        zjTextExplain: null,
        professionZjText: null,
        professionZjTextExplain: null,
        groups: null,
        groupsName: null,
        version: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加专业线0分更新";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getPdProfessionVersion0Update(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改专业线0分更新";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updatePdProfessionVersion0Update(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addPdProfessionVersion0Update(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除专业线0分更新编号为"' + ids + '"的数据项？').then(function() {
        return delPdProfessionVersion0Update(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('processdata/pdProfessionVersion0Update/export', {
        ...this.queryParams
      }, `pdProfessionVersion0Update_${new Date().getTime()}.xlsx`)
    },
    /* 同步 */
    sendSyncRequest() {
      this.syncLoading = true
      sendData2Test(this.syncForm).then(res => {
        this.showSyncDialog = false
        this.$message.success('发送成功')
      }).finally(()=> this.syncLoading = false)
    }
  }
};
</script>
