@cqsjjb/jjb-react-admin-component 3.0.23 → 3.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,12 +2,12 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
2
2
  import React from 'react';
3
3
  import { tools } from '@cqsjjb/jjb-common-lib';
4
4
  import { FilePdfOutlined, LinkOutlined } from '@ant-design/icons';
5
- import { Modal, Descriptions, Empty, Image, Tooltip, Tag, Spin } from 'antd';
5
+ import { Modal, Descriptions, Empty, Image, Tooltip, Tag, Spin, Table } from 'antd';
6
6
  const formilyItemMargin = new Map([['small', 8], ['middle', 12], ['default', 16]]);
7
7
  export default function FormilyDescriptions(props) {
8
8
  const [regions, setRegions] = React.useState([]);
9
9
  React.useEffect(() => {
10
- fetch(`${window.location.origin}/system/operation/regions`, {
10
+ fetch(`${window.process.env.app.API_HOST}/system/operation/regions`, {
11
11
  headers: {
12
12
  token: sessionStorage.token
13
13
  }
@@ -34,6 +34,7 @@ export default function FormilyDescriptions(props) {
34
34
  return {
35
35
  key: childIndex,
36
36
  label: child.name,
37
+ span: child.formType === 'Table' ? props.column : 1,
37
38
  children: /*#__PURE__*/React.createElement(ItemRender, _extends({
38
39
  data: child
39
40
  }, props))
@@ -64,7 +65,15 @@ function ItemRender(props) {
64
65
  imageHeight,
65
66
  imagePreview
66
67
  } = props;
67
- return /*#__PURE__*/React.createElement(React.Fragment, null, tools.isArray(data.value) ? tools.isStringArray(data.value) || tools.isNumberArray(data.value) ? data.value.join('、') : tools.isObjectArray(data.value) ? /*#__PURE__*/React.createElement("div", null, data.value.map((next, nextIndex) => {
68
+ return /*#__PURE__*/React.createElement(React.Fragment, null, tools.isArray(data.value) ? tools.isStringArray(data.value) || tools.isNumberArray(data.value) ? data.value.join('、') : tools.isObjectArray(data.value) ? data.formType === 'Table' ? /*#__PURE__*/React.createElement("div", {
69
+ style: {
70
+ width: '100%'
71
+ }
72
+ }, /*#__PURE__*/React.createElement(Table, {
73
+ columns: data.enumList,
74
+ dataSource: data.value,
75
+ pagination: false
76
+ })) : /*#__PURE__*/React.createElement("div", null, data.value.map((next, nextIndex) => {
68
77
  if (next.url) {
69
78
  if (next.isImage) {
70
79
  return /*#__PURE__*/React.createElement("span", {
@@ -2,7 +2,7 @@ import React from 'react';
2
2
 
3
3
  import { tools } from '@cqsjjb/jjb-common-lib';
4
4
  import { FilePdfOutlined, LinkOutlined } from '@ant-design/icons';
5
- import { Modal, Descriptions, Empty, Image, Tooltip, Tag, Spin } from 'antd';
5
+ import { Modal, Descriptions, Empty, Image, Tooltip, Tag, Spin, Table } from 'antd';
6
6
 
7
7
  const formilyItemMargin = new Map([
8
8
  [ 'small', 8 ],
@@ -14,7 +14,7 @@ export default function FormilyDescriptions(props) {
14
14
  const [ regions, setRegions ] = React.useState([]);
15
15
 
16
16
  React.useEffect(() => {
17
- fetch(`${window.location.origin}/system/operation/regions`, { headers: { token: sessionStorage.token } }).then(res => res.json()).then(res => {
17
+ fetch(`${window.process.env.app.API_HOST}/system/operation/regions`, { headers: { token: sessionStorage.token } }).then(res => res.json()).then(res => {
18
18
  if (res.success) {
19
19
  setRegions(res.data);
20
20
  }
@@ -44,6 +44,9 @@ export default function FormilyDescriptions(props) {
44
44
  return {
45
45
  key: childIndex,
46
46
  label: child.name,
47
+ span: child.formType === 'Table'
48
+ ? props.column
49
+ : 1,
47
50
  children: (
48
51
  <ItemRender data={child} {...props} />
49
52
  )
@@ -87,73 +90,83 @@ function ItemRender(props) {
87
90
  ? (tools.isStringArray(data.value) || tools.isNumberArray(data.value))
88
91
  ? data.value.join('、')
89
92
  : tools.isObjectArray(data.value)
90
- ? (
91
- <div>
92
- {data.value.map((next, nextIndex) => {
93
- if (next.url) {
94
- if (next.isImage) {
95
- return (
96
- <span
97
- key={nextIndex}
98
- style={{
99
- display: 'inline-block',
100
- marginRight: 4,
101
- marginBottom: 4
102
- }}
103
- >
104
- <Image
105
- src={next.url}
106
- width={imageWidth || 64}
107
- height={imageHeight || 64}
108
- preview={imagePreview}
109
- />
110
- </span>
111
- );
93
+ ? data.formType === 'Table'
94
+ ? (
95
+ <div style={{ width: '100%' }}>
96
+ <Table
97
+ columns={data.enumList}
98
+ dataSource={data.value}
99
+ pagination={false}
100
+ />
101
+ </div>
102
+ )
103
+ : (
104
+ <div>
105
+ {data.value.map((next, nextIndex) => {
106
+ if (next.url) {
107
+ if (next.isImage) {
108
+ return (
109
+ <span
110
+ key={nextIndex}
111
+ style={{
112
+ display: 'inline-block',
113
+ marginRight: 4,
114
+ marginBottom: 4
115
+ }}
116
+ >
117
+ <Image
118
+ src={next.url}
119
+ width={imageWidth || 64}
120
+ height={imageHeight || 64}
121
+ preview={imagePreview}
122
+ />
123
+ </span>
124
+ );
125
+ } else {
126
+ return (
127
+ <Tooltip title={next.url}>
128
+ {/\.pdf$/.test(next.url)
129
+ ? (
130
+ <a
131
+ key={nextIndex}
132
+ style={{
133
+ gap: 4,
134
+ display: 'flex',
135
+ alignItems: 'center'
136
+ }}
137
+ onClick={() => {
138
+ setOpen(true);
139
+ setPreviewUrl(next.url);
140
+ }}
141
+ >
142
+ <FilePdfOutlined />
143
+ 点击查看
144
+ </a>
145
+ )
146
+ : (
147
+ <a
148
+ key={nextIndex}
149
+ href={next.url}
150
+ style={{
151
+ gap: 4,
152
+ display: 'flex',
153
+ alignItems: 'center'
154
+ }}
155
+ target="_blank"
156
+ >
157
+ <LinkOutlined />
158
+ 点击下载
159
+ </a>
160
+ )}
161
+ </Tooltip>
162
+ );
163
+ }
112
164
  } else {
113
- return (
114
- <Tooltip title={next.url}>
115
- {/\.pdf$/.test(next.url)
116
- ? (
117
- <a
118
- key={nextIndex}
119
- style={{
120
- gap: 4,
121
- display: 'flex',
122
- alignItems: 'center'
123
- }}
124
- onClick={() => {
125
- setOpen(true);
126
- setPreviewUrl(next.url);
127
- }}
128
- >
129
- <FilePdfOutlined />
130
- 点击查看
131
- </a>
132
- )
133
- : (
134
- <a
135
- key={nextIndex}
136
- href={next.url}
137
- style={{
138
- gap: 4,
139
- display: 'flex',
140
- alignItems: 'center'
141
- }}
142
- target="_blank"
143
- >
144
- <LinkOutlined />
145
- 点击下载
146
- </a>
147
- )}
148
- </Tooltip>
149
- );
165
+ return tools.textPlaceholder(next.name);
150
166
  }
151
- } else {
152
- return tools.textPlaceholder(next.name);
153
- }
154
- })}
155
- </div>
156
- )
167
+ })}
168
+ </div>
169
+ )
157
170
  : tools.textPlaceholder()
158
171
  : (
159
172
  <RenderText
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cqsjjb/jjb-react-admin-component",
3
- "version": "3.0.23",
3
+ "version": "3.0.25",
4
4
  "description": "jjb-react-admin-组件库@new",
5
5
  "main": "index.js",
6
6
  "author": "jjb-front-team",