소스 검색

修改bug

chenrui 1 년 전
부모
커밋
f15af1bbfb

+ 1 - 1
src/views/bulkManagement/bulkImport/list.vue

@@ -84,7 +84,7 @@
 import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
-import detailList from '@/views/reportData/stockImportReport/detailList.vue'
+import detailList from '@/views/inventoryManagement/inventoryImport/detailList.vue'
 import getDate from '@/libs/getDate.js'
 import importGuideModal from './importGuideModal.vue'
 import { reportStockImportList, reportStockImportCount } from '@/api/reportData'

+ 199 - 0
src/views/inventoryManagement/inventoryImport/detailList.vue

@@ -0,0 +1,199 @@
+<template>
+  <a-spin :spinning="spinning" tip="Loading...">
+    <!-- 搜索条件 -->
+    <div class="table-page-search-wrapper">
+      <a-form-model
+        id="salesDetailReportList-form"
+        ref="ruleForm"
+        class="form-model-con"
+        layout="inline"
+        :model="queryParam"
+        :rules="rules"
+        :labelCol="labelCol"
+        :wrapperCol="wrapperCol"
+        @keyup.enter.native="handleSearch" >
+        <a-row :gutter="15">
+          <a-col :md="6" :sm="24">
+            <a-form-model-item label="产品编码">
+              <a-input v-model.trim="queryParam.productEntity.code" allowClear placeholder="请输入产品编码"/>
+            </a-form-model-item>
+          </a-col>
+          <a-col :md="6" :sm="24">
+            <a-form-model-item label="产品名称">
+              <a-input v-model.trim="queryParam.productEntity.name" allowClear placeholder="请输入产品名称"/>
+            </a-form-model-item>
+          </a-col>
+          <a-col :md="6" :sm="24">
+            <a-form-item label="仓库名称">
+              <a-input id="warehouseList-name" v-model.trim="queryParam.productEntity.warehouseName" allowClear placeholder="请输入仓库名称"/>
+            </a-form-item>
+          </a-col>
+          <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
+            <a-button type="primary" @click="handleSearch" :disabled="disabled" id="salesDetailReportList-refresh">查询</a-button>
+            <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="salesDetailReportList-reset">重置</a-button>
+          </a-col>
+        </a-row>
+      </a-form-model>
+    </div>
+    <!-- 合计 -->
+    <a-alert type="info" style="margin-bottom:10px">
+      <div class="ftext" slot="message">
+        导入单号:<strong>{{ detailSn ||'--' }}</strong>;
+        款数:<strong>{{ (totalData && (totalData.putQty || totalData.putQty==0)) ? totalData.putQty : '--' }}</strong>;
+        数量:<strong>{{ (totalData && (totalData.putQty || totalData.putQty==0)) ? totalData.putQty : '--' }}</strong>;
+        <div v-if="$hasPermissions('M_ShowAllCost')" style="display: inline-block;">
+          成本:<strong>{{ (totalData && (totalData.cost || totalData.cost==0)) ? toThousands(totalData.cost) : '--' }}</strong>。
+        </div>
+      </div>
+    </a-alert>
+    <!-- 列表 -->
+    <s-table
+      class="sTable"
+      ref="table"
+      size="small"
+      :rowKey="(record) => record.no"
+      rowKeyName="no"
+      :columns="columns"
+      :data="loadData"
+      :defaultLoadData="false"
+      bordered>
+    </s-table>
+  </a-spin>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { STable, VSelect } from '@/components'
+import rangeDate from '@/views/common/rangeDate.vue'
+import { downloadExcel } from '@/libs/JGPrint.js'
+import ProductType from '../../common/productType.js'
+import ProductBrand from '../../common/productBrand.js'
+import supplier from '@/views/common/supplier'
+import { reportStockImportDetailList, reportStockImportDetailCount, reportStockImportDetailExport } from '@/api/reportData'
+export default {
+  components: { STable, VSelect, rangeDate, ProductType, ProductBrand, supplier },
+  mixins: [commonMixin],
+  props: {
+    detailSn: {
+      type: String,
+      default: null
+    },
+    typeInfo: {
+      type: String,
+      default: null
+    }
+  },
+  data () {
+    return {
+      spinning: false,
+      labelCol: { span: 8 },
+      wrapperCol: { span: 16 },
+      advanced: false, // 高级搜索 展开/关闭
+      tableHeight: 0,
+      supplierSn: undefined,
+      queryParam: { //  查询条件
+        importType: undefined,
+        productEntity: {
+          code: '', //  产品编码
+          name: '', //  产品名称
+          warehouseName: ''// 仓库名称
+        },
+        stockImportNo: ''
+      },
+      disabled: false, //  查询、重置按钮是否可操作
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        const params = Object.assign(parameter, this.queryParam)
+        this.spinning = true
+        if (this.detailSn) {
+          params.stockImportNo = this.detailSn
+          params.importType = this.typeInfo
+        }
+        return reportStockImportDetailList(params).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            // 总计
+            this.getCount(params)
+            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].totalCost = data.list[i].putQty * data.list[i].cost
+            }
+            this.disabled = false
+          }
+          this.spinning = false
+          return data
+        })
+      },
+      totalData: null //  合计
+    }
+  },
+  computed: {
+    columns () {
+      const _this = this
+      const arr = [
+        { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
+        { title: '产品编码', dataIndex: 'productCode', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', width: '12%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '单位', dataIndex: 'unit', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '数量', dataIndex: 'putQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        // { title: '成本', dataIndex: 'cost', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '仓库', dataIndex: 'warehouseName', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '仓位', dataIndex: 'warehouseLocationName', width: '8%', align: 'center', customRender: function (text) { return text || '--' } }
+      ]
+      if (this.$hasPermissions('M_ShowAllCost')) {
+        arr.splice(5, 0, { title: '成本价', dataIndex: 'cost', width: '5%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+        arr.splice(6, 0, { title: '总成本', dataIndex: 'totalCost', width: '5%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+      }
+      return arr
+    }
+  },
+  methods: {
+    // 合计
+    getCount (params) {
+      reportStockImportDetailCount(params).then(res => {
+        if (res.status == 200) {
+          this.totalData = res.data
+        } else {
+          this.totalData = null
+        }
+      })
+    },
+    //  查询
+    handleSearch () {
+      this.$refs.table.refresh(true)
+    },
+    //  重置
+    resetSearchForm () {
+      this.queryParam.stockImportNo = this.detailSn
+      this.queryParam.importType = this.typeInfo
+      this.queryParam.productEntity.code = ''
+      this.queryParam.productEntity.name = ''
+      this.queryParam.productEntity.warehouseName = ''
+      this.handleSearch()
+    },
+    pageInit () {
+      this.disabled = false
+      this.spinning = false
+    }
+  },
+  mounted () {
+    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
+      this.pageInit()
+      this.resetSearchForm()
+    }
+  },
+  activated () {
+    // 如果是新页签打开,则重置当前页面
+    if (this.$store.state.app.isNewTab) {
+      this.pageInit()
+      this.resetSearchForm()
+    }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {})
+  }
+}
+</script>

+ 1 - 1
src/views/inventoryManagement/inventoryImport/list.vue

@@ -86,7 +86,7 @@ import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
 import getDate from '@/libs/getDate.js'
 import importGuideModal from './importGuideModal.vue'
-import detailList from '@/views/reportData/stockImportReport/detailList.vue'
+import detailList from './detailList.vue'
 import { reportStockImportList, reportStockImportCount } from '@/api/reportData'
 export default {
   components: { STable, VSelect, rangeDate, importGuideModal, detailList },

+ 1 - 15
src/views/reportData/stockImportReport/detailList.vue

@@ -78,7 +78,7 @@
               @click="handleExport"
               :disabled="disabled"
               :loading="exportLoading"
-              v-if="$hasPermissions('B_StockImportDetailExport') && !detailSn"
+              v-if="$hasPermissions('B_StockImportDetailExport')"
               class="button-warning"
               id="salesDetailReportList-export-btn">导出</a-button>
             <a @click="advanced=!advanced" style="margin-left: 5px">
@@ -125,16 +125,6 @@ import { reportStockImportDetailList, reportStockImportDetailCount, reportStockI
 export default {
   components: { STable, VSelect, rangeDate, ProductType, ProductBrand, supplier },
   mixins: [commonMixin],
-  props: {
-    detailSn: {
-      type: String,
-      default: null
-    },
-    typeInfo: {
-      type: String,
-      default: null
-    }
-  },
   data () {
     return {
       spinning: false,
@@ -171,10 +161,6 @@ export default {
         const params = Object.assign(parameter, this.queryParam)
         this.spinning = true
         delete params.time
-        if (this.detailSn) {
-          params.stockImportNo = this.detailSn
-          params.importType = this.typeInfo
-        }
         return reportStockImportDetailList(params).then(res => {
           let data
           if (res.status == 200) {