CRM-合同:完善合同表单

(cherry picked from commit 90e0baf5bc)
This commit is contained in:
puhui999 2024-01-27 23:43:30 +08:00 committed by shizhong
parent b6fbecd32b
commit 49b7bb1821
3 changed files with 83 additions and 57 deletions

View File

@ -57,3 +57,8 @@ export const deleteContract = async (id: number) => {
export const exportContract = async (params) => {
return await request.download({ url: `/crm/contract/export-excel`, params })
}
// 提交审核
export const handleApprove = async (id: number) => {
return await request.put({ url: `/crm/contract/approve?id=${id}` })
}

View File

@ -145,15 +145,12 @@
<CardTitle class="mb-10px" title="审批信息" />
</el-col>
<el-col :span="12">
<el-form-item label="工作流" prop="processInstanceId">
<el-input v-model="formData.processInstanceId" placeholder="请选择工作流" />
</el-form-item>
<el-button class="m-20px" link type="primary">查看工作流</el-button>
</el-col>
</el-row>
</el-form>
<template #footer>
<el-button :disabled="formLoading" type="primary" @click="submitForm(1)">提交审核</el-button>
<el-button :disabled="formLoading" type="primary" @click="submitForm(2)">保存草稿</el-button>
<el-button :disabled="formLoading" type="primary" @click="submitForm">保存</el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
@ -165,7 +162,6 @@ import * as UserApi from '@/api/system/user'
import * as ContactApi from '@/api/crm/contact'
import * as BusinessApi from '@/api/crm/business'
import ProductList from './components/ProductList.vue'
import { cloneDeep } from 'lodash-es'
const { t } = useI18n() //
const message = useMessage() //
@ -176,7 +172,11 @@ const formLoading = ref(false) // 表单的加载中1修改时的数据加
const formType = ref('') // create - update -
const formData = ref<ContractApi.ContractVO>({} as ContractApi.ContractVO)
const formRules = reactive({
name: [{ required: true, message: '合同名称不能为空', trigger: 'blur' }]
name: [{ required: true, message: '合同名称不能为空', trigger: 'blur' }],
customerId: [{ required: true, message: '客户不能为空', trigger: 'blur' }],
orderDate: [{ required: true, message: '下单日期不能为空', trigger: 'blur' }],
ownerUserId: [{ required: true, message: '负责人不能为空', trigger: 'blur' }],
no: [{ required: true, message: '合同编号不能为空', trigger: 'blur' }]
})
const formRef = ref() // Ref
watch(
@ -219,7 +219,7 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async (status: number) => {
const submitForm = async () => {
//
if (!formRef) return
const valid = await formRef.value.validate()
@ -227,8 +227,7 @@ const submitForm = async (status: number) => {
//
formLoading.value = true
try {
const data = cloneDeep(unref(formData.value)) as unknown as ContractApi.ContractVO
data.status = status
const data = unref(formData.value) as unknown as ContractApi.ContractVO
if (formType.value === 'create') {
await ContractApi.createContract(data)
message.success(t('common.createSuccess'))

View File

@ -2,44 +2,52 @@
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
:model="queryParams"
class="-mb-15px"
label-width="68px"
>
<el-form-item label="合同编号" prop="no">
<el-input
v-model="queryParams.no"
placeholder="请输入合同编号"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
clearable
placeholder="请输入合同编号"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="合同名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入合同名称"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
clearable
placeholder="请输入合同名称"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
<el-button type="primary" @click="openForm('create')" v-hasPermi="['crm:contract:create']">
<Icon icon="ep:plus" class="mr-5px" /> 新增
<el-button @click="handleQuery">
<Icon class="mr-5px" icon="ep:search" />
搜索
</el-button>
<el-button @click="resetQuery">
<Icon class="mr-5px" icon="ep:refresh" />
重置
</el-button>
<el-button v-hasPermi="['crm:contract:create']" type="primary" @click="openForm('create')">
<Icon class="mr-5px" icon="ep:plus" />
新增
</el-button>
<el-button
type="success"
plain
@click="handleExport"
:loading="exportLoading"
v-hasPermi="['crm:contract:export']"
:loading="exportLoading"
plain
type="success"
@click="handleExport"
>
<Icon icon="ep:download" class="mr-5px" /> 导出
<Icon class="mr-5px" icon="ep:download" />
导出
</el-button>
</el-form-item>
</el-form>
@ -48,70 +56,78 @@
<!-- 列表 -->
<!-- TODO 芋艿各种字段要调整 -->
<ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="合同编号" align="center" prop="id" />
<el-table-column label="合同名称" align="center" prop="name" />
<el-table-column label="客户名称" align="center" prop="customerId" />
<el-table-column label="商机名称" align="center" prop="businessId" />
<el-table-column label="工作流名称" align="center" prop="processInstanceId" />
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true">
<el-table-column align="center" label="合同编号" prop="id" />
<el-table-column align="center" label="合同名称" prop="name" />
<el-table-column align="center" label="客户名称" prop="customerId" />
<el-table-column align="center" label="商机名称" prop="businessId" />
<el-table-column align="center" label="工作流名称" prop="processInstanceId" />
<el-table-column
:formatter="dateFormatter"
align="center"
label="下单时间"
align="center"
prop="orderDate"
:formatter="dateFormatter"
width="180px"
/>
<el-table-column label="负责人" align="center" prop="ownerUserId" />
<el-table-column label="合同编号" align="center" prop="no" />
<el-table-column align="center" label="负责人" prop="ownerUserId" />
<el-table-column align="center" label="合同编号" prop="no" />
<el-table-column
:formatter="dateFormatter"
align="center"
label="开始时间"
align="center"
prop="startTime"
:formatter="dateFormatter"
width="180px"
/>
<el-table-column
:formatter="dateFormatter"
align="center"
label="结束时间"
align="center"
prop="endTime"
:formatter="dateFormatter"
width="180px"
/>
<el-table-column label="合同金额" align="center" prop="price" />
<el-table-column label="整单折扣" align="center" prop="discountPercent" />
<el-table-column label="产品总金额" align="center" prop="productPrice" />
<el-table-column label="联系人" align="center" prop="contactId" />
<el-table-column label="公司签约人" align="center" prop="signUserId" />
<el-table-column align="center" label="合同金额" prop="price" />
<el-table-column align="center" label="整单折扣" prop="discountPercent" />
<el-table-column align="center" label="产品总金额" prop="productPrice" />
<el-table-column align="center" label="联系人" prop="contactId" />
<el-table-column align="center" label="公司签约人" prop="signUserId" />
<el-table-column
:formatter="dateFormatter"
align="center"
label="最后跟进时间"
align="center"
prop="contactLastTime"
:formatter="dateFormatter"
width="180px"
/>
<el-table-column
label="创建时间"
align="center"
prop="createTime"
:formatter="dateFormatter"
align="center"
label="创建时间"
prop="createTime"
width="180px"
/>
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column align="center" label="备注" prop="remark" />
<el-table-column label="操作" width="120px">
<template #default="scope">
<el-button
v-hasPermi="['crm:contract:update']"
link
type="primary"
@click="openForm('update', scope.row.id)"
v-hasPermi="['crm:contract:update']"
>
编辑
</el-button>
<el-button
v-hasPermi="['crm:contract:update']"
link
type="primary"
@click="handleApprove(scope.row.id)"
>
提交审核
</el-button>
<el-button
v-hasPermi="['crm:contract:delete']"
link
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['crm:contract:delete']"
>
删除
</el-button>
@ -120,9 +136,9 @@
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
v-model:page="queryParams.pageNo"
:total="total"
@pagination="getList"
/>
</ContentWrap>
@ -130,7 +146,7 @@
<!-- 表单弹窗添加/修改 -->
<ContractForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts">
<script lang="ts" setup>
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import * as ContractApi from '@/api/crm/contract'
@ -216,6 +232,12 @@ const handleExport = async () => {
}
}
/** 提交审核 **/
const handleApprove = async (id: number) => {
await ContractApi.handleApprove(id)
message.success('提交审核成功!')
await getList()
}
/** 初始化 **/
onMounted(() => {
getList()