wangxingcheng 2 жил өмнө
parent
commit
3ac59ef892

+ 4 - 0
src/api/base/distr/distr.js

@@ -21,6 +21,10 @@ export default {
   getProvinceInfo(query) {
     return micro_request.postRequest(basePath, 'District', 'GetProvinceInfo', query)
   },
+  //详情 GetEntityById
+  getEntity(query) {
+    return micro_request.postRequest(basePath, 'Distributor', 'GetEntityById', query)
+  },
   //创建经销商
   doAdd(query) {
     return micro_request.postRequest(basePath, 'Distributor', 'Create', query)

+ 4 - 0
src/api/customer/index.js

@@ -86,4 +86,8 @@ export default {
   createContact(query) {
     return micro_request.postRequest(basePath, 'Contact', 'Create', query)
   },
+  //导出
+  deriveList(query) {
+    return micro_request.postRequest(basePath, 'Customer', 'DeriveList', query)
+  },
 }

+ 40 - 12
src/views/base/distributor/components/DistrEdit.vue

@@ -50,12 +50,12 @@
   </el-dialog>
 </template> -->
 <template>
-  <el-dialog append-to-body :title="title" :visible.sync="dialogFormVisible" @close="handleClose">
-    <el-form ref="form" :model="form" :rules="rules">
+  <el-dialog append-to-body :title="title" :visible.sync="dialogFormVisible">
+    <el-form ref="form" :model="form" :rules="dist">
       <el-row :gutter="20">
         <el-col :span="12">
           <el-form-item label="名称" prop="distName">
-            <el-input v-model="form.prodName" placeholder="请输入名称" />
+            <el-input v-model="form.distName" placeholder="请输入名称" />
           </el-form-item>
         </el-col>
         <el-col :span="12">
@@ -80,9 +80,21 @@
             <el-input v-model.trim="form.distBossPhone" />
           </el-form-item>
         </el-col>
+        <el-col :span="12">
+          <el-form-item label="业务范围" prop="businessScope">
+            <el-input v-model="form.businessScope" placeholder="请输入业务范围" />
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row :gutter="20">
         <el-col :span="12">
           <el-form-item label="选择省份" prop="provinceDesc">
-            <el-select ref="optionRef" v-model="form.provinceDesc" placeholder="请选择" @change="selectDistrict">
+            <el-select
+              ref="optionRef"
+              v-model="form.provinceDesc"
+              placeholder="请选择"
+              style="width: 100%"
+              @change="selectDistrict">
               <el-option v-for="item in district" :key="item.id" :label="item.distName" :value="item.id" />
             </el-select>
           </el-form-item>
@@ -91,17 +103,17 @@
           </el-form-item>
         </el-col>
         <el-col :span="12">
-          <el-form-item label="销售人员" prop="businessScope">
+          <!-- <el-form-item label="销售人员" prop="businessScope">
             <el-input v-model.trim="form.businessScope" />
-          </el-form-item>
-        </el-col>
-        <el-col :span="12">
-          <el-form-item label="业务范围" prop="distName">
-            <el-input v-model="form.prodName" placeholder="请输入名称" />
+          </el-form-item> -->
+          <select-user ref="selectUser" :query-params="{ roles: ['Sales', 'SalesManager'] }" @save="selectUser" />
+          <el-form-item label="销售人员" prop="belongSale">
+            <el-input v-model="form.belongSale" readonly>
+              <el-button slot="append" icon="el-icon-search" @click="choose" />
+            </el-input>
           </el-form-item>
         </el-col>
       </el-row>
-
       <el-form-item label="备注" prop="remark">
         <el-input
           v-model="form.remark"
@@ -122,13 +134,17 @@
 <script>
   import distrApi from '@/api/distr'
   import '@riophae/vue-treeselect/dist/vue-treeselect.css'
-
+  import SelectUser from '@/components/select/SelectUser'
   export default {
     name: 'UserEdit',
+    components: {
+      SelectUser,
+    },
     data() {
       return {
         form: {
           dist: [],
+          belongSale: '',
         },
         dist: {
           distName: [{ required: true, trigger: 'blur', message: '请输入名称' }],
@@ -174,6 +190,10 @@
         this.form = this.$options.data().form
         this.dialogFormVisible = false
       },
+      choose() {
+        // this.$refs.transfer.innerVisible = true
+        this.$refs.selectUser.open()
+      },
       async getProvinceInfo() {
         const { data: data } = await distrApi.getProvinceInfo({})
         console.log('区域', data.list)
@@ -211,6 +231,14 @@
           }
         })
       },
+      selectUser(userList) {
+        this.userList = userList
+        this.form.belongSale = userList.map((item) => item.userName).join()
+      },
+      async handleSubmit() {
+        this.form.belongSaleId = this.userList[0].id
+        this.form.belongSale = this.userList[0].userName
+      },
     },
   }
 </script>

+ 402 - 0
src/views/base/distributor/detail.vue

@@ -0,0 +1,402 @@
+<template>
+  <div class="detail">
+    <el-row :gutter="30">
+      <el-col :span="25">
+        <div class="title">
+          <p>经销商</p>
+          <h3>
+            {{ detail.distName }}
+          </h3>
+        </div>
+        <header>
+          <el-descriptions :colon="false" :column="10" direction="vertical" style="padding-top: 15px">
+            <el-descriptions-item
+              content-class-name="my-content"
+              label="经销商编码"
+              label-class-name="my-label"
+              style="width: auto">
+              {{ detail.distCode.substring(1, 7) }}
+            </el-descriptions-item>
+            <el-descriptions-item content-class-name="my-content" label="经销商名称" label-class-name="my-label">
+              {{ detail.distName }}
+            </el-descriptions-item>
+            <el-descriptions-item content-class-name="my-content" label="助记名" label-class-name="my-label">
+              {{ detail.abbrName }}
+            </el-descriptions-item>
+            <el-descriptions-item content-class-name="my-content" label="负责人" label-class-name="my-label">
+              {{ detail.distBoss }}
+            </el-descriptions-item>
+            <el-descriptions-item content-class-name="my-content" label="负责人电话" label-class-name="my-label">
+              {{ detail.distBossPhone }}
+            </el-descriptions-item>
+            <el-descriptions-item content-class-name="my-content" label="销售人" label-class-name="my-label">
+              {{ detail.belongSale }}
+            </el-descriptions-item>
+            <el-descriptions-item content-class-name="my-content" label="归属省份" label-class-name="my-label">
+              {{ detail.provinceDesc }}
+            </el-descriptions-item>
+            <el-descriptions-item content-class-name="my-content" label="业务范围" label-class-name="my-label">
+              {{ detail.businessScope }}
+            </el-descriptions-item>
+            <el-descriptions-item content-class-name="my-content" label="创建人" label-class-name="my-label">
+              {{ detail.createdName }}
+            </el-descriptions-item>
+            <el-descriptions-item content-class-name="my-content" label="创建时间" label-class-name="my-label">
+              {{ detail.createdTime }}
+            </el-descriptions-item>
+          </el-descriptions>
+        </header>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+  import { mapGetters } from 'vuex'
+  import api from '@/api/base/distr/distr'
+  export default {
+    name: 'Detail',
+    components: {},
+    data() {
+      return {
+        id: '',
+        privateCus: '',
+        list: [],
+        detail: {
+          distCode: '', //经销商编码
+          distName: '', //经销商名称
+          abbrName: '', //助记名
+          distBoss: '', //负责人
+          distBossPhone: '', //负责人电话
+          belongSale: '', //销售人
+          provinceDesc: '', //归属省份
+          businessScope: '', //业务范围
+          createdName: '', //创建人名字
+          createdTime: '', //创建时间
+        },
+      }
+    },
+    computed: {
+      ...mapGetters({
+        avatar: 'user/avatar',
+        username: 'user/username',
+      }),
+    },
+    mounted() {
+      this.id = this.$route.query.id
+      this.privateCus = this.$route.query.privateCus
+      this.init()
+      //this.getDynamics()
+    },
+    methods: {
+      async init() {
+        Promise.all([api.getEntity({ id: parseInt(this.id) })]).then(([detail]) => {
+          console.log('detail', detail)
+          this.detail = detail.data.list
+        })
+      },
+
+      setSelectRows(val) {
+        this.selectRows = val
+      },
+    },
+  }
+</script>
+
+<style lang="scss" scoped>
+  $base: '.detail';
+
+  #{$base} {
+    height: calc(100vh - 60px - 50px - 12px * 2 - 40px);
+    display: flex;
+    padding: 20px 40px;
+
+    > .el-row {
+      flex: 1;
+
+      > .el-col {
+        height: 100%;
+      }
+    }
+
+    .title {
+      p,
+      h3 {
+        margin: 0;
+      }
+
+      p {
+        font-size: 14px;
+        font-weight: 400;
+        line-height: 22px;
+      }
+
+      h3 {
+        font-size: 24px;
+        font-weight: 500;
+        line-height: 36px;
+        color: #333;
+        display: flex;
+        justify-content: space-between;
+      }
+    }
+
+    header {
+      height: 74px;
+      background: rgba(196, 196, 196, 0.5);
+      border-radius: 4px;
+      display: flex;
+      align-items: center;
+      padding: 0 20px;
+      margin-top: 16px;
+
+      ::v-deep .el-descriptions__body {
+        background: transparent;
+      }
+
+      ::v-deep .my-label {
+        font-size: 14px;
+        font-weight: 600;
+        color: #1d66dc;
+      }
+
+      ::v-deep .my-content {
+        font-size: 14px;
+        font-weight: 600;
+        color: #333;
+      }
+    }
+
+    .el-tabs {
+      height: calc(100% - 148px);
+      display: flex;
+      flex-direction: column;
+
+      ::v-deep .el-tabs__content {
+        flex: 1;
+
+        .el-tab-pane {
+          height: 100%;
+        }
+      }
+    }
+
+    .buttons {
+      padding-top: 28px;
+      text-align: right;
+    }
+
+    .records {
+      margin: 0;
+      padding: 10px 20px;
+      list-style: none;
+      height: calc(100% - 60px);
+      overflow-y: auto;
+
+      > li {
+        display: flex;
+
+        & + li {
+          margin-top: 10px;
+        }
+      }
+
+      .date {
+        width: 100px;
+        display: flex;
+        flex-direction: column;
+        align-items: center;
+
+        h2,
+        h3 {
+          margin: 0;
+        }
+
+        h2 {
+          font-size: 26px;
+          line-height: 32px;
+        }
+      }
+
+      .content {
+        flex: 1;
+        list-style: none;
+
+        li {
+          display: flex;
+
+          & + li {
+            margin-top: 10px;
+          }
+        }
+
+        .user-avatar {
+          font-size: 40px;
+        }
+
+        .text {
+          flex: 1;
+          padding-left: 20px;
+
+          p {
+            font-weight: 500;
+            margin: 0;
+            line-height: 20px;
+
+            span {
+              color: #1d66dc;
+            }
+          }
+
+          p:nth-child(2) {
+            margin-bottom: 10px;
+          }
+
+          .action {
+            font-weight: bold;
+            color: #333;
+          }
+        }
+      }
+    }
+
+    .follow {
+      height: 100%;
+      padding: 10px 20px;
+      overflow: auto;
+
+      > li {
+        display: flex;
+
+        + li {
+          margin-top: 10px;
+        }
+      }
+
+      .date {
+        width: 100px;
+        display: flex;
+        flex-direction: column;
+        align-items: center;
+
+        h2,
+        h3 {
+          margin: 0;
+        }
+
+        h2 {
+          font-size: 26px;
+          line-height: 32px;
+        }
+      }
+
+      .content {
+        flex: 1;
+        list-style: none;
+
+        > li {
+          border: 1px solid rgb(215, 232, 244);
+          background: rgb(247, 251, 254);
+          border-radius: 4px;
+          padding: 8px;
+          overflow: hidden;
+
+          .text-container {
+            display: flex;
+          }
+
+          .comments {
+            padding-left: 60px;
+            margin-top: 10px;
+            max-height: 200px;
+            overflow: auto;
+
+            li {
+              display: flex;
+              border-top: 1px solid #e3e5e7;
+
+              .text {
+                flex: 1;
+                padding: 0 10px;
+
+                p {
+                  font-weight: 500;
+                  margin: 0;
+                  line-height: 32px;
+                }
+
+                p:first-child {
+                  line-height: 30px;
+                  font-weight: bold;
+                }
+
+                p:last-child {
+                  font-size: 12px;
+                  color: #9499a0;
+                  text-align: right;
+                }
+              }
+            }
+          }
+
+          + li {
+            margin-top: 10px;
+          }
+        }
+
+        .user-avatar {
+          font-size: 40px;
+        }
+
+        .text {
+          flex: 1;
+          padding-left: 20px;
+          padding-right: 10px;
+
+          p {
+            font-weight: 500;
+            margin: 0;
+            line-height: 32px;
+
+            span {
+              color: #1d66dc;
+            }
+          }
+
+          .action {
+            display: flex;
+            justify-content: space-between;
+
+            span:first-child {
+              font-weight: bold;
+              color: #333;
+            }
+          }
+
+          .footer {
+            display: flex;
+            justify-content: space-between;
+            align-items: center;
+          }
+        }
+      }
+    }
+  }
+
+  .height-enter-active,
+  .height-leave-active {
+    transition: all 0.5s;
+  }
+
+  .height-enter-to,
+  .height-leave {
+    height: 200px;
+  }
+
+  .height-enter,
+.height-leave-to
+
+  /* .fade-leave-active below version 2.1.8 */ {
+    height: 0;
+  }
+</style>

+ 22 - 9
src/views/base/distributor/index.vue

@@ -69,15 +69,13 @@
             :sortable="item.sortable"
             :width="item.width">
             <template #default="{ row }">
-              <span>{{ row[item.prop] }}</span>
+              <el-button v-if="item.prop === 'distName'" style="font-size: 14px" type="text" @click="handleDetail(row)">
+                {{ row.distName }}
+              </el-button>
+              <span v-else>{{ row[item.prop] }}</span>
             </template>
           </el-table-column>
 
-          <vab-query-form-right-panel :span="6">
-            <el-button icon="el-icon-search" type="primary" @click="queryData">查询</el-button>
-            <el-button icon="el-icon-plus" type="primary" @click="handleEdit($event)">新建</el-button>
-          </vab-query-form-right-panel>
-
           <el-table-column align="center" label="操作" show-overflow-tooltip width="85">
             <template #default="{ row }">
               <el-button type="text" @click="handleEdit(row)">编辑</el-button>
@@ -125,6 +123,12 @@
 
         checkList: [],
         columns: [
+          {
+            label: '经销商名称',
+            width: '120px',
+            prop: 'distName',
+            sortable: false,
+          },
           {
             label: '所在省份',
             width: '100px',
@@ -253,14 +257,23 @@
         this.listLoading = false
       },
       reset() {
-        ;(this.queryForm = {
+        this.queryForm = {
           pageNum: 1,
           pageSize: 10,
           distCode: '',
           distName: '',
           belongSale: '',
-        }),
-          this.fetchData()
+        }
+        this.fetchData()
+      },
+      //详情
+      handleDetail(row) {
+        this.$router.push({
+          path: '/base/info',
+          query: {
+            id: row.id,
+          },
+        })
       },
     },
   }

+ 15 - 1
src/views/base/region/index.vue

@@ -141,7 +141,7 @@
         columns: [
           {
             label: '省份',
-            width: '100px',
+            width: '200px',
             prop: 'distName',
             sortable: false,
           },
@@ -152,6 +152,20 @@
             sortable: false,
             disableCheck: true,
           },
+          {
+            label: '创建人',
+            width: 'auto',
+            prop: 'createdName',
+            sortable: false,
+            disableCheck: true,
+          },
+          {
+            label: '创建时间',
+            width: 'auto',
+            prop: 'createdTime',
+            sortable: false,
+            disableCheck: true,
+          },
         ],
       }
     },

+ 1 - 1
src/views/customer/components/Shift.vue

@@ -67,7 +67,7 @@
       },
       async handleSubmit() {
         let params = { ...this.form }
-        params.SalesIds = this.userList[0].id
+        params.SalesId = this.userList[0].id
         const [err, res] = await to(api.updateBytransfer(params))
         if (err) return
         this.$message.success(res.msg)

+ 18 - 2
src/views/customer/list.vue

@@ -51,7 +51,7 @@
         <el-button icon="el-icon-plus" size="mini" type="primary" @click="handleMerge">合并客户</el-button>
       </vab-query-form-left-panel>
       <vab-query-form-right-panel :span="12">
-        <el-button icon="el-icon-download" />
+        <el-button icon="el-icon-download" @click="exportData" />
         <table-tool :check-list.sync="checkList" :columns="columns" />
       </vab-query-form-right-panel>
     </vab-query-form>
@@ -133,7 +133,7 @@
   import ToOpen from './components/ToOpen'
   import Merge from './components/Merge'
   import TableTool from '@/components/table/TableTool'
-
+  import downloadFileByByte from '@/utils/base64ToFile'
   export default {
     components: {
       Edit,
@@ -153,6 +153,7 @@
           indusTry: '',
           pageNum: 1,
           pageSize: 10,
+          isPublic: false,
         },
         total: 0,
         listLoading: false,
@@ -260,6 +261,21 @@
         this.total = res.data.total
         this.listLoading = false
       },
+
+      exportData() {
+        let exportFrom = JSON.parse(JSON.stringify(this.queryForm))
+        exportFrom.columns = this.finallyColumns.map((item) => item.label)
+        api
+          .deriveList(exportFrom)
+          .then((res) => {
+            if (res.data.list.content) {
+              downloadFileByByte(res.data.list.content, '客户数据.xlsx')
+            }
+          })
+          .catch((err) => {
+            console.error(err)
+          })
+      },
       reset() {
         this.queryForm = {
           pageNum: 1,

+ 16 - 2
src/views/customer/openSea.vue

@@ -45,7 +45,7 @@
         <el-button icon="el-icon-plus" type="primary" @click="handleReceive">领取</el-button>
       </vab-query-form-left-panel>
       <vab-query-form-right-panel :span="12">
-        <el-button icon="el-icon-download" />
+        <el-button icon="el-icon-download" @click="exportData" />
         <table-tool :check-list.sync="checkList" :columns="columns" />
       </vab-query-form-right-panel>
     </vab-query-form>
@@ -145,7 +145,7 @@
   import Edit from './components/Edit'
   import Allocate from './components/Allocate'
   import TableTool from '@/components/table/TableTool'
-
+  import downloadFileByByte from '@/utils/base64ToFile'
   export default {
     name: 'OpenSea',
     components: {
@@ -270,6 +270,20 @@
         this.total = res.data.total
         this.listLoading = false
       },
+      exportData() {
+        let exportFrom = JSON.parse(JSON.stringify(this.queryForm))
+        exportFrom.columns = this.finallyColumns.map((item) => item.label)
+        api
+          .deriveList(exportFrom)
+          .then((res) => {
+            if (res.data.list.content) {
+              downloadFileByByte(res.data.list.content, '公海客户数据.xlsx')
+            }
+          })
+          .catch((err) => {
+            console.error(err)
+          })
+      },
       reset() {
         this.queryForm = {
           pageNum: 1,

+ 1 - 1
src/views/product/index.vue

@@ -180,7 +180,7 @@
       //详情
       handleDetail(row) {
         this.$router.push({
-          path: '/product/detail',
+          path: '/base/detail',
           query: {
             id: row.id,
           },

+ 4 - 12
vue.config.js

@@ -7,7 +7,6 @@ const {
   publicPath,
   assetsDir,
   outputDir,
-  lintOnSave,
   transpileDependencies,
   title,
   abbreviation,
@@ -41,7 +40,7 @@ module.exports = {
   publicPath,
   assetsDir,
   outputDir,
-  lintOnSave,
+  lintOnSave: false,
   transpileDependencies,
   devServer: {
     hot: true,
@@ -140,9 +139,7 @@ module.exports = {
           // },
         },
       })
-      config
-        .plugin('banner')
-        .use(Webpack.BannerPlugin, [`${webpackBanner}${dateTime}`])
+      config.plugin('banner').use(Webpack.BannerPlugin, [`${webpackBanner}${dateTime}`])
       if (imageCompression)
         config.module
           .rule('images')
@@ -157,9 +154,7 @@ module.exports = {
           {
             filename: '[path][base].gz[query]',
             algorithm: 'gzip',
-            test: new RegExp(
-              '\\.(' + productionGzipExtensions.join('|') + ')$'
-            ),
+            test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
             threshold: 8192,
             minRatio: 0.8,
           },
@@ -192,10 +187,7 @@ module.exports = {
         additionalData(content, loaderContext) {
           const { resourcePath, rootContext } = loaderContext
           const relativePath = path.relative(rootContext, resourcePath)
-          if (
-            relativePath.replace(/\\/g, '/') !==
-            'src/vab/styles/variables/variables.scss'
-          )
+          if (relativePath.replace(/\\/g, '/') !== 'src/vab/styles/variables/variables.scss')
             return '@import "~@/vab/styles/variables/variables.scss";' + content
           return content
         },