123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369 |
- // 慢阻肺患者档案-编辑
- var template = ''
- $.ajax('../../../component/statistics/CopdPatientRecordEdit/index.html',{
- data: {},
- dataType: 'html',
- cache: false,
- timeout: 60000,
- async: false,
- error: function(res) {
- },
- success: function(res) {
- template = res
- }
- })
- let vm
- Vue.component('copd-patient-record-edit', {
- template: template,
- props: ['editData'],
- data() {
- return {
- formData:{},
- nationDict:[],
- dicName:['jkcopd_followup_status','jkcopd_isLive','jkcopd_first_area','jkcopd_first_org_level', 'jkcopd_marriage','jkcopd_occupation','jkcopd_smoke','jkcopd_drink','jkcopd_archivesStatus','jkcopd_disease_conversion','jkcopd_firstVisitType','jkcopd_educational','idCardType'],
- marriageArr:[],
- followupArr:[],
- idCardTypeArr:[],
- firstAreaArr:[],
- isLiveArr:[],
- orgLevelArr:[],
- occupationArr:[],
- smokeArr:[],
- drinkArr:[],
- archivesArr:[],
- conversionArr:[],
- firstVisitTypeArr:[],
- educationalArr:[],
- copdArr:[{value:'是',code:'1'},{value:'否',code:'0'}],
- addressOptions:[],
- props: {
- label: 'name',
- value: 'code',
- children: 'children'
- },
- addressVal:[],
- resiginAddressVal:[],
- docInfo: JSON.parse(window.localStorage.getItem('docInfo')),
- rules: {
- mobile:[
- { required: true, message: '请输入联系方式', trigger: 'blur' },
- { min: 11, max: 11, message: '请输入正确的联系方式', trigger: 'blur' }
- ]
- }
- }
- },
- created() {
- vm=this
- },
- watch:{
- 'formData.isLive':{
- handler:function(o) {
- if(o=='1'){
- this.formData.deathTime=''
- this.formData.deathReason=''
- }
- },
- deep: true,
- immediate: true
- },
- addressVal(value){
- console.log(value,'0000000000000000000000')
- }
- },
- mounted() {
- var vm=this
- this.formData= JSON.parse(window.localStorage.getItem('editDetail'))
- console.log(this.formData,'00000000000000000000000000000')
- if(this.formData.liveStreet){
- this.addressVal=[this.formData.liveProvince,this.formData.liveCity,this.formData.liveTown,this.formData.liveStreet]
- this.getDistrict(0)
- }else{
- this.addressVal=[this.formData.liveProvince,this.formData.liveCity,this.formData.liveTown]
- this.getDistrict(0)
- }
- this.getNation()
-
- if(this.formData.liveStreet){
- this.resiginAddressVal=[this.formData.registProvince,this.formData.registCity,this.formData.registTown,this.formData.registStreet]
- this.getDistrict(1)
- }else{
- this.resiginAddressVal=[this.formData.registProvince,this.formData.registCity,this.formData.registTown]
- this.getDistrict(1)
- }
- this.dicName.forEach(function(item) {
- vm.getDictByDictName(item)
- });
- },
- methods: {
- handleItemChange(val) {
- // 获取地址
- if (val.length == 1) {
- // 获取市
- this.baseCityList(val[0])
- }
- if (val.length == 2) {
- // 获取区
- this.baseTownList(val)
-
- }
- if (val.length == 3) {
- // 获取区
- this.stressList(val)
- }
-
- },
- //字典
- getDictByDictName(value){
- var vm=this
- statisticAPI.getDictByDictName({name:value}).then(function(res){
- if(value=='jkcopd_marriage'){
- vm.marriageArr=res.list
- }else if(value=='jkcopd_occupation'){
- vm.occupationArr=res.list
- }else if(value=='jkcopd_smoke'){
- vm.smokeArr=res.list
- }else if(value=='jkcopd_drink'){
- vm.drinkArr=res.list
- }else if(value=='jkcopd_archivesStatus'){
- vm.archivesArr=res.list
- }else if(value=='jkcopd_disease_conversion'){
- vm.conversionArr=res.list
- }else if(value=='jkcopd_firstVisitType'){
- vm.firstVisitTypeArr=res.list
- }else if(value=='jkcopd_educational'){
- vm.educationalArr=res.list
- }else if(value=='idCardType'){
- vm.idCardTypeArr=res.list
- }else if(value=='jkcopd_first_area'){
- vm.firstAreaArr=res.list
- }else if(value=='jkcopd_first_org_level'){
- vm.orgLevelArr=res.list
- }else if(value=='jkcopd_isLive'){
- vm.isLiveArr=res.list
- }else if(value=='jkcopd_followup_status'){
- vm.followupArr=res.list
- }
-
-
-
- })
-
- },
- getNation(){
- var vm=this
- statisticAPI.getNationDict().then(function(res){
- vm.nationDict= res.data
- })
- },
- getDistrict(id){
- var vm =this
- homeAPI.getDistrict({ type:1 ,code:'' }).then(function(res) {
- var detailModelList=res.list
- detailModelList.forEach(function(item){
- item.children = []
- })
- vm.addressOptions=detailModelList
- if(vm.formData.liveProvince&&id==0){
-
- vm.baseCityList(vm.formData.liveProvince,id)
- }
- if(vm.formData.registProvince&&id==1){
-
- vm.baseCityList(vm.formData.registProvince,id)
- }
- })
- },
- onClickNavLink(id) {
- var element = document.getElementById(id);
- var top = element.offsetTop;
- window.scrollTo({ top: top, behavior: 'smooth' });
- },
- //市
- baseCityList:function(code,id){
- var vm = this
- var activeIndex = null
- vm.addressOptions.forEach(function(item, index) {
- if (item.code == code) {
- activeIndex = index
- }
- })
- homeAPI.getDistrict({ type:2 ,code:code }).then(function(res) {
- if (res.status == 200) {
- var detailModelList = res.list
- detailModelList.forEach(item => {
- item.children = []
- })
- vm.addressOptions[activeIndex].children = detailModelList
- if(vm.addressVal.length&&id==0){
- vm.baseTownList([vm.addressVal[0], vm.addressVal[1]],id)
- }
- if(vm.resiginAddressVal.length&&id==1){
- vm.baseTownList([vm.resiginAddressVal[0], vm.resiginAddressVal[1]],id)
- }
- }
- })
- },
- //县
- baseTownList(val,id) {
- var vm = this
- var provinceIndex = null
- var activeIndex = null
- vm.addressOptions.forEach(function(item, index){
- if (item.code == val[0]) {
- var children = item.children
- provinceIndex = index
- children.forEach(function(item, idx) {
- if (item.code == val[1]) {
- activeIndex = idx
- }
- })
- }
- })
- homeAPI.getDistrict({ type:3,code:val[1] }).then( function(res){
- if (res.status == 200) {
- var detailModelList = res.list
- if(val[1]=='350200'){
- detailModelList.forEach(function(item){
- item.children = []
- })
- }
- if (vm.addressOptions[provinceIndex].children[activeIndex]) {
- vm.addressOptions[provinceIndex].children[activeIndex].children = detailModelList
- if(vm.addressVal.length&&id==0){
- vm.stressList([vm.addressVal[0], vm.addressVal[1],vm.addressVal[2]])
- }
- if(vm.resiginAddressVal.length&&id==1){
- vm.stressList([vm.resiginAddressVal[0], vm.resiginAddressVal[1],vm.resiginAddressVal[2]])
-
- }
- }
- }
- })
- },
- //街道
- stressList(val) {
- var vm = this
- var provinceIndex = null
- var activeIndex = null
- var xIndex=null
- vm.addressOptions.forEach(function(item, index) {
- if (item.code == val[0]) {
- var children = item.children
- provinceIndex = index
- children.forEach(function(item, idx) {
- if (item.code == val[1]) {
- activeIndex = idx
- var xItem=item.children
- xItem.forEach(function(item,xianIndex){
- if(item.code==val[2]){
- xIndex=xianIndex
- }
- })
- }
- })
- }
- })
- homeAPI.getDistrict({ type:4,code:val[2] }).then( function(res){
- if (res.status == 200) {
- var detailModelList = res.list
- if (vm.addressOptions[provinceIndex].children[activeIndex].children[xIndex]) {
- vm.addressOptions[provinceIndex].children[activeIndex].children[xIndex].children = detailModelList
- }
- }
- })
- },
- cancel:function(){
- EventBus.$emit('copd-reset-select')
- },
- updJkCopdPatient(){
- var vm =this
- this.$refs.ruleForm.validate(function(valid){
- if(valid){
- if(!vm.formData.mobile){
- this.$message.error('请填写联系方式!')
- return false
- }
- if(vm.formData.sexName=='男'){
- vm.formData.sex=1
- }else{
- vm.formData.sex=2
- }
- if(vm.addressVal.length){
-
- vm.addressVal.forEach(function(item,index){
- if(index==0){
- vm.formData.liveProvince=item
- vm.formData.liveProvinceName=vm.$refs.cascader.currentLabels[index]
- }else if(index==1){
- vm.formData.liveCity=item
- vm.formData.liveCityName=vm.$refs.cascader.currentLabels[index]
- }else if(index==2){
- vm.formData.liveTown=item
- vm.formData.liveTownName=vm.$refs.cascader.currentLabels[index]
- }else if(index==3){
- vm.formData.liveStreet=item
- vm.formData.liveStreetName=vm.$refs.cascader.currentLabels[index]
- }
- })
- }else{
- vm.formData.liveProvince=''
- vm.formData.liveProvinceName=''
- vm.formData.liveCity=''
- vm.formData.liveCityName=''
- vm.formData.liveTown=''
- vm.formData.liveTownName=''
- vm.formData.liveStreet=''
- vm.formData.liveStreetName=''
- }
- if(vm.resiginAddressVal.length){
- vm.resiginAddressVal.forEach(function(item,index){
- if(index==0){
- vm.formData.registProvince=item
- vm.formData.registProvinceName=vm.$refs.cas.currentLabels[index]
- }else if(index==1){
- vm.formData.registCity=item
- vm.formData.registCityName=vm.$refs.cas.currentLabels[index]
- }else if(index==2){
- vm.formData.registTown=item
- vm.formData.registTownName=vm.$refs.cas.currentLabels[index]
- }else if(index==3){
- vm.formData.registStreet=item
- vm.formData.registStreetName=vm.$refs.cas.currentLabels[index]
- }
- })
- }else{
- vm.formData.registProvince=''
- vm.formData.registProvinceName=''
- vm.formData.registCity=''
- vm.formData.registCityName=''
- vm.formData.registTown=''
- vm.formData.registTownName=''
- vm.formData.registStreet=''
- vm.formData.registStreetName=''
- }
- statisticAPI.updJkCopdPatient({jsonData:JSON.stringify(vm.formData),doctor:vm.docInfo.code}).then(
- function(res){
- if(res.status==200){
- EventBus.$emit('copd-reset-save')
- }
- }
- )
- }else{
- vm.$message.error('请填写联系方式!')
- window.scrollTo({ top: top, behavior: 'smooth' });
- }
- })
- return false
-
- }
- }
- });
|