Browse Source

业务负责人

chenrui 2 years ago
parent
commit
f16b54fb48

+ 117 - 0
src/api/bizuser.js

@@ -0,0 +1,117 @@
+import { axios } from '@/utils/request'
+
+//  人员 列表  分页
+export const queryUserList = (params) => {
+  const url = `/bizuser/queryUserList/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 业务负责人配置列表  分页
+export const queryPage = (params) => {
+  const url = `/bizuser/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+
+// 业务负责人配置列表   新增/编辑
+export const bizuserSave = params => {
+  return axios({
+    url: '/bizuser/save',
+    data: params,
+    method: 'post'
+  })
+}
+
+// 业务负责人配置列表 删除
+export const bizuserDelete = params => {
+  return axios({
+    url: `/bizuser/delete/${params.id}`,
+    data: {},
+    method: 'get'
+  })
+}
+
+/*
+****  设置管辖范围
+*/
+
+// 设置管辖品类  新增(生成sn)
+export const getNewScopeSn = params => {
+  return axios({
+    url: '/bizuser/scope/getNewScopeSn',
+    data: {},
+    method: 'get'
+  })
+}
+
+// 设置管辖品类
+export const saveProductBrandList = params => {
+  return axios({
+    url: '/bizuser/scope/saveProductBrandList',
+    data: params,
+    method: 'post'
+  })
+}
+
+// 设置管辖品类
+export const saveProductTypeList = params => {
+  return axios({
+    url: '/bizuser/scope/saveProductTypeList',
+    data: params,
+    method: 'post'
+  })
+}
+// 设置管辖品类
+export const bizuserScopeQueryPage = params => {
+  const url = `/bizuser/scope/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 设置管辖品类  删除整列
+export const bizuserScopeDelete = params => {
+  return axios({
+    url: `/bizuser/scope/delete/${params.id}`,
+    data: {},
+    method: 'get'
+  })
+}
+// 设置管辖品类  删除产品品牌
+export const deleteProductBrand = params => {
+  return axios({
+    url: `/bizuser/scope/detail/deleteProductBrand/${params.id}`,
+    data: {},
+    method: 'get'
+  })
+}
+// 设置管辖品类  删除产品分类
+export const deleteProductType = params => {
+  return axios({
+    url: `/bizuser/scope/detail/deleteProductType/${params.id}`,
+    data: {},
+    method: 'get'
+  })
+}
+//  业务负责人配置列表 导出
+// export const allocateBillExport = (params) => {
+//   return axios({
+//     url: '/allocateBill/exportExcel',
+//     data: params,
+//     method: 'post',
+//     responseType: 'blob'
+//   })
+// }

+ 16 - 16
src/views/common/chooseDealer.vue

@@ -32,7 +32,7 @@
             </a-col>
             <a-col :md="8" :sm="24">
               <a-form-model-item label="地区">
-                  <AreaList id="viewDealers-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
+                <AreaList id="viewDealers-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
               </a-form-model-item>
             </a-col>
           </div>
@@ -61,7 +61,7 @@
       :columns="columns"
       :data="loadData"
       :style="{ height: tableHeight+84.5+'px' }"
-      :scroll="{ y: tableHeight }"
+      :scroll="{ y: pageType=='viewDealers'?tableHeight:tableHeight+80 }"
       :defaultLoadData="false"
       bordered>
       <template slot="areas" slot-scope="text, record">
@@ -99,7 +99,7 @@ export default {
     },
     parentData: {
       type: Object,
-      default: function(){
+      default: function () {
         return null
       }
     }
@@ -144,8 +144,8 @@ export default {
     columns () {
       const _this = this
       const arr = [
-        { title: '经销商名称', dataIndex: 'dealerName', width: '30%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true  },
-        { title: '商户别名', dataIndex: 'dealerAlias', align: 'left', width: '30%', customRender: function (text) { return text || '--' }},
+        { title: '经销商名称', dataIndex: 'dealerName', width: '30%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '商户别名', dataIndex: 'dealerAlias', align: 'left', width: '30%', customRender: function (text) { return text || '--' } },
         { title: '商户类型', dataIndex: 'dealerTypeDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '商户级别', dataIndex: 'dealerLevelDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } }
       ]
@@ -159,7 +159,7 @@ export default {
       }
       return arr
     },
-    selectCount(){
+    selectCount () {
       return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length
     }
   },
@@ -168,17 +168,17 @@ export default {
     rowSelectionFun (obj) {
       this.rowSelectionInfo = obj || null
     },
-    areaChange(val){
+    areaChange (val) {
       this.queryParam.provinceSn = val[0] ? val[0] : ''
       this.queryParam.citySn = val[1] ? val[1] : ''
       this.queryParam.districtSn = val[2] ? val[2] : ''
     },
-    searchForm(flag){
+    searchForm (flag) {
       this.$refs.table.refresh(flag)
       this.$refs.table.clearSelected()
       this.spinning = false
     },
-    subareaChange(val){
+    subareaChange (val) {
       this.queryParam.subareaSn = val[0] ? val[0] : undefined
       this.queryParam.subareaAreaSn = val[1] ? val[1] : undefined
     },
@@ -199,7 +199,7 @@ export default {
       this.$refs.table.refresh(true)
       this.$refs.table.clearSelected()
     },
-    clearTable(){
+    clearTable () {
       this.rowSelectionInfo = null
       this.$refs.table.clearTable()
     },
@@ -212,10 +212,10 @@ export default {
       }
       const dealerSnList = _this.rowSelectionInfo.selectedRowKeys
       this.spinning = true
-      this.$emit("plAdd",dealerSnList)
+      this.$emit('plAdd', dealerSnList)
     },
-    handleAdd(row){
-      if(row.subareaNameSet&&row.subareaNameSet.length){
+    handleAdd (row) {
+      if (row.subareaNameSet && row.subareaNameSet.length) {
         const _this = this
         this.$confirm({
           title: '提示',
@@ -223,12 +223,12 @@ export default {
           centered: true,
           onOk () {
             _this.spinning = true
-            _this.$emit("add", row)
+            _this.$emit('add', row)
           }
         })
-      }else{
+      } else {
         this.spinning = true
-        this.$emit("add", row)
+        this.$emit('add', row)
       }
     },
     pageInit () {

+ 121 - 0
src/views/common/userName.vue

@@ -0,0 +1,121 @@
+<template>
+  <a-select
+    show-search
+    label-in-value
+    :size="size"
+    :value="userName"
+    :placeholder="placeholder"
+    style="width: 100%"
+    :filter-option="false"
+    :not-found-content="fetching ? undefined : null"
+    :dropdownMatchSelectWidth="false"
+    @search="fetchUser"
+    @change="handleChange"
+    allowClear
+  >
+    <a-spin v-if="fetching" slot="notFoundContent" size="small" />
+    <a-select-option v-for="item in data" :key="item.userSn" :value="item.userSn">
+      {{ item.userName }}
+    </a-select-option>
+  </a-select>
+</template>
+<script>
+import debounce from 'lodash/debounce'
+import { queryUserList } from '@/api/bizuser'
+export default {
+  props: {
+    id: {
+      type: String,
+      default: ''
+    },
+    size: {
+      type: String,
+      default: 'default'
+    },
+    itemSn: {
+      type: String || Number,
+      default: undefined
+    },
+    placeholder: {
+      type: String,
+      default: '请输入名称搜索'
+    },
+    cooperateFlag: {
+      type: String,
+      default: undefined
+    }
+  },
+  data () {
+    this.lastFetchId = 0
+    this.fetchUser = debounce(this.fetchUser, 800)
+    return {
+      data: [],
+      userName: [],
+      fetching: false
+    }
+  },
+  methods: {
+    fetchUser (userName) {
+      console.log('fetching user', userName)
+      if (userName == '') return
+      this.lastFetchId += 1
+      const fetchId = this.lastFetchId
+      this.data = []
+      this.fetching = true
+      const params = { pageNo: 1, pageSize: 20 }
+      if (this.itemSn) {
+        params.dealerSn = this.itemSn
+      } else {
+        params.userName = userName
+        if (this.cooperateFlag) {
+          params.cooperateFlag = this.cooperateFlag
+        }
+      }
+      queryUserList(params).then(res => {
+        if (fetchId !== this.lastFetchId) {
+          return
+        }
+        this.data = res.data && res.data.list ? res.data.list : []
+        this.fetching = false
+      })
+    },
+    handleChange (value) {
+      if (value) {
+        const row = this.data.filter(item => item.userSn == value.key)
+        Object.assign(this, {
+          userName: value,
+          data: [],
+          fetching: false
+        })
+        this.$emit('change', value || { key: undefined }, row[0], this.id)
+        // this.$emit('input', value.key)
+      } else {
+        this.setDufaultVal('')
+        this.resetForm()
+        this.$emit('change', value || { key: undefined }, undefined, this.id)
+        // this.$emit('input', value.key)
+      }
+    },
+    resetForm () {
+      this.userName = []
+    },
+    setData (value) {
+      Object.assign(this, {
+        userName: value,
+        data: [],
+        fetching: false
+      })
+    },
+    setDufaultVal (itemSn) {
+      this.fetchUser(itemSn)
+      this.setData({ key: itemSn })
+    }
+  },
+  mounted () {
+    if (this.itemSn) {
+      this.fetchUser(this.itemSn)
+      this.setData({ key: this.itemSn })
+    }
+  }
+}
+</script>

+ 79 - 36
src/views/dealerManagement/businessOwnerSettings/addModal.vue

@@ -4,7 +4,7 @@
     class="businessOwnerSettings-modal"
     :footer="null"
     :maskClosable="false"
-    title="新增人员"
+    :title="itemId ?'编辑人员':'新增人员'"
     v-model="isShow"
     @cancel="isShow=false"
     :width="600">
@@ -12,47 +12,46 @@
       <a-form-model
         ref="ruleForm"
         :model="form"
-        :rules="rules"
         :label-col="labelCol"
         :wrapper-col="wrapperCol"
+        :rules="rules"
       >
-        <a-form-model-item label="人员名称">
-          <a-input id="businessOwnerSettings-name" v-model.trim="form.name" allowClear placeholder="请输入人员姓名"/>
+        <a-form-model-item label="人员名称" prop="userSn">
+          <userName v-if="!itemId" ref="userName" id="businessOwnerSettings-userSn" @change="userChange"></userName>
+          <span>{{ user_name }}</span>
         </a-form-model-item>
-        <a-form-model-item label="人员类型" prop="subareaSnList">
-          <a-select
+        <a-form-model-item label="人员类型" prop="bizUserType">
+          <v-select
+            v-model="form.bizUserType"
+            ref="printStatus"
+            id="businessOwnerSettings-printStatus"
+            code="BIZ_USER_TYPE"
             placeholder="请选择人员类型"
-            allowClear
-            mode="multiple"
-            v-model="form.subareaSnList"
-            :showSearch="true"
-            :filter-option="filterOption">
-            <a-select-option v-for="item in subareaList" :key="item.subareaSn" :value="item.subareaSn">{{ item.subareaName }}</a-select-option>
-          </a-select>
+            allowClear></v-select>
         </a-form-model-item>
-        <a-form-model-item label="管辖经销商" prop="">
-          <a-radio-group v-model="form.value" @change="onChange">
-            <a-radio :value="1">
+        <a-form-model-item label="管辖经销商" prop="allDealerFlag">
+          <a-radio-group v-model="form.allDealerFlag">
+            <a-radio value="1">
               全部经销商
             </a-radio>
-            <a-radio :value="2">
+            <a-radio value="0">
               部分经销商
             </a-radio>
           </a-radio-group>
         </a-form-model-item>
-        <a-form-model-item label="管辖品类" prop="">
-          <a-radio-group v-model="form.value" @change="onChange">
-            <a-radio :value="1">
+        <a-form-model-item label="管辖品类" prop="allProductFlag">
+          <a-radio-group v-model="form.allProductFlag">
+            <a-radio value="1">
               全部品类
             </a-radio>
-            <a-radio :value="2">
+            <a-radio value="0">
               部分品类
             </a-radio>
           </a-radio-group>
         </a-form-model-item>
         <div style="display: flex;justify-content: center;padding: 30px 0;">
-          <a-button type="primary" @click="onSubmit">确定</a-button>
-          <a-button style="margin-left: 15px;" @click="cansel">取消</a-button>
+          <a-button type="primary" @click="handleSave">{{ itemId?'保存':'确定' }}</a-button>
+          <a-button style="margin-left: 15px;" @click="isShow=false">取消</a-button>
         </div>
       </a-form-model>
     </a-spin>
@@ -60,13 +59,21 @@
 </template>
 
 <script>
-import { checkWarehouseSave } from '@/api/checkWarehouse'
+
+import userName from '@/views/common/userName'
+import { VSelect } from '@/components'
+import { bizuserSave } from '@/api/bizuser.js'
 export default {
   name: 'ProductInfoDetailModal',
+  components: { VSelect, userName },
   props: {
     openModal: { //  弹框显示状态
       type: Boolean,
       default: false
+    },
+    itemId: {
+      type: String,
+      default: ''
     }
   },
   data () {
@@ -74,26 +81,61 @@ export default {
       spinning: false,
       isShow: this.openModal, //  是否打开弹框
       form: {
-        name: '',
-        subareaSnList: undefined
+        userSn: '',
+        bizUserType: undefined, // 人员类型
+        allDealerFlag: undefined,
+        allProductFlag: undefined
       },
+      user_name: '',
       labelCol: { span: 5 },
-      wrapperCol: { span: 16 }
+      wrapperCol: { span: 16 },
+      rules: {
+        userSn: [{ required: true, message: '请输入人员名称', trigger: 'change' }],
+        bizUserType: [{ required: true, message: '请选择人员类型', trigger: 'change' }],
+        allDealerFlag: [{ required: true, message: '请选择管辖经销商', trigger: 'change' }],
+        allProductFlag: [{ required: true, message: '请选择管辖产品', trigger: 'change' }]
+      }
     }
   },
   methods: {
-    onChange () {},
-    // 确定
     handleSave () {
-      this.spinning = true
-      checkWarehouseSave({}).then(res => {
-        this.spinning = false
-        if (res.status == 200) {
-          this.$message.success('盘点单新增成功')
-          this.$emit('ok', res.data)
-          this.isShow = false
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          _this.spinning = true
+          if (_this.itemId) {
+            _this.form.id = _this.itemId
+          }
+          bizuserSave(_this.form).then(res => {
+            _this.spinning = false
+            if (res.status == 200) {
+              _this.$emit('ok', res.data)
+              _this.isShow = false
+            }
+          })
+        } else {
+          console.log('error submit!!')
+          return false
         }
       })
+    },
+    resetSearchForm () {
+      if (!this.itemId) {
+        this.$refs.userName.resetForm()
+      }
+      this.$refs.ruleForm.resetFields()
+    },
+    userChange (val) {
+      this.form.userSn = val.key
+    },
+    getEditInfo (obj) {
+      this.user_name = obj.userName
+      this.form = {
+        userSn: obj.userSn,
+        bizUserType: obj.bizUserType, // 人员类型
+        allDealerFlag: obj.allDealerFlag,
+        allProductFlag: obj.allProductFlag
+      }
     }
   },
   watch: {
@@ -104,6 +146,7 @@ export default {
     //  重定义的弹框状态
     isShow (newValue, oldValue) {
       if (!newValue) {
+        this.resetSearchForm()
         this.$emit('close')
       }
     }

+ 147 - 74
src/views/dealerManagement/businessOwnerSettings/categorySet.vue

@@ -3,7 +3,7 @@
     <a-spin :spinning="spinning" tip="Loading...">
       <a-card size="small" :bordered="false" class="categorySet-cont">
         <div class="table-operator" ref="categorySetAddBtn">
-          <a-button type="primary" class="button-error" @click="addCategory">+新增管辖品类</a-button>
+          <a-button type="primary" class="button-error" @click="addCategory" :disabled="disabled">+新增管辖品类</a-button>
         </div>
         <a-table
           bordered
@@ -15,10 +15,10 @@
           :scroll="{ y: tableHeight }" -->
           <!-- 产品分类 -->
           <template slot="classify" slot-scope="text,record,index">
-            <a-row v-if="record.classifyList && record.classifyList.length>0">
+            <a-row v-if="record.productTypeList && record.productTypeList.length>0">
               <a-col :span="20">
-                <a-tag closable @close="delLabel(index,i,'classifyList')" v-for="(con,i) in record.classifyList" :key="i">
-                  {{ con }}
+                <a-tag closable @close.prevent="delLabel(record.bizUserScopeSn,con,'typeList')" v-for="(con,i) in record.productTypeList" :key="i">
+                  {{ con.dataName }}
                 </a-tag>
               </a-col>
               <a-col :span="4" style="text-align:right;">
@@ -37,32 +37,32 @@
           </template>
           <!-- 产品品牌 -->
           <template slot="brand" slot-scope="text,record,index">
-            <a-row v-if="record.brandList && record.brandList.length>0">
+            <a-row v-if="record.productBrandList && record.productBrandList.length>0">
               <a-col :span="20">
-                <a-tag closable @close="delLabel(index,j,'brandList')" v-for="(item,j) in record.brandList" :key="j">
-                  {{ item }}
+                <a-tag closable @close.prevent="delLabel(record.bizUserScopeSn,item,'brandList')" v-for="(item,j) in record.productBrandList" :key="j">
+                  {{ item.dataName }}
                 </a-tag>
               </a-col>
               <a-col :span="4" style="text-align:right;">
-                <a-tag style="background: #fff; borderStyle: dashed;" @click="addBrandTag" color="blue">
+                <a-tag style="background: #fff; borderStyle: dashed;" @click="addBrandTag(index, record)" color="blue">
                   <a-icon type="plus" /> 选择
                 </a-tag>
               </a-col>
             </a-row>
             <a-row v-else>
               <a-col :span="24">
-                <a-tag style="background: #fff; borderStyle: dashed;" @click="addBrandTag" color="blue">
+                <a-tag style="background: #fff; borderStyle: dashed;" @click="addBrandTag(index, record)" color="blue">
                   <a-icon type="plus" /> 选择
                 </a-tag>
               </a-col>
             </a-row>
           </template>
-          <span slot="action" slot-scope="text, record">
+          <span slot="action" slot-scope="text,record">
             <a-button
               size="small"
               type="link"
               class="button-error"
-              @click="handleDel(text)"
+              @click="handleDel(record)"
             >
               删除
             </a-button>
@@ -70,21 +70,22 @@
         </a-table>
       </a-card>
     </a-spin>
-    <!-- 选择分类 -->
-    <chooseClassifyModal :openModal="showClassifyModal" @ok="handleClassifyModal" @close="showClassifyModal=false" ></chooseClassifyModal>
-    <!-- 选择品牌 -->
-    <chooseBrandModal :openModal="showBrandModal" @close="showBrandModal=false" ></chooseBrandModal>
+    <!-- 选择产品品牌 -->
+    <chooseBrandModal :openModal="openBrandModal" @close="openBrandModal=false" @ok="handleBrandOk" />
+    <!-- 选择产品分类 -->
+    <chooseTypeModal :openModal="openTypeModal" @close="openTypeModal=false" @ok="handleTypeOk" />
   </div>
 </template>
 
 <script>
 import { commonMixin } from '@/utils/mixin'
-import chooseBrandModal from './chooseBrandModal'
-import chooseClassifyModal from './chooseClassifyModal'
+import ChooseBrandModal from '@/views/common/chooseBrandModal.vue'
+import ChooseTypeModal from '@/views/common/chooseTypeModal.vue'
+import { getNewScopeSn, bizuserScopeQueryPage, saveProductBrandList, saveProductTypeList, bizuserScopeDelete, deleteProductBrand, deleteProductType } from '@/api/bizuser'
 export default {
   name: 'CategorySet',
   mixins: [commonMixin],
-  components: { chooseBrandModal, chooseClassifyModal },
+  components: { ChooseBrandModal, ChooseTypeModal },
   data () {
     return {
       spinning: false,
@@ -103,9 +104,11 @@ export default {
       openModal: false, //  新增编辑产品品牌  弹框
       itemSn: '', //  当前sn
       nowData: null, //  当前记录数据
-      showClassifyModal: false,
-      showBrandModal: false,
-      ChooseClassifyPos: null
+      openBrandModal: false,
+      openTypeModal: false,
+      chooseBrand: null,
+      chooseType: null,
+      chooseObj: null// 选择品牌 内容
     }
   },
   methods: {
@@ -115,65 +118,133 @@ export default {
     },
     // 新增管辖品类
     addCategory () {
-      const newData = {
-        classifyList: [],
-        brandList: []
-      }
-      this.dataSource.push(newData)
+      const _this = this
+      _this.spinning = true
+      _this.disabled = true
+      getNewScopeSn({}).then(res => {
+        if (res.status == 200) {
+          const newData = {
+            bizUserScopeSn: res.data,
+            productTypeList: [],
+            productBrandList: []
+          }
+          _this.dataSource.push(newData)
+        }
+        _this.spinning = false
+        _this.disabled = false
+      })
     },
     // 删除分类、品牌标签
-    delLabel (pos, i, name) {
-      this.dataSource[pos][name].splice(i, 1)
+    delLabel (bigRow, row, type) {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '删除后不可恢复,确定要删除吗?',
+        centered: true,
+        onOk () {
+          console.log('11111', bigRow)
+          const bigPos = _this.dataSource.findIndex(con => { return bigRow == con.bizUserScopeSn })
+          if (type == 'typeList') {
+            const typePos = _this.dataSource[bigPos].productTypeList.findIndex(item => { return item.id == item.id })
+            deleteProductType({ id: _this.dataSource[bigPos].productTypeList[typePos].id }).then(res => {
+              if (res.status == 200) {
+                _this.dataSource[bigPos].productTypeList.splice(typePos, 1)
+              }
+            })
+          } else {
+            const brandPos = _this.dataSource[bigPos].productBrandList.findIndex(obj => { return obj.id == obj.id })
+            deleteProductBrand({ id: _this.dataSource[bigPos].productBrandList[brandPos].id }).then(res => {
+              if (res.status == 200) {
+                _this.dataSource[bigPos].productBrandList.splice(brandPos, 1)
+              }
+            })
+          }
+        }
+      })
     },
     // 添加分类标签
     addClassifyTag (pos, row) {
-      this.ChooseClassifyPos = pos
-      this.showClassifyModal = true
+      this.chooseObj = row
+      this.openTypeModal = true
     },
     handleClassifyModal (con) {
       const chooseList = con
-      this.showClassifyModal = false
-      this.dataSource[this.ChooseClassifyPos].classifyList = [...this.dataSource[this.ChooseClassifyPos].classifyList, ...chooseList]
+      this.openTypeModal = false
+      this.dataSource[this.ChooseClassifyPos].productTypeList = [...this.dataSource[this.ChooseClassifyPos].productTypeList, ...chooseList]
+    },
+    // 分类
+    handleTypeOk (obj) {
+      this.chooseType = obj
+      this.saveChangeData('CATEGORY')
     },
     // 添加品牌标签
     addBrandTag (pos, row) {
-      this.ChooseBrandPos = pos
-      this.showBrandModal = true
+      this.chooseObj = row
+      this.openBrandModal = true
     },
-    // 保存
-    save () {
-
+    // 品牌
+    handleBrandOk (obj) {
+      this.chooseBrand = obj
+      this.saveChangeData('BRAND')
     },
-    //  新增/编辑
-    handleEdit (row) {
-      if (row) {
-        this.itemSn = row.warehouseLocationSn
-        row.warehouseSn = this.$route.params.sn
-        this.nowData = row
-      } else {
-        this.itemSn = null
-        this.nowData = { warehouseSn: this.$route.params.sn }
+    saveChangeData (type) {
+      const _this = this
+      if (type == 'BRAND') { //  选择品牌
+        if (_this.chooseBrand.length > 0) {
+          const snList = []
+          _this.chooseBrand.map(item => {
+            const newObj = {}
+            newObj.dataSn = item.brandSn
+            snList.push(newObj)
+          })
+          this.save(snList, type)
+        }
+      } else if (type == 'CATEGORY') { //  选择分类
+        if (_this.chooseType.length > 0) {
+          const snList = []
+          _this.chooseType.map(item => {
+            const newObj = {}
+            newObj.dataSn = item.productTypeSn
+            snList.push(newObj)
+          })
+          this.save(snList, type)
+        }
       }
-      this.openModal = true
     },
-    //  新增/编辑  成功
-    handleOk () {
-      this.$refs.table.refresh(true)
-    },
-    //  关闭弹框
-    closeModal () {
-      this.itemSn = ''
-      this.openModal = false
+    save (list, type) {
+      const ajaxdata = { userSn: this.$route.query.sn, bizUserScopeSn: this.chooseObj.bizUserScopeSn }
+      if (type == 'BRAND') {
+        ajaxdata.productBrandList = list
+        saveProductBrandList(ajaxdata).then(res => {
+          if (res.status == 200) {
+            this.openBrandModal = false
+            this.getTableData()
+          }
+        })
+      } else if (type == 'CATEGORY') {
+        ajaxdata.productTypeList = list
+        saveProductTypeList(ajaxdata).then(res => {
+          if (res.status == 200) {
+            this.openTypeModal = false
+            this.getTableData()
+          }
+        })
+      }
     },
-    //  删除
-    handleDel (pos) {
+    // 整行删除 删除
+    handleDel (row) {
       const _this = this
       this.$confirm({
         title: '提示',
         content: '删除后不可恢复,确定要进行删除吗?',
         centered: true,
         onOk () {
-          _this.dataSource.splice(pos, 1)
+          bizuserScopeDelete({ id: row.bizUserScopeSn }).then(res => {
+            if (res.status == 200) {
+              const pos = _this.dataSource.findIndex(item => { return item.bizUserScopeSn == row.bizUserScopeSn })
+              _this.dataSource.splice(pos, 1)
+            }
+          })
         }
       })
     },
@@ -182,6 +253,24 @@ export default {
       this.$nextTick(() => { // 页面渲染完成后的回调
         _this.setTableH()
       })
+      this.getTableData()
+    },
+    // 获取列表数据
+    getTableData (params = {}) {
+      this.spinning = true
+      bizuserScopeQueryPage({
+        pageNo: 1,
+        pageSize: 20,
+        userSn: this.$route.query.sn,
+        hasDetail: 1,
+        ...params
+
+      }).then(res => {
+        if (res.status == 200) {
+          this.dataSource = res.data.list
+        }
+        this.spinning = false
+      })
     },
     setTableH () {
       const addBtnHeight = this.$refs.categorySetAddBtn.offsetHeight
@@ -193,22 +282,6 @@ export default {
       this.setTableH()
     }
   },
-  mounted () {
-    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
-      this.pageInit()
-    }
-  },
-  activated () {
-    // 如果是新页签打开,则重置当前页面
-    if (this.$store.state.app.isNewTab) {
-      this.pageInit()
-    }
-    // 仅刷新列表,不重置页面
-    if (this.$store.state.app.updateList) {
-      this.pageInit()
-      this.$refs.table.refresh()
-    }
-  },
   beforeRouteEnter (to, from, next) {
     next(vm => {})
   }

+ 14 - 11
src/views/dealerManagement/businessOwnerSettings/chooseAreaModal.vue

@@ -45,19 +45,22 @@ export default {
       tableHeight: 0
     }
   },
-
   methods: {
-    onLoadData (treeNode) {
-      return new Promise(resolve => {
-        if (treeNode.dataRef.children) {
-          resolve()
-          return
+    getArea () {
+      subareaQueryAll().then(res => {
+        if (res.status == 200) {
+          res.data && res.data.map(item => {
+            item.name = item.subareaName
+            item.areaSn = item.subareaSn
+            if (item.subareaAreaList) {
+              item.subareaAreaList.map(cd => {
+                cd.name = cd.subareaAreaName
+                cd.areaSn = cd.subareaAreaSn
+              })
+            }
+          })
+          this.list = res.data
         }
-        setTimeout(() => {
-          treeNode.dataRef.children = [{ title: 'Child Node', key: `${treeNode.eventKey}-0` }, { title: 'Child Node', key: `${treeNode.eventKey}-1` }]
-          this.treeData = [...this.treeData]
-          resolve()
-        }, 1000)
       })
     },
     pageInit () {

+ 0 - 114
src/views/dealerManagement/businessOwnerSettings/chooseBrandModal.vue

@@ -1,114 +0,0 @@
-<template>
-  <a-modal
-    centered
-    class="chooseClassify-modal"
-    :footer="null"
-    :maskClosable="false"
-    title="选择产品分类"
-    v-model="isShow"
-    @cancel="isShow=false"
-    :width="680">
-    <a-spin :spinning="spinning" tip="Loading...">
-      <div class="checkboxAllBtn">
-        <a-checkbox :indeterminate="indeterminate" :checked="checkAll" @change="onCheckAllChange">
-          全选
-        </a-checkbox>
-      </div>
-      <a-tree :load-data="onLoadData" :tree-data="treeData" checkable/>
-      <div class="btn-cont">
-        <a-button type="primary" id="product-category-edit-modal-save" @click="handleSave">保存</a-button>
-        <a-button id="product-category-edit-modal-back" @click="isShow = false" style="margin-left: 15px;">取消</a-button>
-      </div>
-    </a-spin>
-  </a-modal>
-</template>
-
-<script>
-import { commonMixin } from '@/utils/mixin'
-export default {
-  name: 'ChooseClassifyModal',
-  mixins: [commonMixin],
-  props: {
-    openModal: { //  弹框显示状态
-      type: Boolean,
-      default: false
-    }
-  },
-  data () {
-    return {
-      isShow: this.openModal, //  是否打开弹框
-      spinning: false,
-      checkedList: [],
-      treeData: [{ title: 'Expand to load', key: '0' },
-        { title: 'Expand to load', key: '1' },
-        { title: 'Tree Node', key: '2', isLeaf: true }],
-      indeterminate: false,
-      checkAll: false
-    }
-  },
-  methods: {
-    onLoadData (treeNode) {
-      return new Promise(resolve => {
-        if (treeNode.dataRef.children) {
-          resolve()
-          return
-        }
-        setTimeout(() => {
-          treeNode.dataRef.children = [
-            { title: 'Child Node', key: `${treeNode.eventKey}-0` },
-            { title: 'Child Node', key: `${treeNode.eventKey}-1` }
-          ]
-          this.treeData = [...this.treeData]
-          resolve()
-        }, 1000)
-      })
-    },
-    onCheckAllChange (e) {
-      Object.assign(this, {
-        checkedList: e.target.checked ? this.plainOptions : [],
-        indeterminate: false,
-        checkAll: e.target.checked
-      })
-    },
-    //  保存
-    handleSave () {
-      const _this = this
-      _this.$emit('ok', _this.checkedList)
-    }
-  },
-  watch: {
-    //  父页面传过来的弹框状态
-    openModal (newValue, oldValue) {
-      this.isShow = newValue
-    },
-    //  重定义的弹框状态
-    isShow (newValue, oldValue) {
-      if (!newValue) {
-        this.$emit('close')
-        this.indeterminate = false
-        this.checkAll = false
-        this.checkedList = []
-      } else {
-        this.getData()
-      }
-    }
-  }
-}
-</script>
-
-<style lang="less">
-  .chooseClassify-modal{
-    .ant-modal-body {
-      padding: 20px 30px;
-      .checkboxAllBtn{
-        border-bottom:1px solid #E9E9E9;
-        padding-bottom:20px;
-        margin-bottom:20px;
-      }
-    }
-    .btn-cont {
-      text-align: center;
-      margin: 35px 0 10px;
-    }
-  }
-</style>

+ 0 - 103
src/views/dealerManagement/businessOwnerSettings/chooseClassifyModal.vue

@@ -1,103 +0,0 @@
-<template>
-  <a-modal
-    centered
-    class="chooseClassify-modal"
-    :footer="null"
-    :maskClosable="false"
-    title="选择产品分类"
-    v-model="isShow"
-    @cancel="isShow=false"
-    :width="680">
-    <a-spin :spinning="spinning" tip="Loading...">
-      <div class="checkboxAllBtn">
-        <a-checkbox :indeterminate="indeterminate" :checked="checkAll" @change="onCheckAllChange">
-          全选
-        </a-checkbox>
-      </div>
-      <a-checkbox-group v-model="checkedList" :options="plainOptions" @change="onChange" />
-      <div class="btn-cont">
-        <a-button type="primary" id="product-category-edit-modal-save" @click="handleSave">保存</a-button>
-        <a-button id="product-category-edit-modal-back" @click="isShow = false" style="margin-left: 15px;">取消</a-button>
-      </div>
-    </a-spin>
-  </a-modal>
-</template>
-
-<script>
-import { commonMixin } from '@/utils/mixin'
-export default {
-  name: 'ChooseClassifyModal',
-  mixins: [commonMixin],
-  props: {
-    openModal: { //  弹框显示状态
-      type: Boolean,
-      default: false
-    }
-  },
-  data () {
-    return {
-      isShow: this.openModal, //  是否打开弹框
-      spinning: false,
-      checkedList: [],
-      plainOptions: ['欧司朗', '优志旺', '阪东BANDO', '东洋', '盖达', '欧皮特(Optibelt)'],
-      checkAll: false,
-      indeterminate: false
-    }
-  },
-  methods: {
-    getData () {
-
-    },
-    onChange () {
-      this.indeterminate = !!this.checkedList.length && this.checkedList.length < this.plainOptions.length
-      this.checkAll = this.checkedList.length === this.plainOptions.length
-    },
-    onCheckAllChange (e) {
-      Object.assign(this, {
-        checkedList: e.target.checked ? this.plainOptions : [],
-        indeterminate: false,
-        checkAll: e.target.checked
-      })
-    },
-    //  保存
-    handleSave () {
-      const _this = this
-      _this.$emit('ok', _this.checkedList)
-    }
-  },
-  watch: {
-    //  父页面传过来的弹框状态
-    openModal (newValue, oldValue) {
-      this.isShow = newValue
-    },
-    //  重定义的弹框状态
-    isShow (newValue, oldValue) {
-      if (!newValue) {
-        this.$emit('close')
-        this.indeterminate = false
-        this.checkAll = false
-        this.checkedList = []
-      } else {
-        this.getData()
-      }
-    }
-  }
-}
-</script>
-
-<style lang="less">
-  .chooseClassify-modal{
-    .ant-modal-body {
-      padding: 20px 30px;
-      .checkboxAllBtn{
-        border-bottom:1px solid #E9E9E9;
-        padding-bottom:20px;
-        margin-bottom:20px;
-      }
-    }
-    .btn-cont {
-      text-align: center;
-      margin: 35px 0 10px;
-    }
-  }
-</style>

+ 38 - 34
src/views/dealerManagement/businessOwnerSettings/list.vue

@@ -7,12 +7,18 @@
           <a-row :gutter="15">
             <a-col :md="6" :sm="24">
               <a-form-model-item label="人员类型">
-                <subarea id="businessOwnerSettings-subareaSn" ref="subarea" @change="subareaChange"></subarea>
+                <v-select
+                  v-model="queryParam.bizUserType"
+                  ref="printStatus"
+                  id="businessOwnerSettings-printStatus"
+                  code="BIZ_USER_TYPE"
+                  placeholder="请选择人员类型"
+                  allowClear></v-select>
               </a-form-model-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="人员姓名">
-                <a-input id="businessOwnerSettings-dealerName" v-model.trim="queryParam.dealerName" allowClear placeholder="请输入人员姓名"/>
+                <a-input id="businessOwnerSettings-name" v-model.trim="queryParam.userName" allowClear placeholder="请输入人员姓名"/>
               </a-form-item>
             </a-col>
             <a-col :md="24" :sm="24" style="margin-top: 10px;text-align:center;">
@@ -51,43 +57,41 @@
       </a-spin>
     </a-card>
     <!-- 新增 -->
-    <addModal :openModal="openAddModal" @close="openAddModal = false"></addModal>
+    <addModal :itemId="itemId" ref="addUser" :openModal="openAddModal" @close="closeModal" @ok="$refs.table.refresh(true)"></addModal>
   </div>
 </template>
 
 <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 { queryPage, bizuserDelete } from '@/api/bizuser'
 import addModal from './addModal'
 export default {
   name: 'BusinessOwnerSettings',
   mixins: [commonMixin],
-  components: { STable, VSelect, subarea, addModal },
+  components: { STable, VSelect, addModal },
   data () {
     return {
       spinning: false,
       disabled: false, //  查询、重置按钮是否可操作
       tableHeight: 0,
       queryParam: {
-        subareaSn: undefined,
-        subareaAreaSn: undefined,
-        dealerName: ''
+        bizUserType: '',
+        userName: undefined
       },
       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: '操作', scopedSlots: { customRender: 'action' }, width: '15%', align: 'center' }
+        { title: '创建时间', dataIndex: 'createDate', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '人员姓名', dataIndex: 'userName', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '人员类型', dataIndex: 'bizUserTypeDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '管辖经销商', dataIndex: 'allDealerFlagDictValue', width: '18%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '管辖品类', dataIndex: 'allProductFlagDictValue', width: '18%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '20%', align: 'center' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
-        return subareaQueryIncludeAreaAll(Object.assign(parameter,this.queryParam)).then(res => {
+        return queryPage(Object.assign(parameter, this.queryParam)).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
@@ -102,30 +106,30 @@ export default {
         })
       },
       openAddModal: false, //  编辑  弹框
-      nowData: null,
-      itemId: null //  当前产品id
+      itemId: ''
     }
   },
   methods: {
+    userChange (val) {
+      this.queryParam.userSn = val.key
+    },
     handleSetCategory (row) {
-      this.$router.push({ name: 'categorySet', query: { sn: row.sn } })
+      this.$router.push({ name: 'categorySet', query: { sn: row.userSn } })
     },
     // 新增
     handleAdd () {
       this.openAddModal = true
     },
-    subareaChange(val){
+    subareaChange (val) {
       this.queryParam.subareaSn = val[0] ? val[0] : undefined
       this.queryParam.subareaAreaSn = val[1] ? val[1] : undefined
     },
     //  重置
     resetSearchForm () {
       this.queryParam = {
-        subareaSn: undefined,
-        subareaAreaSn: undefined,
-        dealerName: ''
+        bizUserType: '',
+        userName: ''
       }
-      this.$refs.subarea.clearData()
       this.$refs.table.refresh(true)
     },
     // 删除
@@ -137,7 +141,7 @@ export default {
         centered: true,
         onOk () {
           _this.spinning = true
-          subareaDeleteBySn({ sn: row.subareaSn }).then(res => {
+          bizuserDelete({ id: row.id }).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$refs.table.refresh()
@@ -151,21 +155,24 @@ export default {
     },
     //  编辑
     handleEdit (row) {
-      this.itemId = row && row.subareaSn ? row.subareaSn : null
-      this.nowData = row
-      this.openModal = true
+      this.itemId = row.id
+      this.openAddModal = true
+      const _this = this
+      this.$nextTick(() => {
+        _this.$refs.addUser.getEditInfo(row)
+      })
     },
     //  关闭弹框
     closeModal () {
-      this.itemId = null
-      this.nowData = null
-      this.openModal = false
+      this.itemId = ''
+      this.openAddModal = false
     },
     pageInit () {
       const _this = this
       this.$nextTick(() => { // 页面渲染完成后的回调
         _this.setTableH()
       })
+      this.resetSearchForm()
     },
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight
@@ -180,19 +187,16 @@ export default {
   mounted () {
     if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
       this.pageInit()
-      this.resetSearchForm()
     }
   },
   activated () {
     // 如果是新页签打开,则重置当前页面
     if (this.$store.state.app.isNewTab) {
       this.pageInit()
-      this.resetSearchForm()
     }
     // 仅刷新列表,不重置页面
     if (this.$store.state.app.updateList) {
       this.pageInit()
-      this.$refs.table.refresh()
     }
   },
   beforeRouteEnter (to, from, next) {

+ 19 - 8
src/views/dealerManagement/businessOwnerSettings/settingsIndex.vue

@@ -12,7 +12,7 @@
       </div>
       <a-card size="small" :bordered="false" class="categorySet-cont">
         <div :style="{ height: tableHeight+84.5+'px' }">
-          <a-tabs default-active-key="1">
+          <a-tabs default-active-key="1" @change="handleTabs">
             <a-tab-pane key="1" tab="设置管辖区域">
               <div class="areaSet-wrap">
                 <div class="table-page-search-wrapper newTableSearchName" >
@@ -24,7 +24,7 @@
                     <a-row :gutter="15">
                       <a-col :md="6" :sm="24">
                         <a-form-model-item label="所在区域/分区">
-                          <subarea id="areaSet-subareaSn" ref="subarea" v-model="queryParam.subareaSn" @change="subareaChange"></subarea>
+                          <subarea id="chooseDealer-subarea" ref="subarea" @change="subareaChange"></subarea>
                         </a-form-model-item>
                       </a-col>
                       <a-col :md="6" :sm="24">
@@ -59,7 +59,7 @@
               </div>
             </a-tab-pane>
             <a-tab-pane key="2" tab="设置管辖品类" force-render>
-              <categorySet></categorySet>
+              <categorySet ref="setCategory"></categorySet>
             </a-tab-pane>
           </a-tabs>
         </div>
@@ -80,7 +80,7 @@
         :wrap-style="{ position: 'absolute' }"
         @close="openChooseDealer = false">
         <div class="dealerModalCon">
-          <chooseDealer></chooseDealer>
+          <chooseDealer @plAdd="handleAddDealer"></chooseDealer>
         </div>
       </a-drawer>
     </a-spin>
@@ -93,10 +93,12 @@ import { STable } from '@/components'
 import categorySet from './categorySet'
 import chooseAreaModal from './chooseAreaModal'
 import chooseDealer from '@/views/common/chooseDealer.vue'
+import { bizuserScopeQueryPage } from '@/api/bizuser'
+import subarea from '@/views/common/subarea.js'
 export default {
   name: 'SettingsIndex',
   mixins: [commonMixin],
-  components: { STable, categorySet, chooseAreaModal, chooseDealer },
+  components: { STable, categorySet, chooseAreaModal, chooseDealer, subarea },
   data () {
     return {
       openChooseArea: false,
@@ -104,6 +106,7 @@ export default {
       spinning: false,
       tableHeight: 0,
       queryParam: {
+        hasDetail: 0,
         subareaSn: undefined,
         subareaAreaSn: undefined,
         dealerName: ''
@@ -127,7 +130,7 @@ export default {
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
-        return subareaQueryIncludeAreaAll(Object.assign(parameter,this.queryParam)).then(res => {
+        return bizuserScopeQueryPage(Object.assign(parameter, this.queryParam)).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
@@ -144,7 +147,12 @@ export default {
     }
   },
   methods: {
-    subareaChange(val){
+    handleTabs (val) {
+      if (val == 2) {
+        this.$refs.setCategory.pageInit()
+      }
+    },
+    subareaChange (val) {
       this.queryParam.subareaSn = val[0] ? val[0] : undefined
       this.queryParam.subareaAreaSn = val[1] ? val[1] : undefined
     },
@@ -175,6 +183,9 @@ export default {
       }
       this.dataSource.push(newData)
     },
+    handleAddDealer (list) {
+      this.openChooseDealer = false
+    },
     // 删除分类、品牌标签
     delLabel (pos, i, name) {
       this.dataSource[pos][name].splice(i, 1)
@@ -236,6 +247,7 @@ export default {
       this.$nextTick(() => { // 页面渲染完成后的回调
         _this.setTableH()
       })
+      this.$refs.table.refresh()
     },
     setTableH () {
       const headHeight = this.$refs.headerBar.offsetHeight
@@ -260,7 +272,6 @@ export default {
     // 仅刷新列表,不重置页面
     if (this.$store.state.app.updateList) {
       this.pageInit()
-      this.$refs.table.refresh()
     }
   },
   beforeRouteEnter (to, from, next) {