1.0.12 合同字段优化

dev
yinq 2 months ago
parent 43d27c9dc3
commit 079a2b14a6

@ -19,6 +19,21 @@ export interface RelationMaterialVO {
*/ */
saleMaterialName: string; saleMaterialName: string;
/**
* SAP
*/
materialCode?: string;
/**
* SAP
*/
materialName?: string;
/**
*
*/
customerName?: string;
/** /**
* *
*/ */
@ -124,17 +139,27 @@ export interface RelationMaterialQuery extends PageQuery {
/** /**
* SAP * SAP
*/ */
materialCode: string; materialCode?: string;
/** /**
* SAP * SAP
*/ */
materialName: string; materialName?: string;
/**
*
*/
materialBrand?: string;
/**
*
*/
materialModel?: string;
/** /**
* *
*/ */
customerName: string; customerName?: string;
} }

@ -127,6 +127,16 @@ export interface ContractMaterialForm extends BaseEntity {
*/ */
materialName?: string; materialName?: string;
/**
*
*/
materialCode?: string;
/**
*
*/
customerName?: string;
/** /**
* ID * ID
*/ */

@ -0,0 +1,266 @@
<template>
<div>
<el-dialog v-model="materialDialog.visible.value" :title="materialDialog.title.value" width="80%" append-to-body>
<el-row :gutter="20">
<el-col :span="24">
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="100px">
<el-form-item label="SAP物料编码" prop="materialCode">
<el-input v-model="queryParams.materialCode" placeholder="请输入SAP物料编码" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="SAP物料名称" prop="materialName">
<el-input v-model="queryParams.materialName" placeholder="请输入SAP物料名称" clearable @keyup.enter="handleQuery" />
</el-form-item>
<!-- <el-form-item label="物料品牌" prop="materialBrand">-->
<!-- <el-input v-model="queryParams.materialBrand" placeholder="请输入物料品牌" clearable @keyup.enter="handleQuery" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="物料型号" prop="materialModel">-->
<!-- <el-input v-model="queryParams.materialModel" placeholder="请输入物料型号" clearable @keyup.enter="handleQuery" />-->
<!-- </el-form-item>-->
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery"></el-button>
<el-button icon="Refresh" @click="() => resetQuery()">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card shadow="hover">
<template v-if="prop.multiple" #header>
<el-tag
v-for="material in selectMaterialList"
:key="material.materialId"
closable
style="margin: 2px"
@close="handleCloseTag(material)"
>
{{ material.saleMaterialName }}
</el-tag>
</template>
<vxe-table
ref="tableRef"
height="400px"
border
show-overflow
:data="materialInfoList"
:loading="loading"
:row-config="{ keyField: 'relationMaterialId', isHover: true }"
:checkbox-config="{ reserve: true, trigger: 'row', highlight: true, showHeader: prop.multiple }"
@checkbox-all="handleCheckboxAll"
@checkbox-change="handleCheckboxChange"
>
<vxe-column type="checkbox" width="50" align="center" />
<!-- <vxe-column key="relationMaterialId" title="关联物料ID" align="center" field="relationMaterialId" />-->
<vxe-column key="materialCode" title="SAP物料编码" align="center" field="materialCode" width="120" />
<vxe-column key="materialName" title="SAP物料名称" align="center" field="materialName" width="120" />
<vxe-column key="customerName" title="客户名称" align="center" field="customerName" width="120" />
<vxe-column key="saleMaterialName" title="销售物料名称" align="center" field="saleMaterialName" width="120" />
<!-- <vxe-column key="purchasePrice" title="采购单价(元)" align="center" field="purchasePrice" width="120" />-->
<!-- <vxe-column key="foreignPrice" title="售前对外单价(元)" align="center" field="foreignPrice" width="140" />-->
<!-- <vxe-column key="stockingPeriod" title="备货期" align="center" field="stockingPeriod" />-->
<!-- <vxe-column key="activeFlag" title="激活标识" align="center">-->
<!-- <template #default="scope">-->
<!-- <dict-tag :options="active_flag" :value="scope.row.activeFlag"></dict-tag>-->
<!-- </template>-->
<!-- </vxe-column>-->
</vxe-table>
<pagination
v-show="total > 0"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
:total="total"
@pagination="pageList"
/>
</el-card>
</el-col>
</el-row>
<template #footer>
<el-button @click="close"></el-button>
<el-button type="primary" @click="confirm"></el-button>
</template>
</el-dialog>
</div>
</template>
<script setup lang="ts">
import { listRelationMaterial } from '@/api/oa/base/relationMaterial';
import { VxeTableInstance } from 'vxe-table';
import useDialog from '@/hooks/useDialog';
import { RelationMaterialQuery, RelationMaterialVO } from '@/api/oa/base/relationMaterial/types';
interface PropType {
modelValue?: RelationMaterialVO[] | RelationMaterialVO | undefined;
multiple?: boolean;
data?: string | number | (string | number)[] | undefined;
}
const prop = withDefaults(defineProps<PropType>(), {
multiple: true,
modelValue: undefined,
data: undefined
});
const emit = defineEmits(['update:modelValue', 'confirmCallBack']);
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { active_flag } = toRefs<any>(proxy?.useDict('active_flag'));
const materialInfoList = ref<RelationMaterialVO[]>([]);
const loading = ref(true);
const showSearch = ref(true);
const total = ref(0);
const selectMaterialList = ref<RelationMaterialVO[]>([]);
const queryFormRef = ref<ElFormInstance>();
const tableRef = ref<VxeTableInstance<RelationMaterialVO>>();
const materialDialog = useDialog({
title: '物料选择'
});
const queryParams = ref<RelationMaterialQuery>({
pageNum: 1,
pageSize: 10,
materialCode: undefined,
materialName: undefined,
materialBrand: undefined,
materialModel: undefined,
activeFlag: undefined,
params: {}
});
const defaultSelectMaterialIds = computed(() => computedIds(prop.data));
const confirm = () => {
emit('update:modelValue', selectMaterialList.value);
emit('confirmCallBack', selectMaterialList.value);
materialDialog.closeDialog();
};
const computedIds = (data) => {
if (data === '' || data === null || data === undefined) {
return [];
}
if (data instanceof Array) {
return data.map((item) => String(item));
} else if (typeof data === 'string') {
return data.split(',');
} else if (typeof data === 'number') {
return [String(data)];
} else {
console.warn('<MaterialSelect> The data type of data should be array or string or number, but I received other');
return [];
}
};
/** 查询物料信息列表 */
const getList = async () => {
loading.value = true;
const res = await listRelationMaterial(queryParams.value);
loading.value = false;
materialInfoList.value = res.rows;
total.value = res.total;
};
const pageList = async () => {
await getList();
const materials = materialInfoList.value.filter((item) => {
return selectMaterialList.value.some((material) => material.relationMaterialId === item.relationMaterialId);
});
await tableRef.value.setCheckboxRow(materials, true);
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = (refresh = true) => {
queryFormRef.value?.resetFields();
queryParams.value.pageNum = 1;
refresh && handleQuery();
};
const handleCheckboxChange = (checked) => {
if (!prop.multiple && checked.checked) {
tableRef.value.setCheckboxRow(selectMaterialList.value, false);
selectMaterialList.value = [];
}
const row = checked.row;
if (checked.checked) {
selectMaterialList.value.push(row);
} else {
selectMaterialList.value = selectMaterialList.value.filter((item) => {
return item.relationMaterialId !== row.relationMaterialId;
});
}
};
const handleCheckboxAll = (checked) => {
const rows = materialInfoList.value;
if (checked.checked) {
rows.forEach((row) => {
if (!selectMaterialList.value.some((item) => item.relationMaterialId === row.relationMaterialId)) {
selectMaterialList.value.push(row);
}
});
} else {
selectMaterialList.value = selectMaterialList.value.filter((item) => {
return !rows.some((row) => row.relationMaterialId === item.relationMaterialId);
});
}
};
const handleCloseTag = (material: RelationMaterialVO) => {
const relationMaterialId = material.relationMaterialId;
// 使splice
const index = selectMaterialList.value.findIndex((item) => item.relationMaterialId === relationMaterialId);
const rows = selectMaterialList.value[index];
tableRef.value?.setCheckboxRow(rows, false);
selectMaterialList.value.splice(index, 1);
};
const initSelectMaterial = async () => {
if (defaultSelectMaterialIds.value.length > 0) {
//
const materials = materialInfoList.value.filter((item) => {
return defaultSelectMaterialIds.value.includes(String(item.relationMaterialId));
});
selectMaterialList.value = materials;
await nextTick(() => {
tableRef.value.setCheckboxRow(materials, true);
});
}
};
const close = () => {
materialDialog.closeDialog();
};
watch(
() => materialDialog.visible.value,
async (newValue: boolean) => {
if (newValue) {
await getList(); //
await initSelectMaterial();
} else {
tableRef.value.clearCheckboxReserve();
tableRef.value.clearCheckboxRow();
resetQuery(false);
selectMaterialList.value = [];
}
}
);
defineExpose({
open: materialDialog.openDialog,
close: materialDialog.closeDialog
});
</script>

@ -246,7 +246,7 @@ const openMaterialSelect = () => {
materialSelectRef.value.open(); materialSelectRef.value.open();
}; };
// //
const materialSelectCallBack = (data) => { const materialSelectCallBack = (data) => {
const materialList = data; const materialList = data;
if (materialList.length > 0) { if (materialList.length > 0) {
@ -298,6 +298,7 @@ const handleUpdate = async (row?: RelationMaterialVO) => {
reset(); reset();
const _relationMaterialId = row?.relationMaterialId || ids.value[0]; const _relationMaterialId = row?.relationMaterialId || ids.value[0];
const res = await getRelationMaterial(_relationMaterialId); const res = await getRelationMaterial(_relationMaterialId);
console.log(res.data);
Object.assign(form.value, res.data); Object.assign(form.value, res.data);
dialog.visible = true; dialog.visible = true;
dialog.title = '修改关联销售物料信息'; dialog.title = '修改关联销售物料信息';

@ -75,25 +75,15 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="甲方公司" prop="oneCustomerId"> <el-form-item label="甲方公司" prop="oneCustomerId">
<el-select v-model="form.oneCustomerId" placeholder="请选择甲方公司" filterable > <el-select v-model="form.oneCustomerId" placeholder="请选择甲方公司" filterable>
<el-option <el-option v-for="item in customerInfoList" :key="item.customerId" :label="item.customerName" :value="item.customerId" />
v-for="item in customerInfoList"
:key="item.customerId"
:label="item.customerName"
:value="item.customerId"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="乙方公司" prop="twoCustomerId"> <el-form-item label="乙方公司" prop="twoCustomerId">
<el-select v-model="form.twoCustomerId" placeholder="请选择乙方公司" filterable > <el-select v-model="form.twoCustomerId" placeholder="请选择乙方公司" filterable>
<el-option <el-option v-for="item in customerInfoList" :key="item.customerId" :label="item.customerName" :value="item.customerId" />
v-for="item in customerInfoList"
:key="item.customerId"
:label="item.customerName"
:value="item.customerId"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -218,25 +208,31 @@
<el-col :span="12"> <el-col :span="12">
<el-form-item label="计划标识" prop="planFlag"> <el-form-item label="计划标识" prop="planFlag">
<el-radio-group v-model="materialForm.planFlag"> <el-radio-group v-model="materialForm.planFlag">
<el-radio <el-radio v-for="dict in plan_flag" :key="dict.value" :value="dict.value">{{ dict.label }} </el-radio>
v-for="dict in plan_flag"
:key="dict.value"
:value="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="物料名称" prop="materialName"> <el-form-item label="物料名称" prop="materialName" v-if="materialForm.planFlag === '1'">
<el-input v-model="materialForm.materialName" placeholder="计划内请点击右侧图标检索物料"> <el-input v-model="materialForm.materialName" placeholder="计划内请点击右侧图标检索物料">
<template #suffix> <template #suffix>
<el-icon style="cursor: pointer" @click="openMaterialSelect"> <el-icon style="cursor: pointer" @click="openSaleMaterialSelect">
<Search /> <Search />
</el-icon> </el-icon>
</template> </template>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12">
<el-form-item label="物料编号" prop="materialCode" v-if="materialForm.planFlag === '1'">
<el-input v-model="materialForm.materialCode" disabled />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="客户名称" prop="customerName" v-if="materialForm.planFlag === '1'">
<el-input v-model="materialForm.customerName" disabled />
</el-form-item>
</el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="产品名称" prop="productName"> <el-form-item label="产品名称" prop="productName">
<el-input v-model="materialForm.productName" placeholder="请输入产品名称" /> <el-input v-model="materialForm.productName" placeholder="请输入产品名称" />
@ -247,16 +243,6 @@
<el-input v-model="materialForm.specificationDescription" placeholder="请输入规格描述" /> <el-input v-model="materialForm.specificationDescription" placeholder="请输入规格描述" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12">
<el-form-item label="物料ID" prop="materialId">
<el-input v-model="materialForm.materialId" placeholder="请输入物料ID" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="销售物料ID" prop="relationMaterialId">
<el-input v-model="materialForm.relationMaterialId" placeholder="请输入销售物料ID" />
</el-form-item>
</el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="数量" prop="amount"> <el-form-item label="数量" prop="amount">
<el-input-number <el-input-number
@ -338,8 +324,8 @@
</div> </div>
</template> </template>
</el-dialog> </el-dialog>
<!-- 物料选择 --> <!-- 销售物料选择 -->
<MaterialSelect ref="materialSelectRef" :multiple="false" @confirm-call-back="materialSelectCallBack"></MaterialSelect> <SaleMaterialSelect ref="saleMaterialSelectRef" :multiple="false" @confirm-call-back="saleMaterialSelectCallBack"></SaleMaterialSelect>
</div> </div>
</template> </template>
@ -350,7 +336,7 @@ import { getErpContractMaterialList } from '@/api/oa/erp/contractMaterial';
import { ContractMaterialVO, ContractMaterialForm } from '@/api/oa/erp/contractMaterial/types'; import { ContractMaterialVO, ContractMaterialForm } from '@/api/oa/erp/contractMaterial/types';
import { getBaseUnitInfoList } from '@/api/oa/base/unitInfo'; import { getBaseUnitInfoList } from '@/api/oa/base/unitInfo';
import { getRuleGenerateCode } from '@/api/system/codeRule'; import { getRuleGenerateCode } from '@/api/system/codeRule';
import MaterialSelect from '@/components/MaterialSelect/index.vue'; import SaleMaterialSelect from '@/components/SaleMaterialSelect/index.vue';
import { ref } from 'vue'; import { ref } from 'vue';
import { listDept } from '@/api/system/dept'; import { listDept } from '@/api/system/dept';
import { getCrmCustomerInfoList } from '@/api/oa/crm/customerInfo'; import { getCrmCustomerInfoList } from '@/api/oa/crm/customerInfo';
@ -503,19 +489,23 @@ const generateContractCode = async () => {
} }
}; };
const materialSelectRef = ref<InstanceType<typeof MaterialSelect>>(); const saleMaterialSelectRef = ref<InstanceType<typeof SaleMaterialSelect>>();
// //
const openMaterialSelect = () => { const openSaleMaterialSelect = () => {
materialSelectRef.value.open(); saleMaterialSelectRef.value.open();
}; };
// //
const materialSelectCallBack = (data) => { const saleMaterialSelectCallBack = (data) => {
const materialList = data; const materialList = data;
if (materialList.length > 0) { if (materialList.length > 0) {
materialForm.value.materialId = materialList[0].materialId; materialForm.value.materialId = materialList[0].materialId;
materialForm.value.productName = materialList[0].materialName; materialForm.value.materialCode = materialList[0].materialCode;
materialForm.value.materialName = materialList[0].materialName;
materialForm.value.productName = materialList[0].saleMaterialName;
materialForm.value.relationMaterialId = materialList[0].relationMaterialId;
materialForm.value.customerName = materialList[0].customerName;
} }
}; };
@ -523,13 +513,6 @@ const submitForm = () => {
contractInfoFormRef.value?.validate(async (valid: boolean) => { contractInfoFormRef.value?.validate(async (valid: boolean) => {
if (valid) { if (valid) {
buttonLoading.value = true; buttonLoading.value = true;
console.log('提交的表单数据:', JSON.stringify(form.value, null, 2));
console.log('甲方公司ID:', form.value.oneCustomerId);
console.log('甲方授权代表:', form.value.oneRepresent);
console.log('甲方签字日期:', form.value.oneDate);
console.log('乙方公司ID:', form.value.twoCustomerId);
console.log('乙方授权代表:', form.value.twoRepresent);
console.log('乙方签字日期:', form.value.twoDate);
if (form.value.contractId) { if (form.value.contractId) {
await updateContractInfo(form.value).finally(() => (buttonLoading.value = false)); await updateContractInfo(form.value).finally(() => (buttonLoading.value = false));
} else { } else {
@ -561,7 +544,7 @@ const getContractMaterialList = async () => {
// contractId // contractId
const handleAddMaterial = () => { const handleAddMaterial = () => {
resetMaterialForm(); resetMaterialForm();
// materialForm.value.contractId = form.value.contractId; materialForm.value.contractId = form.value.contractId;
materialDialog.visible = true; materialDialog.visible = true;
materialDialog.title = '新增合同物料'; materialDialog.title = '新增合同物料';
}; };

Loading…
Cancel
Save