祖安之光
2025-11-17 971ed2f7636afc60802bc06f7fe160b61210aa72
src/views/work/qualityInfo/inventoryRecord/components/editDialog.vue
@@ -9,7 +9,7 @@
        :close-on-click-modal="false"
    >
      <el-form :model="state.form" size="default" ref="superRef" :rules="state.formRules" label-width="150px" >
        <el-form-item v-if="state.isAdmin" label="企业:" prop="companyId">
        <el-form-item v-if="state.isAdmin" label="单位:" prop="companyId">
          <el-select v-model="state.form.companyId" placeholder="请选择" :disabled="state.title =='查看'" clearable @change="getDeptList">
            <el-option
                v-for="item in state.companyList"
@@ -163,6 +163,7 @@
import {listUser} from "@/api/system/user";
import {getWarehousingRecordDetail, updateWarehousingRecord} from "@/api/outsourcingCooperate/outsourcingCooperate";
import {getMaterialList} from "@/api/outsourcingCooperate/outsourcingCooperate";
import {getEmployeeRecords} from "@/api/onlineEducation/user";
import useUserStore from "@/store/modules/user";
const emit = defineEmits(["getList"]);
const dialogVisible = ref(false)
@@ -208,7 +209,7 @@
  if(isAdmin){
    state.companyList = companyList
  }
  await getUserList()
  await getUserList(companyId)
  await getMaterials(companyId)
  state.title = type === 'add' ? '新增' : type ==='edit' ? '编辑' : '查看'
  state.form.companyId = companyId
@@ -384,19 +385,13 @@
const getDeptList = async ()=>{
  state.form.materialId = null
  await getMaterials(state.form.companyId)
  await getUserList(state.form.companyId)
}
const getUserList = async ()=> {
  const res = await listUser({pageIndex: 1,pageSize: 999})
const getUserList = async (companyId)=> {
  const res = await getEmployeeRecords({companyId: companyId})
  if(res.code == 200){
    state.userList = res.data.list?res.data.list.map(item=>{
      const user = item.id
      const {id, ...data} = item
      return {
        ...data,
        userId: user
      }
    }):[]
    state.userList = res.data.list?res.data.list:[]
  }else{
    ElMessage.warning(res.message)
  }