You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
181 lines
3.1 KiB
181 lines
3.1 KiB
<template>
|
|
<!-- 设备 -->
|
|
<view class="add-form-container">
|
|
<Form :form='form' :data='data' ref="form1"></Form>
|
|
<view class="footer">
|
|
<view class="btns">
|
|
<button class="reset" @click="reset">重置</button>
|
|
<button class="sure" @click="submit">确定</button>
|
|
</view>
|
|
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import Form from '@/components/form/index.vue'
|
|
export default {
|
|
components: {
|
|
Form
|
|
},
|
|
data() {
|
|
return {
|
|
form: {
|
|
disabled: false,
|
|
visible: true,
|
|
loading: false,
|
|
labelWidth: '180rpx',
|
|
border: true,
|
|
errorType: ['toast'],
|
|
formData: [{
|
|
type: 'singleColumn',
|
|
field: 'type',
|
|
label: '模具',
|
|
list: [{
|
|
label: '程度1',
|
|
value: 1
|
|
}, {
|
|
label: '程度2',
|
|
value: 2
|
|
}, {
|
|
label: '程度3',
|
|
value: 3
|
|
}]
|
|
}, {
|
|
type: 'singleColumn',
|
|
field: 'type',
|
|
label: '维修工',
|
|
list: [{
|
|
label: '状态1',
|
|
value: 1
|
|
}, {
|
|
label: '状态2',
|
|
value: 2
|
|
}, {
|
|
label: '状态3',
|
|
value: 3
|
|
}]
|
|
}],
|
|
rules: {
|
|
// 对name字段进行必填验证
|
|
name: [
|
|
{
|
|
min: 5,
|
|
message: '简介不能少于5个字',
|
|
trigger: 'change'
|
|
},
|
|
// 对name字段进行必填验证
|
|
{
|
|
required: true,
|
|
message: '请填写姓名',
|
|
trigger: ['change', 'blur']
|
|
},
|
|
]
|
|
}
|
|
},
|
|
data: {
|
|
name: '',
|
|
sex: 2,
|
|
hobby: [1, 2],
|
|
open: true,
|
|
duoxuan: 3,
|
|
time: '2023-12-12 08:00:00'
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
// 触发提交表单
|
|
submit() {
|
|
console.log('表单数据信息1:', this.data);
|
|
this.$refs.form1.$refs.form.validate().then(res => {
|
|
console.log('表单数据信息:', res);
|
|
}).catch(err => {
|
|
console.log('表单错误信息:', err);
|
|
})
|
|
},
|
|
// 重置
|
|
reset() {
|
|
console.log('表单数据信息1:', this.data);
|
|
this.data={}
|
|
},
|
|
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.add-form-container {
|
|
min-height: calc(100vh - 140rpx);
|
|
background: white;
|
|
padding: 0px 30rpx 140rpx;
|
|
}
|
|
.list {
|
|
padding-bottom: 20rpx;
|
|
|
|
.item {
|
|
margin-top: 20rpx;
|
|
background: white;
|
|
padding: 30rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
|
|
image {
|
|
width: 160rpx;
|
|
height: 160rpx;
|
|
margin-right: 20rpx;
|
|
}
|
|
|
|
.title {
|
|
font-size: 32rpx;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.dec1 {
|
|
font-size: 28rpx;
|
|
margin-top: 16rpx;
|
|
color: #acacac;
|
|
}
|
|
|
|
.dec2 {
|
|
font-size: 28rpx;
|
|
margin-top: 6rpx;
|
|
color: #acacac;
|
|
}
|
|
}
|
|
}
|
|
.footer {
|
|
position: fixed;
|
|
bottom: 0px;
|
|
left: 0px;
|
|
width: 100%;
|
|
}
|
|
|
|
.btns {
|
|
display: flex;
|
|
|
|
|
|
button {
|
|
flex: 1;
|
|
}
|
|
|
|
.sure {
|
|
background: #409eff;
|
|
color: white;
|
|
border-radius: 0px;
|
|
|
|
&::after {
|
|
border: 1px solid #409eff;
|
|
border-radius: 0px;
|
|
}
|
|
}
|
|
|
|
.reset {
|
|
background: #F5F5F5;
|
|
border-radius: 0px;
|
|
|
|
&::after {
|
|
border-radius: 0px;
|
|
}
|
|
}
|
|
}
|
|
</style>
|