pull/781/head
parent
efd3c8d3f1
commit
9e53e72f1e
|
|
@ -25,6 +25,7 @@
|
|||
<el-form-item label="客户名称" prop="customerId">
|
||||
<el-select
|
||||
v-model="formData.customerId"
|
||||
disabled
|
||||
placeholder=""
|
||||
class="w-1/1"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -187,11 +187,11 @@ const getList = (val: []) => {
|
|||
if(!formData.value.some(v => v.id === item.id)) {
|
||||
val.forEach(item => {
|
||||
formData.value.push({
|
||||
"customerContactId": item.id,
|
||||
"customerName": item.name,
|
||||
"phoneNumber": item.mobile,
|
||||
"wechat":item. wechat,
|
||||
"email":item. email,
|
||||
"id": item.id
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -462,7 +462,7 @@
|
|||
合同甲方关联单位
|
||||
</ContentWrap>
|
||||
<ContentWrap>
|
||||
<ContractAAuthorizedCompanyForm :type="1" ref="contractAAuthorizedCompanyFormRef" :contract-id="formData.id" />
|
||||
<ContractAAuthorizedCompanyForm :type="1" ref="contractAAuthorizedCompanyFormRef" :data="formData.contractAAuthorizedCompanys" :contract-id="formData.id" />
|
||||
</ContentWrap>
|
||||
<ContentWrap style="border: none;font-weight:700">
|
||||
合同甲方授权人信息
|
||||
|
|
|
|||
|
|
@ -303,12 +303,15 @@
|
|||
:total="total"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<FileTemplateForm ref="formRef" @success="onPrintContract" />
|
||||
</ContentWrap>
|
||||
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { dateFormatter, dateFormatter2 } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import FileTemplateForm from './templateForm.vue'
|
||||
import * as ContractApi from '@/api/crm/contract'
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import { erpPriceInputFormatter, erpPriceTableColumnFormatter } from '@/utils'
|
||||
|
|
@ -399,7 +402,7 @@ const handleCommand = (command: string, row: UserApi.UserVO) => {
|
|||
handleChange(row)
|
||||
break
|
||||
case 'handlePrint':
|
||||
onPrintContract(row)
|
||||
getPrintTemplate(row)
|
||||
break
|
||||
case 'handleDelete':
|
||||
handleDelete(row.id)
|
||||
|
|
@ -445,9 +448,13 @@ const handleSubmit = async (row: ContractApi.ContractVO) => {
|
|||
await getList()
|
||||
}
|
||||
|
||||
|
||||
const getPrintTemplate = (row) => {
|
||||
formRef.value.open(row.id)
|
||||
}
|
||||
|
||||
const onPrintContract = async (row: ContractApi.ContractVO) => {
|
||||
try {
|
||||
await message.confirm(`您确定打印【${row.name}】合同吗?`)
|
||||
const res = await ContractApi.printContract(row.id)
|
||||
|
||||
if (!res) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,109 @@
|
|||
<template>
|
||||
<Dialog title="选择模版" v-model="dialogVisible" width="50%">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="100px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-form-item label="合同模版" prop="name">
|
||||
<el-select
|
||||
v-model="formData.customerId"
|
||||
placeholder="请选择"
|
||||
class="w-1/1"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in contactList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { FileTemplateApi, FileTemplateVO } from '@/api/crm/filetemplate'
|
||||
|
||||
/** CRM 合同模版 表单 */
|
||||
defineOptions({ name: 'FileTemplateForm' })
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
url: undefined,
|
||||
description: undefined,
|
||||
})
|
||||
const formRules = reactive({
|
||||
name: [{ required: true, message: '合同名称不能为空', trigger: 'blur' }],
|
||||
url: [{ required: true, message: '文件地址不能为空', trigger: 'blur' }],
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await FileTemplateApi.getFileTemplate(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as FileTemplateVO
|
||||
if (formType.value === 'create') {
|
||||
await FileTemplateApi.createFileTemplate(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await FileTemplateApi.updateFileTemplate(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
url: undefined,
|
||||
description: undefined,
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
||||
|
|
@ -418,7 +418,7 @@ const querySearchAsync = async (queryString: string, cb: (arg: any) => void) =>
|
|||
clearTimeout(timeout)
|
||||
timeout = setTimeout(() => {
|
||||
cb(results)
|
||||
}, 3000 * Math.random())
|
||||
}, 2000 * Math.random())
|
||||
}
|
||||
const createFilter = (queryString: string) => {
|
||||
return (restaurant: RestaurantItem) => {
|
||||
|
|
|
|||
|
|
@ -123,11 +123,11 @@
|
|||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" fixed="right" label="操作" width="60">
|
||||
<!-- <el-table-column align="center" fixed="right" label="操作" width="60">
|
||||
<template #default="{ $index }">
|
||||
<el-button @click="handleDelete($index)" link>—</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
</el-table>
|
||||
</el-form>
|
||||
<el-row justify="center" class="mt-3">
|
||||
|
|
|
|||
Loading…
Reference in New Issue