You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
739 lines
38 KiB
739 lines
38 KiB
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
|
|
<title>插件模板</title>
|
|
<link rel="stylesheet" href="https://unpkg.com/tailwindcss@2.2.4/dist/tailwind.css">
|
|
<!-- <link rel="stylesheet" type="text/css" href="style.css" /> -->
|
|
<!-- <script type="text/javascript" src="plugin.js"></script> -->
|
|
</head>
|
|
<body>
|
|
<div class="">
|
|
<div class="h-10 w-full flex justify-center items-center border-b-2">项目名称</div>
|
|
<!-- 角色栏-->
|
|
<div class="w-full h-16 flex items-center border-b-2">
|
|
<div class="p-2 m-4">项目经理</div>
|
|
<div class="p-2 m-4 border-b-2 border-blue-500 text-blue-400">运维</div>
|
|
</div>
|
|
|
|
<div class="w-full p-4 bg-gray-100">
|
|
<!-- 日常任务面板-->
|
|
<div class="content p-3 h-46 bg-white rounded-lg">
|
|
<div class="h-6 mb-2 bg-gray-100"></div>
|
|
<div class="h-6 mb-2 bg-gray-100"></div>
|
|
<div class="h-6 mb-2 bg-gray-100"></div>
|
|
<div class="h-6 mb-2 bg-gray-100"></div>
|
|
<div class="h-6 bg-gray-100"></div>
|
|
</div>
|
|
</div>
|
|
<!-- <div class="w-full h-8 bg-blue-500 text-white pl-4 flex items-center">2021年30周</div>-->
|
|
<div class="task-bar h-96 w-full bg-gray-100 p-4">
|
|
<div class="flex mb-3">
|
|
<!-- 序号-->
|
|
<div class="flex flex-col items-center">
|
|
<div class="rounded-full h-8 w-8 mb-1 bg-gray-100 border-2 border-blue-500"></div>
|
|
<div class="w-8 flex-1 flex flex-col items-center">
|
|
<div class="w-0.5 flex-1 bg-gray-300"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex-1">
|
|
<!-- 定期任务面板-->
|
|
<div class="rounded-lg ml-4 bg-white p-3">
|
|
<!-- 示例插件1-->
|
|
<button class="bg-blue-500 py-2 px-5 rounded text-white" onclick="alert('hello')">测试组建1</button>
|
|
<!-- 示例插件2 id=100-->
|
|
<button class="bg-blue-500 py-2 px-5 rounded text-white" onclick="p100.show()">测试组建2</button>
|
|
|
|
<div data-tname="考勤" data-pid="1473556016628244480" data-uid="1217647686598135808" data-rid="1473556018582790144" data-tid="tid444" data-did="did555" style="height:500px;width:100%">
|
|
<!-- 考勤插件 -->
|
|
<div data-root="p1473554031225085952" style="height: 100%; width: 100%;">
|
|
<div class="pb-3 flex justify-between items-center border-b">
|
|
<div class="flex items-center border border-blue-500 rounded-sm">
|
|
<span class="px-2.5 h-6 leading-6 text-sm text-white bg-blue-500">签到</span>
|
|
<span class="px-2.5 h-6 leading-6 text-sm text-blue-500">请假</span>
|
|
</div>
|
|
<div onclick="p1473554031225085952.jumpDetails(this)">
|
|
<img style="width:15px" src="https://www.tall.wiki/staticrec/icon/right.svg" />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mt-2 px-2">
|
|
<!-- <div class="flex items-center text-center h-10 border-b">
|
|
<div class="text-sm" style="width: 20%;">姓名</div>
|
|
<div class="text-sm" style="width: 25%;">早打卡</div>
|
|
<div class="text-sm" style="width: 25%;">晚打卡</div>
|
|
<div class="text-sm" style="width: 30%;">审核人</div>
|
|
</div> -->
|
|
|
|
<div class="record-wrap">
|
|
<div class="flex items-center text-center h-10 border-b">
|
|
<div class="text-sm" style="width: 20%;">姓名</div>
|
|
|
|
<div class="text-sm" style="width: 25%;">
|
|
<div class="flex-1">
|
|
<button class="morningClockBtn bg-blue-500 text-xs rounded py-1 text-white" style="width: 50px;">早打卡</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="text-sm" style="width: 25%;">
|
|
<div class="flex-1">
|
|
<button class="nightClockBtn bg-blue-500 text-xs rounded py-1 text-white" style="width: 50px;">晚打卡</button>
|
|
</div>
|
|
</div>
|
|
<div class="text-sm" style="width: 30%;">
|
|
<div class="flex justify-between flex-nowrap border py-1 px-3 rounded-md" onclick="p1473554031225085952.show()">
|
|
<div class="startBtn mr-1">审核人</div>
|
|
<img style="width:15px" src="https://www.tall.wiki/staticrec/icon/down.svg" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 选择审核人 -->
|
|
<div class="w-screen h-screen fixed z-20 statusChoose bg-black bg-opacity-50" style="display:none;top: 0;left: 0;">
|
|
<div class="flex flex-col absolute w-full bg-white" style="bottom: 0;">
|
|
<div class="flex flex-row justify-between px-5 py-4">
|
|
<span class="text-gray-400" onclick="p1473554031225085952.hide()">取消</span>
|
|
<span class="font-bold">选择审核人</span>
|
|
<span class="text-blue-500" onclick="p1473554031225085952.choose()">确定</span>
|
|
</div>
|
|
<div class="bg-gray-200" style="width:100%;height: 1px"></div>
|
|
<ul class="flex flex-col text-center" style="height: 240px;overflow-y: auto;"></ul>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 打卡弹框 -->
|
|
<div class="w-screen h-screen fixed z-10 clockInPopup bg-black bg-opacity-50" style="display: none; top: 0; left: 0;">
|
|
<div class="flex flex-col absolute bg-white rounded-lg" style="top: 50%; left: 50%; transform: translate(-50%, -50%); width: 90%;">
|
|
<div class="p-4">
|
|
<div class="h-14 flex justify-center items-center font-bold" style="font-size: 17px;">打卡</div>
|
|
<div class="h-12 flex justify-between items-center text-sm" style="border-bottom: 1px solid rgba(0, 0, 0, .1); color: #595959;">
|
|
<div>打卡原因</div>
|
|
<input class="punch-reason text-right focus:outline-none" type="text" placeholder="请输入打卡原因" />
|
|
</div>
|
|
<div class="h-12 flex justify-between items-center text-sm" style="border-bottom: 1px solid rgba(0, 0, 0, .1); color: #595959;">
|
|
<div>打卡时间</div>
|
|
<div class="flex items-center">
|
|
<input class="clockIn text-right focus:outline-none" type="time" value="00:00" />
|
|
<img style="width:15px" src="https://www.tall.wiki/staticrec/icon/right.svg" />
|
|
</div>
|
|
</div>
|
|
<div class="h-12 flex justify-between items-center text-sm" style="border-bottom: 1px solid rgba(0, 0, 0, .1); color: #595959;" onclick="p1473554031225085952.show()">
|
|
<div>审核人</div>
|
|
<div class="flex items-center"><span class="checker">周勇</span><img style="width:15px" src="https://www.tall.wiki/staticrec/icon/right.svg" /></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mt-4 flex" style="border-top: 1px solid rgba(0, 0, 0, .1);">
|
|
<div class="w-2/4 h-14 flex justify-center items-center" style="font-size: 17px; border-right: 1px solid rgba(0, 0, 0, .1);" onclick="p1473554031225085952.hidePopup()">取消</div>
|
|
<div class="w-2/4 h-14 flex justify-center items-center text-blue-500" style="font-size: 17px;" onclick="p1473554031225085952.punch()">提交</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
var p1473554031225085952 = {
|
|
token: '',
|
|
projectId: '',
|
|
roleId: '',
|
|
dom: '',
|
|
lists: [],
|
|
recordList: [], // 打卡列表
|
|
recordTime: '', // 打卡列表时间
|
|
currentIndex: '',
|
|
memberId: '', // 打卡人id
|
|
checkerId: '', // 审核员id
|
|
id: '', // 记录id
|
|
today: '', // 今天日期
|
|
clockType: -1, // 打卡类型 0 早打卡 1 晚打卡
|
|
|
|
init() {
|
|
this.dom = document.querySelector("div[data-root=p1473554031225085952]");
|
|
var domBox = this.dom.parentNode;
|
|
var title = this.dom.querySelector('.title');
|
|
|
|
let currTime = new Date();
|
|
this.today = currTime.getFullYear() + '-' + (currTime.getMonth() + 1) + '-' + currTime.getDate();
|
|
|
|
// 获取父元素携带的参数
|
|
var userId = domBox.getAttribute("data-uid");
|
|
this.projectId = domBox.getAttribute("data-pid");
|
|
this.roleId = domBox.getAttribute("data-rid");
|
|
// 初始化的时候 获取token
|
|
this.getTokenByUserId(userId);
|
|
},
|
|
|
|
// 获取token
|
|
getTokenByUserId(userId){
|
|
var that = this
|
|
fetch(`https://test.tall.wiki/gateway/tall3/v3.0/users/userId?userId=${userId}`)
|
|
.then(function(response) {
|
|
return response.json();
|
|
})
|
|
.then(function(res) {
|
|
const { success, code, data, msg } = res;
|
|
if (success && code === 200) {
|
|
that.token = data.token;
|
|
// 查询项目成员列表
|
|
that.getQueryChecker()
|
|
} else {
|
|
console.log('msg: ', msg);
|
|
}
|
|
});
|
|
},
|
|
|
|
/**
|
|
* 批量查询打卡信息
|
|
* @param {string} projectId 项目id
|
|
* @param {Array} codeList
|
|
*/
|
|
getClockQuery() {
|
|
var that = this
|
|
var timer = null;
|
|
// let d = new Date()
|
|
// let startTime = new Date(d).getTime()
|
|
let startTime = new Date(new Date(new Date().toLocaleDateString()).getTime()).getTime();
|
|
let endTime = new Date(new Date(new Date().toLocaleDateString()).getTime()+24*60*60*1000-1).getTime();
|
|
const params = JSON.stringify({
|
|
param: { projectId: that.projectId,roleId: that.roleId, memberIdList: [], startTime, endTime }
|
|
});
|
|
var url = 'https://test.tall.wiki/gateway/defaultwbs/clock/query';
|
|
fetch(url, {
|
|
method: 'POST',
|
|
mode: 'cors',
|
|
body: params,
|
|
headers: new Headers({
|
|
'Authorization': 'Bearer ' + that.token ,'Content-Type': 'application/json;charset=utf-8'
|
|
})
|
|
}).then(function(response) {
|
|
return response.json();
|
|
}).catch(function(error){
|
|
console.error('Error:', error)
|
|
}).then(function(res){
|
|
const { success, code, data, msg } = res;
|
|
if (success && code === 200) {
|
|
if(data && data.length && data[0].recordList && data[0].recordList.length){
|
|
that.recordList = data[0].recordList;
|
|
that.recordTime = data[0].dateTime;
|
|
|
|
let html = '';
|
|
for (let i = 0; i < that.recordList.length; i++) {
|
|
html += `<div class="record-item-${i} flex items-center text-center h-10 border-b"></div>`;
|
|
}
|
|
that.dom.querySelector('.record-wrap').innerHTML = html;
|
|
|
|
for (let i = 0; i < that.recordList.length; i++) {
|
|
that.renderData(i);
|
|
}
|
|
|
|
that.memberId = data[0].recordList[0].memberId
|
|
that.id = data[0].recordList[0].id
|
|
|
|
// 审核人
|
|
if (data[0].recordList[0].lastCheckerId) {
|
|
that.checkerId = data[0].recordList[0].lastCheckerId
|
|
} else if(data[0].recordList[0].checkerId) {
|
|
that.checkerId = data[0].recordList[0].checkerId
|
|
} else{
|
|
that.checkerId = that.lists[0].memberId;
|
|
}
|
|
|
|
let checkerName = '';
|
|
if (data[0].recordList[0].lastCheckerName) {
|
|
checkerName = data[0].recordList[0].lastCheckerName;
|
|
} else if (data[0].recordList[0].checkerName) {
|
|
checkerName = data[0].recordList[0].checkerName;
|
|
} else {
|
|
checkerName = that.lists[0].name;
|
|
}
|
|
that.dom.querySelector('.checker').innerHTML = checkerName;
|
|
}
|
|
} else {
|
|
console.log('msg: ', msg);
|
|
}
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 查询项目成员列表
|
|
* @param {string} projectId 项目id
|
|
* @param {Array} codeList
|
|
*/
|
|
getQueryChecker() {
|
|
var that = this
|
|
var timer = null;
|
|
let d = new Date()
|
|
const params = JSON.stringify({
|
|
param: { projectId: that.projectId }
|
|
});
|
|
var url = 'https://test.tall.wiki/gateway/defaultwbs/deliver/queryChecker';
|
|
fetch(url, {
|
|
method: 'POST',
|
|
mode: 'cors',
|
|
body: params,
|
|
headers: new Headers({
|
|
'Authorization': 'Bearer ' + that.token ,'Content-Type': 'application/json;charset=utf-8'
|
|
})
|
|
}).then(function(response) {
|
|
return response.json();
|
|
}).catch(function(error){
|
|
console.error('Error:', error)
|
|
}).then(function(res){
|
|
const { success, code, data, msg } = res;
|
|
if (success && code === 200) {
|
|
for(var i = 0; i < data.length; i++){
|
|
data[i].choose = true
|
|
that.lists.push(data[i])
|
|
}
|
|
// 查询考勤信息
|
|
that.getClockQuery()
|
|
} else {
|
|
console.log('msg: ', msg);
|
|
}
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 打卡
|
|
* @param {string} checkerId 审核员id
|
|
* @param {string} clockType 打卡类型 0-早,1-晚
|
|
* @param {string} dateTime 打卡日期
|
|
* @param {string} id 记录id(没有则不传)
|
|
* @param {string} memberId 成员id
|
|
*/
|
|
punch(){
|
|
var that = this
|
|
let { checkerId, id, memberId, clockType } = that
|
|
let d = new Date()
|
|
let dateTime = new Date(d).getTime()
|
|
let remark = that.dom.querySelector('.punch-reason').value;
|
|
const params = JSON.stringify({
|
|
param: { checkerId, id, memberId, dateTime, clockType, remark }
|
|
});
|
|
var url = 'https://test.tall.wiki/gateway/defaultwbs/clock/punch';
|
|
fetch(url, {
|
|
method: 'POST',
|
|
mode: 'cors',
|
|
body: params,
|
|
headers: new Headers({
|
|
'Authorization': 'Bearer ' + that.token ,'Content-Type': 'application/json;charset=utf-8'
|
|
})
|
|
}).then(function(response) {
|
|
return response.json();
|
|
}).catch(function(error) {
|
|
console.error('Error:', error)
|
|
}).then(function(res){
|
|
const { success, code, data, msg } = res;
|
|
if (success && code === 200) {
|
|
that.hidePopup();
|
|
// 查询考勤信息
|
|
that.getClockQuery()
|
|
} else {
|
|
console.log('msg: ', msg);
|
|
}
|
|
})
|
|
},
|
|
|
|
// 显示打卡弹框
|
|
showPopup(type){
|
|
var clockInPopup = this.dom.querySelector('.clockInPopup');
|
|
clockInPopup.style.display = 'block';
|
|
this.clockType = type;
|
|
|
|
let time = this.format(new Date());
|
|
let clockIn = this.dom.querySelector('.clockIn');
|
|
clockIn.value = time;
|
|
},
|
|
|
|
// 隐藏打卡弹框
|
|
hidePopup() {
|
|
var clockInPopup = this.dom.querySelector('.clockInPopup');
|
|
clockInPopup.style.display = 'none';
|
|
},
|
|
|
|
// 显示选择框
|
|
show(){
|
|
var statusChoose = this.dom.querySelector('.statusChoose');
|
|
statusChoose.style.display='block';
|
|
var list = ''
|
|
for (let i = 0; i < this.lists.length; i++) {
|
|
list += `<li class="py-3" onclick="p1473554031225085952.chooseItem(${i})">` + this.lists[i].name + '</li>';
|
|
}
|
|
var ul = this.dom.querySelector('ul');
|
|
ul.innerHTML = list
|
|
},
|
|
|
|
// 选择
|
|
chooseItem(index){
|
|
this.currentIndex = index;
|
|
var lis = this.dom.querySelectorAll('li');
|
|
for (var i = 0; i < lis.length; i++){
|
|
var item = lis[i];
|
|
if(i === index){
|
|
item.classList.add('text-white');
|
|
item.style.backgroundColor = '#3b82f6';
|
|
}else{
|
|
item.classList.remove('text-white');
|
|
item.style.backgroundColor = '#fff';
|
|
}
|
|
}
|
|
},
|
|
|
|
/**
|
|
* 确定 选择审核人
|
|
* @param { Array } codeAndAnswerList code和答案
|
|
* @param { String } projectId 项目ID
|
|
* @param { Number } codeAndAnswerList 提交人类型(0平车 1人)
|
|
*/
|
|
choose(){
|
|
const that = this;
|
|
const { dom } = that;
|
|
var startBtn = dom.querySelector('.startBtn');
|
|
startBtn.innerHTML = that.lists[that.currentIndex].name;
|
|
that.dom.querySelector('.checker').innerHTML = that.lists[that.currentIndex].name;
|
|
that.checkerId = that.lists[that.currentIndex].memberId;
|
|
that.hide();
|
|
},
|
|
|
|
// 取消
|
|
hide(){
|
|
var statusChoose = this.dom.querySelector('.statusChoose');
|
|
statusChoose.style.display='none';
|
|
},
|
|
|
|
// 显示操作面板
|
|
showAction(index, type) {
|
|
for (let i = 0; i < this.recordList.length; i++) {
|
|
this.renderData(i);
|
|
}
|
|
|
|
let action = '';
|
|
if (type === 'morning') {
|
|
action = this.dom.querySelector('.morning-action-' + index);
|
|
} else {
|
|
action = this.dom.querySelector('.night-action-' + index);
|
|
}
|
|
action.style.display = 'inline-block';
|
|
},
|
|
|
|
// 隐藏操作面板
|
|
hideAction(index, type) {
|
|
let action = '';
|
|
if (type === 'morning') {
|
|
action = this.dom.querySelector('.morning-action-' + index);
|
|
} else {
|
|
action = this.dom.querySelector('.night-action-' + index);
|
|
}
|
|
|
|
action.style.display = 'none';
|
|
},
|
|
|
|
// 确认、驳回
|
|
rejectStatus(index, type, timeType) {
|
|
let record = this.recordList[index];
|
|
const param = { id: record.id, type: type, projectId: this.projectId };
|
|
if (timeType === 'morning') {
|
|
param.morning = record.morning;
|
|
} else {
|
|
param.night = record.night;
|
|
}
|
|
this.handleClockAudit(param, index);
|
|
},
|
|
|
|
// 修改时间
|
|
changeTimeData(time, index, type) {
|
|
let record = this.recordList[index];
|
|
let date = new Date(this.recordTime + ' ' + time);
|
|
let dateTime = date.getTime();
|
|
|
|
const param = { id: record.id, type: 0, projectId: this.projectId };
|
|
if (type === 'morning') {
|
|
param.morning = dateTime;
|
|
} else {
|
|
param.night = dateTime;
|
|
}
|
|
|
|
this.handleClockAudit(param, index);
|
|
},
|
|
|
|
/**
|
|
* 审核打卡
|
|
* @param {string} id 打卡记录id
|
|
* @param {string} morning 早打卡时间
|
|
* @param {string} night 晚打卡时间
|
|
* @param {string} projectId 项目id
|
|
* @param {string} type 审批类型(0-修改,1-驳回,2-通过)
|
|
*/
|
|
handleClockAudit(param, index) {
|
|
var that = this
|
|
|
|
const params = JSON.stringify({
|
|
param: param
|
|
});
|
|
var url = 'https://test.tall.wiki/gateway/defaultwbs/clock/audit';
|
|
fetch(url, {
|
|
method: 'POST',
|
|
mode: 'cors',
|
|
body: params,
|
|
headers: new Headers({
|
|
'Authorization': 'Bearer ' + that.token ,'Content-Type': 'application/json;charset=utf-8'
|
|
})
|
|
}).then(function(response) {
|
|
return response.json();
|
|
}).catch(function(error){
|
|
console.error('Error:', error)
|
|
}).then(function(res){
|
|
const { success, code, data, msg } = res;
|
|
if (success && code === 200) {
|
|
// that.getClockQuery();
|
|
if (param.morning) {
|
|
if (param.type === 0) { // 修改
|
|
that.recordList[index].morningStatus = 1;
|
|
} else if (param.type === 1) { // 驳回
|
|
that.recordList[index].morningStatus = 2;
|
|
} else if (param.type === 2) { // 审核
|
|
that.recordList[index].morningStatus = 3;
|
|
}
|
|
|
|
that.recordList[index].morning = param.morning;
|
|
} else {
|
|
if (param.type === 0) { // 修改
|
|
that.recordList[index].nightStatus = 1;
|
|
} else if (param.type === 1) { // 驳回
|
|
that.recordList[index].nightStatus = 2;
|
|
} else if (param.type === 2) { // 审核
|
|
that.recordList[index].nightStatus = 3;
|
|
}
|
|
|
|
that.recordList[index].night = param.night;
|
|
}
|
|
} else {
|
|
console.log('msg: ', msg);
|
|
}
|
|
that.renderData(index);
|
|
})
|
|
},
|
|
|
|
// 修改时间
|
|
changePunchTime(index, type) {
|
|
if (type === 'morning') {
|
|
this.dom.querySelector('.morning-input-' + index).style.display = 'block';
|
|
this.dom.querySelector('.morning-time-' + index).style.display = 'none';
|
|
} else {
|
|
this.dom.querySelector('.night-input-' + index).style.display = 'block';
|
|
this.dom.querySelector('.night-time-' + index).style.display = 'none';
|
|
}
|
|
|
|
this.hideAction(index, type);
|
|
},
|
|
|
|
// 数据渲染
|
|
renderData(index) {
|
|
let that = this;
|
|
let html = '';
|
|
let record = that.recordList[index];
|
|
let morning = Number(record.morning) ? that.format(Number(record.morning)) : '';
|
|
let night = Number(record.night) ? that.format(Number(record.night)) : '';
|
|
|
|
html += `<div class="text-sm" style="width: 20%;">${record.memberName}</div>`;
|
|
|
|
html += `<div class="text-sm" style="width: 25%;">`;
|
|
// 早打卡
|
|
html += `<div class="morning-punch-box-${index} relative inline-block max-w-full">`;
|
|
|
|
if (!record.isMine && !record.isChecker) {
|
|
if (record.morningStatus === 2) {
|
|
html += `<div class="line-through">${morning}</div>`;
|
|
} else {
|
|
html += `<div class="">${morning ? morning : '未打卡'}</div>`;
|
|
}
|
|
}
|
|
|
|
if (record.isMine) {
|
|
if (record.morningStatus === 1) {
|
|
html += `<div class="relative font-bold inline-block">${morning}
|
|
<span class="absolute inline-block rounded-full bg-red-500" style="top: 0; right: -10px; width: 6px; height: 6px;"></span>
|
|
</div>`;
|
|
} else if (record.morningStatus === 2) {
|
|
html += `<div class="line-through font-bold">${morning}</div>`;
|
|
} else if (record.morningStatus === 3) {
|
|
html += `<div class="font-bold">${morning}</div>`;
|
|
} else {
|
|
html += `<button class="morningClockBtn m-auto py-1 rounded bg-blue-500 text-xs text-white" style="width: 50px;" onclick="p1473554031225085952.showPopup(0)">早打卡</button>`;
|
|
}
|
|
}
|
|
|
|
if (record.isChecker) {
|
|
html += `<input class="morning-input-${index} border max-w-full focus:outline-none" style="display: none;" type="time" value="${morning}" onblur="p1473554031225085952.changeTimeData(this.value, ${index}, 'morning')" />`;
|
|
|
|
if (record.morningStatus === 1) {
|
|
html += `<div class="morning-time-${index} relative inline-block" onclick="p1473554031225085952.showAction(${index}, 'morning')">${morning}
|
|
<span class="absolute inline-block rounded-full bg-red-500" style="top: 0; right: -10px; width: 6px; height: 6px;"></span>
|
|
</div>`;
|
|
} else if (record.morningStatus === 2) {
|
|
html += `<div class="morning-time-${index} line-through" onclick="p1473554031225085952.showAction(${index}, 'morning')">${morning}</div>`;
|
|
} else if (record.morningStatus === 3) {
|
|
html += `<div class="morning-time-${index}" onclick="p1473554031225085952.showAction(${index}, 'morning')">${morning}</div>`;
|
|
} else {
|
|
html += `<div class="morning-time-${index}" onclick="p1473554031225085952.showAction(${index}, 'morning')">未打卡</div>`;
|
|
}
|
|
}
|
|
|
|
// 操作面板
|
|
html += `<div class="morning-action-${index} absolute bg-white shadow-lg" style="display: none; bottom: 30px; left: -74px; border-radius: 5px; width: 248px;">
|
|
<div class="relative flex justify-between" style="padding: 8px;">
|
|
<button class="text-white bg-green-500" style="width: 52px; height: 26px; border-radius: 5px;" onclick="p1473554031225085952.rejectStatus(${index}, 2, 'morning')">审核</button>
|
|
<button class="text-white bg-red-500" style="width: 52px; height: 26px; border-radius: 5px;" onclick="p1473554031225085952.rejectStatus(${index}, 1, 'morning')">驳回</button>
|
|
<button class="text-white bg-blue-500" style="width: 52px; height: 26px; border-radius: 5px;" onclick="p1473554031225085952.changePunchTime(${index}, 'morning')">修改</button>
|
|
<button class="border" style="width: 52px; height: 26px; border-radius: 5px; border-color: #999; color: #595959;" onclick="p1473554031225085952.hideAction(${index}, 'morning')">取消</button>
|
|
<div class="absolute w-0 h-0" style="left: 88px; top: 42px; font-size: 0; line-height: 0; border-width: 7px; border-color: #fff transparent transparent;"></div>
|
|
</div>
|
|
</div>`;
|
|
|
|
html += `</div>`;
|
|
html += `</div>`;
|
|
|
|
html += `<div class="text-sm" style="width: 25%;">`;
|
|
// 晚打卡
|
|
html += `<div class="night-punch-box relative max-w-full inline-block">`;
|
|
|
|
if (!record.isMine && !record.isChecker) {
|
|
if (record.nightStatus === 2) {
|
|
html += `<div class="line-through">${night}</div>`;
|
|
} else {
|
|
html += `<div class="">${night ? night : '未打卡'}</div>`;
|
|
}
|
|
} else {
|
|
if (record.isMine) {
|
|
if (record.nightStatus === 1) {
|
|
html += `<div class="relative font-bold inline-block">${night}
|
|
<span class="absolute inline-block rounded-full bg-red-500" style="top: 0; right: -10px; width: 6px; height: 6px;"></span>
|
|
</div>`;
|
|
} else if (record.nightStatus === 2) {
|
|
html += `<div class="line-through font-bold">${night}</div>`;
|
|
} else if (record.nightStatus === 3) {
|
|
html += `<div class="font-bold">${night}</div>`;
|
|
} else {
|
|
html += `<button class="nightClockBtn m-auto py-1 rounded bg-blue-500 text-xs text-white" style="width: 50px;" onclick="p1473554031225085952.showPopup(1)">晚打卡</button>`;
|
|
}
|
|
}
|
|
|
|
if (record.isChecker) {
|
|
html += `<input class="night-input-${index} border max-w-full focus:outline-none" style="display: none;" type="time" value="${night}" onblur="p1473554031225085952.changeTimeData(this.value, ${index}, 'night')" />`;
|
|
|
|
if (record.nightStatus === 1) {
|
|
html += `<div class="night-time-${index} relative inline-block" onclick="p1473554031225085952.showAction(${index}, 'night')">${night}
|
|
<span class="absolute inline-block rounded-full bg-red-500" style="top: 0; right: -10px; width: 6px; height: 6px;"></span>
|
|
</div>`;
|
|
} else if (record.nightStatus === 2) {
|
|
html += `<div class="night-time-${index} line-through" onclick="p1473554031225085952.showAction(${index}, 'night')">${night}</div>`;
|
|
} else if (record.nightStatus === 3) {
|
|
html += `<div class="night-time-${index}" onclick="p1473554031225085952.showAction(${index}, 'night')">${night}</div>`;
|
|
} else {
|
|
html += `<div class="night-time-${index}" onclick="p1473554031225085952.showAction(${index}, 'night')">未打卡</div>`;
|
|
}
|
|
}
|
|
}
|
|
|
|
html += `<div class="night-action-${index} absolute bg-white shadow-lg" style="display: none; bottom: 30px; right: -74px; border-radius: 5px; width: 248px;">
|
|
<div class="relative flex justify-between" style="padding: 8px;">
|
|
<button class="text-white bg-green-500" style="width: 52px; height: 26px; border-radius: 5px;" onclick="p1473554031225085952.rejectStatus(${index}, 2, 'night')">审核</button>
|
|
<button class="text-white bg-red-500" style="width: 52px; height: 26px; border-radius: 5px;" onclick="p1473554031225085952.rejectStatus(${index}, 1, 'night')">驳回</button>
|
|
<button class="text-white bg-blue-500" style="width: 52px; height: 26px; border-radius: 5px;" onclick="p1473554031225085952.changePunchTime(${index}, 'night')">修改</button>
|
|
<button class="border" style="width: 52px; height: 26px; border-radius: 5px; border-color: #999; color: #595959;" onclick="p1473554031225085952.hideAction(${index}, 'night')">取消</button>
|
|
<div class="absolute w-0 h-0" style="right: 88px; top: 42px; font-size: 0; line-height: 0; border-width: 7px; border-color: #fff transparent transparent;"></div>
|
|
</div>
|
|
</div>`;
|
|
|
|
html += `</div>`;
|
|
html += `</div>`;
|
|
|
|
let checker = record.lastCheckerId ? record.lastCheckerName : record.checkerName ? record.checkerName : that.lists[0].name;
|
|
html += `<div class="text-sm" style="width: 30%;">`;
|
|
if (!record.isMine || record.isMine && record.morningStatus && record.nightStatus || that.today !== that.recordTime) {
|
|
html += `<div class="mr-1">${record.checkerName ? record.checkerName : that.lists[0].name}</div>`;
|
|
} else {
|
|
html += `<div class="flex justify-between flex-nowrap border py-1 px-3 rounded-md" onclick="p1473554031225085952.show()">`;
|
|
html += `<div class="startBtn mr-1">${checker}</div>`;
|
|
html += `<img style="width:15px" src="https://www.tall.wiki/staticrec/icon/down.svg" />`;
|
|
html += `</div>`;
|
|
}
|
|
html += `</div>`;
|
|
|
|
that.dom.querySelector('.record-item-' + index).innerHTML = html;
|
|
},
|
|
|
|
// 时间戳转时间格式
|
|
format(shijianchuo){
|
|
//shijianchuo是整数,否则要parseInt转换
|
|
var time = new Date(shijianchuo);
|
|
// var y = time.getFullYear();
|
|
// var m = time.getMonth()+1;
|
|
// var d = time.getDate();
|
|
var h = time.getHours();
|
|
var mm = time.getMinutes();
|
|
// var s = time.getSeconds();
|
|
return this.add0(h)+':' + this.add0(mm);
|
|
},
|
|
|
|
add0(m){return m<10?'0'+m:m },
|
|
|
|
// 跳转详情
|
|
jumpDetails(that) {
|
|
const pId = this.dom.parentNode.getAttribute('data-pid');
|
|
const uId = this.dom.parentNode.getAttribute('data-uid');
|
|
const rId = this.dom.parentNode.getAttribute('data-rid');
|
|
location.href = `https://test.tall.wiki/checkwork/?pid=${pId}&uid=${uId}&rid=${rId}`;
|
|
}
|
|
}
|
|
p1473554031225085952.init()
|
|
</script>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex mb-3">
|
|
<!-- 序号-->
|
|
<div class="flex flex-col items-center">
|
|
<div class="rounded-full h-8 w-8 mb-1 bg-gray-100 border-2 border-blue-500"></div>
|
|
<div class="w-8 flex-1 flex flex-col items-center">
|
|
<div class="w-0.5 flex-1 bg-gray-300"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex-1">
|
|
<!-- 定期任务面板-->
|
|
<div class="rounded-lg ml-4 bg-white p-3">
|
|
<!-- 示例插件1-->
|
|
<button class="bg-blue-500 py-2 px-5 rounded text-white" onclick="alert('hello')">测试组建1</button>
|
|
<!-- 示例插件2 id=100-->
|
|
<button class="bg-blue-500 py-2 px-5 rounded text-white" onclick="p100.show()">测试组建2</button>
|
|
<script>
|
|
const p100 = {
|
|
name: 'hello tall plugin',
|
|
show() {
|
|
alert(this.name)
|
|
}
|
|
}
|
|
</script>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
<style>
|
|
.content, .task-bar{
|
|
overflow-y: scroll;
|
|
}
|
|
.content::-webkit-scrollbar, .task-bar::-webkit-scrollbar{
|
|
display: none;
|
|
}
|
|
</style>
|
|
</html>
|
|
|