浏览代码

散件入库、采购退货

chenrui 2 年之前
父节点
当前提交
021ded72fd

+ 3 - 32
src/views/purchasingManagement/bulkWarehousingOrder/basicInfoModal.vue

@@ -17,15 +17,7 @@
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol" >
         <a-form-model-item label="供应商" prop="supplierSn">
-          <a-select
-            placeholder="请选择供应商"
-            allowClear
-            v-model="form.supplierSn"
-            :showSearch="true"
-            option-filter-prop="children"
-            :filter-option="filterOption">
-            <a-select-option v-for="item in supplierList" :key="item.supplierSn" :value="item.supplierSn" :disabled="item.enableFlag==0">{{ item.supplierName }}</a-select-option>
-          </a-select>
+          <supplier v-model="form.supplierSn" placeholder="请输入供应商名称"></supplier>
         </a-form-model-item>
         <a-form-model-item label="入库类型" prop="sparePartsType">
           <v-select
@@ -64,12 +56,12 @@
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { VSelect } from '@/components'
-import { supplierAllList } from '@/api/supplier'
 import { sparePartsSave } from '@/api/spareParts'
+import supplier from '@/views/common/supplier.js'
 export default {
   name: 'BulkWarehousingOrderBasicInfoModal',
   mixins: [commonMixin],
-  components: { VSelect },
+  components: { VSelect, supplier },
   props: {
     openModal: { //  弹框显示状态
       type: Boolean,
@@ -126,25 +118,6 @@ export default {
           return false
         }
       })
-    },
-    filterOption (input, option) {
-      return (
-        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
-      )
-    },
-    // 供应商下拉数据
-    getSupplierList (val) {
-      supplierAllList().then(res => {
-        if (res.status == 200) {
-          this.supplierList = res.data
-          if (val) { //  需将新增加的供应商回填,即不需要用户再选一下
-            this.form.supplierSn = this.supplierList[0].supplierSn
-            this.$refs.ruleForm.clearValidate('supplierSn')
-          }
-        } else {
-          this.supplierList = []
-        }
-      })
     }
   },
   watch: {
@@ -157,8 +130,6 @@ export default {
       if (!newValue) {
         this.$emit('close')
         this.$refs.ruleForm.resetFields()
-      } else {
-        this.getSupplierList()
       }
     }
   }

+ 33 - 63
src/views/purchasingManagement/purchaseReturn/addModal.vue

@@ -4,7 +4,7 @@
     class="purchaseReturn-basicInfo-modal"
     :footer="null"
     :maskClosable="false"
-    title="新增"
+    :title="itemSn?'编辑':'新增'"
     v-model="isShow"
     @cancel="isShow=false"
     :width="800">
@@ -16,21 +16,8 @@
         :rules="rules"
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol" >
-        <a-form-model-item label="入库单号" prop="sparePartsNo">
-          <a-select
-            placeholder="请输入入库单号"
-            allowClear
-            v-model="form.sparePartsNo"
-            :showSearch="true"
-            option-filter-prop="children"
-            :filter-option="filterOption"
-            @change="handleSupplierName">
-            <a-select-option v-for="item in receiptNoList" :key="item.id" :value="item.sparePartsNo">{{ item.sparePartsNo }}</a-select-option>
-          </a-select>
-        </a-form-model-item>
         <a-form-model-item label="供应商名称" prop="supplierSn">
-          <span v-if="!supplierName">--</span>
-          <span>{{ supplierName }}</span>
+          <supplier v-model="form.supplierSn" placeholder="请输入供应商名称"></supplier>
         </a-form-model-item>
         <a-form-model-item label="退货原因" prop="returnReason">
           <v-select
@@ -45,7 +32,7 @@
         <a-form-model-item label="补充说明" prop="explainInfo">
           <a-textarea
             id="purchaseReturn"
-            :maxLength="30"
+            :maxLength="60"
             v-model="form.explainInfo"
             placeholder="具体描述下退货原因"
             allowClear />
@@ -76,16 +63,20 @@
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { VSelect, Upload } from '@/components'
-import { sparePartsList } from '@/api/spareParts'
-import { sparePartsReturnSave } from '@/api/sparePartsReturn'
+import supplier from '@/views/common/supplier.js'
+import { sparePartsReturnSave, sparePartsReturnInfo } from '@/api/sparePartsReturn'
 export default {
   name: 'PurchaseReturnBasicInfoModal',
   mixins: [commonMixin],
-  components: { VSelect, Upload },
+  components: { VSelect, Upload, supplier },
   props: {
     openModal: { //  弹框显示状态
       type: Boolean,
       default: false
+    },
+    itemSn: {
+      type: [Number, String],
+      default: ''
     }
   },
   data () {
@@ -97,32 +88,22 @@ export default {
         wrapperCol: { span: 16 }
       },
       form: {
-        sparePartsNo: undefined, // 入库单号
         supplierSn: undefined, // 供应商
         returnReason: '', // 退货原因
         explainInfo: '', // 补充说明
-        attachmentList: '',
-        sparePartsSn: undefined,
-        sparePartsBatchNo: undefined
+        attachmentList: ''
       },
-      attachList: [],
+      attachList: [], // 附件
       rules: {
-        sparePartsNo: [
-          { required: true, message: '请选择入库单号', trigger: 'change' }
-        ],
         supplierSn: [
-          { required: true, message: '请选择正确供应商', trigger: 'change' }
+          { required: true, message: '请选择供应商名称', trigger: 'change' }
         ],
         returnReason: [
           { required: true, message: '请选择退货原因', trigger: 'change' }
         ]
-
       },
-      receiptNoList: [], //  入库单号  下拉数据
-      page: 1,
-      pageSize: 20,
-      attachAction: process.env.VUE_APP_API_BASE_URL + '/uploadGetFileInfo',
-      supplierName: null
+      receiptNoList: [], //  供应商  下拉数据
+      attachAction: process.env.VUE_APP_API_BASE_URL + '/uploadGetFileInfo'
     }
   },
   methods: {
@@ -136,8 +117,6 @@ export default {
     //  保存
     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))
@@ -160,36 +139,25 @@ export default {
         }
       })
     },
-    filterOption (input, option) {
-      return (
-        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
-      )
-    },
-    // 入库单号下拉数据
-    getReceiptNoList (val) {
-      sparePartsList({ pageNo: this.page, pageSize: this.pageSize }).then(res => {
+    // 获取编辑详情
+    getDetail () {
+      sparePartsReturnInfo({ sn: this.itemSn }).then(res => {
         if (res.status == 200) {
-          this.receiptNoList = res.data.list
-          // if (val) { //  需将新增加的入库单号回填,即不需要用户再选一下
-          //   this.form.supplierSn = this.receiptNoList[0].supplierSn
-          //   this.$refs.ruleForm.clearValidate('supplierSn')
-          // }
+          const resultObj = res.data
+          this.attachList = resultObj.attachmentList
+          const obj = {
+            supplierSn: resultObj.supplierSn,
+            returnReason: resultObj.returnReason, // 退货原因
+            explainInfo: resultObj.explainInfo // 补充说明
+          }
+          this.$nextTick(() => {
+            this.$refs.attachList.setFileList(this.attachList)
+          })
+          this.form = { ...this.form, ...obj }
         } else {
-          this.receiptNoList = []
+          this.detailsData = null
         }
       })
-    },
-    // 入库单号 -> 供应商名称等信息
-    handleSupplierName (e) {
-      const pos = this.receiptNoList.findIndex(item => { return item.sparePartsNo == e })
-      this.supplierName = this.receiptNoList[pos].supplierName
-      const obj = {
-        sparePartsSn: this.receiptNoList[pos].sparePartsSn,
-        sparePartsNo: e,
-        supplierSn: this.receiptNoList[pos].supplierSn,
-        sparePartsBatchNo: this.receiptNoList[pos].sparePartsBatchNo
-      }
-      Object.assign(this.form, obj)
     }
   },
   watch: {
@@ -205,7 +173,9 @@ export default {
         this.supplierName = null
         this.$refs.ruleForm.resetFields()
       } else {
-        this.getReceiptNoList()
+        if (this.itemSn) {
+          this.getDetail()
+        }
       }
     }
   }

+ 4 - 21
src/views/purchasingManagement/purchaseReturn/chooseDepartUserModal.vue

@@ -4,7 +4,7 @@
     class="departUser-modal"
     :footer="null"
     :maskClosable="false"
-    :title="title+'选择审批人员'"
+    title="选择审批人员"
     v-model="isShow"
     @cancel="cancel"
     width="60%">
@@ -75,7 +75,6 @@ export default {
       uploading: false,
       spinning: false,
       isShow: this.openModal, //  是否打开弹框
-      title: '',
       formItemLayout: {
         labelCol: { span: 4 },
         wrapperCol: { span: 16 }
@@ -85,13 +84,12 @@ export default {
         approvers: [], // 审批人
         ccList: [] // 抄送人
       },
-      attachList: [],
       rules: {
         applyPersonSn: [
           { required: true, message: '请选择申请人员', trigger: 'change' }
         ],
         approvers: [
-          { required: true, type: 'array', message: '请选择审批人', trigger: 'change' }
+          { required: true, type: 'array', message: '请选择审批人', trigger: 'change' }
         ]
       }
     }
@@ -106,7 +104,7 @@ export default {
     updateUser () {
       this.uploading = true
       this.$refs.departUserApp.updateDeptUser()
-      // this.$refs.departUserCc.updateDeptUser()
+      this.$refs.departUserCc.updateDeptUser()
     },
     changeApprovers (value) {
       this.form.approvers = value
@@ -126,14 +124,12 @@ export default {
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
           const form = JSON.parse(JSON.stringify(_this.form))
-          form.attachmentList = this.attachList
           if (form.approvers) {
             form.approvers = this.getTreeVal(form.approvers)
           }
           if (form.ccList) {
             form.ccList = this.getTreeVal(form.ccList)
           }
-          console.log(form)
           this.$emit('submit', form)
           this.$emit('close')
         } else {
@@ -143,30 +139,17 @@ export default {
     },
     getDetail (data) {
       this.form = Object.assign(this.form, {
-        salesReturnType: data.salesReturnType,
         applyPersonSn: data.applyPersonSn
       })
-      // 获取附件列表
-      this.form.attachmentList = ''
-      this.attachList = data.attachmentList
-      this.$nextTick(() => {
-        if (this.attachList.length) {
-          this.$refs.attachList.setFileList(this.attachList)
-        }
-      })
     },
     resetForm () {
       this.$nextTick(() => {
         this.$refs.ruleForm.resetFields()
-        this.$refs.attachList.setFileList('')
       })
-      this.attachList = []
       this.form = {
-        salesReturnType: undefined,
         applyPersonSn: undefined,
         ccList: undefined,
-        approvers: undefined,
-        attachmentList: ''
+        approvers: undefined
       }
     },
     cancel () {

+ 37 - 40
src/views/purchasingManagement/purchaseReturn/detailModal.vue

@@ -9,18 +9,27 @@
     @cancel="isShow=false"
     :width="960">
     <div>
-      <a-descriptions size="small" :column="4" style="margin-bottom: 10px;">
-        <a-descriptions-item label="采购退货单号">{{ nowData&&nowData.stockPutNo || '--' }}</a-descriptions-item>
-        <a-descriptions-item label="入库单号">{{ nowData&&nowData.stockPutNo || '--' }}</a-descriptions-item>
-        <a-descriptions-item label="批次号">{{ nowData&&nowData.stockPutNo || '--' }}</a-descriptions-item>
-        <a-descriptions-item label="供应商名称">{{ nowData&&nowData.putTime || '--' }}</a-descriptions-item>
-        <a-descriptions-item label="退货原因">{{ nowData&&nowData.putBizTypeDictValue || '--' }}</a-descriptions-item>
-        <a-descriptions-item label="补充说明">{{ nowData&&nowData.putBizTypeDictValue || '--' }}</a-descriptions-item>
-        <a-descriptions-item label="附件">{{ nowData&&nowData.putBizTypeDictValue || '--' }}</a-descriptions-item>
+      <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.supplierName || '--' }}</a-descriptions-item>
+        <a-descriptions-item label="退货原因">{{ detailsData&&detailsData.returnReason || '--' }}</a-descriptions-item>
+        <a-descriptions-item label="创建时间">{{ detailsData&&detailsData.returnReason || '--' }}</a-descriptions-item>
+        <a-descriptions-item label="出库时间">{{ detailsData&&detailsData.returnReason || '--' }}</a-descriptions-item>
+        <a-descriptions-item label="业务状态">{{ detailsData&&detailsData.returnReason || '--' }}</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">
+            <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>
+          <span v-else>--</span>
+        </a-descriptions-item>
       </a-descriptions>
-      <!-- 退货金额 -->
       <a-alert type="info" style="margin-bottom:10px">
         <div slot="message">
+          <span>产品款数:<strong>{{ statisticsObj.putQty }}</strong>;</span>
+          <span>申请退货总数量:<strong>{{ statisticsObj.qty }}</strong>;</span>
           <span>退货金额:<strong>{{ statisticsObj.totalCost }}</strong></span>
         </div>
       </a-alert>
@@ -34,12 +43,6 @@
         :defaultLoadData="false"
         bordered>
       </s-table>
-      <div class="auditProgress">审核进度</div>
-      <a-divider />
-      <div class="tip">说明:以下信息来自钉钉</div>
-      <div class="tip">提审时间:2022-12-29 16:16:04</div>
-      <a-table :columns="auditColumns" :data-source="data" bordered>
-      </a-table>
       <div class="btn-cont"><a-button id="confirmationDetail-modal-back" @click="isShow = false">返回列表</a-button></div>
     </div>
   </a-modal>
@@ -47,7 +50,7 @@
 
 <script>
 import { STable } from '@/components'
-import { sparePartsReturnQueryPage, queryPageCount } from '@/api/sparePartsReturn'
+import { sparePartsReturnQueryPage, queryPageCount, sparePartsReturnInfo } from '@/api/sparePartsReturn'
 import { toFixedDecimal } from '@/libs/tools.js'
 export default {
   name: 'ConfirmationDetailModal',
@@ -72,7 +75,7 @@ export default {
     return {
       isShow: this.openModal, //  是否打开弹框
       detailsData: null, //  详情数据
-      statisticsObj: null,
+      statisticsObj: null, // 统计金额数据
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         return sparePartsReturnQueryPage(Object.assign(parameter, { sn: this.itemSn })).then(res => {
@@ -87,44 +90,37 @@ export default {
           }
           return data
         })
-      }
-    }
-  },
-  computed: {
-    // 列表表头
-    columns () {
-      const arr = [
+      },
+      columns: [
         { 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 || '--' } },
-        { title: '产品名称', dataIndex: 'product.name', width: '45%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '产品名称', dataIndex: 'product.name', width: '30%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '单位', dataIndex: 'product.unit', width: '14%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '批次号', dataIndex: 'sparePartsBatchNo', 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 : '--') } }
       ]
-      return arr
-    },
-    auditColumns () {
-      const auditArr = [
-        { title: '序号', dataIndex: 'no', width: '7%', align: 'center' },
-        { title: '人员名称', dataIndex: 'peopleName', width: '45%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '状态', dataIndex: 'status', width: '14%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '审批意见', dataIndex: 'suggest', width: '45%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '附件', dataIndex: 'fujian', width: '14%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '操作时间', dataIndex: 'time', width: '14%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
-      ]
-      return auditArr
     }
   },
   methods: {
-    // 获取退货金额
+    getBasicsInfo () {
+      sparePartsReturnInfo({ sn: this.itemSn }).then(res => {
+        if (res.status == 200) {
+          this.detailsData = res.data
+        } else {
+          this.detailsData = null
+        }
+      })
+    },
+    // 获取金额统计
     getStatisticsData () {
       queryPageCount({ sn: this.itemSn }).then(res => {
         if (res.status == 200) {
-          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
         }
@@ -143,6 +139,7 @@ export default {
         this.$refs.table.clearTable()
       } else {
         this.getStatisticsData()
+        this.getBasicsInfo()
       }
     },
     itemSn (newValue, oldValue) {

+ 31 - 95
src/views/purchasingManagement/purchaseReturn/list.vue

@@ -11,33 +11,32 @@
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
-              <a-form-item label="入库单号">
-                <a-input id="bulkWarehousingOrderList-sparePartsNo" v-model.trim="queryParam.sparePartsNo" allowClear placeholder="请输入入库单号"/>
+              <a-form-item label="采购退货单号">
+                <a-input id="bulkWarehousingOrderList-productCode" v-model.trim="queryParam.sparePartsReturnNo" allowClear placeholder="请输入采购退货单号"/>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="供应商名称">
-                <a-input id="bulkWarehousingOrderList-productCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入供应商名称"/>
+                <supplier v-model="queryParam.supplierSn" placeholder="请输入供应商名称"></supplier>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="退货原因">
                 <v-select
-                  v-model="queryParam.state"
-                  ref="state"
-                  id="bulkWarehousingOrderList-state"
-                  code="SPARE_PARTS_STATE"
+                  v-model="queryParam.returnReason"
+                  ref="returnReason"
+                  id="purchaseReturn-returnReason"
+                  code="SPARE_PARTS_RETURN_REASON"
                   placeholder="请选择退货原因"
-                  allowClear
-                ></v-select>
+                  allowClear></v-select>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
-              <a-form-item label="审核状态">
+              <a-form-item label="业务状态">
                 <v-select
                   v-model="queryParam.state"
                   ref="state"
-                  id="bulkWarehousingOrderList-state"
+                  id="purchaseReturn-state"
                   code="SPARE_PARTS_STATE"
                   placeholder="请选择审核状态"
                   allowClear
@@ -50,7 +49,6 @@
                 <a-button style="margin-left: 5px" @click="resetSearchForm()" :disabled="disabled" id="bulkWarehousingOrderList-reset">重置</a-button>
                 <a-button
                   style="margin-left: 10px"
-                  v-if="$hasPermissions('B_sparePartsExport')"
                   type="primary"
                   class="button-warning"
                   @click="handleExport"
@@ -63,20 +61,17 @@
         </a-form>
       </div>
       <!-- 操作按钮 -->
+      <!-- v-if="$hasPermissions('B_sparePartsExport')" -->
       <div class="table-operator">
         <a-button v-if="$hasPermissions('B_sparePartsNew')" id="bulkWarehousingOrderList-add" type="primary" class="button-error" @click="handleAdd">新增</a-button>
         <a-button
           style="margin-left: 10px"
-          v-if="$hasPermissions('B_sparePartsExport')"
           type="primary"
           class="button-warning"
           @click="handleExport"
           :disabled="disabled"
           :loading="exportLoading"
         >同步到ERP</a-button>
-        <span style="margin-left: 8px">
-          <template v-if="rowSelectionInfo && rowSelectionInfo.selectedRowKeys.length>0">{{ `已选 ${rowSelectionInfo.selectedRowKeys.length} 项` }}</template>
-        </span>
       </div>
       <!-- 列表 -->
       <s-table
@@ -84,10 +79,7 @@
         ref="table"
         :style="{ height: tableHeight+84.5+'px' }"
         size="small"
-        :rowKey="(record) => record.sparePartsSn"
-        rowKeyName="sparePartsSn"
-        :row-selection="$hasPermissions('B_sparePartsBatchAudit')?{ columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: record.state != 'WAIT_AUDIT' } }) }:null"
-        @rowSelection="rowSelectionFun"
+        :rowKey="(record) => record.sparePartsReturnNo"
         :columns="columns"
         :data="loadData"
         :scroll="{ y: tableHeight }"
@@ -97,12 +89,8 @@
         <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="handleWarehousingDetail(record)">{{ record.sparePartsNo }}</span>
-          <span v-else>{{ record.sparePartsNo }}</span>
-        </template>
         <!-- 操作 -->
+        <!-- state 待提交 WAIT_SUBMIT 待审核 WAIT_AUDIT 已完结  -->
         <template slot="action" slot-scope="text, record">
           <a-button
             size="small"
@@ -116,7 +104,7 @@
             type="link"
             class="button-warning"
             @click="openReviewModal = true"
-            v-if="record.state == 'FINISH_AUDIT' ||record.state == 'NOAGREE_AUDIT' "
+            v-if="record.state !='WAIT_SUBMIT'"
             id="allocateBillList-examine-btn">审核进度</a-button>
           <a-button
             size="small"
@@ -145,7 +133,6 @@
     <!-- 选择基本信息弹框 -->
     <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>
     <!-- 审核进度弹窗 -->
@@ -158,18 +145,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 { toFixedDecimal } from '@/libs/tools.js'
+import supplier from '@/views/common/supplier.js'
 import { sparePartsReturnList, sparePartsReturnDelete, sparePartsAudit, sparePartsDetailExport, againSubmit } from '@/api/sparePartsReturn'
 export default {
   name: 'PurchaseReturnList',
   mixins: [commonMixin],
-  components: { STable, VSelect, reportModal, detailModal, addModal, chooseDepartUserModal, rangeDate, reviewProgressModal, sparePartsDetailModal },
+  components: { STable, supplier, VSelect, reportModal, detailModal, addModal, chooseDepartUserModal, rangeDate, reviewProgressModal },
   data () {
     return {
       spinning: false,
@@ -181,19 +168,17 @@ export default {
       auditInfo: null,
       // 查询参数
       queryParam: {
-        productCode: undefined,
-        relationNo: undefined,
-        state: undefined,
-        sparePartsType: undefined,
-        sparePartsNo: undefined,
-        supplierName: undefined,
-        kingdeeNo: undefined
+        beginDate: undefined,
+        endDate: undefined,
+        sparePartsReturnNo: undefined,
+        supplierSn: undefined,
+        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: '入库单号', 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 : '--') } },
@@ -256,11 +241,11 @@ export default {
     },
     //  基本信息  保存
     handleOk (row) {
-      this.$router.push({ path: `/purchasingManagement/purchaseReturn/add/${row.sparePartsReturnSn}/${row.sparePartsNo}` })
+      this.$router.push({ name: 'purchaseReturnAdd', query: { returnSn: row.sparePartsReturnSn, no: row.sparePartsReturnNo, sn: row.supplierSn } })
     },
     //  编辑
     handleEdit (row) {
-      this.$router.push({ path: `/purchasingManagement/purchaseReturn/edit/${row.sparePartsReturnSn}/${row.sparePartsNo}` })
+      this.$router.push({ name: 'purchaseReturnEdit', query: { returnSn: row.sparePartsReturnSn, no: row.sparePartsReturnNo, sn: row.supplierSn } })
     },
     // 再次提交
     handleResubmit (row) {
@@ -288,21 +273,11 @@ export default {
       this.itemSn = row.sparePartsReturnSn
       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
@@ -327,55 +302,16 @@ export default {
     //  重置
     resetSearchForm () {
       this.queryParam = {
-        productCode: '',
-        relationNo: '',
-        state: undefined,
-        sparePartsType: undefined,
-        sparePartsNo: '',
-        supplierName: '',
-        kingdeeNo: ''
+        beginDate: undefined,
+        endDate: undefined,
+        sparePartsReturnNo: undefined,
+        supplierSn: undefined,
+        returnReason: undefined,
+        state: undefined
       }
+      this.$refs.rangeDate.resetDate()
       this.$refs.table.refresh(true)
     },
-    //  单条审核
-    handleAudit (row, isBatch) {
-      const _this = this
-      let content = ''
-      let params = []
-      if (isBatch) { //  批量
-        content = '确认要批量审核吗?'
-        params = row
-      } else { //  单条
-        content = '确认要审核通过吗?'
-        params = [row.sparePartsSn]
-      }
-      this.$confirm({
-        title: '提示',
-        content: content,
-        centered: true,
-        onOk () {
-          _this.spinning = true
-          sparePartsAudit(params).then(res => {
-            if (res.status == 200) {
-              _this.$refs.table.clearSelected() // 清空表格选中项
-              _this.$message.success(res.message)
-              _this.$refs.table.refresh()
-              _this.spinning = false
-            } else {
-              _this.spinning = false
-            }
-          })
-        }
-      })
-    },
-    // 批量审核
-    handleBatchAudit () {
-      if (!this.rowSelectionInfo || (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 1)) {
-        this.$message.warning('请在列表勾选后再进行批量操作!')
-        return
-      }
-      this.handleAudit(this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys, 'batch')
-    },
     pageInit () {
       const _this = this
       this.$nextTick(() => { // 页面渲染完成后的回调

+ 196 - 127
src/views/purchasingManagement/purchaseReturn/purchaseReturnDeatil.vue

@@ -1,26 +1,35 @@
 <template>
   <div class="salesReturnEdit-wrap">
     <a-spin :spinning="spinning" tip="Loading...">
-      <a-page-header :ghost="false" :backIcon="false" class="salesReturnEdit-back" >
+      <a-page-header :ghost="false" :backIcon="false" class="salesReturnEdit-back">
         <!-- 自定义的二级文字标题 -->
         <template slot="subTitle">
-          <a id="salesReturnEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
+          <a id="salesReturnEdit-back-btn" href="javascript:;" @click="handleBack">
+            <a-icon type="left" />
+            返回列表
+          </a>
         </template>
       </a-page-header>
       <a-card size="small" :bordered="false" class="outboundOrderDetail-cont">
         <a-collapse :activeKey="['1']">
           <a-collapse-panel key="1" header="基础信息">
-            <div slot="extra" style="padding: 0 20px; color: #00aaff;" @click.stop="handleEditBase" >
-              <a-icon type="edit" /> 编辑基础信息
+            <div slot="extra" style="padding: 0 20px; color: #00aaff;" @click.stop="handleEditBase">
+              <a-icon type="edit" />
+              编辑基础信息
             </div>
-            <a-descriptions size="small" :column="4" style="margin-bottom: 10px;">
-              <a-descriptions-item label="采购退货单号">CT20221229000001</a-descriptions-item>
-              <a-descriptions-item label="入库单号">SJ221222000001</a-descriptions-item>
-              <a-descriptions-item label="批次号">SJ221222000001</a-descriptions-item>
-              <a-descriptions-item label="供应商名称">东莞市绿冠滤清器有限公司</a-descriptions-item>
-              <a-descriptions-item label="退货原因">2022-12-30 14:22</a-descriptions-item>
-              <a-descriptions-item label="补充说明">2022-12-30 14:22</a-descriptions-item>
-              <a-descriptions-item label="附件">2022-12-30 14:22</a-descriptions-item>
+            <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.supplierName || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="退货原因">{{ detailsData&&detailsData.returnReason || '--' }}</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">
+                  <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>
+                <span v-else>--</span>
+              </a-descriptions-item>
             </a-descriptions>
           </a-collapse-panel>
         </a-collapse>
@@ -34,7 +43,7 @@
         <a-alert style="margin-bottom: 10px;" type="info">
           <div slot="message" class="total-bar">
             <div v-if="statisticsObj">
-              <span>申请退货数量:{{ (statisticsObj.returnedQty || statisticsObj.returnedQty==0) ? statisticsObj.returnedQty : '--' }};</span>
+              <span>申请退货数量:{{ statisticsObj.qty || statisticsObj.qty == 0 ? statisticsObj.qty : '--' }};</span>
               <span>退货金额:{{ statisticsObj.totalCost }}元;</span>
             </div>
           </div>
@@ -44,14 +53,13 @@
             <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
               <a-row :gutter="15">
                 <a-col :md="6" :sm="24">
-                  <a-form-item label="产品编码">
-                    <a-input v-model.trim="productForm.productCode" allowClear placeholder="请输入产品编码"/>
-                  </a-form-item>
+                  <a-form-item label="入库单号"><a-input v-model.trim="productForm.sparePartsNo" allowClear placeholder="请输入入库单号" /></a-form-item>
                 </a-col>
                 <a-col :md="6" :sm="24">
-                  <a-form-item label="产品名称">
-                    <a-input v-model.trim="productForm.productName" allowClear placeholder="请输入产品名称"/>
-                  </a-form-item>
+                  <a-form-item label="产品编码"><a-input v-model.trim="productForm.productCode" allowClear placeholder="请输入产品编码" /></a-form-item>
+                </a-col>
+                <a-col :md="6" :sm="24">
+                  <a-form-item label="产品名称"><a-input v-model.trim="productForm.productName" allowClear placeholder="请输入产品名称" /></a-form-item>
                 </a-col>
                 <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
                   <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled">查询</a-button>
@@ -66,26 +74,27 @@
           class="sTable"
           ref="table"
           size="small"
-          :rowKey="(record) => record.id"
+          :rowKey="record => record.id"
           :columns="columns"
           :data="loadData"
           :defaultLoadData="false"
           :scroll="{ y: 300 }"
           bordered>
           <!--申请退货数量 -->
-          <template slot="returnQty" slot-scope="text, record">
+          <template slot="qty" slot-scope="text, record">
             <a-input-number
               id="salesReturn-qty"
               size="small"
-              v-model="record.returnedQty"
+              v-model="record.qty"
               :precision="0"
-              :min="0"
-              :max="record.returnedQty"
+              :min="1"
+              :max="record.currentStockQty"
               placeholder="请输入"
               style="width: 100%;"
-               @blur="e => onCellBlur(e.target.value, record, 'qty')"/>
+              @blur="e => onCellBlur(e.target.value, record, 'qty')"
+            />
           </template>
-          
+
           <!-- 操作 -->
           <template slot="action" slot-scope="text, record">
             <a-button
@@ -110,11 +119,11 @@
         id="salesReturn-handleSubmit">提交</a-button>
     </div>
     <!-- 选择审核人员 -->
-    <chooseDepartUserModal ref="chooseDepart" :openModal="openDepartUserModal" @close="openDepartUserModal=false" @submit="handleSubmit"></chooseDepartUserModal>
+    <chooseDepartUserModal ref="chooseDepart" :openModal="openDepartUserModal" @close="openDepartUserModal = false" @submit="handleSubmit"></chooseDepartUserModal>
     <!-- 导入产品 -->
     <!-- <importGuideModal :openModal="openGuideModal" :params="{salesReturnBillSn: $route.params.sn}" @close="closeGuideModel" @ok="hanldeOk" /> -->
     <!-- 批量设置退货原因 -->
-    <commonModal modalTit="批量设置退货原因" :openModal="showPlModal" @cancel="showPlModal=false" @ok="setPlReturnReason">
+    <commonModal modalTit="批量设置退货原因" :openModal="showPlModal" @cancel="showPlModal = false" @ok="setPlReturnReason">
       <div style="text-align: center;">
         <div style="margin-bottom: 15px;font-size: 14px;"><strong>请输入退货原因</strong></div>
         <div style="line-height: 24px;">
@@ -123,7 +132,7 @@
       </div>
     </commonModal>
     <!-- 编辑基础信息弹窗 -->
-    <add-modal v-drag :openModal="openModal" @ok="handleOk" @close="openModal=false" />
+    <add-modal v-drag :openModal="openModal" :itemSn="sparePartsReturnSn" @ok="handleOk" @close="openModal = false" />
   </div>
 </template>
 
@@ -138,13 +147,7 @@ import commonModal from '@/views/common/commonModal.vue'
 import EditableCell from '@/views/common/editInput.js'
 import chooseDepartUserModal from './chooseDepartUserModal.vue'
 import returnReason from '@/views/common/returnReason'
-import {
-  salesReturnDetail,
-  salesReturnSubmit,
-  salesReturnBatchInsert,
-  salesReturnPrint,
-  salesReturnExport
-} from '@/api/salesReturn'
+import { salesReturnDetail, salesReturnSubmit, salesReturnBatchInsert, salesReturnPrint, salesReturnExport } from '@/api/salesReturn'
 import {
   salesReturnDetailList,
   salesReturnDetailDel,
@@ -153,10 +156,10 @@ import {
   salesReturnDetailUpdateReason,
   salesReturnDetailSetReason
 } from '@/api/salesReturnDetail'
-import { sparePartsReturnQueryPage, queryPageCount,sparePartsReturnDetailDelete,sparePartsReturnDetailSave,sparePartsReturnSubmit} from '@/api/sparePartsReturn'
+import { sparePartsReturnQueryPage, queryPageCount, sparePartsReturnDetailDelete, sparePartsReturnDetailSave, sparePartsReturnSubmit, sparePartsReturnInfo } from '@/api/sparePartsReturn'
 import { toFixedDecimal } from '@/libs/tools.js'
 export default {
-  name: 'purchaseReturnEdit',
+  name: 'PurchaseReturnEdit',
   mixins: [commonMixin],
   components: {
     STable,
@@ -184,23 +187,85 @@ export default {
       productForm: {
         sn: '',
         productName: '',
-        productCode: ''
+        productCode: '',
+        sparePartsNo: ''
       },
       chooseLoadData: [],
-      columns :[
+      sparePartsReturnSn: null,
+      sparePartsReturnNo: null,
+      columns: [
         { title: '序号', dataIndex: 'no', align: 'center', width: '4%' },
-        { 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: 'cost', align: 'center', width: '8%',customRender: function (text) { return text || '--' }},
-        { title: '申请退货数量', align: 'center', width: '13%', scopedSlots: { customRender: 'returnQty' }},
-        { title: '退款金额', dataIndex: 'totalCost', align: 'center', width: '13%',  customRender: function (text) { return text || '--' }},
+        {
+          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: 'sparePartsBatchNo',
+          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
-        this.productForm.sn = this.$route.params.returnSn;
+        this.productForm.sn = this.$route.query.returnSn
         return sparePartsReturnQueryPage(Object.assign(parameter, this.productForm)).then(res => {
           let data
           if (res.status == 200) {
@@ -224,7 +289,8 @@ export default {
       plReturnReason: '',
       showPlModal: false,
       openModal: false,
-      statisticsObj:null
+      statisticsObj: null,
+      detailsData: null
     }
   },
   watch: {
@@ -236,7 +302,7 @@ export default {
   },
   computed: {
     selNums () {
-      return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length || 0
+      return (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length) || 0
     }
   },
   methods: {
@@ -252,31 +318,6 @@ export default {
     rowSelectionFun (obj) {
       this.rowSelectionInfo = obj || null
     },
-    // 已选产品  blur
-    onCellBlur (val, record, type) {
-      const valBackups = record.qtyBackups
-      //  光标移出,值发生改变再调用编辑接口
-      if (val && val != valBackups) {
-        this.spinning = true
-        salesReturnDetailUpdateQty({
-          salesReturnDetailSn: record.salesReturnDetailSn,
-          initialQty: record.initialQty,
-          price: record.price
-        }).then(res => {
-          if (res.status == 200) {
-            this.resetTable(false)
-            this.$message.success(res.message)
-            this.spinning = false
-            record.qtyBackups = record.initialQty
-          } else {
-            this.spinning = false
-            record.initialQty = valBackups
-          }
-        })
-      } else {
-        record.initialQty = valBackups
-      }
-    },
     // 修改退货原因
     updateReason (row) {
       console.log(row.returnReason)
@@ -313,7 +354,7 @@ export default {
       } else {
         this.spinning = true
         const snList = []
-        const arr = this.rowSelectionInfo && this.rowSelectionInfo.selectedRows || []
+        const arr = (this.rowSelectionInfo && this.rowSelectionInfo.selectedRows) || []
         arr.map(item => {
           snList.push(item.salesReturnDetailSn)
         })
@@ -347,7 +388,7 @@ export default {
         onOk () {
           _this.delLoading = true
           _this.spinning = true
-          sparePartsReturnDetailDelete({ detailSn: row.sparePartsReturnDetailSn }).then(res => {
+          sparePartsReturnDetailDelete({ detailSn: row.id }).then(res => {
             if (res.status == 200) {
               _this.resetTable(false)
             }
@@ -369,30 +410,41 @@ export default {
       this.$refs.table.refresh(!!flag)
       // this.getOrderDetail()
     },
+    // 已选产品  blur
+    onCellBlur (val, record, type) {
+      const ajax_data = {
+        id: record.id,
+        qty: val
+      }
+      this.saveEdit(ajax_data)
+    },
     // 添加或修改产品
     saveProduct (row) {
-      if (this.isInster) {// 防止多次添加产品
+      if (this.isInster) {
+        // 防止多次添加产品
         return
       }
       this.isInster = true
       const paramsData = {
-        'sparePartsReturnSn': this.orderSn,
-        'sparePartsReturnNo': this.ordeDetail.salesReturnBillNo,
-        'sparePartsDetailSn': row.productPrice,
-        'productSn': row.lastStockCost,
-        'productCode': row.returnReason,
-        'putQty': row.productSn,
-        'returnedQty': row.qty,
-        'qty': row.qty,
-        'cost': row.qty,
-        'stockBatchNo': row.qty,
-        'warehouseSn': row.qty,
-        'warehouseLocationSn': row.qty
+        sparePartsReturnSn: this.sparePartsReturnSn,
+        sparePartsReturnNo: this.sparePartsReturnNo,
+        sparePartsDetailSn: row.sparePartsDetailSn,
+        productSn: row.productSn,
+        productCode: row.productCode,
+        putQty: row.productQty, // 入库数量
+        returnedQty: row.returnedQty, // 已退数量
+        qty: row.qty, // 申退数量
+        cost: row.productCost, // 成本
+        stockBatchNo: row.sparePartsBatchNo, // 批次号
+        warehouseSn: row.warehouseSn, // 仓库sn
+        warehouseLocationSn: row.warehouseLocationSn, // 仓位sn
+        sparePartsNo: row.sparePartsNo,
+        sparePartsSn: row.sparePartsSn
       }
       this.spinning = true
-      this.saveEdit(paramsData);
+      this.saveEdit(paramsData)
     },
-    saveEdit(params){
+    saveEdit (params) {
       sparePartsReturnDetailSave(params).then(res => {
         if (res.status == 200) {
           this.resetSearchForm(true)
@@ -402,9 +454,9 @@ export default {
         this.spinning = false
       })
     },
-    
+
     beforeSubmit () {
-       this.openDepartUserModal = true
+      this.openDepartUserModal = true
       // if (this.total) {
       //   const hasKong = this.chooseLoadData.find(item => !item.returnReason)
       //   if (hasKong) {
@@ -419,7 +471,7 @@ export default {
       //   this.$message.warning('请添加产品!')
       // }
     },
-    // 提交销售退货
+    // 提交采购退货
     handleSubmit (data) {
       this.spinning = true
       sparePartsReturnSubmit({ sparePartsReturnSn: this.sparePartsReturnSn, ...data }).then(res => {
@@ -446,7 +498,7 @@ export default {
       const _this = this
       const a = ['WAIT_CUSTOMER_SERVICE_CONFIRM', 'WAIT_FINANCIAL_AUDIT', 'FINANCIAL_REJECT', 'FINISH'].find(item => item == this.ordeDetail.billStatus)
       const status = a ? 'SALES_RETURN_AMOUNT' : 'SALES_RETURN_REASON'
-      const params = { salesReturnBillSn: this.$route.params.sn, priceType: status }
+      const params = { salesReturnBillSn: this.$route.query.sn, priceType: status }
       _this.spinning = true
       // 导出
       if (type == 'export') {
@@ -461,28 +513,45 @@ export default {
       }
     },
     pageInit () {
-      this.sparePartsNo = this.$route.params.no
-      this.sparePartsReturnSn = this.$route.params.returnSn
+      this.supplierSn = this.$route.query.sn
+      this.sparePartsReturnSn = this.$route.query.returnSn
+      this.sparePartsReturnNo = this.$route.query.no
+      this.$refs.partQuery.pageInit(this.supplierSn, 0)
+      this.getStatisticsData()
+      this.getBasicsData()
       this.resetSearchForm(true)
-      this.$refs.partQuery.pageInit(this.sparePartsNo, 0)
     },
+    // 获取页面统计数据
     getStatisticsData () {
-      queryPageCount({ sn: this.$route.params.returnSn }).then(res => {
+      queryPageCount({ sn: this.sparePartsReturnSn }).then(res => {
         if (res.status == 200) {
-          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
         }
       })
+    },
+    // 获取基础信息
+    getBasicsData () {
+      sparePartsReturnInfo({ sn: this.sparePartsReturnSn }).then(res => {
+        if (res.status == 200) {
+          this.detailsData = res.data
+        } else {
+          this.detailsData = null
+        }
+      })
+    },
+    // 修改成功
+    handleOk (data) {
+
     }
   },
   mounted () {
-    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
+    if (!this.$store.state.app.isNewTab) {
+      // 页签刷新时调用
       this.pageInit()
     }
-    // 获取页面统计数据
-    this.getStatisticsData();
   },
   activated () {
     // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
@@ -497,35 +566,35 @@ export default {
 </script>
 
 <style lang="less">
-  .salesReturnEdit-wrap{
-    position: relative;
+.salesReturnEdit-wrap {
+  position: relative;
+  height: 100%;
+  padding-bottom: 51px;
+  box-sizing: border-box;
+  > .ant-spin-nested-loading {
+    overflow-y: scroll;
     height: 100%;
-    padding-bottom: 51px;
-    box-sizing: border-box;
-    >.ant-spin-nested-loading{
-      overflow-y: scroll;
-      height: 100%;
+  }
+  .salesReturnEdit-cont {
+    margin-top: 10px;
+    .ant-divider-horizontal {
+      margin: 10px 0 24px;
     }
-    .salesReturnEdit-cont{
-      margin-top: 10px;
-      .ant-divider-horizontal{
-        margin:10px 0 24px;
-      }
-      .total-bar{
-        display: flex;
-        align-items: center;
-        justify-content: space-between;
-        > div{
-          &:last-child{
-            display: flex;
-            align-items: center;
-            justify-content: space-between;
-            > div{
-              padding: 0 10px;
-            }
+    .total-bar {
+      display: flex;
+      align-items: center;
+      justify-content: space-between;
+      > div {
+        &:last-child {
+          display: flex;
+          align-items: center;
+          justify-content: space-between;
+          > div {
+            padding: 0 10px;
           }
         }
       }
     }
   }
+}
 </style>

+ 67 - 51
src/views/purchasingManagement/purchaseReturn/queryPart.vue

@@ -3,23 +3,38 @@
     <!-- 搜索条件 -->
     <div class="table-page-search-wrapper">
       <div style="width:80%">
-        <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+        <a-form layout="inline" @keyup.enter.native="$refs.chooseTable.refresh(true)">
           <a-row :gutter="15">
-            <a-col :md="6" :sm="24">
+            <a-col :md="5" :sm="24">
+              <a-form-item label="入库单号">
+                <a-input id="salesReturnList-productCode" v-model.trim="queryParam.sparePartsNo" allowClear placeholder="请输入入库单号"/>
+              </a-form-item>
+            </a-col>
+            <a-col :md="5" :sm="24">
+              <a-form-item label="入库日期">
+                <rangeDate ref="rangeDate" :value="warehousingDate" @change="dateChange" />
+              </a-form-item>
+            </a-col>
+            <a-col :md="5" :sm="24">
               <a-form-item label="产品编码">
                 <a-input id="salesReturnList-productCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
               </a-form-item>
             </a-col>
-            <a-col :md="6" :sm="24">
+            <a-col :md="5" :sm="24">
               <a-form-item label="产品名称">
                 <a-input id="salesReturnList-productName" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
               </a-form-item>
             </a-col>
-            <a-col :md="8" :sm="24" style="margin-bottom: 10px;">
-              <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="salesReturnList-refresh">查询</a-button>
+            <a-col :md="4" :sm="24">
+              <a-button type="primary" @click="$refs.chooseTable.refresh(true)" :disabled="disabled" id="salesReturnList-refresh">查询</a-button>
               <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="salesReturnList-reset">重置</a-button>
-              <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="salesReturnList-reset">批量添加</a-button>
-              <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="salesReturnList-reset">整单添加</a-button>
+            </a-col>
+            <a-col :md="12" :sm="24" style="margin-bottom: 10px;display: flex;align-items: center;">
+              <a-button style="margin-right: 5px" @click="resetSearchForm" :disabled="disabled" id="salesReturnList-reset">批量添加</a-button>
+              <a-button style="margin-right: 5px" @click="resetSearchForm" :disabled="disabled" id="salesReturnList-reset">整单添加</a-button>
+              <a-checkbox @change="onChange">
+                显示最大可退数量为0的产品
+              </a-checkbox>
             </a-col>
           </a-row>
         </a-form>
@@ -28,10 +43,10 @@
     <!-- 列表 -->
     <s-table
       class="sTable"
-      ref="table"
+      ref="chooseTable"
       size="small"
       :rowKey="(record) => record.id"
-      :row-selection="{ columnWidth: 40 }"
+      :row-selection="{ columnWidth: 40,getCheckboxProps: record => ({ props: { disabled: record.currentStockQty == 0 } }) }"
       @rowSelection="rowSelectionFun"
       :columns="columns"
       :data="loadData"
@@ -46,29 +61,11 @@
             size="small"
             v-model="record.qty"
             :precision="0"
-            :min="showReceiveQty?0:1"
-            :max="999999"
-            style="width: 100%;"
-            placeholder="请输入" />
-        </div>
-      </template>
-      <!-- 仓库实收数量 -->
-      <template slot="receiveQty" slot-scope="text, record">
-        <div @dblclick.stop>
-          <a-input-number
-            size="small"
-            v-model="record.receiveQty"
-            :precision="0"
             :min="1"
-            :max="999999"
+            :disabled="record.currentStockQty == 0"
+            :max="record.currentStockQty"
             style="width: 100%;"
-            placeholder="请输入" />
-        </div>
-      </template>
-      <!-- 退货原因 -->
-      <template slot="returnReason" slot-scope="text, record">
-        <div @dblclick.stop>
-          <returnReason v-model="record.returnReason"></returnReason>
+            placeholder="请输入"/>
         </div>
       </template>
       <!-- 操作 -->
@@ -78,7 +75,7 @@
           type="link"
           class="button-info"
           :disabled="newLoading"
-          v-if="record.productPrice"
+          v-if="record.currentStockQty != 0"
           @click="handleAdd(record)"
         >添加</a-button>
         <span v-else>--</span>
@@ -89,11 +86,11 @@
 
 <script>
 import { queryDetailStockPage } from '@/api/spareParts'
-import returnReason from '@/views/common/returnReason'
 import { STable, VSelect } from '@/components'
+import rangeDate from '@/views/common/rangeDate.vue'
 export default {
   name: 'QueryPart',
-  components: { STable, VSelect, returnReason },
+  components: { STable, VSelect, rangeDate },
   props: {
     newLoading: Boolean,
     isShowPrice: {
@@ -108,29 +105,35 @@ export default {
   },
   data () {
     return {
-      buyerNo: '',
+      buyerSn: '',
       priceType: '',
       queryParam: { //  查询条件
         productName: '', // 产品名称
-        productCode: '' //  产品编码
+        productCode: '', //  产品编码
+        beginDate: '',
+        endDate: '',
+        sparePartsNo: ''
       },
+      warehousingDate: [], // 入库时间
       disabled: false, //  查询、重置按钮是否可操作
       columns: [
         { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
-        { title: '产品编码', dataIndex: 'productCode', width: '24%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'productName', width: '27%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '单位', dataIndex: 'productUnit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '入库单价', dataIndex: 'productPrice', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '入库数量', dataIndex: 'qty', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '已退数量', dataIndex: 'qty', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '最大可退数量', dataIndex: 'qty', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
+        { 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' } },
-        { slots: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
-        this.queryParam.sparePartsNo = this.buyerNo
+        this.queryParam.supplierSn = this.buyerSn
         return queryDetailStockPage(Object.assign(parameter, this.queryParam)).then(res => {
           let data
           if (res.status == 200) {
@@ -138,8 +141,7 @@ export default {
             const no = (data.pageNo - 1) * data.pageSize
             for (var i = 0; i < data.list.length; i++) {
               data.list[i].no = no + i + 1
-              data.list[i].qty = this.showReceiveQty ? 0 : 1
-              data.list[i].receiveQty = 1
+              data.list[i].qty = data.list[i].currentStockQty
             }
             this.disabled = false
           }
@@ -153,10 +155,20 @@ export default {
     resetSearchForm () {
       this.queryParam.productName = ''
       this.queryParam.productCode = ''
-      this.$refs.table.refresh(true)
+      this.warehousingDate = []
+      this.$refs.rangeDate.resetDate(this.warehousingDate)
+      this.$refs.chooseTable.refresh(true)
+    },
+    onChange (e) {
+      console.log(`checked = ${e.target.checked}`)
     },
-    pageInit (buyerNo) {
-      this.buyerNo = buyerNo
+    //  入库时间  change
+    dateChange (date) {
+      this.queryParam.beginDate = date[0] ? date[0] : ''
+      this.queryParam.endDate = date[1] ? date[1] : ''
+    },
+    pageInit (buyerSn) {
+      this.buyerSn = buyerSn
       this.resetSearchForm()
     },
     // 选择配件
@@ -164,15 +176,19 @@ export default {
       this.$emit('add', row)
     },
     refreshData () {
-      this.$refs.table.refresh()
+      this.$refs.chooseTable.refresh()
     }
   }
 }
 </script>
-<style lang="less">
+<style lang="less" scoped>
   .salesReturnList-wrap{
     .redBg-row{
       background-color: #f5cdc8;
     }
   }
+  /deep/.sTable input:disabled{
+    color:gray !important;
+    -webkit-text-fill-color:gray !important;
+  }
 </style>