shj
2022-08-10 01b6b200bedf57900a88bbd982cf25889e13dc49
src/components/DailogSearchUser/index.vue
@@ -26,11 +26,12 @@
                  </el-col>
               </el-row>
            </el-form>
            <el-table :data="tableData" style="width: 100%; margin-top: 20px" @cell-click="radio">
               <el-table-column align="center">
            <el-table :data="tableData" style="width: 100%; margin-top: 20px"  @selection-change="handleSelectionChange">
            <el-table-column type="selection" width="55" v-if="types==0"/>
               <el-table-column align="center"  v-if="types!=0">
                  <template #default="scope">
                     <el-radio-group v-model="radio1">
                        <el-radio :label="scope.row.username" size="large">{{ null }}</el-radio>
                        <el-radio :label="scope.row.uid" @click="radio(scope.row)" size="large">{{ null }}</el-radio>
                     </el-radio-group>
                  </template>
               </el-table-column>
@@ -44,9 +45,9 @@
               style="padding: 20px 0; border-bottom: 1px solid #dedede"
               v-model:currentPage="currentPage4"
               v-model:page-size="pageSize4"
               :page-sizes="[100, 200, 300, 400]"
               :page-sizes="[10, 20, 30, 40]"
               layout="total, sizes, prev, pager, next, jumper"
               :total="400"
               :total="total"
               @size-change="handleSizeChange"
               @current-change="handleCurrentChange"
            />
@@ -124,6 +125,7 @@
            .then((res) => {
               if (res.data.code == 200) {
                  tableData.value=res.data.data
                  total.value=tableData.value.length
               }else{
                  ElMessage.error(res.data.msg);
               }
@@ -139,13 +141,16 @@
      });
      // 表格
      const tableData = ref();
      const currentPage4 = ref();
      const pageSize4 = ref();
      const currentPage4 = ref(1);
      const pageSize4 = ref(10);
      const total=ref()
      const handleSizeChange = (val: number) => {
         console.log(`${val} items per page`);
         // console.log(`${val} items per page`);
         pageSize4.value=val
      };
      const handleCurrentChange = (val: number) => {
         console.log(`current page: ${val}`);
         // console.log(`current page: ${val}`);
         currentPage4.value=val
      };
      // 右方点击添加后显示标签
      const dynamicTags = ref(['']);
@@ -154,14 +159,16 @@
         radio1.value = '';
      };
      const radio1 = ref('');
      const radio = (event: any) => {
         dynamicTags.value[0] = event;
      const radio = (data: any) => {
         dynamicTags.value[0] = data;
      };
      const handleSelectionChange = (val:any) => {
             dynamicTags.value=val
}
      const types=ref()
      // 开启弹窗
      const dialogVisible = ref(false);
      const openDailog = (type:any) => {
         console.log(type)
         types.value=type
         dialogVisible.value = true;
      };
@@ -175,11 +182,16 @@
         }
      };
      const submitForm = () => {
         let obj = JSON.parse(JSON.stringify(dynamicTags.value));
         emit('SearchUser', obj[0],types.value);
         if(types.value==0){
            emit('SearchUser', dynamicTags.value,types.value);
         }else {
            emit('SearchUser', dynamicTags.value[0],types.value);
         }
         dialogVisible.value = false;
      };
      return {
         total,
         types,
         filterText,
         treeRef,
@@ -196,6 +208,7 @@
         pageSize4,
         handleSizeChange,
         handleCurrentChange,
         handleSelectionChange,
         radio1,
         dynamicTags,
         handleClose,