function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
import { JxhService } from "../../../api";
import { Col, Row } from 'antd';
import dayjs from 'dayjs';
import { VmFactor, VmProgress } from "../../../../_components";
import useSettings from "../../../../_hooks/useSettings";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
export default function (props) {
  var _useSettings = useSettings(),
    isDark = _useSettings.isDark;
  var _JxhService$useWorkSu = JxhService.useWorkSummaryJxh(props.id, dayjs(props.date).format('YYYY-MM-DD'), dayjs(props.date).format('YYYY-MM-DD'), true),
    workSummaryJxhRes = _JxhService$useWorkSu.workSummaryJxhRes,
    loading = _JxhService$useWorkSu.loading;
  var data = [{
    name: '规划里程',
    unit: 'km',
    value: workSummaryJxhRes === null || workSummaryJxhRes === void 0 ? void 0 : workSummaryJxhRes.planMileage,
    img: isDark ? require("../../../imgs/track_dark.png") : require("../../../imgs/track.png"),
    fontType: 'blue'
  }, {
    name: '运行时长',
    unit: '',
    value: workSummaryJxhRes === null || workSummaryJxhRes === void 0 ? void 0 : workSummaryJxhRes.runDuration,
    img: isDark ? require("../../../imgs/clock_dark.png") : require("../../../imgs/clock.png"),
    fontType: 'blue'
  }, {
    name: '总电耗',
    unit: 'kwh',
    value: workSummaryJxhRes === null || workSummaryJxhRes === void 0 ? void 0 : workSummaryJxhRes.electricityExpendTotal,
    img: isDark ? require("../../../imgs/butter_dark.png") : require("../../../imgs/butter.png"),
    fontType: 'yellow'
  }, {
    name: '核算作业里程',
    unit: 'km',
    value: workSummaryJxhRes === null || workSummaryJxhRes === void 0 ? void 0 : workSummaryJxhRes.workMileage,
    img: isDark ? require("../../../imgs/track_green_dark.png") : require("../../../imgs/track_green.png"),
    fontType: 'green'
  }, {
    name: '作业时长',
    unit: '',
    value: workSummaryJxhRes === null || workSummaryJxhRes === void 0 ? void 0 : workSummaryJxhRes.workDuration,
    img: isDark ? require("../../../imgs/clock_green_dark.png") : require("../../../imgs/clock_green.png"),
    fontType: 'green'
  }, {
    name: '总水耗',
    unit: 'L',
    value: workSummaryJxhRes === null || workSummaryJxhRes === void 0 ? void 0 : workSummaryJxhRes.waterExpendTotal,
    img: isDark ? require("../../../imgs/water_dark.png") : require("../../../imgs/water.png"),
    fontType: 'green'
  }];
  return /*#__PURE__*/_jsxs(Row, {
    gutter: [47, 47],
    align: 'middle',
    style: {
      height: '100%',
      marginLeft: 30
    },
    children: [/*#__PURE__*/_jsx(Col, {
      flex: '112px',
      children: /*#__PURE__*/_jsx(VmProgress.Circle, {
        rate: (workSummaryJxhRes === null || workSummaryJxhRes === void 0 ? void 0 : workSummaryJxhRes.workRate) || 0,
        name: '完成率',
        strokeColor: isDark ? {
          '0%': '#009DFF',
          '100%': '#44FF98'
        } : {
          '0%': '#1677FF',
          '100%': '#48A2FF'
        }
      })
    }), /*#__PURE__*/_jsx(Col, {
      flex: '1',
      children: /*#__PURE__*/_jsx(Row, {
        gutter: [0, 27],
        children: data.map(function (item) {
          return /*#__PURE__*/_jsx(Col, {
            span: 8,
            children: /*#__PURE__*/_jsx(VmFactor, _objectSpread(_objectSpread({}, item), {}, {
              type: 'sm'
            }))
          }, item.name);
        })
      })
    })]
  });
}