一:存时间值
向后端传值:
const formData = ref({
id: undefined,
theme: undefined,
studentId: undefined,
questDate: undefined,
questContent: undefined,
dealDate: undefined,
dealContent: undefined,
finishTime: Date,
status: 0,
remark: undefined
})
//需要将时间类型定义为date
finishTime: Date,
传当前时间值
formData.value.finishTime =Date.now();
export interface QuestionDealVO {
id: number // 主键
theme: string // 标题
studentId: number // 学员id
questDate: Date // 发生日期
questContent: string // 异议内容
dealDate: Date // 处理日期
dealContent: string // 处理方法
finishTime: Date // 完成时间
status: number // 状态(草稿:0;处理中:1;已完成:2)
remark: string // 备注
}
实体类接受字段:
@Schema(description = "完成时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime finishTime;
实现层:
@Override
public Long createQuestionDeal(QuestionDealSaveReqVO createReqVO) {
// 插入
QuestionDealDO questionDeal = BeanUtils.toBean(createReqVO, QuestionDealDO.class);
questionDealMapper.insert(questionDeal);
// 返回
return questionDeal.getId();
}
postgresql定义字段:
/**
* 完成时间
*/
private LocalDateTime finishTime;
这样就可以将当前时间值存到数据库里了;
二:定义文本域最大值:
<el-row :gutter="24">
<el-form-item label="备注" prop="remark" class="input-textarea">
<el-input
v-model="formData.remark"
:rows="5"
type="textarea"
maxlength="200"
@input="handleInput"
placeholder="请输入备注(不超过200个字)"
/><view class="textin">{{ currentLength }}/200</view>
</el-form-item>
</el-row>
样式:
<style>
.textin{
position: absolute;
bottom: 0px;
right: 10px;
}
</style>
input事件:
const handleInput = ()=> {
currentLength.value = formData.value.remark.length;
}
以上就可以自己定义一个文本域输入最大值了