basedata.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * @Author: wf
  3. * @Date: 2021-07-10 15:23:53
  4. * @LastEditors: wf
  5. * @LastEditTime:
  6. * @Description: 存储项目公共数据
  7. */
  8. /*
  9. 水质监测仪:waterQualityMeter
  10. 有线远传表:wiredRemoteMeter
  11. 无线远传表:wirelessRemoteMeter
  12. 光电直读表:photoelectricMeter
  13. 预付费监控表:prepaymentMeter
  14. 流量计:flowmeter
  15. NBIOT表:nbiotMeter
  16. Lora水表:loraMeter
  17. */
  18. export const waterMeter = ['wiredRemoteMeter', 'wirelessRemoteMeter', 'photoelectricMeter', 'prepaymentMeter', 'nbiotMeter', 'loraMeter','ycMeter','mechanicMeter']; // 水表别名
  19. const deviceStatusData = [
  20. {
  21. id: '',
  22. label: '全部',
  23. icon: '',
  24. color: '#606266'
  25. },
  26. {
  27. id: '1',
  28. label: '正常',
  29. icon: 'el-icon-success',
  30. color: '#73e9ff'
  31. },
  32. {
  33. id: '2',
  34. label: '离线',
  35. icon: 'el-icon-error',
  36. color: '#F56C6C'
  37. },
  38. {
  39. id: '3',
  40. label: '告警',
  41. icon: 'el-icon-warning',
  42. color: '#E6A23C'
  43. },
  44. {
  45. id: '4',
  46. label: '报废',
  47. icon: 'el-icon-info',
  48. color: '#eb3941'
  49. },
  50. {
  51. id: '5',
  52. label: '未启用',
  53. icon: 'el-icon-info',
  54. color: '#909399'
  55. }
  56. ]
  57. export const deviceLoader = {
  58. options: deviceStatusData, // 设备状态列表
  59. getLabel: (id) => _.find(deviceStatusData, v => v.id == id).label, // 根据ID获取设备状态名称
  60. getColor: (id) => _.find(deviceStatusData, v => v.id == id).color, // 根据ID获取设备状态颜色
  61. getColorbyname: (name) => _.find(deviceStatusData, v => v.label == name).color, // 根据ID获取设备状态颜色
  62. getIcon: (id) => _.find(deviceStatusData, v => v.id == id).icon, // 根据ID获取设备状态icon
  63. getDeviceModel: (data, prop1 = 'manufacturerName', prop2 = 'productName', prop3 = 'productModel') => {// 获取设备型号
  64. let str = '-';
  65. // console.log(`data[prop1]:${JSON.stringify(data)}`);
  66. if(data[prop1] && data[prop2] && data[prop3]) {
  67. str = `${data[prop1]}/${data[prop2]}/${data[[prop3]]}`
  68. }
  69. return str;
  70. },
  71. getDeviceModelDelivery: (data, prop1 = 'manufacturerName', prop2 = 'productName', prop3 = 'productModel') => {// 获取设备型号
  72. let str = '-';
  73. // console.log(`data[prop1]:${JSON.stringify(data[prop1])}`);
  74. if(data[prop1] && data[prop2] && data[prop3]) {
  75. str = `${data[prop1]}/${data[prop2]}/${data[[prop3]]}`
  76. }
  77. return str;
  78. }
  79. };