| | |
| | | <el-table |
| | | ref="multipleTable" |
| | | v-loading="tableLoading" |
| | | element-loading-text="加载中..." |
| | | element-loading-spinner="el-icon-loading" |
| | | :border="border" |
| | | :data="tableData" |
| | | :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" |
| | |
| | | " |
| | | :sortable="item.sortable ? true : false" |
| | | :type="item.type" |
| | | :width=" |
| | | item.dataType === 'action' ? getWidth(item.operation) : item.width |
| | | " |
| | | align="center" |
| | | :width="item.dataType == 'action' ? btnWidth : item.width" |
| | | > |
| | | <!-- <div class="123" v-if="item.type == ''"> --> |
| | | <template |
| | |
| | | </div> |
| | | |
| | | <!-- 按钮 --> |
| | | <div v-else-if="item.dataType == 'action'"> |
| | | <div |
| | | v-else-if="item.dataType == 'action'" |
| | | :style="`width:${getWidth(item.operation, scope.row)}`" |
| | | > |
| | | <template v-for="(o, key) in item.operation"> |
| | | <el-button |
| | | v-show="o.type != 'upload'" |
| | |
| | | {{ o.name }} |
| | | </el-button> |
| | | <el-upload |
| | | :action=" |
| | | javaApi + |
| | | o.url |
| | | " |
| | | :action="javaApi + o.url" |
| | | size="mini" |
| | | ref="upload" |
| | | :multiple="o.multiple ? o.multiple : false" |
| | |
| | | " |
| | | v-if="o.type == 'upload' && o.url" |
| | | style="display: inline-block; width: 50px" |
| | | v-show="o.showHide ? o.showHide(scope.row) : true" |
| | | :data="o.data ? o.data(scope.row) : {}" |
| | | :before-upload="o.beforeUpload ? o.beforeUpload(scope.row) : () => true" |
| | | :before-upload=" |
| | | o.beforeUpload ? o.beforeUpload(scope.row) : () => true |
| | | " |
| | | v-show="o.showHide ? o.showHide(scope.row) : true" |
| | | :headers="uploadHeader" |
| | | :on-error="onError" |
| | | :on-exceed="onExceed" |
| | |
| | | props: { |
| | | isSelection: { |
| | | type: Boolean, |
| | | default: false, |
| | | default: undefined, |
| | | }, |
| | | height: { |
| | | type: String, |
| | |
| | | }, |
| | | rowKey: { |
| | | type: String, |
| | | default: undefined, |
| | | default: "id", |
| | | }, |
| | | page: { |
| | | type: Object, |
| | |
| | | data() { |
| | | return { |
| | | spanList: [], |
| | | btnWidth: "120px", |
| | | }; |
| | | }, |
| | | watch: { |
| | | // column(val) { |
| | | // this.doLayout(); |
| | | // }, |
| | | }, |
| | | updated() { |
| | | this.$nextTick(() => { |
| | | this.$refs.multipleTable.doLayout(); |
| | | }); |
| | | }, |
| | | mounted() { |
| | | this.calculateSpanInfo(); |
| | | }, |
| | | methods: { |
| | | getWidth(row) { |
| | | doLayout() { |
| | | this.$nextTick(() => { |
| | | this.$refs.multipleTable && this.$refs.multipleTable.doLayout(); |
| | | }); |
| | | }, |
| | | getWidth(row, row0) { |
| | | let count = 0; |
| | | row.forEach((a) => { |
| | | if (a.showHide !== undefined && a.showHide()) { |
| | | if (a.showHide !== undefined && a.showHide(row0)) { |
| | | count += a.name.length; |
| | | } else if (!a.showHide) { |
| | | count += a.name.length; |
| | | } |
| | | }); |
| | | this.btnWidth = count * 15 + 70 + "px"; |
| | | return count * 15 + 70 + "px"; |
| | | }, |
| | | iconFn(row) { |
| | |
| | | if (!linkEvent) { |
| | | return this.$message.warning("请配置lingk事件"); |
| | | } |
| | | console.log(linkEvent); |
| | | linkEvent.vueComponent[linkEvent.method](row); |
| | | }, |
| | | // 合并单元格 |
| | |
| | | } |
| | | |
| | | >>> .el-table__body-wrapper::-webkit-scrollbar { |
| | | height: 14px; |
| | | height: 6px; |
| | | /* 设置滚动条宽度 */ |
| | | } |
| | | </style> |