chenrui 2 年 前
コミット
34c99a05fa

+ 167 - 117
src/views/numsGoodsShelves/recallManagement/addRecallBillModal.vue

@@ -4,27 +4,18 @@
     class="shelfSet-basicInfo-modal"
     :footer="null"
     :maskClosable="false"
-    :title="recallBillInfo.shelfName"
+    :title="'新增回调单——'+recallBillInfo.shelfName"
     v-model="isShow"
-    @cancel="isShow = false"
+    @cancel="isShow = false;$refs.recallBillTable.clearSelected();showChecked=false"
     width="60%">
     <a-spin :spinning="spinning" tip="Loading...">
-      <a-form-model
-        id="shelfSet-basicInfo-form"
-        ref="ruleForm"
-        :model="queryParam"
-        :label-col="formItemLayout.labelCol"
-        :wrapper-col="formItemLayout.wrapperCol">
+      <a-form-model id="shelfSet-basicInfo-form" ref="ruleForm" :model="queryParam" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
         <a-row :gutter="10">
           <a-col :md="8" :sm="24">
-            <a-form-model-item label="产品编码">
-              <a-input allowClear placeholder="请输入产品编码" v-model.tirm="queryParam.productCode"/>
-            </a-form-model-item>
+            <a-form-model-item label="产品编码"><a-input allowClear placeholder="请输入产品编码" v-model.tirm="queryParam.productCode" /></a-form-model-item>
           </a-col>
           <a-col :md="8" :sm="24">
-            <a-form-item label="产品名称">
-              <a-input allowClear placeholder="请输入产品名称" v-model.tirm="queryParam.productName"/>
-            </a-form-item>
+            <a-form-item label="产品名称"><a-input allowClear placeholder="请输入产品名称" v-model.tirm="queryParam.productName" /></a-form-item>
           </a-col>
           <a-col :md="8" :sm="24">
             <a-form-model-item label="滞销天数">
@@ -38,7 +29,8 @@
                       :min="0"
                       :max="999999"
                       placeholder="起始天数"
-                      style="width: 100%;display: inline-block;" />
+                      style="width: 100%;display: inline-block;"
+                    />
                   </a-col>
                   <a-col :md="2" :sm="24"><span style="display: block;text-align: center;line-height: 32px;">至</span></a-col>
                   <a-col :md="11" :sm="24">
@@ -49,48 +41,49 @@
                       :min="0"
                       :max="999999"
                       placeholder="截止天数"
-                      style="width: 100%;display: inline-block;" />
+                      style="width: 100%;display: inline-block;"
+                    />
                   </a-col>
                 </a-row>
               </a-input-group>
             </a-form-model-item>
           </a-col>
           <a-col :span="24" style="text-align: right;padding-right: 30px;">
-            <a-button type="primary" @click="handleSearch" id="outboundOrderList-refresh" >查询</a-button>
+            <a-button type="primary" @click="$refs.recallBillTable.refresh(true)" id="outboundOrderList-refresh">查询</a-button>
             <a-button style="margin-left: 8px" @click="resetSearchForm" id="outboundOrderList-reset">重置</a-button>
           </a-col>
         </a-row>
       </a-form-model>
       <div class="tableCon">
         <div style="margin-bottom: 16px">
-          <a-button type="primary" :disabled="!hasSelected" @click="handleSave">
-            新增调回单
-          </a-button>
+          <a-button type="primary" @click="handleSave">新增调回单</a-button>
           <span class="tableSpan">
-            <template v-if="hasSelected">
-              已选<span>{{ selectedRowKeys.length }}</span>款产品,共<span>{{ dataList.length }}</span>件
+            <template>
+              已选
+              <span>{{ selectedRowKeys.length }}</span>
+              款产品,共
+              <span>{{ totalNum }}</span>
+              件
             </template>
           </span>
-          <span>
-            <a-checkbox @change="isShowChooseList" size="small">
-              仅显示已选产品
-            </a-checkbox>
-          </span>
+          <span><a-checkbox @change="isShowChooseList" :checked="showChecked" size="small">仅显示已选产品</a-checkbox></span>
         </div>
-        <a-table
+        <s-table
           class="sTable"
           ref="recallBillTable"
           size="small"
-          :rowKey="record => record.id"
+          :rowKey="(record) => record.id"
+          :row-selection="{columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: record.confirmQty == 0 } })}"
+          @rowSelection="onSelectChange"
           :columns="columns"
-          :dataSource="dataList"
-          :scroll="{ y: 200 }"
-          :pagination="false"
-          bordered
-          :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }">
-          <!-- 调回数量 -->
+          :data="loadData"
+          :scroll="{ y: 450 }"
+          :showPagination="false"
+          bordered>
           <template slot="confirmQty" slot-scope="text, record">
+            <div v-if="record.confirmQty == 0">--</div>
             <a-input-number
+              v-else
               size="small"
               id="shelfMonitoring-add-confirmQty"
               v-model="record.confirmQty"
@@ -98,22 +91,24 @@
               :min="0"
               :max="record.qty"
               placeholder="请输入"
-              :style="{ width: '100%', color: record.confirmQty == 0 ? 'red' : '' }"
+              :style="{ width: '100%' }"
             />
           </template>
-        </a-table>
+        </s-table>
       </div>
     </a-spin>
   </a-modal>
 </template>
 
 <script>
+import { STable } from '@/components'
 import { commonMixin } from '@/utils/mixin'
 import { shelfControlList } from '@/api/shelf'
 import { shelfRecallSave } from '@/api/shelfRecall'
 export default {
   name: 'AddRecallBillModal',
   mixins: [commonMixin],
+  components: { STable },
   props: {
     openModal: {
       //  弹框显示状态
@@ -135,67 +130,140 @@ export default {
         labelCol: { span: 5 },
         wrapperCol: { span: 17 }
       },
-      queryParam: { //  查询条件
+      queryParam: {
+        //  查询条件
         shelfSn: '',
         productCode: undefined,
         productName: undefined,
         unsalableDaysBegin: undefined,
         unsalableDaysEnd: undefined
       },
+      totalNum: 0,
       columns: [
         { title: '序号', dataIndex: 'no', width: '10%', align: 'center' },
         { title: '货位号', dataIndex: 'shelfPlaceCode', width: '15%', align: 'center' },
-        { title: '产品编码', dataIndex: 'productCode', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'productName', width: '30%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '最大库容', dataIndex: 'maxQty', width: '15%', align: 'center', customRender: function (text) { return (text || text == 0) ? text : '--' } },
-        { title: '补货在途', dataIndex: 'replenishBillQty', width: '15%', align: 'center', customRender: function (text) { return (text || text == 0) ? text : '--' } },
-        { title: '调回在途', dataIndex: 'recallBillQty', width: '15%', align: 'center', customRender: function (text) { return (text || text == 0) ? text : '--' } },
-        { title: '货架库存', dataIndex: 'qty', width: '15%', align: 'center', customRender: function (text) { return (text || text == 0) ? text : '--' } },
-        { title: '单位', dataIndex: 'productUnit', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '滞销天数', dataIndex: 'unsalableDays', width: '15%', align: 'center', customRender: function (text) { return (text || text == 0) ? text : '--' } },
+        {
+          title: '产品编码',
+          dataIndex: 'productCode',
+          width: '20%',
+          align: 'center',
+          customRender: function (text) {
+            return text || '--'
+          }
+        },
+        {
+          title: '产品名称',
+          dataIndex: 'productName',
+          width: '30%',
+          align: 'left',
+          customRender: function (text) {
+            return text || '--'
+          },
+          ellipsis: true
+        },
+        {
+          title: '最大库容',
+          dataIndex: 'maxQty',
+          width: '15%',
+          align: 'center',
+          customRender: function (text) {
+            return text || text == 0 ? text : '--'
+          }
+        },
+        {
+          title: '补货在途',
+          dataIndex: 'replenishBillQty',
+          width: '15%',
+          align: 'center',
+          customRender: function (text) {
+            return text || text == 0 ? text : '--'
+          }
+        },
+        {
+          title: '调回在途',
+          dataIndex: 'recallBillQty',
+          width: '15%',
+          align: 'center',
+          customRender: function (text) {
+            return text || text == 0 ? text : '--'
+          }
+        },
+        {
+          title: '货架库存',
+          dataIndex: 'qty',
+          width: '15%',
+          align: 'center',
+          customRender: function (text) {
+            return text || text == 0 ? text : '--'
+          }
+        },
+        {
+          title: '单位',
+          dataIndex: 'productUnit',
+          width: '15%',
+          align: 'center',
+          customRender: function (text) {
+            return text || '--'
+          }
+        },
+        {
+          title: '滞销天数',
+          dataIndex: 'unsalableDays',
+          width: '15%',
+          align: 'center',
+          customRender: function (text) {
+            return text || text == 0 ? text : '--'
+          }
+        },
         { title: '调回数量', width: '20%', align: 'left', scopedSlots: { customRender: 'confirmQty' } }
       ],
       selectedRowKeys: [], // 选中表格id
-      hasSelected: false, // 控制选择按钮
-      dataList: [],
-      chooseList: []
-    }
-  },
-  methods: {
-    getLoadData (ajaxData) { // 获取列表
-      this.spinning = true
-      if (!this.checkValueRange()) {
-        this.spinning = false
-        return
-      }
-      shelfControlList(ajaxData).then(res => {
-        if (res.status == 200) {
-          for (var i = 0; i < res.data.length; i++) {
-            res.data[i].no = i + 1
-            res.data[i].confirmQty = res.data[i].qty
-          }
-          this.dataList = res.data
-          this.spinning = false
-        } else {
+      chooseList: [],
+      showChecked: false,
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        // 获取列表
+        this.spinning = true
+        if (!this.checkValueRange()) {
           this.spinning = false
+          return
         }
-      })
-    },
-    onSelectChange (selectedRowKeys, selectedRows) { // 获取选中列表
-      if (selectedRowKeys.length > 0) {
-        this.hasSelected = true
-      } else {
-        this.hasSelected = false
+        this.queryParam.shelfSn = this.recallBillInfo.shelfSn
+        return shelfControlList(this.queryParam).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            if (this.showChecked) {
+              data = this.chooseList && this.chooseList || []
+            }
+            for (var i = 0; i < data.length; i++) {
+              data[i].no = i + 1
+              data[i].confirmQty = data[i].qty
+            }
+          }
+          this.spinning = false
+          return data
+        })
       }
-      this.selectedRowKeys = selectedRowKeys
-      this.chooseList = selectedRows
+    }
+  },
+  methods: {
+    onSelectChange (obj) {
+      // 获取选中列表
+      this.selectedRowKeys = obj.selectedRowKeys
+      this.chooseList = obj.selectedRows || null
+      this.totalNum = obj.selectedRows.reduce((pre, val) => {
+        return pre + val.confirmQty
+      }, 0)
     },
     //  确定新增回调单
     handleSave () {
       const _this = this
-      _this.spinning = true
+      if (this.chooseList && this.chooseList.length == 0) {
+        this.$message.warning('请先选择产品')
+        return
+      }
       const arr = []
-      const arrInd = []
       this.chooseList.forEach((item, index) => {
         if (item.confirmQty) {
           arr.push({
@@ -207,14 +275,9 @@ export default {
             productName: item.productName,
             qty: item.confirmQty
           })
-        } else {
-          arrInd.push(index + 1)
         }
       })
-      if (arrInd.length > 0) {
-        this.$message.warning('调回数量不能为空或0,请移除后提交')
-        return
-      }
+      _this.spinning = true
       const params = {
         shelfSn: this.recallBillInfo.shelfSn,
         detailList: arr
@@ -224,27 +287,19 @@ export default {
         if (res.status == 200) {
           _this.$emit('ok')
           _this.isShow = false
-          _this.hasSelected = false
-          _this.selectedRowKeys = [] // 清空选中内容
+          this.$refs.recallBillTable.clearSelected()
           _this.$message.success('保存并确认成功')
         }
       })
     },
     isShowChooseList (e) {
-      if (e.target.checked) {
-        this.dataList = this.chooseList
-      } else {
-        this.getLoadData(this.queryParam)
-      }
-    },
-    // 查询
-    handleSearch () {
-      const ajaxData = this.queryParam
-      this.getLoadData(ajaxData)
+      this.showChecked = e.target.checked
+      this.$refs.recallBillTable.refresh(true)
     },
     // 重置
     resetSearchForm () {
-      const obj = { //  查询条件
+      const obj = {
+        //  查询条件
         shelfSn: this.recallBillInfo.shelfSn,
         productCode: undefined,
         productName: undefined,
@@ -252,7 +307,9 @@ export default {
         unsalableDaysEnd: undefined
       }
       this.queryParam = obj
-      this.getLoadData(obj)
+      this.showChecked = false
+      this.$refs.recallBillTable.clearSelected()
+      this.$refs.recallBillTable.refresh(true)
     },
     // 校验滞销天数数值范围
     checkValueRange () {
@@ -292,13 +349,6 @@ export default {
       if (!newValue) {
         this.$emit('close')
         this.$refs.ruleForm.resetFields()
-        // this.$refs.custList.resetForm()
-      } else {
-        if (this.recallBillInfo && this.recallBillInfo.shelfSn) {
-          this.queryParam.shelfSn = this.recallBillInfo.shelfSn
-          const ajaxData = { shelfSn: this.recallBillInfo.shelfSn }
-          this.getLoadData(ajaxData)
-        }
       }
     }
   }
@@ -307,21 +357,21 @@ export default {
 
 <style lang="less">
 .shelfSet-basicInfo-modal {
-	.ant-modal-body {
-		padding: 40px 40px 24px;
-	}
-  .ant-form-item{
+  .ant-modal-body {
+    padding: 40px 40px 24px;
+  }
+  .ant-form-item {
     margin-bottom: 15px;
   }
-	.btn-cont {
-		text-align: center;
-		margin: 35px 0 10px;
-	}
-  .tableSpan{
-    margin:0 16px;
-    span{
+  .btn-cont {
+    text-align: center;
+    margin: 35px 0 10px;
+  }
+  .tableSpan {
+    margin: 0 16px;
+    span {
       margin: 0 10px;
-      color:red;
+      color: red;
       font-weight: bold;
     }
   }

+ 2 - 2
src/views/numsGoodsShelves/recallManagement/basicInfoModal.vue

@@ -4,7 +4,7 @@
     class="shelfSet-basicInfo-modal"
     :footer="null"
     :maskClosable="false"
-    title="新增调单"
+    title="新增调单"
     v-model="isShow"
     @cancel="isShow = false"
     :width="600">
@@ -68,7 +68,7 @@ export default {
         shelfSn: undefined
       },
       rules: {
-        shelfSn: [{ required: true, message: '请选择货架名称', trigger: 'change' }]
+        shelfSn: [{ required: true, message: '请选择需要调回产品货架', trigger: 'change' }]
       },
       showRecallBill: false, // 显示选择货架弹窗
       detailObj: {

+ 101 - 35
src/views/numsGoodsShelves/recallManagement/detailModal.vue

@@ -4,7 +4,7 @@
     class="vinRecord-modal"
     :footer="null"
     :maskClosable="false"
-    title="调回单详情——[数字货架]"
+    :title="shelfName"
     v-model="isShow"
     @cancel="isShow=false"
     width="60%">
@@ -15,7 +15,8 @@
         <a-descriptions-item label="创建时间">{{ itemData.createDate }}</a-descriptions-item>
         <a-descriptions-item label="状态" :span="1">{{ itemData.billStateDictValue }}</a-descriptions-item>
         <a-descriptions-item label="退库时间">{{ itemData.confirmTime }}</a-descriptions-item>
-        <a-descriptions-item label="关联销售退货单">
+        <a-descriptions-item style="width:calc(100% - 18px);background:red">
+          <span style="color:rgba(0, 0, 0, 0.85)">关联销售退货单:</span>
           <span v-if="salesReturnBillList && salesReturnBillList.length>0">
             <span v-for="con in salesReturnBillList" :key="con.id" class="recallBillNo">{{ con.salesReturnNo }}</span>
           </span>
@@ -25,24 +26,14 @@
     </div>
     <!-- 表格 -->
     <div class="table-body" v-if="detailList && detailList.length>0">
-      <table>
-        <tr>
-          <th width="10%">序号</th>
-          <th width="10%">产品编码</th>
-          <th width="50%">产品名称</th>
-          <th width="10%">调回数量</th>
-          <th width="10%">实退数量</th>
-          <th width="10%">单位</th>
-        </tr>
-        <tr v-for="(item,index) in detailList" :key="item.id">
-          <td>{{ index + 1 }}</td>
-          <td>{{ item.productCode }}</td>
-          <td>{{ item.productName }}</td>
-          <td>{{ item.qty }}</td>
-          <td>{{ item.confirmQty }}</td>
-          <td>{{ item.product.unit }}</td>
-        </tr>
-      </table>
+      <a-table
+        :columns="columns"
+        :data-source="detailList"
+        :scroll="{ y: 300 }"
+        :rowKey="(record) => record.id"
+        :pagination="false"
+        :bordered="true"
+      ></a-table>
     </div>
     <div class="btn-cont"><a-button id="vinRecord-modal-back" @click="isShow = false">关闭</a-button></div>
     <!-- 回调单号提示窗 -->
@@ -60,14 +51,18 @@
       </div>
       <div class="tipCon" v-if="salesReturnBillList && salesReturnBillList.length==0">确认生成销售退货订单吗?</div>
       <div v-else>
-        <div class="tipCon">此调单已经存在相应的销售退货单,确定再次生成销售退货单吗?</div>
+        <div class="tipCon">此调单已经存在相应的销售退货单,确定再次生成销售退货单吗?</div>
         <div class="tipRecallBillNo">
           <p v-for="con in salesReturnBillList" :key="con.id">{{ con.salesReturnNo }}</p>
         </div>
       </div>
       <div class="tipFooter">
-        <div class="btnLeft" @click="tipVisible = false">取消</div>
-        <div class="btnLeft" @click="setReturnBill">确定</div>
+        <a-button class="btnLeft" type="link" @click="tipVisible = false">
+          取消
+        </a-button>
+        <a-button class="btnLeft" type="link" @click="setReturnBill" :loading="btnLoading">
+          确定
+        </a-button>
       </div>
     </a-modal>
   </a-modal>
@@ -94,7 +89,62 @@ export default {
       isShow: this.openModal, //  是否打开弹框
       tipVisible: false,
       salesReturnBillList: [],
-      detailList: []
+      detailList: [],
+      btnLoading: false,
+      columns: [{
+        title: '序号',
+        dataIndex: 'no',
+        width: '10%',
+        align: 'center'
+      },
+      {
+        title: '产品编码',
+        dataIndex: 'productCode',
+        width: '15%',
+        align: 'center',
+        customRender: function (text) {
+          return text || '--'
+        }
+      },
+      {
+        title: '产品名称',
+        dataIndex: 'productName',
+        width: '30%',
+        align: 'left',
+        customRender: function (text) {
+          return text || '--'
+        },
+        ellipsis: true
+      },
+      {
+        title: '调回数量',
+        dataIndex: 'qty',
+        width: '15%',
+        align: 'center',
+        customRender: function (text) {
+          return text || text == 0 ? text : '--'
+        }
+      },
+      {
+        title: '实退数量',
+        dataIndex: 'confirmQty',
+        width: '15%',
+        align: 'center',
+        customRender: function (text) {
+          return text || text == 0 ? text : '--'
+        }
+      },
+      {
+        title: '单位',
+        dataIndex: 'product.unit',
+        width: '15%',
+        align: 'center',
+        customRender: function (text) {
+          return text || text == 0 ? text : '--'
+        }
+      }
+      ],
+      shelfName: ''
     }
   },
   watch: {
@@ -108,8 +158,12 @@ export default {
         this.$emit('close')
       } else {
         if (this.itemData) {
-          this.salesReturnBillList = this.itemData.salesReturnBillList
+          this.salesReturnBillList = this.itemData.salesReturnBillList ? this.itemData.salesReturnBillList : []
+          this.itemData.detailList.map((con, i) => {
+            con.no = i + 1
+          })
           this.detailList = this.itemData.detailList
+          this.shelfName = '调回单详情——' + this.itemData.shelfInfo.shelfName
         }
       }
     }
@@ -121,6 +175,7 @@ export default {
     // 生成销售退货单
     setReturnBill () {
       this.spinning = true
+      this.btnLoading = true
       generateSaleReturnBill({ recallBillSn: this.itemData.recallBillSn }).then(res => {
         if (res.status == 200) {
           this.$message.success(res.message)
@@ -130,6 +185,7 @@ export default {
         } else {
           this.spinning = false
         }
+        this.btnLoading = false
       })
     }
   }
@@ -141,21 +197,25 @@ export default {
     .ant-modal-body {
       padding: 40px 40px 24px;
     }
+    .ant-modal-title{
+      font-weight: 600;
+    }
     .btn-cont {
       text-align: center;
       margin: 35px 0 10px;
     }
     .table-body{
-      table{
-        th,td{
-          text-align: center;
-          padding: 5px;
-          border:1px solid #ddd;
-        }
-        th{
-          background:#f8f8f8;
-        }
-      }
+      margin-top:10px;
+      // table{
+      //   th,td{
+      //     text-align: center;
+      //     padding: 5px;
+      //     border:1px solid #ddd;
+      //   }
+      //   th{
+      //     background:#f8f8f8;
+      //   }
+      // }
     }
     .recallBillNo{
       color:#39f;
@@ -173,6 +233,9 @@ export default {
         color: #52a6fb;
       }
     }
+    .ant-descriptions-item{
+          vertical-align: top;
+    }
   }
   // 弹窗
   .tipPopup{
@@ -210,6 +273,9 @@ export default {
       display: flex;
       algin-item:center;
       border-top:1px solid #e0e0e0;
+      :hover{
+
+      }
       .btnLeft{
         width:50%;
         text-align: center;

+ 1 - 1
src/views/numsGoodsShelves/recallManagement/list.vue

@@ -48,7 +48,7 @@
           </a-row>
         </a-form>
       </div>
-      <div class="btnStyle"><a-button type="primary" class="button-primary" @click="openInfoModal = true">新增调回单</a-button></div>
+      <div class="btnStyle"><a-button type="primary" @click="openInfoModal = true">新增调回单</a-button></div>
       <s-table
         class="sTable fixPagination"
         ref="table"

+ 2 - 0
src/views/numsGoodsShelves/shelfMonitoring/list.vue

@@ -280,6 +280,7 @@ export default {
     handleSearch () {
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
+          this.$refs.table.clearSelected()
           this.$refs.table.refresh(true)
           this.isSearch = true
         } else {
@@ -298,6 +299,7 @@ export default {
       this.queryParam.state = undefined
       this.queryParam.unsalableDaysBegin = undefined
       this.queryParam.unsalableDaysEnd = undefined
+      this.$refs.table.clearSelected()
       this.handleSearch()
     },
     // 导出