|
|
@ -7,7 +7,7 @@
|
|
|
|
@register="registerModal"
|
|
|
|
@register="registerModal"
|
|
|
|
@ok="handleSave"
|
|
|
|
@ok="handleSave"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<BasicForm @register="registerForm" />
|
|
|
|
<BasicForm @register="registerForm" @linkageForm="linkageForm" />
|
|
|
|
<!-- 任务邮件接收人配置 -->
|
|
|
|
<!-- 任务邮件接收人配置 -->
|
|
|
|
<BasicForm @register="registerReceiverForm" />
|
|
|
|
<BasicForm @register="registerReceiverForm" />
|
|
|
|
<!-- 任务邮件发送人配置 -->
|
|
|
|
<!-- 任务邮件发送人配置 -->
|
|
|
@ -22,7 +22,7 @@
|
|
|
|
:loading="loading"
|
|
|
|
:loading="loading"
|
|
|
|
ghost
|
|
|
|
ghost
|
|
|
|
style="margin-right: 0.8rem"
|
|
|
|
style="margin-right: 0.8rem"
|
|
|
|
@click="closeModal"
|
|
|
|
@click="handlecloseModal"
|
|
|
|
>取消</a-button
|
|
|
|
>取消</a-button
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<a-button
|
|
|
|
<a-button
|
|
|
@ -50,17 +50,56 @@
|
|
|
|
import { formSchema, ReceiverformSchema, SenderformSchema, CcformSchema } from './columns'
|
|
|
|
import { formSchema, ReceiverformSchema, SenderformSchema, CcformSchema } from './columns'
|
|
|
|
import { ApiEdit, ApiInfo, GetPrintTemplateList } from './api'
|
|
|
|
import { ApiEdit, ApiInfo, GetPrintTemplateList } from './api'
|
|
|
|
import { useMessage } from '/@/hooks/web/useMessage'
|
|
|
|
import { useMessage } from '/@/hooks/web/useMessage'
|
|
|
|
|
|
|
|
import { any } from 'node_modules/vue-types/dist'
|
|
|
|
// 声明Emits
|
|
|
|
// 声明Emits
|
|
|
|
const emit = defineEmits(['success', 'register'])
|
|
|
|
const emit = defineEmits(['success', 'register'])
|
|
|
|
const isUpdate = ref(true)
|
|
|
|
const isUpdate = ref(true)
|
|
|
|
const loading = ref(false)
|
|
|
|
const loading = ref(false)
|
|
|
|
const rowId = ref('')
|
|
|
|
const rowId = ref('')
|
|
|
|
const { createMessage } = useMessage()
|
|
|
|
const { createMessage } = useMessage()
|
|
|
|
const [registerForm, { resetFields, setFieldsValue, validate, updateSchema }] = useForm({
|
|
|
|
const [
|
|
|
|
|
|
|
|
registerForm,
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
resetFields,
|
|
|
|
|
|
|
|
setFieldsValue,
|
|
|
|
|
|
|
|
validate,
|
|
|
|
|
|
|
|
updateSchema,
|
|
|
|
|
|
|
|
appendSchemaByField,
|
|
|
|
|
|
|
|
removeSchemaByField,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
] = useForm({
|
|
|
|
labelWidth: 100,
|
|
|
|
labelWidth: 100,
|
|
|
|
schemas: formSchema,
|
|
|
|
schemas: formSchema,
|
|
|
|
showActionButtonGroup: false,
|
|
|
|
showActionButtonGroup: false,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
const DiyFieldIdS = ref<any>([])
|
|
|
|
|
|
|
|
function linkageForm(data) {
|
|
|
|
|
|
|
|
console.log(data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 清楚所有添加的Schema
|
|
|
|
|
|
|
|
if (DiyFieldIdS.value.length) {
|
|
|
|
|
|
|
|
DiyFieldIdS.value.forEach((item) => {
|
|
|
|
|
|
|
|
removeSchemaByField(item.value)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DiyFieldIdS.value.splice(0)
|
|
|
|
|
|
|
|
data.forEach((item) => {
|
|
|
|
|
|
|
|
appendSchemaByField(
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
field: item.value,
|
|
|
|
|
|
|
|
label: item.label,
|
|
|
|
|
|
|
|
component: 'Input',
|
|
|
|
|
|
|
|
colProps: { span: 6 },
|
|
|
|
|
|
|
|
componentProps: {
|
|
|
|
|
|
|
|
placeholder: '自定义文件名称',
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
'attachments',
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
DiyFieldIdS.value.push(item)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
const [
|
|
|
|
const [
|
|
|
|
registerReceiverForm,
|
|
|
|
registerReceiverForm,
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -100,18 +139,43 @@
|
|
|
|
CcResetFields()
|
|
|
|
CcResetFields()
|
|
|
|
setModalProps({ confirmLoading: false, loading: true })
|
|
|
|
setModalProps({ confirmLoading: false, loading: true })
|
|
|
|
isUpdate.value = !!data?.isUpdate
|
|
|
|
isUpdate.value = !!data?.isUpdate
|
|
|
|
|
|
|
|
DiyFieldIdS.value.forEach((item) => {
|
|
|
|
|
|
|
|
removeSchemaByField(item.value)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
DiyFieldIdS.value.splice(0)
|
|
|
|
if (unref(isUpdate)) {
|
|
|
|
if (unref(isUpdate)) {
|
|
|
|
// setModalProps({ confirmLoading: true });
|
|
|
|
// setModalProps({ confirmLoading: true });
|
|
|
|
rowId.value = data.record.id
|
|
|
|
rowId.value = data.record.id
|
|
|
|
const res: API.DataResult = await ApiInfo({ id: unref(rowId) })
|
|
|
|
const res: API.DataResult = await ApiInfo({ id: unref(rowId) })
|
|
|
|
if (res.succeeded) {
|
|
|
|
if (res.succeeded) {
|
|
|
|
|
|
|
|
let DiyFieldIdSArr: any = []
|
|
|
|
|
|
|
|
let DiyFieldIdSObj: any = {}
|
|
|
|
let attachments: any = []
|
|
|
|
let attachments: any = []
|
|
|
|
|
|
|
|
let arrRes: any = await GetPrintTemplateList({
|
|
|
|
|
|
|
|
queryCondition: `[]`,
|
|
|
|
|
|
|
|
pageCondition: {
|
|
|
|
|
|
|
|
pageIndex: 1,
|
|
|
|
|
|
|
|
pageSize: 999,
|
|
|
|
|
|
|
|
sortConditions: [],
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
})
|
|
|
|
res.data.attachments.forEach((e) => {
|
|
|
|
res.data.attachments.forEach((e) => {
|
|
|
|
attachments.push(e.templateId)
|
|
|
|
attachments.push(e.templateId)
|
|
|
|
|
|
|
|
arrRes.data.forEach((element) => {
|
|
|
|
|
|
|
|
if (element.id == e.templateId) {
|
|
|
|
|
|
|
|
DiyFieldIdSArr.push({
|
|
|
|
|
|
|
|
value: e.templateId,
|
|
|
|
|
|
|
|
label: element.templateName,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
DiyFieldIdSObj[e.templateId] = e.fileName
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
linkageForm(DiyFieldIdSArr)
|
|
|
|
setFieldsValue({
|
|
|
|
setFieldsValue({
|
|
|
|
...res.data,
|
|
|
|
...res.data,
|
|
|
|
attachments,
|
|
|
|
attachments,
|
|
|
|
|
|
|
|
...DiyFieldIdSObj,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
if (res.data.documentType == 0) {
|
|
|
|
if (res.data.documentType == 0) {
|
|
|
|
updateSchema({ field: 'name', required: true })
|
|
|
|
updateSchema({ field: 'name', required: true })
|
|
|
@ -139,7 +203,12 @@
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const getTitle = computed(() => (!unref(isUpdate) ? '新增邮件模板' : '编辑邮件模板'))
|
|
|
|
const getTitle = computed(() => (!unref(isUpdate) ? '新增邮件模板' : '编辑邮件模板'))
|
|
|
|
|
|
|
|
function handlecloseModal() {
|
|
|
|
|
|
|
|
DiyFieldIdS.value.forEach((item) => {
|
|
|
|
|
|
|
|
removeSchemaByField(item.value)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
closeModal()
|
|
|
|
|
|
|
|
}
|
|
|
|
async function handleSave(exit) {
|
|
|
|
async function handleSave(exit) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
const values = await validate()
|
|
|
|
const values = await validate()
|
|
|
@ -153,6 +222,7 @@
|
|
|
|
sortConditions: [],
|
|
|
|
sortConditions: [],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
console.log(DiyFieldIdS.value)
|
|
|
|
|
|
|
|
|
|
|
|
arrRes.data.forEach((item) => {
|
|
|
|
arrRes.data.forEach((item) => {
|
|
|
|
values.attachments.forEach((e) => {
|
|
|
|
values.attachments.forEach((e) => {
|
|
|
@ -162,7 +232,7 @@
|
|
|
|
attachments.push({
|
|
|
|
attachments.push({
|
|
|
|
taskMailId: values.id,
|
|
|
|
taskMailId: values.id,
|
|
|
|
templateId: item.id,
|
|
|
|
templateId: item.id,
|
|
|
|
fileName: item.templateName,
|
|
|
|
fileName: values[item.id] ? values[item.id] : item.templateName,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
@ -194,35 +264,61 @@
|
|
|
|
createMessage.error(res.message)
|
|
|
|
createMessage.error(res.message)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
exit && closeModal()
|
|
|
|
exit && handlecloseModal()
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
// loading.value = false;
|
|
|
|
// loading.value = false;
|
|
|
|
setModalProps({ confirmLoading: false, loading: false })
|
|
|
|
setModalProps({ confirmLoading: false, loading: false })
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
async function refresh() {
|
|
|
|
async function refresh() {
|
|
|
|
|
|
|
|
DiyFieldIdS.value.forEach((item) => {
|
|
|
|
|
|
|
|
removeSchemaByField(item.value)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
DiyFieldIdS.value.splice(0)
|
|
|
|
const res: API.DataResult = await ApiInfo({ id: unref(rowId) })
|
|
|
|
const res: API.DataResult = await ApiInfo({ id: unref(rowId) })
|
|
|
|
|
|
|
|
|
|
|
|
if (res.succeeded) {
|
|
|
|
if (res.succeeded) {
|
|
|
|
|
|
|
|
let DiyFieldIdSArr: any = []
|
|
|
|
|
|
|
|
let DiyFieldIdSObj: any = {}
|
|
|
|
let attachments: any = []
|
|
|
|
let attachments: any = []
|
|
|
|
|
|
|
|
let arrRes: any = await GetPrintTemplateList({
|
|
|
|
|
|
|
|
queryCondition: `[]`,
|
|
|
|
|
|
|
|
pageCondition: {
|
|
|
|
|
|
|
|
pageIndex: 1,
|
|
|
|
|
|
|
|
pageSize: 999,
|
|
|
|
|
|
|
|
sortConditions: [],
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
})
|
|
|
|
res.data.attachments.forEach((e) => {
|
|
|
|
res.data.attachments.forEach((e) => {
|
|
|
|
attachments.push(e.templateId)
|
|
|
|
attachments.push(e.templateId)
|
|
|
|
|
|
|
|
arrRes.data.forEach((element) => {
|
|
|
|
|
|
|
|
if (element.id == e.templateId) {
|
|
|
|
|
|
|
|
DiyFieldIdSArr.push({
|
|
|
|
|
|
|
|
value: e.templateId,
|
|
|
|
|
|
|
|
label: element.templateName,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
DiyFieldIdSObj[e.templateId] = e.fileName
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
linkageForm(DiyFieldIdSArr)
|
|
|
|
setFieldsValue({
|
|
|
|
setFieldsValue({
|
|
|
|
...res.data,
|
|
|
|
...res.data,
|
|
|
|
attachments,
|
|
|
|
attachments,
|
|
|
|
|
|
|
|
...DiyFieldIdSObj,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
if (res.data.documentType == 0) {
|
|
|
|
if (res.data.documentType == 0) {
|
|
|
|
updateSchema({ field: 'name', required: true })
|
|
|
|
updateSchema({ field: 'name', required: true })
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
updateSchema({ field: 'name', required: false })
|
|
|
|
updateSchema({ field: 'name', required: false })
|
|
|
|
}
|
|
|
|
}
|
|
|
|
await ReceiverSetFieldsValue({
|
|
|
|
ReceiverSetFieldsValue({
|
|
|
|
...res.data.receiver,
|
|
|
|
...res.data.receiver,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
await SenderSetFieldsValue({
|
|
|
|
SenderSetFieldsValue({
|
|
|
|
...res.data.sender,
|
|
|
|
...res.data.sender,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
await CcSetFieldsValue({
|
|
|
|
CcSetFieldsValue({
|
|
|
|
...res.data.cc,
|
|
|
|
...res.data.cc,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|