打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
成功vue页面未保存退出提示

<template>
  <div class="app-container" style="padding-top: 0px">
    <el-form
      ref="form"
      :model="form"
      label-width="120px"
      :inline="true"
      style="width: 100%"
    >
      <div style="float: left">
        <el-form-item>
          <el-select
            v-model="SearchType"
            placeholder="请选择"
            style="magin: 0px 5px; width: 160px"
          >
            <el-option
              v-for="item in SearchTypeOptions"
              :key="item.SearchTypeValue"
              :label="item.SearchTypeValue"
              :value="item.SearchTypeValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label prop="SearchContent">
          <el-input
            v-model="SearchContent"
            placeholder="请输入内容"
            style="padding: 0px 5px; width: 160px"
          ></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" v-on:click="GetWarehousingList"
            >查询</el-button
          >
        </el-form-item>
      </div>

      <div style="float: right">
        <el-form-item label="实验用途" prop="ExperimentalUse">
          <el-input v-model="form.ExperimentalUse" />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="AddWarehouseOut()"
            >确认出库</el-button
          >
        </el-form-item>
      </div>
    </el-form>
    <el-table
      v-loading="listLoading"
      :data="
        ListScientificResearchSamplesStorage.slice(
          (currentPage - 1) * pageSize,
          currentPage * pageSize
        )
      "
      element-loading-text="Loading"
      border
      fit
      highlight-current-row
      @selection-change="handleSelectionChange"
      tooltip-effect="dark"
      :header-cell-style="CommonJs.rowClass"
      :row-key="CommonJs.GetRowKey"
    >
      <el-table-column
        type="selection"
        :reserve-selection="true"
        prop="ID"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="SampleType"
        label="样本类型"
        align="center"
      ></el-table-column>
    </el-table>
    <el-pagination
      layout="prev, pager, next, sizes, total, jumper"
      :page-sizes="[5, 10, 20, 100]"
      :page-size="pageSize"
      :total="ListScientificResearchSamplesStorage.length"
      :current-page.sync="currentPage"
      @current-change="handleCurrentChange"
      @size-change="handleSizeChange"
      style="text-align: center; margin-top: 1%"
    ></el-pagination>
  </div>
</template>
脚本:
export default {
  filters: {},
  data() {
    return {
 ModifyCount:0,
}}
updated() {
    this.ModifyCount = this.ModifyCount + 1;
  },
  beforeRouteLeave(to, from, next) {
    if (this.ModifyCount > 0) {
      // 这里需要elementui的支持,如果使用其他界面组件自行替换即可
      this
        .$confirm("正在离开本页面,本页面内所有未保存数据都会丢失", "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        })
        .then(() => {
          // 正常跳转
          next();
        })
        .catch(() => {
          // 如果取消跳转地址栏会变化,这时保持地址栏不变
          window.history.go(1);
        });
    } else {
      next();
    }
  },

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
ElementUI快速入门
[前端]GOFLY项目-响应式登录页的设计和实现
vue项目中view-ui两个时间选择器的判断开始时间不大于结束时间(二)
在线编辑部
table固定前两列和最后一列,其他滑动显示
Javascript的一个经典表格排序源码,兼容IE,Firefox
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服