lyn7568 6 years ago
parent
commit
a1ee8b9ef6

+ 4 - 1
src/App.vue

@ -6,6 +6,9 @@
6 6
7 7
<script>
8 8
export default {
9
  name: 'App'
9
  name: 'App',
10
  created() {
11
    this.$store.dispatch('getCityData')
12
  }
10 13
}
11 14
</script>

+ 56 - 42
src/components/CityPicker/index.vue

@ -7,7 +7,7 @@
7 7
          @change="choseProvince"
8 8
          placeholder="省/直辖市">
9 9
          <el-option
10
            v-for="item in provinceArr"
10
            v-for="item in citydata"
11 11
            :key="item.id"
12 12
            :label="item.value"
13 13
            :value="item.id">
@ -31,62 +31,74 @@
31 31
  </div>
32 32
</template>
33 33
<script>
34
import queryDict from '@/utils/queryDict'
34
import { mapGetters } from 'vuex'
35 35
export default {
36 36
  props: ['addrCode'],
37 37
  data() {
38 38
    return {
39
      provinceArr: [],
39
      // provinceArr: [],
40 40
      cityArr: [],
41 41
      sheng: '',
42 42
      shi: ''
43 43
    }
44 44
  },
45
  computed: {
46
    ...mapGetters([
47
      'citydata'
48
    ])
49
  },
45 50
  watch: {
46
    addrCode: function() {
51
    citydata(val) {
52
      this.citydata = val
53
    },
54
    addrCode(val) {
47 55
      var that = this
48
      setTimeout(function() {
56
      setTimeout(() => {
49 57
        that.initpsq()
50 58
      }, 100)
51 59
    }
52 60
  },
53 61
  created() {
54
    this.getCityData()
62
    // var that = this
63
    // setTimeout(() => {
64
    //   that.initpsq()
65
    // }, 100)
55 66
  },
56 67
  methods: {
57
    getCityData: function() {
58
      var that = this
59
      queryDict.applyDict('XZQH', function(dictData) {
60
        if (dictData && dictData.length > 0) {
61
          var data = dictData.sort((obj1, obj2) => {
62
            return obj1.code - obj2.code
63
          })
64
          that.provinceArr = {}
65
          data.map(item => {
66
            if (item.code.match(/0000$/)) {
67
              that.provinceArr[item.code] = { id: item.code, value: item.caption, children: {}}
68
            } else if (item.code.match(/00$/)) {
69
              var p = that.provinceArr[item.code.slice(0, 2) + '0000']
70
              p.children[item.code] = { id: item.code, value: item.caption, children: {}}
71
              if (!p.defaultChild) {
72
                p.defaultChild = p.children[item.code]
73
              }
74
            }
75
            //  else {
76
            //   var pp = that.provinceArr[item.code.slice(0, 2) + '0000'].children[item.code.slice(0, 4) + '00']
77
            //   pp.children[item.code] = { id: item.code, value: item.caption }
78
            //   if (!pp.defaultChild) {
79
            //     pp.defaultChild = pp.children[item.code]
80
            //   }
81
            // }
82
          / })
83
        } else {
84
          console.log(dictData.status)
85
        }
86
      })
87
    },
68
    // getCityData: function() {
69
    //   var that = this
70
    //   queryDict.applyDict('XZQH', function(dictData) {
71
    //     if (dictData && dictData.length > 0) {
72
    //       var data = dictData.sort((obj1, obj2) => {
73
    //         return obj1.code - obj2.code
74
    //       })
75
    //       console.log(dictData)
76
    //       that.provinceArr = {}
77
    //       data.map(item => {
78
    //         if (item.code.match(/0000$/)) {
79
    //           that.provinceArr[item.code] = { id: item.code, value: item.caption, children: {}}
80
    //         } else if (item.code.match(/00$/)) {
81
    //           var p = that.provinceArr[item.code.slice(0, 2) + '0000']
82
    //           p.children[item.code] = { id: item.code, value: item.caption, children: {}}
83
    //           if (!p.defaultChild) {
84
    //             p.defaultChild = p.children[item.code]
85
    //           }
86
    //         }
87
    //         //  else {
88
    //         //   var pp = that.provinceArr[item.code.slice(0, 2) + '0000'].children[item.code.slice(0, 4) + '00']
89
    //         //   pp.children[item.code] = { id: item.code, value: item.caption }
90
    //         //   if (!pp.defaultChild) {
91
    //         //     pp.defaultChild = pp.children[item.code]
92
    //         //   }
93
    //         // / }
94
    //       })
95
    //     } else {
96
    //       console.log(dictData.status)
97
    //     }
98
    //   })
99
    // },
88 100
    choseProvince: function(e) {
89
      var p = this.provinceArr[e]
101
      var p = this.citydata[e]
90 102
      this.cityArr = p.children
91 103
      this.sheng = p.value
92 104
      this.shi = p.defaultChild.value
@ -95,7 +107,7 @@ export default {
95 107
      this.$emit('parenStr', this.shi)
96 108
    },
97 109
    choseCity: function(e) {
98
      var p = this.provinceArr[e.slice(0, 2) + '0000'].children[e]
110
      var p = this.citydata[e.slice(0, 2) + '0000'].children[e]
99 111
      this.E = p.id
100 112
      this.shi = p.value
101 113
      this.$emit('paren', this.E)
@ -109,9 +121,11 @@ export default {
109 121
      }
110 122
      const s = this.addrCode.substring(0, 2) + '0000'
111 123
      const si = this.addrCode.substring(0, 4) + '00'
112
      var p = this.provinceArr[s]
113
      this.sheng = p.value
114
      this.shi = p.children[si].value
124
      if (this.citydata) {
125
        var p = this.citydata[s]
126
        this.sheng = p.value
127
        this.shi = p.children[si].value
128
      }
115 129
    }
116 130
  }
117 131
}

+ 1 - 3
src/router/index.js

@ -211,15 +211,13 @@ export const asyncRouterMap = [
211 211
          path: 'noactive',
212 212
          component: () => import('@/views/companyCen/noactive/index'),
213 213
          name: 'noactive',
214
          parentPath: true,
215
          alwaysShow: true,
216 214
          redirect: { name: 'noactiveList' },
217 215
          meta: { title: '未激活企业' },
218 216
          children: [
219 217
            {
220 218
              path: 'noactiveList',
221 219
              name: 'noactiveList',
222
              hidden: true,
220
              meta: { title: '未激活企业列表' },
223 221
              component: () => import('@/views/companyCen/noactive/noactiveList')
224 222
            },
225 223
            {

+ 2 - 1
src/store/getters.js

@ -5,6 +5,7 @@ const getters = {
5 5
  account: state => state.user.account,
6 6
  name: state => state.user.name,
7 7
  permission_routers: state => state.permission.routers,
8
  addRouters: state => state.permission.addRouters
8
  addRouters: state => state.permission.addRouters,
9
  citydata: state => state.city.citydata
9 10
}
10 11
export default getters

+ 3 - 1
src/store/index.js

@ -3,6 +3,7 @@ import Vuex from 'vuex'
3 3
import app from './modules/app'
4 4
import permission from './modules/permission'
5 5
import user from './modules/user'
6
import city from './modules/city'
6 7
import getters from './getters'
7 8
8 9
Vue.use(Vuex)
@ -11,7 +12,8 @@ const store = new Vuex.Store({
11 12
  modules: {
12 13
    app,
13 14
    permission,
14
    user
15
    user,
16
    city
15 17
  },
16 18
  getters
17 19
})

+ 52 - 0
src/store/modules/city.js

@ -0,0 +1,52 @@
1
import queryDict from '@/utils/queryDict'
2
3
const city = {
4
  state: {
5
    citydata: {}
6
  },
7
  mutations: {
8
    citydata: (state, value) => {
9
      state.citydata = value
10
    }
11
  },
12
  actions: {
13
    getCityData({ commit, state }) {
14
      return new Promise((resolve, reject) => {
15
        queryDict.applyDict('XZQH', (dictData) => {
16
          if (dictData && dictData.length > 0) {
17
            var sortData = dictData.sort((obj1, obj2) => {
18
              return obj1.code - obj2.code
19
            })
20
            var arr = {}
21
            sortData.map(item => {
22
              if (item.code.match(/0000$/)) {
23
                arr[item.code] = { id: item.code, value: item.caption, children: {}}
24
              } else if (item.code.match(/00$/)) {
25
                var p = arr[item.code.slice(0, 2) + '0000']
26
                if (p) {
27
                  p.children[item.code] = { id: item.code, value: item.caption }
28
                  if (!p.defaultChild) {
29
                    p.defaultChild = p.children[item.code]
30
                  }
31
                } else {
32
                  arr[item.code.slice(0, 2) + '0000'] = { id: item.code.slice(0, 2) + '0000', value: item.caption, children: {}}
33
                  var pr = arr[item.code.slice(0, 2) + '0000']
34
                  pr.children[item.code] = { id: item.code, value: item.caption }
35
                  if (!pr.defaultChild) {
36
                    pr.defaultChild = pr.children[item.code]
37
                  }
38
                }
39
              }
40
            })
41
            commit('citydata', arr)
42
          }
43
          resolve(dictData)
44
        }, (error) => {
45
          reject(error)
46
        })
47
      })
48
    }
49
  }
50
}
51
52
export default city

+ 3 - 1
src/views/companyCen/noactive/compInfo.vue

@ -61,7 +61,7 @@
61 61
                </el-col>
62 62
                <el-col :span="12">
63 63
                  <el-form-item label="所在城市" prop="addr">
64
                    <cityPicker @paren="toshow" :addrCode="formObj.addr"></cityPicker>
64
                    <cityPicker @paren="toshow" :addrCode="addrCur"></cityPicker>
65 65
                  </el-form-item>
66 66
                </el-col>
67 67
                <el-col :span="12">
@ -181,6 +181,7 @@
181 181
        numRanger: [],
182 182
        compType: [],
183 183
        keywordObj: {},
184
        addrCur: '',
184 185
        formLoading: false,
185 186
        rulesObj: {
186 187
          name: [{ required: true, message: requiredTip('企业全部名称'), trigger: 'blur' }],
@ -293,6 +294,7 @@
293 294
          if (res.success) {
294 295
            const obj = res.data
295 296
            that.formObj = obj
297
            that.addrCur = obj.addr
296 298
          }
297 299
        })
298 300
      },

+ 4 - 6
src/views/companyCen/noactive/productInfo.vue

@ -19,9 +19,9 @@
19 19
                    <el-input v-model="formObj.name" placeholder="请填写产品名称" maxlength="30"></el-input>
20 20
                  </el-form-item>
21 21
                </el-col>
22
                <el-col :span="24" v-if="tagsShow">
22
                <el-col :span="24">
23 23
                  <el-form-item label="关键词">
24
                    <dynamicTags :dyStr="formObj.keyword" :tagInfo="tagKeyword" @turnTags="turnKeywordTags"></dynamicTags>
24
                    <dynamicTags :dyStr="keywordObj" :tagInfo="tagKeyword" @turnTags="turnKeywordTags($event)"></dynamicTags>
25 25
                  </el-form-item>
26 26
                </el-col>
27 27
                <el-col :span="24">
@ -89,13 +89,13 @@
89 89
      return {
90 90
        companyId: '',
91 91
        productId: '',
92
        tagsShow: false,
93 92
        tagKeyword: {
94 93
          lableTit: '关键词',
95 94
          placeholder: '请填写相关的关键词,如:腐蚀防护、石墨烯、纳米材料',
96 95
          limitCount: 10,
97 96
          tagsNum: 5
98 97
        },
98
        keywordObj: [],
99 99
        formLoading: true,
100 100
        formObj: {
101 101
          name: '',
@ -173,10 +173,8 @@
173 173
                objKey.push(item.keyword)
174 174
              })
175 175
            }
176
            that.keywordObj = objKey
176 177
            that.formObj.keyword = objKey
177
            setTimeout(function() {
178
              that.tagsShow = true
179
            }, 1)
180 178
          }
181 179
        })
182 180
      },

+ 1 - 6
src/views/specialExperts/expertSort.vue

@ -17,7 +17,7 @@
17 17
          {{form.orgName}}
18 18
        </el-form-item>
19 19
        <el-form-item :label-width="formLabelWidth" prop="level">
20
          <div class='labelBox'>专家平台序号</div></span>
20
          <div class='labelBox'>专家平台序号</div>
21 21
          <el-input type="number" v-model.number="form.level" placeholder="最多三位数字" class="conBox" min="0" max="999" ></el-input>
22 22
        </el-form-item>
23 23
        <el-form-item class="modiaB">
@ -95,11 +95,6 @@
95 95
96 96
  .t-left {
97 97
    float: left
98
  }
99
100
  .headPhoto {
101
    
102
    
103 98
  }
104 99
  .headPhoto img {
105 100
    width: 100px;