Commit f03401ad authored by lrw's avatar lrw

填报查看

parent a48c15db
......@@ -5,7 +5,7 @@
<template v-if="item.type == 'radio'">
<view class="margin-top padding sict-label" :key="item.value" v-show="!item.hidden">
<view v-show="!item.hidden">
<span style="color:red;display: inline-block; vertical-align:inherit;margin-right:4upx" :style="{opacity: item.required ? 1 : 0}" >*</span>
<span style="color:red;display: inline-block; vertical-align:inherit;margin-right:4upx" :style="{opacity: item.required ? 1 : 0}">*</span>
{{item.label}}
</view>
<view class="text-right sict-value" v-show="!item.hidden">
......@@ -21,13 +21,24 @@
</view>
</view>
</template>
<template v-else-if="item.type == 'pickerAddress'">
<view class="cu-form-group margin-top padding-rl" v-show="!item.hidden" :key="item.value">
<view :class="item.titleClass"><span style="color:red;display: inline-block; vertical-align:inherit;margin-right:4upx"
:style="{opacity: item.required ? 1 : 0}">*</span>{{item.label}}</view>
<pickerAddress @change="addressChange($event,item)">
<view class="picker">
{{form[item.value]?form[item.value]:'请选择'}}
</view>
</pickerAddress>
</view>
</template>
<template v-else-if="item.type == 'picker'">
<view class="cu-form-group margin-top padding-rl" v-show="!item.hidden" :key="item.value">
<view :class="item.titleClass"><span style="color:red;display: inline-block; vertical-align:inherit;margin-right:4upx"
:style="{opacity: item.required ? 1 : 0}">*</span>{{item.label}}</view>
<picker @change="updatePickerVal($event,item)" range-key="label" mode="selector" :value="form[item.value]" :range="item.opts">
<view class="picker">
{{form[item.value]?form[item.value]:'请选择'}}
{{form[item.value]? formMat[item.value]:'请选择'}}
</view>
</picker>
</view>
......@@ -77,6 +88,7 @@
@input="updateInputVal($event,item.value)" @blur="inputBlur($event,item)"></input>
</view>
</template>
<view class="margin-top-xs" v-show="item.child && childItem.show" v-for="(childItem,childIndex) in item.child" :key="childItem.value">
<view class="margin-top-sm padding-rl sict-label cu-form-group">
<view>
......@@ -145,19 +157,21 @@
import uniCollapse from '@/components/uni-collapse/uni-collapse.vue'
import uniCollapseItem from '@/components/uni-collapse-item/uni-collapse-item.vue'
import validate from '@/utils/validate.js'
import pickerAddress from '@/components/pickerAddress/pickerAddress.vue'
export default {
components: {
uniCollapse,
uniCollapseItem
uniCollapseItem,
pickerAddress
},
data() {
return {
modalName: false,
isRead:false,
isRead: false,
list: [{
label: '单位名称',
required: true,
value: 'orgName',
value: 'orgId',
titleClass: 'title',
type: 'picker',
opts: []
......@@ -191,7 +205,7 @@
titleClass: 'title',
placeholder: '请输入11位数字手机号',
type: 'input',
validator:validate.isPhone
validator: validate.isPhone
},
{
label: '国籍',
......@@ -1007,7 +1021,7 @@
value: "Zimbabwe"
}
],
show: [8],
show: [8, 101],
showValue: ['China']
},
......@@ -1018,9 +1032,19 @@
titleClass: 'title',
placeholder: '请输入身份证号/护照号',
type: 'input',
validator:validate.isIdCard
validator: validate.isIdCard
},
{
label: '户籍所在地',
required: true,
value: 'householdValues',
titleClass: 'title',
placeholder: '请选择',
type: 'pickerAddress',
num: 101,
hidden: true,
},
{
label: '户籍地址',
required: true,
......@@ -1031,6 +1055,14 @@
num: 8,
hidden: true,
},
{
label: '在沪居住所在地',
required: true,
value: 'residenceValue',
titleClass: 'title',
placeholder: '请选择',
type: 'pickerAddress',
},
{
label: '在沪居住(暂住)地址',
required: true,
......@@ -1303,31 +1335,31 @@
titleClass: 'title',
type: 'pickerMore',
opts: [{
value: '已经确诊',
value: 'a',
label: '已经确诊'
}, {
value: '疑似诊断',
value: 'b',
label: '疑似诊断'
}, {
value: '亲密接触者',
value: 'c',
label: '亲密接触者'
}, {
value: '居家观察/正在接受集中医学观察',
value: 'd',
label: '居家观察/正在接受集中医学观察'
}, {
value: '已解除集中医学观察',
value: 'e',
label: '已解除集中医学观察'
}, {
value: '无上述情况',
value: 'f',
label: '无上述情况'
}],
showList: [{
value: '亲密接触者',
value: 'c',
show: [32, 35, 38, 40, 43, 45, 47]
},
{
value: '居家观察/正在接受集中医学观察',
value: 'd',
show: [49, 50]
},
]
......@@ -1576,34 +1608,34 @@
titleClass: 'title',
type: 'pickerMore',
opts: [{
value: '发热',
value: 'a',
label: '发热'
}, {
value: '咳嗽',
value: 'b',
label: '咳嗽'
}, {
value: '流涕',
value: 'c',
label: '流涕'
}, {
value: '咽痛',
value: 'd',
label: '咽痛'
}, {
value: '咳痰',
value: 'e',
label: '咳痰'
}, {
value: '胸痛',
value: 'f',
label: '胸痛'
}, {
value: '肌肉酸痛/关节痛',
value: 'g',
label: '肌肉酸痛/关节痛'
}, {
value: '气促',
value: 'h',
label: '气促'
}, {
value: '腹泻',
value: 'i',
label: '腹泻'
}, {
value: '以上均无',
value: 'j',
label: '以上均无'
}]
},
......@@ -1622,7 +1654,8 @@
householdAddress: '',
residenceAddress: '',
planReturnDate: ''
}
},
formMat:{}
}
},
......@@ -1630,8 +1663,6 @@
this.getOrg()
this.getInfo()
},
methods: {
openModal() {
if (!this.form.agree) {
......@@ -1668,10 +1699,12 @@
getInfo() {
this.$http.get(`/sict-ncov/report`, this.form).then(res => {
const d = res.data
if(d.code == 1) {
if (d.code == 1) {
this.isRead = true
const data = d.object.reportContent || {}
this.form = data
this.form['householdValues'] = data['householdProvince'] + "," +data['householdCity'] + "," +data['householdDistrict']
this.form['residenceValue'] = data['residenceProvince'] + "," + data['residenceCity'] + "," +data['residenceDistrict']
// 赋值
for (let k in data) {
const val = data[k]
......@@ -1682,17 +1715,31 @@
value: val
}, item)
if (item.type == "pickerMore") {
console.log(1,22)
item.opts.forEach(opt => {
val.split(',').forEach(v => {
if (v === opt.label) {
console.log(opt)
if (v === opt.value) {
this.$set(opt, 'checked', true)
}
})
})
}
if (item.type == "picker") {
item.opts.forEach(opt => {
if(opt.value == val) {
this.formMat[k] = opt.label
}
})
}
if (item.type == "pickerAddress") {
item.opts.forEach(opt => {
if(opt.value == val) {
this.formMat[k] = opt.label
}
})
}
}
}
}
......@@ -1716,13 +1763,13 @@
this.$set(checkList[i], 'checked', false)
}
this.$set(checkList[checkList.length - 1], 'checked', true)
this.form[prop] = obj.label
this.form[prop] = obj.value
} else {
this.$set(checkList[checkList.length - 1], 'checked', false)
const values = []
for (var i = 0, lenI = checkList.length; i < lenI; ++i) {
if (checkList[i].checked) {
values.push(checkList[i].label)
values.push(checkList[i].value)
}
}
this.form[prop] = values.join(',')
......@@ -1802,19 +1849,23 @@
this.form[props] = event.target.value
},
// 输入框失去焦点
inputBlur(e,item) {
inputBlur(e, item) {
const val = e.detail.value
if(!val) {
if (!val) {
return
}
if(item.validator && !item.validator(val)) {
if (item.validator && !item.validator(val)) {
uni.showToast({
icon: 'none',
title: `${item.label }填写错误`
})
}
},
// pickerAddress地址改变
addressChange(e, item) {
const val = e.data.join(',')
this.$set(this.form, item.value, val)
},
// 更新下拉框绑定的表单内容
updatePickerVal(event, item) {
const opts = item.opts
......@@ -1824,12 +1875,8 @@
this.$set(this.form, prop, val)
return
}
if (prop == 'orgName') {
this.$set(this.form, 'orgId', opts[val].value)
this.$set(this.form, prop, opts[val].label)
} else {
this.$set(this.form, prop, opts[val].label)
}
this.$set(this.form, prop, opts[val].value)
this.$set(this.formMat, prop, opts[val].label)
if (item.show) {
this.showChange(event, item)
......@@ -1839,7 +1886,7 @@
formSubmit() {
let flag = true
let msg = ''
if(this.form.agree != 1) {
if (this.form.agree != 1) {
uni.showToast({
icon: 'none',
title: `请勾选知情同意书`
......@@ -1857,7 +1904,7 @@
})
break
}
if(this.list[i].validator && !this.list[i].validator(val)) {
if (this.list[i].validator && !this.list[i].validator(val)) {
flag = false
uni.showToast({
icon: 'none',
......@@ -1874,13 +1921,33 @@
if (!flag) {
return false
} else {
this.$http.post(`/sict-ncov/report`, this.form).then(res => {
const data = {}
for (let k in this.form) {
if (this.form[k]) {
if (k == 'householdValues') {
// 户籍所在地
const values = this.form[k].split(',')
data.householdProvince = values[0]
data.householdCity = values[1]
data.householdDistrict = values[2]
} else if (k == 'residenceValue') {
// 住所所在地
const values = this.form[k].split(',')
data.residenceProvince = values[0]
data.residenceCity = values[1]
data.residenceDistrict = values[2]
} else {
data[k] = this.form[k]
}
}
}
this.$http.post(`/sict-ncov/report`, data).then(res => {
const d = res.data
if (d.code == 1) {
uni.navigateBack()
uni.showToast({
icon: 'success',
title:'提交成功'
title: '提交成功'
})
} else {
uni.showToast({
......@@ -1931,9 +1998,11 @@
}
}
}
.content {
text-indent: 20px;
}
uni-radio-group {
border: 2upx solid #d3d3d3;
border-radius: 8upx;
......
......@@ -27,7 +27,7 @@
:style="{opacity: item.required ? 1 : 0}">*</span>{{item.label}}</view>
<picker @change="updatePickerVal($event,item)" range-key="label" mode="selector" :value="form[item.value]" :range="item.opts">
<view class="picker">
{{form[item.value]?form[item.value]:'请选择'}}
{{form[item.value]?formMat[item.value]:'请选择'}}
</view>
</picker>
</view>
......@@ -98,7 +98,7 @@
</view>
</template>
<view class="padding">
<view class="padding" v-show="!isRead">
<button form-type="submit" class="cu-btn block bg-blue margin-tb-sm lg">提 交</button>
</view>
</form>
......@@ -116,8 +116,7 @@
},
data() {
return {
id: '',
radio: [],
isRead: false,
list: [
{
......@@ -127,31 +126,31 @@
titleClass: 'title',
type: 'pickerMore',
opts: [{
value: '已经确诊',
value: 'a',
label: '已经确诊'
}, {
value: '疑似诊断',
value: 'b',
label: '疑似诊断'
}, {
value: '亲密接触者',
value: 'c',
label: '亲密接触者'
}, {
value: '居家观察/正在接受集中医学观察',
value: 'd',
label: '居家观察/正在接受集中医学观察'
}, {
value: '已解除集中医学观察',
value: 'e',
label: '已解除集中医学观察'
}, {
value: '无上述情况',
value: 'f',
label: '无上述情况'
}],
showList: [{
value: '亲密接触者',
value: 'c',
show: [32, 35, 38, 40, 43, 45, 47]
},
{
value: '居家观察/正在接受集中医学观察',
value: 'd',
show: [49, 50]
},
]
......@@ -400,34 +399,34 @@
titleClass: 'title',
type: 'pickerMore',
opts: [{
value: '发热',
value: 'a',
label: '发热'
}, {
value: '咳嗽',
value: 'b',
label: '咳嗽'
}, {
value: '流涕',
value: 'c',
label: '流涕'
}, {
value: '咽痛',
value: 'd',
label: '咽痛'
}, {
value: '咳痰',
value: 'e',
label: '咳痰'
}, {
value: '胸痛',
value: 'f',
label: '胸痛'
}, {
value: '肌肉酸痛/关节痛',
value: 'g',
label: '肌肉酸痛/关节痛'
}, {
value: '气促',
value: 'h',
label: '气促'
}, {
value: '腹泻',
value: 'i',
label: '腹泻'
}, {
value: '以上均无',
value: 'j',
label: '以上均无'
}]
},
......@@ -663,18 +662,20 @@
hidden: true,
},
],
form: {}
form: {},
formMat: {}
}
},
onLoad(option) {
// 获取信息
this.$http.post(`/sict-ncov/report`, this.form).then(res => {
console.log(res)
})
const data = {
currentStatus: '亲密接触者'
}
this.$http.get(`/sict-ncov/report/daily`).then(res => {
const d = res.data
if (d.code == 1) {
this.isRead = true
const data = d.object || {}
this.form = data
// 赋值
for (let k in data) {
const val = data[k]
if (val) {
......@@ -684,20 +685,37 @@
value: val
}, item)
if (item.type == "pickerMore") {
console.log(1,22)
item.opts.forEach(opt => {
val.split(',').forEach(v => {
if (v === opt.label) {
console.log(opt)
if (v === opt.value) {
this.$set(opt, 'checked', true)
}
})
})
}
if (item.type == "picker") {
item.opts.forEach(opt => {
if (opt.value == val) {
this.formMat[k] = opt.label
}
})
}
if (item.type == "pickerAddress") {
item.opts.forEach(opt => {
if (opt.value == val) {
this.formMat[k] = opt.label
}
})
}
}
}
}
}
})
},
......@@ -718,13 +736,13 @@
this.$set(checkList[i], 'checked', false)
}
this.$set(checkList[checkList.length - 1], 'checked', true)
this.form[prop] = obj.label
this.form[prop] = obj.value
} else {
this.$set(checkList[checkList.length - 1], 'checked', false)
const values = []
for (var i = 0, lenI = checkList.length; i < lenI; ++i) {
if (checkList[i].checked) {
values.push(checkList[i].label)
values.push(checkList[i].value)
}
}
this.form[prop] = values.join(',')
......@@ -748,10 +766,11 @@
current.show.forEach(child => {
this.list.forEach(row => {
if (child == row.num) {
this.$set(row, 'hidden', !current.showValue.includes(val))
this.$set(row, 'hidden', !current.showValue.includes(String(val)))
}
})
})
break
}
}
}
......@@ -773,7 +792,22 @@
}
}
if (type === 'picker') {
let val = evt.value || item.opts[evt.detail.value].value;
for (let i = 0; i < this.list.length; i++) {
const current = this.list[i]
if (current.value == prop && current.show) {
current.show.forEach(child => {
this.list.forEach(row => {
if (child == row.num) {
this.$set(row, 'hidden', !current.showValue.includes(val))
}
})
})
break
}
}
}
},
isShowChild() {
......@@ -796,7 +830,11 @@
this.$set(this.form, prop, val)
return
}
this.$set(this.form, prop, opts[val].label)
this.$set(this.form, prop, opts[val].value)
this.$set(this.formMat, prop, opts[val].label)
if (item.show) {
this.showChange(event, item)
}
},
// 提交信息
formSubmit() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment