WYB
2021-03-22 91b8cdad021ab052e4991f3d41834a6f0ddc36b8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
<template>
  <section>
    <!--工具条-->
    <SearchBar
      :buttonList="buttonList"
      @callFunction="callFunction"
    ></SearchBar>
 
    <!--列表-->
    <el-table
      :data="WMInInventory"
      highlight-current-row
      @current-change="selectCurrentRow"
      v-loading="listLoading"
      @selection-change="selsChange"
      @select="selsChangeOne"
      style="width: 100%"
      ref="multipleTable"
    >
      <el-table-column type="selection" width="50"></el-table-column>
      <el-table-column type="index" width="50"></el-table-column>
      <el-table-column
        prop="InInventoryCode"
        label="入库编号"
        width="110"
        sortable
      ></el-table-column>
      <!-- <el-table-column prop="DepartmentName" label="部门名称" width="150" sortable></el-table-column> -->
      <el-table-column
        prop="WareHouseName"
        label="所属仓库"
        width="130"
        sortable
      ></el-table-column>
      <el-table-column
        prop="SupplierName"
        label="供应商"
        width="280"
        sortable
      ></el-table-column>
      <el-table-column
        prop="OutInTypeName"
        label="出入库类型"
        width="120"
        sortable
      ></el-table-column>
      <el-table-column
        prop="EmployeeName"
        label="采购员"
        width="110"
        sortable
      ></el-table-column>
      <el-table-column
        prop="InTime"
        label="入库时间"
        :formatter="formatDateTime"
        width="150"
        sortable
      ></el-table-column>
      <el-table-column prop="Remark" label="备注" sortable></el-table-column>
      <el-table-column
        prop="AdminName"
        label="创建人"
        width="110"
        sortable
      ></el-table-column>
      <el-table-column
        prop="CreateTime"
        label="创建时间"
        :formatter="formatDateTime"
        width="150"
        sortable
      ></el-table-column>
      <el-table-column label="操作" width="180">
        <template scope="scope">
          <el-button
            size="small"
            class="el-icon-reading jbtn"
            @click="handleDetail(scope.$index, scope.row)"
            >详情</el-button
          >
        </template>
      </el-table-column>
    </el-table>
 
    <!--工具条-->
    <el-col :span="24" class="toolbar">
      <el-pagination
        layout="prev, pager, next"
        @current-change="handleCurrentChange"
        :page-size="20"
        :total="total"
        style="float: right"
      ></el-pagination>
    </el-col>
 
    <!--详情页面-->
    <el-dialog
      title="详情"
      :visible.sync="detailFormVisible"
      v-model="detailFormVisible"
      :close-on-click-modal="false"
      width="1400px"
    >
      <el-button
        class="el-icon-back jbtn"
        @click.native="detailFormVisible = false"
        >返回</el-button
      >
      <el-button v-print="'#print'" class="jbtn">打印</el-button>
 
      <div
        style="
          font-size: 30px;
          line-height: 40px;
          height: 42px;
          color: #000;
          width: 160px;
          margin: 0 auto;
        "
      >
        入库单详情
      </div>
 
      <div id="print">
        <h3>入库信息</h3>
        <el-divider></el-divider>
        <el-form
          :inline="true"
          :model="detailForm"
          label-width="110px"
          ref="detailForm"
        >
          <el-form-item label="入库编号" prop="InInventoryCode">
            <el-input
              :disabled="true"
              v-model="detailForm.InInventoryCode"
            ></el-input>
          </el-form-item>
          <!-- <el-form-item label="部门名称" prop="DepartmentName">
            <el-input :disabled="true" v-model="detailForm.DepartmentName"></el-input>
          </el-form-item> -->
          <el-form-item label="仓库名称" prop="WareHouseName">
            <el-input
              :disabled="true"
              v-model="detailForm.WareHouseName"
            ></el-input>
          </el-form-item>
          <el-form-item label="供应商" prop="SupplierName">
            <el-input
              :disabled="true"
              v-model="detailForm.SupplierName"
            ></el-input>
          </el-form-item>
          <el-form-item label="出入库类型" prop="OutInTypeName">
            <el-input
              :disabled="true"
              v-model="detailForm.OutInTypeName"
            ></el-input>
          </el-form-item>
          <el-form-item label="采购员" prop="EmployeeName">
            <el-input
              :disabled="true"
              v-model="detailForm.EmployeeName"
            ></el-input>
          </el-form-item>
          <el-form-item label="入库时间" prop="InTime">
            <el-input
              :disabled="true"
              v-model="detailForm.InTime"
              :formatter="formatDateTime"
            ></el-input>
          </el-form-item>
          <el-form-item label="备注" prop="Remark">
            <el-input :disabled="true" v-model="detailForm.Remark"></el-input>
          </el-form-item>
        </el-form>
 
        <h3>入库商品列表</h3>
        <el-divider></el-divider>
        <el-table :data="detailForm.InInventoryInfoList" border>
          <el-table-column
            prop="ProductCode"
            label="商品编号"
            width="150"
            sortable
          ></el-table-column>
          <el-table-column
            prop="ProductName"
            label="商品名称"
            width="180"
            sortable
          ></el-table-column>
          <el-table-column
            prop="PurchaseUnit"
            label="商品单位"
            width="110"
            sortable
          ></el-table-column>
          <el-table-column
            prop="ProductSpec"
            label="商品规格"
            width="180"
            sortable
          ></el-table-column>
          <el-table-column
            prop="Price"
            label="单价"
            width="100"
            sortable
          ></el-table-column>
          <el-table-column
            prop="ActualAmount"
            label="总价"
            width="100"
            sortable
          ></el-table-column>
          <el-table-column
            prop="CheckNum"
            label="采购数"
            width="100"
            sortable
          ></el-table-column>
          <el-table-column
            prop="StorageNum"
            label="入库数"
            width="100"
            sortable
          ></el-table-column>
          <el-table-column
            prop="LocationName"
            label="所属库位"
            width="110"
            sortable
          ></el-table-column>
          <el-table-column
            prop="Remark"
            label="备注"
            width
            sortable
          ></el-table-column>
        </el-table>
      </div>
    </el-dialog>
  </section>
</template>
<style scoped>
.jbtn {
  background-color: #f90;
  color: #f3f7fc;
  border: 1px solid #f90;
}
.jbtn:hover {
  background-color: #f90;
}
</style>
<script>
import util from "../../../../util/date";
import {
  //获取后台数据接口
  getWMInInventoryListPage, //入库单列表API
  detailWMInInventory, //入库单详情API
} from "../../../api/api";
import { getButtonList } from "../../../promissionRouter";
import Toolbar from "../../../components/Toolbar";
import SearchBar from "./SearchBar";
export default {
  components: { SearchBar },
  data() {
    return {
      filters: {
        department: "",
        wareHouse: "",
        supplier: "",
        outInType: "",
      },
      WMInInventory: [],
      total: 0,
      buttonList: [],
      currentRow: null,
      page: 1,
      listLoading: false,
      sels: [], //列表选中列
      //详情
      detailForm: {},
      detailFormRules: {},
      detailFormVisible: false, //详情界面是否显示
    };
  },
  methods: {
    //选中行时勾选框
    selsChangeOne(selection, row) {
      this.currentRow = row;
      this.$refs.multipleTable.toggleRowSelection(row); //选中当前选择
      this.selectCurrentRow(row);
    },
    selectCurrentRow(val) {
      this.currentRow = val;
      this.$refs.multipleTable.toggleRowSelection(val); //选中当前选择
    },
    callFunction(item) {
      this.filters = {
        department: item.departmentoptionsSearch,
        wareHouse: item.warehouseoptionsSearch,
        supplier: item.supplieroptionsSearch,
        outInType: item.typeoptionsSearch,
      };
      this[item.Func].apply(this, item);
    },
    formatDateTime: function (row, column) {
      return !row.CreateTime || row.CreateTime == ""
        ? ""
        : util.formatDate.format(new Date(row.CreateTime), "yyyy-MM-dd hh:mm");
    },
    handleCurrentChange(val) {
      this.page = val;
      this.getWMInInventory();
    },
    //获取入库单列表
    getWMInInventory() {
      let para = {
        page: this.page,
        department: this.filters.department,
        wareHouse: this.filters.wareHouse,
        supplier: this.filters.supplier,
        outInType: this.filters.outInType,
      };
      this.listLoading = true;
 
      getWMInInventoryListPage(para).then((res) => {
        this.total = res.data.response.dataCount;
        this.WMInInventory = res.data.response.data;
        this.listLoading = false;
      });
    },
    //显示详情界面
    handleDetail: function (index, row) {
      if (!row) {
        row = this.currentRow;
      }
      let prms = { id: row.Id };
      detailWMInInventory(prms).then((res) => {
        this.detailForm = Object.assign({}, res.data.response);
      });
      this.detailFormVisible = true;
    },
    selsChange: function (sels) {
      this.sels = sels;
    },
  },
  mounted() {
    this.getWMInInventory();
 
    let routers = window.localStorage.router
      ? JSON.parse(window.localStorage.router)
      : [];
    this.buttonList = getButtonList(this.$route.path, routers);
  },
};
</script>