|
@@ -21,7 +21,7 @@
|
|
|
<el-table v-loading="loading" :data="postList" @selection-change="handleSelectionChange">
|
|
|
<el-table-column type="selection" width="55" style="color: red;" align="center" />
|
|
|
<template v-for="(item, index) in tabData">
|
|
|
- <el-table-column :label="item.columnComment" align="center" :prop="item.columnName" :key="index">
|
|
|
+ <el-table-column :width="tabData.length>13?zjFn(item.columnComment)*19:'auto'" :label="item.columnComment" align="center" :prop="item.columnName" :key="index" show-overflow-tooltip>
|
|
|
<template slot-scope="scope">
|
|
|
<img class="img_icon" v-if="item.htmlType=='imageUpload' && scope.row[scope.column.property]" @click="imgBtn(JSON.parse(scope.row[scope.column.property])[0].url)"
|
|
|
:src="JSON.parse(scope.row[scope.column.property])[0].url" alt="">
|
|
@@ -142,7 +142,23 @@
|
|
|
this.init();
|
|
|
this.getList();
|
|
|
},
|
|
|
- methods: {
|
|
|
+ methods: {
|
|
|
+ zjFn(str) {
|
|
|
+ let bytesCount = 0;
|
|
|
+ for (var i = 0; i < str.length; i++)
|
|
|
+ {
|
|
|
+ var c = str.charAt(i);
|
|
|
+ if (/^[\u0000-\u00ff]$/.test(c)) //匹配双字节
|
|
|
+ {
|
|
|
+ bytesCount += 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ bytesCount += 2;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return bytesCount
|
|
|
+ },
|
|
|
imgBtn(url) {
|
|
|
this.pir_imgs = url
|
|
|
this.$refs.BigPicture.hidden.status = true
|
|
@@ -313,7 +329,10 @@
|
|
|
</script>
|
|
|
|
|
|
|
|
|
-<style lang="scss">
|
|
|
+<style lang="scss">
|
|
|
+ .el-table .cell, .el-table th div {
|
|
|
+ padding-right: 0;
|
|
|
+ }
|
|
|
.img_icon {
|
|
|
width: 120px;
|
|
|
height: 120px;
|