chenrui il y a 2 ans
Parent
commit
271a839a72

+ 10 - 0
src/api/bizuser.js

@@ -162,3 +162,13 @@ export const bizuserScopeQueryDealer = (params) => {
     method: 'post'
   })
 }
+
+/* 供应商 */
+// 供应商显示列表
+// export const queryDealerScope = params => {
+//   return axios({
+//     url: '/bizuser/scope/querySupplierScope',
+//     data: params,
+//     method: 'post'
+//   })
+// }

+ 17 - 3
src/views/dealerManagement/businessOwnerSettings/addModal.vue

@@ -48,6 +48,17 @@
             </a-radio>
           </a-radio-group>
         </a-form-model-item>
+        <!-- 供应商 -->
+        <a-form-model-item label="供应商" prop="allSupplierFlag">
+          <a-radio-group v-model="form.allSupplierFlag">
+            <a-radio value="1">
+              全部供应商
+            </a-radio>
+            <a-radio value="0">
+              部分供应商
+            </a-radio>
+          </a-radio-group>
+        </a-form-model-item>
         <!-- 人员类型为仓库管理员时 显示管辖仓库 -->
         <a-form-model-item label="管辖仓库" prop="bizUserScopeList" v-if="form.bizUserType == 'cg'">
           <chooseWarehouse ref="warehouse" modeType="multiple" :value="warehouseList" @change="handleWarehouse"></chooseWarehouse>
@@ -89,7 +100,8 @@ export default {
         bizUserType: undefined, // 人员类型
         allDealerFlag: undefined,
         allProductFlag: undefined,
-        bizUserScopeList: []
+        bizUserScopeList: [],
+        allSupplierFlag: undefined
       },
       warehouseList: [],
       user_name: '',
@@ -100,7 +112,8 @@ export default {
         bizUserType: [{ required: true, message: '请选择人员类型', trigger: 'change' }],
         allDealerFlag: [{ required: true, message: '请选择管辖经销商', trigger: 'change' }],
         allProductFlag: [{ required: true, message: '请选择管辖产品', trigger: 'change' }],
-        bizUserScopeList: [{ required: true, message: '请选择管辖仓库', trigger: 'change' }]
+        bizUserScopeList: [{ required: true, message: '请选择管辖仓库', trigger: 'change' }],
+        allSupplierFlag: [{ required: true, message: '请选择供应商', trigger: 'change' }]
       }
     }
   },
@@ -173,7 +186,8 @@ export default {
         bizUserType: obj.bizUserType, // 人员类型
         allDealerFlag: obj.allDealerFlag,
         allProductFlag: obj.allProductFlag,
-        bizUserScopeList: newarr
+        bizUserScopeList: newarr,
+        allSupplierFlag: obj.allSupplierFlag
       }
     }
   },

+ 1 - 0
src/views/dealerManagement/businessOwnerSettings/list.vue

@@ -99,6 +99,7 @@ export default {
         { 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: '管辖供应商', dataIndex: 'allSupplierFlagDictValue', width: '18%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '管辖仓库', scopedSlots: { customRender: 'showWarehouse' }, width: '22%', align: 'center' },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '20%', align: 'center' }
       ],

+ 5 - 1
src/views/dealerManagement/businessOwnerSettings/settingsIndex.vue

@@ -71,6 +71,9 @@
             <a-tab-pane key="2" tab="设置管辖品类" force-render v-if="infoObj.allProductFlag&&infoObj.allProductFlag!=1">
               <categorySet ref="setCategory" :bizUserSn="infoObj.bizUserSn"></categorySet>
             </a-tab-pane>
+            <a-tab-pane key="3" tab="设置供应商" force-render v-if="infoObj.allSupplierFlag&&infoObj.allSupplierFlag!=1">
+              <supplierSet ref="setSupplier" :bizUserSn="infoObj.bizUserSn"></supplierSet>
+            </a-tab-pane>
           </a-tabs>
         </div>
       </a-card>
@@ -103,6 +106,7 @@
 import { commonMixin } from '@/utils/mixin'
 import { STable } from '@/components'
 import categorySet from './categorySet'
+import supplierSet from './supplierSet'
 import chooseAreaModal from './chooseAreaModal'
 import chooseDealer from './chooseDealer.vue'
 import { bizuserScopeQueryPage, bizuserScopeDelete, findById, queryAreaScope, queryDealerScope, saveAreaScope, saveDealerScope } from '@/api/bizuser'
@@ -110,7 +114,7 @@ import subarea from '@/views/common/subarea.js'
 export default {
   name: 'SettingsIndex',
   mixins: [commonMixin],
-  components: { STable, categorySet, chooseAreaModal, chooseDealer, subarea },
+  components: { STable, categorySet, chooseAreaModal, chooseDealer, subarea, supplierSet },
   data () {
     return {
       openChooseArea: false,

+ 297 - 0
src/views/dealerManagement/businessOwnerSettings/supplierSet.vue

@@ -0,0 +1,297 @@
+<template>
+  <div class="categorySet-wrap">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <a-card size="small" :bordered="false" class="categorySet-cont">
+        <div :style="{ height: tableHeight+84.5+'px' }">
+          <div class="areaSet-wrap">
+            <div class="table-page-search-wrapper newTableSearchName" >
+              <div class="areaSet-btnGroup" style="margin-bottom:20px;">
+                <a-button type="primary" class="button-error" @click="openDealerModal">新增</a-button>
+              </div>
+              <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+                <a-row :gutter="15">
+                  <a-col :md="6" :sm="24">
+                    <a-form-item label="供应商名称">
+                      <a-input id="areaSet-dealerName" v-model.trim="queryParam.dealerName" allowClear placeholder="请输入供应商名称"/>
+                    </a-form-item>
+                  </a-col>
+                  <a-col :md="6" :sm="24">
+                    <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="areaSet-refresh">查询</a-button>
+                    <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="areaSet-reset">重置</a-button>
+                  </a-col>
+                </a-row>
+              </a-form>
+            </div>
+            <a-spin :spinning="spinning" tip="Loading...">
+              <!-- 列表 -->
+              <s-table
+                class="sTable fixPagination"
+                ref="table"
+                size="small"
+                :rowKey="(record) => record.no"
+                rowKeyName="no"
+                :columns="columns"
+                :data="loadData"
+                :defaultLoadData="false"
+                :style="{ height: tableHeight-100+'px' }"
+                :scroll="{ y: tableHeight-180 }"
+                bordered>
+                <!-- 操作 -->
+                <template slot="action" slot-scope="text, record">
+                  <a-button
+                    size="small"
+                    type="link"
+                    class="button-error"
+                    @click="handleDel(record)"
+                  >
+                    删除
+                  </a-button>
+                </template>
+              </s-table>
+            </a-spin>
+          </div>
+        </div>
+      </a-card>
+    </a-spin>
+    <!-- 选择产品品牌 -->
+    <chooseBrandModal :openModal="openBrandModal" :chooseData="chooseBrand" @close="openBrandModal=false" @ok="handleBrandOk" />
+    <!-- 选择产品分类 -->
+    <chooseTypeModal :openModal="openTypeModal" :chooseData="chooseType" @close="openTypeModal=false" @ok="handleTypeOk" />
+  </div>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import ChooseBrandModal from '@/views/common/chooseBrandModal.vue'
+import ChooseTypeModal from '@/views/common/chooseTypeModal.vue'
+import { STable } from '@/components'
+import { getNewScopeSn, bizuserScopeQueryPage, saveProductBrandList, saveProductTypeList, bizuserScopeDelete, deleteProductBrand, deleteProductType } from '@/api/bizuser'
+export default {
+  name: 'CategorySet',
+  mixins: [commonMixin],
+  components: { ChooseBrandModal, ChooseTypeModal, STable },
+  props: {
+    bizUserSn: {
+      type: String,
+      default: ''
+    }
+  },
+  data () {
+    return {
+      spinning: false,
+      tableHeight: 0,
+      disabled: false, //  查询、重置按钮是否可操作
+      columns: [
+        { title: '分类', dataIndex: 'no', width: '42%', align: 'center', scopedSlots: { customRender: 'classify' } },
+        { title: '品牌', dataIndex: 'name', width: '42%', align: 'center', scopedSlots: { customRender: 'brand' } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '16%', align: 'center' }
+      ],
+      queryParam: {
+        hasDetail: 1
+      },
+      dataSource: [],
+      openModal: false, //  新增编辑产品品牌  弹框
+      itemSn: '', //  当前sn
+      nowData: null, //  当前记录数据
+      openBrandModal: false,
+      openTypeModal: false,
+      chooseBrand: [],
+      chooseType: [],
+      chooseObj: null, // 选择品牌 内容
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        this.queryParam.userSn = this.$route.query.sn
+        this.queryParam.bizUserSn = this.bizUserSn
+        return bizuserScopeQueryPage(Object.assign(parameter, this.queryParam)).then(res => {
+          let data
+          data = res.data
+          const no = (data.pageNo - 1) * data.pageSize
+          this.total = data.count || 0
+          for (var i = 0; i < data.list.length; i++) {
+            data.list[i].no = no + i + 1
+          }
+          this.dataSource = data.list
+          this.disabled = false
+          this.spinning = false
+          return data
+        })
+      }
+    }
+  },
+  methods: {
+    //  返回
+    handleBack () {
+      this.$router.push({ name: 'powerUserList' })
+    },
+    // 新增管辖品类
+    addCategory () {
+      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.unshift(newData)
+        }
+        _this.spinning = false
+        _this.disabled = false
+      })
+    },
+    // 删除分类、品牌标签
+    delLabel (bigRow, row, type) {
+      const _this = this
+      const bigPos = _this.dataSource.findIndex(con => { return bigRow == con.bizUserScopeSn })
+      if (type == 'typeList') {
+        const typePos = _this.dataSource[bigPos].productTypeList.findIndex(item => { return item.id == row.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 == row.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) {
+      const newData = []
+      row.productTypeList.forEach(item => {
+        const obj = {}
+        obj.productTypeSn = item.dataSn
+        obj.goodsSn = item.dataSn
+        obj.productTypeName = item.dataName
+        newData.push(obj)
+      })
+      this.chooseType = newData
+      this.chooseObj = row
+      this.openTypeModal = true
+    },
+    handleClassifyModal (con) {
+      const chooseList = con
+      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) {
+      const newData = []
+      row.productBrandList.forEach(item => {
+        const obj = {}
+        obj.goodsSn = item.dataSn
+        newData.push(obj)
+      })
+      this.chooseBrand = newData
+      this.chooseObj = row
+      this.openBrandModal = true
+    },
+    // 品牌
+    handleBrandOk (obj) {
+      this.chooseBrand = obj
+      this.saveChangeData('BRAND')
+    },
+    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)
+        }
+      }
+    },
+    save (list, type) {
+      const ajaxdata = { userSn: this.$route.query.sn, bizUserScopeSn: this.chooseObj.bizUserScopeSn, bizUserSn: this.bizUserSn }
+      if (type == 'BRAND') {
+        ajaxdata.productBrandList = list
+        saveProductBrandList(ajaxdata).then(res => {
+          if (res.status == 200) {
+            this.openBrandModal = false
+            this.$refs.table.refresh()
+          }
+        })
+      } else if (type == 'CATEGORY') {
+        ajaxdata.productTypeList = list
+        saveProductTypeList(ajaxdata).then(res => {
+          if (res.status == 200) {
+            this.openTypeModal = false
+            this.$refs.table.refresh()
+          }
+        })
+      }
+    },
+    // 整行删除 删除
+    handleDel (row) {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '确认要删除吗?删除后当前用户权限以最新权限为准',
+        centered: true,
+        onOk () {
+          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)
+            }
+          })
+        }
+      })
+    },
+    pageInit () {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+      this.$refs.table.refresh()
+    },
+    setTableH () {
+      const addBtnHeight = this.$refs.categorySetAddBtn.offsetHeight
+      this.tableHeight = window.innerHeight - addBtnHeight - 385
+    }
+  },
+  watch: {
+    '$store.state.app.winHeight' (newValue, oldValue) { //  窗口变更时,需同时更改表格高度
+      this.setTableH()
+    }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {})
+  }
+}
+</script>
+
+<style lang="less">
+  .categorySet-wrap{
+    .table-operator{
+    text-align:right;
+    }
+  }
+</style>