deviceMaintainDetail.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. import PageContent from '@/components/PageContent';
  2. import { Table } from 'antd';
  3. import dayjs from 'dayjs';
  4. import ReactZmage from 'react-zmage';
  5. import styles from './detail.less';
  6. const {
  7. DeviceCode,
  8. DeviceName,
  9. MaintainTime,
  10. EvaluationScore,
  11. Operators,
  12. RustRemoval,
  13. AntiCorrosive,
  14. MaterialConsumption,
  15. Fasten,
  16. Clean,
  17. Lubrication,
  18. Check,
  19. Note,
  20. Files = [],
  21. } = JSON.parse(localStorage.maintain || '{}');
  22. export default function DeviceMaintainDetail() {
  23. const columns = [
  24. {
  25. title: '保养资料',
  26. dataIndex: 'Name',
  27. render: (text, item) => {
  28. return (
  29. <ReactZmage
  30. controller={{
  31. // 关闭按钮
  32. close: true,
  33. // 缩放按钮
  34. zoom: false,
  35. // 下载按钮
  36. download: false,
  37. // 翻页按钮
  38. flip: false,
  39. // 多页指示
  40. pagination: false,
  41. }}
  42. backdrop="rgba(255,255,255,0.5)"
  43. style={{ width: '3.5rem' }}
  44. src={item.Url}
  45. />
  46. );
  47. },
  48. },
  49. {
  50. title: '创建时间',
  51. dataIndex: 'CreatedTime',
  52. render: (text) => {
  53. return text ? dayjs(text).format('YYYY年MM月DD日 HH:mm:ss') : null;
  54. },
  55. },
  56. ];
  57. function getUser(params) {
  58. let arr = [];
  59. if (!params) {
  60. return;
  61. } else {
  62. return (arr = params
  63. .map((item) => {
  64. return item.Operator?.CName;
  65. })
  66. .join(','));
  67. }
  68. }
  69. return (
  70. <PageContent closeable={false}>
  71. <div className={styles.detailBox}>
  72. <span>
  73. <label>设备位号:</label>
  74. {DeviceCode}
  75. </span>
  76. <span>
  77. <label>设备名称:</label>
  78. {DeviceName}
  79. </span>
  80. <span>
  81. <label>保养人:</label>
  82. {getUser(Operators)}
  83. </span>
  84. <span>
  85. <label>物料消耗:</label>
  86. {MaterialConsumption}
  87. </span>
  88. <span>
  89. <label>保养日期:</label>
  90. {MaintainTime}
  91. </span>
  92. <span>
  93. <label>是否润滑加油:</label>
  94. {Lubrication === 1 ? '是' : '否'}
  95. </span>
  96. <span>
  97. <label>是否拆检:</label>
  98. {Check === 1 ? '是' : '否'}
  99. </span>
  100. <span>
  101. <label>是否清洁:</label>
  102. {Clean === 1 ? '是' : '否'}
  103. </span>
  104. <span>
  105. <label>是否紧固:</label>
  106. {Fasten === 1 ? '是' : '否'}
  107. </span>
  108. <span>
  109. <label>是否除锈:</label>
  110. {RustRemoval === 1 ? '是' : '否'}
  111. </span>
  112. <span>
  113. <label>是否防腐:</label>
  114. {AntiCorrosive === 1 ? '是' : '否'}
  115. </span>
  116. <span>
  117. <label>评估分数:</label>
  118. {EvaluationScore * 100}
  119. </span>
  120. <span>
  121. <label>保养备注:</label>
  122. {Note?.split('|').map((item) => (
  123. <div>{item}</div>
  124. ))}
  125. </span>
  126. </div>
  127. <Table
  128. style={{ marginTop: '0.1rem' }}
  129. dataSource={Files}
  130. columns={columns}
  131. pagination={false}
  132. />
  133. </PageContent>
  134. );
  135. }