lilei 2 lat temu
rodzic
commit
643a7a6681

+ 1 - 1
public/version.json

@@ -1,5 +1,5 @@
 {
   "message": "发现有新版本发布,确定更新系统?",
   "vendorJsVersion": "",
-  "version": 1660621503716
+  "version": 1660727779508
 }

+ 143 - 0
src/views/numsGoodsShelves/shelfSet/addHWModal.vue

@@ -0,0 +1,143 @@
+<template>
+  <div>
+    <a-modal
+      centered
+      wrapClassName="addHWModal-modal"
+      :footer="null"
+      :maskClosable="false"
+      :title="textTitle"
+      v-model="isshow"
+      @cancle="isshow=false"
+      :width="500">
+      <a-spin :spinning="spinning" tip="Loading...">
+        <a-form-model
+          id="addHWModal-form"
+          ref="ruleForm"
+          :model="form"
+          :rules="rules"
+        >
+          <a-row :gutter="20">
+            <a-col :span="24">
+              <a-form-model-item label="货位号" prop="shelfPlaceCode" :label-col="{span: 5}" :wrapper-col="{span: 18}">
+                <a-input id="addHWModal-shelfPlaceCode" v-model.trim="form.shelfPlaceCode" allowClear placeholder="请输入货位号"/>
+              </a-form-model-item>
+            </a-col>
+          </a-row>
+          <a-form-model-item :label-col="{span: 0}" :wrapper-col="{span: 24}" style="text-align: center;">
+            <a-button type="primary" @click="handleSubmit()" :style="{ marginRight: '8px' }" id="addHWModal-handleSubmit">保存</a-button>
+            <a-button :style="{ marginLeft: '8px' }" @click="isshow=false" id="addHWModal-close">取消</a-button>
+          </a-form-model-item>
+        </a-form-model>
+      </a-spin>
+    </a-modal>
+  </div>
+</template>
+
+<script>
+import { saveHw, shelfHWDetail } from '@/api/shelf.js'
+export default {
+  name: 'AddHWModal',
+  props: {
+    openHWModal: {
+      type: Boolean,
+      default: false
+    },
+    shelfSn: {
+      type: [String, Number],
+      default: ''
+    },
+    nowData: {
+      type: Object,
+      default: function () {
+        return {}
+      }
+    }
+  },
+
+  data () {
+    return {
+      spinning: false,
+      isshow: this.openHWModal,
+      textTitle: '新增货位',
+      roleList: [],
+      pageInfo: null,
+      form: {
+        shelfPlaceCode: '' // 货位号
+      },
+      rules: {
+        shelfPlaceCode: [ { required: true, message: '请输入货位号', trigger: 'blur' }, { pattern: '^[^\u4e00-\u9fa5]{0,}$', message: '货位号不支持汉字' }]
+      }
+    }
+  },
+  methods: {
+    // 过滤空格
+    filterEmpty () {
+      let str = this.form.name
+      str = str.replace(/\ +/g, '')
+      str = str.replace(/[ ]/g, '')
+      str = str.replace(/[\r\n]/g, '')
+      this.form.name = str
+    },
+    // 查询货位详情
+    getShelfHWDetail () {
+      this.spinning = true
+      shelfHWDetail({ shelfPlaceSn: this.nowData.shelfPlaceSn }).then(res => {
+        if (res.status == 200) {
+          this.form = Object.assign({}, res.data)
+        }
+        this.spinning = false
+      })
+    },
+    // 保存提交
+    handleSubmit () {
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          const params = JSON.parse(JSON.stringify(_this.form))
+          params.shelfSn = _this.shelfSn ? _this.shelfSn : null
+          console.log(params.id, params.shelfSn, '------------编辑新增')
+          _this.spinning = true
+          saveHw(params).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$emit('refresh')
+              setTimeout(function () {
+                _this.isshow = false
+                _this.spinning = false
+              }, 300)
+            } else {
+              _this.spinning = false
+            }
+          })
+        } else {
+          console.log('error submit!!')
+          return false
+        }
+      })
+    }
+  },
+  watch: {
+    openHWModal (newValue, oldValue) {
+      console.log(newValue, 'newValue')
+      this.isshow = newValue
+    },
+    isshow (newValue, oldValue) {
+      if (!newValue) {
+        console.log(!newValue, newValue)
+        this.$refs.ruleForm.resetFields()
+        this.form = {}
+        this.textTitle = '新增货位'
+        this.$emit('close')
+      } else {
+        if (this.nowData && this.nowData.id) { //  编辑
+          console.log(this.shelfPlaceSn, 'this.shelfPlaceSn')
+          this.textTitle = '编辑货位'
+          this.getShelfHWDetail()
+        }
+      }
+    }
+  }
+}
+</script>
+<style lang="less">
+</style>

+ 7 - 1
src/views/numsGoodsShelves/shelfSet/basicInfoModal.vue

@@ -17,6 +17,9 @@
         :rules="rules"
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol">
+        <a-form-model-item label="货架名称" prop="shelfName">
+          <a-input v-model="form.shelfName" placeholder="请输入货架名称"></a-input>
+        </a-form-model-item>
         <a-form-model-item prop="customerSn">
           <template slot="label">
             <a-tooltip placement="top">
@@ -68,9 +71,11 @@ export default {
         wrapperCol: { span: 17 }
       },
       form: {
-        customerSn: undefined
+        customerSn: undefined,
+        shelfName: ''
       },
       rules: {
+        shelfName: [{ required: true, message: '请输入货架名称', trigger: 'change' }],
         customerSn: [{ required: true, message: '请选择关联客户', trigger: 'change' }]
       }
     }
@@ -122,6 +127,7 @@ export default {
         if (this.nowData.customerSn) {
           const _this = this
           this.$nextTick(() => {
+            _this.form.shelfName = _this.nowData.shelfName
             _this.form.customerSn = _this.nowData.customerEntity && _this.nowData.customerEntity.customerSn
             _this.$refs.custList.fetchUser(_this.nowData.customerEntity && _this.nowData.customerEntity.customerName)
             _this.$refs.custList.dealerName = {

+ 169 - 0
src/views/numsGoodsShelves/shelfSet/chooseShelfImportModal.vue

@@ -0,0 +1,169 @@
+<template>
+  <a-modal
+    centered
+    class="chooseImport-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="确认导入"
+    v-model="isShow"
+    @cancle="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>
+      </div>
+    </div>
+  </a-modal>
+</template>
+
+<script>
+// import { hdExportExcel } from '@/libs/exportExcel'
+import { saveBatchExcel, exportExcelData } from '@/api/shelf'
+export default {
+  name: 'ChooseImportModal',
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    paramsData: {
+      type: Object,
+      default: () => {
+        return {}
+      }
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      nowColumns: [
+        { title: '序号', dataIndex: 'no', width: '10%', align: 'center' },
+        { title: '货位号', dataIndex: 'shelfPlaceCode', width: '90%', align: 'center', customRender: function (text) { return text || '--' } }
+      ],
+      loadData: [],
+      nowUnColumns: [
+        { title: '序号', dataIndex: 'no', width: '10%', align: 'center' },
+        { title: '货位号', dataIndex: 'shelfPlaceCode', width: '40%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '错误原因', dataIndex: 'remarks', width: '50%', align: 'center', customRender: function (text) { return text || '--' } }
+      ],
+      unLoadData: [],
+      loading: false
+    }
+  },
+  methods: {
+    getData () {
+      const _this = this
+      this.loading = true
+      const params = {
+        shelfSn: this.paramsData.shelfSn,
+        path: this.paramsData.path
+      }
+      exportExcelData(params).then(res => {
+        this.loading = false
+        if (res.status == 200) {
+          if (res.data.successList && res.data.successList.length > 0) {
+            res.data.successList.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.successList || []
+          _this.unLoadData = res.data.failList || []
+        }
+      })
+    },
+    // 确认导入
+    handleSubmit () {
+      if (this.loadData.length == 0) {
+        this.$message.warning('无可导入产品!')
+      } else {
+        saveBatchExcel(this.loadData).then(res => {
+          if (res.status == 200) {
+            this.$emit('ok', this.loadData)
+            this.isShow = 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>

+ 196 - 0
src/views/numsGoodsShelves/shelfSet/importHuoweiModal.vue

@@ -0,0 +1,196 @@
+<template>
+  <a-modal
+    centered
+    class="importHuoweiModal-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="批量导入货位"
+    v-model="isShow"
+    @cancle="isShow=false"
+    :width="750">
+    <div class="importHuoweiModal-con">
+      <div class="explain-con">
+        <div class="explain-item">
+          <div class="explain-tit">
+            <span>1</span>下载导入模板
+            <p>请按照下载的Excel模板填写数据</p>
+            <a :href="filePath" style="padding: 5px 0 0 23px;display: block;">
+              <a-icon type="download" style="padding-right: 5px;" />下载导入模板
+            </a>
+          </div>
+        </div>
+        <div class="explain-item">
+          <div class="explain-tit">
+            <span>2</span>准备导入数据
+          </div>
+          <ul>
+            <li>1) 导入的Excel文件中必须包含名为“货位号”的列,且名称必须相同</li>
+            <li>2) 除了“货位号”一列,其他列可自定义,不影响数据导入</li>
+          </ul>
+
+        </div>
+        <div class="explain-item">
+          <div class="explain-tit">
+            <span>3</span>上传数据文件
+          </div>
+          <p>目前支持的文件类型*.xls,*.xlsx.</p>
+          <div style="overflow: hidden;padding-left: 23px;">
+            <Upload
+              id="importHuoweiModal-attachList"
+              ref="importUpload"
+              :maxNums="1"
+              fileType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
+              uploadType="import"
+              :action="attachAction"
+              :uploadParams="uploadParams"
+              upText="添加文件"
+              @change="changeImport"></Upload>
+          </div>
+        </div>
+      </div>
+      <!-- 按钮 -->
+      <div class="btn-con">
+        <a-button
+          type="primary"
+          id="importHuoweiModal-nextStep"
+          size="large"
+          class="button-primary"
+          @click="handlerNextStep"
+          style="padding: 0 60px;">下一步</a-button>
+        <a-button
+          id="importHuoweiModal-cancel"
+          size="large"
+          class="button-cancel"
+          @click="isShow=false"
+          style="padding: 0 60px;margin-left: 15px;">取消</a-button>
+      </div>
+    </div>
+    <!-- 导入 -->
+    <chooseImportModal :openModal="openImportModal" :paramsData="paramsData" @close="handleClose" @ok="hanldeOk" />
+  </a-modal>
+</template>
+
+<script>
+import ChooseImportModal from './chooseShelfImportModal.vue'
+import { Upload } from '@/components'
+export default {
+  name: 'ImportHuoweiModalModal',
+  components: { ChooseImportModal, Upload },
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    shelfSn: {
+      type: [String, Number],
+      default: ''
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      openImportModal: false, //  导入
+      filePath: 'https://jianguan-images.oss-cn-beijing.aliyuncs.com/template/goodsAllocationTempl.xlsx', // 文件地址
+      attachAction: process.env.VUE_APP_API_BASE_URL + '/upload',
+      paramsData: null,
+      uploadParams: {
+        savePathType: 'local'
+      }
+    }
+  },
+  methods: {
+    // 下一步
+    handlerNextStep () {
+      if (this.paramsData) {
+        this.openImportModal = true
+      } else {
+        this.$message.warning('添加文件后再进行下一步操作!')
+      }
+    },
+    // 上传文件  change
+    changeImport (file) {
+      if (file) {
+        this.paramsData = {
+          shelfSn: this.shelfSn || '',
+          path: file
+        }
+        console.log(this.paramsData, 'this.paramsData')
+      }
+    },
+    // 导入
+    hanldeOk (obj) {
+      if (obj && obj.length > 0) {
+        this.$emit('ok', obj)
+        this.isShow = false
+      }
+    },
+    // 关闭
+    handleClose () {
+      this.openImportModal = false
+      this.isShow = false
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+        this.paramsData = null
+        this.$refs.importUpload.setFileList('')
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+  .importHuoweiModal-modal{
+    .importHuoweiModal-con{
+      .explain-con{
+        .explain-item{
+          margin-bottom: 10px;
+          .explain-tit{
+            font-weight: bold;
+            span{
+              display: inline-block;
+              width: 18px;
+              height: 18px;
+              line-height: 16px;
+              text-align: center;
+              margin-right: 5px;
+              border-radius: 50%;
+              border: 1px solid rgba(0, 0, 0, 0.3);
+            }
+          }
+          p{
+            margin: 8px 0;
+            padding-left: 23px;
+          }
+          ul{
+            list-style: none;
+            padding: 0;
+            padding-left: 23px;
+            margin: 0;
+            li{
+              line-height: 26px;
+            }
+          }
+        }
+        #importHuoweiModal-attachList{
+          width: 100%;
+        }
+      }
+      .btn-con{
+        margin: 10px 0 20px;
+        text-align: center;
+        .button-cancel{
+          font-size: 12px;
+        }
+      }
+    }
+  }
+</style>

+ 25 - 10
src/views/numsGoodsShelves/shelfSet/set.vue

@@ -5,7 +5,7 @@
         <!-- 自定义的二级文字标题 -->
         <template slot="subTitle">
           <a id="shelfSet-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
-          <span class="store-info">{{ (basicInfoData&&basicInfoData.shelfName) || '--' }}</span>
+          <span class="store-info">货架名称:{{ basicInfoData&&basicInfoData.shelfName || '--' }}</span>
         </template>
       </a-page-header>
       <!-- 内容 -->
@@ -14,9 +14,9 @@
           <a-collapse-panel key="1">
             <template slot="header">
               <span>基础信息</span>
-              <a-button icon="edit" size="small" type="link" style="margin-left: 20px;color: #39f;" @click.stop="handleInfoEdit">编辑</a-button>
+              <a-button icon="edit" size="small" type="link" style="margin-left: 20px;color: #39f;" @click.stop="openInfoModal = true">编辑</a-button>
             </template>
-            <a-descriptions :column="3">
+            <a-descriptions :column="1">
               <a-descriptions-item label="关联客户">{{ (basicInfoData&&basicInfoData.customerEntity&&basicInfoData.customerEntity.customerName) || '--' }}</a-descriptions-item>
             </a-descriptions>
           </a-collapse-panel>
@@ -48,6 +48,8 @@
         </div>
         <!-- 操作按钮 -->
         <div class="table-operator">
+          <a-button id="shelfSet-addHW" type="primary" class="button-error" @click="addHW(1)">新增货位</a-button>
+          <a-button id="shelfSet-impoort" type="primary" class="button-info" @click="addHW(0)">批量导入货位</a-button>
           <a-button id="shelfSet-import" type="primary" class="button-error" @click="openGuideModal=true">导入绑定产品</a-button>
           <a-tooltip placement="top">
             <template slot="title">
@@ -94,6 +96,8 @@
         </s-table>
       </a-card>
     </a-spin>
+    <!-- 基础设置 -->
+    <basic-info-modal :openModal="openInfoModal" :nowData="basicInfoData" @ok="handleInfoOk" @close="openInfoModal=false" />
     <!-- 修改信息/绑定产品/更换产品 -->
     <bind-product-modal :openModal="openModal" :type="modalType" :nowData="nowData" @ok="$refs.table.refresh()" @close="handleCancel" />
     <!-- 更换产品 -->
@@ -106,8 +110,10 @@
       @close="openTipsModal=false" />
     <!-- 导入产品 -->
     <importGuideModal :openModal="openGuideModal" :params="{shelfSn: $route.params.sn}" @close="openGuideModal=false" @ok="handleGuideOk" />
-    <!-- 基础设置 -->
-    <basic-info-modal :openModal="openInfoModal" :nowData="basicInfoData" @ok="handleInfoOk" @close="openInfoModal=false" />
+    <!-- 导入货位模板 -->
+    <importHuoweiModal :openModal="openImportModal" @close="openImportModal=false" @ok="$refs.table.refresh(true)" :shelfSn="$route.params.sn"></importHuoweiModal>
+    <!-- 新增货位 -->
+    <addHWModal :openHWModal="openHWModal" @refresh="$refs.table.refresh(true)" :shelfSn="$route.params.sn" :nowData="nowData" @close="openHWModal=false"></addHWModal>
   </div>
 </template>
 
@@ -118,10 +124,12 @@ import commonModal from '@/views/common/commonModal.vue'
 import bindProductModal from './bindProductModal.vue'
 import ImportGuideModal from './importGuideModal.vue'
 import basicInfoModal from './basicInfoModal.vue'
+import importHuoweiModal from './importHuoweiModal.vue'
+import addHWModal from './addHWModal.vue'
 import { shelfDetail, shelfProductList, shelfProductBatchInsert } from '@/api/shelf'
 export default {
   name: 'ShelfMonitoringWarehousing',
-  components: { STable, VSelect, commonModal, bindProductModal, ImportGuideModal, basicInfoModal },
+  components: { STable, VSelect, commonModal, bindProductModal, ImportGuideModal, basicInfoModal, importHuoweiModal, addHWModal },
   mixins: [commonMixin],
   data () {
     return {
@@ -167,13 +175,20 @@ export default {
       nowData: null,
       openGuideModal: false,
       modalType: null,
-      openInfoModal: false
+      openInfoModal: false,
+      openHWModal: false,
+      openImportModal: false
     }
   },
   methods: {
-    // 编辑基本信息
-    handleInfoEdit () {
-      this.openInfoModal = true
+    // 导入或新增
+    addHW (type) {
+      if (type == 0) {
+        this.openImportModal = true
+      } else {
+        this.nowData = null
+        this.openHWModal = true
+      }
     },
     // 基本信息
     getDetail () {