zsysview 0.0.6 → 0.0.8
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 +3 -1
- package/assets/default_avatar.png +0 -0
- package/assets/default_logo.png +0 -0
- package/assets/default_logo_40.png +0 -0
- package/assets/login_bg.jpg +0 -0
- package/components/export/export_dialog.vue +150 -0
- package/components/export/export_progress.vue +62 -0
- package/components/list/zsyslist.vue +2 -2
- package/components/list/zsyslist_header.vue +1 -1
- package/components/zsys_delbutton.vue +60 -0
- package/core/app.ts +21 -2
- package/core/common/common.ts +29 -0
- package/core/common/zsys_eventBus.ts +45 -0
- package/core/common/zsys_time.ts +26 -0
- package/core/httpapi/http_api_return_data.ts +43 -0
- package/core/httpapi/http_api_v1.ts +151 -0
- package/core/httpapi/http_axios.ts +54 -0
- package/core/router copy.ts +148 -0
- package/core/router.ts +149 -0
- package/core/runtime.ts +14 -0
- package/core/user_token.ts +17 -0
- package/css/common.css +16 -0
- package/package.json +9 -2
- package/view/app.vue +0 -1
- package/view/backup/backup.vue +308 -0
- package/view/building.vue +22 -0
- package/view/department/department.vue +111 -0
- package/view/department/department_edit_dialog.vue +267 -0
- package/view/desktop/desktop.vue +11 -0
- package/view/log/log.vue +60 -0
- package/view/log/log_setting.vue +41 -0
- package/view/login.vue +5 -5
- package/view/main/breadcrumb.vue +41 -0
- package/view/main/main.vue +60 -0
- package/view/main/userHeader.vue +73 -0
- package/view/main/userMenu.vue +132 -0
- package/view/main/userMenuItem.vue +49 -0
- package/view/position/position.vue +58 -0
- package/view/position/position_edit_dialog.vue +203 -0
- package/view/role/role.vue +72 -0
- package/view/role/role_edit_dialog.vue +271 -0
- package/view/self/change_password.vue +97 -0
- package/view/self/self.vue +62 -0
- package/view/sys/sys.vue +19 -0
- package/view/user/change_user_password_dialog.vue +155 -0
- package/view/user/user.vue +110 -0
- package/view/user/user_edit_dialog.vue +283 -0
package/README.md
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
<!-- ReusableDialog.vue -->
|
|
2
|
+
<template>
|
|
3
|
+
<el-dialog v-model="visible" title="导出" :align-center="true" :before-close="handleBeforeClose" @open="open"
|
|
4
|
+
width="800" :draggable="true" :overflow="true" @opened="focus" destroy-on-close :close-on-click-modal="false">
|
|
5
|
+
<!-- 默认插槽放主要内容 -->
|
|
6
|
+
<el-form @submit.prevent ref="ruleFormRef" :model="form" :rules="rules"
|
|
7
|
+
style="padding-left: 10px;padding-right: 10px;" label-width="auto" v-show="view.exporting == false">
|
|
8
|
+
<el-form-item label="字段选项" prop="role_title">
|
|
9
|
+
<el-radio-group v-model="form.columnOption">
|
|
10
|
+
<el-radio value="all">全部支持的字段</el-radio>
|
|
11
|
+
<el-radio v-if="props.exportColumn ? true : false" value="custom">自定义</el-radio>
|
|
12
|
+
</el-radio-group>
|
|
13
|
+
</el-form-item>
|
|
14
|
+
<el-form-item label="自定义" v-show="form.columnOption == 'custom'">
|
|
15
|
+
<!-- v-model="form.permission_value" :data="permission_option" -->
|
|
16
|
+
<el-transfer v-model="form.exportColumnWanted" :data="props.exportColumn" :titles="['可选', '已选']" :props="{
|
|
17
|
+
key: 'ColumnName',
|
|
18
|
+
label: 'ColumnTitle',
|
|
19
|
+
}">
|
|
20
|
+
<template #left-empty>
|
|
21
|
+
<el-empty :image-size="60" description="无可选项" />
|
|
22
|
+
</template>
|
|
23
|
+
<template #right-empty>
|
|
24
|
+
<el-empty :image-size="60" description="请从左侧选择" />
|
|
25
|
+
</template>
|
|
26
|
+
</el-transfer>
|
|
27
|
+
</el-form-item>
|
|
28
|
+
</el-form>
|
|
29
|
+
|
|
30
|
+
<export_progress v-show="view.exporting" :export-id="view.exportId"></export_progress>
|
|
31
|
+
|
|
32
|
+
<!-- 底部按钮区插槽 -->
|
|
33
|
+
<template #footer>
|
|
34
|
+
<div style="display: flex;justify-content: right;">
|
|
35
|
+
<el-button type="primary" @click="startExport" v-show="view.exporting == false">开始导出</el-button>
|
|
36
|
+
<!-- <el-button @click="close">取消</el-button> -->
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
</template>
|
|
40
|
+
</el-dialog>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<script setup lang="ts">
|
|
44
|
+
import { ref, watch, reactive } from 'vue';
|
|
45
|
+
import { HttpApiV1 as http } from '../../core/httpapi/http_api_v1';
|
|
46
|
+
import { ZSYSMessage } from '../../components/message';
|
|
47
|
+
import type { FormInstance, FormRules, ElInput } from 'element-plus'
|
|
48
|
+
import { useMagicKeys, whenever } from '@vueuse/core'
|
|
49
|
+
import export_progress from './export_progress.vue';
|
|
50
|
+
const inputRef = ref<InstanceType<typeof ElInput> | null>(null)
|
|
51
|
+
const props = defineProps({
|
|
52
|
+
modelValue: { type: Boolean, required: true }, // 控制显示隐藏
|
|
53
|
+
exportUrl: { type: String, required: true },
|
|
54
|
+
exportColumn: { type: [] }
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const emit = defineEmits<{
|
|
58
|
+
(e: 'update:modelValue', value: boolean): void;
|
|
59
|
+
// (e: 'confirm'): void;
|
|
60
|
+
// (e: 'close'): void;
|
|
61
|
+
}>();
|
|
62
|
+
|
|
63
|
+
const visible = ref(false);
|
|
64
|
+
|
|
65
|
+
// 同步外部 v-model 变化
|
|
66
|
+
watch(
|
|
67
|
+
() => props.modelValue,
|
|
68
|
+
(val) => {
|
|
69
|
+
visible.value = val;
|
|
70
|
+
},
|
|
71
|
+
{ immediate: true }
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
// 内部状态变化通知外部
|
|
75
|
+
watch(visible, (val) => {
|
|
76
|
+
emit('update:modelValue', val);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
//弹窗显示时的处理
|
|
80
|
+
const open = () => {
|
|
81
|
+
view.exporting = false
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// const close = () => {
|
|
85
|
+
// visible.value = false;
|
|
86
|
+
// // emit('close');
|
|
87
|
+
// };
|
|
88
|
+
|
|
89
|
+
const handleBeforeClose = (done: () => void) => {
|
|
90
|
+
ruleFormRef.value?.clearValidate();
|
|
91
|
+
// 可以在这里添加关闭前的拦截逻辑
|
|
92
|
+
done();
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const view = reactive({
|
|
96
|
+
exporting: false,// 导出框当前的状态
|
|
97
|
+
exportId:0n//导出id
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
//^^^^^^^^^^^^^^^上方为对话框功能^^^^^^^^^^^^^^^
|
|
103
|
+
|
|
104
|
+
//===============下方为数据部分===============
|
|
105
|
+
//开始请求后台导出
|
|
106
|
+
async function startExport() {
|
|
107
|
+
view.exporting = true
|
|
108
|
+
let res = await http.Post(props.exportUrl, {})
|
|
109
|
+
if (res.IsSuccess) {
|
|
110
|
+
view.exportId=BigInt(res.data as unknown as bigint)
|
|
111
|
+
} else {
|
|
112
|
+
ZSYSMessage.ShowError(res.message)
|
|
113
|
+
view.exporting = false
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
//=================表单
|
|
118
|
+
const ruleFormRef = ref<FormInstance>()
|
|
119
|
+
const form = ref({
|
|
120
|
+
columnOption: 'all',
|
|
121
|
+
exportColumnWanted: []
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
const rules = reactive<FormRules<typeof form>>({
|
|
125
|
+
|
|
126
|
+
})
|
|
127
|
+
//=================
|
|
128
|
+
|
|
129
|
+
const focus = () => {
|
|
130
|
+
inputRef.value?.focus()
|
|
131
|
+
inputRef.value?.select()
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
//==========快捷键
|
|
135
|
+
const keys = useMagicKeys()
|
|
136
|
+
|
|
137
|
+
whenever(keys.alt_s, () => {
|
|
138
|
+
if (visible.value) {
|
|
139
|
+
console.log('Alt+S提交')
|
|
140
|
+
}
|
|
141
|
+
// 在这里执行你的业务逻辑
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
</script>
|
|
145
|
+
|
|
146
|
+
<style scoped>
|
|
147
|
+
.el-transfer /deep/ .el-transfer-panel {
|
|
148
|
+
width: 240px;
|
|
149
|
+
}
|
|
150
|
+
</style>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div style="padding-left: 20px; padding-right: 20px; padding-top: 6px;">
|
|
3
|
+
<div v-if="view.state == 1" style="font-size: x-large;">正在导出</div>
|
|
4
|
+
<div v-if="view.state == 2" style="font-size: x-large;">导出完成</div>
|
|
5
|
+
<div style="font-size:large; margin-top: 10px;">
|
|
6
|
+
累计处理: {{ view.progress }}
|
|
7
|
+
</div>
|
|
8
|
+
<el-progress v-if="view.state == 1" :percentage="50" :indeterminate="true" style="margin-top: 10px;">
|
|
9
|
+
{{ view.progress }}
|
|
10
|
+
</el-progress>
|
|
11
|
+
<el-space v-if="view.state == 2" wrap style="font-size:large; margin-top: 10px;">
|
|
12
|
+
<el-text>文件(点击下载):</el-text>
|
|
13
|
+
<el-link v-for="item of view.file_ids" :href="http.url_export_file+'?id='+item.toString()" target="_blank"
|
|
14
|
+
underline="always" type="primary">文件{{ item.toString() }}</el-link>
|
|
15
|
+
</el-space>
|
|
16
|
+
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script setup lang="ts">
|
|
22
|
+
import { reactive, watch, type PropType } from 'vue';
|
|
23
|
+
import { HttpApiV1 as http } from '../../core/httpapi/http_api_v1';
|
|
24
|
+
const props = defineProps({
|
|
25
|
+
exportId: { type: BigInt as unknown as PropType<bigint>, required: true }
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const view = reactive({
|
|
29
|
+
state: 1,
|
|
30
|
+
progress: 0n,
|
|
31
|
+
file_ids: [] as bigint[]
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
watch(props, (newVal) => {
|
|
36
|
+
if (newVal.exportId != 0n) {
|
|
37
|
+
var intervalId = setInterval(async () => {
|
|
38
|
+
let xRes = await http.Post(http.url_export_detail, { id: props.exportId })
|
|
39
|
+
if (xRes.IsSuccess) {
|
|
40
|
+
let data = xRes.data as {
|
|
41
|
+
progress: bigint,
|
|
42
|
+
state: number,
|
|
43
|
+
file_ids: string
|
|
44
|
+
}
|
|
45
|
+
view.progress = data.progress
|
|
46
|
+
view.state = data.state
|
|
47
|
+
view.file_ids = []
|
|
48
|
+
let fs = data.file_ids.split(',')
|
|
49
|
+
for (let f of fs) {
|
|
50
|
+
view.file_ids.push(BigInt(f))
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (view.state != 1) { clearInterval(intervalId) }
|
|
54
|
+
}
|
|
55
|
+
// completeExport()
|
|
56
|
+
}, 3600);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<style scoped></style>
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
<script setup lang="ts">
|
|
40
40
|
import { ref, onMounted, onUnmounted, reactive } from "vue";
|
|
41
41
|
import zsyslist_header from "./zsyslist_header.vue";
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
import { HttpApiV1 as http } from "../../core/httpapi/http_api_v1";
|
|
43
|
+
import { zsysEventBus } from "../../core/common/zsys_eventBus";
|
|
44
44
|
const eventBus = zsysEventBus();
|
|
45
45
|
const view = reactive({
|
|
46
46
|
loading: false,
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
<script setup lang="ts">
|
|
42
42
|
import { defineProps,reactive } from 'vue'
|
|
43
43
|
import { Refresh, Search } from '@element-plus/icons-vue'
|
|
44
|
-
import export_dialog from '
|
|
44
|
+
import export_dialog from '../export/export_dialog.vue';
|
|
45
45
|
|
|
46
46
|
const props = defineProps(['config', 'query'])
|
|
47
47
|
const config = props.config
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-popconfirm @confirm="confirm" title="确认要删除吗?" v-if="!view.loading" confirm-button-text="删除"
|
|
3
|
+
cancel-button-text="取消" confirm-button-type="danger">
|
|
4
|
+
<template #reference>
|
|
5
|
+
<el-link type="primary">删除</el-link>
|
|
6
|
+
</template>
|
|
7
|
+
</el-popconfirm>
|
|
8
|
+
<el-popover v-if="view.loading" :visible="view.loading" :width="40" placement="top" content="正在删除">
|
|
9
|
+
<template #reference>
|
|
10
|
+
<el-link type="primary" style="margin-left: 6px;" disabled>删除</el-link>
|
|
11
|
+
</template>
|
|
12
|
+
</el-popover>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script setup lang="ts">
|
|
16
|
+
import { reactive, type PropType } from 'vue'
|
|
17
|
+
import { HttpApiV1 as http } from '../core/httpapi/http_api_v1'
|
|
18
|
+
import { ZSYSMessage } from '../components/message'
|
|
19
|
+
import { zsysEventBus } from '../core/common/zsys_eventBus'
|
|
20
|
+
const eventBus = zsysEventBus()
|
|
21
|
+
const view = reactive({
|
|
22
|
+
loading: false
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
const props = defineProps({
|
|
26
|
+
id: { type: BigInt as unknown as PropType<bigint>, required: true },
|
|
27
|
+
api_url: { type: String, required: true },
|
|
28
|
+
module: { type: String, default:'all' }
|
|
29
|
+
// closeOnClickModal: { type: Boolean, default: true }
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// const refresh_list=inject<() => void>('refresh_list')
|
|
33
|
+
// console.log(refresh_list);
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
const confirm = async () => {
|
|
37
|
+
view.loading = true
|
|
38
|
+
try {
|
|
39
|
+
let res = await http.Post(props.api_url, { id: props.id })
|
|
40
|
+
if (res.IsSuccess) {
|
|
41
|
+
view.loading = false
|
|
42
|
+
ZSYSMessage.ShowSuccess("删除成功")
|
|
43
|
+
console.log('aud',props.module);
|
|
44
|
+
console.log(props.module);
|
|
45
|
+
|
|
46
|
+
eventBus.emit("aud", {module:props.module, id: props.id })
|
|
47
|
+
} else {
|
|
48
|
+
ZSYSMessage.ShowError("删除失败")
|
|
49
|
+
}
|
|
50
|
+
} catch (e) {
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
view.loading = false
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
<style scoped></style>
|
package/core/app.ts
CHANGED
|
@@ -1,13 +1,32 @@
|
|
|
1
1
|
import { createApp } from 'vue'
|
|
2
|
-
import '../css/
|
|
2
|
+
import '../css/common.css'
|
|
3
3
|
import app from '../view/app.vue'
|
|
4
|
+
import {createPinia} from 'pinia'
|
|
5
|
+
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
|
|
4
6
|
|
|
5
7
|
import ElementPlus from 'element-plus' //导入 ElementPlus 组件库的所有模块和功能
|
|
6
8
|
import 'element-plus/dist/index.css' //导入 ElementPlus 组件库所需的全局 CSS 样式
|
|
7
9
|
import zhCn from 'element-plus/es/locale/lang/zh-cn'
|
|
8
10
|
|
|
11
|
+
|
|
12
|
+
//路由
|
|
13
|
+
import {initRouter,addFrameRouter} from './router.ts' //导入路由模块
|
|
14
|
+
|
|
15
|
+
|
|
9
16
|
const zsysapp=createApp(app)
|
|
10
17
|
|
|
18
|
+
const pinia=createPinia()
|
|
19
|
+
pinia.use(piniaPluginPersistedstate)
|
|
20
|
+
|
|
21
|
+
addFrameRouter({path:'/desktop',component:()=>import('../../test_view/test_desktop.vue')})
|
|
22
|
+
|
|
23
|
+
zsysapp.use(initRouter()) //将 Vue Router 插件注册到 Vue 应用中
|
|
24
|
+
zsysapp.use(ElementPlus,{locale: zhCn}) //将 ElementPlus 插件注册到 Vue 应用中
|
|
25
|
+
zsysapp.use(pinia)
|
|
26
|
+
//从后台获取全局信息
|
|
27
|
+
// import {GetPublish}from '../core/runtime.ts'
|
|
28
|
+
// GetPublish(zsysapp)
|
|
11
29
|
zsysapp.mount('#app')
|
|
12
30
|
|
|
13
|
-
|
|
31
|
+
|
|
32
|
+
export default {zsysapp}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export class CommonHelper{
|
|
2
|
+
//数组中是否存在字符串
|
|
3
|
+
static StringArrayHasString(array:string[],str:string):boolean{
|
|
4
|
+
return array.indexOf(str) !== -1
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
//数组中是否存在另一数组中的任意一个元素
|
|
8
|
+
static StringArrayHasStringArrayOne(array:string[],array2:string[]):boolean{
|
|
9
|
+
for(const s of array2)
|
|
10
|
+
{
|
|
11
|
+
if(CommonHelper.StringArrayHasString(array,s)){
|
|
12
|
+
return true
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return false
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//数组2是否包含在数组1中
|
|
19
|
+
static StringArrayHasStringArray(array:string[],array2:string[]):boolean{
|
|
20
|
+
if(array2.length==0){return false}
|
|
21
|
+
for(const s of array2)
|
|
22
|
+
{
|
|
23
|
+
if(!CommonHelper.StringArrayHasString(array,s)){
|
|
24
|
+
return false
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return true
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// src/utils/eventBus.ts
|
|
2
|
+
import mitt, { type Emitter } from 'mitt';
|
|
3
|
+
|
|
4
|
+
// 1. 定义所有事件类型
|
|
5
|
+
type Events = {
|
|
6
|
+
// aud:添加add、修改update、删除del数据事件
|
|
7
|
+
'aud': { module:string, id: bigint };
|
|
8
|
+
// 通知事件
|
|
9
|
+
// 'notification:show': { message: string; type: 'success' | 'error' | 'warning' };
|
|
10
|
+
// 无 payload 的事件
|
|
11
|
+
// 'close': void;
|
|
12
|
+
// 添加更多事件...
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// 2. 创建 emitter 单例
|
|
16
|
+
const emitter: Emitter<Events> = mitt<Events>();
|
|
17
|
+
|
|
18
|
+
// 3. 导出常用的方法(封装以便统一管理)
|
|
19
|
+
export const zsysEventBus = () => {
|
|
20
|
+
return {
|
|
21
|
+
// 触发事件
|
|
22
|
+
emit: emitter.emit,
|
|
23
|
+
|
|
24
|
+
// 监听事件
|
|
25
|
+
on: emitter.on,
|
|
26
|
+
|
|
27
|
+
// 取消监听
|
|
28
|
+
off: emitter.off,
|
|
29
|
+
|
|
30
|
+
// 一次性监听
|
|
31
|
+
once: <T extends keyof Events>(event: T, handler: (payload: Events[T]) => void) => {
|
|
32
|
+
const onceHandler = (payload: Events[T]) => {
|
|
33
|
+
handler(payload);
|
|
34
|
+
emitter.off(event, onceHandler);
|
|
35
|
+
};
|
|
36
|
+
emitter.on(event, onceHandler);
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
// 清空所有监听
|
|
40
|
+
clearAll: emitter.all.clear
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// 4. 导出类型
|
|
45
|
+
export type EventBus = ReturnType<typeof zsysEventBus>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 格式化日期为 YYYY-MM-DD HH:mm:ss 格式
|
|
3
|
+
* @param date 可被Date解析的任何值
|
|
4
|
+
* @returns 格式化后的日期字符串
|
|
5
|
+
*/
|
|
6
|
+
export function formatDateTime(date: Date | string | number): string {
|
|
7
|
+
if (date == '0001-01-01T00:00:00Z') {
|
|
8
|
+
return ''
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const d = new Date(date);
|
|
12
|
+
|
|
13
|
+
if (isNaN(d.getTime())) {
|
|
14
|
+
return ''
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return [
|
|
18
|
+
d.getFullYear(),
|
|
19
|
+
(d.getMonth() + 1).toString().padStart(2, '0'),
|
|
20
|
+
d.getDate().toString().padStart(2, '0')
|
|
21
|
+
].join('-') + ' ' + [
|
|
22
|
+
d.getHours().toString().padStart(2, '0'),
|
|
23
|
+
d.getMinutes().toString().padStart(2, '0'),
|
|
24
|
+
d.getSeconds().toString().padStart(2, '0')
|
|
25
|
+
].join(':');
|
|
26
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export class HttpApiReturnData{
|
|
2
|
+
error_code:number
|
|
3
|
+
message:string
|
|
4
|
+
data:object
|
|
5
|
+
|
|
6
|
+
constructor(){
|
|
7
|
+
this.error_code=1
|
|
8
|
+
this.message="未知错误"
|
|
9
|
+
this.data={}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
get IsSuccess():boolean{
|
|
13
|
+
return this.error_code==0?true:false
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
static fromObject(obj: Partial<HttpApiReturnData>): HttpApiReturnData {
|
|
17
|
+
const instance = new HttpApiReturnData();
|
|
18
|
+
Object.assign(instance, obj);
|
|
19
|
+
return instance;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// export class ApiV1Res<T>{
|
|
24
|
+
// error_code:number
|
|
25
|
+
// message:string
|
|
26
|
+
// data:object
|
|
27
|
+
|
|
28
|
+
// constructor(){
|
|
29
|
+
// this.error_code=1
|
|
30
|
+
// this.message="未知错误"
|
|
31
|
+
// this.data={}
|
|
32
|
+
// }
|
|
33
|
+
|
|
34
|
+
// get IsSuccess():boolean{
|
|
35
|
+
// return this.error_code==0?true:false
|
|
36
|
+
// }
|
|
37
|
+
|
|
38
|
+
// static fromObject(obj: Partial<HttpApiReturnData>): HttpApiReturnData {
|
|
39
|
+
// const instance = new HttpApiReturnData();
|
|
40
|
+
// Object.assign(instance, obj);
|
|
41
|
+
// return instance;
|
|
42
|
+
// }
|
|
43
|
+
// }
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
// let http_api_v1_url={
|
|
2
|
+
// login:'api/login'
|
|
3
|
+
// }
|
|
4
|
+
const hostUrl = `${window.location.protocol}//${window.location.host}/`;
|
|
5
|
+
|
|
6
|
+
// 类型安全声明(防止TS报错)
|
|
7
|
+
declare global {
|
|
8
|
+
interface Window {
|
|
9
|
+
location: Location;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
import http_axios from "./http_axios"
|
|
14
|
+
import { HttpApiReturnData } from "./http_api_return_data"
|
|
15
|
+
|
|
16
|
+
export class HttpApiV1 {
|
|
17
|
+
//系统基础接口
|
|
18
|
+
static api_host = hostUrl//'http://localhost:1788/' //1788
|
|
19
|
+
//当前用户
|
|
20
|
+
static url_login: string = 'api/login'
|
|
21
|
+
static url_usercenter: string = 'api/user_center'
|
|
22
|
+
static url_change_password: string = 'api/change_password'
|
|
23
|
+
static url_user_permission: string = 'api/user_permission'
|
|
24
|
+
//用户管理
|
|
25
|
+
static url_user_save: string = 'api/user_save'
|
|
26
|
+
static url_user_list: string = 'api/user_list'
|
|
27
|
+
static url_user_export: string = 'api/user_export'
|
|
28
|
+
static url_user_del: string = 'api/user_del'
|
|
29
|
+
static url_user_detail: string = 'api/user_detail'
|
|
30
|
+
static url_user_change_pwd: string = 'api/user_change_pwd'
|
|
31
|
+
//组织架构
|
|
32
|
+
static url_department_save: string = 'api/department_save'
|
|
33
|
+
static url_department_list: string = 'api/department_list'
|
|
34
|
+
static url_department_del: string = 'api/department_del'
|
|
35
|
+
static url_department_detail: string = 'api/department_detail'
|
|
36
|
+
//职务
|
|
37
|
+
static url_position_list: string = 'api/position_list'
|
|
38
|
+
static url_position_detail: string = 'api/position_detail'
|
|
39
|
+
static url_position_save: string = 'api/position_save'
|
|
40
|
+
static url_position_del: string = 'api/position_del'
|
|
41
|
+
//系统日志
|
|
42
|
+
static url_syslog_list: string = 'api/syslog_list'
|
|
43
|
+
static url_syslog_config_detail: string = 'api/syslog_config_detail'
|
|
44
|
+
static url_syslog_config_save: string = 'api/syslog_config_save'
|
|
45
|
+
//备份
|
|
46
|
+
static url_backup_start: string = 'api/backup_start'
|
|
47
|
+
static url_backup_list: string = 'api/backup_list'
|
|
48
|
+
static url_backup_del: string = 'api/backup_del'
|
|
49
|
+
static url_backup_config_get: string = 'api/backup_config_get'
|
|
50
|
+
static url_backup_config_save: string = 'api/backup_config_save'
|
|
51
|
+
//权限
|
|
52
|
+
static url_syspermission_list: string = 'api/permission_list'
|
|
53
|
+
static url_sysrole_list: string = 'api/role_list'
|
|
54
|
+
static url_sysrole_del: string = 'api/role_del'
|
|
55
|
+
static url_sysrole_save: string = 'api/role_save'
|
|
56
|
+
static url_sysrole_detail: string = 'api/role_detail'
|
|
57
|
+
//导出
|
|
58
|
+
static url_export_detail: string = 'api/export_detail'
|
|
59
|
+
static url_export_file: string = 'api/export_file'
|
|
60
|
+
// 系统
|
|
61
|
+
static url_system_publish: string = 'api/system_publish'
|
|
62
|
+
|
|
63
|
+
//应用级接口==========================
|
|
64
|
+
//桌面
|
|
65
|
+
static url_desktop: string = 'api/desktop'
|
|
66
|
+
static url_desktop_config_detail: string = 'api/desktop_config_detail'
|
|
67
|
+
static url_desktop_config_save: string = 'api/desktop_config_save'
|
|
68
|
+
//数据看板
|
|
69
|
+
static url_chart_weekly: string = 'api/chart_weekly'
|
|
70
|
+
static url_chart_all: string = 'api/chart_all'
|
|
71
|
+
static url_chart_last: string = 'api/chart_last'
|
|
72
|
+
//事件
|
|
73
|
+
static url_event_list: string = 'api/event_list'
|
|
74
|
+
static url_event_detail: string = 'api/event_detail'
|
|
75
|
+
static url_event_file: string = 'api/event_file'
|
|
76
|
+
static url_event_dispose: string = 'api/event_dispose'
|
|
77
|
+
//规则
|
|
78
|
+
static url_rule_list: string = 'api/rule_list'
|
|
79
|
+
static url_rule_save: string = 'api/rule_save'
|
|
80
|
+
static url_rule_del: string = 'api/rule_del'
|
|
81
|
+
static url_rule_detail: string = 'api/rule_detail'
|
|
82
|
+
//时间模板
|
|
83
|
+
static url_time_list: string = 'api/time_list'
|
|
84
|
+
static url_time_save: string = 'api/time_save'
|
|
85
|
+
static url_time_del: string = 'api/time_del'
|
|
86
|
+
static url_time_detail: string = 'api/time_detail'
|
|
87
|
+
//区域
|
|
88
|
+
static url_area_save: string = 'api/area_save'
|
|
89
|
+
static url_area_list: string = 'api/area_list'
|
|
90
|
+
static url_area_del: string = 'api/area_del'
|
|
91
|
+
static url_area_detail: string = 'api/area_detail'
|
|
92
|
+
//设备
|
|
93
|
+
static url_equipment_save: string = 'api/equipment_save'
|
|
94
|
+
static url_equipment_list: string = 'api/equipment_list'
|
|
95
|
+
static url_equipment_detail: string = 'api/equipment_detail'
|
|
96
|
+
static url_equipment_del: string = 'api/equipment_del'
|
|
97
|
+
//通道画面
|
|
98
|
+
static url_channel_save: string = 'api/channel_save'
|
|
99
|
+
static url_channel_list: string = 'api/channel_list'
|
|
100
|
+
static url_channel_detail: string = 'api/channel_detail'
|
|
101
|
+
static url_channel_del: string = 'api/channel_del'
|
|
102
|
+
|
|
103
|
+
static GetFullApiUrl(api: string): string {
|
|
104
|
+
return this.api_host + api
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
static async Post(url: string, obj: object): Promise<HttpApiReturnData> {
|
|
108
|
+
try {
|
|
109
|
+
let res = await http_axios.post(this.api_host + url, obj)
|
|
110
|
+
// console.log("请求完毕");
|
|
111
|
+
|
|
112
|
+
let re: HttpApiReturnData = HttpApiReturnData.fromObject(res.data)
|
|
113
|
+
// let re:HttpApiReturnData=HttpApiReturnData{
|
|
114
|
+
// error_code:res.
|
|
115
|
+
// }
|
|
116
|
+
return re
|
|
117
|
+
// if (res.data instanceof HttpApiReturnData) {
|
|
118
|
+
// let re: HttpApiReturnData = obj as HttpApiReturnData;
|
|
119
|
+
// return re
|
|
120
|
+
// }else{
|
|
121
|
+
// return Promise.reject('访问服务器失败')
|
|
122
|
+
// }
|
|
123
|
+
} catch (err) {
|
|
124
|
+
console.log(err);
|
|
125
|
+
|
|
126
|
+
return Promise.reject('访问服务器失败')
|
|
127
|
+
}
|
|
128
|
+
// await http_axios.post(url,obj).then(res=>{
|
|
129
|
+
// // console.log(res.data.error_code)
|
|
130
|
+
// if (res.data instanceof HttpApiReturnData) {
|
|
131
|
+
// let re: HttpApiReturnData = obj as HttpApiReturnData;
|
|
132
|
+
// return re
|
|
133
|
+
// } else {
|
|
134
|
+
// return Promise.reject('访问服务器失败')
|
|
135
|
+
// // console.error('对象不是Person类型');
|
|
136
|
+
// }
|
|
137
|
+
// }).catch(err=>{
|
|
138
|
+
// return Promise.reject('访问服务器失败')
|
|
139
|
+
// })
|
|
140
|
+
// // .finally(()=>{
|
|
141
|
+
|
|
142
|
+
// // })
|
|
143
|
+
// return Promise.reject('访问服务器失败')
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// http_axios.interceptors.response.use(res=>{
|
|
147
|
+
// return res
|
|
148
|
+
// },err=>{
|
|
149
|
+
// return Promise.reject(err)
|
|
150
|
+
// })
|
|
151
|
+
}
|