From f6ba10af9f368f251de29e77ba88d5ad33bc31d6 Mon Sep 17 00:00:00 2001
From: feige <feige@qq.com>
Date: 星期二, 13 一月 2026 14:54:37 +0800
Subject: [PATCH] 修改了代码

---
 ruoyi-ui/src/views/collection/collectionInfo.vue |  385 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 383 insertions(+), 2 deletions(-)

diff --git a/ruoyi-ui/src/views/collection/collectionInfo.vue b/ruoyi-ui/src/views/collection/collectionInfo.vue
index 150afef..b550896 100644
--- a/ruoyi-ui/src/views/collection/collectionInfo.vue
+++ b/ruoyi-ui/src/views/collection/collectionInfo.vue
@@ -53,10 +53,74 @@
               </el-form-item>
              </el-col>
              <el-col >
-              <el-form-item label="鎸佹湁鑰�" prop="owner" label-width="65px" style="background: #FAD1E0;border-radius: 7px 7px 7px 7px;opacity: 1;">
+           <!--   <el-form-item label="鎸佹湁鑰�" prop="owner" label-width="65px" style="background: #FAD1E0;border-radius: 7px 7px 7px 7px;opacity: 1;">
                 <el-input v-model="formData.owner" placeholder="璇疯緭鍏ユ寔鏈夎��" clearable :style="{width: '100%'}" :disabled="dsb">
                 </el-input>
+              </el-form-item> -->
+
+              <el-form-item label="瀹舵棌鎴愬憳" prop="selectedMemberIds">
+                <!-- 宸查�夋垚鍛樺洖鏄惧尯鍩� -->
+                <div v-if="selectedMemberNames.length > 0" class="selected-members">
+                  <el-tag
+                    v-for="(name, index) in selectedMemberNames"
+                    :key="index"
+                    closable
+                    @close="handleTagClose(index)"
+                  >
+                    {{ name }}
+                  </el-tag>
+                </div>
+                <!-- 瑙﹀彂寮圭獥鎸夐挳 -->
+                 <div style="display: flex; align-items: center;" v-if="!dsb" >
+                <el-button
+                  type="primary"
+                  icon="el-icon-user-plus"
+                  @click="openMemberDialog"
+                  :disabled="loading"
+                >
+                  閫夋嫨瀹舵棌鎴愬憳
+                </el-button>
+                 </div>
               </el-form-item>
+
+
+             </el-col>
+             <el-col>
+               <!-- 鍏跺畠浜烘樉绀哄尯鍩� -->
+               <el-form-item label="鍏跺畠浜�">
+                 <!-- 宸查�夊叾瀹冧汉鏍囩鏄剧ず -->
+                 <div v-if="otherPeople.length > 0" class="selected-members" style="display: inline-block; vertical-align: middle; margin-right: 10px;">
+                   <el-tag
+                     v-for="(name, index) in otherPeople"
+                     :key="index"
+                     closable
+                     @close="handleOtherPeopleTagClose(index)"
+                   >
+                     {{ name }}
+                   </el-tag>
+                 </div>
+                 <!-- 缂栬緫鎸夐挳 -->
+                 <el-button
+                   v-if="!dsb"
+                   type="primary"
+                   icon="el-icon-edit"
+                   size="mini"
+                   @click="openOtherPeopleDialog"
+                 >
+                   缂栬緫鍏跺畠浜�
+                 </el-button>
+               </el-form-item>
+
+             </el-col>
+             <el-col>
+               <el-form-item label="鏄惁闅愯棌" prop="isHide">
+               
+                    <el-radio-group v-model="formData.isHide" :style="{width: '100%'}">
+                      <el-radio label="鏄�">鏄�</el-radio>
+                      <el-radio label="鍚�">鍚�</el-radio>
+                    </el-radio-group>
+               
+               </el-form-item>
              </el-col>
              <el-col >
                <el-form-item label="浠峰��" prop="price" label-width="50px" style="background: #FAD1E0;border-radius: 7px 7px 7px 7px;opacity: 1;">
@@ -219,6 +283,109 @@
         </el-dialog>
 
 
+
+    <el-dialog
+      :visible.sync="memberDialogVisible"
+      title="閫夋嫨瀹舵棌鎴愬憳"
+      width="50%"
+      :close-on-click-modal="false"
+    >
+      <!-- 寮圭獥鍐呭鍖� -->
+      <div class="member-dialog-content">
+        <!-- 鎼滅储妗� -->
+        <el-input
+          v-model="memberSearch"
+          placeholder="鎼滅储鎴愬憳濮撳悕..."
+          prefix-icon="el-icon-search"
+          style="margin-bottom: 20px;"
+        ></el-input>
+
+
+
+        <!-- 鍔犺浇鐘舵�� -->
+       <div v-if="loading" class="loading-container">
+          <el-loading-spinner></el-loading-spinner>
+          <p>鍔犺浇瀹舵棌鎴愬憳涓�...</p>
+        </div>
+
+       <div v-else-if="familyMembers.length === 0" class="no-data">
+          <el-empty description="鏆傛棤瀹舵棌鎴愬憳鏁版嵁"></el-empty>
+        </div>
+<label v-for="item in familyMembers" :key="item.userId" class="signature-checkbox">
+     <input type="checkbox" v-model="selectedMemberIds" :value="item.userId">
+                                 <span>{{ item.oldName }}</span>
+                  </label>
+                  <hr class="divider-line">
+
+                  <label v-for="item in anotherFamilyMembers" :key="item.userId" class="signature-checkbox">
+                    <input type="checkbox" v-model="selectedMemberIds" :value="item.userId">
+                    <span> {{ item.oldName }} </span>
+                  </label>
+
+        <!-- 澶氶�夊垪琛紙鏈夋暟鎹級 -->
+<!--    <el-checkbox-group>
+         <el-checkbox
+
+
+          >
+          4545
+
+         </el-checkbox>
+        </el-checkbox-group> -->
+
+</div>
+      <!-- 寮圭獥搴曢儴鎸夐挳 -->
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="memberDialogVisible = false">鍙栨秷</el-button>
+        <el-button type="primary" @click="confirmMemberSelection">纭閫夋嫨</el-button>
+      </div>
+    </el-dialog>
+
+    <!-- 鍏跺畠浜虹紪杈戝脊绐� -->
+    <el-dialog
+      :visible.sync="otherPeopleDialogVisible"
+      title="缂栬緫鍏跺畠浜�"
+      width="500px"
+      :close-on-click-modal="false"
+      @close="handleOtherPeopleDialogClose"
+    >
+      <!-- 宸叉坊鍔犵殑鍏跺畠浜烘爣绛� -->
+      <div v-if="tempOtherPeople.length > 0" class="selected-members" style="margin-bottom: 20px;">
+        <el-tag
+          v-for="(name, index) in tempOtherPeople"
+          :key="index"
+          closable
+          @close="handleTempOtherPeopleTagClose(index)"
+        >
+          {{ name }}
+        </el-tag>
+      </div>
+
+      <!-- 娣诲姞杈撳叆妗� -->
+      <div style="display: flex; align-items: center;">
+        <el-input
+          v-model="otherPeopleInput"
+          placeholder="璇疯緭鍏ュ鍚嶏紝鎸夊洖杞︽垨鐐瑰嚮娣诲姞"
+          clearable
+          style="flex: 1; margin-right: 10px;"
+          @keyup.enter.native="addOtherPeople"
+        ></el-input>
+        <el-button
+          type="primary"
+          icon="el-icon-plus"
+          @click="addOtherPeople"
+        >
+          娣诲姞
+        </el-button>
+      </div>
+
+      <!-- 寮圭獥搴曢儴鎸夐挳 -->
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="otherPeopleDialogVisible = false">鍙栨秷</el-button>
+        <el-button type="primary" @click="confirmOtherPeople">瀹屾垚</el-button>
+      </div>
+    </el-dialog>
+
   </div>
 </template>
 
@@ -229,12 +396,27 @@
 import {Message} from "element-ui";
 import {addRole, updateRole} from "@/api/system/role";
 import {getCollection, updateCollection,download,uploadPic,listType} from "@/api/collection/index";
+import { getFamilyMembers ,listAnotherFamilyInfo} from '@/api/root'; // 鍋囪鑾峰彇瀹舵棌鎴愬憳鐨凙PI
 
 export default {
   components: {},
   props: [],
   data() {
     return {
+
+
+      // 鎴愬憳澶氶�夌浉鍏�
+      memberDialogVisible: false, // 寮圭獥鍙鎬�
+      familyMembers: [], // 瀹舵棌鎴愬憳鍒楄〃锛堝師濮嬫暟鎹級
+      anotherFamilyMembers: [], //鍙﹀瀹舵棌鎴愬憳淇℃伅
+      selectedMemberIds: [], // 寮圭獥涓复鏃堕�変腑鐨勬垚鍛業D锛堢敤浜庡閫変氦浜掞級
+      displayMemberNames: [], // 鏄剧ず鐢ㄧ殑鎴愬憳鍚嶇О鏁扮粍
+      otherPeople: [], // 鍏跺畠浜哄垪琛�
+      tempOtherPeople: [], // 寮圭獥涓复鏃剁紪杈戠殑鍏跺畠浜哄垪琛�
+      otherPeopleInput: '', // 鍏跺畠浜鸿緭鍏ユ鍐呭
+      otherPeopleDialogVisible: false, // 鍏跺畠浜哄脊绐楀彲瑙佹��
+      memberSearch: '', // 鎴愬憳鎼滅储鍏抽敭璇�
+      loading: false, // 鍔犺浇鐘舵��
       cdi:"鏀惰棌涓庤崳瑾夎缁嗕俊鎭�",
       udi:"鏀惰棌涓庤崳瑾変俊鎭鎯�",
     // 鏁版嵁鑼冨洿閫夐」
@@ -323,7 +505,51 @@
       showInput: false
     }
   },
-  computed: {},
+  computed: {
+       // 宸查�夋垚鍛樺鍚嶏紙鐢ㄤ簬鍥炴樉锛�
+       selectedMemberNames() {
+       //  alert(this.familyMembers.length)
+        // 浼樺厛浣跨敤鐩存帴璁剧疆鐨勬樉绀哄悕绉�
+        if(this.displayMemberNames && this.displayMemberNames.length > 0 && this.selectedMemberIds.length==0) {
+          return this.displayMemberNames;
+        }
+
+        // 鍚﹀垯鏍规嵁閫変腑鐨処D璁$畻
+        // 鍚堝苟杩囨护鍚庣殑鎴愬憳鍚嶇О鍜宒isplayMemberNames鍐呭
+        const filteredNames = this.familyMembers
+          .filter(member => this.selectedMemberIds.includes(member.userId))
+         .map(member => member.oldName);
+  const filterAnotherNames = this.anotherFamilyMembers
+        .filter(member => this.selectedMemberIds.includes(member.userId))
+        .map(member => member.oldName);
+
+        // 鍒涘缓涓�涓猄et鏉ュ瓨鍌ㄥ敮涓�鍚嶇О锛岄伩鍏嶉噸澶�
+        const uniqueNames = new Set([...filteredNames]);
+filterAnotherNames.forEach(item => uniqueNames.add(item));
+
+        // 濡傛灉displayMemberNames鏈夊唴瀹癸紝涔熷姞鍏et涓�
+        if(this.displayMemberNames && this.displayMemberNames.length > 0) {
+          this.displayMemberNames.forEach(name => uniqueNames.add(name));
+        }
+      else
+        this.displayMemberNames = Array.from(uniqueNames)
+        // 杞洖鏁扮粍骞惰繑鍥�
+        return Array.from(uniqueNames);
+      },
+    // 杩囨护鍚庣殑鎴愬憳鍒楄〃锛堟悳绱㈠姛鑳斤級
+    filteredMembers() {
+      if (!this.memberSearch) return this.familyMembers;
+      console.log(this.familyMembers)
+      console.log("-sdf")
+      const keyword = this.memberSearch.toLowerCase();
+      return this.familyMembers;
+      //.filter(member =>
+     //   member.filteredMembers.toLowerCase().includes(keyword)
+        //||
+     //   member.role.toLowerCase().includes(keyword)
+    //  );
+    }
+  },
   watch: {},
   created() {
     const id = this.$route.params && this.$route.params.id;
@@ -392,6 +618,7 @@
            }
         }
         this.loading = false;
+        this.splitPeopleToSelectedNames(this.formData.owner);
       });
       listType(this.queryParams).then(response => {
           this.typeList = response.data;
@@ -408,6 +635,156 @@
   },
   mounted() {},
   methods: {
+    handleTagClose(index, name) {
+        // 浠� selectedMemberNames 鏁扮粍涓Щ闄ゅ綋鍓嶅叧闂殑鏍囩鍚嶇О
+      //  const index = this.selectedMemberNames.findIndex(item=== name);
+      selectedMemberIds: this.selectedMemberIds.filter(
+          item => item!== index  // 杩囨护鎺変笌鍏抽棴鍚嶇О鐩稿悓鐨勫厓绱�
+        )
+        this.$forceUpdate();
+        console.log(this.selectedMemberIds)
+        this.selectedMemberNames.splice(index, 1);
+        this.$forceUpdate();
+      selectedMemberNames: this.selectedMemberNames.filter(
+          item => item !== name  // 杩囨护鎺変笌鍏抽棴鍚嶇О鐩稿悓鐨勫厓绱�
+        )
+        console.log(this.selectedMemberNames)
+
+      },
+      // 绉婚櫎鍏跺畠浜烘爣绛�
+      handleOtherPeopleTagClose(index) {
+        const removedName = this.otherPeople[index];
+        this.otherPeople.splice(index, 1);
+        this.$message.info(`宸茬Щ闄�: ${removedName}`);
+      },
+
+      // 鎵撳紑鍏跺畠浜虹紪杈戝脊绐�
+      openOtherPeopleDialog() {
+        // 澶嶅埗褰撳墠鍏跺畠浜哄垪琛ㄥ埌涓存椂鍒楄〃
+        this.tempOtherPeople = [...this.otherPeople];
+        this.otherPeopleInput = '';
+        this.otherPeopleDialogVisible = true;
+      },
+
+      // 寮圭獥鍐呮坊鍔犲叾瀹冧汉
+      addOtherPeople() {
+        const name = this.otherPeopleInput.trim();
+        if (!name) {
+          this.$message.warning('璇疯緭鍏ュ鍚�');
+          return;
+        }
+        if (this.tempOtherPeople.includes(name)) {
+          this.$message.warning('璇ュ鍚嶅凡娣诲姞');
+          return;
+        }
+        this.tempOtherPeople.push(name);
+        this.otherPeopleInput = '';
+        this.$message.success(`宸叉坊鍔�: ${name}`);
+      },
+
+      // 寮圭獥鍐呯Щ闄ゅ叾瀹冧汉鏍囩
+      handleTempOtherPeopleTagClose(index) {
+        const removedName = this.tempOtherPeople[index];
+        this.tempOtherPeople.splice(index, 1);
+        this.$message.info(`宸茬Щ闄�: ${removedName}`);
+      },
+
+      // 纭瀹屾垚锛堜繚瀛樺脊绐椾腑鐨勬洿鏀癸級
+      confirmOtherPeople() {
+        if (this.tempOtherPeople.length > 0) {
+          this.$message.success(`宸蹭繚瀛� ${this.tempOtherPeople.length} 鍚嶅叾瀹冧汉`);
+        } else {
+          this.$message.info('鏈坊鍔犱换浣曞叾瀹冧汉');
+        }
+        this.otherPeople = [...this.tempOtherPeople];
+        this.otherPeopleDialogVisible = false;
+      },
+
+      // 鍏跺畠浜哄脊绐楀叧闂鐞�
+      handleOtherPeopleDialogClose() {
+        this.otherPeopleInput = '';
+        // 涓嶄繚瀛樹复鏃跺垪琛ㄧ殑鏇存敼
+      },
+      // 纭閫夋嫨鎴愬憳锛堜繚瀛樺埌琛ㄥ崟锛�
+      confirmMemberSelection() {
+        console.log(this.selectedMemberIds)
+        this.formData.selectedMemberIds = [...this.selectedMemberIds];
+        console.log(this.formData.selectedMemberIds)
+         // 灏嗗脊绐楅�変腑鐨処D鍚屾鍒拌〃鍗�
+        this.memberDialogVisible = false;
+        this.$message.info(`宸查�夋嫨 ${this.selectedMemberNames.length} 鍚嶅鏃忔垚鍛榒);
+        // 娓呯┖瀵硅瘽妗嗛噷闈㈤�夋嫨鐨勫唴瀹�
+       // if(this.displayMemberNames.length==0)
+          this.displayMemberNames = this.selectedMemberNames
+        this.selectedMemberIds = [];
+      },
+      splitPeopleToSelectedNames(people) {
+        // 澶勭悊閫昏緫锛�
+        // 1. 鍒ゆ柇 people 鏄惁瀛樺湪涓斾负瀛楃涓诧紝閬垮厤鎶ラ敊
+        if (!people || typeof people !== "string") {
+          this.displayMemberNames = [];
+          this.otherPeople = [];
+          return;
+        }
+
+        // 2. 鍏堟寜鍒嗗彿鍒嗗壊锛氱涓�閮ㄥ垎鏄鏃忔垚鍛橈紝绗簩閮ㄥ垎鏄叾瀹冧汉
+        const parts = people.split(';');
+
+        // 绗竴閮ㄥ垎锛氭寜閫楀彿鍒嗗壊璧嬪�肩粰 displayMemberNames
+        if (parts[0]) {
+          this.displayMemberNames = parts[0].split(",").map(name => name.trim()).filter(name => name);
+        } else {
+          this.displayMemberNames = [];
+        }
+
+        // 绗簩閮ㄥ垎锛氭寜閫楀彿鍒嗗壊璧嬪�肩粰 otherPeople
+        if (parts[1]) {
+          this.otherPeople = parts[1].split(",").map(name => name.trim()).filter(name => name);
+        } else {
+          this.otherPeople = [];
+        }
+
+        console.log('瀹舵棌鎴愬憳:', this.displayMemberNames)
+        console.log('鍏跺畠浜�:', this.otherPeople)
+      },
+        // 鎵撳紑鎴愬憳澶氶�夊脊绐�
+        async openMemberDialog() {
+        this.memberDialogVisible = true;
+        this.memberSearch = ''; // 閲嶇疆鎼滅储
+        // 鍒濆鍖栧脊绐楅�変腑鐘舵�侊紙鍥炴樉宸查�夋垚鍛橈級
+    //    this.selectedMemberIds = [...this.familyForm.selectedMemberIds];
+        // 鍔犺浇瀹舵棌鎴愬憳鍒楄〃
+        await this.loadFamilyMembers();
+      },
+          // 鍔犺浇瀹舵棌鎴愬憳鍒楄〃
+          async loadFamilyMembers() {
+        this.loading = true;
+
+        let clanId = this.$store.state.user.clanId
+        let userId = this.$store.state.user.userId
+        try {
+          const res = await getFamilyMembers(clanId); // 鍋囪闇�瑕佸鏃廔D鍙傛暟
+    const ano = await listAnotherFamilyInfo(userId)
+
+      console.log(res)
+      console.log(res.data)
+      this.anotherFamilyMembers = ano.data;
+         this.familyMembers = res.data;
+         console.log(this.familyMembers)
+         console.log(this.familyMembers.length)
+         // console.log(this.familyMembers.length)
+        //  console.log(this.familyMembers.length)
+         // console.log(this.familyMembers[0])
+          // for(let i=0; i < this.familyMembers.length; i++)
+          //   console.log(this.familyMembers[i])
+          // console.log("---999")
+          // 鏍煎紡锛歔{ id: 1, name: '寮犱笁', role: '瀹堕暱', relation: '鐖跺瓙', avatar: 'xxx' }, ...]
+        } catch (err) {
+          this.$message.error('鍔犺浇瀹舵棌鎴愬憳澶辫触锛岃閲嶈瘯');
+        } finally {
+          this.loading = false;
+        }
+      },
     getData(){
       const id = this.$route.params && this.$route.params.id;
       let _this = this
@@ -481,6 +858,10 @@
 
       this.$refs['elForm'].validate(valid => {
 
+      // 缁勫悎鏁版嵁锛氬鏃忔垚鍛樻寜閫楀彿鍒嗛殧锛屽叾瀹冧汉鎸夐�楀彿鍒嗛殧锛屼袱閮ㄥ垎鐢ㄥ垎鍙峰垎闅�
+      const memberPart = this.selectedMemberNames.join(",");
+      const otherPart = this.otherPeople.join(",");
+      this.formData.owner = `${memberPart};${otherPart}`;
 
         if (valid) {
           if (this.formData.id != undefined) {

--
Gitblit v1.9.1