瀏覽代碼

采购入库增删查

chenrui 2 年之前
父節點
當前提交
37ed9efcbd

+ 61 - 48
src/views/purchasingManagement/purchaseReturn/addModal.vue

@@ -1,7 +1,7 @@
 <template>
   <a-modal
     centered
-    class="bulkWarehousingOrder-basicInfo-modal"
+    class="purchaseReturn-basicInfo-modal"
     :footer="null"
     :maskClosable="false"
     title="新增"
@@ -10,17 +10,17 @@
     :width="800">
     <a-spin :spinning="spinning" tip="Loading...">
       <a-form-model
-        id="bulkWarehousingOrder-basicInfo-form"
+        id="purchaseReturn-basicInfo-form"
         ref="ruleForm"
         :model="form"
         :rules="rules"
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol" >
-        <a-form-model-item label="入库单号" prop="relationNo">
+        <a-form-model-item label="入库单号" prop="sparePartsNo">
           <a-select
             placeholder="请输入入库单号"
             allowClear
-            v-model="form.supplierSn"
+            v-model="form.sparePartsNo"
             :showSearch="true"
             option-filter-prop="children"
             :filter-option="filterOption">
@@ -30,21 +30,21 @@
         <a-form-model-item label="供应商名称" prop="supplierSn">
           <span>--</span>
         </a-form-model-item>
-        <a-form-model-item label="退货原因" prop="sparePartsType">
+        <a-form-model-item label="退货原因" prop="returnReason">
           <v-select
-            v-model="form.sparePartsType"
-            ref="sparePartsType"
-            id="bulkWarehousingOrder-basicInfo-sparePartsType"
-            code="SPARE_PARTS_TYPE"
+            v-model="form.returnReason"
+            ref="returnReason"
+            id="purchaseReturn-basicInfo-returnReason"
+            code="SPARE_PARTS_RETURN_REASON"
             placeholder="请选择退货原因"
             allowClear></v-select>
         </a-form-model-item>
 
-        <a-form-model-item label="补充说明" prop="remark">
+        <a-form-model-item label="补充说明" prop="explainInfo">
           <a-textarea
-            id="bulkWarehousingOrder"
+            id="purchaseReturn"
             :maxLength="30"
-            v-model="form.remark"
+            v-model="form.explainInfo"
             placeholder="具体描述下退货原因"
             allowClear />
         </a-form-model-item>
@@ -64,8 +64,8 @@
         </a-form-model-item>
       </a-form-model>
       <div class="btn-cont">
-        <a-button id="bulkWarehousingOrder-basicInfo-modal-back" @click="isShow = false">取消</a-button>
-        <a-button style="margin-left: 15px;" type="primary" id="bulkWarehousingOrder-basicInfo-modal-save" @click="handleSave">确定</a-button>
+        <a-button id="purchaseReturn-basicInfo-modal-back" @click="isShow = false">取消</a-button>
+        <a-button style="margin-left: 15px;" type="primary" id="purchaseReturn-modal-save" @click="handleSave">确定</a-button>
       </div>
     </a-spin>
   </a-modal>
@@ -76,8 +76,9 @@ import { commonMixin } from '@/utils/mixin'
 import { VSelect, Upload } from '@/components'
 import { supplierAllList } from '@/api/supplier'
 import { sparePartsSave } from '@/api/spareParts'
+import { sparePartsReturnSave } from '@/api/sparePartsReturn'
 export default {
-  name: 'BulkWarehousingOrderBasicInfoModal',
+  name: 'purchaseReturnBasicInfoModal',
   mixins: [commonMixin],
   components: { VSelect, Upload },
   props: {
@@ -95,52 +96,61 @@ export default {
         wrapperCol: { span: 16 }
       },
       form: {
+        sparePartsNo:undefined,//入库单号
         supplierSn: undefined, // 供应商
-        sparePartsType: undefined, //  散件类型
-        relationNo: '', //  关联单号
-        remark: '' // 备注
+        returnReason:'',//退货原因
+        explainInfo: '' ,// 补充说明
+       attachmentList:undefined
       },
       rules: {
+        sparePartsNo: [
+          { required: true, message: '请选择入库单号', trigger: 'change' }
+        ],
         supplierSn: [
-          { required: true, message: '请选择供应商', trigger: 'change' }
+          { required: true, message: '请选择正确供应商', trigger: 'change' }
         ],
-        sparePartsType: [
-          { required: true, message: '请选择入库类型', trigger: 'change' }
+        returnReason: [
+          { required: true, message: '请选择退货原因', trigger: 'change' }
         ],
-        relationNo: [
-          { required: true, message: '请输入入库单号', trigger: 'change' }
-        ]
+       
       },
       supplierList: [] //  供应商  下拉数据
     }
   },
   methods: {
+    //  附件上传
+    changeAttach (file) {
+      this.form.attachmentList = JSON.parse(file)
+      this.form.attachmentList.map(item => {
+        item.fileType = item.extName
+      })
+    },
     //  保存
     handleSave () {
       const _this = this
-      _this.$emit('close')
-      _this.$router.push({ name: 'purchaseReturnDeatil' })
-      // this.$refs.ruleForm.validate(valid => {
-      //   if (valid) {
-      //     const form = JSON.parse(JSON.stringify(_this.form))
-      //     _this.spinning = true
-      //     sparePartsSave(form).then(res => {
-      //       if (res.status == 200) {
-      //         _this.$message.success(res.message)
-      //         setTimeout(() => {
-      //           _this.isShow = false
-      //           _this.$emit('ok', res.data)
-      //           _this.spinning = false
-      //         }, 1000)
-      //       } else {
-      //         _this.spinning = false
-      //       }
-      //     })
-      //   } else {
-      //     console.log('error submit!!')
-      //     return false
-      //   }
-      // })
+      // _this.$emit('close')
+      // _this.$router.push({ name: 'purchaseReturnDeatil' })
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          const form = JSON.parse(JSON.stringify(_this.form))
+          _this.spinning = true
+          sparePartsReturnSave(form).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              setTimeout(() => {
+                _this.isShow = false
+                _this.$emit('ok', res.data)
+                _this.spinning = false
+              }, 1000)
+            } else {
+              _this.spinning = false
+            }
+          })
+        } else {
+          console.log('error submit!!')
+          return false
+        }
+      })
     },
     filterOption (input, option) {
       return (
@@ -181,7 +191,7 @@ export default {
 </script>
 
 <style lang="less" scoped>
-  .bulkWarehousingOrder-basicInfo-modal{
+  .purchaseReturn-basicInfo-modal{
     .ant-modal-body {
       padding: 40px 40px 24px;
     }
@@ -189,6 +199,9 @@ export default {
       text-align: center;
       margin: 35px 0 10px;
     }
+    .ant-form-item:nth-child(4){
+      margin-bottom: 0px !important;
+    }
   }
 
 </style>

+ 19 - 4
src/views/purchasingManagement/purchaseReturn/detailModal.vue

@@ -21,7 +21,7 @@
       <!-- 退货金额 -->
       <a-alert type="info" style="margin-bottom:10px">
         <div slot="message">
-          <span>退货金额 <strong>{{ (productTotal&&(productTotal.totalPrice || productTotal.totalPrice==0)) ? productTotal.totalPrice : '--' }}</strong></span>
+          <span>退货金额 <strong>{{ (statisticsObj && (statisticsObj.returnAmount || statisticsObj.returnAmount==0)) ? toThousands(statisticsObj.returnAmount) : '--' }}</strong></span>
         </div>
       </a-alert>
       <s-table
@@ -47,7 +47,8 @@
 
 <script>
 import { STable } from '@/components'
-import { stockPutDetailList } from '@/api/stockPut'
+import { sparePartsReturnQueryPage, queryPageCount } from '@/api/sparePartsReturn'
+import { toThousands } from '@/libs/tools.js'
 export default {
   name: 'ConfirmationDetailModal',
   components: { STable },
@@ -71,9 +72,10 @@ export default {
     return {
       isShow: this.openModal, //  是否打开弹框
       detailsData: null, //  详情数据
+      statisticsObj: null,
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
-        return stockPutDetailList(Object.assign(parameter, { sn: this.itemSn })).then(res => {
+        return sparePartsReturnQueryPage(Object.assign(parameter, { sn: this.itemSn })).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
@@ -115,7 +117,18 @@ export default {
       return auditArr
     }
   },
-  methods: {},
+  methods: {
+    // 获取退货金额
+    getStatisticsData () {
+      queryPageCount({ sn: this.itemSn }).then(res => {
+        if (res.status == 200) {
+          this.statisticsObj = res.data
+        } else {
+          this.statisticsObj = null
+        }
+      })
+    }
+  },
   watch: {
     //  父页面传过来的弹框状态
     openModal (newValue, oldValue) {
@@ -126,6 +139,8 @@ export default {
       if (!newValue) {
         this.$emit('close')
         this.$refs.table.clearTable()
+      } else {
+        this.getStatisticsData()
       }
     },
     itemSn (newValue, oldValue) {

+ 59 - 39
src/views/purchasingManagement/purchaseReturn/list.vue

@@ -93,9 +93,13 @@
         :scroll="{ y: tableHeight }"
         :defaultLoadData="false"
         bordered>
+        <!-- 采购退货单号 -->
+        <template slot="sparePartsReturnNo" slot-scope="text, record">
+          <span class="link-bule" @click="handleDetail(record)">{{ record.sparePartsReturnNo }}</span>
+        </template>
         <!-- 入库单号 -->
         <template slot="sparePartsNo" slot-scope="text, record">
-          <span v-if="$hasPermissions('B_sparePartsDetail')" class="link-bule" @click="handleDetail(record)">{{ record.sparePartsNo }}</span>
+          <span v-if="$hasPermissions('B_sparePartsDetail')" class="link-bule" @click="handleWarehousingDetail(record)">{{ record.sparePartsNo }}</span>
           <span v-else>{{ record.sparePartsNo }}</span>
         </template>
         <!-- 操作 -->
@@ -104,43 +108,51 @@
             size="small"
             type="link"
             class="button-warning"
+            v-if="record.state == 'WAIT_AUDIT'"
             @click="openReviewModal = true"
-            id="allocateBillList-examine-btn">审核进度</a-button>
+            id="allocateBillList-examine-btn">审核</a-button>
           <a-button
             size="small"
             type="link"
-            v-if="record.state == 'WAIT_AUDIT' && $hasPermissions('B_sparePartsEdit')"
+            v-if="record.state == 'WAIT_SUBMIT'"
             @click="handleEdit(record)"
             class="button-info"
             id="bulkWarehousingOrderList-edit-btn">编辑</a-button>
           <a-button
             size="small"
             type="link"
-            v-if="record.state == 'WAIT_AUDIT' && $hasPermissions('B_sparePartsEdit')"
+            class="button-warning"
+            @click="openReviewModal = true"
+            v-if="record.state == 'FINISH_AUDIT' ||record.state == 'NOAGREE_AUDIT' "
+            id="allocateBillList-examine-btn">审核进度</a-button>
+          <a-button
+            size="small"
+            type="link"
+            v-if="record.state == 'FINISH_AUDIT'"
             @click="handleEdit(record)"
             class="button-info"
             id="bulkWarehousingOrderList-edit-btn">同步到ERP</a-button>
           <a-button
             size="small"
             type="link"
-            v-if="record.state == 'WAIT_AUDIT' && $hasPermissions('B_sparePartsEdit')"
+            v-if="record.state == 'NOAGREE_AUDIT'"
             @click="handleEdit(record)"
             class="button-info"
             id="bulkWarehousingOrderList-edit-btn">再次提交</a-button>
           <a-button
             size="small"
             type="link"
-            v-if="record.state == 'WAIT_AUDIT' && $hasPermissions('B_sparePartsDel')"
+            v-if="record.state == 'WAIT_SUBMIT'"
             @click="handleDel(record)"
             class="button-error"
             id="bulkWarehousingOrderList-del-btn">删除</a-button>
-          <span v-if="!(record.state == 'WAIT_AUDIT'&&($hasPermissions('B_sparePartsEdit') || $hasPermissions('B_sparePartsDel') || $hasPermissions('B_sparePartsAudit')))">--</span>
         </template>
       </s-table>
     </a-spin>
     <!-- 选择基本信息弹框 -->
     <add-modal v-drag :openModal="openModal" @ok="handleOk" @close="openModal=false" />
     <detailModal v-drag :openModal="openDetailModal" :itemSn="itemSn" @close="closeDetailModal" />
+    <sparePartsDetailModal v-drag :openModal="openWarehousingDetailModal" :itemSn="warehousingSn" @close="closeWarehousingDetailModal" />
     <!-- 导出提示框 -->
     <reportModal :visible="showExport" @close="showExport=false"></reportModal>
     <!-- 选择审核人员 -->
@@ -155,16 +167,18 @@ import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import addModal from './addModal.vue'
 import detailModal from './detailModal.vue'
+import sparePartsDetailModal from '../bulkWarehousingOrder/detailModal.vue'
 import rangeDate from '@/views/common/rangeDate.vue'
 import chooseDepartUserModal from './chooseDepartUserModal.vue'
 import reviewProgressModal from './reviewProgressModal.vue'
 import reportModal from '@/views/common/reportModal.vue'
 import { hdExportExcel } from '@/libs/exportExcel'
-import { sparePartsList, sparePartsDelete, sparePartsAudit, sparePartsDetailExport } from '@/api/spareParts'
+import { toFixedDecimal } from '@/libs/tools.js'
+import { sparePartsReturnList, sparePartsReturnDelete, sparePartsReturnSave, sparePartsAudit, sparePartsDetailExport } from '@/api/sparePartsReturn'
 export default {
   name: 'PurchaseReturnList',
   mixins: [commonMixin],
-  components: { STable, VSelect, reportModal, detailModal, addModal, chooseDepartUserModal, rangeDate, reviewProgressModal },
+  components: { STable, VSelect, reportModal, detailModal, addModal, chooseDepartUserModal, rangeDate, reviewProgressModal, sparePartsDetailModal },
   data () {
     return {
       spinning: false,
@@ -176,22 +190,34 @@ export default {
       auditInfo: null,
       // 查询参数
       queryParam: {
-        productCode: '',
-        relationNo: '',
+        productCode: undefined,
+        relationNo: undefined,
         state: undefined,
         sparePartsType: undefined,
-        sparePartsNo: '',
-        supplierName: '',
-        kingdeeNo: ''
-
+        sparePartsNo: undefined,
+        supplierName: undefined,
+        kingdeeNo: 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: '入库单号', scopedSlots: { customRender: 'sparePartsNo' }, width: '15%', align: 'center' },
+        { title: '供应商名称', dataIndex: 'supplierName', align: 'center', width: '15%', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '退货原因', dataIndex: 'explainInfo', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '申请退货数量', dataIndex: 'totalPutQty', 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' }
+      ],
       openDepartUserModal: false,
       loading: false,
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
-        return sparePartsList(Object.assign(parameter, this.queryParam)).then(res => {
+        return sparePartsReturnList(Object.assign(parameter, this.queryParam)).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
@@ -207,28 +233,12 @@ export default {
       },
       openDetailModal: false,
       itemSn: null,
+      warehousingSn: null,
       rowSelectionInfo: null,
-      openReviewModal: false
+      openReviewModal: false,
+      openWarehousingDetailModal: false
     }
   },
-  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: 'sparePartsNo' }, width: '15%', align: 'center' },
-	      { title: '入库单号', scopedSlots: { customRender: 'sparePartsNo' }, width: '15%', align: 'center' },
-	      { title: '供应商名称', dataIndex: 'supplierName', align: 'center', width: '15%', customRender: function (text) { return text || '--' }, ellipsis: true },
-	      { title: '退货原因', dataIndex: 'remark', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '申请退货数量', dataIndex: 'productTotalQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-	      { title: '退货金额', dataIndex: 'productTotalCost', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-	      { title: '审核时间', dataIndex: 'sparePartsTypeDictValue', 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' }
-	    ]
-	    return arr
-	  }
-  },
   methods: {
     // 提交时间
     dateChange (date) {
@@ -262,16 +272,26 @@ export default {
     handleEdit (row) {
       this.$router.push({ path: `/purchasingManagement/purchaseReturn/purchaseReturnDeatil` })
     },
-    //  详情
+    //  采购退货详情
     handleDetail (row) {
-      this.itemSn = row.sparePartsSn
+      this.itemSn = row.sparePartsReturnNo
       this.openDetailModal = true
     },
-    // 关闭弹框
+    // 入库单详情
+    handleWarehousingDetail (row) {
+      this.warehousingSn = row.sparePartsSn
+      this.openWarehousingDetailModal = true
+    },
+    // 关闭采购退货详情弹框
     closeDetailModal () {
       this.itemSn = null
       this.openDetailModal = false
     },
+    // 关闭入库单详情弹框
+    closeWarehousingDetailModal () {
+      this.warehousingSn = null
+      this.openWarehousingDetailModal = false
+    },
     //  删除
     handleDel (row) {
       const _this = this
@@ -281,7 +301,7 @@ export default {
         centered: true,
         onOk () {
           _this.spinning = true
-          sparePartsDelete({ sn: row.sparePartsSn }).then(res => {
+          sparePartsReturnDelete({ sn: row.sparePartsReturnNo }).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$refs.table.refresh()