123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273 |
- <template>
- <a-modal
- centered
- class="shelfSet-basicInfo-modal"
- :footer="null"
- :maskClosable="false"
- title="新增回调单--[数字货架]名吃环境啥的技术附件"
- v-model="isShow"
- @cancel="isShow = false"
- width="60%">
- <a-spin :spinning="spinning" tip="Loading...">
- <a-form-model
- id="shelfSet-basicInfo-form"
- ref="ruleForm"
- :model="form"
- :rules="rules"
- :label-col="formItemLayout.labelCol"
- :wrapper-col="formItemLayout.wrapperCol">
- <a-row :gutter="16">
- <a-col :span="8">
- <a-form-model-item label="产品编码" prop="shelfName">
- <a-input allowClear placeholder="请输入产品编码" v-model.tirm="form.productCode"/>
- </a-form-model-item>
- </a-col>
- <a-col :span="8">
- <a-form-item label="产品名称">
- <a-input allowClear placeholder="请输入产品名称" v-model.tirm="form.productName"/>
- </a-form-item>
- </a-col>
- <a-col :span="8">
- <a-form-model-item label="滞销天数">
- <a-input-group>
- <a-row>
- <a-col :span="11">
- <a-input-number
- id="shelfMonitoringList-minUnsalableDays"
- v-model="form.minUnsalableDays"
- :precision="0"
- :min="0"
- :max="999999"
- placeholder="起始天数"
- style="width: 100%;display: inline-block;" />
- </a-col>
- <a-col :span="2"><span style="display: block;text-align: center;line-height: 32px;">至</span></a-col>
- <a-col :span="11">
- <a-input-number
- id="shelfMonitoringList-maxUnsalableDays"
- v-model="form.maxUnsalableDays"
- :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="getSumByType" :disabled="disabled" id="outboundOrderList-refresh" >查询</a-button>
- <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" 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" :loading="loading" @click="start">
- 新增调回单
- </a-button>
- <span class="tableSpan">
- <template v-if="hasSelected">
- 已选<span>{{ selectedRowKeys.length }}</span>款产品,共<span>10</span>件
- </template>
- </span>
- <span>
- <a-checkbox @change="onChange" size="small">
- 仅显示已选产品
- </a-checkbox>
- </span>
- </div>
- <a-table
- :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
- :columns="columns"
- :data-source="data"
- >
- </a-table>
- </div>
- </a-spin>
- </a-modal>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { VSelect } from '@/components'
- import custList from '@/views/common/custList.vue'
- import shelfSList from '@/views/common/shelfList'
- import { shelfSave } from '@/api/shelf'
- export default {
- name: 'ShelfSetRecallBillModal',
- components: { VSelect, custList, shelfSList },
- mixins: [commonMixin],
- props: {
- openModal: {
- // 弹框显示状态
- type: Boolean,
- default: false
- },
- nowData: {
- type: Object,
- default: () => {
- return {}
- }
- },
- type: {
- type: [String, Number],
- default: '1'
- }
- },
- data () {
- return {
- spinning: false,
- isShow: this.openModal, // 是否打开弹框
- formItemLayout: {
- labelCol: { span: 5 },
- wrapperCol: { span: 17 }
- },
- form: {
- },
- columns: [
- { title: '序号', dataIndex: 'no', width: '10%', align: 'center' },
- { title: '货位号', dataIndex: 'no', width: '15%', align: 'center' },
- { title: '产品编码', dataIndex: 'product.code', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '产品名称', dataIndex: 'product.name', 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) ? toThousands(text) : '--' } },
- { title: '补货在途', dataIndex: 'confirmQty', width: '15%', align: 'center', customRender: function (text) { return (text || text == 0) ? toThousands(text) : '--' } },
- { title: '调回在途', dataIndex: 'product.unit', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '货架库存', dataIndex: 'confirmQty', width: '15%', align: 'center', customRender: function (text) { return (text || text == 0) ? toThousands(text) : '--' } },
- { title: '单位', dataIndex: 'product.unit', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '滞销天数', dataIndex: 'confirmQty', width: '15%', align: 'center', customRender: function (text) { return (text || text == 0) ? toThousands(text) : '--' } },
- { title: '调回数量', width: '15%', align: 'left', scopedSlots: { customRender: 'num' } }
- ],
- selectedRowKeys: [], // Check here to configure the default column
- loading: false,
- hasSelected: true,
- rules: {
- shelfName: [{ required: true, message: '请选择货架名称', trigger: 'change' }]
- },
- showRecallBill: false
- }
- },
- methods: {
- start () {
- this.loading = true
- // ajax request after empty completing
- setTimeout(() => {
- this.loading = false
- this.selectedRowKeys = []
- }, 1000)
- },
- onSelectChange (selectedRowKeys) {
- console.log('selectedRowKeys changed: ', selectedRowKeys)
- this.selectedRowKeys = selectedRowKeys
- },
- shelfChange (v, row) {
- this.shelfName = row ? row.shelfName : ''
- },
- // 下一步 保存货架信息
- handlerNextStep () {
- this.showRecallBill = true
- },
- // 客户 change
- custChange (obj, row) {
- this.form.customerSn = row && row.customerSn || undefined
- },
- // 保存
- handleSave () {
- const _this = this
- 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 => {
- if (res.status == 200) {
- _this.$message.success(res.message)
- setTimeout(() => {
- _this.isShow = false
- _this.$emit('ok', res.data)
- _this.spinning = false
- }, 100)
- // 更新价格显示
- // updateShelfPriceShow({
- // shelfSn: form.shelfSn,
- // paramValue: form.showPrice
- // }).then(ret => {
- // if (ret.status == 200) {
- // _this.$message.success(ret.message)
- // setTimeout(() => {
- // _this.isShow = false
- // _this.$emit('ok', res.data)
- // _this.spinning = false
- // }, 100)
- // } else {
- // _this.spinning = false
- // }
- // })
- } else {
- _this.spinning = false
- }
- })
- } else {
- console.log('error submit!!')
- return false
- }
- })
- }
- },
- watch: {
- // 父页面传过来的弹框状态
- openModal (newValue, oldValue) {
- this.isShow = newValue
- },
- // 重定义的弹框状态
- isShow (newValue, oldValue) {
- if (!newValue) {
- this.$emit('close')
- this.$refs.ruleForm.resetFields()
- // this.$refs.custList.resetForm()
- } else {
- // const _this = this
- // this.$nextTick(() => {
- // _this.form.shelfName = _this.nowData.shelfName
- // _this.form.showPrice = _this.nowData.showPrice
- // const custome = _this.nowData.customerEntity
- // if (custome) {
- // _this.form.customerSn = custome.customerSn || ''
- // _this.$refs.custList.fetchUser(custome.customerName || '')
- // _this.$refs.custList.dealerName = {
- // key: custome.customerSn,
- // label: custome.customerName,
- // row: _this.nowData
- // }
- // }
- // })
- }
- }
- }
- }
- </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>
|