点击input框弹出一个table页面在选择并且选择高亮

81 阅读1分钟
         <el-dialog
              :title="title"
              v-model="open"
              width="400px"
              :close-on-click-modal="false"
              append-to-body
              :before-close="beforeClose"
            >
            <el-form :model="form" :rules="rules" ref="userRef" label-width="120px">
                <el-form-item label="用户所属部门" prop="deptName">
                  <el-input
                    v-model="form.deptName"
                    placeholder="请输入平台名称"
                    @click.native="getVideoplatList"
                  />
                  </el-form>
                  
                  
             <el-dialog v-model="openTree" title="部门名称" style="padding-top:10px">
              <el-table
                :data="deviceList"
                row-key="deptId"
                 highlight-current-row
                @current-change="handleCurrentChange"
                border
                :expand-row-keys="expands"
                ref="dataTreeList"
                @expand-change="toggleRowExpansion"
                @selection-change="handleSelectionChange"
                :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
              >
                <el-table-column prop="label" label="部门名称" sortable>
                </el-table-column>
              </el-table>
              <template #footer>
                <div class="dialog-footer">
                  <el-button type="primary" @click="camerasubmit">确 定</el-button>
                  <el-button @click="cancel">取 消</el-button>
                </div>
              </template>
            </el-dialog>
            
            
            currentRow:{}
            
            function getVideoplatList() {
                  openTree.value = true;
                  getinit()
                }
            // 赋值给修改
                function camerasubmit() {
                  form.value.deptId = currentRow.value.deptId;
                  form.value.deptName = currentRow.value.label;
                  openTree.value = false;
                }
                // 所属部门选中的table数据
                function handleCurrentChange(val) {
                  currentRow.value = val;
                }
      
      
               <style scoped>
                    .el-table__body tr.hover-row > td.el-table__cell{
                      background: color #e8f4ff !important;;
                      color:#ffffffde;
                    }
                    </style>