浏览代码

货架设置

lilei 1 年之前
父节点
当前提交
c160e91d40
共有 5 个文件被更改,包括 147 次插入32 次删除
  1. 1 1
      public/version.json
  2. 11 0
      src/api/shelf.js
  3. 67 0
      src/views/common/shelfTemplate.js
  4. 66 29
      src/views/numsGoodsShelves/shelfSet/set.vue
  5. 2 2
      vue.config.js

+ 1 - 1
public/version.json

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

+ 11 - 0
src/api/shelf.js

@@ -92,6 +92,17 @@ export const shelfSave = (params) => {
     }
   })
 }
+// 导入货架模板
+export const importShelfTemplate = params => {
+  return axios({
+    url: '/shelf/importShelfTemplate',
+    data: params,
+    method: 'post',
+    headers:{
+      'module': encodeURIComponent('导入货架模板')
+    }
+  })
+}
 //  货架  货位产品 列表 不分页
 export const shelfProductList = (params) => {
   return axios({

+ 67 - 0
src/views/common/shelfTemplate.js

@@ -0,0 +1,67 @@
+import { shelfTemplateList } from '@/api/shelfTemplate'
+const custType = {
+  template: `
+      <a-select
+        :placeholder="placeholder"
+        :id="id"
+        allowClear
+        :value="defaultVal"
+        :showSearch="true"
+        @change="handleChange"
+        option-filter-prop="children"
+        :dropdownMatchSelectWidth="false"
+        :filter-option="filterOption">
+        <a-select-option v-for="item in list" :key="item.templateSn" :value="item.templateSn">{{ item.templateName }}</a-select-option>
+      </a-select>
+    `,
+  props: {
+    value: {
+      type: String,
+    },
+    id: {
+      type: String,
+      default: ''
+    },
+    placeholder: {
+      type: String,
+      default: '请选择货架模板'
+    }
+  },
+  data() {
+    return {
+      defaultVal: this.value,
+      list: []
+    };
+  },
+  mounted() {
+    this.getList()
+  },
+  watch: {
+    value(newValue, oldValue) {
+      this.defaultVal = newValue
+    }
+  },
+  methods: {
+    filterOption (input, option) {
+      return (
+        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
+      )
+    },
+    handleChange(value) {
+      this.defaultVal = value;
+      this.$emit('change', value);
+      this.$emit('input', value);
+    },
+    getList () {
+      shelfTemplateList({pageNo:1,pageSize:100}).then(res => {
+        if (res.status == 200) {
+          this.list = res.data.list
+        } else {
+          this.list = []
+        }
+      })
+    },
+  },
+};
+
+export default custType

+ 66 - 29
src/views/numsGoodsShelves/shelfSet/set.vue

@@ -13,20 +13,26 @@
           <a-collapse-panel key="1">
             <template slot="header">
               <span>基础信息</span>
-              <a-button icon="edit" v-if="basicInfoData&&basicInfoData.state!='WRITE_OFF'&&basicInfoData.state!='SUSPEND'" size="small" type="link" style="margin-left: 20px;color: #39f;" @click.stop="openInfoModal = true">编辑</a-button>
+              <a-button
+                icon="edit"
+                v-if="basicInfoData&&basicInfoData.state!='WRITE_OFF'&&basicInfoData.state!='SUSPEND'"
+                size="small"
+                type="link"
+                style="margin-left: 20px;color: #39f;"
+                @click.stop="openInfoModal = true">编辑</a-button>
             </template>
             <a-descriptions :column="2">
               <a-descriptions-item label="货架名称">
-              {{ basicInfoData&&basicInfoData.shelfName || '--' }}
-              <a-badge count="已注销" :number-style="{ zoom:'80%',marginLeft:'5px', color: '#fff',background:'#999' }" v-if="basicInfoData&&basicInfoData.state=='WRITE_OFF'"></a-badge>
-              <a-badge count="已停用" :number-style="{ zoom:'80%',marginLeft:'5px', color: '#fff',background:'#999' }" v-if="basicInfoData&&basicInfoData.state=='DISABLED'"></a-badge>
-              <a-badge count="已暂停" :number-style="{ zoom:'80%',marginLeft:'5px', color: '#fff',background:'#999' }" v-if="basicInfoData&&basicInfoData.state=='SUSPEND'"></a-badge>
+                {{ basicInfoData&&basicInfoData.shelfName || '--' }}
+                <a-badge count="已注销" :number-style="{ zoom:'80%',marginLeft:'5px', color: '#fff',background:'#999' }" v-if="basicInfoData&&basicInfoData.state=='WRITE_OFF'"></a-badge>
+                <a-badge count="已停用" :number-style="{ zoom:'80%',marginLeft:'5px', color: '#fff',background:'#999' }" v-if="basicInfoData&&basicInfoData.state=='DISABLED'"></a-badge>
+                <a-badge count="已暂停" :number-style="{ zoom:'80%',marginLeft:'5px', color: '#fff',background:'#999' }" v-if="basicInfoData&&basicInfoData.state=='SUSPEND'"></a-badge>
               </a-descriptions-item>
               <a-descriptions-item>
                 <template slot="label">
-                    货架产品 
+                  货架产品
                 </template>
-                <span>{{showPriceStr.length ? showPriceStr.join("/") : '--'}}</span>
+                <span>{{ showPriceStr.length ? showPriceStr.join("/") : '--' }}</span>
               </a-descriptions-item>
               <a-descriptions-item>
                 <template slot="label">
@@ -41,9 +47,9 @@
               </a-descriptions-item>
               <a-descriptions-item>
                 <template slot="label">
-                    非货架产品
+                  非货架产品
                 </template>
-                <span>{{showNoShelfPriceStr.length ? showNoShelfPriceStr.join("/") : '--'}}</span>
+                <span>{{ showNoShelfPriceStr.length ? showNoShelfPriceStr.join("/") : '--' }}</span>
               </a-descriptions-item>
             </a-descriptions>
           </a-collapse-panel>
@@ -74,7 +80,7 @@
                     @click="handleExport"
                     :disabled="disabled"
                     :loading="exportLoading"
-                    >导出</a-button>
+                  >导出</a-button>
                 </span>
               </a-col>
             </a-row>
@@ -83,14 +89,21 @@
         <!-- 操作按钮 -->
         <div class="table-operator" v-if="basicInfoData&&basicInfoData.state!='WRITE_OFF'&&basicInfoData.state!='SUSPEND'">
           <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-button id="shelfSet-imports" type="primary" class="button-info" @click="addHW(0)">批量导入货位</a-button>
+          <a-button id="shelfSet-importProduct" type="primary" class="button-error" @click="openGuideModal=true">导入绑定产品</a-button>
           <a-tooltip placement="top">
             <template slot="title">
               <span>如果货位还没有绑定产品,可使用此功能通过Excel批量导入</span>
             </template>
             <a-icon type="question-circle" style="color: rgba(0,0,0,.45);font-size: 16px;margin-left: 5px;vertical-align: middle;cursor: pointer;" />
           </a-tooltip>
+          <a-button
+            v-if="showTplBtn"
+            id="shelfSet-import-template"
+            style="margin-left:10px;"
+            type="primary"
+            class="button-primary"
+            @click="showTplModal=true">导入模板</a-button>
         </div>
         <!-- 列表 -->
         <s-table
@@ -173,6 +186,10 @@
     <importGuideModal :openModal="openGuideModal" :params="{shelfSn: $route.params.sn}" @close="openGuideModal=false" @ok="handleGuideOk" />
     <!-- 导入货位模板 -->
     <importHuoweiModal :openModal="openImportModal" @close="openImportModal=false" @ok="$refs.table.refresh(true)" :shelfSn="$route.params.sn"></importHuoweiModal>
+    <!-- 导入货架模板 -->
+    <commonModal modalTit="导入货架模板" :openModal="showTplModal" @close="showTplModal=false" @ok="saveTpl">
+      <shelfTemplate style="width:100%" v-model="tplSn"></shelfTemplate>
+    </commonModal>
   </div>
 </template>
 
@@ -186,10 +203,11 @@ import bindProductModal from './bindProductModal.vue'
 import ImportGuideModal from './importGuideModal.vue'
 import basicInfoModal from './basicInfoModal.vue'
 import importHuoweiModal from './importHuoweiModal.vue'
-import { shelfDetail, shelfProductList, shelfProductBatchInsert, delShelfPlaceSn, shelfProductEnable, getShelfPriceShow, shelfProductExport } from '@/api/shelf'
+import shelfTemplate from '@/views/common/shelfTemplate'
+import { shelfDetail, shelfProductList, shelfProductBatchInsert, delShelfPlaceSn, shelfProductEnable, getShelfPriceShow, shelfProductExport, importShelfTemplate } from '@/api/shelf'
 export default {
   name: 'ShelfMonitoringWarehousing',
-  components: { STable, VSelect, commonModal, bindProductModal, addHwModal, ImportGuideModal, basicInfoModal, importHuoweiModal },
+  components: { STable, VSelect, commonModal, bindProductModal, addHwModal, ImportGuideModal, basicInfoModal, importHuoweiModal, shelfTemplate },
   mixins: [commonMixin],
   data () {
     return {
@@ -197,12 +215,15 @@ export default {
       disabled: false, //  查询、重置按钮是否可操作
       tableHeight: 400,
       exportLoading: false,
+      showTplModal: false, // 是否显示导入模板弹框
+      tplSn: undefined, // 模板sn
       queryParam: {
         shelfProductApiEntity: {
           productCode: '',
           productName: ''
         }
       },
+      orginData: [], // 原始数据
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
@@ -216,6 +237,7 @@ export default {
               data[i].enableFlag = data[i].shelfProductApiEntity && data[i].shelfProductApiEntity.enableFlag
             }
             this.disabled = false
+            this.orginData = data
           }
           this.spinning = false
           return data
@@ -234,8 +256,11 @@ export default {
       showNoShelfPriceStr: []
     }
   },
-  computed:{
-    columns(){
+  computed: {
+    showTplBtn () {
+      return this.orginData.length > 0
+    },
+    columns () {
       const _this = this
       const ret = [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
@@ -245,9 +270,9 @@ export default {
         { title: '车主价', dataIndex: 'shelfProductApiEntity.price', width: '9%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } },
         { slots: { title: 'customTitle' }, dataIndex: 'shelfProductApiEntity.cost', width: '9%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } },
         { title: '最大库容', dataIndex: 'shelfProductApiEntity.maxQty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '当前库存', dataIndex: 'shelfProductApiEntity.qty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '当前库存', dataIndex: 'shelfProductApiEntity.qty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
       ]
-      if(this.basicInfoData&&this.basicInfoData.state!='WRITE_OFF'&&this.basicInfoData.state!='SUSPEND'){
+      if (this.basicInfoData && this.basicInfoData.state != 'WRITE_OFF' && this.basicInfoData.state != 'SUSPEND') {
         ret.push({ title: '操作', scopedSlots: { customRender: 'action' }, width: '15%', align: 'center' })
       }
       return ret
@@ -260,30 +285,40 @@ export default {
       this.showNoShelfPriceStr = []
       getShelfPriceShow({ shelfSn: this.$route.params.sn }).then(res => {
         if (res.status == 200) {
-          const ret = res.data&&res.data
+          const ret = res.data && res.data
           this.basicInfoData.showPrice = ret
           ret.map(item => {
-            if(item.paramCode == 'shelf_price_show'&&item.paramValue == 1){
-              this.showPriceStr.push("车主价")
+            if (item.paramCode == 'shelf_price_show' && item.paramValue == 1) {
+              this.showPriceStr.push('车主价')
             }
-            if(item.paramCode == 'shelf_cost_show'&&item.paramValue == 1){
-              this.showPriceStr.push("结算价")
+            if (item.paramCode == 'shelf_cost_show' && item.paramValue == 1) {
+              this.showPriceStr.push('结算价')
             }
-            if(item.paramCode == 'non_shelf_price_show'&&item.paramValue == 1){
-              this.showNoShelfPriceStr.push("车主价")
+            if (item.paramCode == 'non_shelf_price_show' && item.paramValue == 1) {
+              this.showNoShelfPriceStr.push('车主价')
             }
-            if(item.paramCode == 'non_shelf_cost_show'&&item.paramValue == 1){
-              this.showNoShelfPriceStr.push("结算价")
+            if (item.paramCode == 'non_shelf_cost_show' && item.paramValue == 1) {
+              this.showNoShelfPriceStr.push('结算价')
             }
           })
         }
       })
     },
+    // 导入模板成功
+    saveTpl () {
+      this.showTplModal = false
+      importShelfTemplate({ shelfSn: this.$route.params.sn, templateSn: this.tplSn }).then(res => {
+        if (res.status == 200) {
+          this.$message.success(res.message)
+          this.resetSearchForm()
+        }
+      })
+    },
     // 导出产品
     handleExport () {
       this.exportLoading = true
-      shelfProductExport({shelfSn: this.$route.params.sn}).then(res => {
-        downloadExcel(res, (this.basicInfoData?this.basicInfoData.shelfName:'')+"的产品")
+      shelfProductExport({ shelfSn: this.$route.params.sn }).then(res => {
+        downloadExcel(res, (this.basicInfoData ? this.basicInfoData.shelfName : '') + '的产品')
         this.exportLoading = false
       })
     },
@@ -386,6 +421,7 @@ export default {
       this.modalType = type
       this.openModal = true
     },
+    // 编辑弹框取消
     handleCancel () {
       this.modalType = null
       this.nowData = null
@@ -400,6 +436,7 @@ export default {
         }
       })
     },
+    // 编辑基本信息成功
     handleInfoOk () {
       this.getDetail()
     },

+ 2 - 2
vue.config.js

@@ -209,8 +209,8 @@ const vueConfig = {
     // If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
     proxy: {
       '/api': {
-        // target: 'http://192.168.2.123/qpls-md',
-        target: 'https://p.iscm.360arrow.com/qpls-md',
+        target: 'http://192.168.2.124/qpls-md',
+        // target: 'https://p.iscm.360arrow.com/qpls-md',
         // ws: false,
         ws: true,
         changeOrigin: true,