前端回显分类 回显有时显示键值(判断条件:看是否有值传入)

 <div v-if="form.caseType == 1">
        <p class="title-submit" style="margin-top: 0">案源提供人信息</p>
        <el-row v-for="(item, index) in form.superviseList" :key="index">


          <el-col :span="8">
            <el-form-item :label="`第${index + 1}位监督检查人`" style="margin-left: -40px" required>
              <el-select v-model="item.superviseName" filterable :placeholder="`请选择第${index + 1}位监督检查人`">
                <div v-if="item.isSpDept === 'Y'">
                  <el-option v-for="option in userList" :key="option.userId" :label="option.label" :value="option.userId">
                  </el-option>
                </div>
                <div v-else-if="item.superviseDept">
                  <el-option v-for="option in combinedUserList" :key="option.userId" :label="option.label" :value="option.userId">
                  </el-option>
                </div>
                <div v-else>
                  <el-option v-for="option in otherUserList" :key="option.userId" :label="option.label" :value="option.userId">
                  </el-option>
                </div>
              </el-select>

            </el-form-item>
          </el-col>

  
   superviseList: [{
          isSpDept: "Y",
          superviseName: "",
          superviseDept: "",
        },],

根据superviseDept是否有传入值 进行回显选择

combinedUserList  是两个回显list的合并值   合并值看之前内容

根据判断 看是否正确回显数据  (此时修改前 表单组件表格 有时候显示字典键值)

   userList: [],
      otherUserList: [],
      combinedUserList: [],
  created() {
    listCheckUser(2, true).then((response) => {
      this.userList = response.rows.map((d) => {
        d.label = `${d.nickName}`;
        return d;
      });

      this.combinedUserList = this.userList.concat(this.otherUserList);
    });

相关推荐

  1. SQL主

    2024-01-30 09:24:03       25 阅读
  2. el-select

    2024-01-30 09:24:03       65 阅读
  3. uniapp:富文本

    2024-01-30 09:24:03       61 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-01-30 09:24:03       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-01-30 09:24:03       100 阅读
  3. 在Django里面运行非项目文件

    2024-01-30 09:24:03       82 阅读
  4. Python语言-面向对象

    2024-01-30 09:24:03       91 阅读

热门阅读

  1. ES6 Reflect详解

    2024-01-30 09:24:03       52 阅读
  2. 使用Redis LIst 实现数据库分页快速查询的方法

    2024-01-30 09:24:03       54 阅读
  3. C Primer Plus(第六版)14.18 编程练习 第5题

    2024-01-30 09:24:03       49 阅读
  4. 代码随想录算法训练营|day20

    2024-01-30 09:24:03       66 阅读
  5. C#设置程序开机启动

    2024-01-30 09:24:03       56 阅读
  6. 基于 MATLAB 语言的 BP 神经网络的改进算法

    2024-01-30 09:24:03       53 阅读