更新采购合同供应商
This commit is contained in:
@@ -1,205 +0,0 @@
|
|||||||
<template>
|
|
||||||
<el-dialog
|
|
||||||
v-model="state.visible"
|
|
||||||
:title="state.title"
|
|
||||||
width="700px"
|
|
||||||
append-to-body
|
|
||||||
destroy-on-close
|
|
||||||
:close-on-click-modal="false"
|
|
||||||
@close="handleClose"
|
|
||||||
>
|
|
||||||
<el-form ref="formRef" :model="state.formData" :rules="rules" label-width="140px">
|
|
||||||
<el-form-item label="合同编号" prop="contractNo">
|
|
||||||
<el-input v-model="state.formData.contractNo" placeholder="请输入合同编号" :disabled="state.operation === 'view'" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="合同名称" prop="contractName">
|
|
||||||
<el-input v-model="state.formData.contractName" placeholder="请输入合同名称" :disabled="state.operation === 'view'" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="合同金额(元)" prop="money">
|
|
||||||
<el-input-number
|
|
||||||
v-model="state.formData.money"
|
|
||||||
:min="0"
|
|
||||||
:precision="2"
|
|
||||||
:controls="false"
|
|
||||||
placeholder="请输入合同金额"
|
|
||||||
style="width: 100%"
|
|
||||||
:disabled="state.operation === 'view'"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="采购申请ID" prop="purchaseId">
|
|
||||||
<el-input v-model="state.formData.purchaseId" placeholder="请输入采购申请ID" :disabled="state.operation === 'view'" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="是否需要招标" prop="isBidding">
|
|
||||||
<el-radio-group v-model="state.formData.isBidding" :disabled="state.operation === 'view'">
|
|
||||||
<el-radio value="0">否</el-radio>
|
|
||||||
<el-radio value="1">是</el-radio>
|
|
||||||
</el-radio-group>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="是否需要法律顾问" prop="isLegalAdviser">
|
|
||||||
<el-radio-group v-model="state.formData.isLegalAdviser" :disabled="state.operation === 'view'">
|
|
||||||
<el-radio value="0">否</el-radio>
|
|
||||||
<el-radio value="1">是</el-radio>
|
|
||||||
</el-radio-group>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item v-if="state.formData.isLegalAdviser === '1'" label="法律顾问意见" prop="legalAdviserOpinion">
|
|
||||||
<el-input
|
|
||||||
v-model="state.formData.legalAdviserOpinion"
|
|
||||||
type="textarea"
|
|
||||||
:rows="3"
|
|
||||||
placeholder="请输入法律顾问意见"
|
|
||||||
:disabled="state.operation === 'view'"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="是否涉及多个部门" prop="isDepts">
|
|
||||||
<el-radio-group v-model="state.formData.isDepts" :disabled="state.operation === 'view'">
|
|
||||||
<el-radio value="0">否</el-radio>
|
|
||||||
<el-radio value="1">是</el-radio>
|
|
||||||
</el-radio-group>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="是否全校合同" prop="isSchool">
|
|
||||||
<el-radio-group v-model="state.formData.isSchool" :disabled="state.operation === 'view'">
|
|
||||||
<el-radio value="0">否</el-radio>
|
|
||||||
<el-radio value="1">是</el-radio>
|
|
||||||
</el-radio-group>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="备注" prop="remarks">
|
|
||||||
<el-input v-model="state.formData.remarks" type="textarea" :rows="2" placeholder="请输入备注" :disabled="state.operation === 'view'" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<template #footer v-if="state.operation !== 'view'">
|
|
||||||
<el-button @click="handleClose">取消</el-button>
|
|
||||||
<el-button type="primary" @click="handleSubmit" :loading="state.loading">确定</el-button>
|
|
||||||
</template>
|
|
||||||
<template #footer v-else>
|
|
||||||
<el-button @click="handleClose">关闭</el-button>
|
|
||||||
</template>
|
|
||||||
</el-dialog>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts" name="PurchasingContractForm">
|
|
||||||
import { ref, reactive, computed } from 'vue';
|
|
||||||
import { getObj, addObj, editObj } from '/@/api/purchase/purchasingcontract';
|
|
||||||
import { useMessage } from '/@/hooks/message';
|
|
||||||
|
|
||||||
const emit = defineEmits(['refresh']);
|
|
||||||
|
|
||||||
const formRef = ref();
|
|
||||||
|
|
||||||
const state = reactive({
|
|
||||||
visible: false,
|
|
||||||
loading: false,
|
|
||||||
operation: 'add' as 'add' | 'edit' | 'view',
|
|
||||||
title: computed(() => {
|
|
||||||
return state.operation === 'add' ? '新增合同' : state.operation === 'edit' ? '编辑合同' : '合同详情';
|
|
||||||
}),
|
|
||||||
formData: {
|
|
||||||
id: '',
|
|
||||||
contractNo: '',
|
|
||||||
contractName: '',
|
|
||||||
money: 0,
|
|
||||||
purchaseId: '',
|
|
||||||
isBidding: '0',
|
|
||||||
isLegalAdviser: '0',
|
|
||||||
legalAdviserOpinion: '',
|
|
||||||
isDepts: '0',
|
|
||||||
isSchool: '0',
|
|
||||||
remarks: '',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const rules = {
|
|
||||||
contractNo: [{ required: true, message: '请输入合同编号', trigger: 'blur' }],
|
|
||||||
contractName: [{ required: true, message: '请输入合同名称', trigger: 'blur' }],
|
|
||||||
money: [{ required: true, message: '请输入合同金额', trigger: 'blur' }],
|
|
||||||
purchaseId: [{ required: true, message: '请输入采购申请ID', trigger: 'blur' }],
|
|
||||||
isBidding: [{ required: true, message: '请选择是否需要招标', trigger: 'change' }],
|
|
||||||
isLegalAdviser: [{ required: true, message: '请选择是否需要法律顾问', trigger: 'change' }],
|
|
||||||
isDepts: [{ required: true, message: '请选择是否涉及多部门', trigger: 'change' }],
|
|
||||||
isSchool: [{ required: true, message: '请选择是否全校合同', trigger: 'change' }],
|
|
||||||
};
|
|
||||||
|
|
||||||
const openDialog = async (operation: 'add' | 'edit' | 'view', row?: any) => {
|
|
||||||
state.operation = operation;
|
|
||||||
state.visible = true;
|
|
||||||
state.loading = false;
|
|
||||||
|
|
||||||
if (operation === 'add') {
|
|
||||||
resetForm();
|
|
||||||
state.formData.isBidding = '0';
|
|
||||||
state.formData.isLegalAdviser = '0';
|
|
||||||
state.formData.isDepts = '0';
|
|
||||||
state.formData.isSchool = '0';
|
|
||||||
} else if (row) {
|
|
||||||
state.formData.id = row.id;
|
|
||||||
await loadData();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const loadData = async () => {
|
|
||||||
try {
|
|
||||||
state.loading = true;
|
|
||||||
const res: any = await getObj(state.formData.id);
|
|
||||||
if (res.data) {
|
|
||||||
Object.assign(state.formData, res.data);
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
useMessage().error('加载数据失败');
|
|
||||||
} finally {
|
|
||||||
state.loading = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleSubmit = async () => {
|
|
||||||
const valid = await formRef.value?.validate().catch(() => false);
|
|
||||||
if (!valid) return;
|
|
||||||
|
|
||||||
try {
|
|
||||||
state.loading = true;
|
|
||||||
if (state.operation === 'add') {
|
|
||||||
await addObj(state.formData);
|
|
||||||
useMessage().success('新增成功');
|
|
||||||
} else {
|
|
||||||
await editObj(state.formData);
|
|
||||||
useMessage().success('修改成功');
|
|
||||||
}
|
|
||||||
handleClose();
|
|
||||||
emit('refresh');
|
|
||||||
} catch (err: any) {
|
|
||||||
useMessage().error(err.msg || '操作失败');
|
|
||||||
} finally {
|
|
||||||
state.loading = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleClose = () => {
|
|
||||||
state.visible = false;
|
|
||||||
resetForm();
|
|
||||||
};
|
|
||||||
|
|
||||||
const resetForm = () => {
|
|
||||||
formRef.value?.resetFields();
|
|
||||||
state.formData = {
|
|
||||||
id: '',
|
|
||||||
contractNo: '',
|
|
||||||
contractName: '',
|
|
||||||
money: 0,
|
|
||||||
purchaseId: '',
|
|
||||||
isBidding: '0',
|
|
||||||
isLegalAdviser: '0',
|
|
||||||
legalAdviserOpinion: '',
|
|
||||||
isDepts: '0',
|
|
||||||
isSchool: '0',
|
|
||||||
remarks: '',
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
defineExpose({
|
|
||||||
openDialog,
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
:deep(.el-dialog__body) {
|
|
||||||
padding: 20px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,263 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="modern-page-container">
|
|
||||||
<div class="page-wrapper">
|
|
||||||
<!-- 搜索表单卡片 -->
|
|
||||||
<el-card v-show="showSearch" class="search-card" shadow="never">
|
|
||||||
<template #header>
|
|
||||||
<div class="card-header">
|
|
||||||
<span class="card-title">
|
|
||||||
<el-icon class="title-icon"><Search /></el-icon>
|
|
||||||
筛选条件
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<el-form :model="state.queryForm" ref="searchFormRef" :inline="true" @keyup.enter="getDataList" class="search-form">
|
|
||||||
<el-form-item label="合同编号" prop="contractNo">
|
|
||||||
<el-input v-model="state.queryForm.contractNo" placeholder="请输入合同编号" clearable style="width: 200px" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="合同名称" prop="contractName">
|
|
||||||
<el-input v-model="state.queryForm.contractName" placeholder="请输入合同名称" clearable style="width: 200px" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="是否需要招标" prop="isBidding">
|
|
||||||
<el-select v-model="state.queryForm.isBidding" placeholder="请选择" clearable style="width: 200px">
|
|
||||||
<el-option label="否" value="0" />
|
|
||||||
<el-option label="是" value="1" />
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item>
|
|
||||||
<el-button type="primary" icon="Search" @click="getDataList">查询</el-button>
|
|
||||||
<el-button icon="Refresh" @click="handleReset">重置</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
</el-card>
|
|
||||||
|
|
||||||
<!-- 内容卡片 -->
|
|
||||||
<el-card class="content-card" shadow="never">
|
|
||||||
<template #header>
|
|
||||||
<div class="card-header">
|
|
||||||
<span class="card-title">
|
|
||||||
<el-icon class="title-icon"><Document /></el-icon>
|
|
||||||
采购合同管理
|
|
||||||
</span>
|
|
||||||
<div class="header-actions">
|
|
||||||
<el-button icon="FolderAdd" type="primary" @click="formDialogRef.openDialog('add')"> 新增 </el-button>
|
|
||||||
<right-toolbar v-model:showSearch="showSearch" class="ml10" @queryTable="getDataList" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<!-- 表格 -->
|
|
||||||
<el-table
|
|
||||||
ref="tableRef"
|
|
||||||
:data="state.dataList"
|
|
||||||
v-loading="state.loading"
|
|
||||||
stripe
|
|
||||||
:cell-style="tableStyle.cellStyle"
|
|
||||||
:header-cell-style="tableStyle.headerCellStyle"
|
|
||||||
class="modern-table"
|
|
||||||
>
|
|
||||||
<el-table-column type="index" label="序号" width="70" align="center">
|
|
||||||
<template #header>
|
|
||||||
<el-icon><List /></el-icon>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="contractNo" label="合同编号" min-width="150" show-overflow-tooltip>
|
|
||||||
<template #header>
|
|
||||||
<el-icon><DocumentCopy /></el-icon>
|
|
||||||
<span style="margin-left: 4px">合同编号</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="contractName" label="合同名称" min-width="200" show-overflow-tooltip>
|
|
||||||
<template #header>
|
|
||||||
<el-icon><Document /></el-icon>
|
|
||||||
<span style="margin-left: 4px">合同名称</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="money" label="合同金额(元)" min-width="130" align="right">
|
|
||||||
<template #header>
|
|
||||||
<el-icon><Money /></el-icon>
|
|
||||||
<span style="margin-left: 4px">合同金额(元)</span>
|
|
||||||
</template>
|
|
||||||
<template #default="scope">
|
|
||||||
{{ formatMoney(scope.row.money) }}
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="isBidding" label="是否需要招标" min-width="120" align="center">
|
|
||||||
<template #header>
|
|
||||||
<el-icon><Tickets /></el-icon>
|
|
||||||
<span style="margin-left: 4px">是否需要招标</span>
|
|
||||||
</template>
|
|
||||||
<template #default="scope">
|
|
||||||
<el-tag :type="scope.row.isBidding === '1' ? 'warning' : 'info'" size="small">
|
|
||||||
{{ scope.row.isBidding === '1' ? '是' : '否' }}
|
|
||||||
</el-tag>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="isLegalAdviser" label="是否需要法律顾问" min-width="140" align="center">
|
|
||||||
<template #header>
|
|
||||||
<el-icon><User /></el-icon>
|
|
||||||
<span style="margin-left: 4px">是否需要法律顾问</span>
|
|
||||||
</template>
|
|
||||||
<template #default="scope">
|
|
||||||
<el-tag :type="scope.row.isLegalAdviser === '1' ? 'warning' : 'info'" size="small">
|
|
||||||
{{ scope.row.isLegalAdviser === '1' ? '是' : '否' }}
|
|
||||||
</el-tag>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="isDepts" label="是否涉及多部门" min-width="120" align="center">
|
|
||||||
<template #default="scope">
|
|
||||||
<el-tag :type="scope.row.isDepts === '1' ? 'warning' : 'info'" size="small">
|
|
||||||
{{ scope.row.isDepts === '1' ? '是' : '否' }}
|
|
||||||
</el-tag>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="isSchool" label="是否全校合同" min-width="120" align="center">
|
|
||||||
<template #default="scope">
|
|
||||||
<el-tag :type="scope.row.isSchool === '1' ? 'success' : 'info'" size="small">
|
|
||||||
{{ scope.row.isSchool === '1' ? '是' : '否' }}
|
|
||||||
</el-tag>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="createTime" label="创建时间" width="170" align="center">
|
|
||||||
<template #header>
|
|
||||||
<el-icon><Calendar /></el-icon>
|
|
||||||
<span style="margin-left: 4px">创建时间</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="操作" align="center" fixed="right" width="180">
|
|
||||||
<template #default="scope">
|
|
||||||
<el-button icon="Edit" link type="primary" @click="formDialogRef.openDialog('edit', scope.row)"> 编辑 </el-button>
|
|
||||||
<el-button icon="View" link type="primary" @click="formDialogRef.openDialog('view', scope.row)"> 详情 </el-button>
|
|
||||||
<el-button icon="Delete" link type="danger" @click="handleDelete(scope.row)"> 删除 </el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
|
|
||||||
<!-- 分页 -->
|
|
||||||
<pagination v-model:current="state.queryForm.current" v-model:size="state.queryForm.size" :total="state.total" @getDataList="getDataList" />
|
|
||||||
</el-card>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 编辑、新增表单对话框 -->
|
|
||||||
<FormDialog ref="formDialogRef" @refresh="getDataList" />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts" name="PurchasingContract">
|
|
||||||
import { ref, reactive, defineAsyncComponent } from 'vue';
|
|
||||||
import { BasicTableProps, useTable } from '/@/hooks/table';
|
|
||||||
import { getPage, delObj } from '/@/api/purchase/purchasingcontract';
|
|
||||||
import { useMessage, useMessageBox } from '/@/hooks/message';
|
|
||||||
import { Search, Document, DocumentCopy, List, Money, Tickets, User, Calendar } from '@element-plus/icons-vue';
|
|
||||||
|
|
||||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
|
||||||
|
|
||||||
const showSearch = ref(true);
|
|
||||||
const tableRef = ref();
|
|
||||||
const formDialogRef = ref();
|
|
||||||
const searchFormRef = ref();
|
|
||||||
|
|
||||||
const formatMoney = (money: number | string) => {
|
|
||||||
if (money == null) return '-';
|
|
||||||
const num = Number(money);
|
|
||||||
return isNaN(num) ? money : num.toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
||||||
};
|
|
||||||
|
|
||||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
|
||||||
pageList: getPage,
|
|
||||||
queryForm: {
|
|
||||||
current: 1,
|
|
||||||
size: 10,
|
|
||||||
contractNo: '',
|
|
||||||
contractName: '',
|
|
||||||
isBidding: '',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const { getDataList, tableStyle } = useTable(state);
|
|
||||||
|
|
||||||
const handleReset = () => {
|
|
||||||
searchFormRef.value?.resetFields();
|
|
||||||
getDataList();
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleDelete = async (row: any) => {
|
|
||||||
try {
|
|
||||||
await useMessageBox().confirm('确定要删除该记录吗?', '提示', {
|
|
||||||
confirmButtonText: '确定',
|
|
||||||
cancelButtonText: '取消',
|
|
||||||
type: 'warning',
|
|
||||||
});
|
|
||||||
} catch {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
await delObj(row.id);
|
|
||||||
useMessage().success('删除成功');
|
|
||||||
getDataList();
|
|
||||||
} catch (err: any) {
|
|
||||||
useMessage().error(err.msg || '删除失败');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.modern-page-container {
|
|
||||||
padding: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.page-wrapper {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.search-card :deep(.el-card__body) {
|
|
||||||
padding-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.search-form {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content-card :deep(.el-card__body) {
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-header {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-title {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
font-size: 16px;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title-icon {
|
|
||||||
margin-right: 8px;
|
|
||||||
font-size: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-actions {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ml10 {
|
|
||||||
margin-left: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.modern-table {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.el-table__header-wrapper) {
|
|
||||||
background-color: #f5f7fa;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -10,7 +10,10 @@
|
|||||||
<el-descriptions v-if="contractData" :column="2" border>
|
<el-descriptions v-if="contractData" :column="2" border>
|
||||||
<el-descriptions-item label="合同编号">{{ contractData.contractNo || '-' }}</el-descriptions-item>
|
<el-descriptions-item label="合同编号">{{ contractData.contractNo || '-' }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="合同名称">{{ contractData.contractName || '-' }}</el-descriptions-item>
|
<el-descriptions-item label="合同名称">{{ contractData.contractName || '-' }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="合同金额">{{ contractData.money ? Number(contractData.money).toLocaleString() + ' 元' : '-' }}</el-descriptions-item>
|
<el-descriptions-item label="供应商">{{ contractData.supplierName || '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="合同金额">{{
|
||||||
|
contractData.money ? Number(contractData.money).toLocaleString() + ' 元' : '-'
|
||||||
|
}}</el-descriptions-item>
|
||||||
<el-descriptions-item label="合同状态">
|
<el-descriptions-item label="合同状态">
|
||||||
<el-tag v-if="contractData.flowStatus === '0'" type="warning">运行中</el-tag>
|
<el-tag v-if="contractData.flowStatus === '0'" type="warning">运行中</el-tag>
|
||||||
<el-tag v-else-if="contractData.flowStatus === '1'" type="success">已完成</el-tag>
|
<el-tag v-else-if="contractData.flowStatus === '1'" type="success">已完成</el-tag>
|
||||||
|
|||||||
@@ -1,147 +1,148 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="contract-audit-container">
|
<div class="contract-audit-container">
|
||||||
<el-card shadow="never" class="info-card">
|
<el-card shadow="never" class="info-card">
|
||||||
<template #header>
|
<template #header>
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<span class="card-title">
|
<span class="card-title">
|
||||||
<el-icon><Document /></el-icon>
|
<el-icon><Document /></el-icon>
|
||||||
采购申请信息
|
采购申请信息
|
||||||
</span>
|
</span>
|
||||||
<el-tag v-if="flowStatus === '0'" type="warning">运行中</el-tag>
|
<el-tag v-if="flowStatus === '0'" type="warning">运行中</el-tag>
|
||||||
<el-tag v-else-if="flowStatus === '1'" type="success">已完成</el-tag>
|
<el-tag v-else-if="flowStatus === '1'" type="success">已完成</el-tag>
|
||||||
<el-tag v-else-if="flowStatus === '2'" type="info">已作废</el-tag>
|
<el-tag v-else-if="flowStatus === '2'" type="info">已作废</el-tag>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<el-descriptions :column="2" border>
|
<el-descriptions :column="2" border>
|
||||||
<el-descriptions-item label="采购编号">{{ applyData.purchaseNo || '-' }}</el-descriptions-item>
|
<el-descriptions-item label="采购编号">{{ applyData.purchaseNo || '-' }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="项目名称">{{ applyData.projectName || '-' }}</el-descriptions-item>
|
<el-descriptions-item label="项目名称">{{ applyData.projectName || '-' }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="预算金额">{{ applyData.budget ? Number(applyData.budget).toLocaleString() + ' 元' : '-' }}</el-descriptions-item>
|
<el-descriptions-item label="预算金额">{{ applyData.budget ? Number(applyData.budget).toLocaleString() + ' 元' : '-' }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="申请人">{{ applyData.createName || '-' }}</el-descriptions-item>
|
<el-descriptions-item label="申请人">{{ applyData.createName || '-' }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="申请部门" :span="2">{{ applyData.deptName || '-' }}</el-descriptions-item>
|
<el-descriptions-item label="申请部门" :span="2">{{ applyData.deptName || '-' }}</el-descriptions-item>
|
||||||
</el-descriptions>
|
</el-descriptions>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<el-card shadow="never" class="contract-card">
|
<el-card shadow="never" class="contract-card">
|
||||||
<template #header>
|
<template #header>
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<span class="card-title">
|
<span class="card-title">
|
||||||
<el-icon><Tickets /></el-icon>
|
<el-icon><Tickets /></el-icon>
|
||||||
合同信息
|
合同信息
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="160px" :disabled="isViewMode">
|
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="160px" :disabled="isViewMode">
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="12" class="mb12">
|
<el-col :span="12" class="mb12">
|
||||||
<el-form-item label="合同编号" prop="contractNo">
|
<el-form-item label="合同编号" prop="contractNo">
|
||||||
<el-input v-model="formData.contractNo" placeholder="请输入合同编号" disabled />
|
<el-input v-model="formData.contractNo" placeholder="请输入合同编号" disabled />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12" class="mb12">
|
<el-col :span="12" class="mb12">
|
||||||
<el-form-item label="合同名称" prop="contractName">
|
<el-form-item label="合同名称" prop="contractName">
|
||||||
<el-input v-model="formData.contractName" placeholder="请输入合同名称" />
|
<el-input v-model="formData.contractName" placeholder="请输入合同名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
<el-col :span="12" class="mb12">
|
||||||
<el-row :gutter="20">
|
<el-form-item label="供应商" prop="supplierName">
|
||||||
<el-col :span="12" class="mb12">
|
<el-input v-model="formData.supplierName" placeholder="请输入供应商名称" />
|
||||||
<el-form-item label="合同金额(元)" prop="money">
|
</el-form-item>
|
||||||
<el-input-number v-model="formData.money" :precision="2" :min="0" :controls="false" style="width: 100%" />
|
</el-col>
|
||||||
</el-form-item>
|
<el-col :span="12" class="mb12">
|
||||||
</el-col>
|
<el-form-item label="合同金额(元)" prop="money">
|
||||||
<el-col :span="12" class="mb12">
|
<el-input-number v-model="formData.money" :precision="2" :min="0" :controls="false" style="width: 100%" />
|
||||||
<el-form-item label="是否需要招标" prop="isBidding">
|
</el-form-item>
|
||||||
<el-radio-group v-model="formData.isBidding">
|
</el-col>
|
||||||
<el-radio label="0">否</el-radio>
|
<el-col :span="12" class="mb12">
|
||||||
<el-radio label="1">是</el-radio>
|
<el-form-item label="是否需要招标" prop="isBidding">
|
||||||
</el-radio-group>
|
<el-radio-group v-model="formData.isBidding">
|
||||||
</el-form-item>
|
<el-radio label="0">否</el-radio>
|
||||||
</el-col>
|
<el-radio label="1">是</el-radio>
|
||||||
</el-row>
|
</el-radio-group>
|
||||||
<el-row :gutter="20">
|
</el-form-item>
|
||||||
<el-col :span="12" class="mb12">
|
</el-col>
|
||||||
<el-form-item label="是否需要法律顾问" prop="isLegalAdviser">
|
<el-col :span="12" class="mb12">
|
||||||
<el-radio-group v-model="formData.isLegalAdviser">
|
<el-form-item label="是否需要法律顾问" prop="isLegalAdviser">
|
||||||
<el-radio label="0">否</el-radio>
|
<el-radio-group v-model="formData.isLegalAdviser">
|
||||||
<el-radio label="1">是</el-radio>
|
<el-radio label="0">否</el-radio>
|
||||||
</el-radio-group>
|
<el-radio label="1">是</el-radio>
|
||||||
</el-form-item>
|
</el-radio-group>
|
||||||
</el-col>
|
</el-form-item>
|
||||||
<el-col :span="12" class="mb12">
|
</el-col>
|
||||||
<el-form-item label="是否涉及多个部门" prop="isDepts">
|
<el-col :span="12" class="mb12">
|
||||||
<el-radio-group v-model="formData.isDepts">
|
<el-form-item label="是否涉及多个部门" prop="isDepts">
|
||||||
<el-radio label="0">否</el-radio>
|
<el-radio-group v-model="formData.isDepts">
|
||||||
<el-radio label="1">是</el-radio>
|
<el-radio label="0">否</el-radio>
|
||||||
</el-radio-group>
|
<el-radio label="1">是</el-radio>
|
||||||
</el-form-item>
|
</el-radio-group>
|
||||||
</el-col>
|
</el-form-item>
|
||||||
</el-row>
|
</el-col>
|
||||||
<el-row :gutter="20">
|
</el-row>
|
||||||
<el-col :span="12" class="mb12">
|
<el-row :gutter="20">
|
||||||
<el-form-item label="是否全校合同" prop="isSchool">
|
<el-col :span="12" class="mb12">
|
||||||
<el-radio-group v-model="formData.isSchool">
|
<el-form-item label="是否全校合同" prop="isSchool">
|
||||||
<el-radio label="0">否</el-radio>
|
<el-radio-group v-model="formData.isSchool">
|
||||||
<el-radio label="1">是</el-radio>
|
<el-radio label="0">否</el-radio>
|
||||||
</el-radio-group>
|
<el-radio label="1">是</el-radio>
|
||||||
</el-form-item>
|
</el-radio-group>
|
||||||
</el-col>
|
</el-form-item>
|
||||||
</el-row>
|
</el-col>
|
||||||
<el-form-item v-if="formData.isLegalAdviser === '1'" label="法律顾问意见" prop="legalAdviserOpinion">
|
</el-row>
|
||||||
<el-input v-model="formData.legalAdviserOpinion" type="textarea" :rows="3" placeholder="请输入法律顾问意见" />
|
<el-form-item v-if="formData.isLegalAdviser === '1'" label="法律顾问意见" prop="legalAdviserOpinion">
|
||||||
</el-form-item>
|
<el-input v-model="formData.legalAdviserOpinion" type="textarea" :rows="3" placeholder="请输入法律顾问意见" />
|
||||||
<el-form-item label="备注" prop="remarks">
|
</el-form-item>
|
||||||
<el-input v-model="formData.remarks" type="textarea" :rows="2" placeholder="请输入备注" />
|
<el-form-item label="备注" prop="remarks">
|
||||||
</el-form-item>
|
<el-input v-model="formData.remarks" type="textarea" :rows="2" placeholder="请输入备注" />
|
||||||
</el-form>
|
</el-form-item>
|
||||||
</el-card>
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
<el-card shadow="never" class="file-card">
|
<el-card shadow="never" class="file-card">
|
||||||
<template #header>
|
<template #header>
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<span class="card-title">
|
<span class="card-title">
|
||||||
<el-icon><FolderOpened /></el-icon>
|
<el-icon><FolderOpened /></el-icon>
|
||||||
附件信息
|
附件信息
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<el-tabs v-model="activeTab">
|
<el-tabs v-model="activeTab">
|
||||||
<el-tab-pane label="合同文件" name="contract">
|
<el-tab-pane label="合同文件" name="contract">
|
||||||
<el-table v-loading="fileLoading" :data="contractFiles" stripe border v-if="contractFiles.length > 0">
|
<el-table v-loading="fileLoading" :data="contractFiles" stripe border v-if="contractFiles.length > 0">
|
||||||
<el-table-column type="index" label="序号" width="60" align="center" />
|
<el-table-column type="index" label="序号" width="60" align="center" />
|
||||||
<el-table-column prop="fileTitle" label="文件名称" show-overflow-tooltip />
|
<el-table-column prop="fileTitle" label="文件名称" show-overflow-tooltip />
|
||||||
<el-table-column label="操作" width="160" align="center">
|
<el-table-column label="操作" width="160" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button type="primary" link icon="View" @click="handlePreview(scope.row)">预览</el-button>
|
<el-button type="primary" link icon="View" @click="handlePreview(scope.row)">预览</el-button>
|
||||||
<el-button type="success" link icon="Download" @click="handleDownload(scope.row)">下载</el-button>
|
<el-button type="success" link icon="Download" @click="handleDownload(scope.row)">下载</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<el-empty v-else description="暂无合同文件" />
|
<el-empty v-else description="暂无合同文件" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="合同补充材料" name="supplement">
|
<el-tab-pane label="合同补充材料" name="supplement">
|
||||||
<el-table v-loading="fileLoading" :data="supplementFiles" stripe border v-if="supplementFiles.length > 0">
|
<el-table v-loading="fileLoading" :data="supplementFiles" stripe border v-if="supplementFiles.length > 0">
|
||||||
<el-table-column type="index" label="序号" width="60" align="center" />
|
<el-table-column type="index" label="序号" width="60" align="center" />
|
||||||
<el-table-column prop="fileTitle" label="文件名称" show-overflow-tooltip />
|
<el-table-column prop="fileTitle" label="文件名称" show-overflow-tooltip />
|
||||||
<el-table-column label="操作" width="160" align="center">
|
<el-table-column label="操作" width="160" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button type="primary" link icon="View" @click="handlePreview(scope.row)">预览</el-button>
|
<el-button type="primary" link icon="View" @click="handlePreview(scope.row)">预览</el-button>
|
||||||
<el-button type="success" link icon="Download" @click="handleDownload(scope.row)">下载</el-button>
|
<el-button type="success" link icon="Download" @click="handleDownload(scope.row)">下载</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<el-empty v-else description="暂无补充材料" />
|
<el-empty v-else description="暂无补充材料" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<el-dialog v-model="previewVisible" :title="previewTitle" width="80%" top="5vh" destroy-on-close append-to-body>
|
<el-dialog v-model="previewVisible" :title="previewTitle" width="80%" top="5vh" destroy-on-close append-to-body>
|
||||||
<div class="preview-container">
|
<div class="preview-container">
|
||||||
<iframe v-if="previewUrl" :src="previewUrl" class="preview-iframe" />
|
<iframe v-if="previewUrl" :src="previewUrl" class="preview-iframe" />
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts" name="ContractAudit">
|
<script setup lang="ts" name="ContractAudit">
|
||||||
@@ -158,8 +159,8 @@ const CONTRACT_FILE_TYPE = '160';
|
|||||||
const SUPPLEMENT_FILE_TYPE = '170';
|
const SUPPLEMENT_FILE_TYPE = '170';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
currJob: { type: Object, default: null },
|
currJob: { type: Object, default: null },
|
||||||
currElTab: { type: Object, default: null },
|
currElTab: { type: Object, default: null },
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['handleJob']);
|
const emit = defineEmits(['handleJob']);
|
||||||
@@ -171,32 +172,32 @@ const formRef = ref();
|
|||||||
|
|
||||||
const isFlowEmbed = computed(() => !!props.currJob);
|
const isFlowEmbed = computed(() => !!props.currJob);
|
||||||
const isViewMode = computed(() => {
|
const isViewMode = computed(() => {
|
||||||
if (isFlowEmbed.value && props.currJob) {
|
if (isFlowEmbed.value && props.currJob) {
|
||||||
return !!props.currJob.hiJob || props.currElTab?.isFormEdit === '0';
|
return !!props.currJob.hiJob || props.currElTab?.isFormEdit === '0';
|
||||||
}
|
}
|
||||||
return route.query.mode === 'view';
|
return route.query.mode === 'view';
|
||||||
});
|
});
|
||||||
|
|
||||||
const applyData = ref<any>({});
|
const applyData = ref<any>({});
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
purchaseId: '',
|
purchaseId: '',
|
||||||
contractNo: '',
|
contractNo: '',
|
||||||
contractName: '',
|
contractName: '',
|
||||||
money: null as number | null,
|
money: null as number | null,
|
||||||
isBidding: '0',
|
isBidding: '0',
|
||||||
isLegalAdviser: '0',
|
isLegalAdviser: '0',
|
||||||
legalAdviserOpinion: '',
|
legalAdviserOpinion: '',
|
||||||
isDepts: '0',
|
isDepts: '0',
|
||||||
isSchool: '0',
|
isSchool: '0',
|
||||||
remarks: '',
|
remarks: '',
|
||||||
contractFileIds: [] as string[],
|
contractFileIds: [] as string[],
|
||||||
supplementFileIds: [] as string[],
|
supplementFileIds: [] as string[],
|
||||||
});
|
});
|
||||||
|
|
||||||
const formRules = {
|
const formRules = {
|
||||||
contractNo: [{ required: true, message: '请输入合同编号', trigger: 'blur' }],
|
contractNo: [{ required: true, message: '请输入合同编号', trigger: 'blur' }],
|
||||||
contractName: [{ required: true, message: '请输入合同名称', trigger: 'blur' }],
|
contractName: [{ required: true, message: '请输入合同名称', trigger: 'blur' }],
|
||||||
money: [{ required: true, message: '请输入合同金额', trigger: 'blur' }],
|
money: [{ required: true, message: '请输入合同金额', trigger: 'blur' }],
|
||||||
};
|
};
|
||||||
|
|
||||||
const flowStatus = computed(() => formData.value.flowStatus || '0');
|
const flowStatus = computed(() => formData.value.flowStatus || '0');
|
||||||
@@ -209,231 +210,231 @@ const previewTitle = ref('');
|
|||||||
const previewUrl = ref('');
|
const previewUrl = ref('');
|
||||||
|
|
||||||
const effectiveFlowInstId = computed(() => {
|
const effectiveFlowInstId = computed(() => {
|
||||||
if (props.currJob?.flowInstId) {
|
if (props.currJob?.flowInstId) {
|
||||||
return props.currJob.flowInstId;
|
return props.currJob.flowInstId;
|
||||||
}
|
}
|
||||||
return route.query.flowInstId ? Number(route.query.flowInstId) : null;
|
return route.query.flowInstId ? Number(route.query.flowInstId) : null;
|
||||||
});
|
});
|
||||||
|
|
||||||
const effectivePurchaseId = computed(() => {
|
const effectivePurchaseId = computed(() => {
|
||||||
if (props.currJob?.orderId) {
|
if (props.currJob?.orderId) {
|
||||||
return String(props.currJob.orderId);
|
return String(props.currJob.orderId);
|
||||||
}
|
}
|
||||||
return (route.query.id as string) || (route.query.purchaseId as string) || '';
|
return (route.query.id as string) || (route.query.purchaseId as string) || '';
|
||||||
});
|
});
|
||||||
|
|
||||||
const loadApplyData = async () => {
|
const loadApplyData = async () => {
|
||||||
if (!effectivePurchaseId.value) return;
|
if (!effectivePurchaseId.value) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const res = await getObj(effectivePurchaseId.value);
|
const res = await getObj(effectivePurchaseId.value);
|
||||||
if (res.code === 0 && res.data) {
|
if (res.code === 0 && res.data) {
|
||||||
applyData.value = res.data;
|
applyData.value = res.data;
|
||||||
}
|
}
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
ElMessage.error(e?.msg || '加载采购申请失败');
|
ElMessage.error(e?.msg || '加载采购申请失败');
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadContractData = async () => {
|
const loadContractData = async () => {
|
||||||
let contractData: any = null;
|
let contractData: any = null;
|
||||||
let purchaseId = effectivePurchaseId.value;
|
let purchaseId = effectivePurchaseId.value;
|
||||||
|
|
||||||
// 优先使用 flowInstId 获取合同数据(审核流程嵌入时)
|
// 优先使用 flowInstId 获取合同数据(审核流程嵌入时)
|
||||||
if (effectiveFlowInstId.value) {
|
if (effectiveFlowInstId.value) {
|
||||||
try {
|
try {
|
||||||
fileLoading.value = true;
|
fileLoading.value = true;
|
||||||
const res = await getByFlowInstId(effectiveFlowInstId.value);
|
const res = await getByFlowInstId(effectiveFlowInstId.value);
|
||||||
if (res.code === 0 && res.data) {
|
if (res.code === 0 && res.data) {
|
||||||
contractData = res.data;
|
contractData = res.data;
|
||||||
purchaseId = res.data.purchaseId || purchaseId;
|
purchaseId = res.data.purchaseId || purchaseId;
|
||||||
}
|
}
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
ElMessage.error(e?.msg || '加载合同信息失败');
|
ElMessage.error(e?.msg || '加载合同信息失败');
|
||||||
} finally {
|
} finally {
|
||||||
fileLoading.value = false;
|
fileLoading.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果通过 flowInstId 没有获取到数据,则使用 purchaseId 获取
|
// 如果通过 flowInstId 没有获取到数据,则使用 purchaseId 获取
|
||||||
if (!contractData && purchaseId) {
|
if (!contractData && purchaseId) {
|
||||||
try {
|
try {
|
||||||
fileLoading.value = true;
|
fileLoading.value = true;
|
||||||
const res = await getByPurchaseId(purchaseId);
|
const res = await getByPurchaseId(purchaseId);
|
||||||
if (res.code === 0 && res.data) {
|
if (res.code === 0 && res.data) {
|
||||||
contractData = res.data;
|
contractData = res.data;
|
||||||
}
|
}
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
ElMessage.error(e?.msg || '加载合同信息失败');
|
ElMessage.error(e?.msg || '加载合同信息失败');
|
||||||
} finally {
|
} finally {
|
||||||
fileLoading.value = false;
|
fileLoading.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (contractData) {
|
if (contractData) {
|
||||||
formData.value = {
|
formData.value = {
|
||||||
purchaseId: purchaseId,
|
purchaseId: purchaseId,
|
||||||
contractNo: contractData.contractNo || '',
|
contractNo: contractData.contractNo || '',
|
||||||
contractName: contractData.contractName || '',
|
contractName: contractData.contractName || '',
|
||||||
money: contractData.money,
|
money: contractData.money,
|
||||||
isBidding: contractData.isBidding || '0',
|
isBidding: contractData.isBidding || '0',
|
||||||
isLegalAdviser: contractData.isLegalAdviser || '0',
|
isLegalAdviser: contractData.isLegalAdviser || '0',
|
||||||
legalAdviserOpinion: contractData.legalAdviserOpinion || '',
|
legalAdviserOpinion: contractData.legalAdviserOpinion || '',
|
||||||
isDepts: contractData.isDepts || '0',
|
isDepts: contractData.isDepts || '0',
|
||||||
isSchool: contractData.isSchool || '0',
|
isSchool: contractData.isSchool || '0',
|
||||||
remarks: contractData.remarks || '',
|
remarks: contractData.remarks || '',
|
||||||
contractFileIds: [],
|
contractFileIds: [],
|
||||||
supplementFileIds: [],
|
supplementFileIds: [],
|
||||||
};
|
};
|
||||||
(formData.value as any).flowStatus = contractData.flowStatus;
|
(formData.value as any).flowStatus = contractData.flowStatus;
|
||||||
|
|
||||||
if (contractData.contractFiles && contractData.contractFiles.length > 0) {
|
if (contractData.contractFiles && contractData.contractFiles.length > 0) {
|
||||||
contractFiles.value = contractData.contractFiles;
|
contractFiles.value = contractData.contractFiles;
|
||||||
}
|
}
|
||||||
if (contractData.supplementFiles && contractData.supplementFiles.length > 0) {
|
if (contractData.supplementFiles && contractData.supplementFiles.length > 0) {
|
||||||
supplementFiles.value = contractData.supplementFiles;
|
supplementFiles.value = contractData.supplementFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果有 purchaseId,加载采购申请信息
|
// 如果有 purchaseId,加载采购申请信息
|
||||||
if (purchaseId && !applyData.value.id) {
|
if (purchaseId && !applyData.value.id) {
|
||||||
try {
|
try {
|
||||||
const applyRes = await getObj(purchaseId);
|
const applyRes = await getObj(purchaseId);
|
||||||
if (applyRes.code === 0 && applyRes.data) {
|
if (applyRes.code === 0 && applyRes.data) {
|
||||||
applyData.value = applyRes.data;
|
applyData.value = applyRes.data;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('加载采购申请信息失败', e);
|
console.error('加载采购申请信息失败', e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlePreview = async (row: any) => {
|
const handlePreview = async (row: any) => {
|
||||||
if (!row.id) {
|
if (!row.id) {
|
||||||
ElMessage.warning('文件ID不存在');
|
ElMessage.warning('文件ID不存在');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const blob = await previewFileById(row.id);
|
const blob = await previewFileById(row.id);
|
||||||
previewUrl.value = window.URL.createObjectURL(blob);
|
previewUrl.value = window.URL.createObjectURL(blob);
|
||||||
previewTitle.value = row.fileTitle || '文件预览';
|
previewTitle.value = row.fileTitle || '文件预览';
|
||||||
previewVisible.value = true;
|
previewVisible.value = true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
ElMessage.error('预览失败');
|
ElMessage.error('预览失败');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDownload = async (row: any) => {
|
const handleDownload = async (row: any) => {
|
||||||
if (!row.id) {
|
if (!row.id) {
|
||||||
ElMessage.warning('文件ID不存在');
|
ElMessage.warning('文件ID不存在');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const blob = await downloadFileById(row.id);
|
const blob = await downloadFileById(row.id);
|
||||||
const url = window.URL.createObjectURL(blob);
|
const url = window.URL.createObjectURL(blob);
|
||||||
const link = document.createElement('a');
|
const link = document.createElement('a');
|
||||||
link.href = url;
|
link.href = url;
|
||||||
link.download = row.fileTitle || '附件.pdf';
|
link.download = row.fileTitle || '附件.pdf';
|
||||||
document.body.appendChild(link);
|
document.body.appendChild(link);
|
||||||
link.click();
|
link.click();
|
||||||
document.body.removeChild(link);
|
document.body.removeChild(link);
|
||||||
window.URL.revokeObjectURL(url);
|
window.URL.revokeObjectURL(url);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
ElMessage.error('下载失败');
|
ElMessage.error('下载失败');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleFlowSave = async () => {
|
const handleFlowSave = async () => {
|
||||||
try {
|
try {
|
||||||
await formRef.value?.validate();
|
await formRef.value?.validate();
|
||||||
|
|
||||||
const contractFileIds = contractFiles.value.filter((f: any) => f.id).map((f: any) => f.id);
|
const contractFileIds = contractFiles.value.filter((f: any) => f.id).map((f: any) => f.id);
|
||||||
const supplementFileIds = supplementFiles.value.filter((f: any) => f.id).map((f: any) => f.id);
|
const supplementFileIds = supplementFiles.value.filter((f: any) => f.id).map((f: any) => f.id);
|
||||||
|
|
||||||
await updateContract({
|
await updateContract({
|
||||||
...formData.value,
|
...formData.value,
|
||||||
purchaseId: formData.value.purchaseId || effectivePurchaseId.value,
|
purchaseId: formData.value.purchaseId || effectivePurchaseId.value,
|
||||||
contractFileIds,
|
contractFileIds,
|
||||||
supplementFileIds,
|
supplementFileIds,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (props.currJob && props.currElTab?.id) {
|
if (props.currJob && props.currElTab?.id) {
|
||||||
currElTabIsSave(props.currJob, props.currElTab.id, true, emit);
|
currElTabIsSave(props.currJob, props.currElTab.id, true, emit);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
ElMessage.error(e?.msg || '保存失败');
|
ElMessage.error(e?.msg || '保存失败');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const registerFlowCallbacks = () => {
|
const registerFlowCallbacks = () => {
|
||||||
if (!isFlowEmbed.value) return;
|
if (!isFlowEmbed.value) return;
|
||||||
|
|
||||||
if (props.currJob?.resolveSaves) {
|
if (props.currJob?.resolveSaves) {
|
||||||
props.currJob.resolveSaves.push(handleFlowSave);
|
props.currJob.resolveSaves.push(handleFlowSave);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await loadApplyData();
|
await loadApplyData();
|
||||||
await loadContractData();
|
await loadContractData();
|
||||||
registerFlowCallbacks();
|
registerFlowCallbacks();
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.currJob,
|
() => props.currJob,
|
||||||
async (newVal) => {
|
async (newVal) => {
|
||||||
if (newVal) {
|
if (newVal) {
|
||||||
await loadApplyData();
|
await loadApplyData();
|
||||||
await loadContractData();
|
await loadContractData();
|
||||||
registerFlowCallbacks();
|
registerFlowCallbacks();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ immediate: false }
|
{ immediate: false }
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.contract-audit-container {
|
.contract-audit-container {
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
background: var(--el-fill-color-lighter);
|
background: var(--el-fill-color-lighter);
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-card,
|
.info-card,
|
||||||
.contract-card,
|
.contract-card,
|
||||||
.file-card {
|
.file-card {
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-header {
|
.card-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-title {
|
.card-title {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: var(--el-text-color-primary);
|
color: var(--el-text-color-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.preview-container {
|
.preview-container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 75vh;
|
height: 75vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
.preview-iframe {
|
.preview-iframe {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
border: none;
|
border: none;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
Reference in New Issue
Block a user