mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-02-24 05:46:03 +08:00
优化代码
This commit is contained in:
parent
8235c5cd12
commit
5b61f8c53a
21
public/components/property/classesState/classesState.html
Normal file
21
public/components/property/classesState/classesState.html
Normal file
@ -0,0 +1,21 @@
|
||||
<div class="modal fade" id="classesStateModel" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLabel"><span><vc:i18n name="请确认您的操作" namespace="classesState"></vc:i18n></span>!</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<tr align="center">
|
||||
<th><span><vc:i18n name="确定" namespace="classesState"></vc:i18n></span>{{classesStateInfo.stateName}}<span><vc:i18n name="班次" namespace="classesState"></vc:i18n></span></th>
|
||||
</tr>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal" v-on:click="_closeClassesStateModel()"><span><vc:i18n name="点错了" namespace="classesState"></vc:i18n></span></button>
|
||||
<button type="button" class="btn btn-primary" v-on:click="_changeClassesState()"><span><vc:i18n name="确认" namespace="classesState"></vc:i18n></span></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
50
public/components/property/classesState/classesState.js
Normal file
50
public/components/property/classesState/classesState.js
Normal file
@ -0,0 +1,50 @@
|
||||
(function(vc, vm) {
|
||||
|
||||
vc.extends({
|
||||
data: {
|
||||
classesStateInfo: {
|
||||
classesId: '',
|
||||
stateName: '',
|
||||
state: ''
|
||||
|
||||
}
|
||||
},
|
||||
_initMethod: function() {
|
||||
|
||||
},
|
||||
_initEvent: function() {
|
||||
vc.on('classesState', 'openClassesStateModal', function(_params) {
|
||||
vc.copyObject(_params, vc.component.classesStateInfo);
|
||||
$('#classesStateModel').modal('show');
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
_changeClassesState: function() {
|
||||
vc.http.apiPost(
|
||||
'/classes.updateClassesState',
|
||||
JSON.stringify(vc.component.classesStateInfo), {
|
||||
emulateJSON: true
|
||||
},
|
||||
function(json, res) {
|
||||
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
|
||||
if (res.status == 200) {
|
||||
//关闭model
|
||||
$('#classesStateModel').modal('hide');
|
||||
vc.emit('classesManage', 'listClasses', {});
|
||||
return;
|
||||
}
|
||||
vc.toast(json);
|
||||
},
|
||||
function(errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
vc.toast(json);
|
||||
|
||||
});
|
||||
},
|
||||
_closeClassesStateModel: function() {
|
||||
$('#classesStateModel').modal('hide');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
})(window.vc, window.vc.component);
|
||||
@ -1,5 +1,4 @@
|
||||
<div id="editClassesModel" class="modal fade" role="dialog" aria-labelledby="exampleModalLabel"
|
||||
aria-hidden="true">
|
||||
<div id="editClassesModel" class="modal fade" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body">
|
||||
@ -10,12 +9,11 @@
|
||||
<div>
|
||||
<div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label"><span>
|
||||
<label class="col-sm-2 col-form-label text-right"><span>
|
||||
<vc:i18n name='班次名称' namespace='editClasses'></vc:i18n>
|
||||
</span> </label>
|
||||
<div class="col-sm-8">
|
||||
<input v-model="editClassesInfo.name" type="text"
|
||||
:placeholder="vc.i18n('必填,请填写班次名称','editClasses')" class="form-control">
|
||||
<input v-model="editClassesInfo.name" type="text" :placeholder="vc.i18n('必填,请填写班次名称','editClasses')" class="form-control">
|
||||
</div>
|
||||
<label class="col-sm-2 col-form-label text-right">
|
||||
<button class="btn btn-white" type="button" v-on:click="_addEditTimes()">
|
||||
@ -23,21 +21,18 @@
|
||||
</button>
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group row"
|
||||
v-for="(item,index) in editClassesInfo.times">
|
||||
<div class="form-group row" v-for="(item,index) in editClassesInfo.times">
|
||||
<label class="col-sm-2 col-form-label text-right">
|
||||
<span><vc:i18n name='上班时间' namespace='editClasses'></vc:i18n></span>
|
||||
</label>
|
||||
<div class="col-sm-3">
|
||||
<input v-model="item.startTime" type="time"
|
||||
:placeholder="vc.i18n('必填,请填写上班时间','editClasses')" class="form-control"/>
|
||||
<input v-model="item.startTime" type="time" :placeholder="vc.i18n('必填,请填写上班时间','editClasses')" class="form-control" />
|
||||
</div>
|
||||
<label class="col-sm-2 col-form-label text-right">
|
||||
<span><vc:i18n name='下班时间' namespace='editClasses'></vc:i18n></span>
|
||||
</label>
|
||||
<div class="col-sm-3">
|
||||
<input v-model="item.endTime" type="time"
|
||||
:placeholder="vc.i18n('必填,请填写下班时间','editClasses')" class="form-control"/>
|
||||
<input v-model="item.endTime" type="time" :placeholder="vc.i18n('必填,请填写下班时间','editClasses')" class="form-control" />
|
||||
</div>
|
||||
<label class="col-sm-2 col-form-label text-right">
|
||||
<button class="btn btn-white" type="button"
|
||||
@ -48,12 +43,11 @@
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label"><span>
|
||||
<label class="col-sm-2 col-form-label text-right"><span>
|
||||
<vc:i18n name='备注说明' namespace='editClasses'></vc:i18n>
|
||||
</span> </label>
|
||||
<div class="col-sm-10">
|
||||
<textarea v-model="editClassesInfo.remark"
|
||||
:placeholder="vc.i18n('必填,请填写备注说明','editClasses')" class="form-control"></textarea>
|
||||
<textarea v-model="editClassesInfo.remark" :placeholder="vc.i18n('必填,请填写备注说明','editClasses')" class="form-control"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -62,8 +56,7 @@
|
||||
class="fa fa-check"></i> <span>
|
||||
<vc:i18n name="保存"></vc:i18n>
|
||||
</span></button>
|
||||
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;"
|
||||
data-dismiss="modal"><span>
|
||||
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;" data-dismiss="modal"><span>
|
||||
<vc:i18n name="取消"></vc:i18n>
|
||||
</span></button>
|
||||
</div>
|
||||
|
||||
@ -45,7 +45,8 @@
|
||||
let param = {
|
||||
params: {
|
||||
page: 1,
|
||||
row: 100
|
||||
row: 100,
|
||||
state: '1001'
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -13,8 +13,7 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<div class="form-group">
|
||||
<input type="text" :placeholder="vc.i18n('请选择班次名称','classesManage')"
|
||||
v-model="classesManageInfo.conditions.name" class=" form-control">
|
||||
<input type="text" :placeholder="vc.i18n('请选择班次名称','classesManage')" v-model="classesManageInfo.conditions.name" class=" form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-1">
|
||||
@ -58,6 +57,9 @@
|
||||
<th class="text-center"><span>
|
||||
<vc:i18n name='班次名称' namespace='classesManage'></vc:i18n>
|
||||
</span></th>
|
||||
<th class="text-center"><span>
|
||||
<vc:i18n name='时段' namespace='classesManage'></vc:i18n>
|
||||
</span></th>
|
||||
<th class="text-center"><span>
|
||||
<vc:i18n name='状态' namespace='classesManage'></vc:i18n>
|
||||
</span></th>
|
||||
@ -76,22 +78,29 @@
|
||||
<tr v-for="classes in classesManageInfo.classess">
|
||||
<td class="text-center">{{classes.classesId}}</td>
|
||||
<td class="text-center">{{classes.name}}</td>
|
||||
<td class="text-center">
|
||||
<div v-for="(time,index) in classes.times">{{time.startTime}}~{{time.endTime}}</div>
|
||||
</td>
|
||||
<td class="text-center">{{classes.state == '1001'?'启用':'停止'}}</td>
|
||||
<td class="text-center">{{classes.createTime}}</td>
|
||||
<td class="text-center">{{classes.remark}}</td>
|
||||
<td class="text-center">
|
||||
<div class="btn-group">
|
||||
<button class="btn-white btn btn-xs"
|
||||
v-on:click="_openEditClassesModel(classes)"><span>
|
||||
<button class="btn-white btn btn-xs" v-on:click="_openEditClassesModel(classes)"><span>
|
||||
<vc:i18n name='修改'></vc:i18n>
|
||||
</span></button>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button class="btn-white btn btn-xs"
|
||||
v-on:click="_openDeleteClassesModel(classes)"><span>
|
||||
<button class="btn-white btn btn-xs" v-on:click="_openDeleteClassesModel(classes)"><span>
|
||||
<vc:i18n name='删除'></vc:i18n>
|
||||
</span></button>
|
||||
</div>
|
||||
<button class="btn-white btn btn-xs" v-if="classes.state == '1001'" v-on:click="_openDisabledClassesModel(classes)">
|
||||
<vc:i18n name="停用" ></vc:i18n>
|
||||
</button>
|
||||
<button class="btn-white btn btn-xs" v-else v-on:click="_openEnabledClassesModel(classes)">
|
||||
<vc:i18n name="启用" ></vc:i18n>
|
||||
</button>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
@ -116,5 +125,7 @@
|
||||
<vc:create path="property/addClasses" callBackListener="" callBackFunction=""></vc:create>
|
||||
<vc:create path="property/editClasses"></vc:create>
|
||||
<vc:create path="property/deleteClasses"></vc:create>
|
||||
<vc:create path="property/classesState"></vc:create>
|
||||
|
||||
|
||||
</div>
|
||||
@ -1,7 +1,7 @@
|
||||
/**
|
||||
入驻小区
|
||||
**/
|
||||
(function (vc) {
|
||||
(function(vc) {
|
||||
var DEFAULT_PAGE = 1;
|
||||
var DEFAULT_ROWS = 10;
|
||||
vc.extends({
|
||||
@ -20,20 +20,20 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
_initMethod: function () {
|
||||
_initMethod: function() {
|
||||
vc.component._listClassess(DEFAULT_PAGE, DEFAULT_ROWS);
|
||||
},
|
||||
_initEvent: function () {
|
||||
_initEvent: function() {
|
||||
|
||||
vc.on('classesManage', 'listClasses', function (_param) {
|
||||
vc.on('classesManage', 'listClasses', function(_param) {
|
||||
vc.component._listClassess(DEFAULT_PAGE, DEFAULT_ROWS);
|
||||
});
|
||||
vc.on('pagination', 'page_event', function (_currentPage) {
|
||||
vc.on('pagination', 'page_event', function(_currentPage) {
|
||||
vc.component._listClassess(_currentPage, DEFAULT_ROWS);
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
_listClassess: function (_page, _rows) {
|
||||
_listClassess: function(_page, _rows) {
|
||||
|
||||
vc.component.classesManageInfo.conditions.page = _page;
|
||||
vc.component.classesManageInfo.conditions.row = _rows;
|
||||
@ -44,7 +44,7 @@
|
||||
//发送get请求
|
||||
vc.http.apiGet('/classes.listClasses',
|
||||
param,
|
||||
function (json, res) {
|
||||
function(json, res) {
|
||||
var _classesManageInfo = JSON.parse(json);
|
||||
vc.component.classesManageInfo.total = _classesManageInfo.total;
|
||||
vc.component.classesManageInfo.records = _classesManageInfo.records;
|
||||
@ -53,33 +53,49 @@
|
||||
total: vc.component.classesManageInfo.records,
|
||||
currentPage: _page
|
||||
});
|
||||
}, function (errInfo, error) {
|
||||
},
|
||||
function(errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
}
|
||||
);
|
||||
},
|
||||
_openAddClassesModal: function () {
|
||||
_openAddClassesModal: function() {
|
||||
vc.emit('addClasses', 'openAddClassesModal', {});
|
||||
},
|
||||
_openEditClassesModel: function (_classes) {
|
||||
_openEditClassesModel: function(_classes) {
|
||||
vc.emit('editClasses', 'openEditClassesModal', _classes);
|
||||
},
|
||||
_openDeleteClassesModel: function (_classes) {
|
||||
_openDeleteClassesModel: function(_classes) {
|
||||
vc.emit('deleteClasses', 'openDeleteClassesModal', _classes);
|
||||
},
|
||||
_queryClassesMethod: function () {
|
||||
_queryClassesMethod: function() {
|
||||
vc.component._listClassess(DEFAULT_PAGE, DEFAULT_ROWS);
|
||||
|
||||
},
|
||||
_moreCondition: function () {
|
||||
_moreCondition: function() {
|
||||
if (vc.component.classesManageInfo.moreCondition) {
|
||||
vc.component.classesManageInfo.moreCondition = false;
|
||||
} else {
|
||||
vc.component.classesManageInfo.moreCondition = true;
|
||||
}
|
||||
}
|
||||
}, //启用计划
|
||||
_openEnabledClassesModel: function(_classes) {
|
||||
vc.emit('classesState', 'openClassesStateModal', {
|
||||
classesId: _classes.classesId,
|
||||
stateName: '启用',
|
||||
state: '1001'
|
||||
});
|
||||
},
|
||||
//停用计划
|
||||
_openDisabledClassesModel: function(_classes) {
|
||||
vc.emit('classesState', 'openClassesStateModal', {
|
||||
classesId: _classes.classesId,
|
||||
stateName: '停用',
|
||||
state: '2002'
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
})(window.vc);
|
||||
})(window.vc);
|
||||
Loading…
Reference in New Issue
Block a user