init
This commit is contained in:
128
src/components/basic-block/main.vue
Executable file
128
src/components/basic-block/main.vue
Executable file
@@ -0,0 +1,128 @@
|
||||
<template>
|
||||
<div class="basic-block" :style="styleName">
|
||||
<div class="box" :style="boxStyleName">
|
||||
<router-link :to="to">
|
||||
<span v-text="text"></span>
|
||||
<p v-text="dept"></p>
|
||||
<i :class="icon"></i>
|
||||
</router-link>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'basicBlock',
|
||||
props: {
|
||||
icon: {
|
||||
type: String,
|
||||
},
|
||||
background: {
|
||||
type: String,
|
||||
},
|
||||
to: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {};
|
||||
},
|
||||
},
|
||||
text: {
|
||||
type: String,
|
||||
},
|
||||
dept: {
|
||||
type: String,
|
||||
},
|
||||
time: {
|
||||
type: [Number, String],
|
||||
},
|
||||
gutter: {
|
||||
type: [Number, String],
|
||||
default: 5,
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
},
|
||||
width: {
|
||||
type: [Number, String],
|
||||
},
|
||||
height: {
|
||||
type: [Number, String],
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
styleName() {
|
||||
return {
|
||||
animationDelay: `${this.time / 25}s`,
|
||||
width: `${this.width}px`,
|
||||
height: `${this.height}px`,
|
||||
margin: `${this.gutter}px`,
|
||||
};
|
||||
},
|
||||
boxStyleName() {
|
||||
return {
|
||||
backgroundColor: this.color,
|
||||
backgroundImage: `url('${this.background}')`,
|
||||
};
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.basic-block {
|
||||
opacity: 0;
|
||||
|
||||
box-sizing: border-box;
|
||||
color: #fff;
|
||||
animation: mymove 1s;
|
||||
animation-fill-mode: forwards;
|
||||
|
||||
.box {
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
padding: 15px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
transition: all 1s;
|
||||
background-size: cover;
|
||||
|
||||
&:hover {
|
||||
transform: rotateY(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
a {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
span {
|
||||
display: block;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
p {
|
||||
width: 80%;
|
||||
font-size: 10px;
|
||||
color: #eee;
|
||||
line-height: 22px;
|
||||
}
|
||||
|
||||
i {
|
||||
position: absolute;
|
||||
bottom: 15px;
|
||||
right: 15px;
|
||||
font-size: 50px !important;
|
||||
}
|
||||
|
||||
@keyframes mymove {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: scale(0);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
57
src/components/basic-container/main.vue
Executable file
57
src/components/basic-container/main.vue
Executable file
@@ -0,0 +1,57 @@
|
||||
<template>
|
||||
<div class="basic-container" :style="styleName" :class="{ 'basic-container--block': block }">
|
||||
<el-card class="basic-container__card">
|
||||
<slot></slot>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'basicContainer',
|
||||
props: {
|
||||
radius: {
|
||||
type: [String, Number],
|
||||
default: 10,
|
||||
},
|
||||
background: {
|
||||
type: String,
|
||||
},
|
||||
block: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
styleName() {
|
||||
return {
|
||||
borderRadius: `${this.radius}px`,
|
||||
background: this.background,
|
||||
};
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.basic-container {
|
||||
padding: 10px 6px;
|
||||
box-sizing: border-box;
|
||||
|
||||
&--block {
|
||||
height: 100%;
|
||||
|
||||
.basic-container__card {
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
&__card {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
&:first-child {
|
||||
padding-top: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
140
src/components/basic-video/main.vue
Normal file
140
src/components/basic-video/main.vue
Normal file
@@ -0,0 +1,140 @@
|
||||
<template>
|
||||
<div :style="styleName" class="basic-video">
|
||||
<div class="basic-video__border">
|
||||
<span :style="borderStyleName"></span>
|
||||
<span :style="borderStyleName"></span>
|
||||
<span :style="borderStyleName"></span>
|
||||
<span :style="borderStyleName"></span>
|
||||
</div>
|
||||
<img :style="imgStyleName" class="basic-video__img" :src="background" />
|
||||
<video class="basic-video__main" ref="main" autoplay muted></video>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import RecordVideo from './plugin';
|
||||
|
||||
export default {
|
||||
name: 'basic-video',
|
||||
props: {
|
||||
background: {
|
||||
type: String,
|
||||
},
|
||||
width: {
|
||||
type: [String, Number],
|
||||
default: 500,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
styleName() {
|
||||
return {
|
||||
width: `${this.width}px`,
|
||||
};
|
||||
},
|
||||
imgStyleName() {
|
||||
return {
|
||||
width: `${this.width / 2}px`,
|
||||
};
|
||||
},
|
||||
borderStyleName() {
|
||||
return {
|
||||
width: `${this.width / 15}px`,
|
||||
height: `${this.width / 15}px`,
|
||||
borderWidth: `${5}px`,
|
||||
};
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
videoObj: null,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.videoObj = new RecordVideo(this.$refs.main);
|
||||
const videoPromise = this.videoObj.init();
|
||||
videoPromise.then(() => {
|
||||
this.videoObj.mediaRecorder.addEventListener('stop', this.getData, false);
|
||||
});
|
||||
},
|
||||
startRecord() {
|
||||
this.videoObj.startRecord();
|
||||
},
|
||||
stopRecord() {
|
||||
this.videoObj.stopRecord();
|
||||
},
|
||||
getData() {
|
||||
const blob = new Blob(this.videoObj.chunks, {
|
||||
type: 'video/mp4',
|
||||
});
|
||||
const reader = new FileReader();
|
||||
reader.readAsDataURL(blob);
|
||||
reader.addEventListener('loadend', () => {
|
||||
var video_base64 = reader.result;
|
||||
this.$emit('data-change', video_base64);
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.basic-video {
|
||||
margin: 0 auto;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
|
||||
&__border {
|
||||
span {
|
||||
position: absolute;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-width: 4px;
|
||||
color: #0073eb;
|
||||
border-style: solid;
|
||||
|
||||
&:nth-child(1) {
|
||||
left: 15px;
|
||||
top: 15px;
|
||||
border-right: 0;
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
&:nth-child(2) {
|
||||
right: 15px;
|
||||
top: 15px;
|
||||
border-left: 0;
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
&:nth-child(3) {
|
||||
bottom: 15px;
|
||||
left: 15px;
|
||||
border-right: 0;
|
||||
border-top: 0;
|
||||
}
|
||||
|
||||
&:nth-child(4) {
|
||||
bottom: 15px;
|
||||
right: 15px;
|
||||
border-left: 0;
|
||||
border-top: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&__img {
|
||||
width: 100px;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
&__main {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
88
src/components/basic-video/plugin.js
Normal file
88
src/components/basic-video/plugin.js
Normal file
@@ -0,0 +1,88 @@
|
||||
export default class RecordVideo {
|
||||
/**
|
||||
* 构造函数
|
||||
*
|
||||
* @param {Object} videoObj 视频对象
|
||||
*/
|
||||
constructor(videoObj) {
|
||||
this.video = videoObj;
|
||||
this.mediaRecorder = null;
|
||||
this.chunks = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*
|
||||
* @return {Object} promise
|
||||
*/
|
||||
init() {
|
||||
// 返回Promise对象
|
||||
// resolve 正常处理
|
||||
// reject 处理异常情况
|
||||
return new Promise((resovle, reject) => {
|
||||
navigator.mediaDevices
|
||||
.getUserMedia({
|
||||
audio: true,
|
||||
video: true,
|
||||
// video: {
|
||||
// width: this.videoWidth,
|
||||
// height: this.videoHeight
|
||||
// }
|
||||
})
|
||||
// 返回一个媒体内容的流
|
||||
.then(stream => {
|
||||
// 检测是否支持 srcObject,该属性在新的浏览器支持
|
||||
if ('srcObject' in this.video) {
|
||||
this.video.srcObject = stream;
|
||||
} else {
|
||||
// 兼容旧的浏览器
|
||||
this.video.src = window.URL.createObjectURL(stream);
|
||||
}
|
||||
|
||||
// 当视频的元数据已经加载时触发
|
||||
this.video.addEventListener('loadmetadata', () => {
|
||||
this.video.play();
|
||||
});
|
||||
this.mediaRecorder = new MediaRecorder(stream);
|
||||
this.mediaRecorder.addEventListener('dataavailable', e => {
|
||||
this.chunks.push(e.data);
|
||||
});
|
||||
resovle();
|
||||
})
|
||||
// 异常抓取,包括用于禁用麦克风、摄像头
|
||||
.catch(error => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 视频开始录制
|
||||
*/
|
||||
startRecord() {
|
||||
if (this.mediaRecorder.state === 'inactive') {
|
||||
this.mediaRecorder.start();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 视频结束录制
|
||||
*/
|
||||
stopRecord() {
|
||||
if (this.mediaRecorder.state === 'recording') {
|
||||
this.mediaRecorder.stop();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测当前浏览器对否支持
|
||||
*
|
||||
* @return {boolean} 当前浏览器是否支持
|
||||
*/
|
||||
isSupport() {
|
||||
const flag = navigator.mediaDevices && navigator.mediaDevices.getUserMedia;
|
||||
if (flag) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
135
src/components/code-editor/main.vue
Normal file
135
src/components/code-editor/main.vue
Normal file
@@ -0,0 +1,135 @@
|
||||
<template>
|
||||
<div class="code-editor">
|
||||
<textarea ref="textarea" v-show="false"></textarea>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CodeMirror from 'codemirror';
|
||||
import 'codemirror/lib/codemirror.css';
|
||||
// 主题
|
||||
import 'codemirror/theme/idea.css';
|
||||
import 'codemirror/theme/nord.css';
|
||||
import 'codemirror/theme/xq-light.css';
|
||||
import 'codemirror/mode/clike/clike';
|
||||
import 'codemirror/mode/javascript/javascript';
|
||||
import 'codemirror/addon/display/autorefresh';
|
||||
// 搜索
|
||||
import 'codemirror/addon/scroll/annotatescrollbar.js';
|
||||
import 'codemirror/addon/search/matchesonscrollbar.js';
|
||||
import 'codemirror/addon/search/match-highlighter.js';
|
||||
import 'codemirror/addon/search/jump-to-line.js';
|
||||
import 'codemirror/addon/dialog/dialog.js';
|
||||
import 'codemirror/addon/dialog/dialog.css';
|
||||
import 'codemirror/addon/search/searchcursor.js';
|
||||
import 'codemirror/addon/search/search.js';
|
||||
// 折叠
|
||||
import 'codemirror/addon/fold/foldgutter.css';
|
||||
import 'codemirror/addon/fold/foldcode';
|
||||
import 'codemirror/addon/fold/foldgutter';
|
||||
import 'codemirror/addon/fold/brace-fold';
|
||||
import 'codemirror/addon/fold/comment-fold';
|
||||
// 格式化
|
||||
import formatter from '@/utils/formatter';
|
||||
import { validatejson, validatenull } from '@/utils/validate';
|
||||
|
||||
export default {
|
||||
name: 'CodeEditor',
|
||||
props: {
|
||||
modelValue: {
|
||||
type: String,
|
||||
required: true,
|
||||
default: '',
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
required: true,
|
||||
default: '450px',
|
||||
},
|
||||
mode: {
|
||||
type: String,
|
||||
default: 'javascript',
|
||||
},
|
||||
theme: {
|
||||
type: String,
|
||||
default: 'idea',
|
||||
},
|
||||
readonly: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
json: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.editor = CodeMirror.fromTextArea(this.$refs.textarea, {
|
||||
mode: this.mode, // 默认设置为 'javascript' 或根据需要配置
|
||||
theme: this.theme, // 直接设置主题或根据需要配置
|
||||
readOnly: this.readonly,
|
||||
autoRefresh: true,
|
||||
lineNumbers: true,
|
||||
lineWrapping: true,
|
||||
tabSize: 2,
|
||||
foldGutter: true,
|
||||
gutters: ['CodeMirror-linenumbers', 'CodeMirror-foldgutter', 'CodeMirror-lint-markers'],
|
||||
extraKeys: {
|
||||
// 绑定快捷键 Ctrl-F / Cmd-F 开启搜索
|
||||
'Ctrl-F': 'findPersistent',
|
||||
'Cmd-F': 'findPersistent',
|
||||
// 如果需要,您还可以添加 "Ctrl-R"/"Cmd-R" 绑定替换功能
|
||||
'Ctrl-R': 'replace',
|
||||
'Cmd-R': 'replace',
|
||||
},
|
||||
});
|
||||
|
||||
// 设置高度
|
||||
this.editor.setSize('auto', this.height);
|
||||
|
||||
// 设置文本
|
||||
const editorValue = this.json ? formatter.prettyCode(this.modelValue) : this.modelValue;
|
||||
this.editor.setValue(editorValue);
|
||||
|
||||
this.editor.on('change', () => {
|
||||
this.$emit('update:modelValue', this.editor.getValue()); // 更新 modelValue
|
||||
});
|
||||
},
|
||||
watch: {
|
||||
modelValue(newVal) {
|
||||
if (newVal !== this.editor.getValue()) {
|
||||
const editorValue = this.json ? formatter.prettyCode(this.modelValue) : this.modelValue;
|
||||
this.editor.setValue(editorValue);
|
||||
}
|
||||
},
|
||||
height(newHeight) {
|
||||
this.editor.setSize('auto', newHeight);
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
prettyCode() {
|
||||
if (this.json) {
|
||||
const val = this.editor.getValue();
|
||||
if (validatenull(val)) {
|
||||
this.$message.warning('请先填写数据');
|
||||
return;
|
||||
}
|
||||
if (!validatejson(val)) {
|
||||
this.$message.warning('数据 JSON 格式错误');
|
||||
return;
|
||||
}
|
||||
this.editor.setValue(formatter.prettyCode(val));
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.code-editor {
|
||||
line-height: 1.2 !important;
|
||||
width: calc(100% - 4px);
|
||||
height: 100%;
|
||||
border: 1px solid #ccc; /* 添加边框样式 */
|
||||
}
|
||||
</style>
|
||||
23
src/components/error-page/403.vue
Executable file
23
src/components/error-page/403.vue
Executable file
@@ -0,0 +1,23 @@
|
||||
<template>
|
||||
<div class="error-page">
|
||||
<div class="img" style="background-image: url('/img/403.svg')"></div>
|
||||
<div class="content">
|
||||
<h1>403</h1>
|
||||
<div class="desc">抱歉,你无权访问该页面</div>
|
||||
<div class="actions">
|
||||
<router-link :to="{ path: '/' }">
|
||||
<el-button type="primary">返回首页</el-button>
|
||||
</router-link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'error-403',
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@use './style.scss';
|
||||
</style>
|
||||
23
src/components/error-page/404.vue
Executable file
23
src/components/error-page/404.vue
Executable file
@@ -0,0 +1,23 @@
|
||||
<template>
|
||||
<div class="error-page">
|
||||
<div class="img" style="background-image: url('/img/404.svg')"></div>
|
||||
<div class="content">
|
||||
<h1>404</h1>
|
||||
<div class="desc">抱歉,你访问的页面不存在</div>
|
||||
<div class="actions">
|
||||
<router-link :to="{ path: '/' }">
|
||||
<el-button type="primary">返回首页</el-button>
|
||||
</router-link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'error-404',
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@use './style.scss';
|
||||
</style>
|
||||
23
src/components/error-page/500.vue
Executable file
23
src/components/error-page/500.vue
Executable file
@@ -0,0 +1,23 @@
|
||||
<template>
|
||||
<div class="error-page">
|
||||
<div class="img" style="background-image: url('/img/500.svg')"></div>
|
||||
<div class="content">
|
||||
<h1>500</h1>
|
||||
<div class="desc">抱歉,服务器出错了</div>
|
||||
<div class="actions">
|
||||
<router-link :to="{ path: '/' }">
|
||||
<el-button type="primary">返回首页</el-button>
|
||||
</router-link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'error-500',
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@use './style.scss';
|
||||
</style>
|
||||
35
src/components/error-page/style.scss
Executable file
35
src/components/error-page/style.scss
Executable file
@@ -0,0 +1,35 @@
|
||||
.error-page {
|
||||
background: #f0f2f5;
|
||||
margin-top: -30px;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.img {
|
||||
margin-right: 80px;
|
||||
height: 360px;
|
||||
width: 100%;
|
||||
max-width: 430px;
|
||||
background-repeat: no-repeat;
|
||||
background-position: 50% 50%;
|
||||
background-size: contain;
|
||||
}
|
||||
|
||||
.content {
|
||||
h1 {
|
||||
color: #434e59;
|
||||
font-size: 72px;
|
||||
font-weight: 600;
|
||||
line-height: 72px;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.desc {
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
font-size: 20px;
|
||||
line-height: 28px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
}
|
||||
}
|
||||
194
src/components/flow-design-step/main.vue
Normal file
194
src/components/flow-design-step/main.vue
Normal file
@@ -0,0 +1,194 @@
|
||||
<template>
|
||||
<div v-if="componentLoaded">
|
||||
<el-dialog
|
||||
v-if="website.design.designMode"
|
||||
title="流程配置"
|
||||
append-to-body
|
||||
destroy-on-close
|
||||
v-model="visible"
|
||||
:close-on-press-escape="false"
|
||||
:fullscreen="true"
|
||||
:before-close="handleNutflowClose"
|
||||
class="nf-dialog"
|
||||
>
|
||||
<nf-design-base
|
||||
v-if="nutflowOption.step === 1"
|
||||
class="animated fadeIn"
|
||||
style="height: calc(100vh - 108px)"
|
||||
ref="nf-design"
|
||||
:options="nutflowOption.step1"
|
||||
></nf-design-base>
|
||||
<nf-design-base
|
||||
v-if="nutflowOption.step === 2"
|
||||
class="animated fadeIn"
|
||||
style="height: calc(100vh - 108px)"
|
||||
ref="nf-design-view"
|
||||
:options="nutflowOption.step2"
|
||||
></nf-design-base>
|
||||
<template #footer>
|
||||
<span class="avue-dialog__footer">
|
||||
<el-button @click="handleNutflowClose(() => {}, true)">取 消</el-button>
|
||||
<el-button v-if="nutflowOption.step === 1" type="success" @click="handleStep(1)"
|
||||
>下 一 步</el-button
|
||||
>
|
||||
<el-button v-if="nutflowOption.step === 2" type="success" @click="handleStep(-1)"
|
||||
>上 一 步</el-button
|
||||
>
|
||||
<el-button v-if="nutflowOption.step === 2" type="primary" @click="handleSubmitModel"
|
||||
>确 定</el-button
|
||||
>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { loadFlowModule } from '@/utils/module';
|
||||
import { submitModel } from '@/api/flow/flow';
|
||||
|
||||
export default {
|
||||
name: 'flowDesign',
|
||||
props: {
|
||||
isDisplay: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
componentLoaded: false,
|
||||
nutflowOption: {
|
||||
process: {},
|
||||
step: 1,
|
||||
step1: {
|
||||
toolbar: [
|
||||
'open',
|
||||
'create',
|
||||
'fit',
|
||||
'zoom-in',
|
||||
'zoom-out',
|
||||
'undo',
|
||||
'redo',
|
||||
'import',
|
||||
'preview',
|
||||
],
|
||||
},
|
||||
step2: {
|
||||
mode: 'view',
|
||||
simulation: true,
|
||||
minimap: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
// 懒加载流程设计器模块
|
||||
loadFlowModule(this.$app).then(() => {
|
||||
this.componentLoaded = true;
|
||||
});
|
||||
},
|
||||
watch: {
|
||||
isDisplay: {
|
||||
handler(val) {
|
||||
this.visible = val;
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
visible: {
|
||||
handler(val) {
|
||||
this.$emit('update:is-display', val);
|
||||
},
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
handleSubmitModel() {
|
||||
const registry = this.$refs['nf-design-view'].getElementRegistry().getAll();
|
||||
const { businessObject } = registry[0];
|
||||
const { id, name, documentation } = businessObject;
|
||||
const description = documentation && documentation.length > 0 ? documentation[0].text : null;
|
||||
const params = {
|
||||
...this.nutflowOption.process,
|
||||
modelKey: id,
|
||||
name,
|
||||
description,
|
||||
modelEditorXml: this.nutflowOption.process.xml,
|
||||
};
|
||||
submitModel(params).then(() => {
|
||||
this.$message.success('操作成功');
|
||||
this.handleNutflowClose();
|
||||
this.$emit('loadData');
|
||||
});
|
||||
},
|
||||
handleStep(step) {
|
||||
if (step === 1) {
|
||||
// 下一步
|
||||
this.$refs['nf-design'].getData('xml').then(data => {
|
||||
this.nutflowOption.step1.xml = data;
|
||||
this.nutflowOption.step2.xml = data;
|
||||
this.nutflowOption.process.xml = data;
|
||||
this.nutflowOption.step = 2;
|
||||
});
|
||||
} else this.nutflowOption.step = 1;
|
||||
},
|
||||
handleNutflowClose(done, flag) {
|
||||
const initOption = {
|
||||
process: {},
|
||||
step: 1,
|
||||
step1: {
|
||||
toolbar: [
|
||||
'open',
|
||||
'create',
|
||||
'fit',
|
||||
'zoom-in',
|
||||
'zoom-out',
|
||||
'undo',
|
||||
'redo',
|
||||
'import',
|
||||
'preview',
|
||||
],
|
||||
},
|
||||
step2: {
|
||||
mode: 'view',
|
||||
simulation: true,
|
||||
minimap: true,
|
||||
},
|
||||
};
|
||||
if (done || flag) {
|
||||
this.$confirm('确定要关闭吗?关闭未保存的修改都会丢失。', '警告', {
|
||||
type: 'warning',
|
||||
})
|
||||
.then(() => {
|
||||
this.nutflowOption = initOption;
|
||||
if (typeof done == 'function') done();
|
||||
this.visible = false;
|
||||
})
|
||||
.catch(() => {});
|
||||
} else {
|
||||
this.nutflowOption = initOption;
|
||||
this.visible = false;
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.flow-design-dialog {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin: 0 !important;
|
||||
position: absolute;
|
||||
top: 40%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -40%);
|
||||
max-height: calc(100% - 30px);
|
||||
max-width: calc(100% - 30px);
|
||||
|
||||
.el-dialog__body {
|
||||
flex: 1;
|
||||
overflow: auto;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
133
src/components/flow-design/main.vue
Normal file
133
src/components/flow-design/main.vue
Normal file
@@ -0,0 +1,133 @@
|
||||
<template>
|
||||
<div v-if="componentLoaded">
|
||||
<el-dialog
|
||||
v-if="isDialog"
|
||||
v-model="visible"
|
||||
append-to-body
|
||||
destroy-on-close
|
||||
title="流程图展示"
|
||||
width="70%"
|
||||
class="flow-design-dialog"
|
||||
>
|
||||
<nf-design-base ref="bpmn" style="height: 60vh" :options="option"></nf-design-base>
|
||||
</el-dialog>
|
||||
<div v-else>
|
||||
<nf-design-base
|
||||
v-if="visible"
|
||||
ref="bpmn"
|
||||
style="height: 60vh"
|
||||
:options="option"
|
||||
></nf-design-base>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { loadFlowModule } from '@/utils/module';
|
||||
import { modelView } from '@/api/flow/flow';
|
||||
|
||||
export default {
|
||||
name: 'flowDesign',
|
||||
props: {
|
||||
isDialog: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isDisplay: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
processInstanceId: String,
|
||||
processDefinitionId: String,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
componentLoaded: false,
|
||||
option: {
|
||||
mode: 'view',
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
// 懒加载流程设计器模块
|
||||
loadFlowModule(this.$app).then(() => {
|
||||
this.componentLoaded = true;
|
||||
});
|
||||
},
|
||||
watch: {
|
||||
isDisplay: {
|
||||
handler(val) {
|
||||
this.visible = val;
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
visible: {
|
||||
handler(val) {
|
||||
this.$emit('update:is-display', val);
|
||||
},
|
||||
},
|
||||
processInstanceId: {
|
||||
handler(val) {
|
||||
if (!val) return;
|
||||
this.getDetail({ processInstanceId: this.processInstanceId });
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
processDefinitionId: {
|
||||
handler(val) {
|
||||
if (!val) return;
|
||||
this.getDetail({ processDefinitionId: this.processDefinitionId });
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
getDetail(params) {
|
||||
modelView(params).then(res => {
|
||||
const data = res.data.data;
|
||||
const { xml, flow } = data;
|
||||
this.option.xml = xml;
|
||||
if (flow) {
|
||||
const flows = [];
|
||||
flow.forEach(f => {
|
||||
let { endTime } = f;
|
||||
|
||||
const ff = {
|
||||
id: f.historyActivityId,
|
||||
class: !endTime && f.historyActivityType !== 'candidate' ? 'nodePrimary' : '',
|
||||
};
|
||||
|
||||
if (f.historyActivityType === 'sequenceFlow') ff.class = 'lineWarn';
|
||||
else if (!ff.class && f.historyActivityType !== 'candidate') ff.class = 'nodeSuccess';
|
||||
|
||||
const index = flows.findIndex(fl => fl.id === f.historyActivityId);
|
||||
if (index !== -1) flows.splice(index, 1, ff);
|
||||
else flows.push(ff);
|
||||
});
|
||||
this.option.flows = flows;
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.flow-design-dialog {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin: 0 !important;
|
||||
position: absolute;
|
||||
top: 40%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -40%);
|
||||
max-height: calc(100% - 30px);
|
||||
max-width: calc(100% - 30px);
|
||||
|
||||
.el-dialog__body {
|
||||
flex: 1;
|
||||
overflow: auto;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
90
src/components/highlight/main.vue
Normal file
90
src/components/highlight/main.vue
Normal file
@@ -0,0 +1,90 @@
|
||||
<template>
|
||||
<div class="code-block-container">
|
||||
<pre v-if="highlightedCode"><code v-html="highlightedCode" class="hljs"></code></pre>
|
||||
<button v-if="clipboard"
|
||||
v-clipboard:copy="this.code"
|
||||
v-clipboard:success="onCopySuccess"
|
||||
class="copy-btn">
|
||||
一键复制
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import hljs from 'highlight.js';
|
||||
import formatter from '@/utils/formatter';
|
||||
// 引入语言支持
|
||||
import json from 'highlight.js/lib/languages/json';
|
||||
import java from 'highlight.js/lib/languages/java';
|
||||
import javascript from 'highlight.js/lib/languages/javascript';
|
||||
import 'highlight.js/styles/github.css';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
code: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
language: {
|
||||
type: String,
|
||||
default: 'javascript'
|
||||
},
|
||||
clipboard: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
highlightedCode() {
|
||||
hljs.registerLanguage('json', json);
|
||||
hljs.registerLanguage('java', java);
|
||||
hljs.registerLanguage('javascript', javascript);
|
||||
let code = this.code;
|
||||
if (this.language === 'json') {
|
||||
code = formatter.prettyCode(this.code);
|
||||
}
|
||||
return hljs.highlight(code, {language: this.language, ignoreIllegals: true}).value;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onCopySuccess() {
|
||||
this.$message.success('复制成功');
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.code-block-container {
|
||||
position: relative;
|
||||
background-color: #f0f0f0;
|
||||
width: 100%;
|
||||
overflow-y: auto; /* 只显示纵向滚动条 */
|
||||
overflow-x: hidden; /* 隐藏横向滚动条 */
|
||||
white-space: pre-wrap; /* 防止内容溢出 */
|
||||
word-wrap: break-word; /* 自动换行 */
|
||||
}
|
||||
|
||||
pre {
|
||||
margin: 0;
|
||||
padding: 0.5em;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.copy-btn {
|
||||
position: absolute;
|
||||
top: 0.5em;
|
||||
right: 0.5em;
|
||||
padding: 0.25em 0.5em;
|
||||
font-size: 0.75em;
|
||||
color: #fff;
|
||||
background-color: #606266;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.copy-btn:hover {
|
||||
background-color: #909399;
|
||||
}
|
||||
</style>
|
||||
82
src/components/iframe/main.vue
Executable file
82
src/components/iframe/main.vue
Executable file
@@ -0,0 +1,82 @@
|
||||
<template>
|
||||
<basic-container>
|
||||
<iframe :src="src" class="iframe" ref="iframe" />
|
||||
</basic-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import NProgress from 'nprogress'; // progress bar
|
||||
import 'nprogress/nprogress.css'; // progress bar style
|
||||
export default {
|
||||
name: 'AvueIframe',
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
created() {
|
||||
NProgress.configure({ showSpinner: false });
|
||||
},
|
||||
mounted() {
|
||||
this.load();
|
||||
},
|
||||
watch: {
|
||||
$route: function () {
|
||||
this.load();
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
src() {
|
||||
return this.$route.query.url.replace(/#/g, '&');
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// 显示等待框
|
||||
show() {
|
||||
NProgress.start();
|
||||
},
|
||||
// 隐藏等待狂
|
||||
hide() {
|
||||
NProgress.done();
|
||||
},
|
||||
// 加载组件
|
||||
load() {
|
||||
this.show();
|
||||
//超时3s自动隐藏等待狂,加强用户体验
|
||||
let time = 3;
|
||||
const timeFunc = setInterval(() => {
|
||||
time--;
|
||||
if (time == 0) {
|
||||
this.hide();
|
||||
clearInterval(timeFunc);
|
||||
}
|
||||
}, 1000);
|
||||
this.iframeInit();
|
||||
},
|
||||
//iframe窗口初始化
|
||||
iframeInit() {
|
||||
const iframe = this.$refs.iframe;
|
||||
const clientHeight = document.documentElement.clientHeight - 150;
|
||||
if (!iframe) return;
|
||||
iframe.style.height = `${clientHeight}px`;
|
||||
if (iframe.attachEvent) {
|
||||
iframe.attachEvent('onload', () => {
|
||||
this.hide();
|
||||
});
|
||||
} else {
|
||||
iframe.onload = () => {
|
||||
this.hide();
|
||||
};
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.iframe {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 0;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
129
src/components/third-register/main.vue
Normal file
129
src/components/third-register/main.vue
Normal file
@@ -0,0 +1,129 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
title="账号注册"
|
||||
append-to-body
|
||||
v-model="accountBox"
|
||||
:close-on-click-modal="false"
|
||||
:close-on-press-escape="false"
|
||||
:show-close="false"
|
||||
width="20%"
|
||||
>
|
||||
<el-form :model="form" ref="form" label-width="80px">
|
||||
<el-form-item v-if="tenantMode" label="租户编号">
|
||||
<el-input v-model="form.tenantId" placeholder="请输入租户编号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户姓名">
|
||||
<el-input v-model="form.name" placeholder="请输入用户姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="账号名称">
|
||||
<el-input v-model="form.account" placeholder="请输入账号名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="账号密码">
|
||||
<el-input v-model="form.password" placeholder="请输入账号密码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="确认密码">
|
||||
<el-input v-model="form.password2" placeholder="请输入确认密码"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button type="primary" :loading="loading" @click="handleRegister">确 定</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import { validatenull } from 'utils/validate';
|
||||
import { registerGuest } from '@/api/user';
|
||||
import { getTopUrl } from 'utils/util';
|
||||
import { info } from '@/api/system/tenant';
|
||||
import { resetRouter } from '@/router/index';
|
||||
|
||||
export default {
|
||||
name: 'thirdRegister',
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
tenantId: '',
|
||||
name: '',
|
||||
account: '',
|
||||
password: '',
|
||||
password2: '',
|
||||
},
|
||||
loading: false,
|
||||
tenantMode: true,
|
||||
accountBox: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['userInfo']),
|
||||
},
|
||||
created() {
|
||||
this.getTenant();
|
||||
},
|
||||
mounted() {
|
||||
// 若未登录则弹出框进行绑定
|
||||
if (validatenull(this.userInfo.userId) || this.userInfo.userId < 0) {
|
||||
this.form.name = this.userInfo.userName;
|
||||
this.form.account = this.userInfo.account;
|
||||
this.accountBox = true;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleRegister() {
|
||||
if (this.form.tenantId === '') {
|
||||
this.$message.warning('请先输入租户编号');
|
||||
return;
|
||||
}
|
||||
if (this.form.account === '') {
|
||||
this.$message.warning('请先输入账号名称');
|
||||
return;
|
||||
}
|
||||
if (this.form.password === '' || this.form.password2 === '') {
|
||||
this.$message.warning('请先输入密码');
|
||||
return;
|
||||
}
|
||||
if (this.form.password !== this.form.password2) {
|
||||
this.$message.warning('两次密码输入不一致');
|
||||
return;
|
||||
}
|
||||
this.loading = true;
|
||||
registerGuest(this.form, this.userInfo.oauthId).then(
|
||||
res => {
|
||||
this.loading = false;
|
||||
const data = res.data;
|
||||
if (data.success) {
|
||||
this.accountBox = false;
|
||||
this.$alert('注册申请已提交,请耐心等待管理员通过!', '注册提示').then(() => {
|
||||
this.$store.dispatch('LogOut').then(() => {
|
||||
resetRouter();
|
||||
this.$router.push({ path: '/login' });
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this.$message.error(data.msg || '提交失败');
|
||||
}
|
||||
},
|
||||
error => {
|
||||
window.console.log(error);
|
||||
this.loading = false;
|
||||
}
|
||||
);
|
||||
},
|
||||
getTenant() {
|
||||
let domain = getTopUrl();
|
||||
// 临时指定域名,方便测试
|
||||
//domain = "https://bladex.cn";
|
||||
info(domain).then(res => {
|
||||
const data = res.data;
|
||||
if (data.success && data.data.tenantId) {
|
||||
this.form.tenantId = data.data.tenantId;
|
||||
this.tenantMode = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user