xydata-tools 1.0.0 → 1.0.1
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.
- package/README.md +1 -0
- package/package.json +4 -1
- package/.babelrc +0 -3
- package/rollup.config.mjs +0 -43
- package/src/assets/empty.png +0 -0
- package/src/components/Dictionary/components/UpdateForm.jsx +0 -111
- package/src/components/Dictionary/index.jsx +0 -255
- package/src/components/Dictionary/index.less +0 -3
- package/src/index.js +0 -7
- package/src/services/service.js +0 -18
- package/src/utils/request.js +0 -37
- package/src/utils/set-service.js +0 -10
- package/src/utils/token.js +0 -23
- package/src/utils/utils.less +0 -51
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# 鑫义科技前端开发者工具包
|
package/package.json
CHANGED
package/.babelrc
DELETED
package/rollup.config.mjs
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import babel from 'rollup-plugin-babel'
|
|
2
|
-
import postcss from 'rollup-plugin-postcss'
|
|
3
|
-
import resolve from 'rollup-plugin-node-resolve';
|
|
4
|
-
import alias from "@rollup/plugin-alias";
|
|
5
|
-
import terser from '@rollup/plugin-terser';
|
|
6
|
-
import url from 'rollup-plugin-url';
|
|
7
|
-
import image from 'rollup-plugin-image';
|
|
8
|
-
|
|
9
|
-
export default {
|
|
10
|
-
input: './src/index.js',
|
|
11
|
-
output: {
|
|
12
|
-
file: './lib/bundle.js',
|
|
13
|
-
// 输出类型 (amd, cjs, es, iife, umd, system):
|
|
14
|
-
// iife——最早的模块,jQuery时代流行,封装成一个自执行函数,缺点是污染全局变量,且需手动维护script标签加载顺序
|
|
15
|
-
// cjs——即CommonJS,解决了以上问题,但只运行在node.js环境,不支持浏览器。
|
|
16
|
-
// amd——通过requirejs实现,支持浏览器,解决了前面所有问题,但写法复杂,可读性很差,不符合通用的模块化思维
|
|
17
|
-
// umd——兼容了cjs和amd,但产生了更难理解的代码,包也增大
|
|
18
|
-
// system——面向未来的模块依赖方式,微前端流行
|
|
19
|
-
// es——现代化标准
|
|
20
|
-
format: 'es'
|
|
21
|
-
},
|
|
22
|
-
plugins: [
|
|
23
|
-
url(),
|
|
24
|
-
resolve(),
|
|
25
|
-
postcss(),
|
|
26
|
-
alias({
|
|
27
|
-
entries: [
|
|
28
|
-
{ find: '@', replacement: 'src' }
|
|
29
|
-
]
|
|
30
|
-
}),
|
|
31
|
-
image({
|
|
32
|
-
output: `lib/images`, // 打包后的文件
|
|
33
|
-
extensions: /\.(png|jpg|jpeg|gif|svg)$/,
|
|
34
|
-
limit: 8192, // 文件大小的限制(字节)。当一个文件没有超过限制时,它将被转换为 base64字符串,否则,它将被复制到output下
|
|
35
|
-
exclude: 'node_modules/**'
|
|
36
|
-
}),
|
|
37
|
-
babel(),
|
|
38
|
-
terser(),
|
|
39
|
-
],
|
|
40
|
-
// 以下模块都为外部引用(不会打包进包里)
|
|
41
|
-
external: ['antd', '@ant-design/icons', '@ant-design/pro-table', 'umi-request', 'react', 'react-dom']
|
|
42
|
-
}
|
|
43
|
-
|
package/src/assets/empty.png
DELETED
|
Binary file
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { Form, Input, Modal, TreeSelect } from "antd";
|
|
2
|
-
import React from "react";
|
|
3
|
-
|
|
4
|
-
const FormItem = Form.Item;
|
|
5
|
-
const formLayout = {
|
|
6
|
-
labelCol: {
|
|
7
|
-
span: 7,
|
|
8
|
-
},
|
|
9
|
-
wrapperCol: {
|
|
10
|
-
span: 13,
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const UpdateForm = (props) => {
|
|
15
|
-
const [form] = Form.useForm();
|
|
16
|
-
const {
|
|
17
|
-
onSubmit: handleUpdate,
|
|
18
|
-
onCancel: handleUpdateModalVisible,
|
|
19
|
-
updateModalVisible,
|
|
20
|
-
values,
|
|
21
|
-
type,
|
|
22
|
-
treeData,
|
|
23
|
-
} = props;
|
|
24
|
-
|
|
25
|
-
const handleSave = async () => {
|
|
26
|
-
const fieldsValue = await form.validateFields();
|
|
27
|
-
if (type === "U") {
|
|
28
|
-
handleUpdate({ ...values, ...fieldsValue });
|
|
29
|
-
} else {
|
|
30
|
-
handleUpdate(fieldsValue);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
const renderContent = () => {
|
|
34
|
-
return (
|
|
35
|
-
<>
|
|
36
|
-
<FormItem name="parentId" label="父级">
|
|
37
|
-
<TreeSelect
|
|
38
|
-
style={{ width: "100%" }}
|
|
39
|
-
dropdownStyle={{ maxHeight: 400, overflow: "auto" }}
|
|
40
|
-
treeData={treeData}
|
|
41
|
-
treeDefaultExpandedKeys={[values.parentId || "-1"]}
|
|
42
|
-
showSearch
|
|
43
|
-
filterTreeNode={(inputValue, treeNode) => {
|
|
44
|
-
return treeNode.dictName.includes(inputValue);
|
|
45
|
-
}}
|
|
46
|
-
/>
|
|
47
|
-
</FormItem>
|
|
48
|
-
<FormItem
|
|
49
|
-
name="dictName"
|
|
50
|
-
label="字典名称"
|
|
51
|
-
rules={[
|
|
52
|
-
{
|
|
53
|
-
required: true,
|
|
54
|
-
message: "请输入字典表名!",
|
|
55
|
-
whitespace: true,
|
|
56
|
-
},
|
|
57
|
-
]}
|
|
58
|
-
>
|
|
59
|
-
<Input />
|
|
60
|
-
</FormItem>
|
|
61
|
-
|
|
62
|
-
<FormItem
|
|
63
|
-
name="dictCode"
|
|
64
|
-
label="字典编码"
|
|
65
|
-
rules={[
|
|
66
|
-
{
|
|
67
|
-
required: true,
|
|
68
|
-
message: "请输入字典值!",
|
|
69
|
-
whitespace: true,
|
|
70
|
-
},
|
|
71
|
-
]}
|
|
72
|
-
>
|
|
73
|
-
<Input disabled={type === "U"} />
|
|
74
|
-
</FormItem>
|
|
75
|
-
<FormItem name="remark" label="备注">
|
|
76
|
-
<Input />
|
|
77
|
-
</FormItem>
|
|
78
|
-
</>
|
|
79
|
-
);
|
|
80
|
-
};
|
|
81
|
-
return (
|
|
82
|
-
<Modal
|
|
83
|
-
getContainer={() => top.document.body}
|
|
84
|
-
maskClosable={false}
|
|
85
|
-
width={640}
|
|
86
|
-
bodyStyle={{
|
|
87
|
-
padding: "32px 40px 48px",
|
|
88
|
-
}}
|
|
89
|
-
destroyOnClose
|
|
90
|
-
title={type === "C" ? "新增数据字典" : "编辑数据字典"}
|
|
91
|
-
open={updateModalVisible}
|
|
92
|
-
onOk={() => handleSave()}
|
|
93
|
-
onCancel={() => handleUpdateModalVisible()}
|
|
94
|
-
>
|
|
95
|
-
<Form
|
|
96
|
-
{...formLayout}
|
|
97
|
-
form={form}
|
|
98
|
-
initialValues={{
|
|
99
|
-
parentId: values?.parentId || "-1",
|
|
100
|
-
dictName: values?.dictName,
|
|
101
|
-
dictCode: values?.dictCode,
|
|
102
|
-
remark: values?.remark,
|
|
103
|
-
}}
|
|
104
|
-
>
|
|
105
|
-
{renderContent()}
|
|
106
|
-
</Form>
|
|
107
|
-
</Modal>
|
|
108
|
-
);
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
export default UpdateForm;
|
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
import { PlusOutlined } from "@ant-design/icons";
|
|
2
|
-
import ProTable from "@ant-design/pro-table";
|
|
3
|
-
import { ROOT_ID, toTree } from "@zhengxs/js.tree";
|
|
4
|
-
import { Button, ConfigProvider, Divider, Empty, Popconfirm, message } from "antd";
|
|
5
|
-
import React, { useRef, useState } from "react";
|
|
6
|
-
import { addApi, queryApi, removeApi, updateApi } from "@/services/service.js";
|
|
7
|
-
import UpdateForm from "./components/UpdateForm.jsx";
|
|
8
|
-
import emptyPng from "../../assets/empty.png";
|
|
9
|
-
|
|
10
|
-
const customizeRenderEmpty = () => <Empty image={emptyPng} />;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* 添加
|
|
14
|
-
* @param fields
|
|
15
|
-
*/
|
|
16
|
-
const handleAdd = async (fields, type) => {
|
|
17
|
-
const hide = message.loading("正在添加");
|
|
18
|
-
|
|
19
|
-
const res = type === "C" ? await addApi({ ...fields }) : await updateApi({ ...fields });
|
|
20
|
-
// //console.log(res)
|
|
21
|
-
hide();
|
|
22
|
-
if (res) {
|
|
23
|
-
message.success("操作成功!");
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* 删除
|
|
30
|
-
* @param selectedRows
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
const handleRemove = async (record) => {
|
|
34
|
-
let isSuccess = false;
|
|
35
|
-
// const hide = message.loading('正在删除');
|
|
36
|
-
const res = await removeApi(record);
|
|
37
|
-
if (res.rspCode === "000000") {
|
|
38
|
-
message.loading("正在删除");
|
|
39
|
-
message.success("删除成功,正在刷新");
|
|
40
|
-
isSuccess = true;
|
|
41
|
-
} else {
|
|
42
|
-
message.error(res.rspMsg);
|
|
43
|
-
isSuccess = false;
|
|
44
|
-
}
|
|
45
|
-
return isSuccess;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const DictionaryList = () => {
|
|
49
|
-
const [createModalVisible, handleModalVisible] = useState(false);
|
|
50
|
-
const [currentItem, setCurrentItem] = useState({});
|
|
51
|
-
const [originalData, setOriginalData] = useState([]);
|
|
52
|
-
const [treeData, setTreeData] = useState([]);
|
|
53
|
-
const [modalType, setModalType] = useState("C");
|
|
54
|
-
|
|
55
|
-
const actionRef = useRef();
|
|
56
|
-
|
|
57
|
-
const createAndUpdate = async (type, record) => {
|
|
58
|
-
// type = U编辑 C新增
|
|
59
|
-
// if (type === 'U') {
|
|
60
|
-
// //本级及下级所有子节点均不可选择
|
|
61
|
-
// const selectItems = await getData({ dictName: record.dictName, include: true });
|
|
62
|
-
// const newData = JSON.parse(JSON.stringify(originalData));
|
|
63
|
-
// newData.forEach((item, i) => {
|
|
64
|
-
// selectItems.forEach((ele) => {
|
|
65
|
-
// if (item.id === ele.id) {
|
|
66
|
-
// item.disabled = true;
|
|
67
|
-
// }
|
|
68
|
-
// });
|
|
69
|
-
// });
|
|
70
|
-
// setTreeData(rowTotree(newData));
|
|
71
|
-
// } else {
|
|
72
|
-
setTreeData(rowTotree(originalData));
|
|
73
|
-
// }
|
|
74
|
-
setModalType(type);
|
|
75
|
-
setCurrentItem(record);
|
|
76
|
-
handleModalVisible(true);
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const handleCancel = () => {
|
|
80
|
-
handleModalVisible(false);
|
|
81
|
-
setCurrentItem({});
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
const getData = async (params) => {
|
|
85
|
-
const res = await queryApi(params);
|
|
86
|
-
//console.log(res);
|
|
87
|
-
if (res) {
|
|
88
|
-
return res.data;
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
const rowTotree = (dataList) => {
|
|
93
|
-
return toTree(dataList, {
|
|
94
|
-
// 如果 parentId 为 null 或 undefined 会合并一起
|
|
95
|
-
// 使用 ROOT_ID 作为 key 保存
|
|
96
|
-
// 支持函数,动态返回
|
|
97
|
-
root: ROOT_ID,
|
|
98
|
-
|
|
99
|
-
// lodash 版本,支持 path, 如: nested.id
|
|
100
|
-
idKey: "id", // 可选,默认: id
|
|
101
|
-
|
|
102
|
-
// lodash 版本,支持 path, 如: nested.parentId
|
|
103
|
-
parentKey: "parentId", // 可选,默认:parentId
|
|
104
|
-
|
|
105
|
-
// 挂载子级的属性名称,默认:children
|
|
106
|
-
childrenKey: "children",
|
|
107
|
-
|
|
108
|
-
// 数据添加进 children 数组前的处理,可选
|
|
109
|
-
transform(data) {
|
|
110
|
-
// 通过浅拷贝避免修改原始数据
|
|
111
|
-
// 可以在这里动态添加属性
|
|
112
|
-
const isTop = dataList.some((x) => x.id === "-1");
|
|
113
|
-
!isTop && data.parentId === "-1" && (data.parentId = null);
|
|
114
|
-
return {
|
|
115
|
-
...data,
|
|
116
|
-
title: data.dictName,
|
|
117
|
-
value: data.id,
|
|
118
|
-
value: data.id,
|
|
119
|
-
};
|
|
120
|
-
},
|
|
121
|
-
});
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
const deepData = (list) => {
|
|
125
|
-
list.forEach((item) => {
|
|
126
|
-
if (item?.children?.length > 0) {
|
|
127
|
-
deepData(item.children);
|
|
128
|
-
} else {
|
|
129
|
-
delete item.children;
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
const columns = [
|
|
135
|
-
{
|
|
136
|
-
title: "字典名称",
|
|
137
|
-
dataIndex: "dictName",
|
|
138
|
-
search: true,
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
title: "字典编码",
|
|
142
|
-
dataIndex: "dictCode",
|
|
143
|
-
search: false,
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
title: "备注",
|
|
147
|
-
dataIndex: "remark",
|
|
148
|
-
search: false,
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
title: "操作",
|
|
152
|
-
dataIndex: "option",
|
|
153
|
-
valueType: "option",
|
|
154
|
-
render: (_, record) =>
|
|
155
|
-
record.dictName !== "BASE_DICT_ROOT" && (
|
|
156
|
-
<>
|
|
157
|
-
<a onClick={() => createAndUpdate("U", record)}>编辑</a>
|
|
158
|
-
<Divider type="vertical" />
|
|
159
|
-
<Popconfirm
|
|
160
|
-
title="确定删除吗?"
|
|
161
|
-
onConfirm={async () => {
|
|
162
|
-
const success = await handleRemove(record);
|
|
163
|
-
//console.log('🚀 ~ file: index.jsx ~ line 143 ~ onConfirm={ ~ success', success);
|
|
164
|
-
//console.log(actionRef.current)
|
|
165
|
-
if (success && actionRef.current) {
|
|
166
|
-
await actionRef.current.reset();
|
|
167
|
-
await actionRef.current.reload();
|
|
168
|
-
}
|
|
169
|
-
}}
|
|
170
|
-
>
|
|
171
|
-
<a href="#" className="ant-btn-dangerous">
|
|
172
|
-
删除
|
|
173
|
-
</a>
|
|
174
|
-
</Popconfirm>
|
|
175
|
-
</>
|
|
176
|
-
),
|
|
177
|
-
},
|
|
178
|
-
];
|
|
179
|
-
return (
|
|
180
|
-
<div>
|
|
181
|
-
<ConfigProvider renderEmpty={customizeRenderEmpty}>
|
|
182
|
-
<ProTable
|
|
183
|
-
headerTitle="列表"
|
|
184
|
-
actionRef={actionRef}
|
|
185
|
-
rowKey="id"
|
|
186
|
-
defaultExpandedRowKeys={["-1"]}
|
|
187
|
-
toolBarRender={() => [
|
|
188
|
-
<Button type="primary" onClick={() => createAndUpdate("C", {})}>
|
|
189
|
-
<PlusOutlined /> 新建
|
|
190
|
-
</Button>,
|
|
191
|
-
]}
|
|
192
|
-
beforeSearchSubmit={(params) => {
|
|
193
|
-
const { dictName } = params;
|
|
194
|
-
const obj = {
|
|
195
|
-
dictName: dictName || "",
|
|
196
|
-
include: true,
|
|
197
|
-
allTree: true,
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
return obj;
|
|
201
|
-
}}
|
|
202
|
-
params={{}}
|
|
203
|
-
request={async (params = {}) => {
|
|
204
|
-
const res = await queryApi({ ...params, include: true });
|
|
205
|
-
if (res) {
|
|
206
|
-
res.data.map((item) => {
|
|
207
|
-
if (item.dictName === params.dictName) {
|
|
208
|
-
item.parentId = null;
|
|
209
|
-
}
|
|
210
|
-
return item;
|
|
211
|
-
});
|
|
212
|
-
setOriginalData(res.data);
|
|
213
|
-
const handleRes = rowTotree(res.data);
|
|
214
|
-
deepData(handleRes);
|
|
215
|
-
return {
|
|
216
|
-
data: handleRes,
|
|
217
|
-
success: true,
|
|
218
|
-
};
|
|
219
|
-
} else {
|
|
220
|
-
//console.error(res);
|
|
221
|
-
return {
|
|
222
|
-
data: [],
|
|
223
|
-
success: false,
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
}}
|
|
227
|
-
columns={columns}
|
|
228
|
-
rowSelection={false}
|
|
229
|
-
/>
|
|
230
|
-
</ConfigProvider>
|
|
231
|
-
{/* 新建 | 编辑 组件 */}
|
|
232
|
-
{createModalVisible ? (
|
|
233
|
-
<UpdateForm
|
|
234
|
-
onSubmit={async (value) => {
|
|
235
|
-
const success = await handleAdd(value, modalType);
|
|
236
|
-
|
|
237
|
-
if (success) {
|
|
238
|
-
handleCancel();
|
|
239
|
-
if (actionRef.current) {
|
|
240
|
-
actionRef.current.reload();
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}}
|
|
244
|
-
onCancel={handleCancel}
|
|
245
|
-
type={modalType}
|
|
246
|
-
updateModalVisible={createModalVisible}
|
|
247
|
-
values={currentItem}
|
|
248
|
-
treeData={treeData}
|
|
249
|
-
/>
|
|
250
|
-
) : null}
|
|
251
|
-
</div>
|
|
252
|
-
);
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
export default DictionaryList;
|
package/src/index.js
DELETED
package/src/services/service.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import doRequest from '@/utils/request.js';
|
|
2
|
-
|
|
3
|
-
//查询字典
|
|
4
|
-
export async function queryApi(params) {
|
|
5
|
-
return doRequest('/api/dict/queryBaseDictList', "POST", params);
|
|
6
|
-
}
|
|
7
|
-
//删除字典
|
|
8
|
-
export async function removeApi(params) {
|
|
9
|
-
return doRequest('/api/dict/deleteBaseDict', 'POST', params);
|
|
10
|
-
}
|
|
11
|
-
//添加字典
|
|
12
|
-
export async function addApi(params) {
|
|
13
|
-
return doRequest('/api/dict/createBaseDict', 'POST', params);
|
|
14
|
-
}
|
|
15
|
-
//更新字典
|
|
16
|
-
export async function updateApi(params) {
|
|
17
|
-
return doRequest('/api/dict/updateBaseDict', 'POST', params);
|
|
18
|
-
}
|
package/src/utils/request.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import request from 'umi-request';
|
|
2
|
-
import { message } from 'antd';
|
|
3
|
-
import { getSessionStorage } from '@/utils/token.js';
|
|
4
|
-
|
|
5
|
-
export default async function doRequest(url, method, data, params) {
|
|
6
|
-
const headers = {
|
|
7
|
-
SID: SID,
|
|
8
|
-
Authorization: getSessionStorage(),
|
|
9
|
-
UserId: getSessionStorage('userId'),
|
|
10
|
-
OrgId: getSessionStorage('orgId'),
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
return request(url, {
|
|
14
|
-
method, params, data, headers: {
|
|
15
|
-
...headers,
|
|
16
|
-
service: getSessionStorage('service') || 'unknow',
|
|
17
|
-
},
|
|
18
|
-
getResponse: true,
|
|
19
|
-
})
|
|
20
|
-
.then(function ({ data, }) {
|
|
21
|
-
if (data.rspCode === '000000') {
|
|
22
|
-
return data
|
|
23
|
-
} else {
|
|
24
|
-
message.error(data.rspMsg)
|
|
25
|
-
return data
|
|
26
|
-
}
|
|
27
|
-
})
|
|
28
|
-
.catch(async function (error) {
|
|
29
|
-
if (error.response.status === 401 || error.response.status === 402 || error.response.status === 403) {
|
|
30
|
-
let data = await error.response.json()
|
|
31
|
-
message.error(data.rspMsg)
|
|
32
|
-
} else {
|
|
33
|
-
message.error("服务器异常")
|
|
34
|
-
}
|
|
35
|
-
return error.response
|
|
36
|
-
});
|
|
37
|
-
}
|
package/src/utils/set-service.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { setSessionStorage, removeSessionStorage } from "./token.js"
|
|
2
|
-
|
|
3
|
-
export const registerService = function (service) {
|
|
4
|
-
return setSessionStorage('service', service)
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export const unRegisterService = function () {
|
|
8
|
-
return removeSessionStorage('service')
|
|
9
|
-
|
|
10
|
-
}
|
package/src/utils/token.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// 读取数据语法
|
|
2
|
-
export function getSessionStorage(key = 'Token') {
|
|
3
|
-
return sessionStorage.getItem(transformKey(key));
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
// 保存数据语法
|
|
7
|
-
export function setSessionStorage(key = 'Token', value) {
|
|
8
|
-
sessionStorage.setItem(transformKey(key), value);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// 删除指定键的数据
|
|
12
|
-
export function removeSessionStorage(key = 'Token') {
|
|
13
|
-
sessionStorage.removeItem(transformKey(key));
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// 删除所有数据
|
|
17
|
-
export function clearSessionStorage() {
|
|
18
|
-
sessionStorage.clear();
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function transformKey(key) {
|
|
22
|
-
return SID ? `${SID}_${key}` : key
|
|
23
|
-
}
|
package/src/utils/utils.less
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
.textOverflow() {
|
|
2
|
-
overflow: hidden;
|
|
3
|
-
white-space: nowrap;
|
|
4
|
-
text-overflow: ellipsis;
|
|
5
|
-
word-break: break-all;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.textOverflowMulti(@line: 3, @bg: #fff) {
|
|
9
|
-
position: relative;
|
|
10
|
-
max-height: @line * 1.5em;
|
|
11
|
-
margin-right: -1em;
|
|
12
|
-
padding-right: 1em;
|
|
13
|
-
overflow: hidden;
|
|
14
|
-
line-height: 1.5em;
|
|
15
|
-
text-align: justify;
|
|
16
|
-
&::before {
|
|
17
|
-
position: absolute;
|
|
18
|
-
right: 14px;
|
|
19
|
-
bottom: 0;
|
|
20
|
-
padding: 0 1px;
|
|
21
|
-
background: @bg;
|
|
22
|
-
content: '...';
|
|
23
|
-
}
|
|
24
|
-
&::after {
|
|
25
|
-
position: absolute;
|
|
26
|
-
right: 14px;
|
|
27
|
-
width: 1em;
|
|
28
|
-
height: 1em;
|
|
29
|
-
margin-top: 0.2em;
|
|
30
|
-
background: white;
|
|
31
|
-
content: '';
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// mixins for clearfix
|
|
36
|
-
// ------------------------
|
|
37
|
-
.clearfix() {
|
|
38
|
-
zoom: 1;
|
|
39
|
-
&::before,
|
|
40
|
-
&::after {
|
|
41
|
-
display: table;
|
|
42
|
-
content: ' ';
|
|
43
|
-
}
|
|
44
|
-
&::after {
|
|
45
|
-
clear: both;
|
|
46
|
-
height: 0;
|
|
47
|
-
font-size: 0;
|
|
48
|
-
visibility: hidden;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|