优化代码

This commit is contained in:
Your Name 2023-09-28 15:08:28 +08:00
parent ca4bbe4737
commit 29147a8a52
2 changed files with 15 additions and 15 deletions

View File

@ -10,7 +10,7 @@
<div> <div>
<div class="form-group row"> <div class="form-group row">
<label class="col-sm-2 col-form-label"> <label class="col-sm-2 col-form-label">
<span><vc:i18n name="商铺编号" namespace="bindOwnerShops"></vc:i18n></span> <vc:i18n name="商铺编号" namespace="bindOwnerShops"></vc:i18n>
</label> </label>
<div class="col-sm-10"> <div class="col-sm-10">
<input v-model="bindOwnerShopsInfo.shopsName" disabled="disabled" <input v-model="bindOwnerShopsInfo.shopsName" disabled="disabled"
@ -20,7 +20,7 @@
</div> </div>
<div class="form-group row"> <div class="form-group row">
<label class="col-sm-2 col-form-label"> <label class="col-sm-2 col-form-label">
<span><vc:i18n name="租户手机号" namespace="bindOwnerShops"></vc:i18n></span> <vc:i18n name="租户手机号" namespace="bindOwnerShops"></vc:i18n>
</label> </label>
<div class="col-sm-10"> <div class="col-sm-10">
<input v-model="bindOwnerShopsInfo.tel" @blur="_shopsLoadOwnerInfo" type="number" <input v-model="bindOwnerShopsInfo.tel" @blur="_shopsLoadOwnerInfo" type="number"
@ -29,25 +29,25 @@
</div> </div>
<div class="form-group row"> <div class="form-group row">
<label class="col-sm-2 col-form-label"> <label class="col-sm-2 col-form-label">
<span><vc:i18n name="租户姓名" namespace="bindOwnerShops"></vc:i18n></span> <vc:i18n name="租户姓名" namespace="bindOwnerShops"></vc:i18n>
</label> </label>
<div class="col-sm-10"> <div class="col-sm-10">
<input v-model="bindOwnerShopsInfo.ownerName" type="text" <input v-model="bindOwnerShopsInfo.ownerName" type="text"
:placeholder="vc.i18n('必填,请填写租户姓名','bindOwnerShops')" class="form-control"> :placeholder="vc.i18n('必填,请填写租户姓名','bindOwnerShops')" class="form-control">
</div> </div>
</div> </div>
<div class="form-group row" v-if="bindOwnerShopsInfo.shopsState == '2006'"> <div class="form-group row" v-show="bindOwnerShopsInfo.shopsState == '2006'">
<label class="col-sm-2 col-form-label"> <label class="col-sm-2 col-form-label">
<span><vc:i18n name="起租时间" namespace="bindOwnerShops"></vc:i18n></span> <vc:i18n name="起租时间" namespace="bindOwnerShops"></vc:i18n>
</label> </label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="text" :placeholder="vc.i18n('必填,请填写起租时间','bindOwnerShops')" <input type="text" :placeholder="vc.i18n('必填,请填写起租时间','bindOwnerShops')"
class="form-control hireStartTime"> class="form-control hireStartTime">
</div> </div>
</div> </div>
<div class="form-group row" v-if="bindOwnerShopsInfo.shopsState == '2006'"> <div class="form-group row" v-show="bindOwnerShopsInfo.shopsState == '2006'">
<label class="col-sm-2 col-form-label"> <label class="col-sm-2 col-form-label">
<span><vc:i18n name="截租时间" namespace="bindOwnerShops"></vc:i18n></span> <vc:i18n name="截租时间" namespace="bindOwnerShops"></vc:i18n>
</label> </label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="text" :placeholder="vc.i18n('必填,请填写截租时间','bindOwnerShops')" <input type="text" :placeholder="vc.i18n('必填,请填写截租时间','bindOwnerShops')"
@ -56,7 +56,7 @@
</div> </div>
<div class="form-group row"> <div class="form-group row">
<label class="col-sm-2 col-form-label"> <label class="col-sm-2 col-form-label">
<span><vc:i18n name="备注" namespace="bindOwnerShops"></vc:i18n></span> <vc:i18n name="备注" namespace="bindOwnerShops"></vc:i18n>
</label> </label>
<div class="col-sm-10"> <div class="col-sm-10">
<textarea v-model="bindOwnerShopsInfo.remark" <textarea v-model="bindOwnerShopsInfo.remark"

View File

@ -31,7 +31,7 @@
}, },
_initEvent: function () { _initEvent: function () {
vc.on('bindOwnerShops', 'bindOwnerShopsModel', function (_params) { vc.on('bindOwnerShops', 'bindOwnerShopsModel', function (_params) {
vc.component.refreshAddShopsInfo(); $that.refreshAddShopsInfo();
$that.bindOwnerShopsInfo.roomId = _params.roomId; $that.bindOwnerShopsInfo.roomId = _params.roomId;
$that.bindOwnerShopsInfo.shopsState = _params.shopsState; $that.bindOwnerShopsInfo.shopsState = _params.shopsState;
if (_params.shopsState == '2007') { if (_params.shopsState == '2007') {
@ -40,13 +40,13 @@
} }
$that.bindOwnerShopsInfo.shopsName = _params.floorNum + '-' + _params.roomNum; $that.bindOwnerShopsInfo.shopsName = _params.floorNum + '-' + _params.roomNum;
$('#bindOwnerShopsModel').modal('show'); $('#bindOwnerShopsModel').modal('show');
vc.component.bindOwnerShopsInfo.communityId = vc.getCurrentCommunity().communityId; $that.bindOwnerShopsInfo.communityId = vc.getCurrentCommunity().communityId;
}); });
}, },
methods: { methods: {
bindOwnerShopsValidate: function () { bindOwnerShopsValidate: function () {
return vc.validate.validate({ return vc.validate.validate({
bindOwnerShopsInfo: vc.component.bindOwnerShopsInfo bindOwnerShopsInfo: $that.bindOwnerShopsInfo
}, { }, {
'bindOwnerShopsInfo.roomId': [ 'bindOwnerShopsInfo.roomId': [
{ {
@ -98,13 +98,13 @@
}); });
}, },
bindOwnerShops: function () { bindOwnerShops: function () {
if (!vc.component.bindOwnerShopsValidate()) { if (!$that.bindOwnerShopsValidate()) {
vc.toast(vc.validate.errInfo); vc.toast(vc.validate.errInfo);
return; return;
} }
vc.http.apiPost( vc.http.apiPost(
'/room.saveOwnerShops', '/room.saveOwnerShops',
JSON.stringify(vc.component.bindOwnerShopsInfo), { JSON.stringify($that.bindOwnerShopsInfo), {
emulateJSON: true emulateJSON: true
}, },
function (json, res) { function (json, res) {
@ -158,7 +158,7 @@
); );
}, },
refreshAddShopsInfo: function () { refreshAddShopsInfo: function () {
vc.component.bindOwnerShopsInfo = { $that.bindOwnerShopsInfo = {
roomId: '', roomId: '',
roomNum: '', roomNum: '',
shopsName: '', shopsName: '',
@ -174,4 +174,4 @@
} }
} }
}); });
})(window.vc, window.vc.component); })(window.vc, window.$that);