deesCloud-web/scripts/hisd.js

422 lines
12 KiB
JavaScript
Raw Permalink Normal View History

2025-08-01 16:50:32 +08:00
history.pushState(null, null, document.URL);
window.addEventListener('popstate', function () {
console.log(document.URL);
history.pushState(null, null, document.URL);
});
setInterval(checkUser,5000);
var appVue = new Vue(
{
el:"#app",
data(){
var url = decodeURI(window.location.href);
let reg = new RegExp("(^|&)" + 'id' + "=([^&]*)(&|$)", "i");
let r = window.location.search.substr(1).match(reg);
let arg = decodeURI(r[2]);
reg = new RegExp("(^|&)" + 'sid' + "=([^&]*)(&|$)", "i");
r = window.location.search.substr(1).match(reg);
let arg1 = decodeURI(r[2]);
reg = new RegExp("(^|&)" + 'iid' + "=([^&]*)(&|$)", "i");
r = window.location.search.substr(1).match(reg);
let arg2 = decodeURI(r[2]);
// 获取浏览器窗口宽度
var windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
// 获取浏览器窗口高度
var windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
console.log('窗口宽度: ' + windowWidth);
console.log('窗口高度: ' + windowHeight);
// 获取当前屏幕的分辨率
let screenW = window.screen.width;
let screenH = window.screen.height;
console.log("screen width:",screenW);
console.log("screen height:",screenH);
return {
tHeight:windowHeight-192,
tableData: [],
currentPage: 1,
pagesize:50,
recordTotal:0,
if_show:false,
curWellName:arg,
well_state:arg1,
well_oper:arg2,
onlineuser:localStorage.getItem("online_user"),
begin_t:'',
end_t:'',
checked:false,
vit:false,
radio1:'1',
radio2:'1',
if_show_bt:1,
if_show_et:false,
wellname:'',
X:'',
Y:'',
WellDepth:'',
Drilling_num:'',
Servicer:'',
Work_time:'',
Wait_time:'',
nb_data:[],
timeout_data:[],
ver_data:[],
tHeight1:windowHeight-182,
time_warn:0,
value: [], // 多选时为数组
options: [{
value: 0,
label: '测斜'
}, {
value: 1,
label: '近钻头'
}, {
value: 2,
label: '电阻率'
}, {
value: 3,
label: '探管式方位伽马'
}, {
value: 4,
label: '钻铤式方位伽马'
}, {
value: 5,
label: '自然伽马'
}, {
value: 6,
label: '工程参数'
}, {
value: 7,
label: '振动粘滑'
}]
}
},
mounted() {
var _this = this;
axios.post('/deescloud/get_page_setting', {
opuser:localStorage.getItem("online_user"),
opuser_uuid:localStorage.getItem("uuid"),
})
.then(function (response) {
if(response.data.r3=="1"){
_this.$data.if_show_bt=1;
//_this.$data.if_show_et=false;
}else if(response.data.r3=="2"){
//_this.$data.if_show_et=true;
_this.$data.if_show_bt=2;
}else if(response.data.r3=="3"){
//_this.$data.if_show_et=true;
_this.$data.if_show_bt=3;
}else{
_this.$data.if_show_bt=1;
}
})
.catch(function (error) {
console.log(error);
});
var objs;
axios.post('/deescloud/getWellHistory', {
opuser:localStorage.getItem("online_user"),
opuser_uuid:localStorage.getItem("uuid"),
id: this.$data.curWellName,
index: this.$data.currentPage,
count: this.$data.pagesize,
if_asc:this.$data.checked,
if_vit:this.$data.vit,
r1:this.$data.radio1,
r2:this.$data.radio2,
})
.then(function (response) {
console.log(response.data);
objs = response.data.data;
rcnt = response.data.total;
_this.$data.tableData = objs;
_this.$data.recordTotal = rcnt;
_this.$data.time_warn = response.data.time_warn;
_this.$data.if_show = true;
})
.catch(function (error) {
console.log(error);
});
axios.post('/deescloud/get_well_cur_data', {
opuser:localStorage.getItem("online_user"),
opuser_uuid:localStorage.getItem("uuid"),
Wellname: this.$data.curWellName,
})
.then(function (response) {
console.log(response.data);
let data = response.data;
_this.$data.wellname =data.wellname;
_this.$data.X = data.x
_this.$data.Y = data.y;
_this.$data.WellDepth = data.cur_well_dep;
_this.$data.Drilling_num=data.Drilling_num;
_this.$data.Servicer = data.Servicer;
_this.$data.Wait_time =data.Wait_time;
_this.$data.Work_time =data.Work_time;
})
.catch(function (error) {
console.log(error);
});
axios.post('/deescloud/get_well_nb', {
opuser:localStorage.getItem("online_user"),
opuser_uuid:localStorage.getItem("uuid"),
wellname: this.$data.curWellName,
})
.then(function (response) {
let data = response.data.data;
console.log(data);
_this.$data.nb_data = data;
})
.catch(function (error) {
console.log(error);
});
axios.post('/deescloud/get_well_instrument_timeout', {
opuser:localStorage.getItem("online_user"),
opuser_uuid:localStorage.getItem("uuid"),
wellname: this.$data.curWellName,
})
.then(function (response) {
let data = response.data.data;
console.log(data);
_this.$data.timeout_data = data;
})
.catch(function (error) {
console.log(error);
});
axios.post('/deescloud/get_well_ver_timeout', {
opuser:localStorage.getItem("online_user"),
opuser_uuid:localStorage.getItem("uuid"),
wellname: this.$data.curWellName,
})
.then(function (response) {
let data = response.data.data;
console.log(data);
_this.$data.ver_data = data;
})
.catch(function (error) {
console.log(error);
});
},
methods: {
r_change(){
this.getWellhistory();
},
tableRowClassName({row, rowIndex}) {
if (row.paraname=='井斜') {
if (row.decodevalue >180 || row.decodevalue<0) {
return 'warning-row';
}
}
if (row.paraname=='方位') {
if (row.decodevalue >360 || row.decodevalue<0) {
return 'warning-row';
}
}
if (row.paraname=='重工面' || row.paraname=='磁工面') {
if (row.decodevalue >360 || row.decodevalue<0) {
return 'warning-row';
}
}
if (row.ifWarning==1){
return 'warning-row';
}
return '';
},
handleCommand(command) {
if (command === 'exit') {
loginout();
}
},
exportWellHis(){
var _this = this;
axios.post('deescloud/exportWellHistory',{
opuser:localStorage.getItem("online_user"),
opuser_uuid:localStorage.getItem("uuid"),
id: this.$data.curWellName,
beginTime:this.$data.begin_t,
endTime:this.$data.end_t,
if_asc:_this.$data.checked,
if_vit:this.$data.vit,
r1:this.$data.radio1,
r2:this.$data.radio2,
},
).then(function (response) {
console.log(response.data);
var fileid = response.data.fileId;
var downUrl = 'file/'+fileid;
downloadUrl(_this.$data.curWellName+".csv",downUrl);
})
.catch(function (error) {
console.log(error);
});
},
getWellhistory(){
document.getElementById("bt_serach").blur();
this.$data.currentPage = 1;
if (this.$data.curWellName=='') {
console.log("查询的井名为空!");
return;
}
if (this.$data.begin_t != '' && this.$data.end_t != '' && this.$data.begin_t>this.$data.end_t) {
this.$message({
message: '结束时间必须在开始时间之后!',
type: 'warning',
duration: 1500
});
return;
}
let type = 0;
if (this.value.length > 0) {
for (let i = 0; i < this.value.length; i++) {
type += (1 << this.value[i]); // 使用位掩码合并多个选项
}
}
var _this = this;
var objs;
axios.post('/deescloud/getWellHistory', {
opuser:localStorage.getItem("online_user"),
opuser_uuid:localStorage.getItem("uuid"),
id: this.$data.curWellName,
index: this.$data.currentPage,
count: this.$data.pagesize,
beginTime:this.$data.begin_t,
endTime:this.$data.end_t,
if_asc:this.$data.checked,
if_vit:this.$data.vit,
r1:this.$data.radio1,
r2:this.$data.radio2,
type: type,
})
.then(function (response) {
console.log(response.data);
objs = response.data.data;
rcnt = response.data.total;
_this.$data.tableData = objs;
_this.$data.recordTotal = rcnt;
})
.catch(function (error) {
console.log(error);
});
},
handleSizeChange(val) {
this.$data.pagesize = val;
if (this.$data.begin_t != '' && this.$data.end_t != '' && this.$data.begin_t>this.$data.end_t) {
this.$message({
message: '结束时间必须在开始时间之后!',
type: 'warning',
duration: 1500
});
return;
}
var _this = this;
var objs;
axios.post('/deescloud/getWellHistory', {
opuser:localStorage.getItem("online_user"),
opuser_uuid:localStorage.getItem("uuid"),
id: this.$data.curWellName,
index: this.$data.currentPage,
count: this.$data.pagesize,
beginTime:this.$data.begin_t,
endTime:this.$data.end_t,
if_asc:this.$data.checked,
if_vit:this.$data.vit,
r1:this.$data.radio1,
r2:this.$data.radio2,
})
.then(function (response) {
console.log(response.data);
objs = response.data.data;
rcnt = response.data.total;
_this.$data.tableData = objs;
_this.$data.recordTotal = rcnt;
})
.catch(function (error) {
console.log(error);
});
},
handleCurrentChange(val) {
this.$data.currentPage = val;
if (this.$data.begin_t != '' && this.$data.end_t != '' && this.$data.begin_t>this.$data.end_t) {
this.$message({
message: '结束时间必须在开始时间之后!',
type: 'warning',
duration: 1500
});
return;
}
var _this = this;
var objs;
axios.post('/deescloud/getWellHistory', {
opuser:localStorage.getItem("online_user"),
opuser_uuid:localStorage.getItem("uuid"),
id: this.$data.curWellName,
index: this.$data.currentPage,
count: this.$data.pagesize,
beginTime:this.$data.begin_t,
endTime:this.$data.end_t,
if_asc:this.$data.checked,
if_vit:this.$data.vit,
r1:this.$data.radio1,
r2:this.$data.radio2,
})
.then(function (response) {
console.log(response.data);
objs = response.data.data;
rcnt = response.data.total;
_this.$data.tableData = objs;
_this.$data.recordTotal = rcnt;
})
.catch(function (error) {
console.log(error);
});
},
}
}
);