弹出框选择数据

代码实现源码,查看open in new window

文档说明

注意:这是最新版本vue3语法的实现方式,旧版本或者在[表.jsx]中实现弹出框,见旧版本文档,查看open in new window

1.效果截图

1.配置选择按钮

2.弹用弹出框

3.文件目录结构

2.代码实现

1. 实现思路:在生成的vue文件加上自定义弹出框引用其他生成的页面

2. 此处引用的是生成的页面,也可以在弹出框自定义table配置,见下面【弹出框选择数据(明细表)】

MES_ProductionOrder.vue(生成vue文件)
<template>
  <!--将select-custom这段代码放在view-grid标签后面 -->
  <!-- 弹出框(选择数据) -->
  <select-custom ref="customRef" @onSelectCustom="onSelectCustom"></select-custom>
</template>
<script setup lang="jsx">
//将本地的onInit代码去掉,替换下面的这一段整代码
import SelectCustom from './MES_ProductionOrderSelectCustom.vue'
let gridRef
const onInit = async ($vm) => {
  gridRef = $vm
  const option = gridRef.getFormOption("CustomerName");
  option.readonly = true;
  option.extra = {
    icon: 'el-icon-zoom-out', //显示图标
    text: '选择', //显示文本
    style: 'color: #3a8ee6;font-size: 13px;cursor: pointer;',
    //触发事件
    click: (item) => {
      customRef.value.open();
    }
  };
}
//选择客户回调
const onSelectCustom = (rows) => {
   editFormFields.CustomerName=rows[0].CustomerName;
   //这里还可以给其他字段设置值editFormFields.字段=
}
</script>