提交 1cdca983 编写于 作者: yi.li's avatar yi.li

地区回显问题

上级 a44787b2
......@@ -32,200 +32,203 @@
</el-input>
</el-form-item>
</el-col>
<el-col :span="24" style="text-align: center;margin-top:15px;" v-if="!patientId"> <el-button plain size="small" @click="toggleClick">{{tipsText}}</el-button></el-col>
</el-row>
<div class="has-header">数据记录</div>
<el-row>
<el-col :span="12">
<el-form-item label="诊断" prop="diseaseIdList">
<el-select
v-model="diseaseIdList"
multiple
@change="changeDiseases"
placeholder="请选择居民疾病诊断">
<el-option
v-for="(item, index) in diseasesList"
:key="index"
:label="item.diseaseName"
:value="item.diseaseId">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="分组" prop="labelIdList">
<el-select
v-model="labelIdList"
multiple
@change="changeLabels"
placeholder="请选择居民分组">
<el-option
v-for="(item, index) in labelsList"
:key="index"
:label="item.labelName"
:value="item.labelId">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<div class="has-header">基本信息</div>
<el-row>
<el-col :span="12">
<el-form-item label="身份证" prop="idNo">
<el-input
v-model="patientInfoForm.idNo"
placeholder="请输入身份证"
clearable
maxlength="18"
@blur="idNoBlurHandler"
:disabled="hasIdNo">
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="出生日期" prop="birthTime">
<el-date-picker
type="date"
v-model="patientInfoForm.birthTime"
placeholder="请选择出生日期"
value-format="yyyy-MM-dd"
value="yyyy-MM-dd"
@change="getAge"
style="width:250px"
clearable>
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="年龄" prop="age">
<span>{{(patientInfoForm.age || patientInfoForm.age == 0) ? `${patientInfoForm.age}岁` : '-'}}</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="性别" prop="sex">
<el-radio-group v-model="patientInfoForm.sex">
<el-radio :label="1"></el-radio>
<el-radio :label="2"></el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="常驻类型" prop="permanentResidence">
<el-select
v-model="patientInfoForm.permanentResidence"
placeholder="请选择居民常驻类型"
clearable>
<el-option
v-for="(item, index) in residenceList"
:key="index"
:label="item.value"
:value="item.noChar">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="民族" prop="nationality">
<el-select
v-model="patientInfoForm.nationality"
placeholder="请选择民族"
clearable>
<el-option
v-for="(item, index) in nationsList"
:key="index"
:label="item.name"
:value="item.code">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="医保号" prop="socialCard">
<el-input
v-model="patientInfoForm.socialCard"
placeholder="请输入居民医保卡号码"
maxlength="30"
clearable>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="健康档案编号" prop="fileLocator">
<el-input
v-model="patientInfoForm.fileLocator"
placeholder="请输入居民健康档案编号"
maxlength="30"
clearable>
</el-input>
</el-form-item>
</el-col>
</el-row>
<div class="has-header">联系方式</div>
<el-row>
<el-col :span="12">
<el-form-item label="所在地区" prop="addressList">
<el-cascader
placeholder="请选择省市县乡"
:options="provinceList"
v-model="addressList"
@active-item-change="handleItemChange"
:props="optionProps">
</el-cascader>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="详细地址" prop="address">
<el-input
v-model="patientInfoForm.address"
placeholder="请输入居民的详细地址"
maxlength="50"
clearable>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="工作单位" prop="workplace">
<el-input
v-model="patientInfoForm.workplace"
placeholder="请输入居民的工作单位"
maxlength="30"
clearable>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12" v-if="patientId">
<el-form-item label="微信" prop="address">
<p class="info" v-if="patientInfoForm.isWechatBind == '1'">未绑定 <el-button type="text" class="ml10" @click="remindBind" v-if="patientInfoForm.isRemind == '1'" style="color: #449284;">提醒绑定</el-button><span class="ml10" v-if="patientInfoForm.isRemind == '2'">已提醒</span></p>
<!--<p class="info" v-else-if="patientInfoForm.isWechatBind == '2'">已绑定 <span class="ml10">(微信名:{{patientInfoForm.wechatNickname | emptyFilter}}</span></p>-->
<p class="info" v-else-if="patientInfoForm.isWechatBind == '2'">{{patientInfoForm.wechatNickname | emptyFilter}}</p>
</el-form-item>
</el-col>
</el-row>
<div class="has-header">其他</div>
<el-row>
<el-col :span="16">
<el-form-item label="备注" prop="remark">
<el-input
type="textarea"
v-model="patientInfoForm.remark"
placeholder="请输入内容"
clearable
maxlength="200"
:autosize="{ minRows: 3, maxRows: 7}"
show-word-limit>
</el-input>
<span class="text-count">{{currentCount}} / 200</span>
</el-form-item>
</el-col>
</el-row>
<div v-show="isShowAll || patientId">
<div class="has-header">数据记录</div>
<el-row>
<el-col :span="12">
<el-form-item label="诊断" prop="diseaseIdList">
<el-select
v-model="diseaseIdList"
multiple
@change="changeDiseases"
placeholder="请选择居民疾病诊断">
<el-option
v-for="(item, index) in diseasesList"
:key="index"
:label="item.diseaseName"
:value="item.diseaseId">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="分组" prop="labelIdList">
<el-select
v-model="labelIdList"
multiple
@change="changeLabels"
placeholder="请选择居民分组">
<el-option
v-for="(item, index) in labelsList"
:key="index"
:label="item.labelName"
:value="item.labelId">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<div class="has-header">基本信息</div>
<el-row>
<el-col :span="12">
<el-form-item label="身份证" prop="idNo">
<el-input
v-model="patientInfoForm.idNo"
placeholder="请输入身份证"
clearable
maxlength="18"
@blur="idNoBlurHandler"
:disabled="hasIdNo">
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="出生日期" prop="birthTime">
<el-date-picker
type="date"
v-model="patientInfoForm.birthTime"
placeholder="请选择出生日期"
value-format="yyyy-MM-dd"
value="yyyy-MM-dd"
@change="getAge"
style="width:250px"
clearable>
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="年龄" prop="age">
<span>{{(patientInfoForm.age || patientInfoForm.age == 0) ? `${patientInfoForm.age}岁` : '-'}}</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="性别" prop="sex">
<el-radio-group v-model="patientInfoForm.sex">
<el-radio :label="1"></el-radio>
<el-radio :label="2"></el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="常驻类型" prop="permanentResidence">
<el-select
v-model="patientInfoForm.permanentResidence"
placeholder="请选择居民常驻类型"
clearable>
<el-option
v-for="(item, index) in residenceList"
:key="index"
:label="item.value"
:value="item.noChar">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="民族" prop="nationality">
<el-select
v-model="patientInfoForm.nationality"
placeholder="请选择民族"
clearable>
<el-option
v-for="(item, index) in nationsList"
:key="index"
:label="item.name"
:value="item.code">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="医保号" prop="socialCard">
<el-input
v-model="patientInfoForm.socialCard"
placeholder="请输入居民医保卡号码"
maxlength="30"
clearable>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="健康档案编号" prop="fileLocator">
<el-input
v-model="patientInfoForm.fileLocator"
placeholder="请输入居民健康档案编号"
maxlength="30"
clearable>
</el-input>
</el-form-item>
</el-col>
</el-row>
<div class="has-header">联系方式</div>
<el-row>
<el-col :span="12">
<el-form-item label="所在地区" prop="addressList">
<el-cascader
placeholder="请选择省市县乡"
:options="provinceList"
v-model="addressList"
@active-item-change="handleItemChange"
:props="optionProps">
</el-cascader>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="详细地址" prop="address">
<el-input
v-model="patientInfoForm.address"
placeholder="请输入居民的详细地址"
maxlength="50"
clearable>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="工作单位" prop="workplace">
<el-input
v-model="patientInfoForm.workplace"
placeholder="请输入居民的工作单位"
maxlength="30"
clearable>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12" v-if="patientId">
<el-form-item label="微信" prop="address">
<p class="info" v-if="patientInfoForm.isWechatBind == '1'">未绑定 <el-button type="text" class="ml10" @click="remindBind" v-if="patientInfoForm.isRemind == '1'" style="color: #449284;">提醒绑定</el-button><span class="ml10" v-if="patientInfoForm.isRemind == '2'">已提醒</span></p>
<!--<p class="info" v-else-if="patientInfoForm.isWechatBind == '2'">已绑定 <span class="ml10">(微信名:{{patientInfoForm.wechatNickname | emptyFilter}}</span></p>-->
<p class="info" v-else-if="patientInfoForm.isWechatBind == '2'">{{patientInfoForm.wechatNickname | emptyFilter}}</p>
</el-form-item>
</el-col>
</el-row>
<div class="has-header">其他</div>
<el-row>
<el-col :span="16">
<el-form-item label="备注" prop="remark">
<el-input
type="textarea"
v-model="patientInfoForm.remark"
placeholder="请输入内容"
clearable
maxlength="200"
:autosize="{ minRows: 3, maxRows: 7}"
show-word-limit>
</el-input>
<span class="text-count">{{currentCount}} / 200</span>
</el-form-item>
</el-col>
</el-row>
</div>
</el-form>
</div>
</template>
......@@ -304,22 +307,23 @@
},
hasIdNo: false,
validStatus: false,
rules: {
nickname: [{required: true, message: '请输入居民姓名', trigger: ['change', 'blur'] }],
mobilePhone: [{required: true, message: '请输入手机号', trigger: ['change', 'blur'] },{ validator: checkMobile , trigger: ['blur','change'] }],
idNo: [{required: false,validator: checkCardNum, trigger: ['change'] }],
},
optionProps: {
value: "id",
label: "name",
children: "children"
},
provinceList: [],
provinceLists: [], //省列表
cityLists: [], //市列表
countyLists: [], //县列表
townLists: [],//乡镇列表
optionProps: {
value: "id",
label: "name",
children: "children"
},
tipsText: '展开录入完整信息',
isShowAll: false,
rules: {
nickname: [{required: true, message: '请输入居民姓名', trigger: ['change', 'blur'] }],
mobilePhone: [{required: true, message: '请输入手机号', trigger: ['change', 'blur'] },{ validator: checkMobile , trigger: ['blur','change'] }],
idNo: [{required: false,validator: checkCardNum, trigger: ['change'] }],
},
}
},
props: {
......@@ -328,72 +332,86 @@
patientId: String,
},
watch: {
patientInfoObj(val){
if(this.patientId){
this.patientInfoForm = val;
this.baseInfoEdit = this.patientInfoForm.baseInfoEdit;
let customLabels = this.patientInfoForm.customLabels;
let diseases = this.patientInfoForm.diseases;
if(customLabels && customLabels.length > 0){
customLabels.forEach((kkk)=>{
this.labelIdList.push(Number(kkk.labelId))
})
}else {
this.labelIdList = [];
}
if(diseases && diseases.length > 0) {
diseases.forEach((dis)=>{
this.diseaseIdList.push(Number(dis.diseaseId))
})
}else {
this.diseaseIdList = [];
}
if(this.patientInfoForm.idNo) {
this.hasIdNo = true;
}else {
this.hasIdNo = false;
}
//对地区数据做处理
if(this.patientInfoForm.patientAddress) {
this.addressList[0] = parseInt(this.patientInfoForm.provinceId);
this.addressList[1] = parseInt(this.patientInfoForm.cityId);
this.addressList[2] = parseInt(this.patientInfoForm.countyId);
this.addressList[3] = parseInt(this.patientInfoForm.townId);
// this.addressList = JSON.parse(this.addressList);
// const obj = await searchObj(id).then(res => res);
patientInfoObj: {
async handler(val) {
if(this.patientId){
this.patientInfoForm = val;
this.baseInfoEdit = this.patientInfoForm.baseInfoEdit;
let customLabels = this.patientInfoForm.customLabels;
let diseases = this.patientInfoForm.diseases;
if(customLabels && customLabels.length > 0){
customLabels.forEach((kkk)=>{
this.labelIdList.push(Number(kkk.labelId))
})
}else {
this.labelIdList = [];
}
if(diseases && diseases.length > 0) {
diseases.forEach((dis)=>{
this.diseaseIdList.push(Number(dis.diseaseId))
})
}else {
this.diseaseIdList = [];
}
if(this.patientInfoForm.idNo) {
this.hasIdNo = true;
}else {
this.hasIdNo = false;
}
//对地区数据做处理
if(this.patientInfoForm.patientAddress) {
let provinceId = this.patientInfoForm.provinceId;
let cityId = this.patientInfoForm.cityId;
let countyId = this.patientInfoForm.countyId;
let townId = this.patientInfoForm.townId;
await this.getCity(provinceId);
await this.getCounty(provinceId, cityId);
await this.getTown(provinceId, cityId, countyId);
await setTimeout(() => {
this.addressList[0] = parseInt(provinceId);
this.addressList[1] = parseInt(cityId);
this.addressList[2] = parseInt(countyId);
this.addressList[3] = parseInt(townId);
},10);
this.$forceUpdate();
}else {
this.addressList = [];
}
// this.$refs['patientInfoForm'].clearValidate();
}else {
this.addressList = [];
}
this.$refs['patientInfoForm'].clearValidate();
this.$forceUpdate();
}else {
// 新增
this.patientInfoForm = {
nickname: '',
mobilePhone: '',
diseases: [],
patientDiseases: [],
customLabels: [],
idNo: '',
birthTime: '',
age: '',
sex: null,
permanentResidence: '',
nationality: '',
socialCard: '',
fileLocator: '',
isWechatBind: null,
isRemind: null,
wechatNickname: '',
remark: '',
patientAddress: '',
address: '',
workplace: '',
provinceId: null,
cityId: null,
countyId: null,
townId: null,
// 新增
this.patientInfoForm = {
nickname: '',
mobilePhone: '',
diseases: [],
patientDiseases: [],
customLabels: [],
idNo: '',
birthTime: '',
age: '',
sex: null,
permanentResidence: '',
nationality: '',
socialCard: '',
fileLocator: '',
isWechatBind: null,
isRemind: null,
wechatNickname: '',
remark: '',
patientAddress: '',
address: '',
workplace: '',
provinceId: null,
cityId: null,
countyId: null,
townId: null,
}
}
}
},
deep: true,
},
checkForm(val){
if(val){// 触发校验
......@@ -597,8 +615,8 @@
}
this.$forceUpdate();
},
getProvinceLists() {
getProvinceList({}).then((data) => {
async getProvinceLists() {
await getProvinceList({}).then((data) => {
if(data.code == '000000') {
this.provinceLists = data.data.provinceList;
this.provinceLists.map(item => {
......@@ -607,11 +625,12 @@
this.$set(item, "children", []);
});
this.provinceList = this.provinceLists;
// this.$forceUpdate();
}
})
},
getCity(provinceId) {
getCityList({provinceId: provinceId}).then((data) => {
async getCity(provinceId) {
await getCityList({provinceId: provinceId}).then((data) => {
if(data.code == '000000') {
this.cityLists = data.data.cityList;
this.cityLists.map(item => {
......@@ -624,11 +643,12 @@
item.children = this.cityLists;
}
})
// this.$forceUpdate();
}
})
},
getCounty(provinceId, cityId) {
getCountyList({cityId: cityId}).then((data) => {
async getCounty(provinceId, cityId) {
await getCountyList({cityId: cityId}).then((data) => {
if(data.code == '000000') {
this.countyLists = data.data.countyList;
this.countyLists.map(item => {
......@@ -643,11 +663,12 @@
})
}
})
// this.$forceUpdate();
}
})
},
getTown(provinceId, cityId, countyId) {
getTownList({countyId: countyId}).then((data) => {
async getTown(provinceId, cityId, countyId) {
await getTownList({countyId: countyId}).then((data) => {
if(data.code == '000000') {
this.townLists = data.data.townList;
this.townLists.map(item => {
......@@ -667,8 +688,18 @@
}
})
}
// this.$forceUpdate();
})
},
toggleClick() {
if(this.isShowAll) {
this.tipsText = '展开录入完整信息';
this.isShowAll = false;
}else {
this.tipsText = '收起录入完整信息';
this.isShowAll = true;
}
}
},
filters: {
emptyFilter: function(value) {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册