税务申请

<template>

  <div>

    <el-form :inline="false" :model="form" ref="riskform" class="condition" label-width="95px">

      <el-row :gutter="0">

        <el-col :span="6">

          <el-form-item label="税务组织" required>

            <tax-org :getOrgParams="getOrgParams" @select="handleSelect" ref="taxOrg"></tax-org>

          </el-form-item>

        </el-col>

        <el-col :span="8">

          <el-form-item label="展示期间">

            <el-col :span="6">

              <el-select v-model="form.dataType" size="small" placeholder="请选择">

                <el-option label="月" value="M"></el-option>

                <el-option label="季" value="Q"></el-option>

              </el-select>

            </el-col>

            <el-col :span="8">

              <!-- 月份 -->

              <template v-if="this.form.dataType ==='M'">

                <i-date

                  type="month"

                  v-model="form.region"

                  placeholder="请选择"

                  :editable="false"

                  size="small"

                  :clearable="false"

                  class="date-common"

                  format="yyyyMM"

                ></i-date>

              </template>

              <!-- 季度 -->

              <template v-else-if="this.form.dataType ==='Q'">

                <i-date

                  type="quarter"

                  v-model="form.region"

                  placeholder="请选择"

                  :editable="false"

                  size="small"

                  :clearable="false"

                  :picker-options="pickerOptionsStartQH"

                  class="date-common"

                ></i-date>

              </template>

            </el-col>

          </el-form-item>

        </el-col>

        <el-col :span="5">

          <el-form-item label="状态">

            <el-select v-model="form.status" size="small" placeholder="请选择">

              <el-option

                :label="item.itemName"

                v-for="item in applyStatusOption"

                :key="item.itemCode"

                :value="item.itemCode"

              ></el-option>

            </el-select>

          </el-form-item>

        </el-col>

        <el-col :span="5">

          <el-form-item>

            <el-button type="primary" size="small" @click="searchListData">查询</el-button>

            <el-button size="small" @click="resetForm()">重置</el-button>

          </el-form-item>

        </el-col>

      </el-row>

      <!-- <el-row :gutter="0">

        <el-col :span="24" class="opreate">

          <el-form-item style="margin-left: 66%;">

            <el-button size="small" @click="resetForm()">重置</el-button>

            <el-button type="primary" size="small" @click="searchListData">查询</el-button>

          </el-form-item>

        </el-col>

      </el-row>-->

    </el-form>

    <div class="tool">

      <div

        class="btn_add"

        v-bind:class="{ notclick: !this.disjunctor}"

        style="width:120px"

        @click="newAddApply"

      >

        <i></i>

        <span>新增申请</span>

        <b></b>

      </div>

      <div style="width:20px">

        <i></i>

        <b></b>

      </div>

      <div class="btn_xiazai" @click="downModel" style="width:80px">

        <i></i>

        <span>下载模板</span>

        <b></b>

      </div>

    </div>

    <div class="table-area">

      <itax-table

        :data="listData"

        class="my-table"

        height="0"

        border

        highlight-current-row

        @row-click="detailListData"

        style="width: 100%;min-height:340px;height:100%"

      >

        <itax-table-column label="序号" align="center" type="index" min-width="35">

          <template scope="scope">{{(scope.$index+1)+(currentPage-1)*pageSize }}</template>

        </itax-table-column>

        <itax-table-column

          prop="applyNum"

          header-align="center"

          label="申请号"

          align="center"

          min-width="60"

        ></itax-table-column>

        <itax-table-column prop="orgName" align="center" label="税务组织" min-width="60"></itax-table-column>

        <itax-table-column

          prop="dataType"

          header-align="center"

          label="数据类别"

          align="center"

          min-width="50"

          :formatter="formatDataType"

        ></itax-table-column>

        <itax-table-column

          prop="region"

          header-align="center"

          label="所属期间"

          align="center"

          min-width="50"

        >

          <template scope="scope">

            <span>{{scope.row.region.slice(0,4)}}{{scope.row.region.slice(5)}}</span>

          </template>

        </itax-table-column>

        <itax-table-column

          prop="fileName"

          header-align="center"

          label="附件"

          align="center"

          min-width="60"

        >

          <template scope="scope">

            <itax-tag

              class="tag"

              v-for="tag in scope.row.attachList"

              :key="tag.attachName"

              type="primary"

              @click="download(tag)"

            >

              {{tag.attachName}}

              <span title="下载" class="dl-sp" @click.stop="download(tag)"></span>

            </itax-tag>

          </template>

        </itax-table-column>

        <itax-table-column

          prop="status"

          header-align="center"

          label="状态"

          align="center"

          min-width="60"

          :formatter="formatStatus"

        ></itax-table-column>

        <itax-table-column

          prop="updatedBy"

          header-align="center"

          label="操作人员"

          align="center"

          min-width="50"

        ></itax-table-column>

        <itax-table-column

          prop="updatedDate"

          header-align="center"

          label="操作时间"

          align="center"

          min-width="80"

        ></itax-table-column>

        <itax-table-column header-align="center" label="操作" align="left" min-width="150">

          <template scope="scope">

            <el-button

              size="mini"

              type="primary"

              @click="AmendData(scope.row)"

              :disabled="scope.row.status !== 'UNCOMMITTED'"

              v-if="scope.row.status !== 'APPROVEING'||scope.row.status !== 'APPPASS'||scope.row.status !== 'UNAPPPASS'"

            >修改</el-button>

            <el-button

              size="mini"

              type="primary"

              @click.stop="submitData(scope.row)"

              :disabled="scope.row.status !== 'UNCOMMITTED'"

            >提交</el-button>

            <el-button

              size="mini"

              type="primary"

              @click.stop="checkOutData(scope.row)"

              :disabled="scope.row.status !== 'APPROVEING'"

            >撤回</el-button>

            <el-button

              size="mini"

              type="primary"

              @click.stop="deleteData(scope.row)"

              :disabled="scope.row.status !== 'UNCOMMITTED'"

            >删除</el-button>

            <a

              @click.stop="approvalDetailWay(scope.row)"

              v-if="scope.row.status === 'APPROVEING'||scope.row.status === 'APPPASS'||scope.row.status === 'UNAPPPASS'"

            >

              <u style="color:#ff7000; cursor:pointer">审批详情</u>

            </a>

          </template>

        </itax-table-column>

      </itax-table>

      <div class="page">

        <el-pagination

          class="fr"

          v-show="pageData.total>10"

          @size-change="handleSizeChange"

          @current-change="handleCurrentChange"

          :current-page="currentPage"

          :page-sizes="pageArr"

          :page-size="pageSize"

          layout="total, sizes, prev, pager, next ,jumper"

          :total="pageData.total"

        ></el-pagination>

      </div>

    </div>

    <div class="table-title">

      <span>数据详情</span>

      <span>指标单元:元</span>

    </div>

    <div class="table-area">

      <itax-table

        :data="detailList"

        class="my-table"

        height="0"

        border

        highlight-current-row

        style="width: 100%;min-height:340px"

      >

        <itax-table-column label="序号" align="center" type="index" min-width="35">

          <template scope="scope">{{(scope.$index+1)+(detailCurrentPage-1)*detailPageSize }}</template>

        </itax-table-column>

        <itax-table-column

          prop="target"

          header-align="center"

          label="指标名称"

          align="center"

          min-width="60"

        ></itax-table-column>

        <itax-table-column

          prop="dataType"

          header-align="center"

          label="所属期间"

          align="center"

          min-width="90"

        ></itax-table-column>

        <itax-table-column

          prop="partyAmount"

          header-align="center"

          label="当期数"

          align="center"

          min-width="90"

        ></itax-table-column>

        <itax-table-column

          prop="yearSum"

          header-align="center"

          label="年累计"

          align="center"

          min-width="90"

        ></itax-table-column>

      </itax-table>

      <div class="page">

        <el-pagination

          class="fr"

          v-show="detailPageData.total>10"

          @size-change="detailHandleSizeChange"

          @current-change="detailHandleCurrentChange"

          :current-page="detailCurrentPage"

          :page-sizes="detailPageArr"

          :page-size="detailPageSize"

          layout="total, sizes, prev, pager, next,jumper"

          :total="detailPageData.total"

        ></el-pagination>

      </div>

      <!-- 新增申请 -->

      <el-dialog title="新增申请" :visible.sync="dialogFormVisible" custom-class="apply-box">

        <el-form :model="addAmendForm" ref="ruleForm">

          <el-form-item label="申请号" prop="applyNum" required :label-width="formLabelWidth">

            <el-input

              v-model="addAmendForm.applyNum"

              autocomplete="off"

              class="common-sty"

              :disabled="true"

            ></el-input>

          </el-form-item>

          <el-form-item label="税务组织" prop="orgId" required :label-width="formLabelWidth">

            <tax-org

              :getOrgParams="getOrgParams"

              @select="handleSelect"

              size="medium"

              class="common-sty"

            ></tax-org>

          </el-form-item>

          <el-form-item label="数据类别" required :label-width="formLabelWidth">

            <el-radio-group v-model="addAmendForm.dataType" @change="typeToggle">

              <el-radio label="CURRENT" :disabled="this.currentIsAllow">当期</el-radio>

              <el-radio label="HISTORY" :disabled="this.historyIsAllow">历史</el-radio>

            </el-radio-group>

          </el-form-item>

          <el-form-item label="所属期间" required :label-width="formLabelWidth">

            <el-input

              v-model="addAmendForm.region"

              autocomplete="off"

              class="common-sty"

              :disabled="true"

            ></el-input>

          </el-form-item>

          <el-form-item label="附件" prop="fileName" required :label-width="formLabelWidth">

            <el-col :span="13">

              <!-- <el-input v-model="addAmendForm.fileName" autocomplete="off" id="filename-box"></el-input> -->

              <div id="filename-box">

                <itax-tag

                  class="tag"

                  v-for="tag in this.addAmendForm.attachList"

                  :key="tag.attachName"

                  type="primary"

                  @click="download(tag)"

                >

                  {{tag.attachName}}

                  <span title="下载" class="dl-sp" @click.stop="download(tag)"></span>

                </itax-tag>

              </div>

            </el-col>

            <el-col :span="11">

              <el-button @click.prevent="uploadFile" class="upload-btn" type="primary">上传</el-button>

              <input type="file" style="width:0px;height:0px;" class="file-scan">

              <el-button type="primary" @click="downModel">下载模板</el-button>

            </el-col>

          </el-form-item>

          <el-form-item label="状态" prop="status" :label-width="formLabelWidth">

            <el-input

              v-model="addAmendForm.status"

              autocomplete="off"

              class="common-sty"

              :disabled="true"

            ></el-input>

          </el-form-item>

        </el-form>

        <div slot="footer" class="dialog-footer" style="text-align: center">

          <el-button type="primary" @click="addPreserve('save')">保存</el-button>

          <el-button type="primary" @click="addPreserve('saveAndSubmit')">保存并提交</el-button>

          <el-button @click="dialogFormVisible = false">取 消</el-button>

        </div>

      </el-dialog>

      <!-- 修改申请 -->

      <el-dialog title="修改申请" :visible.sync="amenddialogFormVisible" custom-class="apply-box">

        <el-form :model="addAmendForm" :rules="rules" ref="ruleForm">

          <el-form-item label="申请号" prop="applyNum" required :label-width="formLabelWidth">

            <el-input

              v-model="addAmendForm.applyNum"

              autocomplete="off"

              class="common-sty"

              :disabled="true"

            ></el-input>

          </el-form-item>

          <el-form-item label="税务组织" prop="orgId" required :label-width="formLabelWidth">

            <tax-org

              :getOrgParams="getOrgParams"

              @select="handleSelect"

              size="medium"

              class="common-sty"

            ></tax-org>

          </el-form-item>

          <el-form-item label="数据类别" required :label-width="formLabelWidth">

            <el-radio-group v-model="addAmendForm.dataType" @change="typeToggle">

              <el-radio label="CURRENT" :disabled="this.currentIsAllow">当期</el-radio>

              <el-radio label="HISTORY" :disabled="this.historyIsAllow">历史</el-radio>

            </el-radio-group>

          </el-form-item>

          <el-form-item label="所属期间" required :label-width="formLabelWidth">

            <el-input

              v-model="addAmendForm.region"

              autocomplete="off"

              class="common-sty"

              :disabled="true"

            ></el-input>

          </el-form-item>

          <el-form-item label="附件" prop="fileName" required :label-width="formLabelWidth">

            <el-col :span="13">

              <!-- <el-input v-model="addAmendForm.fileName" autocomplete="off" id="filename-box"></el-input> -->

              <div id="filename-box">

                <itax-tag

                  class="tag"

                  v-for="tag in this.addAmendForm.attachList"

                  :key="tag.attachName"

                  type="primary"

                  @click="download(tag)"

                >

                  {{tag.attachName}}

                  <span title="下载" class="dl-sp" @click.stop="download(tag)"></span>

                </itax-tag>

              </div>

            </el-col>

            <el-col :span="11">

              <el-button

                @click.prevent="uploadFile"

                class="upload-btn"

                type="primary"

                size="smaill"

              >上传</el-button>

              <input type="file" style="width:0px;height:0px;" class="file-scan">

              <el-button type="primary" @click="downModel">下载模板</el-button>

            </el-col>

          </el-form-item>

          <el-form-item label="状态" prop="status" required :label-width="formLabelWidth">

            <el-input

              v-model="addAmendForm.status"

              autocomplete="off"

              class="common-sty"

              :disabled="true"

            ></el-input>

          </el-form-item>

        </el-form>

        <div slot="footer" class="dialog-footer" style="text-align: center">

          <el-button type="primary" @click="alterPreserve('save')">保存</el-button>

          <el-button type="primary" @click="alterPreserve('saveAndsSubmit')">保存并提交</el-button>

          <el-button @click="amenddialogFormVisible = false">取 消</el-button>

        </div>

      </el-dialog>

      <!-- 确认删除对话框 -->

      <el-dialog

        title="提示"

        :visible.sync="deleteDialogVisible"

        width="30%"

        custom-class="delete-box"

        center

      >

        <div class="el-message-box__status el-icon-warning icon-box">

          <span class="confim-info">确认删除此条导入申请吗?</span>

        </div>

        <span slot="footer" class="dialog-footer">

          <el-button type="primary" @click.prevent="confirmDelete">确 定</el-button>

          <el-button @click="deleteDialogVisible = false">取 消</el-button>

        </span>

      </el-dialog>

      <web-uploader

        :upLoadFileUrl="uploadUrl"

        @attachAdds="attachAdds"

        :isMultiple="true"

        :correlation="false"

        v-if="isShowUpload"

        :modelClose="modelClose"

      />

    </div>

  </div>

</template>

<script>

import mock from "../mock/index2.js";

import {

  addData,

  delData,

  alterData,

  listData,

  disjunctor,

  recordSubmit,

  approvalDetail,

  dataDetail,

  applyDetail,

  templeName,

  getDict

} from "./tax-apply.js";

import taxOrg from "@/income-pro/common/taxorg/index";

import IDate from "../../common/date-picker/src/picker/date-picker";

// import orgSelect from "@/income-pro/common/orgSelect/index.vue";

import webUploader from "@/income-pro/common/web-uploader/index.vue";

import mixin from "@/income-pro/common/web-uploader/data.vue"; //混合导入公共的下载方法。

export default {

  mixins: [mixin],

  components: { taxOrg, webUploader, IDate },

  data() {

    return {

      pickerOptionsStartM: {

        // disabledDate: date => {

        //  if (!date.getMonth) debugger;

        //  return typeof date === "number" || date.getMonth();

        // }

      },

      pickerOptionsStartQH: {},

      getOrgParams: {

        permissionType: "MENU",

        keyWord: "",

        permissionCode: "MU-INS-TASK-MAG",

        scope: "SELF",

        orgTypes: "",

        containVirtualFlag: ""

      },

      form: {

        orgId: "",

        dataType: "M",

        region: "",

        status: ""

      },

      addAmendForm: {

        applyNum: "",

        orgId: "",

        dataType: "CURRENT",

        region: "",

        attachList: [],

        fileName: "",

        status: ""

      },

      disjunctor: false, //默认申请开关的状态为关闭。

      currentIsAllow: true, //当期类型是否允许。

      historyIsAllow: true, //历史类型是否允许。

      templeName: "", //下载的模板名。

      applyStatusOption: [],

      rules: {

        orgId: [{ required: true, message: "请输入组织名称", trigger: "blur" }],

        riskkind: [

          { required: true, message: "请选择风险分类", trigger: "change" }

        ]

      },

      listData: [],

      detailList: [],

      taskInfo: [],

      orgId: "",

      orgType: "",

      rowId: "",

      isShowUpload: false,

      pageArr: [10, 20, 40, 100],

      defaultPageSize: 0,

      currentPage: 1,

      pageSize: 20,

      pageData: {},

      detailPageArr: [10, 20, 40, 100], //详细分页的数据

      detailDefaultPageSize: 0,

      detailCurrentPage: 1,

      detailPageSize: 10,

      detailPageData: {},

      dialogFormVisible: false,

      amenddialogFormVisible: false,

      deleteDialogVisible: false, //删除对话

      formLabelWidth: "80px"

    };

  },

  computed: {

    uploadUrl() {

      return serverIpAddress + "/zuul/itax-core-base/uploadIobs";

    }

  },

  methods: {

    //下载模板

    async downModel() {

      console.log("下载模板!");

      let params = {

        orgId: this.orgId

      };

      try {

        const data = await templeName(params);

        if (data.responseCode === "0") {

          let temName = data.result.name; //因为异步了,而下载需要在获取名字后,所有需要把下载的数据写在回调中。达到同步的效果。

          let url =

            (process.env.NODE_ENV !== "development" ? "/itax" : "") +

            "/static/template/税负数据_导入模板_" +

            temName +

            ".xlsx";

          var _a = document.createElement("a");

          _a.href = url;

          $("body").append(_a);

          _a.click();

          $(_a).remove();

        }

      } catch (err) {

        console.log(err);

      }

    },

    //数据详情

    async detailListData(row) {

      console.log(row);

      this.rowId = row.id;

      let params = {

        id: this.rowId,

        currentPage: this.detailCurrentPage,

        pageSize: this.detailPageSize

      };

      try {

        const data = await dataDetail(params);

        if (data.responseCode === "0") {

          this.detailList = data.result;

          this.detailPageData = data.page;

        }

      } catch (err) {

        console.log(err);

      }

    },

    //分页查询数据详情

    async pageDetailList() {

      let params = {

        id: this.rowId,

        currentPage: this.detailCurrentPage,

        pageSize: this.detailPageSize

      };

      try {

        const data = await dataDetail(params);

        if (data.responseCode === "0") {

          this.detailList = data.result;

          this.detailPageData = data.page;

        }

      } catch (err) {

        console.log(err);

      }

    },

    //获取申请开关的状态。

    async getDisjunctorStatus() {

      let params = {

        orgId: this.orgId,

        region: this.form.region

      };

      try {

        const data = await disjunctor(params);

        if (data.responseCode === "0") {

          if (data.result.disjunctor === "off") {

            this.disjunctor = false;

          } else {

            this.disjunctor = true;

            let allowType = data.result.dataType;

            if (allowType.includes("CURRENT")) {

              this.currentIsAllow = false;

            } else {

              this.currentIsAllow = true; //不包含,开启禁用。

            }

            if (allowType.includes("HISTORY")) {

              this.historyIsAllow = false;

            } else {

              this.historyIsAllow = true; //不包含,开启禁用。

            }

            // debugger;

          }

        }

      } catch (err) {

        console.log(err);

      }

    },

    //新增保存或保存并提交按钮

    async addPreserve(val) {

      if (typeof this.orgId !== "number") {

        this.notify("请选择被税务组织名称!", "warning");

        return;

      }

      if (

        this.addAmendForm.attachList.length == 0

      ) {

        this.notify("请选择上传附件!", "warning");

        return;

      }

      if (val == "save") { //这里应该用一个局域变量吗?

        this.addAmendForm.status = 'UNCOMMITTED'

      } else {

        this.addAmendForm.status = 'APPROVEING'

      }

      let params = {

        applyNum: this.addAmendForm.applyNum,

        orgId: this.orgId,

        dataType: this.addAmendForm.dataType,

        region:

          this.addAmendForm.region.slice(0, 4) +

          "-" +

          this.addAmendForm.region.slice(4),

        attachList: this.addAmendForm.attachList,

        status: this.addAmendForm.status,

        operation: val

      };

      try {

        const data = await addData(params);

        if (data.responseCode === "0") {

          this.dialogFormVisible = false;

          this.notify("保存成功!", "success");

          if (val == "save") {

            this.getListData();

          } else {

            let params = {

              id: this.addAmendForm.applyNum, //这是是申请号id。

              operation: val,

              orgId: this.orgId,

              orgType: this.orgType,

              permissionCode: "FN_ANALYSIS_TAXDATA_SUB",

              scope: "self"

            };

            this.$router.push({

              path: "/intelligent-analysis/tax-eoa",

              query: params

            });

          }

          // this.getListData();

        }

      } catch (err) {

        console.log(err);

      }

    },

    //删除申请

    deleteData(row) {

      this.deleteDialogVisible = true;

      this.rowId = row.id;

    },

    //删除对话框的确认按钮

    async confirmDelete() {

      let params = { id: this.rowId };

      try {

        const data = await delData(params);

        if (data.responseCode === "0") {

          this.deleteDialogVisible = false;

          this.notify("操作成功!", "success");

          this.getListData();

        }

      } catch (err) {

        console.log(err);

      }

    },

    //修改申请

    AmendData(row) {

      console.log(row);

      this.amenddialogFormVisible = true;

      this.addAmendForm.applyNum = row.applyNum;

      this.orgId = row.orgId;

      this.addAmendForm.dataType = row.dataType;

      this.addAmendForm.region = row.region.slice(0, 4) + row.region.slice(5);

      this.addAmendForm.attachList = row.attachList;

      this.rowId = row.id;

      this.addAmendForm.status = "";

      debugger

    },

    //修改申请的保存或保存并提交按钮

    async alterPreserve(val) {

      if (typeof this.orgId !== "number") {

        this.notify("请选择被税务组织名称!", "warning");

        return;

      }

      if (

        this.addAmendForm.attachList == []

      ) {

        this.notify("请选择上传附件!", "warning");

        return;

      }

      if (val == "save") {

        this.addAmendForm.status = 'UNCOMMITTED'

      } else {

        this.addAmendForm.status = 'APPROVEING'

      }

      let params = {

        id: this.rowId,

        applyNum: this.addAmendForm.applyNum,

        orgId: this.orgId,

        dataType: this.addAmendForm.dataType,

        region:

          this.addAmendForm.region.slice(0, 4) +

          "-" +

          this.addAmendForm.region.slice(4),

        attachList: this.addAmendForm.attachList,

        status: this.addAmendForm.status,

        operation: val

      };

      try {

        const data = await alterData(params);

        if (data.responseCode === "0") {

          this.amenddialogFormVisible = false;

          this.notify("保存成功!", "success");

          if (val == "save") {

            this.getListData();

          } else {

            //如点击的是保存并提交按钮需要发送eoa。

            let params = {

              id: this.addAmendForm.applyNum, //这是是申请号id。

              operation: val,

              orgId: this.orgId,

              orgType: this.orgType,

              permissionCode: "FN_ANALYSIS_TAXDATA_SUB",

              scope: "self"

            };

            this.$router.push({

              path: "/intelligent-analysis/tax-eoa",

              query: params

            });

          }

          // this.getListData();

        }

      } catch (err) {

        console.log(err);

      }

    },

    //提交

    submitData(row) {

      let params = {

        id: row.applyNum, //这是是申请号id。

        operation: "submit", //这里到时候再看看!

        orgId: row.orgId,

        orgType: this.orgType,

        permissionCode: "FN_ANALYSIS_TAXDATA_SUB",

        scope: "self"

      };

      this.$router.push({

        path: "/intelligent-analysis/tax-eoa",

        query: params

      });

    },

    //撤回

    async checkOutData(row) {

      let params = {

        id: row.applyNum, //这是是申请号id。

        operation: "cancle", //

        orgId: row.orgId,

        orgType: this.orgType,

        permissionCode: "FN_ANALYSIS_TAXDATA_REM",

        scope: "self"

      };

      this.$router.push({

        path: "/intelligent-analysis/tax-eoa",

        query: params

      });

    },

    //审批详情

    async approvalDetailWay(row) {

      console.log("审批详情。");

      let params = { eoaRequestId: '' };

      try {

        const data = await approvalDetail(params);

        if (data.responseCode === "0") {

          this.notify("操作成功!", "success");

        }

      } catch (err) {

        console.log(err);

      }

    },

    typeToggle() {

      switch (this.addAmendForm.dataType) {

        case "CURRENT":

          this.orgId !== 291295

            ? (this.addAmendForm.region = this.getPreMonth())

            : (this.addAmendForm.region = this.getPreQuarter()); //待改判断条件。

          break;

        case "HISTORY":

          this.addAmendForm.region = "201906";

          break;

      }

    },

    modelClose() {

      this.isShowUpload = false;

    },

    attachAdds(value) {

      let arr = [];

      var finalArrBe = this.addAmendForm.attachList;

      var str = JSON.stringify(finalArrBe);

      for (let i in value) {

        var obj = {

          attachName: value[i].attachName,

          attachCode: value[i].attachCode,

          attachId: value[i].attachId

        };

        var flag = str.indexOf(obj.attachCode) === -1; //判断是否已经存在这个文件。不存在可以添加。

        if (flag) {

          arr = arr.concat(obj);

        }

      }

      this.addAmendForm.attachList = arr; //由于只允许上传一个文件,所有直接赋值。

      // this.addAmendForm.fileName = value[value.length - 1].attachName; //把最后的一个文件名赋值到附件框中。

    },

    handleSelect(node) {

      // if (node.permissions) {

      //  this.powerInfo = JSON.parse(JSON.stringify(node.permissions));

      // }

      this.orgId = node.orgId;

      this.orgType = node.orgType; //获取组织类型。

      this.addAmendForm.orgId = node.orgId;

      this.getListData();

      this.getDisjunctorStatus(); //修改开关的方法。

      // this.getTemName()

    },

    //获取上一个月 不带横杆

    getPreMonth() {

      let year = new Date().format("yyyy");

      let month = new Date().getMonth() + 1;

      if (month == 1) {

        month = 12;

        year = year - 1;

      } else if (2 <= month <= 10) {

        month = month - 1; //上一个月

        month = "0" + month; //月份填补成2位。

      } else {

        month = month - 1; //上一个月

      }

      return year + "" + month;

      debugger;

    },

    //获取上一个月 带横杆

    getPreMonthH() {

      let year = new Date().format("yyyy");

      let month = new Date().getMonth() + 1;

      if (month == 1) {

        month = 12;

        year = year - 1;

      } else if (2 <= month <= 10) {

        month = month - 1; //上一个月

        month = "0" + month; //月份填补成2位。

      } else {

        month = month - 1; //上一个月

      }

      return year + "-" + month;

    },

    //获取上一个季度

    getPreQuarter() {

      let year = new Date().format("yyyy");

      let month = new Date().getMonth() + 1;

      let quarter = "";

      if (month >= 1 && month <= 3) {

        year = year - 1;

        quarter = "Q4";

      } else if (month >= 4 && month <= 6) {

        quarter = "Q1";

      } else if (month >= 7 && month <= 9) {

        quarter = "Q2";

      } else {

        quarter = "Q3";

      }

      return year + "" + quarter;

    },

    searchListData() {

      if (typeof this.orgId !== "number") {

        this.notify("请选择被税务组织名称!", "warning");

        return;

      }

      this.getListData();

    },

    downAttach(row) {

      console.log("下载附件!");

    },

    handleSizeChange(val) {

      this.pageSize = val;

      this.getListData();

    },

    handleCurrentChange(val) {

      this.currentPage = val;

      this.getListData();

    },

    detailHandleSizeChange(val) {

      this.detailPageSize = val;

      this.pageDetailList();

    },

    detailHandleCurrentChange(val) {

      this.detailCurrentPage = val;

      this.pageDetailList();

    },

    amendSubmitForm(formName) {

      this.$refs[formName].validate(valid => {

        if (valid) {

          alert("submit!");

          this.amenddialogFormVisible = false;

        } else {

          console.log("error submit!!");

          return false;

        }

      });

    },

    resetForm() {

      console.log("重置表单!");

      this.$refs.taxOrg.clearInfo();

      this.form = {

        dataType: "M",

        region: "",

        status: ""

      };

    },

    //查询税负申请记录。

    async getListData() {

      if (/^\d{4}-\d{2}$/.test(this.form.region)) {

        this.form.region = this.form.region;

      } else if (this.form.region == "") {

        this.form.region = "";

      } else {

        this.form.region = this.form.region.format("yyyy-MM");

      }

      let params = {

        orgId: this.orgId,

        region: this.form.region,

        status: this.form.status,

        currentPage: this.currentPage,

        pageSize: this.pageSize

      };

      try {

        const data = await listData(params);

        if (data.result) {

          this.listData = data.result;

          this.pageData = data.page;

        }

      } catch (err) {

        console.log(err);

      }

    },

    /* 获取申请状态方法 */

    async getApplyStatus() {

      let params = {

        dictCode: "APPLY_ITEM_STATUS"

      };

      const data = await getDict(params);

      if (data.responseCode === "0") {

        this.applyStatusOption = data.result;

      }

    },

    newAddApply() {

      this.dialogFormVisible = true;

      // this.$refs.taxOrg.clearInfo();

      this.addAmendForm.applyNum = new Date().format("yyyyMMddhhmmss");

      let period = this.orgId !== 291295

          ? (period = this.getPreMonth())

          : (period = this.getPreQuarter()); //只有平安银行才有季度。;

      this.addAmendForm.region = period;

      this.addAmendForm.attachList = []; //置空附件。

      this.addAmendForm.status = "";

    },

    uploadFile() {

      console.log("luoyong!!!");

      // let eleNav = document.getElementsByClassName("file-scan")[0];

      // eleNav.click();

      this.isShowUpload = true;

    },

    // fileScan() {

    //  console.log("scan!!!");

    //  let filePath = document.getElementsByClassName("file-scan")[0].value;

    //  let arr = filePath.split("\\");

    //  let fileName = arr[arr.length - 1];

    //  console.log(fileName);

    //  // document.getElementsByClassName('filename-box')[0].value ="reerer";

    //  this.addAmendForm.fileName = fileName;

    // },

    notify(msg, type) {

      var that = this;

      that.$message({

        duration: 2000,

        showClose: true,

        message: msg,

        type: type

      });

    },

    formatDataType: function(row, column) {

      switch (row.dataType) {

        case "CURRENT":

          return "当期";

          break;

        case "HISTORY":

          return "历史";

          break;

        default:

          break;

      }

    },

    formatStatus: function(row, column) {

      switch (row.status) {

        case "UNCOMMITTED":

          return "未提交审批";

          break;

        case "APPROVEING":

          return "审批中";

          break;

        case "APPPASS":

          return "审批通过";

          break;

        case "UNAPPPASS":

          return "审批不通过";

          break;

        default:

          break;

      }

    }

  },

  created() {

    // this.getDisjunctorStatus();

    this.form.region = this.getPreMonthH();

    this.getApplyStatus();

  }

};

</script>

<style lang='less'>

.condition {

  margin-top: 15px;

}

.common-sty {

  width: 58%;

}

.tool {

  width: 600px;

  height: 30px;

  margin-left: 20px;

  margin-bottom: 10px;

  display: flex;

  flex-direction: row;

  align-items: center;

  // .apply-button{

  //  display: inline-block;

  //  font-size: 14px;

  // }

}

.table-title {

  margin-top: 55px;

  // border: #ff7000 solid 1px;

  height: 30px;

  display: flex;

  flex-direction: row;

  align-items: center;

  span:first-child {

    height: 20px;

    font-size: 16px;

    color: #ff7000;

    font-weight: bold;

    margin-left: 10px;

  }

  span:last-child {

    height: 20px;

    font-size: 14px;

    line-height: 20px;

    color: #ff7000;

    font-weight: bold;

    margin-left: 80%;

  }

}

.upload-btn {

  margin-left: 23px;

}

.notclick {

  pointer-events: none;

}

//新增申请自定义类改变宽度。

.apply-box {

  width: 530px;

}

.delete-box {

  width: 420px;

  height: 174px;

  .el-dialog__footer {

    text-align: center;

    box-sizing: border-box;

    padding: 50px 20px 15px;

  }

}

.icon-box {

  display: flex;

  flex-direction: row;

  align-items: center;

  .confim-info {

    height: 20px;

    line-height: 20px;

    margin-left: 20px;

    font-size: 14px;

    color: #66666f;

    // border: 1px solid red;

  }

}

#filename-box {

  width: 238px;

  height: 38px;

  border: #e5dcd1 solid 1px;

  border-radius: 5px;

}

#filename-box:hover {

  border: #bbb solid 1px;

}

</style>

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 194,088评论 5 459
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 81,715评论 2 371
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 141,361评论 0 319
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 52,099评论 1 263
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 60,987评论 4 355
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 46,063评论 1 272
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 36,486评论 3 381
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 35,175评论 0 253
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 39,440评论 1 290
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 34,518评论 2 309
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 36,305评论 1 326
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 32,190评论 3 312
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 37,550评论 3 298
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 28,880评论 0 17
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 30,152评论 1 250
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 41,451评论 2 341
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 40,637评论 2 335

推荐阅读更多精彩内容