Commit bd56efbc by 姜雷

添加设备运营

parent eaabc2d1
...@@ -66,5 +66,8 @@ exports.baseFetch = function (req) { ...@@ -66,5 +66,8 @@ exports.baseFetch = function (req) {
exports.operatorFetch = function (req) { exports.operatorFetch = function (req) {
return fetch(__assign({}, req, { url: constants_1.devUrl.OPERATOR_SERVER_URL + req.url })); return fetch(__assign({}, req, { url: constants_1.devUrl.OPERATOR_SERVER_URL + req.url }));
}; };
exports.deviceFetch = function (req) {
return fetch(__assign({}, req, { url: constants_1.devUrl.DEVICE_SERVEL_URL + req.url }));
};
exports.default = fetch; exports.default = fetch;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmV0Y2guanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJmZXRjaC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsaURBQXFFO0FBRXJFLElBQU0sR0FBRyxHQUFHLE1BQU0sRUFBVSxDQUFDO0FBRTdCLElBQU0sS0FBSyxHQUFHLFVBQUMsR0FBcUI7SUFDbEMsT0FBQSxJQUFJLE9BQU8sQ0FBQyxVQUFDLE9BQU8sRUFBRSxNQUFNO1FBQzFCLElBQU0sS0FBSyxHQUFHLEdBQUcsQ0FBQyxVQUFVLENBQUMsS0FBSyxDQUFDO1FBQ25DLEVBQUUsQ0FBQyxPQUFPLGNBQ0wsR0FBRyxJQUNOLE1BQU0sRUFBRSxLQUFLO2dCQUNYLENBQUMsWUFDRyxLQUFLLE9BQUEsSUFDRixHQUFHLENBQUMsTUFBTSxFQUVqQixDQUFDLENBQUMsR0FBRyxDQUFDLE1BQU0sRUFFZCxPQUFPLEVBQUUsT0FBTyxFQUNoQixJQUFJLEVBQUUsTUFBTSxJQUNaLENBQUM7SUFDTCxDQUFDLENBQUMsQ0FBQyxJQUFJLENBQUMsVUFBQyxHQUFvQztRQUMzQyxJQUFNLGFBQWlDLEVBQS9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ByZWplY3QpID0+IHtcbiAgICBjb25zdCB0b2tlbiA9IGFwcC5nbG9iYWxEYXRhLnRva2VuO1xuICAgIHd4LnJlcXVlc3Qoe1xuICAgICAgLi4ucmVxLFxuICAgICAgaGVhZGVyOiB0b2tlblxuICAgICAgICA/IHtcbiAgICAgICAgICAgIHRva2VuLFxuICAgICAgICAgICAgLi4ucmVxLmhlYWRlcixcbiAgICAgICAgICB9XG4gICAgICAgIDogcmVxLmhlYWRlcixcblxuICAgICAgc3VjY2VzczogcmVzb2x2ZSxcbiAgICAgIGZhaWw6IHJlamVjdCxcbiAgICB9KTtcbiAgfSkudGhlbigocmVzOiB3eC5SZXF1ZXN0U3VjY2Vzc0NhbGxiYWNrUmVzdWx0KSA9PiB7XG4gICAgY29uc3QgeyBjb2RlLCAuLi5vdGhlcmtleXMgfSA9IHJlcy5kYXRhO1xuICAgIGlmIChjb2RlID09PSBzdWNjZXNzQ29kZSkge1xuICAgICAgY29uc29sZS5sb2cocmVzKTtcbiAgICAgIGlmIChyZXMuaGVhZGVyWydTZXQtQ29va2llJ10pXG4gICAgICAgIHJldHVybiB7XG4gICAgICAgICAgaGVhZGVyOiByZXMuaGVhZGVyLFxuICAgICAgICAgIGRhdGE6IG90aGVya2V5cyxcbiAgICAgICAgfTtcbiAgICAgIHJldHVybiBvdGhlcmtleXM7XG4gICAgfSBlbHNlIGlmIChjb2RlID09PSBsb2dvdXRvZGUpIHtcbiAgICAgIGFwcC5yZXNldFVzZXJpbmZvKCk7XG4gICAgICB3eC5yZUxhdW5jaCh7XG4gICAgICAgIHVybDogJy9wYWdlcy9pbmRleC9pbmRleCcsXG4gICAgICB9KTtcbiAgICAgIHRocm93IHtcbiAgICAgICAgZXJyTXNnOiByZXMuZGF0YS5tc2cgfHwgJ+e9kee7nOW8guW4uCcsXG4gICAgICB9O1xuICAgIH0gZWxzZSB7XG4gICAgICB0aHJvdyB7XG4gICAgICAgIGVyck1zZzogcmVzLmRhdGEubXNnIHx8ICfnvZHnu5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4uLnJlcSwgdXJsOiBkZXZVcmwuU1RBVElTVElDU19TRVJWRVJfVVJMICsgcmVxLnVybCB9KTtcbmV4cG9ydCBjb25zdCBjdXN0b21lckZldGNoID0gKHJlcTogd3guUmVxdWVzdE9wdGlvbikgPT5cbiAgZmV0Y2goeyAuLi5yZXEsIHVybDogZGV2VXJsLkNVU1RPTUVSX1NFUlZFUl9VUkwgKyByZXEudXJsIH0pO1xuZXhwb3J0IGNvbnN0IGJhc2VGZXRjaCA9IChyZXE6IHd4LlJlcXVlc3RPcHRpb24pID0+XG4gIGZldGNoKHsgLi4ucmVxLCB1cmw6IGRldlVybC5CQVNFX1NFUlZFUl9VUkwgKyByZXEudXJsIH0pO1xuZXhwb3J0IGNvbnN0IG9wZXJhdG9yRmV0Y2ggPSAocmVxOiB3eC5SZXF1ZXN0T3B0aW9uKSA9PlxuICBmZXRjaCh7IC4uLnJlcSwgdXJsOiBkZXZVcmwuT1BFUkFUT1JfU0VSVkVSX1VSTCArIHJlcS51cmwgfSk7XG5leHBvcnQgY29uc3QgZGV2aWNlRmV0Y2ggPSAocmVxOiB3eC5SZXF1ZXN0T3B0aW9uKSA9PlxuICBmZXRjaCh7IC4uLnJlcSwgdXJsOiBkZXZVcmwuREVWSUNFX1NFUlZFTF9VUkwgKyByZXEudXJsIH0pO1xuZXhwb3J0IGRlZmF1bHQgZmV0Y2g7XG4iXX0=
\ No newline at end of file \ No newline at end of file
...@@ -52,5 +52,6 @@ export const baseFetch = (req: wx.RequestOption) => ...@@ -52,5 +52,6 @@ export const baseFetch = (req: wx.RequestOption) =>
fetch({ ...req, url: devUrl.BASE_SERVER_URL + req.url }); fetch({ ...req, url: devUrl.BASE_SERVER_URL + req.url });
export const operatorFetch = (req: wx.RequestOption) => export const operatorFetch = (req: wx.RequestOption) =>
fetch({ ...req, url: devUrl.OPERATOR_SERVER_URL + req.url }); fetch({ ...req, url: devUrl.OPERATOR_SERVER_URL + req.url });
export const deviceFetch = (req: wx.RequestOption) =>
fetch({ ...req, url: devUrl.DEVICE_SERVEL_URL + req.url });
export default fetch; export default fetch;
...@@ -9,7 +9,9 @@ ...@@ -9,7 +9,9 @@
"pages/userGrowth/userGrowth", "pages/userGrowth/userGrowth",
"pages/areaSelect/areaSelect", "pages/areaSelect/areaSelect",
"pages/platformFee/platformFee", "pages/platformFee/platformFee",
"pages/platformFeeRecord/platformFeeRecord" "pages/platformFeeRecord/platformFeeRecord",
"pages/equipment/equipment",
"pages/equipmentReport/equipmentReport"
], ],
"window": { "window": {
"backgroundTextStyle": "light", "backgroundTextStyle": "light",
......
...@@ -6,6 +6,7 @@ exports.devUrl = { ...@@ -6,6 +6,7 @@ exports.devUrl = {
CUSTOMER_SERVER_URL: 'https://ex-dev-customer-manage.168cad.top', CUSTOMER_SERVER_URL: 'https://ex-dev-customer-manage.168cad.top',
BASE_SERVER_URL: 'https://ex-dev-dcxy-base-manage.168cad.top', BASE_SERVER_URL: 'https://ex-dev-dcxy-base-manage.168cad.top',
OPERATOR_SERVER_URL: 'https://dev-op-man-serv.168cad.top', OPERATOR_SERVER_URL: 'https://dev-op-man-serv.168cad.top',
DEVICE_SERVEL_URL: 'https://in-dev-device-management-api.168cad.top',
}; };
exports.testUrl = { exports.testUrl = {
SYSTEM_SERVER_URL: 'https://ex-test-dcxy-system-manage.168cad.top', SYSTEM_SERVER_URL: 'https://ex-test-dcxy-system-manage.168cad.top',
...@@ -13,6 +14,7 @@ exports.testUrl = { ...@@ -13,6 +14,7 @@ exports.testUrl = {
CUSTOMER_SERVER_URL: 'https://ex-test-customer-manage.168cad.top', CUSTOMER_SERVER_URL: 'https://ex-test-customer-manage.168cad.top',
BASE_SERVER_URL: 'https://ex-test-dcxy-base-manage.168cad.top', BASE_SERVER_URL: 'https://ex-test-dcxy-base-manage.168cad.top',
OPERATOR_SERVER_URL: 'https://test-op-man-serv.168cad.top', OPERATOR_SERVER_URL: 'https://test-op-man-serv.168cad.top',
DEVICE_SERVEL_URL: 'https://in-test-device-management-api.168cad.top',
}; };
exports.masterUrl = { exports.masterUrl = {
SYSTEM_SERVER_URL: 'https://dcxy-system-manage.dcrym.com', SYSTEM_SERVER_URL: 'https://dcxy-system-manage.dcrym.com',
...@@ -23,4 +25,4 @@ exports.masterUrl = { ...@@ -23,4 +25,4 @@ exports.masterUrl = {
}; };
exports.successCode = 1000; exports.successCode = 1000;
exports.logoutode = -2; exports.logoutode = -2;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY29uc3RhbnRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQWEsUUFBQSxNQUFNLEdBQUc7SUFDcEIsaUJBQWlCLEVBQUUsOENBQThDO0lBQ2pFLHFCQUFxQixFQUFFLGtEQUFrRDtJQUN6RSxtQkFBbUIsRUFBRSwyQ0FBMkM7SUFDaEUsZUFBZSxFQUFFLDRDQUE0QztJQUM3RCxtQkFBbUIsRUFBRSxvQ0FBb0M7Q0FDMUQsQ0FBQztBQUNXLFFBQUEsT0FBTyxHQUFHO0lBQ3JCLGlCQUFpQixFQUFFLCtDQUErQztJQUNsRSxxQkFBcUIsRUFBRSxtREFBbUQ7SUFDMUUsbUJBQW1CLEVBQUUsNENBQTRDO0lBQ2pFLGVBQWUsRUFBRSw2Q0FBNkM7SUFDOUQsbUJBQW1CLEVBQUUscUNBQXFDO0NBQzNELENBQUM7QUFDVyxRQUFBLFNBQVMsR0FBRztJQUN2QixpQkFBaUIsRUFBRSxzQ0FBc0M7SUFDekQscUJBQXFCLEVBQUUsMENBQTBDO0lBQ2pFLG1CQUFtQixFQUFFLHdDQUF3QztJQUM3RCxlQUFlLEVBQUUsb0NBQW9DO0lBQ3JELG1CQUFtQixFQUFFLCtCQUErQjtDQUNyRCxDQUFDO0FBRVcsUUFBQSxXQUFXLEdBQUcsSUFBSSxDQUFDO0FBQ25CLFFBQUEsU0FBUy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RjcnltLmNvbScsXG59O1xuXG5leHBvcnQgY29uc3Qgc3VjY2Vzc0NvZGUgPSAxMDAwO1xuZXhwb3J0IGNvbnN0IGxvZ291dG9kZSA9IC0yO1xuIl19
\ No newline at end of file \ No newline at end of file
...@@ -4,6 +4,7 @@ export const devUrl = { ...@@ -4,6 +4,7 @@ export const devUrl = {
CUSTOMER_SERVER_URL: 'https://ex-dev-customer-manage.168cad.top', CUSTOMER_SERVER_URL: 'https://ex-dev-customer-manage.168cad.top',
BASE_SERVER_URL: 'https://ex-dev-dcxy-base-manage.168cad.top', BASE_SERVER_URL: 'https://ex-dev-dcxy-base-manage.168cad.top',
OPERATOR_SERVER_URL: 'https://dev-op-man-serv.168cad.top', OPERATOR_SERVER_URL: 'https://dev-op-man-serv.168cad.top',
DEVICE_SERVEL_URL: 'https://in-dev-device-management-api.168cad.top',
}; };
export const testUrl = { export const testUrl = {
SYSTEM_SERVER_URL: 'https://ex-test-dcxy-system-manage.168cad.top', SYSTEM_SERVER_URL: 'https://ex-test-dcxy-system-manage.168cad.top',
...@@ -11,6 +12,7 @@ export const testUrl = { ...@@ -11,6 +12,7 @@ export const testUrl = {
CUSTOMER_SERVER_URL: 'https://ex-test-customer-manage.168cad.top', CUSTOMER_SERVER_URL: 'https://ex-test-customer-manage.168cad.top',
BASE_SERVER_URL: 'https://ex-test-dcxy-base-manage.168cad.top', BASE_SERVER_URL: 'https://ex-test-dcxy-base-manage.168cad.top',
OPERATOR_SERVER_URL: 'https://test-op-man-serv.168cad.top', OPERATOR_SERVER_URL: 'https://test-op-man-serv.168cad.top',
DEVICE_SERVEL_URL: 'https://in-test-device-management-api.168cad.top',
}; };
export const masterUrl = { export const masterUrl = {
SYSTEM_SERVER_URL: 'https://dcxy-system-manage.dcrym.com', SYSTEM_SERVER_URL: 'https://dcxy-system-manage.dcrym.com',
......
"use strict";
var __assign = (this && this.__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;
};
Component({
properties: {
colors: {
type: Array,
value: ['#6895fe'],
},
dataList: {
type: Array,
value: [],
observer: function (newVal) {
var maxnum = Math.ceil(Math.max.apply(Math, newVal.map(function (item) { return item.value; })) / 0.9);
var list = newVal.map(function (item) { return (__assign({}, item, { precent: Math.ceil((item.value / maxnum) * 100) })); });
this.setData({
list: list,
});
},
},
},
data: {
list: [],
},
methods: {},
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRXF1aXBtZW50Q2hhcnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJFcXVpcG1lbnRDaGFydC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFDQSxTQUFTLENBQUM7SUFJUixVQUFVLEVBQUU7UUFDVixNQUFNLEVBQUU7WUFDTixJQUFJLEVBQUUsS0FBSztZQUNYLEtBQUssRUFBRSxDQUFDLFNBQVMsQ0FBQztTQUNuQjtRQUNELFFBQVEsRUFBRTtZQUNSLElBQUksRUFBRSxLQUFLO1lBQ1gsS0FBSyxFQUFFLEVBQUU7WUFDVCxRQUFRLFlBQUMsTUFBTTtnQkFDYixJQUFJLE1BQU0sR0FBRyxJQUFJLENBQUMsSUFBSSxDQUNwQixJQUFJLENBQUMsR0FBRyxPQUFSLElBQUksRUFBUSxNQUFNLENBQUMsR0FBRyxDQUFDLFVBQUEsSUFBSSxJQUFJLE9BQUEsSUFBSSxDQUFDLEtBQUssRUFBVixDQUFVLENBQUMsSUFBSSxHQUFHLENBQ2xELENBQUM7Z0JBQ0YsSUFBSSxJQUFJLEdBQUcsTUFBTSxDQUFDLEdBQUcsQ0FBQyxVQUFBLElBQUksSUFBSSxPQUFBLGNBQ3pCLElBQUksSUFDUCxPQUFPLEVBQUUsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFDLElBQUksQ0FBQyxLQUFLLEdBQU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gIH0sXG5cbiAgLyoqXG4gICAqIOe7hOS7tueahOWIneWni+aVsOaNrlxuICAgKi9cbiAgZGF0YToge1xuICAgIGxpc3Q6IFtdLFxuICB9LFxuXG4gIC8qKlxuICAgKiDnu4Tku7bnmoTmlrnms5XliJfooahcbiAgICovXG4gIG1ldGhvZHM6IHt9LFxufSk7XG4iXX0=
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
// pages/components/EquipmentChart/EquipmentChart.js
Component({
/**
* 组件的属性列表
*/
properties: {
colors: {
type: Array,
value: ['#6895fe'],
},
dataList: {
type: Array,
value: [],
observer(newVal) {
let maxnum = Math.ceil(
Math.max(...newVal.map(item => item.value)) / 0.9,
);
let list = newVal.map(item => ({
...item,
precent: Math.ceil((item.value / maxnum) * 100),
}));
this.setData({
list,
});
},
},
},
/**
* 组件的初始数据
*/
data: {
list: [],
},
/**
* 组件的方法列表
*/
methods: {},
});
<!-- pages/components/EquipmentChart/EquipmentChart.wxml -->
<view class="EquipmentChart">
<view wx:for="{{list}}" wx:key="key" class="EquipmentChart-item">
<view class="EquipmentChart-name">{{item.key}}</view>
<view class="EquipmentChart-precent">
<view class="EquipmentChart-innerprecent" style="width: {{item.precent}}%;background-color: {{index < colors.length - 1 ? colors[index] : colors[index%colors.length]}}"></view>
</view>
<view class="EquipmentChart-count">{{item.value}}台</view>
</view>
</view>
\ No newline at end of file
/* pages/components/EquipmentChart/EquipmentChart.wxss */
.EquipmentChart {
padding-bottom: 20rpx;
}
.EquipmentChart-item {
display: flex;
align-items: center;
padding-bottom: 20rpx;
}
.EquipmentChart-name {
margin-right: 20rpx;
}
.EquipmentChart-precent,
.EquipmentChart-innerprecent {
width: 460rpx;
height: 12rpx;
border-radius: 12rpx;
}
.EquipmentChart-precent {
background-color: #f2f2f2;
}
.EquipmentChart-innerprecent {
width: 0;
background-color: #6f96f6;
}
.EquipmentChart-count {
flex: 1;
text-align: right;
}
"use strict";
var __assign = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
var fetch_1 = require("../../../api/fetch");
Component({
lifetimes: {
attached: function () {
this.fetchData();
this.refreshList();
},
},
properties: {
totalAmount: {
type: Array,
value: [],
observer: function (newVal) {
console.log('totalAmount', newVal);
},
},
},
data: {
sortTypeOptions: [
{ value: 'desc', label: '降序' },
{ value: 'asc', label: '升序' },
],
sortTypeIndex: '0',
sortType: 'desc',
timeType: 0,
comsumerData: {
title: '消费总额',
numberType: 'price',
count: 0,
},
countData: {
title: '消费笔数',
numberType: 'count',
count: 0,
},
pageNum: 1,
pageSize: 10,
dataList: [],
deviceType: 2,
},
methods: {
changeType: function (e) {
console.log(e);
var timetype = e.currentTarget.dataset.timetype;
if (timetype === this.data.timeType)
return;
this.setData({
timeType: timetype,
});
this.fetchData();
this.refreshList();
},
fetchData: function () {
var _this = this;
fetch_1.statisticsFetch({
url: '/boss/device/operation/data/summary',
method: 'POST',
data: {
areaId: this.data.areaId,
timeType: this.data.timeType,
},
})
.then(function (res) {
console.log(res);
var _a = res.data, totalConsumeAmount = _a.totalConsumeAmount, totalConsumeCount = _a.totalConsumeCount;
_this.setData({
'comsumerData.count': totalConsumeAmount,
'countData.count': totalConsumeCount,
});
})
.catch(function (err) {
console.log(err);
});
},
fetchList: function (entity) {
return fetch_1.statisticsFetch({
url: '/boss/device/operation/data/detail/paging',
method: 'POST',
data: __assign({ areaId: this.data.areaId, timeType: this.data.timeType, sortType: this.data.sortType, deviceType: this.data.deviceType, pageNum: this.data.pageNum, pageSize: this.data.pageSize }, entity),
});
},
refreshList: function () {
var _this = this;
this.fetchList({
pageNum: 1,
})
.then(function (res) {
var list = res.data.list;
_this.setData({
pageNum: 1,
dataList: list,
});
})
.catch(function (err) {
console.log(err);
});
},
getMoreListItem: function () {
var _this = this;
this.fetchList({
pageNum: this.data.pageNum + 1,
})
.then(function (res) {
var list = res.data.list;
if (list && list.length) {
_this.setData({
dataList: _this.data.dataList.concat(list),
pageNum: _this.data.pageNum + 1,
});
}
})
.catch(function (err) {
console.log(err);
});
},
changeSortType: function (e) {
var value = e.detail.value;
var item = this.data.sortTypeOptions[value];
console.log(item);
this.setData({
sortTypeIndex: value,
sortType: item.label,
});
this.refreshList();
},
changeDeviceType: function (e) {
console.log(e);
var devicetype = e.currentTarget.dataset.devicetype;
if (devicetype === this.data.deviceType)
return;
this.setData({
deviceType: devicetype,
});
this.refreshList();
},
},
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRXF1aXBtZW50T3BlcmF0aW9uRGV0YWlscy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIkVxdWlwbWVudE9wZXJhdGlvbkRldGFpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQUFBLDRDQUFxRDtBQUdyRCxTQUFTLENBQUM7SUFDUixTQUFTLEVBQUU7UUFDVCxRQUFRO1lBQ04sSUFBSSxDQUFDLFNBQVMsRUFBRSxDQUFDO1lBQ2pCLElBQUksQ0FBQyxXQUFXLEVBQUUsQ0FBQztRQUNyQixDQUFDO0tBQ0Y7SUFJRCxVQUFVLEVBQUU7UUFDVixXQUFXLEVBQUU7WUFDWCxJQUFJLEVBQUUsS0FBSztZQUNYLEtBQUssRUFBRSxFQUFFO1lBQ1QsUUFBUSxZQUFDLE1BQU07Z0JBQ2IsT0FBTyxDQUFDLEdBQUcsQ0FBQyxhQUFhLEVBQUUsTUFBTSxDQUFDLENBQUM7WUFDckMsQ0FBQztTQUNGO0tBQ0Y7SUFLRCxJQUFJLEVBQUU7UUFDSixlQUFlLEVBQUU7WUFDZixFQUFFLEtBQUssRUFBRSxNQUFNLEVBQUUsS0FBSyxFQUFFLElBQUksRUFBRTtZQUM5QixFQUFFLEtBQUssRUFBRSxLQU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bENvbnN1bWVDb3VudCxcbiAgICAgICAgICB9KTtcbiAgICAgICAgfSlcbiAgICAgICAgLmNhdGNoKGVyciA9PiB7XG4gICAgICAgICAgY29uc29sZS5sb2coZXJyKTtcbiAgICAgICAgfSk7XG4gICAgfSxcbiAgICBmZXRjaExpc3QoZW50aXR5KSB7XG4gICAgICByZXR1cm4gc3RhdGlzdGljc0ZldGNoKHtcbiAgICAgICAgdXJsOiAnL2Jvc3MvZGV2aWNlL29wZXJhdGlvbi9kYXRhL2RldGFpbC9wYWdpbmcnLFxuICAgICAgICBtZXRob2Q6ICdQT1NUJyxcbiAgICAgICAgZGF0YToge1xuICAgICAgICAgIGFyZWFJZDogdGhpcy5kYXRhLmFyZWFJZCxcbiAgICAgICAgICB0aW1lVHlwZTogdGhpcy5kYXRhLnRpbWVUeXBlLFxuICAgICAgICAgIHNvcnRUeXBlOiB0aGlzLmRhdGEuc29ydFR5cGUsXG4gICAgICAgICAgZGV2aWNlVHlwZTogdGhpcy5kYXRhLmRldmljZVR5cGUsXG4gICAgICAgICAgcGFnZU51bTogdGhpcy5kYXRhLnBhZ2VOdW0sXG4gICAgICAgICAgcGFnZVNpemU6IHRoaXMuZGF0YS5wYWdlU2l6ZSxcbiAgICAgICAgICAuLi5lbnRpdHksXG4gICAgICAgIH0sXG4gICAgICB9KTtcbiAgICB9LFxuICAgIHJlZnJlc2hMaXN0KCkge1xuICAgICAgdGhpcy5mZXRjaExpc3Qoe1xuICAgICAgICBwYWdlTnVtOiAxLFxuICAgICAgfSlcbiAgICAgICAgLnRoZW4ocmVzID0+IHtcbiAgICAgICAgICBjb25zdCB7IGxpc3QgfSA9IHJlcy5kYXRhO1xuICAgICAgICAgIHRoaXMuc2V0RGF0YSh7XG4gICAgICAgICAgICBwYWdlTnVtOiAxLFxuICAgICAgICAgICAgZGF0YUxpc3Q6IGxpc3QsXG4gICAgICAgICAgfSk7XG4gICAgICAgIH0pXG4gICAgICAgIC5jYXRjaChlcnIgPT4ge1xuICAgIC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lwZSB9ID0gZS5jdXJyZW50VGFyZ2V0LmRhdGFzZXQ7XG4gICAgICBpZiAoZGV2aWNldHlwZSA9PT0gdGhpcy5kYXRhLmRldmljZVR5cGUpIHJldHVybjtcbiAgICAgIHRoaXMuc2V0RGF0YSh7XG4gICAgICAgIGRldmljZVR5cGU6IGRldmljZXR5cGUsXG4gICAgICB9KTtcbiAgICAgIHRoaXMucmVmcmVzaExpc3QoKTtcbiAgICB9LFxuICB9LFxufSk7XG4iXX0=
\ No newline at end of file
{
"component": true,
"usingComponents": {
"c-select": "../Select/Select",
"price-and-count": "../components/PriceAndCount/PriceAndCount"
}
}
import { statisticsFetch } from '../../../api/fetch';
// pages/components/EquipmentOperationDetails/EquipmentOperationDetails.js
Component({
lifetimes: {
attached() {
this.fetchData();
this.refreshList();
},
},
/**
* 组件的属性列表
*/
properties: {
totalAmount: {
type: Array,
value: [],
observer(newVal) {
console.log('totalAmount', newVal);
},
},
},
/**
* 组件的初始数据
*/
data: {
sortTypeOptions: [
{ value: 'desc', label: '降序' },
{ value: 'asc', label: '升序' },
],
sortTypeIndex: '0',
sortType: 'desc',
timeType: 0,
comsumerData: {
title: '消费总额',
numberType: 'price',
count: 0,
},
countData: {
title: '消费笔数',
numberType: 'count',
count: 0,
},
pageNum: 1,
pageSize: 10,
dataList: [],
deviceType: 2, // (2:洗衣,3:饮水,4:吹风,5:洗浴)
},
/**
* 组件的方法列表
*/
methods: {
changeType(e) {
console.log(e);
const { timetype } = e.currentTarget.dataset;
if (timetype === this.data.timeType) return;
this.setData({
timeType: timetype,
});
this.fetchData();
this.refreshList();
},
fetchData() {
statisticsFetch({
url: '/boss/device/operation/data/summary',
method: 'POST',
data: {
areaId: this.data.areaId,
timeType: this.data.timeType,
},
})
.then(res => {
console.log(res);
const { totalConsumeAmount, totalConsumeCount } = res.data;
this.setData({
'comsumerData.count': totalConsumeAmount,
'countData.count': totalConsumeCount,
});
})
.catch(err => {
console.log(err);
});
},
fetchList(entity) {
return statisticsFetch({
url: '/boss/device/operation/data/detail/paging',
method: 'POST',
data: {
areaId: this.data.areaId,
timeType: this.data.timeType,
sortType: this.data.sortType,
deviceType: this.data.deviceType,
pageNum: this.data.pageNum,
pageSize: this.data.pageSize,
...entity,
},
});
},
refreshList() {
this.fetchList({
pageNum: 1,
})
.then(res => {
const { list } = res.data;
this.setData({
pageNum: 1,
dataList: list,
});
})
.catch(err => {
console.log(err);
});
},
getMoreListItem() {
this.fetchList({
pageNum: this.data.pageNum + 1,
})
.then(res => {
const { list } = res.data;
if (list && list.length) {
this.setData!({
dataList: [...this.data.dataList, ...list],
pageNum: this.data.pageNum + 1,
});
}
})
.catch(err => {
console.log(err);
});
},
changeSortType(e) {
const { value } = e.detail;
let item = this.data.sortTypeOptions[value];
console.log(item);
this.setData({
sortTypeIndex: value,
sortType: item.label,
});
this.refreshList();
},
changeDeviceType(e) {
console.log(e);
const { devicetype } = e.currentTarget.dataset;
if (devicetype === this.data.deviceType) return;
this.setData({
deviceType: devicetype,
});
this.refreshList();
},
},
});
<!-- pages/components/EquipmentOperationDetails/EquipmentOperationDetails.wxml -->
<view class="EquipmentOperationDetails">
<view class="EOperationDetails-filters">
<view class="EOperationDetails-filters-tiem">
<view class="EOperationDetails-filters-tiemItem {{timeType === 0?'checked':''}}" data-timetype="{{0}}" bind:tap="changeType">
本日
</view>
<view class="EOperationDetails-filters-tiemItem {{timeType === 1?'checked':''}}" data-timetype="{{1}}" bind:tap="changeType">
近七天
</view>
</view>
<view class="EOperationDetails-filters-type">
<c-select ex-class="EOperationDetails-filters-typeInput" mode="selector" value="{{sortTypeIndex}}" range="{{sortTypeOptions}}" rangeKey="label" bindchange="changeSortType" />
</view>
</view>
<view class="EOperationDetails-sumOrder">
<price-and-count tag-data="{{comsumerData}}" />
<price-and-count tag-data="{{countData}}" />
</view>
<view class="EOperationDetails-statebar">
<view wx:for="{{totalAmount}}" wx:key="key" class="EOperationDetails-statebarItem {{deviceType === item.type ? 'checked' : ''}}" data-devicetype="{{item.type}}" bind:tap="changeDeviceType">
<view class="EOperationDetails-statebarItem-name">{{item.key}}</view>
<view class="EOperationDetails-statebarItem-count">{{item.value}}台</view>
</view>
</view>
<view class="EOperationDetails-elist">
<scroll-view wx:if="{{dataList.length}}" class="EOperationDetails-list" scroll-y bindscrolltolower="getMoreListItem">
<view wx:for="{{dataList}}" class="EOperationDetails-elist-Item">
<view class="EOperationDetails-elist-ItemCode">{{item.deviceCode}}</view>
<view class="EOperationDetails-elist-ItemLocation">{{item.devicePos}}</view>
<view class="EOperationDetails-elist-ItemPrice">{{item.consumeAmount}}元</view>
</view>
</scroll-view>
</view>
</view>
\ No newline at end of file
/* pages/components/EquipmentOperationDetails/EquipmentOperationDetails.wxss */
.EquipmentOperationDetails {
display: flex;
flex-direction: column;
height: 100%;
}
.EOperationDetails-filters {
display: flex;
padding: 40rpx 0;
justify-content: space-between;
}
.EOperationDetails-filters-tiem {
display: flex;
justify-content: space-around;
align-items: center;
width: 328rpx;
height: 80rpx;
background-color: #ededed;
border-radius: 20rpx;
}
.EOperationDetails-filters-tiemItem {
width: 136rpx;
height: 60rpx;
line-height: 60rpx;
text-align: center;
font-size: 28rpx;
color: #666;
}
.EOperationDetails-filters-tiemItem.checked {
border-radius: 20rpx;
background-color: #fff;
color: #6a92ff;
}
.EOperationDetails-filters-type {
width: 194rpx;
}
.EOperationDetails-filters-typeInput {
height: 80rpx;
line-height: 80rpx;
border-radius: 20rpx;
background-color: #ededed;
}
.EOperationDetails-filters-typeInput .select-icon {
right: 20rpx;
top: 10rpx;
}
.EOperationDetails-sumOrder {
display: flex;
padding-bottom: 40rpx;
}
.EOperationDetails-statebar {
display: flex;
}
.EOperationDetails-statebarItem {
align-items: center;
width: 168rpx;
height: 128rpx;
text-align: center;
font-size: 28rpx;
color: #666;
border: 1px solid #eee;
border-right-width: 0;
}
.EOperationDetails-statebarItem:last-child {
border-right-width: 1px;
}
.EOperationDetails-statebarItem.checked {
background-color: #7094f7;
color: #fff;
}
.EOperationDetails-statebarItem-name {
margin: 24rpx 0 10rpx;
}
.EOperationDetails-statebarItem-count {
width: 100%;
font-size: 24rpx;
}
.EOperationDetails-elist {
flex: 1;
overflow: hidden;
}
.EOperationDetails-elist-Item {
display: flex;
height: 100rpx;
line-height: 100rpx;
font-size: 28rpx;
color: #333;
border-bottom: 1px solid #f0f0f0;
}
.EOperationDetails-elist-ItemLocation {
margin-left: 20rpx;
flex: 1;
}
.EOperationDetails-list {
height: 100%;
}
"use strict";
var __assign = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
var fetch_1 = require("../../../api/fetch");
Component({
lifetimes: {
attached: function () { },
},
properties: {
areaId: {
type: Number,
value: 0,
observer: function (newVal) {
this.fetchAll();
},
},
},
data: {
status: 'enable',
tabs: [],
pagination: {
enable: {
pageNum: 1,
pageSize: 10,
},
forbidden: {
pageNum: 1,
pageSize: 10,
},
online: {
pageNum: 1,
pageSize: 10,
},
offline: {
pageNum: 1,
pageSize: 10,
},
},
dataList: {
enable: [],
forbidden: [],
online: [],
offline: [],
},
},
methods: {
fetchAll: function () {
this.fetchData();
this.refreshList();
},
fetchData: function () {
var _this = this;
fetch_1.deviceFetch({
url: "/device/report/deviceStautsCount/" + this.data.areaId,
})
.then(function (res) {
console.log(res);
var list = res.data.map(function (item) {
var label = '';
switch (item.status) {
case 'enable':
label = '启用设备';
break;
case 'forbidden':
label = '禁用设备';
break;
case 'online':
label = '在线设备';
break;
case 'offline':
label = '离线设备';
break;
default:
break;
}
return __assign({}, item, { label: label });
});
_this.setData({
tabs: list,
});
})
.catch(function (err) {
console.log(err);
});
},
fetchList: function (entity) {
return fetch_1.deviceFetch({
url: "/device/report/status/" + this.data.status,
data: __assign({ areaId: this.data.areaId, pageNum: this.data.pagination[this.data.status].pageNum, pageSize: this.data.pagination[this.data.status].pageSize }, entity),
});
},
refreshList: function () {
var _this = this;
wx.showLoading({
title: '加载中',
});
this.fetchList()
.then(function (res) {
wx.hideLoading();
console.log(res);
if (res.data && res.data.length) {
_this.setData((_a = {},
_a['dataList.' + _this.data.status] = res.data,
_a));
}
var _a;
})
.catch(function (err) {
wx.hideLoading();
console.log(err);
});
},
getMoreListItem: function () {
var _this = this;
wx.showLoading({
title: '加载中',
});
var nextPage = this.data.pagination[this.data.status].pageNum + 1;
this.fetchList({
pageNum: nextPage,
})
.then(function (res) {
wx.hideLoading();
console.log(res);
if (res.data && res.data.length) {
_this.setData((_a = {},
_a['dataList.' + _this.data.status] = _this.data.dataList[_this.data.status].concat(res.data),
_a['pagination.' + _this.data.status + '.pageNum'] = nextPage,
_a));
}
var _a;
})
.catch(function (err) {
wx.hideLoading();
console.log(err);
});
},
changeTab: function (e) {
var status = e.currentTarget.dataset.status;
console.log(e, status);
this.setData({
status: status,
});
if (!this.data.dataList[status].length)
this.refreshList();
},
openEquipment: function (e) {
var _this = this;
var _a = e.currentTarget.dataset, code = _a.code, type = _a.type;
console.log(code);
fetch_1.deviceFetch({
url: "/device/" + code + "/" + type + "/enable",
method: 'POST',
})
.then(function (res) {
wx.showToast({
title: res.msg || '操作成功',
});
_this.refreshList();
})
.catch(function (err) {
console.log(err);
});
},
closeEquipment: function (e) {
var _this = this;
var _a = e.currentTarget.dataset, code = _a.code, type = _a.type;
console.log(code);
fetch_1.deviceFetch({
url: "/device/" + code + "/" + type + "/forbidden",
method: 'POST',
})
.then(function (res) {
wx.showToast({
title: res.msg || '操作成功',
});
_this.refreshList();
})
.catch(function (err) {
console.log(err);
});
},
},
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRXF1aXBtZW50U3RhdGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJFcXVpcG1lbnRTdGF0ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7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GEoKSB7XG4gICAgICBkZXZpY2VGZXRjaCh7XG4gICAgICAgIHVybDogYC9kZXZpY2UvcmVwb3J0L2RldmljZVN0YXV0c0NvdW50LyR7dGhpcy5kYXRhLmFyZWFJZH1gLFxuICAgICAgfSlcbiAgICAgICAgLnRoZW4ocmVzID0+IHtcbiAgICAgICAgICBjb25zb2xlLmxvZyhyZXMpO1xuICAgICAgICAgIGNvbnN0IGxpc3QgPSByZXMuZGF0YS5tYXAoaXRlbSA9PiB7XG4gICAgICAgICAgICBsZXQgbGFiZWwgPSAnJztcbiAgICAgICAgICAgIHN3aXRjaCAoaXRlbS5zdGF0dXMpIHtcbiAgICAgICAgICAgICAgY2FzZSAnZW5hYmxlJzpcbiAgICAgICAgICAgICAgICBsYWJlbCA9ICflkK/nlKjorr7lpIcnO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICBjYXNlICdmb3JiaWRkZW4nOlxuICAgICAgICAgICAgICAgIGxhYmVsID0gJ+emgeeUqOiuvuWkhyc7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgIGNhc2UgJ29ubGluZSc6XG4gICAgICAgICAgICAgICAgbGFiZWwgPSAn5Zyo57q/6K6+5aSHJztcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgY2FzZSAnb2ZmbGluZSc6XG4gICAgICAgICAgICAgICAgbGFiZWwgPSAn56a757q/6K6+5aSHJztcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgIC4uLml0ZW0sXG4gICAgICAgICAgICAgIGxhYmVsLFxuICAgICAgICAgICAgfTtcbiAgICAgICAgICB9KTtcbiAgICAgICAgICB0aGlzLnNldERhdGEoe1xuICAgICAgICAgICAgdGFiczogbGlzdCxcbiAgICAgICAgIC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gICAgICAgd3guaGlkZUxvYWRpbmcoKTtcbiAgICAgICAgICBjb25zb2xlLmxvZyhlcnIpO1xuICAgICAgICB9KTtcbiAgICB9LFxuICAgIGdldE1vcmVMaXN0SXRlbSgpIHtcbiAgICAgIHd4LnNob3dMb2FkaW5nKHtcbiAgICAgICAgdGl0bGU6ICfliqDovb3kuK0nLFxuICAgICAgfSk7XG4gICAgICBsZXQgbmV4dFBhZ2UgPSB0aGlzLmRhdGEucGFnaW5hdGlvblt0aGlzLmRhdGEuc3RhdHVzXS5wYWdlTnVtICsgMTtcbiAgICAgIHRoaXMuZmV0Y2hMaXN0KHtcbiAgICAgICAgcGFnZU51bTogbmV4dFBhZ2UsXG4gICAgICB9KVxuICAgICAgICAudGhlbihyZXMgPT4ge1xuICAgICAgICAgIHd4LmhpZGVMb2FkaW5nKCk7XG4gICAgICAgICAgY29uc29sZS5sb2cocmVzKTtcbiAgICAgICAgICBpZiAocmVzLmRhdGEgJiYgcmVzLmRhdGEubGVuZ3RoKSB7XG4gICAgICAgICAgICB0aGlzLnNldERhdGEoe1xuICAgICAgICAgICAgICBbJ2RhdGFMaXN0LicgKyB0aGlzLmRhdGEuc3RhdHVzXTogW1xuICAgICAgICAgICAgICAgIC4uLnRoaXMuZGF0YS5kYXRhTGlzdFt0aGlzLmRhdGEuc3RhdHVzXSxcbiAgICAgICAgICAgICAgICAuLi5yZXMuZGF0YSxcbiAgICAgICAgICAgICAgXSxcbiAgICAgICAgICAgICAgWydwYWdpbmF0aW9uLicgKyB0aGlzLmRhdGEuc3RhdHVzICsgJy5wYWdlTnVtJ106IG5leHRQYWdlLFxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgfVxuICAgICAgICB9KVxuICAgICAgICAuY2F0Y2goZXJyID0+IHtcbiAgICAgICAgICB3eC5oaWRlTG9hZGluZygpO1xuICAgICAgICAgIGNvbnNvbGUubG9nKGVycik7XG4gICAgICAgIH0pO1xuICAgIH0sXG4gICAgY2hhbmdlVGFiKGUpIHt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gICBtZXRob2Q6ICdQT1NUJyxcbiAgICAgIH0pXG4gICAgICAgIC50aGVuKHJlcyA9PiB7XG4gICAgICAgICAgd3guc2hvd1RvYXN0KHtcbiAgICAgICAgICAgIHRpdGxlOiByZXMubXNnIHx8ICfmk43kvZzmiJDlip8nLFxuICAgICAgICAgIH0pO1xuICAgICAgICAgIHRoaXMucmVmcmVzaExpc3QoKTtcbiAgICAgICAgfSlcbiAgICAgICAgLmNhdGNoKGVyciA9PiB7XG4gICAgICAgICAgY29uc29sZS5sb2coZXJyKTtcbiAgICAgICAgfSk7XG4gICAgfSxcbiAgfSxcbn0pO1xuIl19
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
import { deviceFetch } from '../../../api/fetch';
// pages/components/EquipmentState/EquipmentState.js
Component({
lifetimes: {
attached() {},
},
/**
* 组件的属性列表
*/
properties: {
areaId: {
type: Number,
value: 0,
observer(newVal) {
this.fetchAll();
},
},
},
/**
* 组件的初始数据
*/
data: {
status: 'enable',
tabs: [],
pagination: {
enable: {
pageNum: 1,
pageSize: 10,
},
forbidden: {
pageNum: 1,
pageSize: 10,
},
online: {
pageNum: 1,
pageSize: 10,
},
offline: {
pageNum: 1,
pageSize: 10,
},
},
dataList: {
enable: [],
forbidden: [],
online: [],
offline: [],
},
},
/**
* 组件的方法列表
*/
methods: {
fetchAll() {
this.fetchData();
this.refreshList();
},
fetchData() {
deviceFetch({
url: `/device/report/deviceStautsCount/${this.data.areaId}`,
})
.then(res => {
console.log(res);
const list = res.data.map(item => {
let label = '';
switch (item.status) {
case 'enable':
label = '启用设备';
break;
case 'forbidden':
label = '禁用设备';
break;
case 'online':
label = '在线设备';
break;
case 'offline':
label = '离线设备';
break;
default:
break;
}
return {
...item,
label,
};
});
this.setData({
tabs: list,
});
})
.catch(err => {
console.log(err);
});
},
fetchList(entity) {
return deviceFetch({
url: `/device/report/status/${this.data.status}`,
data: {
areaId: this.data.areaId,
pageNum: this.data.pagination[this.data.status].pageNum,
pageSize: this.data.pagination[this.data.status].pageSize,
...entity,
},
});
},
refreshList() {
wx.showLoading({
title: '加载中',
});
this.fetchList()
.then(res => {
wx.hideLoading();
console.log(res);
if (res.data && res.data.length) {
this.setData({
['dataList.' + this.data.status]: res.data,
});
}
})
.catch(err => {
wx.hideLoading();
console.log(err);
});
},
getMoreListItem() {
wx.showLoading({
title: '加载中',
});
let nextPage = this.data.pagination[this.data.status].pageNum + 1;
this.fetchList({
pageNum: nextPage,
})
.then(res => {
wx.hideLoading();
console.log(res);
if (res.data && res.data.length) {
this.setData({
['dataList.' + this.data.status]: [
...this.data.dataList[this.data.status],
...res.data,
],
['pagination.' + this.data.status + '.pageNum']: nextPage,
});
}
})
.catch(err => {
wx.hideLoading();
console.log(err);
});
},
changeTab(e) {
const { status } = e.currentTarget.dataset;
console.log(e, status);
this.setData({
status,
});
if (!this.data.dataList[status].length) this.refreshList();
},
openEquipment(e) {
const { code, type } = e.currentTarget.dataset;
console.log(code);
deviceFetch({
url: `/device/${code}/${type}/enable`,
method: 'POST',
})
.then(res => {
wx.showToast({
title: res.msg || '操作成功',
});
this.refreshList();
})
.catch(err => {
console.log(err);
});
},
closeEquipment(e) {
const { code, type } = e.currentTarget.dataset;
console.log(code);
deviceFetch({
url: `/device/${code}/${type}/forbidden`,
method: 'POST',
})
.then(res => {
wx.showToast({
title: res.msg || '操作成功',
});
this.refreshList();
})
.catch(err => {
console.log(err);
});
},
},
});
<!-- pages/components/EquipmentState/EquipmentState.wxml -->
<view class="EquipmentState">
<view class="EquipmentState-statebar">
<view wx:for="{{tabs}}" wx:key="status" class="EquipmentState-statebarItem {{status === item.status ? 'checked':''}}" data-status="{{item.status}}" bind:tap="changeTab">
<view class="EquipmentState-statebarItem-name">{{item.label}}</view>
<view class="EquipmentState-statebarItem-count">{{item.amount}}台</view>
</view>
</view>
<view class="EquipmentState-elist">
<scroll-view class="EquipmentState-list" scroll-y bindscrolltolower="getMoreListItem">
<view wx:for="{{dataList[status]}}" wx:key="deviceCode" class="EquipmentState-elist-Item">
<view class="EquipmentState-elist-ItemCode">{{item.deviceCode}}</view>
<view class="EquipmentState-elist-ItemService">
{{item.deviceType === 2?'洗衣':item.deviceType === 3?'饮水':item.deviceType === 4?'吹风':item.deviceType === 5?'洗浴':item.deviceType}}
</view>
<view class="EquipmentState-elist-ItemLocation">{{item.position?item.position:'-'}}</view>
<view wx:if="{{status === 'forbidden'}}" class="EquipmentState-elist-ItemBtn Open" data-code="{{item.deviceCode}}" data-type="{{item.deviceType}}" bind:tap="openEquipment">
启用
</view>
<view wx:elif="{{status === 'enable'}}" class="EquipmentState-elist-ItemBtn Close" data-code="{{item.deviceCode}}" data-type="{{item.deviceType}}" bind:tap="closeEquipment">
禁用
</view>
</view>
</scroll-view>
</view>
</view>
\ No newline at end of file
/* pages/components/EquipmentState/EquipmentState.wxss */
.EquipmentState {
height: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
}
.EquipmentState-statebar {
display: flex;
margin: 40rpx 0 20rpx;
}
.EquipmentState-statebarItem {
align-items: center;
width: 168rpx;
height: 128rpx;
text-align: center;
font-size: 28rpx;
color: #666;
border: 1px solid #eee;
}
.EquipmentState-statebarItem.checked {
background-color: #7094f7;
color: #fff;
}
.EquipmentState-statebarItem-name {
margin: 24rpx 0 10rpx;
}
.EquipmentState-statebarItem-count {
width: 100%;
font-size: 24rpx;
}
.EquipmentState-elist {
flex: 1;
overflow: hidden;
}
.EquipmentState-list {
height: 100%;
}
.EquipmentState-elist-Item {
display: flex;
align-items: center;
height: 100rpx;
line-height: 100rpx;
font-size: 28rpx;
color: #333;
border-bottom: 1px solid #f0f0f0;
}
.EquipmentState-elist-ItemCode {
width: 150rpx;
}
.EquipmentState-elist-ItemService {
margin-left: 20rpx;
}
.EquipmentState-elist-ItemLocation {
margin-left: 20rpx;
flex: 1;
}
.EquipmentState-elist-ItemBtn {
width: 80rpx;
height: 60rpx;
line-height: 60rpx;
border-radius: 20rpx;
text-align: center;
font-size: 24rpx;
}
.EquipmentState-elist-ItemBtn.Open {
background-color: #e6f9ec;
color: #6edb8f;
}
.EquipmentState-elist-ItemBtn.Close {
background-color: #ffe5e5;
color: #fe6868;
}
"use strict";
var __assign = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
var fetch_1 = require("../../../api/fetch");
Component({
lifetimes: {
attached: function () {
if (!this.data.warningTypeRange) {
this.fetchWarningLevelList();
}
},
},
properties: {
areaId: {
type: Number,
value: 0,
observer: function (newVal) {
this.refreshList();
},
},
},
data: {
warningLevelRange: [],
warnLevelIndex: '',
warnLevel: 0,
deviceLocation: '',
dataList: [],
pageNum: 1,
pageSize: 10,
},
methods: {
fetchWarningLevelList: function () {
var _this = this;
fetch_1.deviceFetch({
url: '/device/warning/dict/illegalOperations',
})
.then(function (res) {
console.log(res);
_this.setData({
warningLevelRange: res.data,
});
})
.catch(function (err) {
console.log(err);
});
},
changeWarningType: function (e) {
var index = e.detail.value;
if (index === this.data.warnLevelIndex)
return;
var item = this.data.warningLevelRange[index];
console.log(item);
this.setData({
warnLevelIndex: index,
warnLevel: item.key,
});
this.refreshList();
},
changeLocation: function (e) {
var value = e.detail.value;
console.log(value);
this.setData({
deviceLocation: value,
});
this.refreshList();
},
fetchList: function (entity) {
if (this.data.warnLevel) {
entity.operation = this.data.warnLevel;
}
if (this.data.deviceLocation) {
entity.deviceLocation = this.data.deviceLocation;
}
return fetch_1.deviceFetch({
url: '/device/warning/paging',
method: 'POST',
data: __assign({ areaId: this.data.areaId, pageNum: this.data.pageNum, pageSize: this.data.pageSize }, entity),
});
},
refreshList: function () {
var _this = this;
wx.showLoading({
title: '加载中',
});
this.fetchList()
.then(function (res) {
wx.hideLoading();
console.log(res);
var list = res.data.list;
if (list && list.length) {
_this.setData({
dataList: list,
});
}
})
.catch(function (err) {
wx.hideLoading();
console.log(err);
});
},
getMoreListItem: function () {
var _this = this;
wx.showLoading({
title: '加载中',
});
var nextPage = this.data.pageNum + 1;
this.fetchList({
pageNum: nextPage,
})
.then(function (res) {
wx.hideLoading();
console.log(res);
var _a = res.data, list = _a.list, pageNum = _a.pageNum;
if (list && list.length) {
_this.setData({
dataList: _this.data.dataList.concat(list),
pageNum: pageNum,
});
}
})
.catch(function (err) {
wx.hideLoading();
console.log(err);
});
},
closeEquipment: function (e) {
var _this = this;
var _a = e.currentTarget.dataset, code = _a.code, type = _a.type;
console.log(code);
fetch_1.deviceFetch({
url: "/device/" + code + "/" + type + "/forbidden",
method: 'POST',
})
.then(function (res) {
wx.showToast({
title: res.msg || '操作成功',
});
_this.refreshList();
})
.catch(function (err) {
console.log(err);
});
},
},
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRXF1aXBtZW50V2FybmluZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIkVxdWlwbWVudFdhcm5pbmcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQUFBLDRDQUFpRDtBQUdqRCxTQUFTLENBQUM7SUFDUixTQUFTLEVBQUU7UUFDVCxRQUFRO1lBQ04sRUFBRSxDQUFDLENBQUMsQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLGdCQUFnQixDQUFDLENBQUMsQ0FBQztnQkFDaEMsSUFBSSxDQUFDLHFCQUFxQixFQUFFLENBQUM7WUFDL0IsQ0FBQztRQUNILENBQUM7S0FDRjtJQUlELFVBQVUsRUFBRTtRQUNWLE1BQU0sRUFBRTtZQUNOLElBQUksRUFBRSxNQUFNO1lBQ1osS0FBSyxFQUFFLENBQUM7WUFDUixRQUFRLFlBQUMsTUFBTTtnQkFDYixJQUFJLENBQUMsV0FBVyxFQUFFLENBQUM7WUFDckIsQ0FBQztTQUNGO0tBQ0Y7SUFLRCxJQUFJLEVBQUU7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N0ICYmIGxpc3QubGVuZ3RoKSB7XG4gICAgICAgICAgICB0aGlzLnNldERhdGEoe1xuICAgICAgICAgICAgICBkYXRhTGlzdDogbGlzdCxcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgIH1cbiAgICAgICAgfSlcbiAgICAgICAgLmNhdGNoKGVyciA9PiB7XG4gICAgICAgICAgd3guaGlkZUxvYWRpbmcoKTtcbiAgICAgICAgICBjb25zb2xlLmxvZyhlcnIpO1xuICAgICAgICB9KTtcbiAgICB9LFxuICAgIGdldE1vcmVMaXN0SXRlbSgpIHtcbiAgICAgIHd4LnNob3dMb2FkaW5nKHtcbiAgICAgICAgdGl0bGU6ICfliqDovb3kuK0nLFxuICAgICAgfSk7XG4gICAgICBsZXQgbmV4dFBhZ2UgPSB0aGlzLmRhdGEucGFnZU51bSArIDE7XG4gICAgICB0aGlzLmZldGNoTGlzdCh7XG4gICAgICAgIHBhZ2VOdW06IG5leHRQYWdlLFxuICAgICAgfSlcbiAgICAgICAgLnRoZW4ocmVzID0+IHtcbiAgICAgICAgICB3eC5oaWRlTG9hZGluZygpO1xuICAgICAgICAgIGNvbnNvbGUubG9nKHJlcyk7XG4gICAgICAgICAgY29uc3QgeyBsaXN0LCBwYWdlTnVtIH0gPSByZXMuZGF0YTtcbiAgICAgICAgICBpZiAobGlzdCAmJiBsaXN0Lmxlbmd0aCkge1xuICAgICAgICAgICAgdGhpcy5zZXREYXRhKHtcbiAgICAgICAgICAgICAgZGF0YUxpc3Q6IFsuLi50aGlzLmRhdGEuZGF0YUxpc3QsIC4uLmxpc3RdLFxuICAgICAgICAgICAgICBwYWdlTnVtLFxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgfVxuICAgICAgICB9KVxuICAgICAgICAuY2F0Y2goZXJyID0+IHtcbiAgICAgICAgICB3eC5oaWRlTG9hZGluZygpO1xuICAgICAgICAgIGNvbnNvbGUubG9nKGVycik7XG4gICAgICAgIH0pO1xuICAgIH0sXG4gICAgY2xvc2VFcXVpcG1lbnQoZSkge1xuICAgICAgY29uc3QgeyBjb2RlLCB0eXBlIH0gPSBlLmN1cnJlbnRUYXJnZXQuZGF0YXNldDtcbiAgICAgIGNvbnNvbGUubG9nKGNvZGUpO1xuICAgICAgZGV2aWNlRmV0Y2goe1xuICAgICAgICB1cmw6IGAvZGV2aWNlLyR7Y29kZX0vJHt0eXBlfS9mb3JiaWRkZW5gLFxuICAgICAgICBtZXRob2Q6ICdQT1NUJyxcbiAgICAgIH0pXG4gICAgICAgIC50aGVuKHJlcyA9PiB7XG4gICAgICAgICAgd3guc2hvd1RvYXN0KHtcbiAgICAgICAgICAgIHRpdGxlOiByZXMubXNnIHx8ICfmk43kvZzmiJDlip8nLFxuICAgICAgICAgIH0pO1xuICAgICAgICAgIHRoaXMucmVmcmVzaExpc3QoKTtcbiAgICAgICAgfSlcbiAgICAgICAgLmNhdGNoKGVyciA9PiB7XG4gICAgICAgICAgY29uc29sZS5sb2coZXJyKTtcbiAgICAgICAgfSk7XG4gICAgfSxcbiAgfSxcbn0pO1xuIl19
\ No newline at end of file
{
"component": true,
"usingComponents": {
"c-select": "../components/Select/Select"
}
}
import { deviceFetch } from '../../../api/fetch';
// pages/components/EquipmentWarning/EquipmentWarning.js
Component({
lifetimes: {
attached() {
if (!this.data.warningTypeRange) {
this.fetchWarningLevelList();
}
},
},
/**
* 组件的属性列表
*/
properties: {
areaId: {
type: Number,
value: 0,
observer(newVal) {
this.refreshList();
},
},
},
/**
* 组件的初始数据
*/
data: {
warningLevelRange: [],
warnLevelIndex: '',
warnLevel: 0,
deviceLocation: '',
dataList: [],
pageNum: 1,
pageSize: 10,
},
/**
* 组件的方法列表
*/
methods: {
fetchWarningLevelList() {
deviceFetch({
url: '/device/warning/dict/illegalOperations',
})
.then(res => {
console.log(res);
this.setData({
warningLevelRange: res.data,
});
})
.catch(err => {
console.log(err);
});
},
changeWarningType(e) {
const index = e.detail.value;
if (index === this.data.warnLevelIndex) return;
const item = this.data.warningLevelRange[index];
console.log(item);
this.setData({
warnLevelIndex: index,
warnLevel: item.key,
});
this.refreshList();
},
changeLocation(e) {
const { value } = e.detail;
console.log(value);
this.setData({
deviceLocation: value,
});
this.refreshList();
},
fetchList(entity) {
if (this.data.warnLevel) {
entity.operation = this.data.warnLevel;
}
if (this.data.deviceLocation) {
entity.deviceLocation = this.data.deviceLocation;
}
return deviceFetch({
url: '/device/warning/paging',
method: 'POST',
data: {
areaId: this.data.areaId,
pageNum: this.data.pageNum,
pageSize: this.data.pageSize,
...entity,
},
});
},
refreshList() {
wx.showLoading({
title: '加载中',
});
this.fetchList()
.then(res => {
wx.hideLoading();
console.log(res);
const { list } = res.data;
if (list && list.length) {
this.setData({
dataList: list,
});
}
})
.catch(err => {
wx.hideLoading();
console.log(err);
});
},
getMoreListItem() {
wx.showLoading({
title: '加载中',
});
let nextPage = this.data.pageNum + 1;
this.fetchList({
pageNum: nextPage,
})
.then(res => {
wx.hideLoading();
console.log(res);
const { list, pageNum } = res.data;
if (list && list.length) {
this.setData({
dataList: [...this.data.dataList, ...list],
pageNum,
});
}
})
.catch(err => {
wx.hideLoading();
console.log(err);
});
},
closeEquipment(e) {
const { code, type } = e.currentTarget.dataset;
console.log(code);
deviceFetch({
url: `/device/${code}/${type}/forbidden`,
method: 'POST',
})
.then(res => {
wx.showToast({
title: res.msg || '操作成功',
});
this.refreshList();
})
.catch(err => {
console.log(err);
});
},
},
});
<!-- pages/components/EquipmentWarning/EquipmentWarning.wxml -->
<view class="EquipmentWarning">
<view class="EquipmentWarning-filters">
<view class="EquipmentWarning-type">
<c-select ex-class="EquipmentWarning-filters-levelInput" mode="selector" value="{{warningLevel}}" range="{{warningLevelRange}}" rangeKey="value" bindchange="changeWarningType" />
</view>
<view class="EquipmentWarning-location">
<input class="EquipmentWarning-location-input" type="text" placeholder="设备位置" bindconfirm="changeLocation" />
</view>
</view>
<view class="EquipmentWarning-elist">
<scroll-view class="EquipmentWarning-list" scroll-y bindscrolltolower="getMoreListItem">
<view wx:for="{{dataList}}" wx:key="id" class="EquipmentWarning-listItem">
<view class="EquipmentWarning-listItem-title">
<view class="EquipmentWarning-listItem-titleCode">{{item.deviceCode}}</view>
<view class="EquipmentWarning-listItem-titleLocation">{{item.deviceLocation}}</view>
<view class="EquipmentWarning-listItem-titleState" data-code="{{item.deviceCode}}" data-type="{{item.deviceType}}" bind:tap="closeEquipment">
禁用
</view>
</view>
<view class="EquipmentWarning-listItem-info">
<view class="EquipmentWarning-listItem-infoErr">{{item.operationName}}</view>
<view class="EquipmentWarning-listItem-infoTime">{{item.operTime}}</view>
</view>
</view>
</scroll-view>
</view>
</view>
\ No newline at end of file
/* pages/components/EquipmentWarning/EquipmentWarning.wxss */
.EquipmentWarning {
height: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
}
.EquipmentWarning-filters {
display: flex;
justify-content: space-between;
padding: 40rpx 0 60rpx;
}
.EquipmentWarning-type {
width: 246rpx;
height: 80rpx;
}
.EquipmentWarning-location {
width: 404rpx;
height: 80rpx;
}
.EquipmentWarning-location-input {
height: 80rpx;
line-height: 80rpx;
border-radius: 20rpx;
}
.EquipmentWarning-filters .EquipmentWarning-filters-levelInput {
height: 80rpx;
line-height: 80rpx;
border-radius: 20rpx;
background-color: #ededed;
}
.EquipmentWarning-elist {
padding: 20rpx 0;
flex: 1;
overflow: hidden;
}
.EquipmentWarning-list {
height: 100%;
}
.EquipmentWarning-listItem {
padding: 40rpx 0;
border-bottom: 1px solid #eee;
}
.EquipmentWarning-listItem:last-child {
border: 0;
}
.EquipmentWarning-listItem-title {
display: flex;
align-items: center;
font-size: 28rpx;
color: #666;
}
.EquipmentWarning-listItem-titleCode {
width: 150rpx;
}
.EquipmentWarning-listItem-titleLocation {
margin-left: 20rpx;
width: 300rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.EquipmentWarning-listItem-titleState {
text-align: center;
border-radius: 20rpx;
width: 80rpx;
height: 60rpx;
line-height: 60rpx;
background-color: #ffe5e5;
color: #fe6868;
margin-left: 120rpx;
}
.EquipmentWarning-listItem-info {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 28rpx;
color: #333;
margin-top: 20rpx;
}
.EquipmentWarning-listItem-infoErr {
width: 410rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.EquipmentWarning-listItem-infoTime {
font-size: 24rpx;
color: #999;
}
...@@ -16,6 +16,9 @@ Component({ ...@@ -16,6 +16,9 @@ Component({
if (numberType === 'price') { if (numberType === 'price') {
formatCount = util_1.formatPrice(count); formatCount = util_1.formatPrice(count);
} }
else {
formatCount = util_1.formatPrice(count).split('.')[0];
}
this.setData({ this.setData({
formatCount: formatCount, formatCount: formatCount,
}); });
...@@ -27,4 +30,4 @@ Component({ ...@@ -27,4 +30,4 @@ Component({
}, },
methods: {}, methods: {},
}); });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUHJpY2VBbmRDb3VudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIlByaWNlQW5kQ291bnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw0Q0FBa0Q7QUFHbEQsU0FBUyxDQUFDO0lBSVIsVUFBVSxFQUFFO1FBQ1YsT0FBTyxFQUFFO1lBQ1AsSUFBSSxFQUFFLE1BQU07WUFDWixLQUFLLEVBQUU7Z0JBQ0wsS0FBSyxFQUFFLEVBQUU7Z0JBQ1QsVUFBVSxFQUFFLEVBQUU7Z0JBQ2QsS0FBSyxFQUFFLENBQUM7YUFDVDtZQUNELFFBQVEsRUFBRSxVQUFTLE1BQU07Z0JBQ2YsSUFBQSxvQkFBSyxFQUFFLDhCQUFVLENBQVk7Z0JBQ3JDLElBQUksV0FBVyxHQUFHLEtBQUssQ0FBQyxRQUFRLEVBQUUsQ0FBQztnQkFDbkMsRUFBRSxDQUFDLENBQUMsVUFBVSxLQUFLLE9BQU8sQ0FBQyxDQUFDLENBQUM7b0JBQzNCLFdB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sXG4gIC8qKlxuICAgKiDnu4Tku7bnmoTliJ3lp4vmlbDmja5cbiAgICovXG4gIGRhdGE6IHtcbiAgICBmb3JtYXRDb3VudDogJzAnLFxuICB9LFxuXG4gIC8qKlxuICAgKiDnu4Tku7bnmoTmlrnms5XliJfooahcbiAgICovXG4gIG1ldGhvZHM6IHt9LFxufSk7XG4iXX0=
\ No newline at end of file \ No newline at end of file
...@@ -18,6 +18,8 @@ Component({ ...@@ -18,6 +18,8 @@ Component({
let formatCount = count.toString(); let formatCount = count.toString();
if (numberType === 'price') { if (numberType === 'price') {
formatCount = formatPrice(count); formatCount = formatPrice(count);
} else {
formatCount = formatPrice(count).split('.')[0];
} }
this.setData({ this.setData({
formatCount, formatCount,
......
"use strict"; "use strict";
Component({ Component({
externalClasses: ['ex-class'],
properties: { properties: {
placeholder: { placeholder: {
type: String, type: String,
...@@ -44,4 +45,4 @@ Component({ ...@@ -44,4 +45,4 @@ Component({
}, },
}, },
}); });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiU2VsZWN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiU2VsZWN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxTQUFTLENBQUM7SUFDUixVQUFVLEVBQUU7UUFDVixXQUFXLEVBQUU7WUFDWCxJQUFJLEVBQUUsTUFBTTtZQUNaLEtBQUssRUFBRSxLQUFLO1NBQ2I7UUFDRCxLQUFLLEVBQUU7WUFDTCxJQUFJLEVBQUUsS0FBSztZQUNYLEtBQUssRUFBRSxFQUFFO1NBQ1Y7UUFDRCxRQUFRLEVBQUU7WUFDUixJQUFJLEVBQUUsTUFBTTtZQUNaLEtBQUssRUFBRSxLQUFLO1NBQ2I7UUFDRCxJQUFJLEVBQUU7WUFDSixJQUFJLEVBQUUsTUFBTTtZQUNaLEtBQUssRUFBRSxVQUFVO1NBQ2xCO1FBQ0QsTUFBTSxFQUFFO1lB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mdlJywgeyB2YWx1ZSB9KTtcbiAgICB9LFxuICB9LFxufSk7XG4iXX0=
\ No newline at end of file \ No newline at end of file
Component({ Component({
externalClasses: ['ex-class'],
properties: { properties: {
placeholder: { placeholder: {
type: String, type: String,
......
<!-- pages/components/Select/Select.wxml --> <!-- pages/components/Select/Select.wxml -->
<view class="select-input"> <view class="select-input ex-class">
<picker class="select-picker" mode="{{mode}}" bindchange="bindPickerChange" value="{{selected}}" range="{{range}}" range-key="{{rangeKey}}" fields="{{fields}}"> <picker class="select-picker" mode="{{mode}}" bindchange="bindPickerChange" value="{{selected}}" range="{{range}}" range-key="{{rangeKey}}" fields="{{fields}}">
<view wx:if="{{selected && mode === 'date'}}" class="select-value">{{selected}}</view> <view wx:if="{{selected && mode === 'date'}}" class="select-value">{{selected}}</view>
<view wx:elif="{{selected}}" class="select-value">{{range[selected][rangeKey]}}</view> <view wx:elif="{{selected}}" class="select-value">{{range[selected][rangeKey]}}</view>
......
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var fetch_1 = require("../../api/fetch");
Page({
data: {
colors: ['#6895fe', '#fe6868', '#6ee18f', '#feae68'],
areaDeviceAmount: [],
statusAmount: [],
totalAmount: [],
total: 0,
},
onLoad: function (options) {
this.fetchList();
},
fetchList: function () {
var _this = this;
fetch_1.deviceFetch({
url: '/device/report/mainPage',
})
.then(function (res) {
console.log(res);
var _a = res.data, areaDeviceAmount = _a.areaDeviceAmount, statusAmount = _a.statusAmount, totalAmount = _a.totalAmount;
var total = totalAmount.reduce(function (count, item) { return count + item.value; }, 0);
_this.setData({
areaDeviceAmount: areaDeviceAmount,
statusAmount: statusAmount,
totalAmount: totalAmount,
total: total,
});
})
.catch(function (err) {
console.log(err);
});
},
goReportPage: function (e) {
var index = e.currentTarget.dataset.index;
var item = this.data.areaDeviceAmount[index];
wx.navigateTo({
url: "/pages/equipmentReport/equipmentReport?areaId=" + item.areaId + "&areaName=" + item.areaName,
success: function (res) {
res.eventChannel.emit('acceptDataFromO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QvZXF1aXBtZW50UmVwb3J0P2FyZWFJZD0ke2l0ZW0uYXJlYUlkfSZhcmVhTmFtZT0ke2l0ZW0uYXJlYU5hbWV9YCxcbiAgICAgIHN1Y2Nlc3M6IGZ1bmN0aW9uKHJlcykge1xuICAgICAgICAvLyDpgJrov4dldmVudENoYW5uZWzlkJHooqvmiZPlvIDpobXpnaLkvKDpgIHmlbDmja5cbiAgICAgICAgcmVzLmV2ZW50Q2hhbm5lbC5lbWl0KCdhY2NlcHREYXRhRnJvbU9wZW5lclBhZ2UnLCB7IGRhdGE6IGl0ZW0gfSk7XG4gICAgICB9LFxuICAgIH0pO1xuICB9LFxufSk7XG4iXX0=
\ No newline at end of file
{
"navigationBarTitleText": "设备运营分析",
"usingComponents": {
"equipment-chart": "../components/EquipmentChart/EquipmentChart"
}
}
\ No newline at end of file
import { deviceFetch } from '../../api/fetch';
// miniprogram/pages/equipment/equipment.js
Page({
/**
* 页面的初始数据
*/
data: {
colors: ['#6895fe', '#fe6868', '#6ee18f', '#feae68'],
areaDeviceAmount: [],
statusAmount: [],
totalAmount: [],
total: 0,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
this.fetchList();
},
fetchList() {
deviceFetch({
url: '/device/report/mainPage',
})
.then(res => {
console.log(res);
const { areaDeviceAmount, statusAmount, totalAmount } = res.data;
let total = totalAmount.reduce((count, item) => count + item.value, 0);
this.setData!({
areaDeviceAmount,
statusAmount,
totalAmount,
total,
});
})
.catch(err => {
console.log(err);
});
},
goReportPage(e) {
const { index } = e.currentTarget.dataset;
const item = this.data.areaDeviceAmount[index];
wx.navigateTo({
url: `/pages/equipmentReport/equipmentReport?areaId=${item.areaId}&areaName=${item.areaName}`,
success: function(res) {
// 通过eventChannel向被打开页面传送数据
res.eventChannel.emit('acceptDataFromOpenerPage', { data: item });
},
});
},
});
<!-- miniprogram/pages/equipment/equipment.wxml -->
<view class="equipment">
<view class="equipment-block">
<view class="equipment-title">
<view class="equipment-title-color"></view>
<view class="equipment-title-text">设备总数({{total}}台)</view>
</view>
<view class="equipment-canvas autoheight">
<equipment-chart dataList="{{totalAmount}}" />
</view>
</view>
<view class="equipment-block">
<view class="equipment-title">
<view class="equipment-title-color"></view>
<view class="equipment-title-text">设备状态</view>
</view>
<view class="equipment-canvas autoheight">
<equipment-chart dataList="{{statusAmount}}" colors="{{colors}}" />
</view>
</view>
<view class="equipment-area">
<view wx:for="{{areaDeviceAmount}}" wx:key="areaId" class="equipment-areaitem">
<view class="equipment-areaitem-title">
<view>{{item.areaName}}</view>
<view class="equipment-areaitem-titleLink" data-index="{{index}}" bind:tap="goReportPage">
运营数据 >
</view>
</view>
<view class="equipment-areaitem-count">
<view wx:for="{{item.totalAmount}}" wx:key="key" class="equipment-areaitem-countItem">
{{item.key}}设备数:{{item.value}}
</view>
</view>
</view>
</view>
</view>
\ No newline at end of file
/* miniprogram/pages/equipment/equipment.wxss */
.equipment-block {
padding: 0 40rpx;
/* border-bottom: 8rpx solid #eef3fc; */
}
.equipment-title {
display: flex;
align-items: center;
padding: 50rpx 0 20rpx;
}
.equipment-title-color {
width: 12rpx;
height: 12rpx;
margin-right: 12rpx;
border-radius: 50%;
background-color: #6895fe;
}
.equipment-area {
padding: 40rpx 24rpx;
background-color: #f8f8f8;
}
.equipment-areaitem {
margin-bottom: 20rpx;
border-radius: 20rpx;
padding: 40rpx 32rpx 20rpx;
background-color: #fff;
border: 1rpx solid #eee;
}
.equipment-areaitem-title {
display: flex;
justify-content: space-between;
font-size: 32rpx;
color: #666;
margin-bottom: 40rpx;
}
.equipment-areaitem-titleLink {
font-size: 28rpx;
color: #6a92ff;
}
.equipment-areaitem-count {
display: flex;
flex-wrap: wrap;
font-size: 28rpx;
color: #333;
}
.equipment-areaitem-countItem {
width: 50%;
margin-bottom: 20rpx;
}
"use strict";
var __assign = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
var fetch_1 = require("../../api/fetch");
Page({
data: {
areaId: null,
areaName: '',
type: 0,
timeType: 0,
totalAmount: [],
},
onLoad: function (options) {
var _this = this;
console.log(options);
var areaId = options.areaId, areaName = options.areaName;
var eventChannel = this.getOpenerEventChannel();
eventChannel.on('acceptDataFromOpenerPage', function (res) {
console.log(res);
_this.setData({
totalAmount: res.data.totalAmount.map(function (item) { return (__assign({}, item, { type: item.key === '饮水'
? 2
: item.key === '吹风'
? 3
: item.key === '洗浴'
? 4
: item.key === '洗衣'
? 5
: item.key })); }),
});
});
this.setData({
areaId: areaId,
areaName: areaName,
});
},
fetchWarningLevel: function () {
fetch_1.deviceFetch({
url: '/device/warning/dict/warningLevel',
})
.then(function (res) {
console.log(res);
})
.catch(function (err) {
console.log(err);
});
},
changeType: function (e) {
var type = e.currentTarget.dataset.type;
console.log(type);
if (type === this.data.type)
return;
this.setData({
type: type,
});
return false;
},
changeTimeType: function (e) {
var timeType = e.currentTarget.dataset.timeType;
console.log(timeType);
if (timeType === this.data.timeType)
return;
this.setData({
timeType: timeType,
});
return false;
},
fetchData: function () {
fetch_1.statisticsFetch({
url: '/boss/device/operation/data/summary',
method: 'POST',
data: {
areaId: this.data.areaId,
timeType: this.data.timeType,
},
})
.then(function (res) {
console.log(res);
})
.catch(function (err) {
console.log(err);
});
},
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXF1aXBtZW50UmVwb3J0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiZXF1aXBtZW50UmVwb3J0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFBQSx5Q0FBK0Q7QUFHL0QsSUFBSSxDQUFDO0lBSUgsSUFBSSxFQUFFO1FBQ0osTUFBTSxFQUFFLElBQUk7UUFDWixRQUFRLEVBQUUsRUFBRTtRQUNaLElBQ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2cob3B0aW9ucyk7XG4gICAgY29uc3QgeyBhcmVhSWQsIGFyZWFOYW1lIH0gPSBvcHRpb25zO1xuICAgIGNvbnN0IGV2ZW50Q2hhbm5lbCA9IHRoaXMuZ2V0T3BlbmVyRXZlbnRDaGFubmVsKCk7XG4gICAgZXZlbnRDaGFubmVsLm9uKCdhY2NlcHREYXRhRnJvbU9wZW5lclBhZ2UnLCByZXMgPT4ge1xuICAgICAgY29uc29sZS5sb2cocmVzKTtcbiAgICAgIHRoaXMuc2V0RGF0YSh7XG4gICAgICAgIHRvdGFsQW1vdW50OiByZXMuZGF0YS50b3RhbEFtb3VudC5tYXAoaXRlbSA9PiAoe1xuICAgICAgICAgIC4uLml0ZW0sXG4gICAgICAgICAgdHlwZTpcbiAgICAgICAgICAgIGl0ZW0ua2V5ID09PSAn6aWu5rC0J1xuICAgICAgICAgICAgICA/IDJcbiAgICAgICAgICAgICAgOiBpdGVtLmtleSA9PT0gJ+WQuemjjidcbiAgICAgICAgICAgICAgPyAzXG4gICAgICAgICAgICAgIDogaXRlbS5rZXkgPT09ICfmtJfmtbQnXG4gICAgICAgICAgICAgID8gNFxuICAgICAgICAgICAgICA6IGl0ZW0ua2V5ID09PSAn5rSX6KGjJ1xuICAgICAgICAgICAgICA/IDVcbiAgICAgICAgICAgICAgOiBpdGVtLmtleSxcbiAgICAgICAgfSkpLFxuICAgICAgfSk7XG4gICAgfSk7XG4gICAgdGhpcy5zZXREYXRhISh7XG4gICAgICBhcmVhSWQsXG4gICAgICBhcmVhTmFtZSxcbiAgICB9KTtcbiAgICAvLyB0aGlzLmZldGNoV2FybmluZ0xldmVsKCk7XG4gIH0sXG4gIGZldGNoV2FybmluZ0xldmVsKCkge1xuICAgIGRldmljZUZldGNoKHtcbiAgICAgIHVybDogJy9kZXZpY2Uvd2FybmluZy9kaWN0L3dhcm5pbmdMZXZlbCcsXG4gICAgfSlcbiAgICAgIC50aGVuKHJlcyA9PiB7XG4gICAgICAgIGNvbnNvbGUubG9nK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bnNvbGUubG9nKGVycik7XG4gICAgICB9KTtcbiAgfSxcbn0pO1xuIl19
\ No newline at end of file
{
"usingComponents": {
"equipment-operation-details": "../components/EquipmentOperationDetails/EquipmentOperationDetails",
"equipment-state": "../components/EquipmentState/EquipmentState",
"equipment-warning": "../components/EquipmentWarning/EquipmentWarning"
}
}
import { deviceFetch, statisticsFetch } from '../../api/fetch';
// miniprogram/pages/equipmentReport/equipmentReport.js
Page({
/**
* 页面的初始数据
*/
data: {
areaId: null,
areaName: '',
type: 0,
timeType: 0,
totalAmount: [],
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
console.log(options);
const { areaId, areaName } = options;
const eventChannel = this.getOpenerEventChannel();
eventChannel.on('acceptDataFromOpenerPage', res => {
console.log(res);
this.setData({
totalAmount: res.data.totalAmount.map(item => ({
...item,
type:
item.key === '饮水'
? 2
: item.key === '吹风'
? 3
: item.key === '洗浴'
? 4
: item.key === '洗衣'
? 5
: item.key,
})),
});
});
this.setData!({
areaId,
areaName,
});
// this.fetchWarningLevel();
},
fetchWarningLevel() {
deviceFetch({
url: '/device/warning/dict/warningLevel',
})
.then(res => {
console.log(res);
})
.catch(err => {
console.log(err);
});
},
changeType(e) {
const { type } = e.currentTarget.dataset;
console.log(type);
if (type === this.data.type) return;
this.setData!({
type: type,
});
return false;
},
changeTimeType(e) {
const { timeType } = e.currentTarget.dataset;
console.log(timeType);
if (timeType === this.data.timeType) return;
this.setData!({
timeType,
});
return false;
},
fetchData() {
statisticsFetch({
url: '/boss/device/operation/data/summary',
method: 'POST',
data: {
areaId: this.data.areaId,
timeType: this.data.timeType,
},
})
.then(res => {
console.log(res);
})
.catch(err => {
console.log(err);
});
},
});
<!-- miniprogram/pages/equipmentReport/equipmentReport.wxml -->
<view class="equipmentReport">
<view class="equipmentReport-title">{{areaName}}</view>
<view class="home-title-type">
<view class="title-type-item" data-type="{{0}}" bindtap="changeType">
<view class="radio-box {{type === 0?'checked':''}}"></view>
运营明细
</view>
<view class="title-type-item" data-type="{{1}}" bindtap="changeType">
<view class="radio-box {{type === 1?'checked':''}}"></view>
设备状态
</view>
<view class="title-type-item" data-type="{{2}}" bindtap="changeType">
<view class="radio-box {{type === 2?'checked':''}}"></view>
设备告警
</view>
</view>
<view class="equipmentReport-content">
<equipment-operation-details wx:if="{{type === 0}}" timeType="{{timeType}}" totalAmount="{{totalAmount}}" />
<equipment-state wx:if="{{type === 1}}" areaId="{{areaId}}" />
<equipment-warning wx:if="{{type === 2}}" areaId="{{areaId}}" />
</view>
</view>
\ No newline at end of file
/* miniprogram/pages/equipmentReport/equipmentReport.wxss */
page {
height: 100%;
}
.equipmentReport {
display: flex;
flex-direction: column;
height: 100%;
padding: 0 40rpx;
}
.equipmentReport-title {
padding: 40rpx 0;
font-size: 40rpx;
color: #333;
}
.home-title-type,
.title-type-item {
display: flex;
align-items: center;
}
.title-type-item {
font-size: 28rpx;
margin-right: 20rpx;
}
.radio-box {
box-sizing: border-box;
width: 32rpx;
height: 32rpx;
border-radius: 50%;
border: 2px solid #9c9c9c;
margin-right: 8rpx;
}
.radio-box.checked {
border-color: #6895fe;
background-color: #6895fe;
}
.equipmentReport-content {
flex: 1;
overflow: hidden;
}
...@@ -103,6 +103,20 @@ ...@@ -103,6 +103,20 @@
"id": -1, "id": -1,
"name": "platformFeeRecord", "name": "platformFeeRecord",
"pathName": "pages/platformFeeRecord/platformFeeRecord", "pathName": "pages/platformFeeRecord/platformFeeRecord",
"query": "",
"scene": null
},
{
"id": -1,
"name": "equipment",
"pathName": "pages/equipment/equipment",
"scene": null
},
{
"id": 8,
"name": "equipmentReport",
"pathName": "pages/equipmentReport/equipmentReport",
"query": "areaId=15&areaName=多彩温江校区",
"scene": null "scene": null
} }
] ]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment