优化代码

This commit is contained in:
java110 2022-09-08 19:30:36 +08:00
parent 1b013f1558
commit 11463fd329
5 changed files with 177 additions and 56 deletions

View File

@ -194,6 +194,14 @@
padding-right: 0;
}
.padding-r-0 {
padding-right: 0;
}
.padding-l-0 {
padding-left: 0;
}
.padding-xs {
padding: 5px;
}
@ -344,6 +352,10 @@
padding-bottom: 25px;
}
.border {
border: 1px solid #e7eaec;
}
.border-right {
border-right: 1px solid #e7eaec;
}

View File

@ -0,0 +1,33 @@
<div>
<div class="row">
<div class="col-md-2 ">
<div class="margin-xs-r bg-white padding">
<input type="text" :placeholder="vc.i18n('请选择月份','monthAttendanceManage')" v-model="staffAttendanceManageInfo.curDate" class=" form-control queryDate">
</div>
<div class="margin-xs-r bg-white padding">
<input v-model="staffAttendanceManageInfo.orgName" readonly @focus="_staffAttendanceChangeOrg()" type="text" :placeholder="vc.i18n('必填,请填写组织','staffAttendanceManage')" class="form-control">
</div>
<div class="margin-xs-r bg-white treeview">
<ul class="list-group text-center border-radius">
<!-- :class="{'vc-node-selected':newOaWorkflowInfo.switchValue=='newOaWorkflowPool'}" -->
<li class="list-group-item node-orgTree " v-for="(item,index) in staffAttendanceManageInfo.staffs" @click="swatch(item)">
{{item.name}}
</li>
</ul>
</div>
</div>
<div class="col-md-10 ">
<div class="row bg-white border-radius padding">
<div class="col-md-1 text-center border padding-lg" v-for="index in staffAttendanceManageInfo.maxDay" :key="index" :style="{'background-color': _getBgColor(index)}" style="border-radius: 5px;cursor:pointer">
<div>{{staffAttendanceManageInfo.curYear}}-{{staffAttendanceManageInfo.curMonth}}-{{index}}</div>
<div>考勤状态:{{_getAttendanceState(index)}}</div>
<div>考勤时间:</div>
<div>考勤时间:</div>
</div>
</div>
</div>
</div>
<vc:create path="frame/chooseOrgTree" callBackListener="staffAttendanceManage"></vc:create>
</div>

View File

@ -0,0 +1,74 @@
/**
入驻小区
**/
(function(vc) {
var DEFAULT_PAGE = 1;
var DEFAULT_ROWS = 10;
vc.extends({
data: {
staffAttendanceManageInfo: {
staffs: [],
classesId: '',
orgId: '',
orgName: '',
curDate: vc.dateFormat(new Date()),
curYear: '',
curMonth: '',
maxDay: '',
}
},
_initMethod: function() {
vc.component._loadStaffs();
$that.initStaffDate();
},
_initEvent: function() {
vc.on('monthAttendanceManage', 'listMonthAttendance', function(_param) {
vc.component._listMonthAttendances(DEFAULT_PAGE, DEFAULT_ROWS);
});
vc.on('pagination', 'page_event', function(_currentPage) {
vc.component._listMonthAttendances(_currentPage, DEFAULT_ROWS);
});
},
methods: {
_loadStaffs: function() {
let param = {
params: {
page: 1,
row: 100,
orgId: $that.staffAttendanceManageInfo.orgId,
}
}
vc.http.apiGet('/query.staff.infos',
param,
function(json) {
let _staffInfo = JSON.parse(json);
// 员工列表 和 岗位列表匹配
let staffList = _staffInfo.staffs;
$that.staffAttendanceManageInfo.staffs = staffList;
},
function() {
console.log('请求失败处理');
}
);
},
initStaffDate: function() {
let _date = new Date($that.staffAttendanceManageInfo.curDate);
$that.staffAttendanceManageInfo.curMonth = _date.getMonth() + 1
$that.staffAttendanceManageInfo.curYear = _date.getFullYear();
$that.staffAttendanceManageInfo.maxDay = new Date(_date.getFullYear(), _date.getMonth() + 1, 0).getDate();
},
_getAttendanceState: function() {
},
_getBgColor: function(_curDay) {
return "#fff"
},
_staffAttendanceChangeOrg: function() {
}
}
});
})(window.vc);

View File

@ -11,32 +11,33 @@
<div class="row">
<div class="col-sm-3">
<div class="form-group">
<input type="text" :placeholder="vc.i18n('请输入班组名称','todayAttendanceManage')"
v-model="todayAttendanceManageInfo.conditions.classesName" class=" form-control">
<input type="text" :placeholder="vc.i18n('请输入班组名称','todayAttendanceManage')" v-model="todayAttendanceManageInfo.conditions.classesName" class=" form-control">
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<input type="text" :placeholder="vc.i18n('请输入部门名称','todayAttendanceManage')"
v-model="todayAttendanceManageInfo.conditions.departmentName"
class=" form-control">
<input type="text" :placeholder="vc.i18n('请输入部门名称','todayAttendanceManage')" v-model="todayAttendanceManageInfo.conditions.departmentName" class=" form-control">
</div>
</div>
<div class="col-sm-3">
<input type="text" :placeholder="vc.i18n('请选择打卡时间','todayAttendanceManage')"
v-model="todayAttendanceManageInfo.conditions.date" class=" form-control queryDate">
<input type="text" :placeholder="vc.i18n('请选择打卡时间','todayAttendanceManage')" v-model="todayAttendanceManageInfo.conditions.date" class=" form-control queryDate">
</div>
<div class="col-sm-2">
<button type="button" class="btn btn-primary btn-sm"
v-on:click="_queryTodayAttendanceMethod()">
<button type="button" class="btn btn-primary btn-sm" v-on:click="_queryTodayAttendanceMethod()">
<i class="fa fa-search"></i> <span><vc:i18n name="查询" namespace="todayAttendanceManage"></vc:i18n></span>
</button>
<button type="button" class="btn btn-primary btn-sm"
v-on:click="_resetTodayAttendanceMethod()">
<button type="button" class="btn btn-primary btn-sm" v-on:click="_resetTodayAttendanceMethod()">
<i class="fa fa-repeat"></i> <span><vc:i18n name="重置" namespace="todayAttendanceManage"></vc:i18n></span>
</button>
</div>
</div>
<div class="row">
<div class="col-sm-3">
<div class="form-group">
<input type="text" :placeholder="vc.i18n('请输入员工名称','todayAttendanceManage')" v-model="todayAttendanceManageInfo.conditions.staffName" class=" form-control">
</div>
</div>
</div>
</div>
</div>
</div>
@ -52,39 +53,38 @@
<div class="ibox-content">
<table class="footable table table-stripped toggle-arrow-tiny" data-page-size="15">
<thead>
<tr>
<th class="text-center"><span><vc:i18n name="部门名称" namespace="todayAttendanceManage"></vc:i18n></span></th>
<th class="text-center"><span><vc:i18n name="员工名称" namespace="todayAttendanceManage"></vc:i18n></span></th>
<th class="text-center"><span><vc:i18n name="考勤班组" namespace="todayAttendanceManage"></vc:i18n></span></th>
<th class="text-center"><span><vc:i18n name="考勤时间" namespace="todayAttendanceManage"></vc:i18n></span></th>
<th class="text-center"><span><vc:i18n name="考勤状态" namespace="todayAttendanceManage"></vc:i18n></span></th>
<th class="text-center"><span><vc:i18n name="操作" namespace="todayAttendanceManage"></vc:i18n></span></th>
</tr>
<tr>
<th class="text-center"><span><vc:i18n name="部门名称" namespace="todayAttendanceManage"></vc:i18n></span></th>
<th class="text-center"><span><vc:i18n name="员工名称" namespace="todayAttendanceManage"></vc:i18n></span></th>
<th class="text-center"><span><vc:i18n name="考勤班组" namespace="todayAttendanceManage"></vc:i18n></span></th>
<th class="text-center"><span><vc:i18n name="考勤时间" namespace="todayAttendanceManage"></vc:i18n></span></th>
<th class="text-center"><span><vc:i18n name="考勤状态" namespace="todayAttendanceManage"></vc:i18n></span></th>
<th class="text-center"><span><vc:i18n name="操作" namespace="todayAttendanceManage"></vc:i18n></span></th>
</tr>
</thead>
<tbody>
<tr v-for="attendance in todayAttendanceManageInfo.attendances">
<td class="text-center">{{attendance.classObjName}}</td>
<td class="text-center">{{attendance.staffName}}</td>
<td class="text-center">{{attendance.classesName}}</td>
<td class="text-center">
{{attendance.taskYear+'-'+attendance.taskMonth+'-'+attendance.taskDay}}
</td>
<td class="text-center">{{attendance.stateName}}</td>
<td class="text-center">
<div class="btn-group">
<button class="btn-white btn btn-xs"
v-on:click="_openAttendanceDetailModel(attendance)"><span><vc:i18n name="详情" namespace="todayAttendanceManage"></vc:i18n></span>
<tr v-for="attendance in todayAttendanceManageInfo.attendances">
<td class="text-center">{{attendance.classObjName}}</td>
<td class="text-center">{{attendance.staffName}}</td>
<td class="text-center">{{attendance.classesName}}</td>
<td class="text-center">
{{attendance.taskYear+'-'+attendance.taskMonth+'-'+attendance.taskDay}}
</td>
<td class="text-center">{{attendance.stateName}}</td>
<td class="text-center">
<div class="btn-group">
<button class="btn-white btn btn-xs" v-on:click="_openAttendanceDetailModel(attendance)"><span><vc:i18n name="详情" namespace="todayAttendanceManage"></vc:i18n></span>
</button>
</div>
</td>
</tr>
</div>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="7">
<ul class="pagination float-right"></ul>
</td>
</tr>
<tr>
<td colspan="7">
<ul class="pagination float-right"></ul>
</td>
</tr>
</tfoot>
</table>
<!-- 分页 -->
@ -94,4 +94,4 @@
</div>
</div>
<vc:create path="property/todayAttendanceDetail"></vc:create>
</div>
</div>

View File

@ -1,7 +1,7 @@
/**
入驻小区
**/
(function (vc) {
(function(vc) {
var DEFAULT_PAGE = 1;
var DEFAULT_ROWS = 10;
vc.extends({
@ -15,24 +15,25 @@
conditions: {
classesName: '',
departmentName: '',
date: vc.dateFormat(new Date())
date: vc.dateFormat(new Date()),
staffName: ''
}
}
},
_initMethod: function () {
_initMethod: function() {
vc.component._listTodayAttendances(DEFAULT_PAGE, DEFAULT_ROWS);
vc.component._initDate();
},
_initEvent: function () {
vc.on('todayAttendanceManage', 'listTodayAttendance', function (_param) {
_initEvent: function() {
vc.on('todayAttendanceManage', 'listTodayAttendance', function(_param) {
vc.component._listTodayAttendances(DEFAULT_PAGE, DEFAULT_ROWS);
});
vc.on('pagination', 'page_event', function (_currentPage) {
vc.on('pagination', 'page_event', function(_currentPage) {
vc.component._listTodayAttendances(_currentPage, DEFAULT_ROWS);
});
},
methods: {
_initDate: function () {
_initDate: function() {
$(".queryDate").datetimepicker({
language: 'zh-CN',
fontAwesome: 'fa',
@ -43,7 +44,7 @@
todayBtn: true
});
$('.queryDate').datetimepicker()
.on('changeDate', function (ev) {
.on('changeDate', function(ev) {
var value = $(".queryDate").val();
vc.component.todayAttendanceManageInfo.conditions.date = value;
});
@ -54,7 +55,7 @@
e.currentTarget.blur();
}
},
_listTodayAttendances: function (_page, _rows) {
_listTodayAttendances: function(_page, _rows) {
vc.component.todayAttendanceManageInfo.conditions.page = _page;
vc.component.todayAttendanceManageInfo.conditions.row = _rows;
var param = {
@ -65,7 +66,7 @@
//发送get请求
vc.http.apiGet('/attendanceClass/queryAttendanceClassesTask',
param,
function (json, res) {
function(json, res) {
var _todayAttendanceManageInfo = JSON.parse(json);
vc.component.todayAttendanceManageInfo.total = _todayAttendanceManageInfo.total;
vc.component.todayAttendanceManageInfo.records = _todayAttendanceManageInfo.records;
@ -75,26 +76,27 @@
dataCount: vc.component.todayAttendanceManageInfo.total,
currentPage: _page
});
}, function (errInfo, error) {
},
function(errInfo, error) {
console.log('请求失败处理');
}
);
},
_openAttendanceDetailModel: function (_attendance) {
_openAttendanceDetailModel: function(_attendance) {
vc.emit('todayAttendanceDetail', 'openTodayAttendanceDetail', _attendance);
},
//查询
_queryTodayAttendanceMethod: function () {
_queryTodayAttendanceMethod: function() {
vc.component._listTodayAttendances(DEFAULT_PAGE, DEFAULT_ROWS);
},
//重置
_resetTodayAttendanceMethod: function () {
_resetTodayAttendanceMethod: function() {
vc.component.todayAttendanceManageInfo.conditions.classesName = "";
vc.component.todayAttendanceManageInfo.conditions.departmentName = "";
vc.component.todayAttendanceManageInfo.conditions.date = vc.dateFormat(new Date());
vc.component._listTodayAttendances(DEFAULT_PAGE, DEFAULT_ROWS);
},
_moreCondition: function () {
_moreCondition: function() {
if (vc.component.todayAttendanceManageInfo.moreCondition) {
vc.component.todayAttendanceManageInfo.moreCondition = false;
} else {
@ -103,4 +105,4 @@
}
}
});
})(window.vc);
})(window.vc);