From d44d15d044c9e1b70f3dbf87b8d7a54ac8983852 Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: Thu, 07 May 2026 15:22:19 +0800
Subject: [PATCH] 修改
---
src/views/work/qualityInfo/inventoryRecord/components/editDialog.vue | 61 +++++++++++++++++-------------
1 files changed, 35 insertions(+), 26 deletions(-)
diff --git a/src/views/work/qualityInfo/inventoryRecord/components/editDialog.vue b/src/views/work/qualityInfo/inventoryRecord/components/editDialog.vue
index 5ab3fe4..1255cd0 100644
--- a/src/views/work/qualityInfo/inventoryRecord/components/editDialog.vue
+++ b/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"
@@ -18,6 +18,14 @@
:value="item.id">
</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">
@@ -44,7 +52,7 @@
<el-form-item label="库存数量:">
<el-input v-model.trim="state.originInventory" readonly placeholder="库存数量"></el-input>
</el-form-item>
- <el-form-item label="材料清单:" prop="warehousingRecordDetails">
+ <el-form-item label="出入库:" prop="warehousingRecordDetails">
<el-button
type="primary"
plain
@@ -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)
@@ -170,7 +179,7 @@
const dialogRef = ref();
const checkList = (rule, value, callback) => {
if (state.form.warehousingRecordDetails.length == 0) {
- callback(new Error('材料清单不可为空'))
+ callback(new Error('出入库不可为空'))
} else {
callback()
}
@@ -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
@@ -223,7 +234,7 @@
}
const calculateInventoryExcludingCurrent = (currentRow) => {
- if(!state.form.materialId) return 0
+ // if(!state.form.materialId) return 0
let inventory = state.materialList.find(i=>i.id == state.form.materialId)?.inventory || 0;
if(Array.isArray(state.form.warehousingRecordDetails) && state.form.warehousingRecordDetails.length>0){
for(let i of state.form.warehousingRecordDetails){
@@ -240,7 +251,7 @@
}
const calculateInventory = () => {
- if(state.form.materialId){
+ // if(state.form.materialId){
let inventory = state.materialList.find(i=>i.id == state.form.materialId)?.inventory || 0
if(Array.isArray(state.form.warehousingRecordDetails) && state.form.warehousingRecordDetails.length>0){
for(let i of state.form.warehousingRecordDetails){
@@ -256,9 +267,9 @@
if(inventory < 0){
ElMessage.warning('库存不足,无法出库')
}
- }else{
- state.originInventory = 0
- }
+ // }else{
+ // state.originInventory = 0
+ // }
}
const checkRemain = (scope) => {
@@ -290,13 +301,14 @@
}
const getInventory = ()=>{
- state.form.warehousingRecordDetails = state.form.warehousingRecordDetails.map(i=>{
- return {
- ...i,
- specification: state.materialList.find(i=>i.id == state.form.materialId)?.specification,
- materialUnit: state.materialList.find(i=>i.id == state.form.materialId)?.materialUnit
- }
- })
+ state.form.warehousingRecordDetails = []
+ // state.form.warehousingRecordDetails = state.form.warehousingRecordDetails.map(i=>{
+ // return {
+ // ...i,
+ // specification: state.materialList.find(i=>i.id == state.form.materialId)?.specification,
+ // materialUnit: state.materialList.find(i=>i.id == state.form.materialId)?.materialUnit
+ // }
+ // })
calculateInventory()
}
@@ -361,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,
@@ -383,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)
}
@@ -409,8 +416,10 @@
recordName: '',
inventory: null,
warehousingRecordDetails: [],
+ year:new Date().getFullYear().toString(),
delDetails: []
}
+ state.originInventory = 0
superRef.value.clearValidate();
superRef.value.resetFields()
dialogVisible.value = false;
--
Gitblit v1.9.2