129 lines
4.4 KiB
HTML
129 lines
4.4 KiB
HTML
<template id="form-component-list">
|
|
<v-list-item>
|
|
<!-- 单选 -->
|
|
<v-list-item-content v-if="formItem.type === 'single'" class="py-0">
|
|
<template v-if="formItem.optionList.length > 0">
|
|
<v-radio-group :readonly='readonly' v-model="formItem.answer" @change="calcWorkflow" >
|
|
<v-radio hide-details v-for="(option, optionIndex) in formItem.optionList"
|
|
:key="optionIndex" :label="option" :value="option"></v-radio>
|
|
</v-radio-group>
|
|
</template>
|
|
<div v-else class="text-caption">请添加选项~</div>
|
|
</v-list-item-content>
|
|
|
|
<!-- 多选 -->
|
|
<v-list-item-content v-if="formItem.type === 'multiple'" class="py-0">
|
|
<template v-if="formItem.optionList.length > 0">
|
|
<div v-for="(option, optionIndex) in formItem.optionList" :key="optionIndex">
|
|
<v-checkbox class="mt-0" :readonly='readonly' :label="option" :value="option" hide-details v-model="formItem.answer" @click="calcWorkflow"></v-checkbox>
|
|
</div>
|
|
</template>
|
|
<div v-else class="text-caption">请添加选项~</div>
|
|
</v-list-item-content>
|
|
|
|
<!-- 多行文本 -->
|
|
<v-list-item-content v-if="formItem.type === 'textarea'" class="py-0">
|
|
<v-textarea class="jh-v-input" dense outlined hide-details :readonly="readonly" :rows="4" placeholder='请输入' v-model="formItem.answer" />
|
|
</v-list-item-content>
|
|
|
|
<!-- 单行文本 -->
|
|
<v-list-item-content v-if="formItem.type === 'input'" class="py-0">
|
|
<v-text-field class="jh-v-input" dense outlined :readonly='readonly' placeholder='请输入' v-model="formItem.answer"></v-text-field>
|
|
</v-list-item-content>
|
|
|
|
<!-- 文件 -->
|
|
<v-list-item-content v-if="formItem.type === 'file'" class="py-0">
|
|
<v-file-input v-if="disabled" chips multiple :disabled='disabled' ></v-file-input>
|
|
<file-upload v-else :file-biz-id="taskId" v-model="formItem.answer"></file-upload>
|
|
</v-list-item-content>
|
|
|
|
<!-- 数字 -->
|
|
<v-list-item-content v-if="formItem.type === 'number'" class="py-0">
|
|
<v-text-field class="jh-v-input" type="number" dense outlined :readonly='readonly' placeholder='请输入' v-model="formItem.answer" @input="calcWorkflow"></v-text-field>
|
|
</v-list-item-content>
|
|
|
|
<!-- 日期选择器 -->
|
|
<v-list-item-content v-if="formItem.type === 'date'" class="py-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='请选择'
|
|
v-model="formItem.answer"
|
|
></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'" class="py-0">
|
|
<date-time-picker :disabled='disabled' @save-date-time="setDateTime" v-model="formItem.answer"></date-time-picker>
|
|
</v-list-item-content>
|
|
</v-list-item>
|
|
</template>
|
|
|
|
{% include 'component/common/dateTimePicker.html' %}
|
|
{% include 'component/common/fileUpload.html' %}
|
|
|
|
<script type="module">
|
|
Vue.component("form-component-list", {
|
|
template: '#form-component-list',
|
|
vuetify: new Vuetify(),
|
|
props: {
|
|
formItem: {
|
|
type: Object,
|
|
default: () => {
|
|
return {};
|
|
},
|
|
},
|
|
disabled: {
|
|
type: Boolean,
|
|
default: true,
|
|
},
|
|
taskId: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
readonly: {
|
|
type: Boolean,
|
|
default: true,
|
|
},
|
|
},
|
|
data() {
|
|
return {
|
|
datetime:"2023-12-24 22:23",
|
|
}
|
|
},
|
|
computed: {
|
|
|
|
},
|
|
async created() {
|
|
|
|
},
|
|
methods: {
|
|
setDateTime(data){
|
|
this.datetime = data
|
|
},
|
|
async calcWorkflow(){
|
|
await this.$emit('calc-workflow')
|
|
}
|
|
}
|
|
})
|
|
</script>
|
|
|
|
<style scoped>
|
|
|
|
</style> |