123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- 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,
- props: [],
- data: function () {
- return {
- form: {},
- menophaniaAgeList: [],
- selAddress: '350200', // 默认值
- selectedStreet: '',
- areaList: areaDataArr,
- areaOptions: [], // 地区数据
- rules: {},
- streetList: [],
- cascaderProps: {
- value: 'value',
- label: 'label',
- children: 'children',
- expandTrigger: 'hover',
- checkStrictly: true, // 可以只选父级
- emitPath: true // 只返回最后一级的值
- }
- }
- },
- methods: {
- handleItemChange(item, type) {
- if (type == 1) {
- this.form.sickProvince = item[0] || ''
- this.form.sickCity = item[1] || ''
- this.form.sickCounty = ''
- this.form.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)
- })
- } else {
- console.log('22222222222222222', item)
- }
- },
- 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 params = {
- town: item.value
- }
- httpRequest.get('doctor/sign/getStreetListByTown', { data: params }).then(function (res) {
- if (res.status == 200) {
- var children =
- !res.data || !res.data.length
- ? []
- : _.map(res.data, function (v) {
- return {
- label: v.name,
- value: v.code
- }
- })
- }
- item.children = children
- })
- }
- },
- mounted() {
- for (var i = 8; i < 21; i++) {
- this.menophaniaAgeList.push(i)
- }
- // 初始化时加载地区数据
- this.loadAreaData()
- }
- })
|