邮寄人员

This commit is contained in:
姚亚男
2021-09-15 18:07:26 +08:00
parent 1e106f1e22
commit 4b23889e16
8 changed files with 832 additions and 14 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

@@ -5,22 +5,22 @@
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row>
<a-col :xl="5" :lg="5" :md="24" :sm="24">
<a-col :xl="6" :lg="6" :md="24" :sm="24">
<a-form-item label="文件名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入文件名称" v-model="queryParam.fileName"></a-input>
</a-form-item>
</a-col>
<a-col :xl="5" :lg="5" :md="24" :sm="24">
<a-col :xl="6" :lg="6" :md="24" :sm="24">
<a-form-item label="用户名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入用户名称" v-model="queryParam.meetingName"></a-input>
<a-input placeholder="请输入用户名称" v-model="queryParam.downloadName"></a-input>
</a-form-item>
</a-col>
<a-col :xl="5" :lg="5" :md="24" :sm="24">
<a-form-item label="会议名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入会议名称" v-model="queryParam.meetingName"></a-input>
</a-form-item>
</a-col>
<a-col :xl="9" :lg="9" :md="24" :sm="24">
<!-- <a-col :xl="5" :lg="5" :md="24" :sm="24">-->
<!-- <a-form-item label="会议名称" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
<!-- <a-input placeholder="请输入会议名称" v-model="queryParam.meetingName"></a-input>-->
<!-- </a-form-item>-->
<!-- </a-col>-->
<a-col :xl="8" :lg="8" :md="24" :sm="24">
<a-form-item label="下载时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-date
format="YYYY-MM-DD"
@@ -43,7 +43,7 @@
<a-row>
<a-col :xl="5" :lg="5" :md="8" :sm="24">
<a-form-item label="企业名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入企业名称" v-model="queryParam.meetingName"></a-input>
<a-input placeholder="请输入企业名称" v-model="queryParam.companyName"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
@@ -54,7 +54,7 @@
</a-col>
</a-row>
<div class="table-page-search-submitButtons">
<a-button icon="export" type="primary" class="opera-btn" @click="handleExportXls">导出</a-button>
<a-button icon="export" type="primary" class="opera-btn" @click="handleExportXls('资料下载记录')">导出</a-button>
</div>
</a-form>
</div>
@@ -127,7 +127,9 @@ import PageHeaderTitle from '@comp/layouts/PageHeaderTitle'
import IconImg from '@/assets/imgs/icon/icon_committee.png'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import { RangeDateMixin } from '@/mixins/RangeDateMixin'
import { downloadFile } from '@/api/manage'
import JDate from '@comp/tools/JDate'
import { getAction } from '@/api/manage'
export default {
name: 'DataDownloadRecord',
@@ -139,6 +141,10 @@ export default {
visible: false,
record: {},
confirmLoading: false,
dateKeyObj: {
beginKey: 'startTime',
endKey: 'endTime'
},
labelCol: {
xl: { span: 6 },
xs: { span: 24 },
@@ -211,6 +217,10 @@ export default {
}
}
],
filters: {
column: '',
order: ''
},
url: {
list: 'payFileDownloadRecord/payFileDownloadRecord/list',
exportXlsUrl: 'payFileDownloadRecord/payFileDownloadRecord/exportXls',
@@ -218,22 +228,56 @@ export default {
}
}
},
watch:{
// format显示YYYY-MM-DD 后端传 YYYY-MM-DD HH:mm:ss
'queryParam.startTime'() {
this.queryParam.startTime = this.queryParam.startTime ? (this.queryParam.startTime.indexOf('00:00:00') > -1 ? this.queryParam.startTime : this.queryParam.startTime + ' 00:00:00') : undefined
this.lastQueryParam = {...this.queryParam}
},
'queryParam.endTime'() {
this.queryParam.endTime = this.queryParam.endTime ? (this.queryParam.endTime.indexOf('23:59:59') > -1 ? this.queryParam.endTime : this.queryParam.endTime + ' 23:59:59') : undefined
this.lastQueryParam = {...this.queryParam}
}
},
methods: {
download(record) {
this.record = record
this.visible = true
},
handleOk() {
console.log(this.record.fileId)
console.log(this.record)
this.confirmLoading = true
// 下载文件
getAction(this.url.download, { fileId: this.record.fileId}).then(res=>{
console.log(res)
this.close()
}).catch( err =>{
this.$message.error(err.message)
this.confirmLoading = false
})
},
handleExportXls(fileName) {
if (!fileName || typeof fileName != 'string') {
fileName = '导出文件'
}
let param = this.getQueryParams()
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
param['ids'] = this.selectedRowKeys.join(',')
}
downloadFile(this.url.exportXlsUrl, fileName + '.xls', param)
},
handleCancel() {
this.visible = false
},
close() {
this.visible = false
this.confirmLoading = false
}
}
}
</script>
<style scoped lang="less">
@import '~@assets/less/common.less';
.download-modal{
width: 100%;
display: flex;
@@ -138,6 +138,10 @@ export default {
IconImg,
disableMixinCreated: true,
isData: true, // 默认是资料目录
dateKeyObj: {
beginKey: 'startTime',
endKey: 'endTime'
},
filters: {
id: '', // 目录id,查询该目录下文件
column: '',
@@ -87,13 +87,20 @@ export default {
},
url: {
treeList: 'payDataDirectory/payDataDirectory/tree', // 资料树
treeMeetList: 'payDataDirectory/payDataDirectory/meetingTree', // 会议树
add: 'payDataFile/payDataFile/add', // 资料和会议的添加 post
edit: 'payDataFile/payDataFile/edit', // 资料和会议的编辑 post
}
}
},
created(){
getAction(this.url.treeList).then(res => {
let url = ''
if (this.dataType === 1) {
url = this.url.treeList
} else {
url = this.url.treeMeetList
}
getAction(url).then(res => {
if (res.success) {
this.treeDataEdit = res.result
}
+227
View File
@@ -0,0 +1,227 @@
<template>
<div>
<page-header-title :img-for-icon="IconImg"></page-header-title>
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :xl="7" :lg="8" :md="8" :sm="24">
<a-form-item label="来款项目">
<a-input placeholder="请输入来款项目" v-model="queryParam.projectName"></a-input>
</a-form-item>
</a-col>
<a-col :xl="7" :lg="8" :md="8" :sm="24">
<a-form-item label="项目负责人">
<select-principal v-model="queryParam.pricipalId" placeholder="请选择项目负责人"></select-principal>
</a-form-item>
</a-col>
<a-col :xl="7" :lg="8" :md="8" :sm="24">
<a-form-item label="来款单位">
<a-input placeholder="请输入来款单位" v-model="queryParam.chargeCompanyName"></a-input>
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col :xl="12" :lg="12" :md="16" :sm="24">
<a-form-item label="邮寄时间">
<j-date
format="YYYY-MM-DD"
placeholder="请选择开始日期"
class="query-group-cust"
v-model="queryParam.startTime"
:disabled-date="disabledStartDate">
</j-date>
<span class="query-group-split-cust"></span>
<j-date
format="YYYY-MM-DD"
placeholder="请选择结束日期"
class="query-group-cust"
v-model="queryParam.endTime"
:disabled-date="disabledEndDate">
</j-date>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
<a-button @click="searchReset" icon="reload" class="reset-button" style="margin-left: 8px">重置</a-button>
</span>
</a-col>
</a-row>
</a-form>
</div>
<!-- 查询区域-END -->
<!-- 操作按钮区域 -->
<div class="table-operator">
<a-button type="primary" icon="download" @click="handleExportXls">导出</a-button>
</div>
<!-- table区域-begin -->
<div>
<a-table
ref="table"
size="middle"
bordered
rowKey="id"
:scroll="{x:true}"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
class="j-table-force-nowrap"
@change="handleTableChange">
<template slot="htmlSlot" slot-scope="text, record">
<div class="primary-color" v-html="text"></div>
</template>
<span slot="print" slot-scope="text, record" class="action-span-cell">
<a-button type="primary" :disabled="record.sendMethod === 1 ? true : false">打印</a-button>
</span>
<span slot="action" slot-scope="text, record" class="action-span-cell">
<a @click="handleAdd" v-if="record.postStatus === 0">邮寄</a>
<a @click="handleEdit(record)" v-if="record.postStatus === 1">修改</a>
<a @click="goLogistics(record.id)" v-if="record.postStatus === 1">查看物流</a>
</span>
</a-table>
</div>
<mail-modal ref="modalForm" @ok="modalFormOk"></mail-modal>
</a-card>
</div>
</template>
<script>
import {mixinDevice} from '@/utils/mixin'
import {JeroListMixin} from '@/mixins/JeroListMixin'
import {RangeDateMixin} from '@/mixins/RangeDateMixin'
import PageHeaderTitle from '@comp/layouts/PageHeaderTitle'
import IconImg from '@/assets/imgs/icon/xin.png'
import MailModal from './modules/MailModal'
import JDate from '@comp/tools/JDate'
import { downloadFile } from '@/api/manage'
import SelectPrincipal from '@/components/company/SelectPrincipal'
export default {
name: 'BillMail',
mixins: [JeroListMixin, mixinDevice, RangeDateMixin],
components: {
PageHeaderTitle, JDate, MailModal, SelectPrincipal
},
data() {
return {
IconImg,
dateKeyObj: {
beginKey: 'startTime',
endKey: 'endTime'
},
filters: {
column: '',
order: ''
},
columns: [
{
title: '序号',
dataIndex: '',
key: 'rowIndex',
align: 'center',
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
{
title: '来款项目',
align: 'center',
dataIndex: 'projectName',
scopedSlots: {customRender: 'htmlSlot'}
},
{
title: '票号',
align: 'center',
dataIndex: 'billNo',
},
{
title: '开票金额',
align: 'center',
dataIndex: 'invoiceAmount',
},
{
title: '项目负责人',
align: 'center',
dataIndex: 'pricipalName',
},
{
title: '来款单位',
align: 'center',
dataIndex: 'chargeCompanyName',
},
{
title: '邮寄联系人',
align: 'center',
dataIndex: 'liaisonMan',
},
{
title: '联系人电话',
align: 'center',
dataIndex: 'mobile',
},
{
title: '状态',
align: 'center',
dataIndex: 'postStatus_dictText',
},
{
title: '打印',
align: 'center',
dataIndex: '',
scopedSlots: { customRender: 'print' }
},
{
title: '操作',
align: 'center',
fixed: 'right',
width: 160,
scopedSlots: {customRender: 'action'}
},
],
url: {
list: '/mail/payMailBill/list',
exportXlsUrl: '/mail/payMailBill/exportXls',
},
}
},
methods: {
// 查看物流
goLogistics(id) {
},
handleAdd: function () {
this.$refs.modalForm.add()
this.$refs.modalForm.title = '邮寄'
this.$refs.modalForm.disableSubmit = false
},
handleEdit: function (record) {
this.$refs.modalForm.edit(record)
console.log(record)
this.$refs.modalForm.title = '修改'
this.$refs.modalForm.disableSubmit = false
},
handleExportXls() {
let date = new Date()
let fileName = date.getFullYear() + '年' + (date.getMonth() + 1) + '月' + date.getDate() + '日' + date.getHours() + '时' + date.getMinutes() + '分' + date.getSeconds() + '秒票据邮寄信息'
let param = this.getQueryParams()
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
param['ids'] = this.selectedRowKeys.join(',')
}
console.log('导出参数', param)
downloadFile(this.url.exportXlsUrl, fileName + '.xls', param)
},
}
}
</script>
<style scoped lang="less">
@import '~@assets/less/common.less';
</style>
+210
View File
@@ -0,0 +1,210 @@
<template>
<div>
<page-header-title :img-for-icon="IconImg"></page-header-title>
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :xl="5" :lg="8" :md="8" :sm="24">
<a-form-item label="合同编号">
<a-input placeholder="请输入来款项目" v-model="queryParam.contractNum"></a-input>
</a-form-item>
</a-col>
<a-col :xl="5" :lg="8" :md="8" :sm="24">
<a-form-item label="合同名称">
<a-input placeholder="请输入来款单位" v-model="queryParam.contractName"></a-input>
</a-form-item>
</a-col>
<a-col :xl="5" :lg="12" :md="16" :sm="24">
<a-form-item label="签订单位">
<a-input placeholder="请输入签订单位" v-model="queryParam.signedCompanyTemporaryName"></a-input>
</a-form-item>
</a-col>
<a-col :xl="5" :lg="8" :md="8" :sm="24">
<a-form-item label="负责人">
<select-principal v-model="queryParam.pricipalId" placeholder="请选择负责人"></select-principal>
</a-form-item>
</a-col>
<a-col :xl="4" :lg="7" :md="8" :sm="24">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
<a-button @click="searchReset" icon="reload" class="reset-button" style="margin-left: 8px">重置</a-button>
</span>
</a-col>
</a-row>
</a-form>
</div>
<!-- 查询区域-END -->
<!-- 操作按钮区域 -->
<div class="table-operator">
<a-button type="primary" icon="download" @click="handleExportXls">导出</a-button>
</div>
<!-- table区域-begin -->
<div>
<a-table
ref="table"
size="middle"
bordered
rowKey="id"
:scroll="{x:true}"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
class="j-table-force-nowrap"
@change="handleTableChange">
<template slot="htmlSlot" slot-scope="text, record">
<div class="primary-color" v-html="text"></div>
</template>
<span slot="print" slot-scope="text, record" class="action-span-cell">
<a-button type="primary" :disabled="record.sendMethod === 1 ? true : false">打印</a-button>
</span>
<span slot="action" slot-scope="text, record" class="action-span-cell">
<a @click="handleAdd" v-if="record.postStatus === '0'">邮寄</a>
<a @click="handleEdit(record)" v-if="record.postStatus !== '0'">修改</a>
<a @click="goLogistics(record.id)" v-if="record.postStatus !== '0'">查看物流</a>
</span>
</a-table>
</div>
<mail-contract-modal ref="modalForm" @ok="modalFormOk"></mail-contract-modal>
</a-card>
</div>
</template>
<script>
import {mixinDevice} from '@/utils/mixin'
import {JeroListMixin} from '@/mixins/JeroListMixin'
import {RangeDateMixin} from '@/mixins/RangeDateMixin'
import PageHeaderTitle from '@comp/layouts/PageHeaderTitle'
import IconImg from '@/assets/imgs/icon/xin.png'
import MailContractModal from './modules/MailModal'
import { downloadFile } from '@/api/manage'
import SelectPrincipal from '@/components/company/SelectPrincipal'
export default {
name: 'ContractMail',
mixins: [JeroListMixin, mixinDevice, RangeDateMixin],
components: {
PageHeaderTitle, MailContractModal, SelectPrincipal
},
data() {
return {
IconImg,
dateKeyObj: {
beginKey: 'startTime',
endKey: 'endTime'
},
filters: {
column: '',
order: ''
},
columns: [
{
title: '序号',
dataIndex: '',
key: 'rowIndex',
align: 'center',
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
{
title: '合同编号',
align: 'center',
dataIndex: 'contractNum',
scopedSlots: {customRender: 'htmlSlot'}
},
{
title: '合同名称',
align: 'center',
dataIndex: 'contractName',
},
{
title: '签订单位',
align: 'center',
dataIndex: 'signedCompanyTemporaryName',
},
{
title: '负责人',
align: 'center',
dataIndex: 'pricipalName',
},
{
title: '合同总金额',
align: 'center',
dataIndex: 'contractAmount',
},
{
title: '邮寄联系人',
align: 'center',
dataIndex: 'liaisonMan',
},
{
title: '联系人电话',
align: 'center',
dataIndex: 'mobile',
},
{
title: '状态',
align: 'center',
dataIndex: 'postStatus_dictText',
},
{
title: '打印',
align: 'center',
dataIndex: '',
scopedSlots: { customRender: 'print' }
},
{
title: '操作',
align: 'center',
fixed: 'right',
width: 160,
scopedSlots: {customRender: 'action'}
},
],
url: {
list: '/payMailContract/payMailContract/list',
exportXlsUrl: '/payMailContract/payMailContract/exportXls',
},
}
},
methods: {
// 查看物流
goLogistics(id) {
},
handleAdd: function () {
this.$refs.modalForm.add()
this.$refs.modalForm.title = '邮寄'
this.$refs.modalForm.disableSubmit = false
},
handleEdit: function (record) {
this.$refs.modalForm.edit(record)
console.log(record)
this.$refs.modalForm.title = '修改'
this.$refs.modalForm.disableSubmit = false
},
handleExportXls() {
let date = new Date()
let fileName = date.getFullYear() + '年' + (date.getMonth() + 1) + '月' + date.getDate() + '日' + date.getHours() + '时' + date.getMinutes() + '分' + date.getSeconds() + '秒票据邮寄信息'
let param = this.getQueryParams()
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
param['ids'] = this.selectedRowKeys.join(',')
}
console.log('导出参数', param)
downloadFile(this.url.exportXlsUrl, fileName + '.xls', param)
},
}
}
</script>
<style scoped lang="less">
@import '~@assets/less/common.less';
</style>
@@ -0,0 +1,158 @@
<template>
<div>
<j-modal
:title="title"
:width="width"
:visible="visible"
:confirmLoading="confirmLoading"
switchFullscreen
@ok="handleOk"
@cancel="handleCancel"
cancelText="关闭">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-row>
<a-col>
<a-form-item label="快递公司:" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-dict-select-tag
v-decorator="['sendMethod', validatorRules.sendMethod]"
placeholder="请选择"
:trigger-change="true"
dict-code="mail_send"
></j-dict-select-tag>
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col>
<a-form-item label="快递单号:" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input
v-decorator="['postNo', validatorRules.postNo]"
placeholder="请输入快递单号"
></a-input>
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col>
<a-form-item label="邮寄时间:" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-date
format="YYYY-MM-DD"
placeholder="请选择邮寄时间"
class="query-group-cust"
style="width: 100%"
v-decorator="['sendDate', validatorRules.sendDate]"
>
</j-date>
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col>
<a-form-item label="备注:" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-textarea
placeholder="请输入备注"
:auto-size="{ minRows: 3, maxRows: 6 }"
v-decorator="['remark']"
:maxLength='200'
@change="e => {e.target.value = (e.target.value + '').trim()}"/>
</a-form-item>
</a-col>
</a-row>
</a-form>
</a-spin>
</j-modal>
</div>
</template>
<script>
import pick from 'lodash.pick'
import JDictSelectTag from '@/components/dict/JDictSelectTag'
import JDate from '@comp/tools/JDate'
import { httpAction } from '@/api/manage'
export default {
name: 'MailContractModal',
components: {JDictSelectTag, JDate},
data() {
return {
title: '操作',
width: 500,
visible: false,
confirmLoading: false,
form: this.$form.createForm(this),
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 17 }
},
validatorRules: {
sendMethod: {
rules: [{required: true, message: '请选择快递公司'}],
validateTrigger: 'blur, change'
},
sendDate: {
rules: [{required: true, message: '请选择邮寄时间'}],
validateTrigger: 'blur, change'
},
postNo: {
rules: [{required: true, message: '请输入快递单号'}],
validateTrigger: 'blur'
},
},
url: {
edit: 'payMailContract/payMailContract/edit'
}
}
},
methods: {
add() {
this.edit({})
},
edit(record) {
this.form.resetFields()
this.model = Object.assign({}, record)
this.visible = true
let date = new Date()
let sendDate = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
this.$nextTick(() => {
this.form.setFieldsValue({'sendDate': sendDate})
this.form.setFieldsValue(pick(this.model, 'sendMethod', 'sendDate', 'postNo', 'remark'))
})
},
close() {
this.$emit('close')
this.visible = false
},
handleOk() {
const that = this
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
that.confirmLoading = true
const formData = Object.assign(this.model, values)
console.log('表单提交数据', formData)
httpAction(this.url.edit, formData, 'post').then((res) => {
if (res.success) {
that.$message.success(res.message)
that.$emit('ok')
that.confirmLoading = false
that.close()
} else {
that.$message.warning(res.message)
}
}).finally(() => {
that.confirmLoading = false
})
}
})
},
handleCancel() {
this.close()
}
}
}
</script>
<style scoped lang="less"></style>
@@ -0,0 +1,168 @@
<template>
<div>
<j-modal
:title="title"
:width="width"
:visible="visible"
:confirmLoading="confirmLoading"
switchFullscreen
@ok="handleOk"
@cancel="handleCancel"
cancelText="关闭">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-row>
<a-col>
<a-form-item label="快递公司:" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-dict-select-tag
v-decorator="['sendMethod', validatorRules.sendMethod]"
placeholder="请选择"
:trigger-change="true"
dict-code="mail_send"
></j-dict-select-tag>
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col>
<a-form-item label="快递单号:" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input
v-decorator="['postNo', validatorRules.postNo]"
placeholder="请输入快递单号"
></a-input>
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col>
<a-form-item label="邮寄时间:" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-date
format="YYYY-MM-DD"
placeholder="请选择邮寄时间"
class="query-group-cust"
style="width: 100%"
v-decorator="['sendDate', validatorRules.sendDate]"
>
</j-date>
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col>
<a-form-item label="备注:" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-textarea
placeholder="请输入备注"
:auto-size="{ minRows: 3, maxRows: 6 }"
v-decorator="['remark']"
:maxLength='200'
@change="e => {e.target.value = (e.target.value + '').trim()}"/>
</a-form-item>
</a-col>
</a-row>
</a-form>
</a-spin>
</j-modal>
</div>
</template>
<script>
import pick from 'lodash.pick'
import JDictSelectTag from '@/components/dict/JDictSelectTag'
import JDate from '@comp/tools/JDate'
import { httpAction } from '@/api/manage'
export default {
name: 'MailModal',
components: {JDictSelectTag, JDate},
data() {
return {
title: '操作',
width: 500,
visible: false,
confirmLoading: false,
form: this.$form.createForm(this),
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 17 }
},
validatorRules: {
sendMethod: {
rules: [{required: true, message: '请选择快递公司'}],
validateTrigger: 'blur, change'
},
sendDate: {
rules: [{required: true, message: '请选择邮寄时间'}],
validateTrigger: 'blur, change'
},
postNo: {
rules: [{required: true, message: '请输入快递单号'}],
validateTrigger: 'blur'
},
},
url: {
add: 'mail/payMailBill/edit',
edit: 'mail/payMailBill/edit2'
}
}
},
methods: {
add() {
this.edit({})
},
edit(record) {
this.form.resetFields()
this.model = Object.assign({}, record)
this.visible = true
let date = new Date()
let sendDate = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
this.$nextTick(() => {
this.form.setFieldsValue({'sendDate': sendDate})
this.form.setFieldsValue(pick(this.model, 'sendMethod', 'sendDate', 'postNo', 'remark'))
})
},
close() {
this.$emit('close')
this.visible = false
},
handleOk() {
const that = this
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
that.confirmLoading = true
let httpurl = ''
let method = ''
if (!this.model.id) {
httpurl += this.url.add
method = 'post'
} else {
httpurl += this.url.edit
method = 'post'
}
const formData = Object.assign(this.model, values)
console.log('表单提交数据', formData)
httpAction(httpurl, formData, method).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.$emit('ok')
that.confirmLoading = false
that.close()
} else {
that.$message.warning(res.message)
}
}).finally(() => {
that.confirmLoading = false
})
}
})
},
handleCancel() {
this.close()
}
}
}
</script>
<style scoped lang="less"></style>