若依组件vue全屏显示

文章介绍了如何在Vue项目中构建一个违法事项选择对话框,包括表单输入、搜索、全屏模式以及数据列表的展示和操作功能,使用了el-dialog和表格组件进行交互设计。
摘要由CSDN通过智能技术生成

代码

<template>
  <el-dialog title="违法事项选择" :visible.sync="visible" :fullscreen="fullscreen" width="90%" @close="close" append-to-body>


  <div :class="[fullscreen ? 'exitFullScreenBtn' : 'fullScreenBtn']" v-if="!loading"
         @click.stop="toggleFullscreen"></div>

    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
      <el-form-item label="违法事项" prop="userName">
        <el-input v-model="queryParams.illegalActivities" placeholder="请输入违法事项" clearable />
      </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-table v-loading="loading" :data="dataList" style="width: 100%" >
      <el-table-column label="违法事项ID" align="center" prop="id" v-if="false"/>
      <el-table-column label="违法事项" align="center" prop="illegalActivities" fixed="left" width="400" height="500" show-overflow-tooltip />
      <el-table-column label="违反条款" align="center" prop="terms" width="400" height="500"/>
      <el-table-column label="违反条款内容" align="center" prop="termsContent" width="500" height="500" show-overflow-tooltip/>
      <el-table-column label="处罚依据" align="center" prop="according" width="400" height="500"/>
      <el-table-column label="处罚依据内容" align="center" prop="accordingContent" width="500"  height="500" show-overflow-tooltip/>
      <el-table-column align="center" fixed="right" label="操作" width="200">
        <template slot-scope="scope">
          <el-button @click="select(scope.row)" type="text" size="small">选择</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>
</template>

<script>
import {delIllegalActivities, getIllegalActivities, listIllegalActivities} from "@/api/enforceLaw/illegalActivities";
/*违法事项选择组件*/
export default {
  name: "IllegalActivitiesSelect",
  props: {
    //用户信息
    value: [Object],

    fullscreen: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      //可选项列表
      dataList: [],
      //是否显示
      visible: false,
      // 总条数
      total: 0,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        //违法事项
        illegalActivities: null,
      },
    }
  },

  watch: {
    value: {
      handler(val) {
        if (val) {
          return val;
        } else {
          return {};
        }
      },
      deep: true,
      immediate: true
    },
  },
  created() {
  },
  methods: {
    toggleFullscreen() {
      this.fullscreen = !this.fullscreen; // 切换全屏状态
    },
    open() {
      if (this.dataList.length === 0){
        this.getList();
      }
      this.visible = true;
    },
    /** 查询售后工单信息列表 */
    getList() {
      this.loading = true;
      listIllegalActivities(this.queryParams).then(response => {
        this.dataList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getIllegalActivities(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改违法事项库";
        this.subIsShow=true;
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除违法事项库编号为"' + ids + '"的数据项?').then(function() {
        return delIllegalActivities(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /**查看列表信息*/
    openView(row, column, cell, event){
      if (column.property===this.cellClickName){
        this.reset();
        const id = row.id || this.ids
        getIllegalActivities(id).then(response => {
          this.form = response.data;
          this.open = true;
          this.title = "查看违法事项库";
          this.subIsShow=false;
        });
      }
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 选中用户 */
    select(row) {
      console.log(row);
      this.$emit("input", row);
      this.$emit("change", row);
      this.close();
    },
    /** 关闭 */
    close() {
      this.visible = false;
      this.fullscreen = false;
    },
  }
}
</script>

<style scoped>

</style>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值