1.0.13 合同附件上传

dev
yinq 2 months ago
parent 079a2b14a6
commit c81c041582

@ -122,13 +122,21 @@
<!-- </el-form-item>--> <!-- </el-form-item>-->
<!-- </el-col>--> <!-- </el-col>-->
<el-col :span="12"> <el-col :span="12">
<el-form-item label="合同模板ID" prop="templateId"> <el-form-item label="合同模板" prop="templateId">
<el-input v-model="form.templateId" placeholder="请输入合同模板ID" /> <el-select v-model="form.templateId" placeholder="请选择合同模板" filterable>
<el-option
v-for="item in printTemplateList"
:key="item.templateId"
:label="item.templateName + '-' + item.version"
:value="item.templateId"
/>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="附件ID" prop="ossId"> <el-form-item label="附件" prop="ossId">
<el-input v-model="form.ossId" type="textarea" placeholder="请输入内容" /> <!-- <el-input v-model="form.ossId" type="textarea" placeholder="请输入内容" />-->
<el-button type="primary" plain icon="Upload" @click="handleFile"></el-button>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -326,6 +334,21 @@
</el-dialog> </el-dialog>
<!-- 销售物料选择 --> <!-- 销售物料选择 -->
<SaleMaterialSelect ref="saleMaterialSelectRef" :multiple="false" @confirm-call-back="saleMaterialSelectCallBack"></SaleMaterialSelect> <SaleMaterialSelect ref="saleMaterialSelectRef" :multiple="false" @confirm-call-back="saleMaterialSelectCallBack"></SaleMaterialSelect>
<!-- 添加或修改OSS对象存储对话框 -->
<el-dialog v-model="dialog.visible" :title="dialog.title" width="500px" append-to-body>
<el-form ref="ossFormRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="文件名">
<fileUpload v-if="type === 0" v-model="ossFileModel" />
<imageUpload v-if="type === 1" v-model="ossFileModel" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitOss"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
</div> </div>
</template> </template>
@ -340,6 +363,7 @@ 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';
import { getBasePrintTemplateList } from '@/api/oa/base/printTemplate';
const route = useRoute(); const route = useRoute();
const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@ -350,6 +374,15 @@ const { contract_category, business_direction, active_flag, contract_flag, contr
const buttonLoading = ref(false); const buttonLoading = ref(false);
const contractInfoFormRef = ref<ElFormInstance>(); const contractInfoFormRef = ref<ElFormInstance>();
const type = ref(0);
const dialog = reactive<DialogOption>({
visible: false,
title: ''
});
// OSS v-model form
const ossFileModel = ref<string | string[] | undefined>(undefined);
// //
const isCodeGenerated = ref(false); const isCodeGenerated = ref(false);
@ -363,6 +396,13 @@ const contractMaterialList = computed(() => {
return (form.value as any).contractMaterialList || []; return (form.value as any).contractMaterialList || [];
}); });
/** 查询打印模板下拉框结构 */
const printTemplateList = ref([]);
const getPrintTemplateListSelect = async () => {
let res = await getBasePrintTemplateList(null);
printTemplateList.value = res.data;
};
/** 查询单位信息下拉框结构 */ /** 查询单位信息下拉框结构 */
const unitInfoList = ref([]); const unitInfoList = ref([]);
const getUnitInfoListSelect = async () => { const getUnitInfoListSelect = async () => {
@ -419,7 +459,9 @@ const materialRules = {
taxRate: [{ required: true, message: '税率不能为空', trigger: 'blur' }] taxRate: [{ required: true, message: '税率不能为空', trigger: 'blur' }]
}; };
const initFormData: ContractInfoForm = { type ContractInfoFormEx = ContractInfoForm & { file?: any };
const initFormData: ContractInfoFormEx = {
contractId: undefined, contractId: undefined,
contractFlag: '1', contractFlag: '1',
contractCode: undefined, contractCode: undefined,
@ -445,10 +487,11 @@ const initFormData: ContractInfoForm = {
taxRate: undefined, taxRate: undefined,
remark: undefined, remark: undefined,
activeFlag: '1', activeFlag: '1',
contractMaterialList: [] contractMaterialList: [],
file: undefined
} as any; } as any;
const data = reactive<{ form: ContractInfoForm; rules: any }>({ const data = reactive<{ form: ContractInfoFormEx; rules: any }>({
form: { ...initFormData }, form: { ...initFormData },
rules: { rules: {
contractId: [{ required: true, message: '合同ID不能为空', trigger: 'blur' }] contractId: [{ required: true, message: '合同ID不能为空', trigger: 'blur' }]
@ -476,7 +519,6 @@ watch(
// //
const generateContractCode = async () => { const generateContractCode = async () => {
if (isCodeGenerated.value) return; // if (isCodeGenerated.value) return; //
try { try {
const params = { codeRuleCode: '1001' } as any; const params = { codeRuleCode: '1001' } as any;
const res = await getRuleGenerateCode(params); const res = await getRuleGenerateCode(params);
@ -509,6 +551,20 @@ const saleMaterialSelectCallBack = (data) => {
} }
}; };
/** 取消按钮 */
function cancel() {
dialog.visible = false;
}
/** 文件按钮操作 */
const handleFile = () => {
type.value = 0;
dialog.visible = true;
dialog.title = '上传合同附件';
//
ossFileModel.value = form.value.ossId as any;
};
const submitForm = () => { const submitForm = () => {
contractInfoFormRef.value?.validate(async (valid: boolean) => { contractInfoFormRef.value?.validate(async (valid: boolean) => {
if (valid) { if (valid) {
@ -524,6 +580,14 @@ const submitForm = () => {
}); });
}; };
// v-model ossId
const submitOss = () => {
// ossId
form.value.ossId = ossFileModel.value as any;
dialog.visible = false;
proxy?.$modal.msgSuccess('附件已更新');
};
// //
const getContractMaterialList = async () => { const getContractMaterialList = async () => {
if (!form.value.contractId) return; if (!form.value.contractId) return;
@ -670,8 +734,17 @@ const submitMaterialForm = () => {
}); });
}; };
//
const loadSelectOptions = () => {
getUnitInfoListSelect();
getDeptInfoListSelect();
getCustomerInfoListSelect();
getPrintTemplateListSelect();
};
onMounted(async () => { onMounted(async () => {
const id = (route.query.id || route.params.id) as string | number; const id = (route.query.id || route.params.id) as string | number;
loadSelectOptions();
if (id) { if (id) {
proxy?.$modal.loading('正在加载数据,请稍后...'); proxy?.$modal.loading('正在加载数据,请稍后...');
const res = await getContractInfo(id); const res = await getContractInfo(id);
@ -697,8 +770,16 @@ onMounted(async () => {
isCodeGenerated.value = false; isCodeGenerated.value = false;
} }
} }
await getUnitInfoListSelect();
await getDeptInfoListSelect();
await getCustomerInfoListSelect();
}); });
// ossId
//
watch(
() => form.value.ossId,
(val) => {
if (!dialog.visible) {
ossFileModel.value = val as any;
}
}
);
</script> </script>

@ -81,8 +81,8 @@
<dict-tag :options="contract_flag" :value="scope.row.contractFlag" /> <dict-tag :options="contract_flag" :value="scope.row.contractFlag" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="合同编号" align="center" prop="contractCode" width="120" v-if="columns[3].visible" /> <el-table-column label="合同编号" align="center" prop="contractCode" width="140" v-if="columns[3].visible" />
<el-table-column label="合同名称" align="center" prop="contractName" width="120" v-if="columns[4].visible" /> <el-table-column label="合同名称" align="center" prop="contractName" width="200" v-if="columns[4].visible" />
<el-table-column label="合同大类" align="center" prop="contractCategory" v-if="columns[5].visible"> <el-table-column label="合同大类" align="center" prop="contractCategory" v-if="columns[5].visible">
<template #default="scope"> <template #default="scope">
<dict-tag :options="contract_category" :value="scope.row.contractCategory" /> <dict-tag :options="contract_category" :value="scope.row.contractCategory" />
@ -93,26 +93,26 @@
<dict-tag :options="contract_type" :value="scope.row.contractType" /> <dict-tag :options="contract_type" :value="scope.row.contractType" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="业务方向" align="center" prop="businessDirection" v-if="columns[7].visible"> <el-table-column label="业务方向" align="center" prop="businessDirection" width="100" v-if="columns[7].visible">
<template #default="scope"> <template #default="scope">
<dict-tag :options="business_direction" :value="scope.row.businessDirection" /> <dict-tag :options="business_direction" :value="scope.row.businessDirection" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="部门" align="center" prop="contractDeptId" v-if="columns[8].visible" /> <el-table-column label="部门" align="center" prop="deptName" width="100" v-if="columns[8].visible" />
<el-table-column label="合同时间" align="center" prop="contractDate" width="100" v-if="columns[9].visible"> <el-table-column label="合同时间" align="center" prop="contractDate" width="100" v-if="columns[9].visible">
<template #default="scope"> <template #default="scope">
<span>{{ parseTime(scope.row.contractDate, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.contractDate, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="合同总价" align="center" prop="totalPrice" v-if="columns[10].visible" /> <el-table-column label="合同总价" align="center" prop="totalPrice" v-if="columns[10].visible" />
<el-table-column label="甲方公司" align="center" prop="oneCustomerId" v-if="columns[11].visible" /> <el-table-column label="甲方公司" align="center" prop="oneCustomerName" width="200" v-if="columns[11].visible" />
<el-table-column label="甲方授权代表" align="center" prop="oneRepresent" width="110" v-if="columns[12].visible" /> <el-table-column label="甲方授权代表" align="center" prop="oneRepresent" width="110" v-if="columns[12].visible" />
<el-table-column label="甲方签字日期" align="center" prop="aDate" width="120" v-if="columns[13].visible"> <el-table-column label="甲方签字日期" align="center" prop="aDate" width="120" v-if="columns[13].visible">
<template #default="scope"> <template #default="scope">
<span>{{ parseTime(scope.row.oneDate, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.oneDate, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="乙方公司" align="center" prop="twoCustomerId" v-if="columns[14].visible" /> <el-table-column label="乙方公司" align="center" prop="twoCustomerName" width="200" v-if="columns[14].visible" />
<el-table-column label="乙方授权代表" align="center" prop="twoRepresent" width="110" v-if="columns[15].visible" /> <el-table-column label="乙方授权代表" align="center" prop="twoRepresent" width="110" v-if="columns[15].visible" />
<el-table-column label="乙方签字日期" align="center" prop="twoDate" width="120" v-if="columns[16].visible"> <el-table-column label="乙方签字日期" align="center" prop="twoDate" width="120" v-if="columns[16].visible">
<template #default="scope"> <template #default="scope">

Loading…
Cancel
Save