日照项目的居民端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

95 lines
2.6 KiB

"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
Component({
properties: {
title: {
type: String,
value: ''
},
header: {
type: Array,
value: []
},
list: {
type: Array,
value: []
},
isClick: {
type: Boolean,
value: true
},
agencyId: {
type: String,
value: ''
},
gridId: {
type: String,
value: "",
}
},
data: {
width: '100%',
positionHeader: [],
positionData: [],
columnsHeader: [],
tableClass: '',
tableList: []
},
ready: function () {
this.computedWidth();
},
observers: {
'list': function () {
this.concatCell();
}
},
methods: {
computedWidth: function () {
var _a = this.data, header = _a.header, tableClass = _a.tableClass;
var _width = '100%';
if (header.length > 5) {
_width = 100 + (header.length - 5) * 15 + '%';
}
if (header.length === 3) {
tableClass = 'table-short';
}
if (header.length === 4) {
tableClass = 'table-middle';
}
this.setData({
width: _width,
positionHeader: header.slice(0, 2),
columnsHeader: header.slice(1),
tableClass: tableClass
});
},
concatCell: function () {
var list = this.data.list;
console.log('list', list);
list = list.map(function (item) {
return __assign(__assign({}, item), { gridName: item.agencyName + '-' + item.gridName });
});
this.setData({
tableList: list
});
console.log('tablelist', this.data.tableList);
},
handleChange: function (e) {
if (!this.data.isClick)
return false;
var index = e.currentTarget.dataset.index;
this.triggerEvent('change', this.data.list[index]);
}
}
});