325 lines
9.7 KiB
JavaScript
325 lines
9.7 KiB
JavaScript
|
|
history.pushState(null, null, document.URL);
|
|||
|
|
window.addEventListener('popstate', function () {
|
|||
|
|
console.log(document.URL);
|
|||
|
|
history.pushState(null, null, document.URL);
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
setInterval(checkUser,5000);
|
|||
|
|
|
|||
|
|
ELEMENT.locale(ELEMENT.lang.en);
|
|||
|
|
var appVue = new Vue(
|
|||
|
|
{
|
|||
|
|
el:"#app",
|
|||
|
|
data(){
|
|||
|
|
var url = decodeURI(window.location.href);
|
|||
|
|
/*var argsIndex = url.split("?id=");
|
|||
|
|
var arg = argsIndex[1];
|
|||
|
|
|
|||
|
|
var argsIndex1 = url.split("sid=");
|
|||
|
|
var arg1 = argsIndex1[1];
|
|||
|
|
|
|||
|
|
var argsIndex2 = url.split("iid=");
|
|||
|
|
var arg2 = argsIndex2[1];w*/
|
|||
|
|
|
|||
|
|
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]);
|
|||
|
|
|
|||
|
|
// 获取当前屏幕的分辨率
|
|||
|
|
let screenW = window.screen.width;
|
|||
|
|
let screenH = window.innerHeight;
|
|||
|
|
console.log("screen width:",screenW);
|
|||
|
|
console.log("screen height:",screenH);
|
|||
|
|
|
|||
|
|
return {
|
|||
|
|
onlineuser:localStorage.getItem("online_user"),
|
|||
|
|
curWellName:arg,
|
|||
|
|
series_id:arg1,
|
|||
|
|
iid:arg2,
|
|||
|
|
tableData: [],
|
|||
|
|
tHeight:screenH-142,
|
|||
|
|
currentPage: 1,
|
|||
|
|
pagesize:50,
|
|||
|
|
recordTotal:0,
|
|||
|
|
if_show:false,
|
|||
|
|
|
|||
|
|
radio:'1',
|
|||
|
|
|
|||
|
|
if_show_t:true,
|
|||
|
|
|
|||
|
|
wellname:'',
|
|||
|
|
X:'',
|
|||
|
|
Y:'',
|
|||
|
|
WellDepth:'',
|
|||
|
|
Drilling_num:'',
|
|||
|
|
Servicer:'',
|
|||
|
|
Work_time:'',
|
|||
|
|
Wait_time:'',
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
mounted() {
|
|||
|
|
|
|||
|
|
//数据展示获取数据
|
|||
|
|
var _this = this;
|
|||
|
|
|
|||
|
|
axios.post('/deescloud/get_page_setting', {
|
|||
|
|
opuser:localStorage.getItem("online_user"),
|
|||
|
|
opuser_uuid:localStorage.getItem("uuid"),
|
|||
|
|
})
|
|||
|
|
.then(function (response) {
|
|||
|
|
_this.$data.ps_info = response.data;
|
|||
|
|
if(response.data.r2=="1"){
|
|||
|
|
_this.$data.if_show_t=true;
|
|||
|
|
}else{
|
|||
|
|
_this.$data.if_show_t=false;
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
.catch(function (error) {
|
|||
|
|
console.log(error);
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
axios.post('/deescloud/getts_details_en',
|
|||
|
|
{
|
|||
|
|
opuser:localStorage.getItem("online_user"),
|
|||
|
|
opuser_uuid:localStorage.getItem("uuid"),
|
|||
|
|
series:this.$data.series_id,
|
|||
|
|
instrument_id:this.$data.iid,
|
|||
|
|
wellname: this.$data.curWellName,
|
|||
|
|
index: this.$data.currentPage,
|
|||
|
|
count: this.$data.pagesize,
|
|||
|
|
t_type:this.$data.radio,
|
|||
|
|
})
|
|||
|
|
.then(function (response) {
|
|||
|
|
console.log(response.data);
|
|||
|
|
_this.$data.tableData = response.data.data;
|
|||
|
|
_this.$data.recordTotal = response.data.total;
|
|||
|
|
|
|||
|
|
_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);
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
methods: {
|
|||
|
|
r_change(val){
|
|||
|
|
console.log(val);
|
|||
|
|
this.get_ts();
|
|||
|
|
},
|
|||
|
|
|
|||
|
|
get_ts(){
|
|||
|
|
var _this = this;
|
|||
|
|
axios.post('/deescloud/getts_details_en',
|
|||
|
|
{
|
|||
|
|
opuser:localStorage.getItem("online_user"),
|
|||
|
|
opuser_uuid:localStorage.getItem("uuid"),
|
|||
|
|
series:this.$data.series_id,
|
|||
|
|
instrument_id:this.$data.iid,
|
|||
|
|
wellname: this.$data.curWellName,
|
|||
|
|
index: this.$data.currentPage,
|
|||
|
|
count: this.$data.pagesize,
|
|||
|
|
t_type:this.$data.radio,
|
|||
|
|
})
|
|||
|
|
.then(function (response) {
|
|||
|
|
console.log(response.data);
|
|||
|
|
_this.$data.tableData = response.data.data;
|
|||
|
|
_this.$data.recordTotal = response.data.total;
|
|||
|
|
|
|||
|
|
_this.$data.if_show = true;
|
|||
|
|
})
|
|||
|
|
.catch(function (error) {
|
|||
|
|
console.log(error);
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
|
|||
|
|
exportTsDetail(){
|
|||
|
|
var _this = this;
|
|||
|
|
var filename = '';
|
|||
|
|
filename = _this.$data.curWellName+'-temperature range information';
|
|||
|
|
|
|||
|
|
axios.post('deescloud/exportts_en',{
|
|||
|
|
opuser:localStorage.getItem("online_user"),
|
|||
|
|
opuser_uuid:localStorage.getItem("uuid"),
|
|||
|
|
wellname: _this.$data.curWellName,
|
|||
|
|
series:this.$data.series_id,
|
|||
|
|
instrument_id:this.$data.iid,
|
|||
|
|
t_type:this.$data.radio,
|
|||
|
|
},
|
|||
|
|
).then(function (response) {
|
|||
|
|
console.log(response.data);
|
|||
|
|
var fileid = response.data.fileId;
|
|||
|
|
|
|||
|
|
var downUrl = 'file/'+fileid;
|
|||
|
|
downloadUrl(filename+".csv",downUrl);
|
|||
|
|
})
|
|||
|
|
.catch(function (error) {
|
|||
|
|
console.log(error);
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
handleCommand(command) {
|
|||
|
|
if (command === 'exit') {
|
|||
|
|
loginout();
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
handleSizeChange(val) {
|
|||
|
|
this.$data.pagesize = val;
|
|||
|
|
|
|||
|
|
var _this = this;
|
|||
|
|
|
|||
|
|
var objs;
|
|||
|
|
axios.post('/deescloud/getts_details_en', {
|
|||
|
|
opuser:localStorage.getItem("online_user"),
|
|||
|
|
opuser_uuid:localStorage.getItem("uuid"),
|
|||
|
|
series:this.$data.series_id,
|
|||
|
|
instrument_id:this.$data.iid,
|
|||
|
|
wellname: this.$data.curWellName,
|
|||
|
|
index: this.$data.currentPage,
|
|||
|
|
count: this.$data.pagesize,
|
|||
|
|
t_type:this.$data.radio,
|
|||
|
|
})
|
|||
|
|
.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;
|
|||
|
|
|
|||
|
|
var _this = this;
|
|||
|
|
|
|||
|
|
var objs;
|
|||
|
|
axios.post('/deescloud/getts_details_en', {
|
|||
|
|
opuser:localStorage.getItem("online_user"),
|
|||
|
|
opuser_uuid:localStorage.getItem("uuid"),
|
|||
|
|
series:this.$data.series_id,
|
|||
|
|
instrument_id:this.$data.iid,
|
|||
|
|
wellname: this.$data.curWellName,
|
|||
|
|
index: this.$data.currentPage,
|
|||
|
|
count: this.$data.pagesize,
|
|||
|
|
t_type:this.$data.radio,
|
|||
|
|
})
|
|||
|
|
.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);
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
|
|||
|
|
flexColumnWidth(str, tableData, flag = 'max') {
|
|||
|
|
// str为该列的字段名(传字符串);tableData为该表格的数据源(传变量);
|
|||
|
|
// flag为可选值,可不传该参数,传参时可选'max'或'equal',默认为'max'
|
|||
|
|
// flag为'max'则设置列宽适配该列中最长的内容,flag为'equal'则设置列宽适配该列中第一行内容的长度。
|
|||
|
|
let flexWidth = 0
|
|||
|
|
|
|||
|
|
str = str + ''
|
|||
|
|
let columnContent = ''
|
|||
|
|
if (!tableData || !tableData.length || tableData.length === 0 || tableData === undefined) {
|
|||
|
|
flexWidth = 120;
|
|||
|
|
return flexWidth + 'px';
|
|||
|
|
}
|
|||
|
|
if (!str || !str.length || str.length === 0 || str === undefined) {
|
|||
|
|
flexWidth = 120;
|
|||
|
|
return flexWidth + 'px';
|
|||
|
|
}
|
|||
|
|
if (flag === 'equal') {
|
|||
|
|
// 获取该列中第一个不为空的数据(内容)
|
|||
|
|
for (let i = 0; i < tableData.length; i++) {
|
|||
|
|
if (tableData[i][str].length > 0) {
|
|||
|
|
// console.log('该列数据[0]:', tableData[0][str])
|
|||
|
|
columnContent = tableData[i][str]
|
|||
|
|
break
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
// 获取该列中最长的数据(内容)
|
|||
|
|
let index = 0
|
|||
|
|
for (let i = 0; i < tableData.length; i++) {
|
|||
|
|
if (tableData[i][str] === null) {
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
const now_temp = tableData[i][str] + ''
|
|||
|
|
const max_temp = tableData[index][str] + ''
|
|||
|
|
if (now_temp.length > max_temp.length) {
|
|||
|
|
index = i
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
columnContent = tableData[index][str]
|
|||
|
|
}
|
|||
|
|
// console.log('该列数据[i]:', columnContent)
|
|||
|
|
// 以下分配的单位长度可根据实际需求进行调整
|
|||
|
|
|
|||
|
|
console.log(columnContent);
|
|||
|
|
|
|||
|
|
for (const char of columnContent.toString()) {
|
|||
|
|
if ((char >= 'A' && char <= 'Z') || (char >= 'a' && char <= 'z')) {
|
|||
|
|
// 如果是英文字符,为字符分配8个单位宽度
|
|||
|
|
flexWidth += 8
|
|||
|
|
} else if (char >= '\u4e00' && char <= '\u9fa5') {
|
|||
|
|
// 如果是中文字符,为字符分配15个单位宽度
|
|||
|
|
flexWidth += 15
|
|||
|
|
} else {
|
|||
|
|
// 其他种类字符,为字符分配8个单位宽度
|
|||
|
|
flexWidth += 8
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (flexWidth < 120) {
|
|||
|
|
// 设置最小宽度
|
|||
|
|
flexWidth = 120
|
|||
|
|
return flexWidth + 'px'
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (flexWidth > 200) {
|
|||
|
|
// 设置最大宽度
|
|||
|
|
flexWidth = 200;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//console.log("1-flexWidth:",flexWidth);
|
|||
|
|
flexWidth = flexWidth;//20-padding
|
|||
|
|
console.log("2-flexWidth:",flexWidth);
|
|||
|
|
return flexWidth + 'px'
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
}
|
|||
|
|
);
|
|||
|
|
|