This commit is contained in:
2025-08-23 09:16:17 +08:00
2 changed files with 44 additions and 3 deletions

View File

@ -61,3 +61,10 @@ export const delMaterialIssue = (id: string | number | Array<string | number>) =
method: 'delete' method: 'delete'
}); });
}; };
//获取一起名称
export const getMaterialName = (id: any) => {
return request({
url: '/materials/materials/inventoryNumber/' + id,
method: 'get'
});
};

View File

@ -140,11 +140,13 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item <el-form-item
label="名称" label="名称11"
:prop="`itemList.${index}.name`" :prop="`itemList.${index}.name`"
:rules="[{ required: true, message: '名称不能为空', trigger: 'blur' }]" :rules="[{ required: true, message: '名称不能为空', trigger: 'blur' }]"
> >
<el-input v-model="item.name" placeholder="请输入名称" /> <el-select v-model="item.name" placeholder="请输入名称" @change="(value) => getNameChange(value, index, item)">
<el-option v-for="item in optionsName" :key="item.id" :label="item.materialsName" :value="item.id" />
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -249,7 +251,15 @@
</template> </template>
<script setup name="MaterialIssue" lang="ts"> <script setup name="MaterialIssue" lang="ts">
import { listMaterialIssue, getMaterialIssue, delMaterialIssue, addMaterialIssue, updateMaterialIssue } from '@/api/materials/materialIssue'; import {
listMaterialIssue,
getMaterialIssue,
delMaterialIssue,
addMaterialIssue,
updateMaterialIssue,
getMaterialName
} from '@/api/materials/materialIssue';
import { MaterialIssueVO, MaterialIssueQuery, MaterialIssueForm } from '@/api/materials/materialIssue/types'; import { MaterialIssueVO, MaterialIssueQuery, MaterialIssueForm } from '@/api/materials/materialIssue/types';
import { useUserStoreHook } from '@/store/modules/user'; import { useUserStoreHook } from '@/store/modules/user';
import wordllssue from './word/index.vue'; import wordllssue from './word/index.vue';
@ -345,6 +355,29 @@ const getList = async () => {
total.value = res.total; total.value = res.total;
loading.value = false; loading.value = false;
}; };
const optionsName: any = ref([]);
//获取一起名称
const getName = async () => {
const res = await getMaterialName(currentProject.value.id);
console.log(res);
if (res.code == 200) {
optionsName.value = res.data;
}
};
const getNameChange = (value, index, item) => {
// 这里可以添加处理逻辑
console.log(value);
const data = optionsName.value.find((item) => item.id == value);
console.log(data);
form.value.itemList[index].name = data.materialsName;
form.value.itemList[index].specification = data.typeSpecificationName;
form.value.itemList[index].unit = data.weightId;
form.value.itemList[index].stockQuantity = data.inventoryNumber;
};
/** 取消按钮 */ /** 取消按钮 */
const cancel = () => { const cancel = () => {
@ -447,6 +480,7 @@ const handleView = (row) => {
}; };
onMounted(() => { onMounted(() => {
getList(); getList();
getName();
}); });
//监听项目id刷新数据 //监听项目id刷新数据
const listeningProject = watch( const listeningProject = watch(