|
|
|
@ -13,40 +13,136 @@
|
|
|
|
|
<a-tooltip placement="top" title="删除">
|
|
|
|
|
<SvgIcon class="ml15" size="18" name="delete" @click="deleteData" />
|
|
|
|
|
</a-tooltip>
|
|
|
|
|
<a-tooltip placement="top" title="打印">
|
|
|
|
|
<SvgIcon class="ml15" size="18" name="print" @click="print" />
|
|
|
|
|
</a-tooltip>
|
|
|
|
|
<a-tooltip placement="top" title="发送">
|
|
|
|
|
<SvgIcon class="ml15" size="18" name="submit" @click="sendEmail" />
|
|
|
|
|
</a-tooltip>
|
|
|
|
|
<a-tooltip placement="top" title="历史">
|
|
|
|
|
<SvgIcon class="ml15" size="18" name="submit" @click="historyList" />
|
|
|
|
|
</a-tooltip>
|
|
|
|
|
</div>
|
|
|
|
|
<BasicForm @register="registerForm" />
|
|
|
|
|
</a-spin>
|
|
|
|
|
<DsPrint ref="dsPrint" temCode="release_the_cabin" :paramJsonStr="'{id:' + id + '}'"/>
|
|
|
|
|
<!-- 邮件发送弹窗 -->
|
|
|
|
|
<EmailModal ref="emailModal" temCode="release_the_cabin"></EmailModal>
|
|
|
|
|
<!-- 历史弹窗 -->
|
|
|
|
|
<a-modal
|
|
|
|
|
v-model:visible="visible"
|
|
|
|
|
title="历史信息"
|
|
|
|
|
width="80%"
|
|
|
|
|
>
|
|
|
|
|
<BasicTable @register="registerTable"></BasicTable>
|
|
|
|
|
<template #footer></template>
|
|
|
|
|
</a-modal>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
|
import { ref, watch, defineExpose, defineEmits } from 'vue'
|
|
|
|
|
import { SvgIcon } from '/@/components/Icon'
|
|
|
|
|
import { BasicForm, useForm } from '/@/components/Form/index'
|
|
|
|
|
import { formSchema } from './OpBusinessYardColumns'
|
|
|
|
|
import { EditOpBusinessYard, GetOpBusinessYardInfo, BatchDelOpBusinessYard } from './LetterApi'
|
|
|
|
|
// 打印组件
|
|
|
|
|
import DsPrint from '/@/components/Print/index.vue'
|
|
|
|
|
import { formatParams } from '/@/hooks/web/common'
|
|
|
|
|
// 邮件发送组件
|
|
|
|
|
import EmailModal from '/@/components/EmailModal/index.vue'
|
|
|
|
|
import { formSchema, historyColumns } from './OpBusinessYardColumns'
|
|
|
|
|
import { EditOpBusinessYard, GetOpBusinessYardInfo, BatchDelOpBusinessYard, GetYardHistoryList } from './LetterApi'
|
|
|
|
|
import { useMessage } from '/@/hooks/web/useMessage'
|
|
|
|
|
import { useUserStore } from '/@/store/modules/user'
|
|
|
|
|
import { propTypes } from '/@/utils/propTypes'
|
|
|
|
|
import { BasicTable, useTable } from '/@/components/Table'
|
|
|
|
|
const props = defineProps({
|
|
|
|
|
businessId: {
|
|
|
|
|
type: Object
|
|
|
|
|
},
|
|
|
|
|
selectId: propTypes.string,
|
|
|
|
|
})
|
|
|
|
|
// 历史弹窗
|
|
|
|
|
const visible = ref(false)
|
|
|
|
|
|
|
|
|
|
// 初始化回填表单数据
|
|
|
|
|
const init = (nVal) => {
|
|
|
|
|
// 回填联系人信息
|
|
|
|
|
const yard = {}
|
|
|
|
|
if (nVal.orderContactList && nVal.orderContactList.length) {
|
|
|
|
|
const yardList = nVal.orderContactList.filter(item => {
|
|
|
|
|
return nVal.yardId == item.customerId
|
|
|
|
|
})
|
|
|
|
|
if (yardList && yardList.length) {
|
|
|
|
|
yard['yardAttn'] = yardList[0].name
|
|
|
|
|
yard['yardTel'] = yardList[0].tel
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 回填from
|
|
|
|
|
const userStore = useUserStore()
|
|
|
|
|
yard['fromName'] = userStore.getUserInfo.userName
|
|
|
|
|
yard['fromTel'] = userStore.getUserInfo.tel
|
|
|
|
|
yard['fromEmail'] = userStore.getUserInfo.email
|
|
|
|
|
yard['fromMobile'] = userStore.getUserInfo.phone
|
|
|
|
|
if (contaList.value && contaList.value.length) {
|
|
|
|
|
yard['toName'] = contaList.value[0].customerName
|
|
|
|
|
yard['toAttn'] = contaList.value[0].name
|
|
|
|
|
yard['toAttnTel'] = contaList.value[0].tel
|
|
|
|
|
yard['toAttnEmail'] = contaList.value[0].email
|
|
|
|
|
yard['toAttnMobile'] = ''
|
|
|
|
|
}
|
|
|
|
|
setFieldsValue({
|
|
|
|
|
...nVal,
|
|
|
|
|
businessId: nVal.id,
|
|
|
|
|
id: 0,
|
|
|
|
|
...yard
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
const [registerTable, { reload }] = useTable({
|
|
|
|
|
title: '',
|
|
|
|
|
api: async (p) => {
|
|
|
|
|
const res: API.DataResult = await GetYardHistoryList(p)
|
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
|
resolve({ data: [...res.data], total: res.count })
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
beforeFetch: (p) => {
|
|
|
|
|
return formatParams(p)
|
|
|
|
|
},
|
|
|
|
|
columns: historyColumns,
|
|
|
|
|
isTreeTable: false,
|
|
|
|
|
pagination: true,
|
|
|
|
|
striped: false,
|
|
|
|
|
bordered: true,
|
|
|
|
|
showIndexColumn: true,
|
|
|
|
|
canResize: false
|
|
|
|
|
})
|
|
|
|
|
// 历史弹窗
|
|
|
|
|
const historyList = () => {
|
|
|
|
|
visible.value = true
|
|
|
|
|
}
|
|
|
|
|
// 邮件发送组件
|
|
|
|
|
const emailModal = ref(null)
|
|
|
|
|
// 打印
|
|
|
|
|
const dsPrint = ref(null)
|
|
|
|
|
const print = () => {
|
|
|
|
|
dsPrint.value.init()
|
|
|
|
|
}
|
|
|
|
|
let details = {}
|
|
|
|
|
const contaList = ref([])
|
|
|
|
|
const id = ref(null)
|
|
|
|
|
watch(
|
|
|
|
|
() => props.businessId,
|
|
|
|
|
async (nVal) => {
|
|
|
|
|
if (nVal) {
|
|
|
|
|
id.value = nVal.id
|
|
|
|
|
details = nVal
|
|
|
|
|
const res: API.DataResult = await GetOpBusinessYardInfo({ id: nVal.id })
|
|
|
|
|
if (res.data == null) {
|
|
|
|
|
setFieldsValue({
|
|
|
|
|
...nVal,
|
|
|
|
|
businessId: nVal.id,
|
|
|
|
|
id: 0
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
contaList.value = res?.data?.contacts
|
|
|
|
|
if (res.data.id) {
|
|
|
|
|
setFieldsValue({
|
|
|
|
|
...res.data
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
init(nVal)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
@ -55,7 +151,7 @@
|
|
|
|
|
// 声明Emits
|
|
|
|
|
const emit = defineEmits(['success', 'register'])
|
|
|
|
|
const { createMessage } = useMessage()
|
|
|
|
|
const [registerForm, { getFieldsValue, setFieldsValue, validate, updateSchema }] = useForm({
|
|
|
|
|
const [registerForm, { getFieldsValue, setFieldsValue, validate, updateSchema, resetFields }] = useForm({
|
|
|
|
|
labelWidth: 100,
|
|
|
|
|
schemas: formSchema,
|
|
|
|
|
showActionButtonGroup: false,
|
|
|
|
@ -83,10 +179,17 @@
|
|
|
|
|
BatchDelOpBusinessYard({ ids: [data.id] }).then(res => {
|
|
|
|
|
console.log(res)
|
|
|
|
|
createMessage.success('删除成功!')
|
|
|
|
|
resetFields()
|
|
|
|
|
init(details)
|
|
|
|
|
emit('success')
|
|
|
|
|
loading.value = false
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
// 发送邮件
|
|
|
|
|
const sendEmail = () => {
|
|
|
|
|
// 发送邮件
|
|
|
|
|
emailModal.value.init([], props.businessId)
|
|
|
|
|
}
|
|
|
|
|
defineExpose({
|
|
|
|
|
setFieldsValue
|
|
|
|
|
})
|
|
|
|
|