Skip to content
本页目录

CreateModalView

基于视图渲染的表格弹框组件,可实现常用的选中行操作,这个组件可以单独使用,同时 create-from-view 组件内也内嵌了这个组件。 CreateModalView 组件内部之间使用的 CreateView 组件

基本用法

示例
vue
<template>
  <div>
    <CreateModalView
      v-model:modalVisible="jumpModalVisible"
      :jumpGroupId="jumpGroupId"
      :table-params="jumpTableConfigs"
      @do-check="handleModalCheck"
    ></CreateModalView>
  </div>
</template>
<script lang="ts" setup>
import { ref, reactive, onMounted } from 'vue'
// 引用组件
import { CreateModalView } from 'ctj-ui-next'

const jumpModalVisible = ref(false)
const jumpGroupId = ref('')
const jumpTableConfigs = reactive<TableParams>({
  tableConfigs: {
    viewConfig: {
      rowKey: 'invoice_number',
      checkType: 'checkbox',
    },
    request: {
      api: '/system/ledger/query/page',
    },
    cusPagination: {
      pageSize: 10,
      current: 1,
      total: 20,
    },
  },
})

const showJumpModal = (jump_group_id: string) => {
  jumpGroupId.value = jump_group_id
  jumpModalVisible.value = true
}

const handleModalCheck = (selectRows: Array<Record<string, any>>) => {
  console.log(selectRows)
}
</script>
<style lang="less" scoped></style>
<template>
  <div>
    <CreateModalView
      v-model:modalVisible="jumpModalVisible"
      :jumpGroupId="jumpGroupId"
      :table-params="jumpTableConfigs"
      @do-check="handleModalCheck"
    ></CreateModalView>
  </div>
</template>
<script lang="ts" setup>
import { ref, reactive, onMounted } from 'vue'
// 引用组件
import { CreateModalView } from 'ctj-ui-next'

const jumpModalVisible = ref(false)
const jumpGroupId = ref('')
const jumpTableConfigs = reactive<TableParams>({
  tableConfigs: {
    viewConfig: {
      rowKey: 'invoice_number',
      checkType: 'checkbox',
    },
    request: {
      api: '/system/ledger/query/page',
    },
    cusPagination: {
      pageSize: 10,
      current: 1,
      total: 20,
    },
  },
})

const showJumpModal = (jump_group_id: string) => {
  jumpGroupId.value = jump_group_id
  jumpModalVisible.value = true
}

const handleModalCheck = (selectRows: Array<Record<string, any>>) => {
  console.log(selectRows)
}
</script>
<style lang="less" scoped></style>

属性 Props

参数说明类型可选值默认值
modalVisible显示隐藏弹框(必传)boolean-false
modalWidth弹框的宽度string/number-'90%'
title弹框 titlestring-'请选择'
jumpGroupId按钮跳转的视图 id(这个属性与 allUiViews 必传其中一个)string--
allUiViews弹框视图数据(这个属性与 jumpGroupId 必传其中一个)UiData--
TableParamscrate-view 的参数(去除了 allUiViews)Omit<CreateViewProps, 'allUiViews'>--
cusHandleModal是否自己处理隐藏操作,设true时需要自己在doCheck以及modalCancel隐藏弹框boolean-false

事件 Events

事件名说明回调参数参数说明
doCheck弹框选择确认事件selectRows选中的行
modalCancel弹框取消事件--

插槽

插槽名称说明
modalFooter底部按钮

预算单位软件产品开发部