123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- <template>
- <a-modal
- centered
- class="fundAount-basicInfo-modal"
- :footer="null"
- :maskClosable="false"
- :title="(isEdit?'编辑':'新增')+'资金账户'"
- v-model="isShow"
- @cancel="isShow=false"
- :width="600">
- <a-spin :spinning="spinning" tip="Loading...">
- <a-form-model
- id="fundAount-basicInfo-form"
- ref="ruleForm"
- :model="form"
- :rules="rules"
- :label-col="formItemLayout.labelCol"
- :wrapper-col="formItemLayout.wrapperCol" >
- <a-form-model-item label="账户类型" prop="settleStyleSn">
- <v-select
- code="SETTLE_STYLE"
- id="fundAount-settleStyleSn"
- v-model="form.settleStyleSn"
- @change="settleStyleChange"
- allowClear
- placeholder="请选择账户类型"
- ></v-select>
- </a-form-model-item>
- <a-form-model-item label="账户名称" prop="accountName">
- <a-input
- id="fundAount-accountName"
- :maxLength="30"
- v-model.trim="form.accountName"
- placeholder="请输入账户名称(最多30个字符)"
- allowClear />
- </a-form-model-item>
- <a-form-model-item label="账户号码" prop="accountNo">
- <a-input
- id="fundAount-accountNo"
- :maxLength="30"
- v-model.trim="form.accountNo"
- placeholder="请输入账户号码(最多30个字符)"
- allowClear />
- </a-form-model-item>
- <a-form-model-item :wrapper-col="{ span: 12, offset: 6 }" style="text-align: center;">
- <a-button type="primary" :loading="confirmLoading" @click="handleSubmit" id="chooseCustom-btn-submit">保存</a-button>
- <a-button @click="isShow=false" style="margin-left: 15px" id="chooseCustom-btn-back">取消</a-button>
- </a-form-model-item>
- </a-form-model>
- </a-spin>
- </a-modal>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { VSelect } from '@/components'
- import { settleAccountSave, settleAccountDetail } from '@/api/settleAcount'
- export default {
- name: 'BasicInfoModal',
- components: { VSelect },
- mixins: [commonMixin],
- props: {
- openModal: { // 弹框显示状态
- type: Boolean,
- default: false
- }
- },
- data () {
- return {
- spinning: false,
- confirmLoading: false,
- isShow: this.openModal, // 是否打开弹框
- isEdit: false,
- formItemLayout: {
- labelCol: { span: 4 },
- wrapperCol: { span: 18 }
- },
- form: {
- settleStyleSn: '',
- settleStyleName: '',
- accountName: '',
- accountNo: ''
- },
- rules: {
- settleStyleSn: [
- { required: true, message: '请选择账户类型', trigger: 'change' }
- ],
- accountName: [
- { required: true, message: '请输入账户名称(最多30个字符)', trigger: 'change' }
- ],
- accountNo: [
- { required: true, message: '请输入账户号(最多30个字符)', trigger: 'change' }
- ]
- }
- }
- },
- methods: {
- resetForm () {
- this.$refs.ruleForm.resetFields()
- this.form = {
- settleStyleSn: '',
- settleStyleName: '',
- accountName: '',
- accountNo: ''
- }
- this.isEdit = false
- },
- settleStyleChange (v, name) {
- this.form.settleStyleName = name.dispName
- },
- // 保存
- handleSubmit (e) {
- e.preventDefault()
- const _this = this
- this.$refs.ruleForm.validate(valid => {
- if (valid) {
- _this.spinning = true
- settleAccountSave(_this.form).then(res => {
- if (res.status == 200) {
- _this.isShow = false
- _this.$emit('ok', res.data)
- _this.spinning = false
- _this.$message.info(res.message)
- } else {
- _this.spinning = false
- }
- })
- } else {
- return false
- }
- })
- },
- // 编辑信息
- setData (data) {
- if (data && data.settleAccountSn) {
- settleAccountDetail({ settleAccountSn: data.settleAccountSn }).then(res => {
- if (res.status == '200') {
- this.form = Object.assign(this.form, res.data || {})
- this.isEdit = true
- }
- })
- }
- }
- },
- watch: {
- // 父页面传过来的弹框状态
- openModal (newValue, oldValue) {
- this.isShow = newValue
- },
- // 重定义的弹框状态
- isShow (newValue, oldValue) {
- if (!newValue) {
- this.$emit('close')
- this.resetForm()
- }
- }
- }
- }
- </script>
- <style lang="less">
- .fundAount-basicInfo-modal{
- .ant-modal-body {
- padding: 40px 40px 24px;
- }
- .radio-s{
- margin-bottom: 8px;
- }
- .btn-cont {
- text-align: center;
- margin: 35px 0 10px;
- }
- }
- </style>
|