健康同学微信公众号h5项目
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.

28 lines
890B

  1. import store from '@/store';
  2. import request from '@/config/request';
  3. import { DeviceCommandModel } from '@/config/models';
  4. import { isNotNull } from '@/services/utils-service';
  5. const APICommandList = {
  6. getClocks() {
  7. const data = { deviceId: store.getters.deviceId };
  8. return request({ url: '/api/Command/CommandList', method: 'post', data });
  9. },
  10. setClocks(cmdValue) {
  11. const data = {
  12. deviceId: store.getters.deviceId,
  13. userId: store.getters.userId,
  14. serialNo: store.getters.serialNo,
  15. cmdCode: DeviceCommandModel.clock,
  16. cmdValue
  17. };
  18. return request({ url: '/api/Command/SendCommand', method: 'post', data });
  19. },
  20. getCmdValue(data, deviceCommandModel) {
  21. const result = data.filter(v => v.cmdCode === deviceCommandModel);
  22. return isNotNull(result) ? JSON.parse(result[0].cmdValue).Items : [];
  23. }
  24. };
  25. export default APICommandList;