123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- <template>
- <section>
- <!--工具条-->
- <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
- <div class="nowTime">{{ $t('feiGongZuoQingKuangTongJi') }}</div>
- </el-col>
- <!--列表-->
- <el-table
- :data="list"
- highlight-current-row
- v-loading="listLoading"
- :height="tableHeight"
- style="width: 100%;"
- >
- <el-table-column type="index" width="60"></el-table-column>
- <el-table-column prop="name" :label="$t('lable.name')" width="140" sortable></el-table-column>
- <el-table-column :label="$t('hangWei')">
- <template slot-scope="scope">{{converType(scope.row.type+1)}}</template>
- </el-table-column>
- <el-table-column :label="$t('tuPian')" width="200">
- <template slot-scope="scope">
- <el-image :src="scope.row.picUrl" :preview-src-list="getSrcList(index)">
- <div slot="error" class="image-slot">
- <el-image :src="require('../../assets/image/noPic.png')" class="image"></el-image>
- </div>
- </el-image>
- </template>
- </el-table-column>
- <el-table-column prop="time" :label="$t('time.times')" width="140" sortable></el-table-column>
- <el-table-column prop="date" :label="$t('weekDay.date')" width="140" sortable></el-table-column>
- </el-table>
- <!--工具条-->
- <el-col :span="24" class="toolbar">
- <el-pagination
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :page-sizes="[20 , 50 , 80 , 100]"
- :page-size="20"
- layout="total, sizes, prev, pager, next"
- :total="total"
- style="float:right;"
- ></el-pagination>
- </el-col>
- </section>
- </template>
- <script>
- export default {
- data() {
- return {
- user: JSON.parse(sessionStorage.getItem("user")),
- tableHeight: 0,
- listLoading: false,
- total: 0,
- page: 1,
- size: 20,
- list: [],
- srcList: [],
- };
- },
- methods: {
- //获取异常信息
- getDevianceList() {
- this.listLoading = true;
- this.http.post(
- this.port.time.listDeviance,
- { pageIndex: this.page, pageSize: this.size },
- res => {
- this.listLoading = false;
- if (res.code == "ok") {
- this.list = res.data.records;
- this.srcList = [];
- for(var i in this.list) {
- this.srcList.push(this.list[i].picUrl)
- }
- this.total = res.data.total;
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.listLoading = false;
- this.$message({
- message: error,
- type: "error"
- });
- }
- );
- },
- //分页
- handleCurrentChange(val) {
- this.page = val;
- this.getDevianceList();
- },
- handleSizeChange(val) {
- this.size = val;
- this.getDevianceList();
- },
- //类型枚举转换
- converType(type) {
- switch (type) {
- case 0:
- return this.$t('qiTaGongZuo');
- case 1:
- return this.$t('yanFa');
- case 2:
- return this.$t('shangWang');
- case 3:
- return this.$t('wenDang');
- case 4:
- return this.$t('sheJi');
- case 5:
- return this.$t('meiGong');
- case 6:
- return this.$t('yunYing');
- case 7:
- return this.$t('kanXiaoShuo');
- case 8:
- return this.$t('yingShiYuLe');
- case 9:
- return this.$t('tingYinLe');
- default:
- return this.$t('weiZhi');
- }
- },
- getSrcList(index) {
- return this.srcList.slice(index).concat(this.srcList.slice(0, index));
- },
- },
- created() {
- let height = window.innerHeight;
- this.tableHeight = height - 195;
- const that = this;
- window.onresize = function temp() {
- that.tableHeight = window.innerHeight - 195;
- };
- },
- mounted() {
- this.getDevianceList();
- }
- };
- </script>
- <style lang="scss" scoped>
- .nowTime {
- height: 35px;
- line-height: 28px;
- font-size: 18px;
- color: #333;
- margin-left: 10px;
- i {
- margin-right: 10px;
- }
- }
- </style>
|