Browse Source

09-15 优化异步加载

haodingding 1 year ago
parent
commit
6c182c43f2
1 changed files with 37 additions and 54 deletions
  1. 37 54
      src/views/system/profile/index.vue

+ 37 - 54
src/views/system/profile/index.vue

@@ -154,8 +154,8 @@
         <el-row>
           <el-col :span="12">
             <el-form-item label="出生年月" prop="birthday">
-              <el-date-picker v-model="form.birthday" type="date" placeholder="选择日期"
-                style="width: 100%;" value-format="yyyy-MM-dd"></el-date-picker>
+              <el-date-picker v-model="form.birthday" type="date" placeholder="选择日期" style="width: 100%;"
+                value-format="yyyy-MM-dd"></el-date-picker>
             </el-form-item>
           </el-col>
           <el-col :span="12">
@@ -675,14 +675,12 @@
           <div>{{ aihao }}</div>
         </el-form-item>
         <el-form-item label="照片" prop="photo">
-          <el-image style="width: 150px; height: 200px" :src="form.photo"
-                :preview-src-list="[form.photo]">
-              </el-image>
+          <el-image style="width: 150px; height: 200px" :src="form.photo" :preview-src-list="[form.photo]">
+          </el-image>
         </el-form-item>
         <el-form-item label="其他照片" prop="otherPhoto">
-          <el-image style="width: 150px; height: 200px" :src="form.otherPhoto"
-                :preview-src-list="[form.otherPhoto]">
-              </el-image>
+          <el-image style="width: 150px; height: 200px" :src="form.otherPhoto" :preview-src-list="[form.otherPhoto]">
+          </el-image>
         </el-form-item>
         <el-form-item label="备注" prop="remarks">
           <el-input v-model="form.remarks" type="textarea" />
@@ -839,54 +837,9 @@ export default {
   },
   created() {
     this.getList();
-    this.getDicts('sys_marry_status').then(res => {
-      this.marryStatus = res.data
-    })
-    this.getDicts('sys_hobby').then(res => {
-      this.hobby = res.data
-    })
-    this.getDicts('sys_national').then(res => {
-      this.nation = res.data
-    })
-    this.getDicts('sys_speciality').then(res => {
-      this.speciality = res.data
-    })
-    this.getDicts('sys_educa_level').then(res => {
-      this.educaLevel = res.data
-    })
-    this.getDicts('sys_disablity_status').then(res => {
-      this.disablityStatus = res.data
-    })
-    this.getDicts('sys_disablity_entry').then(res => {
-      this.disablityEntry = res.data
-    })
-    this.getDicts('sys_user_type').then(res => {
-      this.userType = res.data
-    })
-    this.getDicts('sys_live_status').then(res => {
-      this.liveStatus = res.data
-    })
     this.getDicts('sys_relation').then(res => {
       this.relation = res.data
     })
-    this.getDicts('sys_service_type').then(res => {
-      this.serviceType = res.data
-    })
-    this.getDicts('sys_money_come').then(res => {
-      this.moneyCome = res.data
-    })
-    this.getDicts('sys_treate_sure').then(res => {
-      this.treateSure = res.data
-    })
-    this.getDicts('sys_slow_illness').then(res => {
-      this.slowIllness = res.data
-    })
-    this.getDicts('sys_blood_type').then(res => {
-      this.bloodType = res.data
-    })
-    this.getDicts('sys_shi_status').then(res => {
-      this.shiStatus = res.data
-    })
     this.getManage()
   },
   watch: {
@@ -1071,8 +1024,38 @@ export default {
       })
     },
     /** 查询用户档案列表 */
-    getList() {
+    async getList() {
       this.loading = true;
+      let { data: marryStatus } = await this.getDicts('sys_marry_status')
+      this.marryStatus = marryStatus
+      let { data: nation } = await this.getDicts('sys_national')
+      this.nation = nation
+      let { data: userType } = await this.getDicts('sys_user_type')
+      this.userType = userType
+      let { data: liveStatus } = await this.getDicts('sys_live_status')
+      this.liveStatus = liveStatus
+      let { data: serviceType } = await this.getDicts('sys_service_type')
+      this.serviceType = serviceType
+      let { data: treateSure } = await this.getDicts('sys_treate_sure')
+      this.treateSure = treateSure
+      let { data: moneyCome } = await this.getDicts('sys_money_come')
+      this.moneyCome = moneyCome
+      let { data: bloodType } = await this.getDicts('sys_blood_type')
+      this.bloodType = bloodType
+      let { data: disablityStatus } = await this.getDicts('sys_disablity_status')
+      this.disablityStatus = disablityStatus
+      let { data: disablityEntry } = await this.getDicts('sys_disablity_entry')
+      this.disablityEntry = disablityEntry
+      let { data: educaLevel } = await this.getDicts('sys_educa_level')
+      this.educaLevel = educaLevel
+      let { data: shiStatus } = await this.getDicts('sys_shi_status')
+      this.shiStatus = shiStatus
+      let { data: hobby } = await this.getDicts('sys_hobby')
+      this.hobby = hobby
+      let { data: speciality } = await this.getDicts('sys_speciality')
+      this.speciality = speciality
+      let { data: slowIllness } = await this.getDicts('sys_slow_illness')
+      this.slowIllness = slowIllness
       listProfile(this.queryParams).then(response => {
         this.profileList = response.rows;
         this.profileList.map(item => {