Explorar el Código

修复v-model的问题

xiaochan hace 1 año
padre
commit
157a163e57

+ 6 - 4
src/components/med-tec-mod/RefundForProjectEntry.vue

@@ -1,8 +1,7 @@
 <template>
   <xc-dialog-v2 title="退费详细"
                 v-model="modelValue"
-                width="100%"
-                @closed="emit('update:modelValue',false)">
+                width="100%">
     <page-layer>
       <template #header>
         数量:{{ chargeAmount }} 金额: {{
@@ -89,6 +88,7 @@ import {conversionRefundFlag, costState} from "@/utils/computed";
 import {ElMessageBox} from "element-plus";
 import PageLayer from "@/layout/PageLayer";
 import {refund} from "@/api/hospitalization-costs/hospitalization-costs-api";
+import {useModel} from "vue";
 
 const props = defineProps({
   modelValue: {
@@ -108,6 +108,8 @@ const props = defineProps({
 
 const emit = defineEmits(['uncheck', 'update:modelValue', 'refreshFee'])
 
+const modelValue = useModel(props, 'modelValue', emit)
+
 const chargeAmount = ref(0)
 const chargeFee = ref(0)
 const groupNo = ref('73')
@@ -132,7 +134,7 @@ const confirmRefund = (flag) => {
     }
     await refund(data)
     emit('refreshFee')
-    emit('update:modelValue', false)
+    modelValue.value = false
   }).catch(() => {
 
   });
@@ -142,7 +144,7 @@ const deleteData = async (data, index) => {
   await emit('uncheck', data)
   props.list.splice(index, 1)
   if (props.list.length === 0) {
-    emit('update:modelValue', false)
+    modelValue.value = false
   }
   calculatedAmount()
 }

+ 13 - 7
src/components/medical-insurance/charge-list/Index.vue

@@ -3,7 +3,8 @@
     <div style="display: flex; width: 100%; height: 100%;">
       <div style="width: 330px;height: 100%; padding: 0 12px; border-right: 1px solid lightgray">
         <div class="flex-header">
-          <el-input v-model="patNo" placeholder="住院号" clearable style="width: 160px"></el-input>
+          <el-input :model-value="patNo" placeholder="住院号" @input="inputPatNo" clearable
+                    style="width: 160px"></el-input>
           <el-button type="primary" icon="Search" style="margin-left: 20px" @click="fetchOverview">查询</el-button>
         </div>
         <div style="width: 336px">
@@ -32,10 +33,10 @@
           <tr>
             <td colspan="8"
                 style="width: 96%;height: 50px;text-align: center;vertical-align:center;">
-                <div style="font-size: 20px;font-weight: bold;">住院病人费用明细清单</div>
-                <div style="margin-top: 5px">
-                    机构名称:长沙泰和医院&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;机构编码:H43010500370
-                </div>
+              <div style="font-size: 20px;font-weight: bold;">住院病人费用明细清单</div>
+              <div style="margin-top: 5px">
+                机构名称:长沙泰和医院&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;机构编码:H43010500370
+              </div>
             </td>
           </tr>
           <tr>
@@ -136,7 +137,7 @@ export default {
       default: true
     }
   },
-  emits: ['close'],
+  emits: ['close', 'update:patNo'],
   setup(props, ctx) {
     const tableHeight = window.innerHeight - 72
     const patList = ref([])
@@ -150,6 +151,10 @@ export default {
       overflowY: 'scroll'
     }
 
+    const inputPatNo = (val) => {
+      ctx.emits('update:patNo', val)
+    }
+
     const fetchOverview = () => {
       if (!props.patNo) {
         ElMessage({
@@ -244,7 +249,8 @@ export default {
       closeTablet,
       selfpayUpload,
       execPrint,
-      props
+      props,
+      inputPatNo
     }
   },
 }

+ 4 - 4
src/components/xiao-chan/cy-dialog/cy-dialog.vue

@@ -4,22 +4,22 @@ import {ElDialog, ElIcon, useEscapeKeydown} from "element-plus";
 import {useVModels} from "@vueuse/core";
 // @ts-ignore
 import {Close} from '@element-plus/icons-vue'
-import {computed} from "vue";
-import {VNode} from "@vue/runtime-core";
+import {computed, withDefaults} from "vue";
 import sleep from "@/utils/sleep";
 
 const props = withDefaults(
     defineProps<{
-      modelValue: boolean,
+      modelValue?: boolean,
       title?: string,
       width?: string | number,
       titleAlign?: 'center' | 'left',
-      titleIcon?: VNode | null,
+      titleIcon?: any | null,
       titleIconColor?: string,
       closeOnClickModal?: boolean,
       bodyCenter?: boolean
     }>(),
     {
+      title: '弹窗',
       width: '420px',
       titleAlign: 'center',
       titleIcon: null,