xiaochan 1 年之前
父节点
当前提交
f2e664ca92

二进制
deps/element-plus.2.5.2.2.tar.gz


+ 5 - 1
src/components/cy/message-box/src/cy-message-box.ts

@@ -39,7 +39,11 @@ const iconData = {
     }
 }
 
-const messageInstance = new Map <string, { close: () => void }>
+declare type MapClose = {
+    close: () => void
+}
+
+const messageInstance = new Map<string, MapClose>();
 
 const MESSAGE_BOX_VARIANTS = ['alert', 'confirm', 'prompt'] as const
 const MESSAGE_BOX_DEFAULT_OPTS: {

+ 15 - 6
src/layout/HeaderV2/PasswordLayer.vue → src/components/system/password-layer/PasswordLayer.vue

@@ -1,7 +1,12 @@
 <template>
-  <el-dialog ref="dialog" :close-on-click-modal="false"
-             v-model="showLayer" title="修改密码" :close-on-press-escape="false"
-             :show-close="props.closable" width="360px">
+  <el-dialog ref="dialog"
+             @closed="emits('close')"
+             :close-on-click-modal="props.closable"
+             v-model="showLayer"
+             title="修改密码"
+             :close-on-press-escape="props.closable"
+             :show-close="props.closable"
+             width="360px">
     <el-form :model="form" :rules="rules" ref="ruleForm" label-width="120px" style="margin-right: 30px">
       <el-form-item label="用户名:" prop="name"> {{ username }}</el-form-item>
       <el-form-item label="原密码:" prop="old">
@@ -23,8 +28,9 @@
 
 <script setup>
 import {ref} from 'vue'
-import {useStore} from 'vuex'
 import {changePassword} from '@/api/settings/user-settings'
+import store from '@/store'
+import {ElDialog, ElForm, ElButton, ElFormItem, ElInput} from 'element-plus'
 
 const props = defineProps({
   closable: {
@@ -33,12 +39,14 @@ const props = defineProps({
   },
 })
 
+const emits = defineEmits(['close'])
+
 const showLayer = ref(true)
 const ruleForm = ref(null)
 const layerDom = ref(null)
-const store = useStore()
 const username = store.getters['user/info'].name
-let form = ref({
+
+const form = ref({
   codeRs: store.getters['user/info'].codeRs,
   name: '',
   old: '',
@@ -58,6 +66,7 @@ function submit() {
           newPassword: form.value.new,
         }
         changePassword(params).then(() => {
+          showLayer.value = false
           layerDom.value && layerDom.value.close()
           store.dispatch('user/logout')
         })

+ 19 - 0
src/components/system/password-layer/index.ts

@@ -0,0 +1,19 @@
+import PasswordLayer from './PasswordLayer.vue'
+import {render} from "vue";
+import {createVNode} from "vue";
+
+
+const changePassword = (closable: boolean = true) => {
+    const div = document.createElement('div')
+    document.body.appendChild(div)
+
+    function clear() {
+        render(null, div);
+        div.remove()
+    }
+
+    const vNode = createVNode(PasswordLayer, {closable, onClose: clear}, null)
+    render(vNode, div)
+}
+
+export default changePassword

+ 3 - 13
src/layout/HeaderV2/ToolInfoBar.vue

@@ -23,35 +23,25 @@
         <theme/>
       </div>
       <div class="function-list-item" style="width: auto; margin-left: 6px;padding: 0 6px" id="tutorial_user_info">
-        <user-info @password="showPasswordLayer" @logout="logout"/>
+        <user-info @password="changePassword" @logout="logout"/>
       </div>
     </div>
-    <!-- 修改密码 -->
-    <password-layer />
   </div>
 </template>
 
-<script setup name='ToolInfoBar' lang="ts">
-import {ref} from 'vue'
+<script setup lang="ts">
 import {useStore} from 'vuex'
 import Download from './function-list/Download.vue'
 import Message from './function-list/Message.vue'
 import FullScreen from './function-list/Fullscreen.vue'
 import SizeChange from './function-list/SizeChange.vue'
-import PasswordLayer from './PasswordLayer.vue'
 import UserInfo from "./function-list/user-info/UserInfo.vue";
 import ScrollNotifications from "./ScrollNotifications.vue";
 import Theme from "./function-list/Theme.vue";
-
+import changePassword from "@/components/system/password-layer";
 
 const store = useStore()
 
-const showLayer = ref(false)
-
-const showPasswordLayer = () => {
-  showLayer.value = true
-}
-
 const logout = () => {
   store.dispatch('user/logout')
 }

+ 1 - 5
src/views/hospitalization/zhu-yuan-yi-sheng/yi-zhu-lu-ru/components/DoctorAuthorization.vue

@@ -63,23 +63,19 @@ onMounted(() => {
                 @closed="cancel"
                 @confirm="confirm"
                 @cancel="cancel">
-
     <el-alert type="warning">
       药品分为限制等级,可通过上级医生授权的方式开出大于自身等级的药品,输入上级医生的工号和密码后,点击确认即可,请注意电子确认后该医嘱会变成这个医生开的,请不要在此医嘱上进行修改不然这条医嘱会变成另外一个医生的,如果开错了,删除重新开。。
     </el-alert>
     <hr>
     <el-form>
-
       <el-form-item label="工号:">
         <el-input v-model="param.codeRs"/>
       </el-form-item>
 
       <el-form-item label="密码:">
-        <el-input v-model="param.password" type="password"/>
+        <el-input v-model="param.password" class="security"/>
       </el-form-item>
-
     </el-form>
-
   </xc-dialog-v2>
 
 </template>

+ 111 - 199
src/views/settings/UserInfo.vue

@@ -20,7 +20,7 @@
               <div class="clearfix">
                 <span>个人信息</span>
                 <el-button style="float: right; padding: 3px 0" text @click="quitLogin">退出账号</el-button>
-                <el-button style="float: right; padding: 3px 0; margin-right: 10px" text @click="dialogVisible = true">
+                <el-button style="float: right; padding: 3px 0; margin-right: 10px" text @click="changePassword">
                   修改密码
                 </el-button>
               </div>
@@ -79,20 +79,6 @@
         </div>
       </div>
     </div>
-    <el-dialog title="修改密码" v-model="dialogVisible" width="360px">
-      <el-input v-model="changePwdParam.oldPassword" type="password" show-password
-                placeholder="请输入旧密码"></el-input>
-      <div style="margin-top: 20px"></div>
-      <el-input v-model="changePwdParam.newPassword" type="password" show-password
-                placeholder="请输入新密码"></el-input>
-      <div style="margin-top: 20px"></div>
-      <el-input v-model="changePwdParam.newPasswordCopy" type="password" show-password
-                placeholder="请重复新密码"></el-input>
-      <template #footer>
-        <el-button type="info" icon="RefreshLeft" @click="closeDialog">取消</el-button>
-        <el-button type="primary" icon="Check" @click="confirmDialog">确定</el-button>
-      </template>
-    </el-dialog>
     <el-dialog title="建议详情" v-model="showCurrentAdvice" width="380px">
       <div class="advice-detail">
         <div><span>当前状态:</span>{{ filterStatusText(currentAdvice.statusFlag) }}</div>
@@ -116,10 +102,9 @@
   </el-container>
 </template>
 
-<script>
-import {computed, onActivated, onDeactivated, reactive, ref} from 'vue'
+<script setup>
+import {computed, onActivated, onDeactivated, ref} from 'vue'
 import {
-  changePassword,
   checkAdvice,
   dismissUserBadge,
   getMyAdvices,
@@ -133,197 +118,124 @@ import router from '@/router'
 import Cookies from 'js-cookie'
 import store from '@/store'
 import {setCallback} from '@/utils/websocket'
+import changePassword from "@/components/system/password-layer";
 
-export default {
-  setup() {
-    const windowSize = store.state.app.windowSize
-    const adviceBoxStyle = {
-      height: windowSize.h / 2 + 'px',
-      padding: '0 5px',
-      overflowY: 'auto',
-    }
-    const userInfo = ref({})
-    const isAdmin = computed(() => {
-      return userInfo.value.roles.indexOf(1) > -1
-    })
-    const errorHandler = () => {
-      return true
-    }
-    const makeTextPortrait = () => {
-      return genTextPortrait(userInfo.value.name)
-    }
-    const dialogVisible = ref(false)
-    const changePwdParam = reactive({
-      oldPassword: '',
-      newPassword: '',
-      newPasswordCopy: '',
-    })
-    const closeDialog = () => {
-      dialogVisible.value = false
-      changePwdParam.oldPassword = changePwdParam.newPassword = changePwdParam.newPasswordCopy = ''
-    }
-    const confirmDialog = () => {
-      if (!changePwdParam.oldPassword) {
-        ElMessage({
-          message: '请输入旧密码!',
-          type: 'warning',
-          duration: 2500,
-          showClose: true,
-        })
-        return
-      }
-      if (!changePwdParam.newPassword) {
-        ElMessage({
-          message: '请输入新密码!',
-          type: 'warning',
-          duration: 2500,
-          showClose: true,
-        })
-        return
-      }
-      if (changePwdParam.newPassword !== changePwdParam.newPasswordCopy) {
-        ElMessage({
-          message: '两次输入的新密码不一致,请检查!',
-          type: 'warning',
-          duration: 2500,
-          showClose: true,
-        })
-        return
-      }
-      changePassword(changePwdParam).then(() => {
-        ElMessageBox.alert('修改成功,请重新登录。', '提示', {
-          type: 'success',
-        }).then(() => {
-          quitLogin()
-        }).catch(() => {
-          quitLogin()
-        })
-      })
-    }
-    const quitLogin = () => {
-      Cookies.remove('token')
-      router.push('/login')
-    }
-    const currentStatus = ref('')
-    const myAdvices = ref([])
-    const cptAdvices = computed(() => {
-      return myAdvices.value.filter((item) => {
-        return item.statusFlag.toString().indexOf(currentStatus.value) !== -1
-      })
-    })
-    const currentAdvice = ref({})
-    const showCurrentAdvice = ref(false)
-    const newAdvice = () => {
-      ElMessageBox.prompt('请填写建议内容(不超过300个字)', '新建议', {
-        confirmButtonText: '提交',
-        cancelButtonText: '取消',
-        type: 'info',
-      }).then(({value}) => {
-        submitNewAdvice({submitContent: value}).then(() => {
-          getMyAdvices().then((res) => {
-            myAdvices.value = res
-            ElMessage({
-              message: '提交成功',
-              type: 'success',
-              duration: 2000,
-              showClose: true,
-            })
-          })
-        })
-      })
-    }
-    const filterStatusType = (val) => {
-      switch (val) {
-        case 0:
-          return 'info'
-        case 1:
-          return 'primary'
-        case 2:
-          return 'success'
-        default:
-          return 'error'
-      }
-    }
-    const filterStatusText = (val) => {
-      switch (val) {
-        case 0:
-          return '未查看'
-        case 1:
-          return '已查看'
-        case 2:
-          return '已回复'
-        default:
-          return '未知状态'
-      }
-    }
-    const seeAdviceDetail = (item) => {
-      currentAdvice.value = item
-      showCurrentAdvice.value = true
-      if (item.statusFlag === 0 && isAdmin.value) {
-        checkAdvice(item.id).then(() => {
-          item.statusFlag = 1
-        })
-      }
-      if (item.statusFlag === 2 && !isAdmin.value) {
-        dismissUserBadge(item.id).then(() => {
-          item.userBadge = 0
-        })
-      }
-    }
-    const replyAdvice = () => {
-      updateReply(currentAdvice.value).then(() => {
-        currentAdvice.value.statusFlag = 2
-        showCurrentAdvice.value = false
-      })
-    }
 
-    const callback = () => {
+const windowSize = store.state.app.windowSize
+const adviceBoxStyle = {
+  height: windowSize.h / 2 + 'px',
+  padding: '0 5px',
+  overflowY: 'auto',
+}
+const userInfo = ref({})
+const isAdmin = computed(() => {
+  return userInfo.value.roles.indexOf(1) > -1
+})
+const errorHandler = () => {
+  return true
+}
+const makeTextPortrait = () => {
+  return genTextPortrait(userInfo.value.name)
+}
+const quitLogin = () => {
+  Cookies.remove('token')
+  router.push('/login')
+}
+const currentStatus = ref('')
+const myAdvices = ref([])
+const cptAdvices = computed(() => {
+  return myAdvices.value.filter((item) => {
+    return item.statusFlag.toString().indexOf(currentStatus.value) !== -1
+  })
+})
+const currentAdvice = ref({})
+const showCurrentAdvice = ref(false)
+const newAdvice = () => {
+  ElMessageBox.prompt('请填写建议内容(不超过300个字)', '新建议', {
+    confirmButtonText: '提交',
+    cancelButtonText: '取消',
+    type: 'info',
+  }).then(({value}) => {
+    submitNewAdvice({submitContent: value}).then(() => {
       getMyAdvices().then((res) => {
         myAdvices.value = res
-      })
-    }
-
-    onActivated(() => {
-      getUserInfo().then((res) => {
-        userInfo.value = res
-        getMyAdvices().then((res2) => {
-          myAdvices.value = res2
-          setCallback(callback)
-          if (isAdmin.value) {
-            currentStatus.value = '0'
-          }
+        ElMessage({
+          message: '提交成功',
+          type: 'success',
+          duration: 2000,
+          showClose: true,
         })
       })
     })
-
-    onDeactivated(() => {
-      setCallback(null)
+  })
+}
+const filterStatusType = (val) => {
+  switch (val) {
+    case 0:
+      return 'info'
+    case 1:
+      return 'primary'
+    case 2:
+      return 'success'
+    default:
+      return 'error'
+  }
+}
+const filterStatusText = (val) => {
+  switch (val) {
+    case 0:
+      return '未查看'
+    case 1:
+      return '已查看'
+    case 2:
+      return '已回复'
+    default:
+      return '未知状态'
+  }
+}
+const seeAdviceDetail = (item) => {
+  currentAdvice.value = item
+  showCurrentAdvice.value = true
+  if (item.statusFlag === 0 && isAdmin.value) {
+    checkAdvice(item.id).then(() => {
+      item.statusFlag = 1
+    })
+  }
+  if (item.statusFlag === 2 && !isAdmin.value) {
+    dismissUserBadge(item.id).then(() => {
+      item.userBadge = 0
     })
+  }
+}
+const replyAdvice = () => {
+  updateReply(currentAdvice.value).then(() => {
+    currentAdvice.value.statusFlag = 2
+    showCurrentAdvice.value = false
+  })
+}
 
-    return {
-      userInfo,
-      isAdmin,
-      adviceBoxStyle,
-      errorHandler,
-      makeTextPortrait,
-      dialogVisible,
-      changePwdParam,
-      closeDialog,
-      confirmDialog,
-      quitLogin,
-      myAdvices,
-      newAdvice,
-      filterStatusType,
-      filterStatusText,
-      currentAdvice,
-      seeAdviceDetail,
-      showCurrentAdvice,
-      replyAdvice,
-      currentStatus,
-      cptAdvices,
-    }
-  },
+const callback = () => {
+  getMyAdvices().then((res) => {
+    myAdvices.value = res
+  })
 }
+
+onActivated(() => {
+  getUserInfo().then((res) => {
+    userInfo.value = res
+    getMyAdvices().then((res2) => {
+      myAdvices.value = res2
+      setCallback(callback)
+      if (isAdmin.value) {
+        currentStatus.value = '0'
+      }
+    })
+  })
+})
+
+onDeactivated(() => {
+  setCallback(null)
+})
 </script>
 
 <style scoped>