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.

228 lines
7.4 KiB

<template>
<div class="container">
<!-- 查询配置 -->
<div style="padding: 0px 20px">
<div ref="lxHeader">
<LxHeader icon="md-apps" text="工具箱异常管理" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
<div slot="content">
</div>
<slot>
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="超时未归还异常" name="first"></el-tab-pane>
<el-tab-pane label="过期未校准异常" name="second"></el-tab-pane>
</el-tabs>
<div class="searchFields">
<el-autocomplete class="inline-input" v-model="searchFields.client" :fetch-suggestions="querySearch"
placeholder="所在工具箱" :trigger-on-focus="true" @select="handleSelectSClient" @blur="handleSelectSClient">
</el-autocomplete>
<Select v-model="searchFields.tool_id" style="width:150px;margin-left: 10px" placeholder="请先选择工具">
</Select>
<DatePicker type="datetimerange" v-model="searchFields.daterange" placeholder="选择时间范围"
style="width: 300px;margin-left:10px;"></DatePicker>
<Input style="width: 200px; margin-left: 10px" v-model.number="searchFields.Name" placeholder="关键词搜索" />
<Button type="primary" @click="load" style="margin-left: 10px">查询</Button>
<Button icon="md-cloud-download" style="margin-left: 10px" type="primary">导出</Button>
</div>
</slot>
</LxHeader>
</div>
<div ref="lxTable" class="table-tree">
<el-table :data="tableData" class="v-table" :height="tableHeight" style="width: 100%">
<el-table-column type="index" width="50" align="center"></el-table-column>
<el-table-column :prop="column.field" :align="column.align" v-for="(column,index) in columns"
:label="column.title" :width="column.width">
<template slot-scope="scope">
<div v-if="column.type == 'img'">
<img v-for="(file, vIndex) in getFilePath( scope.row[column.field], column)" :key="vIndex"
@click="viewImg(scope.row, column, file.path)" class="table-img" :src="file.path" />
</div>
<div v-else-if="column.type=='format'">
<div v-if="column.field=='client'">
{{scope.row[column.field]?scope.row[column.field].name:""}}
</div>
<div v-else-if="column.field=='toolpn'||column.field=='toolname'||column.field=='tooltype'">
{{scope.row.tool[0]?scope.row.tool[0][column.field]:""}}
</div>
</div>
<div v-else>{{scope.row[column.field]}}</div>
</template>
</el-table-column>
</el-table>
<div class="pagination">
<el-pagination @current-change="handleCurrentChange" :current-page="paginations.page"
:page-size="paginations.page_size" background layout="prev, pager, next" :total="paginations.total">
</el-pagination>
</div>
</div>
</div>
</div>
</template>
<script>
import LxHeader from "@/components/LxHeader/index.vue";
import {
listMaintain,
listnoReturn
} from "../../api/toolbox/exception.js"
import {
listToolbox
} from "../../api/toolbox/list.js"
export default {
components: {
LxHeader
},
created() {
this.initLoad();
this.load();
},
mounted() {},
data() {
return {
activeName: "first",
tableHeight: 0,
//查询条件字段
searchFields: {
keyword: "",
client: "",
client_id: "",
tool_id: "",
date_range: "",
daterange: null
},
paginations: {
page: 1,
page_size: 15,
total: 10
},
tableData: [],
columns: [{
field: "client",
title: "工具箱",
type: "format"
},
{
field: "toolpn",
title: "工具编号",
type: "format",
width: 120
},
{
field: "toolname",
title: "工具名称",
type: "format",
width: 100
},
{
field: "tooltype",
title: "工具型号",
type: "format",
width: 120
},
{
field: "TransactionType",
title: "责任人",
type: "int",
width: 80
},
{
field: "TransactionType",
title: "校准截止时间",
type: "int",
width: 180
},
{
field: "TransactionType",
title: "短信通知",
type: "int",
width: 80
},
{
field: "TransactionType",
title: "微信通知",
type: "int",
width: 80
},
],
};
},
methods: {
load() {
if (this.activeName == "first") {
this.loadMaintain();
} else {
this.loadnoReturn();
}
},
handleClick(v) {
this.load();
},
handleCurrentChange(page) {
this.paginations.page = page;
if (this.activeName == "first") {
this.loadMaintain();
} else {
this.loadnoReturn();
}
},
querySearch(queryString, cb) {
listToolbox().then(response => {
var data = response.data;
for (var m of data) {
m.value = m.name;
}
cb(data)
}).catch(error => {
//reject(error)
})
},
handleSelectSClient(item) {
this.searchFields.client_id = item.id;
},
initLoad() {
var that = this;
var clientHeight = document.documentElement.clientHeight
var lxHeader_height = 96.5; //查询 头部
var paginationHeight = 37; //分页的高度
var topHeight = 50; //页面 头部
let tableHeight = clientHeight - lxHeader_height - topHeight - paginationHeight - 61;
that.tableHeight = tableHeight;
},
loadMaintain() {
listMaintain({
client_id: this.searchFields.client_id,
tool_id: this.searchFields.tool_id,
page: this.paginations.page,
page_size: this.paginations.page_size,
keyword: this.searchFields.keyword,
date_range: this.searchFields.date_range
}).then((res) => {
this.tableData = res.data;
this.paginations.total = res.total;
}).catch((error) => {
})
},
loadnoReturn() {
listnoReturn({
client_id: this.searchFields.client_id,
tool_id: this.searchFields.tool_id,
page: this.paginations.page,
page_size: this.paginations.page_size,
keyword: this.searchFields.keyword,
date_range: this.searchFields.date_range
}).then((res) => {
this.tableData = res.data;
this.paginations.total = res.total;
}).catch((error) => {
})
}
},
};
</script>