From 1737343f1ac89c5980a268775a201304c47151ca Mon Sep 17 00:00:00 2001
From: Tcsm <1377977403@qq.com>
Date: 星期二, 08 八月 2023 19:38:58 +0800
Subject: [PATCH] 个人模块的查看详情电子文件三键

---
 ruoyi-ui/src/views/self/show.vue |  154 ++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 116 insertions(+), 38 deletions(-)

diff --git a/ruoyi-ui/src/views/self/show.vue b/ruoyi-ui/src/views/self/show.vue
index 2ea3fd1..9bd7f95 100644
--- a/ruoyi-ui/src/views/self/show.vue
+++ b/ruoyi-ui/src/views/self/show.vue
@@ -1,5 +1,7 @@
 <template>
   <div class="app-container">
+    <!--  鍒锋柊椤甸潰  -->
+<!--    <MyComponent :key="componentKey" />-->
     <!--    鍥炲埌椤堕儴-->
     <el-backtop :bottom="150" :right="30">
       <el-button type="primary" circle
@@ -56,12 +58,12 @@
 <!--                  <el-input v-model="individualList.sex === 1 ? '鐢�':'濂�' " placeholder="" clearable :style="{width: '100%'}" :disabled="dsb">-->
 <!--                  </el-input>-->
                   <template v-if="!isEditing">
-                    <el-input v-model="individualList.sex === 1 ? '鐢�':'濂�'" placeholder="" clearable :style="{width: '100%'}" :disabled="dsb"></el-input>
+                    <el-input v-model="individualList.sex === 1 ? inds='鐢�':inds='濂�'" placeholder="" clearable :style="{width: '100%'}" :disabled="dsb"></el-input>
                   </template>
                   <template v-else>
-                    <el-select v-model="individualList.sex" placeholder="璇烽�夋嫨鎬у埆" clearable :style="{width: '100%'}">
-                      <el-option label="鐢�" value="1"></el-option>
-                      <el-option label="濂�" value="0"></el-option>
+                    <el-select v-model="inds" placeholder="璇烽�夋嫨鎬у埆" clearable :style="{width: '100%'}" :disabled="dsb">
+                      <el-option label="鐢�" value='1'></el-option>
+                      <el-option label="濂�" value='0'></el-option>
                     </el-select>
                   </template>
                 </el-form-item>
@@ -97,13 +99,14 @@
                   <template v-if="!isEditing" >
                     <el-input v-if="individualList.maritalStatus===0" placeholder="鏈"></el-input>
                     <el-input v-if="individualList.maritalStatus===1" placeholder="宸插"></el-input>
-                    <el-input v-if="individualList.maritalStatus===2" placeholder="绂诲"></el-input>
+                    <el-input v-if="individualList.maritalStatus===2" placeholder="鏈"></el-input>
+
                   </template>
                   <template v-else>
-                    <el-select v-model="individualList.maritalStatus" placeholder="璇烽�夋嫨鎬у埆" clearable :style="{width: '100%'}">
-                      <el-option label="鏈" value="0"></el-option>
-                      <el-option label="宸插" value="1"></el-option>
-                      <el-option label="绂诲" value="2"></el-option>
+                    <el-select v-model="mrs" placeholder="璇烽�夋嫨鎬у埆" clearable :style="{width: '100%'}">
+                      <el-option label="鏈" value='0'></el-option>
+                      <el-option label="宸插" value='1'></el-option>
+                      <el-option label="绂诲" value='2'></el-option>
                     </el-select>
                   </template>
                 </el-form-item>
@@ -239,7 +242,7 @@
       <div>
         <el-form v-loading="loading" :data="individualList" @selection-change="handleSelectionChange">
           <el-form-item label="鏄惁鎷ユ湁澶栫睄銆佸澶栧眳鐣欐潈銆侀暱鏈熷眳鐣欒鍙�" >
-            <el-radio-group v-model="individualList.outStatus" style="margin-bottom: 0;color: #FEF7FC;">
+            <el-radio-group v-model="individualList.outStatus" style="margin-bottom: 0;color: #FEF7FC;" :disabled="dsb">
               <el-radio :label="1">鏄�</el-radio>
               <el-radio :label="0">鍚�</el-radio>
             </el-radio-group>
@@ -266,7 +269,7 @@
           <div class="title-wrapper">
             涓昏瀛︿範鍙婂伐浣滅粡鍘�
             <div>
-            <el-button class="button" size="mini" type="text"  @click="showDialog('open')">
+            <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>
             </div>
           </div>
@@ -490,8 +493,12 @@
             <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;'>
+              <sapn v-html="'\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'"></sapn>
+            </el-button>
           </el-tab-pane>
         </el-tabs>
+
         <el-button size='mini' type="text" class="btn_autobiography" @click="showDialog('autobiography')" style='position: absolute;right:10px;top:5px;'>
           <sapn v-html="'\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'"></sapn>
         </el-button>
@@ -627,10 +634,16 @@
       </div>
     </el-dialog>
     <!--鏂板鑷紶-->
-    <el-dialog :title="title" :visible.sync="dialogVisible.autobiography" width="900px" append-to-body>
+    <el-dialog :title="isEdit1 ? '缂栬緫璁板綍' : '鏂板璁板綍'" :visible.sync="dialogVisible.autobiography" width="900px" append-to-body>
       <el-col >
         <el-form ref="elForm" :model="formDat" :rules="rules" size="medium" label-position="left" >
           <el-row :span="5">
+<!--            <el-form-item label="闇�瑕佷慨鏀圭殑璁板綍锛�" prop="id">-->
+<!--              <el-select v-model="formDat.id" placeholder="璇烽�夋嫨闇�瑕佷慨鏀圭殑璁板綍" clearable :style="{width: '50%'}"  >-->
+<!--                <el-option v-for="(item, index) in AutobiographyList" :key='item.id' :label="item.ageBegin+'~'+item.ageEnd+'宀�'+'('+item.term+')'"-->
+<!--                ></el-option>-->
+<!--              </el-select>-->
+<!--            </el-form-item>-->
             <el-form-item label="骞撮緞娈碉細" prop="ageBegin ageEnd" label-width="70px">
               <el-input v-model="formDat.ageBegin" placeholder="" clearable :style="{width: '20%'}" >
               </el-input>
@@ -675,8 +688,8 @@
   listExperience, addExperience, updateExperience, delExperience,
   getIndividualRelation, addRelation, updateRelation, delRelation,
   getCertificateList, addCertificate, updateCertificate, delCertificate,
-  getAbroadList, addAbroad,updateAbroad, delAbroad,
-  getAutobiographyList, getAutobiographyTermList, addAutobiography,
+  getAbroadList, addAbroad, updateAbroad, delAbroad,
+  getAutobiographyList, getAutobiographyTermList, addAutobiography,updateAutobiography,
   getCategory,
 } from "@/api/self/index";
 import { delFamilyevent, uploadPic } from '../../api/bignote'
@@ -687,6 +700,9 @@
 export default {
   name: "show",
   dicts: ['sys_normal_disable'],
+  // components: {
+  //   MyComponent
+  // },
   data() {
     return {
       // 閬僵灞�
@@ -694,8 +710,13 @@
 
       loading: true,
       formData:[],
+      componentKey: 0,
       // 閫変腑鏁扮粍
       ids: [],
+      //鎬у埆
+      inds:undefined,
+      //濠氬Щ绫诲埆
+      mrs:undefined,
       // 闈炲崟涓鐢�
       single: true,
       // 闈炲涓鐢�
@@ -766,15 +787,13 @@
       dateRange: [],
       // 鏁版嵁鑼冨洿閫夐」
       fot:[".jpg",".jif"],
-      fileList:[
-      ],
-      fileListOther:[
-
-      ],
+      fileList:[],
+      fileListOther:[],
       dsb:true,
       btn:false,
       isShow:true,
       isShow_2:false,
+      isEdit1:false,
       formDat: {
         //涓汉鍩烘湰淇℃伅
         nickName:undefined,
@@ -832,7 +851,6 @@
         term:undefined,
 
       },
-      AgeEnd:'',
       // 鑿滃崟鍒楄〃
       menuOptions: [],
       // 閮ㄩ棬鍒楄〃
@@ -949,6 +967,7 @@
         }],
 
       },
+      selectedOption:'',
       typeOptions:[],
       typeOption: [{
         value:'鎶ょ収',
@@ -974,8 +993,13 @@
       this.dialogVisible.relation1 = false;
       this.dialogVisible.certificate =false;
       this.dialogVisible.abroad=false;
-      this.dialogVisible.autobiography=false
+      this.dialogVisible.autobiography=false;
+      this.isEdit1 = false;
       this.reset();
+      // 娓呯┖formDat瀵硅薄鐨勬暟鎹�
+      Object.keys(this.formDat).forEach(key => {
+        this.formDat[key] = '';
+      });
     },
     //涓嬫媺
     handleChange(activeNames) {
@@ -991,6 +1015,18 @@
       // console.log(tab, event);
       this.getAutobiographyInfor();
       // this.getSrc1(typeOptions)
+    },
+    //涓汉鑷紶缂栬緫
+    editData(data) {
+      this.isEdit1 = true; // 璁剧疆涓虹紪杈戞搷浣�
+      // 灏嗚淇敼鐨勬暟鎹~鍏呭埌formDat瀵硅薄涓�
+      this.formDat.ageBegin = data.ageBegin;
+      this.formDat.ageEnd = data.ageEnd;
+      this.formDat.term = data.term;
+      this.formDat.content = data.content;
+
+      // 鎵撳紑寮圭獥
+      this.dialogVisible.autobiography = true;
     },
 
     //闅旇鍙樿壊
@@ -1013,11 +1049,6 @@
         return '鈥斺�斺�斺�斺�斺��'
       }
     },
-    getSrc1(term){
-      if(term==='7'){
-        return '鐮旂┒鐢�'
-      }
-    },
 
     /** 鏌ヨ瑙掕壊鍒楄〃 */
     getList() {
@@ -1032,7 +1063,6 @@
           this.total = response.data.total;
           this.loading = false;
         }
-
       );
       //鎴愬憳鍏崇郴
       getIndividualRelation(this.queryParams).then(response => {
@@ -1087,7 +1117,6 @@
       //   this.total = response.data.total;
       //   this.loading = false;
       // });
-
     },
 
     //鍥剧墖鐨勪笂浼犲強涓婁紶鎸夐挳闅愯棌
@@ -1200,7 +1229,12 @@
       this.isShow=false
       this.isShow_2=true
       this.isEditing=true
-      // this.isEdit=false
+      if(this.individualList.maritalStatus == 0)
+          this.mrs = '鏈'
+      else if(this.individualList.maritalStatus == 1)
+          this.mrs = '宸插'
+      else
+          this.mrs = '绂诲'// this.isEdit=false
     },
 
     /** 鏌ヨ鑷紶淇℃伅 */
@@ -1292,25 +1326,49 @@
         this.formDat[key] = '';
       });
     },
-    //涓汉鑷紶
+    //涓汉鑷紶鐨勪繚瀛�
     submitDataScope6: function() {
       this.$refs["elForm"].validate(valid => {
         if (valid) {
           // 鏍规嵁鍊兼壘鍒伴�変腑鐨勯�夐」瀵硅薄
           const selectedOption = this.typeOptions.find(option => option.value === this.formDat.term);
-          // 灏嗛�変腑閫夐」鐨勬枃鏈缃负"term"瀛楁鐨勫��
-          this.formDat.term = selectedOption.label;
-          addAutobiography(this.formDat).then(response => {
-            this.$modal.msgSuccess("鏂板鎴愬姛");
-            this.dialogVisible.autobiography = false;
-            this.getList();
-          });
+
+          if (this.isEdit1) {
+            // 鎵ц淇敼鎿嶄綔
+            updateAutobiography(this.formDat).then(response => {
+              // 灏嗛�変腑閫夐」鐨勬枃鏈缃负"term"瀛楁鐨勫��
+              this.formDat.term = selectedOption.label;
+              this.formDat.id = selectedOption.id;
+              console.log("1")
+              this.$modal.msgSuccess("淇敼鎴愬姛");
+              this.dialogVisible.autobiography = false;
+              this.isEdit1 = false;
+              this.getList();
+            }).catch(error => {
+              console.log(error);
+              this.isEdit1 = false;
+              this.dialogVisible.autobiography = false;
+            });
+          } else {
+            // 鎵ц鏂板鎿嶄綔
+            addAutobiography(this.formDat).then(response => {
+              this.formDat.term = selectedOption.label;
+              this.$modal.msgSuccess("鏂板鎴愬姛");
+              this.dialogVisible.autobiography = false;
+              this.getList();
+            }).catch(error => {
+              console.log(error);
+              this.dialogVisible.autobiography = false;
+            });
+          }
         }
       });
       // 娓呯┖formDat瀵硅薄鐨勬暟鎹�
       Object.keys(this.formDat).forEach(key => {
         this.formDat[key] = '';
       });
+      // 閲嶇疆isEdit涓篺alse锛屼互渚夸笅娆$偣鍑绘柊澧炴椂涓烘柊澧炴搷浣�
+      this.isEdit1 = false;
     },
 
     editRow(row) {
@@ -1320,6 +1378,16 @@
     //淇敼鍚庣殑淇濆瓨
     //涓汉鍩烘湰淇℃伅
     submitForm() {
+      if(this.inds=='1')
+        this.individualList.sex = 1;
+      else
+        this.individualList.sex = 0;
+      if(this.mrs=='0')
+        this.individualList.maritalStatus = 0
+      else if(this.mrs == '1')
+        this.individualList.maritalStatus = 1
+      else
+        this.individualList.maritalStatus = 2
       let ul = this.fileList.map(function (elem){
         return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"")
       }).join(",")
@@ -1333,8 +1401,14 @@
           if (this.individualList.userId !== undefined) {
             updateIndividual(this.individualList).then(response => {
               this.$modal.msgSuccess("淇敼鎴愬姛");
+              // 寮哄埗鏇存柊鐩稿叧缁勪欢
+              this.individualList={...this.individualList}
+
               // this.open = false;
+              this.dsb = true
               this.btn=false
+              this.isShow_2=false
+              this.isShow=true
             });
           } else {
             this.$modal.msgSuccess("淇敼澶辫触");
@@ -1343,7 +1417,7 @@
         }
       })
       // 鍒锋柊椤甸潰
-      window.location.reload();
+      // window.location.reload();
     },
     //涓昏缁忓巻
     saveRowExperienceList(row) {
@@ -1541,6 +1615,10 @@
 .btn_autobiography{
   background:center no-repeat url('../../assets/icons/add1.png') ;
 }
+.btn_edit{
+  background:center no-repeat url('../../assets/icons/edit.png') ;
+}
+
 .button {
   background:center no-repeat url('../../assets/icons/add1.png') ;
   margin-left: 69.5vw;

--
Gitblit v1.9.1