9eadeb70 by lihua

数据服务前端代码

1 parent 24ba6db6
1 # 页面标题 1 # 页面标题
2 VITE_APP_TITLE = 数据资产管理系统 2 VITE_APP_TITLE = 可信数据空间
3 # 接口域名 3 # 接口域名
4 # VITE_API_BASEURL = https://www.zgsjzc.com/api 4 # VITE_API_BASEURL = https://www.zgsjzc.com/api
5 # VITE_API_BASEURL = https://swzl-test.csbr.cn/api 5 # VITE_API_BASEURL = https://swzl-test.csbr.cn/api
6 VITE_API_BASEURL = http://192.168.6.20:28052/ 6 # VITE_API_BASEURL = http://localhost:9000
7 VITE_API_BASEURL = http://192.168.9.1:58052/
7 # VITE_API_BASEURL = http://192.168.6.20:8052/ 8 # VITE_API_BASEURL = http://192.168.6.20:8052/
8 9
9 VITE_IDASS_BASEURL = https://daop-test.zgsjzc.com/portalLogin 10 VITE_IDASS_BASEURL = https://daop-test.zgsjzc.com/portalLogin
...@@ -97,6 +98,9 @@ VITE_APP_CIRCULATION = https://daop-lt-test.zgsjzc.com/ ...@@ -97,6 +98,9 @@ VITE_APP_CIRCULATION = https://daop-lt-test.zgsjzc.com/
97 #数据加工交付 98 #数据加工交付
98 VITE_APP_DATA_DELIVERY = https://daop-jgjf-test.zgsjzc.com/ 99 VITE_APP_DATA_DELIVERY = https://daop-jgjf-test.zgsjzc.com/
99 100
101 #数据服务接口地址
102 VITE_APP_SERVICE_BASEURL = ms-daop-jgjf-data-open-service
103
100 # 本地访问地址 104 # 本地访问地址
101 # VITE_API_CIRCULATION_URL = http://localhost:9000/circulation 105 # VITE_API_CIRCULATION_URL = http://localhost:9000/circulation
102 106
......
1 # 页面标题 1 # 页面标题
2 VITE_APP_TITLE = 数据资产管理系统 2 VITE_APP_TITLE = 可信数据空间
3 # 接口域名 3 # 接口域名
4 VITE_API_BASEURL = https://daop-zcgl-test.zgsjzc.com/ 4 VITE_API_BASEURL = https://daop-zcgl-test.zgsjzc.com/
5 # VITE_API_BASEURL = http://49.4.26.201:31709/ 5 # VITE_API_BASEURL = http://49.4.26.201:31709/
...@@ -122,6 +122,9 @@ VITE_API_MESSAGE = ms-daop-message-service ...@@ -122,6 +122,9 @@ VITE_API_MESSAGE = ms-daop-message-service
122 #企业信息接口 122 #企业信息接口
123 VITE_APP_PERSONAL_URL = ms-daop-personel-service 123 VITE_APP_PERSONAL_URL = ms-daop-personel-service
124 124
125 #数据服务接口地址
126 VITE_APP_SERVICE_BASEURL = ms-daop-jgjf-data-open-service
127
125 #流通平台接口地址 128 #流通平台接口地址
126 VITE_APP_CIRCULATION = https://daop-lt-test.zgsjzc.com/ 129 VITE_APP_CIRCULATION = https://daop-lt-test.zgsjzc.com/
127 #数据加工交付 130 #数据加工交付
......
...@@ -32,10 +32,10 @@ export const getSystemMenu = (params, isAdmin = false) => { ...@@ -32,10 +32,10 @@ export const getSystemMenu = (params, isAdmin = false) => {
32 isAdmin 32 isAdmin
33 ? `${ 33 ? `${
34 import.meta.env.VITE_APP_AUTH_URL 34 import.meta.env.VITE_APP_AUTH_URL
35 }/product-menu-permission/tenant/get-product-menu?tenantGuid=${params.tenantGuid}&platformSystemGuid=32774fcfdf5e43e8b866660374d8bced` 35 }/product-menu-permission/tenant/get-product-menu?tenantGuid=${params.tenantGuid}&platformSystemGuid=4149c763d70948b195eb3d4b997c1722`
36 : `${ 36 : `${
37 import.meta.env.VITE_APP_AUTH_URL 37 import.meta.env.VITE_APP_AUTH_URL
38 }/product-menu-permission/staff/get-product-menu-template?platformSystemGuid=32774fcfdf5e43e8b866660374d8bced`, 38 }/product-menu-permission/staff/get-product-menu-template?platformSystemGuid=4149c763d70948b195eb3d4b997c1722`,
39 method: "get", 39 method: "get",
40 }); 40 });
41 }; 41 };
...@@ -247,6 +247,21 @@ export const getDataSource = (params) => request({ ...@@ -247,6 +247,21 @@ export const getDataSource = (params) => request({
247 method: "post", 247 method: "post",
248 data: params, 248 data: params,
249 }); 249 });
250
251 /** 获取数据源列表 */
252 export const getSchemaTableList = (params) => request({
253 url:`${import.meta.env.VITE_APP_DATA_SOURCE_URL}/data-source/schema-table-page-list`,
254 method: 'post',
255 data: params
256 })
257
258 // 获取表结构
259 export const tableColumnList = (params)=> request({
260 url:`${import.meta.env.VITE_APP_DATA_SOURCE_URL}/data-source/table-column-list`,
261 method: 'post',
262 data: params
263 })
264
250 // 新增 265 // 新增
251 export const addDataSource = (params) => request({ 266 export const addDataSource = (params) => request({
252 url: `${import.meta.env.VITE_APP_DATA_SOURCE_URL}/data-source/save`, 267 url: `${import.meta.env.VITE_APP_DATA_SOURCE_URL}/data-source/save`,
...@@ -289,6 +304,12 @@ export const getAllFlowData = (params) => request({ ...@@ -289,6 +304,12 @@ export const getAllFlowData = (params) => request({
289 method: 'get', 304 method: 'get',
290 params 305 params
291 }) 306 })
307
308 export const getParamsDictList = (dictType) => request({
309 url: `${import.meta.env.VITE_APP_CONFIG_URL}/dict/data/get-by-dictType?dictType=${dictType}`,
310 method: 'get',
311 })
312
292 // 获取资产/价值评估机构数据 313 // 获取资产/价值评估机构数据
293 export const getSingleList = (params) => request({ 314 export const getSingleList = (params) => request({
294 url: `${import.meta.env.VITE_APP_PERSONAL_URL}/tenant/singlePage`, 315 url: `${import.meta.env.VITE_APP_PERSONAL_URL}/tenant/singlePage`,
...@@ -316,4 +337,11 @@ export const getParamsList = (params) => request({ ...@@ -316,4 +337,11 @@ export const getParamsList = (params) => request({
316 url: `${import.meta.env.VITE_APP_CONFIG_URL}/dict/data/get-by-dictType`, 337 url: `${import.meta.env.VITE_APP_CONFIG_URL}/dict/data/get-by-dictType`,
317 method: 'get', 338 method: 'get',
318 params 339 params
319 })
...\ No newline at end of file ...\ No newline at end of file
340 })
341
342 // sql验证
343 export const checkSql = (params) => request({
344 url:`${import.meta.env.VITE_APP_DATA_SOURCE_URL }/sql-operate/check-sql`,
345 method: 'post',
346 data:params
347 })
......
...@@ -3,25 +3,6 @@ function Layout() { ...@@ -3,25 +3,6 @@ function Layout() {
3 return import('@/layouts/index.vue') 3 return import('@/layouts/index.vue')
4 } 4 }
5 const routes: RouteRecordRaw[] = [ 5 const routes: RouteRecordRaw[] = [
6 // {
7 // path: '/data-asset/register-guide',
8 // component: Layout,
9 // meta: {
10 // title: '登记服务指南',
11 // icon: 'sidebar-videos',
12 // },
13 // children: [{
14 // path: '',
15 // name: 'registerGuide',
16 // component: () => import('@/views/data_asset/registerGuide.vue'),
17 // meta: {
18 // title: '登记服务指南',
19 // sidebar: false,
20 // breadcrumb: false,
21 // cache: true
22 // },
23 // }]
24 // },
25 { 6 {
26 path: '/data-asset/register-catalog', 7 path: '/data-asset/register-catalog',
27 component: Layout, 8 component: Layout,
......
...@@ -253,47 +253,5 @@ const routes: RouteRecordRaw[] = [ ...@@ -253,47 +253,5 @@ const routes: RouteRecordRaw[] = [
253 }, 253 },
254 ], 254 ],
255 }, 255 },
256 {
257 path: '/data-asset-register/register-progress',
258 component: Layout,
259 meta: {
260 title: '登记进度一览',
261 icon: 'ep:grid',
262 },
263 children: [
264 {
265 path: '',
266 name: 'registerProgress',
267 component: () => import('@/views/data_asset/registerProgress.vue'),
268 meta: {
269 title: '登记进度一览',
270 sidebar: false,
271 cache: true,
272 breadcrumb: false,
273 },
274 },
275 ]
276 },
277 {
278 path: '/data-asset-register/contract-progress',
279 component: Layout,
280 meta: {
281 title: '合同进度一览',
282 icon: 'ep:grid',
283 },
284 children: [
285 {
286 path: '',
287 name: 'contractProgress',
288 component: () => import('@/views/data_asset/contractProgress.vue'),
289 meta: {
290 title: '合同进度一览',
291 sidebar: false,
292 cache: true,
293 breadcrumb: false,
294 },
295 },
296 ]
297 }
298 ] 256 ]
299 export default routes 257 export default routes
......
1 import type { RouteRecordRaw } from 'vue-router'
2
3 function Layout() {
4 return import('@/layouts/index.vue')
5 }
6
7 const routes: RouteRecordRaw[] = [
8 {
9 path: '/data-service/api-management',
10 component: Layout,
11 meta: {
12 title: '管理API',
13 icon: 'sidebar-videos',
14 },
15 children: [
16 {
17 path: '',
18 name: 'apiManagement',
19 component: () => import('@/views/data_service/apiManagement.vue'),
20 meta: {
21 title: '管理API',
22 sidebar: false,
23 breadcrumb: false,
24 cache: true
25 }
26 },
27 {
28 path: 'api-create',
29 name: 'apiCreate',
30 component: () => import('@/views/data_service/apiCreate.vue'),
31 meta: {
32 title: '新建API',
33 sidebar: false,
34 breadcrumb: false,
35 cache: true,
36 reuse: true,
37 editPage: true
38 },
39 beforeEnter: (to, from) => {
40 if (to.query.type) {
41 to.meta.title = `新建(${to.query.type == '1' ? '单表API' : (to.query.type == '2' ? '自定义sql' : '注册API')})`;
42 to.meta.editPage = true;
43 } else if (to.query.detail) {
44 to.meta.title = `详情-${to.query.apiName}`;
45 to.meta.editPage = false;
46 } else if (to.query.guid) {
47 to.meta.title = `编辑-${to.query.apiName}`;
48 to.meta.editPage = true;
49 }
50 }
51 },
52 {
53 // path: 'processDetail',
54 // name: 'APIProcessDetail',
55 path: 'api-detail',
56 name: 'apiDetail',
57 component: () => import('@/views/data_service/detail_serviceApi.vue'),
58 meta: {
59 title: '流程详情',
60 sidebar: false,
61 breadcrumb: false,
62 cache: true,
63 reuse: true
64 }
65 },
66 {
67 path: 'processDetail',
68 name: 'APIProcessDetail',
69 component: () => import('@/views/detail.vue'),
70 meta: {
71 title: '流程详情',
72 sidebar: false,
73 breadcrumb: false,
74 cache: true,
75 reuse: true
76 }
77 },
78 ],
79 },
80 {
81 path: '/data-service/api-test',
82 component: Layout,
83 meta: {
84 title: '测试API',
85 icon: 'sidebar-videos',
86 },
87 children: [
88 {
89 path: '',
90 name: 'apiTest',
91 component: () => import('@/views/data_service/apiTest.vue'),
92 meta: {
93 title: '测试API',
94 sidebar: false,
95 breadcrumb: false,
96 cache: true
97 },
98 },
99 ],
100 },
101 ]
102
103 export default routes
...@@ -3,6 +3,7 @@ import generatedRoutes from 'virtual:generated-pages' ...@@ -3,6 +3,7 @@ import generatedRoutes from 'virtual:generated-pages'
3 import type { RouteRecordRaw } from 'vue-router' 3 import type { RouteRecordRaw } from 'vue-router'
4 import DataAssess from './modules/dataAsset'; 4 import DataAssess from './modules/dataAsset';
5 import DataAssetRegistry from './modules/dataAssetRegistry'; 5 import DataAssetRegistry from './modules/dataAssetRegistry';
6 import DataService from './modules/dataService';
6 7
7 import useSettingsStore from '@/store/modules/settings' 8 import useSettingsStore from '@/store/modules/settings'
8 9
...@@ -90,7 +91,8 @@ const systemRoutes: RouteRecordRaw[] = [ ...@@ -90,7 +91,8 @@ const systemRoutes: RouteRecordRaw[] = [
90 // 动态路由(异步路由、导航栏路由) 91 // 动态路由(异步路由、导航栏路由)
91 const asyncRoutes: RouteRecordRaw[] = [ 92 const asyncRoutes: RouteRecordRaw[] = [
92 ...DataAssess, 93 ...DataAssess,
93 ...DataAssetRegistry, 94 ...DataService,
95 // ...DataAssetRegistry,
94 ] 96 ]
95 97
96 const constantRoutesByFilesystem = generatedRoutes.filter((item) => { 98 const constantRoutesByFilesystem = generatedRoutes.filter((item) => {
......
...@@ -40,7 +40,7 @@ const globalSettings: Settings.all = { ...@@ -40,7 +40,7 @@ const globalSettings: Settings.all = {
40 }, 40 },
41 "home": { 41 "home": {
42 "enable": false, 42 "enable": false,
43 "title": "数据资产管理系统" 43 "title": "可信数据空间"
44 }, 44 },
45 "breadcrumb": { 45 "breadcrumb": {
46 "enable": true 46 "enable": true
......
1 const useDataAnonymizationStore = defineStore(
2 // 资产目录guid
3 'isRefresh',
4 () => {
5 const isRefresh = ref<boolean>(false);
6 function setIsRefresh(v: boolean) {
7 isRefresh.value = v;
8 }
9
10 const isAnonPageRefresh = ref<boolean>(false);
11 function setIsAnonPageRefresh(v: boolean) {
12 isAnonPageRefresh.value = v;
13 }
14
15 return {
16 isRefresh,
17 isAnonPageRefresh,
18 setIsRefresh,
19 setIsAnonPageRefresh,
20 };
21 }
22 );
23
24 export default useDataAnonymizationStore;
1 const useDataCatalogStore = defineStore(
2 // 主题域guid
3 'domainGuid',
4 () => {
5 const domainGuid = ref<string>("")
6
7 function set(guid: any) {
8 domainGuid.value = guid;
9 }
10
11 return {
12 domainGuid,
13 set
14 }
15 },
16 )
17
18 export default useDataCatalogStore
19
...\ No newline at end of file ...\ No newline at end of file
1 const useEntryStore = defineStore(
2 // api标签分类guid
3 'isRefresh',
4
5 () => {
6
7 const isRefresh = ref(false);
8 function setIsRefresh(update: boolean) {
9 isRefresh.value = update;
10 }
11
12 return {
13 isRefresh,
14 setIsRefresh,
15 }
16 },
17 )
18
19 export default useEntryStore
...\ No newline at end of file ...\ No newline at end of file
1 const useDataMetaStore = defineStore("dataMeta", () => {
2 const guid: Ref<string> = ref("")
3 const databaseName = ref("")
4 const tableName = ref("")
5 const databaseChName = ref("");
6 const databaseGuid = ref('');
7 const fieldGuid = ref("");
8 const fieldEnName = ref('');
9 const isFieldLineage = ref(false);
10 const set = (prop?: {
11 tableGuid: string;
12 table: string;
13 databas: string;
14 databaseCh: string;
15 dsGuid: string;
16 fGuid?: string;
17 fEnName?: string;
18 isFieldLine?: boolean;
19 }) => {
20 guid.value = prop?.tableGuid || "";
21 databaseName.value = prop?.databas || "";
22 tableName.value = prop?.table || "";
23 databaseChName.value = prop?.databaseCh || "";
24 databaseGuid.value = prop?.dsGuid || "";
25 fieldGuid.value = prop?.fGuid || "";
26 fieldEnName.value = prop?.fEnName || "";
27 isFieldLineage.value = prop?.isFieldLine ?? false;
28 }
29 return {
30 guid,
31 databaseName,
32 tableName,
33 databaseChName,
34 databaseGuid,
35 fieldGuid,
36 fieldEnName,
37 isFieldLineage,
38 set
39 }
40 })
41
42 export default useDataMetaStore
...\ No newline at end of file ...\ No newline at end of file
1 const useDataQualityStore = defineStore(
2 // 质检表分组guid
3 'modelGroupGuid',
4
5 () => {
6 const modelGroupGuid = ref<string>("")
7
8 function set(guid: any) {
9 modelGroupGuid.value = guid;
10 }
11
12 const modelGuid = ref<string>("")
13
14 function setModelGuid(guid: any) {
15 modelGuid.value = guid;
16 }
17
18 const planType = ref<number>(0);
19
20 function setPlanType(type: any) {
21 planType.value = type;
22 }
23
24 const defaultPlanType = ref<number>(1);
25
26 function setDefaultPlanType(type: any) {
27 defaultPlanType.value = type;
28 }
29
30 const isUpdate = ref(false);
31 function setIsUpdate(update: boolean) {
32 isUpdate.value = update;
33 }
34
35
36 return {
37 modelGroupGuid,
38 set,
39 setModelGuid,
40 modelGuid,
41 planType,
42 isUpdate,
43 setIsUpdate,
44 setPlanType,
45 setDefaultPlanType,
46 defaultPlanType
47 }
48 },
49 )
50
51 export default useDataQualityStore
...\ No newline at end of file ...\ No newline at end of file
1 const useDataAsyncStore = defineStore("asyncGuid",()=>{
2 const taskGuid = ref("")
3 const set = (guid:string)=>{
4 taskGuid.value = guid
5 }
6 return {
7 taskGuid,
8 set
9 }
10 })
11
12 export default useDataAsyncStore
...\ No newline at end of file ...\ No newline at end of file
1 const useDataStandardsStore = defineStore(
2 // 主题域guid
3 'domainGuid',
4 () => {
5 const isAdd = ref(false)
6 const standardSetGuid = ref("")
7 const guid = ref("")
8 function set(guid: any) {
9 isAdd.value = guid;
10 }
11 function setGuid(sGuid,stanGuid){
12 guid.value = sGuid
13 standardSetGuid.value = stanGuid
14 }
15 return {
16 isAdd,
17 set,
18 guid,
19 setGuid,
20 standardSetGuid,
21 }
22 },
23 )
24
25 export default useDataStandardsStore
...\ No newline at end of file ...\ No newline at end of file
...@@ -46,4 +46,4 @@ export const commonPageConfig = { ...@@ -46,4 +46,4 @@ export const commonPageConfig = {
46 } 46 }
47 47
48 /** 通用的系统guid */ 48 /** 通用的系统guid */
49 export const SystemGuid = '32774fcfdf5e43e8b866660374d8bced';
...\ No newline at end of file ...\ No newline at end of file
49 export const SystemGuid = '4149c763d70948b195eb3d4b997c1722';
...\ No newline at end of file ...\ No newline at end of file
......
1 <route lang="yaml"> 1 <route lang="yaml">
2 name: notFound 2 name: notFound
3 meta: 3 meta:
4 title: 数据资产管理 4 title: 可信数据空间
5 constant: true 5 constant: true
6 layout: false 6 layout: false
7 </route> 7 </route>
......
1 <route lang="yaml">
2 name: apiCalls
3 </route>
4
5 <script lang="ts" setup name="apiCalls">
6 import { ref } from 'vue';
7 import { TableColumnWidth } from '@/utils/enum';
8 import { commonPageConfig } from '@/components/PageNav/index';
9 import TableTools from '@/components/Tools/table_tools.vue';
10 import { useRouter, useRoute } from "vue-router";
11 import {
12 getAppProductData,
13 deleteAppProduct
14 } from "@/api/modules/dataService";
15 import useDataServiceStore from "@/store/modules/dataService";
16
17 const { proxy } = getCurrentInstance() as any;
18 const router = useRouter();
19 const dataServiceStore = useDataServiceStore();
20
21 /** 分页及搜索传参信息配置。 */
22 const page = ref({
23 ...commonPageConfig,
24 productName: ''
25 });
26
27 const searchItemList = ref([
28 {
29 type: "input",
30 label: "",
31 field: "productName",
32 default: "",
33 placeholder: "应用名称",
34 clearable: true,
35 }
36 ]);
37
38 const tableInfo = ref({
39 id: 'data-app-table',
40 fields: [
41 { label: "序号", type: "index", width: TableColumnWidth.INDEX, align: "center" },
42 { label: "应用名称", field: "productName", width: 140 },
43 { label: "appKey", field: "appKey", width: 140 },
44 { label: "appSecret", field: "appSecret", width: 120 },
45 {
46 label: "绑定API数", field: "apiBingingNum", width: 100, align: 'right', type: 'chnum'
47 },
48 {
49 label: "调用次数", field: "invokeNum", width: 100, align: 'right', type: 'chnum'
50 },
51 {
52 label: "调用异常数", field: "invokeErrorNum", width: 105, align: 'right', type: 'chnum'
53 },
54 { label: "应用负责人", field: "directorName", width: TableColumnWidth.USERNAME },
55 { label: "修改人", field: "updateUserName", width: TableColumnWidth.USERNAME },
56 { label: "修改时间", field: "updateTime", width: TableColumnWidth.DATETIME },
57 ],
58 data: [],
59 page: {
60 type: "normal",
61 rows: 0,
62 ...page.value,
63 },
64 actionInfo: {
65 label: "操作",
66 type: "btn",
67 width: 120,
68 fixed: 'right',
69 btns: (scope) => {
70 const row = scope.row
71 let btnsArr: any = [];
72 btnsArr.push({
73 label: "编辑", value: "edit", click: (scope) => {
74 router.push({
75 name: 'apiBind',
76 query: {
77 guid: scope.row.guid,
78 productName: scope.row.productName
79 }
80 });
81 }
82 });
83 btnsArr.push({
84 label: "删除", value: "delete", click: (scope) => {
85 if (scope.row.apiBingingNum > 0) {
86 proxy.$ElMessage.warning('该应用有绑定的API,无法删除');
87 return;
88 }
89 proxy.$openMessageBox('确定要删除该应用吗?', () => {
90 deleteAppProduct([scope.row.guid]).then((res: any) => {
91 if (res.code == proxy.$passCode) {
92 page.value.curr = 1;
93 getTableData();
94 proxy.$ElMessage.success("删除成功");
95 } else {
96 proxy.$ElMessage.error(res.msg);
97 }
98 });
99 }, () => {
100 proxy.$ElMessage.info("已取消");
101 })
102 }
103 });
104 return btnsArr
105 },
106 },
107 loading: false
108 })
109
110 const toSearch = (val: any, clear: boolean = false) => {
111 page.value.curr = 1;
112 if (clear) {
113 searchItemList.value.map((item) => (item.default = ""));
114 page.value.productName = '';
115 } else {
116 page.value.productName = val.productName;
117 }
118 getTableData();
119 };
120
121 const tablePageChange = (info) => {
122 page.value.curr = Number(info.curr);
123 page.value.limit = Number(info.limit);
124 getTableData();
125 };
126
127 const getTableDataPromise: any = ref(null);
128 const getTableData = () => {
129 tableInfo.value.loading = true
130 getTableDataPromise.value = getAppProductData({
131 pageIndex: page.value.curr,
132 pageSize: page.value.limit,
133 productName: page.value.productName
134 }).then((res: any) => {
135 getTableDataPromise.value = null;
136 if (res.code == proxy.$passCode) {
137 const data = res.data || {}
138 tableInfo.value.data = data.records || []
139 tableInfo.value.page.limit = data.pageSize
140 tableInfo.value.page.curr = data.pageIndex
141 tableInfo.value.page.rows = data.totalRows
142 } else {
143 proxy.$ElMessage({
144 type: 'error',
145 message: res.msg,
146 })
147 }
148 tableInfo.value.loading = false
149 })
150 };
151
152 const addAppProduct = () => {
153 router.push({
154 name: 'apiBind',
155 });
156 }
157
158 onBeforeMount(() => {
159 toSearch({})
160 })
161
162 onActivated(() => {
163 if (dataServiceStore.isUpdate) {
164 if (getTableDataPromise.value) {
165 getTableDataPromise.value.then(() => {
166 getTableData();
167 dataServiceStore.setIsUpdate(false);
168 });
169 } else {
170 getTableData();
171 dataServiceStore.setIsUpdate(false);
172 }
173 }
174 });
175
176 </script>
177
178 <template>
179 <div class="container_wrap">
180 <div class="table_tool_wrap">
181 <TableTools :searchItems="searchItemList" :searchId="'data-source-search'" @search="toSearch" :init="false" />
182 <div class="tools_btns">
183 <el-button type="primary" @click="addAppProduct" v-preReClick>添加</el-button>
184 </div>
185 </div>
186 <div class="table_panel_wrap">
187 <Table :tableInfo="tableInfo" @tablePageChange="tablePageChange" />
188 </div>
189 </div>
190 </template>
191
192 <style lang="scss" scoped>
193 .table_tool_wrap {
194 width: 100%;
195 height: 84px !important;
196 padding: 0 8px;
197
198 .tools_btns {
199 padding: 0px 0 0;
200 }
201 }
202
203 .table_panel_wrap {
204 width: 100%;
205 height: calc(100% - 84px);
206 padding: 0px 8px 0;
207 }
208 </style>
...\ No newline at end of file ...\ No newline at end of file
1 <route lang="yaml">
2 name: ipWhitelist
3 </route>
4
5 <script lang="ts" setup name="ipWhitelist">
6 import { ref } from 'vue';
7 import { TableColumnWidth } from '@/utils/enum';
8 import TableTools from '@/components/Tools/table_tools.vue';
9 import { commonPageConfig } from '@/components/PageNav/index';
10 import { useRouter, useRoute } from "vue-router";
11 import {
12 getIPList,
13 deleteIP,
14 saveIP,
15 updateIP
16 } from "@/api/modules/dataService";
17 import { useValidator } from '@/hooks/useValidator';
18
19 const { proxy } = getCurrentInstance() as any;
20 const router = useRouter();
21 const { required, regexpValidate } = useValidator();
22
23 /** 分页及搜索传参信息配置。 */
24 const page = ref({
25 ...commonPageConfig,
26 ip: ''
27 });
28
29 const searchItemList = ref([{
30 type: "input",
31 label: "",
32 field: "ip",
33 default: "",
34 placeholder: "IP",
35 clearable: true,
36 }]);
37
38 const currTableData: any = ref({});
39 const tableInfo = ref({
40 id: 'data-app-table',
41 fields: [
42 { label: "序号", type: "index", width: TableColumnWidth.INDEX, align: "center" },
43 { label: "IP", field: "ip", width: 140 },
44 { label: "描述", field: "description", width: TableColumnWidth.DESCRIPTION },
45 { label: "修改人", field: "updateUserName", width: TableColumnWidth.USERNAME },
46 { label: "修改时间", field: "updateTime", width: TableColumnWidth.DATETIME },
47 ],
48 data: [],
49 page: {
50 type: "normal",
51 rows: 0,
52 ...page.value,
53 },
54 actionInfo: {
55 label: "操作",
56 type: "btn",
57 width: 120,
58 fixed: 'right',
59 btns: (scope) => {
60 let btnsArr: any = [];
61 btnsArr.push({
62 label: "编辑", value: "edit", click: (scope) => {
63 currTableData.value = scope.row;
64 IPDialogInfo.value.header.title = '编辑IP';
65 IPDialogInfo.value.type = 'edit';
66 IPFormItems.value[0].default = scope.row.ip;
67 IPFormItems.value[1].default = scope.row.description;
68 IPDialogInfo.value.visible = true;
69 }
70 });
71 btnsArr.push({
72 label: "删除", value: "delete", click: (scope) => {
73 proxy.$openMessageBox('确定要删除该IP吗?', () => {
74 deleteIP([scope.row.guid]).then((res: any) => {
75 if (res.code == proxy.$passCode) {
76 page.value.curr = 1;
77 getTableData();
78 proxy.$ElMessage.success("删除成功");
79 } else {
80 proxy.$ElMessage.error(res.msg);
81 }
82 });
83 }, () => {
84 proxy.$ElMessage.info("已取消");
85 })
86 }
87 });
88 return btnsArr
89 },
90 },
91 loading: false
92 })
93
94 const IPFormItems = ref([{
95 type: 'input',
96 label: 'IP',
97 field: 'ip',
98 default: '',
99 block: true,
100 placeholder: '请输入',
101 maxlength: 50,
102 clearable: true,
103 required: true
104 }, {
105 label: '描述',
106 type: 'textarea',
107 placeholder: '请输入',
108 field: 'description',
109 default: '',
110 maxlength: 200,
111 block: true,
112 clearable: true,
113 required: false
114 }]);
115
116 const IPFormRules = ref({
117 ip: [required("请填写IP"), regexpValidate(/^(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])$/, '请输入合法的IP地址')],
118 });
119
120 const IPDialogInfo = ref({
121 visible: false,
122 size: 480,
123 direction: "column",
124 header: {
125 title: "添加IP",
126 },
127 type: 'add',
128 contents: [
129 {
130 type: 'form',
131 title: '',
132 formInfo: {
133 id: 'add-authorize-form',
134 items: IPFormItems.value,
135 rules: IPFormRules.value
136 }
137 }
138 ],
139 footer: {
140 btns: [
141 { type: "default", label: "取消", value: "cancel" },
142 { type: "primary", label: "确定", value: "submit", loading: false },
143 ],
144 },
145 });
146
147 const IPDialogBtnClick = (btn, info) => {
148 if (btn.value == 'submit') {
149 IPDialogInfo.value.footer.btns[1].loading = true;
150 if (IPDialogInfo.value.type == 'add') {
151 saveIP(info).then((res: any) => {
152 IPDialogInfo.value.footer.btns[1].loading = false;
153 if (res.code == proxy.$passCode) {
154 page.value.curr = 1;
155 getTableData();
156 proxy.$ElMessage({
157 type: 'success',
158 message: `添加IP成功`
159 })
160 IPDialogInfo.value.visible = false;
161 } else {
162 proxy.$ElMessage.error(res.msg);
163 }
164 })
165 } else {
166 info.guid = currTableData.value.guid;
167 updateIP(info).then((res: any) => {
168 IPDialogInfo.value.footer.btns[1].loading = false;
169 if (res.code == proxy.$passCode) {
170 page.value.curr = 1;
171 getTableData();
172 proxy.$ElMessage({
173 type: 'success',
174 message: `编辑IP成功`
175 })
176 IPDialogInfo.value.visible = false;
177 } else {
178 proxy.$ElMessage.error(res.msg);
179 }
180 })
181 }
182 } else if (btn.value == 'cancel') {
183 IPDialogInfo.value.visible = false;
184 }
185 };
186
187 const toSearch = (val: any, clear: boolean = false) => {
188 page.value.curr = 1;
189 if (clear) {
190 searchItemList.value.map((item) => (item.default = ""));
191 page.value.ip = '';
192 } else {
193 page.value.ip = val.ip;
194 }
195 getTableData();
196 };
197
198 const tablePageChange = (info) => {
199 page.value.curr = Number(info.curr);
200 page.value.limit = Number(info.limit);
201 getTableData();
202 };
203
204 const getTableData = () => {
205 tableInfo.value.loading = true
206 getIPList({
207 pageIndex: page.value.curr,
208 pageSize: page.value.limit,
209 ip: page.value.ip
210 }).then((res: any) => {
211 if (res.code == proxy.$passCode) {
212 const data = res.data || {}
213 tableInfo.value.data = data.records || []
214 tableInfo.value.page.limit = data.pageSize
215 tableInfo.value.page.curr = data.pageIndex
216 tableInfo.value.page.rows = data.totalRows
217 } else {
218 proxy.$ElMessage({
219 type: 'error',
220 message: res.msg,
221 })
222 }
223 tableInfo.value.loading = false
224 })
225 };
226
227 const addIPWhite = () => {
228 IPDialogInfo.value.visible = true;
229 IPDialogInfo.value.header.title = '添加IP';
230 IPDialogInfo.value.type = 'add';
231 IPFormItems.value[0].default = '';
232 IPFormItems.value[1].default = ''
233 }
234
235 onBeforeMount(() => {
236 toSearch({})
237 })
238
239 </script>
240
241 <template>
242 <div class="container_wrap">
243 <div class="table_tool_wrap">
244 <TableTools :searchItems="searchItemList" :searchId="'data-source-search'" @search="toSearch" :init="false" />
245 <div class="tools_btns">
246 <el-button type="primary" @click="addIPWhite" v-preReClick>添加</el-button>
247 </div>
248 </div>
249 <div class="table_panel_wrap">
250 <Table :tableInfo="tableInfo" @tablePageChange="tablePageChange" />
251 </div>
252 <!-- 添加编辑IP对话框 -->
253 <Dialog :dialogInfo="IPDialogInfo" @btnClick="IPDialogBtnClick" />
254 </div>
255 </template>
256
257 <style lang="scss" scoped>
258 .table_tool_wrap {
259 width: 100%;
260 height: 84px !important;
261 padding: 0 8px;
262
263 .tools_btns {
264 padding: 0px 0 0;
265 }
266 }
267
268 .table_panel_wrap {
269 width: 100%;
270 height: calc(100% - 84px);
271 padding: 0px 8px 0;
272 }
273 </style>
...\ No newline at end of file ...\ No newline at end of file
...@@ -154,7 +154,7 @@ function testAccount(logonUser: string) { ...@@ -154,7 +154,7 @@ function testAccount(logonUser: string) {
154 <div> 154 <div>
155 <img :src="banner" class="banner"> 155 <img :src="banner" class="banner">
156 <div class="banner_desc"> 156 <div class="banner_desc">
157 <h4>数据资产管理系统</h4> 157 <h4>可信数据空间</h4>
158 <span>激活数据流通体系,释放数据要素新质生产力</span> 158 <span>激活数据流通体系,释放数据要素新质生产力</span>
159 </div> 159 </div>
160 </div> 160 </div>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!