故障报

role1.0
fanluyan 1 year ago
parent ceb665d724
commit 38b708b4a3

@ -785,3 +785,11 @@ export function getTermFaultsApi(data) {
data,
});
}
//导出数据故障信息报
export function getTermFaultsExcel() {
return request({
url: "/xymanager/getTermFaultsExcel",
method: "get",
responseType: "blob",
});
}

@ -195,7 +195,8 @@ export default {
//
handleExport(val) {
console.log(val);
window.location.href = "/api/api/getOnlineTerminalListExcel?type=" + val;
window.location.href =
"/api/xymanager/getOnlineTerminalListExcel?type=" + val;
},
//
changedate() {

@ -9,8 +9,10 @@
<el-form :inline="true" :model="formdata" class="demo-form-inline">
<el-form-item label="开始日期">
<el-date-picker
@change="changestartdate"
v-model="formdata.starttime"
type="datetime"
:picker-options="pickerOptions"
placeholder="开始日期"
value-format="timestamp"
>
@ -18,9 +20,10 @@
</el-form-item>
<el-form-item label="结束日期">
<el-date-picker
@change="changeenddate"
v-model="formdata.endtime"
type="datetime"
default-time="23:59:59"
:picker-options="pickerOptions"
placeholder="结束日期"
value-format="timestamp"
class="ml10"
@ -29,7 +32,7 @@
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit"></el-button>
<el-button type="primary">导出</el-button>
<el-button type="primary" @click="exportFault"></el-button>
</el-form-item>
</el-form>
<el-table
@ -49,7 +52,13 @@
</template>
</el-table-column>
<el-table-column
prop="fault_time"
prop="cmdid"
label="装置编号"
min-width="120"
show-overflow-tooltip
></el-table-column>
<el-table-column
prop="faultTime"
label="采集时间"
min-width="120"
show-overflow-tooltip
@ -74,12 +83,12 @@
</el-pagination>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="isShow = false"> </el-button>
<el-button @click="hide"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { getTermFaultsApi } from "@/utils/api/index";
import { getTermFaultsApi, getTermFaultsExcelApi } from "@/utils/api/index";
export default {
data() {
return {
@ -91,17 +100,77 @@ export default {
page: 1, //
pageSize: 10, //
total: 0, //
pickerOptions: {
disabledDate(date) {
return date.getTime() > Date.now(); //
},
},
};
},
mounted() {
watch: {
endtime(newVal) {
if (newVal) {
const date = new Date(newVal);
date.setHours(23);
date.setMinutes(59);
date.setSeconds(59);
this.formdata.endtime = date;
}
},
},
created() {},
mounted() {},
methods: {
getTime() {
const thirtyDaysAgo = new Date();
thirtyDaysAgo.setHours(0); // 23
thirtyDaysAgo.setMinutes(0); // 59
thirtyDaysAgo.setSeconds(0); // 59
this.$set(
this.formdata,
"starttime",
new Date(new Date().toLocaleDateString()).getTime()
new Date(thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30))
);
this.$set(this.formdata, "endtime", new Date().getTime());
console.log(this.formdata.starttime);
const currentDate = new Date(); //
currentDate.setHours(23); // 23
currentDate.setMinutes(59); // 59
currentDate.setSeconds(59); // 59
this.$set(this.formdata, "endtime", currentDate);
this.getfaultinfo();
},
changestartdate(val) {
console.log(val);
if (val == null) {
console.log(new Date());
const startDate = new Date();
startDate.setHours(0); // 23
startDate.setMinutes(0); // 59
startDate.setSeconds(0); // 59
this.formdata.starttime = startDate;
console.log(this.formdata.starttime);
} else {
this.formdata.starttime = val;
}
},
//
changeenddate(val) {
if (val == null) {
console.log(new Date());
const endDate = new Date();
endDate.setHours(23); // 23
endDate.setMinutes(59); // 59
endDate.setSeconds(59); // 59
this.formdata.endtime = endDate;
console.log(this.formdata.endtime);
} else {
val.setHours(23); // 23
val.setMinutes(59); // 59
val.setSeconds(59); // 59
this.formdata.endtime = val;
console.log(val);
}
},
methods: {
//
onSubmit() {
if (this.formdata.starttime > this.formdata.endtime) {
@ -114,18 +183,27 @@ export default {
}
this.getfaultinfo();
},
//
exportFault() {
window.location.href =
"/api/getTermFaultsExcel?termid=" + this.rowInfo.id;
},
//
getfaultinfo() {
this.loading = true;
getTermFaultsApi({
termid: this.rowInfo.id,
starttime: this.formdata.starttime,
endtime: this.formdata.endtime,
pageindex: this.page,
pagesize: this.pageSize,
}).then((res) => {
this.listData = res.data.list;
this.total = res.data.total;
this.$nextTick(() => {
this.loading = false;
});
});
},
//
handleCurrentChange(val) {
@ -141,10 +219,11 @@ export default {
console.log(row);
this.rowInfo = row;
this.isShow = true;
this.getfaultinfo();
this.getTime();
},
hide() {
this.isShow = false;
this.formdata = {};
},
},
};

@ -22,12 +22,12 @@ module.exports = defineConfig({
"/api": {
//表示拦截以/api开头的请求路径
//target: "http://47.96.238.157:8093", //阿里云服务器环境
target: "http://180.166.218.222:40080", //dell
//target: "http://192.168.50.7:8094", //liu 本机ip
//target: "http://180.166.218.222:40080", //dell
target: "http://192.168.50.7:8094", //liu 本机ip
// target: "http://192.168.50.42:81", //东视
changOrigin: true, //是否开启跨域
pathRewrite: {
"^/api": "/api", //重写api把api变成空字符因为我们真正请求的路径是没有api的
"^/api": "", //重写api把api变成空字符因为我们真正请求的路径是没有api的
},
},
},

Loading…
Cancel
Save