|
|
|
|
@ -105,8 +105,11 @@
|
|
|
|
|
<el-card shadow="never">
|
|
|
|
|
<template #header>
|
|
|
|
|
<div class="table-header standard">
|
|
|
|
|
<span class="title-dot standard-dot"></span>
|
|
|
|
|
<span class="title-text">标准物料</span>
|
|
|
|
|
<div class="title-wrapper">
|
|
|
|
|
<span class="title-dot standard-dot"></span>
|
|
|
|
|
<span class="title-text">标准物料</span>
|
|
|
|
|
</div>
|
|
|
|
|
<el-button v-if="canEditMaterial" type="primary" icon="Plus" size="small" @click="handleAddMaterial('1')">新增</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<el-table v-loading="materialLoading" :data="standardMaterialList" border :row-class-name="getRowClassName">
|
|
|
|
|
@ -145,8 +148,11 @@
|
|
|
|
|
<el-card shadow="never">
|
|
|
|
|
<template #header>
|
|
|
|
|
<div class="table-header non-standard">
|
|
|
|
|
<span class="title-dot non-standard-dot"></span>
|
|
|
|
|
<span class="title-text">非标准物料</span>
|
|
|
|
|
<div class="title-wrapper">
|
|
|
|
|
<span class="title-dot non-standard-dot"></span>
|
|
|
|
|
<span class="title-text">非标准物料</span>
|
|
|
|
|
</div>
|
|
|
|
|
<el-button v-if="canEditMaterial" type="primary" icon="Plus" size="small" @click="handleAddMaterial('2')">新增</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<el-table v-loading="materialLoading" :data="nonStandardMaterialList" border :row-class-name="getRowClassName">
|
|
|
|
|
@ -212,7 +218,17 @@
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col v-if="materialForm.materialFlag === '1'" :span="12">
|
|
|
|
|
<el-form-item label="采购物料编码" prop="materialCode">
|
|
|
|
|
<el-input v-model="materialForm.materialCode" placeholder="请输入采购物料编码" />
|
|
|
|
|
<el-input v-model="materialForm.materialCode" placeholder="请选择采购标准物料" readonly>
|
|
|
|
|
<template #suffix>
|
|
|
|
|
<el-icon
|
|
|
|
|
style="cursor: pointer"
|
|
|
|
|
:disabled="!canEditMaterial"
|
|
|
|
|
@click="openMaterialSelect"
|
|
|
|
|
>
|
|
|
|
|
<Search />
|
|
|
|
|
</el-icon>
|
|
|
|
|
</template>
|
|
|
|
|
</el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
@ -245,7 +261,6 @@
|
|
|
|
|
class="w-full"
|
|
|
|
|
placeholder="请输入数量"
|
|
|
|
|
:precision="2"
|
|
|
|
|
:disabled="true"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
@ -282,6 +297,7 @@
|
|
|
|
|
<submitVerify ref="submitVerifyRef" :task-variables="taskVariables" @submit-callback="submitCallback" />
|
|
|
|
|
<approvalRecord ref="approvalRecordRef" />
|
|
|
|
|
<ProjectSelect ref="projectSelectRef" :multiple="false" @confirm-call-back="projectInfoSelectCallBack" />
|
|
|
|
|
<MaterialSelect ref="materialSelectRef" :multiple="false" @confirm-call-back="materialSelectCallBack" />
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
@ -304,6 +320,7 @@ import SubmitVerify from '@/components/Process/submitVerify.vue';
|
|
|
|
|
import ApprovalRecord from '@/components/Process/approvalRecord.vue';
|
|
|
|
|
import ApprovalButton from '@/components/Process/approvalButton.vue';
|
|
|
|
|
import ProjectSelect from '@/components/ProjectSelect/index.vue';
|
|
|
|
|
import MaterialSelect from '@/components/MaterialSelect/index.vue';
|
|
|
|
|
import { FlowCodeEnum } from '@/enums/OAEnum';
|
|
|
|
|
import type { ProjectInfoVO } from '@/api/oa/erp/projectInfo/types';
|
|
|
|
|
import { listUser } from '@/api/system/user';
|
|
|
|
|
@ -311,6 +328,7 @@ import type { UserVO, UserQuery } from '@/api/system/user/types';
|
|
|
|
|
import { useUserStore } from '@/store/modules/user';
|
|
|
|
|
import { getBaseUnitInfoList } from '@/api/oa/base/unitInfo';
|
|
|
|
|
import { getInfo } from '@/api/login';
|
|
|
|
|
import type { MaterialInfoVO } from '@/api/oa/base/materialInfo/types';
|
|
|
|
|
|
|
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
@ -335,6 +353,7 @@ const projectPurchaseFormRef = ref<FormInstance>();
|
|
|
|
|
const submitVerifyRef = ref<InstanceType<typeof SubmitVerify>>();
|
|
|
|
|
const approvalRecordRef = ref<InstanceType<typeof ApprovalRecord>>();
|
|
|
|
|
const projectSelectRef = ref<InstanceType<typeof ProjectSelect>>();
|
|
|
|
|
const materialSelectRef = ref<InstanceType<typeof MaterialSelect>>();
|
|
|
|
|
const taskVariables = ref<Record<string, any>>({});
|
|
|
|
|
|
|
|
|
|
const initFormData: ProjectPurchaseForm & { projectName?: string } = {
|
|
|
|
|
@ -409,6 +428,26 @@ const getRowClassName = ({ row }: { row: ProjectPurchaseMaterialVO }) => {
|
|
|
|
|
return '';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const openMaterialSelect = () => {
|
|
|
|
|
if (!canEditMaterial.value) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
materialSelectRef.value?.open();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const materialSelectCallBack = (data: MaterialInfoVO[]) => {
|
|
|
|
|
if (!data?.length) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const material = data[0];
|
|
|
|
|
materialForm.value.materialId = material.materialId;
|
|
|
|
|
materialForm.value.materialCode = material.materialCode;
|
|
|
|
|
materialForm.value.materialName = material.materialName;
|
|
|
|
|
materialForm.value.purchaseMaterialName = material.materialName;
|
|
|
|
|
// materialForm.value.relationMaterialCode = material.materialCode;
|
|
|
|
|
// materialForm.value.relationMaterialName = material.materialName;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 用户列表
|
|
|
|
|
const userList = ref<UserVO[]>([]);
|
|
|
|
|
const getUserList = async () => {
|
|
|
|
|
@ -445,8 +484,11 @@ const initMaterialFormData: ProjectPurchaseMaterialForm = {
|
|
|
|
|
materialFlag: undefined,
|
|
|
|
|
materialId: undefined,
|
|
|
|
|
relationMaterialId: undefined,
|
|
|
|
|
relationMaterialCode: undefined,
|
|
|
|
|
relationMaterialName: undefined,
|
|
|
|
|
materialCode: undefined,
|
|
|
|
|
materialName: undefined,
|
|
|
|
|
purchaseMaterialName: undefined,
|
|
|
|
|
specificationDescription: undefined,
|
|
|
|
|
unitId: undefined,
|
|
|
|
|
needPurchaseAmount: undefined,
|
|
|
|
|
@ -497,7 +539,6 @@ const loadDetail = async (projectPurchaseId?: string | number) => {
|
|
|
|
|
materialList.value = [];
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
pageLoading.value = true;
|
|
|
|
|
try {
|
|
|
|
|
resetForm();
|
|
|
|
|
const res = await getProjectPurchase(projectPurchaseId);
|
|
|
|
|
@ -512,29 +553,12 @@ const loadDetail = async (projectPurchaseId?: string | number) => {
|
|
|
|
|
if (userList.value.length === 0) {
|
|
|
|
|
await getUserList();
|
|
|
|
|
}
|
|
|
|
|
await loadMaterials();
|
|
|
|
|
materialList.value = res?.data.purchaseMaterialList || [];
|
|
|
|
|
} finally {
|
|
|
|
|
pageLoading.value = false;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 加载物料列表
|
|
|
|
|
*/
|
|
|
|
|
const loadMaterials = async () => {
|
|
|
|
|
if (!form.value.projectPurchaseId) {
|
|
|
|
|
materialList.value = [];
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
materialLoading.value = true;
|
|
|
|
|
try {
|
|
|
|
|
const res = await getErpProjectPurchaseMaterialList({ projectPurchaseId: form.value.projectPurchaseId });
|
|
|
|
|
materialList.value = res?.data || [];
|
|
|
|
|
} finally {
|
|
|
|
|
materialLoading.value = false;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 提交主表单
|
|
|
|
|
*/
|
|
|
|
|
@ -624,6 +648,21 @@ const handleEditMaterial = (row: ProjectPurchaseMaterialVO) => {
|
|
|
|
|
materialDialog.visible = true;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 新增物料
|
|
|
|
|
*/
|
|
|
|
|
const handleAddMaterial = (materialFlag) => {
|
|
|
|
|
if (!canEditMaterial.value) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
resetMaterialForm();
|
|
|
|
|
materialForm.value.materialFlag = materialFlag;
|
|
|
|
|
materialForm.value.purchasePlanFlag = '2';
|
|
|
|
|
materialForm.value.projectPurchaseId = form.value.projectPurchaseId;
|
|
|
|
|
materialDialog.title = materialFlag === '1' ? '新增标准物料' : '新增非标准物料';
|
|
|
|
|
materialDialog.visible = true;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 提交物料表单(仅操作本地列表)
|
|
|
|
|
*/
|
|
|
|
|
@ -767,6 +806,7 @@ onMounted(async () => {
|
|
|
|
|
nextTick(async () => {
|
|
|
|
|
// 获取路由参数
|
|
|
|
|
Object.assign(routeParams, route.query);
|
|
|
|
|
pageLoading.value = true;
|
|
|
|
|
loadSelectOptions();
|
|
|
|
|
const id = routeParams.id as string | number;
|
|
|
|
|
const type = routeParams.type as string;
|
|
|
|
|
@ -796,10 +836,17 @@ onMounted(async () => {
|
|
|
|
|
.table-header {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.title-wrapper {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 8px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.title-dot {
|
|
|
|
|
width: 8px;
|
|
|
|
|
height: 24px;
|
|
|
|
|
|