123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329 |
- <template>
- <a-modal
- centered
- class="shelfSet-basicInfo-modal"
- :footer="null"
- :maskClosable="false"
- :title="recallBillInfo.shelfName"
- v-model="isShow"
- @cancel="isShow = 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-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-col>
- <a-col :md="8" :sm="24">
- <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="滞销天数">
- <a-input-group>
- <a-row>
- <a-col :md="11" :sm="24">
- <a-input-number
- id="shelfMonitoringList-minUnsalableDays"
- v-model="queryParam.unsalableDaysBegin"
- :precision="0"
- :min="0"
- :max="999999"
- placeholder="起始天数"
- 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">
- <a-input-number
- id="shelfMonitoringList-maxUnsalableDays"
- v-model="queryParam.unsalableDaysEnd"
- :precision="0"
- :min="0"
- :max="999999"
- placeholder="截止天数"
- 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 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>
- <span class="tableSpan">
- <template v-if="hasSelected">
- 已选<span>{{ selectedRowKeys.length }}</span>款产品,共<span>{{ dataList.length }}</span>件
- </template>
- </span>
- <span>
- <a-checkbox @change="isShowChooseList" size="small">
- 仅显示已选产品
- </a-checkbox>
- </span>
- </div>
- <a-table
- class="sTable"
- ref="recallBillTable"
- size="small"
- :rowKey="record => record.id"
- :columns="columns"
- :dataSource="dataList"
- :scroll="{ y: 200 }"
- :pagination="false"
- bordered
- :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }">
- <!-- 调回数量 -->
- <template slot="confirmQty" slot-scope="text, record">
- <a-input-number
- size="small"
- id="shelfMonitoring-add-confirmQty"
- v-model="record.confirmQty"
- :precision="0"
- :min="0"
- :max="record.qty"
- placeholder="请输入"
- :style="{ width: '100%', color: record.confirmQty == 0 ? 'red' : '' }"
- />
- </template>
- </a-table>
- </div>
- </a-spin>
- </a-modal>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { shelfControlList } from '@/api/shelf'
- import { shelfRecallSave } from '@/api/shelfRecall'
- export default {
- name: 'AddRecallBillModal',
- mixins: [commonMixin],
- props: {
- openModal: {
- // 弹框显示状态
- type: Boolean,
- default: false
- },
- recallBillInfo: {
- type: Object,
- default: () => {
- return {}
- }
- }
- },
- data () {
- return {
- spinning: false,
- isShow: this.openModal, // 是否打开弹框
- formItemLayout: {
- labelCol: { span: 5 },
- wrapperCol: { span: 17 }
- },
- queryParam: { // 查询条件
- shelfSn: '',
- productCode: undefined,
- productName: undefined,
- unsalableDaysBegin: undefined,
- unsalableDaysEnd: undefined
- },
- 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: '调回数量', 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 {
- this.spinning = false
- }
- })
- },
- onSelectChange (selectedRowKeys, selectedRows) { // 获取选中列表
- if (selectedRowKeys.length > 0) {
- this.hasSelected = true
- } else {
- this.hasSelected = false
- }
- this.selectedRowKeys = selectedRowKeys
- this.chooseList = selectedRows
- },
- // 确定新增回调单
- handleSave () {
- const _this = this
- _this.spinning = true
- const arr = []
- const arrInd = []
- this.chooseList.forEach((item, index) => {
- if (item.confirmQty) {
- arr.push({
- shelfSn: item.shelfSn,
- shelfPlaceSn: item.shelfPlaceSn,
- shelfPlaceCode: item.shelfPlaceCode,
- productSn: item.productSn,
- productCode: item.productCode,
- productName: item.productName,
- qty: item.confirmQty
- })
- } else {
- arrInd.push(index + 1)
- }
- })
- if (arrInd.length > 0) {
- this.$message.warning('调回数量不能为空或0,请移除后提交')
- return
- }
- const params = {
- shelfSn: this.recallBillInfo.shelfSn,
- detailList: arr
- }
- shelfRecallSave(params).then(res => {
- _this.spinning = false
- if (res.status == 200) {
- _this.$emit('ok')
- _this.isShow = false
- _this.hasSelected = false
- _this.selectedRowKeys = [] // 清空选中内容
- _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)
- },
- // 重置
- resetSearchForm () {
- const obj = { // 查询条件
- shelfSn: this.recallBillInfo.shelfSn,
- productCode: undefined,
- productName: undefined,
- unsalableDaysBegin: undefined,
- unsalableDaysEnd: undefined
- }
- this.queryParam = obj
- this.getLoadData(obj)
- },
- // 校验滞销天数数值范围
- checkValueRange () {
- const isONull = this.queryParam.unsalableDaysBegin === null || this.queryParam.unsalableDaysBegin === undefined
- const isOEmpty = this.queryParam.unsalableDaysBegin === ''
- const isOZero = this.queryParam.unsalableDaysBegin === 0
- const isTNull = this.queryParam.unsalableDaysEnd === null || this.queryParam.unsalableDaysEnd === undefined
- const isTEmpty = this.queryParam.unsalableDaysEnd === ''
- const isTZero = this.queryParam.unsalableDaysEnd === 0
- // 第一个为空(可为null可为空字符)第二个不为空
- // 第一个不为空第二个为空(可为null可为空字符)
- // 第一个大于第二个
- if ((isONull || isOEmpty) && (this.queryParam.unsalableDaysEnd || isTZero)) {
- this.$message.info('请输入正确的滞销天数查询范围!')
- return false
- }
- if ((this.queryParam.unsalableDaysBegin || isOZero) && (isTNull || isTEmpty)) {
- this.$message.info('请输入正确的滞销天数查询范围!')
- return false
- }
- if (this.queryParam.unsalableDaysBegin > this.queryParam.unsalableDaysEnd) {
- this.$message.info('请输入正确的滞销天数查询范围!')
- return false
- }
- this.queryParam.unsalableDaysBegin = this.queryParam.unsalableDaysBegin > 999999999 ? 999999999 : this.queryParam.unsalableDaysBegin
- this.queryParam.unsalableDaysEnd = this.queryParam.unsalableDaysEnd > 999999999 ? 999999999 : this.queryParam.unsalableDaysEnd
- return true
- }
- },
- watch: {
- // 父页面传过来的弹框状态
- openModal (newValue, oldValue) {
- this.isShow = newValue
- },
- // 重定义的弹框状态
- isShow (newValue, oldValue) {
- 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)
- }
- }
- }
- }
- }
- </script>
- <style lang="less">
- .shelfSet-basicInfo-modal {
- .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{
- margin: 0 10px;
- color:red;
- font-weight: bold;
- }
- }
- }
- </style>
|