zhangdan %!s(int64=3) %!d(string=hai) anos
pai
achega
9993cdb6d8

+ 20 - 11
src/views/inventoryManagement/inventoryQuery/list.vue

@@ -130,7 +130,7 @@
         <template slot="unsalableDays" slot-scope="text, record" >
           <span v-if="record.unsalableDays>=180&&record.unsalableDays<=360" style="color:#FF9900">{{num(record.unsalableDays)}}</span>
           <span v-else-if="record.unsalableDays>360" style="color:#FF0000">{{num(record.unsalableDays)}}</span>
-          <span v-else >{{num(record.unsalableDays)}}</span>
+          <span v-else >{{num(record.unsalableDays) }}</span>
         </template>
         <!-- 操作 -->
         <template slot="action" slot-scope="text, record">
@@ -200,12 +200,12 @@ export default {
         { title: '产品编码', dataIndex: 'productCode', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品名称', dataIndex: 'productName', width: '16%', align: 'left', ellipsis: true, customRender: function (text) { return text || '--' } },
         { title: '原厂编码', dataIndex: 'productOrigCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品品牌', dataIndex: 'brandName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品品牌', dataIndex: 'brandName', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品分类', scopedSlots: { customRender: 'productTypeName' }, width: '13%', align: 'center' },
         { title: '可用库存数量(个)', dataIndex: 'currentStockQty', width: '8%', align: 'center', sorter: true, customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '可用库存成本(¥)', dataIndex: 'currentStockCost', width: '8%', align: 'center', sorter: true, customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: <div><a-tooltip placement='top' title='1:产品距离最近一次销售的时间,30天算一个月 2:采购退货,调拨等不算销售,不用来计算滞销天数'><a-icon type="question-circle" /></a-tooltip>&nbsp;滞销天数</div>, width: '7%', align: 'center', scopedSlots: { customRender: 'unsalableDays' },sorter: true,   },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: '15%', align: 'center' }
+        { title: <div><a-tooltip placement='top' title='1:产品距离最近一次销售的时间,30天算一个月 2:采购退货,调拨等不算销售,不用来计算滞销天数'><a-icon type="question-circle" /></a-tooltip>&nbsp;滞销天数</div>, width: '10%', align: 'center', scopedSlots: { customRender: 'unsalableDays' },sorter: true,   },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -296,15 +296,24 @@ export default {
       this.queryParam.maxUnsalableDays = this.queryParam.maxUnsalableDays > 999999999 ? 999999999 : this.queryParam.maxUnsalableDays
       return true
     },
+    // 格式化滞销天数为几个月零几天
     num(val){
       let days
-      if(val>=30){
-        const a=Math.floor(val/30)
-        const b=val-a*30
-        days=a+'个月'+b+'天'
-      }else{
-        days=b+'天'
-      }
+      if(val){
+        if(val>=30){
+          const a=Math.floor(val/30)
+            const b=val-a*30
+            if(b>0){
+              days=a+'个月'+b+'天'
+            }else{
+              days=a+'个月'
+            }
+          }else{
+            days=val+'天'
+          }
+        }else{
+          days='--'
+        }
       return days
       console.log(days,'天数')
     },

+ 17 - 9
src/views/reportData/chainStockReport/list.vue

@@ -198,8 +198,8 @@ export default {
         { title: '原厂编码', dataIndex: 'productOrigCode', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '可用库存数量(个)', dataIndex: 'currentStockQty', width: '14%', align: 'center', sorter: true, customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '可用库存成本(¥)', dataIndex: 'currentStockCost', width: '14%', align: 'center', sorter: true, customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: <div><a-tooltip placement='top' title='1:产品距离最近一次销售的时间,30天算一个月 2:采购退货,调拨等不算销售,不用来计算滞销天数'><a-icon type="question-circle" /></a-tooltip>&nbsp;滞销天数</div>, width: '7%', align: 'center', scopedSlots: { customRender: 'unsalableDays' },sorter: true, },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: '12%', align: 'center' }
+        { title: <div><a-tooltip placement='top' title='1:产品距离最近一次销售的时间,30天算一个月 2:采购退货,调拨等不算销售,不用来计算滞销天数'><a-icon type="question-circle" /></a-tooltip>&nbsp;滞销天数</div>, width: '10%', align: 'center', scopedSlots: { customRender: 'unsalableDays' },sorter: true, },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '5%', align: 'center' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -291,13 +291,21 @@ export default {
     },
     num(val){
       let days
-      if(val>=30){
-        const a=Math.floor(val/30)
-        const b=val-a*30
-        days=a+'个月'+b+'天'
-      }else{
-        days=b+'天'
-      }
+      if(val){
+        if(val>=30){
+          const a=Math.floor(val/30)
+            const b=val-a*30
+            if(b>0){
+              days=a+'个月'+b+'天'
+            }else{
+              days=a+'个月'
+            }
+          }else{
+            days=val+'天'
+          }
+        }else{
+          days='--'
+        }
       return days
       console.log(days,'天数')
     },