"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = TodayWorkLJSY;
var _react = _interopRequireDefault(require("react"));
var _moment = _interopRequireDefault(require("moment"));
var _vmTable = _interopRequireDefault(require("../../../vm-table"));
var _vmImageText = _interopRequireDefault(require("../../../vm-image-text"));
var _useSettings2 = _interopRequireDefault(require("../../../vm-hooks/useSettings"));
var _api = require("../../api");
var _ysdw = _interopRequireDefault(require("../../imgs/ysdw.png"));
var _ywcdw = _interopRequireDefault(require("../../imgs/ywcdw.png"));
var _wcl = _interopRequireDefault(require("../../imgs/wcl.png"));
var _ysdw_light = _interopRequireDefault(require("../../imgs/ysdw_light.png"));
var _ywcdw_light = _interopRequireDefault(require("../../imgs/ywcdw_light.png"));
var _wcl_light = _interopRequireDefault(require("../../imgs/wcl_light.png"));
var _ysdw_blue = _interopRequireDefault(require("../../imgs/ysdw_blue.png"));
var _ywcdw_blue = _interopRequireDefault(require("../../imgs/ywcdw_blue.png"));
var _wcl_blue = _interopRequireDefault(require("../../imgs/wcl_blue.png"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
/**
 * 今日作业-垃圾收运
 */

function TodayWorkLJSY(_ref) {
  var id = _ref.id;
  var _a, _b;
  var _useSettings = (0, _useSettings2["default"])(),
    theme = _useSettings.theme;
  var _BaseService$useToday = _api.BaseService.useTodayWorkLjsy(id, (0, _moment["default"])().format('YYYY-MM-DD')),
    todayRunLjsyRes = _BaseService$useToday.todayRunLjsyRes;
  var paramConfigsList = _api.BaseService.useConfig();
  var getSrc = function getSrc(code) {
    var obj = {};
    if (theme === 'dark') {
      obj = {
        ysdw: _ysdw["default"],
        ywcdw: _ywcdw["default"],
        wcl: _wcl["default"]
      };
    } else if (theme === 'blue') {
      obj = {
        ysdw: _ysdw_blue["default"],
        ywcdw: _ywcdw_blue["default"],
        wcl: _wcl_blue["default"]
      };
    } else {
      obj = {
        ysdw: _ysdw_light["default"],
        ywcdw: _ywcdw_light["default"],
        wcl: _wcl_light["default"]
      };
    }
    return obj[code];
  };
  var data = [{
    src: getSrc('ysdw'),
    name: '应收频次',
    value: (todayRunLjsyRes === null || todayRunLjsyRes === void 0 ? void 0 : todayRunLjsyRes.planCollectPointNum) || 0,
    unit: '次'
  }, {
    src: getSrc('ywcdw'),
    name: '实收频次',
    value: (todayRunLjsyRes === null || todayRunLjsyRes === void 0 ? void 0 : todayRunLjsyRes.collectPointNum) || 0,
    unit: '次'
  }, {
    src: getSrc('wcl'),
    name: '完成率',
    value: (todayRunLjsyRes === null || todayRunLjsyRes === void 0 ? void 0 : todayRunLjsyRes.completeRate) || 0,
    unit: '%'
  }];
  var columns = [{
    title: '收集点',
    dataIndex: 'collectPointName',
    key: 'collectPointName',
    width: 130,
    ellipsis: true
  }, {
    title: '收集次数(次)',
    dataIndex: 'collectNum',
    key: 'collectNum',
    width: 90,
    align: 'right'
  }];
  if (((_a = paramConfigsList['SHOW_COLLECTING_BUCKETS']) === null || _a === void 0 ? void 0 : _a.value) === 'true') {
    columns = columns.concat([{
      title: '收集桶数(桶)',
      dataIndex: 'bucketNum',
      key: 'bucketNum',
      width: 90,
      align: 'right'
    }]);
  }
  if (((_b = paramConfigsList['SHOW_WEIGHTING']) === null || _b === void 0 ? void 0 : _b.value) === 'true') {
    columns = columns.concat([{
      title: '收集重量(kg)',
      dataIndex: 'weight',
      key: 'weight',
      width: 90,
      align: 'right'
    }]);
  }
  var tableProps = {
    height: (todayRunLjsyRes === null || todayRunLjsyRes === void 0 ? void 0 : todayRunLjsyRes.planCollectPointNum) > 0 ? 180 : 246,
    paganitation: false,
    dataSource: (todayRunLjsyRes === null || todayRunLjsyRes === void 0 ? void 0 : todayRunLjsyRes.details) || []
  };
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, (todayRunLjsyRes === null || todayRunLjsyRes === void 0 ? void 0 : todayRunLjsyRes.planCollectPointNum) > 0 && (/*#__PURE__*/_react["default"].createElement("div", {
    className: "ljsy-summary"
  }, data === null || data === void 0 ? void 0 : data.map(function (ele, index) {
    return /*#__PURE__*/_react["default"].createElement(_vmImageText["default"], Object.assign({
      key: index
    }, ele, {
      style: {
        margin: '0 0 12px 0',
        width: '33.3333%'
      }
    }));
  }))), /*#__PURE__*/_react["default"].createElement(_vmTable["default"], Object.assign({
    columns: columns,
    isIndex: false,
    rowKey: "index"
  }, tableProps)));
}
//# sourceMappingURL=TodayWorkLJSY.js.map
