移动端新建
<template> <!-- 添加或编辑措施 --> <van-popup v-model="visible" position="bottom" :style="{ height: '60%' }" @close="closeFn" > <div class="page-popup-box btm"> <div class="page-popup-head"> <van-row> <van-col span="8" class="f18 pl10 cor3 flexa"> </van-col> <van-col span="8" class="tc f16">{{ postPageType == "add" ? "新增" : "编辑" }}</van-col> <van-col @click="closeFn" span="8" class="tr f20"> <span class="mr10 f14 cor9">关闭</span></van-col > </van-row> </div> <div class="page-popup-content"> <van-form ref="baseFrom" class=""> <div class="bgf ml12 mr12 bdr10 page-van-cell page-van-field__body"> <div class="pl15 pt15 pr15"> <div class="f14 corac"> <span class="corcc">*</span> JSA安全风险识别 </div> <van-field v-model="formData.jsaRisk" placeholder="请填写JSA安全风险识别" type="textarea" :rules="[{ required: true, message: '请填写JSA安全风险识别' }]" /> </div> <div class="pl15 pt15 pr15"> <div class="f14 corac"> <span class="corcc">*</span> 措施名称 </div> <van-field v-model="formData.measureName" type="textarea" placeholder="请填写" :rules="[{ required: true, message: '请填写措施名称' }]" /> </div> </div> </van-form> </div> <div class="page-popup-btm"> <div class="w p10 bxs"> <van-button class="w" type="info" size="small" round @click="handelConfirm" >确 定</van-button > </div> </div> </div> </van-popup> </template> <script> export default { props: ["visible"], data() { return { formData: {}, postPageType: "", }; }, methods: { closeFn() { this.$emit("update:visible", false); }, //添加或编辑措施2 申请 handelConfirm() { this.$refs.baseFrom .validate() .then(async (res) => { var datVal = { specialtyId: this.formData.specialtyId, processNodeId: this.formData.processNodeId, workTicketId: this.workTicketId, }; this.$toast.loading({ duration: 0, forbidClick: true, mask: false, message: "请求中...", }); if (this.formData.id) { const result = await measuresItemEditMeasures(datVal); this.$toast.clear(); if (result.code == 200) { this.visible = false; this.getDetailFn(); } } else { const result = await measuresItemAddMeasures(datVal); this.$toast.clear(); if (result.code == 200) { this.visible = false; this.getDetailFn(); } } }) .catch((err) => {}); }, }, }; </script> <style lang="scss" scoped> </style>