Parcourir la source

优化usedialog的params的类型提示

xiaochan il y a 2 mois
Parent
commit
f115159e39

+ 7 - 7
src/components/cy/CyDialog/index.ts

@@ -1,4 +1,4 @@
-import { Component, ref, shallowRef } from "vue";
+import { ref, shallowRef } from "vue";
 import XEUtils from "xe-utils";
 
 interface DialogProps {
@@ -30,9 +30,9 @@ export namespace UseDialogType {
   }
 }
 
-export interface DialogOptions<P extends Component> {
+export interface DialogOptions<Props> {
   dialogProps?: DialogProps;
-  params?: ExtractPropTypes<P>;
+  params?: Props;
   showCancel?: boolean;
   hideHeader?: boolean;
   showConfirm?: boolean;
@@ -66,10 +66,10 @@ export const dialogKey = ref(1);
  * @param component 组件
  * @param props 参数
  */
-export function useDialog<C extends Component>(
-  component: C,
-  props: DialogOptions<C> = {}
-) {
+export function useDialog<
+  C extends abstract new (...args: any) => any,
+  Props extends InstanceType<C>,
+>(component: C, props: DialogOptions<Props["$props"]> = {}) {
   return new Promise<any>((resolve, reject) => {
     if (!XEUtils.has(props, "dialogProps.title")) {
       XEUtils.set(props, "dialogProps.title", "");

+ 57 - 57
src/components/si-sheet-upload/jie-suan-dan-xiu-gai/JieSuanDanXiangQing.vue

@@ -13,40 +13,40 @@
             size="small"
             type="primary"
             @click="dianJiChaKanHuanZheJianYan()"
-            >检验记录</el-button
-          >
+            >检验记录
+          </el-button>
           <el-button size="small" type="primary" @click="queryJianYanJianCha"
-            >检查记录</el-button
-          >
+            >检查记录
+          </el-button>
           <el-button size="small" type="primary" @click="bingAnShouYe"
-            >病案首页</el-button
-          >
+            >病案首页
+          </el-button>
           <el-button
             size="small"
             v-if="auditQuanXian()"
             type="primary"
             @click="shenQingCheHui"
-            >撤销审核</el-button
-          >
+            >撤销审核
+          </el-button>
           <el-button size="small" type="primary" @click="showChargeListClick"
-            >费用清单</el-button
-          >
+            >费用清单
+          </el-button>
           <el-button size="small" type="primary" @click="querylistSetlAuditLog"
-            >审核历史记录</el-button
-          >
+            >审核历史记录
+          </el-button>
           <el-button size="small" type="primary" @click="queryDianZiBingLi"
-            >电子病历</el-button
-          >
+            >电子病历
+          </el-button>
           <el-button size="small" type="primary" @click="qualityTest('3')"
-            >质控测算</el-button
-          >
+            >质控测算
+          </el-button>
           <el-button size="small" type="primary" @click="drgGroupTest"
-            >DRG分组测算</el-button
-          >
+            >DRG分组测算
+          </el-button>
           <el-button type="info" @click="shenHeClick">审核信息</el-button>
           <el-button size="small" type="primary" @click="shuJuDuiBi"
-            >数据对比</el-button
-          >
+            >数据对比
+          </el-button>
           <el-button
             size="small"
             :disabled="shenHeSendFlag"
@@ -72,9 +72,9 @@
         </template>
         <el-descriptions-item label="姓名">
           {{ setlinfo.name }}
-          <el-button @click="feiYongDrawer">{{
-            setlinfo.outDeptName
-          }}</el-button>
+          <el-button @click="feiYongDrawer"
+            >{{ setlinfo.outDeptName }}
+          </el-button>
           <ke-shi-fei-yong
             v-if="keShiFeiYongRef"
             :patNo="setlinfo.inpatientNo"
@@ -207,22 +207,22 @@
             :disabled="shenHeTongGuoFlag"
             type="success"
             @click="qualityTest('2')"
-            >审核通过</el-button
-          >
+            >审核通过
+          </el-button>
           <!--          <el-button :disabled="keFouShenHe" type="success" @click="shenHeTongGuoShangChuanClick">审核通过并上传-->
           <!--          </el-button>-->
           <el-button
             :disabled="keFouShenHe"
             type="danger"
             @click="shenHeBoHuiClick"
-            >审核驳回</el-button
-          >
+            >审核驳回
+          </el-button>
         </el-descriptions-item>
       </el-descriptions>
       <el-tag size="small">住院诊断信息</el-tag>
       <el-button icon="CirclePlus" type="success" @click="addZhenDuanClick"
-        >新增诊断</el-button
-      >
+        >新增诊断
+      </el-button>
       入院病情: 1.有,2.临床未确定,3.情况不明,4.无
       <el-table
         id="sortable-diseinfo"
@@ -274,8 +274,8 @@
               icon="Edit"
               type="warning"
               @click="xiuGaiZhenDuanClick(scope.$index, scope.row)"
-              >修改</el-button
-            >
+              >修改
+            </el-button>
             <el-popconfirm
               cancel-button-text="取消"
               confirm-button-text="确认"
@@ -286,8 +286,8 @@
             >
               <template #reference>
                 <el-button icon="Delete" size="small" type="danger"
-                  >删除</el-button
-                >
+                  >删除
+                </el-button>
               </template>
             </el-popconfirm>
           </template>
@@ -298,8 +298,8 @@
         icon="CirclePlus"
         type="success"
         @click="tianJiaXiuGaiShouShu(-1)"
-        >新增手术</el-button
-      >
+        >新增手术
+      </el-button>
       <el-table
         id="sortable-oprninfo"
         :data="oprninfo"
@@ -380,8 +380,8 @@
               icon="Edit"
               type="warning"
               @click="tianJiaXiuGaiShouShu(scope.$index)"
-              >修改</el-button
-            >
+              >修改
+            </el-button>
             <el-popconfirm
               cancel-button-text="取消"
               confirm-button-text="确认"
@@ -392,8 +392,8 @@
             >
               <template #reference>
                 <el-button icon="Delete" size="small" type="danger"
-                  >删除</el-button
-                >
+                  >删除
+                </el-button>
               </template>
             </el-popconfirm>
           </template>
@@ -401,8 +401,8 @@
       </el-table>
       <el-tag>患者输血信息</el-tag>
       <el-button icon="CirclePlus" type="success" @click="xinZhengShuXueXinXi"
-        >新增输血信息</el-button
-      >
+        >新增输血信息
+      </el-button>
       <el-table :data="patientBldInfos" :height="innerHeight / 3">
         <el-table-column label="输血品种" prop="bldCatName"></el-table-column>
         <el-table-column label="输血量" prop="bldAmt"></el-table-column>
@@ -414,8 +414,8 @@
               type="warning"
               @click="modifiedBloodTransfusion(scope.row)"
             >
-              修改</el-button
-            >
+              修改
+            </el-button>
             <el-popconfirm
               cancel-button-text="取消"
               confirm-button-text="确认"
@@ -426,8 +426,8 @@
             >
               <template #reference>
                 <el-button icon="Delete" size="small" type="danger"
-                  >删除</el-button
-                >
+                  >删除
+                </el-button>
               </template>
             </el-popconfirm>
           </template>
@@ -464,8 +464,8 @@
         @keyup.enter="zhenDuanChaXunClick"
       ></el-input>
       <el-button icon="Search" type="primary" @click="zhenDuanChaXunClick"
-        >查询</el-button
-      >
+        >查询
+      </el-button>
       诊断类别:
       <el-select v-model="lingShiZhenDuan.siDiagType" style="width: 120px">
         <el-option
@@ -521,8 +521,8 @@
             >
               <template #reference>
                 <el-button icon="CirclePlus" size="small" type="success"
-                  >新增</el-button
-                >
+                  >新增
+                </el-button>
               </template>
             </el-popconfirm>
             <el-popconfirm
@@ -536,8 +536,8 @@
             >
               <template #reference>
                 <el-button icon="Edit" size="small" type="warning"
-                  >修改</el-button
-                >
+                  >修改
+                </el-button>
               </template>
             </el-popconfirm>
           </template>
@@ -551,8 +551,8 @@
         上一页
       </el-button>
       <el-button @click="pageZhenDuanChaXun((diagnosticQuery.page += 1))"
-        >下一页</el-button
-      >
+        >下一页
+      </el-button>
     </el-dialog>
     <jie-suan-dan-xiu-gai-shou-shu
       v-if="shouShuDialog"
@@ -642,14 +642,14 @@
           v-show="quRenShenHeTongGuoFlag"
           type="primary"
           @click="queRenShenHeTongGuo"
-          >确认审核通过</el-button
-        >
+          >确认审核通过
+        </el-button>
         <el-button
           v-if="queRenBaoCunFlag"
           type="primary"
           @click="queRenbaoCunXiuGai()"
-          >确认保存</el-button
-        >
+          >确认保存
+        </el-button>
         <el-button
           v-if="zhiJieBaoCunFlag"
           type="primary"

+ 100 - 90
src/components/xiao-chan/select/XcSelect.vue

@@ -1,26 +1,33 @@
 <template>
-  <el-select v-model="modelObj"
-             :clearable="props.clearable"
-             :remote="props.remote"
-             :id="props.id"
-             :remote-method="xcMethod"
-             :style="{width: props.width + 'px'}"
-             ref="selectRef"
-             filterable
-             @change="(el) => changeStaff(el)"
-             @clear="clear"
-             @focus="getFocus">
-    <el-option v-for="(item,index) in props.data"
-               :key="item.index"
-               :label="item.name"
-               :value="item.code">
-      <template v-for="(opitem,index) in optionList" v-if="optionList.length > 0">
-        <el-divider v-if="index !== 0" direction='vertical'></el-divider>
+  <el-select
+    v-model="modelObj"
+    :clearable="props.clearable"
+    :remote="props.remote"
+    :id="props.id"
+    :remote-method="xcMethod"
+    :style="{ width: props.width + 'px' }"
+    ref="selectRef"
+    filterable
+    @change="el => changeStaff(el)"
+    @clear="clear"
+    @focus="getFocus"
+  >
+    <el-option
+      v-for="(item, index) in props.data"
+      :key="item.index"
+      :label="item.name"
+      :value="item.code"
+    >
+      <template
+        v-for="(opitem, index) in optionList"
+        v-if="optionList.length > 0"
+      >
+        <el-divider v-if="index !== 0" direction="vertical"></el-divider>
         <span :style="opitem.style">{{ item[opitem.label] }}</span>
       </template>
       <template v-else>
         <span>{{ item.code }}</span>
-        <el-divider direction='vertical'></el-divider>
+        <el-divider direction="vertical"></el-divider>
         <span>{{ item.name }}</span>
       </template>
     </el-option>
@@ -28,11 +35,11 @@
 </template>
 
 <script setup>
-import {debounce} from "@/utils/debounce";
-import {stringNotBlank} from "@/utils/blank-utils";
-import {onMounted, watch} from 'vue'
+import { debounce } from "@/utils/debounce";
+import { stringNotBlank } from "@/utils/blank-utils";
+import { onMounted, watch } from "vue";
 import useCompRef from "@/utils/useCompRef";
-import {ElSelect} from "element-plus";
+import { ElSelect } from "element-plus";
 
 const props = defineProps({
   modelValue: {
@@ -40,65 +47,69 @@ const props = defineProps({
   },
   name: {
     type: Array,
-    default: ['code', 'name']
+    default: ["code", "name"],
   },
   width: {
     type: Number,
-    default: 120
+    default: 120,
   },
   data: {
     type: Array,
-    default: []
+    default: [],
   },
   remote: {
     type: Boolean,
-    default: false
+    default: false,
   },
   clearable: {
     type: Boolean,
-    default: false
+    default: false,
   },
   id: {
-    type: String
-  }
-})
+    type: String,
+  },
+});
 
-const emit = defineEmits(['method', 'change', 'focus'])
+const emit = defineEmits(["method", "change", "focus"]);
 
-const modelObj = ref(null)
-const selectRef = useCompRef(ElSelect)
-const optionList = ref([])
+const modelObj = ref(null);
+const selectRef = useCompRef(ElSelect);
+const optionList = ref([]);
 const colorList = {
-  'primary': '#409eff',
-  'danger': '#f56c6c',
-  'info': '#8492a6',
-  'success': '#67C23A',
-  'warning': '#E6A23C'
-}
-
-const changeStaff = (el) => {
+  primary: "#409eff",
+  danger: "#f56c6c",
+  info: "#8492a6",
+  success: "#67C23A",
+  warning: "#E6A23C",
+};
+
+const changeStaff = el => {
   nextTick(() => {
-    props.modelValue[props.name[0]] = el
-    props.modelValue[props.name[1]] = selectRef.value?.states.selected?.currentLabel
-  })
-  emit('change', props.data.find((i) => i.code === modelObj.value))
-}
+    props.modelValue[props.name[0]] = el;
+    props.modelValue[props.name[1]] =
+      selectRef.value?.states.selected?.currentLabel;
+  });
+  emit(
+    "change",
+    props.data.find(i => i.code === modelObj.value)
+  );
+};
 
 const clear = () => {
-  modelObj.value = null
-  props.modelValue[props.name[0]] = null
-  props.modelValue[props.name[1]] = null
-}
+  modelObj.value = null;
+  props.modelValue[props.name[0]] = null;
+  props.modelValue[props.name[1]] = null;
+};
 
 const xcMethod = debounce(value => {
   if (stringNotBlank(value) && value.length > 1) {
-    method(value)
+    method(value);
   }
-}, 400)
+}, 400);
 
 const getFocus = () => {
-  emit('focus')
-}
+  emit("focus");
+};
 
 /**
  * 监听父组件的值是否改变
@@ -107,67 +118,66 @@ const getFocus = () => {
  * props.data 里面没有值对得上那就需要执行查询动作了
  *
  */
-watch(() => props.modelValue[props.name[0]], () => {
-  modelObj.value = props.modelValue[props.name[0]]
-  let len = props.data.length
-  if (len === 0) {
-    method(modelObj.value)
-  }
-  for (let i = 0; i < len; i++) {
-    if (modelObj.value === props.data[i].code) {
-      return
+watch(
+  () => props.modelValue[props.name[0]],
+  () => {
+    modelObj.value = props.modelValue[props.name[0]];
+    let len = props.data.length;
+    if (len === 0) {
+      method(modelObj.value);
+    }
+    for (let i = 0; i < len; i++) {
+      if (modelObj.value === props.data[i].code) {
+        return;
+      }
     }
+    method(modelObj.value);
   }
-  method(modelObj.value)
-})
+);
 
-const method = (value) => {
-  emit('method', value)
-}
+const method = value => {
+  emit("method", value);
+};
 
 const focus = () => {
-  selectRef.value.focus()
-}
+  selectRef.value.focus();
+};
 
 const blur = () => {
-  selectRef.value.blur()
-}
+  selectRef.value.blur();
+};
 
-defineExpose({focus, blur})
+defineExpose({ focus, blur });
 
 onMounted(() => {
-
   nextTick(() => {
-    modelObj.value = props.modelValue[props.name[0]]
-  })
+    modelObj.value = props.modelValue[props.name[0]];
+  });
 
   // 判断组件是否使用了 slot
   if (!!useSlots().default) {
     // 判断 slot 有没有想要的值
     for (let item of useSlots().default()) {
       if (item.props !== null) {
-        let style = {}
-        if (typeof item.props.style === 'undefined') {
-          if (typeof item.props.type === 'undefined') {
-            style = {'color': '#8492a6'}
+        let style = {};
+        if (typeof item.props.style === "undefined") {
+          if (typeof item.props.type === "undefined") {
+            style = { color: "#8492a6" };
           } else {
-            style = {'color': colorList[item.props.type]}
+            style = { color: colorList[item.props.type] };
           }
         } else {
-          style = item.props.style
+          style = item.props.style;
         }
         let data = {
           label: item.props.label,
           style: style,
-        }
-        optionList.value.push(data)
+        };
+        optionList.value.push(data);
       }
     }
   }
-})
-
+});
 </script>
 
-<style scoped>
-
-</style>
+<style scoped></style>

+ 45 - 34
src/views/data-base/page-editor-help-v2/components/page-editor-v2/PageEditorV2.vue

@@ -1,58 +1,69 @@
 <script setup lang="ts">
-import {ref, nextTick} from "vue";
+import { ref, nextTick } from "vue";
 import PageHelpV2 from "@/views/data-base/page-editor-help-v2/components/page-editor-v2/PageHelpV2.vue";
-import {pageHelpV2Mitt} from "@/views/data-base/page-editor-help-v2/page-help-v2";
-import {ReportForms} from "@/api/reports/report-query-center";
+import { pageHelpV2Mitt } from "@/views/data-base/page-editor-help-v2/page-help-v2";
+import { ReportForms } from "@/api/reports/report-query-center";
 import useCompRef from "@/utils/useCompRef";
 
 const props = defineProps<{
-  currentData: ReportForms
-}>()
+  currentData: ReportForms;
+}>();
 
-const componentAttributeRef = ref(null)
-const pageHelpRef = useCompRef(PageHelpV2)
-const tabsValue = ref('属性配置')
-const otherConfigurationsRef = ref()
-const componentPageHelp = ref<null>(null)
+const componentAttributeRef = ref(null);
+const pageHelpRef = useCompRef(PageHelpV2);
+const tabsValue = ref("属性配置");
+const otherConfigurationsRef = ref();
+const componentPageHelp = ref<any | null>(null);
 
-pageHelpV2Mitt.on('componentReady', (data) => {
-  componentPageHelp.value = data
-})
+pageHelpV2Mitt.on("componentReady", data => {
+  componentPageHelp.value = data;
+});
 
-pageHelpV2Mitt.on('doTestResult', (data, id, url) => {
+pageHelpV2Mitt.on("doTestResult", (data, id, url) => {
   if (props.currentData.id === id) {
-    pageHelpRef.value!.setTableData(data)
-    pageHelpRef.value!.setUrl(url)
+    pageHelpRef.value!.setTableData(data);
+    pageHelpRef.value!.setUrl(url);
   }
-})
+});
 
 function doTest(data) {
-  pageHelpV2Mitt.emit('doTest', props.currentData.id, data)
+  pageHelpV2Mitt.emit("doTest", props.currentData.id, data);
 }
 
 defineExpose({
   setPageData: async (value: any) => {
-    await nextTick()
-    pageHelpRef.value?.setPageData(value)
-  }
-})
+    await nextTick();
+    pageHelpRef.value?.setPageData(value);
+  },
+});
 </script>
 
 <template>
-  <div
-      class="layout_h-w_max layout_display_flex">
+  <div class="layout_h-w_max layout_display_flex">
     <div style="flex: 1; padding: 5px; width: 0">
-      <PageHelpV2 ref="pageHelpRef"
-                  :do-test="doTest"
-                  is-editor
-                  :addComponent="componentPageHelp"
-                  :other-configurations="otherConfigurationsRef"
-                  :componentAttribute="componentAttributeRef"
-                  @change-tabs="(val) => {tabsValue = val}"/>
-    </div>
-    <div style="width: 300px;border-left: 1px solid #000; height: 100%; overflow: auto"
-         ref="componentAttributeRef">
+      <PageHelpV2
+        ref="pageHelpRef"
+        :do-test="doTest"
+        is-editor
+        :addComponent="componentPageHelp"
+        :other-configurations="otherConfigurationsRef"
+        :componentAttribute="componentAttributeRef"
+        @change-tabs="
+          val => {
+            tabsValue = val;
+          }
+        "
+      />
     </div>
+    <div
+      style="
+        width: 300px;
+        border-left: 1px solid #000;
+        height: 100%;
+        overflow: auto;
+      "
+      ref="componentAttributeRef"
+    ></div>
   </div>
 </template>
 

+ 3 - 3
src/views/dictionary/orderZdMaintain/compoents/orderitem/EditorDialog.vue

@@ -7,9 +7,9 @@ import XEUtils from "xe-utils";
 
 const props = defineProps<{
   data: YzOrderItemDTO;
-  changeType: [];
-  ssType: [];
-  operations: [];
+  changeType: any[];
+  ssType: any[];
+  operations: any[];
 }>();
 
 const tmpData = ref(XEUtils.cloneDeep(props.data));