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

8
supplier/pages/offer/index.vue

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

Loading…
Cancel
Save