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
<template>
  <div class="add-sales-details">
    <el-dialog
      :close-on-click-modal="false"
      :visible.sync="editRow.visible"
      width="64rem"
      :before-close="handleClose"
      append-to-body
      custom-class="delivery-dalog"
    >
      <div slot="title" class="tac drawerHeader">
        {{ editCommonConfig.title }}
      </div>
      <div class="dialog-body">
        <el-form :model="ruleForm" :rules="rules" ref="form" label-width="90px" class="demo-ruleForm">
          <el-row>
            <el-col :span="6">
              <el-form-item label="发货单号:" prop="number">
                <el-input v-model="ruleForm.number" size="mini"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="承运商:" prop="carrier">
                <el-input v-model="ruleForm.carrier" size="mini"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="运单号:" prop="waybillNumber">
                <el-input v-model="ruleForm.waybillNumber" size="mini"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6"></el-col>
          </el-row>
        </el-form>
        <el-table
          ref="multipleTable"
          :data="tableData"
          tooltip-effect="dark"
          style="width: 100%"
          height="500"
          border
          @selection-change="getSelectArray"
          :header-cell-style="{
            background: '#f1f3f8',
            color: '#000009',
            'font-size': '12px',
            'font-family': 'PingFangSC'
          }"
          size="mini"
        >
          <!-- <el-table-column type="selection" width="55"> </el-table-column> -->
          <el-table-column type="index" label="序号" width="50" align="center"></el-table-column>
          <el-table-column prop="name" label="产品名称" show-overflow-tooltip></el-table-column>
          <el-table-column prop="number" label="产品编号" show-overflow-tooltip> </el-table-column>
          <el-table-column prop="orderAmount" label="订单数量"> </el-table-column>
          <el-table-column prop="amount" label="已发货数量"> </el-table-column>
          <el-table-column prop="specifications" label="产品规格"> </el-table-column>
          <el-table-column prop="modelNumber" label="产品型号"> </el-table-column>
          <el-table-column prop="unit" label="单位"> </el-table-column>
          <el-table-column prop="deliveryAmount" label="发货数量">
            <template slot-scope="scope">
              <el-input
                v-model.number="scope.row.deliveryAmount"
                placeholder=""
                :min="0"
                size="mini"
                @change="
                  (val) => {
                    inputContent(val, scope)
                  }
                "
              ></el-input>
            </template>
          </el-table-column>
          <div slot="empty">
            <el-empty description="暂无数据"></el-empty>
          </div>
        </el-table>
      </div>
      <div slot="footer" class="dialog-footer">
        <template v-if="isView">
          <el-button @click="editRow.visible = false">关闭</el-button>
        </template>
        <template v-else>
          <el-button type="primary" :loading="isAddloading" @click="saveClick('form')">全部发货完成</el-button>
          <el-button @click="editRow.visible = false">取消</el-button>
          <el-button type="primary" :loading="isAddloading" @click="saveClick('form')">确认发货</el-button>
        </template>
      </div>
    </el-dialog>
  </div>
</template>
 
<script>
// import { saveMaterialApply } from "@/api/outsourceEnterpriseManage/index"
export default {
  name: "DeliveryDialog",
  props: {
    editCommonConfig: {
      type: Object,
      default: () => {
        return {
          visible: false,
          title: "发货",
          infomation: {}
        }
      }
    }
  },
  components: {},
  data() {
    return {
      editRow: this.editCommonConfig,
      isView: this.editCommonConfig.title === "发货信息",
      editSelCommonConfig: {
        editVisible: false,
        isSelectBox: false,
        title: "",
        infomation: {}
      },
      isAddloading: false,
      tableData: [
        {
          name: "顶顶顶顶",
          deliveryAmount: 2
        }
      ],
      ruleForm: {
        number: "",
        carrier: "",
        waybillNumber: ""
      },
      rules: {
        number: [{ required: true, message: "请输入发货单号", trigger: "blur" }]
      }
    }
  },
  created() {
    // this.setTableForm()
  },
  watch: {
    "editCommonConfig.visible"(val) {
      if (val) {
        // this.setTableForm()
      }
    }
  },
  methods: {
    handleClose() {
      this.editRow.visible = false
    },
    // 多选回调
    getSelectArray(arr) {
      console.log(arr)
      // let isPush = true
      // if (arr.length > 0) {
      //   for (let i in arr) {
      //     let item = {
      //       outsourcingOrderNumber: this.editRow.infomation.outsourcingOrderNumber,
      //       materialNumber: arr[i].id,
      //       materialName: arr[i].name,
      //       amount: 1,
      //       unit: arr[i].unit ? arr[i].unit : 1,
      //       type: arr[i].type ? arr[i].type : "",
      //       specs: arr[i].specs ? arr[i].specs : ""
      //     }
      //     console.log(arr, "8989")
      //     isPush = this.getIsPush(this.productTableList.tableInfomation, arr[i].id)
      //     if (isPush) {
      //       this.productTableList.tableInfomation.splice(this.productTableList.tableInfomation.length, 0, item)
      //     }
      //   }
    },
    // 数量输入回调
    inputContent(val, scope) {
      console.log(val, scope)
    },
    saveClick(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          console.log("保存内容处理")
        }
      })
    }
  }
}
</script>
 
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
::v-deep {
  .delivery-dalog .el-dialog__header {
    background: #fff;
  }
  .delivery-dalog .el-dialog__body {
    padding: 20px !important;
  }
  .el-dialog__footer {
    width: 100%;
    height: 65px;
    // line-height: 55px;
    background-color: #fff;
    padding: 0px 20px 0;
    text-align: right;
    box-sizing: border-box;
    border-top: 0px solid #dadee5;
    position: relative;
    .footer-left {
      position: absolute;
      top: 0px;
      left: 20px;
    }
  }
}
</style>