表单
This commit is contained in:
1 parent
ecc057d869
commit
1232d10528
8 files changed
+706
-59
No files matched your search
@@ -64,7 +64,6 @@ class TaskService extends Service {
|
|||||||
nodeList = _.values(nodeList);
|
nodeList = _.values(nodeList);
|
||||||
workflowConfig.nodeList = nodeList
|
workflowConfig.nodeList = nodeList
|
||||||
|
|
||||||
|
|
||||||
// start 节点进入历史
|
// start 节点进入历史
|
||||||
const startNode = nodeList.find(e => e.id.includes('start-'));
|
const startNode = nodeList.find(e => e.id.includes('start-'));
|
||||||
const startLine = lineList.filter(e => e.from === startNode.id);
|
const startLine = lineList.filter(e => e.from === startNode.id);
|
||||||
|
|||||||
@@ -1,22 +1,4 @@
|
|||||||
<template id="edit-line">
|
<template id="edit-line">
|
||||||
<!-- <el-form :model="line" ref="dataForm" label-width="100px" class="flowEditForm margin13" size="mini">
|
|
||||||
<el-form-item label="GUID">
|
|
||||||
<el-input disabled v-model="line.id"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="源活动">
|
|
||||||
<el-input disabled v-model="line.from"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="目标活动">
|
|
||||||
<el-input disabled v-model="line.to"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="名称">
|
|
||||||
<el-input v-model="line.label"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="备注说明">
|
|
||||||
<el-input v-model="line.Remark" type="textarea" :autosize="{ minRows: 2, maxRows: 4}"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form> -->
|
|
||||||
|
|
||||||
<v-form v-model="isFormValid" ref="dataForm" lazy-validation>
|
<v-form v-model="isFormValid" ref="dataForm" lazy-validation>
|
||||||
<v-row class="px-2" :class="{'pb-7': isMobile}">
|
<v-row class="px-2" :class="{'pb-7': isMobile}">
|
||||||
<v-col cols="12" class=" pb-3">
|
<v-col cols="12" class=" pb-3">
|
||||||
|
|||||||
@@ -1,23 +1,4 @@
|
|||||||
<template id="edit-node">
|
<template id="edit-node">
|
||||||
|
|
||||||
<!-- <el-form :model="node" ref="dataForm" label-width="100px" class="flowEditForm margin13" size="mini">
|
|
||||||
<el-form-item label="GUID">
|
|
||||||
<el-input disabled v-model="node.id"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="名称">
|
|
||||||
<el-input v-model="node.label"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="活动类型">
|
|
||||||
<el-select v-model="node.Type" placeholder="请选择">
|
|
||||||
<el-option v-for="item in TypeList" :key="item.Value" :label="item.Text" :value="item.Value">
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="备注">
|
|
||||||
<el-input v-model="node.Remark" type="textarea" :autosize="{ minRows: 2, maxRows: 4}"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form> -->
|
|
||||||
|
|
||||||
<v-form v-model="isFormValid" ref="dataForm" lazy-validation>
|
<v-form v-model="isFormValid" ref="dataForm" lazy-validation>
|
||||||
<v-row class="px-2" :class="{'pb-7': isMobile}">
|
<v-row class="px-2" :class="{'pb-7': isMobile}">
|
||||||
<v-col cols="12" class=" pb-3">
|
<v-col cols="12" class=" pb-3">
|
||||||
@@ -34,7 +15,7 @@
|
|||||||
</v-col>
|
</v-col>
|
||||||
<template v-if="!node.id.includes('start-') && !node.id.includes('end-')">
|
<template v-if="!node.id.includes('start-') && !node.id.includes('end-')">
|
||||||
|
|
||||||
<!-- <v-col cols="12" class=" pb-3">
|
<v-col cols="12" class=" pb-3">
|
||||||
<span class="inputLabel">指派类型</span>
|
<span class="inputLabel">指派类型</span>
|
||||||
|
|
||||||
<v-select
|
<v-select
|
||||||
@@ -49,7 +30,6 @@
|
|||||||
v-model="node.assignType"
|
v-model="node.assignType"
|
||||||
></v-select>
|
></v-select>
|
||||||
</v-col>
|
</v-col>
|
||||||
-->
|
|
||||||
<v-col cols="12" class=" pb-3">
|
<v-col cols="12" class=" pb-3">
|
||||||
<span class="inputLabel">指派</span>
|
<span class="inputLabel">指派</span>
|
||||||
<v-autocomplete
|
<v-autocomplete
|
||||||
@@ -66,17 +46,9 @@
|
|||||||
</v-col>
|
</v-col>
|
||||||
<v-col cols="12" class=" pb-3" v-if="mode == 'serial'">
|
<v-col cols="12" class=" pb-3" v-if="mode == 'serial'">
|
||||||
<span class="inputLabel">允许的操作(英文逗号分隔)</span>
|
<span class="inputLabel">允许的操作(英文逗号分隔)</span>
|
||||||
<!-- <v-textarea
|
|
||||||
filled single-line
|
|
||||||
name="input-7-4"
|
|
||||||
label="允许的操作"
|
|
||||||
value=""
|
|
||||||
rows="3"
|
|
||||||
hide-details
|
|
||||||
></v-textarea> -->
|
|
||||||
<v-text-field class="jh-v-input" dense filled single-line label="允许的操作(英文逗号分隔)" v-model="node.lineTypeList"></v-text-field>
|
<v-text-field class="jh-v-input" dense filled single-line label="允许的操作(英文逗号分隔)" v-model="node.lineTypeList"></v-text-field>
|
||||||
</v-col>
|
</v-col>
|
||||||
<!-- <v-col cols="12" class=" pb-3" >
|
<v-col cols="12" class=" pb-3" >
|
||||||
<span class="inputLabel">可写模板</span>
|
<span class="inputLabel">可写模板</span>
|
||||||
<v-select
|
<v-select
|
||||||
:items="tpl"
|
:items="tpl"
|
||||||
@@ -105,7 +77,7 @@
|
|||||||
multiple
|
multiple
|
||||||
v-model="node.formIdHidden"
|
v-model="node.formIdHidden"
|
||||||
></v-select>
|
></v-select>
|
||||||
</v-col> -->
|
</v-col>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="node.id.includes('end-')">
|
<template v-if="node.id.includes('end-')">
|
||||||
<v-col cols="12" class=" pb-3">
|
<v-col cols="12" class=" pb-3">
|
||||||
@@ -143,12 +115,12 @@
|
|||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// tpl: {
|
tpl: {
|
||||||
// type: Array,
|
type: Array,
|
||||||
// default: () => {
|
default: () => {
|
||||||
// return []
|
return []
|
||||||
// }
|
}
|
||||||
// },
|
},
|
||||||
mode: {
|
mode: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'serial'
|
default: 'serial'
|
||||||
@@ -176,6 +148,12 @@
|
|||||||
this.lf.setProperties(node.id, node);
|
this.lf.setProperties(node.id, node);
|
||||||
},
|
},
|
||||||
deep: true
|
deep: true
|
||||||
|
},
|
||||||
|
tpl: {
|
||||||
|
handler: function (tpl) {
|
||||||
|
console.log('tpl change', tpl)
|
||||||
|
},
|
||||||
|
deep: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<span style="transform: translateY(2px); display: inline-block; ">{{editType == 'node' ? '节点' : '连线'}}属性</span>
|
<span style="transform: translateY(2px); display: inline-block; ">{{editType == 'node' ? '节点' : '连线'}}属性</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="flow-edit-content">
|
<div class="flow-edit-content">
|
||||||
<edit-node ref="nodeForm" v-if="editType == 'node'" :lf="logicFlow" :user="user" :group="group" :mode="mode"></edit-node>
|
<edit-node ref="nodeForm" v-if="editType == 'node'" :lf="logicFlow" :user="user" :group="group" :mode="mode" :tpl="tpl"></edit-node>
|
||||||
<edit-line ref="lineForm" v-if="editType == 'line'" :lf="logicFlow" :mode="mode"></edit-line>
|
<edit-line ref="lineForm" v-if="editType == 'line'" :lf="logicFlow" :mode="mode"></edit-line>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -72,6 +72,12 @@ Vue.component("process-flow", {
|
|||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
tpl: {
|
||||||
|
type: Array,
|
||||||
|
default: () => {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
},
|
||||||
currentNodeId: {
|
currentNodeId: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
|
|||||||
@@ -0,0 +1,414 @@
|
|||||||
|
<template id="form-item-list-generator">
|
||||||
|
<v-card color="#f5f8fa" :class="{'d-flex': !isMobile, 'form-item-list-generator-content': !isMobile}">
|
||||||
|
<v-card :style="{'width': isMobile ? '100%' : '300px'}"
|
||||||
|
:class="{'pa-4': !isMobile, 'pa-2': isMobile, 'mr-6': !isMobile}">
|
||||||
|
<div class="left-component-item-title" :style="{'white-space': 'nowrap'}">
|
||||||
|
<v-icon>mdi-puzzle-outline</v-icon>
|
||||||
|
<span style="transform: translateY(2px); display: inline-block;">组件</span>
|
||||||
|
</div>
|
||||||
|
<draggable
|
||||||
|
:group="{ name: 'componentGroup', pull: 'clone', put: false }"
|
||||||
|
:list="componentList"
|
||||||
|
draggable=".left-component-item"
|
||||||
|
:clone="cloneComponent"
|
||||||
|
@end="leftComponentDraggableOnEnd">
|
||||||
|
<div class="left-component-item"
|
||||||
|
v-for="(component, index) in componentList" :key="index"
|
||||||
|
@click="addFormItem(component)">
|
||||||
|
<div class="left-component-item-body">
|
||||||
|
<v-icon small class="mr-1">{{ component.icon }}</v-icon>
|
||||||
|
{{ component.typeName }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</draggable>
|
||||||
|
</v-card>
|
||||||
|
|
||||||
|
<v-card class="formItemList py-10 pl-4 pr-4" style="position: relative;">
|
||||||
|
<v-btn small color="error" @click.stop="emptyCanva" class="mr-2 mt-2"
|
||||||
|
style="position: absolute; right: 8px; top: 0;">
|
||||||
|
<span>重置</span>
|
||||||
|
</v-btn>
|
||||||
|
<draggable
|
||||||
|
v-if="formItemList.length > 0"
|
||||||
|
:list="formItemList"
|
||||||
|
:animation="300"
|
||||||
|
group="componentGroup">
|
||||||
|
<v-hover v-for="(formItem, index) in formItemList" :key="index" v-slot:default="{ hover }">
|
||||||
|
<v-card
|
||||||
|
@click.native="formItemSelect(formItem.id)"
|
||||||
|
:elevation="hover ? 12 : 2"
|
||||||
|
:class="['my-2', selectedFormItemId === formItem.id && !hover ? 'formItem-selected' : 'formItem-body']"
|
||||||
|
style="cursor: move"
|
||||||
|
dense>
|
||||||
|
<v-list-item>
|
||||||
|
|
||||||
|
<v-list-item-content v-if="formItem.component.type === 'singleSelect'">
|
||||||
|
<v-radio-group :disabled="true" :label="(index+1) + '. ' + formItem.component.statement">
|
||||||
|
<v-radio hide-details v-for="(option, optionIndex) in formItem.component.property.selectOptionList"
|
||||||
|
:key="optionIndex" :label="option.value" :value="option.value"></v-radio>
|
||||||
|
</v-radio-group>
|
||||||
|
</v-list-item-content>
|
||||||
|
|
||||||
|
<v-list-item-content v-if="formItem.component.type === 'multipleSelect'">
|
||||||
|
<v-list-item-title class="formItem-title">{{ index + 1 }}. {{
|
||||||
|
formItem.component.statement
|
||||||
|
}}
|
||||||
|
</v-list-item-title>
|
||||||
|
<div v-for="(option, optionIndex) in formItem.component.property.selectOptionList" :key="optionIndex">
|
||||||
|
<v-checkbox hide-details style="margin-top: 0px;" :disabled="true" :label="option.value" hide-details
|
||||||
|
color="red"></v-checkbox>
|
||||||
|
</div>
|
||||||
|
</v-list-item-content>
|
||||||
|
|
||||||
|
<v-list-item-content v-if="formItem.component.type === 'textarea'">
|
||||||
|
<v-textarea dense outlined placeholder="请输入答案" hide-details :disabled="true" :rows="4"
|
||||||
|
:label="(index+1) + '. ' + formItem.component.statement"/>
|
||||||
|
</v-list-item-content>
|
||||||
|
|
||||||
|
<v-list-item-content v-if="formItem.component.type === 'input'">
|
||||||
|
<v-text-field class="cus-v-input" dense outlined :label="(index+1) + '. ' + formItem.component.statement"
|
||||||
|
:disabled="true"></v-text-field>
|
||||||
|
</v-list-item-content>
|
||||||
|
|
||||||
|
<v-list-item-action v-if="selectedFormItemId === formItem.id" class="justify-start">
|
||||||
|
<v-btn x-small icon @click.stop="formItemCopy(index, formItem)">
|
||||||
|
<v-icon color="primary">mdi-content-duplicate</v-icon>
|
||||||
|
</v-btn>
|
||||||
|
<v-btn x-small icon @click.stop="formItemDelete(formItem.id)">
|
||||||
|
<v-icon color="error">mdi-close-box</v-icon>
|
||||||
|
</v-btn>
|
||||||
|
</v-list-item-action>
|
||||||
|
</v-list-item>
|
||||||
|
</v-card>
|
||||||
|
</v-hover>
|
||||||
|
</draggable>
|
||||||
|
<v-row v-else align="center" justify="center" class="ma-0 pa-0" style="width: 100%;">
|
||||||
|
<v-card height="100" class="ma-12" width="100%" color="#f5f8fa" style="border: 1px dashed #333333">
|
||||||
|
<draggable :list="[]" :animation="300" group="componentGroup" style="position: relative; height: 100%;">
|
||||||
|
<v-card-text class="text-center title draggable-placeholder">
|
||||||
|
从左侧拖入或点选组件进行表单设计
|
||||||
|
</v-card-text>
|
||||||
|
</draggable>
|
||||||
|
</v-card>
|
||||||
|
</v-row>
|
||||||
|
</v-card>
|
||||||
|
|
||||||
|
<v-card :style="{'width': isMobile ? 'auto' : '300px'}" class="pa-4" :class="{'ml-6': !isMobile}">
|
||||||
|
<div class="property-title">
|
||||||
|
<v-icon>mdi-application-edit-outline</v-icon>
|
||||||
|
<span style="transform: translateY(2px); display: inline-block;">组件属性</span>
|
||||||
|
</div>
|
||||||
|
<div v-if="selectCanvaIndex >= 0 && formItemList[selectCanvaIndex]">
|
||||||
|
<v-card class="mt-5" flat
|
||||||
|
v-if="formItemList[selectCanvaIndex].component.type === 'singleSelect' || formItemList[selectCanvaIndex].component.type === 'multipleSelect'">
|
||||||
|
<v-row no-gutters>
|
||||||
|
<v-col cols="12">
|
||||||
|
<v-text-field class="cus-v-input mr-2" dense filled single-line prefix="标题: " color="success"
|
||||||
|
v-model="formItemList[selectCanvaIndex].component.statement"></v-text-field>
|
||||||
|
<div style="display: flex; flex-direction: row;justify-content: space-between; align-items: center;">
|
||||||
|
<v-subheader class="pa-0">选项列表</v-subheader>
|
||||||
|
<v-btn icon
|
||||||
|
@click.stop="propertyAddOption(formItemList[selectCanvaIndex].component.property.selectOptionList.length)">
|
||||||
|
<v-icon dark color="grey lighten-1">mdi-plus-box</v-icon>
|
||||||
|
</v-btn>
|
||||||
|
</div>
|
||||||
|
<v-list class="propertyList" dense style="max-height: 300px; overflow-y: auto;">
|
||||||
|
<v-list-item
|
||||||
|
class="pa-0"
|
||||||
|
v-for="(option, index) in formItemList[selectCanvaIndex].component.property.selectOptionList"
|
||||||
|
:key="index">
|
||||||
|
<v-list-item-content>
|
||||||
|
<v-text-field
|
||||||
|
v-model="option.value"
|
||||||
|
prefix="选项:"
|
||||||
|
color="success"
|
||||||
|
filled single-line
|
||||||
|
dense
|
||||||
|
hide-details
|
||||||
|
clearable
|
||||||
|
placeholder="请输入选项"/>
|
||||||
|
</v-list-item-content>
|
||||||
|
<v-list-item-action class="ml-2">
|
||||||
|
<v-btn icon @click.stop="propertyDeleteOption(index)">
|
||||||
|
<v-icon color="grey lighten-1" dark>mdi-delete</v-icon>
|
||||||
|
</v-btn>
|
||||||
|
</v-list-item-action>
|
||||||
|
</v-list-item>
|
||||||
|
</v-list>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</v-card>
|
||||||
|
<v-card class="mt-5" flat v-if="formItemList[selectCanvaIndex].component.type === 'textarea'">
|
||||||
|
<v-text-field class="cus-v-input" dense filled single-line label="多行文本"
|
||||||
|
v-model="formItemList[selectCanvaIndex].component.statement"></v-text-field>
|
||||||
|
</v-card>
|
||||||
|
<v-card class="mt-5" flat v-if="formItemList[selectCanvaIndex].component.type === 'input'">
|
||||||
|
<v-text-field class="cus-v-input" dense filled single-line label="单行文本"
|
||||||
|
v-model="formItemList[selectCanvaIndex].component.statement"></v-text-field>
|
||||||
|
</v-card>
|
||||||
|
</div>
|
||||||
|
</v-card>
|
||||||
|
</v-card>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script src="//cdn.jsdelivr.net/npm/sortablejs@1.8.4/Sortable.min.js"></script>
|
||||||
|
<script src="//cdnjs.cloudflare.com/ajax/libs/Vue.Draggable/2.20.0/vuedraggable.umd.min.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// 1. v-main 滚动条
|
||||||
|
// 2. v-navigation-drawer 小屏幕 不要关闭
|
||||||
|
Vue.component("form-item-list-generator", {
|
||||||
|
template: '#form-item-list-generator',
|
||||||
|
vuetify: new Vuetify(),
|
||||||
|
name: 'form-item-list-generator',
|
||||||
|
props: {
|
||||||
|
formItemList: {
|
||||||
|
type: Array,
|
||||||
|
default: [],
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data: () => ({
|
||||||
|
componentList: [
|
||||||
|
{typeName: '单行文本', type: 'input', statement: '单行文本', property: {}, icon: 'mdi-form-textarea'},
|
||||||
|
{typeName: '多行文本', type: 'textarea', statement: '多行文本', property: {}, icon: 'mdi-form-textarea'},
|
||||||
|
{
|
||||||
|
typeName: '单选',
|
||||||
|
type: 'singleSelect',
|
||||||
|
statement: '单选',
|
||||||
|
property: {selectOptionList: []},
|
||||||
|
icon: 'mdi-checkbox-marked-circle'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
typeName: '多选',
|
||||||
|
type: 'multipleSelect',
|
||||||
|
statement: '多选',
|
||||||
|
property: {selectOptionList: []},
|
||||||
|
icon: 'mdi-checkbox-marked'
|
||||||
|
},
|
||||||
|
],
|
||||||
|
tempComponent: null,
|
||||||
|
|
||||||
|
|
||||||
|
// 当 needle 是空字符串时,我们应当返回什么值呢?这是一个在面试中很好的问题。
|
||||||
|
|
||||||
|
// 对于本题而言,当 needle 是空字符串时我们应当返回 0 。这与 C 语言的 strstr() 以及 Java 的 indexOf() 定义相符。
|
||||||
|
// 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
|
||||||
|
// `,
|
||||||
|
// property: {}, icon: 'mdi-checkbox-marked-circle'
|
||||||
|
// },
|
||||||
|
// formItemData: {}
|
||||||
|
// }
|
||||||
|
// ],
|
||||||
|
selectedFormItemId: null,
|
||||||
|
rightPanels: [0, 1, 2, 3, 4],
|
||||||
|
}),
|
||||||
|
computed: {
|
||||||
|
selectCanvaIndex() {
|
||||||
|
const index = this.formItemList.findIndex(item => item.id === this.selectedFormItemId);
|
||||||
|
return index;
|
||||||
|
},
|
||||||
|
isMobile() {
|
||||||
|
return window.innerWidth < 600;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
},
|
||||||
|
destroyed() {
|
||||||
|
},
|
||||||
|
watch: {},
|
||||||
|
async created() {
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
cloneComponent(component) {
|
||||||
|
this.tempComponent = component;
|
||||||
|
},
|
||||||
|
leftComponentDraggableOnEnd(event) {
|
||||||
|
if (event.from !== event.to) {
|
||||||
|
const newIndex = event.newIndex;
|
||||||
|
this.addFormItem(this.tempComponent, newIndex);
|
||||||
|
}
|
||||||
|
this.tempComponent = null;
|
||||||
|
},
|
||||||
|
addFormItem(component, targetIndex) {
|
||||||
|
const {type} = component;
|
||||||
|
const formItem = {
|
||||||
|
id: `${type}_${this.uuid(8)}`,
|
||||||
|
...component,
|
||||||
|
};
|
||||||
|
if (!this.formItemList) {
|
||||||
|
this.formItemList = [];
|
||||||
|
}
|
||||||
|
if (targetIndex > -1) {
|
||||||
|
this.formItemList.splice(targetIndex, 0, formItem);
|
||||||
|
} else {
|
||||||
|
this.formItemList.push(formItem);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
formItemSelect(id) {
|
||||||
|
this.selectedFormItemId = id;
|
||||||
|
},
|
||||||
|
formItemCopy(index, formItem) {
|
||||||
|
const newFormItem = _.cloneDeep(formItem);
|
||||||
|
newFormItem.id = `${newFormItem.component.type}_${this.uuid(8)}`,
|
||||||
|
this.formItemList.splice(index + 1, 0, newFormItem);
|
||||||
|
},
|
||||||
|
emptyCanva() {
|
||||||
|
this.formItemList.splice(0, this.formItemList.length);
|
||||||
|
},
|
||||||
|
formItemDelete(id) {
|
||||||
|
const index = this.formItemList.findIndex((item) => item.id === id);
|
||||||
|
if (index > -1) {
|
||||||
|
this.formItemList.splice(index, 1);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
propertyAddOption(index) {
|
||||||
|
this.formItemList[this.selectCanvaIndex].component.property.selectOptionList.splice(index, 0, {value: ""});
|
||||||
|
},
|
||||||
|
propertyDeleteOption(index) {
|
||||||
|
this.formItemList[this.selectCanvaIndex].component.property.selectOptionList.splice(index, 1);
|
||||||
|
},
|
||||||
|
uuid(t = 21) {
|
||||||
|
let e = "", r = crypto.getRandomValues(new Uint8Array(t));
|
||||||
|
for (; t--;) {
|
||||||
|
let n = 63 & r[t];
|
||||||
|
e += n < 36 ? n.toString(36) : n < 62 ? (n - 26).toString(36).toUpperCase() : n < 63 ? "_" : "-"
|
||||||
|
}
|
||||||
|
;
|
||||||
|
return e
|
||||||
|
},
|
||||||
|
getFormItemList() {
|
||||||
|
return this.formItemList;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.form-item-list-generator-content {
|
||||||
|
align-items: stretch;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.componentList {
|
||||||
|
padding: 8px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 256px;
|
||||||
|
overflow-y: auto;
|
||||||
|
height: 100%;
|
||||||
|
max-height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.left-component-item {
|
||||||
|
width: 100%;
|
||||||
|
margin: 8px 0;
|
||||||
|
transition: transform 0ms !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.left-component-item-title {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #222;
|
||||||
|
margin: 6px 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.left-component-item-body {
|
||||||
|
padding: 8px 10px;
|
||||||
|
background: #f5f8fa;
|
||||||
|
font-size: 12px;
|
||||||
|
cursor: move;
|
||||||
|
border: 1px dashed #f5f8fa;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.left-component-item-body:hover {
|
||||||
|
border: 1px dashed #4caf50;
|
||||||
|
background: #f5f8fa;
|
||||||
|
color: #4caf50;
|
||||||
|
}
|
||||||
|
|
||||||
|
.left-component-item-body:hover .v-icon {
|
||||||
|
color: #4caf50;
|
||||||
|
}
|
||||||
|
|
||||||
|
.formItemList {
|
||||||
|
flex: 1;
|
||||||
|
overflow-y: auto;
|
||||||
|
height: 100%;
|
||||||
|
max-height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.formItemList .formItem-selected {
|
||||||
|
border: 1px dashed #4caf50 !important;
|
||||||
|
background: #e6fde3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.formItem-title {
|
||||||
|
white-space: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.property {
|
||||||
|
width: 360px;
|
||||||
|
overflow-y: auto;
|
||||||
|
max-height: calc(100vh - 105px);
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.property .property-title {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.property .v-expansion-panel .v-expansion-panel-header {
|
||||||
|
min-height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.property .v-expansion-panel-content__wrap {
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.property .v-expansion-panel .v-list-item__action, .v-list-item__avatar, .v-list-item__icon {
|
||||||
|
display: inline-block;
|
||||||
|
min-width: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.propertyList::-webkit-scrollbar {
|
||||||
|
width: 5px;
|
||||||
|
background: #f5f8fa;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.propertyList::-webkit-scrollbar-thumb {
|
||||||
|
width: 5px;
|
||||||
|
background: #606060;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
body .theme--light.v-text-field--filled.cus-v-input.black > .v-input__control > .v-input__slot {
|
||||||
|
background: #e6ebee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.draggable-placeholder {
|
||||||
|
position: absolute;
|
||||||
|
left: 0!important;
|
||||||
|
top: 50%!important;
|
||||||
|
transform: translateY(-50%)!important;
|
||||||
|
opacity: 0.3;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 500px) {
|
||||||
|
.left-component-item {
|
||||||
|
width: auto;
|
||||||
|
display: inline-block;
|
||||||
|
margin: 8px 4px;
|
||||||
|
transition: transform 0ms !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.formItemList {
|
||||||
|
border-top: 2px solid #cccccc !important;
|
||||||
|
border-bottom: 2px solid #cccccc !important;
|
||||||
|
border-radius: unset !important;
|
||||||
|
height: auto;
|
||||||
|
max-height: none;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,170 @@
|
|||||||
|
<template id="form-item-list-review">
|
||||||
|
<div class="form-item-list-review-container">
|
||||||
|
<!-- 单选 -->
|
||||||
|
<template v-if="formItem.component.type === 'singleSelect'">
|
||||||
|
<span class="jh-input-label">{{ formItem.component.statement }}</span>
|
||||||
|
<v-radio-group readonly v-model="formItem.user.answer">
|
||||||
|
<v-radio
|
||||||
|
v-for="(option, optionIndex) in formItem.component.selectOptionList" :key="optionIndex"
|
||||||
|
:label="assignmentOptionKey[optionIndex]+': '+option" :value="option"></v-radio>
|
||||||
|
</v-radio-group>
|
||||||
|
</template>
|
||||||
|
<!-- 多选和填空 -->
|
||||||
|
<template v-if="['fillBlank', 'multipleSelect'].includes(formItem.component.type)">
|
||||||
|
<span class="jh-input-label" style="white-space:nowrap !important;" v-if="formItem.component.type === 'fillBlank'">
|
||||||
|
<template v-for="(blank, blankIndex) in formItem.component.statement" :key="blankIndex">
|
||||||
|
<span class="fill-blank fill-blank-input" v-if="blank.type === 'input'">{{
|
||||||
|
formItem.user.answer[blank.id] }}</span>
|
||||||
|
<span v-else>{{ blank.value }}</span>
|
||||||
|
</template>
|
||||||
|
</span>
|
||||||
|
<span class="jh-input-label" v-else>{{ formItem.component.statement }}</span>
|
||||||
|
<template v-if="formItem.component.type === 'multipleSelect'">
|
||||||
|
<template v-for="(option, optionIndex) in formItem.component.selectOptionList" :key="optionIndex">
|
||||||
|
<v-checkbox
|
||||||
|
readonly style="margin-top: 0px;" v-model="formItem.user.answer" :value="option"
|
||||||
|
:label="assignmentOptionKey[optionIndex]+': '+option" hide-details color="red"></v-checkbox>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
<!-- 多行文本,问答和markdown -->
|
||||||
|
<template v-if="['textarea', 'questionAnswer', 'markdown'].includes(formItem.component.type)">
|
||||||
|
<span class="jh-input-label">{{ formItem.component.statement }}</span>
|
||||||
|
<template v-if="formItem.component.type === 'markdown'" cols="12">
|
||||||
|
<md2html :article-content="formItem.user.answer" @complete="isContentLoading = false"></md2html>
|
||||||
|
</template>
|
||||||
|
<template v-else cols="12">
|
||||||
|
<v-textarea readonly dense filled single-line v-model="formItem.user.answer" :rows="5" auto-grow />
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
<!-- 题目组 -->
|
||||||
|
<template v-if="formItem.component.type === 'questionGroup'">
|
||||||
|
<span class="jh-input-label">{{ formItem.component.statement }}</span>
|
||||||
|
<md2html :article-content="formItem.component.markdownContent" @complete="isContentLoading = false">
|
||||||
|
</md2html>
|
||||||
|
<form-item-list-review
|
||||||
|
:form-item-list="formItem.component.itemList" :review-data="reviewData"
|
||||||
|
:answer-check="answerCheck" />
|
||||||
|
</template>
|
||||||
|
<!-- 纯标题 -->
|
||||||
|
<v-list-item-content v-if="formItem.component.type === 'displayText'">
|
||||||
|
<p>{{formItem.component.statement}}</p>
|
||||||
|
</v-list-item-content>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
Vue.component("form-item-list-review", {
|
||||||
|
template: '#form-item-list-review',
|
||||||
|
vuetify: new Vuetify(),
|
||||||
|
name: 'form-item-list-review',
|
||||||
|
props: {
|
||||||
|
formItem: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
reviewData: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
answerCheck: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data: () => ({
|
||||||
|
overlay: false,
|
||||||
|
imgSrc: '',
|
||||||
|
assignmentOptionKey: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K'],
|
||||||
|
}),
|
||||||
|
computed: {
|
||||||
|
isMobile() {
|
||||||
|
return window.innerWidth < 500;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
destroyed() {
|
||||||
|
},
|
||||||
|
watch: {},
|
||||||
|
created() {
|
||||||
|
},
|
||||||
|
methods: {}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.form-item-list-review-container {
|
||||||
|
background-color: unset;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-item-list-review-container .jh-input-label {
|
||||||
|
white-space: pre-line;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 16px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-item-list-review-container audio {
|
||||||
|
height: 35px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-item-list-review-container .audio-box {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*.form-item-list-review-container .submit-handle-box {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.form-item-list-review-container .submit-handle-box::after {
|
||||||
|
position: absolute;
|
||||||
|
width: 1px;
|
||||||
|
content: '';
|
||||||
|
background-color: #e0e0e0;
|
||||||
|
height: 200px;
|
||||||
|
top: auto;
|
||||||
|
bottom: auto;
|
||||||
|
}*/
|
||||||
|
.student-remark textarea {
|
||||||
|
color: rgb(0, 172, 37) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fill-blank {
|
||||||
|
display: inline-block;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.fill-blank-input {
|
||||||
|
padding-left: 10px;
|
||||||
|
padding-right: 10px;
|
||||||
|
border-bottom: 2px solid gray;
|
||||||
|
margin-left: 5px;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-close {
|
||||||
|
position: fixed;
|
||||||
|
right: 10px;
|
||||||
|
top: 5px;
|
||||||
|
z-index: 50000
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-download {
|
||||||
|
position: fixed;
|
||||||
|
right: 50px;
|
||||||
|
top: 5px;
|
||||||
|
z-index: 50000
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-prev-wrap {
|
||||||
|
overflow: auto;
|
||||||
|
max-width: 80vw;
|
||||||
|
max-height: 90vh;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
|
||||||
|
<template id="tpl-form-design">
|
||||||
|
<div class="tpl-form-design-container">
|
||||||
|
<form-item-list-generator
|
||||||
|
:form-item-list="form"
|
||||||
|
ref="formItemListGenerator"/>
|
||||||
|
|
||||||
|
<!-- <v-navigation-drawer v-model="formItemListPreviewDrawer" fixed temporary bottom width="90%">
|
||||||
|
<v-toolbar dark class="blue darken-3" dense>
|
||||||
|
<v-toolbar-title>表单预览</v-toolbar-title>
|
||||||
|
<v-spacer></v-spacer>
|
||||||
|
<v-toolbar-items>
|
||||||
|
<v-btn dark text @click="formItemListPreviewDrawer = false">关闭</v-btn>
|
||||||
|
</v-toolbar-items>
|
||||||
|
</v-toolbar>
|
||||||
|
<v-card class="mt-3">
|
||||||
|
<v-row>
|
||||||
|
<v-col cols="12" md="6" class="pa-0">
|
||||||
|
<codemirror v-model="JSON.stringify(formItemList, null, 4)" :options="codemirrorOptions"/>
|
||||||
|
</v-col>
|
||||||
|
<v-col cols="12" md="6">
|
||||||
|
<form-item-list-render :form-item-list="formItemList"></form-item-list-render>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</v-card>
|
||||||
|
</v-navigation-drawer> -->
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script type="module">
|
||||||
|
Vue.component("tpl-form-design", {
|
||||||
|
template: "#tpl-form-design",
|
||||||
|
props: {
|
||||||
|
form: {
|
||||||
|
type: Array,
|
||||||
|
default: () => {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data: () => ({
|
||||||
|
}),
|
||||||
|
computed: {
|
||||||
|
versionList () {
|
||||||
|
const list = this.articleAssignmentListWithAnswer.map(item => {
|
||||||
|
return { text: item.version, value: item.version }
|
||||||
|
})
|
||||||
|
return list;
|
||||||
|
},
|
||||||
|
formItemList () {
|
||||||
|
let list = []
|
||||||
|
if (this.articleAssignmentListWithAnswer[this.selectedVersionIndex]) {
|
||||||
|
list = this.articleAssignmentListWithAnswer[this.selectedVersionIndex].formItemList;
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
// 每个属性值发生变化就会调用这个函数
|
||||||
|
form(newVal, oldVal) {
|
||||||
|
this.saveData(newVal)
|
||||||
|
},
|
||||||
|
// 深度监听 属性的变化
|
||||||
|
deep: true
|
||||||
|
},
|
||||||
|
async created() {
|
||||||
|
},
|
||||||
|
mounted() {},
|
||||||
|
methods: {
|
||||||
|
saveData(newVal) {
|
||||||
|
// this.$emit('change-structure', this.form);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.tpl-form-design-container {
|
||||||
|
width: 100%;
|
||||||
|
height: 500px;
|
||||||
|
max-height: 500px;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
@media (max-width: 500px) {
|
||||||
|
.tpl-form-design-container {
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
max-height: none;
|
||||||
|
overflow-y: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -54,12 +54,16 @@
|
|||||||
</v-row>
|
</v-row>
|
||||||
</v-card>
|
</v-card>
|
||||||
|
|
||||||
<div class="pt-4 pb-4 text-h7">流程设置</div>
|
<div class="py-4 text-h7">模板设置</div>
|
||||||
|
<tpl-form-design :form="formObj.workflowForm" v-if="!loading" />
|
||||||
|
|
||||||
|
<div class="py-4 text-h7">流程设置</div>
|
||||||
<process-flow
|
<process-flow
|
||||||
v-if="!loading" ref="processFlow"
|
v-if="!loading" ref="processFlow"
|
||||||
:data="formObj.workflowConfig"
|
:data="formObj.workflowConfig"
|
||||||
:user="constantObj.userList"
|
:user="constantObj.userList"
|
||||||
:group="constantObj.groupList"
|
:group="constantObj.groupList"
|
||||||
|
:tpl="constantObj.workflowFormList"
|
||||||
:mode="formObj.mode">
|
:mode="formObj.mode">
|
||||||
</process-flow>
|
</process-flow>
|
||||||
</div>
|
</div>
|
||||||
@@ -98,6 +102,9 @@
|
|||||||
{% include 'component/flow/processFlow.html' %}
|
{% include 'component/flow/processFlow.html' %}
|
||||||
{% include 'component/flow/editLine.html' %}
|
{% include 'component/flow/editLine.html' %}
|
||||||
{% include 'component/flow/editNode.html' %}
|
{% include 'component/flow/editNode.html' %}
|
||||||
|
{% include 'component/tpl/tplFormDesign.html' %}
|
||||||
|
{% include 'component/tpl/formItemListGenerator.html' %}
|
||||||
|
{% include 'component/tpl/formItemListReview.html' %}
|
||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
new Vue({
|
new Vue({
|
||||||
@@ -137,7 +144,7 @@ new Vue({
|
|||||||
if (!this.formObj.workflowForm) return;
|
if (!this.formObj.workflowForm) return;
|
||||||
this.buildConstantWorkflowFormList();
|
this.buildConstantWorkflowFormList();
|
||||||
if (!this.formObj.workflowConfig) return;
|
if (!this.formObj.workflowConfig) return;
|
||||||
this.buildConstantWorkflowConfig()
|
this.buildConstantWorkflowConfig();
|
||||||
},
|
},
|
||||||
deep: true,
|
deep: true,
|
||||||
immediate: true
|
immediate: true
|
||||||
|
|||||||
Reference in new issue
Block a user