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
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
<template>
  <div class="order-manage">
    <div class="filter">
      <div class="filter-card">
        <CommonSearch
          :show-add="false"
          :show-download="false"
          :amount-view="true"
          :totalObject="totalObject"
          :otherOptions="otherOptions"
          :show-action-btn="false"
          :placeholder="'请输入订单编号'"
          @searchClick="onFilterSearch"
        />
      </div>
    </div>
    <div class="content">
      <div class="content-top">
        <div class="list-view">
          <TableCommonView
            ref="tableListRef"
            :table-list="tableList"
            @tableRowClick="tableRowClick"
            :selectClassRow="selectRow"
            @selTableCol="selTableCol"
            @getSelectArray="getSelectArray"
            :outsourceOrderStatus="'status'"
          >
            <template slot="tableButton">
              <el-table-column label="操作" width="160" fixed="right">
                <template slot-scope="scope">
                  <el-button v-if="scope.row.status == 0" type="text" size="small">待确认</el-button>
                  <el-button
                    v-else-if="scope.row.status == 2 || scope.row.status == 4"
                    type="text"
                    size="small"
                    @click.stop="applyClick(scope.row)"
                    >申请物料</el-button
                  >
                  <template v-else-if="scope.row.status == 5">
                    <el-button type="text" size="small">生产完成</el-button>
                    <el-button type="text" size="small" @click.stop="deliveryClick(scope.row)">发货</el-button>
                  </template>
                  <template v-else-if="scope.row.status == 6">
                    <el-button type="text" size="small" @click.stop="deliveryClick(scope.row)">发货</el-button>
                    <el-button type="text" size="small">关闭</el-button>
                  </template>
                  <span v-else>--</span>
                </template>
              </el-table-column>
            </template>
          </TableCommonView>
        </div>
        <div class="btn-pager">
          <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
        </div>
      </div>
      <div class="content-bottom">
        <div class="lable-view table-bottom-tabs">
          <span class="name">{{ selectRow.number || "--" }}</span>
          <div
            class="tab-pane"
            @click="tabClickBottom(1)"
            :style="{
              background: activeNameBottom == 1 ? '#2a78fb' : '#F1F3F8',
              color: activeNameBottom == 1 ? '#fff' : '#666'
            }"
          >
            产品信息
          </div>
          <div
            class="tab-pane"
            @click="tabClickBottom(2)"
            :style="{
              background: activeNameBottom == 2 ? '#2a78fb' : '#F1F3F8',
              color: activeNameBottom == 2 ? '#fff' : '#666'
            }"
          >
            物料申请单
          </div>
          <div
            class="tab-pane"
            @click="tabClickBottom(3)"
            :style="{
              background: activeNameBottom == 3 ? '#2a78fb' : '#F1F3F8',
              color: activeNameBottom == 3 ? '#fff' : '#666'
            }"
          >
            发货明细
          </div>
        </div>
        <div class="list-view">
          <TableCommonView
            v-if="activeNameBottom == 1"
            :table-list="bottomTwoTableList1"
            v-loading="isTableBottomLoading"
            element-loading-text="数据加载中,请耐心等待~"
            @selTableCol="selBottomTableCol"
          >
          </TableCommonView>
          <TableCommonView
            v-if="activeNameBottom == 2"
            :table-list="bottomTwoTableList2"
            @selTableCol="selBottomTwoTableCol2"
          >
          </TableCommonView>
          <TableCommonView
            v-if="activeNameBottom == 3"
            :table-list="bottomTwoTableList3"
            @selTableCol="selBottomTwoTableCol3"
          >
          </TableCommonView>
        </div>
      </div>
    </div>
    <!-- 申请物料-->
    <ApplyMaterialsDialog
      v-if="editApplyConfig.visible"
      :edit-common-config="editApplyConfig"
      @reRreshData="reRreshData"
    />
    <!-- 发货/发货信息 -->
    <DeliveryDialog v-if="deliveryConfig.visible" :edit-common-config="deliveryConfig" @reRreshData="reRreshData" />
  </div>
</template>
 
<script>
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
import ApplyMaterialsDialog from "@/views/orderManageModule/orderManage/components/ApplyMaterialsDialog"
import DeliveryDialog from "@/views/orderManageModule/orderManage/components/DeliveryDialog"
export default {
  name: "orderManage",
  props: {},
  components: { ApplyMaterialsDialog, DeliveryDialog },
  mixins: [pageMixin],
  computed: {},
  data() {
    return {
      totalObject: {
        value: 0,
        label: "订单总量"
      },
      otherOptions: [
        {
          value: 0,
          label: "待分配",
          status: "yellow"
        },
        {
          value: 0,
          label: "已分配",
          status: "success"
        }
      ],
      tableList: {},
      tableColumn: [
        { label: "订单编号", prop: "number", min: 90, default: true },
        { label: "产品数量", prop: "quotationName", min: 120 },
        { label: "签约日期", prop: "validity_date", min: 100 },
        { label: "交付日期", prop: "client_name", min: 120 },
        { label: "状态", prop: "quotationStatus", isCallMethod: true, getCallMethod: this.getStatus }
      ],
      showCol: ["订单编号", "产品数量", "签约日期", "交付日期", "状态"],
      selectRow: {},
      activeNameBottom: 1,
      isTableBottomLoading: false,
      bottomTwoTableList1: {},
      bottomTwoTableList2: {},
      bottomTwoTableList3: {},
      productColumn: [
        { label: "产品名称", prop: "number", min: 90, default: true },
        { label: "产品编号", prop: "quotationName", min: 120 },
        { label: "Bom编号", prop: "validity_date", min: 100 },
        { label: "产品规格", prop: "client_name", min: 120 },
        { label: "产品数量", prop: "quotationStatus" },
        { label: "单位", prop: "client_name", min: 120 }
      ],
      showProductCol: ["产品名称", "产品编号", "Bom编号", "产品规格", "产品数量", "单位"],
      materialRquestColumn: [
        { label: "产品名称", prop: "number", min: 90, default: true },
        { label: "产品编号", prop: "quotationName", min: 120 },
        { label: "产品数量", prop: "validity_date", min: 100 },
        { label: "产品规格", prop: "client_name", min: 120 },
        { label: "产品型号", prop: "quotationStatus" },
        { label: "单位", prop: "client_name", min: 120 }
      ],
      showMaterialRquestCol: ["产品名称", "产品编号", "产品数量", "产品规格", "产品型号", "单位"],
      deliveryRquestColumn: [
        { label: "发货单号", prop: "number", default: true },
        { label: "产品名称", prop: "number", default: true },
        { label: "产品编号", prop: "quotationName" },
        { label: "订单数量", prop: "validity_date" },
        { label: "发货数量", prop: "validity_date" },
        { label: "产品规格", prop: "client_name" },
        { label: "产品型号", prop: "quotationStatus" },
        { label: "单位", prop: "client_name" },
        { label: "运单号", prop: "validity_date" },
        { label: "承运商", prop: "validity_date" },
        { label: "创建时间", prop: "client_name", min: 100 }
      ],
      showDeliveryRquestCol: [
        "发货单号",
        "产品名称",
        "产品编号",
        "订单数量",
        "发货数量",
        "产品规格",
        "产品型号",
        "单位",
        "运单号",
        "承运商",
        "创建时间"
      ],
      editApplyConfig: {
        visible: false,
        title: "物料申请",
        infomation: {}
      },
      deliveryConfig: {
        visible: false,
        title: "发货",
        infomation: {}
      }
    }
  },
  created() {
    this.setTable()
  },
  methods: {
    reRreshData() {
      this.getData()
    },
    addCommonClick() {
      alert("露西666")
    },
    searchClick() {},
    onFilterSearch() {},
    tableRowClick() {},
    getSelectArray() {},
    // 申请物料
    applyClick(row) {
      this.editApplyConfig.visible = true
      this.editApplyConfig.title = "物料申请"
      this.editApplyConfig.infomation = {
        outsourcingOrderNumber: row.number,
        ...row,
        products: []
      }
    },
    // 发货
    deliveryClick(row) {
      this.deliveryConfig.visible = true
      this.deliveryConfig.title = "发货"
      this.deliveryConfig.infomation = {
        outsourcingOrderNumber: row.number
      }
    },
    tabClickBottom(activeNameBottom) {
      this.activeNameBottom = activeNameBottom
      // if (activeNameBottom == 1) {
      //   this.getProductListMethod(this.selectRow.id);
      // } else {
      //   this.getMaterialApplyList(this.selectRow.number);
      // }
    },
    setTable() {
      this.tableList = {
        selectIndex: true,
        selectBox: true,
        tableInfomation: [
          {
            number: "1111",
            status: 4
          }
        ],
        allcol: [],
        showcol: this.showCol,
        tableColumn: this.setColumnVisible(this.showCol, this.tableColumn)
      }
      this.setTableList(this.tableList)
      // bottom 产品信息
      this.tableBottomColumn = this.productColumn
      this.showBottomCol = this.showProductCol
      this.setBottomList()
      this.setBottomMaterialList()
      this.setBottomDeliveryList()
    },
    // bom 产品新列表
    setBottomList() {
      this.bottomTwoTableList1 = {
        selectIndex: true,
        tableInfomation: [],
        allcol: [],
        showcol: this.showBottomCol,
        tableColumn: this.setColumnVisible(this.showBottomCol, this.tableBottomColumn)
      }
      this.setTableList(this.bottomTwoTableList1)
    },
    setTableList(tableList) {
      tableList.allcol = tableList.tableColumn.filter((ele) => !ele.default).map((ele) => ele.label)
      this.searchOptions = []
      for (let i = 0; i < tableList.tableColumn.length; i++) {
        const label = tableList.tableColumn[i].label
        const value = tableList.tableColumn[i].prop
        this.searchOptions.push({ value: value, label: label })
      }
    },
    // bottom 产品信息
    selBottomTableCol(val) {
      this.showProductCol = val
      this.bottomTwoTableList1.tableColumn = this.setColumnVisible(val, this.tableBottomColumn)
    },
    setColumnVisible(showCol, tableColumn) {
      return tableColumn.map((ele) => {
        return {
          ...ele,
          isShowColumn: showCol.includes(ele.label)
        }
      })
    },
    selTableCol(val) {
      this.showcol = val
      this.tableList.tableColumn = this.setColumnVisible(val)
    },
    // bottom 物料申请单
    setBottomMaterialList() {
      this.bottomTwoTableList2 = {
        selectIndex: true,
        tableInfomation: [],
        allcol: [],
        showcol: this.showMaterialRquestCol,
        tableColumn: this.setColumnVisible(this.showMaterialRquestCol, this.materialRquestColumn)
      }
      this.setTableList(this.bottomTwoTableList2)
    },
    selBottomTwoTableCol2(val) {
      this.showMaterialRquestCol = val
      this.bottomTwoTableList1.tableColumn = this.setBottomTwoTableColumn1(val, this.materialRquestColumn)
    },
    // bottom 物料申请单
    setBottomDeliveryList() {
      this.bottomTwoTableList3 = {
        selectIndex: true,
        tableInfomation: [],
        allcol: [],
        showcol: this.showDeliveryRquestCol,
        tableColumn: this.setColumnVisible(this.showDeliveryRquestCol, this.deliveryRquestColumn)
      }
      this.setTableList(this.bottomTwoTableList2)
    },
    selBottomTwoTableCol3(val) {
      this.showDeliveryRquestCol = val
      this.bottomTwoTableList3.tableColumn = this.setBottomTwoTableColumn1(val, this.deliveryRquestColumn)
    },
    // 状态
    getStatus(val) {
      return val === 0
        ? "待分配"
        : val === 1
        ? "已分配"
        : val === 2
        ? "待生产"
        : val === 3
        ? "待领料审核"
        : val === 4
        ? "领料审核拒绝"
        : val === 5
        ? "生产中"
        : val === 6
        ? "生产完成"
        : "--"
    }
  }
}
</script>
 
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
.order-manage {
  height: 100%;
  overflow: hidden;
  background-color: transparent;
  .filter {
    height: 80px;
    display: flex;
    align-items: center;
    padding: 12px 20px 0 20px;
    &-card {
      height: 80px;
      display: flex;
      align-items: center;
      box-sizing: border-box;
      padding: 10px 20px;
      flex: 1;
      border-radius: 12px;
      background-color: #fff;
    }
  }
  .content {
    width: 100%;
    height: calc(100% - 102px);
    box-sizing: border-box;
    padding: 10px 20px;
    border-radius: 12px;
    .content-top {
      min-height: 70px;
      background-color: #fff;
      height: 48%;
      border-radius: 12px;
      .list-view {
        height: calc(100% - 60px);
      }
    }
    .content-bottom {
      background-color: #fff;
      min-height: 70px;
      height: calc(52% - 10px);
      margin-top: 10px;
      // padding: 10px 20px;
      .lable-view {
        width: 100%;
        background: #e6ecf2;
        height: 40px;
        line-height: 40px;
        position: relative;
        .name {
          border-left: 4px solid #2a78fb;
          padding-left: 10px;
          margin-right: 40px;
        }
        .sure-btn {
          float: right;
          position: absolute;
          right: 0;
          top: 0;
        }
      }
      .list-view {
        height: calc(100% - 40px);
      }
      // 列表下的页签的样式
      .table-bottom-tabs {
        height: 34px;
        line-height: 34px;
        background: #e6ecf2;
        display: flex;
        font-size: 14px;
        .tab-pane {
          min-width: 60px;
          width: auto;
          padding: 0 20px;
          margin-right: 20px;
          text-align: center;
          background: #2a78fb;
          cursor: pointer;
          border-top-left-radius: 20px;
          border-top-right-radius: 20px;
        }
      }
    }
  }
}
::v-deep {
  .el-table {
    height: auto !important;
    .el-table--fit {
      height: 90%;
    }
    .onSelect {
      background: #ebf2ff;
    }
  }
  .el-table {
    height: 100% !important;
  }
}
</style>