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.
438 lines
20 KiB
438 lines
20 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="1420652719055839232" data-uid="1323567842540523520" data-rid="rid333" data-tid="tid444" data-did="did555" data-pstart="1627560659000" data-rstart="1627564259000" style="height:50px;width:100%">
|
|
<!-- 溶栓插件 -->
|
|
<div data-root="p1419895941603008512" class="flex flex-row items-center" style="height:100%;width:100%;">
|
|
<div class="flex-1 title" onclick="p1419895941603008512.jumpDetails(this)"></div>
|
|
<div class="flex flex-nowrap startBtn mr-2">
|
|
<button class="bg-blue-500 text-xs rounded-full py-1 px-5 text-white" onclick="p1419895941603008512.show(this)">开始</button>
|
|
</div>
|
|
<div class="flex flex-nowrap statusBtn mr-2 font-bold" style="display:none">
|
|
<span class="mr-3 startTime" onclick="p1419895941603008512.show(this)"></span>
|
|
<span class="text-red-500 disparity"></span>
|
|
</div>
|
|
<div class="flex flex-row-reverse items-center" onclick="p1419895941603008512.jumpDetails(this)">
|
|
<img style="height:16px" src="https://www.tall.wiki/staticrec/photos/right.png">
|
|
</div>
|
|
<div class="time-box w-screen h-screen fixed z-10" style="background: rgba(0,0,0,0.65);top:0;left:0;display:none">
|
|
<div class="flex flex-col absolute w-full" style="background:#fff;bottom: 0;height:300px;border-radius:8px 8px 0 0">
|
|
<div class="flex justify-between p-2 border-gray-200 border-b-2" style="height:44px;">
|
|
<div class="text-gray-500" onclick="p1419895941603008512.cancelTime()">取消</div>
|
|
<div>溶栓时间</div>
|
|
<div class="text-blue-500" onclick="p1419895941603008512.changeTime()">确定</div>
|
|
</div>
|
|
<div class="flex flex-1 items-center overflow-hidden" style="padding:0 16px">
|
|
<div class="h-full flex flex-row text-center w-1/6 overflow-x-hidden relative">
|
|
<div class="h-full mx-auto absolute w-full" style="right:-8px">
|
|
<div class="h-full mx-auto year-box overflow-y-scroll" style="padding: 116px 16px 116px 0"></div>
|
|
</div>
|
|
</div>
|
|
<div class="flex flex-row text-center">
|
|
年
|
|
</div>
|
|
<div class="h-full flex flex-row text-center w-1/6 overflow-x-hidden relative">
|
|
<div class="h-full mx-auto absolute w-full" style="right:-8px">
|
|
<div class="h-full month-box mx-auto overflow-y-scroll" style="padding: 116px 16px 116px 0"></div>
|
|
</div>
|
|
</div>
|
|
<div class="flex flex-row text-center">
|
|
月
|
|
</div>
|
|
<div class="h-full flex flex-row text-center w-1/6 overflow-x-hidden relative">
|
|
<div class="h-full mx-auto absolute w-full" style="right:-8px">
|
|
<div class="h-full day-box mx-auto overflow-y-scroll" style="padding: 116px 16px 116px 0"></div>
|
|
</div>
|
|
</div>
|
|
<div class="flex flex-row text-center">
|
|
日
|
|
</div>
|
|
<div class="h-full flex flex-row text-center w-1/6 overflow-x-hidden relative">
|
|
<div class="h-full mx-auto absolute w-full" style="right:-8px">
|
|
<div class="h-full hour-box mx-auto overflow-y-scroll" style="padding: 116px 16px 116px 0;"></div>
|
|
</div>
|
|
</div>
|
|
<div class="flex flex-row text-center">
|
|
时
|
|
</div>
|
|
<div class="h-full flex flex-row text-center w-1/6 overflow-x-hidden relative">
|
|
<div class="h-full mx-auto absolute w-full" style="right:-8px">
|
|
<div class="h-full min-box mx-auto overflow-y-scroll" style="padding: 116px 16px 116px 0;"></div>
|
|
</div>
|
|
</div>
|
|
<div class="flex flex-row text-center">
|
|
分
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
var p1419895941603008512 = {
|
|
token: '',
|
|
dom: '',
|
|
projectId: '',
|
|
planStart: '',
|
|
realStart: '',
|
|
chooseTimeValue: 0,
|
|
|
|
init() {
|
|
this.dom = document.querySelector("div[data-root=p1419895941603008512]");
|
|
var domBox = this.dom.parentNode;
|
|
var title = this.dom.querySelector('.title');
|
|
title.innerHTML = domBox.getAttribute('data-tname')
|
|
this.planStart = domBox.getAttribute('data-pstart')
|
|
this.realStart = domBox.getAttribute('data-rstart')
|
|
this.chooseTimeValue = +this.realStart
|
|
|
|
// 获取父元素携带的参数
|
|
var userId = domBox.getAttribute("data-uid");
|
|
this.projectId = domBox.getAttribute("data-pid");
|
|
// 初始化的时候 获取token
|
|
this.getTokenByUserId(userId);
|
|
},
|
|
|
|
// 获取token
|
|
getTokenByUserId(userId){
|
|
var that = this
|
|
fetch(`https://www.tall.wiki/gateway/tall3/v3.0/users/userId?userId=${userId}`)
|
|
.then(function(response) {
|
|
return response.json();
|
|
})
|
|
.then(function(res) {
|
|
var { success, code, data, msg } = res;
|
|
if (success && code === 200) {
|
|
that.token = data.token;
|
|
} else {
|
|
alert(msg || '获取失败')
|
|
}
|
|
});
|
|
},
|
|
|
|
// 选择时间 添加
|
|
async show(){
|
|
var timeBox = this.dom.querySelector('.time-box');
|
|
timeBox.style.display = 'block'
|
|
this.setTimeData()
|
|
},
|
|
|
|
/**
|
|
* 确定 批量提交急救信息
|
|
* @param { Array } codeAndAnswerList code和答案
|
|
* @param { String } projectId 项目ID
|
|
* @param { Number } codeAndAnswerList 提交人类型(0平车 1人)
|
|
*/
|
|
choose(time){
|
|
var that = this;
|
|
var params = JSON.stringify({
|
|
param: {
|
|
codeAndAnswerList: [
|
|
{
|
|
answer: [time],
|
|
questionCode: 'JMRSSJ'
|
|
}
|
|
],
|
|
projectId: that.projectId,
|
|
userType: 0
|
|
}
|
|
});
|
|
fetch('https://www.tall.wiki/gateway/qcp/v3.0/patient/aidRecord', {
|
|
headers: new Headers({
|
|
'Authorization': 'Bearer ' + that.token,
|
|
'Content-Type': 'application/json;charset=utf-8'
|
|
}),
|
|
method: 'POST',
|
|
mode: 'cors',
|
|
body: params
|
|
}).then(function(response) {
|
|
return response.json();
|
|
}).catch(function(error){
|
|
console.error('Error:', error)
|
|
// TODO: 测试数据
|
|
that.setDate()
|
|
// TODO:
|
|
}).then(function(res){
|
|
var { success, code, data, msg } = res;
|
|
if (success && code === 200) {
|
|
that.setDate()
|
|
} else {
|
|
alert(msg || '添加失败')
|
|
}
|
|
})
|
|
},
|
|
|
|
// 界面渲染
|
|
setDate(res) {
|
|
var { dom } = this;
|
|
var startBtn = dom.querySelector('.startBtn');
|
|
var statusBtn = dom.querySelector('.statusBtn');
|
|
var startTime = dom.querySelector('.startTime');
|
|
var disparity = dom.querySelector('.disparity');
|
|
|
|
startBtn.style.display='none';
|
|
statusBtn.style.display='block';
|
|
|
|
var ms = (+this.planStart) - (+this.chooseTimeValue); //时间差的毫秒数
|
|
var morbidityTime = Math.ceil(ms/1000/60);
|
|
disparity.innerHTML = morbidityTime + "min"
|
|
startTime.innerHTML = this.setTime(this.chooseTimeValue)
|
|
if(morbidityTime >= 0){
|
|
disparity.className="text-red-500 disparity"
|
|
}else{
|
|
disparity.className="text-green-500 disparity"
|
|
}
|
|
},
|
|
|
|
// 转化时间格式
|
|
setTime(timestamp) {
|
|
let time = new Date(+timestamp)
|
|
let year = time.getFullYear()
|
|
var month = (time.getMonth() + 1).toString().padStart(2, '0')
|
|
var date = (time.getDate()).toString().padStart(2, '0')
|
|
var hours = (time.getHours()).toString().padStart(2, '0')
|
|
var minute = (time.getMinutes()).toString().padStart(2, '0')
|
|
var second = (time.getSeconds()).toString().padStart(2, '0')
|
|
|
|
return hours + ':' + minute
|
|
},
|
|
|
|
// 开始到场
|
|
jumpDetails(that) {
|
|
var pId = that.parentNode.parentNode.getAttribute('data-pid');
|
|
var rId = that.parentNode.parentNode.getAttribute('data-rid');
|
|
var uId = that.parentNode.parentNode.getAttribute('data-uid');
|
|
var tId = that.parentNode.parentNode.getAttribute('data-tid');
|
|
location.href = `https://www.tall.wiki/qc/vein?projectId=${pId}&roleId=${rId}&userId=${uId}&id=${tId}`;
|
|
},
|
|
|
|
// 取消时间
|
|
cancelTime() {
|
|
var timeBox = this.dom.querySelector('.time-box');
|
|
timeBox.style.display = 'none'
|
|
},
|
|
|
|
// 确定时间
|
|
async changeTime() {
|
|
var hourDom = this.dom.querySelector('.hour-box');
|
|
var minDom = this.dom.querySelector('.min-box');
|
|
var yearDom = this.dom.querySelector('.year-box');
|
|
var monthDom = this.dom.querySelector('.month-box');
|
|
var dayDom = this.dom.querySelector('.day-box');
|
|
var year = 2021 - Math.round(yearDom.scrollTop / 26)
|
|
let month = Math.round(monthDom.scrollTop / 26) + 1
|
|
let day = Math.round(dayDom.scrollTop / 26) + 1
|
|
if (month === 2) {
|
|
if ( (year % 4 === 0 && year % 100 !== 0) || (year % 400 === 0 && year % 4000 !== 0) ) {
|
|
if(day > 29) {
|
|
day = 29
|
|
}
|
|
} else {
|
|
if(day > 28) {
|
|
day = 28
|
|
}
|
|
}
|
|
} else {
|
|
if (month === 2 || month === 4 || month === 6 || month === 9 || month === 11) {
|
|
if(day > 30) {
|
|
day = 30
|
|
}
|
|
} else {
|
|
if(day > 31) {
|
|
day = 31
|
|
}
|
|
}
|
|
}
|
|
let hour = Math.round(hourDom.scrollTop / 26)
|
|
let min = Math.round(minDom.scrollTop / 26)
|
|
if(month<10) {
|
|
month = '0' + month
|
|
}
|
|
if(day<10) {
|
|
day = '0' + day
|
|
}
|
|
if(hour<10) {
|
|
hour = '0' + hour
|
|
}
|
|
if(min<10) {
|
|
min = '0' + min
|
|
}
|
|
var chooseTime = `${year}-${month}-${day} ${hour}:${min}`
|
|
this.chooseTimeValue = new Date(chooseTime.replace(/-/g,'/')).getTime()
|
|
if(chooseTime){
|
|
await this.choose(this.chooseTimeValue)
|
|
this.cancelTime()
|
|
}
|
|
},
|
|
|
|
// 设置时间数据
|
|
setTimeData(){
|
|
var hourDom = this.dom.querySelector('.hour-box');
|
|
var minDom = this.dom.querySelector('.min-box');
|
|
var yearDom = this.dom.querySelector('.year-box');
|
|
var monthDom = this.dom.querySelector('.month-box');
|
|
var dateDom = this.dom.querySelector('.day-box');
|
|
// 清空
|
|
hourDom.innerHTML = '';
|
|
minDom.innerHTML = '';
|
|
yearDom.innerHTML = '';
|
|
monthDom.innerHTML = '';
|
|
dateDom.innerHTML = '';
|
|
var nowYear = new Date().getFullYear();
|
|
var nowMonth = new Date().getMonth();
|
|
var nowDay = new Date().getDate()-1;
|
|
var nowHour = new Date().getHours();
|
|
var nowMin = new Date().getMinutes();
|
|
var yearTop = 0;
|
|
var monthTop = 0;
|
|
var dayTop = 0;
|
|
var hourTop = 0;
|
|
var minTop = 0;
|
|
/* 生成小时数组 */
|
|
for(let i=0;i<24;i++) {
|
|
var div = document.createElement('div');
|
|
div.style.height = '26px';
|
|
div.innerHTML = i;
|
|
hourDom.appendChild(div);
|
|
if(nowHour === i) {
|
|
hourTop = i*26
|
|
}
|
|
}
|
|
/* 生成分钟数组 */
|
|
for(let i=0;i<60;i++) {
|
|
var div = document.createElement('div');
|
|
div.style.height = '26px';
|
|
div.innerHTML = i;
|
|
minDom.appendChild(div);
|
|
if(nowMin === i) {
|
|
minTop = i*26
|
|
}
|
|
}
|
|
/* 生成年数组 */
|
|
var my = new Date();
|
|
var endYear = my.getFullYear();// 获取当前年份
|
|
for (var i = endYear; i > 1899; i--) {
|
|
var div = document.createElement('div');
|
|
div.style.height = '26px';
|
|
div.innerHTML = i;
|
|
yearDom.appendChild(div);
|
|
}
|
|
/* 生成月数组 */
|
|
for (var i = 1; i < 13; i++) {
|
|
var div = document.createElement('div');
|
|
div.style.height = '26px';
|
|
div.innerHTML = i;
|
|
monthDom.appendChild(div);
|
|
if(nowMonth === i) {
|
|
monthTop = i*26
|
|
}
|
|
}
|
|
/* 生成日数组 */
|
|
for (var i = 1; i < 32; i++) {
|
|
var div = document.createElement('div');
|
|
div.style.height = '26px';
|
|
div.innerHTML = i;
|
|
dateDom.appendChild(div);
|
|
if(nowDay === i) {
|
|
dayTop = i*26
|
|
}
|
|
}
|
|
hourDom.scrollTop = hourTop
|
|
minDom.scrollTop = minTop
|
|
monthDom.scrollTop = monthTop
|
|
dateDom.scrollTop = dayTop
|
|
}
|
|
|
|
}
|
|
p1419895941603008512.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>
|
|
var 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>
|
|
|