Browse Source

Merge branch 'develop_yh39' of http://git.chelingzhu.com/jianguan-web/jg-ocs-html into develop_yh39

chenrui 1 năm trước cách đây
mục cha
commit
109147f18c

+ 1 - 1
src/views/dealerManagement/merchantInfoManagement/detailModal.vue

@@ -14,7 +14,7 @@
           <a-descriptions :column="2" bordered size="small">
             <a-descriptions-item label="经销商名称">{{ form&&form.dealerName ? form.dealerName : '--' }}</a-descriptions-item>
             <a-descriptions-item label="经销商别名">{{ form&&form.dealerAlias ? form.dealerAlias : '--' }}</a-descriptions-item>
-            <a-descriptions-item label="商户类型">{{ form&&form.dealerTypeDictValue ? form.dealerTypeDictValue : '--' }}</a-descriptions-item>
+            <a-descriptions-item label="商户类型">{{ form&&form.dealerTypeName1 ? form.dealerTypeName1+'>'+form.dealerTypeName2 : '--' }}</a-descriptions-item>
             <a-descriptions-item label="联系人1">{{ form&&form.contact ? form.contact : '--' }}</a-descriptions-item>
             <a-descriptions-item label="联系手机1">{{ form&&form.contactMobile ? form.contactMobile : '--' }}</a-descriptions-item>
             <a-descriptions-item label="联系角色1">{{ form&&form.contactRole ? form.contactRole : '--' }}</a-descriptions-item>

+ 102 - 70
src/views/dealerManagement/rebateBinding/categoryList.vue

@@ -1,19 +1,17 @@
 <template>
-  <div class="categoryList-wrap">
+  <div class="categoryList-wrap" :style="{minHeight:maxHeight+'px'}">
     <a-spin :spinning="spinning" tip="Loading...">
       <ve-table
-        v-show="!showEmpty"
         border-y
+        v-show="!showEmpty"
         :scroll-width="0"
-        :max-height="tableHeight"
         :row-style-option="{clickHighlight: true}"
         :cellSelectionOption="{enable: false}"
-        :virtual-scroll-option="{enable: true}"
+        :virtual-scroll-option="{enable: false}"
         :columns="columns"
         :table-data="list"
         row-key-field-name="id"
-        :cell-span-option="cellSpanOption"
-        :cell-style-option="cellStyleOption"
+        :expand-option="expandOption"
       />
       <div v-show="showEmpty" class="empty-data" :style="{height:maxHeight+'px'}"><a-empty description="暂无数据" :image="simpleImage"/></div>
     </a-spin>
@@ -26,6 +24,40 @@ import { commonMixin } from '@/utils/mixin'
 import { VSelect } from '@/components'
 import { dealerUpsList, dealerUpsDelete } from '@/api/dealer'
 import { Empty } from 'ant-design-vue'
+// 子表格
+const ChildTableComp = {
+  name: 'ChildTableComp',
+  template: `
+        <div class="child-table-comp">
+            <ve-table
+              v-if="row.childData.length>0"
+              :row-style-option="{clickHighlight: true, stripe: true}"
+              :cellSelectionOption="{enable: false}"
+              :scroll-width="0"
+              :max-height="row.childData.length*30>300?300:row.childData.length*30+31"
+              row-key-field-name="id"
+              :virtual-scroll-option="{enable: true}"
+              :columns="columns"
+              :table-data="row.childData"
+            />
+            <a-empty v-else description="暂无品类" :image="simpleImage"/>
+        </div>
+    `,
+  props: {
+    row: Object
+  },
+  data () {
+    return {
+      columns: [
+        { title: '序号', field: 'no', key: 'a', width: 40, align: 'center', operationColumn: false },
+        { title: '品牌', field: 'productBrandName', key: 'b', width: 100, align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } },
+        { title: '一级分类', field: 'productTypeName1', key: 'e', width: 180, align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } },
+        { title: '二级分类', field: 'productTypeName2', width: 180, key: 'i', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } },
+        { title: '三级分类', field: 'productTypeName3', width: 180, key: 'm', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } }
+      ]
+    }
+  }
+}
 export default {
   name: 'DetailProductList',
   mixins: [commonMixin],
@@ -54,21 +86,20 @@ export default {
         // column resize min width
         minWidth: 50
       },
-      cellSpanOption: {
-        bodyCellSpan: this.bodyCellSpan
-      },
-      cellStyleOption: {
-        bodyCellClass: ({ row, column, rowIndex }) => {
-          if (column.field === 'superDealerName') {
-            return 'table-body-cell-1'
-          }
-          if (column.field === 'productTypeName3') {
-            return 'table-body-cell-2'
-          }
+      expandOption: {
+        defaultExpandAllRows: false,
+        expandedRowKeys: [],
+        render: ({ row, column, rowIndex }, h) => {
+          return <ChildTableComp row={row} />
+        },
+        // 重新赋值处理
+        afterExpandRowChange: ({ afterExpandedRowKeys, row, rowIndex }) => {
+          this.changeExpandedRowKeys(afterExpandedRowKeys)
         }
       },
       showEmpty: true,
-      checkedDealerSn: []
+      checkedDealerSn: [],
+      isTeyue: false
     }
   },
   computed: {
@@ -96,46 +127,54 @@ export default {
               size="small"
               type="link"
               class="button-info"
-              onClick={() => _this.handleEdit(record)}
+              onClick={(e) => _this.handleEdit(record, e)}
             >编辑</a-button>
             <a-button
               size="small"
               type="link"
               class="button-error"
-              onClick={() => _this.handleDel(record)}
+              onClick={(e) => _this.handleDel(record, e)}
             >删除</a-button>
           </div>
         )
       }
 
+      const expendFormat = function (record, data, h) {
+        if (_this.isTeyue) {
+          return (<span>-</span>)
+        }
+        const hasExpend = _this.expandOption.expandedRowKeys.indexOf(record.id)
+        if (hasExpend >= 0) {
+          return (
+            <span style="cursor:pointer;">收起</span>
+          )
+        }
+        return (
+          <span style="cursor:pointer;">展开</span>
+        )
+      }
+
       const arr = [
-        { title: '序号', field: 'no', key: 'a', width: 50, align: 'center', operationColumn: false },
-        { title: '品牌', field: 'productBrandName', key: 'b', width: 100, align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } },
-        { title: '一级分类', field: 'productTypeName1', key: 'e', width: 180, align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } },
-        { title: '二级分类', field: 'productTypeName2', width: 180, key: 'i', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } },
-        { title: '三级分类', field: 'productTypeName3', width: 180, key: 'm', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } },
-        { title: '上级经销商', field: 'superDealerName', width: 180, key: 'h', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } },
-        { title: '差价归属方', field: 'rebateDealerList', width: 180, key: 'k', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return jcgsFormat(row, row[column.field], h) } },
-        { title: '操作', field: 'action', width: 100, key: 's', align: 'center', fixed: 'right', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return actionFormat(row, row[column.field], h) } }
+        { field: '', key: 'x', type: (this.isTeyue ? '-' : 'expand'), title: '品类', width: '5%', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return expendFormat(row, row[column.field], h) } },
+        { title: '上级经销商', field: 'superDealerName', width: '20%', key: 'h', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } },
+        { title: '差价归属方', field: 'rebateDealerList', width: '65%', key: 'k', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return jcgsFormat(row, row[column.field], h) } },
+        { title: '操作', field: 'action', width: '10%', key: 's', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return actionFormat(row, row[column.field], h) } }
       ]
       return arr
     }
   },
   methods: {
-    bodyCellSpan ({ row, column, rowIndex }) {
-      if (column.field === 'superDealerName' || column.field === 'rebateDealerList' || column.field === 'action') {
-        if (row.rowspan) {
-          return {
-            rowspan: row.rowspan,
-            colspan: 1
-          }
-        } else {
-          return {
-            rowspan: 0,
-            colspan: 0
-          }
-        }
-      }
+    // 给可控属性重新赋值
+    changeExpandedRowKeys (keys) {
+      this.expandOption.expandedRowKeys = keys
+    },
+    // 展开全部
+    expandAll () {
+      this.expandOption.expandedRowKeys = this.list.map((x) => x.id)
+    },
+    // 折叠全部
+    foldAll () {
+      this.expandOption.expandedRowKeys = []
     },
     // 筛选数据
     filterData (data, queryParam) {
@@ -159,8 +198,8 @@ export default {
     // 组装数据
     formatData (listData, queryParam) {
       // 格式化数据
-      let ret = []
-      let no = 0
+      const ret = []
+      const no = 0
       for (let i = 0; i < listData.length; i++) {
         const item = listData[i]
         const rebateScopeList = item.rebateScopeList ? this.filterData(item.rebateScopeList, queryParam) : [{ productBrandName: null, productTypeName1: null, productTypeName2: null, productTypeName3: null }]
@@ -179,24 +218,20 @@ export default {
         if (headDealerList) {
           rebateDealerList.push(headDealerList)
         }
-
         for (let j = 0; j < rebateScopeList.length; j++) {
-          rebateScopeList[j].no = no + j + 1
-          if (j == 0) {
-            rebateScopeList[j].rowspan = rebateScopeList.length
-            rebateScopeList[j].rebateDealerList = rebateDealerList
-          }
+          rebateScopeList[j].no = j + 1
           rebateScopeList[j].dealerUpsSn = item.dealerUpsSn
           rebateScopeList[j].dealerSn = item.dealerSn
-
-          if (supDealerList) {
-            rebateScopeList[j].supDealerList = supDealerList
-            rebateScopeList[j].superDealerName = supDealerList.parentDealer.dealerName
-          }
         }
-
-        no = no + rebateScopeList.length
-        ret = ret.concat(rebateScopeList)
+        ret.push({
+          no: i + 1,
+          id: item.id,
+          superDealerName: supDealerList.parentDealer.dealerName,
+          dealerUpsSn: item.dealerUpsSn,
+          dealerSn: item.dealerSn,
+          rebateDealerList: rebateDealerList,
+          childData: rebateScopeList
+        })
       }
 
       return ret
@@ -218,13 +253,15 @@ export default {
         this.disabled = false
       })
     },
-    handleEdit (record) {
+    handleEdit (record, e) {
+      console.log(e)
+      e.stopPropagation()
       const row = this.dataSource.find(item => item.dealerUpsSn == record.dealerUpsSn && item.dealerSn == record.dealerSn)
       this.$emit('edit', row)
     },
-    handleDel (record) {
+    handleDel (record, e) {
+      e.stopPropagation()
       const _this = this
-      console.log(record)
       this.$confirm({
         title: '提示',
         content: '删除后,将解除该品类差价设置归属关系。确定删除吗?',
@@ -242,7 +279,8 @@ export default {
         }
       })
     },
-    pageInit (queryParam) {
+    pageInit (queryParam, isTeyue) {
+      this.isTeyue = isTeyue
       // 获取列表
       this.searchTable(queryParam)
     }
@@ -268,13 +306,7 @@ export default {
     .ve-table .ve-table-container .ve-table-content-wrapper table.ve-table-content tbody.ve-table-body tr.ve-table-expand-tr td.table-body-cell-no{
       padding: 0;
     }
-    .ve-table .ve-table-container .ve-table-content-wrapper{
-      border-bottom: 1px solid #ddd;
+    .child-table-comp{
+      padding: 10px;
     }
-    .table-body-cell-1 {
-            border-left: 1px solid #ddd !important;
-        }
-    .table-body-cell-2 {
-            border-right: none !important;
-        }
   </style>

+ 21 - 5
src/views/dealerManagement/rebateBinding/list.vue

@@ -53,8 +53,11 @@
           </a-form-model>
         </div>
         <!-- 操作按钮 -->
-        <div class="table-operator" v-if="showBtns">
+        <div class="table-operator" style="display: flex;align-items: center;justify-content: space-between;" v-if="showBtns">
           <a-button id="rebateBinding-brand" type="primary" class="button-error" @click="openGlModal">差价设置</a-button>
+          <div v-if="!isTeyue">
+            <a-button type="default" @click="expandAllRow">{{ expandAll?'收起全部':'展开全部' }}</a-button>
+          </div>
         </div>
         <!-- 列表 -->
         <categoryList ref="categoryList" @loaded="loadList" @del="delOk" @edit="handleEdit" :maxHeight="tableHeight"></categoryList>
@@ -96,7 +99,8 @@ export default {
         productTypeSn3: undefined,
         dealerName: ''
       },
-      showBtns: true
+      showBtns: true,
+      expandAll: false
     }
   },
   computed: {
@@ -110,8 +114,12 @@ export default {
       this.$router.push({ name: 'merchantInfoManagementList', query: { closeLastOldTab: true } })
     },
     loadList (list) {
-      console.log(list.length == 0)
       this.showBtns = this.isTeyue ? list.length == 0 : true
+      this.$nextTick(() => {
+        if (!this.expandAll) {
+          this.expandAllRow()
+        }
+      })
     },
     // 查询
     handleSearch () {
@@ -122,7 +130,7 @@ export default {
           params[k] = this.queryParam[k]
         }
       }
-      this.$refs.categoryList.pageInit(params)
+      this.$refs.categoryList.pageInit(params, this.isTeyue)
     },
     //  产品分类  change
     changeProductType (val, opt) {
@@ -130,6 +138,14 @@ export default {
       this.queryParam.productTypeSn2 = val[1] ? val[1] : undefined
       this.queryParam.productTypeSn3 = val[2] ? val[2] : undefined
     },
+    expandAllRow () {
+      if (this.expandAll) {
+        this.$refs.categoryList.foldAll()
+      } else {
+        this.$refs.categoryList.expandAll()
+      }
+      this.expandAll = !this.expandAll
+    },
     // 重置表单
     resetSearchForm () {
       this.queryParam.dealerName = ''
@@ -164,6 +180,7 @@ export default {
       dealerDetailBySn({ sn: this.$route.params.sn }).then(res => {
         if (res.status == 200) {
           this.detail = res.data
+          this.handleSearch()
         }
         this.spinning = false
       })
@@ -171,7 +188,6 @@ export default {
     pageInit () {
       const _this = this
       this.getDetail()
-      this.handleSearch()
       this.$nextTick(() => { // 页面渲染完成后的回调
         _this.setTableH()
       })

+ 2 - 2
vue.config.js

@@ -108,9 +108,9 @@ const vueConfig = {
     // If you want to turn on the proxy, please remosve the mockjs /src/main.jsL11
     proxy: {
       '/api': {
-        target: 'http://192.168.2.117/ocs-admin',
+        // target: 'http://192.168.2.117/ocs-admin',
         // target: 'https://t.ocs.360arrow.com/ocs-admin', //  练习
-        // target: 'https://p.ocs.360arrow.com/ocs-admin', //  预发布
+        target: 'https://p.ocs.360arrow.com/ocs-admin', //  预发布
         ws: false,
         changeOrigin: true,
         pathRewrite: {