跟新
This commit is contained in:
231
src/views/purchase/purchasingcontract/form.vue
Normal file
231
src/views/purchase/purchasingcontract/form.vue
Normal file
@@ -0,0 +1,231 @@
|
||||
<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>
|
||||
301
src/views/purchase/purchasingcontract/index.vue
Normal file
301
src/views/purchase/purchasingcontract/index.vue
Normal file
@@ -0,0 +1,301 @@
|
||||
<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>
|
||||
@@ -182,7 +182,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" class="mb12">
|
||||
<el-col :span="8" class="mb12" v-if="!isEntrustCenterChannel">
|
||||
<el-form-item label="采购方式" prop="purchaseType" :required="!isEntrustCenterChannel">
|
||||
<el-select
|
||||
v-model="dataForm.purchaseType"
|
||||
@@ -201,7 +201,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb12" v-if="isPurchaseType(DEPT_PURCHASE_TYPE.BUSINESS_NEGOTIATION)">
|
||||
<el-col :span="24" class="mb12" v-if="isPurchaseType(DEPT_PURCHASE_TYPE.BUSINESS_NEGOTIATION) && isEntrustCenterChannel">
|
||||
<el-form-item label="洽谈理由" prop="negotiationReason" required>
|
||||
<el-input
|
||||
v-model="dataForm.negotiationReason"
|
||||
@@ -215,7 +215,7 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" class="mb12" v-if="isPurchaseType(DEPT_PURCHASE_TYPE.BUSINESS_NEGOTIATION)">
|
||||
<el-col :span="8" class="mb12" v-if="isPurchaseType(DEPT_PURCHASE_TYPE.BUSINESS_NEGOTIATION) && isEntrustCenterChannel">
|
||||
<el-form-item label="商务洽谈表" prop="businessNegotiationTable" required>
|
||||
<upload-file
|
||||
v-model="dataForm.businessNegotiationTable"
|
||||
@@ -236,7 +236,7 @@
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" class="mb12" v-if="isPurchaseType(DEPT_PURCHASE_TYPE.MARKET_PURCHASE)">
|
||||
<el-col :span="8" class="mb12" v-if="isPurchaseType(DEPT_PURCHASE_TYPE.MARKET_PURCHASE) && isEntrustCenterChannel">
|
||||
<el-form-item label="市场采购纪要" prop="marketPurchaseMinutes" required>
|
||||
<upload-file
|
||||
v-model="dataForm.marketPurchaseMinutes"
|
||||
@@ -257,7 +257,7 @@
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" class="mb12" v-if="isPurchaseType(DEPT_PURCHASE_TYPE.ONLINE_MALL)">
|
||||
<el-col :span="8" class="mb12" v-if="isPurchaseType(DEPT_PURCHASE_TYPE.ONLINE_MALL) && isEntrustCenterChannel">
|
||||
<el-form-item label="网上商城采购相关材料" prop="onlineMallMaterials" required>
|
||||
<upload-file
|
||||
v-model="dataForm.onlineMallMaterials"
|
||||
@@ -269,7 +269,7 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" class="mb12" v-if="isInquiryPurchaseType">
|
||||
<el-col :span="8" class="mb12" v-if="isInquiryPurchaseType && isEntrustCenterChannel">
|
||||
<el-form-item label="询价模板" prop="inquiryTemplate" required>
|
||||
<upload-file
|
||||
v-model="dataForm.inquiryTemplate"
|
||||
|
||||
@@ -0,0 +1,229 @@
|
||||
<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="是否需要招标" 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="ContractDialog">
|
||||
import { ref, reactive, computed } from 'vue'
|
||||
import { 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: ''
|
||||
},
|
||||
purchaseNo: ''
|
||||
});
|
||||
|
||||
const rules = {
|
||||
contractNo: [{ required: true, message: '请输入合同编号', trigger: 'blur' }],
|
||||
contractName: [{ required: true, message: '请输入合同名称', trigger: 'blur' }],
|
||||
money: [{ required: true, message: '请输入合同金额', 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 = (purchaseApply: any, contract: any) => {
|
||||
state.visible = true;
|
||||
state.loading = false;
|
||||
state.purchaseNo = purchaseApply?.purchaseNo || '';
|
||||
state.formData.purchaseId = purchaseApply?.id || purchaseApply?.purchaseId || '';
|
||||
|
||||
if (contract && contract.id) {
|
||||
state.operation = 'edit';
|
||||
state.formData = {
|
||||
id: contract.id,
|
||||
contractNo: contract.contractNo || '',
|
||||
contractName: contract.contractName || '',
|
||||
money: contract.money || 0,
|
||||
purchaseId: contract.purchaseId || state.formData.purchaseId,
|
||||
isBidding: contract.isBidding || '0',
|
||||
isLegalAdviser: contract.isLegalAdviser || '0',
|
||||
legalAdviserOpinion: contract.legalAdviserOpinion || '',
|
||||
isDepts: contract.isDepts || '0',
|
||||
isSchool: contract.isSchool || '0',
|
||||
remarks: contract.remarks || ''
|
||||
};
|
||||
} else {
|
||||
state.operation = 'add';
|
||||
state.formData = {
|
||||
id: '',
|
||||
contractNo: '',
|
||||
contractName: '',
|
||||
money: 0,
|
||||
purchaseId: state.formData.purchaseId,
|
||||
isBidding: '0',
|
||||
isLegalAdviser: '0',
|
||||
legalAdviserOpinion: '',
|
||||
isDepts: '0',
|
||||
isSchool: '0',
|
||||
remarks: ''
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
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;
|
||||
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>
|
||||
@@ -332,6 +332,9 @@
|
||||
<!-- 更新材料弹窗 -->
|
||||
<UpdateFilesDialog ref="updateFilesDialogRef" @refresh="getDataList" />
|
||||
|
||||
<!-- 合同弹窗 -->
|
||||
<ContractDialog ref="contractDialogRef" @refresh="getDataList" />
|
||||
|
||||
<!-- 招标文件审核弹窗 -->
|
||||
<!-- <DocAuditDialog ref="docAuditDialogRef" @refresh="getDataList" />-->
|
||||
|
||||
@@ -399,6 +402,7 @@ import { getTree } from '/@/api/purchase/purchasingcategory';
|
||||
import { List, Document, DocumentCopy, Search, Money, CircleCheck, InfoFilled, Calendar, OfficeBuilding, Warning, DocumentChecked, Edit, Delete, Upload, FolderOpened, Download, User, RefreshRight, Shop, CopyDocument } from '@element-plus/icons-vue'
|
||||
import other from '/@/utils/other'
|
||||
import { Session } from '/@/utils/storage'
|
||||
import { getByPurchaseId } from "/@/api/purchase/purchasingcontract";
|
||||
|
||||
// 角色常量
|
||||
const PURCHASE_DEPT_AUDIT_ROLE_CODE = 'PURCHASE_DEPT_AUDIT'
|
||||
@@ -413,6 +417,7 @@ const PurchasingAcceptModal = defineAsyncComponent(() => import('./accept/Purcha
|
||||
const FlowCommentTimeline = defineAsyncComponent(() => import('/@/views/jsonflow/comment/timeline.vue'));
|
||||
const FileArchiveDialog = defineAsyncComponent(() => import('./FileArchiveDialog.vue'));
|
||||
const UpdateFilesDialog = defineAsyncComponent(() => import('./UpdateFilesDialog.vue'));
|
||||
const ContractDialog = defineAsyncComponent(() => import('./contract/ContractDialog.vue'));
|
||||
// const DocAuditDialog = defineAsyncComponent(() => import('./docAudit/DocAuditDialog.vue'));
|
||||
|
||||
// 字典数据和品目树数据
|
||||
@@ -443,6 +448,7 @@ const currFlowCommentType = ref<'apply' | 'file'>('apply')
|
||||
const implementFormRef = ref()
|
||||
const fileArchiveDialogRef = ref()
|
||||
const updateFilesDialogRef = ref()
|
||||
const contractDialogRef = ref()
|
||||
|
||||
/** 采购代表弹窗 */
|
||||
const representorDialogVisible = ref(false)
|
||||
@@ -708,6 +714,12 @@ const getActionMenuItems = (row: any) => {
|
||||
icon: RefreshRight,
|
||||
visible: () => (isCompleted || isRunning) && hasAuth('purchase_purchasingapply_edit'),
|
||||
},
|
||||
{
|
||||
command: 'contract',
|
||||
label: '采购合同',
|
||||
icon: DocumentChecked,
|
||||
visible: () => isCompleted,
|
||||
},
|
||||
// {
|
||||
// command: 'downloadFileApply',
|
||||
// label: '下载文件审批表',
|
||||
@@ -766,6 +778,9 @@ const handleMoreCommand = (command: string, row: any) => {
|
||||
case 'updateFiles':
|
||||
handleUpdateFiles(row);
|
||||
break;
|
||||
case 'contract':
|
||||
handleContract(row);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -779,6 +794,21 @@ const handleUpdateFiles = (row: any) => {
|
||||
updateFilesDialogRef.value?.open(id, row.purchaseNo);
|
||||
};
|
||||
|
||||
/** 采购合同 */
|
||||
const handleContract = async (row: any) => {
|
||||
const id = row?.id ?? row?.purchaseId;
|
||||
if (!id) {
|
||||
useMessage().warning('无法获取采购申请ID');
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const res = await getByPurchaseId(id);
|
||||
contractDialogRef.value?.open(row, res?.data || null);
|
||||
} catch (e) {
|
||||
useMessage().error('获取合同信息失败');
|
||||
}
|
||||
};
|
||||
|
||||
/** 下载审批表 */
|
||||
const handleDownloadApply = (row: any) => {
|
||||
const id = row?.id ?? row?.purchaseId;
|
||||
|
||||
Reference in New Issue
Block a user