push
8
nervui-operations/.env
Normal file
@@ -0,0 +1,8 @@
|
||||
# port
|
||||
VITE_PORT = 5052
|
||||
|
||||
# spa-title
|
||||
VITE_GLOB_APP_TITLE = nervui-app-develop
|
||||
|
||||
# spa shortname
|
||||
VITE_GLOB_APP_SHORT_NAME = nervui-app-develop
|
||||
20
nervui-operations/.env.development
Normal file
@@ -0,0 +1,20 @@
|
||||
# Whether to open mock
|
||||
VITE_USE_MOCK = true
|
||||
|
||||
# public path
|
||||
VITE_PUBLIC_PATH = /nervui-operations/
|
||||
|
||||
# Cross-domain proxy, you can configure multiple
|
||||
# Please note that no line breaks
|
||||
|
||||
# Delete console
|
||||
VITE_DROP_CONSOLE = false
|
||||
|
||||
# Basic interface address SPA
|
||||
VITE_GLOB_API_URL=/basic-api
|
||||
|
||||
# File upload address, optional
|
||||
VITE_GLOB_UPLOAD_URL=/upload
|
||||
|
||||
# Interface prefix
|
||||
VITE_GLOB_API_URL_PREFIX=
|
||||
35
nervui-operations/.env.production
Normal file
@@ -0,0 +1,35 @@
|
||||
# Whether to open mock
|
||||
VITE_USE_MOCK = true
|
||||
|
||||
# public path
|
||||
VITE_PUBLIC_PATH = /nervui-operations/
|
||||
|
||||
# Delete console
|
||||
VITE_DROP_CONSOLE = true
|
||||
|
||||
# Whether to enable gzip or brotli compression
|
||||
# Optional: gzip | brotli | none
|
||||
# If you need multiple forms, you can use `,` to separate
|
||||
VITE_BUILD_COMPRESS = 'none'
|
||||
|
||||
# Whether to delete origin files when using compress, default false
|
||||
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false
|
||||
|
||||
# Basic interface address SPA
|
||||
VITE_GLOB_API_URL=/app-develop
|
||||
|
||||
# File upload address, optional
|
||||
# It can be forwarded by nginx or write the actual address directly
|
||||
VITE_GLOB_UPLOAD_URL=/upload
|
||||
|
||||
# Interface prefix
|
||||
VITE_GLOB_API_URL_PREFIX=
|
||||
|
||||
# Whether to enable image compression
|
||||
VITE_USE_IMAGEMIN= true
|
||||
|
||||
# use pwa
|
||||
VITE_USE_PWA = false
|
||||
|
||||
# Is it compatible with older browsers
|
||||
VITE_LEGACY = false
|
||||
1
nervui-operations/.version
Normal file
@@ -0,0 +1 @@
|
||||
3.0.1
|
||||
74
nervui-operations/build.sh
Normal file
@@ -0,0 +1,74 @@
|
||||
#!/bin/bash
|
||||
SOURCE="$0"
|
||||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
SOURCE="$(readlink "$SOURCE")"
|
||||
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
||||
done
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
|
||||
if [ -z $WORKSPACE ];then
|
||||
echo "WORKSPACE not exists"
|
||||
else
|
||||
set DIR=$WORKSPACE
|
||||
fi
|
||||
|
||||
echo "current dir"
|
||||
echo "$DIR"
|
||||
|
||||
cd "$DIR"
|
||||
projectname=$(basename `pwd`)
|
||||
|
||||
npm run operations-build
|
||||
|
||||
if [ -d "$DIR/dist" ];then
|
||||
|
||||
cd "$DIR/dist"
|
||||
|
||||
# copy module.json
|
||||
cp ../module.json ./
|
||||
|
||||
# package
|
||||
VERSION=$(cat ../.version)
|
||||
lastdir=../release/
|
||||
if [ -d ${lastdir} ];then
|
||||
echo "删除旧release文件夹"
|
||||
rm -rf ${lastdir}
|
||||
else
|
||||
echo "文件夹不存在!"
|
||||
fi
|
||||
mkdir -p ${lastdir}
|
||||
|
||||
dir=../release/nerv/$projectname/$VERSION
|
||||
mkdir -p ${dir}
|
||||
tar -zcvf "${dir}/$projectname-$VERSION.tgz" ./*
|
||||
|
||||
templatedir=../release/resources/templates/nerv/$projectname/$VERSION/$projectname
|
||||
mkdir -p ${templatedir}
|
||||
cp -r ../resources/templates/* ${templatedir}
|
||||
|
||||
cd ../
|
||||
|
||||
releasefile=nerv-$projectname-$VERSION.tgz
|
||||
if [ -f ${releasefile} ];then
|
||||
echo "删除旧包!"
|
||||
rm -rf ${releasefile}
|
||||
fi
|
||||
|
||||
tar -zcvf ${releasefile} ./release/* release.yaml
|
||||
|
||||
mkdir -p ./release/nervui
|
||||
cp -r ./release/nerv/* ./release/nervui
|
||||
|
||||
if [ -f ${releasefile} ];then
|
||||
echo "编译成功!"
|
||||
mv ${releasefile} ./release
|
||||
else
|
||||
echo "编译失败!!!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
else
|
||||
echo "编译失败!!!"
|
||||
exit 1
|
||||
fi
|
||||
13
nervui-operations/index.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" href="/favicon-stack.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>运营管理</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="./src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
44
nervui-operations/module.json
Normal file
@@ -0,0 +1,44 @@
|
||||
[
|
||||
{
|
||||
"catalog": "运营维护",
|
||||
"icon": "",
|
||||
"name": "operations",
|
||||
"label": "运营管理",
|
||||
"authModuleNames": [
|
||||
"tenant"
|
||||
],
|
||||
"menus": [
|
||||
{
|
||||
"label": "租户",
|
||||
"name": "tenant",
|
||||
"url": "/operations/Tenant",
|
||||
"operation": {
|
||||
"method": "list",
|
||||
"resource": "tenant"
|
||||
},
|
||||
"isGlobal": true,
|
||||
"submenus": [
|
||||
{
|
||||
"label": "租户管理",
|
||||
"url": "/operations/Tenant",
|
||||
"operation": {
|
||||
"method": "list",
|
||||
"resource": "Tenant"
|
||||
},
|
||||
"submenus": [
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "审批中心",
|
||||
"url": "/operations/Approval",
|
||||
"operation": {
|
||||
"method": "list",
|
||||
"resource": "Approval"
|
||||
},
|
||||
"submenus": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
11
nervui-operations/offline-release.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"release": [
|
||||
{
|
||||
"src": "nervui-operations/release",
|
||||
"dest": "/upload/pkg",
|
||||
"include": [
|
||||
"nervui-operations-(\\d+).(\\d+).(\\d+)(|-\\w+).tar.gz"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
31
nervui-operations/offline.sh
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SOURCE="$0"
|
||||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||
DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)"
|
||||
SOURCE="$(readlink "$SOURCE")"
|
||||
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
||||
done
|
||||
DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)"
|
||||
|
||||
cd "$DIR" || exit
|
||||
|
||||
VERSION=$(cat "$(pwd)"/.version)
|
||||
sed "s|\${VERSION}|${VERSION}|g" "$(pwd)"/offline.tpl.yaml > "$(pwd)"/offline.yaml || exit 1
|
||||
|
||||
|
||||
releaseDir="./release/nervui/nerv/nervui-operations-offline"
|
||||
rm -rf $releaseDir
|
||||
version="${VERSION}-$(cat "$(pwd)"/offline.version)"
|
||||
|
||||
set -x
|
||||
docker run --rm -i \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-v "$(pwd)"/offline.yaml:/app/build.yaml \
|
||||
-v "$(pwd)/$releaseDir":/app/output \
|
||||
-e name=nervui-operations \
|
||||
-e version="$version" \
|
||||
--pull=always \
|
||||
registry.nervhub.nervstack.io/nerv3/deploy:latest
|
||||
|
||||
rm -rf $releaseDir/output
|
||||
5
nervui-operations/offline.tpl.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
images:
|
||||
helm:
|
||||
- name: nervui-operations
|
||||
version: "${VERSION}"
|
||||
repository: "https://registry.nervhub.nervstack.io/chartrepo/nerv3-ui"
|
||||
1
nervui-operations/offline.version
Normal file
@@ -0,0 +1 @@
|
||||
alpha1
|
||||
BIN
nervui-operations/public/asset/image/header_background.png
Normal file
|
After Width: | Height: | Size: 248 KiB |
BIN
nervui-operations/public/asset/image/login/login-background.jpeg
Normal file
|
After Width: | Height: | Size: 126 KiB |
BIN
nervui-operations/public/asset/image/login/logo-data.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
nervui-operations/public/asset/image/login/logo-paas.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
nervui-operations/public/asset/image/sider_background.png
Normal file
|
After Width: | Height: | Size: 602 KiB |
BIN
nervui-operations/public/favicon-stack.ico
Normal file
|
After Width: | Height: | Size: 66 KiB |
BIN
nervui-operations/public/favicon.ico
Normal file
|
After Width: | Height: | Size: 11 KiB |
378
nervui-operations/public/resumable.d.ts
vendored
Normal file
@@ -0,0 +1,378 @@
|
||||
/** @format */
|
||||
|
||||
// Type definitions for Resumable.js
|
||||
// Project: https://github.com/23/resumable.js
|
||||
// Definitions by: Bazyli Brzóska <https://invent.life/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export declare namespace Resumable {
|
||||
export interface ConfigurationHash {
|
||||
/**
|
||||
* The target URL for the multipart POST request. This can be a string or a function that allows you you to construct and return a value, based on supplied params. (Default: /)
|
||||
**/
|
||||
target?: string;
|
||||
/**
|
||||
* The size in bytes of each uploaded chunk of data. The last uploaded chunk will be at least this size and up to two the size, see Issue #51 for details and reasons. (Default: 1*1024*1024)
|
||||
**/
|
||||
chunkSize?: number;
|
||||
/**
|
||||
* Force all chunks to be less or equal than chunkSize. Otherwise, the last chunk will be greater than or equal to chunkSize. (Default: false)
|
||||
**/
|
||||
forceChunkSize?: boolean;
|
||||
/**
|
||||
* Number of simultaneous uploads (Default: 3)
|
||||
**/
|
||||
simultaneousUploads?: number;
|
||||
/**
|
||||
* The name of the multipart POST parameter to use for the file chunk (Default: file)
|
||||
**/
|
||||
fileParameterName?: string;
|
||||
/**
|
||||
* The name of the chunk index (base-1) in the current upload POST parameter to use for the file chunk (Default: resumableChunkNumber)
|
||||
*/
|
||||
chunkNumberParameterName?: string;
|
||||
/**
|
||||
* The name of the total number of chunks POST parameter to use for the file chunk (Default: resumableTotalChunks)
|
||||
*/
|
||||
totalChunksParameterName?: string;
|
||||
/**
|
||||
* The name of the general chunk size POST parameter to use for the file chunk (Default: resumableChunkSize)
|
||||
*/
|
||||
chunkSizeParameterName?: string;
|
||||
/**
|
||||
* The name of the total file size number POST parameter to use for the file chunk (Default: resumableTotalSize)
|
||||
*/
|
||||
totalSizeParameterName?: string;
|
||||
/**
|
||||
* The name of the unique identifier POST parameter to use for the file chunk (Default: resumableIdentifier)
|
||||
*/
|
||||
identifierParameterName?: string;
|
||||
/**
|
||||
* The name of the original file name POST parameter to use for the file chunk (Default: resumableFilename)
|
||||
*/
|
||||
fileNameParameterName?: string;
|
||||
/**
|
||||
* The name of the file's relative path POST parameter to use for the file chunk (Default: resumableRelativePath)
|
||||
*/
|
||||
relativePathParameterName?: string;
|
||||
/**
|
||||
* The name of the current chunk size POST parameter to use for the file chunk (Default: resumableCurrentChunkSize)
|
||||
*/
|
||||
currentChunkSizeParameterName?: string;
|
||||
/**
|
||||
* The name of the file type POST parameter to use for the file chunk (Default: resumableType)
|
||||
*/
|
||||
typeParameterName?: string;
|
||||
/**
|
||||
* Extra parameters to include in the multipart POST with data. This can be an object or a function. If a function, it will be passed a ResumableFile and a ResumableChunk object (Default: {})
|
||||
**/
|
||||
query?: Object;
|
||||
/**
|
||||
* Method for chunk test request. (Default: 'GET')
|
||||
**/
|
||||
testMethod?: 'GET' | 'POST' | 'OPTIONS' | 'PUT' | 'DELETE';
|
||||
/**
|
||||
* Method for chunk upload request. (Default: 'POST')
|
||||
**/
|
||||
uploadMethod?: 'GET' | 'POST' | 'OPTIONS' | 'PUT' | 'DELETE';
|
||||
/**
|
||||
* Extra prefix added before the name of each parameter included in the multipart POST or in the test GET. (Default: '')
|
||||
**/
|
||||
parameterNamespace?: string;
|
||||
/**
|
||||
* Extra headers to include in the multipart POST with data. This can be an object or a function that allows you to construct and return a value, based on supplied file (Default: {})
|
||||
**/
|
||||
headers?: Object | ((file) => Object);
|
||||
/**
|
||||
* Method to use when POSTing chunks to the server (multipart or octet) (Default: multipart)
|
||||
**/
|
||||
method?: 'multipart' | 'octet';
|
||||
/**
|
||||
* Prioritize first and last chunks of all files. This can be handy if you can determine if a file is valid for your service from only the first or last chunk. For example, photo or video meta data is usually located in the first part of a file, making it easy to test support from only the first chunk. (Default: false)
|
||||
**/
|
||||
prioritizeFirstAndLastChunk?: boolean;
|
||||
/**
|
||||
* Make a GET request to the server for each chunks to see if it already exists. If implemented on the server-side, this will allow for upload resumes even after a browser crash or even a computer restart. (Default: true)
|
||||
**/
|
||||
testChunks?: boolean;
|
||||
/**
|
||||
* Optional function to process each chunk before testing & sending. Function is passed the chunk as parameter, and should call the preprocessFinished method on the chunk when finished. (Default: null)
|
||||
**/
|
||||
preprocess?: (chunk: ResumableChunk) => ResumableChunk;
|
||||
/**
|
||||
* Optional function to process each file before testing & sending the corresponding chunks. Function is passed the file as parameter, and should call the preprocessFinished method on the file when finished. (Default: null)
|
||||
**/
|
||||
preprocessFile?: (file: ResumableFile) => ResumableFile;
|
||||
/**
|
||||
* Override the function that generates unique identifiers for each file. (Default: null)
|
||||
**/
|
||||
generateUniqueIdentifier?: (file: File, event: Event) => Promise<string> | string;
|
||||
/**
|
||||
* Indicates how many files can be uploaded in a single session. Valid values are any positive integer and undefined for no limit. (Default: undefined)
|
||||
**/
|
||||
maxFiles?: number;
|
||||
/**
|
||||
* A function which displays the please upload n file(s) at a time message. (Default: displays an alert box with the message Please n one file(s) at a time.)
|
||||
**/
|
||||
maxFilesErrorCallback?: (files, errorCount) => void;
|
||||
/**
|
||||
* The minimum allowed file size. (Default: undefined)
|
||||
**/
|
||||
minFileSize?: number;
|
||||
/**
|
||||
* A function which displays an error a selected file is smaller than allowed. (Default: displays an alert for every bad file.)
|
||||
**/
|
||||
minFileSizeErrorCallback?: (file, errorCount) => void;
|
||||
/**
|
||||
* The maximum allowed file size. (Default: undefined)
|
||||
**/
|
||||
maxFileSize?: number;
|
||||
/**
|
||||
* A function which displays an error a selected file is larger than allowed. (Default: displays an alert for every bad file.)
|
||||
**/
|
||||
maxFileSizeErrorCallback?: (file, errorCount) => void;
|
||||
/**
|
||||
* The file types allowed to upload. An empty array allow any file type. (Default: [])
|
||||
**/
|
||||
fileType?: Array<string>;
|
||||
/**
|
||||
* A function which displays an error a selected file has type not allowed. (Default: displays an alert for every bad file.)
|
||||
**/
|
||||
fileTypeErrorCallback?: (file, errorCount) => void;
|
||||
/**
|
||||
* The maximum number of retries for a chunk before the upload is failed. Valid values are any positive integer and undefined for no limit. (Default: undefined)
|
||||
**/
|
||||
maxChunkRetries?: number;
|
||||
/**
|
||||
* The number of milliseconds to wait before retrying a chunk on a non-permanent error. Valid values are any positive integer and undefined for immediate retry. (Default: undefined)
|
||||
**/
|
||||
chunkRetryInterval?: number;
|
||||
/**
|
||||
* Standard CORS requests do not send or set any cookies by default. In order to include cookies as part of the request, you need to set the withCredentials property to true. (Default: false)
|
||||
**/
|
||||
withCredentials?: boolean;
|
||||
/**
|
||||
* setChunkTypeFromFile` Set chunk content-type from original file.type. (Default: false, if false default Content-Type: application/octet-stream)
|
||||
**/
|
||||
setChunkTypeFromFile?: boolean;
|
||||
/**
|
||||
* The class name to add on drag over an assigned drop zone. (Default: dragover)
|
||||
**/
|
||||
dragOverClass?: string;
|
||||
}
|
||||
|
||||
export class Resumable {
|
||||
constructor(options: ConfigurationHash);
|
||||
|
||||
/**
|
||||
* A boolean value indicator whether or not Resumable.js is supported by the current browser.
|
||||
**/
|
||||
support: boolean;
|
||||
/**
|
||||
* A hash object of the configuration of the Resumable.js instance.
|
||||
**/
|
||||
opts: ConfigurationHash;
|
||||
/**
|
||||
* An array of ResumableFile file objects added by the user (see full docs for this object type below).
|
||||
**/
|
||||
files: Array<ResumableFile>;
|
||||
|
||||
events: Array<any>;
|
||||
version: number;
|
||||
|
||||
/**
|
||||
* Assign a browse action to one or more DOM nodes. Pass in true to allow directories to be selected (Chrome only).
|
||||
**/
|
||||
assignBrowse(domNode: Element, isDirectory: boolean): void;
|
||||
assignBrowse(domNodes: Array<Element>, isDirectory: boolean): void;
|
||||
/**
|
||||
* Assign one or more DOM nodes as a drop target.
|
||||
**/
|
||||
assignDrop(domNode: Element): void;
|
||||
assignDrop(domNodes: Array<Element>): void;
|
||||
unAssignDrop(domNode: Element): void;
|
||||
unAssignDrop(domNodes: Array<Element>): void;
|
||||
/**
|
||||
* Start or resume uploading.
|
||||
**/
|
||||
upload(): void;
|
||||
uploadNextChunk(): void;
|
||||
/**
|
||||
* Pause uploading.
|
||||
**/
|
||||
pause(): void;
|
||||
/**
|
||||
* Cancel upload of all ResumableFile objects and remove them from the list.
|
||||
**/
|
||||
cancel(): void;
|
||||
fire(): void;
|
||||
/**
|
||||
* Returns a float between 0 and 1 indicating the current upload progress of all files.
|
||||
**/
|
||||
progress(): number;
|
||||
/**
|
||||
* Returns a boolean indicating whether or not the instance is currently uploading anything.
|
||||
**/
|
||||
isUploading(): boolean;
|
||||
/**
|
||||
* Add a HTML5 File object to the list of files.
|
||||
**/
|
||||
addFile(file: File): void;
|
||||
/**
|
||||
* Add an Array of HTML5 File objects to the list of files.
|
||||
**/
|
||||
addFiles(files: Array<File>): void;
|
||||
/**
|
||||
* Cancel upload of a specific ResumableFile object on the list from the list.
|
||||
**/
|
||||
removeFile(file: ResumableFile): void;
|
||||
/**
|
||||
* Look up a ResumableFile object by its unique identifier.
|
||||
**/
|
||||
getFromUniqueIdentifier(uniqueIdentifier: string): void;
|
||||
/**
|
||||
* Returns the total size of the upload in bytes.
|
||||
**/
|
||||
getSize(): number;
|
||||
getOpt(o: string): any;
|
||||
|
||||
// Events
|
||||
/**
|
||||
* Listen for event from Resumable.js (see below)
|
||||
**/
|
||||
on(event: string, callback: Function): void;
|
||||
/**
|
||||
* A specific file was completed.
|
||||
**/
|
||||
on(event: 'fileSuccess', callback: (file: ResumableFile) => void);
|
||||
void;
|
||||
/**
|
||||
* Uploading progressed for a specific file.
|
||||
**/
|
||||
on(event: 'fileProgress', callback: (file: ResumableFile) => void): void;
|
||||
/**
|
||||
* A new file was added. Optionally, you can use the browser event object from when the file was added.
|
||||
**/
|
||||
on(event: 'fileAdded', callback: (file: ResumableFile, event: DragEvent) => void): void;
|
||||
/**
|
||||
* New files were added.
|
||||
**/
|
||||
on(event: 'filesAdded', callback: (files: Array<ResumableFile>) => void): void;
|
||||
/**
|
||||
* Something went wrong during upload of a specific file, uploading is being retried.
|
||||
**/
|
||||
on(event: 'fileRetry', callback: (file: ResumableFile) => void): void;
|
||||
/**
|
||||
* An error occurred during upload of a specific file.
|
||||
**/
|
||||
on(event: 'fileError', callback: (file: ResumableFile, message: string) => void): void;
|
||||
/**
|
||||
* Upload has been started on the Resumable object.
|
||||
**/
|
||||
on(event: 'uploadStart', callback: () => void): void;
|
||||
/**
|
||||
* Uploading completed.
|
||||
**/
|
||||
on(event: 'complete', callback: () => void): void;
|
||||
/**
|
||||
* Uploading progress.
|
||||
**/
|
||||
on(event: 'progress', callback: () => void): void;
|
||||
/**
|
||||
* An error, including fileError, occurred.
|
||||
**/
|
||||
on(event: 'error', callback: (message: string, file: ResumableFile) => void): void;
|
||||
/**
|
||||
* Uploading was paused.
|
||||
**/
|
||||
on(event: 'pause', callback: () => void): void;
|
||||
/**
|
||||
* Triggers before the items are cancelled allowing to do any processing on uploading files.
|
||||
**/
|
||||
on(event: 'beforeCancel', callback: () => void): void;
|
||||
/**
|
||||
* Uploading was canceled.
|
||||
**/
|
||||
on(event: 'cancel', callback: () => void): void;
|
||||
/**
|
||||
* Started preparing file for upload
|
||||
**/
|
||||
on(event: 'chunkingStart', callback: (file: ResumableFile) => void): void;
|
||||
/**
|
||||
* Show progress in file preparation
|
||||
**/
|
||||
on(event: 'chunkingProgress', callback: (file: ResumableFile, ratio) => void): void;
|
||||
/**
|
||||
* File is ready for upload
|
||||
**/
|
||||
on(event: 'chunkingComplete', callback: (file: ResumableFile) => void): void;
|
||||
/**
|
||||
* Listen to all the events listed above with the same callback function.
|
||||
**/
|
||||
on(event: 'catchAll', callback: () => void);
|
||||
}
|
||||
|
||||
export interface ResumableFile {
|
||||
/**
|
||||
* A back-reference to the parent Resumable object.
|
||||
**/
|
||||
resumableObj: Resumable;
|
||||
/**
|
||||
* The correlating HTML5 File object.
|
||||
**/
|
||||
file: File;
|
||||
/**
|
||||
* The name of the file.
|
||||
**/
|
||||
fileName: string;
|
||||
/**
|
||||
* The relative path to the file (defaults to file name if relative path doesn't exist)
|
||||
**/
|
||||
relativePath: string;
|
||||
/**
|
||||
* Size in bytes of the file.
|
||||
**/
|
||||
size: number;
|
||||
/**
|
||||
* A unique identifier assigned to this file object. This value is included in uploads to the server for reference, but can also be used in CSS classes etc when building your upload UI.
|
||||
**/
|
||||
uniqueIdentifier: string;
|
||||
/**
|
||||
* An array of ResumableChunk items. You shouldn't need to dig into these.
|
||||
**/
|
||||
chunks: Array<ResumableChunk>;
|
||||
|
||||
/**
|
||||
* Returns a float between 0 and 1 indicating the current upload progress of the file. If relative is true, the value is returned relative to all files in the Resumable.js instance.
|
||||
**/
|
||||
progress: (relative: boolean) => number;
|
||||
/**
|
||||
* Abort uploading the file.
|
||||
**/
|
||||
abort: () => void;
|
||||
/**
|
||||
* Abort uploading the file and delete it from the list of files to upload.
|
||||
**/
|
||||
cancel: () => void;
|
||||
/**
|
||||
* Retry uploading the file.
|
||||
**/
|
||||
retry: () => void;
|
||||
/**
|
||||
* Rebuild the state of a ResumableFile object, including reassigning chunks and XMLHttpRequest instances.
|
||||
**/
|
||||
bootstrap: () => void;
|
||||
/**
|
||||
* Returns a boolean indicating whether file chunks is uploading.
|
||||
**/
|
||||
isUploading: () => boolean;
|
||||
/**
|
||||
* Returns a boolean indicating whether the file has completed uploading and received a server response.
|
||||
**/
|
||||
isComplete: () => boolean;
|
||||
}
|
||||
|
||||
class ResumableChunk {}
|
||||
}
|
||||
|
||||
export declare class ResumableModule {}
|
||||
1281
nervui-operations/public/resumable.js
Normal file
12
nervui-operations/release.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
# 上传release目录信息到nerv-file仓库
|
||||
release:
|
||||
- {src: release, dest: /upload/pkg, include: [".*(.tgz)$"]}
|
||||
- {src: release/resources/templates, dest: /upload/templates}
|
||||
register:
|
||||
name: nervui-operations
|
||||
version: 3.0.1
|
||||
components:
|
||||
- type: nervui-operations
|
||||
resources:
|
||||
- {type: template, relativePath: /nervui-operations/deploy.json}
|
||||
|
||||
18
nervui-operations/src/App.vue
Normal file
@@ -0,0 +1,18 @@
|
||||
<template>
|
||||
<ns-application />
|
||||
</template>
|
||||
|
||||
<script lang="ts" type="module">
|
||||
import { defineComponent } from 'vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'App',
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
#app {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
50
nervui-operations/src/api/index.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
/***
|
||||
*配置接口 格式 module:Array<resource>
|
||||
*/
|
||||
export const apiModule = {
|
||||
pension: [
|
||||
'User',
|
||||
'CurrentUser',
|
||||
'Gaffer',
|
||||
// 'Organizational',
|
||||
// 'Device',
|
||||
// 'Region',
|
||||
// 'Owner',
|
||||
// 'AllList',
|
||||
// 'VisitorRecord',
|
||||
// 'Room',
|
||||
// 'Device',
|
||||
// 'CommunityVisitor',
|
||||
// 'AccessControlGroup',
|
||||
// 'AccessControlLeft',
|
||||
// 'AccessControlRight',
|
||||
// 'AccessControlRightIdentity',
|
||||
// 'Visitor',
|
||||
// 'DeviceListByDeviceCategory',
|
||||
// 'Perimeter',
|
||||
// 'AccessControlRightVisitorIdentity',
|
||||
// 'BedChoose',
|
||||
// 'Gateway',
|
||||
// 'FileUpload',
|
||||
// 'User',
|
||||
// 'CurrentUser',
|
||||
// 'Organizational',
|
||||
// 'Device',
|
||||
// 'Region',
|
||||
// 'Owner',
|
||||
// 'AllList',
|
||||
// 'VisitorRecord',
|
||||
// 'Room',
|
||||
// 'Device',
|
||||
// 'CommunityVisitor',
|
||||
// 'AccessControlGroup',
|
||||
// 'AccessControlLeft',
|
||||
// 'AccessControlRight',
|
||||
// 'AccessControlRightIdentity',
|
||||
// 'Visitor',
|
||||
// 'DeviceListByDeviceCategory',
|
||||
// 'BedChoose',
|
||||
// 'Perimeter',
|
||||
// 'OrganizationConfig',
|
||||
],
|
||||
};
|
||||
15
nervui-operations/src/api/user.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { http } from '/nerv-lib/paas';
|
||||
|
||||
enum Api {
|
||||
USER_LOGIN = '/api/passport/objs/login', //用户登录
|
||||
USER_INFO = '/api/webui/webui/objs/PassportUserInfo', //获取用户信息
|
||||
}
|
||||
export const userLogin = (data: RoomListModel) => http.post(Api.USER_LOGIN, data);
|
||||
export const userInfo = () => http.get(Api.USER_INFO);
|
||||
/**
|
||||
* @description 用户登录
|
||||
* @property `[fatherRegionUuid]` 父级区域唯一标识
|
||||
*/
|
||||
interface RoomListModel {
|
||||
data: string;
|
||||
}
|
||||
6
nervui-operations/src/config/app.config.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
/** @format */
|
||||
|
||||
export const appConfig = {
|
||||
projectType: 'web',
|
||||
timeout: 120 * 1000,
|
||||
};
|
||||
2
nervui-operations/src/config/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
import { appConfig } from '/@/config/app.config';
|
||||
export { appConfig };
|
||||
16
nervui-operations/src/main.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { createApp } from 'vue';
|
||||
import App from '/@/App.vue';
|
||||
import { paasInit } from '/nerv-lib/paas';
|
||||
import { apiModule } from '/@/api';
|
||||
import { appConfig } from '/@/config';
|
||||
// import '/@/theme/theme.scss';
|
||||
|
||||
const modules = undefined;
|
||||
const app = createApp(App);
|
||||
paasInit({
|
||||
app,
|
||||
apiModule,
|
||||
appConfig,
|
||||
modules,
|
||||
});
|
||||
app.mount('#app');
|
||||
@@ -0,0 +1,35 @@
|
||||
echo "=====================================================create====================================================="
|
||||
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function create() {
|
||||
|
||||
if [ -d "$nervui_app_home" ];then
|
||||
echo "$nervui_app_home exists!"
|
||||
else
|
||||
echo "start mkdir $nervui_app_home"
|
||||
mkdir -p "$nervui_app_home"
|
||||
fi
|
||||
|
||||
pkg_file_name=${pkg_url##*/}
|
||||
pkg_file_path="$nervui_app_home$pkg_file_name"
|
||||
|
||||
|
||||
echo "start download $pkg_url"
|
||||
curl -L -o $pkg_file_path $pkg_url
|
||||
|
||||
|
||||
echo "start install $pkg_file_path"
|
||||
tar -xf $pkg_file_path -C $nervui_app_home
|
||||
|
||||
}
|
||||
|
||||
if [ "$pkg_url" == "" ]; then
|
||||
echo {\"error\":\"pkg_url is empty\"}
|
||||
exit 1
|
||||
elif [ "$nervui_app_home" == "" ]; then
|
||||
echo {\"error\":\"nervui_app_home is empty\"}
|
||||
exit 1
|
||||
else
|
||||
create
|
||||
fi
|
||||
@@ -0,0 +1 @@
|
||||
echo "=====================================================delete====================================================="
|
||||
@@ -0,0 +1 @@
|
||||
echo "=====================================================setup====================================================="
|
||||
@@ -0,0 +1 @@
|
||||
echo "=====================================================start====================================================="
|
||||
@@ -0,0 +1 @@
|
||||
echo "=====================================================stop====================================================="
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"name":"/nervui-notify",
|
||||
"operations": [
|
||||
{
|
||||
"name": "Create",
|
||||
"type": "shell",
|
||||
"implementor": "create.sh"
|
||||
},
|
||||
{
|
||||
"name": "Delete",
|
||||
"type": "shell",
|
||||
"implementor": "delete.sh"
|
||||
},
|
||||
{
|
||||
"name": "Setup",
|
||||
"type": "shell",
|
||||
"implementor": "setup.sh"
|
||||
},
|
||||
{
|
||||
"name": "Start",
|
||||
"type": "shell",
|
||||
"implementor": "start.sh"
|
||||
},
|
||||
{
|
||||
"name": "Stop",
|
||||
"type": "shell",
|
||||
"implementor": "stop.sh"
|
||||
}
|
||||
]
|
||||
}
|
||||
64
nervui-operations/src/resources/templates/deploy.json
Normal file
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"name": "/nervui-operations",
|
||||
"version": 1,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "server_ip",
|
||||
"type": "string",
|
||||
"required":true,
|
||||
"description":"应用安装IP地址",
|
||||
"inputType":"ipSelectType"
|
||||
},
|
||||
{
|
||||
"name": "version",
|
||||
"type": "string",
|
||||
"required":true,
|
||||
"description":"软件版本",
|
||||
"inputType":"versionSelectType"
|
||||
},
|
||||
{
|
||||
"name": "install_dir",
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"defaultValue": "/data",
|
||||
"inputType": "textInputType",
|
||||
"description": "安装目录"
|
||||
}
|
||||
],
|
||||
"nodes": [
|
||||
{
|
||||
"name": "nervui-operations",
|
||||
"type": "/nerv/nerv-orchestrator/cluster/Nervui",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "file_repository",
|
||||
"value": "${nerv_file_repository}"
|
||||
},
|
||||
{
|
||||
"name": "install_dir",
|
||||
"value": "${install_dir}"
|
||||
},
|
||||
{
|
||||
"name": "pkg_url",
|
||||
"value": "/api/pkg/nerv/nervui-operations/${version}/nervui-operations-${version}.tgz"
|
||||
}
|
||||
],
|
||||
"dependencies": [
|
||||
{
|
||||
"type": "contained",
|
||||
"target": "host"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "host",
|
||||
"type": "/nerv/nerv-orchestrator/compute/Host",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "address",
|
||||
"value": "${server_ip}"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
11
nervui-operations/src/router/index.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
/** @format */
|
||||
|
||||
const RootRoute = {
|
||||
path: '/root',
|
||||
name: 'root',
|
||||
redirect: '/operations',
|
||||
meta: {
|
||||
title: 'Root',
|
||||
},
|
||||
};
|
||||
export default RootRoute;
|
||||
169
nervui-operations/src/router/operations.ts
Normal file
@@ -0,0 +1,169 @@
|
||||
/** @format */
|
||||
|
||||
import { NsViewContent, NsViewDetail, NsViewSideNav } from '/nerv-lib/paas';
|
||||
|
||||
const SideNav = () => Promise.resolve(NsViewSideNav);
|
||||
const Base = () => Promise.resolve(NsViewContent);
|
||||
const operations = {
|
||||
path: '/operations',
|
||||
name: 'operations',
|
||||
component: SideNav,
|
||||
redirect: { name: 'Tenant' },
|
||||
meta: {
|
||||
sideMenus: {
|
||||
title: '运营管理',
|
||||
name: 'tenant',
|
||||
menus: [
|
||||
{
|
||||
name: 'Tenant',
|
||||
label: '租户管理',
|
||||
url: '/operations/Tenant',
|
||||
module: 'vm',
|
||||
app: 'tenant',
|
||||
},
|
||||
{
|
||||
name: 'Approval',
|
||||
label: '审批中心',
|
||||
url: '/operations/Approval',
|
||||
module: 'vm',
|
||||
app: 'tenant',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
children: [
|
||||
// 租户管理
|
||||
{
|
||||
path: 'Tenant',
|
||||
name: 'TenantMangment',
|
||||
component: Base,
|
||||
// redirect: { name: 'TenantList' },
|
||||
children: [
|
||||
// 租户管理列表
|
||||
{
|
||||
path: 'list',
|
||||
name: 'Tenant',
|
||||
meta: { app: 'tenant' },
|
||||
component: () => import('/@/view/Tenant/list.vue'),
|
||||
},
|
||||
{
|
||||
path: 'add',
|
||||
name: 'TenantAdd',
|
||||
meta: { app: 'tenant' },
|
||||
component: () => import('/@/view/Tenant/add.vue'),
|
||||
},
|
||||
{
|
||||
path: ':id/edit',
|
||||
name: 'TenantEdit',
|
||||
meta: { app: 'tenant' },
|
||||
component: () => import('/@/view/Tenant/edit.vue'),
|
||||
},
|
||||
],
|
||||
},
|
||||
// 审批中心
|
||||
{
|
||||
path: 'Approval',
|
||||
name: 'ApprovalCenter',
|
||||
component: Base,
|
||||
children: [
|
||||
// 租户管理列表
|
||||
{
|
||||
path: 'list',
|
||||
name: 'Approval',
|
||||
meta: { app: 'tenant' },
|
||||
component: () => import('/@/view/Approval/list.vue'),
|
||||
},
|
||||
{
|
||||
path: ':id',
|
||||
name: 'ApprovalDetail',
|
||||
component: NsViewDetail,
|
||||
meta: { app: 'tenant' },
|
||||
// component: () => import('/@/view/Approval/detail.vue'),
|
||||
|
||||
props: {
|
||||
title: '查看',
|
||||
showBack: true,
|
||||
api: '/api/passport/passport/objs/ApprovalCenter/:id',
|
||||
detail: [
|
||||
{
|
||||
title: '企业认证',
|
||||
items: [
|
||||
{
|
||||
label: '企业名称',
|
||||
name: 'companyName',
|
||||
},
|
||||
{
|
||||
label: '营业执照注册号',
|
||||
name: 'businessLicense',
|
||||
},
|
||||
{
|
||||
label: '营业执照所在地',
|
||||
name: 'licenseAddress',
|
||||
},
|
||||
{
|
||||
label: '营业执照期限',
|
||||
name: 'licenseTimeLimit',
|
||||
},
|
||||
{
|
||||
label: '常用地址',
|
||||
name: 'address',
|
||||
},
|
||||
{
|
||||
label: '联系电话',
|
||||
name: 'contactNumber',
|
||||
},
|
||||
{
|
||||
label: '营业执照副本扫描件',
|
||||
name: 'licensephoto',
|
||||
type: 'image',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: '法人认证',
|
||||
items: [
|
||||
{
|
||||
label: '法定代表人归属地',
|
||||
name: 'corporateplace',
|
||||
},
|
||||
{
|
||||
label: '法定代表人真实姓名',
|
||||
name: 'corporateRealName',
|
||||
},
|
||||
{
|
||||
label: '法定代表人身份证号码',
|
||||
name: 'corporateIDNumber',
|
||||
},
|
||||
{
|
||||
label: '身份证类型',
|
||||
name: 'IDCardType',
|
||||
format: (value: any) => ['二代身份证', '临时身份证'][value],
|
||||
},
|
||||
{
|
||||
label: '身份证正面',
|
||||
name: 'IDCardFront',
|
||||
type: 'image',
|
||||
},
|
||||
{
|
||||
label: '身份证反面',
|
||||
name: 'IDCardBack',
|
||||
type: 'image',
|
||||
},
|
||||
{
|
||||
label: '邮箱',
|
||||
name: 'email',
|
||||
},
|
||||
{
|
||||
label: '手机号码',
|
||||
name: 'phoneNumber',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
export default operations;
|
||||
0
nervui-operations/src/theme/global.scss
Normal file
2
nervui-operations/src/theme/theme.scss
Normal file
@@ -0,0 +1,2 @@
|
||||
@import "variable";
|
||||
@import "global";
|
||||
10
nervui-operations/src/theme/variable.less
Normal file
@@ -0,0 +1,10 @@
|
||||
// @layout-header-background:url(/asset/image/header_background.png) no-repeat;
|
||||
// // @layout-sider-background:url(/asset/image/sider_background.png) no-repeat;
|
||||
// @layout-nav-background:url(/asset/image/sider_background.png) no-repeat;
|
||||
// @layout-header-color: #FFFFFF;
|
||||
// @layout-header-link-color: #FFFFFF;
|
||||
// @layout-nav-color: #FFFFFF;
|
||||
// @layout-nav-check-color: #FFFFFF;
|
||||
// @primary-color: #2C68FF; // 全局主色
|
||||
// @link-color: #2C68FF; // 链接色
|
||||
// @layout-nav-hover:linear-gradient(90deg, #2C68FF 0%, rgba(44, 104, 255, 0.4) 100%);
|
||||
0
nervui-operations/src/theme/variable.scss
Normal file
85
nervui-operations/src/view/Approval/add.vue
Normal file
@@ -0,0 +1,85 @@
|
||||
<!-- @format -->
|
||||
|
||||
<template>
|
||||
<ns-view-add-form
|
||||
:schemas="formSchema"
|
||||
:model="data"
|
||||
formLayout="vertical"
|
||||
title="添加token"
|
||||
api="/api/passport/passport/objs/Credential" />
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'TokenEdit',
|
||||
setup() {
|
||||
const router = useRouter();
|
||||
const { view } = router.currentRoute.value.query;
|
||||
const data = ref({});
|
||||
let formSchema = ref([
|
||||
{
|
||||
label: '凭据类型',
|
||||
field: 'type',
|
||||
component: 'NsInputText',
|
||||
defaultValue: view,
|
||||
},
|
||||
{
|
||||
label: '凭据名称',
|
||||
field: 'name',
|
||||
component: 'NsInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入',
|
||||
},
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
validator: async (rule, value) => {
|
||||
if (!value) {
|
||||
return Promise.reject('凭据名称必填');
|
||||
}
|
||||
if (!/^[A-Za-z\d\u4e00-\u9fa5][A-Za-z\d\u4e00-\u9fa5\._-]{0,31}$/.test(value)) {
|
||||
return Promise.reject(
|
||||
'支持中文/字母/数字/特殊字符:点(.)短横线(-)下划线(_)输入,长度1~32位;不能以特殊字符开头,不能只包含特殊字符',
|
||||
);
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
field: 'token',
|
||||
label: 'token',
|
||||
component: 'NsInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入',
|
||||
},
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
validator: async (rule, value) => {
|
||||
if (!value) {
|
||||
return Promise.reject('token必填');
|
||||
}
|
||||
if (!/^[A-Za-z][A-Za-z\d_-]{3,31}$/.test(value)) {
|
||||
return Promise.reject(
|
||||
'支持字母,数字,短横线(-)和下划线(_)输入,长度4-32位;不能以特殊字符或数字开头,不能只包含特殊字符',
|
||||
);
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
return {
|
||||
data,
|
||||
formSchema,
|
||||
};
|
||||
},
|
||||
beforeCreate() {},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
84
nervui-operations/src/view/Approval/detail.vue
Normal file
@@ -0,0 +1,84 @@
|
||||
<!-- @format -->
|
||||
|
||||
<template>
|
||||
<ns-view-detail
|
||||
title="查看详情"
|
||||
:api="`/api/passport/passport/objs/ApprovalCenter/${$router.currentRoute.value.params.id}`"
|
||||
:detail="detail" />
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { dateUtil } from '/nerv-lib/util/date-util';
|
||||
import { useRouter } from 'vue-router';
|
||||
export default defineComponent({
|
||||
name: 'SoftwareVersionManageDetail',
|
||||
setup() {
|
||||
const router = useRouter();
|
||||
const detail = [
|
||||
{
|
||||
title: '基本信息',
|
||||
items: [
|
||||
{
|
||||
label: '软件名称',
|
||||
name: 'appName',
|
||||
},
|
||||
{
|
||||
label: '版本号',
|
||||
name: 'versionCode',
|
||||
},
|
||||
{
|
||||
name: 'downUrl',
|
||||
label: '下载地址',
|
||||
},
|
||||
{
|
||||
label: '安装包',
|
||||
name: 'appPackageName',
|
||||
ifShow: ({ platformId }) => platformId == 1,
|
||||
},
|
||||
{
|
||||
label: '下载方式',
|
||||
name: 'downSource',
|
||||
ifShow: ({ platformId }) => platformId == 1,
|
||||
format: (value) => ['浏览器下载', '应用商城下载', '应用内下载'][value],
|
||||
},
|
||||
// {
|
||||
// name: 'md5',
|
||||
// label: 'MD5码',
|
||||
// },
|
||||
// {
|
||||
// name: 'uniqueCode',
|
||||
// label: '唯一code',
|
||||
// },
|
||||
{
|
||||
name: 'updateFlag',
|
||||
label: '是否需要更新',
|
||||
format: (value, data) => {
|
||||
return ['否', '是'][value];
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'updateType',
|
||||
label: '更新类型',
|
||||
format: (value, data) => {
|
||||
return ['建议更新', '强制更新'][value];
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'versionState',
|
||||
label: '是否最新版本',
|
||||
format: (value, data) => {
|
||||
return ['否', '是'][value];
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'upgradeTips',
|
||||
label: '更新日志',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
return { detail };
|
||||
},
|
||||
});
|
||||
</script>
|
||||
277
nervui-operations/src/view/Approval/list.vue
Normal file
@@ -0,0 +1,277 @@
|
||||
<!-- @format -->
|
||||
|
||||
<template>
|
||||
<page-title title="审批中心" />
|
||||
|
||||
<a-tabs class="tabs" v-model:activeKey="activeKey">
|
||||
<a-tab-pane v-for="(item, index) in tabBucket" :key="index" :tab="item.title">
|
||||
<ns-view-list-table v-bind="item.tableConfig" ref="nsTableRef" />
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref, watch } from 'vue';
|
||||
import { dateUtil } from '/nerv-lib/util/date-util';
|
||||
import { http } from '/nerv-lib/util';
|
||||
import { NsMessage } from '/nerv-lib/component/message';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ApproveList',
|
||||
|
||||
setup() {
|
||||
const nsTableRef = ref();
|
||||
const activeKey = ref();
|
||||
// 缓存选中tab
|
||||
if (sessionStorage.getItem('ACTIVE_TAB_KEY')) {
|
||||
activeKey.value = Number(sessionStorage.getItem('ACTIVE_TAB_KEY'));
|
||||
}
|
||||
|
||||
watch(
|
||||
() => activeKey.value,
|
||||
(val) => {
|
||||
sessionStorage.setItem('ACTIVE_TAB_KEY', `${val}`);
|
||||
},
|
||||
);
|
||||
const actionReq = (api) => {
|
||||
// 指定刷新那个api列表
|
||||
if (Object.prototype.toString.apply(nsTableRef.value) === '[object Array]') {
|
||||
nsTableRef.value.map((item, index) => {
|
||||
if (item.api == api) {
|
||||
nsTableRef.value[index]?.nsTableRef.reload();
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
nsTableRef.value?.nsTableRef.reload();
|
||||
};
|
||||
let approval_time = ref('');
|
||||
let approval_select = ref('pass,unpass');
|
||||
const joinFunc = (select, time) => {
|
||||
approvalConfig.params.where = `${
|
||||
select.indexOf(',') !== -1
|
||||
? 'approval_result = ? or approval_result = ?'
|
||||
: 'approval_result = ?'
|
||||
}${time && ' and created_at >= ? and created_at <= ?'}`;
|
||||
approvalConfig.params.values = `${select}${time}`;
|
||||
};
|
||||
const tableConfig = {
|
||||
api: '/api/passport/passport/objs/ApprovalCenter?order=created_at desc',
|
||||
params: {
|
||||
where: 'approval_result = ?',
|
||||
values: 'unknown',
|
||||
},
|
||||
formConfig: {
|
||||
keySearch: false,
|
||||
schemas: [
|
||||
{
|
||||
field: 'timeRange',
|
||||
label: '申请时间',
|
||||
component: 'NsRangePicker',
|
||||
componentProps: {
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
showTime: true,
|
||||
'show-time': {
|
||||
hideDisabledOptions: true,
|
||||
defaultValue: [
|
||||
dateUtil('00:00:00', 'HH:mm:ss'),
|
||||
dateUtil('23:59:59', 'HH:mm:ss'),
|
||||
],
|
||||
},
|
||||
onChange: (_, [start, end]) => {
|
||||
tableConfig.params.where = `approval_result = ?${
|
||||
start && ' and created_at >= ? and created_at <= ?'
|
||||
}`;
|
||||
tableConfig.params.values = `unknown${start && `,${start},${end}`}`;
|
||||
actionReq(tableConfig.api);
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
showTitle: false,
|
||||
rowSelection: null,
|
||||
scroll: { x: '100%' },
|
||||
resultField: 'data',
|
||||
columns: [
|
||||
{
|
||||
title: '企业名称',
|
||||
dataIndex: 'companyName',
|
||||
width: '34%',
|
||||
},
|
||||
{
|
||||
title: '申请类型',
|
||||
dataIndex: 'approvalType',
|
||||
customRender: ({ value }) => ['企业认证'][value],
|
||||
width: '33%',
|
||||
},
|
||||
{
|
||||
title: '申请时间',
|
||||
dataIndex: 'CreatedAt',
|
||||
customRender: ({ value }: any) => dateUtil(value).format('YYYY-MM-DD HH:mm:ss'),
|
||||
width: '33%',
|
||||
},
|
||||
],
|
||||
columnActions: {
|
||||
title: '操作',
|
||||
actions: [
|
||||
{
|
||||
label: '审批',
|
||||
name: 'ApprovalApproval',
|
||||
route: ':ID',
|
||||
},
|
||||
],
|
||||
},
|
||||
rowKey: 'ID',
|
||||
};
|
||||
|
||||
const approvalConfig = {
|
||||
api: '/api/passport/passport/objs/ApprovalCenter',
|
||||
params: {
|
||||
where: 'approval_result = ? or approval_result = ?',
|
||||
order: 'created_at desc',
|
||||
values: 'pass,unpass',
|
||||
},
|
||||
showTitle: false,
|
||||
rowSelection: null,
|
||||
resultField: 'data',
|
||||
scroll: { x: '100%' },
|
||||
columns: [
|
||||
{
|
||||
title: '企业名称',
|
||||
width: '25%',
|
||||
dataIndex: 'companyName',
|
||||
},
|
||||
{
|
||||
title: '申请类型',
|
||||
width: '25%',
|
||||
dataIndex: 'approvalType',
|
||||
customRender: ({ value }) => ['企业认证'][value],
|
||||
},
|
||||
{
|
||||
title: '审批结果',
|
||||
dataIndex: 'approvalResult',
|
||||
width: '25%',
|
||||
customRender: ({ value }) => {
|
||||
enum status {
|
||||
pass = '审批通过',
|
||||
unpass = '审批拒绝',
|
||||
unknown = '未审批',
|
||||
}
|
||||
return status[value];
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '申请时间',
|
||||
dataIndex: 'CreatedAt',
|
||||
width: '25%',
|
||||
customRender: ({ value }: any) => dateUtil(value).format('YYYY-MM-DD HH:mm:ss'),
|
||||
},
|
||||
],
|
||||
columnActions: {
|
||||
title: '操作',
|
||||
actions: [
|
||||
{
|
||||
label: '查看',
|
||||
name: 'ApprovalDetail',
|
||||
route: ':ID',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
formConfig: {
|
||||
keySearch: false,
|
||||
schemas: [
|
||||
{
|
||||
field: 'values',
|
||||
label: '类型',
|
||||
component: 'NsSelect',
|
||||
defaultValue: 'pass,unpass',
|
||||
componentProps: {
|
||||
placeholder: '请选择',
|
||||
options: [
|
||||
{
|
||||
label: '全部',
|
||||
value: 'pass,unpass',
|
||||
},
|
||||
{
|
||||
label: '通过',
|
||||
value: 'pass',
|
||||
},
|
||||
{
|
||||
label: '拒绝',
|
||||
value: 'unpass',
|
||||
},
|
||||
],
|
||||
onChange: (value) => {
|
||||
approval_select.value = value;
|
||||
joinFunc(approval_select.value, approval_time.value);
|
||||
actionReq(approvalConfig.api);
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'timeRange',
|
||||
label: '申请时间',
|
||||
component: 'NsRangePicker',
|
||||
componentProps: {
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
showTime: true,
|
||||
'show-time': {
|
||||
hideDisabledOptions: true,
|
||||
defaultValue: [
|
||||
dateUtil('00:00:00', 'HH:mm:ss'),
|
||||
dateUtil('23:59:59', 'HH:mm:ss'),
|
||||
],
|
||||
},
|
||||
onChange: (_, [start, end]) => {
|
||||
approval_time.value = start && `,${start},${end}`;
|
||||
joinFunc(approval_select.value, approval_time.value);
|
||||
actionReq(approvalConfig.api);
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
rowKey: 'ID',
|
||||
};
|
||||
|
||||
const tabBucket = [
|
||||
{
|
||||
title: '待审批',
|
||||
tableConfig,
|
||||
},
|
||||
{
|
||||
title: '已审批',
|
||||
tableConfig: approvalConfig,
|
||||
},
|
||||
];
|
||||
|
||||
return {
|
||||
nsTableRef,
|
||||
tableConfig,
|
||||
tabBucket,
|
||||
activeKey,
|
||||
};
|
||||
},
|
||||
|
||||
methods: {},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.tabs {
|
||||
margin: 0 24px;
|
||||
}
|
||||
|
||||
:deep(.ns-table .ns-table-main) {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
:deep(.ant-tabs-nav) {
|
||||
margin: 0 !important;
|
||||
}
|
||||
</style>
|
||||
162
nervui-operations/src/view/Tenant/add.vue
Normal file
@@ -0,0 +1,162 @@
|
||||
<!-- @format -->
|
||||
|
||||
<template>
|
||||
<my-add-form
|
||||
:schemas="formSchema"
|
||||
:model="data"
|
||||
formLayout="vertical"
|
||||
title="创建租户"
|
||||
api="/api/passport/passport/objs/Tenant"
|
||||
:confirmContent="`将发送验证邮件到${data.tenantEmail},以便激活完成租户开通,激活链接将在24小时以内有效,确定发送吗?`"
|
||||
confirmApi="/api/passport/passport/objs/PreCreateTenant" />
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import myAddForm from '/@/view/components/add-form.vue';
|
||||
export default defineComponent({
|
||||
name: 'TenantAdd',
|
||||
components: { myAddForm },
|
||||
setup() {
|
||||
const router = useRouter();
|
||||
const { view } = router.currentRoute.value.query;
|
||||
const data = ref({});
|
||||
let formSchema = ref([
|
||||
{
|
||||
label: '项目',
|
||||
field: 'projectID',
|
||||
component: 'NsSelectApi',
|
||||
componentProps: {
|
||||
api: {
|
||||
url: '/api/passport/passport/objs/Authorization/CheckAuthorization',
|
||||
method: 'POST',
|
||||
},
|
||||
dropdownReload: true,
|
||||
showSearch: true,
|
||||
filterOption: (input: string, option: any) => {
|
||||
return option.name.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
||||
},
|
||||
resultField: 'projects',
|
||||
labelField: 'projectname',
|
||||
valueField: 'projectid',
|
||||
immediate: true,
|
||||
placeholder: '请选择',
|
||||
},
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择项目',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: '租户名',
|
||||
field: 'tenant',
|
||||
component: 'NsInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入',
|
||||
},
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入租户名',
|
||||
},
|
||||
{
|
||||
pattern: /^[A-Za-z][A-Za-z\d_-]{5,31}$/,
|
||||
message: '以字母开头输入6-32个字符,只能包含字母,数字,短横线(-)和下划线(_)',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: '别名',
|
||||
field: 'alias',
|
||||
component: 'NsInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入',
|
||||
},
|
||||
rules: [
|
||||
{
|
||||
pattern: /^[A-Za-z][A-Za-z\d_-]{5,31}$/,
|
||||
message: '以字母开头输入6-32个字符,只能包含字母,数字,短横线(-)和下划线(_)',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: '域名',
|
||||
field: 'cloudDomain',
|
||||
component: 'NsSelectApi',
|
||||
componentProps: {
|
||||
api: '/api/passport/passport/objs/GetCloudDomainList?pageSize=100',
|
||||
dropdownReload: true,
|
||||
showSearch: true,
|
||||
filterOption: (input: string, option: any) => {
|
||||
return option.name.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
||||
},
|
||||
resultField: 'data',
|
||||
labelField: 'cloudDomain',
|
||||
valueField: 'cloudDomain',
|
||||
immediate: true,
|
||||
placeholder: '请选择',
|
||||
},
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: '邮箱地址',
|
||||
field: 'tenantEmail',
|
||||
component: 'NsInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入',
|
||||
},
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入邮箱地址',
|
||||
},
|
||||
{
|
||||
pattern: /^\w+@[a-z0-9]+\.[a-z]{2,4}$/,
|
||||
message: '请输入正确的邮箱地址',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
field: 'tenantType',
|
||||
component: 'NsRadioGroup',
|
||||
defaultValue: 2,
|
||||
label: '租户类型',
|
||||
componentProps: {
|
||||
radioType: 'radio',
|
||||
options: [
|
||||
// {
|
||||
// label: '私有云租户',
|
||||
// value: 1,
|
||||
// },
|
||||
{
|
||||
label: '公有云租户',
|
||||
value: 2,
|
||||
},
|
||||
],
|
||||
},
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择',
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
return {
|
||||
data,
|
||||
formSchema,
|
||||
};
|
||||
},
|
||||
beforeCreate() {},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
99
nervui-operations/src/view/Tenant/edit.vue
Normal file
@@ -0,0 +1,99 @@
|
||||
<!-- @format -->
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<ns-view-edit-form
|
||||
:schemas="formSchema"
|
||||
:model="data"
|
||||
formLayout="vertical"
|
||||
title="编辑租户"
|
||||
api="/api/passport/passport/objs/Tenant"
|
||||
:getApi="`/api/passport/passport/objs/Tenant/${$router.currentRoute.value.params.id}`" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { defineComponent, reactive, ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { NsMessage } from '/nerv-lib/component/message';
|
||||
import { useNavigate } from '/nerv-lib/use/use-navigate';
|
||||
import { http } from '/nerv-lib/util/http';
|
||||
export default defineComponent({
|
||||
name: 'TenantAdd',
|
||||
setup() {
|
||||
const data = ref({});
|
||||
let formSchema = ref([
|
||||
{
|
||||
field: 'projectID',
|
||||
component: 'NsInput',
|
||||
show: false,
|
||||
},
|
||||
{
|
||||
field: 'ID',
|
||||
component: 'NsInput',
|
||||
show: false,
|
||||
},
|
||||
{
|
||||
label: '项目',
|
||||
field: 'projectName',
|
||||
component: 'NsInputText',
|
||||
},
|
||||
{
|
||||
label: '租户名',
|
||||
field: 'tenant',
|
||||
component: 'NsInputText',
|
||||
},
|
||||
{
|
||||
label: '别名',
|
||||
field: 'alias',
|
||||
component: 'NsInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入',
|
||||
},
|
||||
rules: [
|
||||
{
|
||||
pattern: /^[A-Za-z][A-Za-z\d_-]{5,31}$/,
|
||||
message: '以字母开头输入6-32个字符,只能包含字母,数字,短横线(-)和下划线(_)',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: '域名',
|
||||
field: 'cloudDomain',
|
||||
component: 'NsInputText',
|
||||
},
|
||||
{
|
||||
label: '邮箱地址',
|
||||
field: 'tenantEmail',
|
||||
component: 'NsInputText',
|
||||
},
|
||||
{
|
||||
field: 'tenantType',
|
||||
component: 'NsRadioGroup',
|
||||
defaultValue: 2,
|
||||
label: '租户类型',
|
||||
componentProps: {
|
||||
radioType: 'radio',
|
||||
options: [
|
||||
// {
|
||||
// label: '私有云租户',
|
||||
// value: 1,
|
||||
// },
|
||||
{
|
||||
label: '公有云租户',
|
||||
value: 2,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
return {
|
||||
data,
|
||||
formSchema,
|
||||
};
|
||||
},
|
||||
beforeCreate() {},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
156
nervui-operations/src/view/Tenant/list.vue
Normal file
@@ -0,0 +1,156 @@
|
||||
<!-- @format -->
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<ns-view-list-table v-bind="tableConfig" rowKey="ID" ref="nsTableRef" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref, computed, unref } from 'vue';
|
||||
import { dateUtil } from '/nerv-lib/util/date-util';
|
||||
import { useRouter } from 'vue-router';
|
||||
export default defineComponent({
|
||||
name: 'TenantPage',
|
||||
setup() {
|
||||
const router = useRouter();
|
||||
const nsTableRef = ref();
|
||||
const tableConfig = {
|
||||
api: '/api/passport/passport/objs/Tenant',
|
||||
title: '租户列表',
|
||||
params: {
|
||||
order: 'created_at desc',
|
||||
},
|
||||
rowSelection: null,
|
||||
resultField: 'data',
|
||||
columns: [
|
||||
{
|
||||
title: '项目',
|
||||
dataIndex: 'projectName',
|
||||
},
|
||||
{
|
||||
title: '租户名',
|
||||
dataIndex: 'tenant',
|
||||
},
|
||||
{
|
||||
title: '别名',
|
||||
dataIndex: 'alias',
|
||||
},
|
||||
{
|
||||
title: '租户类型',
|
||||
dataIndex: 'tenantType',
|
||||
customRender: ({ value }) => ['未知', '私有云', '公有云'][value],
|
||||
},
|
||||
|
||||
{
|
||||
title: '域名',
|
||||
dataIndex: 'cloudDomain',
|
||||
},
|
||||
{
|
||||
title: '邮箱',
|
||||
dataIndex: 'tenantEmail',
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'tenantStatus',
|
||||
transform: {
|
||||
pipe: 'state',
|
||||
statusField: ({ tenantStatus }: object) => {
|
||||
enum status {
|
||||
'unknown',
|
||||
'success',
|
||||
'error',
|
||||
}
|
||||
return status[tenantStatus];
|
||||
},
|
||||
textField: ({ tenantStatus }: object) => {
|
||||
enum status {
|
||||
'未激活',
|
||||
'激活',
|
||||
'禁用',
|
||||
}
|
||||
return status[tenantStatus];
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '创建人',
|
||||
dataIndex: 'CreatedBy',
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'CreatedAt',
|
||||
sorter: true,
|
||||
customRender: ({ value }: any) => dateUtil(value).format('YYYY-MM-DD HH:mm:ss'),
|
||||
},
|
||||
],
|
||||
columnActions: {
|
||||
title: '操作',
|
||||
// autoMergeAction: false,
|
||||
// actionNumber: 3,
|
||||
// textNumber: 5,
|
||||
actions: [
|
||||
{
|
||||
label: '编辑',
|
||||
name: 'TenantEdit',
|
||||
route: ':ID/edit',
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
name: 'TenantRemove',
|
||||
confirm: {
|
||||
content: '删除后不可恢复,您确定要删除吗?',
|
||||
},
|
||||
isReload: true,
|
||||
api: { method: 'delete', url: '/api/passport/passport/objs/Tenant/:ID' },
|
||||
ifShow: ({ tenantStatus }: any) => tenantStatus !== 1,
|
||||
},
|
||||
|
||||
{
|
||||
label: '禁用',
|
||||
name: 'TenantRemove',
|
||||
confirm: {
|
||||
content: '确定要禁用该租户吗?禁用后该租户将无法登录平台!',
|
||||
},
|
||||
isReload: true,
|
||||
dynamicParams: ['projectID', 'tenant'],
|
||||
api: { method: 'post', url: '/api/passport/passport/objs/Tenant/Forbidden' },
|
||||
ifShow: ({ tenantStatus }: any) => tenantStatus === 1,
|
||||
},
|
||||
{
|
||||
label: '启用',
|
||||
name: 'TenantRemove',
|
||||
isReload: true,
|
||||
dynamicParams: ['projectID', 'tenant'],
|
||||
api: { method: 'post', url: '/api/passport/passport/objs/Tenant/Activate' },
|
||||
ifShow: ({ tenantStatus }: any) => tenantStatus === 2,
|
||||
},
|
||||
],
|
||||
},
|
||||
headerActions: [
|
||||
{
|
||||
label: '创建租户',
|
||||
type: 'primary',
|
||||
name: 'TenantAdd',
|
||||
route: 'add',
|
||||
},
|
||||
],
|
||||
formConfig: {},
|
||||
rowKey: 'ID',
|
||||
};
|
||||
|
||||
return {
|
||||
nsTableRef,
|
||||
dateUtil,
|
||||
tableConfig,
|
||||
};
|
||||
},
|
||||
methods: {},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
:deep(.status-field > .anticon) {
|
||||
// 解决pipe 处理状态,隐藏问号icon
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
118
nervui-operations/src/view/components/add-form.vue
Normal file
@@ -0,0 +1,118 @@
|
||||
<template>
|
||||
<div :key="'addForm_' + $route.name">
|
||||
<a-spin :spinning="isLoading">
|
||||
<page-title :title="title" />
|
||||
<a-page-header>
|
||||
<template #extra>
|
||||
<!-- todo 隐藏取消-->
|
||||
<a-button @click="navigateBack">返回</a-button>
|
||||
<a-button type="primary" @click="submit" :disabled="!nsFormElRef?.validateResult">
|
||||
保存</a-button
|
||||
>
|
||||
</template>
|
||||
</a-page-header>
|
||||
<div class="add-form">
|
||||
<ns-form ref="nsFormElRef" v-bind="getBindValue">
|
||||
<template #[item]="data" v-for="item in Object.keys($slots)">
|
||||
<slot :name="item" v-bind="data || {}"></slot>
|
||||
</template>
|
||||
</ns-form>
|
||||
</div>
|
||||
</a-spin>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { computed, defineComponent, ref } from 'vue';
|
||||
import { http } from '/nerv-lib/util/http';
|
||||
import { NsMessage } from '/nerv-lib/component/message';
|
||||
import { formProps } from '/nerv-lib/component/form/form/props';
|
||||
import { PropTypes } from '/nerv-lib/util/type';
|
||||
import { useNavigate } from '/nerv-lib/use/use-navigate';
|
||||
import { useApi, HttpRequestConfig } from '/nerv-lib/use/use-api';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { NsModal } from '/nerv-lib/component/modal';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'NsViewAddForm',
|
||||
props: {
|
||||
...formProps,
|
||||
api: PropTypes.string,
|
||||
title: PropTypes.string,
|
||||
confirmContent: String,
|
||||
confirmApi: String,
|
||||
},
|
||||
setup(props, { attrs }) {
|
||||
const nsFormElRef = ref();
|
||||
const isLoading = ref(false);
|
||||
const { navigateBack } = useNavigate();
|
||||
const { httpRequest } = useApi();
|
||||
const route = useRoute();
|
||||
|
||||
function submit() {
|
||||
const { confirmApi, confirmContent, api } = props;
|
||||
fetch(confirmApi).then(() => {
|
||||
NsModal.confirm({
|
||||
title: '确认发送邮箱',
|
||||
content: confirmContent,
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: () =>
|
||||
fetch(api).then(() => {
|
||||
NsMessage.success('操作成功', 1, () => {
|
||||
navigateBack();
|
||||
});
|
||||
}),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function fetch(api) {
|
||||
return new Promise((resolve, reject) => {
|
||||
nsFormElRef.value
|
||||
.triggerSubmit()
|
||||
.then((data: Recordable) => {
|
||||
isLoading.value = true;
|
||||
// const { api } = props;
|
||||
const { params } = route;
|
||||
const requestConfig: HttpRequestConfig = { method: 'POST' };
|
||||
httpRequest({ api, params: data, pathParams: params, requestConfig })
|
||||
.then((res) => {
|
||||
isLoading.value = false;
|
||||
resolve(res);
|
||||
})
|
||||
.catch(() => {
|
||||
isLoading.value = false;
|
||||
});
|
||||
})
|
||||
.catch((err) => reject(err));
|
||||
});
|
||||
}
|
||||
const getBindValue = computed(() => ({
|
||||
...attrs,
|
||||
...props,
|
||||
}));
|
||||
return { nsFormElRef, submit, getBindValue, isLoading, navigateBack };
|
||||
},
|
||||
});
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.ant-page-header {
|
||||
padding: 0 24px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
:deep(.ant-page-header-heading-extra) {
|
||||
margin-right: auto !important;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.add-form {
|
||||
padding: 0 24px;
|
||||
}
|
||||
:deep(.ant-table-thead
|
||||
> tr
|
||||
> th:not(:last-child):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not([colspan])::before) {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
48
nervui-operations/tsconfig.json
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"baseUrl": "./",
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "preserve",
|
||||
"lib": ["esnext", "dom"],
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"resolveJsonModule": true,
|
||||
"skipLibCheck": true,
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"strictFunctionTypes": false,
|
||||
"target": "esnext",
|
||||
"types": ["vite/client"],
|
||||
"typeRoots": [
|
||||
"../node_modules/@types",
|
||||
"../node_modules/@vue",
|
||||
"../type"
|
||||
],
|
||||
"paths": {
|
||||
"/@/*": [
|
||||
"src/*"
|
||||
],
|
||||
"/nerv-lib/*": [
|
||||
"../lib/*"
|
||||
],
|
||||
"/nerv-base/*": [
|
||||
"../lib/paas/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"src/**/*",
|
||||
"type/**/*",
|
||||
"mock/**/*",
|
||||
"vite.config.ts"
|
||||
, "public/resumable.d.ts", "public/resumable.js" ],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"dist",
|
||||
"**/*.js"
|
||||
]
|
||||
}
|
||||
23
nervui-operations/vite.config.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
/** @format */
|
||||
|
||||
import configFun from '../build/vite-default.config';
|
||||
const dirname = __dirname;
|
||||
const proxy = {
|
||||
'/assets/fonts': {
|
||||
target: 'http://portal.devops.wh.dingcloud.com:30080/assets/fonts',
|
||||
changeOrigin: true,
|
||||
rewrite: (path: any) => path.replace(/^\/assets\/fonts/, ''),
|
||||
},
|
||||
|
||||
'/api/idaas': {
|
||||
target: 'http://100.86.13.85:8080/api',
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
rewrite: (path: any) => path.replace(/^\/api\/idaas/, ''),
|
||||
},
|
||||
'/api': {
|
||||
target: 'http://portal.op.sh.dingcloud.com:30080',
|
||||
changeOrigin: true,
|
||||
},
|
||||
};
|
||||
export default configFun({ dirname, serviceMode: 'paas', baseDir: '../', proxy });
|
||||