Browse Source

经销商管理

chenrui 2 years ago
parent
commit
bd8bfce381

+ 2 - 61
src/views/common/chooseDealer.vue

@@ -118,7 +118,7 @@ export default {
       },
       tableHeight: 0,
       disabled: false, //  查询、重置按钮是否可操作
-      loading: false,
+      loading: false, // 批量添加loading
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
@@ -167,66 +167,7 @@ export default {
       this.queryParam.auditState = undefined
       this.$refs.table.refresh(true)
     },
-    // 详情
-    handleDetail (row) {
-      if (this.$hasPermissions('B_warehousingConfirmationDetail')) {
-        this.itemSn = row.stockPutSn
-        this.nowData = row
-        this.openModal = true
-      }
-    },
-    closeModal () {
-      this.itemSn = ''
-      this.nowData = null
-      this.openModal = false
-    },
-    // 通过
-    handleConfirmationOk () {
-      if (this.isBatch) { //  批量
-        this.auditOrder(this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys, true)
-      } else {
-        this.auditOrder([this.confirmationInfo.stockPutSn], true)
-      }
-    },
-    // 不通过
-    handleConfirmationFail () {
-      if (this.isBatch) { //  批量
-        this.auditOrder(this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys, false)
-      } else {
-        this.auditOrder([this.confirmationInfo.stockPutSn], false)
-      }
-    },
-    // 单个审核
-    handleAudit (row) {
-      this.confirmationInfo = row
-      this.isBatch = false
-      this.confirmationModal = true
-    },
-    auditOrder (snList, flag) {
-      const _this = this
-      if (this.isBatch) {
-        _this.loading = true
-      }
-      _this.spinning = true
-      stockPutConfirm({ stockPutSnList: snList, confirm: flag }).then(res => {
-        if (this.isBatch) {
-          _this.loading = false
-        }
-        if (res.status == 200) {
-          if (this.isBatch) {
-            _this.$refs.table.clearSelected() // 清空表格选中项
-          }
-          _this.$message.success(res.message)
-          _this.$refs.table.refresh()
-          _this.confirmationModal = false
-          _this.spinning = false
-        } else {
-          _this.confirmationModal = false
-          _this.spinning = false
-        }
-      })
-    },
-    // 批量审核
+    // 批量添加
     handleBatchAudit () {
       const _this = this
       if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {

+ 28 - 47
src/views/dealerManagement/dealerZoneSearch/list.vue

@@ -17,7 +17,7 @@
             </a-col>
             <a-col :md="8" :sm="24">
               <a-form-item label="客服/区域负责人/销售总监">
-                <a-input id="dealerZoneSearch-dealerName" v-model.trim="queryParam.dealerName" allowClear placeholder="请输入客服/区域负责人/销售总监"/>
+                <a-input id="dealerZoneSearch-dealerName" v-model.trim="queryParam.customerName" allowClear placeholder="请输入客服/区域负责人/销售总监"/>
               </a-form-item>
             </a-col>
             <a-col :md="24" :sm="24" style="margin-top: 10px;text-align:center;">
@@ -29,7 +29,8 @@
                 class="button-warning"
                 @click="handleExport"
                 :disabled="disabled"
-                id="allocateBillList-export">导出</a-button>
+                :loading="exportLoading"
+                id="dealerZoneSearch-export">导出</a-button>
             </a-col>
           </a-row>
         </a-form>
@@ -59,8 +60,9 @@
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
-import { subareaQueryIncludeAreaAll, subareaDeleteBySn } from '@/api/subarea'
 import subarea from '@/views/common/subarea.js'
+import { exportExcel } from '@/libs/JGPrint.js'
+import { subareaQueryIncludeAreaAll, dealerExport } from '@/api/subarea'
 export default {
   name: 'DealerZoneSearch',
   mixins: [commonMixin],
@@ -72,15 +74,16 @@ export default {
       tableHeight: 0,
       queryParam: {
         subareaSn: undefined,
-        dealerName: ''
+        dealerName: '',
+        customerName: ''
       },
       columns: [
-        { title: '经销商名称', dataIndex: 'subareaName', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '所属区域', dataIndex: 'subareaName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '所属分区', dataIndex: 'subareaName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '客服', dataIndex: 'subareaName', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '区域负责人', dataIndex: 'subareaName', width: '18%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '销售总监', dataIndex: 'subareaName', width: '30%', align: 'center', customRender: function (text) { return text || '--' } }
+        { title: '经销商名称', dataIndex: 'subareaName1', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '所属区域', dataIndex: 'subareaName2', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '所属分区', dataIndex: 'subareaName3', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '客服', dataIndex: 'subareaName4', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '区域负责人', dataIndex: 'subareaName5', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '销售总监', dataIndex: 'subareaName', width: '20%', align: 'center', customRender: function (text) { return text || '--' } }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -100,49 +103,27 @@ export default {
           return data
         })
       },
-      openModal: false, //  编辑  弹框
-      nowData: null,
-      itemId: null //  当前产品id
+      exportLoading: false// 导出loading
     }
   },
   methods: {
-    handleExport () {},
-    //  重置
-    resetSearchForm () {
-      this.$refs.table.refresh(true)
-    },
-    // 删除
-    handleDel (row) {
+    // 导出
+    handleExport () {
       const _this = this
-      this.$confirm({
-        title: '提示',
-        content: '确定要删除吗?删除后,经销商解除区域归属,人员解除管辖区域,删除后数据不可恢复。',
-        centered: true,
-        onOk () {
-          _this.spinning = true
-          subareaDeleteBySn({ sn: row.subareaSn }).then(res => {
-            if (res.status == 200) {
-              _this.$message.success(res.message)
-              _this.$refs.table.refresh()
-              _this.spinning = false
-            } else {
-              _this.spinning = false
-            }
-          })
-        }
+      const params = this.queryParam
+      this.spinning = true
+      this.exportLoading = true
+      exportExcel(dealerExport, params, '经销商所属分区导出', function () {
+        _this.spinning = false
+        _this.exportLoading = false
       })
     },
-    //  编辑
-    handleEdit (row) {
-      this.itemId = row && row.subareaSn ? row.subareaSn : null
-      this.nowData = row
-      this.openModal = true
-    },
-    //  关闭弹框
-    closeModal () {
-      this.itemId = null
-      this.nowData = null
-      this.openModal = false
+    //  重置
+    resetSearchForm () {
+      this.queryParam.subareaSn = undefined
+      this.queryParam.dealerName = ''
+      this.queryParam.customerName = ''
+      this.$refs.table.refresh(true)
     },
     pageInit () {
       const _this = this

+ 1 - 152
src/views/dealerManagement/marketingDivisionSetNew/addAreaModal.vue

@@ -57,11 +57,6 @@ export default {
       return (this.itemId ? '编辑' : '新增') + '区域'
     }
   },
-  filters: {
-    hasCheckChild: function (value) {
-      return value.filter(item => item.checked).length
-    }
-  },
   data () {
     return {
       isShow: this.openModal, //  是否打开弹框
@@ -77,122 +72,10 @@ export default {
         subareaName: [
           { required: true, message: '请输入分区名称', trigger: 'blur' }
         ]
-      },
-      addrProvinceList: [], //  省下拉
-      subareaAreaList: []
+      }
     }
   },
   methods: {
-    filterEmpty () {
-      let str = this.form.subareaName
-      str = str.replace(/\ +/g, '')
-      str = str.replace(/[ ]/g, '')
-      str = str.replace(/[\r\n]/g, '')
-      this.form.subareaName = str
-    },
-    onChange (item, e, parent) {
-      // console.log(item, `checked = ${e.target.checked}`)
-      item.checked = e.target.checked
-      item.noSave = false
-      // 父级
-      if (item.type == 2) {
-        item.children && item.children.map(d => {
-          d.checked = item.checked
-        })
-        item.indeterminate = false
-      }
-      // 子级
-      if (item.type == 3) {
-        // 父级节点
-        const hasCheckd = parent.children.filter(k => k.checked)
-        // 是否全选
-        parent.checked = hasCheckd.length == parent.children.length
-        parent.children.map(d => d.noSave = parent.checked)
-        // indeterminate为true,则为全选,false则为部分选择或者空
-        parent.indeterminate = ((hasCheckd.length < parent.children.length) && (hasCheckd.length != 0))
-      }
-      this.addrProvinceList = JSON.parse(JSON.stringify(this.addrProvinceList))
-    },
-    // 展开收起
-    expend (item) {
-      if (item.children && item.children.length == 0) {
-        item.isOpen = 1
-        this.getArea('city', item, 1)
-      } else {
-        item.isOpen = !item.isOpen
-      }
-    },
-    //  省/市/区
-    getArea (leve, item, openType) {
-      let params
-      if (leve == 'province') {
-        params = { type: '2' }
-      } else {
-        params = { parentId: item.areaSn, type: leve == 'city' ? '3' : '4' }
-      }
-      getArea(params).then(res => {
-        if (res.status == 200) {
-          if (leve == 'province') {
-            this.addrProvinceList = res.data || []
-            this.addrProvinceList.map(item => {
-              item.noSave = true
-              item.checked = false
-              item.children = []
-              item.indeterminate = false
-            })
-            // 编辑时获取已选数据
-            if (this.itemId) {
-              this.getChecked()
-            }
-            document.getElementById('treeNode').scrollTop = 0
-          } else if (leve == 'city') {
-            item.children = res.data || []
-            item.children.map(d => {
-              // 编辑时回显
-              if (this.itemId && openType == 0) {
-                d.checked = !!this.subareaAreaList.find(o => o.areaSn == d.areaSn)
-                d.noSave = false
-              } else {
-                d.checked = item.checked
-                d.noSave = true
-              }
-            })
-
-            // 首次加载子级
-            if (openType == 1) {
-              this.addrProvinceList = JSON.parse(JSON.stringify(this.addrProvinceList))
-            } else {
-              item.isOpen = 1
-              item.indeterminate = true
-            }
-          }
-        } else {
-          if (leve == 'province') {
-            this.addrProvinceList = []
-          } else if (leve == 'city') {
-            item.children = []
-            item.isOpen = 0
-          }
-        }
-      })
-    },
-    // 过滤数据
-    filterData (list) {
-      list.map(item => {
-        if (item.checked && !item.noSave) {
-          this.subareaAreaList.push({
-            areaSn: item.areaSn,
-            areaName: item.name,
-            areaType: item.type,
-            areaParentSn: item.parentId
-          })
-        } else {
-          if (item.children && item.children.length) {
-            this.filterData(item.children)
-          }
-        }
-      })
-    },
     //  保存
     handleSave () {
       const _this = this
@@ -227,35 +110,6 @@ export default {
           return false
         }
       })
-    },
-    // 编辑
-    getChecked () {
-      subareaFindBySn({ sn: this.itemId }).then(res => {
-        // console.log(res.data)
-        this.form.subareaName = res.data.subareaName
-        this.subareaAreaList = res.data.subareaAreaList
-        this.form.subareaSn = res.data.subareaSn
-        this.form.id = res.data.id
-        // 回显数据
-        this.showChecked()
-      })
-    },
-    showChecked () {
-      // 省回显
-      this.addrProvinceList.map(item => {
-        item.checked = !!this.subareaAreaList.find(d => d.areaSn == item.areaSn)
-        item.noSave = false
-        item.indeterminate = false
-      })
-      // 市回显
-      const hasCity = this.nowData.subareaAreaList.filter(item => item.citySubareaAreaList && item.citySubareaAreaList.length)
-      // console.log(hasCity, 'hasCity.nowData')
-      hasCity.map(item => {
-        // 省
-        const pre = this.addrProvinceList.find(k => k.areaSn == item.areaSn)
-        // 获取子级
-        this.getArea('city', pre, 0)
-      })
     }
   },
   watch: {
@@ -267,11 +121,6 @@ export default {
     isShow (newValue, oldValue) {
       if (!newValue) {
         this.$emit('close')
-        this.form.subareaName = ''
-        this.form.subareaSn = ''
-        delete this.form.id
-      } else {
-        this.getArea('province')
       }
     }
   }

+ 1 - 152
src/views/dealerManagement/marketingDivisionSetNew/addZoneModal.vue

@@ -54,11 +54,6 @@ export default {
       return (this.itemId ? '编辑' : '新增') + '分区'
     }
   },
-  filters: {
-    hasCheckChild: function (value) {
-      return value.filter(item => item.checked).length
-    }
-  },
   data () {
     return {
       isShow: this.openModal, //  是否打开弹框
@@ -74,122 +69,10 @@ export default {
         subareaName: [
           { required: true, message: '请输入分区名称', trigger: 'blur' }
         ]
-      },
-      addrProvinceList: [], //  省下拉
-      subareaAreaList: []
+      }
     }
   },
   methods: {
-    filterEmpty () {
-      let str = this.zoneForm.subareaName
-      str = str.replace(/\ +/g, '')
-      str = str.replace(/[ ]/g, '')
-      str = str.replace(/[\r\n]/g, '')
-      this.zoneForm.subareaName = str
-    },
-    onChange (item, e, parent) {
-      // console.log(item, `checked = ${e.target.checked}`)
-      item.checked = e.target.checked
-      item.noSave = false
-      // 父级
-      if (item.type == 2) {
-        item.children && item.children.map(d => {
-          d.checked = item.checked
-        })
-        item.indeterminate = false
-      }
-      // 子级
-      if (item.type == 3) {
-        // 父级节点
-        const hasCheckd = parent.children.filter(k => k.checked)
-        // 是否全选
-        parent.checked = hasCheckd.length == parent.children.length
-        parent.children.map(d => d.noSave = parent.checked)
-        // indeterminate为true,则为全选,false则为部分选择或者空
-        parent.indeterminate = ((hasCheckd.length < parent.children.length) && (hasCheckd.length != 0))
-      }
-      this.addrProvinceList = JSON.parse(JSON.stringify(this.addrProvinceList))
-    },
-    // 展开收起
-    expend (item) {
-      if (item.children && item.children.length == 0) {
-        item.isOpen = 1
-        this.getArea('city', item, 1)
-      } else {
-        item.isOpen = !item.isOpen
-      }
-    },
-    //  省/市/区
-    getArea (leve, item, openType) {
-      let params
-      if (leve == 'province') {
-        params = { type: '2' }
-      } else {
-        params = { parentId: item.areaSn, type: leve == 'city' ? '3' : '4' }
-      }
-      getArea(params).then(res => {
-        if (res.status == 200) {
-          if (leve == 'province') {
-            this.addrProvinceList = res.data || []
-            this.addrProvinceList.map(item => {
-              item.noSave = true
-              item.checked = false
-              item.children = []
-              item.indeterminate = false
-            })
-            // 编辑时获取已选数据
-            if (this.itemId) {
-              this.getChecked()
-            }
-            document.getElementById('treeNode').scrollTop = 0
-          } else if (leve == 'city') {
-            item.children = res.data || []
-            item.children.map(d => {
-              // 编辑时回显
-              if (this.itemId && openType == 0) {
-                d.checked = !!this.subareaAreaList.find(o => o.areaSn == d.areaSn)
-                d.noSave = false
-              } else {
-                d.checked = item.checked
-                d.noSave = true
-              }
-            })
-
-            // 首次加载子级
-            if (openType == 1) {
-              this.addrProvinceList = JSON.parse(JSON.stringify(this.addrProvinceList))
-            } else {
-              item.isOpen = 1
-              item.indeterminate = true
-            }
-          }
-        } else {
-          if (leve == 'province') {
-            this.addrProvinceList = []
-          } else if (leve == 'city') {
-            item.children = []
-            item.isOpen = 0
-          }
-        }
-      })
-    },
-    // 过滤数据
-    filterData (list) {
-      list.map(item => {
-        if (item.checked && !item.noSave) {
-          this.subareaAreaList.push({
-            areaSn: item.areaSn,
-            areaName: item.name,
-            areaType: item.type,
-            areaParentSn: item.parentId
-          })
-        } else {
-          if (item.children && item.children.length) {
-            this.filterData(item.children)
-          }
-        }
-      })
-    },
     //  保存
     handleSave () {
       const _this = this
@@ -224,35 +107,6 @@ export default {
           return false
         }
       })
-    },
-    // 编辑
-    getChecked () {
-      subareaFindBySn({ sn: this.itemId }).then(res => {
-        // console.log(res.data)
-        this.form.subareaName = res.data.subareaName
-        this.subareaAreaList = res.data.subareaAreaList
-        this.form.subareaSn = res.data.subareaSn
-        this.form.id = res.data.id
-        // 回显数据
-        this.showChecked()
-      })
-    },
-    showChecked () {
-      // 省回显
-      this.addrProvinceList.map(item => {
-        item.checked = !!this.subareaAreaList.find(d => d.areaSn == item.areaSn)
-        item.noSave = false
-        item.indeterminate = false
-      })
-      // 市回显
-      const hasCity = this.nowData.subareaAreaList.filter(item => item.citySubareaAreaList && item.citySubareaAreaList.length)
-      // console.log(hasCity, 'hasCity.nowData')
-      hasCity.map(item => {
-        // 省
-        const pre = this.addrProvinceList.find(k => k.areaSn == item.areaSn)
-        // 获取子级
-        this.getArea('city', pre, 0)
-      })
     }
   },
   watch: {
@@ -264,11 +118,6 @@ export default {
     isShow (newValue, oldValue) {
       if (!newValue) {
         this.$emit('close')
-        this.form.subareaName = ''
-        this.form.subareaSn = ''
-        delete this.form.id
-      } else {
-        this.getArea('province')
       }
     }
   }

+ 2 - 25
src/views/dealerManagement/marketingDivisionSetNew/list.vue

@@ -17,19 +17,7 @@
         :data="loadData"
         :scroll="{ y: tableHeight }"
         :defaultLoadData="false"
-        expanded-row-keys
         bordered>
-        <!-- 市区 -->
-        <template slot="cityArea" slot-scope="text, record">
-          <div style="display: inline-block;margin-right: 15px;" v-for="item in record.subareaAreaList" :key="item.id">
-            {{ item.areaName }}
-            <span v-if="item.citySubareaAreaList">(</span>
-            <span style="color: #999;margin:0 3px;" v-for="area in item.citySubareaAreaList" :key="area.id">
-              {{ area.areaName }}
-            </span>
-            <span v-if="item.citySubareaAreaList">)</span>
-          </div>
-        </template>
         <!-- 操作 -->
         <template slot="action" slot-scope="text, record">
           <a-button
@@ -47,18 +35,15 @@
           <a-button
             size="small"
             type="link"
-            v-if="$hasPermissions('B_marketingDivisionSet_edit')"
             class="button-info"
             @click="handleEdit(record)"
             id="marketingDivisionSetNew-edit-btn">编辑</a-button>
           <a-button
             size="small"
             type="link"
-            v-if="$hasPermissions('B_marketingDivisionSet_del')"
             class="button-error"
             @click="handleDel(record)"
             id="marketingDivisionSetNew-del-btn">删除</a-button>
-          <span v-if="!$hasPermissions('B_marketingDivisionSet_edit') && !$hasPermissions('B_marketingDivisionSet_del')">--</span>
         </template>
       </s-table>
     </a-spin>
@@ -95,9 +80,7 @@ export default {
   data () {
     return {
       spinning: false,
-      disabled: false, //  查询、重置按钮是否可操作
       tableHeight: 0,
-      openAddDealer: false,
       openAreaModal: false,
       openZoneModal: false,
       openDealerModal: false,
@@ -107,7 +90,6 @@ export default {
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
-        this.disabled = true
         this.spinning = true
         return subareaQueryIncludeAreaAll(parameter).then(res => {
           let data
@@ -117,7 +99,6 @@ export default {
             for (var i = 0; i < data.length; i++) {
               data[i].no = no + i + 1
             }
-            this.disabled = false
           }
           this.spinning = false
           return data
@@ -134,10 +115,6 @@ export default {
     addZone (row) {
       this.openZoneModal = true
     },
-    //  重置
-    resetSearchForm () {
-      this.$refs.table.refresh(true)
-    },
     // 删除
     handleDel (row) {
       const _this = this
@@ -184,14 +161,14 @@ export default {
   mounted () {
     if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
       this.pageInit()
-      this.resetSearchForm()
+      this.$refs.table.refresh()
     }
   },
   activated () {
     // 如果是新页签打开,则重置当前页面
     if (this.$store.state.app.isNewTab) {
       this.pageInit()
-      this.resetSearchForm()
+      this.$refs.table.refresh()
     }
     // 仅刷新列表,不重置页面
     if (this.$store.state.app.updateList) {