From d005bd35a832469a895fb4e8a805bbf636b60a7f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E2=80=98Aos=E2=80=99?= <9068149@qq.com>
Date: Tue, 20 Dec 2022 17:13:25 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=A1=A8=E5=8D=95=E7=BB=84?=
=?UTF-8?q?=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../componentscom/investigate/index.vue | 80 +++++++++++++------
1 file changed, 54 insertions(+), 26 deletions(-)
diff --git a/src/components/componentscom/investigate/index.vue b/src/components/componentscom/investigate/index.vue
index d5d3827..ebc2f6f 100644
--- a/src/components/componentscom/investigate/index.vue
+++ b/src/components/componentscom/investigate/index.vue
@@ -2,20 +2,14 @@
{{ datas.title }}
-
+
@@ -30,7 +24,7 @@
:placeholder="'点击选择' + item1.name"
class="readinput"
@click="showpic(index1)"
- :value="item1.value2"
+ v-model="item1.value2"
/>
-
+
-
+
-
+
{{ item }}
+ (多选)
-
+
@@ -97,7 +92,13 @@ export default {
props: {
datas: Object,
},
- created() {},
+ created() {
+ this.datas.jsonData.forEach((el) => {
+ if (el.type == 3) {
+ el.value2 = []
+ }
+ })
+ },
mounted() {},
methods: {
//点击显示下拉框
@@ -106,25 +107,49 @@ export default {
this.datas.jsonData.forEach((el) => {
el.showPicker = false
})
+ // eslint-disable-next-line vue/no-mutating-props
this.datas.jsonData[index1].showPicker = !this.datas.jsonData[index1]
.showPicker
},
-
- // //下拉选择
- xuanze(index1) {
- this.datas.jsonData[index1].showPicker = false
- },
-
//关闭下拉选项
guanbi() {
this.datas.jsonData.forEach((el) => {
el.showPicker = false
})
},
- leave() {
+ //下拉选择
+ xuanze(index1, item) {
+ // this.value = value;
+
+ // eslint-disable-next-line vue/no-mutating-props
+ this.datas.jsonData[index1].value2 = item //保留被选中的值
+
+ // eslint-disable-next-line vue/no-mutating-props
+ this.datas.jsonData[index1].showPicker = false //关闭下拉选择
+ },
+ //保存数据到后台
+ submit() {
+ //判断不能为空,为空则不能提交
+ for (let i = 0; i < this.datas.jsonData.length; i++) {
+ if (this.datas.jsonData[i].value2 == '') {
+ this.$toast(this.datas.jsonData[i].name + '不能为空')
+ return
+ }
+ }
+ //获取要提交的数据
+ this.jsonData = []
this.datas.jsonData.forEach((el) => {
- el.showPicker = false
+ let text = {}
+ text.name = el.name
+ text.value = el.value2
+ if (text.value instanceof Array) {
+ console.log(text.value, '111111111')
+ text.value = text.value.join('&')
+ }
+ this.jsonData.push(text)
})
+ console.log(this.jsonData, '0000000000')
+ //提交信息
},
//
},
@@ -198,9 +223,6 @@ select {
}
/deep/.van-field__label {
width: 100%;
- // overflow: hidden;
- // white-space: nowrap;
- // text-overflow: ellipsis;
padding-left: 10px;
border-bottom: 1px solid #dddddd;
padding-bottom: 10px;
@@ -269,4 +291,10 @@ select {
margin-top: 6px;
position: absolute;
}
-
+.multiple {
+ height: 34px;
+ line-height: 34px;
+ font-size: 14px;
+ color: #aaaaaa;
+}
+
\ No newline at end of file