index.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. var template = ''
  2. $.ajax('../../../component/statistics/LascModifyPatient/index.html', {
  3. data: {},
  4. dataType: 'html',
  5. cache: false,
  6. timeout: 60000,
  7. async: false,
  8. error: function (res) {},
  9. success: function (res) {
  10. template = res
  11. }
  12. })
  13. Vue.component('lasc-modify-patient', {
  14. template: template,
  15. props: [],
  16. data: function () {
  17. return {
  18. form: {},
  19. menophaniaAgeList: [],
  20. selAddress: '350200', // 默认值
  21. selectedStreet: '',
  22. areaList: areaDataArr,
  23. areaOptions: [], // 地区数据
  24. rules: {},
  25. cascaderProps: {
  26. value: 'value',
  27. label: 'label',
  28. children: 'children',
  29. expandTrigger: 'hover',
  30. checkStrictly: true, // 可以只选父级
  31. emitPath: false // 只返回最后一级的值
  32. }
  33. }
  34. },
  35. methods: {
  36. handleItemChange(item, type) {},
  37. loadAreaData() {
  38. this.areaOptions = Object.keys(this.areaList.province_list).map(provinceCode => ({
  39. value: provinceCode,
  40. label: this.areaList.province_list[provinceCode],
  41. children: this.getCityChildren(provinceCode)
  42. }))
  43. },
  44. // 获取城市子节点
  45. getCityChildren(provinceCode) {
  46. const prefix = provinceCode.substring(0, 2)
  47. return Object.keys(this.areaList.city_list)
  48. .filter(cityCode => cityCode.startsWith(prefix))
  49. .map(cityCode => ({
  50. value: cityCode,
  51. label: this.areaList.city_list[cityCode]
  52. }))
  53. }
  54. },
  55. mounted() {
  56. for (var i = 8; i < 21; i++) {
  57. this.menophaniaAgeList.push(i)
  58. }
  59. // 初始化时加载地区数据
  60. this.loadAreaData()
  61. }
  62. })