소스 검색

新增街道社区级民政用户

XhuiCoder 1 년 전
부모
커밋
884c298d7a
3개의 변경된 파일125개의 추가작업 그리고 62개의 파일을 삭제
  1. 47 32
      pages/info/add-files.vue
  2. 4 2
      pages/login/index.vue
  3. 74 28
      pages/lr/info.vue

+ 47 - 32
pages/info/add-files.vue

@@ -22,9 +22,7 @@
           </view>
         </view>
 
-        <uni-forms ref="baseForm" :modelValue="baseFormData" :rules="rules" style="margin-top: 5vh;">
-
-
+        <uni-forms ref="baseForm" :modelValue="baseFormData" :rules="rules" label-width="75px" style="margin-top: 5vh;">
           <uni-forms-item label="姓名" required name="lrXm">
             <uni-easyinput ref="xm" type="text" :disabled="disabled" v-model="baseFormData.lrXm" placeholder="请输入姓名"
               :inputBorder="true"></uni-easyinput>
@@ -40,7 +38,7 @@
             <uni-easyinput type="text" v-model="baseFormData.jhrlxdh" :disabled="disabled" placeholder="请输入监护人联系电话"
               :inputBorder="true"></uni-easyinput>
           </uni-forms-item>
-          <uni-forms-item label="街道社区">
+          <uni-forms-item label="街道社区" v-if="level !== 5" name="diqu" required>
             <uni-easyinput type="text" v-model="diqu" @focus="toggle('bottom')" placeholder="请选择街道社区" :clearable="false"></uni-easyinput>
           </uni-forms-item>
           <uni-forms-item label="住址" required name="jzdz">
@@ -103,10 +101,10 @@
       <!-- 普通弹窗 -->
       <uni-popup ref="popup" background-color="#fff">
         <picker-view :indicator-style="indicatorStyle" @change="bindChange" class="picker-view">
-          <picker-view-column>
+          <picker-view-column v-if="jiedaoData.length > 0">
             <view class="item" v-for="(item,index) in jiedaoData" :key="index">{{item.label}}</view>
           </picker-view-column>
-          <picker-view-column>
+          <picker-view-column v-if="shequData.length > 0">
             <view class="item" v-for="(item,index) in shequData" :key="index">{{item.label}}</view>
           </picker-view-column>
         </picker-view>
@@ -139,6 +137,7 @@
     },
     data() {
       return {
+        level: 3,
         diqu: '',
         tkzmList: [],
         dbzmList: [],
@@ -323,7 +322,8 @@
       this.userInfo = getUser()
       this.baseFormData.lrHjdz = this.userInfo.dept.locationCode
       this.groupId = this.userInfo.dept.locationCode.substring(0, 6)
-      console.log(this.userInfo);
+      let unitFilter = this.userInfo.dept.unitFilter.split(',')
+      this.level = unitFilter.length
       if (this.userInfo.userType === '07') {
         this.updateFlag = true
         this.baseFormData.lrHjdz = this.userInfo.dept.locationCode.substring(0, 6) + '000000'
@@ -352,14 +352,21 @@
           code: code
         }).then(res => {
           if (res.data) {
-            this.jiedaoData = res.data
-            this.shequData = res.data[0].children
-
-
-            this.jiedaoValue = this.jiedaoData[0]
-            this.shequValue = this.shequData[0]
-            this.diqu = this.jiedaoValue.label + '/' + this.shequValue.label
-            this.baseFormData.lrHjdz = this.shequValue.code
+            if (this.level === 3) { //区县级用户
+              this.jiedaoData = res.data
+              this.shequData = res.data[0].children
+              this.jiedaoValue = this.jiedaoData[0]
+              this.shequValue = this.shequData[0]
+              this.diqu = this.jiedaoValue.label + '/' + this.shequValue.label
+              this.baseFormData.lrHjdz = this.shequValue.code
+            } else if (this.level === 4) { //街道级用户
+              this.shequData = res.data
+              this.shequValue = this.shequData[0]
+              this.diqu = this.shequValue.label
+              this.baseFormData.lrHjdz = this.shequValue.code
+            } else if (this.level === 5) { //社区级用户
+              this.baseFormData.lrHjdz = this.userInfo.dept.locationCode
+            }
           }
         })
       },
@@ -567,30 +574,38 @@
       },
       toggle(type) {
         uni.hideKeyboard()
-        this.shequData = this.jiedaoData[0].children
+        if (this.level === 3) {
+          this.shequData = this.jiedaoData[0].children
+        }
+
         // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
         this.$refs.popup.open(type)
       },
       bindChange(e) {
-        if (e.detail.value.length == 1) {
-          this.jiedaoValue = this.jiedaoData[e.detail.value[0]]
-          this.shequData = this.jiedaoData[e.detail.value[0]].children
-          if (this.shequData.length > 0 && this.shequData[0] != null) {
-            this.shequValue = this.shequData[0]
+        if (this.level === 3) { // 区县级用户
+          if (e.detail.value.length == 1) {
+            this.jiedaoValue = this.jiedaoData[e.detail.value[0]]
+            this.shequData = this.jiedaoData[e.detail.value[0]].children
+            if (this.shequData.length > 0 && this.shequData[0] != null) {
+              this.shequValue = this.shequData[0]
+              this.diqu = this.jiedaoValue.label + '/' + this.shequValue.label
+              this.baseFormData.lrHjdz = this.shequValue.code
+            } else {
+              this.shequData = []
+              this.shequValue = ''
+              this.diqu = this.jiedaoValue.label
+              this.baseFormData.lrHjdz = this.jiedaoValue.code
+            }
+          } else {
+            let index = e.detail.value[0] ? e.detail.value[0] : 0
+            this.jiedaoValue = this.jiedaoData[index]
+            this.shequValue = this.shequData[e.detail.value[1]]
             this.diqu = this.jiedaoValue.label + '/' + this.shequValue.label
             this.baseFormData.lrHjdz = this.shequValue.code
-          } else {
-            this.shequData = []
-            this.shequValue = ''
-            this.diqu = this.jiedaoValue.label
-            this.baseFormData.lrHjdz = this.jiedaoValue.code
           }
-
-        } else {
-          let index = e.detail.value[0] ? e.detail.value[0] : 0
-          this.jiedaoValue = this.jiedaoData[index]
-          this.shequValue = this.shequData[e.detail.value[1]]
-          this.diqu = this.jiedaoValue.label + '/' + this.shequValue.label
+        } else if (this.level === 4) { // 街道级用户
+          this.shequValue = this.shequData[e.detail.value[0]]
+          this.diqu = this.shequValue.label
           this.baseFormData.lrHjdz = this.shequValue.code
         }
 

+ 4 - 2
pages/login/index.vue

@@ -94,7 +94,7 @@
           { text: '民政用户', value: '1' },
           { text: '非民政用户', value: '0' },
         ],
-        accountType: '0',
+        accountType: '1',
 
         formData: {
           username: '',
@@ -103,7 +103,9 @@
           // password: '090050',
           // username: '15578179876',
           // username: '15114481023',
-          // password: 'sckj12356',
+          username: 'ylfw_220822001',
+          // username: 'ylfw_220822001001',
+          password: 'sckj12356',
           // code: "081X2kll21UGPc4HRlml27WxeO3X2kl6",
           code: "",
           openid: "",

+ 74 - 28
pages/lr/info.vue

@@ -33,7 +33,7 @@
             <uni-easyinput type="text" v-model="baseFormData.jhrlxdh" placeholder="请输入监护人联系电话" :inputBorder="true"></uni-easyinput>
           </uni-forms-item>
 
-          <uni-forms-item label="街道社区">
+          <uni-forms-item label="街道社区" v-if="level !== 5" name="diqu" required>
             <uni-easyinput type="text" v-model="diqu" @focus="toggle('bottom')" placeholder="请选择街道社区" :clearable="false"></uni-easyinput>
           </uni-forms-item>
 
@@ -83,10 +83,10 @@
       <!-- 普通弹窗 -->
       <uni-popup ref="popup" background-color="#fff">
         <picker-view :indicator-style="indicatorStyle" @change="bindChange" class="picker-view">
-          <picker-view-column>
+          <picker-view-column v-if="jiedaoData.length > 0">
             <view class="item" v-for="(item,index) in jiedaoData" :key="index">{{item.label}}</view>
           </picker-view-column>
-          <picker-view-column>
+          <picker-view-column v-if="shequData.length > 0">
             <view class="item" v-for="(item,index) in shequData" :key="index">{{item.label}}</view>
           </picker-view-column>
         </picker-view>
@@ -156,6 +156,7 @@
     },
     data() {
       return {
+        level: 3,
         id: '',
         diqu: '',
         item: {},
@@ -298,6 +299,8 @@
     onLoad(o) {
       this.userInfo = getUser()
       this.userType = this.userInfo.userType
+      let unitFilter = this.userInfo.dept.unitFilter.split(',')
+      this.level = unitFilter.length
       //  查询街道和社区
       this.getAddressList(this.userInfo.dept.locationCode)
 
@@ -388,19 +391,33 @@
           code: code
         }).then(res => {
           if (res.data) {
-            this.jiedaoData = res.data
-            this.shequData = res.data[0].children
-
-
-            this.jiedaoValue = this.jiedaoData[0]
-            if (this.shequData.length > 0) {
+            if (this.level === 3) { //区县级用户
+              this.jiedaoData = res.data
+              this.shequData = res.data[0].children
+              this.jiedaoValue = this.jiedaoData[0]
               this.shequValue = this.shequData[0]
               this.diqu = this.jiedaoValue.label + '/' + this.shequValue.label
               this.baseFormData.lrHjdz = this.shequValue.code
-            } else {
-              this.diqu = this.jiedaoValue.label
+            } else if (this.level === 4) { //街道级用户
+              this.shequData = res.data
+              this.shequValue = this.shequData[0]
+              this.diqu = this.shequValue.label
               this.baseFormData.lrHjdz = this.shequValue.code
+            } else if (this.level === 5) { //社区级用户
+              this.baseFormData.lrHjdz = this.userInfo.dept.locationCode
             }
+
+            // this.jiedaoData = res.data
+            // this.shequData = res.data[0].children
+            // this.jiedaoValue = this.jiedaoData[0]
+            // if (this.shequData.length > 0) {
+            //   this.shequValue = this.shequData[0]
+            //   this.diqu = this.jiedaoValue.label + '/' + this.shequValue.label
+            //   this.baseFormData.lrHjdz = this.shequValue.code
+            // } else {
+            //   this.diqu = this.jiedaoValue.label
+            //   this.baseFormData.lrHjdz = this.shequValue.code
+            // }
             if (this.id) this.showInfo(this.id)
           }
         })
@@ -449,33 +466,62 @@
       },
       toggle(type) {
         uni.hideKeyboard()
-        this.shequData = this.jiedaoData[0].children
+        if (this.level === 3) {
+          this.shequData = this.jiedaoData[0].children
+        }
         // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
         this.$refs.popup.open(type)
       },
       bindChange(e) {
-        if (e.detail.value.length == 1) {
-          this.jiedaoValue = this.jiedaoData[e.detail.value[0]]
-          this.shequData = this.jiedaoData[e.detail.value[0]].children
-          if (this.shequData.length > 0 && this.shequData[0] != null) {
-            this.shequValue = this.shequData[0]
+        if (this.level === 3) { // 区县级用户
+          if (e.detail.value.length == 1) {
+            this.jiedaoValue = this.jiedaoData[e.detail.value[0]]
+            this.shequData = this.jiedaoData[e.detail.value[0]].children
+            if (this.shequData.length > 0 && this.shequData[0] != null) {
+              this.shequValue = this.shequData[0]
+              this.diqu = this.jiedaoValue.label + '/' + this.shequValue.label
+              this.baseFormData.lrHjdz = this.shequValue.code
+            } else {
+              this.shequData = []
+              this.shequValue = ''
+              this.diqu = this.jiedaoValue.label
+              this.baseFormData.lrHjdz = this.jiedaoValue.code
+            }
+          } else {
+            let index = e.detail.value[0] ? e.detail.value[0] : 0
+            this.jiedaoValue = this.jiedaoData[index]
+            this.shequValue = this.shequData[e.detail.value[1]]
             this.diqu = this.jiedaoValue.label + '/' + this.shequValue.label
             this.baseFormData.lrHjdz = this.shequValue.code
-          } else {
-            this.shequData = []
-            this.shequValue = ''
-            this.diqu = this.jiedaoValue.label
-            this.baseFormData.lrHjdz = this.jiedaoValue.code
           }
-
-        } else {
-          let index = e.detail.value[0] ? e.detail.value[0] : 0
-          this.jiedaoValue = this.jiedaoData[index]
-          this.shequValue = this.shequData[e.detail.value[1]]
-          this.diqu = this.jiedaoValue.label + '/' + this.shequValue.label
+        } else if (this.level === 4) { // 街道级用户
+          this.shequValue = this.shequData[e.detail.value[0]]
+          this.diqu = this.shequValue.label
           this.baseFormData.lrHjdz = this.shequValue.code
         }
 
+        // if (e.detail.value.length == 1) {
+        //   this.jiedaoValue = this.jiedaoData[e.detail.value[0]]
+        //   this.shequData = this.jiedaoData[e.detail.value[0]].children
+        //   if (this.shequData.length > 0 && this.shequData[0] != null) {
+        //     this.shequValue = this.shequData[0]
+        //     this.diqu = this.jiedaoValue.label + '/' + this.shequValue.label
+        //     this.baseFormData.lrHjdz = this.shequValue.code
+        //   } else {
+        //     this.shequData = []
+        //     this.shequValue = ''
+        //     this.diqu = this.jiedaoValue.label
+        //     this.baseFormData.lrHjdz = this.jiedaoValue.code
+        //   }
+
+        // } else {
+        //   let index = e.detail.value[0] ? e.detail.value[0] : 0
+        //   this.jiedaoValue = this.jiedaoData[index]
+        //   this.shequValue = this.shequData[e.detail.value[1]]
+        //   this.diqu = this.jiedaoValue.label + '/' + this.shequValue.label
+        //   this.baseFormData.lrHjdz = this.shequValue.code
+        // }
+
       },
       buildDataByLevel(data, pid) {
         let result = [];