提交 2a33240a 编写于 作者: tao.wu's avatar tao.wu

bug修改,量表

上级 3a9afebc
<template>
<div>
<!-- input -->
<el-input
v-if="item.formType === 'input'"
v-model="form[item.model]"
:type="item.type"
:class="item.className"
:disabled="item.disabled"
:maxlength="item.maxlength"
:minlength="item.minlength"
:placeholder="item.placeholder"
@change="item.changeFun ? item.changeFun($event) : defaultFun($event)">
<template
v-for="slot in item.slots || []"
:slot="slot.type">{{ slot.name }}</template>
</el-input>
<!-- radios -->
<el-radio-group
v-else-if="item.formType === 'radio'"
v-model="form[item.model]"
@change="item.changeFun ? item.changeFun($event) : defaultFun($event)"
>
<el-radio
v-for="(opt, rad) in item.options"
:key="rad"
:label="opt.value">
{{ opt.label }}
</el-radio>
</el-radio-group>
</div>
</template>
<script>
export default {
props: {
dataSource: Object,
},
created(){
this.item = this.dataSource
},
data() {
return {
item: {},
form: {
symptomList: [],//checkbox 症状
inputVal: '',
radioVal: ''
},
}
},
methods: {
defaultFun() {},
}
}
</script>
<style scoped lang="scss">
</style>
<template>
<div class="form-box">
<el-row>
<el-col
v-for="(item, index) in dataSource"
:span="item.spanNum ? item.spanNum : spanNum"
:class="item.className"
:offset="item.offset"
:key="index" >
<el-form-item
v-if="isParent(item)"
:prop="item.prop"
:label="item.label"
:rules="item.rules"
:label-width="item.labelWidth"
:required="item.required"
:class="item.className"
:error="item.error">
<!-- div文本 -->
<div v-if="item.formType === 'div'" :class="item.className">{{ item.name }}</div>
<!-- input -->
<el-input
v-else-if="item.formType === 'input'"
v-model="form[item.model]"
:type="item.type"
:class="item.className"
:disabled="item.disabled"
:maxlength="item.maxlength"
:minlength="item.minlength"
:placeholder="item.placeholder"
@change="item.changeFun ? item.changeFun($event) : defaultFun($event)">
<template
v-for="slot in item.slots || []"
:slot="slot.type">{{ slot.name }}</template>
</el-input>
<!-- label -->
<label
v-else-if="item.formType === 'label'"
:class="item.className"
:disabled="item.disabled">{{ form[item.model]==''?'-':form[item.model] }}{{ item.suffix }}
</label>
<!-- select -->
<el-select
v-else-if="item.formType === 'select'"
v-model="form[item.model]"
:multiple="item.multiple"
:placeholder="item.placeholder"
@change="item.changeFun ? item.changeFun($event) : defaultFun($event)">
<el-option
v-for="(opt, index2) in item.options"
:key="index2"
:label="opt.label"
:value="opt.value"/>
</el-select>
<!-- checkbox -->
<el-checkbox-group
v-else-if="item.formType === 'checkbox'"
v-model="form[item.model]"
@change="item.changeFun ? item.changeFun($event) : defaultFun($event)"
>
<el-checkbox
v-for="(opt, ck) in item.options"
:key="ck"
:label="opt.value"
>
{{ opt.label }}
</el-checkbox>
</el-checkbox-group>
<!-- radios -->
<el-radio-group
v-else-if="item.formType === 'radio'"
v-model="form[item.model]"
@change="item.changeFun ? item.changeFun($event) : defaultFun($event)"
>
<el-radio
v-for="(opt, rad) in item.options"
:key="rad"
:label="opt.value">
{{ opt.label }}
</el-radio>
</el-radio-group>
<!-- switch-->
<el-switch
v-else-if="item.formType === 'switch'"
v-model="form[item.model]"/>
<!-- transfer-->
<el-transfer
v-else-if="item.formType === 'transfer'"
v-model="form[item.model]"
:data="item.data"/>
<!-- 时间 -->
<el-date-picker
v-else-if="item.formType === 'date-picker'"
v-model="form[item.model]"
:disabled="item.disabled"
:type="item.type || dateType"
:placeholder="item.placeholder"
:format="item.format || format"
:value-format="item.valueFormat || valueFormat"
@change="item.changeFun ? item.changeFun($event) : defaultFun($event)"/>
<!-- 图片 -->
<img v-else-if="item.formType === 'img'" :src="item.src||''" :alt="item.alt||''" :width="item.width">
</el-form-item>
</el-col>
</el-row>
</div>
</template>
<script>
import _ from 'lodash'
export default {
props: {
dataSource: {
type: Array,
default: () => []
},
form: {
type: Object,
default: () => {}
}
},
data() {
return {
spanNum: 12,
valueFormat: 'timestamp',
format: 'yyyy-MM-dd HH:mm',
dateType: 'datetime'
}
},
methods: {
defaultFun() {},
isParent(item) {
if (!item.linkageRule) {
return true
} else {
let num = 0
item.linkageRule.forEach(t => {
if (this.form[t.name] == null) {
return false
}
if (typeof this.form[t.name] === 'string') {
if (t.value.includes(this.form[t.name])) {
num += 1
}
} else {
const nameVal = this.form[t.name]
const valType = _.isArray(nameVal) ? nameVal : Array.of(nameVal)
const bool = _.intersection(valType, t.value)
if (_.isArray(bool) && bool.length > 0) {
num += 1
}
}
})
if (num !== item.linkageRule.length) {
delete this.form[item.model]
}
return num === item.linkageRule.length
}
}
}
}
</script>
<style lang="scss">
.form-box {
padding: 20px 40px;
}
.h72 {
height: 92px;
}
.clear {
clear: left;
}
.m-title {
.el-form-item__label {
font-size: 16px;
color: rgba(74, 74, 74, 1);
}
}
</style>
<template>
<div>
<!-- input -->
<el-input
v-if="item.formType === 'input'"
v-model="form[item.model]"
:type="item.type"
:class="item.className"
:disabled="item.disabled"
:maxlength="item.maxlength"
:minlength="item.minlength"
:placeholder="item.placeholder"
@change="item.changeFun ? item.changeFun($event) : defaultFun($event)">
<template
v-for="slot in item.slots || []"
:slot="slot.type">{{ slot.name }}</template>
</el-input>
<!-- radios -->
<el-radio-group
v-else-if="item.formType === 'radio'"
v-model="form[item.model]"
@change="item.changeFun ? item.changeFun($event) : defaultFun($event)"
>
<el-radio
v-for="(opt, rad) in item.options"
:key="rad"
:label="opt.value">
{{ opt.label }}
</el-radio>
</el-radio-group>
</div>
</template>
<script>
export default {
props: {
dataSource: Object,
},
created(){
this.item = this.dataSource
},
data() {
return {
item: {},
form: {
symptomList: [],//checkbox 症状
inputVal: '',
radioVal: ''
},
}
},
methods: {
defaultFun() {},
}
}
</script>
<style scoped lang="scss">
</style>
<template>
<div>
<!-- input -->
<el-input
v-if="item.formType === 'input'"
v-model="form[item.model]"
:type="item.type"
:class="item.className"
:disabled="item.disabled"
:maxlength="item.maxlength"
:minlength="item.minlength"
:placeholder="item.placeholder"
@change="item.changeFun ? item.changeFun($event) : defaultFun($event)">
<template
v-for="slot in item.slots || []"
:slot="slot.type">{{ slot.name }}</template>
</el-input>
<!-- radios -->
<el-radio-group
v-else-if="item.formType === 'radio'"
v-model="form[item.model]"
@change="item.changeFun ? item.changeFun($event) : defaultFun($event)"
>
<el-radio
v-for="(opt, rad) in item.options"
:key="rad"
:label="opt.value">
{{ opt.label }}
</el-radio>
</el-radio-group>
</div>
</template>
<script>
export default {
props: {
dataSource: Object,
},
created(){
this.item = this.dataSource
},
data() {
return {
item: {},
form: {
symptomList: [],//checkbox 症状
inputVal: '',
radioVal: ''
},
}
},
methods: {
defaultFun() {},
}
}
</script>
<style scoped lang="scss">
</style>
<template>
<div>
<!-- checkbox -->
<el-checkbox-group
v-if="item.formType=='checkbox'"
v-model="form[item.model]"
@change="changeFun(item,form[item.model])"
>
<el-checkbox
v-for="(opt, ck) in item.options"
:key="ck"
:label="opt.value"
:disabled="opt.disabled"
>
{{ opt.label }}
</el-checkbox>
</el-checkbox-group>
<!-- input -->
<el-input
v-else-if="item.formType === 'input'"
v-model="form[item.model]"
:type="item.type"
:class="item.className"
:disabled="item.disabled"
:maxlength="item.maxlength"
:minlength="item.minlength"
:placeholder="item.placeholder"
@change="item.changeFun ? item.changeFun($event) : defaultFun($event)">
<template
v-for="slot in item.slots || []"
:slot="slot.type">{{ slot.name }}</template>
</el-input>
</div>
</template>
<script>
export default {
props: {
dataSource: Object,
},
created(){
this.item = this.dataSource
},
data() {
return {
item: {},
form: {
symptomList: [],//checkbox 症状
inputVal: ''
},
}
},
methods: {
// 改变checkbox的时候判断
changeFun(obj,val){
const len = val.length
const options = obj.options
if(len>0){
val.forEach((item)=>{
if(item=='1'){
options.forEach((item)=>{
if(item.value!='1'){
item.disabled = true
}else{
item.disabled = false
}
})
}else{
options.forEach((item)=>{
item.disabled = false
})
}
})
}else{
options.forEach((item)=>{
item.disabled = false
})
}
},
defaultFun() {},
}
}
</script>
<style scoped lang="scss">
</style>
<template>
<div>
<!--<el-form :ref="timeForm.formRef" :model="timeForm" :rules="timeFormRules" label-suffix=":" label-width="140px" :inline-message="true" size="small">-->
<el-form-item label="本次随访时间" required>
<div style="display: flex;">
<el-form-item prop="timeNo">
<el-input
v-model="timeForm.timeNo"
type="tel"
size="small"
placeholder="请输入"
:disabled="isStandedTemplate"
maxlength="2"
clearable />
</el-form-item>
<el-form-item prop="timeUnit" class="ml20">
<el-select v-if="!isStandedTemplate && !planId" v-model="timeForm.timeUnit" placeholder="请选择" :disabled="timeForm.isDisabled">
<el-option
v-for="(item,index) in markOptions"
:key="index"
:label="item.value"
:value="item.no">
</el-option>
</el-select>
<el-select v-if="isStandedTemplate || planId" v-model="timeForm.timeUnit" placeholder="请选择" :disabled="isStandedTemplate">
<el-option
v-for="(item,index) in markOptions"
:key="index"
:label="item.value"
:value="item.no">
</el-option>
</el-select>
</el-form-item>
</div>
</el-form-item>
<el-form-item label="随访方式" prop="type">
<el-radio-group v-model="timeForm.type" size="small">
<el-radio v-for="(item,index) in followTypeList" :key="index" :label="item.no" :disabled="isStandedTemplate">{{item.value}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="提醒医生预约居民">
<el-select
v-if="!isStandedTemplate"
v-model="timeForm.remindDay"
multiple
:multiple-limit=3
@change="changeRemindDay"
placeholder="请选择">
<el-option
v-for="(item,index) in remindOptions"
:key="index"
:label="item.value"
:value="item.no">
</el-option>
</el-select>
<!--<template>-->
<!--<div>-->
<!--&lt;!&ndash;<el-form :ref="timeForm.formRef" :model="timeForm" :rules="timeFormRules" label-suffix=":" label-width="140px" :inline-message="true" size="small">&ndash;&gt;-->
<!--<el-form-item label="本次随访时间" required>-->
<!--<div style="display: flex;">-->
<!--<el-form-item prop="timeNo">-->
<!--<el-input-->
<!--v-model="timeForm.timeNo"-->
<!--type="tel"-->
<!--size="small"-->
<!--placeholder="请输入"-->
<!--:disabled="isStandedTemplate"-->
<!--maxlength="2"-->
<!--clearable />-->
<!--</el-form-item>-->
<!--<el-form-item prop="timeUnit" class="ml20">-->
<!--<el-select v-if="!isStandedTemplate && !planId" v-model="timeForm.timeUnit" placeholder="请选择" :disabled="timeForm.isDisabled">-->
<!--<el-option-->
<!--v-for="(item,index) in markOptions"-->
<!--:key="index"-->
<!--:label="item.value"-->
<!--:value="item.no">-->
<!--</el-option>-->
<!--</el-select>-->
<!--<el-select v-if="isStandedTemplate || planId" v-model="timeForm.timeUnit" placeholder="请选择" :disabled="isStandedTemplate">-->
<!--<el-option-->
<!--v-for="(item,index) in markOptions"-->
<!--:key="index"-->
<!--:label="item.value"-->
<!--:value="item.no">-->
<!--</el-option>-->
<!--</el-select>-->
<!--</el-form-item>-->
<!--</div>-->
<!--</el-form-item>-->
<!--<el-form-item label="随访方式" prop="type">-->
<!--<el-radio-group v-model="timeForm.type" size="small">-->
<!--<el-radio v-for="(item,index) in followTypeList" :key="index" :label="item.no" :disabled="isStandedTemplate">{{item.value}}</el-radio>-->
<!--</el-radio-group>-->
<!--</el-form-item>-->
<!--<el-form-item label="提醒医生预约居民">-->
<!--<el-select-->
<!--v-if="!isStandedTemplate"-->
<!--v-model="timeForm.remindDay"-->
<!--multiple-->
<!--:multiple-limit=3-->
<!--@change="changeRemindDay"-->
<!--placeholder="请选择">-->
<!--<el-option-->
<!--v-for="(item,index) in remindOptions"-->
<!--:key="index"-->
<!--:label="item.value"-->
<!--:value="item.no">-->
<!--</el-option>-->
<!--</el-select>-->
<!--固定模板需要填充-->
<el-select
v-if="isStandedTemplate"
v-model="timeForm.remindDay"
multiple
:multiple-limit=3
:disabled="isStandedTemplate"
placeholder="请选择">
<el-option
v-for="(item,index) in remindOptionsCopy"
:key="index"
:label="item.startDaysStr"
:value="item.startDays">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="推送患教">
<div style="display: flex">
<!--&lt;!&ndash;固定模板需要填充&ndash;&gt;-->
<!--<el-select-->
<!--v-if="isStandedTemplate"-->
<!--v-model="timeForm.remindDay"-->
<!--multiple-->
<!--:multiple-limit=3-->
<!--:disabled="isStandedTemplate"-->
<!--placeholder="请选择">-->
<!--<el-option-->
<!--v-for="(item,index) in remindOptionsCopy"-->
<!--:key="index"-->
<!--:label="item.startDaysStr"-->
<!--:value="item.startDays">-->
<!--</el-option>-->
<!--</el-select>-->
<!--</el-form-item>-->
<!--<el-form-item label="推送患教">-->
<!--<div style="display: flex">-->
<el-select
v-if="!isStandedTemplate"
v-model="timeForm.pushDay"
placeholder="选择推送时间"
clearable
>
<el-option
v-for="(item,index) in pushTimeOptions"
:key="index"
:label="item.value"
:value="item.no">
</el-option>
</el-select>
<!--<el-select-->
<!--v-if="!isStandedTemplate"-->
<!--v-model="timeForm.pushDay"-->
<!--placeholder="选择推送时间"-->
<!--clearable-->
<!--&gt;-->
<!--<el-option-->
<!--v-for="(item,index) in pushTimeOptions"-->
<!--:key="index"-->
<!--:label="item.value"-->
<!--:value="item.no">-->
<!--</el-option>-->
<!--</el-select>-->
<!--固定模板需要填充-->
<el-select
v-if="isStandedTemplate"
v-model="timeForm.pushDay"
placeholder="选择推送时间"
clearable
:disabled="isStandedTemplate"
>
<el-option
:label="timeForm.startDaysStr"
:value="timeForm.pushDay">
</el-option>
</el-select>
<el-button plain class="ml20" @click="goSelectCartoon" v-if="!timeForm.hasSelected && !isStandedTemplate && !planId">选择健康漫画</el-button>
<div class="selected-div ml20" v-if="timeForm.hasSelected">
<span>{{timeForm.comentMsg.header_name}}</span>
<el-button type="text" @click="goSelectCartoon" v-if="!isStandedTemplate && !planId">重选</el-button>
<el-button type="text" @click="deleteClick" v-if="!isStandedTemplate && !planId">删除</el-button>
</div>
</div>
</el-form-item>
<div class="tips-contnt" v-if="timeForm.hasSelected">
<p class="yellow-font">当前计划中共{{timeForm.totalNumber}}位居民(微信:{{timeForm.wechatPatientNum}}位,短信:{{timeForm.messagePatientNum}}位),本次定时推送任务在发送当日预计需要{{timeForm.messagePatientNum}}条短信额度(微信推送不消耗额度,建议您让居民关注云鹊健康微信公众号),务必提前确保短信额度的充足。</p>
<p>需要更多额度,请前往「云鹊医App-个人中心-啾啾币中心」兑换短信额度后再进行预约,您也可以联系云鹊医客服购买短信额度,客服电话:400-920-8877</p>
</div>
<el-form-item label="随访登记表">
<el-select
v-if="!isStandedTemplate"
v-model="timeForm.followResourceId"
multiple
:multiple-limit=3
@change="changeFollowId"
placeholder="请选择">
<el-option
v-for="(item,index) in formOptions"
:key="index"
:label="item.name"
:value="item.scaleNo">
</el-option>
</el-select>
<!--&lt;!&ndash;固定模板需要填充&ndash;&gt;-->
<!--<el-select-->
<!--v-if="isStandedTemplate"-->
<!--v-model="timeForm.pushDay"-->
<!--placeholder="选择推送时间"-->
<!--clearable-->
<!--:disabled="isStandedTemplate"-->
<!--&gt;-->
<!--<el-option-->
<!--:label="timeForm.startDaysStr"-->
<!--:value="timeForm.pushDay">-->
<!--</el-option>-->
<!--</el-select>-->
<!--<el-button plain class="ml20" @click="goSelectCartoon" v-if="!timeForm.hasSelected && !isStandedTemplate && !planId">选择健康漫画</el-button>-->
<!--<div class="selected-div ml20" v-if="timeForm.hasSelected">-->
<!--<span>《{{timeForm.comentMsg.header_name}}》</span>-->
<!--<el-button type="text" @click="goSelectCartoon" v-if="!isStandedTemplate && !planId">重选</el-button>-->
<!--<el-button type="text" @click="deleteClick" v-if="!isStandedTemplate && !planId">删除</el-button>-->
<!--</div>-->
<!--</div>-->
<!--</el-form-item>-->
<!--<div class="tips-contnt" v-if="timeForm.hasSelected">-->
<!--<p class="yellow-font">当前计划中共{{timeForm.totalNumber}}位居民(微信:{{timeForm.wechatPatientNum}}位,短信:{{timeForm.messagePatientNum}}位),本次定时推送任务在发送当日预计需要{{timeForm.messagePatientNum}}条短信额度(微信推送不消耗额度,建议您让居民关注云鹊健康微信公众号),务必提前确保短信额度的充足。</p>-->
<!--<p>需要更多额度,请前往「云鹊医App-个人中心-啾啾币中心」兑换短信额度后再进行预约,您也可以联系云鹊医客服购买短信额度,客服电话:400-920-8877</p>-->
<!--</div>-->
<!--<el-form-item label="随访登记表">-->
<!--<el-select-->
<!--v-if="!isStandedTemplate"-->
<!--v-model="timeForm.followResourceId"-->
<!--multiple-->
<!--:multiple-limit=3-->
<!--@change="changeFollowId"-->
<!--placeholder="请选择">-->
<!--<el-option-->
<!--v-for="(item,index) in formOptions"-->
<!--:key="index"-->
<!--:label="item.name"-->
<!--:value="item.scaleNo">-->
<!--</el-option>-->
<!--</el-select>-->
<!--固定模板需要填充-->
<el-select
v-if="isStandedTemplate"
v-model="timeForm.followResourceId"
multiple
:multiple-limit=3
@change="changeFollowId"
:disabled="isStandedTemplate"
placeholder="请选择">
<el-option
v-for="(item,index) in formOptionsCopy"
:key="index"
:label="item.sendContent"
:value="item.resourceId">
</el-option>
</el-select>
</el-form-item>
<!--</el-form>-->
<select-cartoon
:isSelectCartoon="isSelectCartoon"
@closeSelectCartoon="closeSelectCartoon"
@pushConmentMsg="pushConmentMsg"
/>
</div>
</template>
<script>
import _ from 'lodash';
import SelectCartoon from '@/views/followup/plan-manage/dialog/select-cartoon';
import { getPatientNumber } from '@/utils/followup/followapis'
<!--&lt;!&ndash;固定模板需要填充&ndash;&gt;-->
<!--<el-select-->
<!--v-if="isStandedTemplate"-->
<!--v-model="timeForm.followResourceId"-->
<!--multiple-->
<!--:multiple-limit=3-->
<!--@change="changeFollowId"-->
<!--:disabled="isStandedTemplate"-->
<!--placeholder="请选择">-->
<!--<el-option-->
<!--v-for="(item,index) in formOptionsCopy"-->
<!--:key="index"-->
<!--:label="item.sendContent"-->
<!--:value="item.resourceId">-->
<!--</el-option>-->
<!--</el-select>-->
<!--</el-form-item>-->
<!--&lt;!&ndash;</el-form>&ndash;&gt;-->
<!--<select-cartoon-->
<!--:isSelectCartoon="isSelectCartoon"-->
<!--@closeSelectCartoon="closeSelectCartoon"-->
<!--@pushConmentMsg="pushConmentMsg"-->
<!--/>-->
<!--</div>-->
<!--</template>-->
<!--<script>-->
<!--import _ from 'lodash';-->
<!--import SelectCartoon from '@/views/followup/plan-manage/dialog/select-cartoon';-->
<!--import { getPatientNumber } from '@/utils/followup/followapis'-->
export default {
components: {
SelectCartoon
},
data() {
const checkDay = (rule, value, callback)=>{
const num = parseFloat(value)
if(num < 1 || num>99){
return callback(new Error('日期不能大于99天或小于0天'));
}
callback();
}
return {
formNoList: [],//存放量表 scaleNo 的数组,用于匹配所选项
remindOptionsCopy: [],//提升医生预约居民 - 标准模板
formOptionsCopy: [], //量表 - 标准模板
isSelectCartoon: false,
timeFormRules: {
timeNo: [{ required: true, message: '请添加随访时间', trigger: 'change' },{ validator: checkDay, trigger: 'blur' }],
timeUnit: [{ required: true, message: '请添加随访时间', trigger: 'change' }],
type: [{ required: true, message: '请选择随访方式', trigger: 'change' }],
},
}
},
props: {
timeForm: Object,
valBegin: Boolean, // 设置新时间节点的校验开关
saveValiedBegin: Boolean, // 点击保存提交整个表单的校验开关
markOptions:Array,
followTypeList:Array,
remindOptions:Array,
pushTimeOptions:Array,
formOptions: Array,
patientIdList: Array,
isStandedTemplate: Boolean,
planId: String
},
watch: {
patientIdList(val){
<!--export default {-->
<!--components: {-->
<!--SelectCartoon-->
<!--},-->
<!--data() {-->
<!--const checkDay = (rule, value, callback)=>{-->
<!--const num = parseFloat(value)-->
<!--if(num < 1 || num>99){-->
<!--return callback(new Error('日期不能大于99天或小于0天'));-->
<!--}-->
<!--callback();-->
<!--}-->
<!--return {-->
<!--formNoList: [],//存放量表 scaleNo 的数组,用于匹配所选项-->
<!--remindOptionsCopy: [],//提升医生预约居民 - 标准模板-->
<!--formOptionsCopy: [], //量表 - 标准模板-->
<!--isSelectCartoon: false,-->
<!--timeFormRules: {-->
<!--timeNo: [{ required: true, message: '请添加随访时间', trigger: 'change' },{ validator: checkDay, trigger: 'blur' }],-->
<!--timeUnit: [{ required: true, message: '请添加随访时间', trigger: 'change' }],-->
<!--type: [{ required: true, message: '请选择随访方式', trigger: 'change' }],-->
<!--},-->
<!--}-->
<!--},-->
<!--props: {-->
<!--timeForm: Object,-->
<!--valBegin: Boolean, // 设置新时间节点的校验开关-->
<!--saveValiedBegin: Boolean, // 点击保存提交整个表单的校验开关-->
<!--markOptions:Array,-->
<!--followTypeList:Array,-->
<!--remindOptions:Array,-->
<!--pushTimeOptions:Array,-->
<!--formOptions: Array,-->
<!--patientIdList: Array,-->
<!--isStandedTemplate: Boolean,-->
<!--planId: String-->
<!--},-->
<!--watch: {-->
<!--patientIdList(val){-->
},
timeForm(val){
this.timeForm = val
if(this.isStandedTemplate || this.planId){
// console.log('表单子组件监听到的form数据',this.timeForm)
this.timeForm.isDisabled = true
console.log(this.timeForm.remindList)
if(this.timeForm.remindList && this.timeForm.remindList.length > 0){// remindDay
this.remindOptionsCopy = this.timeForm.remindList
this.timeForm.remindDay = []
this.timeForm.remindList.forEach((item)=>{
this.timeForm.remindDay.push(item.startDays)
})
}
if(this.timeForm.pushContentList && this.timeForm.pushContentList.length > 0){//pushDay
let pushData = this.timeForm.pushContentList[0]
this.timeForm.pushDay = pushData.startDays
this.timeForm.startDaysStr = pushData.startDaysStr
this.timeForm.comentMsg = {
id: pushData.resourceId,
header_name: pushData.sendContent
}
this.closeSelectCartoon({
closeStatus: false,
hasSelected: this.timeForm.comentMsg
})
}
<!--},-->
<!--timeForm(val){-->
<!--this.timeForm = val-->
<!--if(this.isStandedTemplate || this.planId){-->
<!--// console.log('表单子组件监听到的form数据',this.timeForm)-->
<!--this.timeForm.isDisabled = true-->
<!--console.log(this.timeForm.remindList)-->
<!--if(this.timeForm.remindList && this.timeForm.remindList.length > 0){// remindDay-->
<!--this.remindOptionsCopy = this.timeForm.remindList-->
<!--this.timeForm.remindDay = []-->
<!--this.timeForm.remindList.forEach((item)=>{-->
<!--this.timeForm.remindDay.push(item.startDays)-->
<!--})-->
<!--}-->
<!--if(this.timeForm.pushContentList && this.timeForm.pushContentList.length > 0){//pushDay-->
<!--let pushData = this.timeForm.pushContentList[0]-->
<!--this.timeForm.pushDay = pushData.startDays-->
<!--this.timeForm.startDaysStr = pushData.startDaysStr-->
<!--this.timeForm.comentMsg = {-->
<!--id: pushData.resourceId,-->
<!--header_name: pushData.sendContent-->
<!--}-->
<!--this.closeSelectCartoon({-->
<!--closeStatus: false,-->
<!--hasSelected: this.timeForm.comentMsg-->
<!--})-->
<!--}-->
if(this.timeForm.followupList && this.timeForm.followupList.length > 0){ //followResourceId
this.formOptionsCopy = this.timeForm.followupList
this.timeForm.followResourceId = []
this.timeForm.followupList.forEach((item)=>{
this.timeForm.followResourceId.push(item.resourceId)
})
}
console.log(this.formOptionsCopy)
getPatientNumber({
patientIdList: this.patientIdList
}).then(res=>{
if(res.code=='000000'){
this.timeForm.wechatPatientNum = res.data.wechatPatientNum;
this.timeForm.messagePatientNum = res.data.messagePatientNum;
this.timeForm.totalNumber = this.timeForm.wechatPatientNum + this.timeForm.messagePatientNum
}else{
this.$notify.success({
title: '提交失败',
message: res.message,
showClose: false
});
}
<!--if(this.timeForm.followupList && this.timeForm.followupList.length > 0){ //followResourceId-->
<!--this.formOptionsCopy = this.timeForm.followupList-->
<!--this.timeForm.followResourceId = []-->
<!--this.timeForm.followupList.forEach((item)=>{-->
<!--this.timeForm.followResourceId.push(item.resourceId)-->
<!--})-->
<!--}-->
<!--console.log(this.formOptionsCopy)-->
<!--getPatientNumber({-->
<!--patientIdList: this.patientIdList-->
<!--}).then(res=>{-->
<!--if(res.code=='000000'){-->
<!--this.timeForm.wechatPatientNum = res.data.wechatPatientNum;-->
<!--this.timeForm.messagePatientNum = res.data.messagePatientNum;-->
<!--this.timeForm.totalNumber = this.timeForm.wechatPatientNum + this.timeForm.messagePatientNum-->
<!--}else{-->
<!--this.$notify.success({-->
<!--title: '提交失败',-->
<!--message: res.message,-->
<!--showClose: false-->
<!--});-->
<!--}-->
})
// console.log(this.isStandedTemplate)
// console.log(this.formOptions)
// console.log(this.formOptionsCopy)
<!--})-->
<!--// console.log(this.isStandedTemplate)-->
<!--// console.log(this.formOptions)-->
<!--// console.log(this.formOptionsCopy)-->
}
},
formOptions(val){
val.forEach((item)=>{
this.formNoList.push(item.scaleNo)
})
},
valBegin(val){
if(val){
this.$refs[this.timeForm.formRef].validate((valid) => {
this.$emit('checkValid',{valid: valid, type: 'normal'})
});
}
},
saveValiedBegin(val){
// console.log('保存按钮子组件的校验',val)
// console.log('++++',this.timeForm.formRef)
if(val && this.timeForm.formRef){
this.$refs[this.timeForm.formRef].validate((valid) => {
// console.log('告诉父组件,校验结果' + valid)
this.$emit('checkValid',{valid: valid, type: 'save'})
});
}
}
},
methods: {
changeRemindDay(val){
console.log(val)
},
changeFollowId(val){
console.log(val)
this.timeForm.followResourceIdStr = []
val.forEach((item)=>{
if(this.formNoList.includes(item)){
this.timeForm.followResourceIdStr.push(item)
}
})
},
goSelectCartoon() {
this.isSelectCartoon = true;
},
closeSelectCartoon(val) {
this.isSelectCartoon = val.closeStatus;
this.timeForm.hasSelected = val.hasSelected;
},
deleteClick() {
this.timeForm.hasSelected = '';
},
pushConmentMsg(val){
this.timeForm.comentMsg = val
getPatientNumber({
patientIdList: this.patientIdList
}).then(res=>{
if(res.code=='000000'){
this.timeForm.wechatPatientNum = res.data.wechatPatientNum;
this.timeForm.messagePatientNum = res.data.messagePatientNum;
this.timeForm.totalNumber = this.timeForm.wechatPatientNum + this.timeForm.messagePatientNum
}else{
this.$notify.success({
title: '提交失败',
message: res.message,
showClose: false
});
}
<!--}-->
<!--},-->
<!--formOptions(val){-->
<!--val.forEach((item)=>{-->
<!--this.formNoList.push(item.scaleNo)-->
<!--})-->
<!--},-->
<!--valBegin(val){-->
<!--if(val){-->
<!--this.$refs[this.timeForm.formRef].validate((valid) => {-->
<!--this.$emit('checkValid',{valid: valid, type: 'normal'})-->
<!--});-->
<!--}-->
<!--},-->
<!--saveValiedBegin(val){-->
<!--// console.log('保存按钮子组件的校验',val)-->
<!--// console.log('++++',this.timeForm.formRef)-->
<!--if(val && this.timeForm.formRef){-->
<!--this.$refs[this.timeForm.formRef].validate((valid) => {-->
<!--// console.log('告诉父组件,校验结果' + valid)-->
<!--this.$emit('checkValid',{valid: valid, type: 'save'})-->
<!--});-->
<!--}-->
<!--}-->
<!--},-->
<!--methods: {-->
<!--changeRemindDay(val){-->
<!--console.log(val)-->
<!--},-->
<!--changeFollowId(val){-->
<!--console.log(val)-->
<!--this.timeForm.followResourceIdStr = []-->
<!--val.forEach((item)=>{-->
<!--if(this.formNoList.includes(item)){-->
<!--this.timeForm.followResourceIdStr.push(item)-->
<!--}-->
<!--})-->
<!--},-->
<!--goSelectCartoon() {-->
<!--this.isSelectCartoon = true;-->
<!--},-->
<!--closeSelectCartoon(val) {-->
<!--this.isSelectCartoon = val.closeStatus;-->
<!--this.timeForm.hasSelected = val.hasSelected;-->
<!--},-->
<!--deleteClick() {-->
<!--this.timeForm.hasSelected = '';-->
<!--},-->
<!--pushConmentMsg(val){-->
<!--this.timeForm.comentMsg = val-->
<!--getPatientNumber({-->
<!--patientIdList: this.patientIdList-->
<!--}).then(res=>{-->
<!--if(res.code=='000000'){-->
<!--this.timeForm.wechatPatientNum = res.data.wechatPatientNum;-->
<!--this.timeForm.messagePatientNum = res.data.messagePatientNum;-->
<!--this.timeForm.totalNumber = this.timeForm.wechatPatientNum + this.timeForm.messagePatientNum-->
<!--}else{-->
<!--this.$notify.success({-->
<!--title: '提交失败',-->
<!--message: res.message,-->
<!--showClose: false-->
<!--});-->
<!--}-->
})
}
},
}
</script>
<style scoped lang="scss">
.form-div{
padding-top: 30px;
.tips-contnt{
margin-top: -10px;
padding-left: 140px;
padding-bottom: 30px;
font-size: 12px;
color: #9B9997;
width: 55%;
p{
line-height: 18px;
&.yellow-font{
color: #e6a23c;
padding-bottom: 10px;
}
}
}
}
.ml20{
margin-left: 20px;
}
</style>
<!--})-->
<!--}-->
<!--},-->
<!--}-->
<!--</script>-->
<!--<style scoped lang="scss">-->
<!--.form-div{-->
<!--padding-top: 30px;-->
<!--.tips-contnt{-->
<!--margin-top: -10px;-->
<!--padding-left: 140px;-->
<!--padding-bottom: 30px;-->
<!--font-size: 12px;-->
<!--color: #9B9997;-->
<!--width: 55%;-->
<!--p{-->
<!--line-height: 18px;-->
<!--&.yellow-font{-->
<!--color: #e6a23c;-->
<!--padding-bottom: 10px;-->
<!--}-->
<!--}-->
<!--}-->
<!--}-->
<!--.ml20{-->
<!--margin-left: 20px;-->
<!--}-->
<!--</style>-->
......@@ -24,7 +24,7 @@
v-show="index == activeTab"
class="form-div"
>
<el-form :ref="itemTimeForm.formRef" :model="itemTimeForm" :rules="timeFormRules" label-suffix=":" label-width="140px" :inline-message="true" size="small">
<el-form :ref="itemTimeForm.formRef" :model="itemTimeForm" :rules="timeFormRules" label-suffix=":" label-width="140px" :inline-message="false" size="small">
<el-form-item label="本次随访时间" required>
<div style="display: flex;">
<el-form-item prop="timeNo">
......@@ -180,6 +180,7 @@
messagePatientNum: 0,
totalNumber: 0,
activeResourceId: '',
errMsg: '',
}
},
props: {
......@@ -269,6 +270,7 @@
this.setTimeNodeList[index].formRef = 'form' + index;
});
this.$forceUpdate();
this.activeTab = this.setTimeNodeList.length - 1 + '';
}
},
......@@ -368,8 +370,8 @@
// 如果直接点击保存,需要进行对当前填写的表单进行校验
this.checkStart();
if(this.isValied){
let timeNo = this.setTimeNodeList[this.activeTab].timeNo;
this.checkIsRepeat(timeNo);
// let timeNo = this.setTimeNodeList[this.activeTab].timeNo;
// this.checkIsRepeat(timeNo);
// 保存 校验通过后,排序 + 发送请求
// 新增成功之后
this.setTimeNodeList = this.sortKey(this.setTimeNodeList,'timeNo');
......@@ -379,13 +381,13 @@
})
}else{
this.$message({
message: '请填写完整表单',
message: this.errMsg,
type: 'error'
});
this.$emit('addListenSave',{
status: false,
setTimeNodeList: this.setTimeNodeList,
message: '请填写完整表单'
message: this.errMsg
})
}
}
......@@ -398,8 +400,6 @@
//开始校验
this.checkStart();
if(this.isValied){
let timeNo = this.setTimeNodeList[this.activeTab].timeNo;
this.checkIsRepeat(timeNo);
// 校验通过后,切换tab并且增加初始化list一个item
let newTabName = ++this.activeTab + '';
this.initNewForm();
......@@ -407,8 +407,9 @@
// 新增成功之后
this.setTimeNodeList = this.sortKey(this.setTimeNodeList,'timeNo');
}else{
this.errMsg = '请填写完整表单';
this.$message({
message: '请填写完整表单',
message: this.errMsg,
type: 'error'
});
}
......@@ -417,9 +418,10 @@
deleteTimeNode(index) {
let listLen = this.setTimeNodeList.length;
if(listLen<=1){
this.errMsg = '至少选择一个时间节点';
this.$message({
message: '至少选择一个时间节点',
type: 'warning'
message: this.errMsg,
type: 'error'
});
return;
}else{
......@@ -443,29 +445,31 @@
console.log(pushData)
// 如果选了推送时间,没选漫画
if(len && (startDays!==''&&startDays >= 0) && !resourceId){
this.errMsg = '请选择推送的患教漫画';
this.$message({
message: '请选择推送的患教漫画',
message: this.errMsg,
type: 'error'
});
if(type=='save'){
this.$emit('addListenSave',{
status: false,
setTimeNodeList: this.setTimeNodeList,
message: '请选择推送的患教漫画'
message: this.errMsg
})
}
return false;
}else if(len && startDays === '' && resourceId){
//如果选了漫画,没选推送时间
this.errMsg = '请选择推送时间';
this.$message({
message: '请选择推送时间',
message: this.errMsg,
type: 'error'
});
if(type=='save'){
this.$emit('addListenSave',{
status: false,
setTimeNodeList: this.setTimeNodeList,
message: '请选择推送时间'
message: this.errMsg
})
}
return false;
......@@ -482,11 +486,14 @@
if(!isValied){
this.activeTab = i + '';
this.isValied = false;
this.errMsg = '请填写完整表单';
return;
}else{
this.isValied = true
}
}
let timeNo = this.setTimeNodeList[this.activeTab].timeNo;
this.checkIsRepeat(timeNo);
},
// 表单验证
valiedForm(form){
......@@ -510,17 +517,18 @@
},
// 检查是否重复
checkIsRepeat(val){
this.setTimeNodeList.forEach((item,index)=>{
if(this.activeTab!=index && val==item.timeNo){
for(let i=0;i<this.setTimeNodeList.length;i++){
if(this.activeTab!=i && val==this.setTimeNodeList[i].timeNo){
this.isValied = false;
this.errMsg = '时间节点重复';
this.$message({
message: '时间节点重复',
type: 'warning'
message: this.errMsg,
type: 'error'
});
this.isValied = false;
this.setTimeNodeList[this.activeTab].timeNo = '';
return;
}
})
}
},
// 是否禁用按钮
itemIsDisabled(item){
......@@ -680,7 +688,7 @@
showTabLabel(item){
let str;
if(this.isStandedTemplate || this.planId){
str = item.timeStr;
str = item.timeStr ? item.timeStr : '设置时间节点';
}else{
if(item.timeNo){
str = '开始后' + String(item.timeNo) + this.timeUnitStr
......@@ -688,15 +696,6 @@
str = '设置时间节点'
}
}
// if(!this.isStandedTemplate && !this.planId){
// if(item.timeNo){
// str = '开始后' + String(item.timeNo) + this.timeUnitStr
// }else{
// str = '设置时间节点'
// }
// }else{
// str = '开始后' + String(item.timeNo) + this.timeUnitStr
// }
return str
},
},
......
......@@ -6,124 +6,58 @@
:curmbThird="'录入量表'"
/>
<div class="resident-content f-main-content screenSet">
<!--渲染不同的模块表单-->
<div v-for="(item, index) in addComponents">
<div class="content-box" >
<div class="title">{{item.title}}</div>
<el-form ref="form" :model="form" label-width="120px">
<div class="form-box">
<el-row>
<!--渲染不同的表单内部分类字段-->
<el-col v-for="(item2, index) in item.dataSource"
:span="item2.spanNum ? item2.spanNum : spanNum"
:class="item2.className"
:offset="item2.offset"
:push="item2.push"
:key="index" >
<el-form-item
v-if="isParent(item2)"
:prop="item2.prop"
:label="item2.label"
:rules="item2.rules"
:label-width="item2.labelWidth"
:required="item2.required"
:class="item2.className"
:error="item2.error">
<component
:is="item.name"
:key="index"
:dataSource="item2"
/>
</el-form-item>
</el-col>
</el-row>
<div>
<el-row :gutter="24">
<el-col :span="20"><div class="grid-content bg-purple">脑卒中患者随访服务记录表</div></el-col>
<el-col :span="4">
<div class="grid-content bg-purple">
<el-button class="button-white" size="small" plain @click="">暂存</el-button>
<el-button type="primary" size="small" @click="">提交</el-button>
</div>
</el-form>
</div>
</el-col>
</el-row>
</div>
<el-row :gutter="24">
<el-col :span="4"><div class="grid-content bg-purple">居民:戴家康</div></el-col>
<el-col :span="12"><div class="grid-content bg-purple">身份证号:31021212121212121212</div></el-col>
<el-col :span="8"><div class="grid-content bg-purple">随访计划名称:2018年河北省脑卒中随访</div></el-col>
</el-row>
<!--模板页面除了显示居民基本信息,将病种展示作为组件引入-->
<!--脑卒中-->
<stroke />
<!--高血压-->
</div>
</div>
</template>
<script>
import BreadCrumb from '@/components/breadcrumb'
import HelpChecking from '@/components/followup/form/helpChecking'
import LifeStyleGuide from '@/components/followup/form/lifeStyleGuide'
import MedicalStateUsing from '@/components/followup/form/medicalStateUsing'
import Sign from '@/components/followup/form/sign'
import Symptom from '@/components/followup/form/symptom'
import dataSourceSymptom from '@/model/dataSourceSymptom'
import dataSourceSign from '@/model/dataSourceSign'
import dataSourceLifeStyleGuide from '@/model/dataSourceLifeStyleGuide'
import dataSourceHelpChecking from '@/model/dataSourceHelpChecking'
import dataSourceMedicalStateUsing from '@/model/dataSourceMedicalStateUsing'
// 糖尿病
import stroke from './patient-scale/stroke'
export default {
components: {
Symptom,//症状
Sign,//体征
LifeStyleGuide,//生活方式指导
HelpChecking,//辅助检查
MedicalStateUsing,//用药情况
stroke,
//以下是非组件
BreadCrumb,
},
data(){
return {
spanNum: 12,
valueFormat: 'timestamp',
format: 'yyyy-MM-dd HH:mm',
dateType: 'datetime',
form: {},
addComponents: [
{name: 'Symptom',dataSource:dataSourceSymptom, title: '症状'},
{name: 'Sign',dataSource:dataSourceSign, title: '体征'},
{name: 'LifeStyleGuide',dataSource:dataSourceLifeStyleGuide, title: '生活方式指导'},
{name: 'HelpChecking',dataSource:dataSourceHelpChecking, title: '辅助检查'},
{name: 'MedicalStateUsing',dataSource:dataSourceMedicalStateUsing, title: '用药情况'},
],
//量表结果集合
dataSource: {
AcuteBrainVeinThrombolytic: {},
Lifestyle: {}
},
// //量表结果集合
// dataSource: {
// AcuteBrainVeinThrombolytic: {},
// Lifestyle: {}
// },
}
},
created(){
},
methods: {
defaultFun() {},
isParent(item) {
if (!item.linkageRule) {
return true
} else {
let num = 0
item.linkageRule.forEach(t => {
if (this.form[t.name] == null) {
return false
}
if (typeof this.form[t.name] === 'string') {
if (t.value.includes(this.form[t.name])) {
num += 1
}
} else {
const nameVal = this.form[t.name]
const valType = _.isArray(nameVal) ? nameVal : Array.of(nameVal)
const bool = _.intersection(valType, t.value)
if (_.isArray(bool) && bool.length > 0) {
num += 1
}
}
})
if (num !== item.linkageRule.length) {
delete this.form[item.model]
}
return num === item.linkageRule.length
}
}
}
}
</script>
......
export default [
{
formType: 'radio',
// className: 'clear-left',
prop: 'm1',
model: 'm1',
spanNum: 24,
label: '调查时状态',
options: [
{ label: '接受', value: '1' },
{ label: '失访', value: '2' },
{ label: '死亡', value: '3' }
],
rules: [{ required: true, message: '请选择调查时状态', trigger: 'blur' }]
},
{
formType: 'radio',
// className: 'clear-left',
prop: 'm1',
model: 'm2',
spanNum: 24,
label: '失访原因',
linkageRule: [{ name: 'm1', value: ['2'] }],
options: [
{ label: '失去联系', value: '1' },
{ label: '拒绝参加调查', value: '2' },
{ label: '其他', value: '3' }
],
rules: [{ required: true, message: '请选择失访原因', trigger: 'blur' }]
},
{
formType: 'input',
linkageRule: [
{
name: 'm2',
value: ['3']
}
],
prop: 'm3',
model: 'm3',
label: '其他',
disabled: false,
placeholder: '请输入其他原因',
spanNum: 12,
type: 'number',
labmsg: '',
// slots: [{ name: 'mmol/L', type: 'append' }]
},
]
export default [
{
formType: 'date-picker',
prop: 'screeningTime',
model: 'screeningTime',
placeholder: '选择日期时间',
label: '随访日期',
format: 'yyyy-MM-dd',
type: 'date',
rules: [{ required: true, message: '请选择日期时间', trigger: 'blur' }]
},
{
formType: 'radio',
model: '111',
label: '随访方式',
disabled: false,
placeholder: '150',
spanNum: 24,
options: [
{ label: '门诊', value: '1', disabled: false },
{ label: '家庭', value: '2', disabled: false },
{ label: '电话', value: '3', disabled: false },
],
rules: [{ required: true, message: '请选择随访方式', trigger: 'blur' }]
},
]
export default [
{
formType: 'date-picker',
prop: 'screeningTime',
model: 'screeningTime',
placeholder: '选择日期时间',
label: '随访日期',
format: 'yyyy-MM-dd',
type: 'date',
rules: [{ required: true, message: '请选择日期时间', trigger: 'blur' }]
},
{
formType: 'radio',
model: 'radioVal',
label: '随访方式',
disabled: false,
placeholder: '150',
spanNum: 24,
options: [
{ label: '门诊', value: '1', disabled: false },
{ label: '家庭', value: '2', disabled: false },
{ label: '电话', value: '3', disabled: false },
],
rules: [{ required: true, message: '请选择随访方式', trigger: 'blur' }]
},
]
<template>
<div>
<!--渲染不同的模块表单-->
<div v-for="(item, index) in addComponents">
<div class="content-box" >
<div class="title">{{item.title}}</div>
<el-form ref="form" :model="form" label-width="120px">
<FormScale :dataSource="item.dataSource" :form="form" />
</el-form>
</div>
</div>
</div>
</template>
<script>
// 量表 template
import FormScale from '@/components/followup/form/index'
// 量表模块数据模型
import dataSourceBaseInfo from '../models/stroke/dataSourceBaseInfo'
import dataSourceDataType from '../models/stroke/dataSourceDataType'
import dataSourceSymptom from '../models/stroke/dataSourceSymptom'
import dataSourceSign from '../models/stroke/dataSourceSign'
import dataSourceLifeStyleGuide from '../models/stroke/dataSourceLifeStyleGuide'
import dataSourceHelpChecking from '../models/stroke/dataSourceHelpChecking'
import dataSourceMedicalStateUsing from '../models/stroke/dataSourceMedicalStateUsing'
export default {
components: {
FormScale,
},
data(){
return {
addComponents: [
{name: 'BaseInfo',dataSource:dataSourceBaseInfo, title: '基本信息'},
{name: 'DataType',dataSource:dataSourceDataType, title: '日期与方式'},
{name: 'Symptom',dataSource:dataSourceSymptom, title: '症状'},
{name: 'Sign',dataSource:dataSourceSign, title: '体征'},
{name: 'LifeStyleGuide',dataSource:dataSourceLifeStyleGuide, title: '生活方式指导'},
{name: 'HelpChecking',dataSource:dataSourceHelpChecking, title: '辅助检查'},
{name: 'MedicalStateUsing',dataSource:dataSourceMedicalStateUsing, title: '用药情况'},
],
form: {
symptomList: [],//checkbox 症状
inputVal: '',
radioVal: ''
},
}
},
}
</script>
<style scoped lang="scss">
</style>
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册