Blame view

ant-design-vue-jeecg/src/views/system/task/modules/MaterialTaskModal.vue 5.53 KB
1
2
3
<template>
  <a-modal
    :title="title"
4
    :width="900"
5
6
7
8
9
10
11
12
13
14
    :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">
        <!-- 主表单区域 -->
        <a-row class="form-row" :gutter="0">
15
          <a-col :lg="10">
肖超群 authored
16
17
            <a-form-model-item label="容器编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="containerCode">
肖超群 authored
18
              <j-select-multi-can-use-container v-model="quickMainModel.containerCode"></j-select-multi-can-use-container>
19
20
21
22
            </a-form-model-item>
          </a-col>

          <a-col :lg="8">
肖超群 authored
23
            <a-form-model-item label="入库口">
24
25
26
27
28
29
30
31
<!--              <a-input placeholder="请输入入库口" v-model="quickMainModel.toPort"/>-->
              <j-search-select-tag
                placeholder="请选择入库口"
                v-model="quickMainModel.toPort"
                dict="port,name,code,type!='2'"
                :pageSize="5"
                :async="true">
              </j-search-select-tag>
32
33
34
35
            </a-form-model-item>
          </a-col>
        </a-row>
36
37
38

      <!-- 子表单区域 -->
39
40
41
42
43
44
      <a-tabs defaultActiveKey="1">
        <a-tab-pane tab="物料信息" key="1">
          <div>
            <a-row type="flex" style="margin-bottom:10px" :gutter="16">
              <a-col :span="8">物料编码</a-col>
              <a-col :span="5">数量</a-col>
陈翱 authored
45
              <a-col :span="2">操作</a-col>
46
47
48
49
50
51
52
53
54
55
56
57
            </a-row>

            <a-row type="flex" style="margin-bottom:10px" :gutter="16"
                   v-for="(item, index) in quickMainModel.receiptEntityList" :key="index">
              <a-col :span="6" style="display: none">
                <a-form-model-item>
                  <a-input placeholder="id" v-model="item.id"/>
                </a-form-model-item>
              </a-col>
              <a-col :span="8">
                <a-form-model-item>
                  <j-search-select-tag
58
                    placeholder="请选择"
59
                    v-model="item.materialCode"
60
                    :dict="'material,name,code '"
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
                    :pageSize="5"
                    :async="true">
                  </j-search-select-tag>
                </a-form-model-item>
              </a-col>
              <a-col :span="5">
                <a-form-model-item>
                  <a-input placeholder="数量" v-model="item.qty"/>
                </a-form-model-item>
              </a-col>

              <a-col :span="2">
                <a-form-model-item>
                  <a-icon type="minus-circle" @click="delRowCustom(index)" style="fontSize :20px"/>
                </a-form-model-item>
              </a-col>
            </a-row>
            <a-button type="dashed" style="width: 98%;margin-top: 10px" @click="addRowCustom">
              <a-icon type="plus"/>
              添加物料信息
            </a-button>
          </div>
83
84
        </a-tab-pane>
      </a-tabs>
85
      </a-form-model>
86
87
88
89
90
91
92
    </a-spin>
  </a-modal>
</template>

<script>

import JEditableTable from '@/components/jeecg/JEditableTable'
肖超群 authored
93
import {execute, quickReceipt} from '@/api/api'
94
import JDate from '@/components/jeecg/JDate'
肖超群 authored
95
import JSelectMultiCanUseContainer from "../../../../components/jeecgbiz/JSelectMultiCanUseContainer";
96
97
98
99

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

<style scoped>
</style>