lilei 1 年之前
父节点
当前提交
3844aa4f20

+ 28 - 27
src/views/numsGoodsShelves/shelfSet/addHwModal.vue

@@ -18,10 +18,10 @@
         :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-input id="shelfSet-newHw-shelfPlaceCode" v-model="form.shelfPlaceCode" @input="placeCodeBlur" placeholder="请输入货位号(字母+数字格式)"></a-input>
         </a-form-model-item>
         <a-form-model-item label="绑定产品" v-if="type=='add'">
-          <productJqList ref="productJqList" :params="{customerSn:nowData&&nowData.customerSn}" @change="productJqChange"></productJqList>
+          <productJqList id="shelfSet-newHw-product" ref="productJqList" :params="{customerSn:nowData&&nowData.customerSn}" @change="productJqChange"></productJqList>
         </a-form-model-item>
         <a-form-model-item label="产品名称" v-if="form.productSn">{{ productName || '--' }}</a-form-model-item>
         <a-form-model-item v-if="form.productSn" label="车主价" prop="price">
@@ -68,22 +68,22 @@
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { VSelect } from '@/components'
-import productJqList from '@/views/common/productJqList.vue'
-import { addPlaceAndProduct } from '@/api/shelf'
+import productJqList from '@/views/common/productJqList.vue' // 货架产品列表组件
+import { addPlaceAndProduct } from '@/api/shelf' // 接口
 export default {
   name: 'AddHwModal',
   components: { VSelect, productJqList },
   mixins: [commonMixin],
   props: {
-    openModal: { //  弹框显示状态
+    openModal: { // 弹框显示状态
       type: Boolean,
       default: false
     },
-    type: {
+    type: { // 编辑or新增
       type: String,
       default: ''
     },
-    nowData: {
+    nowData: { // 当前操作数据
       type: Object,
       default: () => {
         return {}
@@ -98,30 +98,30 @@ export default {
         labelCol: { span: 4 },
         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' },
-          {
-          	pattern: /^[a-zA-Z]{1}[0-9]{1,29}$/g,
-          	message: '货位号必需字母+数字,且不能超过30个字符'
-          }
+          { pattern: /^[a-zA-Z]{1}[0-9]{1,29}$/g, message: '货位号必需字母+数字,且不能超过30个字符' }
         ],
         price: [{ required: true, message: '请输入销售价', trigger: 'blur' }],
         cost: [{ required: true, message: '请输入结算价', trigger: 'blur' }],
         maxQty: [{ required: true, message: '请输入最大库容', trigger: 'blur' }]
       },
-      productName: ''
+      productName: '' // 产品名称
     }
   },
   computed: {
+    // 弹框标题
     modalTit () {
       let title = ''
       if (this.type == 'edit') {
@@ -133,7 +133,7 @@ export default {
     }
   },
   methods: {
-    // 产品 change
+    // 选择产品
     productJqChange (obj) {
       this.form.productSn = obj.key || undefined
       this.form.productCode = obj && obj.row && obj.row.code || ''
@@ -144,12 +144,13 @@ export default {
       this.form.oldCost = obj && obj.row && obj.row.cost || ''
       this.form.oldMaxQty = ''
     },
+    // 货位号变更
     placeCodeBlur (v) {
-    	this.$nextTick(() => {
-    		this.form.shelfPlaceCode = this.form.shelfPlaceCode.toLocaleUpperCase()
-    	})
+      this.$nextTick(() => {
+        this.form.shelfPlaceCode = this.form.shelfPlaceCode.toLocaleUpperCase()
+      })
     },
-    //  保存
+    // 保存
     handleSave () {
       const _this = this
       this.$refs.ruleForm.validate(valid => {
@@ -181,16 +182,15 @@ export default {
               _this.$message.success(res.message)
               _this.isShow = false
               _this.$emit('ok', res.data)
-              _this.spinning = false
-            } else {
-              _this.spinning = false
             }
+            _this.spinning = false
           })
         } else {
           return false
         }
       })
     },
+    // 重置表单
     resetData () {
       this.form.productSn = undefined
       this.form.productCode = undefined
@@ -201,6 +201,7 @@ export default {
         this.$refs.productJqList.resetForm()
       }
       this.$refs.ruleForm.resetFields(['productSn'])
+      this.productName = ''
     }
   },
   watch: {
@@ -213,8 +214,8 @@ export default {
       if (!newValue) {
         this.$emit('close')
         this.resetData()
-        this.productName = ''
       } else {
+        // 如果是编辑
         if (this.type == 'edit') {
           this.form.shelfPlaceCode = this.nowData.shelfPlaceCode
         }

+ 14 - 13
src/views/numsGoodsShelves/shelfSet/basicInfoModal.vue

@@ -18,7 +18,7 @@
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol">
         <a-form-model-item label="货架名称" v-if="type==1" prop="shelfName">
-          <a-input v-model="form.shelfName" :maxLength="30" placeholder="请输入货架名称"></a-input>
+          <a-input id="shelfSet-basicInfo-modal-shelfName" v-model="form.shelfName" :maxLength="30" placeholder="请输入货架名称"></a-input>
         </a-form-model-item>
         <a-form-model-item prop="customerSn">
           <template slot="label">
@@ -29,7 +29,7 @@
               关联客户<a-icon type="question-circle" style="color: rgba(0,0,0,.65);font-size: 16px;margin-left: 2px;vertical-align: sub;cursor: pointer;" />
             </a-tooltip>
           </template>
-          <custList ref="custList" :dealerFlag="0" :isEnabled="true" @change="custChange"></custList>
+          <custList id="shelfSet-basicInfo-modal-custList" ref="custList" :dealerFlag="0" :isEnabled="true" @change="custChange"></custList>
         </a-form-model-item>
         <a-form-model-item prop="showPrice">
           <template slot="label">
@@ -40,7 +40,7 @@
               价格权限设置<a-icon type="question-circle" style="color: rgba(0,0,0,.65);font-size: 16px;margin-left: 2px;vertical-align: sub;cursor: pointer;" />
             </a-tooltip>
           </template>
-          <a-checkbox-group v-model="form.showPrice">
+          <a-checkbox-group v-model="form.showPrice" id="shelfSet-basicInfo-showPrice-checkbox">
             <div style="display: flex;padding:10px 0;">
               <div style="width: 80px;font-weight: bold;">货架产品:</div>
               <a-checkbox value="shelf_price_show">
@@ -81,17 +81,17 @@ export default {
   mixins: [commonMixin],
   props: {
     openModal: {
-      //  弹框显示状态
+      // 弹框显示状态
       type: Boolean,
       default: false
     },
-    nowData: {
+    nowData: { // 当前操作数据
       type: Object,
       default: () => {
         return {}
       }
     },
-    type: {
+    type: { // 新增or查看
       type: [String, Number],
       default: '1'
     }
@@ -105,19 +105,19 @@ export default {
         wrapperCol: { span: 17 }
       },
       form: {
-        customerSn: undefined,
-        shelfName: '',
-        showPrice: undefined
+        customerSn: undefined, // 关联客户sn
+        shelfName: '', // 货架名称
+        showPrice: undefined // 价格显示
       },
       rules: {
         shelfName: [{ required: true, message: '请输入货架名称', trigger: 'change' }],
-        customerSn: [{ required: true, message: '请选择关联客户', trigger: 'change' }],
+        customerSn: [{ required: true, message: '请选择关联客户', trigger: 'change' }]
         // showPrice: [{ required: true, message: '请选择价格显示', trigger: 'change' }]
       }
     }
   },
   methods: {
-    // 客户 change
+    // 选择关联客户
     custChange (obj, row) {
       this.form.customerSn = row && row.customerSn || undefined
     },
@@ -129,6 +129,7 @@ export default {
           const form = JSON.parse(JSON.stringify(_this.form))
           form.shelfSn = _this.nowData && _this.nowData.shelfSn
           _this.spinning = true
+          // 保存货架信息
           shelfSave(form).then(res => {
             if (res.status == 200) {
               const paramValue = []
@@ -138,7 +139,7 @@ export default {
                   paramValue: form.showPrice.includes(item.paramCode) ? 1 : 0
                 })
               })
-              // 更新价格显示
+              // 更新价格显示设置
               updateShelfPriceShow({
                 shelfSn: form.shelfSn,
                 paramValue: paramValue
@@ -159,7 +160,6 @@ export default {
             }
           })
         } else {
-          console.log('error submit!!')
           return false
         }
       })
@@ -182,6 +182,7 @@ export default {
           _this.form.shelfName = _this.nowData.shelfName
           _this.form.showPrice = _this.nowData.showPrice.filter(item => item.paramValue == 1).map(item => item.paramCode)
           const custome = _this.nowData.customerEntity
+          // 如果关联了客户
           if (custome) {
             _this.form.customerSn = custome.customerSn || ''
             _this.$refs.custList.fetchUser(custome.customerName || '')

+ 13 - 12
src/views/numsGoodsShelves/shelfSet/bindProductModal.vue

@@ -23,7 +23,7 @@
           <p style="margin: 0;">{{ productInfo&&productInfo.productName || '--' }}</p>
         </a-form-model-item>
         <a-form-model-item :label="type!='bind'?'新绑定产品':'绑定产品'" prop="productSn" v-if="type!='edit'">
-          <productJqList ref="productJqList" :params="{customerSn:nowData&&nowData.customerSn}" @change="productJqChange"></productJqList>
+          <productJqList id="shelfSet-bindProduct-product" ref="productJqList" :params="{customerSn:nowData&&nowData.customerSn}" @change="productJqChange"></productJqList>
           <span v-if="form.productSn">{{ productName || '--' }}</span>
         </a-form-model-item>
         <a-form-model-item label="车主价" prop="price">
@@ -80,11 +80,11 @@ export default {
       type: Boolean,
       default: false
     },
-    type: {
+    type: { // 编辑、新增
       type: String,
       default: ''
     },
-    nowData: {
+    nowData: { // 当前操作数据
       type: Object,
       default: () => {
         return {}
@@ -100,11 +100,11 @@ export default {
         wrapperCol: { span: 18 }
       },
       form: {
-        productSn: undefined,
-        productCode: undefined,
-        price: '',
-        cost: '',
-        maxQty: ''
+        productSn: undefined, // 产品sn
+        productCode: undefined, // 产品编码
+        price: '', // 车主价
+        cost: '', // 结算价
+        maxQty: '' // 最大库容
       },
       rules: {
         productSn: [{ required: true, message: '请选择绑定产品', trigger: 'change' }],
@@ -112,11 +112,12 @@ export default {
         cost: [{ required: true, message: '请输入结算价', trigger: 'change' }],
         maxQty: [{ required: true, message: '请输入最大库容', trigger: 'change' }]
       },
-      productName: '',
-      productInfo: null
+      productName: '', // 产品名称
+      productInfo: null // 产品信息
     }
   },
   computed: {
+    // 弹框标题
     modalTit () {
       let title = ''
       if (this.type == 'edit') {
@@ -130,7 +131,7 @@ export default {
     }
   },
   methods: {
-    // 产品 change
+    // 选择产品
     productJqChange (obj) {
       this.form.productSn = obj.key || undefined
       this.form.productCode = obj && obj.row && obj.row.code || ''
@@ -167,7 +168,6 @@ export default {
             }
           })
         } else {
-          console.log('error submit!!')
           return false
         }
       })
@@ -193,6 +193,7 @@ export default {
         }
       })
     },
+    // 重置表单
     resetData () {
       this.productName = ''
       this.productInfo = null

+ 6 - 3
src/views/numsGoodsShelves/shelfSet/chooseImportModal.vue

@@ -68,7 +68,7 @@ export default {
       type: Boolean,
       default: false
     },
-    paramsData: {
+    paramsData: { // 参数
       type: Object,
       default: () => {
         return {}
@@ -99,23 +99,26 @@ export default {
         { 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 }
       ],
-      loadData: [],
-      unLoadData: [],
+      loadData: [], // 正常表格数据
+      unLoadData: [], // 错误表格数据
       loading: 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

+ 11 - 8
src/views/numsGoodsShelves/shelfSet/chooseShelfImportModal.vue

@@ -79,7 +79,7 @@ export default {
       type: Boolean,
       default: false
     },
-    paramsData: {
+    paramsData: { // 参数
       type: Object,
       default: () => {
         return {}
@@ -96,27 +96,28 @@ export default {
         { title: '货位号', dataIndex: 'shelfPlaceCode', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品编码', dataIndex: 'productCode', width: '15%', 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: '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 : '--') } }
       ],
-      loadData: [],
+      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: '15%', 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: '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: '15%', align: 'center', customRender: function (text) { return text || '--' } }
       ],
-      unLoadData: [],
+      unLoadData: [], // 错误列表数据
       loading: false,
       disabled: false
     }
   },
   methods: {
+    // 获取解析后的数据
     getData () {
       const _this = this
       this.loading = true
@@ -129,11 +130,13 @@ export default {
         this.loading = false
         this.disabled = 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
@@ -159,7 +162,7 @@ export default {
         })
       }
     },
-    // 导出
+    // 导出错误项
     handleError () {
       const _this = this
       if (_this.unLoadData.length < 1) {

+ 3 - 13
src/views/numsGoodsShelves/shelfSet/importGuideModal.vue

@@ -73,7 +73,6 @@
 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 },
@@ -82,7 +81,7 @@ export default {
       type: Boolean,
       default: false
     },
-    params: {
+    params: { // 参数
       type: Object,
       default: null
     }
@@ -93,9 +92,9 @@ export default {
       openImportModal: false, //  导入
       attachAction: process.env.VUE_APP_API_BASE_URL + '/upload',
       filePath: location.protocol + '//' + location.host + '/templ/绑定产品导入模板.xlsx',
-      paramsData: null,
+      paramsData: null, // 参数
       uploadParams: {
-        savePathType: 'local'
+        savePathType: 'local' // 保存到本地
       }
     }
   },
@@ -128,15 +127,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: {

+ 5 - 6
src/views/numsGoodsShelves/shelfSet/importHuoweiModal.vue

@@ -83,7 +83,7 @@ export default {
       type: Boolean,
       default: false
     },
-    shelfSn: {
+    shelfSn: { // 货架sn
       type: [String, Number],
       default: ''
     }
@@ -92,9 +92,9 @@ export default {
     return {
       isShow: this.openModal, //  是否打开弹框
       openImportModal: false, //  导入
-      filePath: location.protocol + '//' + location.host + '/templ/货位导入模板.xlsx',
-      attachAction: process.env.VUE_APP_API_BASE_URL + '/upload',
-      paramsData: null,
+      filePath: location.protocol + '//' + location.host + '/templ/货位导入模板.xlsx', // 模板地址
+      attachAction: process.env.VUE_APP_API_BASE_URL + '/upload', // 统一上传接口
+      paramsData: null, // 参数
       uploadParams: {
         savePathType: 'local'
       }
@@ -109,14 +109,13 @@ export default {
         this.$message.warning('添加文件后再进行下一步操作!')
       }
     },
-    // 上传文件  change
+    // 上传文件成功
     changeImport (file) {
       if (file) {
         this.paramsData = {
           shelfSn: this.shelfSn || '',
           path: file
         }
-        console.log(this.paramsData, 'this.paramsData')
       }
     },
     // 导入

+ 52 - 36
src/views/numsGoodsShelves/shelfSet/list.vue

@@ -7,12 +7,12 @@
           <a-row :gutter="15">
             <a-col :md="6" :sm="24">
               <a-form-item label="货架名称">
-                <shelfSList v-model="queryParam.shelfSn"></shelfSList>
+                <shelfSList v-model="queryParam.shelfSn" id="shelfSetList-shelfName"></shelfSList>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="关联客户">
-                <custList ref="custList" :dealerFlag="0" @change="custChange" :isEnabled="true"></custList>
+                <custList ref="custList" id="shelfSetList-custList" :dealerFlag="0" @change="custChange" :isEnabled="true"></custList>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
@@ -51,9 +51,9 @@
         bordered>
         <!-- 货架名称 -->
         <template slot="shelfName" slot-scope="text, record">
-           {{record.shelfName}}
-           <a-badge count="已注销" :number-style="{ zoom:'80%',marginLeft:'5px', color: '#fff',background:'#999' }" v-if="record.state=='WRITE_OFF'"></a-badge>
-           <a-badge count="已暂停" :number-style="{ zoom:'80%',marginLeft:'5px', color: '#fff',background:'#999' }" v-if="record.state=='SUSPEND'"></a-badge>
+          {{ record.shelfName }}
+          <a-badge count="已注销" :number-style="{ zoom:'80%',marginLeft:'5px', color: '#fff',background:'#999' }" v-if="record.state=='WRITE_OFF'"></a-badge>
+          <a-badge count="已暂停" :number-style="{ zoom:'80%',marginLeft:'5px', color: '#fff',background:'#999' }" v-if="record.state=='SUSPEND'"></a-badge>
         </template>
         <!-- 货位数量 -->
         <template slot="shelfPlaceNum" slot-scope="text, record">
@@ -72,6 +72,7 @@
             v-if="record.finishFlag!=undefined"
             @change="changeStatus(record)"
             :checked="record.finishFlag == 1"
+            id="shelfSetList-finishFlag"
           />
           <span v-else :style="{ color: record.finishFlag == 1 ? '#00aa00' : '#999' }">
             {{ record.finishFlag == 1 ? '是' : (record.finishFlag!=undefined?'否':'--') }}
@@ -86,6 +87,7 @@
             v-if="record.state!=undefined"
             @change="enableShelf(record)"
             :checked="record.state == 'ENABLE'"
+            id="shelfSetList-state"
           />
           <span v-else :style="{ color: record.state == 'ENABLE' ? '#00aa00' : '#999' }">
             {{ record.state == 'ENABLE' ? '启用' : (record.state!=undefined&&record.state!='WRITE_OFF'&&record.state!='SUSPEND'?'停用':'--') }}
@@ -94,14 +96,20 @@
         <!-- 操作 -->
         <template slot="action" slot-scope="text, record">
           <div>
-            <a-button size="small" type="link" class="button-primary" @click="handleSet(record)">{{record.state!='WRITE_OFF'&&record.state!='SUSPEND'?'货架设置':'查看'}}</a-button>
-            <a-button size="small" type="link" class="button-primary" v-if="record.state!='WRITE_OFF'&&record.state!='SUSPEND'" @click="handleCancel(record)">注销</a-button>
+            <a-button id="shelfSetList-setView" size="small" type="link" class="button-primary" @click="handleSet(record)">{{ record.state!='WRITE_OFF'&&record.state!='SUSPEND'?'货架设置':'查看' }}</a-button>
+            <a-button
+              id="shelfSetList-cancel"
+              size="small"
+              type="link"
+              class="button-primary"
+              v-if="record.state!='WRITE_OFF'&&record.state!='SUSPEND'"
+              @click="handleCancel(record)">注销</a-button>
           </div>
         </template>
       </s-table>
     </a-spin>
     <!-- 基础设置 -->
-    <basic-info-modal :type="0" :openModal="openModal" :nowData="nowData" @ok="handleOk" @close="openModal=false" />
+    <basic-info-modal :type="0" :openModal="openModal" :nowData="nowData" @ok="handleOkToSet" @close="openModal=false" />
     <a-modal
       centered
       class="common-modal"
@@ -117,8 +125,8 @@
         <div style="font-size:12px;color:#999;margin-top:10px;">如需要迁移该数字货架的数据,可去货架设置中导出货架信息</div>
       </div>
       <div class="btn-box" style="display: flex;align-items: center;justify-content: center;margin-top:25px;">
-        <a-button type="primary" @click="handleCommonOk">确定</a-button>
-        <a-button type="default" class="button-warning" @click="showTip=false">取消</a-button>
+        <a-button id="shelfSetList-handle-ok" type="primary" @click="handleCommonOk">确定</a-button>
+        <a-button id="shelfSetList-handle-cancel" type="default" class="button-warning" @click="showTip=false">取消</a-button>
       </div>
     </a-modal>
   </a-card>
@@ -127,28 +135,29 @@
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
-import custList from '@/views/common/custList.vue'
-import shelfSList from '@/views/common/shelfList'
-import basicInfoModal from './basicInfoModal.vue'
-import commonModal from '@/views/common/commonModal.vue'
-import { shelfList, modifFinishFlag, shelfModifState } from '@/api/shelf'
+import custList from '@/views/common/custList.vue' // 客户列表组件
+import shelfSList from '@/views/common/shelfList' // 货架列表组件
+import basicInfoModal from './basicInfoModal.vue' // 基本信息弹框
+import commonModal from '@/views/common/commonModal.vue' // 公共弹框
+import { shelfList, modifFinishFlag, shelfModifState } from '@/api/shelf' // 接口api
 export default {
   components: { STable, VSelect, custList, shelfSList, basicInfoModal, commonModal },
   mixins: [commonMixin],
   data () {
     return {
-      spinning: false,
-      tableHeight: 0,
+      spinning: false, // loading
+      tableHeight: 0, // 表格高度
       disabled: false, //  查询、重置按钮是否可操作
-      showTip: false,
+      showTip: false, // 注销弹框
       queryParam: {
-        shelfSn: undefined,
-        customerSn: undefined,
-        finishFlag: undefined,
-        customerEntity: {
+        shelfSn: undefined, // 货架sn
+        customerSn: undefined, // 关联客户sn
+        finishFlag: undefined, // 是否完成设置
+        customerEntity: { // 关联客户名称
           customerName: undefined
         }
       },
+      // 列定义
       columns: [
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
         { title: '货架名称', scopedSlots: { customRender: 'shelfName' }, width: '25%', align: 'left', ellipsis: true },
@@ -176,16 +185,18 @@ export default {
           return data
         })
       },
-      openModal: false,
-      nowData: null
+      openModal: false, // 新增编辑弹框
+      nowData: null // 当前操作行数据
     }
   },
   methods: {
     // 设置/修改
     handleSet (row) {
+      // 如果有关联客户跳转到设置页面
       if (row.customerSn) {
-        this.$router.push({ path: `/numsGoodsShelves/shelfSet/set/${row.shelfSn}` })
+        this.handleOkToSet(row)
       } else {
+        // 否则打开编辑弹框
         this.nowData = {
           shelfSn: row.shelfSn,
           shelfName: row.shelfName
@@ -193,10 +204,11 @@ export default {
         this.openModal = true
       }
     },
-    handleOk (data) {
+    // 跳转到货架设置页面
+    handleOkToSet (data) {
       this.$router.push({ path: `/numsGoodsShelves/shelfSet/set/${data.shelfSn}` })
     },
-    // 客户 change
+    // 选择关联客户
     custChange (obj, row) {
       if (row) {
         this.queryParam.customerSn = row && row.customerSn || undefined
@@ -206,7 +218,7 @@ export default {
         this.queryParam.customerSn = undefined
       }
     },
-    // 是否设置完成
+    // 是否设置完成更改
     changeStatus (record) {
       const params = {
         shelfSn: record.shelfSn,
@@ -224,7 +236,7 @@ export default {
       })
     },
     // 启用禁用
-    enableShelf(record){
+    enableShelf (record) {
       const params = {
         shelfSn: record.shelfSn,
         state: record.state == 'ENABLE' ? 'DISABLED' : 'ENABLE'
@@ -232,27 +244,29 @@ export default {
       const _this = this
       _this.$confirm({
         title: '提示',
-        content: <div style="text-align:center;">是否{(record.state == 'ENABLE'?'停用':'启用')+record.shelfName}</div>,
+        content: <div style="text-align:center;">是否{(record.state == 'ENABLE' ? '停用' : '启用') + record.shelfName}</div>,
         centered: true,
         closable: true,
         class: 'confirm-center',
         onOk () {
-           _this.updateState(params)
+          _this.updateState(params)
         }
       })
     },
-    // 注销
-    handleCancel(record){
+    // 打开注销弹框
+    handleCancel (record) {
       this.nowData = {
         shelfSn: record.shelfSn,
         state: 'WRITE_OFF'
       }
       this.showTip = true
     },
-    handleCommonOk(){
+    // 确定注销
+    handleCommonOk () {
       this.updateState(this.nowData)
     },
-    updateState(params){
+    // 更改货架状态
+    updateState (params) {
       this.spinning = true
       shelfModifState(params).then(res => {
         if (res.status == 200) {
@@ -265,7 +279,7 @@ export default {
         this.showTip = false
       })
     },
-    // 重置
+    // 重置列表查询
     resetSearchForm () {
       this.queryParam.shelfSn = undefined
       this.queryParam.customerSn = undefined
@@ -274,10 +288,12 @@ export default {
       this.queryParam.finishFlag = undefined
       this.$refs.table.refresh(true)
     },
+    // 计算表格高度
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight
       this.tableHeight = window.innerHeight - tableSearchH - 235
     },
+    // 初始化页面
     pageInit () {
       const _this = this
       this.$nextTick(() => { // 页面渲染完成后的回调

+ 40 - 30
src/views/numsGoodsShelves/shelfSet/set.vue

@@ -184,9 +184,9 @@
       @close="openTipsModal=false" />
     <!-- 导入产品 -->
     <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>
@@ -197,13 +197,13 @@
 import { commonMixin } from '@/utils/mixin'
 import { downloadExcel } from '@/libs/JGPrint.js'
 import { STable, VSelect } from '@/components'
-import commonModal from '@/views/common/commonModal.vue'
-import addHwModal from './addHwModal.vue'
-import bindProductModal from './bindProductModal.vue'
-import ImportGuideModal from './importGuideModal.vue'
-import basicInfoModal from './basicInfoModal.vue'
-import importHuoweiModal from './importHuoweiModal.vue'
-import shelfTemplate from '@/views/common/shelfTemplate'
+import commonModal from '@/views/common/commonModal.vue' // 公共提示弹框
+import addHwModal from './addHwModal.vue' // 新增货位弹框
+import bindProductModal from './bindProductModal.vue' // 绑定产品弹框
+import ImportGuideModal from './importGuideModal.vue' // 导入产品弹框
+import basicInfoModal from './basicInfoModal.vue' // 基本信息弹框
+import importHuoweiModal from './importHuoweiModal.vue' // 导入货位模板
+import shelfTemplate from '@/views/common/shelfTemplate' // 货架模板下拉组件
 import { shelfDetail, shelfProductList, shelfProductBatchInsert, delShelfPlaceSn, shelfProductEnable, getShelfPriceShow, shelfProductExport, importShelfTemplate } from '@/api/shelf'
 export default {
   name: 'ShelfMonitoringWarehousing',
@@ -211,16 +211,16 @@ export default {
   mixins: [commonMixin],
   data () {
     return {
-      spinning: false,
+      spinning: false, // 页面loading
       disabled: false, //  查询、重置按钮是否可操作
-      tableHeight: 400,
-      exportLoading: false,
+      tableHeight: 400, // 表格高度
+      exportLoading: false, // 导出loading
       showTplModal: false, // 是否显示导入模板弹框
-      tplSn: undefined, // 模板sn
+      tplSn: undefined, // 货架模板sn
       queryParam: {
         shelfProductApiEntity: {
-          productCode: '',
-          productName: ''
+          productCode: '', // 产品编码
+          productName: '' // 产品名称
         }
       },
       orginData: [], // 原始数据
@@ -243,23 +243,25 @@ export default {
           return data
         })
       },
-      basicInfoData: null,
-      openTipsModal: false,
-      openModal: false,
-      nowData: null,
-      openGuideModal: false,
-      modalType: null,
-      openInfoModal: false,
-      openHwModal: false,
-      openImportModal: false,
-      showPriceStr: [],
-      showNoShelfPriceStr: []
+      basicInfoData: null, // 基础设置弹框
+      openTipsModal: false, // 更换产品提示弹框
+      openModal: false, // 修改信息/绑定产品/更换产品弹框
+      nowData: null, // 当前操作货位产品数据
+      openGuideModal: false, // 导入产品
+      modalType: null, // 新增或编辑
+      openInfoModal: false, // 基础设置弹框
+      openHwModal: false, // 新增编辑货位弹框
+      openImportModal: false, // 导入货位模板弹框
+      showPriceStr: [], // 货架产品价格权限
+      showNoShelfPriceStr: [] // 非货架产品价格权限
     }
   },
   computed: {
+    // 是否显示模板导入按钮
     showTplBtn () {
       return this.orginData.length == 0
     },
+    // 列定义
     columns () {
       const _this = this
       const ret = [
@@ -272,6 +274,7 @@ export default {
         { 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 : '--') } }
       ]
+      // 注销或停用的货架不能操作
       if (this.basicInfoData && this.basicInfoData.state != 'WRITE_OFF' && this.basicInfoData.state != 'SUSPEND') {
         ret.push({ title: '操作', scopedSlots: { customRender: 'action' }, width: '15%', align: 'center' })
       }
@@ -334,7 +337,7 @@ export default {
         this.openHwModal = true
       }
     },
-    // 禁用启用
+    // 禁用启用弹框提示
     handleEnable (row) {
       const _this = this
       if (row.enableFlag == 1) {
@@ -350,10 +353,15 @@ export default {
         _this.enableFun(row)
       }
     },
+    // 禁用启用货架
     enableFun (row) {
       const _this = this
       _this.spinning = true
-      shelfProductEnable({ shelfSn: this.$route.params.sn, shelfProductSn: row.shelfProductApiEntity.shelfProductSn, enableFlag: row.enableFlag == 1 ? 0 : 1 }).then(res => {
+      shelfProductEnable({
+        shelfSn: this.$route.params.sn,
+        shelfProductSn: row.shelfProductApiEntity.shelfProductSn,
+        enableFlag: row.enableFlag == 1 ? 0 : 1
+      }).then(res => {
         if (res.status == 200) {
           _this.$message.success(res.message)
           _this.$refs.table.refresh()
@@ -378,6 +386,7 @@ export default {
       shelfDetail({ sn: this.$route.params.sn }).then(res => {
         if (res.status == 200) {
           this.basicInfoData = res.data
+          // 获取价格权限
           this.getShelfPriceShow()
         } else {
           this.basicInfoData = null
@@ -440,17 +449,18 @@ export default {
     handleInfoOk () {
       this.getDetail()
     },
-    //  重置
+    // 重置
     resetSearchForm () {
       this.queryParam.shelfProductApiEntity.productCode = ''
       this.queryParam.shelfProductApiEntity.productName = ''
       this.$refs.table.refresh(true)
     },
+    // 计算表格高度
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight
       this.tableHeight = window.innerHeight - tableSearchH - 350
     },
-    //  返回列表
+    // 返回列表
     handleBack () {
       this.$router.push({ path: '/numsGoodsShelves/shelfSet/list' })
     }