|
|
|
@ -2,13 +2,7 @@ |
|
|
|
|
<a-card :bordered="false"> |
|
|
|
|
<div class="card-title">{{ $route.meta.title }}</div> |
|
|
|
|
<a-spin :spinning="isLoading"> |
|
|
|
|
<a-form-model |
|
|
|
|
ref="myForm" |
|
|
|
|
class="my-form" |
|
|
|
|
:model="record" |
|
|
|
|
:label-col="labelCol" |
|
|
|
|
:wrapperCol="wrapperCol" |
|
|
|
|
> |
|
|
|
|
<a-form-model ref="myForm" class="my-form" :model="record" :label-col="labelCol" :wrapperCol="wrapperCol"> |
|
|
|
|
<a-form-model-item |
|
|
|
|
label="支付模板名称" |
|
|
|
|
prop="name" |
|
|
|
@ -33,11 +27,7 @@ |
|
|
|
|
<small>数字越小越靠前</small> |
|
|
|
|
</div> |
|
|
|
|
</a-form-model-item> |
|
|
|
|
<a-form-model-item |
|
|
|
|
label="支付方式" |
|
|
|
|
prop="method" |
|
|
|
|
:rules="[{ required: true, message: '请选择支付方式' }]" |
|
|
|
|
> |
|
|
|
|
<a-form-model-item label="支付方式" prop="method" :rules="[{ required: true, message: '请选择支付方式' }]"> |
|
|
|
|
<a-radio-group v-model="record.method" disabled> |
|
|
|
|
<a-radio :value="PaymentMethodEnum.WECHAT.value">{{ PaymentMethodEnum.WECHAT.name }}</a-radio> |
|
|
|
|
<a-radio :value="PaymentMethodEnum.ALIPAY.value">{{ PaymentMethodEnum.ALIPAY.name }}</a-radio> |
|
|
|
@ -50,10 +40,7 @@ |
|
|
|
|
</p> |
|
|
|
|
<p v-if="record.method === PaymentMethodEnum.ALIPAY.value" class="extra"> |
|
|
|
|
支付宝开发者平台: |
|
|
|
|
<a |
|
|
|
|
href="https://open.alipay.com/dev/workspace" |
|
|
|
|
target="_blank" |
|
|
|
|
>https://open.alipay.com/dev/workspace</a> |
|
|
|
|
<a href="https://open.alipay.com/dev/workspace" target="_blank">https://open.alipay.com/dev/workspace</a> |
|
|
|
|
</p> |
|
|
|
|
</div> |
|
|
|
|
</a-form-model-item> |
|
|
|
@ -88,10 +75,7 @@ |
|
|
|
|
</a-radio-group> |
|
|
|
|
</a-form-model-item> |
|
|
|
|
|
|
|
|
|
<div |
|
|
|
|
v-if="record.config.wechat.mchType === 'normal'" |
|
|
|
|
:mchType="record.config.wechat.mchType" |
|
|
|
|
> |
|
|
|
|
<div v-if="record.config.wechat.mchType === 'normal'" :mchType="record.config.wechat.mchType"> |
|
|
|
|
<a-form-model-item |
|
|
|
|
label="应用ID (AppID)" |
|
|
|
|
prop="config.wechat.normal.appId" |
|
|
|
@ -99,7 +83,9 @@ |
|
|
|
|
> |
|
|
|
|
<a-input v-model="record.config.wechat.normal.appId" autocomplete="off" /> |
|
|
|
|
<div class="form-item-help"> |
|
|
|
|
<small>微信小程序或者微信公众号的APPID,需要在哪个客户端支付就填写哪个,APP支付需要填写开放平台的应用APPID</small> |
|
|
|
|
<small |
|
|
|
|
>微信小程序或者微信公众号的APPID,需要在哪个客户端支付就填写哪个,APP支付需要填写开放平台的应用APPID</small |
|
|
|
|
> |
|
|
|
|
</div> |
|
|
|
|
</a-form-model-item> |
|
|
|
|
|
|
|
|
@ -119,11 +105,7 @@ |
|
|
|
|
prop="config.wechat.normal.apiKey" |
|
|
|
|
:rules="[{ required: true, message: '请填写支付密钥 (APIKEY)' }]" |
|
|
|
|
> |
|
|
|
|
<a-input |
|
|
|
|
type="password" |
|
|
|
|
v-model="record.config.wechat.normal.apiKey" |
|
|
|
|
autocomplete="off" |
|
|
|
|
/> |
|
|
|
|
<a-input type="password" v-model="record.config.wechat.normal.apiKey" autocomplete="off" /> |
|
|
|
|
<div class="form-item-help"> |
|
|
|
|
<small>"微信支付商户平台"" - "账户中心" - "API安全" - "设置API密钥"</small> |
|
|
|
|
</div> |
|
|
|
@ -160,10 +142,7 @@ |
|
|
|
|
</a-form-model-item> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<div |
|
|
|
|
v-if="record.config.wechat.mchType === 'provider'" |
|
|
|
|
:mchType="record.config.wechat.mchType" |
|
|
|
|
> |
|
|
|
|
<div v-if="record.config.wechat.mchType === 'provider'" :mchType="record.config.wechat.mchType"> |
|
|
|
|
<a-form-model-item |
|
|
|
|
label="服务商应用ID (AppID)" |
|
|
|
|
prop="config.wechat.provider.spAppId" |
|
|
|
@ -191,11 +170,7 @@ |
|
|
|
|
prop="config.wechat.provider.spApiKey" |
|
|
|
|
:rules="[{ required: true, message: '请填写服务商密钥 (APIKEY)' }]" |
|
|
|
|
> |
|
|
|
|
<a-input |
|
|
|
|
type="password" |
|
|
|
|
v-model="record.config.wechat.provider.spApiKey" |
|
|
|
|
autocomplete="off" |
|
|
|
|
/> |
|
|
|
|
<a-input type="password" v-model="record.config.wechat.provider.spApiKey" autocomplete="off" /> |
|
|
|
|
<div class="form-item-help"> |
|
|
|
|
<small>"微信支付商户平台"" - "账户中心" - "API安全" - "设置API密钥"</small> |
|
|
|
|
</div> |
|
|
|
@ -208,7 +183,9 @@ |
|
|
|
|
> |
|
|
|
|
<a-input v-model="record.config.wechat.provider.subAppId" autocomplete="off" /> |
|
|
|
|
<div class="form-item-help"> |
|
|
|
|
<small>微信小程序或者微信公众号的APPID,需要在哪个客户端支付就填写哪个,APP支付需要填写开放平台的应用APPID</small> |
|
|
|
|
<small |
|
|
|
|
>微信小程序或者微信公众号的APPID,需要在哪个客户端支付就填写哪个,APP支付需要填写开放平台的应用APPID</small |
|
|
|
|
> |
|
|
|
|
</div> |
|
|
|
|
</a-form-model-item> |
|
|
|
|
|
|
|
|
@ -313,7 +290,7 @@ |
|
|
|
|
</a-form-model-item> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<div v-if="record.config.alipay.signMode ===10" :method="record.method"> |
|
|
|
|
<div v-if="record.config.alipay.signMode === 10" :method="record.method"> |
|
|
|
|
<a-form-model-item |
|
|
|
|
label="应用公钥证书" |
|
|
|
|
prop="config.alipay.appCertPublicKey" |
|
|
|
@ -375,7 +352,7 @@ |
|
|
|
|
</div> |
|
|
|
|
</a-form-model-item> |
|
|
|
|
</div> |
|
|
|
|
<!-- 汇付支付 --> |
|
|
|
|
<!-- 汇付支付 --> |
|
|
|
|
<div v-if="record.method === PaymentMethodEnum.HUIFU.value" :method="record.method"> |
|
|
|
|
<a-form-model-item |
|
|
|
|
label="商户号类型" |
|
|
|
@ -384,16 +361,28 @@ |
|
|
|
|
> |
|
|
|
|
<a-radio-group v-model="record.config.huifu.mchType" @change="clearValidate()"> |
|
|
|
|
<a-radio value="normal">普通商户</a-radio> |
|
|
|
|
<a-radio value="provider">子商户 (服务商模式)</a-radio> |
|
|
|
|
<!-- <a-radio value="provider">子商户 (服务商模式)</a-radio> --> |
|
|
|
|
</a-radio-group> |
|
|
|
|
</a-form-model-item> |
|
|
|
|
<div v-if="record.config.huifu.mchType === 'normal'" :mchType="record.config.huifu.mchType"> |
|
|
|
|
<a-form-model-item |
|
|
|
|
label="汇付商户号" |
|
|
|
|
prop="config.huifu.normal.sysId" |
|
|
|
|
:rules="[{ required: true, message: '请填写汇付商户号' }]" |
|
|
|
|
label="APPID" |
|
|
|
|
prop="config.huifu.normal.appid" |
|
|
|
|
:rules="[{ required: true, message: '请填写APPID' }]" |
|
|
|
|
> |
|
|
|
|
<a-input v-model="record.config.huifu.normal.appid" autocomplete="off" /> |
|
|
|
|
<div class="form-item-help"> |
|
|
|
|
<small |
|
|
|
|
>微信小程序或者微信公众号的APPID,需要在哪个客户端支付就填写哪个,APP支付需要填写开放平台的应用APPID</small |
|
|
|
|
> |
|
|
|
|
</div> |
|
|
|
|
</a-form-model-item> |
|
|
|
|
<a-form-model-item |
|
|
|
|
label="APPKEY" |
|
|
|
|
prop="config.huifu.normal.appkey" |
|
|
|
|
:rules="[{ required: true, message: '请填写APPKEY' }]" |
|
|
|
|
> |
|
|
|
|
<a-input v-model="record.config.huifu.normal.sysId" autocomplete="off" /> |
|
|
|
|
<a-input v-model="record.config.huifu.normal.appkey" autocomplete="off" /> |
|
|
|
|
<div class="form-item-help"> |
|
|
|
|
<small |
|
|
|
|
>微信小程序或者微信公众号的APPID,需要在哪个客户端支付就填写哪个,APP支付需要填写开放平台的应用APPID</small |
|
|
|
@ -402,36 +391,39 @@ |
|
|
|
|
</a-form-model-item> |
|
|
|
|
|
|
|
|
|
<a-form-model-item |
|
|
|
|
label="产品编号" |
|
|
|
|
prop="config.huifu.normal.productId" |
|
|
|
|
:rules="[{ required: true, message: '请填写产品编号' }]" |
|
|
|
|
label="商户编号" |
|
|
|
|
prop="config.huifu.normal.mid" |
|
|
|
|
:rules="[{ required: true, message: '请填写商户编号' }]" |
|
|
|
|
> |
|
|
|
|
<a-input v-model="record.config.huifu.normal.productId" autocomplete="off" /> |
|
|
|
|
<a-input v-model="record.config.huifu.normal.mid" autocomplete="off" /> |
|
|
|
|
</a-form-model-item> |
|
|
|
|
<a-form-model-item |
|
|
|
|
label="商户私钥" |
|
|
|
|
prop="config.huifu.normal.rsaMerchPrivateKey" |
|
|
|
|
:rules="[{ required: true, message: '请填写商户私钥' }]" |
|
|
|
|
label="终端号" |
|
|
|
|
prop="config.huifu.normal.tid" |
|
|
|
|
:rules="[{ required: true, message: '请填终端号' }]" |
|
|
|
|
> |
|
|
|
|
<a-textarea |
|
|
|
|
v-model="record.config.huifu.normal.rsaMerchPrivateKey" |
|
|
|
|
:autoSize="{ minRows: 4, maxRows: 6 }" |
|
|
|
|
autocomplete="off" |
|
|
|
|
/> |
|
|
|
|
<div class="form-item-help"> |
|
|
|
|
<small>"微信支付商户平台"" - "账户中心" - "API安全" - "设置API密钥"</small> |
|
|
|
|
</div> |
|
|
|
|
<a-input v-model="record.config.huifu.normal.tid" autocomplete="off" /> |
|
|
|
|
</a-form-model-item> |
|
|
|
|
<a-form-model-item |
|
|
|
|
label="汇付公钥" |
|
|
|
|
prop="config.huifu.normal.rsaHuifuPublicKey" |
|
|
|
|
:rules="[{ required: true, message: '请填写汇付公钥' }]" |
|
|
|
|
label="来源编号" |
|
|
|
|
prop="config.huifu.normal.msgSrcId" |
|
|
|
|
:rules="[{ required: true, message: '请填来源编号' }]" |
|
|
|
|
> |
|
|
|
|
<a-textarea |
|
|
|
|
v-model="record.config.huifu.normal.rsaHuifuPublicKey" |
|
|
|
|
:autoSize="{ minRows: 4, maxRows: 6 }" |
|
|
|
|
autocomplete="off" |
|
|
|
|
/> |
|
|
|
|
<a-input v-model="record.config.huifu.normal.msgSrcId" autocomplete="off" /> |
|
|
|
|
</a-form-model-item> |
|
|
|
|
<a-form-model-item |
|
|
|
|
label="消息来源" |
|
|
|
|
prop="config.huifu.normal.msgSrc" |
|
|
|
|
:rules="[{ required: true, message: '请填消息来源' }]" |
|
|
|
|
> |
|
|
|
|
<a-input v-model="record.config.huifu.normal.msgSrc" autocomplete="off" /> |
|
|
|
|
</a-form-model-item> |
|
|
|
|
<a-form-model-item |
|
|
|
|
label="密钥(网付)" |
|
|
|
|
prop="config.huifu.normal.md5Secret" |
|
|
|
|
:rules="[{ required: true, message: '请填写支付密钥(网付)' }]" |
|
|
|
|
> |
|
|
|
|
<a-input type="password" v-model="record.config.huifu.normal.md5Secret" autocomplete="off" /> |
|
|
|
|
<div class="form-item-help"> |
|
|
|
|
<small>"微信支付商户平台"" - "账户中心" - "API安全" - "设置API密钥"</small> |
|
|
|
|
</div> |
|
|
|
@ -440,57 +432,71 @@ |
|
|
|
|
|
|
|
|
|
<div v-if="record.config.huifu.mchType === 'provider'" :mchType="record.config.huifu.mchType"> |
|
|
|
|
<a-form-model-item |
|
|
|
|
label="汇付商户号" |
|
|
|
|
prop="config.huifu.provider.spSysId" |
|
|
|
|
:rules="[{ required: true, message: '请填写汇付商户号' }]" |
|
|
|
|
label="APPID" |
|
|
|
|
prop="config.huifu.provider.spAppid" |
|
|
|
|
:rules="[{ required: true, message: '请填写APPID' }]" |
|
|
|
|
> |
|
|
|
|
<a-input v-model="record.config.huifu.provider.spAppId" autocomplete="off" /> |
|
|
|
|
<a-input v-model="record.config.huifu.provider.spAppid" autocomplete="off" /> |
|
|
|
|
<div class="form-item-help"> |
|
|
|
|
<small>请填写微信支付服务商的AppID</small> |
|
|
|
|
</div> |
|
|
|
|
</a-form-model-item> |
|
|
|
|
|
|
|
|
|
<a-form-model-item |
|
|
|
|
label="产品编号" |
|
|
|
|
prop="config.huifu.provider.spProductId" |
|
|
|
|
:rules="[{ required: true, message: '请填写产品编号' }]" |
|
|
|
|
label="APPKEY" |
|
|
|
|
prop="config.huifu.provider.syAppkey" |
|
|
|
|
:rules="[{ required: true, message: '请填写APPKEY' }]" |
|
|
|
|
> |
|
|
|
|
<a-input v-model="record.config.huifu.provider.spProductId" autocomplete="off" /> |
|
|
|
|
<a-input v-model="record.config.huifu.provider.syAppkey" autocomplete="off" /> |
|
|
|
|
<div class="form-item-help"> |
|
|
|
|
<small>微信支付服务商的商户号,纯数字格式;例如:1600000109</small> |
|
|
|
|
<small>请填写微信支付服务商的AppID</small> |
|
|
|
|
</div> |
|
|
|
|
</a-form-model-item> |
|
|
|
|
|
|
|
|
|
<a-form-model-item |
|
|
|
|
label="商户私钥" |
|
|
|
|
prop="config.huifu.provider.spRsaMerchPrivateKey" |
|
|
|
|
:rules="[{ required: true, message: '请填写商户私钥' }]" |
|
|
|
|
label="商户编号" |
|
|
|
|
prop="config.huifu.provider.syMid" |
|
|
|
|
:rules="[{ required: true, message: '请填写商户编号' }]" |
|
|
|
|
> |
|
|
|
|
<a-textarea |
|
|
|
|
v-model="record.config.huifu.provider.spRsaMerchPrivateKey" |
|
|
|
|
:autoSize="{ minRows: 4, maxRows: 6 }" |
|
|
|
|
autocomplete="off" |
|
|
|
|
/> |
|
|
|
|
<div class="form-item-help"> |
|
|
|
|
<small>"微信支付商户平台"" - "账户中心" - "API安全" - "设置API密钥"</small> |
|
|
|
|
</div> |
|
|
|
|
<a-input v-model="record.config.huifu.provider.syMid" autocomplete="off" /> |
|
|
|
|
<!-- <div class="form-item-help"> |
|
|
|
|
<small>微信支付服务商的商户号,纯数字格式;例如:1600000109</small> |
|
|
|
|
</div> --> |
|
|
|
|
</a-form-model-item> |
|
|
|
|
<a-form-model-item |
|
|
|
|
label="汇付公钥" |
|
|
|
|
prop="config.huifu.provider.spRsaHuifuPublicKey" |
|
|
|
|
:rules="[{ required: true, message: '请填写汇付公钥' }]" |
|
|
|
|
label="终端号" |
|
|
|
|
prop="config.huifu.provider.syTid" |
|
|
|
|
:rules="[{ required: true, message: '请填写终端号' }]" |
|
|
|
|
> |
|
|
|
|
<a-textarea |
|
|
|
|
v-model="record.config.huifu.provider.spRsaHuifuPublicKey" |
|
|
|
|
:autoSize="{ minRows: 4, maxRows: 6 }" |
|
|
|
|
autocomplete="off" |
|
|
|
|
/> |
|
|
|
|
<a-input v-model="record.config.huifu.provider.syTid" autocomplete="off" /> |
|
|
|
|
</a-form-model-item> |
|
|
|
|
<a-form-model-item |
|
|
|
|
label="来源编号" |
|
|
|
|
prop="config.huifu.provider.syMsgSrcId" |
|
|
|
|
:rules="[{ required: true, message: '请填写来源编号' }]" |
|
|
|
|
> |
|
|
|
|
<a-input v-model="record.config.huifu.provider.syMsgSrcId" autocomplete="off" /> |
|
|
|
|
</a-form-model-item> |
|
|
|
|
<a-form-model-item |
|
|
|
|
label="消息来源" |
|
|
|
|
prop="config.huifu.provider.syMsgSrc" |
|
|
|
|
:rules="[{ required: true, message: '请填写终端号' }]" |
|
|
|
|
> |
|
|
|
|
<a-input v-model="record.config.huifu.provider.syMsgSrc" autocomplete="off" /> |
|
|
|
|
<!-- <div class="form-item-help"> |
|
|
|
|
<small>微信支付服务商的商户号,纯数字格式;例如:1600000109</small> |
|
|
|
|
</div> --> |
|
|
|
|
</a-form-model-item> |
|
|
|
|
<a-form-model-item |
|
|
|
|
label="密钥(网付)" |
|
|
|
|
prop="config.huifu.provider.syMd5Secret" |
|
|
|
|
:rules="[{ required: true, message: '请填写支付密钥(网付)' }]" |
|
|
|
|
> |
|
|
|
|
<a-input type="password" v-model="record.config.huifu.normal.syMd5Secret" autocomplete="off" /> |
|
|
|
|
<div class="form-item-help"> |
|
|
|
|
<small>"微信支付商户平台"" - "账户中心" - "API安全" - "设置API密钥"</small> |
|
|
|
|
</div> |
|
|
|
|
</a-form-model-item> |
|
|
|
|
|
|
|
|
|
<a-form-model-item |
|
|
|
|
<!-- <a-form-model-item |
|
|
|
|
label="子商户私钥" |
|
|
|
|
prop="config.huifu.provider.subAppId" |
|
|
|
|
:rules="[{ required: true, message: '请填写子商户应用ID (AppID)' }]" |
|
|
|
@ -519,7 +525,7 @@ |
|
|
|
|
<div class="form-item-help"> |
|
|
|
|
<small>微信支付的商户号,纯数字格式;例如:1600000109</small> |
|
|
|
|
</div> |
|
|
|
|
</a-form-model-item> |
|
|
|
|
</a-form-model-item> --> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<a-form-model-item :wrapperCol="{ offset: labelCol.span }"> |
|
|
|
@ -562,8 +568,8 @@ const defaultData = { |
|
|
|
|
subAppId: '', |
|
|
|
|
subMchId: '', |
|
|
|
|
spApiclientCert: '', |
|
|
|
|
spApiclientKey: '' |
|
|
|
|
} |
|
|
|
|
spApiclientKey: '', |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
[PaymentMethodEnum.ALIPAY.value]: { |
|
|
|
|
appId: '', |
|
|
|
@ -573,23 +579,29 @@ const defaultData = { |
|
|
|
|
appCertPublicKey: '', |
|
|
|
|
alipayCertPublicKey: '', |
|
|
|
|
alipayRootCert: '', |
|
|
|
|
merchantPrivateKey: '' |
|
|
|
|
merchantPrivateKey: '', |
|
|
|
|
}, |
|
|
|
|
[PaymentMethodEnum.HUIFU.value]: { |
|
|
|
|
[PaymentMethodEnum.HUIFU.value]: { |
|
|
|
|
// 微信商户号类型(normal普通商户 provider子商户) |
|
|
|
|
mchType: 'normal', |
|
|
|
|
normal: { |
|
|
|
|
sysId: '', |
|
|
|
|
productId: '', |
|
|
|
|
rsaMerchPrivateKey: '', |
|
|
|
|
rsaHuifuPublicKey: '', |
|
|
|
|
appkey: '', |
|
|
|
|
mid: '', |
|
|
|
|
tid: '', |
|
|
|
|
msgSrcId: '', |
|
|
|
|
msgSrc: '', |
|
|
|
|
md5Secret: '', |
|
|
|
|
}, |
|
|
|
|
provider: { |
|
|
|
|
sysId: '', |
|
|
|
|
productId: '', |
|
|
|
|
rsaMerchPrivateKey: '', |
|
|
|
|
rsaHuifuPublicKey: '', |
|
|
|
|
// spSysId: '', |
|
|
|
|
syAppkey: '', |
|
|
|
|
syMid: '', |
|
|
|
|
syTid: '', |
|
|
|
|
syMsgSrcId: '', |
|
|
|
|
syMsgSrc: '', |
|
|
|
|
syMd5Secret: '', |
|
|
|
|
// spAppid: '', |
|
|
|
|
// spProductId: '', |
|
|
|
|
// spRsaMerchPrivateKey: '', |
|
|
|
|
// spRsaHuifuPublicKey: '', |
|
|
|
@ -597,14 +609,14 @@ const defaultData = { |
|
|
|
|
// spApiclientKey: '', |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
components: { |
|
|
|
|
InputFile |
|
|
|
|
InputFile, |
|
|
|
|
}, |
|
|
|
|
data () { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
// 正在加载 |
|
|
|
|
isLoading: false, |
|
|
|
@ -635,48 +647,47 @@ export default { |
|
|
|
|
'$route.query.templateId': { |
|
|
|
|
// 首次加载的时候执行函数 |
|
|
|
|
immediate: true, |
|
|
|
|
handler (val) { |
|
|
|
|
handler(val) { |
|
|
|
|
// 记录当前模板ID |
|
|
|
|
this.templateId = val |
|
|
|
|
// 获取当前记录 |
|
|
|
|
this.getDetail() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
created () { }, |
|
|
|
|
created() {}, |
|
|
|
|
methods: { |
|
|
|
|
|
|
|
|
|
// 获取当前记录 |
|
|
|
|
getDetail () { |
|
|
|
|
getDetail() { |
|
|
|
|
this.isLoading = true |
|
|
|
|
Api.detail(this.templateId) |
|
|
|
|
.then(result => { |
|
|
|
|
.then((result) => { |
|
|
|
|
// 当前记录 |
|
|
|
|
this.record = { ...defaultData, ...result.data.detail } |
|
|
|
|
}) |
|
|
|
|
.finally(() => this.isLoading = false) |
|
|
|
|
.finally(() => (this.isLoading = false)) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 移除表单项的校验结果 |
|
|
|
|
clearValidate () { |
|
|
|
|
clearValidate() { |
|
|
|
|
this.$refs.myForm.clearValidate() |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 点击表单提交 |
|
|
|
|
handleSubmit (e) { |
|
|
|
|
handleSubmit(e) { |
|
|
|
|
e.preventDefault() |
|
|
|
|
this.$refs.myForm.validate(valid => { |
|
|
|
|
this.$refs.myForm.validate((valid) => { |
|
|
|
|
if (valid) { |
|
|
|
|
this.onSubmitForm() |
|
|
|
|
} else { |
|
|
|
|
console.log('validate error') |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 上传文件后记录到 uploadFiles中 |
|
|
|
|
onChangeInputFile (name, args, key) { |
|
|
|
|
onChangeInputFile(name, args, key) { |
|
|
|
|
const { uploadFiles } = this |
|
|
|
|
if (args[1] !== null) { |
|
|
|
|
uploadFiles[key] = args[1] |
|
|
|
@ -684,12 +695,12 @@ export default { |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 表单数据提交到后端 |
|
|
|
|
onSubmitForm () { |
|
|
|
|
onSubmitForm() { |
|
|
|
|
this.isLoading = true |
|
|
|
|
this.isBtnLoading = true |
|
|
|
|
const formData = this.buildFormData() |
|
|
|
|
Api.edit(formData) |
|
|
|
|
.then(result => { |
|
|
|
|
.then((result) => { |
|
|
|
|
// 显示成功 |
|
|
|
|
this.$message.success(result.message, 1.5) |
|
|
|
|
// 跳转到列表页 |
|
|
|
@ -697,12 +708,12 @@ export default { |
|
|
|
|
this.$router.push('./index') |
|
|
|
|
}, 1500) |
|
|
|
|
}) |
|
|
|
|
.catch(() => this.isBtnLoading = false) |
|
|
|
|
.finally(() => this.isLoading = false) |
|
|
|
|
.catch(() => (this.isBtnLoading = false)) |
|
|
|
|
.finally(() => (this.isLoading = false)) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 生成表单数据 FormData格式 |
|
|
|
|
buildFormData () { |
|
|
|
|
buildFormData() { |
|
|
|
|
const { record, uploadFiles, templateId } = this |
|
|
|
|
const formData = new FormData() |
|
|
|
|
formData.append('templateId', templateId) |
|
|
|
@ -717,9 +728,8 @@ export default { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return formData |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|