Blame view

ant-design-vue-jeecg/src/views/system/task/modules/MaterialTaskModal.vue 5.4 KB
1
2
3
<template>
  <a-modal
    :title="title"
谭毅彬 authored
4
    :width="800"
5
6
7
8
9
10
11
12
13
    :visible="visible"
    :maskClosable="false"
    :confirmLoading="confirmLoading"
    @ok="handleOk"
    @cancel="handleCancel">

    <a-spin :spinning="confirmLoading">
      <a-form-model ref="form" :label-col="labelCol" :wrapper-col="wrapperCol" :model="model">
        <!-- 主表单区域 -->
谭毅彬 authored
14
        <a-row class="form-row" :gutter="24">
肖超群 authored
15
16
17
          <a-col :lg="8">
            <a-form-model-item label="托盘号"   :rules="[{ required: true, message: '请输入托盘号!' }]">
              <a-input placeholder="请输入托盘号" v-model="quickMainModel.containerCode"/>
18
19
            </a-form-model-item>
          </a-col>
谭毅彬 authored
20
          <a-col :lg="10">
肖超群 authored
21
            <a-form-model-item label="入库口">
22
23
24
25
<!--              <a-input placeholder="请输入入库口" v-model="quickMainModel.toPort"/>-->
              <j-search-select-tag
                placeholder="请选择入库口"
                v-model="quickMainModel.toPort"
26
                dict="port,name,code,type='3'"
27
28
29
                :pageSize="5"
                :async="true">
              </j-search-select-tag>
30
31
32
33
            </a-form-model-item>
          </a-col>
        </a-row>
      <!-- 子表单区域 -->
34
35
36
      <a-tabs defaultActiveKey="1">
        <a-tab-pane tab="物料信息" key="1">
          <div>
谭毅彬 authored
37
38
39
40
            <a-row type="flex" style="margin-bottom:10px" :gutter="24">
              <a-col :span="12">物料编码</a-col>
              <a-col :span="8">数量</a-col>
              <a-col :span="4">操作</a-col>
41
            </a-row>
谭毅彬 authored
42
43
            <a-row type="flex" style="margin-bottom:-20px" :gutter="24" v-for="(item, index) in quickMainModel.receiptEntityList" :key="index">
              <a-col style="display: none">
44
45
46
47
                <a-form-model-item>
                  <a-input placeholder="id" v-model="item.id"/>
                </a-form-model-item>
              </a-col>
谭毅彬 authored
48
              <a-col :span="12">
49
50
                <a-form-model-item>
                  <j-search-select-tag
51
                    placeholder="请选择"
52
                    v-model="item.materialCode"
谭毅彬 authored
53
                    :dict="'material,name,code'"
54
55
56
57
58
                    :pageSize="5"
                    :async="true">
                  </j-search-select-tag>
                </a-form-model-item>
              </a-col>
谭毅彬 authored
59
              <a-col :span="8">
60
61
62
63
                <a-form-model-item>
                  <a-input placeholder="数量" v-model="item.qty"/>
                </a-form-model-item>
              </a-col>
谭毅彬 authored
64
              <a-col :span="4">
65
66
67
68
69
                <a-form-model-item>
                  <a-icon type="minus-circle" @click="delRowCustom(index)" style="fontSize :20px"/>
                </a-form-model-item>
              </a-col>
            </a-row>
谭毅彬 authored
70
            <a-button type="dashed" style="width: 100%;margin-top: 10px" @click="addRowCustom"><a-icon type="plus"/>添加物料信息</a-button>
71
          </div>
72
73
        </a-tab-pane>
      </a-tabs>
74
      </a-form-model>
75
76
77
78
79
80
81
    </a-spin>
  </a-modal>
</template>

<script>

import JEditableTable from '@/components/jeecg/JEditableTable'
肖超群 authored
82
import {execute, quickReceipt} from '@/api/api'
83
import JDate from '@/components/jeecg/JDate'
肖超群 authored
84
import JSelectMultiCanUseContainer from "../../../../components/jeecgbiz/JSelectMultiCanUseContainer";
85
86
87
88

export default {
  name: 'MaterialTaskModal',
  components: {
肖超群 authored
89
    JDate, JEditableTable,JSelectMultiCanUseContainer
90
91
92
  },
  data() {
    return {
93
      title: '快速入库',
94
95
96
97
98
      visible: false,
      confirmLoading: false,
      model: {},
      labelCol: {
        xs: {span: 24},
谭毅彬 authored
99
        sm: {span: 4}
100
101
102
      },
      wrapperCol: {
        xs: {span: 24},
谭毅彬 authored
103
        sm: {span: 24}
104
105
      },
      activeKey: '1',
106
107
      quickMainModel: {
        receiptEntityList: [{}],
108
      },
109
      // 客户信息
110
111
112
113
114
115
116
117
118
      url: {
        add: '/test/jeecgOrderMain/add',
        edit: '/test/jeecgOrderMain/edit',
      }
    }
  },
  created() {
  },
  methods: {
119
120
    handleOk() {
      this.validateFields()
121
    },
122
123
    handleCancel() {
      this.visible = false
124
125
    },
126
127
128
    addRowCustom() {
      this.quickMainModel.receiptEntityList.push({});
      this.$forceUpdate();
129
    },
130
131
132
133
    delRowCustom(index) {
      console.log(index)
      this.quickMainModel.receiptEntityList.splice(index, 1);
      this.$forceUpdate();
134
    },
135
136
137
138
    addRowTicket() {
      this.quickMainModel.jeecgOrderTicketList.push({});
      console.log(this.quickMainModel.jeecgOrderTicketList)
      this.$forceUpdate();
139
    },
140
141
142
143
    delRowTicket(index) {
      console.log(index)
      this.quickMainModel.jeecgOrderTicketList.splice(index, 1);
      this.$forceUpdate();
144
145
    },
146
147
148
149
150
151
152
    edit(record) {
      this.visible = true
      this.activeKey = '1'
      this.quickMainModel = Object.assign({
        receiptEntityList: [{}]
      }, record);
    },
153
154
    /** 触发表单验证 */
    validateFields() {
155
156
157
158
      // 触发表单验证
      this.$refs.form.validate(valid => {
        //alert(JSON.stringify(this.quickMainModel));
        this.receipt(this.quickMainModel);
159
160
      })
    },
161
肖超群 authored
162
    receipt(record) {
肖超群 authored
163
      this.confirmLoading = true
肖超群 authored
164
165
166
167
168
      this.model = Object.assign({}, record);
      quickReceipt(this.model).then((res) => {
        this.loading = false;
        if (res.success) {
          this.$message.success(res.message);
肖超群 authored
169
          this.$emit('ok');
170
          this.visible = false
肖超群 authored
171
172
173
        } else {
          this.$message.error(res.message);
        }
肖超群 authored
174
        this.confirmLoading = false
肖超群 authored
175
176
      });
    },
177
178
  }
}
谭毅彬 authored
179
</script>