优化代码

This commit is contained in:
java110 2020-07-20 14:10:45 +08:00
parent 051578b55b
commit e66e9fde2d
5 changed files with 114 additions and 8 deletions

View File

@ -23,10 +23,57 @@
<option selected disabled value="">必填,请选择公告类型</option>
<option value="1000">业主通知</option>
<option value="1001">员工通知</option>
<option value="1002">小区通知</option>
<option value="1003">业主微信</option>
</select>
</div>
</div>
<div class="form-group row" v-if="addNoticeViewInfo.noticeTypeCd == '1003'">
<label class="col-sm-2 col-form-label">公告范围</label>
<div class="col-sm-10">
<select class="custom-select" v-model="addNoticeViewInfo.objType" @change="_changeObjType()">
<option selected disabled value="">必填,请选择公告范围</option>
<option value="001">小区</option>
<option value="002">楼栋</option>
<option value="003">单元</option>
<option value="004">房屋</option>
</select></div>
</div>
<div class="form-group row"
v-show="addNoticeViewInfo.objType == '002' || addNoticeViewInfo.objType == '003' || addNoticeViewInfo.objType == '004' ">
<label class="col-sm-2 col-form-label">归属楼栋</label>
<div class="col-sm-10">
<vc:create path="property/floorSelect2"
parentModal="addNoticeView"
callBackListener="addNoticeView"
callBackFunction="notify"
namespace="addNoticeView"
></vc:create>
</div>
</div>
<div class="form-group row"
v-show="addNoticeViewInfo.objType == '003' || addNoticeViewInfo.objType == '004' ">
<label class="col-sm-2 col-form-label">归属单元</label>
<div class="col-sm-10">
<vc:create path="property/unitSelect2"
parentModal="addNoticeView"
callBackListener="addNoticeView"
callBackFunction="notify"
namespace="addNoticeView"
></vc:create>
</div>
</div>
<div class="form-group row"
v-show="addNoticeViewInfo.objType == '004' ">
<label class="col-sm-2 col-form-label">归属房屋</label>
<div class="col-sm-10">
<vc:create path="property/roomSelect2"
parentModal="addNoticeView"
callBackListener="addNoticeView"
callBackFunction="notify"
namespace="addNoticeView"
></vc:create>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">开始时间</label>
<div class="col-sm-10">

View File

@ -8,6 +8,12 @@
context: '',
startTime: '',
endTime: '',
objType: '',
objId: '',
floorId: '',
unitId: '',
roomId: '',
state: '3000'
}
},
@ -15,9 +21,19 @@
vc.component._initNoticeInfo();
},
_initEvent: function () {
vc.on('addNoticeView', 'openAddNoticeView', function () {
vc.on('addNoticeView', 'notify', function (_param) {
//vc.component._initNoticeInfo();
if (_param.hasOwnProperty('floorId')) {
$that.addNoticeViewInfo.floorId = _param.floorId;
}
if (_param.hasOwnProperty('unitId')) {
$that.addNoticeViewInfo.unitId = _param.unitId;
}
if (_param.hasOwnProperty('roomId')) {
$that.addNoticeViewInfo.roomId = _param.roomId;
}
});
},
methods: {
@ -90,12 +106,34 @@
});
},
saveNoticeInfo: function () {
if($that.addNoticeViewInfo.noticeTypeCd != '1003'){
$that.addNoticeViewInfo.objType ='001';
}
if ($that.addNoticeViewInfo.objType == '001') {
$that.addNoticeViewInfo.objId = vc.getCurrentCommunity().communityId;
} else if ($that.addNoticeViewInfo.objType == '002') {
$that.addNoticeViewInfo.objId = $that.addNoticeViewInfo.floorId;
} else if ($that.addNoticeViewInfo.objType == '003') {
$that.addNoticeViewInfo.objId = $that.addNoticeViewInfo.unitId;
} else {
$that.addNoticeViewInfo.objId = $that.addNoticeViewInfo.roomId;
}
if ($that.addNoticeViewInfo.noticeTypeCd == '1003') {
$that.addNoticeViewInfo.state = '1000';
}
if (!vc.component.addNoticeValidate()) {
vc.toast(vc.validate.errInfo);
return;
}
if($that.addNoticeViewInfo.objId == "" ){
vc.toast("未选择发布范围");
return ;
}
vc.component.addNoticeViewInfo.communityId = vc.getCurrentCommunity().communityId;
vc.http.post(
@ -126,11 +164,21 @@
});
},
clearaddNoticeViewInfo: function () {
vc.emit('addNoticeView', 'floorSelect2', 'clearFloor', {});
vc.emit('addNoticeView', 'unitSelect2', 'clearUnit', {});
vc.emit('addNoticeView', 'roomSelect2', 'clearRoom', {});
vc.component.addNoticeViewInfo = {
title: '',
noticeTypeCd: '',
context: '',
startTime: '',
endTime: '',
objType: '',
objId: '',
floorId: '',
unitId: '',
roomId: '',
state: '3000'
};
},
@ -228,6 +276,9 @@
vc.toast(errInfo);
});
},
_changeObjType: function () {
}
}

View File

@ -24,7 +24,7 @@
<option selected disabled value="">必填,请选择公告类型</option>
<option value="1000">业主通知</option>
<option value="1001">员工通知</option>
<option value="1002">小区通知</option>
<option value="1003">业主微信通知</option>
</select></div>
</div>

View File

@ -1,7 +1,9 @@
(function (vc) {
vc.extends({
propTypes: {
parentModal: vc.propTypes.string
parentModal: vc.propTypes.string,
callBackListener: vc.propTypes.string = "", //父组件名称
callBackFunction: vc.propTypes.string = "" //父组件监听方法
},
data: {
floorSelect2Info: {
@ -18,6 +20,8 @@
handler: function () {
vc.emit($namespace, 'unitSelect2', 'clearUnit', {});
vc.emit($namespace, 'unitSelect2', "transferFloor", this.floorSelect2Info);
vc.emit($namespace, $props.callBackListener, $props.callBackFunction, this.floorSelect2Info);
}
}
},
@ -40,6 +44,7 @@
vc.on('floorSelect2', 'clearFloor', function (_param) {
$('#floorSelector').val('').select2();
this._initFloorSelect2();
this.floorSelect2Info = {
floors: [],
floorId: '-1',

View File

@ -25,7 +25,7 @@
<option selected value="">请选择公告类型</option>
<option value="1000">业主通知</option>
<option value="1001">员工通知</option>
<option value="1002">小区通知</option>
<option value="1003">业主微信通知</option>
</select>
</div>
</div>
@ -65,21 +65,24 @@
<table class="footable table table-stripped toggle-arrow-tiny" data-page-size="15">
<thead>
<tr>
<th>公告ID</th>
<!-- <th>公告ID</th> -->
<th>标题</th>
<th>公告类型</th>
<th>开始时间</th>
<th>结束时间</th>
<th>状态</th>
<th class="text-right">操作</th>
</tr>
</thead>
<tbody>
<tr v-for="notice in noticeManageInfo.notices">
<td>{{notice.noticeId}}</td>
<!-- <td>{{notice.noticeId}}</td> -->
<td>{{notice.title}}</td>
<td>{{notice.noticeTypeCdName}}</td>
<td>{{notice.startTime}}</td>
<td>{{notice.endTime}}</td>
<td>{{notice.stateName}}</td>
<td class="text-right">
<div class="btn-group">
<button class="btn-white btn btn-xs" v-on:click="_openNoticeDetail(notice)">详情
@ -89,7 +92,7 @@
<button class="btn-white btn btn-xs" v-on:click="_openEditNoticeModel(notice)">修改
</button>
</div>
<div class="btn-group">
<div class="btn-group" v-if="notice.state != '2000'">
<button class="btn-white btn btn-xs" v-on:click="_openDeleteNoticeModel(notice)">
删除
</button>