Browse Source

前后台匹配更新数据

lipengtao 5 years ago
parent
commit
580668de5f

+ 57 - 54
src/pages/index/views/ViewExpertPool/expItem.vue

@ -25,6 +25,7 @@
25 25
    },
26 26
    data() {
27 27
      return {
28
        platId: process.env.PLAT_ID,
28 29
        userData: [],
29 30
        loadingModalShow: true,
30 31
        loadingComplete: false,
@ -61,68 +62,70 @@
61 62
    methods: {
62 63
      buttedProfessors() {
63 64
        var that = this
64
        that.$axios.get('/ajax/professor/list', {}, (res) => {
65
          if (res.success) {
66
            var $data = res.data;
67
            var arr = []
68
            var hdata = { num: 1, data: $data }
69
            if ($data.length > 0) {
70
              for (let i = 0; i < $data.length; ++i) {
71
                hdata.num++
72
                arr[i] = $data[i].id;
65
        that.$axios.get('http://www.xttjpt.cn:88/ajax/professor/sync', {pid: that.platId}, (res) => {
66
          that.$axios.get('/ajax/professor/list', {}, (res) => {
67
            if (res.success) {
68
              var $data = res.data;
69
              var arr = []
70
              var hdata = { num: 1, data: $data }
71
              if ($data.length > 0) {
72
                for (let i = 0; i < $data.length; ++i) {
73
                  hdata.num++
74
                  arr[i] = $data[i].id;
75
                  hdata.num--
76
                }
73 77
                hdata.num--
74
              }
75
              hdata.num--
76
              if (hdata.num === 0 && arr.length) {
77
                that.$axios.getk('/ajax/professor/qm', {
78
                  id: arr
79
                }, function(data) {
80
                  if (data.success && data.data) {
81
                    var obj = data.data
82
                    if (obj.length > 0) {
83
                      for (let m = 0; m < obj.length; ++m) {
84
                        obj[m].img = defaultSet.img.expert
85
                        if (obj[m].hasHeadImage) {
86
                          obj[m].img = ImageUrl(('head/' + obj[m].id + '_l.jpg'), true)
78
                if (hdata.num === 0 && arr.length) {
79
                  that.$axios.getk('/ajax/professor/qm', {
80
                    id: arr
81
                  }, function(data) {
82
                    if (data.success && data.data) {
83
                      var obj = data.data
84
                      if (obj.length > 0) {
85
                        for (let m = 0; m < obj.length; ++m) {
86
                          obj[m].img = defaultSet.img.expert
87
                          if (obj[m].hasHeadImage) {
88
                            obj[m].img = ImageUrl(('head/' + obj[m].id + '_l.jpg'), true)
89
                          }
90
                          obj[m].auth = autho(obj[m].authType, obj[m].orgAuth, obj[m].authStatus)
91
                          obj[m].offt = formatOfft(obj[m], true)
87 92
                        }
88
                        obj[m].auth = autho(obj[m].authType, obj[m].orgAuth, obj[m].authStatus)
89
                        obj[m].offt = formatOfft(obj[m], true)
90
                      }
91
                      setTimeout(() => {
92
                        that.$parent.loadingState = false
93
                        for (let j = 0; j < obj.length; ++j) {
94
                          for (let n = 0; n < $data.length; ++n) {
95
                            if (obj[j].id === $data[n].id) {
96
                              if ($data[n].level) {
97
                                obj[j].level = $data[n].level
98
                              } else {
99
                                obj[j].level = 99999
93
                        setTimeout(() => {
94
                          that.$parent.loadingState = false
95
                          for (let j = 0; j < obj.length; ++j) {
96
                            for (let n = 0; n < $data.length; ++n) {
97
                              if (obj[j].id === $data[n].id) {
98
                                if ($data[n].level) {
99
                                  obj[j].level = $data[n].level
100
                                } else {
101
                                  obj[j].level = 99999
102
                                }
100 103
                              }
101 104
                            }
102 105
                          }
103
                        }
104
                        obj.sort(function(a, b) {
105
                          return a.level > b.level ? 1 : (a.level === b.level ? 0 : -1)
106
                        })
107
                        if (obj.length <= that.pageSize) {
108
                          that.loadingModalShow = false
109
                          that.loadingComplete = true
110
                          that.isFormSearch = true
111
                          that.isLoading = false
112
                          that.ifDefault = false
113
                        }
114
                        that.userData = obj
115
                      }, 1000)
106
                          obj.sort(function(a, b) {
107
                            return a.level > b.level ? 1 : (a.level === b.level ? 0 : -1)
108
                          })
109
                          if (obj.length <= that.pageSize) {
110
                            that.loadingModalShow = false
111
                            that.loadingComplete = true
112
                            that.isFormSearch = true
113
                            that.isLoading = false
114
                            that.ifDefault = false
115
                          }
116
                          that.userData = obj
117
                        }, 1000)
118
                      }
116 119
                    }
117
                  }
118
                })
120
                  })
121
                }
122
              } else {
123
                that.ifDefault = true
124
                that.$parent.loadingState = false
119 125
              }
120
            } else {
121
              that.ifDefault = true
122
              that.$parent.loadingState = false
123 126
            }
124
          }
125
        })
127
          })
128
        }) 
126 129
      },
127 130
      searchLower() {
128 131
        if (this.loadingModalShow && !this.isLoading) {

+ 57 - 54
src/pages/index/views/ViewOrganization/orgItem.vue

@ -25,6 +25,7 @@
25 25
    },
26 26
    data() {
27 27
      return {
28
        platId: process.env.PLAT_ID,
28 29
        orgData: [],
29 30
        loadingModalShow: true,
30 31
        loadingComplete: false,
@ -61,68 +62,70 @@
61 62
    methods: {
62 63
      ResidentOrgs() {
63 64
        var that = this
64
        that.$axios.get('/ajax/org/list', {}, (res) => {
65
          if (res.success) {
66
            var $data = res.data;
67
            var arr = []
68
            var hdata = { num: 1, data: $data }
69
            if ($data.length > 0) {
70
              for (let i in $data) {
71
                hdata.num++
72
                arr[i] = $data[i].id;
65
       that.$axios.get('http://www.xttjpt.cn:88/ajax/org/sync', {pid: that.platId}, (res) => {
66
          that.$axios.get('/ajax/org/list', {}, (res) => {
67
            if (res.success) {
68
              var $data = res.data;
69
              var arr = []
70
              var hdata = { num: 1, data: $data }
71
              if ($data.length > 0) {
72
                for (let i in $data) {
73
                  hdata.num++
74
                  arr[i] = $data[i].id;
75
                  hdata.num--
76
                }
73 77
                hdata.num--
74
              }
75
              hdata.num--
76
              if (hdata.num === 0 && arr.length) {
77
                that.$axios.getk('/ajax/org/qm', {
78
                  id: arr
79
                }, function(data) {
80
                  if (data.success && data.data) {
81
                    var obj = data.data
82
                    if (obj.length > 0) {
83
                      for (let m = 0; m < obj.length; ++m) {
84
                        obj[m].logo = defaultSet.img.org
85
                        if (obj[m].hasOrgLogo) {
86
                          obj[m].logo = ImageUrl(('org/' + obj[m].id + '.jpg'), true)
87
                        }
88
                        if (obj[m].industry) {
89
                          obj[m].industry = obj[m].industry.replace(/,/g, ' | ')
78
                if (hdata.num === 0 && arr.length) {
79
                  that.$axios.getk('/ajax/org/qm', {
80
                    id: arr
81
                  }, function(data) {
82
                    if (data.success && data.data) {
83
                      var obj = data.data
84
                      if (obj.length > 0) {
85
                        for (let m = 0; m < obj.length; ++m) {
86
                          obj[m].logo = defaultSet.img.org
87
                          if (obj[m].hasOrgLogo) {
88
                            obj[m].logo = ImageUrl(('org/' + obj[m].id + '.jpg'), true)
89
                          }
90
                          if (obj[m].industry) {
91
                            obj[m].industry = obj[m].industry.replace(/,/g, ' | ')
92
                          }
90 93
                        }
91
                      }
92
                      setTimeout(() => {
93
                        that.$parent.loadingState = false
94
                        for (let j = 0; j < obj.length; ++j) {
95
                          for (let n = 0; n < $data.length; ++n) {
96
                            if (obj[j].id === $data[n].id) {
97
                              if ($data[n].level) {
98
                                obj[j].level = $data[n].level
99
                              } else {
100
                                obj[j].level = 99999
94
                        setTimeout(() => {
95
                          that.$parent.loadingState = false
96
                          for (let j = 0; j < obj.length; ++j) {
97
                            for (let n = 0; n < $data.length; ++n) {
98
                              if (obj[j].id === $data[n].id) {
99
                                if ($data[n].level) {
100
                                  obj[j].level = $data[n].level
101
                                } else {
102
                                  obj[j].level = 99999
103
                                }
101 104
                              }
102 105
                            }
103 106
                          }
104
                        }
105
                        obj.sort(function(a, b) {
106
                          return a.level > b.level ? 1 : (a.level === b.level ? 0 : -1)
107
                        })
108
                        if (obj.length <= that.pageSize) {
109
                          that.loadingModalShow = false
110
                          that.loadingComplete = true
111
                          that.isFormSearch = true
112
                          that.isLoading = false
113
                          that.ifDefault = false
114
                        }
115
                        that.orgData = obj
116
                      }, 1000);
107
                          obj.sort(function(a, b) {
108
                            return a.level > b.level ? 1 : (a.level === b.level ? 0 : -1)
109
                          })
110
                          if (obj.length <= that.pageSize) {
111
                            that.loadingModalShow = false
112
                            that.loadingComplete = true
113
                            that.isFormSearch = true
114
                            that.isLoading = false
115
                            that.ifDefault = false
116
                          }
117
                          that.orgData = obj
118
                        }, 1000);
119
                      }
117 120
                    }
118
                  }
119
                })
121
                  })
122
                }
123
              } else {
124
                that.ifDefault = true
125
                that.$parent.loadingState = false
120 126
              }
121
            } else {
122
              that.ifDefault = true
123
              that.$parent.loadingState = false
124 127
            }
125
          }
128
          })
126 129
        })
127 130
      },
128 131
      searchLower() {