Browse Source

页签bug 修复

lilei 4 years ago
parent
commit
9545c607b4

+ 22 - 25
src/components/MultiTab/MultiTab.vue

@@ -6,6 +6,7 @@ export default {
   data () {
     return {
       fullPathList: [],
+      tabsList: [],
       pages: [],
       activeKey: '',
       newTabIndex: 0
@@ -35,7 +36,7 @@ export default {
     })
 
     this.pages.push(this.$route)
-    this.fullPathList.push(this.$route.fullPath)
+    this.tabsList.push(this.$route.name)
     this.selectedLastPath()
   },
   methods: {
@@ -43,30 +44,30 @@ export default {
       this[action](targetKey)
     },
     remove (targetKey) {
-      this.pages = this.pages.filter(page => page.fullPath !== targetKey)
-      this.fullPathList = this.fullPathList.filter(path => path !== targetKey)
+      this.pages = this.pages.filter(page => page.name !== targetKey)
+      this.tabsList = this.tabsList.filter(name => name !== targetKey)
       // 判断当前标签是否关闭,若关闭则跳转到最后一个还存在的标签页
-      if (!this.fullPathList.includes(this.activeKey)) {
+      if (!this.tabsList.includes(this.activeKey)) {
         this.selectedLastPath()
       }
     },
     selectedLastPath () {
-      this.activeKey = this.fullPathList[this.fullPathList.length - 1]
+      this.activeKey = this.tabsList[this.tabsList.length - 1]
     },
 
     // content menu
     closeThat (e) {
       // 判断是否为最后一个标签页,如果是最后一个,则无法被关闭
-      if (this.fullPathList.length > 1) {
+      if (this.tabsList.length > 1) {
         this.remove(e)
       } else {
         this.$message.info('这是最后一个标签了, 无法被关闭')
       }
     },
     closeLeft (e) {
-      const currentIndex = this.fullPathList.indexOf(e)
+      const currentIndex = this.tabsList.indexOf(e)
       if (currentIndex > 0) {
-        this.fullPathList.forEach((item, index) => {
+        this.tabsList.forEach((item, index) => {
           if (index < currentIndex) {
             this.remove(item)
           }
@@ -76,9 +77,9 @@ export default {
       }
     },
     closeRight (e) {
-      const currentIndex = this.fullPathList.indexOf(e)
-      if (currentIndex < (this.fullPathList.length - 1)) {
-        this.fullPathList.forEach((item, index) => {
+      const currentIndex = this.tabsList.indexOf(e)
+      if (currentIndex < (this.tabsList.length - 1)) {
+        this.tabsList.forEach((item, index) => {
           if (index > currentIndex) {
             this.remove(item)
           }
@@ -88,8 +89,8 @@ export default {
       }
     },
     closeAll (e) {
-      const currentIndex = this.fullPathList.indexOf(e)
-      this.fullPathList.forEach((item, index) => {
+      const currentIndex = this.tabsList.indexOf(e)
+      this.tabsList.forEach((item, index) => {
         if (index !== currentIndex) {
           this.remove(item)
         }
@@ -121,19 +122,15 @@ export default {
   },
   watch: {
     '$route': function (newVal) {
-      this.activeKey = newVal.fullPath
-      console.log(this.fullPathList.length)
-      if (this.fullPathList.indexOf(newVal.fullPath) < 0) {
-        if (this.fullPathList.length <= 10) {
-          this.fullPathList.push(newVal.fullPath)
-          this.pages.push(newVal)
-        } else {
-          this.$message.info('最多同时打开10个页签')
-        }
+      this.activeKey = newVal.name
+      if (this.tabsList.indexOf(newVal.name) < 0) {
+        this.tabsList.push(newVal.name)
+        this.pages.push(newVal)
       }
     },
     activeKey: function (newPathKey) {
-      this.$router.push({ path: newPathKey })
+      const row = this.pages.find(item => item.name == newPathKey)
+      this.$router.push({ path: row.fullPath })
     }
   },
   render () {
@@ -142,10 +139,10 @@ export default {
       return (
         <a-tab-pane
           style={{ height: 0 }}
-          key={page.fullPath} closable={pages.length > 1}
+          key={page.name} closable={pages.length > 1}
         >
           <span slot="tab">
-            {this.renderTabPane(page.meta.customTitle || page.meta.title, page.fullPath)}
+            {this.renderTabPane(page.meta.customTitle || page.meta.title, page.name)}
           </span>
         </a-tab-pane>)
     })

+ 3 - 2
src/views/salesManagement/salesReturn/detail.vue

@@ -77,8 +77,9 @@ export default {
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
-        this.getQueryCount(Object.assign(parameter, { salesReturnSn: this.$route.params.sn }))
-        return salesReturnDetailList(Object.assign(parameter, { salesReturnSn: this.$route.params.sn })).then(res => {
+        const params = Object.assign(parameter, { salesReturnBillSn: this.$route.params.sn })
+        this.getQueryCount(params)
+        return salesReturnDetailList(params).then(res => {
           const data = res.data
           const no = (data.pageNo - 1) * data.pageSize
           for (var i = 0; i < data.list.length; i++) {

+ 8 - 5
src/views/salesManagement/salesReturn/queryPart.vue

@@ -47,7 +47,7 @@
       :data="loadData"
       :customRow="handleClickRow"
       :defaultLoadData="false"
-      :scroll="{ x: 1700, y: 300 }"
+      :scroll="{ x: grabFlag == '1' ? 1700 : 860, y: 300 }"
       bordered>
       <!-- 价格 -->
       <template slot="price" slot-scope="text, record">
@@ -90,7 +90,8 @@ export default {
       default: ''
     },
     newLoading: Boolean,
-    grabFlag: [Number, String]
+    grabFlag: [Number, String],
+    priceType: [Number, String]
   },
   data () {
     return {
@@ -123,6 +124,9 @@ export default {
           this.queryParam.endDate = undefined
         }
         const fun = [querySumByProductLocation, salesReturnProductList]
+        if (this.grabFlag == 0) {
+          this.queryParam.salePriceType = this.priceType
+        }
         return fun[this.grabFlag](Object.assign(parameter, this.queryParam)).then(res => {
           const data = res.data
           const no = (data.pageNo - 1) * data.pageSize
@@ -220,8 +224,7 @@ export default {
       {
         title: '产品名称',
         dataIndex: 'productName',
-        align: 'center',
-        width: 200
+        align: 'center'
       },
       {
         title: '原厂编码',
@@ -244,7 +247,7 @@ export default {
         customRender: function (text) { return text || '--' },
         width: 120
       },
-      { slots: { title: 'customTitle' }, scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }]
+      { slots: { title: 'customTitle' }, scopedSlots: { customRender: 'action' }, width: 100, align: 'center' }]
     }
   },
   methods: {

+ 14 - 16
src/views/salesManagement/salesReturn/salesReturnEdit.vue

@@ -26,7 +26,7 @@
 
     <a-card size="small" :bordered="false" class="pages-wrap">
       <!-- 查询配件列表 -->
-      <queryPart :buyerSn="$route.params.buyerSn" grabFlag="0" :newLoading="isInster" @add="saveProduct"></queryPart>
+      <queryPart :buyerSn="$route.params.buyerSn" :priceType="ordeDetail.priceType" grabFlag="0" :newLoading="isInster" @add="saveProduct"></queryPart>
     </a-card>
     <a-card size="small" :bordered="false" class="pages-wrap">
       <!-- alert -->
@@ -110,6 +110,17 @@
             :precision="0"
             @change="onCellChange(record.id, 'celQty', $event)" />
         </template>
+        <!-- 价格 -->
+        <template slot="price" slot-scope="text, record">
+          <editable-cell
+            size="small"
+            :text="text"
+            :max="999999"
+            :min="0"
+            :precision="2"
+            punit="¥"
+            @change="onCellChange(record.id, 'price', $event)" />
+        </template>
         <!-- 退货金额小计 -->
         <template slot="returnAmount" slot-scope="text, record">
           ¥{{ (record.price * record.qty).toFixed(2) }}
@@ -216,12 +227,6 @@ export default {
           width: 160,
           customRender: function (text) { return text || '--' }
         },
-        {
-          title: '销售单号',
-          dataIndex: 'salesBillNo',
-          align: 'center',
-          width: 200
-        },
         {
           title: '售价',
           dataIndex: 'price',
@@ -235,14 +240,9 @@ export default {
           align: 'center',
           width: 100
         },
+        { title: '仓库仓位', scopedSlots: { customRender: 'warehouse' }, width: 200, align: 'center' },
         {
-          title: '销售数量',
-          dataIndex: 'salesQty',
-          align: 'center',
-          width: 100
-        },
-        {
-          title: '本次退货数量',
+          title: '退货数量',
           dataIndex: 'qty',
           align: 'center',
           width: 150,
@@ -255,7 +255,6 @@ export default {
           width: 150,
           scopedSlots: { customRender: 'celQty' }
         },
-        { title: '仓库仓位', scopedSlots: { customRender: 'warehouse' }, width: 200, align: 'center' },
         {
           title: '退货金额小计',
           align: 'center',
@@ -316,7 +315,6 @@ export default {
       const row = chooseLoadData.find(item => item.id === id)
       if (row) {
         row[key] = Number(value)
-        console.log(row.celQty, row.qty)
         if (row.celQty > row.qty) {
           this.$message.info('废品数量不可大于本次退货数量')
         } else {