chenrui преди 2 години
родител
ревизия
7cbadc20a4

+ 13 - 6
src/views/purchasingManagement/purchaseReturn/detailModal.vue

@@ -30,7 +30,7 @@
         <div slot="message">
           <span>产品款数:<strong>{{ statisticsObj&&statisticsObj.totalCategory|| '--' }}</strong>;</span>
           <span>申请退货总数量:<strong>{{ statisticsObj&&statisticsObj.qty||'--' }}</strong>;</span>
-          <span>退货金额:<strong>{{ statisticsObj&&statisticsObj.totalCost || '--' }}</strong></span>
+          <span v-if="$hasPermissions('B_isShowPrice')">退货金额:<strong>{{ statisticsObj&&statisticsObj.totalCost || '--' }}</strong></span>
         </div>
       </a-alert>
       <s-table
@@ -90,8 +90,12 @@ export default {
           }
           return data
         })
-      },
-      columns: [
+      }
+    }
+  },
+  computed: {
+    columns () {
+      const arr = [
         { title: '序号', dataIndex: 'no', width: '7%', align: 'center' },
         { title: '入库单号', dataIndex: 'sparePartsNo', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品编码', dataIndex: 'productCode', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
@@ -99,10 +103,13 @@ export default {
         { title: '单位', dataIndex: 'product.unit', width: '14%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '批次号', dataIndex: 'stockBatchNo', width: '20%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '入库数量', dataIndex: 'putQty', width: '14%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '退货单价', dataIndex: 'cost', width: '14%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '申请退货数量', dataIndex: 'qty', width: '14%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '退货金额', dataIndex: 'totalCost', width: '14%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
+        { title: '申请退货数量', dataIndex: 'qty', width: '14%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
       ]
+      if (this.$hasPermissions('B_isShowPrice')) { //  售价权限
+        arr.splice(7, 0, { title: '退货单价', dataIndex: 'cost', width: '14%', align: 'center', customRender: function (text) { return ((text || text == 0) ? toFixedDecimal(text, 2) : '--') } })
+        arr.splice(9, 0, { title: '退货金额', dataIndex: 'totalCost', width: '14%', align: 'center', customRender: function (text) { return ((text || text == 0) ? toFixedDecimal(text, 2) : '--') } })
+      }
+      return arr
     }
   },
   methods: {

+ 19 - 12
src/views/purchasingManagement/purchaseReturn/list.vue

@@ -176,18 +176,6 @@ export default {
         returnReason: undefined,
         state: undefined
       },
-      columns: [
-        { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
-        { title: '创建时间', dataIndex: 'createDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '采购退货单号', scopedSlots: { customRender: 'sparePartsReturnNo' }, width: '15%', align: 'center' },
-        { title: '供应商名称', dataIndex: 'supplier.supplierName', align: 'center', width: '15%', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '退货原因', dataIndex: 'returnReasonDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '申请退货数量', dataIndex: 'totalQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '退货金额', dataIndex: 'totalCost', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? toFixedDecimal(text, 2) : '--') } },
-        { title: '审核时间', dataIndex: 'auditDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '审核状态', dataIndex: 'stateDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: '9%', align: 'center' }
-      ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
@@ -210,6 +198,25 @@ export default {
       auditTime: null// 审核时间
     }
   },
+  computed: {
+    columns () {
+      const arr = [
+        { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
+        { title: '创建时间', dataIndex: 'createDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '采购退货单号', scopedSlots: { customRender: 'sparePartsReturnNo' }, width: '15%', align: 'center' },
+        { title: '供应商名称', dataIndex: 'supplier.supplierName', align: 'center', width: '15%', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '退货原因', dataIndex: 'returnReasonDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '申请退货数量', dataIndex: 'totalQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '审核时间', dataIndex: 'auditDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '审核状态', dataIndex: 'stateDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '9%', align: 'center' }
+      ]
+      if (this.$hasPermissions('B_isShowPrice')) { //  售价权限
+        arr.splice(6, 0, { title: '退货金额', dataIndex: 'totalCost', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? toFixedDecimal(text, 2) : '--') } })
+      }
+      return arr
+    }
+  },
   methods: {
     // 创建时间
     dateChange (date) {

+ 67 - 100
src/views/purchasingManagement/purchaseReturn/purchaseReturnDeatil.vue

@@ -18,13 +18,19 @@
               编辑基础信息
             </div>
             <a-descriptions size="small" :column="3" style="margin-bottom: 10px;">
-              <a-descriptions-item label="采购退货单号">{{ detailsData&&detailsData.sparePartsReturnNo || '--' }}</a-descriptions-item>
-              <a-descriptions-item label="供应商名称">{{ detailsData&&detailsData.supplier&&detailsData.supplier.supplierName || '--' }}</a-descriptions-item>
-              <a-descriptions-item label="退货原因">{{ detailsData&&detailsData.returnReasonDictValue || '--' }}</a-descriptions-item>
-              <a-descriptions-item label="补充说明" :span="3">{{ detailsData&&detailsData.explainInfo || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="采购退货单号">{{ (detailsData && detailsData.sparePartsReturnNo) || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="供应商名称">{{ (detailsData && detailsData.supplier && detailsData.supplier.supplierName) || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="退货原因">{{ (detailsData && detailsData.returnReasonDictValue) || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="补充说明" :span="3">{{ (detailsData && detailsData.explainInfo) || '--' }}</a-descriptions-item>
               <a-descriptions-item label="附件" :span="3">
-                <span v-if="detailsData&&detailsData.attachmentList&&detailsData.attachmentList.length>0">
-                  <a target="_blank" style="color: #00aaff;text-decoration: underline;margin-right: 15px;" :href="item.filePath" v-for="item in detailsData.attachmentList" :key="item.id">
+                <span v-if="detailsData && detailsData.attachmentList && detailsData.attachmentList.length > 0">
+                  <a
+                    target="_blank"
+                    style="color: #00aaff;text-decoration: underline;margin-right: 15px;"
+                    :href="item.filePath"
+                    v-for="item in detailsData.attachmentList"
+                    :key="item.id"
+                  >
                     {{ item.fileName }}
                   </a>
                 </span>
@@ -43,8 +49,8 @@
         <a-alert style="margin-bottom: 10px;" type="info">
           <div slot="message" class="total-bar">
             <div>
-              <span>申请退货数量:{{ statisticsObj&&(statisticsObj.qty || statisticsObj.qty == 0 )? statisticsObj.qty : '--' }};</span>
-              <span>退货金额:{{ statisticsObj&&statisticsObj.totalCost }}元;</span>
+              <span>申请退货数量:{{ statisticsObj && (statisticsObj.qty || statisticsObj.qty == 0) ? statisticsObj.qty : '--' }};</span>
+              <span v-if="$hasPermissions('B_isShowPrice')">退货金额:{{ statisticsObj && statisticsObj.totalCost }}元;</span>
             </div>
           </div>
         </a-alert>
@@ -131,7 +137,14 @@ import { STable, VSelect } from '@/components'
 import queryPart from './queryPart.vue'
 import addModal from './addModal.vue'
 import chooseDepartUserModal from './chooseDepartUserModal.vue'
-import { sparePartsReturnQueryPage, queryPageCount, sparePartsReturnDetailDelete, sparePartsReturnDetailSave, sparePartsReturnSubmit, sparePartsReturnInfo } from '@/api/sparePartsReturn'
+import {
+  sparePartsReturnQueryPage,
+  queryPageCount,
+  sparePartsReturnDetailDelete,
+  sparePartsReturnDetailSave,
+  sparePartsReturnSubmit,
+  sparePartsReturnInfo
+} from '@/api/sparePartsReturn'
 import { toFixedDecimal } from '@/libs/tools.js'
 export default {
   name: 'PurchaseReturnEdit',
@@ -158,75 +171,6 @@ export default {
       sparePartsReturnSn: null,
       sparePartsReturnNo: null,
       chooseList: [],
-      columns: [
-        { title: '序号', dataIndex: 'no', align: 'center', width: '4%' },
-        {
-          title: '入库单号',
-          dataIndex: 'sparePartsNo',
-          width: '18%',
-          align: 'center',
-          customRender: function (text) {
-            return text || '--'
-          }
-        },
-        {
-          title: '产品编码',
-          dataIndex: 'product.code',
-          width: '18%',
-          align: 'center',
-          customRender: function (text) {
-            return text || '--'
-          }
-        },
-        {
-          title: '产品名称',
-          dataIndex: 'product.name',
-          width: '25%',
-          align: 'left',
-          customRender: function (text) {
-            return text || '--'
-          },
-          ellipsis: true
-        },
-        {
-          title: '单位',
-          dataIndex: 'product.unit',
-          align: 'center',
-          width: '6%',
-          customRender: function (text) {
-            return text || '--'
-          }
-        },
-        {
-          title: '批次号',
-          dataIndex: 'stockBatchNo',
-          align: 'center',
-          width: '18%',
-          customRender: function (text) {
-            return text || '--'
-          }
-        },
-        {
-          title: '退货单价',
-          dataIndex: 'cost',
-          align: 'center',
-          width: '8%',
-          customRender: function (text) {
-            return text || text == 0 ? toFixedDecimal(text, 2) : '--'
-          }
-        },
-        { title: '申请退货数量', align: 'center', width: '13%', scopedSlots: { customRender: 'qty' } },
-        {
-          title: '退款金额',
-          dataIndex: 'totalCost',
-          align: 'center',
-          width: '13%',
-          customRender: function (text) {
-            return text || text == 0 ? toFixedDecimal(text, 2) : '--'
-          }
-        },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
-      ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
@@ -251,7 +195,26 @@ export default {
       openModal: false, // 修改信息弹窗
       statisticsObj: null, // 统计明细
       detailsData: null, // 基础信息数据
-      addMoreLoading: false// 批量添加动画
+      addMoreLoading: false // 批量添加动画
+    }
+  },
+  computed: {
+    columns () {
+      const arr = [
+        { title: '序号', dataIndex: 'no', align: 'center', width: '4%' },
+        { title: '入库单号', dataIndex: 'sparePartsNo', width: '18%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'product.code', width: '18%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'product.name', width: '25%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '单位', dataIndex: 'product.unit', align: 'center', width: '6%', customRender: function (text) { return text || '--' } },
+        { title: '批次号', dataIndex: 'stockBatchNo', align: 'center', width: '18%', customRender: function (text) { return text || '--' } },
+        { title: '申请退货数量', align: 'center', width: '13%', scopedSlots: { customRender: 'qty' } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
+      ]
+      if (this.$hasPermissions('B_isShowPrice')) {
+        arr.splice(6, 0, { title: '退货单价', dataIndex: 'cost', align: 'center', width: '8%', customRender: function (text) { return text || text == 0 ? toFixedDecimal(text, 2) : '--' } })
+        arr.splice(8, 0, { title: '退款金额', dataIndex: 'totalCost', align: 'center', width: '13%', customRender: function (text) { return text || text == 0 ? toFixedDecimal(text, 2) : '--' } })
+      }
+      return arr
     }
   },
   methods: {
@@ -274,16 +237,18 @@ export default {
         onOk () {
           _this.delLoading = true
           _this.spinning = true
-          sparePartsReturnDetailDelete({ detailSn: row.sparePartsReturnDetailSn }).then(res => {
-            if (res.status == 200) {
-              _this.resetTable(false)
-            }
-            _this.$message.info(res.message)
-            _this.delLoading = false
-            _this.spinning = false
-          }).catch(err => {
-            _this.delLoading = false
-          })
+          sparePartsReturnDetailDelete({ detailSn: row.sparePartsReturnDetailSn })
+            .then(res => {
+              if (res.status == 200) {
+                _this.resetTable(false)
+              }
+              _this.$message.info(res.message)
+              _this.delLoading = false
+              _this.spinning = false
+            })
+            .catch(err => {
+              _this.delLoading = false
+            })
         }
       })
     },
@@ -381,16 +346,18 @@ export default {
     },
     saveEdit (params) {
       this.spinning = true
-      sparePartsReturnDetailSave(params).then(res => {
-        if (res.status == 200) {
-          this.resetSearchForm(true)
-        }
-        this.isInster = false
-        this.spinning = false
-        this.addMoreLoading = false
-      }).catch(err => {
-        this.isInster = false
-      })
+      sparePartsReturnDetailSave(params)
+        .then(res => {
+          if (res.status == 200) {
+            this.resetSearchForm(true)
+          }
+          this.isInster = false
+          this.spinning = false
+          this.addMoreLoading = false
+        })
+        .catch(err => {
+          this.isInster = false
+        })
     },
     beforeSubmit () {
       if (this.chooseList.length > 0) {
@@ -423,7 +390,7 @@ export default {
       queryPageCount({ sparePartsReturnSn: this.sparePartsReturnSn }).then(res => {
         if (res.status == 200) {
           if (res.data) {
-            res.data.totalCost = (res.data && (res.data.totalCost || res.data.totalCost == 0)) ? toFixedDecimal(res.data.totalCost, 2) : '--'
+            res.data.totalCost = res.data && (res.data.totalCost || res.data.totalCost == 0) ? toFixedDecimal(res.data.totalCost, 2) : '--'
             this.statisticsObj = res.data
           } else {
             this.statisticsObj = null

+ 23 - 14
src/views/purchasingManagement/purchaseReturn/queryPart.vue

@@ -86,6 +86,7 @@
 import { queryDetailStockPage } from '@/api/spareParts'
 import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
+import { toFixedDecimal } from '@/libs/tools.js'
 export default {
   name: 'QueryPart',
   components: { STable, VSelect, rangeDate },
@@ -122,20 +123,6 @@ export default {
       selectArr: null,
       isChecked: false,
       addedSn: [],
-      columns: [
-        { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
-        { title: '入库单号', dataIndex: 'sparePartsNo', width: '24%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品编码', dataIndex: 'product.code', width: '24%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'product.name', width: '27%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '单位', dataIndex: 'product.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '批次号', dataIndex: 'sparePartsBatchNo', width: '24%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '入库单价', dataIndex: 'productCost', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '入库数量', dataIndex: 'productQty', width: '9%', align: 'center', customRender: function (text) { return (text || text == 0) ? text : '--' } },
-        { title: '已退数量', dataIndex: 'returnedQty', width: '9%', align: 'center', customRender: function (text) { return (text || text == 0) ? text : '--' } },
-        { title: '最大可退数量', dataIndex: 'currentStockQty', width: '9%', align: 'center', customRender: function (text) { return (text || text == 0) ? text : '--' } },
-        { title: '申请退货数量', width: '9%', align: 'center', scopedSlots: { customRender: 'qty' } },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
-      ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
@@ -158,6 +145,28 @@ export default {
       }
     }
   },
+  computed: {
+    columns () {
+      const arr = [
+        { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
+        { title: '入库单号', dataIndex: 'sparePartsNo', width: '24%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'product.code', width: '24%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'product.name', width: '27%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '单位', dataIndex: 'product.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '批次号', dataIndex: 'sparePartsBatchNo', width: '24%', align: 'center', customRender: function (text) { return text || '--' } },
+
+        { title: '入库数量', dataIndex: 'productQty', width: '9%', align: 'center', customRender: function (text) { return (text || text == 0) ? text : '--' } },
+        { title: '已退数量', dataIndex: 'returnedQty', width: '9%', align: 'center', customRender: function (text) { return (text || text == 0) ? text : '--' } },
+        { title: '最大可退数量', dataIndex: 'currentStockQty', width: '9%', align: 'center', customRender: function (text) { return (text || text == 0) ? text : '--' } },
+        { title: '申请退货数量', width: '9%', align: 'center', scopedSlots: { customRender: 'qty' } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
+      ]
+      if (this.$hasPermissions('B_isShowPrice')) {
+        arr.splice(6, 0, { title: '入库单价', dataIndex: 'productCost', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? toFixedDecimal(text, 2) : '--') } })
+      }
+      return arr
+    }
+  },
   methods: {
     //  重置
     resetSearchForm () {