From 8b10791c5f8a48bfc694bc9219fda8390a78e935 Mon Sep 17 00:00:00 2001
From: miaojiale <1123971748@qq.com>
Date: Thu, 9 Feb 2023 15:13:34 +0800
Subject: [PATCH] =?UTF-8?q?1.=E6=95=B0=E6=8D=AE=E6=A6=82=E8=A7=88=E7=AD=9B?=
 =?UTF-8?q?=E6=9F=A5=E6=A6=82=E8=A7=88=E4=B8=8D=E4=BC=A0=202.=E6=8F=90?=
 =?UTF-8?q?=E4=BA=A4=E8=B7=B3=E8=BD=AC=E7=AD=9B=E6=9F=A5=E6=9F=A5=E8=AF=A2?=
 =?UTF-8?q?=EF=BC=8C=E6=9F=A5=E8=AF=A2=E5=BD=93=E5=89=8D=E6=95=B0=E6=8D=AE?=
 =?UTF-8?q?=203.=E7=AD=9B=E6=9F=A5=E6=9F=A5=E8=AF=A2=E4=BF=AE=E6=94=B9?=
 =?UTF-8?q?=E5=90=8E=E6=93=8D=E4=BD=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../CustomForm/FormItemText.vue               |  3 ++-
 src/store/modules/table.js                    |  5 ++++
 src/utils/index.js                            | 18 +++++++--------
 src/views/dataoverview/index.vue              |  4 +++-
 src/views/screening/DraftBox.vue              |  1 +
 .../screening/components/ConfigForms.vue      | 21 ++++++++++++-----
 src/views/screening/index.vue                 | 23 +++++++++++++++++++
 7 files changed, 58 insertions(+), 17 deletions(-)

diff --git a/src/components/FormComponents/CustomForm/FormItemText.vue b/src/components/FormComponents/CustomForm/FormItemText.vue
index 81b2b0f..5a69d21 100644
--- a/src/components/FormComponents/CustomForm/FormItemText.vue
+++ b/src/components/FormComponents/CustomForm/FormItemText.vue
@@ -77,7 +77,8 @@ export default {
   },
   watch: {
     unionList(v) {
-      if (v.length > 0) {
+      if (v.length > 0 && this.form[this.item.prop]) {
+        console.log()
         this.unionName = v.filter(
           (e) => e.unionNo == this.form[this.item.prop]
         )[0].unionName
diff --git a/src/store/modules/table.js b/src/store/modules/table.js
index e49519f..ed50400 100644
--- a/src/store/modules/table.js
+++ b/src/store/modules/table.js
@@ -1,10 +1,12 @@
 const state = {
   fontSize: localStorage.getItem("fontSize") || 1,
   selectedIndex: sessionStorage.getItem("selectedIndex") || "",
+  refreshFlag: 0,
 }
 const getters = {
   fontSize: (state) => state.fontSize,
   selectedIndex: (state) => state.selectedIndex,
+  refreshFlag: (state) => state.refreshFlag,
 }
 const mutations = {
   setFontSize(state, fontSize) {
@@ -18,6 +20,9 @@ const mutations = {
     state.selectedIndex = ""
     sessionStorage.removeItem("selectedIndex")
   },
+  setRefreshFlag(state, refreshFlag) {
+    state.refreshFlag = refreshFlag
+  },
 }
 const actions = {}
 export default {
diff --git a/src/utils/index.js b/src/utils/index.js
index c7f7c1c..1674bc9 100644
--- a/src/utils/index.js
+++ b/src/utils/index.js
@@ -153,7 +153,7 @@ export function getInfoByIdCard(idCard, type = "birthDate") {
     d.getFullYear() -
     birthdays.getFullYear() -
     (d.getMonth() < birthdays.getMonth() ||
-      (d.getMonth() == birthdays.getMonth() && d.getDate() < birthdays.getDate())
+    (d.getMonth() == birthdays.getMonth() && d.getDate() < birthdays.getDate())
       ? 1
       : 0)
 
@@ -182,12 +182,12 @@ export function paramObj(url) {
   }
   return JSON.parse(
     '{"' +
-    decodeURIComponent(search)
-      .replace(/"/g, '\\"')
-      .replace(/&/g, '","')
-      .replace(/=/g, '":"')
-      .replace(/\+/g, " ") +
-    '"}'
+      decodeURIComponent(search)
+        .replace(/"/g, '\\"')
+        .replace(/&/g, '","')
+        .replace(/=/g, '":"')
+        .replace(/\+/g, " ") +
+      '"}'
   )
 }
 
@@ -489,7 +489,7 @@ export function formatDicList(list, value, connector = ",") {
       }
     })
   }
-  console.log('å­—å…¸', list, value, result)
+  // console.log("å­—å…¸", list, value, result)
   return result
 }
 /**
@@ -523,7 +523,7 @@ export function changeTime(time) {
   let seconds = Math.floor(time % 60) //ç§’
   return `${day ? day + "天" : ""} ${hours ? hours + "小时" : ""}${
     minutes ? minutes + "分" : ""
-    }${seconds}ç§’`
+  }${seconds}ç§’`
 }
 
 export default { formatDicList, excelExport }
diff --git a/src/views/dataoverview/index.vue b/src/views/dataoverview/index.vue
index ef41627..28b973a 100644
--- a/src/views/dataoverview/index.vue
+++ b/src/views/dataoverview/index.vue
@@ -109,7 +109,9 @@ export default {
     },
     getPatientPage() {
       this.listLoading = true
-      let data = { patientFrom: this.selectedIndex }
+      let data = {
+        patientFrom: this.selectedIndex == "0" ? null : this.selectedIndex,
+      }
       getPatientPage(data).then((res) => {
         this.listLoading = false
         if (res.code === 1) {
diff --git a/src/views/screening/DraftBox.vue b/src/views/screening/DraftBox.vue
index 8cbed63..bdd6a99 100644
--- a/src/views/screening/DraftBox.vue
+++ b/src/views/screening/DraftBox.vue
@@ -145,6 +145,7 @@ export default {
   mounted() {},
   methods: {
     handleAdd({ patientId, name }, index, disabled = false) {
+      sessionStorage.removeItem("index1Data")
       this.disabled = disabled
       this.patientId = patientId || null
       this.name = name
diff --git a/src/views/screening/components/ConfigForms.vue b/src/views/screening/components/ConfigForms.vue
index 10b3404..07320da 100644
--- a/src/views/screening/components/ConfigForms.vue
+++ b/src/views/screening/components/ConfigForms.vue
@@ -58,10 +58,7 @@
       </el-tabs>
     </div>
     <el-empty v-else description="暂无数据"></el-empty>
-    <public-dialog
-      ref="showDialog"
-      :show-close="dialogType == 'draft' ? true : false"
-    >
+    <public-dialog ref="showDialog" :show-close="true">
       <!-- 保存草稿 -->
       <template v-if="dialogType == 'draft'" slot="content">
         <div class="title center">已保存至草稿箱!</div>
@@ -225,7 +222,7 @@ export default {
     },
     temporaryConfirm(data, done, cb) {
       this.addPatient(data, done, cb, () => {
-        console.log("倒了")
+        console.log("临时保存")
         this.$refs.showDialog.dialogVisible = true
         this.loading = false
       })
@@ -270,8 +267,20 @@ export default {
         this.$router.push("/screening/add")
       }
     },
+    // 去查看跳转
     viewJump() {
-      this.$router.push("/screening/index")
+      console.log(this.patientId)
+      if (this.$route.path == "/screening/index") {
+        this.$store.commit("table/setRefreshFlag", 1)
+      } else {
+        this.$router.push({
+          path: "/screening/index",
+          query: {
+            patientId: this.patientId || this.patientStandbyId,
+          },
+        })
+      }
+      this.$refs.showDialog.dialogVisible = false
       // alert("跳转")
     },
   },
diff --git a/src/views/screening/index.vue b/src/views/screening/index.vue
index 9e3bf66..2b7a8e5 100644
--- a/src/views/screening/index.vue
+++ b/src/views/screening/index.vue
@@ -257,6 +257,7 @@ export default {
       disabled = false,
       tabDisabled = true
     ) {
+      sessionStorage.removeItem("index1Data")
       this.disabled = disabled
       this.tabDisabled = tabDisabled
       this.patientId = patientId || null
@@ -306,6 +307,7 @@ export default {
   computed: {
     ...mapGetters({
       selectedIndex: "table/selectedIndex",
+      refreshFlag: "table/refreshFlag",
     }),
   },
   created() {
@@ -313,11 +315,32 @@ export default {
     // if (this.$route.path == "/screening/index") {
     //   this.tabDisabled = false
     // }
+    if (this.$route.query.patientId) {
+      let patientId = this.$route.query.patientId
+      // this.$nextTick(() => {
+      this.disabled = true
+      this.tabDisabled = false
+      this.patientId = patientId || null
+      this.isDetail = true
+      // })
+    }
   },
   watch: {
     selectedIndex(v) {
       this.handleFormSearch(this.searchForm)
     },
+    refreshFlag(v) {
+      if (v) {
+        this.$store.commit("table/setRefreshFlag", 0)
+        this.isDetail = false
+        this.$nextTick(() => {
+          this.handleAdd({
+            patientId: this.patientId,
+            name: "",
+          })
+        })
+      }
+    },
   },
 }
 </script>
-- 
2.22.0