Merge remote-tracking branch 'origin/dev' into dev

dev
suixy 2 months ago
commit f9fe6b54d0

@ -122,13 +122,21 @@
<!-- </el-form-item>-->
<!-- </el-col>-->
<el-col :span="12">
<el-form-item label="合同模板ID" prop="templateId">
<el-input v-model="form.templateId" placeholder="请输入合同模板ID" />
<el-form-item label="合同模板" prop="templateId">
<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-col>
<el-col :span="12">
<el-form-item label="附件ID" prop="ossId">
<el-input v-model="form.ossId" type="textarea" placeholder="请输入内容" />
<el-form-item label="附件" prop="ossId">
<!-- <el-input v-model="form.ossId" type="textarea" placeholder="请输入内容" />-->
<el-button type="primary" plain icon="Upload" @click="handleFile"></el-button>
</el-form-item>
</el-col>
<el-col :span="12">
@ -208,7 +216,7 @@
<el-col :span="12">
<el-form-item label="计划标识" prop="planFlag">
<el-radio-group v-model="materialForm.planFlag">
<el-radio v-for="dict in plan_flag" :key="dict.value" :value="dict.value">{{ dict.label }} </el-radio>
<el-radio v-for="dict in plan_flag" :key="dict.value" :value="dict.value">{{ dict.label }}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
@ -326,6 +334,21 @@
</el-dialog>
<!-- 销售物料选择 -->
<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>
</template>
@ -340,6 +363,7 @@ import SaleMaterialSelect from '@/components/SaleMaterialSelect/index.vue';
import { ref } from 'vue';
import { listDept } from '@/api/system/dept';
import { getCrmCustomerInfoList } from '@/api/oa/crm/customerInfo';
import { getBasePrintTemplateList } from '@/api/oa/base/printTemplate';
const route = useRoute();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@ -350,6 +374,15 @@ const { contract_category, business_direction, active_flag, contract_flag, contr
const buttonLoading = ref(false);
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);
@ -363,6 +396,13 @@ const contractMaterialList = computed(() => {
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 getUnitInfoListSelect = async () => {
@ -419,7 +459,9 @@ const materialRules = {
taxRate: [{ required: true, message: '税率不能为空', trigger: 'blur' }]
};
const initFormData: ContractInfoForm = {
type ContractInfoFormEx = ContractInfoForm & { file?: any };
const initFormData: ContractInfoFormEx = {
contractId: undefined,
contractFlag: '1',
contractCode: undefined,
@ -445,10 +487,11 @@ const initFormData: ContractInfoForm = {
taxRate: undefined,
remark: undefined,
activeFlag: '1',
contractMaterialList: []
contractMaterialList: [],
file: undefined
} as any;
const data = reactive<{ form: ContractInfoForm; rules: any }>({
const data = reactive<{ form: ContractInfoFormEx; rules: any }>({
form: { ...initFormData },
rules: {
contractId: [{ required: true, message: '合同ID不能为空', trigger: 'blur' }]
@ -476,7 +519,6 @@ watch(
//
const generateContractCode = async () => {
if (isCodeGenerated.value) return; //
try {
const params = { codeRuleCode: '1001' } as any;
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 = () => {
contractInfoFormRef.value?.validate(async (valid: boolean) => {
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 () => {
if (!form.value.contractId) return;
@ -670,8 +734,17 @@ const submitMaterialForm = () => {
});
};
//
const loadSelectOptions = () => {
getUnitInfoListSelect();
getDeptInfoListSelect();
getCustomerInfoListSelect();
getPrintTemplateListSelect();
};
onMounted(async () => {
const id = (route.query.id || route.params.id) as string | number;
loadSelectOptions();
if (id) {
proxy?.$modal.loading('正在加载数据,请稍后...');
const res = await getContractInfo(id);
@ -697,8 +770,16 @@ onMounted(async () => {
isCodeGenerated.value = false;
}
}
await getUnitInfoListSelect();
await getDeptInfoListSelect();
await getCustomerInfoListSelect();
});
// ossId
//
watch(
() => form.value.ossId,
(val) => {
if (!dialog.visible) {
ossFileModel.value = val as any;
}
}
);
</script>

@ -81,8 +81,8 @@
<dict-tag :options="contract_flag" :value="scope.row.contractFlag" />
</template>
</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="contractName" width="120" v-if="columns[4].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="200" v-if="columns[4].visible" />
<el-table-column label="合同大类" align="center" prop="contractCategory" v-if="columns[5].visible">
<template #default="scope">
<dict-tag :options="contract_category" :value="scope.row.contractCategory" />
@ -93,26 +93,26 @@
<dict-tag :options="contract_type" :value="scope.row.contractType" />
</template>
</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">
<dict-tag :options="business_direction" :value="scope.row.businessDirection" />
</template>
</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">
<template #default="scope">
<span>{{ parseTime(scope.row.contractDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<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="aDate" width="120" v-if="columns[13].visible">
<template #default="scope">
<span>{{ parseTime(scope.row.oneDate, '{y}-{m}-{d}') }}</span>
</template>
</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="twoDate" width="120" v-if="columns[16].visible">
<template #default="scope">
@ -130,6 +130,12 @@
<el-table-column label="付款方式" align="center" prop="paymentMethod" v-if="columns[21].visible" />
<el-table-column label="签字合同附件" align="center" prop="signatureAppendix" v-if="columns[22].visible" />
<el-table-column label="合同税率(预留)" align="center" prop="taxRate" v-if="columns[23].visible" />
<el-table-column label="终版合同" align="center" width="100" v-if="columns[32].visible">
<template #default="scope">
<el-button v-if="scope.row.signatureAppendix" link type="primary" icon="Download" @click="downloadFinalContract(scope.row.signatureAppendix)"></el-button>
<span v-else style="color: #999;">未上传</span>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" v-if="columns[24].visible" />
<el-table-column label="激活标识" align="center" prop="activeFlag" v-if="columns[25].visible">
<template #default="scope">
@ -148,26 +154,46 @@
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
<el-table-column label="操作" align="center" width="100" fixed="right" class-name="small-padding fixed-width">
<template #default="scope">
<el-tooltip content="修改" placement="top">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['oa/erp:contractInfo:edit']"></el-button>
</el-tooltip>
<el-tooltip content="删除" placement="top">
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['oa/erp:contractInfo:remove']"></el-button>
<!-- <el-tooltip content="删除" placement="top">-->
<!-- <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['oa/erp:contractInfo:remove']"></el-button>-->
<!-- </el-tooltip>-->
<el-tooltip content="上传终版合同" placement="top" v-if="!scope.row.signatureAppendix">
<el-button link type="success" icon="Upload" @click="openUploadFinalDialog(scope.row)" v-hasPermi="['oa/erp:contractInfo:edit']"></el-button>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
</el-card>
<!-- 上传终版合同对话框 -->
<el-dialog v-model="uploadDialog.visible" title="上传终版合同" width="520px" append-to-body>
<el-form :model="uploadDialog.form" label-width="100px">
<el-form-item label="签字合同附件">
<fileUpload v-model="uploadDialog.form.oss" :limit="1" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" :loading="uploadDialog.loading" @click="confirmUploadFinal"> </el-button>
<el-button @click="uploadDialog.visible = false"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup name="ContractInfo" lang="ts">
import { listContractInfo, delContractInfo } from '@/api/oa/erp/contractInfo';
import { ContractInfoVO, ContractInfoQuery } from '@/api/oa/erp/contractInfo/types';
import { updateContractInfo } from '@/api/oa/erp/contractInfo';
import download from '@/plugins/download';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { contract_category, business_direction, active_flag, contract_flag, contract_type, contract_status } = toRefs<any>(
@ -217,7 +243,8 @@ const columns = ref<FieldOption[]>([
{ key: 28, label: `创建人`, visible: false },
{ key: 29, label: `创建时间`, visible: false },
{ key: 30, label: `更新人`, visible: false },
{ key: 31, label: `更新时间`, visible: false }
{ key: 31, label: `更新时间`, visible: false },
{ key: 32, label: `终版合同`, visible: true }
]);
const data = reactive<{ queryParams: ContractInfoQuery }>({
@ -253,6 +280,16 @@ const data = reactive<{ queryParams: ContractInfoQuery }>({
const { queryParams } = toRefs(data);
//
const uploadDialog = reactive({
visible: false,
loading: false,
form: {
contractId: undefined as any,
oss: undefined as any
}
});
/** 查询合同信息列表 */
const getList = async () => {
loading.value = true;
@ -315,4 +352,34 @@ const handleExport = () => {
onMounted(() => {
getList();
});
//
const openUploadFinalDialog = (row?: ContractInfoVO) => {
const contractId = row?.contractId || ids.value[0];
if (!contractId) return;
uploadDialog.form.contractId = contractId;
uploadDialog.form.oss = undefined as any;
uploadDialog.visible = true;
};
//
const confirmUploadFinal = async () => {
uploadDialog.loading = true;
try {
// id
const ossStr = uploadDialog.form.oss as unknown as string;
const firstOssId = ossStr ? Number(String(ossStr).split(',')[0]) : undefined;
await updateContractInfo({ contractId: uploadDialog.form.contractId, signatureAppendix: ossStr } as any);
proxy?.$modal.msgSuccess('终版合同已上传');
uploadDialog.visible = false;
await getList();
} finally {
uploadDialog.loading = false;
}
};
//
const downloadFinalContract = (ossId: string | number) => {
download.oss(ossId);
};
</script>

Loading…
Cancel
Save