Jay
2025-02-14 6a10ba124109f8a64471fbfe862dd0ab3aff3009
提交 | 用户 | 时间
c889d8 1 <template>
J 2   <el-dialog
3     title="指标当前值"
4     :close-on-click-modal="false"
5     width="30%"
6     v-model="visible"
7   >
8     <el-form
9       :inline="true"
10       :model="dataForm"
11     >
12       <el-form-item>
13         <el-button @click="getData()">查询</el-button>
14       </el-form-item>
15       <el-form-item>
16         <el-input v-model="dataForm.itemCurrentData" type="textarea" :rows="15" style="width: 550px" disabled/>
17       </el-form-item>
18     </el-form>
19   </el-dialog>
20 </template>
21
22 <script lang="ts" setup>
23 import {ref} from 'vue';
24 import * as ItemApi from '@/api/data/ind/item/item'
25
26 const message = useMessage() // 消息弹窗
27 const visible = ref(false);
28 const dataForm = ref({
29   itemNo: "",
30   itemCurrentData: "",
31 });
32
33 /** 打开弹窗 */
34 const open = async (itemNo: string) => {
35   visible.value = true
36   dataForm.value.itemNo = itemNo
6a10ba 37   dataForm.value.itemCurrentData = JSON.stringify(await ItemApi.getItemCurrentData(itemNo));
c889d8 38 }
J 39
40 defineExpose({open}) // 提供 open 方法,用于打开弹窗
41
42 const getData = async() =>{
43   dataForm.value.itemCurrentData = await ItemApi.getItemCurrentData(dataForm.value.itemNo);
44 }
45 </script>