表单设置
This commit is contained in:
1 parent
61235c6ec2
commit
7751704fe7
3 files changed
+167
-34
No files matched your search
@@ -0,0 +1,104 @@
|
|||||||
|
<template id="date-time-picker">
|
||||||
|
<v-row class="ma-0 pa-0">
|
||||||
|
<v-col cols="6" class="ma-0 pa-0">
|
||||||
|
<v-menu
|
||||||
|
:close-on-content-click="false"
|
||||||
|
:nudge-right="40"
|
||||||
|
transition="scale-transition"
|
||||||
|
offset-y
|
||||||
|
min-width="auto"
|
||||||
|
:disabled="disabled">
|
||||||
|
<template v-slot:activator="{ on, attrs }">
|
||||||
|
<v-text-field
|
||||||
|
class="jh-v-input"
|
||||||
|
dense
|
||||||
|
single-line
|
||||||
|
filled
|
||||||
|
v-bind="attrs"
|
||||||
|
v-on="on"
|
||||||
|
placeholder='请选择日期'
|
||||||
|
:value="date"
|
||||||
|
:disabled="disabled"
|
||||||
|
></v-text-field>
|
||||||
|
</template>
|
||||||
|
<v-date-picker no-title scrollable v-model="date"></v-date-picker>
|
||||||
|
</v-menu>
|
||||||
|
</v-col>
|
||||||
|
<v-col cols="3" class="ma-0 pa-0">
|
||||||
|
<v-select class="jh-v-input ml-1" v-model="hour" dense filled single-line :items="_.map(_.range(24), String)" label="时" :disabled="disabled"></v-select>
|
||||||
|
</v-col>
|
||||||
|
<v-col cols="3" class="ma-0 pa-0">
|
||||||
|
<v-select class="jh-v-input ml-1" v-model="minute" dense filled single-line :items="_.map(_.range(60), String)" label="分钟" :disabled="disabled"></v-select>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</template>
|
||||||
|
<script type="module">
|
||||||
|
Vue.component("date-time-picker", {
|
||||||
|
template: '#date-time-picker',
|
||||||
|
props: {
|
||||||
|
datetime: {
|
||||||
|
type: [Date, String],
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
disabled: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
validationRules: {
|
||||||
|
requireRules: [
|
||||||
|
v => !!v || '必填',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
constantObj: {
|
||||||
|
},
|
||||||
|
date: null,
|
||||||
|
hour: null,
|
||||||
|
minute: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
date(){
|
||||||
|
this.$emit('save-date-time', `${this.date} ${this.hour<10?'0'+this.hour:this.hour}:${this.minute<10?'0'+this.minute:this.minute}`)
|
||||||
|
},
|
||||||
|
hour(){
|
||||||
|
this.$emit('save-date-time', `${this.date} ${this.hour<10?'0'+this.hour:this.hour}:${this.minute<10?'0'+this.minute:this.minute}`)
|
||||||
|
},
|
||||||
|
minute(){
|
||||||
|
this.$emit('save-date-time', `${this.date} ${this.hour<10?'0'+this.hour:this.hour}:${this.minute<10?'0'+this.minute:this.minute}`)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
created() {},
|
||||||
|
mounted() {
|
||||||
|
this.init()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async doUiAction(uiActionId, uiActionData) {
|
||||||
|
switch (uiActionId) {
|
||||||
|
default:
|
||||||
|
console.error("[doUiAction] uiActionId not find", {uiActionId});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
init(){
|
||||||
|
if (!this.datetime) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let datetime = dayjs(this.datetime)
|
||||||
|
console.log(datetime);
|
||||||
|
this.date = `${datetime.year()}-${datetime.month()+1}-${datetime.date()}`
|
||||||
|
this.hour = `${datetime.hour()}`
|
||||||
|
this.minute = `${datetime.minute()}`
|
||||||
|
console.log(this.hour, this.minute);
|
||||||
|
// this.time = `${date.hour()<10?'0'+date.hour():date.hour()}:${date.minute()<10?'0'+date.minute():date.minute()}`
|
||||||
|
},
|
||||||
|
saveDateTime(){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
style="cursor: move"
|
style="cursor: move"
|
||||||
dense outlined>
|
dense outlined>
|
||||||
<div class="d-flex justify-end align-center px-4 pt-4">
|
<div class="d-flex justify-end align-center px-4 pt-4">
|
||||||
<div>{{ index + 1 }}. {{ formItem.statement }}</div>
|
<div>{{ index + 1 }}. {{ formItem.statement }}<span v-show="formItem.isRequire" class="red--text ml-1">*</span></div>
|
||||||
<v-spacer></v-spacer>
|
<v-spacer></v-spacer>
|
||||||
<!-- 复制和删除功能 -->
|
<!-- 复制和删除功能 -->
|
||||||
<template>
|
<template>
|
||||||
@@ -94,14 +94,53 @@
|
|||||||
|
|
||||||
<!-- 多行文本 -->
|
<!-- 多行文本 -->
|
||||||
<v-list-item-content v-if="formItem.type === 'textarea'">
|
<v-list-item-content v-if="formItem.type === 'textarea'">
|
||||||
<v-textarea class="jh-v-input" dense outlined hide-details disabled :rows="4" />
|
<v-textarea class="jh-v-input" dense outlined hide-details disabled :rows="4" placeholder='请输入' />
|
||||||
</v-list-item-content>
|
</v-list-item-content>
|
||||||
|
|
||||||
<!-- 单行文本 -->
|
<!-- 单行文本 -->
|
||||||
<v-list-item-content v-if="formItem.type === 'input'">
|
<v-list-item-content v-if="formItem.type === 'input'">
|
||||||
<v-text-field class="jh-v-input" dense outlined disabled></v-text-field>
|
<v-text-field class="jh-v-input" dense outlined disabled placeholder='请输入'></v-text-field>
|
||||||
</v-list-item-content>
|
</v-list-item-content>
|
||||||
|
|
||||||
|
<!-- 文件 -->
|
||||||
|
<v-list-item-content v-if="formItem.type === 'file'">
|
||||||
|
<v-file-input chips multiple disabled></v-file-input>
|
||||||
|
</v-list-item-content>
|
||||||
|
|
||||||
|
<!-- 数字 -->
|
||||||
|
<v-list-item-content v-if="formItem.type === 'number'">
|
||||||
|
<v-text-field class="jh-v-input" type="number" dense outlined disabled placeholder='请输入'></v-text-field>
|
||||||
|
</v-list-item-content>
|
||||||
|
|
||||||
|
<!-- 日期选择器 -->
|
||||||
|
<v-list-item-content v-if="formItem.type === 'date'">
|
||||||
|
<v-menu
|
||||||
|
:close-on-content-click="false"
|
||||||
|
:nudge-right="40"
|
||||||
|
transition="scale-transition"
|
||||||
|
offset-y
|
||||||
|
min-width="auto"
|
||||||
|
disabled
|
||||||
|
>
|
||||||
|
<template v-slot:activator="{ on, attrs }">
|
||||||
|
<v-text-field
|
||||||
|
class="jh-v-input"
|
||||||
|
dense
|
||||||
|
single-line
|
||||||
|
filled
|
||||||
|
v-bind="attrs"
|
||||||
|
v-on="on"
|
||||||
|
placeholder='请选择'
|
||||||
|
></v-text-field>
|
||||||
|
</template>
|
||||||
|
<v-date-picker no-title scrollable></v-date-picker>
|
||||||
|
</v-menu>
|
||||||
|
</v-list-item-content>
|
||||||
|
|
||||||
|
<!-- 日期时间选择器 -->
|
||||||
|
<v-list-item-content v-if="formItem.type === 'time'">
|
||||||
|
<date-time-picker :disabled='true' @save-date-time="setDateTime"></date-time-picker>
|
||||||
|
</v-list-item-content>
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
</v-card>
|
</v-card>
|
||||||
</v-hover>
|
</v-hover>
|
||||||
@@ -135,6 +174,13 @@
|
|||||||
</div>
|
</div>
|
||||||
<!--<<<<<<<<<< 标题-->
|
<!--<<<<<<<<<< 标题-->
|
||||||
|
|
||||||
|
<!--必填 >>>>>>>>>>-->
|
||||||
|
<div class="mb-3">
|
||||||
|
<span class="jh-input-label">是否必填</span>
|
||||||
|
<v-checkbox v-model="formItemList[selectCanvaIndex].isRequire" label="必填" dense></v-checkbox>
|
||||||
|
</div>
|
||||||
|
<!--<<<<<<<<<< 必填-->
|
||||||
|
|
||||||
<!--单选、多选的选项 >>>>>>>>>>-->
|
<!--单选、多选的选项 >>>>>>>>>>-->
|
||||||
<template v-if="formItemList[selectCanvaIndex].type === 'single' || formItemList[selectCanvaIndex].type === 'multiple'">
|
<template v-if="formItemList[selectCanvaIndex].type === 'single' || formItemList[selectCanvaIndex].type === 'multiple'">
|
||||||
<v-row class="ma-0">
|
<v-row class="ma-0">
|
||||||
@@ -193,38 +239,18 @@ Vue.component("form-item-list-generator", {
|
|||||||
},
|
},
|
||||||
data: () => ({
|
data: () => ({
|
||||||
componentList: [
|
componentList: [
|
||||||
{typeName: '单行文本', type: 'input', statement: '单行文本', property: {}, icon: 'mdi-form-textarea'},
|
{ typeName: '单行文本', type: 'input', statement: '单行文本', property: {}, icon: 'mdi-form-textarea', isRequire: false },
|
||||||
{typeName: '多行文本', type: 'textarea', statement: '多行文本', property: {}, icon: 'mdi-form-textarea'},
|
{ typeName: '多行文本', type: 'textarea', statement: '多行文本', property: {}, icon: 'mdi-form-textarea', isRequire: false },
|
||||||
{
|
{ typeName: '单选', type: 'single', statement: '单选', optionList: [], icon: 'mdi-checkbox-marked-circle', isRequire: false },
|
||||||
typeName: '单选',
|
{ typeName: '多选', type: 'multiple', statement: '多选', optionList: [], icon: 'mdi-checkbox-marked', isRequire: false},
|
||||||
type: 'single',
|
{ typeName: '数字', type: 'number', statement: '数字', property: {}, icon: 'mdi-numeric', isRequire: false },
|
||||||
statement: '单选',
|
{ typeName: '日期选择器', type: 'date', statement: '日期选择器', property: {}, icon: 'mdi-calendar-range', isRequire: false },
|
||||||
optionList: [],
|
{ typeName: '日期时间选择器', type: 'time', statement: '日期时间选择器', property: {}, icon: 'mdi-calendar-clock', isRequire: false },
|
||||||
icon: 'mdi-checkbox-marked-circle'
|
{ typeName: '上传文件', type: 'file', statement: '上传文件', property: {}, icon: 'mdi-file-account-outline', isRequire: false },
|
||||||
},
|
|
||||||
{
|
|
||||||
typeName: '多选',
|
|
||||||
type: 'multiple',
|
|
||||||
statement: '多选',
|
|
||||||
optionList: [],
|
|
||||||
icon: 'mdi-checkbox-marked'
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
tempComponent: null,
|
tempComponent: null,
|
||||||
|
|
||||||
|
|
||||||
// 当 needle 是空字符串时,我们应当返回什么值呢?这是一个在面试中很好的问题。
|
|
||||||
|
|
||||||
// 对于本题而言,当 needle 是空字符串时我们应当返回 0 。这与 C 语言的 strstr() 以及 Java 的 indexOf() 定义相符。
|
|
||||||
// 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
|
|
||||||
// `,
|
|
||||||
// property: {}, icon: 'mdi-checkbox-marked-circle'
|
|
||||||
// },
|
|
||||||
// formItemData: {}
|
|
||||||
// }
|
|
||||||
// ],
|
|
||||||
selectedFormItemId: null,
|
selectedFormItemId: null,
|
||||||
rightPanels: [0, 1, 2, 3, 4],
|
datetime:"2023-12-24 22:23"
|
||||||
}),
|
}),
|
||||||
computed: {
|
computed: {
|
||||||
selectCanvaIndex() {
|
selectCanvaIndex() {
|
||||||
@@ -303,6 +329,9 @@ Vue.component("form-item-list-generator", {
|
|||||||
getFormItemList() {
|
getFormItemList() {
|
||||||
return this.formItemList;
|
return this.formItemList;
|
||||||
},
|
},
|
||||||
|
setDateTime(data){
|
||||||
|
this.datetime = data
|
||||||
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
editable
|
editable
|
||||||
step="2"
|
step="2"
|
||||||
>
|
>
|
||||||
模板设置
|
表单设置
|
||||||
</v-stepper-step>
|
</v-stepper-step>
|
||||||
<v-divider></v-divider>
|
<v-divider></v-divider>
|
||||||
<v-stepper-step
|
<v-stepper-step
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
<v-card-text>
|
<v-card-text>
|
||||||
<div class="mt-1">
|
<div class="mt-1">
|
||||||
{{formObj.workflowForm}}
|
{{formObj.workflowForm}}
|
||||||
<!-- <div class="text-subtitle-2 mb-2">模板设置</div> -->
|
<!-- <div class="text-subtitle-2 mb-2">表单设置</div> -->
|
||||||
<tpl-form-design :form="formObj.workflowForm" v-if="!loading"></tpl-form-design>
|
<tpl-form-design :form="formObj.workflowForm" v-if="!loading"></tpl-form-design>
|
||||||
</div>
|
</div>
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
|
|||||||
Reference in new issue
Block a user