chenrui 11 kuukautta sitten
vanhempi
commit
e6299442f4

+ 10 - 64
src/views/purchasingManagement/purchaseReceipt/edit.vue

@@ -78,20 +78,6 @@
           :data="loadData"
           :defaultLoadData="false"
           bordered>
-          <!--申请退货数量 -->
-          <!-- <template slot="qty" slot-scope="text, record">
-            <a-input-number
-              id="purchaseReceiptEdit-qty"
-              size="small"
-              v-model="record.qty"
-              :precision="0"
-              :min="1"
-              :max="record.qty"
-              placeholder="请输入"
-              style="width: 100%;"
-              @blur="e => onCellBlur(e.target.value, record)"
-            />
-          </template> -->
           <!-- 操作 -->
           <template slot="action" slot-scope="text, record">
             <a-button
@@ -128,7 +114,7 @@
       :itemSn="itemSn"
       :openModal="openAddModal"
       :nowData="detailsData"
-      @ok="ahandleAddOk"
+      @ok="handleAddOk"
       @close="openAddModal=false" />
     <!-- 导入弹窗 -->
     <importGuideModal :openModal="openGuideModal" :params="{sparePartsSn: $route.query.sn}" @close="openGuideModal=false" @ok="hanldleImportOk" />
@@ -162,16 +148,14 @@ export default {
   data () {
     return {
       spinning: false,
-      showDetail: false, // 是否显示基础信息
+      showDetail: true, // 是否显示基础信息
       delLoading: false, // 删除loading
       openAddModal: false, // 打开新增产品弹窗
       openBasicInfoModal: false, // 打开编辑基础信息弹窗
       openGuideModal: false, // 导入产品弹窗
       detailsData: null, // 基础信息数据
-
-      isInster: false, // 是否正在添加产品
       addMoreLoading: false, // 防止多次添加  加载状态
-      loading: false,
+      loading: false, // 第三方库存按钮加载状态
 
       // 查询参数
       productForm: {
@@ -181,9 +165,9 @@ export default {
       statisticsObj: null, // 统计明细
 
       sparePartsSn: null, // 采购入库sn
+
       itemObj: null, // 基础信息弹窗信息
-      sparePartsReturnNo: null,
-      chooseList: [],
+
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.productForm.sparePartsSn = this.sparePartsSn
@@ -198,11 +182,9 @@ export default {
               data.list[i].no = no + i + 1
             }
           }
-          this.chooseList = data.list
           return data
         })
-      },
-      grabFlag: undefined // 备注
+      }
     }
   },
   computed: {
@@ -293,7 +275,8 @@ export default {
     }
   },
   methods: {
-    ahandleAddOk () {
+    // 新增产品成功 刷新基础信息时间,防止重复提交
+    handleAddOk () {
       this.pageInit()
     },
     // 第三方库存
@@ -336,10 +319,6 @@ export default {
       this.itemSn = (row && row.sparePartsDetailSn) ? row.sparePartsDetailSn : null
       this.openAddModal = true
     },
-    handleAddOk () {
-      this.getBasicsData()
-      this.resetTable()
-    },
     // 导入产品
     handleImport () {
       this.openGuideModal = true
@@ -414,41 +393,6 @@ export default {
       })
       this.saveMore(ajax_data)
     },
-    saveEdit (params) {
-      this.spinning = true
-      sparePartsReturnDetailSave(params).then(res => {
-        if (res.status == 200) {
-          this.getStatisticsData()
-          this.$refs.table.refresh(true)
-          this.getChooseList()
-        }
-        this.isInster = false
-        this.spinning = false
-        this.addMoreLoading = false
-      }).catch(err => {
-        this.isInster = false
-      })
-    },
-    saveMore (params) {
-      this.spinning = true
-      sparePartsReturnDetailSaveBatch(params)
-        .then(res => {
-          if (res.status == 200) {
-            this.getStatisticsData()
-            this.getChooseList()
-            this.$refs.table.refresh(true)
-            this.$refs.partQuery.refreshLength()
-          }
-          this.isInster = false
-          this.spinning = false
-          this.addMoreLoading = false
-        })
-        .catch(err => {
-          this.isInster = false
-          this.addMoreLoading = false
-          this.spinning = false
-        })
-    },
     beforeSubmit () {
       if (this.chooseList.length > 0) {
         this.openDepartUserModal = true
@@ -470,7 +414,9 @@ export default {
     // 初始化
     pageInit () {
       this.sparePartsSn = this.$route.query.sn
+      // 获取统计数据
       this.getStatisticsData()
+      // 获取基础信息
       this.getBasicsData()
       this.$nextTick(() => {
         this.resetSearchForm()

+ 83 - 54
src/views/purchasingManagement/purchaseReceipt/list.vue

@@ -3,62 +3,68 @@
     <a-card size="small" :bordered="false" class="searchBoxNormal">
       <!-- 搜索条件 -->
       <div ref="tableSearch" class="table-page-search-wrapper">
-        <a-form layout="inline" id="purchaseReceiptList-form" @keyup.enter.native="$refs.table.refresh(true)">
+        <a-form-model
+          layout="inline"
+          ref="ruleForm"
+          :model="queryParam"
+          :rules="rules"
+          id="purchaseReceiptList-form"
+          @keyup.enter.native="handleSearch">
           <a-row :gutter="15">
             <a-col :md="6" :sm="24">
-              <a-form-item label="创建时间">
+              <a-form-model-item label="创建时间" prop="time">
                 <rangeDate ref="rangeDate" id="purchaseReceiptList-time" @change="dateChange" />
-              </a-form-item>
+              </a-form-model-item>
             </a-col>
             <a-col :md="6" :sm="24">
-              <a-form-item label="采购单号">
+              <a-form-model-item label="采购单号">
                 <a-input id="purchaseReceiptList-sparePartsNo" v-model.trim="queryParam.sparePartsNo" allowClear placeholder="请输入采购单号"/>
-              </a-form-item>
+              </a-form-model-item>
             </a-col>
             <a-col :md="6" :sm="24">
-              <a-form-item label="供应商名称">
+              <a-form-model-item label="供应商名称">
                 <supplier id="purchaseReceiptList-supplierSn" v-model="queryParam.supplierSn" isPermission placeholder="请输入供应商名称"></supplier>
-              </a-form-item>
+              </a-form-model-item>
             </a-col>
             <template v-if="advanced">
               <a-col :md="6" :sm="24">
-                <a-form-item label="客户名称">
+                <a-form-model-item label="客户名称">
                   <custList ref="custList" id="purchaseReceiptList-buyerSn" @change="custChange"></custList>
-                </a-form-item>
+                </a-form-model-item>
               </a-col>
               <a-col :md="6" :sm="24">
-                <a-form-item label="关联单号">
-                  <a-input id="purchaseReceiptList-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入关联单号"/>
-                </a-form-item>
+                <a-form-model-item label="关联单号">
+                  <a-input id="purchaseReceiptList-relationNo" v-model.trim="queryParam.relationNo" allowClear placeholder="请输入关联单号"/>
+                </a-form-model-item>
               </a-col>
               <a-col :md="6" :sm="24">
-                <a-form-item label="业务状态">
+                <a-form-model-item label="业务状态">
                   <v-select
                     v-model="queryParam.state"
                     ref="state"
-                    id="purchaseReceiptList-serviceState"
+                    id="purchaseReceiptList-state"
                     code="PURCHASE_STATE"
                     placeholder="请选择业务状态"
                     allowClear
                   ></v-select>
-                </a-form-item>
+                </a-form-model-item>
               </a-col>
               <a-col :md="6" :sm="24">
-                <a-form-item label="供应商状态">
+                <a-form-model-item label="供应商状态">
                   <v-select
-                    v-model="queryParam.state"
-                    ref="state"
-                    id="purchaseReceiptList-state"
+                    v-model="queryParam.thirdpartyBizState"
+                    ref="thirdpartyBizState"
+                    id="purchaseReceiptList-thirdpartyBizState"
                     code="THIRD_PARTY_BIZ_STATE"
                     placeholder="请选择供应商状态"
                     allowClear
                   ></v-select>
-                </a-form-item>
+                </a-form-model-item>
               </a-col>
             </template>
             <a-col :md="6" :sm="24">
               <span class="table-page-search-submitButtons">
-                <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="purchaseReceiptList-refresh">查询</a-button>
+                <a-button type="primary" @click="handleSearch" :disabled="disabled" id="purchaseReceiptList-refresh">查询</a-button>
                 <a-button style="margin-left: 10px" @click="resetSearchForm()" :disabled="disabled" id="purchaseReceiptList-reset">重置</a-button>
                 <a @click="advanced=!advanced" style="margin-left: 8px">
                   {{ advanced ? '收起' : '展开' }}
@@ -67,7 +73,7 @@
               </span>
             </a-col>
           </a-row>
-        </a-form>
+        </a-form-model>
       </div>
     </a-card>
     <a-card size="small" :bordered="false" class="purchaseReceiptList-wrap">
@@ -166,12 +172,13 @@
 
 <script>
 import { commonMixin } from '@/utils/mixin'
+import moment from 'moment'
+import getDate from '@/libs/getDate.js'
 // 组件
 import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
 import custList from '@/views/common/custList.vue'
 import supplier from '@/views/common/supplier.js'
-import warehouse from '@/views/common/chooseWarehouse.js'
 import reviewModal from './reviewModal.vue'
 import detailModal from './detailModal.vue'
 import uploadVoucherModal from './uploadVoucherModal.vue'
@@ -180,7 +187,7 @@ import { purchaseList, purchasePageCount, purchaseCancel, purchaseAudit } from '
 export default {
   name: 'PurchaseReceiptList',
   mixins: [commonMixin],
-  components: { STable, supplier, VSelect, custList, rangeDate, warehouse, reviewModal, detailModal, uploadVoucherModal },
+  components: { STable, supplier, VSelect, custList, rangeDate, reviewModal, detailModal, uploadVoucherModal },
   data () {
     return {
       spinning: false,
@@ -189,14 +196,16 @@ export default {
       advanced: true, // 高级搜索 展开/关闭
       // 查询参数
       queryParam: {
-        beginDate: undefined,
-        endDate: undefined,
-
-        sparePartsReturnNo: undefined,
-        supplierSn: undefined,
-        returnReason: undefined,
-        warehouseSn: undefined, // 仓库
-        state: undefined
+        time: [ moment(getDate.getThreeMonthDays().starttime, 'YYYY-MM-DD'),
+          moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')],
+        beginDate: getDate.getThreeMonthDays().starttime, // 创建开始时间
+        endDate: getDate.getCurrMonthDays().endtime, // 创建结束时间
+        sparePartsNo: undefined, // 采购单号
+        supplierSn: undefined, // 供应商名称
+        buyerSn: undefined, // 客户名称
+        relationNo: undefined, // 关联单号
+        state: undefined, // 业务状态
+        thirdpartyBizState: undefined// 供应商状态
       },
       openReviewModal: false, // 审核弹窗
       openVoucherModal: false, // 上传凭证
@@ -208,13 +217,15 @@ export default {
         this.disabled = true
         this.spinning = true
         const params = Object.assign(parameter, this.queryParam)
+        const newParams = JSON.parse(JSON.stringify(params))
+        delete newParams.time
         // 获取列表数据 有分页
-        return purchaseList(params).then(res => {
+        return purchaseList(newParams).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
             // 获取统计数据
-            this.getCount(params)
+            this.getCount(newParams)
             // 计算列表序号
             const no = (data.pageNo - 1) * data.pageSize
             for (var i = 0; i < data.list.length; i++) {
@@ -225,6 +236,9 @@ export default {
           this.spinning = false
           return data
         })
+      },
+      rules: {
+        'time': [{ required: true, message: '请选择创建时间', trigger: 'change' }]
       }
     }
   },
@@ -241,7 +255,7 @@ export default {
         { title: '采购金额', dataIndex: 'productTotalCost', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } },
         { title: '入库仓库', dataIndex: 'warehouseName', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '关联单号', dataIndex: 'lockBizNo', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '客户名称', dataIndex: 'shippingAddr', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '客户名称', dataIndex: 'supplierName', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '业务状态', dataIndex: 'stateDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '供应商状态', dataIndex: 'thirdpartyBizStateDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '备注', dataIndex: 'remark', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
@@ -254,8 +268,6 @@ export default {
     }
   },
   methods: {
-    // <!-- state  取消 CANCEL 待提交 WAIT_SUBMIT 待审核 WAIT_AUDIT 待入库 WAIT_PUT 已完结 FINISH 审核通过 PASS 审核不通过 REJECT -->
-    // <!-- thirdpartyBizState 审核通过	AUDIT_PASS 审核不通过	AUDIT_REJECT  已取消	CANCEL 已出库	FINISH 待审核	WAIT_AUDIT 待发货	WAIT_RECEIVE -->
     // 是否显示取消按钮
     isShowCancelBtn (row) {
       const res = ((row.state === 'WAIT_SUBMIT' || row.state === 'WAIT_AUDIT' || row.state === 'REJECT') && !row.thirdpartyBizState) || (row.state === 'PASS' && row.thirdpartyBizState === 'WAIT_AUDIT') || (row.state === 'PASS' && row.thirdpartyBizState === 'AUDIT_PASS')
@@ -278,8 +290,25 @@ export default {
     },
     // 创建时间
     dateChange (date) {
-      this.queryParam.beginDate = date[0]
-      this.queryParam.endDate = date[1]
+      if (date[0] && date[1]) {
+        this.queryParam.time = date
+      } else {
+        this.queryParam.time = []
+      }
+      this.queryParam.beginDate = date[0] || undefined
+      this.queryParam.endDate = date[1] || undefined
+    },
+    // 查询
+    handleSearch () {
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          _this.$refs.table.refresh(true)
+        } else {
+          _this.$message.error('请选择创建时间')
+          return false
+        }
+      })
     },
     // 获取统计数据
     getCount (params) {
@@ -366,17 +395,22 @@ export default {
     },
     //  重置
     resetSearchForm () {
-      this.queryParam = {
-        beginDate: undefined,
-        endDate: undefined,
-        sparePartsReturnNo: undefined,
-        supplierSn: undefined,
-        returnReason: undefined,
-        warehouseSn: undefined, // 仓库
-        state: undefined
-      }
+      this.queryParam.beginDate = getDate.getThreeMonthDays().starttime
+      this.queryParam.endDate = getDate.getCurrMonthDays().endtime
+      this.queryParam.time = [
+        getDate.getThreeMonthDays().starttime,
+        getDate.getCurrMonthDays().endtime
+      ]
+      this.$refs.rangeDate.resetDate(this.queryParam.time)
+      this.queryParam.sparePartsNo = undefined
+      this.queryParam.supplierSn = undefined
+      this.queryParam.buyerSn = undefined
+      this.queryParam.relationNo = undefined
+      this.queryParam.state = undefined
+      this.queryParam.thirdpartyBizState = undefined
+      this.itemSn = null
       this.$refs.custList.resetForm()
-      this.$refs.rangeDate.resetDate()
+      this.$refs.ruleForm.resetFields()
       this.$refs.table.refresh(true)
     },
     // 初始化数据
@@ -385,11 +419,6 @@ export default {
       this.$nextTick(() => { // 页面渲染完成后的回调
         _this.setTableH()
       })
-      this.openModal = false
-      // this.openDetailModal = false
-      this.itemSn = null
-      this.rowSelectionInfo = null
-      this.$refs.table.clearTable()
     },
     // 计算表格高度
     setTableH () {