@scenetechnology/cj_element_table 0.0.17 → 0.0.18
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 +154 -13
- package/package.json +1 -1
- package/babel.config.js +0 -6
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -17
- package/src/App.vue +0 -60
- package/src/api/All.ts +0 -104
- package/src/assets/images/TablehederTool.png +0 -0
- package/src/assets/images/addIcon.png +0 -0
- package/src/assets/images/blue_lock.png +0 -0
- package/src/assets/images/changeIcon.png +0 -0
- package/src/assets/images/downImg.png +0 -0
- package/src/assets/images/kong_icon.png +0 -0
- package/src/assets/images/lbIcon.png +0 -0
- package/src/assets/images/lookImg.png +0 -0
- package/src/assets/images/model_title_icon.png +0 -0
- package/src/assets/images/pgIcon.png +0 -0
- package/src/assets/images/pzIcon.png +0 -0
- package/src/assets/images/tuozhui_icon.png +0 -0
- package/src/assets/images/view_save_icon.png +0 -0
- package/src/assets/images/view_setting_icon.png +0 -0
- package/src/assets/images/yaIcon.png +0 -0
- package/src/assets/logo.png +0 -0
- package/src/components/Dialog/index.ts +0 -3
- package/src/components/Dialog/src/Dialog.vue +0 -72
- package/src/components/HelloWorld.vue +0 -60
- package/src/components/Upload/index.vue +0 -287
- package/src/config/axios/config.ts +0 -123
- package/src/config/axios/index.ts +0 -48
- package/src/config/axios/service.ts +0 -118
- package/src/main.ts +0 -13
- package/src/router/index.ts +0 -16
- package/src/shims-vue.d.ts +0 -6
- package/tsconfig.json +0 -41
- package/vue.config.js +0 -33
package/README.md
CHANGED
|
@@ -1,24 +1,165 @@
|
|
|
1
1
|
# cj_element_table
|
|
2
2
|
|
|
3
|
-
##
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
## 项目概述
|
|
4
|
+
|
|
5
|
+
cj_element_table 是一个基于 Vue3 和 element plus 的表格组件项目。该项目提供了增强的表格功能,简化了表格的使用和配置。
|
|
6
|
+
|
|
7
|
+
## 安装说明
|
|
8
|
+
|
|
9
|
+
### 环境要求
|
|
10
|
+
- Node.js (建议 v16 或更高版本)
|
|
11
|
+
- Yarn 包管理器
|
|
7
12
|
|
|
8
|
-
###
|
|
13
|
+
### 安装步骤
|
|
14
|
+
|
|
15
|
+
1. 克隆或下载项目代码
|
|
16
|
+
2. 在项目根目录运行以下命令安装依赖:
|
|
9
17
|
```
|
|
10
|
-
npm
|
|
18
|
+
npm install @scenetechnology/cj_element_table --legacy-peer-deps
|
|
11
19
|
```
|
|
12
20
|
|
|
13
|
-
###
|
|
21
|
+
### 引入
|
|
22
|
+
|
|
23
|
+
1. 在main.js中 引入UI库 引入UI样式
|
|
14
24
|
```
|
|
15
|
-
|
|
25
|
+
import cj_element_table from '@scenetechnology/cj_element_table'
|
|
26
|
+
import '@scenetechnology/cj_element_table/dist/cj_element_table.css'
|
|
27
|
+
Vue.use(cj_element_table)
|
|
16
28
|
```
|
|
17
29
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
30
|
+
|
|
31
|
+
# TableComponent 组件使用文档
|
|
32
|
+
|
|
33
|
+
## 组件说明
|
|
34
|
+
TableComponent 是一个基于 Element Plus 的表格组件封装,提供了丰富的表格功能,包括数据展示、搜索、排序、导入导出等功能。
|
|
35
|
+
|
|
36
|
+
## 属性配置
|
|
37
|
+
|
|
38
|
+
### 基础属性
|
|
39
|
+
| 属性名 | 说明 | 类型 | 默认值 | 是否必填 |
|
|
40
|
+
| --- | --- | --- | --- | --- |
|
|
41
|
+
| tableData | 表格数据 | Object | {rows: [],total: 0} | 是 |
|
|
42
|
+
| columns | 表格列配置 | Array | - | 是 |
|
|
43
|
+
| routerName | 路由名称 | String | - | 是 |
|
|
44
|
+
| exportUrl | 导出表格数据接口 | String | - | 否 |
|
|
45
|
+
| templateUrl | 下载表格模板接口 | String | - | 否 |
|
|
46
|
+
| inputUrl | 导入表格数据接口 | String | - | 否 |
|
|
47
|
+
| exportXlsxName | 导出表格名称 | String | 路由名称 | 否 |
|
|
48
|
+
| showSelection | 是否显示表格多选框 | Boolean | true | 否 |
|
|
49
|
+
| showIndex | 是否显示表格序号 | Boolean | true | 否 |
|
|
50
|
+
| showInputButtons | 是否显示导入按钮 | Boolean | true | 否 |
|
|
51
|
+
| showOutputButtons | 是否显示导出按钮 | Boolean | true | 否 |
|
|
52
|
+
| showInputButtons | 是否显示列表设置按钮 | Boolean | true | 否 |
|
|
53
|
+
| showViewSettingButtons | 是否显示视图设置按钮 | Boolean | true | 否 |
|
|
54
|
+
| maxHeight | 表格最大高度 | number/string | 55vh | 否 |
|
|
55
|
+
| selecTableDisabledField | 表格多选框禁用条件 | Object | {key:'',value:''} 当表格row中的[key]字段等于value时禁用 | 否 |
|
|
56
|
+
| initialQuery | 初始化查询条件 | Object | {page: 1,rows: 10,total: 0,} | 否 |
|
|
57
|
+
| pageSizes | 分页大小选项 | Array | [10, 20, 30, 50] | 否 |
|
|
58
|
+
| colsPerRow | 每行的列数 | Number | 4 | 否 |
|
|
59
|
+
| headerCellStyle | 表头单元格样式 | Object | {background:'#f5f7fa',color:'#606266',fontWeight:'bold'} | 否 |
|
|
60
|
+
|
|
61
|
+
### columns 配置项说明
|
|
62
|
+
| 字段名 | 说明 | 类型 | 是否必填 | 默认值 | 可选值 |
|
|
63
|
+
| --- | --- | --- | --- | --- | --- |
|
|
64
|
+
| prop | 字段名称 | String | 是 | - | - |
|
|
65
|
+
| label | 显示标签 | String | 是 | - | - |
|
|
66
|
+
| search | 是否可搜索 | Boolean | 否 | false | true/false |
|
|
67
|
+
| searchType | 搜索类型 | String | 否 | - | select/date |
|
|
68
|
+
| require | 是否必填 | Boolean | 否 | false | true/false |
|
|
69
|
+
| options | 选项数组(当 searchType 为 select 时使用) | Array | 否 | - | - |
|
|
70
|
+
|
|
71
|
+
### columns 字段详细说明
|
|
72
|
+
```javascript
|
|
73
|
+
const columns = [
|
|
74
|
+
{
|
|
75
|
+
prop: 'name',
|
|
76
|
+
require: true,
|
|
77
|
+
label: '项目名称及规模',
|
|
78
|
+
search: true
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
prop: 'type',
|
|
82
|
+
label: '项目类型',
|
|
83
|
+
search: true,
|
|
84
|
+
require: true,
|
|
85
|
+
searchType: 'select',
|
|
86
|
+
options: [
|
|
87
|
+
{ value: 1, label: '新建' },
|
|
88
|
+
{ value: 2, label: '改建' },
|
|
89
|
+
{ value: 3, label: '扩建' },
|
|
90
|
+
{ value: 4, label: '技改(技术改造)' },
|
|
91
|
+
{ value: 5, label: '引进(技术引进)' }
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
prop: 'status',
|
|
96
|
+
label: '项目状态',
|
|
97
|
+
search: true,
|
|
98
|
+
require: true,
|
|
99
|
+
searchType: 'select',
|
|
100
|
+
options: [
|
|
101
|
+
{ value: 1, label: '取消' },
|
|
102
|
+
{ value: 2, label: '设立' },
|
|
103
|
+
{ value: 3, label: '设计' },
|
|
104
|
+
{ value: 4, label: '建设中' },
|
|
105
|
+
{ value: 5, label: '试生产' },
|
|
106
|
+
{ value: 6, label: '竣工验收' }
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
prop: 'save',
|
|
111
|
+
label: '是否提交',
|
|
112
|
+
require: true,
|
|
113
|
+
options: [
|
|
114
|
+
{ value: 1, label: '待提交' },
|
|
115
|
+
{ value: 2, label: '已提交' }
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
prop: 'report_date',
|
|
120
|
+
label: '报告时间',
|
|
121
|
+
search: true,
|
|
122
|
+
searchType: 'date'
|
|
123
|
+
}
|
|
124
|
+
]
|
|
21
125
|
```
|
|
22
126
|
|
|
23
|
-
|
|
24
|
-
|
|
127
|
+
## 事件
|
|
128
|
+
| 事件名 | 说明 | 回调参数 |
|
|
129
|
+
| --- | --- | --- |
|
|
130
|
+
| selection-change | 当选择项发生变化时会触发该事件 | selection: 已选择的行数据数组 |
|
|
131
|
+
| search | 当搜索条件发生变化时会触发该事件 | query: 搜索条件对象 |
|
|
132
|
+
|
|
133
|
+
## 插槽
|
|
134
|
+
| 插槽名 | 说明 |
|
|
135
|
+
| --- | --- |
|
|
136
|
+
| operation | 表格顶部操作区域 |
|
|
137
|
+
| columns | 自定义列操作栏 |
|
|
138
|
+
|
|
139
|
+
## 使用示例
|
|
140
|
+
```vue
|
|
141
|
+
<template>
|
|
142
|
+
<TableComponent
|
|
143
|
+
ref="tableRef"
|
|
144
|
+
:exportUrl="exportUrl"
|
|
145
|
+
:templateUrl="templateUrl"
|
|
146
|
+
:inputUrl="inputUrl"
|
|
147
|
+
:tableData="tableData"
|
|
148
|
+
:columns="columns"
|
|
149
|
+
@selection-change="handleSelectionChange"
|
|
150
|
+
@search="handleSearch"
|
|
151
|
+
>
|
|
152
|
+
<template #operation>
|
|
153
|
+
<el-button type="primary" @click="handleAdd">添加</el-button>
|
|
154
|
+
</template>
|
|
155
|
+
<template #columns>
|
|
156
|
+
<el-table-column label="操作" align="center" min-width="120">
|
|
157
|
+
<template #default="scope">
|
|
158
|
+
<el-button link type="primary" @click="handleEdit(scope.row)">编辑</el-button>
|
|
159
|
+
<el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button>
|
|
160
|
+
</template>
|
|
161
|
+
</el-table-column>
|
|
162
|
+
</template>
|
|
163
|
+
</TableComponent>
|
|
164
|
+
</template>
|
|
165
|
+
```
|
package/package.json
CHANGED
package/babel.config.js
DELETED
package/public/favicon.ico
DELETED
|
Binary file
|
package/public/index.html
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
6
|
-
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
|
7
|
-
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
|
8
|
-
<title><%= htmlWebpackPlugin.options.title %></title>
|
|
9
|
-
</head>
|
|
10
|
-
<body>
|
|
11
|
-
<noscript>
|
|
12
|
-
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
|
13
|
-
</noscript>
|
|
14
|
-
<div id="app"></div>
|
|
15
|
-
<!-- built files will be auto injected -->
|
|
16
|
-
</body>
|
|
17
|
-
</html>
|
package/src/App.vue
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div id="app">
|
|
3
|
-
<pro-table
|
|
4
|
-
ref="tableRef"
|
|
5
|
-
:tableData="tableData"
|
|
6
|
-
:columns="columns"
|
|
7
|
-
:showInputButtons="false"
|
|
8
|
-
:showOutputButtons="false"
|
|
9
|
-
routerName="Ceshirouter"
|
|
10
|
-
@selection-change="
|
|
11
|
-
(rows) => {
|
|
12
|
-
selectionRows = rows.ids
|
|
13
|
-
}
|
|
14
|
-
"
|
|
15
|
-
@search="handleSearch"></pro-table>
|
|
16
|
-
</div>
|
|
17
|
-
</template>
|
|
18
|
-
|
|
19
|
-
<script setup lang="ts">
|
|
20
|
-
import { ref } from 'vue';
|
|
21
|
-
import proTable from '../packages/components/index.vue'
|
|
22
|
-
const tableData = ref({})
|
|
23
|
-
const tableRef = ref()
|
|
24
|
-
const selectionRows = ref([])
|
|
25
|
-
const columns = ref([
|
|
26
|
-
{
|
|
27
|
-
prop: 'department_item_name',
|
|
28
|
-
label: '岗位名称',
|
|
29
|
-
search: true,
|
|
30
|
-
searchType: 'select',
|
|
31
|
-
searchKey:'department_item_id',
|
|
32
|
-
options: []
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
prop: 'department_name',
|
|
36
|
-
label: '所属部门',
|
|
37
|
-
search: true,
|
|
38
|
-
searchKey:'department_id',
|
|
39
|
-
searchType: 'select',
|
|
40
|
-
options: [] // 初始为空数组
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
prop: 'duty',
|
|
44
|
-
label: '岗位职责',
|
|
45
|
-
search: true
|
|
46
|
-
// searchType: 'datePicker',
|
|
47
|
-
// dataType:true,
|
|
48
|
-
//dataName:'sasss'
|
|
49
|
-
}
|
|
50
|
-
])
|
|
51
|
-
|
|
52
|
-
const handleSearch = (query) => {
|
|
53
|
-
// getSaftDutyList(query).then((res) => {
|
|
54
|
-
// tableData.value = res.data
|
|
55
|
-
// })
|
|
56
|
-
}
|
|
57
|
-
</script>
|
|
58
|
-
|
|
59
|
-
<style>
|
|
60
|
-
</style>
|
package/src/api/All.ts
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import request from '@/config/axios'
|
|
2
|
-
import { config } from '@/config/axios/config'
|
|
3
|
-
export const FieldGroup_index = (data: any) => {
|
|
4
|
-
return request.post({ url: '/FieldGroup/index', data })
|
|
5
|
-
}
|
|
6
|
-
export const FieldGroup_read = (data: any) => {
|
|
7
|
-
return request.post({ url: '/FieldGroup/read', data })
|
|
8
|
-
}
|
|
9
|
-
export const Field_read = (data: any) => {
|
|
10
|
-
return request.post({ url: '/Field/read', data })
|
|
11
|
-
}
|
|
12
|
-
export const FieldGroup_save = (data: any) => {
|
|
13
|
-
return request.post({ url: '/FieldGroup/save', data })
|
|
14
|
-
}
|
|
15
|
-
export const FieldGroup_update = (data: any) => {
|
|
16
|
-
return request.post({ url: '/FieldGroup/update', data })
|
|
17
|
-
}
|
|
18
|
-
export const Field_save = (data: any) => {
|
|
19
|
-
return request.post({ url: '/Field/save', data })
|
|
20
|
-
}
|
|
21
|
-
export const Field_update = (data: any) => {
|
|
22
|
-
return request.post({ url: '/Field/update', data })
|
|
23
|
-
}
|
|
24
|
-
export const Three_index = (data: any) => {
|
|
25
|
-
return request.post({ url: '/Three/index', data })
|
|
26
|
-
}
|
|
27
|
-
export const Three_save = (data: any) => {
|
|
28
|
-
return request.post({ url: '/Three/save', data })
|
|
29
|
-
}
|
|
30
|
-
export const Three_update = (data: any) => {
|
|
31
|
-
return request.post({ url: '/Three/update', data })
|
|
32
|
-
}
|
|
33
|
-
export const Three_delete = (data: any) => {
|
|
34
|
-
return request.post({ url: '/Three/delete', data })
|
|
35
|
-
}
|
|
36
|
-
export const Three_download = (data: any) => {
|
|
37
|
-
return request.post({ url: '/Three/download', data })
|
|
38
|
-
}
|
|
39
|
-
export const Three_import = (data: any) => {
|
|
40
|
-
return request.post({ url: '/Three/import', data })
|
|
41
|
-
}
|
|
42
|
-
export const Three_read = (data: any) => {
|
|
43
|
-
return request.post({ url: '/Three/read', data })
|
|
44
|
-
}
|
|
45
|
-
export const Three_save_field = (data: any) => {
|
|
46
|
-
return request.post({ url: '/Three/save_field', data })
|
|
47
|
-
}
|
|
48
|
-
export const Three_read_field = (data: any) => {
|
|
49
|
-
return request.post({ url: '/Three/read_field', data })
|
|
50
|
-
}
|
|
51
|
-
export const Field_sort = (data: any) => {
|
|
52
|
-
return request.post({ url: '/Field/sort', data })
|
|
53
|
-
}
|
|
54
|
-
export const FieldGroup_sort = (data: any) => {
|
|
55
|
-
return request.post({ url: '/FieldGroup/sort', data })
|
|
56
|
-
}
|
|
57
|
-
export const Field_delete = (data: any) => {
|
|
58
|
-
return request.post({ url: '/Field/delete', data })
|
|
59
|
-
}
|
|
60
|
-
export const FieldGroup_delete = (data: any) => {
|
|
61
|
-
return request.post({ url: '/FieldGroup/delete', data })
|
|
62
|
-
}
|
|
63
|
-
export const upload = (data: any) => {
|
|
64
|
-
return request.post({ url: '/File/upload', data })
|
|
65
|
-
}
|
|
66
|
-
export const config_config = (data: any) => {
|
|
67
|
-
return request.post({ url: `${config.simpUseUrl}/Config/config`, data })
|
|
68
|
-
}
|
|
69
|
-
export const config_read = (data: any) => {
|
|
70
|
-
return request.post({ url: `${config.simpUseUrl}/Config/config_read`, data })
|
|
71
|
-
}
|
|
72
|
-
export const FieldGroup_export = (data: any) => {
|
|
73
|
-
return request.post({ url: '/FieldGroup/export', data })
|
|
74
|
-
}
|
|
75
|
-
export const FieldGroup_import = (data: any) => {
|
|
76
|
-
return request.post({ url: '/FieldGroup/import', data })
|
|
77
|
-
}
|
|
78
|
-
export const Person_index = (data: any) => {
|
|
79
|
-
return request.post({ url: `${config.simpUrl}/simp/api/Person/index`, data })
|
|
80
|
-
}
|
|
81
|
-
export const File_update_all = (data: any) => {
|
|
82
|
-
return request.post({ url: `${config.simpUrl}/simp/api/File/update_all`, data })
|
|
83
|
-
}
|
|
84
|
-
export const UserQuery_index = (params: any) => {
|
|
85
|
-
return request.get({ url: `${config.simpUrl}/simp/api/UserQuery/index`, params })
|
|
86
|
-
}
|
|
87
|
-
export const UserQuery_update = (data: any) => {
|
|
88
|
-
return request.post({ url: `${config.simpUrl}/simp/api/UserQuery/update`, data })
|
|
89
|
-
}
|
|
90
|
-
export const UserQuery_save = (data: any) => {
|
|
91
|
-
return request.post({ url: `${config.simpUrl}/simp/api/UserQuery/save`, data })
|
|
92
|
-
}
|
|
93
|
-
export const UserQuery_sort = (data: any) => {
|
|
94
|
-
return request.post({ url: `${config.simpUrl}/simp/api/UserQuery/sort`, data })
|
|
95
|
-
}
|
|
96
|
-
export const UserQuery_delete = (data: any) => {
|
|
97
|
-
return request.post({ url: `${config.simpUrl}/simp/api/UserQuery/delete`, data })
|
|
98
|
-
}
|
|
99
|
-
export const ImportRecord_index = (data: any) => {
|
|
100
|
-
return request.post({ url: `${config.simpUrl}/simp/api/ImportRecord/index`, data })
|
|
101
|
-
}
|
|
102
|
-
// export const getFlowRead = (id) => {
|
|
103
|
-
// return request.get({ url: '/flow/'+id })
|
|
104
|
-
// }
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/assets/logo.png
DELETED
|
Binary file
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
|
|
3
|
-
</script>
|
|
4
|
-
|
|
5
|
-
<template>
|
|
6
|
-
|
|
7
|
-
</template>
|
|
8
|
-
|
|
9
|
-
<style lang="less">
|
|
10
|
-
.el-dialog__header {
|
|
11
|
-
margin-right: 0 !important;
|
|
12
|
-
border-bottom: 1px solid var(--tags-view-border-color);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.el-dialog__footer {
|
|
16
|
-
border-top: 1px solid var(--tags-view-border-color);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.is-hover {
|
|
20
|
-
&:hover {
|
|
21
|
-
color: var(--el-color-primary) !important;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.dark {
|
|
26
|
-
.el-dialog__header {
|
|
27
|
-
border-bottom: 1px solid var(--el-border-color);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.el-dialog__footer {
|
|
31
|
-
border-top: 1px solid var(--el-border-color);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
.round {
|
|
35
|
-
width: 8px;
|
|
36
|
-
height: 8px;
|
|
37
|
-
border: 1px solid #3145de;
|
|
38
|
-
box-shadow: 0px 2px 1px 0px rgba(59, 67, 133, 0.18);
|
|
39
|
-
border-radius: 50%;
|
|
40
|
-
}
|
|
41
|
-
.alCen {
|
|
42
|
-
display: flex;
|
|
43
|
-
align-items: center;
|
|
44
|
-
justify-content: space-between;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/* 添加新的样式来修复对齐问题 */
|
|
48
|
-
.dialog-title {
|
|
49
|
-
line-height: 24px;
|
|
50
|
-
display: inline-block;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.fullscreen-icon {
|
|
54
|
-
display: flex;
|
|
55
|
-
align-items: center;
|
|
56
|
-
margin-top: 0 !important;
|
|
57
|
-
margin-right: 5px !important;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/* 修复右上角关闭图标的对齐问题 */
|
|
61
|
-
.el-dialog__headerbtn {
|
|
62
|
-
top: 5px !important;
|
|
63
|
-
display: flex;
|
|
64
|
-
align-items: center;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.el-dialog__close {
|
|
68
|
-
display: flex;
|
|
69
|
-
align-items: center;
|
|
70
|
-
justify-content: center;
|
|
71
|
-
}
|
|
72
|
-
</style>
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="hello">
|
|
3
|
-
<h1>{{ msg }}</h1>
|
|
4
|
-
<p>
|
|
5
|
-
For a guide and recipes on how to configure / customize this project,<br>
|
|
6
|
-
check out the
|
|
7
|
-
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
|
|
8
|
-
</p>
|
|
9
|
-
<h3>Installed CLI Plugins</h3>
|
|
10
|
-
<ul>
|
|
11
|
-
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-typescript" target="_blank" rel="noopener">typescript</a></li>
|
|
12
|
-
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
|
|
13
|
-
</ul>
|
|
14
|
-
<h3>Essential Links</h3>
|
|
15
|
-
<ul>
|
|
16
|
-
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
|
|
17
|
-
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
|
|
18
|
-
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
|
|
19
|
-
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
|
|
20
|
-
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
|
|
21
|
-
</ul>
|
|
22
|
-
<h3>Ecosystem</h3>
|
|
23
|
-
<ul>
|
|
24
|
-
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
|
|
25
|
-
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
|
|
26
|
-
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
|
|
27
|
-
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
|
|
28
|
-
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
|
|
29
|
-
</ul>
|
|
30
|
-
</div>
|
|
31
|
-
</template>
|
|
32
|
-
|
|
33
|
-
<script lang="ts">
|
|
34
|
-
import { defineComponent } from 'vue';
|
|
35
|
-
|
|
36
|
-
export default defineComponent({
|
|
37
|
-
name: 'HelloWorld',
|
|
38
|
-
props: {
|
|
39
|
-
msg: String,
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
</script>
|
|
43
|
-
|
|
44
|
-
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
|
45
|
-
<style scoped>
|
|
46
|
-
h3 {
|
|
47
|
-
margin: 40px 0 0;
|
|
48
|
-
}
|
|
49
|
-
ul {
|
|
50
|
-
list-style-type: none;
|
|
51
|
-
padding: 0;
|
|
52
|
-
}
|
|
53
|
-
li {
|
|
54
|
-
display: inline-block;
|
|
55
|
-
margin: 0 10px;
|
|
56
|
-
}
|
|
57
|
-
a {
|
|
58
|
-
color: #42b983;
|
|
59
|
-
}
|
|
60
|
-
</style>
|
|
@@ -1,287 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-upload
|
|
3
|
-
id="uploadID"
|
|
4
|
-
ref="upload"
|
|
5
|
-
v-model:file-list="file_list"
|
|
6
|
-
:action="uploadUrl"
|
|
7
|
-
:limit="props.limit"
|
|
8
|
-
:before-upload="beforeUpload"
|
|
9
|
-
:on-success="handleSuccess"
|
|
10
|
-
:on-error="handleError"
|
|
11
|
-
:show-file-list="props.showFileList"
|
|
12
|
-
:on-exceed="handleExceed"
|
|
13
|
-
:on-change="handleChange"
|
|
14
|
-
:on-preview="handlePreview"
|
|
15
|
-
:headers="headers"
|
|
16
|
-
:data="data"
|
|
17
|
-
:accept="fileTypes"
|
|
18
|
-
:name="name"
|
|
19
|
-
>
|
|
20
|
-
<el-button v-show="showButton" :id="targetId" :type="buttonType">{{ buttonText }}</el-button>
|
|
21
|
-
<el-switch
|
|
22
|
-
v-model="data.auth"
|
|
23
|
-
v-if="show_auth"
|
|
24
|
-
@click.stop
|
|
25
|
-
class="mb-2"
|
|
26
|
-
:active-value="1"
|
|
27
|
-
:inactive-value="2"
|
|
28
|
-
@click="authChange"
|
|
29
|
-
inline-prompt
|
|
30
|
-
active-text="可下载"
|
|
31
|
-
inactive-text="仅预览"
|
|
32
|
-
style="margin-left: 20px"
|
|
33
|
-
/>
|
|
34
|
-
<div slot="tip" class="el-upload__tip" v-if="tipText">{{ tipText }}</div>
|
|
35
|
-
</el-upload>
|
|
36
|
-
<ElDialog v-model="viewShow" title="预览" :minHeight="600" width="970px" @clickClose="viewClose">
|
|
37
|
-
<iframe
|
|
38
|
-
id="iframe"
|
|
39
|
-
:src="viewUrl"
|
|
40
|
-
style="width: 100%; height: 500px; overflow-y: auto"
|
|
41
|
-
v-show="imgview == ''"
|
|
42
|
-
frameborder="0"
|
|
43
|
-
></iframe>
|
|
44
|
-
<el-image
|
|
45
|
-
:src="imgview"
|
|
46
|
-
v-if="imgview"
|
|
47
|
-
:zoom-rate="1.2"
|
|
48
|
-
:max-scale="7"
|
|
49
|
-
:min-scale="0.2"
|
|
50
|
-
:initial-index="555"
|
|
51
|
-
:preview-teleported="true"
|
|
52
|
-
fit="cover"
|
|
53
|
-
:z-index="9999"
|
|
54
|
-
style="margin: 0 auto; display: block"
|
|
55
|
-
/>
|
|
56
|
-
<template #footer>
|
|
57
|
-
<ElButton
|
|
58
|
-
v-if="data.auth == 1 || is_root || cruuent_id == create_by_id"
|
|
59
|
-
type="primary"
|
|
60
|
-
@click="download_file"
|
|
61
|
-
>下载</ElButton
|
|
62
|
-
>
|
|
63
|
-
<ElButton @click="viewShow = false">取消</ElButton>
|
|
64
|
-
</template>
|
|
65
|
-
</ElDialog>
|
|
66
|
-
</template>
|
|
67
|
-
|
|
68
|
-
<script setup lang="ts">
|
|
69
|
-
import { ref, onMounted, watch } from 'vue'
|
|
70
|
-
import { ElDialog, ElUpload, ElButton, ElMessage, ElSwitch, ElImage } from 'element-plus'
|
|
71
|
-
import { config } from '@/config/axios/config'
|
|
72
|
-
import { useRoute } from 'vue-router'
|
|
73
|
-
import { File_update_all } from '@/api/All.ts'
|
|
74
|
-
let route_path = ''
|
|
75
|
-
const route = useRoute()
|
|
76
|
-
if(route&&route.name)
|
|
77
|
-
{
|
|
78
|
-
route_path = route.name
|
|
79
|
-
}
|
|
80
|
-
const props = withDefaults(
|
|
81
|
-
defineProps<{
|
|
82
|
-
limit?: number // 限制上传文件数量
|
|
83
|
-
file_list_default: any[] // 文件列表回显
|
|
84
|
-
uploadUrl: string // 上传地址
|
|
85
|
-
showButton: boolean // 是否显示上传按钮
|
|
86
|
-
fileTypes?: string // 文件类型
|
|
87
|
-
tipText?: string // 提示语
|
|
88
|
-
name?: string
|
|
89
|
-
buttonText?: string // 按钮文字
|
|
90
|
-
verify?: number // 是否需要验证后缀 1是0否
|
|
91
|
-
auth?: number // 权限 1可下载 2仅预览
|
|
92
|
-
create_by_id?: string // 创建人id
|
|
93
|
-
show_auth?: boolean // 是否显示权限开关
|
|
94
|
-
showFileList?: boolean // 是否显示文件列表
|
|
95
|
-
targetId: string // 按钮id 方便在隐藏按钮时获取button触发上传
|
|
96
|
-
buttonType?: 'default' | 'primary' | 'success' | 'warning' | 'danger'
|
|
97
|
-
}>(),
|
|
98
|
-
{
|
|
99
|
-
uploadUrl:
|
|
100
|
-
process.env.NODE_ENV == 'development'
|
|
101
|
-
? 'http://192.168.1.229:3005/simp/api/File/upload'
|
|
102
|
-
: '/simp/api/File/upload',
|
|
103
|
-
fileTypes: '',
|
|
104
|
-
showButton: true,
|
|
105
|
-
tipText: '',
|
|
106
|
-
show_auth: false,
|
|
107
|
-
showFileList: true,
|
|
108
|
-
buttonText: '点击上传',
|
|
109
|
-
verify: 0,
|
|
110
|
-
auth: 1,
|
|
111
|
-
buttonType: 'primary'
|
|
112
|
-
}
|
|
113
|
-
)
|
|
114
|
-
const is_root = ref(window.localStorage.getItem('is_root') == 'true')
|
|
115
|
-
// const cruuent_id = ref(JSON.parse(window.sessionStorage.getItem('user')).id)
|
|
116
|
-
const cruuent_id = ref('666')
|
|
117
|
-
|
|
118
|
-
const create_by_id = ref(
|
|
119
|
-
props.create_by_id ||
|
|
120
|
-
(props.file_list_default?.length ? props.file_list_default[0].create_by : undefined)
|
|
121
|
-
)
|
|
122
|
-
const current_file = ref('')
|
|
123
|
-
const file_list = ref(
|
|
124
|
-
(props.file_list_default || [])?.map((item) => {
|
|
125
|
-
if (item?.original_name) {
|
|
126
|
-
item.name = item.original_name
|
|
127
|
-
}
|
|
128
|
-
return item
|
|
129
|
-
})
|
|
130
|
-
)
|
|
131
|
-
|
|
132
|
-
const data = ref({
|
|
133
|
-
simp_token: sessionStorage.getItem('token') as string,
|
|
134
|
-
project_id: (sessionStorage.getItem('project_id') as string)
|
|
135
|
-
? (sessionStorage.getItem('project_id') as string)
|
|
136
|
-
: (localStorage.getItem('inspect_project_id') as string),
|
|
137
|
-
tag: route_path,
|
|
138
|
-
verify: props.verify,
|
|
139
|
-
auth: props.file_list_default?.length ? +props.file_list_default[0].auth : props.auth
|
|
140
|
-
})
|
|
141
|
-
watch(
|
|
142
|
-
() => props.file_list_default,
|
|
143
|
-
(newVal) => {
|
|
144
|
-
file_list.value = (newVal || [])?.map((item) => {
|
|
145
|
-
if (item?.original_name) {
|
|
146
|
-
item.name = item.original_name
|
|
147
|
-
}
|
|
148
|
-
return item
|
|
149
|
-
})
|
|
150
|
-
data.value.auth = props.file_list_default?.length
|
|
151
|
-
? +props.file_list_default[0].auth
|
|
152
|
-
: props.auth
|
|
153
|
-
}
|
|
154
|
-
)
|
|
155
|
-
const emit = defineEmits<{
|
|
156
|
-
(e: 'success', response: any, file: File): void
|
|
157
|
-
(e: 'change', file_list: any): void
|
|
158
|
-
(e: 'change_file_list', file_list: any): void
|
|
159
|
-
}>()
|
|
160
|
-
|
|
161
|
-
const upload = ref(null)
|
|
162
|
-
|
|
163
|
-
const headers = ref({
|
|
164
|
-
cjostoken: localStorage.getItem('simp_token') as string
|
|
165
|
-
})
|
|
166
|
-
const authChange = () => {
|
|
167
|
-
File_update_all({ ids: getids().join(), auth: data.value.auth }).then((res) => {
|
|
168
|
-
ElMessage.success(res.msg || '修改成功')
|
|
169
|
-
file_list.value.forEach((item: any) => {
|
|
170
|
-
item.auth = data.value.auth
|
|
171
|
-
})
|
|
172
|
-
console.log(file_list.value, 11)
|
|
173
|
-
if (file_list.value?.length > 0) {
|
|
174
|
-
emit('change_file_list', file_list.value)
|
|
175
|
-
}
|
|
176
|
-
})
|
|
177
|
-
}
|
|
178
|
-
const handleExceed = () => {
|
|
179
|
-
ElMessage.error('超过文件数量限制')
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
const beforeUpload = (file: File) => {
|
|
183
|
-
return true
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
const handleSuccess = (response: any, file: File, fileList: File[]) => {
|
|
187
|
-
let fieldResponse = []
|
|
188
|
-
ElMessage.info(response.msg || '上传成功')
|
|
189
|
-
fileList.forEach((item: any) => {
|
|
190
|
-
if (item.response) {
|
|
191
|
-
fieldResponse.push(item.response.data[0])
|
|
192
|
-
} else {
|
|
193
|
-
fieldResponse.push(item)
|
|
194
|
-
}
|
|
195
|
-
})
|
|
196
|
-
emit('success', fieldResponse)
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
const handleError = (error: any, file: File, fileList: File[]) => {
|
|
200
|
-
ElMessage.error('上传失败')
|
|
201
|
-
}
|
|
202
|
-
const handleChange = (uploadFile: any, uploadFiles: any) => {
|
|
203
|
-
console.log(uploadFile.response, 'uploadFile.response')
|
|
204
|
-
if (uploadFile.response) {
|
|
205
|
-
let ids = getids()
|
|
206
|
-
emit('change', ids)
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
const getids = () => {
|
|
210
|
-
let ids = []
|
|
211
|
-
file_list.value.forEach((item: any) => {
|
|
212
|
-
if (item.response) {
|
|
213
|
-
item.id = item.response.data[0]?.id
|
|
214
|
-
}
|
|
215
|
-
ids.push(item.id as never)
|
|
216
|
-
})
|
|
217
|
-
return ids
|
|
218
|
-
}
|
|
219
|
-
const download_file = () => {
|
|
220
|
-
let downsrc = `${config.simpUrl}${current_file.value}`
|
|
221
|
-
const a = document.createElement('a')
|
|
222
|
-
a.download = ''
|
|
223
|
-
a.href = downsrc
|
|
224
|
-
a.click()
|
|
225
|
-
}
|
|
226
|
-
const handlePreview = (file: File) => {
|
|
227
|
-
console.log(file, 'file')
|
|
228
|
-
if (file.src) {
|
|
229
|
-
current_file.value = file.src
|
|
230
|
-
} else {
|
|
231
|
-
current_file.value = file.response.data[0]?.src
|
|
232
|
-
}
|
|
233
|
-
console.log(current_file.value, 'current_file.value')
|
|
234
|
-
lookkkFile(current_file.value)
|
|
235
|
-
}
|
|
236
|
-
const encodeURLToBase64ThenURIComponent = (url) => {
|
|
237
|
-
// 先将 URL 进行 base64 编码
|
|
238
|
-
var base64Encoded = btoa(url)
|
|
239
|
-
// 再将 base64 编码后的结果进行 URL 编码
|
|
240
|
-
var encodedURL = encodeURIComponent(base64Encoded)
|
|
241
|
-
return encodedURL
|
|
242
|
-
}
|
|
243
|
-
const lookkkFile = (e) => {
|
|
244
|
-
let url = 'http://simp' + e
|
|
245
|
-
const isImage = /\.(jpg|jpeg|png|gif|bmp|webp)$/i.test(e)
|
|
246
|
-
console.log(isImage)
|
|
247
|
-
if (isImage) {
|
|
248
|
-
imgview.value = config.simpUrl + e
|
|
249
|
-
viewShow.value = true
|
|
250
|
-
} else {
|
|
251
|
-
imgview.value = '' // Handle non-image files with document viewer
|
|
252
|
-
var result = encodeURLToBase64ThenURIComponent(url)
|
|
253
|
-
viewShow.value = true
|
|
254
|
-
viewUrl.value = config.simpUrl + 'preview/onlinePreview?url=' + result
|
|
255
|
-
}
|
|
256
|
-
console.log(imgview.value, 111)
|
|
257
|
-
}
|
|
258
|
-
onMounted(() => {})
|
|
259
|
-
const viewShow = ref(false)
|
|
260
|
-
const viewUrl = ref('')
|
|
261
|
-
const imgview = ref('')
|
|
262
|
-
|
|
263
|
-
const viewClose = () => {
|
|
264
|
-
viewShow.value = false
|
|
265
|
-
viewUrl.value = ''
|
|
266
|
-
imgview.value = ''
|
|
267
|
-
}
|
|
268
|
-
</script>
|
|
269
|
-
|
|
270
|
-
<style lang="less" scoped >
|
|
271
|
-
.el-upload__tip {
|
|
272
|
-
margin-top: 10px;
|
|
273
|
-
color: #909399;
|
|
274
|
-
display: block;
|
|
275
|
-
}
|
|
276
|
-
#uploadID .el-upload {
|
|
277
|
-
width: 100%;
|
|
278
|
-
display: block !important;
|
|
279
|
-
}
|
|
280
|
-
:deep(.el-upload-list__item) {
|
|
281
|
-
height: 20px;
|
|
282
|
-
line-height: 20px;
|
|
283
|
-
}
|
|
284
|
-
:deep(.el-upload-list) {
|
|
285
|
-
margin: 0;
|
|
286
|
-
}
|
|
287
|
-
</style>
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
const config: {
|
|
2
|
-
base_url: {
|
|
3
|
-
base: string
|
|
4
|
-
dev: string
|
|
5
|
-
pro: string
|
|
6
|
-
test: string
|
|
7
|
-
}
|
|
8
|
-
result_code: number | string
|
|
9
|
-
default_headers: string,
|
|
10
|
-
request_timeout: number,
|
|
11
|
-
viewUrl: string,
|
|
12
|
-
uploadurl: string,
|
|
13
|
-
uploadImgUrl: string,
|
|
14
|
-
cjosUrl: string,
|
|
15
|
-
simpUrl: string,
|
|
16
|
-
upUse: string,
|
|
17
|
-
simpUseUrl: string,
|
|
18
|
-
flowUrl: string,
|
|
19
|
-
wflowUrl: string,
|
|
20
|
-
simptrainingspaceUrl: string,
|
|
21
|
-
simpSasUrl: string,
|
|
22
|
-
useProjectUrl: string,
|
|
23
|
-
simpelementsUrl: string,
|
|
24
|
-
} = {
|
|
25
|
-
/**
|
|
26
|
-
* api请求基础路径
|
|
27
|
-
*/
|
|
28
|
-
base_url: {
|
|
29
|
-
// 开发环境接口前缀//hkemergency
|
|
30
|
-
base: 'http://192.168.1.229:3005/policy/api/',
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
// 打包开发环境接口前缀
|
|
35
|
-
dev: '',
|
|
36
|
-
// 打包生产环境接口前缀
|
|
37
|
-
pro: window.location.protocol + '//' + window.location.hostname + ':' + window.location.port + '/policy/api/',
|
|
38
|
-
|
|
39
|
-
// 打包测试环境接口前缀
|
|
40
|
-
test: ''
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* 接口成功返回状态码
|
|
45
|
-
*/
|
|
46
|
-
result_code: '200',
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* 接口请求超时时间
|
|
50
|
-
*/
|
|
51
|
-
request_timeout: 60000,
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* 默认接口请求类型
|
|
55
|
-
* 可选值:application/x-www-form-urlencoded multipart/form-data
|
|
56
|
-
*/
|
|
57
|
-
|
|
58
|
-
default_headers: 'application/json',
|
|
59
|
-
viewUrl: window.location.protocol + '//' + window.location.hostname + ':' + window.location.port,//查看图片路径
|
|
60
|
-
uploadurl: window.location.protocol + '//' + window.location.hostname + ':' + window.location.port + '/admin/',//上传路径
|
|
61
|
-
cjosUrl: ``,
|
|
62
|
-
simpUseUrl :``,
|
|
63
|
-
simptrainingspaceUrl :``,
|
|
64
|
-
simpSasUrl :``,
|
|
65
|
-
useProjectUrl : ``,
|
|
66
|
-
simpelementsUrl : ``,
|
|
67
|
-
upUse:'',
|
|
68
|
-
simpUrl:'',
|
|
69
|
-
uploadImgUrl:'',
|
|
70
|
-
flowUrl:'',
|
|
71
|
-
wflowUrl:'',
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (process.env.NODE_ENV == 'development') {
|
|
75
|
-
config.uploadImgUrl = config.base_url.base
|
|
76
|
-
|
|
77
|
-
// config.viewUrl='http://192.168.1.114:8038/'
|
|
78
|
-
// if(window.location.port)
|
|
79
|
-
// {
|
|
80
|
-
// config.viewUrl=window.location.protocol+'//'+window.location.hostname+':'+window.location.port
|
|
81
|
-
// }else{
|
|
82
|
-
// config.viewUrl=window.location.protocol+'//'+window.location.hostname
|
|
83
|
-
// }
|
|
84
|
-
config.wflowUrl = "http://192.168.1.229:3005/wflow/admin/"
|
|
85
|
-
config.viewUrl = 'https://gps.gy.jxcc.com/car'
|
|
86
|
-
config.simpUrl = 'http://192.168.1.229:3005/'//'http://222.174.114.2:30090/'
|
|
87
|
-
config.upUse = "http://192.168.1.229:3005/simp/api/file/verify"
|
|
88
|
-
config.simpUseUrl = "http://192.168.1.229:3005/simp/index.php/api/"
|
|
89
|
-
config.flowUrl = 'http://192.168.1.93:88/simpflow/simpflow/index.html#/workspace/approval?zhiduguanli=true'
|
|
90
|
-
|
|
91
|
-
} else {
|
|
92
|
-
config.uploadImgUrl = config.base_url.pro
|
|
93
|
-
config.wflowUrl = window.location.protocol + '//' + window.location.hostname + ':' + window.location.port + "/wflow/admin/"
|
|
94
|
-
if (window.location.port) {
|
|
95
|
-
config.viewUrl = window.location.protocol + '//' + window.location.hostname + ':' + window.location.port
|
|
96
|
-
} else {
|
|
97
|
-
config.viewUrl = window.location.protocol + '//' + window.location.hostname
|
|
98
|
-
}
|
|
99
|
-
config.flowUrl = window.location.protocol + '//' + window.location.hostname + ':' + window.location.port + '/simpflow/simpflow/index.html#/workspace/approval?zhiduguanli=true'
|
|
100
|
-
config.simpUrl = window.location.protocol + '//' + window.location.hostname + ':' + window.location.port + '/'
|
|
101
|
-
config.upUse = window.location.protocol + '//' + window.location.hostname + ':' + window.location.port + "/simp/api/file/verify"
|
|
102
|
-
if (localStorage.getItem('is_root') === 'true' || localStorage.getItem('is_root') === 'false') {
|
|
103
|
-
if (window.location.port) {
|
|
104
|
-
config.viewUrl = window.location.protocol + '//' + window.location.hostname + ':' + window.location.port + '/simp/'
|
|
105
|
-
config.base_url.pro = window.location.protocol + '//' + window.location.hostname + ':' + window.location.port + '/policy/api/'
|
|
106
|
-
} else {
|
|
107
|
-
config.viewUrl = window.location.protocol + '//' + window.location.hostname + '/simp/'
|
|
108
|
-
config.base_url.pro = window.location.protocol + '//' + window.location.hostname + '/policy/api/'
|
|
109
|
-
}
|
|
110
|
-
config.uploadImgUrl = config.base_url.pro
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
config.cjosUrl = `${config.simpUrl}prod-api/v1/auth/`
|
|
118
|
-
config.simpUseUrl = `${config.simpUrl}simp/index.php/api/`
|
|
119
|
-
config.simptrainingspaceUrl = `${config.simpUrl}simptrainingspace/api/`
|
|
120
|
-
config.simpSasUrl = `${config.simpUrl}simp-sas/api/`
|
|
121
|
-
config.useProjectUrl = `${config.simpUrl}policy/api/`
|
|
122
|
-
config.simpelementsUrl = `${config.simpUrl}simpelements/api/`
|
|
123
|
-
export { config }
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { service } from './service'
|
|
2
|
-
|
|
3
|
-
import { config } from './config'
|
|
4
|
-
|
|
5
|
-
const { default_headers } = config
|
|
6
|
-
|
|
7
|
-
const request = (option: any) => {
|
|
8
|
-
const { url, method, params, data, headersType, responseType } = option;
|
|
9
|
-
|
|
10
|
-
// 判断是否需要附加特定的请求头
|
|
11
|
-
const shouldIncludeHeaders = url.includes('prod-api/v1/auth');
|
|
12
|
-
|
|
13
|
-
// 构建 headers 对象
|
|
14
|
-
const headers: any = {
|
|
15
|
-
'Content-Type': headersType || default_headers,
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
// 如果 URL 包含 'prod-api/v1/auth',添加额外的 headers
|
|
19
|
-
if (shouldIncludeHeaders) {
|
|
20
|
-
headers['Currentproject'] = localStorage.getItem('current_project_id');
|
|
21
|
-
headers['Projects'] = localStorage.getItem('user_projects');
|
|
22
|
-
headers['Authorization'] = 'Bearer ' + sessionStorage.getItem('token');
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// 返回请求
|
|
26
|
-
return service({
|
|
27
|
-
url: url,
|
|
28
|
-
method,
|
|
29
|
-
params,
|
|
30
|
-
data,
|
|
31
|
-
responseType: responseType,
|
|
32
|
-
headers: headers,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
export default {
|
|
36
|
-
get: <T = any>(option: any) => {
|
|
37
|
-
return request({ method: 'get', ...option }) as unknown as T
|
|
38
|
-
},
|
|
39
|
-
post: <T = any>(option: any) => {
|
|
40
|
-
return request({ method: 'post', ...option }) as unknown as T
|
|
41
|
-
},
|
|
42
|
-
delete: <T = any>(option: any) => {
|
|
43
|
-
return request({ method: 'delete', ...option }) as unknown as T
|
|
44
|
-
},
|
|
45
|
-
put: <T = any>(option: any) => {
|
|
46
|
-
return request({ method: 'put', ...option }) as unknown as T
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import axios, {
|
|
2
|
-
AxiosInstance,
|
|
3
|
-
InternalAxiosRequestConfig,
|
|
4
|
-
AxiosRequestHeaders,
|
|
5
|
-
AxiosResponse,
|
|
6
|
-
AxiosError
|
|
7
|
-
} from 'axios'
|
|
8
|
-
|
|
9
|
-
import qs from 'qs'
|
|
10
|
-
|
|
11
|
-
import { config } from './config'
|
|
12
|
-
|
|
13
|
-
import { ElMessage } from 'element-plus'
|
|
14
|
-
|
|
15
|
-
const { result_code, base_url } = config
|
|
16
|
-
|
|
17
|
-
// 要修改
|
|
18
|
-
// export const PATH_URL = base_url[import.meta.env.VITE_API_BASEPATH as keyof typeof base_url]
|
|
19
|
-
export const PATH_URL = '192.168.1.229:92'
|
|
20
|
-
|
|
21
|
-
// import { resetRouter } from '@/router'
|
|
22
|
-
// import { useRouter } from 'vue-router'
|
|
23
|
-
|
|
24
|
-
// 创建axios实例
|
|
25
|
-
const service: AxiosInstance = axios.create({
|
|
26
|
-
baseURL: PATH_URL, // api 的 base_url
|
|
27
|
-
timeout: config.request_timeout // 请求超时时间
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
// let token = null
|
|
31
|
-
let token: string | null = null
|
|
32
|
-
// request拦截器
|
|
33
|
-
service.interceptors.request.use(
|
|
34
|
-
(config: InternalAxiosRequestConfig) => {
|
|
35
|
-
if (sessionStorage.getItem('token')) {
|
|
36
|
-
token = sessionStorage.getItem('token')
|
|
37
|
-
}
|
|
38
|
-
config.headers['car-token'] = token;
|
|
39
|
-
config.headers['Authorization'] = 'Bearer ' + token;
|
|
40
|
-
if (localStorage.getItem('is_root') === 'true' || localStorage.getItem('is_root') === 'false') {
|
|
41
|
-
if (localStorage.getItem('is_root')) {
|
|
42
|
-
config.headers['cjostoken'] = localStorage.getItem('simp_token')
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
if (!config.url?.includes('prod-api/v1/auth')) {
|
|
46
|
-
config.headers['cjostoken'] = localStorage.getItem('simp_token')
|
|
47
|
-
}
|
|
48
|
-
if (config.method === 'post') {
|
|
49
|
-
config.data = config.data ?? {};
|
|
50
|
-
config.data.simp_token = sessionStorage.getItem('token') as string
|
|
51
|
-
config.data.project_id = sessionStorage.getItem('project_id') as string
|
|
52
|
-
? sessionStorage.getItem('project_id') as string
|
|
53
|
-
: localStorage.getItem('inspect_project_id') as string
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
if (
|
|
57
|
-
config.method === 'post' && (config.headers as AxiosRequestHeaders)['Content-Type'] === 'application/x-www-form-urlencoded') {
|
|
58
|
-
config.data = qs.stringify(config.data)
|
|
59
|
-
}
|
|
60
|
-
// ;(config.headers as AxiosRequestHeaders)['Token'] = 'test test'
|
|
61
|
-
// get参数编码
|
|
62
|
-
if (config.method === 'get') {
|
|
63
|
-
config.params.simp_token = sessionStorage.getItem('token') as string
|
|
64
|
-
config.params.project_id = sessionStorage.getItem('project_id') as string
|
|
65
|
-
? sessionStorage.getItem('project_id') as string
|
|
66
|
-
: localStorage.getItem('inspect_project_id') as string
|
|
67
|
-
// let url = config.url as string
|
|
68
|
-
// url += '?'
|
|
69
|
-
// const keys = Object.keys(config.params)
|
|
70
|
-
// for (const key of keys) {
|
|
71
|
-
// if (config.params[key] !== void 0 && config.params[key] !== null) {
|
|
72
|
-
// url += `${key}=${encodeURIComponent(config.params[key])}&`
|
|
73
|
-
// }
|
|
74
|
-
// }
|
|
75
|
-
// url = url.substring(0, url.length - 1)
|
|
76
|
-
// config.url = url
|
|
77
|
-
}
|
|
78
|
-
return config
|
|
79
|
-
},
|
|
80
|
-
(error: AxiosError) => {
|
|
81
|
-
// Do something with request error
|
|
82
|
-
console.log(error) // for debug
|
|
83
|
-
Promise.reject(error)
|
|
84
|
-
}
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
// response 拦截器
|
|
88
|
-
service.interceptors.response.use(
|
|
89
|
-
(response: AxiosResponse<any>) => {
|
|
90
|
-
|
|
91
|
-
if (response.config.responseType === 'blob') {
|
|
92
|
-
// 如果是文件流,直接过
|
|
93
|
-
return response
|
|
94
|
-
} else if (response.data.code == result_code) {
|
|
95
|
-
return response.data
|
|
96
|
-
} else if (response.data.body) {
|
|
97
|
-
return response.data
|
|
98
|
-
} else {
|
|
99
|
-
// ElMessage.error(response.data.msg)
|
|
100
|
-
return response
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
(error: AxiosError) => {
|
|
104
|
-
console.log('***', error) // for debug
|
|
105
|
-
try {
|
|
106
|
-
// if (error.response.status == 401) {//401退出登录
|
|
107
|
-
if (error.response && error.response.status === 401) {//401退出登录
|
|
108
|
-
console.log('退出登录');
|
|
109
|
-
|
|
110
|
-
// resetRouter() // 重置静态路由表
|
|
111
|
-
}
|
|
112
|
-
} catch (e) { }
|
|
113
|
-
// ElMessage.error(error.response.data.msg)
|
|
114
|
-
return Promise.reject(error)
|
|
115
|
-
}
|
|
116
|
-
)
|
|
117
|
-
|
|
118
|
-
export { service }
|
package/src/main.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { createApp } from 'vue'
|
|
2
|
-
import App from './App.vue'
|
|
3
|
-
import ElementPlus from 'element-plus'
|
|
4
|
-
import 'element-plus/dist/index.css'
|
|
5
|
-
import zhCn from 'element-plus/es/locale/lang/zh-cn'
|
|
6
|
-
// import router from './router'
|
|
7
|
-
|
|
8
|
-
const app = createApp(App)
|
|
9
|
-
app.use(ElementPlus, {
|
|
10
|
-
// locale: zhCn,
|
|
11
|
-
})
|
|
12
|
-
// app.use(router)
|
|
13
|
-
app.mount('#app')
|
package/src/router/index.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
|
|
2
|
-
|
|
3
|
-
const routes: Array<RouteRecordRaw> = [
|
|
4
|
-
{
|
|
5
|
-
path: '/',
|
|
6
|
-
name: 'Home',
|
|
7
|
-
component: () => import('../App.vue')
|
|
8
|
-
}
|
|
9
|
-
]
|
|
10
|
-
|
|
11
|
-
const router = createRouter({
|
|
12
|
-
history: createWebHistory(),
|
|
13
|
-
routes
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
export default router
|
package/src/shims-vue.d.ts
DELETED
package/tsconfig.json
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es5",
|
|
4
|
-
"module": "esnext",
|
|
5
|
-
"strict": true,
|
|
6
|
-
"jsx": "preserve",
|
|
7
|
-
"importHelpers": true,
|
|
8
|
-
"moduleResolution": "node",
|
|
9
|
-
"skipLibCheck": true,
|
|
10
|
-
"esModuleInterop": true,
|
|
11
|
-
"allowSyntheticDefaultImports": true,
|
|
12
|
-
"forceConsistentCasingInFileNames": true,
|
|
13
|
-
"useDefineForClassFields": true,
|
|
14
|
-
"sourceMap": true,
|
|
15
|
-
"baseUrl": ".",
|
|
16
|
-
"types": [
|
|
17
|
-
"webpack-env"
|
|
18
|
-
],
|
|
19
|
-
"paths": {
|
|
20
|
-
"@/*": [
|
|
21
|
-
"src/*"
|
|
22
|
-
]
|
|
23
|
-
},
|
|
24
|
-
"lib": [
|
|
25
|
-
"esnext",
|
|
26
|
-
"dom",
|
|
27
|
-
"dom.iterable",
|
|
28
|
-
"scripthost"
|
|
29
|
-
]
|
|
30
|
-
},
|
|
31
|
-
"include": [
|
|
32
|
-
"src/**/*.ts",
|
|
33
|
-
"src/**/*.tsx",
|
|
34
|
-
"src/**/*.vue",
|
|
35
|
-
"tests/**/*.ts",
|
|
36
|
-
"tests/**/*.tsx"
|
|
37
|
-
],
|
|
38
|
-
"exclude": [
|
|
39
|
-
"node_modules"
|
|
40
|
-
]
|
|
41
|
-
}
|
package/vue.config.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const { resolve } = require('path')
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
// 设置生产环境的source map,提高代码可读性
|
|
5
|
-
productionSourceMap: true,
|
|
6
|
-
lintOnSave: false,
|
|
7
|
-
pages: {
|
|
8
|
-
index: {
|
|
9
|
-
// 修改项目入口文件
|
|
10
|
-
entry: 'src/main.ts',
|
|
11
|
-
template: 'public/index.html',
|
|
12
|
-
filename: 'index.html'
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
// 扩展 webpack 配置,使 packages 加入编译
|
|
16
|
-
chainWebpack: config => {
|
|
17
|
-
config.module
|
|
18
|
-
.rule('js')
|
|
19
|
-
.include.add(resolve(__dirname, 'packages')).end()
|
|
20
|
-
.use('babel')
|
|
21
|
-
.loader('babel-loader')
|
|
22
|
-
.tap(options => {
|
|
23
|
-
// 确保正确处理现代JavaScript语法
|
|
24
|
-
return {
|
|
25
|
-
...options,
|
|
26
|
-
plugins: [
|
|
27
|
-
'@vue/babel-plugin-jsx',
|
|
28
|
-
'@babel/plugin-transform-modules-commonjs'
|
|
29
|
-
]
|
|
30
|
-
}
|
|
31
|
-
})
|
|
32
|
-
}
|
|
33
|
-
}
|