瀏覽代碼

货架模板设置

lilei 1 年之前
父節點
當前提交
461278c42b

+ 1 - 1
public/version.json

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

+ 130 - 0
src/api/shelfTemplate.js

@@ -0,0 +1,130 @@
+import { axios } from '@/utils/request'
+
+// 货架模板 列表  分页
+export const shelfTemplateList = (params) => {
+  const url = `/shelfTemplate/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post',
+    headers:{
+      'module': encodeURIComponent('货架模板列表查询')
+    }
+  })
+}
+//  新建
+export const shelfTemplateSave = (params) => {
+  return axios({
+    url: `/shelfTemplate/save`,
+    data: params,
+    method: 'post',
+    headers:{
+      'module': encodeURIComponent('新建编辑货架模板')
+    }
+  })
+}
+//  复制
+export const shelfTemplateCopy = (params) => {
+  return axios({
+    url: `/shelfTemplate/copy/${params.templateSn}`,
+    data: params,
+    method: 'post',
+    headers:{
+      'module': encodeURIComponent('复制货架模板')
+    }
+  })
+}
+//  删除
+export const shelfTemplateDel = (params) => {
+  return axios({
+    url: `/shelfTemplate/deleteBySn/${params.templateSn}`,
+    data: params,
+    method: 'post',
+    headers:{
+      'module': encodeURIComponent('删除货架模板')
+    }
+  })
+}
+//  详情
+export const shelfTemplateDetail = (params) => {
+  return axios({
+    url: `/shelfTemplate/queryBySn/${params.templateSn}`,
+    data: params,
+    method: 'post',
+    headers:{
+      'module': encodeURIComponent('复制货架模板')
+    }
+  })
+}
+// 货架模板明细 列表  分页
+export const shelfTemplateDetailList = (params) => {
+  const url = `/shelfTemplate/detail/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post',
+    headers:{
+      'module': encodeURIComponent('货架模板明细列表查询')
+    }
+  })
+}
+//  货架模板明细保存
+export const shelfTemplateDetailSave = (params) => {
+  return axios({
+    url: `/shelfTemplate/detail/save`,
+    data: params,
+    method: 'post',
+    headers:{
+      'module': encodeURIComponent('货架模板新增编辑明细')
+    }
+  })
+}
+// 删除货架模板明细
+export const shelfTemplateDetailBySn = (params) => {
+  return axios({
+    url: `/shelfTemplate/detail/deleteBySn/${params.templateDetailSn}`,
+    data: params,
+    method: 'post',
+    headers:{
+      'module': encodeURIComponent('货架模板明细删除')
+    }
+  })
+}
+// 导入货架产品-保存数据
+export const shelfTemplateDetailImportSave = (params) => {
+  return axios({
+    url: `/shelfTemplate/detail/insertImport`,
+    data: params,
+    method: 'post',
+    headers:{
+      'module': encodeURIComponent('货架模板明细导入产品')
+    }
+  })
+}
+// 导入货架产品-导出错误项
+export const shelfTemplateImportDetailError = (params) => {
+  return axios({
+    url: `/shelfTemplate/detail/importDetailError`,
+    data: params,
+    method: 'post',
+    responseType: 'blob',
+    headers:{
+      'module': encodeURIComponent('货架模板导出错误项')
+    }
+  })
+}
+// 导入货架模板-解析模板
+export const shelfTemplateDetailImportParse = (params) => {
+  return axios({
+    url: `/shelfTemplate/detail/importDetail`,
+    data: params,
+    method: 'post',
+    headers:{
+      'module': encodeURIComponent('导入货架模板产品')
+    }
+  })
+}

+ 2 - 2
src/views/allocationManagement/storeTransferOut/importGuideModal.vue

@@ -92,7 +92,7 @@ export default {
         savePathType: 'local',
         storeCallOutSn: this.params.storeCallOutSn
       },
-      filePath: location.protocol + '//' +location.host + '/templ/店内调出产品导入模板.xls'
+      filePath: location.protocol + '//' + location.host + '/templ/店内调出产品导入模板.xls'
     }
   },
   methods: {
@@ -129,7 +129,7 @@ export default {
     handleClose () {
       this.openImportModal = false
       this.isShow = false
-    },
+    }
   },
   watch: {
     //  父页面传过来的弹框状态

+ 25 - 9
src/views/common/productJqList.vue

@@ -20,6 +20,7 @@
 <script>
 import debounce from 'lodash/debounce'
 import { shelfDealerProductList } from '@/api/shelf'
+import { productList } from '@/api/product'
 export default {
   props: {
     itemSn: {
@@ -31,6 +32,10 @@ export default {
       default: () => {
         return null
       }
+    },
+    dataType: {
+      type: String,
+      default: 'shelf'
     }
   },
   data () {
@@ -51,16 +56,27 @@ export default {
       this.data = []
       this.fetching = true
       let params = { code: productCode, pageNo: 1, pageSize: 20 }
-      if (this.params) {
-        params = Object.assign(params, this.params)
-      }
-      shelfDealerProductList(params).then(res => {
-        if (fetchId !== this.lastFetchId) {
-          return
+
+      if (this.dataType == 'shelf') {
+        if (this.params) {
+          params = Object.assign(params, this.params)
         }
-        this.data = res.data && res.data.list ? res.data.list : []
-        this.fetching = false
-      })
+        shelfDealerProductList(params).then(res => {
+          if (fetchId !== this.lastFetchId) {
+            return
+          }
+          this.data = res.data && res.data.list ? res.data.list : []
+          this.fetching = false
+        })
+      } else {
+        productList(params).then(res => {
+          if (fetchId !== this.lastFetchId) {
+            return
+          }
+          this.data = res.data && res.data.list ? res.data.list : []
+          this.fetching = false
+        })
+      }
     },
     handleChange (value) {
       if (value && value.key) {

+ 20 - 39
src/views/numsGoodsShelves/shelfProductTempl/addHwModal.vue

@@ -16,12 +16,11 @@
         :rules="rules"
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol">
-        <a-form-model-item label="模板名称">{{ nowData&&nowData.shelfName || '--' }}</a-form-model-item>
         <a-form-model-item label="货位号" prop="shelfPlaceCode">
           <a-input v-model="form.shelfPlaceCode" @input="placeCodeBlur" placeholder="请输入货位号(字母+数字格式)"></a-input>
         </a-form-model-item>
         <a-form-model-item label="绑定产品" prop="productSn">
-          <productJqList ref="productJqList" :params="{customerSn:nowData&&nowData.customerSn}" @change="productJqChange"></productJqList>
+          <productJqList ref="productJqList" dataType="jg" @change="productJqChange"></productJqList>
         </a-form-model-item>
         <a-form-model-item label="车主价">
           <a-input-number
@@ -31,7 +30,6 @@
             :min="0"
             :max="999999"
             placeholder="请输入车主价(最多允许两位小数)"
-            suffix="元"
             style="width: 80%;display: inline-block;" /> 元
         </a-form-model-item>
         <a-form-model-item label="结算价">
@@ -52,7 +50,6 @@
             :min="0"
             :max="999999"
             placeholder="请输入最大库容(正整数或0)"
-            suffix="元"
             style="width: 100%;display: inline-block;" />
         </a-form-model-item>
       </a-form-model>
@@ -68,7 +65,7 @@
 import { commonMixin } from '@/utils/mixin'
 import { VSelect } from '@/components'
 import productJqList from '@/views/common/productJqList.vue'
-import { addPlaceAndProduct } from '@/api/shelf'
+import { shelfTemplateDetailSave } from '@/api/shelfTemplate'
 export default {
   name: 'AddHwModal',
   components: { VSelect, productJqList },
@@ -98,13 +95,14 @@ export default {
         wrapperCol: { span: 18 }
       },
       form: {
-        shelfPlaceCode: '',
-        productSn: undefined,
-        productCode: undefined,
-        price: '',
-        cost: '',
-        maxQty: ''
+        shelfPlaceCode: '', // 货位号
+        productSn: undefined, // 产品sn
+        productCode: undefined, // 产品编码
+        price: '', // 售价(车主价)
+        cost: '', // 成本(结算价)
+        maxQty: '' // 最大库容
       },
+      // 表单校验规则
       rules: {
         shelfPlaceCode: [
           { required: true, message: '请输入货位号', trigger: 'blur' },
@@ -115,8 +113,7 @@ export default {
         ],
         productSn: [{ required: true, message: '请选择产品', trigger: 'blur' }],
         maxQty: [{ required: true, message: '请输入最大库容', trigger: 'blur' }]
-      },
-      productName: ''
+      }
     }
   },
   computed: {
@@ -133,14 +130,13 @@ export default {
   methods: {
     // 选择产品 change
     productJqChange (obj) {
+      console.log(obj)
       this.form.productSn = obj.key || undefined
-      this.form.productCode = obj && obj.row && obj.row.code || ''
-      this.form.price = obj && obj.row && obj.row.price || ''
-      this.form.cost = obj && obj.row && obj.row.cost || ''
-      this.productName = obj && obj.row && obj.row.name || ''
-      this.form.oldPrice = obj && obj.row && obj.row.price || ''
-      this.form.oldCost = obj && obj.row && obj.row.cost || ''
-      this.form.oldMaxQty = ''
+      if (obj && obj.row) {
+        this.form.productCode = obj.row.code || ''
+        this.form.price = obj.row.carOwnersPrice || ''
+        this.form.cost = obj.row.terminalPrice || ''
+      }
     },
     // 货位号变更
     placeCodeBlur (v) {
@@ -155,27 +151,14 @@ export default {
         if (valid) {
           const params = {}
           const form = JSON.parse(JSON.stringify(_this.form))
-          params.shelfSn = _this.nowData && _this.nowData.shelfSn
+          params.templateSn = _this.nowData && _this.nowData.templateSn
           params.shelfPlaceCode = form.shelfPlaceCode.toLocaleUpperCase()
           if (this.type == 'edit') {
-            params.id = this.nowData.id
-          }
-          // 绑定了产品
-          if (form.productSn) {
-            params.shelfProductApiEntity = {
-              productSn: form.productSn,
-              productCode: form.productCode,
-              price: form.price,
-              cost: form.cost,
-              maxQty: form.maxQty,
-              oldPrice: form.oldPrice,
-              oldCost: form.oldCost,
-              oldMaxQty: form.oldMaxQty
-            }
+            params.templateDetailSn = this.nowData.templateDetailSn
           }
           // 开始提交数据
           _this.spinning = true
-          addPlaceAndProduct(params).then(res => {
+          shelfTemplateDetailSave({ ...form, ...params }).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.isShow = false
@@ -192,8 +175,7 @@ export default {
     },
     // 编辑赋值
     setFormData () {
-      console.log(this.nowData)
-      const product = this.nowData.shelfProductApiEntity
+      const product = this.nowData
       this.form.shelfPlaceCode = this.nowData.shelfPlaceCode
       this.form.productSn = product.productSn
       this.form.productCode = product.productCode
@@ -204,7 +186,6 @@ export default {
     },
     // 重置表单
     resetData () {
-      this.productName = ''
       this.form.shelfPlaceCode = ''
       this.form.productSn = undefined
       this.form.productCode = undefined

+ 17 - 17
src/views/numsGoodsShelves/shelfProductTempl/basicInfoModal.vue

@@ -4,7 +4,7 @@
     class="shelfSet-basicInfo-modal"
     :footer="null"
     :maskClosable="false"
-    :title="form.shelfName?'更改名称':'新增模板'"
+    :title="form.templateSn?'更改名称':'新增模板'"
     v-model="isShow"
     @cancel="isShow = false"
     :width="600">
@@ -15,8 +15,8 @@
         :rules="rules"
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol">
-        <a-form-model-item label="模板名称" prop="shelfName">
-          <a-input v-model="form.shelfName" :maxLength="30" placeholder="请输入模板名称"></a-input>
+        <a-form-model-item label="模板名称" prop="templateName">
+          <a-input v-model="form.templateName" :maxLength="30" placeholder="请输入模板名称"></a-input>
         </a-form-model-item>
       </a-form-model>
       <div class="btn-cont">
@@ -30,7 +30,7 @@
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { VSelect } from '@/components'
-import { shelfSave } from '@/api/shelf'
+import { shelfTemplateSave } from '@/api/shelfTemplate'
 export default {
   name: 'ShelfSetBasicInfoModal',
   components: { VSelect },
@@ -46,10 +46,6 @@ export default {
       default: () => {
         return {}
       }
-    },
-    type: {
-      type: [String, Number],
-      default: '1'
     }
   },
   data () {
@@ -61,10 +57,11 @@ export default {
         wrapperCol: { span: 17 }
       },
       form: {
-        shelfName: ''
+        templateName: '',
+        templateSn: undefined
       },
       rules: {
-        shelfName: [{ required: true, message: '请输入模板名称', trigger: 'change' }]
+        templateName: [{ required: true, message: '请输入模板名称', trigger: 'change' }]
       }
     }
   },
@@ -75,19 +72,17 @@ export default {
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
           const form = JSON.parse(JSON.stringify(_this.form))
-          form.shelfSn = _this.nowData && _this.nowData.shelfSn
           _this.spinning = true
-          shelfSave(form).then(res => {
+          shelfTemplateSave(form).then(res => {
             if (res.status == 200) {
               _this.$message.success('保存成功')
-              _this.$emit('ok')
+              _this.$emit('ok', res.data)
               _this.spinning = false
             } else {
               _this.spinning = false
             }
           })
         } else {
-          console.log('error submit!!')
           return false
         }
       })
@@ -105,9 +100,14 @@ export default {
         this.$refs.ruleForm.resetFields()
       } else {
         const _this = this
-        this.$nextTick(() => {
-          _this.form.shelfName = _this.nowData.shelfName
-        })
+        if (_this.nowData) {
+          this.$nextTick(() => {
+            _this.form.templateName = _this.nowData.templateName || ''
+            if (_this.nowData.templateSn) {
+              _this.form.templateSn = _this.nowData.templateSn
+            }
+          })
+        }
       }
     }
   }

+ 62 - 44
src/views/numsGoodsShelves/shelfProductTempl/chooseImportModal.vue

@@ -4,9 +4,9 @@
     class="chooseImport-modal"
     :footer="null"
     :maskClosable="false"
-    title="确认导入"
+    title="确认导入货位"
     v-model="isShow"
-    @cancel="isShow=false"
+    @cancle="isShow=false"
     :width="900">
     <div class="chooseImport-con">
       <!-- 可导入数据 -->
@@ -15,7 +15,7 @@
         class="sTable"
         ref="table"
         size="small"
-        :rowKey="(record) => record.shelfSn"
+        :rowKey="(record) => record.allocateSn"
         :columns="nowColumns"
         :dataSource="loadData"
         :loading="loading"
@@ -27,7 +27,7 @@
       <!-- 不可导入数据 -->
       <p class="red">不可导入数据{{ unLoadData.length }}条</p>
       <a-table
-        class="sTable unTable"
+        class="unTable"
         ref="unTable"
         size="small"
         :rowKey="(record) => record.errorDesc"
@@ -44,22 +44,33 @@
           type="primary"
           id="chooseImport-submit"
           size="large"
+          :disabled="disabled"
           :class="loadData.length==0?'button-grey':'button-primary'"
           @click="handleSubmit"
           style="padding: 0 40px;">确认导入</a-button>
         <a-button
           id="chooseImport-cancel"
           size="large"
+          :disabled="disabled"
           class="button-cancel"
           @click="isShow=false"
           style="padding: 0 40px;margin-left: 15px;">取消</a-button>
+        <a-button
+          type="primary"
+          id="chooseImport-error"
+          size="large"
+          :disabled="disabled"
+          class="button-error"
+          @click="handleError"
+          style="padding: 0 40px;margin-left: 15px;">导出错误项</a-button>
       </div>
     </div>
   </a-modal>
 </template>
 
 <script>
-import { shelfProductParseProducts } from '@/api/shelf'
+import { hdExportExcel } from '@/libs/exportExcel'
+import { shelfTemplateImportDetailError } from '@/api/shelfTemplate'
 import { toThousands } from '@/libs/tools.js'
 export default {
   name: 'ChooseImportModal',
@@ -80,60 +91,67 @@ export default {
     return {
       toThousands,
       isShow: this.openModal, //  是否打开弹框
-      nowColumns: [ //  可导入
-        { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
-        { title: '货位号', dataIndex: 'shelfPlaceCode', width: '19%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '绑定产品编码', dataIndex: 'productCode', width: '17%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '绑定产品名称', dataIndex: 'productName', width: '26%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '车主价', dataIndex: 'price', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } },
-        { title: '结算价', dataIndex: 'cost', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } },
-        { title: '最大库容', dataIndex: 'maxQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
+      nowColumns: [
+        { title: '序号', dataIndex: 'no', width: '8%', align: 'center' },
+        { title: '货位号', dataIndex: 'shelfPlaceCode', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'productCode', width: '35%', align: 'center', customRender: function (text) { return text || '--' } },
+        // { title: '产品名称', dataIndex: 'productName', width: '45%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '车主价', dataIndex: 'price', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) && text.length ? _this.toThousands(text, 2) : '--') } },
+        { title: '结算价', dataIndex: 'cost', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) && text.length ? _this.toThousands(text, 2) : '--') } },
+        { title: '最大库容', dataIndex: 'maxQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
       ],
-      nowUnColumns: [ //  不可导入
-        { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
-        { title: '货位号', dataIndex: 'shelfPlaceCode', width: '18%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '绑定产品编码', dataIndex: 'productCode', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '绑定产品名称', dataIndex: 'productName', width: '20%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '车主价', dataIndex: 'price', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } },
-        { title: '结算价', dataIndex: 'cost', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } },
+      loadData: [],
+      nowUnColumns: [
+        { title: '序号', dataIndex: 'no', width: '8%', align: 'center' },
+        { title: '货位号', dataIndex: 'shelfPlaceCode', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'productCode', width: '35%', align: 'center', customRender: function (text) { return text || '--' } },
+        // { title: '产品名称', dataIndex: 'productName', width: '30%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '车主价', dataIndex: 'price', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) && text.length ? _this.toThousands(text, 2) : '--') } },
+        { title: '结算价', dataIndex: 'cost', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) && text.length ? _this.toThousands(text, 2) : '--') } },
         { title: '最大库容', dataIndex: 'maxQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '错误原因', dataIndex: 'remarks', width: '17%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true }
+        { title: '错误原因', dataIndex: 'remark', width: '25%', align: 'center', customRender: function (text) { return text || '--' } }
       ],
-      loadData: [],
       unLoadData: [],
-      loading: false
+      loading: false,
+      disabled: false
     }
   },
   methods: {
     getData () {
-      const _this = this
-      this.loading = true
-      shelfProductParseProducts(this.paramsData).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 || []
-        }
+      const paramsData = JSON.parse(JSON.stringify(this.paramsData))
+      this.loadData = paramsData.rightList || []
+      this.unLoadData = paramsData.errorList || []
+      this.loadData.map((item, index) => {
+        item.no = index + 1
+        item.templateSn = paramsData.templateSn
+      })
+      this.unLoadData.map((item, index) => {
+        item.no = index + 1
+        item.templateSn = paramsData.templateSn
       })
     },
     // 确认导入
     handleSubmit () {
-      if (this.loadData.length == 0) {
-        this.$message.warning('无可导入产品!')
+      if (this.paramsData.rightList.length == 0) {
+        this.$message.warning('无可导入的货位!')
       } else {
-        this.$emit('ok', this.loadData)
+        const data = this.paramsData.rightList
+
+        this.$emit('ok', data)
         this.isShow = false
       }
+    },
+    // 导出
+    handleError () {
+      const _this = this
+      if (_this.paramsData.errorList.length < 1) {
+        _this.$message.info('暂无可导出错误项~')
+        return
+      }
+      _this.spinning = true
+      hdExportExcel(shelfTemplateImportDetailError, _this.paramsData.errorList, '货架模板货位错误项', function () {
+        _this.spinning = false
+      })
     }
   },
   watch: {

+ 15 - 20
src/views/numsGoodsShelves/shelfProductTempl/importGuideModal.vue

@@ -39,10 +39,11 @@
               ref="importUpload"
               :maxNums="1"
               fileType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
-              uploadType="import"
+              uploadType="attach"
               :action="attachAction"
               :uploadParams="uploadParams"
-              upText="添加文件"
+              upText="选择导入文件"
+              @remove="resetSearchForm"
               @change="changeImport"></Upload>
           </div>
         </div>
@@ -70,10 +71,8 @@
 </template>
 
 <script>
-import { hdPrint } from '@/libs/JGPrint.js'
 import ChooseImportModal from './chooseImportModal.vue'
 import { Upload } from '@/components'
-import { shelfProductDownload } from '@/api/shelf'
 export default {
   name: 'ImportGuideModal',
   components: { ChooseImportModal, Upload },
@@ -91,15 +90,21 @@ export default {
     return {
       isShow: this.openModal, //  是否打开弹框
       openImportModal: false, //  导入
-      attachAction: process.env.VUE_APP_API_BASE_URL + '/upload',
+      attachAction: process.env.VUE_APP_API_BASE_URL + '/shelfTemplate/detail/importDetail',
       filePath: location.protocol + '//' + location.host + '/templ/绑定产品导入模板.xlsx',
       paramsData: null,
       uploadParams: {
-        savePathType: 'local'
+        savePathType: 'local',
+        templateSn: this.params.templateSn
       }
     }
   },
   methods: {
+    // 清空数据
+    resetSearchForm () {
+      this.$refs.importUpload.setFileList() //  清空导入文件
+      this.paramsData = null //  清空上传数据
+    },
     // 下一步
     handlerNextStep () {
       if (this.paramsData) {
@@ -110,11 +115,10 @@ export default {
     },
     // 上传文件  change
     changeImport (file) {
-      if (file) {
-        this.paramsData = {
-          shelfSn: this.params.shelfSn || '',
-          path: file
-        }
+      if (file && JSON.parse(file).length > 0) {
+        this.paramsData = Object.assign({}, JSON.parse(file)[0] || null, this.params)
+      } else {
+        this.paramsData = null
       }
     },
     // 导入
@@ -128,15 +132,6 @@ export default {
     handleClose () {
       this.openImportModal = false
       this.isShow = false
-    },
-    //  导出
-    handleExport () {
-      const _this = this
-      _this.spinning = true
-      // 导出
-      hdPrint('', 'export', shelfProductDownload, _this.params, '导入绑定产品模板', function () {
-        _this.spinning = false
-      })
     }
   },
   watch: {

+ 29 - 24
src/views/numsGoodsShelves/shelfProductTempl/list.vue

@@ -7,14 +7,14 @@
           <a-row :gutter="15">
             <a-col :md="6" :sm="24">
               <a-form-item label="模板名称">
-                <a-input v-model.trim="queryParam.tempName" allowClear placeholder="请输入模板名称"/>
+                <a-input v-model.trim="queryParam.templateName" allowClear placeholder="请输入模板名称"/>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="模板类型">
                 <v-select
-                  v-model="queryParam.tempType"
-                  code="FLAG"
+                  v-model="queryParam.sysFlag"
+                  code="SHELF_TEMPLATE_SYS_FLAG"
                   placeholder="请选择模板类型"
                   allowClear></v-select>
               </a-form-item>
@@ -42,21 +42,21 @@
         :defaultLoadData="false"
         bordered>
         <!-- 模板名称 -->
-        <template slot="tempName" slot-scope="text, record">
-          <span class="table-td-link" @click="handleDetail(record)">{{ record.shelfName }}</span>
+        <template slot="templateName" slot-scope="text, record">
+          <span class="table-td-link" @click="handleDetail(record)">{{ record.templateName }}</span>
         </template>
         <!-- 操作 -->
         <template slot="action" slot-scope="text, record">
           <div>
-            <a-button size="small" type="link" class="button-primary" @click="addTemp(record)">更改名称</a-button>
+            <a-button size="small" v-if="record.sysFlag==0" type="link" class="button-primary" @click="addTemp(record)">更改名称</a-button>
             <a-button size="small" type="link" class="button-primary" @click="handleCopy(record)">复制</a-button>
-            <a-button size="small" type="link" class="button-error" @click="handleCancel(record)">删除</a-button>
+            <a-button size="small" v-if="record.sysFlag==0" type="link" class="button-error" @click="handleCancel(record)">删除</a-button>
           </div>
         </template>
       </s-table>
     </a-spin>
     <!-- 基础设置 -->
-    <basic-info-modal :type="0" :openModal="openModal" :nowData="nowData" @ok="handleDetail" @close="openModal=false" />
+    <basic-info-modal :openModal="openModal" :nowData="nowData" @ok="saveOk" @close="openModal=false" />
   </a-card>
 </template>
 
@@ -65,7 +65,7 @@ import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import basicInfoModal from './basicInfoModal.vue'
 import commonModal from '@/views/common/commonModal.vue'
-import { shelfList, shelfModifState } from '@/api/shelf'
+import { shelfTemplateList, shelfTemplateCopy, shelfTemplateDel } from '@/api/shelfTemplate'
 export default {
   name: 'ShelfProductTemplList',
   components: { STable, VSelect, basicInfoModal, commonModal },
@@ -76,21 +76,21 @@ export default {
       tableHeight: 0,
       disabled: false, //  查询、重置按钮是否可操作
       queryParam: {
-        tempName: '', // 模板名称
-        tempType: undefined // 模板类型
+        templateName: '', // 模板名称
+        sysFlag: undefined // 模板类型
       },
       columns: [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '模板类型', dataIndex: 'tempType', width: '20%', align: 'left' },
-        { title: '模板名称', scopedSlots: { customRender: 'tempName' }, width: '50%', align: 'left', ellipsis: true },
-        { title: '产品款数', dataIndex: 'qty', width: '15%', align: 'center' },
+        { title: '模板类型', dataIndex: 'sysFlagDictValue', width: '20%', align: 'center' },
+        { title: '模板名称', scopedSlots: { customRender: 'templateName' }, width: '50%', align: 'left', ellipsis: true },
+        { title: '产品款数', dataIndex: 'productCategory', width: '15%', align: 'center' },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '11%', align: 'center' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
-        return shelfList(Object.assign(parameter, this.queryParam)).then(res => {
+        return shelfTemplateList(Object.assign(parameter, this.queryParam)).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
@@ -111,15 +111,15 @@ export default {
   methods: {
     // 新增/修改模板
     addTemp (row) {
-      this.nowData = row
+      this.nowData = row || {}
       this.openModal = true
     },
     // 模板详情设置
     handleDetail (data) {
-      this.$router.push({ name: 'shelfProductTemplSetting', params: { sn: data.shelfSn } })
+      this.$router.push({ name: 'shelfProductTemplSetting', params: { sn: data.templateSn } })
     },
     // 复制模板
-    handleCopy (row) {
+    handleCopy (record) {
       const _this = this
       this.$confirm({
         title: '提示',
@@ -128,8 +128,8 @@ export default {
         closable: true,
         onOk () {
           _this.spinning = true
-          shelfModifState({
-            shelfSn: record.shelfSn
+          shelfTemplateCopy({
+            templateSn: record.templateSn
           }).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
@@ -150,8 +150,8 @@ export default {
         closable: true,
         onOk () {
           _this.spinning = true
-          shelfModifState({
-            shelfSn: record.shelfSn
+          shelfTemplateDel({
+            templateSn: record.templateSn
           }).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
@@ -162,10 +162,15 @@ export default {
         }
       })
     },
+    // 保存成功
+    saveOk () {
+      this.$refs.table.refresh(true)
+      this.openModal = false
+    },
     // 重置
     resetSearchForm () {
-      this.queryParam.tempName = ''
-      this.queryParam.tempType = undefined
+      this.queryParam.templateName = ''
+      this.queryParam.sysFlag = undefined
       this.$refs.table.refresh(true)
     },
     // 表格高度

+ 17 - 17
src/views/numsGoodsShelves/shelfProductTempl/set.vue

@@ -5,7 +5,7 @@
         <!-- 自定义的二级文字标题 -->
         <template slot="subTitle">
           <a href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
-          <span style="margin-left:10px;" v-if="basicInfoData">模板名称:{{ basicInfoData&&basicInfoData.shelfName || '--' }}</span>
+          <span style="margin-left:10px;" v-if="basicInfoData">模板名称:{{ basicInfoData&&basicInfoData.templateName || '--' }}</span>
         </template>
       </a-page-header>
       <!-- 页面内容 -->
@@ -34,7 +34,7 @@
           </a-form>
         </div>
         <!-- 操作按钮 -->
-        <div class="table-operator" v-if="basicInfoData&&basicInfoData.state!='WRITE_OFF'&&basicInfoData.state!='SUSPEND'">
+        <div class="table-operator" v-if="basicInfoData&&basicInfoData.sysFlag==0">
           <a-button type="primary" class="button-error" @click="addHW">新增</a-button>
           <a-button type="primary" class="button-info" @click="openGuideModal=true">导入</a-button>
         </div>
@@ -47,7 +47,6 @@
           :rowKey="(record) => record.id"
           :columns="columns"
           :data="loadData"
-          :showPagination="false"
           :defaultLoadData="false"
           bordered>
           <span slot="customTitle">
@@ -80,7 +79,7 @@
     <!-- 编辑、新增 -->
     <addHwModal :openModal="openHwModal" :type="modalType" :nowData="nowData" @ok="$refs.table.refresh()" @close="handleCancel" />
     <!-- 导入产品 -->
-    <importGuideModal :openModal="openGuideModal" :params="{shelfSn: $route.params.sn}" @close="openGuideModal=false" @ok="handleGuideOk" />
+    <importGuideModal :openModal="openGuideModal" :params="{templateSn: $route.params.sn}" @close="openGuideModal=false" @ok="handleGuideOk" />
   </div>
 </template>
 
@@ -90,7 +89,7 @@ import { STable, VSelect } from '@/components'
 import commonModal from '@/views/common/commonModal.vue'
 import addHwModal from './addHwModal.vue'
 import ImportGuideModal from './importGuideModal.vue'
-import { shelfDetail, shelfProductList, shelfProductBatchInsert, delShelfPlaceSn, shelfProductEnable } from '@/api/shelf'
+import { shelfTemplateDetail, shelfTemplateDetailList, shelfTemplateDetailBySn, shelfTemplateDetailImportSave } from '@/api/shelfTemplate'
 export default {
   name: 'ShelfMonitoringWarehousing',
   components: { STable, VSelect, commonModal, addHwModal, ImportGuideModal },
@@ -108,15 +107,16 @@ export default {
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
-        return shelfProductList(Object.assign(parameter, this.queryParam, { shelfSn: this.$route.params.sn })).then(res => {
+        return shelfTemplateDetailList(Object.assign(parameter, this.queryParam, { templateSn: this.$route.params.sn })).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
-            for (var i = 0; i < data.length; i++) {
-              data[i].no = i + 1
+            const no = (data.pageNo - 1) * data.pageSize
+            for (var i = 0; i < data.list.length; i++) {
+              data.list[i].no = no + i + 1
             }
-            this.disabled = false
           }
+          this.disabled = false
           this.spinning = false
           return data
         })
@@ -134,10 +134,10 @@ export default {
       const ret = [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
         { title: '货位号', dataIndex: 'shelfPlaceCode', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品编码', dataIndex: 'shelfProductApiEntity.productCode', width: '25%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '车主价', dataIndex: 'shelfProductApiEntity.price', width: '15%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } },
-        { slots: { title: 'customTitle' }, dataIndex: 'shelfProductApiEntity.cost', width: '15%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } },
-        { title: '最大库容', dataIndex: 'shelfProductApiEntity.maxQty', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
+        { title: '产品编码', dataIndex: 'productCode', width: '25%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '车主价', dataIndex: 'price', width: '15%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } },
+        { slots: { title: 'customTitle' }, dataIndex: 'cost', width: '15%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } },
+        { title: '最大库容', dataIndex: 'maxQty', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
       ]
       // 内置模板没有操作这一列
       ret.push({ title: '操作', scopedSlots: { customRender: 'action' }, width: '15%', align: 'center' })
@@ -160,7 +160,7 @@ export default {
     // 绑定产品/修改信息
     handleProduct (row, type) {
       if (row) {
-        this.nowData = Object.assign(row, { customerSn: this.basicInfoData && this.basicInfoData.customerEntity && this.basicInfoData.customerEntity.customerSn })
+        this.nowData = Object.assign(row, { templateSn: this.basicInfoData && this.basicInfoData.templateSn })
       } else {
         this.nowData = this.basicInfoData
       }
@@ -176,7 +176,7 @@ export default {
     },
     // 基本信息
     getDetail () {
-      shelfDetail({ sn: this.$route.params.sn }).then(res => {
+      shelfTemplateDetail({ templateSn: this.$route.params.sn }).then(res => {
         if (res.status == 200) {
           this.basicInfoData = res.data
         } else {
@@ -193,7 +193,7 @@ export default {
         centered: true,
         onOk () {
           _this.spinning = true
-          delShelfPlaceSn({ shelfPlaceSn: row.shelfPlaceSn }).then(res => {
+          shelfTemplateDetailBySn({ templateDetailSn: row.templateDetailSn }).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$refs.table.refresh()
@@ -205,7 +205,7 @@ export default {
     },
     // 导入成功
     handleGuideOk (obj) {
-      shelfProductBatchInsert(obj).then(res => {
+      shelfTemplateDetailImportSave(obj).then(res => {
         if (res.status == 200) {
           this.$refs.table.refresh(true)
         }