zhouwx
6 天以前 79f2fd7d49d3316278c2a33aa5d0fc14a1fddf7f
src/views/build/conpanyFunctionConsult/qualityObjectives/objective/components/objectiveDialog.vue
@@ -345,7 +345,6 @@
  state.isAdmin = userInfo.userType === 0;
  state.form.companyName = userInfo.companyName
  state.form.companyId = userInfo.companyId
  await getDeptList()
  title.value = type === 'add' ? '新增' : type ==='edit' ? '编辑' : '查看' ;
  if(type === 'edit' || type === 'review') {
    state.form = JSON.parse(JSON.stringify(value));
@@ -354,13 +353,23 @@
      state.form.companyName = value.companyName
    }
  }
  await getDeptList()
  if(state.isAdmin){
    await   getCompanyList()
  }
  await   getPeopleList()
  dialogVisible.value = true;
}
const addObject = () => {
  state.form.qualityTargets.push({})
}
const getDeptList = async () => {
  const res = await getDept()
  const param = {
    pageNum: 1,
    pageSize: 999,
    companyId: state.form.companyId
  }
  const res = await getDept(param)
  if(res.code === 200){
    state.deptList = res.data
  }
@@ -434,10 +443,10 @@
  state.form.qualityTargets = state.form.qualityTargets.filter(item=> item != val)
}
const getPeopleList = async (val)=>{
  if(val != ""){
  if(val){
    const queryParams = {
      name: val,
      companyId: state.form.companyId
      companyId: state.form.companyId == 0 ? null : state.form.companyId
    }
    const res = await getUser(queryParams)
    if (res.code == 200) {
@@ -446,6 +455,20 @@
    } else {
      ElMessage.warning(res.message)
    }
  }else {
    const queryParams = {
      pageNum: 1,
      pageSize: 10,
      companyId: state.form.companyId == 0 ? null : state.form.companyId
    }
    const res = await getUser(queryParams)
    if (res.code == 200) {
      state.peopleList = res.data.list
    } else {
      ElMessage.warning(res.message)
    }
  }
}
const selectValue = (val) => {
@@ -478,19 +501,27 @@
  }
}
const selectValueCom = (val) => {
  state.form.leadBy = null
  state.form.qualityBy = null
  state.form.compilationBy = null
  state.form.leadName = null
  state.form.qualityName = null
  state.form.compilationName = null
  state.form.departId = null
  state.companyList.forEach(item => {
    if(item.name === val){
      state.form.companyId = item.id
    }
  })
  getDeptList()
  getPeopleList()
}
const changeLevel = () => {
  // state.form.companyName = ''
  state.form.departId = null
}
const getCompanyList = async (val)=>{
  if(val != ""){
  if(val){
    const queryParams = {
      name: val
    }
@@ -501,6 +532,17 @@
    } else {
      ElMessage.warning(res.message)
    }
  }else {
    const queryParams = {
      pageSize: 10,
      pageNum: 1,
    }
    const res = await getCompany(queryParams)
    if (res.code == 200) {
      state.companyList = res.data.list
    } else {
      ElMessage.warning(res.message)
    }
  }
}