zhouwx
2024-11-21 a6a8e49af8c8172f4209dd94e65f53f17825cc44
src/views/safetyReview/userManage/expertUsers/components/expertDialog.vue
@@ -40,12 +40,12 @@
                    <el-col :span="11">
                        <el-form-item label="所属机构:"  prop="agencyId" v-if="state.title !== '修改密码'">
                            <el-input v-if="isAgency" v-model="state.agencyName" disabled></el-input>
                            <el-select v-model="state.form.agencyId" v-else style="width: 100%" v-loadMore="loadMore" class="m-2" placeholder="请选择机构" popper-class="more_select_dropdown"   >
                            <el-select v-model="state.form.agencyName" @change="selectValue" v-else style="width: 100%" v-loadMore="loadMore" class="m-2" placeholder="请选择机构" popper-class="more_select_dropdown"   >
                                <el-option
                                    v-for="item in state.agencyList"
                                    :key="item.id"
                                    :label="item.name"
                                    :value="item.id"
                                    :value="item.name"
                                />
                            </el-select>
                        </el-form-item>
@@ -404,7 +404,7 @@
    console.log("attribute", attribute.value)
  } else {
    getAgency()
    getAgency('open')
  }
}
@@ -421,7 +421,7 @@
        const res = await getUserById(param);
        if(res.code == 200){
            state.form = res.data
          // debugger
          state.form.agencyName = res.data.agency.name
            state.socialList = res.data.socialAttach.map(url => {
                return {
                    url:  import.meta.env.VITE_APP_BASE_API +'/'+url.path,
@@ -457,7 +457,7 @@
                })
              }
              state.form.majorShow = arr;
              console.log(state.form.majorShow,'certificateList')
              console.log(state.form,'certificateList')
            }
        }else{
@@ -671,23 +671,24 @@
}
const handlePhotoRemove = async (file) => {
  if (file && file.status == 'success') {
  // state.form.idPhoto = ''
  let path = ""
  if(file.response && file.response.data){
  if (file.response && file.response.data) {
    path = file.response.data.path
  }else {
  } else {
    const base = import.meta.env.VITE_APP_BASE_API
    path = file.url.substring(base.length+1,file.url.length )
    path = file.url.substring(base.length + 1, file.url.length)
  }
  await delPic({path: path}).then(res => {
    if(res.code == 200){
    if (res.code == 200) {
      // ElMessage({
      //   type: 'success',
      //   message: '文件已删除'
      // })
      state.form.idPhoto = ''
    }else{
    } else {
      ElMessage({
        type: 'warning',
        message: res.message
@@ -696,6 +697,7 @@
  }).catch(() => {
    state.form.idPhoto = ''
  });
}
  // const res = await delPic({path: path})
@@ -716,66 +718,73 @@
const handleRemove = async (file, uploadFiles,type) => {
  if(file && file.status == 'success') {
    let path = ""
    if(state.title === '编辑') {
        const base = import.meta.env.VITE_APP_BASE_API
        path = file.url.substring(base.length+1,file.url.length )
    }else {
        path = file.response.data.path
    if (state.title === '编辑') {
      const base = import.meta.env.VITE_APP_BASE_API
      path = file.url.substring(base.length + 1, file.url.length)
    } else {
      path = file.response.data.path
    }
  await delPic({path: path}).then(res => {
    if(res.code == 200){
      // ElMessage({
      //   type: 'success',
      //   message: '文件已删除'
      // })
    }else{
      ElMessage({
        type: 'warning',
        message: res.message
      })
    }
    await delPic({path: path}).then(res => {
      if (res.code == 200) {
        // ElMessage({
        //   type: 'success',
        //   message: '文件已删除'
        // })
      } else {
        ElMessage({
          type: 'warning',
          message: res.message
        })
      }
    }).catch(() => {
    if(type === 1){
      state.form.socialAttach = state.form.socialAttach.filter(item => item.path !== path)
    }else if(type === 2){
      state.form.medicalAttach = state.form.medicalAttach.filter(item => item.path !== path)
    }else {
      state.form.salaryAttach = state.form.salaryAttach.filter(item => item.path !== path)
    }
      if (type === 1) {
        state.form.socialAttach = state.form.socialAttach.filter(item => item.path !== path)
      } else if (type === 2) {
        state.form.medicalAttach = state.form.medicalAttach.filter(item => item.path !== path)
      } else {
        state.form.salaryAttach = state.form.salaryAttach.filter(item => item.path !== path)
      }
    });
    if(type === 1){
        state.form.socialAttach = state.form.socialAttach.filter(item => item.path !== path)
    }else if(type === 2){
        state.form.medicalAttach = state.form.medicalAttach.filter(item => item.path !== path)
    }else {
        state.form.salaryAttach = state.form.salaryAttach.filter(item => item.path !== path)
    if (type === 1) {
      state.form.socialAttach = state.form.socialAttach.filter(item => item.path !== path)
    } else if (type === 2) {
      state.form.medicalAttach = state.form.medicalAttach.filter(item => item.path !== path)
    } else {
      state.form.salaryAttach = state.form.salaryAttach.filter(item => item.path !== path)
    }
  }
}
const finshed = ref(false)
const getAgency = async () => {
const getAgency = async (type) => {
  if (type === 'open' && state.pageNum !== 1) {
  } else {
    const queryParams = {
        pageNum: state.pageNum,
        pageSize: state.pageSize,
      pageNum: state.pageNum,
      pageSize: state.pageSize,
    }
    const res = await getInsitutionList(queryParams)
    if(res.code == 200){
        if(res.data.pageNum === state.pageNum){
            finshed.value = false;
            if(state.pageNum == 1){
                state.agencyList = res.data.list
            }else {
                state.agencyList =state.agencyList .concat(res.data.list)
            }
        }else {
            finshed.value = true;
    if (res.code == 200) {
      if (res.data.pageNum === state.pageNum) {
        finshed.value = false;
        if (state.pageNum == 1) {
          state.agencyList = res.data.list
        } else {
          state.agencyList = state.agencyList.concat(res.data.list)
        }
      } else {
        finshed.value = true;
      }
    }else{
        ElMessage.warning(res.message)
    } else {
      ElMessage.warning(res.message)
    }
  }
}
@@ -786,7 +795,7 @@
    setTimeout(() => {
      if (finshed.value) return //值为true,则代表没有数据了
      state.pageNum += 1
      getAgency()
      getAgency('')
    }, 500)
}
@@ -795,6 +804,14 @@
    // state.form.selectMajorList= val;
    console.log('选中的xxxx',val)
}
const selectValue = (val) => {
  state.agencyList.forEach(item => {
    if(item.name === val){
      state.form.agencyId = item.id
    }
  })
}
defineExpose({
    openDialog