Commit f03401ad authored by lrw's avatar lrw

填报查看

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