Merge pull request 'master' (#705) from master into prod

Reviewed-on: http://git.feashow.cn/clay/mosr-web/pulls/705
This commit is contained in:
2024-08-12 15:26:25 +00:00
2 changed files with 37 additions and 42 deletions

View File

@@ -392,6 +392,7 @@ const handleDownload = (row) => {
onActivated(()=>{ onActivated(()=>{
handleSearch() handleSearch()
getTagsOption()
}) })
handleSearch() handleSearch()
getTagsOption() getTagsOption()

View File

@@ -37,7 +37,19 @@ const localData = reactive({
roleOpt: [], roleOpt: [],
jobOpt: [] jobOpt: []
}) })
const openChangeRoleDialog = (selectRoleId, data) => {
ElMessageBox.confirm(`${getRoleName(selectRoleId)} 角色存在对应人员:${data[selectRoleId][0].nickName},您确定要替换为 ${form.value.getValues().nickName}?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(async () => {
}).catch((action) => {
if (action == 'cancel') {
form.value.getValues().roleIds = form.value.getValues().roleIds.filter(roleItem => roleItem != selectRoleId);
}
})
}
const schame = computed(() => { const schame = computed(() => {
let arr = [ let arr = [
{ {
@@ -124,49 +136,31 @@ const schame = computed(() => {
change: async (val) => { change: async (val) => {
const {code, data} = await judgeIsSameRole(form.value.getValues().userId) const {code, data} = await judgeIsSameRole(form.value.getValues().userId)
if (code === 1000) { if (code === 1000) {
console.log('currentRoleArray.value', currentRoleArray.value) // console.log('currentRoleArray.value', currentRoleArray.value)
console.log('data,val', data, val) // console.log('data,val', data, val)
let selectRoleLast = val[val?.length - 1]
if (currentRoleArray.value.length !== 0) {//当前用户存在角色 if (currentRoleArray.value.length !== 0) {//当前用户存在角色
val.forEach(selectItem => { currentRoleArray.value?.forEach(currentItem => {
currentRoleArray.value?.forEach(currentItem => { console.log('currentItem', currentItem, data[currentItem], form.value.getValues().userId)
if (selectItem != currentItem) { //当前用户已经选择科创部对接人/财务对接人时移除角色不出现替换弹窗
console.log('currentItem', currentItem,data[currentItem],form.value.getValues().userId) if (currentItem && data[currentItem] && data[currentItem].length > 0 && data[currentItem][0].userId == form.value.getValues().userId) {
if (currentItem &&data[currentItem]&& data[currentItem].length > 0&& data[currentItem][0].userId==form.value.getValues().userId) { console.log('已选择对接人')
//选择两个对接人
}else{ if (data[selectRoleLast]?.length > 0 && data[selectRoleLast][0].userId !== form.value.getValues().userId) {
if (data[selectItem]?.length > 0 ) { console.log('选择两个对接人')
ElMessageBox.confirm(`${getRoleName(selectItem)}角色存在对应人员:${data[selectItem][0].nickName},您确定要替换为 ${form.value.getValues().nickName}?`, "提示", { openChangeRoleDialog(selectRoleLast, data)
confirmButtonText: "确定", }
cancelButtonText: "取消", } else {
type: "warning" //当前用户未选择对接人
}).then(async () => { if (data[selectRoleLast]?.length > 0) {
openChangeRoleDialog(selectRoleLast, data)
}).catch((action) => {
if (action == 'cancel') {
form.value.getValues().roleIds = form.value.getValues().roleIds.filter(roleItem => roleItem != selectItem);
}
})
}
}
} }
})
})
} else {
val.forEach(selectItem => {
if (data[selectItem]?.length > 0) {
ElMessageBox.confirm(`此角色存在对应人员:${data[selectItem][0].nickName},您确定要替换该人员?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(async () => {
}).catch((action) => {
if (action == 'cancel') {
form.value.getValues().roleIds = form.value.getValues().roleIds.filter(roleItem => roleItem != selectItem);
}
})
} }
}) })
} else {//当前用户未分配角色
if (data[selectRoleLast]?.length > 0) {
openChangeRoleDialog(selectRoleLast, data)
}
} }
} }
} }
@@ -234,9 +228,9 @@ const rules = reactive({
sex: [{required: true, message: '请选择', trigger: 'change'}], sex: [{required: true, message: '请选择', trigger: 'change'}],
state: [{required: true, message: '请选择', trigger: 'change'}], state: [{required: true, message: '请选择', trigger: 'change'}],
}) })
const getRoleName=(roleId)=>{ const getRoleName = (roleId) => {
console.log('roleId',roleId,localData.roleOpt,localData.roleOpt.filter(item=>item.value==roleId)) console.log('roleId', roleId, localData.roleOpt, localData.roleOpt.filter(item => item.value == roleId))
return localData.roleOpt.filter(item=>item.value==roleId)[0].label return localData.roleOpt.filter(item => item.value == roleId)[0].label
} }
const getInstance = (e) => { const getInstance = (e) => {
form.value = e form.value = e