<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="所属小区" prop="areaId">
        <el-select v-model="queryParams.areaId" filterable clearable placeholder="请选择所属小区"
                   @change="getBuilding(queryParams.areaId),resetqueryform()"
        >
          <el-option v-for="item in areaList" :key="item.id" :value="item.id" :label="item.name">{{
              item.name
            }}
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="所属楼宇" prop="buildingId">
        <el-select v-model="queryParams.buildingId" filterable clearable placeholder="请选择楼宇"
                   @change="getUnit(queryParams.buildingId),resetqueryunitform()"
        >
          <el-option v-for="item in buildingList" :key="item.id" :value="item.id" :label="item.name">{{
              item.name
            }}
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="所属单元" prop="unitId">
        <el-select v-model="queryParams.unitId" filterable clearable placeholder="请选择单元"
                   @change="getHouse(queryParams.unitId),resetqueryhouseform()"
        >
          <el-option v-for="item in unitList" :key="item.id" :value="item.id" :label="item.name">{{
              item.name
            }}
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="房屋" prop="houseId">
        <el-select v-model="queryParams.houseId" filterable clearable placeholder="请选择房屋" @change="setHouseName(queryParams.houseId)" >
          <el-option v-for="item in houseList" :key="item.id" :value="item.id" :label="item.name">{{
              item.name
            }}
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="服务类别" prop="serviceType">
        <el-select v-model="queryParams.serviceType" placeholder="请选择服务类别" clearable size="small">
          <el-option
            v-for="dict in dict.type.service_type"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="职工" prop="userId">
        <el-select v-model="queryParams.userId" filterable placeholder="请选择职工">
          <el-option v-for="item in workerList" :key="item.id" :value="item.id" :label="item.name">{{
              item.name
            }}
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="订单状态" prop="orderStatus">
        <el-select v-model="queryParams.orderStatus" placeholder="请选择订单状态" clearable size="small">
          <el-option
            v-for="dict in dict.type.order_status"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="审核状态" prop="examineStatus">
        <el-select v-model="queryParams.examineStatus" placeholder="请选择审核状态" clearable size="small">
          <el-option
            v-for="dict in dict.type.examine_status"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="开始时间" prop="starTime">
        <el-date-picker clearable size="small"
                        v-model="queryParams.starTime"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="选择日期"
        >
        </el-date-picker>
      </el-form-item>
      <el-form-item label="结束时间" prop="endTime">
        <el-date-picker clearable size="small"
                        v-model="queryParams.endTime"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="选择日期"
        >
        </el-date-picker>
      </el-form-item>
      <el-form-item label="工号" prop="jobNum">
        <el-input
          v-model="queryParams.jobNum"
          :maxlength="4"
          placeholder="请输入工号前四位"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['gas:order:add']"
        >新增
        </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="['gas:order:remove']"
        >删除
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          :loading="exportLoading"
          @click="handleExport"
          v-hasPermi="['gas:order:export']"
        >导出
        </el-button>
      </el-col>
      <!--      <el-col :span="1.5">-->
      <!--        <el-button-->
      <!--          type="warning"-->
      <!--          plain-->
      <!--          icon="el-icon-download"-->
      <!--          size="mini"-->
      <!--          :loading="exportLoading"-->
      <!--          @click="backup"-->
      <!--          v-hasPermi="['gas:order:export']"-->
      <!--        >备份</el-button>-->
      <!--      </el-col>-->
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="orderList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center"/>
      <el-table-column label="服务类别" align="center" prop="serviceType">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.service_type" :value="scope.row.serviceType"/>
        </template>
      </el-table-column>
      <el-table-column label="职工" align="center" prop="userName"/>
      <el-table-column label="房屋" align="center" prop="house"/>
      <el-table-column label="管子类型" align="center" prop="pipeType"/>
      <el-table-column label="管子长度" align="center" prop="pipeLength"/>
      <el-table-column label="自闭阀类型" align="center" prop="valveType"/>
      <el-table-column label="订单时间" align="center" prop="time"/>
      <el-table-column label="订单状态" align="center" prop="orderStatus">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.order_status" :value="scope.row.orderStatus"/>
        </template>
      </el-table-column>
      <el-table-column label="审核状态" align="center" prop="examineStatus">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.examine_status" :value="scope.row.examineStatus"/>
        </template>
      </el-table-column>
      <el-table-column label="照片" align="center" prop="photoList">
        <template slot-scope="scope">
          <el-image
            v-if="scope.row.photoList.length> 0"
            style="width: 100px; height: 100px"
            :src="scope.row.photoList[0]"
            :preview-src-list="scope.row.photoList"
          >
          </el-image>
        </template>
      </el-table-column>
      <el-table-column label="备注" align="center" prop="remark"/>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button v-show="scope.row.orderStatus ==='001'"
                     size="mini"
                     type="text"
                     icon="el-icon-edit"
                     @click="handleUpdate(scope.row)"
                     v-hasPermi="['gas:order:edit']"
          >修改
          </el-button>
          <el-button v-show="scope.row.orderStatus ==='002'"
                     size="mini"
                     type="text"
                     icon="el-icon-edit"
                     @click="handleUpdate1(scope.row)"
                     v-hasPermi="['gas:order:edit']"
          >复审
          </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" width="1000px" append-to-body>
      <el-row :gutter="15">
        <el-form ref="form" :model="form" :rules="rules" label-width="100px">
          <el-col :span="22">
            <el-form-item label="服务类别" prop="serviceType">
              <el-select v-model="form.serviceType" placeholder="请选择服务类别" clearable :style="{width: '100%'}">
                <el-option
                  v-for="dict in dict.type.service_type"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="23">
            <el-form-item label="照片" prop="photoList">
              <imageUpload v-model="form.photoList"/>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="职工" prop="userId">
              <el-select v-model="form.userId" filterable placeholder="请选择职工" clearable :style="{width: '100%'}">
                <el-option v-for="item in workerList" :key="item.id" :value="item.id" :label="item.name">{{
                    item.name
                  }}
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="所属小区" prop="areaId">
              <el-select v-model="form.areaId" filterable placeholder="请选择小区" clearable :style="{width: '100%'}"
                         @change="getBuilding(form.areaId),resetform()"
              >
                <el-option v-for="item in areaList" :key="item.id" :value="item.id" :label="item.name">{{
                    item.name
                  }}
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="所属楼宇" prop="buildingId">
              <el-select v-model="form.buildingId" filterable placeholder="请选择楼宇" clearable :style="{width: '100%'}"
                         @change="getUnit(form.buildingId),resetunitform()"
              >
                <el-option v-for="item in buildingList" :key="item.id" :value="item.id" :label="item.name">{{
                    item.name
                  }}
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="所属单元" prop="unitId">
              <el-select v-model="form.unitId" filterable placeholder="请选择单元" clearable :style="{width: '100%'}"
                         @change="getHouse(form.unitId),resethouseform()"
              >
                <el-option v-for="item in unitList" :key="item.id" :value="item.id" :label="item.name">{{
                    item.name
                  }}
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="房屋" prop="houseId">
              <el-select v-model="form.houseId" filterable placeholder="请选择房屋" clearable :style="{width: '100%'}">
                <el-option v-for="item in houseList" :key="item.id" :value="item.id" :label="item.name">{{ item.name }}
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="管子类型" prop="pipeType">
              <el-radio-group v-model="form.pipeType">
                <el-radio
                  v-for="item in pipeTypeList"
                  :key="item.pipeType"
                  :label="item.pipeType"
                >{{ item.pipeType }}
                </el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="管子长度" prop="pipeLength" >
              <el-radio-group v-model="form.pipeLength">
                <el-radio
                  v-for="item in pipeLengthList"
                  :key="item.pipeLength"
                  :label="item.pipeLength"
                >{{ item.pipeLength }}
                </el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="自闭阀类型" prop="valveType">
              <el-radio-group v-model="form.valveType">
                <el-radio
                  v-for="item in valveTypeList"
                  :key="item.valveType"
                  :label="item.valveType"
                >{{ item.valveType }}
                </el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="22">
            <el-form-item label="备注" prop="remark">
              <el-input v-model="form.remark" type="textarea" placeholder="请输入内容"/>
            </el-form-item>
          </el-col>
        </el-form>

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


    <!-- 复审对话框 -->
    <el-dialog :title="title" :visible.sync="open1" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="服务类别" prop="serviceType">
          <el-select disabled v-model="form.serviceType" placeholder="请选择服务类别">
            <el-option
              v-for="dict in dict.type.service_type"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="照片">
          <imageUpload v-model="form.photoList" :disabled="true"/>
        </el-form-item>
        <el-form-item label="职工" prop="userId">
          <el-select disabled v-model="form.userId" filterable placeholder="请选择职工">
            <el-option v-for="item in workerList" :key="item.id" :value="item.id" :label="item.name">{{
                item.name
              }}
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="所属小区" prop="areaId">
          <el-select disabled v-model="form.areaId" filterable placeholder="请选择小区"
                     @change="getBuilding(form.areaId),resetform()"
          >
            <el-option v-for="item in areaList" :key="item.id" :value="item.id" :label="item.name">{{
                item.name
              }}
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="所属楼宇" prop="buildingId">
          <el-select disabled v-model="form.buildingId" filterable placeholder="请选择楼宇"
                     @change="getUnit(form.buildingId),resetunitform()"
          >
            <el-option v-for="item in buildingList" :key="item.id" :value="item.id" :label="item.name">{{
                item.name
              }}
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="所属单元" prop="unitId">
          <el-select disabled v-model="form.unitId" filterable placeholder="请选择单元"
                     @change="getHouse(form.unitId),resethouseform()"
          >
            <el-option v-for="item in unitList" :key="item.id" :value="item.id" :label="item.name">{{
                item.name
              }}
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="房屋" prop="houseId">
          <el-select disabled v-model="form.houseId" filterable placeholder="请选择房屋">
            <el-option v-for="item in houseList" :key="item.id" :value="item.id" :label="item.name">{{
                item.name
              }}
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="管子类型" prop="pipeType">
          <el-radio-group disabled v-model="form.pipeType">
            <el-radio
              v-for="item in pipeTypeList"
              :key="item.pipeType"
              :label="item.pipeType"
            >{{ item.pipeType }}
            </el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="管子长度" prop="pipeLength">
          <el-radio-group disabled v-model="form.pipeLength">
            <el-radio
              v-for="item in pipeLengthList"
              :key="item.pipeLength"
              :label="item.pipeLength"
            >{{ item.pipeLength }}
            </el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="自闭阀类型" prop="valveType">
          <el-radio-group disabled v-model="form.valveType">
            <el-radio
              v-for="item in valveTypeList"
              :key="item.valveType"
              :label="item.valveType"
            >{{ item.valveType }}
            </el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input disabled v-model="form.remark" type="textarea" placeholder="请输入内容"/>
        </el-form-item>
        <el-form-item label="审核意见" prop="reason">
          <el-input v-model="form.reason" type="textarea" placeholder="请输入内容"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button :loading="buttonLoading" type="primary" @click="submitY">合格</el-button>
        <el-button :loading="buttonLoading" type="primary" @click="submitN">不合格</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  listOrder,
  getOrderForStatus,
  getHouse,
  backup,
  getUnit,
  getArea,
  getBuilding,
  getOrder,
  getWorker,
  getPipeType,
  getValveType,
  getPipeLength,
  delOrder,
  addOrder,
  submitY,
  submitN,
  updateOrder
} from '@/api/gas/order'

export default {
  name: 'Order',
  inheritAttrs: false,
  dicts: ['service_type', 'order_status', 'examine_status'],
  data() {
    return {
      // 按钮loading
      buttonLoading: false,
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      //职工下拉
      workerList: [],
      pipeLengthList: [],
      pipeTypeList: [],
      valveTypeList: [],
      areaList: [],
      buildingList: [],
      unitList: [],
      houseList: [],
      // 选中数组
      ids: [],
      // 选中数组的乐观锁
      versions: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 工程管理表格数据
      orderList: [],
      // 弹出层标题
      title: '',
      // 是否显示弹出层
      open: false,
      open1: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        serviceType: undefined,
        starTime: undefined,
        endTime: undefined,
        areaId: undefined,
        buildingId: undefined,
        unitId: undefined,
        houseId: undefined,
        userId: undefined,
        orderStatus: undefined,
        examineStatus: undefined,
        jobNum: undefined
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        serviceType: [
          { required: true, message: '服务类别不能为空', trigger: 'change' }
        ],
        photoList: [
          { required: false, message: '请上传照片', trigger: 'change' }
        ],
        userId: [
          { required: true, message: '职工不能为空', trigger: 'blur' }
        ],
        houseId: [
          { required: true, message: '房屋不能为空', trigger: 'change' }

        ]
      }
    }
  },
  created() {
    this.getList()
    this.getWorker()
    this.getArea()
    this.getPipeLength()
    this.getPipeType()
    this.getValveType()
  },
  methods: {
    backup() {
      backup().then(response => {
      })
    },
    /** 查询工程管理列表 */
    getList() {
      this.loading = true
      listOrder(this.queryParams).then(response => {
        this.orderList = response.rows
        this.total = response.total
        this.loading = false
      })
    },
    /**职工下拉框*/
    getWorker() {
      getWorker().then(response => {
        this.workerList = response.data
      })
    },

    //管子长度
    getPipeLength() {
      getPipeLength().then(response => {
        this.pipeLengthList = response.data
      })
    },
    //管子类别
    getPipeType() {
      getPipeType().then(response => {
        this.pipeTypeList = response.data
      })
    },
    //自闭阀类别
    getValveType() {
      getValveType().then(response => {
        this.valveTypeList = response.data
      })
    },
    /**小区下拉框*/
    getArea() {
      getArea().then(response => {
        this.areaList = response.data
      })
    },
    /**楼宇下拉框*/
    getBuilding(areaId) {
      this.form.areaName =  this.areaList.filter(item => item.id == areaId )[0].name
      getBuilding(areaId).then(response => {
        this.buildingList = response.data
      })
    },
    getUnit(buildingId) {
      this.form.buildingName =  this.buildingList.filter(item => item.id == buildingId )[0].name
      getUnit(buildingId).then(response => {
        this.unitList = response.data
      })
    },
    getHouse(unitId) {
      this.form.unitName =  this.unitList.filter(item => item.id == unitId )[0].name
      getHouse(unitId).then(response => {
        this.houseList = response.data
      })
    },
    setHouseName(houseId) {
      this.form.houseName =  this.houseList.filter(item => item.id == houseId )[0].name
    },
    /**
     * 联级清空
     */
    resetform() {
      this.form.buildingId = undefined
      this.form.unitId = undefined
      this.form.houseId = undefined
    },
    resetunitform() {
      this.form.unitId = undefined
      this.form.houseId = undefined
    },
    resethouseform() {
      this.form.houseId = undefined
    },
    resetqueryform() {
      this.queryParams.buildingId = undefined
      this.queryParams.unitId = undefined
      this.queryParams.houseId = undefined
    },
    resetqueryunitform() {
      this.queryParams.unitId = undefined
      this.queryParams.houseId = undefined
    },
    resetqueryhouseform() {
      this.queryParams.houseId = undefined
    },
    // 取消按钮
    cancel() {
      this.open = false
      this.open1 = false
      this.reset()
    },
    // 表单重置
    reset() {
      this.form = {
        id: undefined,
        serviceType: undefined,
        photoList: [],
        userId: undefined,
        unitId: undefined,
        buildingId: undefined,
        areaId: undefined,
        houseId: undefined,
        pipeLength: undefined,
        pipeType: undefined,
        remark: undefined,
        delFlag: undefined,
        createBy: undefined,
        createTime: undefined,
        updateBy: undefined,
        updateTime: undefined,
        reason: undefined
      }
      this.resetForm('form')
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1
      this.getList()
    },
    /** 重置按钮操作 */
    resetQuery() {
      // this.resetForm("queryForm");
      this.$refs['queryForm'].resetFields()
      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 = '添加工程管理'
      this.getWorker()
      this.getPipeLength()
      this.getPipeType()
      this.getValveType()
      this.getArea()
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset()
      this.getWorker()
      this.getPipeLength()
      this.getPipeType()
      this.getValveType()
      this.getArea()
      const id = row.id || this.ids
      getOrder(id).then(response => {
        this.loading = false
        this.form = response.data
        this.open = true
        this.title = '修改工程管理'
        this.getBuilding(this.form.areaId)
        this.getUnit(this.form.buildingId)
        this.getHouse(this.form.unitId)
      })
    },
    /** 复审按钮操作 */
    handleUpdate1(row) {
      this.loading = true
      this.reset()
      this.getWorker()
      this.getPipeLength()
      this.getPipeType()
      this.getValveType()
      this.getArea()
      const id = row.id || this.ids
      getOrder(id).then(response => {
        this.loading = false
        this.form = response.data
        this.open1 = true
        this.title = '审核信息'
        this.getBuilding(this.form.areaId)
        this.getUnit(this.form.buildingId)
        this.getHouse(this.form.unitId)
      })
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs['form'].validate(valid => {
        if (valid) {
          this.buttonLoading = true
          if (this.form.id != null) {
            if (typeof this.form.photoList === 'string') {
              this.form.photoList = this.form.photoList.split(',')
            }
            updateOrder(this.form).then(response => {
              this.$modal.msgSuccess('修改成功')
              this.open = false
              this.getList()
              this.getWorker()
            }).finally(() => {
              this.buttonLoading = false
            })
          } else {
            // this.form.photoList = this.form.photoList.split(',')
            addOrder(this.form).then(response => {
              this.$modal.msgSuccess('新增成功')
              this.open = false
              this.getList()
              this.getWorker()
            }).finally(() => {
              this.buttonLoading = false
            })
          }
        }
      })
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids
      this.$modal.confirm('是否确认删除工程管理编号为"' + ids + '"的数据项？').then(() => {
        this.loading = true
        return delOrder(ids)
      }).then(() => {
        this.loading = false
        this.getList()
        this.getWorker()
        this.$modal.msgSuccess('删除成功')
      }).finally(() => {
        this.loading = false
      })
    },
    /** 导出按钮操作 */
    handleExport() {
      this.$download.excel('/gas/order/export', this.queryParams)
    },
    submitY(row) {
      if (this.form.id != null) {
        const ids = this.form.id
        const versions = this.form.version
        this.$modal.confirm('确定审核？').then(() => {
          this.loading = true
          return submitY(ids, this.form.reason, versions)
        }).then((res) => {
          this.open1 = false
          this.loading = false
          this.getList()
          this.getWorker()
          this.$modal.msgSuccess(res.msg)
        }).finally(() => {
          this.loading = false
        })
      } else {
        const ids = row.id || this.ids
        const versions = row.version || this.versions
        this.$modal.confirm('确定审核？').then(() => {
          this.loading = true
          return submitY(ids, this.form.reason, versions)
        }).then((res) => {
          this.loading = false
          this.getList()
          this.getWorker()
          this.$modal.msgSuccess(res.msg)
        }).finally(() => {
          this.loading = false
        })
      }
    },
    submitN(row) {
      if (this.form.id != null) {
        const ids = this.form.id
        const versions = this.form.version
        this.$modal.confirm('确定审核？').then(() => {
          this.loading = true
          return submitN(ids, this.form.reason, versions)
        }).then((res) => {
          this.open1 = false
          this.loading = false
          this.getList()
          this.getWorker()
          this.$modal.msgSuccess(res.msg)
        }).finally(() => {
          this.loading = false
        })
      } else {
        const ids = row.id || this.ids
        const versions = row.version || this.versions
        this.$modal.confirm('确定审核？').then(() => {
          this.loading = true
          return submitN(ids, this.form.reason, versions)
        }).then((res) => {
          this.loading = false
          this.getList()
          this.getWorker()
          this.$modal.msgSuccess(res.msg)
        }).finally(() => {
          this.loading = false
        })
      }

    }

  }
}
</script>
