多体系建设信息化条统-前端
zhouwx
yesterday 88fb30f552ae51cc85d969e3a5ce050628ce0b7c
src/views/work/qualityInfo/inventoryRecord/components/editDialog.vue
@@ -19,6 +19,14 @@
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="年份:" prop="year">
          <el-date-picker
              v-model="state.form.year"
              type="year"
              value-format="YYYY"
              placeholder="年份"
          />
        </el-form-item>
        <el-row>
          <el-col :span="12">
            <el-form-item label="材料名称:" prop="materialId">
@@ -163,6 +171,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)
@@ -185,6 +194,7 @@
    recordName: '',
    inventory: null,
    warehousingRecordDetails: [],
    year:new Date().getFullYear().toString(),
    delDetails: []
  },
  oldDeviceList: [],
@@ -192,6 +202,7 @@
    companyId: [{ required: true, message: '请选择企业', trigger: 'blur' }],
    materialId: [{ required: true, message: '请选择材料',  trigger: 'blur' }],
    warehousingRecordDetails: [{ required: true, validator: checkList, trigger: 'blur' }],
    year: [{ required: true, message: '请选择年份', trigger: 'blur' }],
  },
  isAdmin: false,
  companyList: [],
@@ -208,7 +219,7 @@
  if(isAdmin){
    state.companyList = companyList
  }
  await getUserList()
  await getUserList(companyId)
  await getMaterials(companyId)
  state.title = type === 'add' ? '新增' : type ==='edit' ? '编辑' : '查看'
  state.form.companyId = companyId
@@ -362,6 +373,7 @@
        state.form[key] = res.data[key]
      }
    })
    state.originInventory = state.form.inventory
    state.form.warehousingRecordDetails = res.data.warehousingRecordDetails?.map(item=>{
      return {
        id: item.id,
@@ -384,19 +396,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 ? res.data :[]
  }else{
    ElMessage.warning(res.message)
  }
@@ -410,6 +416,7 @@
    recordName: '',
    inventory: null,
    warehousingRecordDetails: [],
    year:new Date().getFullYear().toString(),
    delDetails: []
  }
  state.originInventory = 0