89 lines
4.9 KiB
JavaScript
89 lines
4.9 KiB
JavaScript
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 _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
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 { Card, Space, Divider } from 'antd';
|
|
import { theme } from 'antd/lib';
|
|
import React from 'react';
|
|
import dayjs from 'dayjs';
|
|
import "./index.less";
|
|
;
|
|
;
|
|
export var WarningRecordCard = function WarningRecordCard(props) {
|
|
var componentName = "zhst-biz-warning-record-card";
|
|
var record = props.record,
|
|
onRecordClick = props.onRecordClick,
|
|
style = props.style,
|
|
cardProps = props.cardProps,
|
|
selectedRecordId = props.selectedRecordId,
|
|
cardStyle = props.cardStyle,
|
|
imgStyle = props.imgStyle;
|
|
var _ref = record || {},
|
|
imgSrc = _ref.imgSrc,
|
|
id = _ref.id,
|
|
warningType = _ref.warningType,
|
|
_ref$warningInfo = _ref.warningInfo,
|
|
warningInfo = _ref$warningInfo === void 0 ? [] : _ref$warningInfo,
|
|
cabietText = _ref.cabietText,
|
|
warningTime = _ref.warningTime,
|
|
warningTimestamp = _ref.warningTimestamp,
|
|
_ref$warningTimeForma = _ref.warningTimeFormat,
|
|
warningTimeFormat = _ref$warningTimeForma === void 0 ? 'YYYY-MM-DD HH:mm:ss' : _ref$warningTimeForma;
|
|
var formattedDate = warningTimestamp ? dayjs(warningTimestamp).format(warningTimeFormat) : '';
|
|
var warningTimeShow = warningTime ? warningTime : formattedDate;
|
|
var useToken = theme.useToken;
|
|
var _useToken = useToken(),
|
|
token = _useToken.token;
|
|
var selectedBorderStyle = {
|
|
border: "2px solid ".concat(token.colorPrimary),
|
|
boxShadow: " 0px 2px 9px 0px rgba(0,0,0,0.16)"
|
|
};
|
|
var selectedCardStyle = _objectSpread({}, selectedRecordId === (record === null || record === void 0 ? void 0 : record.id) ? selectedBorderStyle : {});
|
|
var handleClick = function handleClick() {
|
|
onRecordClick === null || onRecordClick === void 0 || onRecordClick(record);
|
|
};
|
|
return /*#__PURE__*/React.createElement("div", {
|
|
className: componentName,
|
|
key: id,
|
|
onClick: handleClick,
|
|
style: style
|
|
}, /*#__PURE__*/React.createElement(Card, _extends({
|
|
cover: /*#__PURE__*/React.createElement("img", {
|
|
alt: "\u9884\u8B66\u56FE",
|
|
src: imgSrc,
|
|
style: _objectSpread({
|
|
width: 336,
|
|
height: 203,
|
|
borderRadius: 0
|
|
}, imgStyle)
|
|
}),
|
|
style: _objectSpread(_objectSpread({
|
|
width: 356,
|
|
height: 302,
|
|
padding: 10,
|
|
borderRadius: 4
|
|
}, selectedCardStyle), cardStyle)
|
|
}, cardProps), /*#__PURE__*/React.createElement("div", {
|
|
className: "left-context"
|
|
}, /*#__PURE__*/React.createElement("div", {
|
|
className: "warning-type"
|
|
}, warningType), /*#__PURE__*/React.createElement(Space, {
|
|
size: 0,
|
|
split: /*#__PURE__*/React.createElement(Divider, {
|
|
type: "vertical"
|
|
})
|
|
}, warningInfo === null || warningInfo === void 0 ? void 0 : warningInfo.map(function (item, index) {
|
|
return /*#__PURE__*/React.createElement("div", {
|
|
key: index,
|
|
className: "info-item"
|
|
}, item);
|
|
})), /*#__PURE__*/React.createElement("div", {
|
|
className: "warning-time"
|
|
}, warningTimeShow)), /*#__PURE__*/React.createElement("div", {
|
|
className: "cabietInfo"
|
|
}, cabietText)));
|
|
};
|
|
export default WarningRecordCard; |