shj
2022-09-06 d1a430e88df40d76558a14f890ac0dbd3181f3a0
src/components/DailogSearchUser/index.vue
@@ -13,24 +13,25 @@
         <el-col :span="14" style="padding: 20px">
            <el-form ref="ruleFormRef" :model="ruleForm" status-icon>
               <el-row>
                  <el-col :span="10" :offset="1">
                  <!-- <el-col :span="10" :offset="1">
                     <el-form-item size="default">
                        <el-input v-model="ruleForm.pass" placeholder="登录名" />
                     </el-form-item>
                  </el-col>
                  </el-col> -->
                  <el-col :span="8" :offset="1">
                     <el-form-item>
                        <el-button size="default" type="primary" >查询</el-button>
                        <el-button size="default">重置</el-button>
                        <!-- <el-button size="default" type="primary" >查询</el-button> -->
                        <el-button size="default" @click="clear">清除选择</el-button>
                     </el-form-item>
                  </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" ref="clearAll"  @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.value" 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,14 +45,15 @@
               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"
            />
         </el-col>
         <el-col :span="4">
         <div v-if="dynamicTags[0]==''?false:true">
            <el-tag
               v-for="tag in dynamicTags"
               :key="tag"
@@ -63,6 +65,7 @@
            >
               {{ tag.realName }}
            </el-tag>
            </div>
         </el-col>
      </el-row>
      <template #footer>
@@ -117,12 +120,12 @@
      //左边树形部分点击获取回调
      const names = ref<any>();
      const handleNodeClick = (data: Tree) => {
         console.log(data);
         goalManagementApi()
            .getManName(data.depId)
            .then((res) => {
               if (res.data.code == 200) {
                  tableData.value=res.data.data
                  total.value=tableData.value.length
               }else{
                  ElMessage.error(res.data.msg);
               }
@@ -138,27 +141,35 @@
      });
      // 表格
      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(['']);
      const handleClose = (tag: string) => {
      const handleClose = (tag: any) => {
         dynamicTags.value.splice(dynamicTags.value.indexOf(tag), 1);
         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 = () => {
      const openDailog = (type:any) => {
         types.value=type
         dialogVisible.value = true;
      };
      //全屏
@@ -171,11 +182,26 @@
         }
      };
      const submitForm = () => {
         let obj = JSON.parse(JSON.stringify(dynamicTags.value));
         emit('SearchUser', obj[0]);
         if(types.value==0){
            emit('SearchUser', dynamicTags.value,types.value);
         }else {
            emit('SearchUser', dynamicTags.value[0],types.value);
         }
         dialogVisible.value = false;
         clear()
      };
      const clearAll=ref()
      const clear=()=>{
           dynamicTags.value=[]
         radio1.value=""
        clearAll.value.clearSelection()
      }
      return {
         clear,
         clearAll,
         total,
         types,
         filterText,
         treeRef,
         filterNode,
@@ -191,6 +217,7 @@
         pageSize4,
         handleSizeChange,
         handleCurrentChange,
         handleSelectionChange,
         radio1,
         dynamicTags,
         handleClose,