From b609f77709c4646daf155341475ae14fc0c7943d Mon Sep 17 00:00:00 2001 From: 祖安之光 <11848914+light-of-zuan@user.noreply.gitee.com> Date: 星期五, 27 六月 2025 13:25:30 +0800 Subject: [PATCH] 修改 --- src/views/safetyReview/userManage/expertUsers/components/expertDialog.vue | 129 ++++++++++++++++++++++++------------------ 1 files changed, 73 insertions(+), 56 deletions(-) diff --git a/src/views/safetyReview/userManage/expertUsers/components/expertDialog.vue b/src/views/safetyReview/userManage/expertUsers/components/expertDialog.vue index ca97e72..45aebc7 100644 --- a/src/views/safetyReview/userManage/expertUsers/components/expertDialog.vue +++ b/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 -- Gitblit v1.9.2