优化代码

This commit is contained in:
Your Name 2023-09-16 17:49:26 +08:00
parent 9525adba3f
commit 86d46e5604
3 changed files with 18 additions and 18 deletions

View File

@ -18,9 +18,9 @@
}, },
_initEvent: function () { _initEvent: function () {
vc.on('addShops', 'addShopsModel', function (_params) { vc.on('addShops', 'addShopsModel', function (_params) {
vc.component.refreshAddShopsInfo(); $that.refreshAddShopsInfo();
$('#addShopsModel').modal('show'); $('#addShopsModel').modal('show');
vc.component.addShopsInfo.communityId = vc.getCurrentCommunity().communityId; $that.addShopsInfo.communityId = vc.getCurrentCommunity().communityId;
}); });
vc.on('addShops', 'addShops', 'notify', function (_param) { vc.on('addShops', 'addShops', 'notify', function (_param) {
if (_param.hasOwnProperty('floorId')) { if (_param.hasOwnProperty('floorId')) {
@ -31,7 +31,7 @@
methods: { methods: {
addShopsValidate: function () { addShopsValidate: function () {
return vc.validate.validate({ return vc.validate.validate({
addShopsInfo: vc.component.addShopsInfo addShopsInfo: $that.addShopsInfo
}, { }, {
'addShopsInfo.roomNum': [ 'addShopsInfo.roomNum': [
{ {
@ -127,13 +127,13 @@
}); });
}, },
addShops: function () { addShops: function () {
if (!vc.component.addShopsValidate()) { if (!$that.addShopsValidate()) {
vc.toast(vc.validate.errInfo); vc.toast(vc.validate.errInfo);
return; return;
} }
vc.http.apiPost( vc.http.apiPost(
'room.saveShops', '/room.saveShops',
JSON.stringify(vc.component.addShopsInfo), JSON.stringify($that.addShopsInfo),
{ {
emulateJSON: true emulateJSON: true
}, },
@ -155,7 +155,7 @@
}); });
}, },
refreshAddShopsInfo: function () { refreshAddShopsInfo: function () {
vc.component.addShopsInfo = { $that.addShopsInfo = {
floorId: '', floorId: '',
roomNum: '', roomNum: '',
layer: '', layer: '',
@ -170,4 +170,4 @@
} }
} }
}); });
})(window.vc, window.vc.component); })(window.vc, window.$that);

View File

@ -1,4 +1,4 @@
<div id="editRoomModel" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" <div id="editRoomModel" class="modal fade" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true"> aria-hidden="true">
<div class="modal-dialog modal-lg"> <div class="modal-dialog modal-lg">
<div class="modal-content"> <div class="modal-content">
@ -42,7 +42,7 @@
</label> </label>
<div class="col-sm-10"> <div class="col-sm-10">
<select class="custom-select" v-model="editRoomInfo.unitId"> <select class="custom-select" v-model="editRoomInfo.unitId">
<option selected disabled value="">{{vc.i18n('必填','editRoom')}},请选择单元</option> <option selected disabled value="">{{vc.i18n('必填,请选择单元','editRoom')}}</option>
<option v-for="(unit,index) in editRoomUnits" :key="index" <option v-for="(unit,index) in editRoomUnits" :key="index"
v-bind:value="unit.unitId">{{unit.unitNum}}{{vc.i18n('单元','editRoom')}} v-bind:value="unit.unitId">{{unit.unitNum}}{{vc.i18n('单元','editRoom')}}
</option> </option>
@ -55,7 +55,7 @@
</label> </label>
<div class="col-sm-5" style="display: inline"> <div class="col-sm-5" style="display: inline">
<select class="custom-select" v-model="editRoomInfo.apartment1"> <select class="custom-select" v-model="editRoomInfo.apartment1">
<option selected value="">{{vc.i18n('必填','editRoom')}},请选择房屋户型</option> <option selected value="">{{vc.i18n('必填,请选择房屋户型','editRoom')}}</option>
<option value="10">{{vc.i18n('一室','editRoom')}}</option> <option value="10">{{vc.i18n('一室','editRoom')}}</option>
<option value="20">{{vc.i18n('两室','editRoom')}}</option> <option value="20">{{vc.i18n('两室','editRoom')}}</option>
<option value="30">{{vc.i18n('三室','editRoom')}}</option> <option value="30">{{vc.i18n('三室','editRoom')}}</option>
@ -68,7 +68,7 @@
</div> </div>
<div class="col-sm-5" style="display: inline"> <div class="col-sm-5" style="display: inline">
<select class="custom-select" v-model="editRoomInfo.apartment2"> <select class="custom-select" v-model="editRoomInfo.apartment2">
<option selected value="">{{vc.i18n('必填','editRoom')}},请选择房屋户型</option> <option selected value="">{{vc.i18n('必填,请选择房屋户型','editRoom')}}</option>
<option value="101">{{vc.i18n('一厅','editRoom')}}</option> <option value="101">{{vc.i18n('一厅','editRoom')}}</option>
<option value="102">{{vc.i18n('两厅','editRoom')}}</option> <option value="102">{{vc.i18n('两厅','editRoom')}}</option>
<option value="103">{{vc.i18n('三厅','editRoom')}}</option> <option value="103">{{vc.i18n('三厅','editRoom')}}</option>
@ -87,7 +87,7 @@
</label> </label>
<div class="col-sm-10"> <div class="col-sm-10">
<select class="custom-select" v-model="editRoomInfo.roomSubType"> <select class="custom-select" v-model="editRoomInfo.roomSubType">
<option selected disabled value="">{{vc.i18n('必填','editRoom')}},请选择房屋类型</option> <option selected disabled value="">{{vc.i18n('必填,请选择房屋类型','editRoom')}}</option>
<option :value="item.statusCd" <option :value="item.statusCd"
v-for="(item,index) in editRoomInfo.roomSubTypes">{{item.name}} v-for="(item,index) in editRoomInfo.roomSubTypes">{{item.name}}
</option> </option>
@ -143,8 +143,8 @@
<option value="2005">{{vc.i18n('已装修','editRoom')}}</option> <option value="2005">{{vc.i18n('已装修','editRoom')}}</option>
<option value="2004">{{vc.i18n('未入住','editRoom')}}</option> <option value="2004">{{vc.i18n('未入住','editRoom')}}</option>
<!--wuxw 关闭 这里和后端对不上 后端要求提供开始时间和结束时间 前段 没有这个选项,不清楚什么场景下的需求,后面的兄弟记得补充--> <!--wuxw 关闭 这里和后端对不上 后端要求提供开始时间和结束时间 前段 没有这个选项,不清楚什么场景下的需求,后面的兄弟记得补充-->
<!-- <option value="2006">{{vc.i18n('已出租','editRoom')}}</option> --> <!-- <option value="2006">{{vc.i18n('已出租','editRoom')}}</option>
<option value="2008">{{vc.i18n('空闲','editRoom')}}</option> <option value="2008">{{vc.i18n('空闲','editRoom')}}</option>-->
<option value="2009">{{vc.i18n('装修中','editRoom')}}</option> <option value="2009">{{vc.i18n('装修中','editRoom')}}</option>
</select> </select>
</div> </div>

View File

@ -4,7 +4,7 @@
<div class="ibox "> <div class="ibox ">
<div class="ibox-title"> <div class="ibox-title">
<h5> <h5>
<span><vc:i18n name="查询条件" namespace="shops"></vc:i18n></span> <vc:i18n name="查询条件" namespace="shops"></vc:i18n>
</h5> </h5>
<div class="ibox-tools" style="top:10px;"> <div class="ibox-tools" style="top:10px;">
<!-- <button type="button" class="btn btn-link btn-sm" style="margin-right:10px;" <!-- <button type="button" class="btn btn-link btn-sm" style="margin-right:10px;"
@ -55,7 +55,7 @@
<div class="ibox"> <div class="ibox">
<div class="ibox-title"> <div class="ibox-title">
<h5> <h5>
<span><vc:i18n name="商铺信息" namespace="shops"></vc:i18n></span> <vc:i18n name="商铺信息" namespace="shops"></vc:i18n>
</h5> </h5>
<div class="ibox-tools" style="top:10px;" v-if="vc.hasPrivilege('502020082453087940')"> <div class="ibox-tools" style="top:10px;" v-if="vc.hasPrivilege('502020082453087940')">
<button type="button" class="btn btn-primary btn-sm" style="margin-left:10px" <button type="button" class="btn btn-primary btn-sm" style="margin-left:10px"
@ -71,7 +71,7 @@
<thead> <thead>
<tr> <tr>
<th data-hide="phone" class="text-center"> <th data-hide="phone" class="text-center">
<span><vc:i18n name="商铺" namespace="shops"></vc:i18n></span>ID <vc:i18n name="商铺ID" namespace="shops"></vc:i18n>
</th> </th>
<th data-hide="phone" class="text-center"> <th data-hide="phone" class="text-center">
<span><vc:i18n name="商铺编号" namespace="shops"></vc:i18n></span> <span><vc:i18n name="商铺编号" namespace="shops"></vc:i18n></span>