<template>
  <div class="content-main">
    <el-row :id="$route.query.state == 'export' ? 'tjcbData' : ''">
      <el-row class="titles" id="protectedItems"
        >市级储备粮移库差数预申请包干轮换补贴表</el-row
      >
      <div id="adjustingMonth"></div>
			<el-row class="titlesMor">
				申请企业：{{ detailData.ssqymc }}
			</el-row>
      <el-row>
        <el-form :model="detailData" ref="detailData" :rules="rules">
          <el-table
            :data="detailData.tjmxs"
            stripe
            border
            fit
            highlight-current-row
            style="width: 100%"
          >
            <el-table-column prop="pzbmmc" align="center" label="品种">
            </el-table-column>
            <el-table-column align="center" :label="$route.query.ssqymc">
              <el-table-column prop="ycfbhmc" align="center" label="移出仓号">
              </el-table-column>
              <el-table-column prop="jhdcsl" align="center" label="账面数量">
                <template slot-scope="scope">
                  {{
                    String(scope.row.jhdcsl).indexOf(".") > -1
                      ? Number(scope.row.jhdcsl).toFixed(3)
                      : scope.row.jhdcsl
                  }}
                </template>
              </el-table-column>
            </el-table-column>
            <el-table-column align="center" :label="$route.query.yrkssqymc">
              <el-table-column prop="mdcfbhmc" align="center" label="移入仓号">
              </el-table-column>
              <el-table-column prop="sjdcsl" align="center" label="倒入数量">
                <template slot-scope="scope">
                  {{
                    String(scope.row.sjdcsl).indexOf(".") > -1
                      ? Number(scope.row.sjdcsl).toFixed(3)
                      : scope.row.sjdcsl
                  }}
                </template>
              </el-table-column>
            </el-table-column>
            <el-table-column prop="cs" align="center" label="差数">
              <template slot-scope="scope">
                {{
                  String(scope.row.cs).indexOf(".") > -1
                    ? Number(scope.row.cs).toFixed(3)
                    : scope.row.cs
                }}
              </template>
            </el-table-column>
            <el-table-column
              align="center"
              prop="dnlhjsdj"
              label="当年轮换结算单价(元/吨)"
            >
            </el-table-column>
            <el-table-column
              align="center"
              prop="ysqbgbtje"
              label="预拨包干轮换补贴金额"
            >
            </el-table-column>
          </el-table>
          <el-row style="margin-top: 10px">
            <el-col :span="24">
              <el-form-item prop="bz" label="备注" label-width="100px">
                <el-input
                  class="inputWidBz"
                  disabled
                  placeholder="请输入"
                  v-model="detailData.bz"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="6">
              <el-form-item prop="qyfzr" label="单位负责人" label-width="100px">
                <el-input
                  disabled
                  class="inputWid"
                  placeholder="请输入"
                  v-model="detailData.qyfzr"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item prop="fh" label="复核" label-width="100px">
                <el-input
                  class="inputWid"
                  disabled
                  placeholder="请输入"
                  v-model="detailData.fh"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item prop="zb" label="制表" label-width="100px">
                <el-input
                  class="inputWid"
                  disabled
                  placeholder="请输入"
                  v-model="detailData.zb"
                ></el-input>
              </el-form-item>
            </el-col>
						<el-col :span="6">
        					<el-form-item label="填报日期:" prop="tbrq">
        					  <el-date-picker
        					    class="dateInputCompatible"
        					    v-model="detailData.tbrq"
								      disabled
        					    type="date"
								      placeholder="填报日期"
        					    value-format="yyyy-MM-dd"
        					  ></el-date-picker>
        					</el-form-item>
						</el-col>
          </el-row>
        </el-form>
      </el-row>
        <el-row>
          <el-form
            :model="detailData"
            label-width="130px"
            ref="shForm"
            :rules="rules"
          >
            <table class="table-a">
              <tr>
                <td colspan="2" style="text-align:center; padding: 20px">市储备公司审批</td>
              </tr>
              <tr>
                <td style="width: 20px; padding: 20px">
                  <div>审核人</div>
                </td>
                <td>
                  <el-row
                    v-if="
                      $route.query.detail == 1 ||
                      ($route.query.detail == 0 && detailData.spzbspjg)
                    "
                  >
                    <el-row>
                      <el-col :span="7">
                        <span
                          class="songFont"
                          style="display: inline-block; width: 160px;margin-bottom:20px"
                          v-if="cFlag"
                        >
                          审核意见:
                        </span>
                        <span class="songFont" v-if="cFlag">{{
                          detailData.spzbspjg == "1"
                            ? "同意"
                            : detailData.spzbspjg == "0"
                            ? "不同意"
                            : ""
                        }}</span>
                        <el-form-item
                          v-else
                          label="审核意见:"
                          prop="spzbspjg"
                          :rules="{
                            required: true,
                            message: '请选择审核意见',
                            trigger: 'change',
                          }"
                        >
                          <el-radio-group
                            :disabled="
                              $route.query.detail == 0 ||
                              ($route.query.detail == 1 &&
                                $route.query.shzt !== '4' &&
                                $route.query.shzt !== '7')
                            "
                            v-model="detailData.spzbspjg"
                          >
                            <el-radio label="1">同意</el-radio>
                            <el-radio label="0">不同意</el-radio>
                          </el-radio-group>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row style="text-align: left">
                      <span
                        class="songFont"
                        style="
                          display: inline-block;
                          margin-left: 158px;
                          height: 50px;
                          padding: 5px;
                        "
                        v-if="cFlag"
                        >{{ detailData.spzbspjyj }}</span
                      >

                      <el-form-item
                        v-else
                        prop="spzbspjyj"
                        :rules="{
                          required: detailData.spzbspjg === '0',
                          message: '请输入审核意见',
                          trigger: ['change', 'blur'],
                        }"
                        style="margin-left:8px"
                      >
                        <el-input
                          v-model="detailData.spzbspjyj"
                          :disabled="
                            $route.query.detail == 0 ||
                              ($route.query.detail == 1 &&
                                $route.query.shzt !== '4' &&
                                $route.query.shzt !== '7')
                          "
                          type="textarea"
                        ></el-input>
                      </el-form-item>
                    </el-row>
                    <el-row>
                      <el-col :span="11">
                        <span
                          class="songFont"
                          style="display: inline-block; width: 160px"
                          v-if="cFlag"
                          >审核人:</span
                        >
                        <span class="songFont" v-if="cFlag">{{
                          detailData.spzb
                        }}</span>
                        <el-form-item v-else label="审核人:" prop="spzb">
                          <el-input
                            :disabled="
                              $route.query.detail == 0 ||
                              ($route.query.detail == 1 &&
                                $route.query.shzt !== '4' &&
                                $route.query.shzt !== '7')
                            "
                            class="inputwidth"
                            v-model="detailData.spzb"
                          ></el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="11">
                        <span
                          class="songFont"
                          style="display: inline-block; width: 160px"
                          v-if="cFlag"
                          >日期:</span
                        >
                        <span class="songFont" v-if="cFlag">{{
                          detailData.spzbrspsj
                        }}</span>
                        <el-form-item v-else label="日期:" prop="spzbrspsj">
                          <el-date-picker
                            v-model="detailData.spzbrspsj"
                            :disabled="
                              $route.query.detail == 0 ||
                              ($route.query.detail == 1 &&
                                $route.query.shzt !== '4' &&
                                $route.query.shzt !== '7')
                            "
                            class="inputwidth"
                            type="date"
                            placeholder="请选择"
                            value-format="yyyy-MM-dd"
                          ></el-date-picker>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </el-row>
                </td>
              </tr>
              <tr>
                <td style="width: 20px; padding: 20px">
                  <div>复核</div>
                </td>
                <td>
                  <el-row
                    v-if="
                      ($route.query.detail == 1 && $route.query.shzt > 5) ||
                      ($route.query.detail == 0 && detailData.spfhspjg)
                    "
                  >
                    <el-row>
                      <el-col :span="7">
                        <span
                          class="songFont"
                          style="display: inline-block; width: 160px;margin-bottom:20px"
                          v-if="cFlag"
                        >
                          审核意见:
                        </span>
                        <span class="songFont" v-if="cFlag">{{
                          detailData.spfhspjg == "1"
                            ? "同意"
                            : detailData.spfhspjg == "0"
                            ? "不同意"
                            : ""
                        }}</span>
                        <el-form-item
                          v-else
                          label="审核意见:"
                          prop="spfhspjg"
                          :rules="{
                            required: true,
                            message: '请选择审核意见',
                            trigger: 'change',
                          }"
                        >
                          <el-radio-group
                            :disabled="
                              $route.query.detail == 0 ||
                              ($route.query.detail == 1 &&
                                $route.query.shzt !== '6' &&
                                $route.query.shzt !== '9')
                            "
                            v-model="detailData.spfhspjg"
                          >
                            <el-radio label="1">同意</el-radio>
                            <el-radio label="0">不同意</el-radio>
                          </el-radio-group>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row style="text-align: left">
                      <span
                        class="songFont"
                        style="
                          display: inline-block;
                          margin-left: 158px;
                          height: 50px;
                          padding: 5px;
                        "
                        v-if="cFlag"
                        >{{ detailData.spfhspjyj }}</span
                      >

                      <el-form-item
                        v-else
                        prop="spfhspjyj"
                        :rules="{
                          required: detailData.spfhspjg === '0',
                          message: '请输入审核意见',
                          trigger: ['change', 'blur'],
                        }"
                        style="margin-left:8px"
                      >
                        <el-input
                          v-model="detailData.spfhspjyj"
                          :disabled="
                            $route.query.detail == 0 ||
                              ($route.query.detail == 1 &&
                                $route.query.shzt !== '6' &&
                                $route.query.shzt !== '9')
                          "
                          type="textarea"
                        ></el-input>
                      </el-form-item>
                    </el-row>
                    <el-row>
                      <el-col :span="11">
                        <span
                          class="songFont"
                          style="display: inline-block; width: 160px"
                          v-if="cFlag"
                          >审核人:</span
                        >
                        <span class="songFont" v-if="cFlag">{{
                          detailData.spfh
                        }}</span>
                        <el-form-item v-else label="审核人:" prop="spfh">
                          <el-input
                            :disabled="
                              $route.query.detail == 0 ||
                              ($route.query.detail == 1 &&
                                $route.query.shzt !== '6' &&
                                $route.query.shzt !== '9')
                            "
                            class="inputwidth"
                            v-model="detailData.spfh"
                          ></el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="11">
                        <span
                          class="songFont"
                          style="display: inline-block; width: 160px"
                          v-if="cFlag"
                          >日期:</span
                        >
                        <span class="songFont" v-if="cFlag">{{
                          detailData.spfhrspsj
                        }}</span>
                        <el-form-item v-else label="日期:" prop="spfhrspsj">
                          <el-date-picker
                            v-model="detailData.spfhrspsj"
                            :disabled="
                              $route.query.detail == 0 ||
                              ($route.query.detail == 1 &&
                                $route.query.shzt !== '6' &&
                                $route.query.shzt !== '9')
                            "
                            class="inputwidth"
                            type="date"
                            placeholder="请选择"
                            value-format="yyyy-MM-dd"
                          ></el-date-picker>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </el-row>
                </td>
              </tr>
              <tr>
                <td style="width: 20px; padding: 20px">
                  <div>财务分管领导</div>
                </td>
                <td>
                  <el-row
                    v-if="
                      ($route.query.detail == 1 && $route.query.shzt > 7) ||
                      ($route.query.detail == 0 && detailData.cwldpspjg)
                    "
                  >
                    <el-row>
                      <el-col :span="7">
                        <span
                          class="songFont"
                          style="display: inline-block; width: 160px;margin-bottom:20px"
                          v-if="cFlag"
                        >
                          审核意见:
                        </span>
                        <span class="songFont" v-if="cFlag">{{
                          detailData.cwldpspjg == "1"
                            ? "同意"
                            : detailData.cwldpspjg == "0"
                            ? "不同意"
                            : ""
                        }}</span>
                        <el-form-item
                          v-else
                          label="审核意见:"
                          prop="cwldpspjg"
                          :rules="{
                            required: true,
                            message: '请选择审核意见',
                            trigger: 'change',
                          }"
                        >
                          <el-radio-group
                            :disabled="
                              $route.query.detail == 0 ||
                              ($route.query.detail == 1 &&
                                $route.query.shzt !== '8' &&
                                $route.query.shzt !== '13' &&
                                $route.query.shzt !== '11')
                            "
                            v-model="detailData.cwldpspjg"
                          >
                            <el-radio label="1">同意</el-radio>
                            <el-radio label="0">不同意</el-radio>
                          </el-radio-group>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row style="text-align: left">
                      <span
                        class="songFont"
                        style="
                          display: inline-block;
                          margin-left: 158px;
                          height: 50px;
                          padding: 5px;
                        "
                        v-if="cFlag"
                        >{{ detailData.cwldpspjyj }}</span
                      >

                      <el-form-item
                        v-else
                        prop="cwldpspjyj"
                        :rules="{
                          required: detailData.cwldpspjg === '0',
                          message: '请输入审核意见',
                          trigger: ['change', 'blur'],
                        }"
                        style="margin-left:8px"
                      >
                        <el-input
                          v-model="detailData.cwldpspjyj"
                          :disabled="
                            $route.query.detail == 0 ||
                              ($route.query.detail == 1 &&
                                $route.query.shzt !== '8' &&
                                $route.query.shzt !== '13' &&
                                $route.query.shzt !== '11')
                          "
                          type="textarea"
                        ></el-input>
                      </el-form-item>
                    </el-row>
                    <el-row>
                      <el-col :span="11">
                        <span
                          class="songFont"
                          style="display: inline-block; width: 160px"
                          v-if="cFlag"
                          >审核人:</span
                        >
                        <span class="songFont" v-if="cFlag">{{
                          detailData.cwldps
                        }}</span>
                        <el-form-item v-else label="审核人:" prop="cwldps">
                          <el-input
                            :disabled="
                              $route.query.detail == 0 ||
                              ($route.query.detail == 1 &&
                                $route.query.shzt !== '8' &&
                                $route.query.shzt !== '13' &&
                                $route.query.shzt !== '11')
                            "
                            class="inputwidth"
                            v-model="detailData.cwldps"
                          ></el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="11">
                        <span
                          class="songFont"
                          style="display: inline-block; width: 160px"
                          v-if="cFlag"
                          >日期:</span
                        >
                        <span class="songFont" v-if="cFlag">{{
                          detailData.cwldpssj
                        }}</span>
                        <el-form-item v-else label="日期:" prop="cwldpssj">
                          <el-date-picker
                            v-model="detailData.cwldpssj"
                            :disabled="
                              $route.query.detail == 0 ||
                              ($route.query.detail == 1 &&
                                $route.query.shzt !== '8' &&
                                $route.query.shzt !== '13' &&
                                $route.query.shzt !== '11')
                            "
                            class="inputwidth"
                            type="date"
                            placeholder="请选择"
                            value-format="yyyy-MM-dd"
                          ></el-date-picker>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </el-row>
                </td>
              </tr>
              <tr>
                <td style="width: 20px; padding: 20px">
                  <div>单位负责人</div>
                </td>
                <td>
                  <el-row
                    v-if="
                      ($route.query.detail == 1 && $route.query.shzt > 9) ||
                      ($route.query.detail == 0 && detailData.dwfzrpspjg)
                    "
                  >
                    <el-row>
                      <el-col :span="7">
                        <span
                          class="songFont"
                          style="display: inline-block; width: 160px;margin-bottom:20px"
                          v-if="cFlag"
                        >
                          审核意见:
                        </span>
                        <span class="songFont" v-if="cFlag">{{
                          detailData.dwfzrpspjg == "1"
                            ? "同意"
                            : detailData.dwfzrpspjg == "0"
                            ? "不同意"
                            : ""
                        }}</span>
                        <el-form-item
                          v-else
                          label="审核意见:"
                          prop="dwfzrpspjg"
                          :rules="{
                            required: true,
                            message: '请选择审核意见',
                            trigger: 'change',
                          }"
                        >
                          <el-radio-group
                            :disabled="
                              $route.query.detail == 0 ||
                              ($route.query.detail == 1 &&
                                $route.query.shzt !== '10')
                            "
                            v-model="detailData.dwfzrpspjg"
                          >
                            <el-radio label="1">同意</el-radio>
                            <el-radio label="0">不同意</el-radio>
                          </el-radio-group>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row style="text-align: left">
                      <span
                        class="songFont"
                        style="
                          display: inline-block;
                          margin-left: 158px;
                          height: 50px;
                          padding: 5px;
                        "
                        v-if="cFlag"
                        >{{ detailData.dwfzrpspjyj }}</span
                      >

                      <el-form-item
                        v-else
                        prop="dwfzrpspjyj"
                        :rules="{
                          required: detailData.dwfzrpspjg === '0',
                          message: '请输入审核意见',
                          trigger: ['change', 'blur'],
                        }"
                        style="margin-left:8px"
                      >
                        <el-input
                          v-model="detailData.dwfzrpspjyj"
                          :disabled="
                            $route.query.detail == 0 ||
                              ($route.query.detail == 1 &&
                                $route.query.shzt !== '10')
                          "
                          type="textarea"
                        ></el-input>
                      </el-form-item>
                    </el-row>
                    <el-row>
                      <el-col :span="11">
                        <span
                          class="songFont"
                          style="display: inline-block; width: 160px"
                          v-if="cFlag"
                          >审核人:</span
                        >
                        <span class="songFont" v-if="cFlag">{{
                          detailData.dwfzrps
                        }}</span>
                        <el-form-item v-else label="审核人:" prop="dwfzrps">
                          <el-input
                            :disabled="
                              $route.query.detail == 0 ||
                              ($route.query.detail == 1 &&
                                $route.query.shzt !== '10')
                            "
                            class="inputwidth"
                            v-model="detailData.dwfzrps"
                          ></el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="11">
                        <span
                          class="songFont"
                          style="display: inline-block; width: 160px"
                          v-if="cFlag"
                          >日期:</span
                        >
                        <span class="songFont" v-if="cFlag">{{
                          detailData.dwfzrpssj
                        }}</span>
                        <el-form-item v-else label="日期:" prop="dwfzrpssj">
                          <el-date-picker
                            v-model="detailData.dwfzrpssj"
                            :disabled="
                              $route.query.detail == 0 ||
                              ($route.query.detail == 1 &&
                                $route.query.shzt !== '10')
                            "
                            class="inputwidth"
                            type="date"
                            placeholder="请选择"
                            value-format="yyyy-MM-dd"
                          ></el-date-picker>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </el-row>
                </td>
              </tr>
            </table>
          </el-form>
        </el-row>
    </el-row>

    <!-- <sealDialog
      ref="sealDialog"
      sealId="adjustingMonth"
      @sealTodo="sealTodo"
      @sealError="sealError"
    ></sealDialog> -->
    <span class="detail-footer">
      <el-button
        v-if="downTzFlag"
        type="primary"
        size="small"
        @click="signData"
        class="iconfont iconqianzhang"
        >盖章</el-button
      >
      <el-button
        v-if="downTzFlag"
        type="primary"
        size="small"
        @click="reject"
        class="iconfont iconbohui"
        >驳回</el-button
      >
      <el-button
        v-if="!detailF"
        type="primary"
        size="small"
        class="iconfont icontijiao"
        @click="saveChange()"
        >审批</el-button
      >
      <el-button
        v-if="$route.query.state == 'export'"
        type="primary"
        size="small"
        class="iconfont icondaochu11"
        @click="exportTable"
        >导出</el-button
      >
      <el-button
        type="primary"
        size="small"
        class="iconfont iconfanhui"
        @click="returnList"
        >返回</el-button
      >
    </span>
  </div>
</template>
<script>
import { queryDetail, getPzOptions, update } from "@/api/reverseSubsidy/index";
import { getNowDate } from "@/utils/index";

// import sealDialog from "@/components/sealDialog/index.vue";
import htmlToPdf from "@/utils/htmlToPdf";

export default {
  // components: {
  //   sealDialog,
  // },
  data() {
    return {
      cFlag: false,
      detailData: {
        tjmxs: [],
      },
      rules: {
        qtzcsl: [
          {
            required: true,
            trigger: "blur",
            message: "请输入",
            type: "number",
          },
          {
            validator: {
              pattern: /^[0-9]\d{0,10}(\.\d{1,3})?$/,
              message: "请输入数字,保留三位小数",
            },
            trigger: "blur",
          },
        ],
        qtsrsl: [
          {
            required: true,
            trigger: "blur",
            message: "请输入",
            type: "number",
          },
          {
            validator: {
              pattern: /^[0-9]\d{0,10}(\.\d{1,3})?$/,
              message: "请输入数字,保留三位小数",
            },
            trigger: "blur",
          },
        ],
        qyfzr11: {
          required: true,
          trigger: "blur",
          message: "请输入单位负责人",
        },
      },
      detailF: false,
      downTzFlag: false,
    };
  },
  created() {
    if (this.$route.query.state == "seal") {
      this.detailF = true; //禁用内容
      this.downTzFlag = true; //签章
      this.getDetail();
    } else if (
      this.$route.query.state == "detail" ||
      this.$route.query.state == "export"
    ) {
      this.detailF = true; //禁用内容
      this.downTzFlag = false; //签章
        this.cFlag = true;
      this.getDetail();
    } else if (this.$route.query.state == "edit") {
      this.detailF = false; //禁用内容
      this.downTzFlag = false; //签章
        this.cFlag = false;
      this.getDetail();
    }
    // console.log(this.$route.query,"$route.query.shzt");
  },
  methods: {
    exportTable() {
      let _this = this;
      setTimeout(function () {
        htmlToPdf.downloadPDF(
          document.querySelector("#tjcbData"),
          "市级储备粮实际库存管理平衡表.pdf",
          1,
          "1550px"
        );
      }, 100);
    },
    getDetail() {
      queryDetail(this.$route.query.dcyksqbm).then((res) => {
        if (res.infoCode == "200") {
          this.detailData = res.data;
          this.detailData.tjmxs = res.data.dcykbtmxDOList;
            
          if (this.detailData.sqgz) {
            if (this.detailData.sqgz.indexOf("newSeal") == -1) {
              this.$nextTick(() => {
                this.$ShowSeal("adjustingMonth", 1);
                this.$SetSealData(this.detailData.sqgz, 0, "lingdao", 1);
              });
            } else {
              this.$nextTick(() => {
                this.$signatureOnload(
                  "adjustingMonth",
                  this.detailData.sqgz.substring(7)
                );
              });
            }
          }
          if (this.$route.query.detail == 1) {
            switch (this.$route.query.shzt) {
              case "4":
                this.$set(
                  this.detailData,
                  "spzb",
                  sessionStorage.getItem("userName")
                );
                this.$set(this.detailData, "spzbrspsj", getNowDate());
                this.$set(this.detailData, "spzbspjg", "1");
                break;
              case "6":
                this.$set(
                  this.detailData,
                  "spfh",
                  sessionStorage.getItem("userName")
                );
                this.$set(this.detailData, "spfhrspsj", getNowDate());
                this.$set(this.detailData, "spfhspjg", "1");
                break;
              case "8":
                this.$set(
                  this.detailData,
                  "cwldps",
                  sessionStorage.getItem("userName")
                );
                this.$set(this.detailData, "cwldpssj", getNowDate());
                this.$set(this.detailData, "cwldpspjg", "1");
                break;
              case "10":
                this.$set(
                  this.detailData,
                  "dwfzrps",
                  sessionStorage.getItem("userName")
                );
                this.$set(this.detailData, "dwfzrpssj", getNowDate());
                this.$set(this.detailData, "dwfzrpspjg", "1");
                break;
            }
          }
        }
      });
    },
    //驳回
    reject() {
      this.$confirm("是否确认驳回？", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.doRejectTodo();
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消驳回",
          });
        });
    },
    doRejectTodo() {
      this.downTzFlag = false;
      let data = {
        ...this.detailData,
        shzt: "0",
      };
      update(data)
        .then((res) => {
          if (res.infoCode == "200") {
            this.$message({
              message: "驳回成功",
              type: "success",
            });
            this.returnList();
          } else {
            this.$message({
              message: "驳回失败",
              type: "error",
            });
            this.downTzFlag = true;
          }
        })
        .catch((res) => {
          this.$message({
            message: res.msg,
            type: "error",
          });
          this.downTzFlag = true;
        });
    },
    returnList() {
        this.$router.push({
          name: "reverseSubsidyIndex",
          query: {
            active: "yk" 
          },
        });
    },
    saveChange() {
      this.$refs.shForm.validate((valid) => {
        if (valid) {
          this.$confirm("是否确认提交？", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning",
          })
            .then(() => {
              this.definiteInfoTodo();
            })
            .catch(() => {
              this.$message({
                type: "info",
                message: "已取消提交",
              });
            });
        } else {
          this.$message({
            message: "请先填写必填项",
            type: "warning",
          });
        }
      });
    },
    // 审批
    definiteInfoTodo() {
      let data = {
        ...this.detailData,
      };
      if (
        this.$route.query.shzt == "4" ||
        this.$route.query.shzt == "7"
      ) {
        data.shrq = data.spzbrspsj
        if (data.spzbspjg == "1") {
          data.shzt = "6";
        } else if (data.spzbspjg == "0") {
          data.shzt = "5";
        }
      } else if (
        this.$route.query.shzt == "6" ||
        this.$route.query.shzt == "9"
      ) {
        data.shrq = data.spfhrspsj
        if (data.spfhspjg == "1") {
          data.shzt = "8";
        } else if (data.spfhspjg == "0") {
          data.shzt = "7";
        }
      } else if (
        this.$route.query.shzt == "8" ||
        this.$route.query.shzt == "13" ||
        this.$route.query.shzt == "11"
      ) {
        data.shrq = data.cwldpssj
        if (data.cwldpspjg == "1") {
          data.shzt = "10";
        } else if (data.cwldpspjg == "0") {
          data.shzt = "9";
        }
      } else if (
        this.$route.query.shzt == "10"
      ) {
        data.shrq = data.dwfzrpssj
        if (data.dwfzrpspjg == "1") {
          data.shzt = "12";
        } else if (data.dwfzrpspjg == "0") {
          data.shzt = "11";
        }
      }
      update(data).then((res) => {
        if (res.infoCode == "200") {
          this.$message({
            message: "审批成功",
            type: "success",
          });
          this.returnList();
        } else {
          this.$message({ type: "error", message: res.msg });
        }
      });
    },
  },
};
</script>
<style scoped lang="scss">
.titles {
  width: 100%;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  margin: 10px 0;
  /* margin-bottom: 50px; */
}
.titlesMor {
  font-size: 16px;
  margin-left: 10px;
  margin-bottom: 50px;
}
.inputWid {
  width: 80%;
}
.inputWidBz {
  width: 94.5%;
}
#tjcbData {
  padding: 20px 50px;
  font-size: 18px;
}
.table-a {
  width: 100%;
  border-collapse: collapse;
  //   height: 100px;
  // background-color: #000;
  border: 1px solid #00000086;
  text-align: left;
  border-top: 0;
  border-left: 1px solid #00000086;
  // border-right: 1px solid #000;
  // border-bottom: 1px solid #000;
  td {
    // width: 320px;
    // height: 50px;
    padding: 10px;
    border: 1px solid #00000086;
    // border-top: 0;
    // border-left: 1px solid #000;
    // border-top: 1px solid #000;
    font-size: 14px;
  }
  .inputwidth {
    width: 90%;
  }
}
</style>
<style>
#adjustingMonth {
  position: relative;
}

#adjustingMonth > div {
  top: -30px !important;
  left: 115px !important;
}
</style>
