feige
4 天以前 6508e19c8d2e266c7405439ac32c06df6f602439
ruoyi-ui/src/views/bignote/index.vue
@@ -276,6 +276,30 @@
          选择家族成员
        </el-button>
      </el-form-item>
      <!-- 其它人选择字段 -->
      <el-form-item label="其它人" prop="otherPeople">
        <!-- 已选其它人回显区域 -->
        <div v-if="formDat.otherPeople && formDat.otherPeople.length > 0" class="selected-members">
          <el-tag
            v-for="(name, index) in formDat.otherPeople"
            :key="index"
            closable
            @close="handleOtherPeopleTagClose(index)"
          >
            {{ name }}
          </el-tag>
        </div>
        <!-- 触发弹窗按钮 -->
        <el-button
          type="primary"
          icon="el-icon-user"
          @click="openOtherPeopleDialog"
          :disabled="loading"
        >
          添加其它人
        </el-button>
      </el-form-item>
        <el-form-item label="地点" prop="address">
          <el-input v-model="formDat.address" placeholder="请输入地点" clearable :style="{width: '100%'}" >
          </el-input>
@@ -481,6 +505,49 @@
        <el-button type="primary" @click="confirmMemberSelection">确认选择</el-button>
      </div>
    </el-dialog>
    <!-- 其它人弹窗 -->
    <el-dialog
      :visible.sync="otherPeopleDialogVisible"
      title="添加其它人"
      width="400px"
      :close-on-click-modal="false"
      @close="handleOtherPeopleDialogClose"
    >
      <div class="other-people-dialog">
        <el-input
          v-model="otherPeopleInput"
          placeholder="请输入姓名,按回车或点击添加按钮添加"
          @keyup.enter.native="addOtherPeople"
          style="margin-bottom: 20px;"
        >
          <el-button slot="append" icon="el-icon-plus" @click="addOtherPeople">添加</el-button>
        </el-input>
        <!-- 已添加的其它人列表 -->
        <div v-if="formDat.otherPeople && formDat.otherPeople.length > 0" class="added-people-list">
          <el-divider content-position="left">已添加 ({{ formDat.otherPeople.length }}人)</el-divider>
          <el-tag
            v-for="(name, index) in formDat.otherPeople"
            :key="index"
            closable
            @close="handleOtherPeopleTagClose(index)"
            style="margin-right: 8px; margin-bottom: 8px;"
          >
            {{ name }}
          </el-tag>
        </div>
        <div v-else class="no-people" style="padding: 20px 0;">
          <el-empty description="暂未添加任何人" :image-size="60"></el-empty>
        </div>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="confirmOtherPeople">完成</el-button>
      </div>
    </el-dialog>
    <!-- 分享对话框1 -->
    <el-dialog :title="title1" :visible.sync="open1" width="500px" append-to-body @close="handleClose2">
@@ -711,9 +778,13 @@
      dsb:true,
      btn:false,
      uploading: false,
      // 其它人弹窗相关
      otherPeopleDialogVisible: false,
      otherPeopleInput: '',
      formDat: {
        // type: undefined,
        selectedMemberIds: [],
        otherPeople: [], // 存储其它人名字
        title: undefined,
        location: undefined,
        holder: undefined,
@@ -798,7 +869,7 @@
        return this.displayMemberNames;
      }
      // 否则根据选中的ID计算
        // 合并过滤后的成员名称和displayMemberNames内容
        console.log(this.selectedMemberIds)
@@ -1109,6 +1180,50 @@
        }
      );
    },
openOtherPeopleDialog(){
      this.otherPeopleDialogVisible = true;
      this.otherPeopleInput = ''; // 清空输入框
    },
    // 添加其它人(支持回车和点击添加按钮)
    addOtherPeople() {
      const name = this.otherPeopleInput.trim();
      if (!name) {
        this.$message.warning('请输入姓名');
        return;
      }
      if (this.formDat.otherPeople.includes(name)) {
        this.$message.warning('该姓名已添加');
        return;
      }
      this.formDat.otherPeople.push(name);
      this.otherPeopleInput = ''; // 清空输入框,准备输入下一个
      this.$message.success(`已添加: ${name}`);
    },
    // 确认完成(关闭弹窗)
    confirmOtherPeople() {
      if (this.formDat.otherPeople.length > 0) {
        this.$message.success(`已添加 ${this.formDat.otherPeople.length} 名其它人`);
      } else {
        this.$message.info('未添加任何其它人');
      }
      this.otherPeopleDialogVisible = false;
    },
    // 关闭其它人标签
    handleOtherPeopleTagClose(index) {
      const removedName = this.formDat.otherPeople[index];
      this.formDat.otherPeople.splice(index, 1);
      this.$message.info(`已移除: ${removedName}`);
    },
    // 其它人弹窗关闭处理
    handleOtherPeopleDialogClose() {
      this.otherPeopleInput = '';
    },
    // ------------------- 恢复被删除的方法 -------------------
    // 取消按钮
    cancel() {
@@ -1157,7 +1272,6 @@
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
    //  alert(this.ids)
      this.single = selection.length!=1
      this.multiple = !selection.length
    },
@@ -1169,11 +1283,10 @@
      this.title = "添加家庭大事记信息";
    },
    /** 查看详细信息 */
    handleCheck(row){
      const id = row.id;
     this.open2 = false;
      this.open2 = false;
      this.$router.push("/familymodel/bignote/familyeventInfo/" + id);
    },
    /** 修改按钮操作 */
@@ -1190,33 +1303,23 @@
    },
    handleRemove(file) {
      //alert(98)
      //alert(this.fileList.length)
     for(let i = 0; i < this.fileList.length; i++)
     {
       if(this.fileList[i].url==file.url)
      {
         this.$delete(this.fileList,i);
       this.$delete(this.uploadFileList,i);
       }
     }
    // let ul = this.fileList.map(function (elem){
    //   return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"")
    // }).join(",")
    // alert(this.fileListOther.length)
    // let uls = this.fileListOther.map(function (elem){
    //   return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"")
    // }).join(",")
    // this.formDat.url = ul+","+uls;
      for(let i = 0; i < this.fileList.length; i++)
      {
        if(this.fileList[i].url==file.url)
        {
          this.$delete(this.fileList,i);
          this.$delete(this.uploadFileList,i);
        }
      }
    },
    handleRemoveFile(file) {
      for(let i = 0; i < this.fileListOther.length; i++)
      {
        if(this.fileListOther[i].url==file.url)
      {
        {
          this.$delete(this.fileListOther,i);
        this.$delete(this.uploadFileList1,i);
        }
          this.$delete(this.uploadFileList1,i);
        }
      }
    },
@@ -1224,6 +1327,8 @@
      this.dialogImageUrl = file.url;
      this.dialogVisible = true;
    },
    //
    handleTagClose(index, name) {
      // 从 selectedMemberNames 数组中移除当前关闭的标签名称
    //  const index = this.selectedMemberNames.findIndex(item=== name);
@@ -1255,6 +1360,11 @@
      //把名字连在一起
      var pel = ""
      pel = pel + this.selectedMemberNames.join(",")
      if(this.formDat.otherPeople.length != 0)
      {
        pel = pel +";"+ this.formDat.otherPeople.join(",")
      }
     // alert(pel)
      this.formDat.people = pel;
      this.$refs["elForm"].validate(valid => {
        if (valid) {
@@ -1480,6 +1590,7 @@
    selectedMemberNames: this.selectedMemberNames.filter(
        item => item !== name  // 过滤掉与关闭名称相同的元素
      )
      this.displayMemberNames = this.selectedMemberNames
      console.log(this.selectedMemberNames)
    },