邮寄人员

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
@@ -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>