Enzo 5 years ago
parent
commit
572eaf8cf8
  1. 63
      supplier/components/wyb-table/wyb-table.vue
  2. 8
      supplier/pages/offer/index.vue

63
supplier/components/wyb-table/wyb-table.vue

@ -1,5 +1,6 @@
<template>
<view class="wyb-table-box">
<!-- loading加载框 -->
<view v-if="loading" class="wyb-table-loading-box" :style="{
'max-width': width === 'auto' ? screenWidth : width,
'max-height': height === 'auto' ? '300rpx' : height,
@ -16,6 +17,7 @@
borderBottom: '3px solid ' + loadingColor.bottom,
borderLeft: '3px solid ' + loadingColor.left}" />
</view>
<!-- table主体 -->
<view v-if="!loading" class="wyb-table-scroll-view" :style="{
'max-width': width,
'max-height': height}">
@ -206,6 +208,7 @@
<script>
import Pinyin from './js/characterToPinyin.js'
import {isEqual} from './js/objEqual.js'
let timer = null;
export default {
data() {
return {
@ -229,6 +232,7 @@
}
},
computed: {
//
loadingColor() {
let color = this.loaderColor.slice()
let rgbList = this.hexToRgb(color)
@ -243,16 +247,19 @@
left
}
},
// contentkey
contentLineKey() {
return function(content, cIndex) {
return this.randomString(32, this.chars)
}
},
// key
contentItemKey() {
return function(header, hIndex) {
return this.randomString(16, this.chars)
}
},
//
autoContentItem() {
return function(cIndex, hIndex) {
let content = this.contentsSort[cIndex]
@ -318,6 +325,7 @@
return result
}
},
// 线
autoTextDecoration() {
return function(cIndex, hIndex) {
let result = 'auto'
@ -337,6 +345,7 @@
return result
}
},
//
autoContentBgColor() {
return function(cIndex, hIndex) {
let result = this.contentBgColor
@ -413,6 +422,7 @@
}
}
},
//
autoContentColor() {
return function(cIndex, hIndex) {
let result = this.contentFtColor
@ -490,6 +500,7 @@
return result
}
},
//
autoSortShow() {
return function(hIndex) {
let result = false
@ -512,6 +523,7 @@
return result
}
},
//
screenWidth() {
return `${uni.getSystemInfoSync()['screenWidth']}px`
}
@ -731,6 +743,10 @@
checkerCellBgColor: {
type: String,
default: '#f1f1f1'
},
scrollToInput: {
type: Boolean, // input
default: true
}
},
watch: {
@ -754,27 +770,40 @@
this.$set(item, 'checked', false)
})
this.oContentsSort = this.contentsSort.slice()
console.log("this.sortCol", this.sortCol);
if (this.sortCol.length !== 0) {
this.sortActiveKey = this.sortCol[0].key
uni.setStorageSync('lastSortActiveKey', this.sortActiveKey)
this.doSort(this.sortCol[0].key, this.sortWays[this.sortWay], this.sortCol[0].isNumber)
}
this.autoScrollView();
},
methods: {
//
// toArray(val){
// if(Array.isArray(val)){
// console.log("ssssss=======")
// return val.slice();
// }else{
// let contents = {...val};
// let arr = [];
// for(let i in contents){
// arr.push(contents[i]);
// }
// return arr;
// }
// },
// input
autoScrollView(){
try{
// #ifdef H5
if(this.$props.scrollToInput){
setTimeout(function(){
// dom .wyb-table-scroll-view .wyb-table-content .wyb-table-content-line .wyb-table-content-item input
let tabView = document.querySelector('.wyb-table-scroll-view'); // table
let tabContent = tabView.querySelector('.wyb-table-content'); // tablecontent
let contentLine = tabContent.querySelector('.wyb-table-content-line'); //
let contentItem = contentLine.querySelector('.wyb-table-content-item input'); //
let offsetLeft = contentItem.offsetParent.offsetLeft - 90;
timer = setInterval(function(){
tabView.scrollLeft += 10;
if(tabView.scrollLeft >= offsetLeft){
clearInterval(timer);
}
}, 10);
}, 1000)
}
// #endif
}catch(e){
console.log(e);
}
},
inputBlur(cIndex, hIndex, event){
let event_obj = {};
let value = event.detail.value;
@ -1127,6 +1156,12 @@
for (var i = length; i > 0; --i) result += chars[Math.floor(Math.random() * chars.length)]
return result
}
},
destroyed(){
if(timer){
clearInterval(timer);
timer = null;
}
}
}
</script>

8
supplier/pages/offer/index.vue

@ -48,6 +48,8 @@
contentBgColor="#eef6fe"
:headers="headers"
:contents="contents"
:scrollToInput="true"
:loading="table_loading"
@onInputChange="onInputChange"
@onButtonClick="onButtonClick"
width="100%" height="80vh"></wyb-table>
@ -112,7 +114,8 @@
code: '', //
type: 0,
deadline_start: '',
deadline_end: ''
deadline_end: '',
table_loading: true
}
},
computed: {
@ -201,6 +204,7 @@
}
})
this.contents = contents;
this.table_loading = false;
this.getCanteenList();
})
},
@ -235,6 +239,7 @@
return obj;
})
this.contents = contents;
this.table_loading = false;
//
let deadline_start = '';
let deadline_end = '';
@ -276,6 +281,7 @@
}
})
this.contents = contents;
this.table_loading = false;
//
let deadline_start = '';
let deadline_end = '';

Loading…
Cancel
Save