lilei 6 months ago
parent
commit
3476b81b26

+ 0 - 193
src/views/allocationManagement/transferOut/chooseImportModal.vue

@@ -1,193 +0,0 @@
-<template>
-  <a-modal
-    centered
-    class="chooseImport-modal"
-    :footer="null"
-    :maskClosable="false"
-    title="导入"
-    v-model="isShow"
-    @cancel="isShow=false"
-    :width="900">
-    <div class="chooseImport-con">
-      <!-- 可导入数据 -->
-      <p class="">可导入数据{{ loadData.length }}条</p>
-      <a-table
-        class="sTable"
-        ref="table"
-        size="small"
-        :rowKey="(record) => record.allocateSn"
-        :columns="nowColumns"
-        :dataSource="loadData"
-        :loading="loading"
-        :scroll="{ y: 200 }"
-        :pagination="false"
-        bordered>
-      </a-table>
-      <a-divider />
-      <!-- 不可导入数据 -->
-      <p class="red">不可导入数据{{ unLoadData.length }}条</p>
-      <a-table
-        class="unTable"
-        ref="unTable"
-        size="small"
-        :rowKey="(record) => record.errorDesc"
-        :columns="nowUnColumns"
-        :dataSource="unLoadData"
-        :loading="loading"
-        :scroll="{ y: 200 }"
-        :pagination="false"
-        bordered>
-      </a-table>
-      <!-- 按钮 -->
-      <div class="btn-con">
-        <a-button
-          type="primary"
-          id="chooseImport-submit"
-          size="large"
-          :class="loadData.length==0?'button-grey':'button-primary'"
-          @click="handleSubmit"
-          style="padding: 0 40px;">确认导入</a-button>
-        <a-button
-          id="chooseImport-cancel"
-          size="large"
-          class="button-cancel"
-          @click="isShow=false"
-          style="padding: 0 40px;margin-left: 15px;">取消</a-button>
-        <a-button
-          type="primary"
-          id="chooseImport-error"
-          size="large"
-          class="button-error"
-          @click="handleError"
-          style="padding: 0 40px;margin-left: 15px;">导出错误项</a-button>
-      </div>
-    </div>
-  </a-modal>
-</template>
-
-<script>
-import { commonMixin } from '@/utils/mixin'
-import { hdExportExcel } from '@/libs/exportExcel'
-// 接口
-import { allocateBillParseProducts, allocateBillFailExcel } from '@/api/allocateBill'
-export default {
-  name: 'TransferOutChooseImportModal',
-  mixins: [commonMixin],
-  props: {
-    openModal: { //  弹框显示状态
-      type: Boolean,
-      default: false
-    },
-    paramsData: {
-      type: Object,
-      default: () => {
-        return {}
-      }
-    }
-  },
-  data () {
-    return {
-      isShow: this.openModal, //  是否打开弹框
-      nowColumns: [ //  正品
-        { title: '序号', dataIndex: 'no', width: 70, align: 'center' },
-        { title: '产品编码', dataIndex: 'productCode', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '数量', dataIndex: 'qtyText', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '库存', dataIndex: 'currentStockQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '单位', dataIndex: 'productUnit', width: 60, align: 'center', customRender: function (text) { return text || '--' } }
-      ],
-      nowUnColumns: [ //  促销品
-        { title: '序号', dataIndex: 'no', width: 70, align: 'center' },
-        { title: '产品编码', dataIndex: 'productCode', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '数量', dataIndex: 'qtyText', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '库存', dataIndex: 'currentStockQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '单位', dataIndex: 'productUnit', width: 60, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '备注', dataIndex: 'errorDesc', width: 180, align: 'center', customRender: function (text) { return text || '--' } }
-      ],
-      loadData: [], // 可导入数据
-      unLoadData: [], // 错误数据
-      loading: false// 表格加载状态
-    }
-  },
-  methods: {
-    // 获取表格数据
-    getData () {
-      const _this = this
-      this.loading = true
-      // 获取列表数据  无分页
-      allocateBillParseProducts(this.paramsData).then(res => {
-        this.loading = false
-        if (res.status == 200) {
-          if (res.data.okList && res.data.okList.length > 0) {
-            res.data.okList.map((item, index) => {
-              item.no = index + 1
-            })
-          }
-          if (res.data.failList && res.data.failList.length > 0) {
-            res.data.failList.map((item, index) => {
-              item.no = index + 1
-            })
-          }
-          _this.loadData = res.data.okList || []
-          _this.unLoadData = res.data.failList || []
-        }
-      })
-    },
-    // 确认导入
-    handleSubmit () {
-      if (this.loadData.length == 0) {
-        this.$message.warning('无可导入产品!')
-      } else {
-        this.$emit('ok', this.loadData)
-        this.isShow = false
-      }
-    },
-    // 导出
-    handleError () {
-      const _this = this
-      if (_this.unLoadData.length < 1) {
-        _this.$message.info('暂无可导出错误项~')
-        return
-      }
-      _this.spinning = true
-      hdExportExcel(allocateBillFailExcel, _this.unLoadData, '产品导入错误项', function () {
-        _this.spinning = false
-      })
-    }
-  },
-  watch: {
-    //  父页面传过来的弹框状态
-    openModal (newValue, oldValue) {
-      this.isShow = newValue
-    },
-    //  重定义的弹框状态
-    isShow (newValue, oldValue) {
-      if (!newValue) {
-        this.$emit('close')
-        this.loadData = []
-        this.unLoadData = []
-      } else {
-        this.getData()
-      }
-    }
-  }
-}
-</script>
-
-<style lang="less" scoped>
-  .chooseImport-modal{
-    .chooseImport-con{
-      .red{
-        color: #f30;
-      }
-      .btn-con{
-        text-align: center;
-        margin: 30px 0 20px;
-        .button-cancel,.button-error{
-          font-size: 12px;
-        }
-      }
-    }
-  }
-</style>

+ 3 - 9
src/views/allocationManagement/transferOut/edit.vue

@@ -388,7 +388,7 @@ import { printBase64Fun, exportExcel } from '@/libs/JGPrint.js'
 import { queryStockProductForOtherPage } from '@/api/stock'
 import { productPriceInfo } from '@/api/product'
 import { departmentQueryList } from '@/api/expenseManagement'
-import { allocateBillDetailList, allocateBillDetailCount, allocateBillDetail, allocateBillDetailSave, allocateBillSubmit, allocateBillDetailDel, allocateBillDetailDelAll, allocateBillDetailPrint, allocateBillBatchInsert, allocateBillDetailExcel, updateBatchDepartment, queryStockProductPage } from '@/api/allocateBill'
+import { allocateBillDetailList, allocateBillDetailCount, allocateBillDetail, allocateBillDetailSave, allocateBillSubmit, allocateBillDetailDel, allocateBillDetailDelAll, allocateBillDetailPrint, allocateBillDetailExcel, updateBatchDepartment, queryStockProductPage } from '@/api/allocateBill'
 
 export default {
   name: 'TransferOutEdit',
@@ -620,14 +620,8 @@ export default {
     },
     // 导入产品
     handleGuideOk (obj) {
-      this.spinning = true
-      allocateBillBatchInsert(obj).then(res => {
-        if (res.status == 200) {
-          this.$refs.chooseTable.refresh(true)
-        }
-        this.spinning = false
-        this.getDetail(true)
-      })
+      this.$refs.chooseTable.refresh(true)
+      this.getDetail(true)
     },
     // 已选产品  重置
     chooseResetSearchForm (flag) {

+ 225 - 43
src/views/allocationManagement/transferOut/importGuideModal.vue

@@ -4,12 +4,13 @@
     class="importGuide-modal"
     :footer="null"
     :maskClosable="false"
-    title="导入"
+    destroyOnClose
+    title="导入产品"
     v-model="isShow"
-    @cancel="isShow=false"
-    :width="750">
+    :closable="false"
+    :width="850">
     <div class="importGuide-con">
-      <div class="explain-con">
+      <div class="explain-con" v-show="step==0">
         <div class="explain-item">
           <div class="explain-tit">
             <span>1</span>准备导入
@@ -24,7 +25,7 @@
             type="link"
             icon="download"
             style="padding: 0 0 0 23px;"
-            :loading="exportLoading"
+            :loading="spinning"
             @click="handleExport">下载导入模板</a-button>
         </div>
         <div class="explain-item">
@@ -46,39 +47,97 @@
           </div>
         </div>
       </div>
+      <!-- 第二步 -->
+      <div v-show="step==1">
+        <!-- 可导入数据 -->
+        <p class="blue">可导入数据<span>{{ loadData.length }}</span>条</p>
+        <a-table
+          class="sTable"
+          ref="table"
+          size="small"
+          :rowKey="(record) => record.no"
+          :columns="nowColumns"
+          :dataSource="loadData"
+          :loading="spinning"
+          :scroll="{ y: 200 }"
+          :pagination="false"
+          bordered>
+        </a-table>
+        <!-- 不可导入数据 -->
+        <p class="red">不可导入数据<span>{{ unLoadData.length }}</span>条</p>
+        <a-table
+          class="unTable"
+          ref="unTable"
+          size="small"
+          :rowKey="(record) => record.no"
+          :columns="nowUnColumns"
+          :dataSource="unLoadData"
+          :loading="spinning"
+          :scroll="{ y: 200 }"
+          :pagination="false"
+          bordered>
+        </a-table>
+      </div>
       <!-- 按钮 -->
       <div class="btn-con">
+        <a-button
+          id="importGuide-cancel"
+          size="large"
+          class="button-cancel"
+          @click="handleCancel"
+          :disabled="spinning"
+          style="padding: 0 40px;margin-left: 15px;">取消</a-button>
         <a-button
           type="primary"
           id="importGuide-nextStep"
           size="large"
           class="button-primary"
           @click="handlerNextStep"
-          style="padding: 0 60px;">下一步</a-button>
+          v-if="step==0"
+          :disabled="spinning"
+          style="padding: 0 40px;margin-left: 15px;">下一步</a-button>
         <a-button
-          id="importGuide-cancel"
+          type="default"
+          id="importGuide-prevStep"
           size="large"
-          class="button-cancel"
-          @click="isShow=false"
-          style="padding: 0 60px;margin-left: 15px;">取消</a-button>
+          v-if="step==1"
+          class="button-primary"
+          @click="handlerPrevStep"
+          :disabled="spinning"
+          style="padding: 0 40px;margin-left: 15px;">上一步</a-button>
+        <a-button
+          type="primary"
+          id="chooseImport-submit"
+          v-if="step==1"
+          size="large"
+          class="button-primary"
+          @click="handleSubmit"
+          :disabled="spinning"
+          style="padding: 0 40px;margin-left: 15px;">确认导入</a-button>
+        <a-button
+          type="primary"
+          id="chooseImport-error"
+          v-if="step==1"
+          size="large"
+          class="button-error"
+          :disabled="spinning"
+          @click="handleError"
+          style="padding: 0 40px;margin-left: 15px;">导出错误项</a-button>
       </div>
     </div>
-    <!-- 导入 -->
-    <chooseImportModal :openModal="openImportModal" :paramsData="paramsData" @close="handleClose" @ok="hanldeOk" />
   </a-modal>
 </template>
 
 <script>
 import { commonMixin } from '@/utils/mixin'
-// 组件
-import ChooseImportModal from './chooseImportModal.vue'
+import { hdExportExcel } from '@/libs/exportExcel'
 import { Upload } from '@/components'
 // 接口
-import { allocateBillDownload } from '@/api/allocateBill'
+import { allocateBillDownload, allocateBillParseProducts, allocateBillFailExcel, allocateBillBatchInsert } from '@/api/allocateBill'
 export default {
   name: 'TransferOutImportGuideModal',
   mixins: [commonMixin],
-  components: { ChooseImportModal, Upload },
+  components: { Upload },
   props: {
     openModal: { //  弹框显示状态
       type: Boolean,
@@ -92,24 +151,35 @@ export default {
   data () {
     return {
       isShow: this.openModal, //  是否打开弹框
-      openImportModal: false, //  导入
       attachAction: process.env.VUE_APP_API_BASE_URL + '/upload', // 上传文件路径
       paramsData: null, // 上传参数
       uploadParams: { // 上传参数
         savePathType: 'local'
       },
-      exportLoading: false// 导出按钮加载状态
+      spinning: false, // 导出按钮加载状态
+      step: 0,
+      nowColumns: [ //  正品
+        { title: '序号', dataIndex: 'no', width: 70, align: 'center' },
+        { title: '产品编码', dataIndex: 'productCode', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '数量', dataIndex: 'qtyText', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '库存', dataIndex: 'currentStockQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '单位', dataIndex: 'productUnit', width: 60, align: 'center', customRender: function (text) { return text || '--' } }
+      ],
+      nowUnColumns: [ //  促销品
+        { title: '序号', dataIndex: 'no', width: 70, align: 'center' },
+        { title: '产品编码', dataIndex: 'productCode', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '数量', dataIndex: 'qtyText', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '库存', dataIndex: 'currentStockQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '单位', dataIndex: 'productUnit', width: 60, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '备注', dataIndex: 'errorDesc', width: 180, align: 'center', customRender: function (text) { return text || '--' } }
+      ],
+      loadData: [], // 可导入数据
+      unLoadData: [] // 错误数据
     }
   },
   methods: {
-    // 下一步
-    handlerNextStep () {
-      if (this.paramsData) {
-        this.openImportModal = true
-      } else {
-        this.$message.warning('添加文件后再进行下一步操作!')
-      }
-    },
     // 上传文件  change
     changeImport (file) {
       if (file) {
@@ -117,28 +187,122 @@ export default {
           allocateSn: this.params.allocateSn || '',
           path: file
         }
+        this.loadData = []
+        this.unLoadData = []
+        this.handlerNextStep()
+      } else {
+        this.paramsData = null
       }
     },
-    // 导入
-    hanldeOk (obj) {
-      if (obj && obj.length > 0) {
-        this.$emit('ok', obj)
-        this.isShow = false
+    // 下一步
+    handlerNextStep () {
+      if (this.paramsData) {
+        if (this.loadData.length == 0 && this.unLoadData.length == 0) {
+          this.getData()
+        }
+        this.step = 1
+      } else {
+        this.$message.warning('添加文件后再进行下一步操作!')
       }
     },
-    // 关闭
-    handleClose () {
-      this.openImportModal = false
-      this.isShow = false
+    // 上一步
+    handlerPrevStep () {
+      const _this = this
+      if (this.loadData.length) {
+        this.$confirm({
+          title: '提示',
+          content: '当前页面数据未导入,是否返回上页?',
+          centered: true,
+          cancelText: '返回上页',
+          okText: '继续导入',
+          onOk () {
+            _this.step = 1
+          },
+          onCancel () {
+            _this.step = 0
+          }
+        })
+      } else {
+        _this.step = 0
+      }
+    },
+    // 取消或关闭
+    handleCancel () {
+      const _this = this
+      if (_this.loadData.length) {
+        this.$confirm({
+          title: '提示',
+          content: '当前页面数据未导入,是否取消导入操作?',
+          centered: true,
+          cancelText: '确认取消',
+          okText: '继续导入',
+          onOk () {
+            _this.step = 1
+          },
+          onCancel () {
+            _this.isShow = false
+          }
+        })
+      } else {
+        _this.isShow = false
+      }
+    },
+    // 获取表格数据
+    getData () {
+      const _this = this
+      this.spinning = true
+      // 获取列表数据  无分页
+      allocateBillParseProducts(this.paramsData).then(res => {
+        this.spinning = false
+        if (res.status == 200) {
+          if (res.data.okList && res.data.okList.length > 0) {
+            res.data.okList.map((item, index) => {
+              item.no = index + 1
+            })
+          }
+          if (res.data.failList && res.data.failList.length > 0) {
+            res.data.failList.map((item, index) => {
+              item.no = index + 1
+            })
+          }
+          _this.loadData = res.data.okList || []
+          _this.unLoadData = res.data.failList || []
+        }
+      })
+    },
+    // 确认导入
+    handleSubmit () {
+      if (this.loadData.length == 0) {
+        this.$message.warning('无可导入产品!')
+      } else {
+        this.spinning = true
+        allocateBillBatchInsert(this.loadData).then(res => {
+          if (res.status == 200) {
+            this.$emit('ok')
+            this.isShow = false
+          }
+          this.spinning = false
+        })
+      }
+    },
+    // 导出
+    handleError () {
+      const _this = this
+      if (_this.unLoadData.length < 1) {
+        _this.$message.info('暂无可导出错误项~')
+        return
+      }
+      _this.spinning = true
+      hdExportExcel(allocateBillFailExcel, _this.unLoadData, '产品导入错误项', function () {
+        _this.spinning = false
+      })
     },
-    //  导出
+    // 下载模板
     handleExport () {
       const _this = this
       _this.spinning = true
-      _this.exportLoading = true
       allocateBillDownload({}).then(res => {
         _this.spinning = false
-        _this.exportLoading = false
         if (res.type == 'application/json') {
           var reader = new FileReader()
           reader.addEventListener('loadend', function () {
@@ -176,8 +340,15 @@ export default {
     isShow (newValue, oldValue) {
       if (!newValue) {
         this.$emit('close')
+      } else {
         this.paramsData = null
-        this.$refs.importUpload.setFileList('')
+        if (this.$refs.importUpload) {
+          this.$refs.importUpload.setFileList('')
+        }
+        this.loadData = []
+        this.unLoadData = []
+        this.step = 0
+        this.spinning = false
       }
     }
   }
@@ -221,12 +392,23 @@ export default {
           width: 100%;
         }
       }
+      .blue{
+        span{
+          color: #1890ff;
+          margin: 0 5px;
+        }
+        margin: 10px 0;
+      }
+      .red{
+        span{
+          color: #f5222d;
+          margin: 0 5px;
+        }
+        margin: 10px 0;
+      }
       .btn-con{
-        margin: 10px 0 20px;
+        margin: 30px 0 20px;
         text-align: center;
-        .button-cancel{
-          font-size: 12px;
-        }
       }
     }
   }

+ 6 - 6
src/views/expenseManagement/expenseReimbursementDetail/list.vue

@@ -296,21 +296,21 @@ export default {
         { title: '详细说明', dataIndex: 'content', align: 'center', width: 150, customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '记账类型', dataIndex: 'accountTypeDictValue', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '记账名称', dataIndex: 'accountName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '记账名称财务核算编码', dataIndex: 'accountNameFnumber', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '财务编码', dataIndex: 'accountNameFnumber', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '所属区域', dataIndex: 'subareaArea.subareaName', width: 60, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '所属分区', dataIndex: 'subareaArea.subareaAreaName', width: 60, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '所属省份', dataIndex: 'provinceName', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '所属城市', dataIndex: 'cityName', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '记账费用', dataIndex: 'expense', width: 120, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
         { title: '费用承担方', dataIndex: 'splitObjName', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '费用承担方财务核算编码', dataIndex: 'splitObjFnumber', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '承担方财务编码', dataIndex: 'splitObjFnumber', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '费用承担金额', dataIndex: 'splitAmount', width: 120, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
         { title: '费用承担人', dataIndex: 'childSplitObjName', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '人员平摊费用', dataIndex: 'childSplitAmount', width: 120, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '费用归属品牌', dataIndex: 'productBrandName', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '费用归属品类(一级)', dataIndex: 'productTypeName1', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '费用归属品牌(二级)', dataIndex: 'productTypeName2', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '费用归属品牌(三级)', dataIndex: 'productTypeName3', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
+        // { title: '费用归属品牌', dataIndex: 'productBrandName', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
+        // { title: '费用归属品类(一级)', dataIndex: 'productTypeName1', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
+        // { title: '费用归属品牌(二级)', dataIndex: 'productTypeName2', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
+        // { title: '费用归属品牌(三级)', dataIndex: 'productTypeName3', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '备注', dataIndex: 'remarks', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
       ]
     }