动态表单
This commit is contained in:
parent
140a53a773
commit
5f6fa7ccc1
@ -0,0 +1,102 @@
|
|||||||
|
<template>
|
||||||
|
<div class="dynamicFroms">
|
||||||
|
<div class="title flex between">
|
||||||
|
<div><span style="color:#3F85FF;font-size: 12px;">|</span> 动态表单</div>
|
||||||
|
<div class="">
|
||||||
|
<el-button type="primary" @click="addFormInput" size="small">新增</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="formBox">
|
||||||
|
<div class="formInput flex" v-for="(item, index) in dynamicFroms" :key="index">
|
||||||
|
<input class="fromsTit" v-model="item.title" />
|
||||||
|
<span style="padding:0 6px;">:</span>
|
||||||
|
<el-input class="inputBox" :placeholder="'请输入' + item.title" v-model="item.value"></el-input>
|
||||||
|
<div style="margin:0 12px;">
|
||||||
|
<el-radio-group v-model="item.isRequired">
|
||||||
|
<el-radio :label="true">必 填</el-radio>
|
||||||
|
<el-radio :label="false">非必填</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</div>
|
||||||
|
<el-button type="text" @click="delectInput(index)" size="">删除</el-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
dynamicFroms: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
addFormInput() {
|
||||||
|
this.dynamicFroms.push({
|
||||||
|
title: '表单标题',
|
||||||
|
name: '',
|
||||||
|
isRequired: true,
|
||||||
|
value: ''
|
||||||
|
})
|
||||||
|
},
|
||||||
|
delectInput(i){
|
||||||
|
this.dynamicFroms.splice(i,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.dynamicFroms {
|
||||||
|
margin-top: 20px;
|
||||||
|
|
||||||
|
.formBox {
|
||||||
|
margin-top: 12px;
|
||||||
|
|
||||||
|
.inputBox {
|
||||||
|
width: 200px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.formInput {
|
||||||
|
.fromsTit {
|
||||||
|
border: none;
|
||||||
|
|
||||||
|
border-bottom: 1px solid #E2E5EF;
|
||||||
|
width: 120px;
|
||||||
|
padding: 12px 6px;
|
||||||
|
outline: none;
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.title {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.flex {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.between {
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrap {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -234,11 +234,15 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
id="container"
|
id="container"
|
||||||
style="width: 580px; height: 400px; background: pink"
|
style="width: 580px; height: 400px; background: pink"
|
||||||
></div>
|
></div>
|
||||||
<div class="addrTitle">{{ cardForm.addr }}</div>
|
<div class="addrTitle">{{ cardForm.addr }}</div>
|
||||||
|
|
||||||
|
<dynamicForms ref="dynamicFormsRef"></dynamicForms>
|
||||||
|
|
||||||
<div id="qrCode" ref="qrCodeDiv"></div>
|
<div id="qrCode" ref="qrCodeDiv"></div>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button
|
<el-button
|
||||||
@ -269,11 +273,13 @@ import {
|
|||||||
deletePointApi,
|
deletePointApi,
|
||||||
} from "@/assets/js/api/insect.js";
|
} from "@/assets/js/api/insect.js";
|
||||||
import { getProjectChilderSystemUserListApi } from "@/assets/js/api/configManage";
|
import { getProjectChilderSystemUserListApi } from "@/assets/js/api/configManage";
|
||||||
|
import dynamicForms from "./components/dynamicForms/index.vue"
|
||||||
// import QRCode from "qrcodejs2";
|
// import QRCode from "qrcodejs2";
|
||||||
var mouseTool;
|
var mouseTool;
|
||||||
var mouseTool;
|
var mouseTool;
|
||||||
var objs = [];
|
var objs = [];
|
||||||
export default {
|
export default {
|
||||||
|
components:{dynamicForms},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
searchForm: {
|
searchForm: {
|
||||||
@ -624,8 +630,12 @@ export default {
|
|||||||
},
|
},
|
||||||
// 生成二维码
|
// 生成二维码
|
||||||
addCardFn() {
|
addCardFn() {
|
||||||
|
|
||||||
this.$refs.cardForm.validate((valid) => {
|
this.$refs.cardForm.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
let formTemplate;
|
||||||
|
formTemplate=this.$refs.dynamicFormsRef.dynamicFroms;
|
||||||
|
|
||||||
// 新增
|
// 新增
|
||||||
let data = this.cardForm;
|
let data = this.cardForm;
|
||||||
data.projectSn = this.$store.state.projectSn;
|
data.projectSn = this.$store.state.projectSn;
|
||||||
@ -633,6 +643,7 @@ export default {
|
|||||||
data.createUserName = this.$store.state.userInfo.account;
|
data.createUserName = this.$store.state.userInfo.account;
|
||||||
data.inspectUserIds = data.inspectUserIds.toString(',');
|
data.inspectUserIds = data.inspectUserIds.toString(',');
|
||||||
data.noticeUserIds = data.noticeUserIds.toString(',');
|
data.noticeUserIds = data.noticeUserIds.toString(',');
|
||||||
|
data.template=JSON.stringify(formTemplate);
|
||||||
addPointApi(data).then((res) => {
|
addPointApi(data).then((res) => {
|
||||||
console.log("新增", res);
|
console.log("新增", res);
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user