var template = '' $.ajax('../../../component/statistics/LascModifyPatient/index.html', { data: {}, dataType: 'html', cache: false, timeout: 60000, async: false, error: function (res) {}, success: function (res) { template = res } }) Vue.component('lasc-modify-patient', { template: template, name: 'lasc-modify-patient', props: { currentInfo: {} }, data: function () { return { form: { baseinfo:{ sickName: '', age: '', nation: '', nationName: '', birthday: '', sex: '', phone: '', address: '', womenCategory: '', accountFeeType: '', unitName:'', height:'', weight:'', edu:'', monthlyIncome:'', vaccinationHpv:'' }, disease: { menophagia: '', menophagiaAge: '', hysterectomy: '', hysterectomyAge: '', menopause: '', menopauseAge: '', copd: '', copdAge: '', }, fertility: { menophaniaAge: '', menopause: '', lmp:'', miscarriage:'', reproductiveHistory:'', breastCancerFir:'', breastCancerSec:'', partusMaturus:'', prematureDelivery:'', firstDeliveryAge:'', breastCancerSecNum:'', oophoromaNum:'', cervicalCancerFir:'', brcaGeneticTesting:'', chestRadiotherapy:'', chestRadiotherapy:'', hormoneUseMonth:'', breastBiopsySurgery:'', oophoromaSec:'', breastSurgeryNum:'', breastSurgeryResult:'', accessoryExcision:'', hysterectomy:'', hysterectomyAge:'', contraceptiveOtherMethod:'', contraceptiveMethod:'', accessoryExcision:'', contactBleeding:'', irregularVaginalBleeding:'' } }, menophaniaAgeList: [], selAddress: '', // 默认值 selectedStreet: '', areaList: areaDataArr, areaOptions: [], // 地区数据 rules: {}, streetList: [], cascaderProps: { value: 'value', label: 'label', children: 'children', expandTrigger: 'hover', checkStrictly: true, // 可以只选父级 emitPath: true // 只返回最后一级的值 }, currentStreet:[] } }, methods: { getTableInfo(){ var vm = this; vm.selectedStreet=''; vm.selAddress='' vm.form={ baseinfo:{ sickName: '', age: '', nation: '', nationName: '', birthday: '', sex: '', phone: '', address: '', womenCategory: '', accountFeeType: '', unitName:'', height:'', weight:'', edu:'', monthlyIncome:'', vaccinationHpv:'' }, disease: { menophagia: '', menophagiaAge: '', hysterectomy: '', hysterectomyAge: '', menopause: '', menopauseAge: '', copd: '', copdAge: '', }, fertility: { menophaniaAge: '', menopause: '', lmp:'', miscarriage:'', reproductiveHistory:'', breastCancerFir:'', breastCancerSec:'', partusMaturus:'', prematureDelivery:'', firstDeliveryAge:'', breastCancerSecNum:'', oophoromaNum:'', cervicalCancerFir:'', brcaGeneticTesting:'', chestRadiotherapy:'', chestRadiotherapy:'', hormoneUseMonth:'', breastBiopsySurgery:'', oophoromaSec:'', breastSurgeryNum:'', breastSurgeryResult:'', accessoryExcision:'', hysterectomy:'', hysterectomyAge:'', contraceptiveOtherMethod:'', contraceptiveMethod:'', accessoryExcision:'', contactBleeding:'', irregularVaginalBleeding:'' } } var params={ id:'', // 表单id screenId:this.currentInfo.id,// 筛查id type:'1' //表单类型 } httpRequest.get('doctor/twoCancers/count/tableDetail', { data: params }).then(function (res) { if (res.status == 200) { if(res.obj.baseinfo){ vm.form.baseinfo=res.obj.baseinfo _.filter(vm.areaList.city_list, function (v, k) { if (v.indexOf(vm.form.baseinfo.sickCity) === 0) { vm.selAddress=k; } }) vm.getStreetData(vm.selAddress,vm.form.baseinfo.sickStreet) } if(res.obj.disease){ vm.form.disease=res.obj.disease } if(res.obj.fertility){ vm.form.fertility=res.obj.fertility } // vm.form = res.obj; } }) }, // 编辑 updJkCopdPatient() { var vm =this var params = { baseInfoJson:JSON.stringify(this.form.baseinfo), fertilityJson:JSON.stringify(this.form.fertility), cervicalDiseaseHistoryJson:JSON.stringify(this.form.disease) } httpRequest.post('doctor/twoCancers/updBaseInfoSave', { data: params }).then(function (res) { console.log('333333333333333',res) if(res.status==200){ toastr.error("保存成功") vm.getTableInfo() }else{ toastr.error(res.msg) } }) }, getStreetData(cityCode,streetName) { console.log('1111111111111111',cityCode,streetName) var cityCode = cityCode.substring(0, 4) var streetList = [] _.filter(this.areaList.county_list, function (v, k) { if (k.indexOf(cityCode) === 0) { streetList.push({ value: k, label: v, children: [] }) } }) this.streetList = streetList console.log(this.streetList, ';;;;;;;;;;;;;;;;;;;;;;;') this.streetList.map(item => { this.fetchStreetList(item) }) var currentStreet = this.currentStreet setTimeout(() => { currentStreet.forEach(item1 => { if (item1.name == streetName) { this.selectedStreet = item1.code } }) }, 1000) }, handleItemChange(item) { var sickProvince = ''; var sickCity = '' _.filter(this.areaList.province_list, function (v, k) { if (k.indexOf(item[0]) === 0) { sickProvince=v||'' } }) _.filter(this.areaList.city_list, function (v, k) { if (k.indexOf(item[1]) === 0) { sickCity=v||'' } }) this.form.baseinfo.sickProvince = sickProvince this.form.baseinfo.sickCity = sickCity this.form.baseinfo.sickCounty = '' this.form.baseinfo.sickStreet = '' this.selSickStreet = '' var cityCode = (item[1] || '').substring(0, 4) var streetList = [] _.filter(this.areaList.county_list, function (v, k) { if (k.indexOf(cityCode) === 0) { streetList.push({ value: k, label: v, children: [] }) } }) this.streetList = streetList console.log(this.streetList, ';;;;;;;;;;;;;;;;;;;;;;;') this.streetList.map(item => { this.fetchStreetList(item) }) console.log('111111111111111112222222222222222',this.currentStreet) }, loadAreaData() { this.areaOptions = Object.keys(this.areaList.province_list).map(provinceCode => ({ value: provinceCode, label: this.areaList.province_list[provinceCode], children: this.getCityChildren(provinceCode) })) }, // 获取城市子节点 getCityChildren(provinceCode) { const prefix = provinceCode.substring(0, 2) return Object.keys(this.areaList.city_list) .filter(cityCode => cityCode.startsWith(prefix)) .map(cityCode => ({ value: cityCode, label: this.areaList.city_list[cityCode] })) }, fetchStreetList(item) { var vm = this var params = { town: item.value } httpRequest.get('doctor/sign/getStreetListByTown', { data: params }).then(function (res) { if (res.status == 200) { res.data.forEach(element => { vm.currentStreet.push(element) }); var children = !res.data || !res.data.length ? [] : _.map(res.data, function (v) { return { label: v.name, value: v.code } }); } item.children = children }) }, handleStreetChange(item){ this.form.baseinfo.sickCounty= this.areaList.county_list[item[0]] this.currentStreet.forEach(element => { if(element.code==item[1]){ this.form.baseinfo.sickStreet= element.name } }); } }, watch: { currentInfo: { handler(newVal, oldVal) { if (newVal) { this.getTableInfo(); } }, deep: true } }, mounted() { console.log('currentInfocurrentInfo: ', this.currentInfo) // this.form = this.currentInfo for (var i = 8; i < 21; i++) { this.menophaniaAgeList.push(i) } this.loadAreaData() this.getTableInfo(); console.log('3333333333333333333333333',this) } })