From 4b1fbea0d8099259ea7d0ef10bd7633c3bc62f2e Mon Sep 17 00:00:00 2001
From: feige <791364011@qq.com>
Date: 星期二, 17 十二月 2024 17:43:08 +0800
Subject: [PATCH] 修改了对应的bug

---
 ruoyi-ui/src/views/marry/index.vue |  151 ++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 109 insertions(+), 42 deletions(-)

diff --git a/ruoyi-ui/src/views/marry/index.vue b/ruoyi-ui/src/views/marry/index.vue
index 228acc9..6adaecd 100644
--- a/ruoyi-ui/src/views/marry/index.vue
+++ b/ruoyi-ui/src/views/marry/index.vue
@@ -26,7 +26,7 @@
               </el-row>
               <el-row :span="16">
                 <el-form-item label="鍑虹敓鏃ユ湡" prop="birthday" label-width="75px">
-                
+
                   <el-date-picker v-model="marryList.birthday"
                                   type="date"
                                   placeholder="璇烽�夋嫨鏃ユ湡"
@@ -223,7 +223,7 @@
         <el-container >
 
 
-          <el-row :gutter="10" class="mb8">
+          <el-row :gutter="10" class="mb8" v-if="userId != 2">
             <el-col  >
               <el-button
                 plain
@@ -276,10 +276,10 @@
           <template v-slot:title>
             <h2 style="font-size:16px ">鍓嶄换鎯呭喌</h2>
             <div class="title-wrapper">
-              <div>
+             <!-- <div>
                 <el-button class="button" size="mini" type="text"  @click="handleAdd">
-                  <sapn v-html="'\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'"></sapn></el-button>
-              </div>
+                  <span v-html="'\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'"></span></el-button>
+              </div> -->
 
 
             </div>
@@ -295,8 +295,8 @@
               <template slot-scope="scope">
                 <template v-if="!scope.row.isEdit">{{ scope.row.sex }}</template>
                 <template v-else><el-select v-model="scope.row.sex" placeholder="璇烽�夋嫨">
-                  <el-option label="濂�" value="0"></el-option>
-                  <el-option label="鐢�" value="1"></el-option>
+                 <el-option label="濂�" value='濂�'></el-option>
+                  <el-option label="鐢�" value='鐢�'></el-option>
                 </el-select></template>
               </template>
             </el-table-column>
@@ -340,11 +340,9 @@
                   <span v-if="scope.row.marryStatus== 1">鍒濆</span>
                   <span v-if="scope.row.marryStatus== 2">绂诲</span>
                   <span v-if="scope.row.marryStatus== 3">鍐嶅</span></template>
-                <template v-else>  <el-select v-model="qianren" placeholder="璇烽�夋嫨">
-                  <el-option label="鏈" value="0"></el-option>
-                  <el-option label="鍒濆" value="1"></el-option>
-                  <el-option label="绂诲" value="2"></el-option>
-                  <el-option label="鍐嶅" value="3"></el-option>
+                <template v-else>  <el-select v-model="qianren" placeholder="璇烽�夋嫨" @change="getMarryStatus">
+                  <el-option v-for="item in qianrenOptions"
+                    :key="item.value" :label="item.label" :value="item.value"/>
                 </el-select></template>
               </template>
             </el-table-column>
@@ -358,7 +356,7 @@
               </template>
             </el-table-column>
             <!-- 鎿嶄綔 -->
-            <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width">
+            <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width" v-if="userId != 2">
               <template slot-scope="scope" v-if="scope.row.roleId !== 1">
                 <el-button size="mini" type="text" icon="el-icon-edit" v-if="!editStatus[scope.row.id]"
                            @click="editRow(scope.row)" v-hasPermi="['system:role:edit']">淇敼</el-button>
@@ -539,13 +537,15 @@
 import { treeselect as menuTreeselect, roleMenuTreeselect } from "@/api/system/menu";
 import {listMarry,updateMarry,delMarryOld,addMarryOld,updateMarryOld} from "@/api/marry/index";
 import { blobValidate } from '../../utils/ruoyi'
+import {getInfo} from "@/api/login";
 
 export default {
-  name: "show",
+  name: "ZMarry",
   dicts: ['sys_normal_disable'],
   data() {
     return {
-
+      qianren:undefined,
+userId: undefined,
       showOldSpouse:false,//鏄剧ず鍓嶄换淇℃伅
       // 閬僵灞�
       disabled: false,
@@ -570,6 +570,7 @@
       limitCountImg:1,//涓婁紶鍥剧墖鐨勬渶澶ф暟閲�
       //涓汉淇℃伅鏁版嵁
       marryList:{
+        id:undefined,
         name:undefined,
         sex:undefined,
         birthday:undefined,
@@ -602,11 +603,14 @@
       activeNames:['1'],
       // 寮瑰嚭灞傛爣棰�
       title: "",
+      iddd:undefined,
       // 鏄惁鏄剧ず寮瑰嚭灞�
       open: false,
       // open:true,
       // 鏄惁鏄剧ず寮瑰嚭灞傦紙鏁版嵁鏉冮檺锛�
       bear:undefined,
+      handsj:undefined,
+      onebear:undefined,
       mrs:undefined,
       smrs:undefined,
       openDataScope: false,
@@ -670,13 +674,13 @@
       },
       // 琛ㄥ崟鏍¢獙
       rules: {
-        id: [{
-          required: true,
+        idNo: [{
+          // required: true,
           message: '璇疯緭鍏ヨ韩浠借瘉鍙风爜',
           trigger: 'blur'
         }],
         name: [{
-          required: true,
+          // required: true,
           message: '璇疯緭鍏ュ鍚�',
           trigger: 'blur'
         }],
@@ -686,7 +690,7 @@
           trigger: 'change'
         }],
         marryStatus: [{
-          required: true,
+          // required: true,
           message: '璇烽�夋嫨濠氬Щ鐘跺喌',
           trigger: 'change'
         }],
@@ -721,13 +725,41 @@
           value: '3',
           label: '鍐嶅',
         },],
+
+        qianrenOptions:[
+          {
+            value: '0',
+            label: '鏈',
+          },
+            {
+              value: '1',
+              label: '鍒濆',
+            },
+            {
+              value: '2',
+              label: '绂诲',
+            },
+            {
+              value: '3',
+              label: '鍐嶅',
+            }
+        ],
+
+
     };
   },
   created() {
     this.getList()
+    this.getInfo()
   },
   methods: {
-
+    getInfo(){
+          console.log('-----------------')
+          getInfo().then(response=>{
+            console.log(response.user.roles[0].roleId,'roleID')
+            this.userId = response.user.roles[0].roleId
+          })
+        },
     handleMarryStatusChange() {
       // 鍒ゆ柇褰撳墠閫変腑鐨勫濮荤姸鎬佹槸鍚︿负鍐嶅
       if (this.mrs === '3') {
@@ -751,6 +783,7 @@
     cancelData() {
       this.open = false;
       this.reset();
+
     },
     //涓嬫媺
     handleChange(val) {
@@ -765,9 +798,9 @@
 
 
     getList() {
-      this.loading = false;
+      this.loading = true;
       //涓汉淇℃伅
-      listMarry(this.queryParams).then(response => {
+      listMarry().then(response => {
 
           if(response.data.length === 0){
             this.loading = false;
@@ -780,7 +813,9 @@
             this.oldSpouseList = this.marryList.oldSpouseList;
             console.log(111)
             console.log("淇℃伅")
-            console.log(this.marryList.marryStatus);
+            console.log(this.marryList,'1111111111111111111');
+            this.iddd = this.marryList.id
+            console.log(this.iddd,'2222222222222')
 			//alert(this.marryList.bearStatus)
             if(this.marryList.marryStatus===3){
               this.showOldSpouse = true;
@@ -831,7 +866,7 @@
           deptCheckStrictly: true,
           remark: undefined
         };
-      this.resetForm("form");
+      this.resetForm("elForm");
     },
 
 
@@ -941,11 +976,12 @@
     },
 
     editRow(row) {
-      if(this.oldSpouseList.marryStatus == 0)
+
+      if(row.marryStatus == '0')
         this.qianren = '鏈'
-      else if(this.oldSpouseList.marryStatus == 1)
+      else if(row.marryStatus == '1')
         this.qianren = '鍒濆'
-      else if(this.oldSpouseList.marryStatus == 2)
+      else if(row.marryStatus == '2')
         this.qianren = '绂诲'
       else
         this.qianren = '鍐嶅'// this.isEdit=false
@@ -959,9 +995,7 @@
         this.marryList.marryStatus = parseInt(this.mrs)
       if(this.smrs!=undefined)
         this.marryList.spouseMarryStatus = parseInt(this.smrs)
-	  // console.log(this.bear)
-	  // alert(this.bear)
-	  // if( parseInt(this.bear))
+
       if(this.bear!=undefined)
         this.marryList.bearStatus = parseInt(this.bear)
 
@@ -969,7 +1003,10 @@
       this.marryList.handbookStatus =parseInt(this.handsj)
       this.marryList.sex = this.sinds
       this.marryList.spouseSex = this.inds
+      console.log(this.marryList,'marryListmarryListmarryListmarryList')
+      // this.marryList.id = this.iddd
       this.$refs['elForm'].validate(valid => {
+        // alert(valid)
         if (valid) {
           if (this.marryList.id !== undefined) {
             updateMarry(this.marryList).then(response => {
@@ -980,6 +1017,7 @@
               this.dsb = true
               this.isShow_2=false
               this.isShow = true
+              this.getList()
 
             }).catch(error => {
               console.error(error);
@@ -991,24 +1029,51 @@
           }
         }
       })
+      this.getList()
       // 鍒锋柊椤甸潰
       // window.location.reload();
+    },
+    getMarryStatus(value){
+      // alert(value)
+      if(value == '0')
+        this.qianren = '鏈'
+      else if(value == '1')
+        this.qianren = '鍒濆'
+      else if(value == '2')
+        this.qianren = '绂诲'
+      else
+        this.qianren = '鍐嶅'// this.isEdit=false
     },
     //鍓嶄换淇敼
     saveRowmarryList(row) {
       this.$refs['elForm'].validate(valid => {
 
-        console.log(this.oldSpouseList)
+        console.log(this.oldSpouseList,'oldSpouseListoldSpouseListoldSpouseListoldSpouseList')
         if (valid) {
+
+          if(this.qianren == '鏈')
+            row.marryStatus = 0
+          else if(this.qianren == '鍒濆')
+            row.marryStatus = 1
+          else if(this.qianren == '绂诲')
+            row.marryStatus = 2
+          else
+            row.marryStatus = 3
           this.marryList.oldSpouseList =  this.oldSpouseList
 
           const foundIndex = this.oldSpouseList.findIndex(item => item.id === row.id);
           if (foundIndex !== -1) {
+
+            this.marryList.oldSpouseList[foundIndex].marryStatus = Number(this.marryList.oldSpouseList[foundIndex].marryStatus)
+            // alert(this.marryList.oldSpouseList[foundIndex].marryStatus)
+
             const updatedData = Object.assign({}, this.marryList.oldSpouseList[foundIndex], row);
             updateMarryOld(updatedData).then(response => {
+
               this.oldSpouseList = this.marryList.oldSpouseList
               this.$modal.msgSuccess("淇敼鎴愬姛");
-              console.log(updatedData)
+              console.log(updatedData,'updatedDataupdatedDataupdatedData')
+              console.log(response,'responseresponseresponseresponse')
               this.getList();
               // console.log(this.oldSpouseList)
             }).catch(error => {
@@ -1023,7 +1088,8 @@
       this.$set(row, 'isEdit', false);
       this.$set(this.editStatus, row.id, false);
     },
-
+handleSelectionChange()
+{},
     //闅旇鍙樿壊
     tableRowClassName({ row, rowIndex }) {
       if (rowIndex % 2 == 0) {
@@ -1034,24 +1100,25 @@
     },
     /** 鍒犻櫎鍓嶄换 */
     handleDelete(row) {
-      console.log(this.oldSpouseList)
+      // console.log(this.oldSpouseList,'123123123123')
       const id = row.id || this.oldSpouseList.id
+
       console.log(id)
 
       this.$modal.confirm('鏄惁纭鍒犻櫎鎵�閫夋暟鎹」锛�').then(function() {
-        return delMarryOld({id});
-      }).then(() => {
-        this.oldSpouseList = this.oldSpouseList.filter(item => item.id !== id);
-        this.marryList.oldSpouseList=this.oldSpouseList
-        console.log(this.marryList.oldSpouseList)
+        return delMarryOld(id);
+      }).then((res) => {
+        console.log(res)
+        // this.oldSpouseList = this.oldSpouseList.filter(item => item.id !== id);
+        // this.marryList.oldSpouseList=this.oldSpouseList
+        // console.log(this.marryList.oldSpouseList,'oldSpouseListoldSpouseListoldSpouseList1')
 
-        console.log(this.oldSpouseList)
+        // console.log(this.oldSpouseList,'oldSpouseListoldSpouseListoldSpouseList2')
         this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
         this.getList();
-
+        console.log(this.marryList.oldSpouseList,'oldSpouseListoldSpouseListoldSpouseList1')
         // window.location.reload();
       }).catch(() => {});
-
     },
 
     /** 瀵煎嚭鎸夐挳鎿嶄綔 */

--
Gitblit v1.9.1