<template>
  <div class="app-container">
    <el-form
      :model="queryParams"
      ref="queryForm"
      size="small"
      :inline="true"
      v-show="showSearch"
      label-width="68px"
    >
      <!-- <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="['business:ECONOMICSINDEX: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="['business:ECONOMICSINDEX: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="['business:ECONOMICSINDEX: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="['business:ECONOMICSINDEX:export']"
          >导出</el-button
        >
      </el-col> -->
      <right-toolbar
        :showSearch.sync="showSearch"
        @queryTable="getList"
      ></right-toolbar>
    </el-row>

    <el-table
      :data="ECONOMICSINDEXList"
      @selection-change="handleSelectionChange"
    >
      <el-table-column type="selection" width="55" align="center" />
      <!-- <el-table-column
        label="综合保税区经济运行主要指标表主键"
        align="center"
        prop="id"
      >
      </el-table-column> -->
      <el-table-column label="进出口总值" align="center" prop="jckzz">
      </el-table-column>
      <el-table-column label="加工贸易进出口值 " align="center" prop="jgmyjckz">
      </el-table-column>
      <el-table-column label="物流货物进出口值 " align="center" prop="wlhwjckz">
      </el-table-column>
      <el-table-column label="一般贸易进出口值 " align="center" prop="ybmyjckz">
      </el-table-column>
      <el-table-column label="经营总收入 " align="center" prop="jyzsr">
      </el-table-column>
      <el-table-column label="海关税收 " align="center" prop="hgss">
      </el-table-column>
      <el-table-column label="税务部门税收 " align="center" prop="swbmss">
      </el-table-column>
      <el-table-column
        label="货物贸易涉外收支总额 "
        align="center"
        prop="hwmyswszze"
      >
      </el-table-column>
      <el-table-column label="期末企业从业人员 " align="center" prop="qmqycyry">
      </el-table-column>
      <el-table-column label="活跃企业数 " align="center" prop="hyqys">
      </el-table-column>
      <el-table-column label="单位面积进出口值 " align="center" prop="dwmjjckz">
      </el-table-column>
      <el-table-column
        label="单位面积经营总收入 "
        align="center"
        prop="dwmjjyzsr"
      >
      </el-table-column>
      <el-table-column label="单位面积海关税收 " align="center" prop="dwmjhgss">
      </el-table-column>
      <el-table-column
        label="单位面积税务部门税收 "
        align="center"
        prop="dwmjswbmss"
      >
      </el-table-column>
      <el-table-column
        label="单位面积货物贸易涉外收支额 "
        align="center"
        prop="dwmjhwmyswsze"
      >
      </el-table-column>
      <el-table-column
        label="期末单位面积企业从业人员 "
        align="center"
        prop="qmdwmjqycyry"
      >
      </el-table-column>
      <el-table-column label="进出口总值增幅 " align="center" prop="jckzzzf">
      </el-table-column>
      <el-table-column
        label="同期活跃企业数增幅 "
        align="center"
        prop="tqhyqyszf"
      >
      </el-table-column>
      <el-table-column
        label="期末批准规划面积验收率 "
        align="center"
        prop="qmpzghmjysl"
      >
      </el-table-column>
      <el-table-column
        label="期末封闭围网面积开发率 "
        align="center"
        prop="qmfbwwmjkfl"
      >
      </el-table-column>
      <el-table-column label="实际使用外资金额 " align="center" prop="sjsywzje">
      </el-table-column>
      <el-table-column label="进出区货物总值" align="center" prop="jcqhwzz">
      </el-table-column>
      <el-table-column
        label="进出口总值占其所在省"
        align="center"
        prop="jckzzzqszstqjckbz"
      >
      </el-table-column>
      <el-table-column label="维修业务进出口值 " align="center" prop="wxywjckz">
      </el-table-column>
      <el-table-column label="研发业务进出口值 " align="center" prop="yfywjckz">
      </el-table-column>
      <el-table-column label="租赁贸易进出口值 " align="center" prop="zlmyjckz">
      </el-table-column>
      <el-table-column
        label="跨境电商业务进出口值 "
        align="center"
        prop="kjdsywjckz"
      >
      </el-table-column>
      <el-table-column label="规模以上工业产值 " align="center" prop="gmysgycz">
      </el-table-column>
      <el-table-column label="固定资产投资 " align="center" prop="gdtzcz">
      </el-table-column>
      <el-table-column
        label="占同期所在市进出口值比重 "
        align="center"
        prop="ztqszsjckzbz"
      >
      </el-table-column>
      <el-table-column label="时间" align="center" prop="createTime">
      </el-table-column>
      <el-table-column
        fixed="right"
        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="['business:ECONOMICSINDEX:edit']"
            >修改</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['business:ECONOMICSINDEX: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"
    />

    <!-- 添加或修改综合保税区经济运行主要指标对话框 -->
    <el-dialog
      :title="title"
      :visible.sync="open"
      :close-on-click-modal="false"
      width="65%"
      append-to-body
    >
      <el-tabs v-model="tabMsg" type="border-card">
        <el-tab-pane name="basicMsg" label="基本信息">
          <el-form ref="forms" :model="form" :rules="rules" label-width="220px">
            <el-row>
              <el-col :span="12">
                <el-form-item label="进出口总值" prop="jckzz">
                  <el-input v-model="form.jckzz"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="加工贸易进出口值" prop="jgmyjckz">
                  <el-input v-model="form.jgmyjckz"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="物流货物进出口值" prop="wlhwjckz">
                  <el-input v-model="form.wlhwjckz"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="一般贸易进出口值" prop="ybmyjckz">
                  <el-input v-model="form.ybmyjckz"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="经营总收入 " prop="jyzsr">
                  <el-input v-model="form.jyzsr"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="海关税收 " prop="hgss">
                  <el-input v-model="form.hgss"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="税务部门税收 " prop="swbmss">
                  <el-input v-model="form.swbmss"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="货物贸易涉外收支总额 " prop="hwmyswszze">
                  <el-input v-model="form.hwmyswszze"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="期末企业从业人员 " prop="qmqycyry">
                  <el-input v-model="form.qmqycyry"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="活跃企业数 " prop="hyqys">
                  <el-input v-model="form.hyqys"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="单位面积进出口值 " prop="dwmjjckz">
                  <el-input v-model="form.dwmjjckz"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="单位面积经营总收入 " prop="dwmjjyzsr">
                  <el-input v-model="form.dwmjjyzsr"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="单位面积海关税收 " prop="dwmjhgss">
                  <el-input v-model="form.dwmjhgss"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="单位面积税务部门税收 " prop="dwmjswbmss">
                  <el-input v-model="form.dwmjswbmss"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item
                  label="单位面积货物贸易涉外收支额 "
                  prop="dwmjhwmyswsze"
                >
                  <el-input v-model="form.dwmjhwmyswsze"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item
                  label="期末单位面积企业从业人员 "
                  prop="qmdwmjqycyry"
                >
                  <el-input v-model="form.qmdwmjqycyry"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </el-tab-pane>
        <el-tab-pane name="extraMsg" label="额外信息">
          <el-form ref="form" :model="form" :rules="rules" label-width="220px">
            <el-row>
              <el-col :span="12">
                <el-form-item label="进出口总值增幅 " prop="jckzzzf">
                  <el-input v-model="form.jckzzzf"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="同期活跃企业数增幅 " prop="tqhyqyszf">
                  <el-input v-model="form.tqhyqyszf"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item
                  label="期末批准规划面积验收率  "
                  prop="qmpzghmjysl"
                >
                  <el-input v-model="form.qmpzghmjysl"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item
                  label="期末封闭围网面积开发率  "
                  prop="qmfbwwmjkfl"
                >
                  <el-input v-model="form.qmfbwwmjkfl"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="实际使用外资金额  " prop="sjsywzje">
                  <el-input v-model="form.sjsywzje"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="进出区货物总值 " prop="jcqhwzz">
                  <el-input v-model="form.jcqhwzz"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item
                  label="进出口总值占其所在省 "
                  prop="jckzzzqszstqjckbz"
                >
                  <el-input v-model="form.jckzzzqszstqjckbz"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="维修业务进出口值  " prop="wxywjckz">
                  <el-input v-model="form.wxywjckz"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="研发业务进出口值  " prop="yfywjckz">
                  <el-input v-model="form.yfywjckz"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="租赁贸易进出口值  " prop="zlmyjckz">
                  <el-input v-model="form.zlmyjckz"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="跨境电商业务进出口值  " prop="kjdsywjckz">
                  <el-input v-model="form.kjdsywjckz"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="规模以上工业产值  " prop="gmysgycz">
                  <el-input v-model="form.gmysgycz"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="固定资产投资  " prop="gdtzcz">
                  <el-input v-model="form.gdtzcz"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item
                  label="占同期所在市进出口值比重  "
                  prop="ztqszsjckzbz"
                >
                  <el-input v-model="form.ztqszsjckzbz"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </el-tab-pane>
      </el-tabs>

      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  listECONOMICSINDEX,
  getECONOMICSINDEX,
  delECONOMICSINDEX,
  addECONOMICSINDEX,
  updateECONOMICSINDEX,
} from "@/api/portal/ECONOMICSINDEX/ECONOMICSINDEX";

export default {
  name: "ECONOMICSINDEX",
  data() {
    return {
      tabMsg: "basicMsg",

      // 根路径
      baseURL: process.env.VUE_APP_BASE_API,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 综合保税区经济运行主要指标表格数据
      ECONOMICSINDEXList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        id: null,
        jckzz: null,
        jgmyjckz: null,
        wlhwjckz: null,
        ybmyjckz: null,
        jyzsr: null,
        hgss: null,
        swbmss: null,
        hwmyswszze: null,
        qmqycyry: null,
        hyqys: null,
        dwmjjckz: null,
        dwmjjyzsr: null,
        dwmjhgss: null,
        dwmjswbmss: null,
        dwmjhwmyswsze: null,
        qmdwmjqycyry: null,
        jckzzzf: null,
        tqhyqyszf: null,
        qmpzghmjysl: null,
        qmfbwwmjkfl: null,
        sjsywzje: null,
        jcqhwzz: null,
        jckzzzqszstqjckbz: null,
        wxywjckz: null,
        yfywjckz: null,
        zlmyjckz: null,
        kjdsywjckz: null,
        gmysgycz: null,
        gdtzcz: null,
        ztqszsjckzbz: null,
        createTime: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        jckzz: [
          { required: true, message: "进出口总值 不能为空", trigger: "blur" },
          {
            pattern: /^-?(([0-9]*(\.[0-9]{1,100})$)|([0-9]+$))/,
            message: "值需为数字或小数",
            trigger: "blur",
          },
        ],
        jgmyjckz: [
          {
            required: true,
            message: "加工贸易进出口值 不能为空",
            trigger: "blur",
          },
          {
            pattern: /^-?(([0-9]*(\.[0-9]{1,100})$)|([0-9]+$))/,
            message: "值需为数字或小数",
            trigger: "blur",
          },
        ],
        wlhwjckz: [
          {
            required: true,
            message: "物流货物进出口值 不能为空",
            trigger: "blur",
          },
          {
            pattern: /^-?(([0-9]*(\.[0-9]{1,3})$)|([0-9]+$))/,
            message: "值需为数字或小数",
            trigger: "blur",
          },
        ],
        ybmyjckz: [
          {
            required: true,
            message: "一般贸易进出口值 不能为空",
            trigger: "blur",
          },
          {
            pattern: /^-?(([0-9]*(\.[0-9]{1,3})$)|([0-9]+$))/,
            message: "值需为数字或小数",
            trigger: "blur",
          },
        ],
        jyzsr: [
          { required: true, message: "经营总收入 不能为空", trigger: "blur" },
          {
            pattern: /^-?(([0-9]*(\.[0-9]{1,3})$)|([0-9]+$))/,
            message: "值需为数字或小数",
            trigger: "blur",
          },
        ],
        hgss: [
          { required: true, message: "海关税收 不能为空", trigger: "blur" },
          {
            pattern: /^-?(([0-9]*(\.[0-9]{1,3})$)|([0-9]+$))/,
            message: "值需为数字或小数",
            trigger: "blur",
          },
        ],
        swbmss: [
          { required: true, message: "税务部门税收 不能为空", trigger: "blur" },
          {
            pattern: /^-?(([0-9]*(\.[0-9]{1,3})$)|([0-9]+$))/,
            message: "值需为数字或小数",
            trigger: "blur",
          },
        ],
        hwmyswszze: [
          {
            required: true,
            message: "货物贸易涉外收支总额 不能为空",
            trigger: "blur",
          },
          {
            pattern: /^-?(([0-9]*(\.[0-9]{1,3})$)|([0-9]+$))/,
            message: "值需为数字或小数",
            trigger: "blur",
          },
        ],
        qmqycyry: [
          {
            required: true,
            message: "期末企业从业人员 不能为空",
            trigger: "blur",
          },
          {
            pattern: /^-?(([0-9]*(\.[0-9]{1,3})$)|([0-9]+$))/,
            message: "值需为数字或小数",
            trigger: "blur",
          },
        ],
        hyqys: [
          { required: true, message: "活跃企业数 不能为空", trigger: "blur" },
          {
            pattern: /^-?(([0-9]*(\.[0-9]{1,3})$)|([0-9]+$))/,
            message: "值需为数字或小数",
            trigger: "blur",
          },
        ],
        dwmjjckz: [
          {
            required: true,
            message: "单位面积进出口值 不能为空",
            trigger: "blur",
          },
          {
            pattern: /^-?(([0-9]*(\.[0-9]{1,3})$)|([0-9]+$))/,
            message: "值需为数字或小数",
            trigger: "blur",
          },
        ],
        dwmjjyzsr: [
          {
            required: true,
            message: "单位面积经营总收入 不能为空",
            trigger: "blur",
          },
          {
            pattern: /^-?(([0-9]*(\.[0-9]{1,3})$)|([0-9]+$))/,
            message: "值需为数字或小数",
            trigger: "blur",
          },
        ],
        dwmjhgss: [
          {
            required: true,
            message: "单位面积海关税收 不能为空",
            trigger: "blur",
          },
          {
            pattern: /^-?(([0-9]*(\.[0-9]{1,3})$)|([0-9]+$))/,
            message: "值需为数字或小数",
            trigger: "blur",
          },
        ],
        dwmjswbmss: [
          {
            required: true,
            message: "单位面积税务部门税收 不能为空",
            trigger: "blur",
          },
          {
            pattern: /^-?(([0-9]*(\.[0-9]{1,3})$)|([0-9]+$))/,
            message: "值需为数字或小数",
            trigger: "blur",
          },
        ],
        dwmjhwmyswsze: [
          {
            required: true,
            message: "单位面积货物贸易涉外收支额 不能为空",
            trigger: "blur",
          },
          {
            pattern: /^-?(([0-9]*(\.[0-9]{1,3})$)|([0-9]+$))/,
            message: "值需为数字或小数",
            trigger: "blur",
          },
        ],
        qmdwmjqycyry: [
          {
            required: true,
            message: "期末单位面积企业从业人员 不能为空",
            trigger: "blur",
          },
          {
            pattern: /^-?(([0-9]*(\.[0-9]{1,3})$)|([0-9]+$))/,
            message: "值需为数字或小数",
            trigger: "blur",
          },
        ],
        jckzzzf: [
          {
            required: true,
            message: "进出口总值增幅 不能为空",
            trigger: "blur",
          },
          {
            pattern: /^-?(([0-9]*(\.[0-9]{1,3})$)|([0-9]+$))/,
            message: "值需为数字或小数",
            trigger: "blur",
          },
        ],
        tqhyqyszf: [
          {
            required: true,
            message: "同期活跃企业数增幅 不能为空",
            trigger: "blur",
          },
          {
            pattern: /^-?(([0-9]*(\.[0-9]{1,3})$)|([0-9]+$))/,
            message: "值需为数字或小数",
            trigger: "blur",
          },
        ],
        qmpzghmjysl: [
          {
            required: true,
            message: "期末批准规划面积验收率 不能为空",
            trigger: "blur",
          },
          {
            pattern: /^-?(([0-9]*(\.[0-9]{1,3})$)|([0-9]+$))/,
            message: "值需为数字或小数",
            trigger: "blur",
          },
        ],
        qmfbwwmjkfl: [
          {
            required: true,
            message: "期末封闭围网面积开发率 不能为空",
            trigger: "blur",
          },
          {
            pattern: /^-?(([0-9]*(\.[0-9]{1,3})$)|([0-9]+$))/,
            message: "值需为数字或小数",
            trigger: "blur",
          },
        ],
        sjsywzje: [
          {
            required: true,
            message: "实际使用外资金额 不能为空",
            trigger: "blur",
          },
          {
            pattern: /^-?(([0-9]*(\.[0-9]{1,3})$)|([0-9]+$))/,
            message: "值需为数字或小数",
            trigger: "blur",
          },
        ],
        jcqhwzz: [
          {
            required: true,
            message: "进出区货物总值不能为空",
            trigger: "blur",
          },
          {
            pattern: /^-?(([0-9]*(\.[0-9]{1,3})$)|([0-9]+$))/,
            message: "值需为数字或小数",
            trigger: "blur",
          },
        ],
        jckzzzqszstqjckbz: [
          {
            required: true,
            message: "进出口总值占其所在省不能为空",
            trigger: "blur",
          },
          {
            pattern: /^-?(([0-9]*(\.[0-9]{1,3})$)|([0-9]+$))/,
            message: "值需为数字或小数",
            trigger: "blur",
          },
        ],
        wxywjckz: [
          {
            required: true,
            message: "维修业务进出口值 不能为空",
            trigger: "blur",
          },
          {
            pattern: /^-?(([0-9]*(\.[0-9]{1,3})$)|([0-9]+$))/,
            message: "值需为数字或小数",
            trigger: "blur",
          },
        ],
        yfywjckz: [
          {
            required: true,
            message: "研发业务进出口值 不能为空",
            trigger: "blur",
          },
          {
            pattern: /^-?(([0-9]*(\.[0-9]{1,3})$)|([0-9]+$))/,
            message: "值需为数字或小数",
            trigger: "blur",
          },
        ],
        zlmyjckz: [
          {
            required: true,
            message: "租赁贸易进出口值 不能为空",
            trigger: "blur",
          },
          {
            pattern: /^-?(([0-9]*(\.[0-9]{1,3})$)|([0-9]+$))/,
            message: "值需为数字或小数",
            trigger: "blur",
          },
        ],
        kjdsywjckz: [
          {
            required: true,
            message: "跨境电商业务进出口值 不能为空",
            trigger: "blur",
          },
          {
            pattern: /^-?(([0-9]*(\.[0-9]{1,3})$)|([0-9]+$))/,
            message: "值需为数字或小数",
            trigger: "blur",
          },
        ],
        gmysgycz: [
          {
            required: true,
            message: "规模以上工业产值 不能为空",
            trigger: "blur",
          },
          {
            pattern: /^-?(([0-9]*(\.[0-9]{1,3})$)|([0-9]+$))/,
            message: "值需为数字或小数",
            trigger: "blur",
          },
        ],
        gdtzcz: [
          { required: true, message: "固定资产投资 不能为空", trigger: "blur" },
          {
            pattern: /^-?(([0-9]*(\.[0-9]{1,3})$)|([0-9]+$))/,
            message: "值需为数字或小数",
            trigger: "blur",
          },
        ],
        ztqszsjckzbz: [
          {
            required: true,
            message: "占同期所在市进出口值比重 不能为空",
            trigger: "blur",
          },
          {
            pattern: /^-?(([0-9]*(\.[0-9]{1,3})$)|([0-9]+$))/,
            message: "值需为数字或小数",
            trigger: "blur",
          },
        ],
      },
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询综合保税区经济运行主要指标列表 */
    getList() {
      this.loading = true;
      listECONOMICSINDEX(this.queryParams).then((response) => {
        this.ECONOMICSINDEXList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        jckzz: null,
        jgmyjckz: null,
        wlhwjckz: null,
        ybmyjckz: null,
        jyzsr: null,
        hgss: null,
        swbmss: null,
        hwmyswszze: null,
        qmqycyry: null,
        hyqys: null,
        dwmjjckz: null,
        dwmjjyzsr: null,
        dwmjhgss: null,
        dwmjswbmss: null,
        dwmjhwmyswsze: null,
        qmdwmjqycyry: null,
        jckzzzf: null,
        tqhyqyszf: null,
        qmpzghmjysl: null,
        qmfbwwmjkfl: null,
        sjsywzje: null,
        jcqhwzz: null,
        jckzzzqszstqjckbz: null,
        wxywjckz: null,
        yfywjckz: null,
        zlmyjckz: null,
        kjdsywjckz: null,
        gmysgycz: null,
        gdtzcz: null,
        ztqszsjckzbz: 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 = "添加综合保税区经济运行主要指标";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids;
      getECONOMICSINDEX(id).then((response) => {
        this.form = response.data;
        this.open = true;
        this.title = "修改综合保税区经济运行主要指标";
      });
    },
    /** 提交按钮 */
    submitForm() {
      let is;
      this.$refs["form"].validate((valid)=>{
        if(!valid) {
          this.$message.error("额外数据未填写齐全");
          is = true;
        }
        return;
      })
      
      if (is) return false;

      this.$refs["forms"].validate((valid) => {
        if (valid) {
          if (this.form.id != null) {
            updateECONOMICSINDEX(this.form).then((response) => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addECONOMICSINDEX(this.form).then((response) => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal
        .confirm(
          '是否确认删除综合保税区经济运行主要指标编号为"' + ids + '"的数据项？'
        )
        .then(function () {
          return delECONOMICSINDEX(ids);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download(
        "/ECONOMICSINDEX/export",
        {
          ...this.queryParams,
        },
        `ECONOMICSINDEX_${new Date().getTime()}.xlsx`
      );
    },
  },
};
</script>
