2
This commit is contained in:
@ -61,3 +61,10 @@ export const delMaterialIssue = (id: string | number | Array<string | number>) =
|
||||
method: 'delete'
|
||||
});
|
||||
};
|
||||
//获取一起名称
|
||||
export const getMaterialName = (id: any) => {
|
||||
return request({
|
||||
url: '/materials/materials/inventoryNumber/' + id,
|
||||
method: 'get'
|
||||
});
|
||||
};
|
||||
|
@ -140,11 +140,13 @@
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="名称"
|
||||
label="名称11"
|
||||
:prop="`itemList.${index}.name`"
|
||||
: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-col>
|
||||
<el-col :span="12">
|
||||
@ -249,7 +251,15 @@
|
||||
</template>
|
||||
|
||||
<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 { useUserStoreHook } from '@/store/modules/user';
|
||||
import wordllssue from './word/index.vue';
|
||||
@ -345,6 +355,29 @@ const getList = async () => {
|
||||
total.value = res.total;
|
||||
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 = () => {
|
||||
@ -447,6 +480,7 @@ const handleView = (row) => {
|
||||
};
|
||||
onMounted(() => {
|
||||
getList();
|
||||
getName();
|
||||
});
|
||||
//监听项目id刷新数据
|
||||
const listeningProject = watch(
|
||||
|
Reference in New Issue
Block a user