Ver Fonte

Merge branch 'master' of http://18.167.157.193:1026/guanli/ngds

kevin_zhangl há 3 anos atrás
pai
commit
ac096cc4f5
2 ficheiros alterados com 294 adições e 295 exclusões
  1. 293 294
      backendEle/src/components/FilterUser.vue
  2. 1 1
      frontendEle/src/views/user/dec.vue

+ 293 - 294
backendEle/src/components/FilterUser.vue

@@ -121,330 +121,329 @@
 </template>
 
 <script>
-  import network from '@/utils/network'
-  import baseInfo from '@/utils/baseInfo'
-  import store from '@/utils/vuexStore'
-  import Pagination from './Pagination'
-  import filterHelper from '@/utils/filterHelper'
+import network from '@/utils/network'
+import baseInfo from '@/utils/baseInfo'
+import store from '@/utils/vuexStore'
+import Pagination from './Pagination'
+import filterHelper from '@/utils/filterHelper'
 
-  export default {
-    name: 'FilterUser',
-    components: {Pagination},
-    props: {
-      filterTypes: {
-        type: Object,
-        default() {
-          return {
-            'USER_NAME': {isUserTable: true, name: '会员编号'},
-            'REAL_NAME': {isUserTable: true, name: '会员姓名'},
-            'ID_CARD': {isUserTable: true, name: '身份证'},
-            'MOBILE': {isUserTable: true, name: '手机号'},
-            'CREATED_AT': {isUserTable: true, name: '加入时间', other: 'date'},
-          }
-        },
-      },
-      filterBtnName: {
-        type: String,
-        default() {
-          return 'Select'//筛选
+export default {
+  name: 'FilterUser',
+  components: {Pagination},
+  props: {
+    filterTypes: {
+      type: Object,
+      default () {
+        return {
+          'USER_NAME': {isUserTable: true, name: '会员编号'},
+          'REAL_NAME': {isUserTable: true, name: '会员姓名'},
+          'ID_CARD': {isUserTable: true, name: '身份证'},
+          'MOBILE': {isUserTable: true, name: '手机号'},
+          'CREATED_AT': {isUserTable: true, name: '加入时间', other: 'date'}
         }
       }
     },
-    data() {
-      return {
-        loading: false,
-        filterUserDialogShow: false,
-        tableData: [],
-        currentPage: 1,
-        totalPages: 1,
-        totalCount: 1,
-        pageSize: 20,
-        filterCustomType: {
-          decLevel: {
-            placeholder: '请选择报单级别',
-            labelField: 'LEVEL_NAME',
-            valueField: 'ID',
-            values: baseInfo.decLevels()
-          },
-          empLevel: {
-            placeholder: '请选择聘级',
-            labelField: 'LEVEL_NAME',
-            valueField: 'ID',
-            values: baseInfo.empLevels()
-          },
-          decRole: {
-            placeholder: '请选择报单中心级别',
-            labelField: 'ROLE_NAME',
-            valueField: 'ID',
-            values: baseInfo.decRoles()
-          },
-          subCompany: {
-            placeholder: '请选择分公司',
-            labelField: 'COM_NAME',
-            valueField: 'ID',
-            values: baseInfo.subCompanies()
-          },
-          status: {
-            placeholder: '请选择会员状态',
-            labelField: 'label',
-            valueField: 'value',
-            values: baseInfo.allStatus()
-          },
-          dealTypes: {
-            placeholder: '请选择交易类型',
-            labelField: 'TYPE_NAME',
-            valueField: 'ID',
-            values: baseInfo.dealTypes()
-          },
-          systems: {
-            placeholder: '请选择体系',
-            labelField: 'SYSTEM_NAME',
-            valueField: 'ID',
-            values: baseInfo.systems()
-          },
-          sex: {
-            placeholder: '请选择性别',
-            labelField: 'label',
-            valueField: 'value',
-            values: {
-              '男': {label: '男', value: '男'},
-              '女': {label: '女', value: '女'},
-            }
-          },
-          yesOrNo: {
-            placeholder: '请选择是否',
-            labelField: 'label',
-            valueField: 'value',
-            values: {
-              1: {label: '是', value: 1},
-              0: {label: '否', value: 0},
-            }
-          },
-          banks: {
-            placeholder: '请选择开户行',
-            labelField: 'BANK_NAME',
-            valueField: 'BANK_CODE',
-            values: baseInfo.allOpenBank()
-          },
-          nations: {
-            placeholder: '请选择民族',
-            labelField: 'name',
-            valueField: 'id',
-            values: baseInfo.allNation()
-          },
-          location: {
-            placeholder: '请选择市场',
-            labelField: 'label',
-            valueField: 'value',
-            values: {
-              1: {label: '一市场', value: 1},
-              2: {label: '二市场', value: 2},
-              3: {label: '三市场', value: 3},
-              4: {label: '四市场', value: 4},
-              5: {label: '五市场', value: 5},
-            }
-          },
+    filterBtnName: {
+      type: String,
+      default () {
+        return 'Select' // 筛选
+      }
+    }
+  },
+  data () {
+    return {
+      loading: false,
+      filterUserDialogShow: false,
+      tableData: [],
+      currentPage: 1,
+      totalPages: 1,
+      totalCount: 1,
+      pageSize: 20,
+      filterCustomType: {
+        decLevel: {
+          placeholder: '请选择报单级别',
+          labelField: 'LEVEL_NAME',
+          valueField: 'ID',
+          values: baseInfo.decLevels()
         },
-        filterModel: {
-          userId: '',
+        empLevel: {
+          placeholder: '请选择聘级',
+          labelField: 'LEVEL_NAME',
+          valueField: 'ID',
+          values: baseInfo.empLevels()
         },
-        allFilterTypes: this.filterTypes,
-        filterType: '',
-        filterSymbol: '',
-        filterSymbols: {
-          '=': 'Is equal to', //等于
-          'like': 'Is including',//包含
-          '<>': 'Is not',//不等于
-          'notLike': 'not Is including ',//不包含
-          '>': 'Is greater than',//大于
-          '>=': 'Is greater than or equal to',//大于等于
-          '<': 'Is smaller than',//小于
-          '<=': 'Is smaller than or equal to',//小于等于
+        decRole: {
+          placeholder: '请选择报单中心级别',
+          labelField: 'ROLE_NAME',
+          valueField: 'ID',
+          values: baseInfo.decRoles()
         },
-        filterRelation: 'and',
-        filterRelations: {
-          'and': '并且',
-          'or': '或者',
+        subCompany: {
+          placeholder: '请选择分公司',
+          labelField: 'COM_NAME',
+          valueField: 'ID',
+          values: baseInfo.subCompanies()
         },
-        filterValue: '',
-        filterName: '',
-        filterSelected: [],
-        selectData: [],
-        multipleSelection: [],
-        multipleSelectionUserId: [],
-        regionData: store.state.regionInfo.regionData,
-        filterAreaValue: [],
-        filterRequest: {},
-      }
-    },
-    watch: {
-      filterTypes(newVal) {
-        this.allFilterTypes = this.filterTypes
-      },
-    },
-    methods: {
-      handleFilterTypeChange() {
-        this.filterValue = ''
-      },
-      handleSelectionChange(val) {
-        this.multipleSelection = val
-        this.multipleSelectionUserId = [];
-        for (let i in this.multipleSelection) {
-          this.multipleSelectionUserId.push(this.multipleSelection[i].ID)
+        status: {
+          placeholder: '请选择会员状态',
+          labelField: 'label',
+          valueField: 'value',
+          values: baseInfo.allStatus()
+        },
+        dealTypes: {
+          placeholder: '请选择交易类型',
+          labelField: 'TYPE_NAME',
+          valueField: 'ID',
+          values: baseInfo.dealTypes()
+        },
+        systems: {
+          placeholder: '请选择体系',
+          labelField: 'SYSTEM_NAME',
+          valueField: 'ID',
+          values: baseInfo.systems()
+        },
+        sex: {
+          placeholder: '请选择性别',
+          labelField: 'label',
+          valueField: 'value',
+          values: {
+            '男': {label: '男', value: '男'},
+            '女': {label: '女', value: '女'}
+          }
+        },
+        yesOrNo: {
+          placeholder: '请选择是否',
+          labelField: 'label',
+          valueField: 'value',
+          values: {
+            1: {label: '是', value: 1},
+            0: {label: '否', value: 0}
+          }
+        },
+        banks: {
+          placeholder: '请选择开户行',
+          labelField: 'BANK_NAME',
+          valueField: 'BANK_CODE',
+          values: baseInfo.allOpenBank()
+        },
+        nations: {
+          placeholder: '请选择民族',
+          labelField: 'name',
+          valueField: 'id',
+          values: baseInfo.allNation()
+        },
+        location: {
+          placeholder: '请选择市场',
+          labelField: 'label',
+          valueField: 'value',
+          values: {
+            1: {label: '一市场', value: 1},
+            2: {label: '二市场', value: 2},
+            3: {label: '三市场', value: 3},
+            4: {label: '四市场', value: 4},
+            5: {label: '五市场', value: 5}
+          }
         }
       },
-      handleCurrentChange(page) {
-        this.getData(this.filterRequest, page, this.pageSize)
+      filterModel: {
+        userId: ''
       },
-      handleSizeChange(pageSize) {
-        this.getData(this.filterRequest, this.currentPage, pageSize)
+      allFilterTypes: this.filterTypes,
+      filterType: '',
+      filterSymbol: '',
+      filterSymbols: {
+        '=': 'Is equal to', // 等于
+        'like': 'Is including', // 包含
+        '<>': 'Is not', // 不等于
+        'notLike': 'not Is including ', // 不包含
+        '>': 'Is greater than', // 大于
+        '>=': 'Is greater than or equal to', // 大于等于
+        '<': 'Is smaller than', // 小于
+        '<=': 'Is smaller than or equal to'// 小于等于
       },
-      remoteMethod(query) {
-        if (query !== '') {
-          this.loading = true
-          network.getData(`user/filter-user`, {kw: query}).then(response => {
-            this.selectData = response
-            this.loading = false
-          }).catch(error => {
-            this.loading = false
-          })
-        }
+      filterRelation: 'and',
+      filterRelations: {
+        'and': '并且',
+        'or': '或者'
       },
-      handleOptionPlus() {
-        if (this.filterType === '' || this.filterSymbol === '' || (this.filterValue === '' && this.filterAreaValue === [])) {
-          this.$message({
-            message: 'please complete the selection',//请填写完整筛选内容
-            type: 'warning'
-          });
-          return false
-        }
-        let valueName = this.filterValue
-        if (this.filterType !== '' && this.allFilterTypes[this.filterType].hasOwnProperty('other')) {
-          //获取下拉筛选时的选中项
-          if(this.allFilterTypes[this.filterType].other === 'select'){
-            let nameObj = []
-            let _this = this
-            if (!Array.isArray(this.allFilterTypes[this.filterType].selectData)) {
-              nameObj[0] = this.allFilterTypes[this.filterType].selectData[_this.filterValue]
-            } else {
-              nameObj = (this.allFilterTypes[this.filterType].selectData).filter(function (item, index, array) {
-                return item.id === _this.filterValue
-              });
-            }
-            valueName = nameObj[0] ? nameObj[0].name : null
+      filterValue: '',
+      filterName: '',
+      filterSelected: [],
+      selectData: [],
+      multipleSelection: [],
+      multipleSelectionUserId: [],
+      regionData: store.state.regionInfo.regionData,
+      filterAreaValue: [],
+      filterRequest: {}
+    }
+  },
+  watch: {
+    filterTypes (newVal) {
+      this.allFilterTypes = this.filterTypes
+    }
+  },
+  methods: {
+    handleFilterTypeChange () {
+      this.filterValue = ''
+    },
+    handleSelectionChange (val) {
+      this.multipleSelection = val
+      this.multipleSelectionUserId = []
+      for (let i in this.multipleSelection) {
+        this.multipleSelectionUserId.push(this.multipleSelection[i].ID)
+      }
+    },
+    handleCurrentChange (page) {
+      this.getData(this.filterRequest, page, this.pageSize)
+    },
+    handleSizeChange (pageSize) {
+      this.getData(this.filterRequest, this.currentPage, pageSize)
+    },
+    remoteMethod (query) {
+      if (query !== '') {
+        this.loading = true
+        network.getData(`user/filter-user`, {kw: query}).then(response => {
+          this.selectData = response
+          this.loading = false
+        }).catch(error => {
+          console.log(error)
+          this.loading = false
+        })
+      }
+    },
+    handleOptionPlus () {
+      if (this.filterType === '' || this.filterSymbol === '' || (this.filterValue === '' && this.filterAreaValue === [])) {
+        this.$message({
+          message: 'please complete the selection', // 请填写完整筛选内容
+          type: 'warning'
+        })
+        return false
+      }
+      let valueName = this.filterValue
+      if (this.filterType !== '' && this.allFilterTypes[this.filterType].hasOwnProperty('other')) {
+        // 获取下拉筛选时的选中项
+        if (this.allFilterTypes[this.filterType].other === 'select') {
+          let nameObj = []
+          let _this = this
+          if (!Array.isArray(this.allFilterTypes[this.filterType].selectData)) {
+            nameObj[0] = this.allFilterTypes[this.filterType].selectData[_this.filterValue]
+          } else {
+            nameObj = (this.allFilterTypes[this.filterType].selectData).filter(function (item, index, array) {
+              return item.id === _this.filterValue
+            })
           }
-          else if(this.allFilterTypes[this.filterType].other === 'area'){
-            if(this.filterSymbol!=='='){
-              this.$message({
-                message: '地区仅限于"等于"的筛选方式',
-                type: 'warning'
-              });
-              return false
-            }
-            this.filterValue = this.filterAreaValue.join(',')
-            valueName = ''
-            for(let i in this.regionData){
-              if(this.regionData[i].value === this.filterAreaValue[0]){
-                valueName += this.regionData[i].label+','
-                for(let j in this.regionData[i].children){
-                  if(this.regionData[i].children[j].value === this.filterAreaValue[1]){
-                    valueName += this.regionData[i].children[j].label+','
-                    for(let h in this.regionData[i].children[j].children){
-                      if(this.regionData[i].children[j].children[h].value === this.filterAreaValue[2]){
-                        valueName += this.regionData[i].children[j].children[h].label
-                        break;
-                      }
+          valueName = nameObj[0] ? nameObj[0].name : null
+        } else if (this.allFilterTypes[this.filterType].other === 'area') {
+          if (this.filterSymbol !== '=') {
+            this.$message({
+              message: '地区仅限于"等于"的筛选方式',
+              type: 'warning'
+            })
+            return false
+          }
+          this.filterValue = this.filterAreaValue.join(',')
+          valueName = ''
+          for (let i in this.regionData) {
+            if (this.regionData[i].value === this.filterAreaValue[0]) {
+              valueName += this.regionData[i].label + ','
+              for (let j in this.regionData[i].children) {
+                if (this.regionData[i].children[j].value === this.filterAreaValue[1]) {
+                  valueName += this.regionData[i].children[j].label + ','
+                  for (let h in this.regionData[i].children[j].children) {
+                    if (this.regionData[i].children[j].children[h].value === this.filterAreaValue[2]) {
+                      valueName += this.regionData[i].children[j].children[h].label
+                      break
                     }
-                    break;
                   }
+                  break
                 }
-                break;
               }
+              break
             }
           }
-          else if(this.filterCustomType.hasOwnProperty(this.allFilterTypes[this.filterType].other)) {
-            let allCustomData = this.filterCustomType[this.allFilterTypes[this.filterType].other].values
-            let customField = this.filterCustomType[this.allFilterTypes[this.filterType].other].labelField
-            valueName = allCustomData[this.filterValue][customField]
-          }
+        } else if (this.filterCustomType.hasOwnProperty(this.allFilterTypes[this.filterType].other)) {
+          let allCustomData = this.filterCustomType[this.allFilterTypes[this.filterType].other].values
+          let customField = this.filterCustomType[this.allFilterTypes[this.filterType].other].labelField
+          valueName = allCustomData[this.filterValue][customField]
         }
-        // 如果是筛选会员编号,则把会员编号转成小写
-        // if(this.filterType === 'USER_NAME'){
-        //   this.filterValue = this.filterValue.toLowerCase()
-        // }
+      }
+      // 如果是筛选会员编号,则把会员编号转成小写
+      // if(this.filterType === 'USER_NAME'){
+      //   this.filterValue = this.filterValue.toLowerCase()
+      // }
 
-        this.filterSelected.push({
-          filterType: this.filterType,
-          filterTypeName: this.allFilterTypes[this.filterType].name,
-          filterSymbol: this.filterSymbol,
-          filterSymbolName: this.filterSymbols[this.filterSymbol],
-          filterValue: this.filterValue,
-          filterRelation: this.filterRelation,
-          filterRelationName: this.filterRelations[this.filterRelation],
-          filterName: valueName,
-          filterOther: this.filterType !== '' && this.allFilterTypes[this.filterType].hasOwnProperty('other') ? this.allFilterTypes[this.filterType].other : null,
-          isUserTable: this.allFilterTypes[this.filterType].isUserTable,
-        })
-      },
-      handleCloseTag(tag) {
-        this.filterSelected.splice(tag, 1)
-      },
-      handleFilterUser() {
-        if (this.filterSelected.length > 0) {
-          this.loading = true
-          this.filterRequest = {}
-          for (let i in this.filterSelected) {
-            if (this.filterSelected[i].isUserTable) {
-              let reqFilterValue = `${this.filterSelected[i].filterSymbol},${this.filterSelected[i].filterValue}`
-              if (this.filterSelected[i].hasOwnProperty('filterOther')) {
-                reqFilterValue += `,${this.filterSelected[i].filterOther}`
-              }
-              let filterType = this.filterSelected[i].filterType
-              if (this.filterRequest[filterType]) {
-                this.$set(this.filterRequest, filterType, (this.filterRequest[filterType] + '|' + reqFilterValue))
-              } else {
-                this.$set(this.filterRequest, filterType, reqFilterValue)
-              }
+      this.filterSelected.push({
+        filterType: this.filterType,
+        filterTypeName: this.allFilterTypes[this.filterType].name,
+        filterSymbol: this.filterSymbol,
+        filterSymbolName: this.filterSymbols[this.filterSymbol],
+        filterValue: this.filterValue,
+        filterRelation: this.filterRelation,
+        filterRelationName: this.filterRelations[this.filterRelation],
+        filterName: valueName,
+        filterOther: this.filterType !== '' && this.allFilterTypes[this.filterType].hasOwnProperty('other') ? this.allFilterTypes[this.filterType].other : null,
+        isUserTable: this.allFilterTypes[this.filterType].isUserTable
+      })
+    },
+    handleCloseTag (tag) {
+      this.filterSelected.splice(tag, 1)
+    },
+    handleFilterUser () {
+      if (this.filterSelected.length > 0) {
+        this.loading = true
+        this.filterRequest = {}
+        for (let i in this.filterSelected) {
+          if (this.filterSelected[i].isUserTable) {
+            let reqFilterValue = `${this.filterSelected[i].filterSymbol},${this.filterSelected[i].filterValue}`
+            if (this.filterSelected[i].hasOwnProperty('filterOther')) {
+              reqFilterValue += `,${this.filterSelected[i].filterOther}`
+            }
+            let filterType = this.filterSelected[i].filterType
+            if (this.filterRequest[filterType]) {
+              this.$set(this.filterRequest, filterType, (this.filterRequest[filterType] + '|' + reqFilterValue))
+            } else {
+              this.$set(this.filterRequest, filterType, reqFilterValue)
             }
-          }
-          if (Object.keys(this.filterRequest).length === 0) {
-            this.handleSelectValue(true)
-          } else {
-            this.getData(this.filterRequest,this.currentPage)
           }
         }
-      },
-      getData(request, page = null, pageSize = null) {
-        network.getPageData(this, 'user/filter-user', page, pageSize, request, response => {
-          this.filterUserDialogShow = true
-        })
-      },
-      handleSelectValue(isAll = false) {
-        let otherFilterTypes = [];
-        for (let i in this.filterSelected) {
-          if (!this.filterSelected[i].isUserTable) {
-            otherFilterTypes.push(this.filterSelected[i])
-          }
+        if (Object.keys(this.filterRequest).length === 0) {
+          this.handleSelectValue(true)
+        } else {
+          this.getData(this.filterRequest, this.currentPage)
         }
-        let userIds = this.multipleSelectionUserId
-        if (isAll) {
-          userIds = 'all'
+      }
+    },
+    getData (request, page = null, pageSize = null) {
+      network.getPageData(this, 'user/filter-user', page, pageSize, request, response => {
+        this.filterUserDialogShow = true
+      })
+    },
+    handleSelectValue (isAll = false) {
+      let otherFilterTypes = []
+      for (let i in this.filterSelected) {
+        if (!this.filterSelected[i].isUserTable) {
+          otherFilterTypes.push(this.filterSelected[i])
         }
-        this.$emit('select-value', {
-          userIds: userIds,
-          otherFilterTypes: otherFilterTypes,
-        })
-        this.filterUserDialogShow = false
-      },
-      handleFilterClear() {
-        Object.assign(this.$data, this.$options.data())
-        this.allFilterTypes = this.filterTypes
-        // 清空地址栏
-        filterHelper.clearFilterOption(this)
-        this.$emit('select-value', {userIds: 'all', otherFilterTypes: []})
       }
+      let userIds = this.multipleSelectionUserId
+      if (isAll) {
+        userIds = 'all'
+      }
+      this.$emit('select-value', {
+        userIds: userIds,
+        otherFilterTypes: otherFilterTypes
+      })
+      this.filterUserDialogShow = false
+    },
+    handleFilterClear () {
+      Object.assign(this.$data, this.$options.data())
+      this.allFilterTypes = this.filterTypes
+      // 清空地址栏
+      filterHelper.clearFilterOption(this)
+      this.$emit('select-value', {userIds: 'all', otherFilterTypes: []})
     }
   }
+}
 </script>
 
 <style scoped>

+ 1 - 1
frontendEle/src/views/user/dec.vue

@@ -17,7 +17,7 @@
                     </el-select><!--请选择报单级别-->
                 </el-form-item>
                 <el-form-item label="Stockist Code"><!--报单中心编号-->
-                    <el-input v-model="form.decUserName"></el-input>
+                    <el-input v-model="form.decUserName" readonly></el-input>
                 </el-form-item>