From 6f6e804a48c822f339e1974cfe482bc2f60227a3 Mon Sep 17 00:00:00 2001
From: linwenling <3256558519@qq.com>
Date: 星期一, 25 九月 2023 12:42:08 +0800
Subject: [PATCH] 修改健康保健

---
 ruoyi-ui/src/views/self/show.vue |  150 ++++++++++++++++++++++++++++++++-----------------
 1 files changed, 98 insertions(+), 52 deletions(-)

diff --git a/ruoyi-ui/src/views/self/show.vue b/ruoyi-ui/src/views/self/show.vue
index 69b3d57..2259c78 100644
--- a/ruoyi-ui/src/views/self/show.vue
+++ b/ruoyi-ui/src/views/self/show.vue
@@ -1,5 +1,5 @@
 <template>
-  <div class="app-container">
+  <div class="app-container" id="printable-content">
     <!--  鍒锋柊椤甸潰  -->
 <!--    <MyComponent :key="componentKey" />-->
     <!--    鍥炲埌椤堕儴-->
@@ -35,6 +35,7 @@
             size="mini"
             style=" width: 67px;height: 27px;background: #FFDDE3;
             border-radius: 7px 7px 7px 7px;opacity: 1; margin-left: 20px;"
+            v-print="'#printable-content'"
             v-hasPermi="['family:note:export']"
           >鎵撳嵃</el-button>
       </div>
@@ -286,7 +287,7 @@
       <el-collapse-item name="1"  >
         <template v-slot:title>
           <div class="title-wrapper">
-            涓昏瀛︿範鍙婂伐浣滅粡鍘�
+            <div class="left-content">涓昏瀛︿範鍙婂伐浣滅粡鍘�</div>
             <div>
             <el-button class="button" size="mini" type="text"  @click="showDialog('open')" >
               <sapn v-html="'\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'"></sapn></el-button>
@@ -340,9 +341,9 @@
       <el-collapse-item name="2" >
         <template v-slot:title>
           <div class="title-wrapper">
-            瀹跺涵鎴愬憳鍙婁富瑕佺ぞ浼氬叧绯绘儏鍐�
+            <div class="left-content">瀹跺涵鎴愬憳鍙婁富瑕佺ぞ浼氬叧绯绘儏鍐�</div>
             <div>
-            <el-button class="button2" size="mini" type="text"  @click="showDialog('relation1')">
+            <el-button class="button" size="mini" type="text"  @click="showDialog('relation1')">
               <sapn v-html="'\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'"></sapn></el-button>
             </div>
           </div>
@@ -395,8 +396,8 @@
       <el-collapse-item  name="4">
         <template v-slot:title>
           <div class="title-wrapper">
-            鎸佹湁璇佷欢鎯呭喌
-            <el-button class="button4" size="mini" type="text"  @click="showDialog('certificate')">
+            <div class="left-content">鎸佹湁璇佷欢鎯呭喌</div>
+            <el-button class="button" size="mini" type="text"  @click="showDialog('certificate')">
               <sapn v-html="'\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'"></sapn></el-button>
           </div>
         </template>
@@ -460,8 +461,8 @@
       <el-collapse-item  name="5">
         <template v-slot:title>
           <div class="title-wrapper">
-            鍑哄浗锛堝锛夋儏鍐�
-            <el-button class="button5" size="mini" type="text"  @click="showDialog('abroad')">
+            <div class="left-content">鍑哄浗锛堝锛夋儏鍐�</div>
+            <el-button class="button" size="mini" type="text"  @click="showDialog('abroad')">
               <sapn v-html="'\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'"></sapn></el-button>
           </div>
         </template>
@@ -513,9 +514,9 @@
       <el-collapse-item  name="6">
         <template v-slot:title>
           <div class="title-wrapper">
-            鑷紶
+            <div class="left-content">鑷紶</div>
             <div>
-              <el-button size='mini' type="text" class="btn_autobiography" @click="showDialog('autobiography')" >
+              <el-button size='mini' type="text" class="button" @click="showDialog('autobiography')" >
                 <sapn v-html="'\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'"></sapn>
               </el-button>
             </div>
@@ -527,16 +528,17 @@
                      v-loading="loading" :data="AutobiographyList" >
               <el-tab-pane v-for="(item, index) in AutobiographyList"
                            :key='item.id' :label="item.ageBegin+'~'+item.ageEnd+'宀�'+'('+item.term+')'">
-                <div v-if="item.term === '濠村効'"> {{item.content}}</div>
-                <div v-if="item.term === '骞煎効'"> {{item.content}}</div>
-                <div v-if="item.term === '灏忓'"> {{item.content}}</div>
-                <div v-if="item.term === '鍒濅腑'"> {{item.content}}</div>
-                <div v-if="item.term === '楂樹腑'"> {{item.content}}</div>
-                <div v-if="item.term === '澶у'"> {{item.content}}</div>
-                <div v-if="item.term === '鐮旂┒鐢�'"> {{item.content}}</div>
-                <div v-if="item.term === '宸ヤ綔'"> {{item.content}}</div>
-                <div v-if="item.term === '缁撳鍚�'"> {{item.content}}</div>
-                <el-button size='mini' type="text" class="btn_edit" @click="editData(item)" style='position: absolute;right:10px;top:5px;'>
+                <div>{{ item.content }}</div>
+<!--                <div v-if="item.term === '濠村効'"> {{item.content}}</div>-->
+<!--                <div v-if="item.term === '骞煎効'"> {{item.content}}</div>-->
+<!--                <div v-if="item.term === '灏忓'"> {{item.content}}</div>-->
+<!--                <div v-if="item.term === '鍒濅腑'"> {{item.content}}</div>-->
+<!--                <div v-if="item.term === '楂樹腑'"> {{item.content}}</div>-->
+<!--                <div v-if="item.term === '澶у'"> {{item.content}}</div>-->
+<!--                <div v-if="item.term === '鐮旂┒鐢�'"> {{item.content}}</div>-->
+<!--                <div v-if="item.term === '宸ヤ綔'"> {{item.content}}</div>-->
+<!--                <div v-if="item.term === '缁撳鍚�'"> {{item.content}}</div>-->
+                <el-button size='mini' type="text" class="btn_edit" @click="editAutobiography(item)" style='position: absolute;right:10px;top:5px;'>
                   <sapn v-html="'\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'"></sapn>
                 </el-button>
               </el-tab-pane>
@@ -626,10 +628,12 @@
           </el-input>
         </el-form-item>
         <el-form-item label="璇佷欢绫诲瀷" prop="type">
-          <el-select v-model="formDat.type" placeholder="璇烽�夋嫨绫诲瀷" clearable :style="{width: '100%'}"  >
+          <el-select v-model="formDat.type" placeholder="璇烽�夋嫨璇佷欢绫诲瀷" clearable :style="{width: '100%'}"  >
             <el-option v-for="(item, index) in typeOption" :key="index" :label="item.label" :value="item.value"
             ></el-option>
           </el-select>
+          <el-input v-model="newOption" v-if="showInput" placeholder="鑻ユ湭鍦ㄤ笂杩伴�夐」涓壘鍒板搴旂被鍨嬶紝璇峰湪姝よ緭鍏ユ柊鐨勮瘉浠剁被鍨�" @change="addNewOption"></el-input>
+
         </el-form-item>
         <el-form-item label="鎸佹湁鎯呭喌" prop="ownStatus">
           <el-input v-model="formDat.ownStatus" placeholder="璇疯緭鍏ユ寔鏈夋儏鍐�" clearable :style="{width: '100%'}" >
@@ -705,10 +709,12 @@
               <span> 宀� </span>
           </el-form-item>
             <el-form-item label="鏃舵湡锛�" prop="term">
-              <el-select v-model="formDat.term" placeholder="璇烽�夋嫨鏃舵湡" clearable :style="{width: '50%'}"  >
-                <el-option v-for="(item, index) in typeOptions" :key="index" :label="item.label" :value="item.value"
-                ></el-option>
-              </el-select>
+<!--              <el-select v-model="formDat.term" placeholder="璇烽�夋嫨鏃舵湡" clearable :style="{width: '50%'}"  >-->
+<!--                <el-option v-for="(item, index) in typeOptions" :key="index" :label="item.label" :value="item.value"-->
+<!--                ></el-option>-->
+<!--              </el-select>-->
+              <el-input v-model="formDat.term"  placeholder="璇疯緭鍏ユ椂鏈�" clearable :style="{width: '100%'}" >
+              </el-input>
             </el-form-item>
             <el-form-item label="鍐呭缂栬緫锛�" prop="content">
               <el-input v-model="formDat.content" type="textarea" :rows="5" placeholder="" clearable :style="{width: '100%'}" >
@@ -734,12 +740,11 @@
 import axios from 'axios';
 
 //鍦╯ystem/note/index.js涓鍏ユ帴鍙e嚱鏁�  --鎺ュソ浜�
-import {
-  getIndividualList, addIndividual, updateIndividual, delIndividual,
+import {getIndividualList, addIndividual, updateIndividual, delIndividual,
   listExperience, addExperience, updateExperience, delExperience,
   getIndividualRelation, addRelation, updateRelation, delRelation,
   getCertificateList, addCertificate, updateCertificate, delCertificate,
-  getAbroadList, addAbroad, updateAbroad, delAbroad,
+  getAbroadList, addAbroad, updateAbroad, delAbroad,listType,
   getAutobiographyList, getAutobiographyTermList, addAutobiography,updateAutobiography,
   getCategory,
 } from "@/api/self/index";
@@ -791,6 +796,7 @@
       relationList:[],
       //鍑哄叆澧冭瘉浠舵儏鍐�
       certificateList:[],
+      typeList:[],
       //鍑哄浗鎯呭喌
       AbroadList:[],
 
@@ -999,7 +1005,7 @@
         //鑷紶
         term: [{
           required: true,
-          message: '璇烽�夋嫨鏃舵湡',
+          message: '璇疯緭鍏ユ椂鏈�',
           trigger: 'blur'
         }],
         ageBegin: [{
@@ -1016,16 +1022,9 @@
       },
       selectedOption:'',
       typeOptions:[],
-      typeOption: [{
-        value:'鎶ょ収',
-        label:'鎶ょ収'
-      },{
-        value:'閫氳璇�',
-        label:'閫氳璇�'
-      },{
-        value:'韬唤璇�',
-        label:'韬唤璇�'
-      }],
+      typeOption:[],
+      newOption: undefined,
+      showInput: true
     };
   },
   created() {
@@ -1080,6 +1079,11 @@
       // 鎵撳紑寮圭獥
       this.dialogVisible.autobiography = true;
     },
+    editAutobiography(item) {
+      this.isEdit1 = true;
+      this.dialogVisible.autobiography = true;
+      this.formDat = { ...item };
+    },
 
     //闅旇鍙樿壊
     tableRowClassName({ row, rowIndex }) {
@@ -1101,7 +1105,14 @@
         return '鈥斺�斺�斺�斺�斺��'
       }
     },
-
+//绫诲埆
+    addNewOption() {
+      const newOption = this.newOption.trim();
+      if (newOption && !this.typeOption.includes(newOption)) {
+        this.typeOption.push(newOption);
+        this.$set(this.formDat, 'type', newOption); // 鏇存柊formDat.type鐨勫�间负鏂扮殑閫夐」
+      }
+    },
     /** 鏌ヨ瑙掕壊鍒楄〃 */
     getList() {
       this.loading = true;
@@ -1112,7 +1123,7 @@
           //  alert(123)
           //   console.log(response.data)
           this.experienceList = response.data;
-          this.total = response.data.total;
+          // this.total = response.data.total;
           this.loading = false;
         }
       );
@@ -1121,7 +1132,7 @@
           //  alert(123)
           //   console.log(response.data)
           this.relationList = response.data;
-          this.total = response.data.total;
+          // this.total = response.data.total;
           this.loading = false;
         }
       );
@@ -1130,7 +1141,7 @@
           //  alert(123)
           //   console.log(response.data)
           this.individualList = response.data;
-          this.total = response.data.total;
+          // this.total = response.data.total;
           this.loading = false;
         }
       );
@@ -1139,7 +1150,7 @@
           //  alert(123)
           //   console.log(response.data)
           this.certificateList = response.data;
-          this.total = response.data.total;
+          // this.total = response.data.total;
           this.loading = false;
         }
       );
@@ -1148,7 +1159,7 @@
           //  alert(123)
           //   console.log(response.data)
           this.AbroadList = response.data;
-          this.total = response.data.total;
+          // this.total = response.data.total;
           this.loading = false;
         }
       );
@@ -1157,7 +1168,7 @@
         //  alert(123)
         //   console.log(response.data)
         this.AutobiographyList = response.data;
-        this.total = response.data.total;
+        // this.total = response.data.total;
         this.loading = false;
 
       });
@@ -1169,6 +1180,32 @@
       //   this.total = response.data.total;
       //   this.loading = false;
       // });
+      listType(this.queryParams).then(response => {
+          this.typeList = response.data;
+          // this.total = response.data.total;
+          // console.log( this.typeList )
+          // 鍦ㄥ洖璋冨嚱鏁颁腑璋冪敤 getTypeOptions()
+          this.getTypeOptions();
+          this.loading = false;
+        }
+      );
+    },
+    getTypeOptions() {
+      const filteredOptions = this.typeList.filter(item => typeof item === 'string' && item !== '');
+      // 鍒涘缓涓�涓┖瀵硅薄鐢ㄤ簬瀛樺偍鍞竴鐨勫瓧绗︿覆閫夐」
+      const uniqueOptions = {};
+      // 鏋勫缓涓嬫媺閫夐」鍒楄〃
+      this.typeOption = filteredOptions.reduce((options, option) => {
+        if (!uniqueOptions[option]) {
+          uniqueOptions[option] = true;
+          options.push({
+            label: option,
+            value: option
+          });
+        }
+        return options;
+      }, []);
+
     },
 
     //鍥剧墖鐨勪笂浼犲強涓婁紶鎸夐挳闅愯棌
@@ -1376,14 +1413,14 @@
       this.$refs["elForm"].validate(valid => {
         if (valid) {
           // 鏍规嵁鍊兼壘鍒伴�変腑鐨勯�夐」瀵硅薄
-          const selectedOption = this.typeOptions.find(option => option.value === this.formDat.term);
+          // const selectedOption = this.typeOptions.find(option => option.value === this.formDat.term);
 
           if (this.isEdit1) {
             // 鎵ц淇敼鎿嶄綔
             updateAutobiography(this.formDat).then(response => {
               // 灏嗛�変腑閫夐」鐨勬枃鏈缃负"term"瀛楁鐨勫��
-              this.formDat.term = selectedOption.label;
-              this.formDat.id = selectedOption.id;
+              // this.formDat.term = selectedOption.value;
+              // this.formDat.id = selectedOption.id;
               console.log("1")
               this.$modal.msgSuccess("淇敼鎴愬姛");
               this.dialogVisible.autobiography = false;
@@ -1397,7 +1434,7 @@
           } else {
             // 鎵ц鏂板鎿嶄綔
             addAutobiography(this.formDat).then(response => {
-              this.formDat.term = selectedOption.label;
+              // this.formDat.term = selectedOption.label;
               this.$modal.msgSuccess("鏂板鎴愬姛");
               this.dialogVisible.autobiography = false;
               this.getList();
@@ -1696,10 +1733,17 @@
 
 .el-collapse-item__header {
   background-color:#FEF7FC;
+  width: 100%;
 }
 .title-wrapper {
   display: flex;
   justify-content: space-between;
+  align-items: center;
+  width: calc(100% - 50px);
+}
+.left-content {
+
+  width: 100%;
 }
 .btn_autobiography{
   background:center no-repeat url('../../assets/icons/add1.png') ;
@@ -1718,8 +1762,10 @@
 }
 .button {
   background:center no-repeat url('../../assets/icons/add1.png') ;
-  margin-left: 69.5vw;
-
+  /*margin-right: -10px ;*/
+  flex-shrink: 0;
+  width: 30px;
+  height: 28px;
 }
 .button2 {
   background: center no-repeat url('../../assets/icons/add1.png') ;

--
Gitblit v1.9.1