Explorar o código

导入唯一码

chenrui hai 1 ano
pai
achega
3a042d8cef

BIN=BIN
public/templ/轮胎唯一码导入模板.xlsx


+ 239 - 0
src/views/salesManagement/outboundOrder/chooseImportModal.vue

@@ -0,0 +1,239 @@
+<template>
+  <a-modal
+    centered
+    class="chooseImport-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="确认导入"
+    v-model="isShow"
+    @cancel="isShow=false"
+    width="72%">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <div class="chooseImport-con">
+        <p>产品款数与产品数量不符:Y6508N(17/18);Y6509N(15/18)</p>
+        <!-- 列表 -->
+        <s-table
+          class="sTable fixPagination"
+          ref="table"
+          style="height: 500px"
+          size="small"
+          :rowClassName="(record, index) => record.isError==1 ? 'redBg-row':''"
+          :rowKey="(record) => record.id"
+          :columns="columns"
+          :data="loadData"
+          :scroll="{ y:430}"
+          :defaultLoadData="false"
+          bordered>
+        </s-table>
+        <!-- 按钮 -->
+        <div class="btn-con">
+          <a-button
+            type="primary"
+            id="chooseImport-submit"
+            size="large"
+            class="button-primary"
+            @click="handleConfirm"
+            style="padding: 0 40px;">确认导入</a-button>
+          <a-button
+            id="chooseImport-cancel"
+            size="large"
+            class="button-cancel"
+            @click="handleCancel"
+            style="padding: 0 40px;margin-left: 15px;">取消</a-button>
+          <a-button
+            type="primary"
+            id="chooseImport-error"
+            size="large"
+            class="button-error"
+            @click="handleExportError"
+            style="padding: 0 40px;margin-left: 15px;">导出错误项</a-button>
+        </div>
+      </div>
+      <common-modal
+        :openModal="openTipsModal"
+        :modalHtml="modalHtml"
+        modalTit="操作提示"
+        okText="确定"
+        :isCancel="false"
+        @ok="operationEnd"
+        @close="openTipsModal=false" />
+    </a-spin>
+  </a-modal>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { STable, Upload } from '@/components'
+import { stockImportList, stockImportFinish, stockImportCancel, stockImportKCExportError } from '@/api/stockImport'
+import { downloadExcel } from '@/libs/JGPrint.js'
+import commonModal from '@/views/common/commonModal.vue'
+export default {
+  name: 'StockImportList',
+  components: { STable, Upload, commonModal },
+  mixins: [commonMixin],
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    paramsData: {
+      type: Object,
+      default: () => {
+        return {}
+      }
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      openTipsModal: false,
+      modalHtml: '',
+      spinning: false,
+      exportLoading: false, // 导出loading
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.spinning = true
+        return stockImportList(Object.assign(parameter, { stockImportSn: this.uploadData && this.uploadData.stockImportSn })).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            const no = (data.pageNo - 1) * data.pageSize
+            for (var i = 0; i < data.list.length; i++) {
+              data.list[i].no = no + i + 1
+            }
+            const ret = data.list.filter(item => item.isError == 1)
+            this.isAllError = ret.length == data.count
+            this.listData = data.list
+            if (this.uploadData && data.list.length == 0) {
+              this.$message.info('没有可导入数据,请检查模板是否为空')
+              this.resetSearchForm()
+            }
+          }
+          this.spinning = false
+          return data
+        })
+      },
+      isAllError: false, // 是否全部错误
+      listData: [],
+      columns:[
+        { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
+        { title: '产品编码', dataIndex: 'productCode', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '唯一码', dataIndex: 'warehouseName', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '工厂出库单号', dataIndex: 'warehouseLocationName', width: '25%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '错误原因', dataIndex: 'errorMsg', width: '30%', align: 'center', customRender: function (text) { return text || '--' } }
+      ]
+    }
+  },
+  methods: {
+    resetSearchForm () {
+      this.$refs.table.clearTable() //  清空列表数据
+      this.uploadData = null //  清空上传数据
+    },
+    // 确认导入
+    handleConfirm () {
+      const _this = this
+      if (this.isAllError) {
+        this.$message.error('没有可导入的数据!')
+        return false
+      }
+      _this.spinning = true
+      stockImportFinish({ stockImportSn: _this.uploadData && _this.uploadData.stockImportSn }).then(res => {
+        if (res.status == 200) {
+          _this.$message.success(res.message)
+          _this.showSuccessModal(res.data)
+          _this.spinning = false
+        } else {
+          _this.spinning = false
+        }
+      })
+    },
+    showSuccessModal (data) {
+      if (data) {
+        this.openTipsModal = true
+        this.$emit('close')
+        this.modalHtml = `<div><div>库存导入成功</div><div>入库类型:库存导入</div><div>库存批次:${data.stockBatchNo}</div><div>总导入款数:${data.productTotalCategory}</div><div>总入库数量:${data.productTotalQty}</div><div>总入库成本:${data.productTotalCost}</div></div>`
+      }
+    },
+    // 操作完成
+    operationEnd () {
+      this.$emit('ok')
+      this.openTipsModal = false
+      this.isShow = false
+      this.resetSearchForm()
+    },
+    // 取消导入
+    handleCancel () {
+      const _this = this
+      _this.spinning = true
+      stockImportCancel({ stockImportSn: _this.uploadData && _this.uploadData.stockImportSn }).then(res => {
+        if (res.status == 200) {
+          _this.$message.success(res.message)
+          _this.spinning = false
+          _this.isShow = false
+          _this.resetSearchForm()
+        } else {
+          _this.spinning = false
+        }
+      })
+    },
+    // 导出错误项
+    handleExportError () {
+      const _this = this
+      _this.spinning = true
+      stockImportKCExportError({ stockImportSn: _this.uploadData && _this.uploadData.stockImportSn }).then(res => {
+        _this.spinning = false
+        if (res.type == 'application/json') {
+          var reader = new FileReader()
+          reader.addEventListener('loadend', function () {
+            const obj = JSON.parse(reader.result)
+            _this.$notification.error({
+              message: '提示',
+              description: obj.message
+            })
+          })
+          reader.readAsText(res)
+        } else {
+          downloadExcel(res, '库存导入错误项')
+        }
+      })
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+      } else {
+        if (this.paramsData) {
+          this.uploadData = this.paramsData
+          const _this = this
+          this.$nextTick(() => {
+            _this.$refs.table.refresh(true)
+          })
+        }
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+  .chooseImport-modal{
+    .chooseImport-con{
+      /deep/.redBg-row{
+        background-color: #F39494 !important;
+      }
+      .btn-con{
+        text-align: center;
+        margin: 30px 0 20px;
+        .button-cancel,.button-error{
+          font-size: 12px;
+        }
+      }
+    }
+  }
+</style>

+ 1 - 1
src/views/salesManagement/outboundOrder/importGuideModal.vue

@@ -95,7 +95,7 @@ export default {
         savePathType: 'local'
       },
       exportLoading: false,
-      filePath: location.protocol + '//' + location.host + '/templ/发货单信息导入模板.xlsx'
+      filePath: location.protocol + '//' + location.host + '/templ/轮胎唯一码导入模板.xlsx'
     }
   },
   methods: {

+ 83 - 36
src/views/salesManagement/outboundOrder/uniqueCodeList.vue

@@ -1,43 +1,74 @@
 <template>
   <div>
     <a-card size="small" :bordered="false" class="searchBoxNormal">
-      <!-- 搜索条件 -->
-      <div ref="tableSearch" class="table-page-search-wrapper">
-        <a-form layout="inline">
-          <a-row :gutter="15">
-            <a-col :md="6" :sm="24">
-              <a-form-item label="产品编码">
-                <a-input v-model.trim="queryParam.outBizSubNo" allowClear placeholder="请输入产品编码"/>
-              </a-form-item>
-            </a-col>
-            <a-col :md="6" :sm="24">
-              <a-form-item label="唯一码">
-                <a-input v-model.trim="queryParam.demanderName" allowClear placeholder="请输入唯一码"/>
-              </a-form-item>
-            </a-col>
-            <a-col :md="6" :sm="24">
-              <a-form-item label="产品名称">
-                <a-input v-model.trim="queryParam.demanderName" allowClear placeholder="请输入产品名称"/>
-              </a-form-item>
-            </a-col>
-            <a-col :md="6" :sm="24">
-              <span class="table-page-search-submitButtons">
-                <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
-                <a-button style="margin-left: 8px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
-              </span>
-            </a-col>
-          </a-row>
-        </a-form>
+      <a-page-header :ghost="false" :backIcon="false" class="salesDetail-cont">
+        <template slot="subTitle">
+          <a id="salesEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
+          <span style="margin: 0 15px;color: #666;font-weight: bold;">出库单号:{{ detailData&&detailData.salesBillNo }}</span>
+          <span style="margin: 0 10px;color: #666;">客户名称:{{ detailData&&detailData.buyerName }}</span>
+          <a-button size="small" type="link" class="button-default" @click="showDetail=!showDetail">
+            <a-icon :type="showDetail ? 'eye-invisible' : 'eye'"/> {{ showDetail?'隐藏':'查看' }}信息
+          </a-button>
+        </template>
+      </a-page-header>
+    </a-card>
+    <!-- 基础信息 -->
+    <div ref="detailInfo" style="margin-bottom: 6px;" v-if="showDetail">
+    <a-card size="small" :bordered="false" class="pages-wrap" >
+      <div style="padding: 0;">
+        <a-descriptions size="small" :column="3">
+          <a-descriptions-item label="客户名称">{{ detailData&&detailData.buyerName || '--' }}</a-descriptions-item>
+          <a-descriptions-item label="销售单号">{{ detailData&&detailData.buyerName || '--' }}</a-descriptions-item>
+          <a-descriptions-item label="备货单号">{{ detailData&&detailData.buyerName || '--' }}</a-descriptions-item>
+          <a-descriptions-item label="收货客户名称">{{ detailData&&detailData.salesBillExtEntity&&detailData.salesBillExtEntity.consigneeName || '--' }}</a-descriptions-item>
+          <a-descriptions-item label="发货编号">{{ detailData&&detailData.salesBillExtEntity&&detailData.salesBillExtEntity.consigneeTel || '--' }}</a-descriptions-item>
+          <a-descriptions-item label="收款方式">{{ detailData&&detailData.settleStyleSnDictValue || '--' }}</a-descriptions-item>
+          <a-descriptions-item label="收货人">{{ detailData&&detailData.auditDate || '--' }}</a-descriptions-item>
+          <a-descriptions-item label="收货电话">{{ detailData&&detailData.billStatusDictValue || '--' }}</a-descriptions-item>
+          <a-descriptions-item label="收货地址">{{ shippingAddress||'--' }}</a-descriptions-item>
+          <a-descriptions-item label="业务状态">{{ detailData&&detailData.financialStatusDictValue || '--' }}</a-descriptions-item>
+          <a-descriptions-item label="备注" :span="3">{{ detailData&&detailData.remarks || '--' }}</a-descriptions-item>
+        </a-descriptions>
       </div>
     </a-card>
+    </div>
     <a-card size="small" :bordered="false">
       <a-spin :spinning="spinning" tip="Loading...">
-        <div v-if="isHasId" style="margin-bottom:10px;">
-          <a-button
-            type="primary"
-            id="outboundOrder-export"
-            :loading="loading"
-            @click="openGuideModal = true">导入</a-button>
+        <!-- 搜索条件 -->
+        <div ref="tableSearch" class="table-page-search-wrapper">
+          <a-form layout="inline">
+            <a-row :gutter="15">
+              <a-col :md="6" :sm="24">
+                <a-form-item label="产品编码">
+                  <a-input v-model.trim="queryParam.outBizSubNo" allowClear placeholder="请输入产品编码"/>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="唯一码">
+                  <a-input v-model.trim="queryParam.demanderName" allowClear placeholder="请输入唯一码"/>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="产品名称">
+                  <a-input v-model.trim="queryParam.demanderName" allowClear placeholder="请输入产品名称"/>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <span class="table-page-search-submitButtons">
+                  <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
+                  <a-button style="margin-left: 8px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
+                </span>
+              </a-col>
+            </a-row>
+          </a-form>
+          <div style="margin-bottom:10px;">
+            <a-button
+              type="primary"
+              id="outboundOrder-export"
+              :loading="loading"
+              @click="openGuideModal = true">导入</a-button>
+            <span style="margin-left:6px;color:#f30;">每次都需全部导完,请在导入列表中修改后重新全部导入。</span>
+          </div>
         </div>
         <a-alert type="info" style="margin-bottom: 10px;" v-if="detailData!=null">
           <div slot="message">
@@ -118,10 +149,26 @@ export default {
       ],
       detailData: null,
       tableHeight: 0,
-      isHasId: true
+      isHasId: true,
+      showDetail:false
+    }
+  },
+  watch: {
+    showDetail (newValue, oldValue) {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+    },
+    '$store.state.app.winHeight' (newValue, oldValue) { //  窗口变更时,需同时更改表格高度
+      this.setTableH()
     }
   },
   methods: {
+    //  返回
+    handleBack () {
+      this.$router.push({ name: 'outboundOrder' })
+    },
     handleGuideOk () {
 
     },
@@ -169,8 +216,8 @@ export default {
     },
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight
-      const fixHeight = this.isHasId ? (!this.detailData ? 242 : 275) : (!this.detailData ? 198 : 275)
-      this.tableHeight = window.innerHeight - tableSearchH - fixHeight
+      const detailInfoH = this.showDetail? this.$refs.detailInfo.offsetHeight : 0
+      this.tableHeight = window.innerHeight - tableSearchH  - detailInfoH -255
     }
   },
   mounted () {