guoyuji
2024-06-18 cebc472c6c6f1ed7773be63f1201f55b0e906409
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
<script setup>
import request from "@/utils/request"
import {computed, onMounted, ref} from "vue"
import PrintFoot from "@/components/sd/order/PrintFoot.vue"
 
 
 
let props = defineProps({
  orderId:null
})
let data = ref({
  order:{
    processingNote:''
  },
  orderProductDetail:[]
})
const grossNum = ref({
  quantity: 0,
  grossArea: 0,
  perimeter: 0
})
const getData = () => {
  request.get(`/order/printOrderProductDetail/${props.orderId}`).then(res => {
    data.value= res.data
    console.log(data.value)
    res.data.orderProductDetail.forEach(item => {
        grossNum.value.quantity += getQuantity(item.productDetail)
        grossNum.value.grossArea += getArea(item.productDetail)
        grossNum.value.perimeter += getPerimeter(item.productDetail)
 
    })
 
    grossNum.value.quantity = parseFloat(grossNum.value.quantity.toFixed(3))
    grossNum.value.grossArea = parseFloat(grossNum.value.grossArea.toFixed(3))
    grossNum.value.perimeter = parseFloat(grossNum.value.perimeter.toFixed(3))
 
  })
}
 
onMounted(() => {
  getData()
})
 
const getQuantity = (productList) => {
  let quantity = 0
  productList.forEach(item => {
    quantity += item.quantity
  })
  return parseFloat(quantity.toFixed(3))
 
}
 
const getArea = (productList) => {
  let area = 0
  productList.forEach(item => {
    area += item.grossArea
  })
  return parseFloat(area.toFixed(3))
 
}
 
const getPerimeter = (productList) => {
  let perimeter = 0
  productList.forEach(item => {
    perimeter += item.perimeter
  })
  return parseFloat(perimeter.toFixed(3))
}
 
const printSheet = () => {
  // printJS({
  //   printable:'sheet',
  //   type:'html',
  //   //style:styleAll(),
  //   targetStyles: ['*']
  //   //scanStyles:false
  // })
}
 
 
 
 
defineExpose({
  printSheet
});
</script>
 
 
<template>
  <div id="sheet">
 
    <el-row class="titles" style="margin-bottom: 0.5rem;">
        <img src="../../../assets/northGlass.ico" alt="" style="float: left;max-width: 60px;max-height: 60px">
        <h1>
          天津北玻玻璃工业技术有限公司(THBB-QR7.1-01)
        </h1>
 
    </el-row >
    <el-row style="text-align: left">
      <el-col :span="1" ></el-col>
      <el-col :span="9" >地址:天津宝坻区节能环保工业区天兴路西侧宝中道南侧</el-col>
      <el-col :span="2"></el-col>
      <el-col :span="5" >电话:022-59280088</el-col>
      <el-col :span="5" >传真:022-59280066</el-col>
    </el-row>
    <hr>
    <hr class="hr-border">
 
    <el-row >
      <h3>玻璃加工单</h3>
 
    </el-row>
 
    <table border="1" >
      <tr>
        <th class="title-1">客户名称</th>
        <th colspan="3">{{data.order.customerName}}</th>
        <th class="title-1">工程名称</th>
        <th colspan="3">{{data.order.project}}</th>
      </tr>
      <tr>
        <th class="title-1">生产单号</th>
        <th>{{data.order.orderId}}</th>
        <th class="title-1">下单日期</th>
        <th>{{data.order.createTime}}</th>
        <th class="title-1">订单类型</th>
        <th>{{data.order.orderType}}</th>
        <th class="title-1">跟单员</th>
        <th>{{data.order.creator}}</th>
      </tr>
      <tr>
        <th>磨边</th>
        <th></th>
        <th>完工日期</th>
        <th>{{data.order.deliveryDate}}</th>
        <th>商标</th>
        <th>{{data.order.icon}}</th>
        <th>包装</th>
        <th>{{data.order.packType}}</th>
      </tr>
 
    </table>
    <table border="1" >
 
 
 
 
 
      <thead>
        <tr>
          <th class="title-1">玻璃图号</th>
          <th>彩釉图号</th>
          <th>编号</th>
          <th>规格(宽W*高H)</th>
          <th>片数</th>
          <th>面积</th>
          <th>延米</th>
          <th>交货日期</th>
          <th>序号</th>
          <th>箱架号</th>
          <th>备注1</th>
          <th>备注2</th>
          <th>磨边/备注/加工内容</th>
        </tr>
      </thead>
      <tbody v-for="(item,index) in data.orderProductDetail" :key="index">
        <tr>
          <td class="no-change-row">品&nbsp;&nbsp;种</td>
          <td colspan="9">{{item.productName}}</td>
          <td class="no-change-row">产品描述</td>
          <td colspan="3"></td>
        </tr>
        <tr v-for="(item1,index1) in item.productDetail" :key="index1">
          <td>{{}}</td>
          <td></td>
          <td></td>
          <td>{{item1.width +'*'+item1.height}}</td>
          <td>{{item1.quantity}}</td>
          <td>{{item1.grossArea}}</td>
          <td>{{item1.perimeter}}</td>
          <td></td>
          <td>{{item1.orderNumber}}</td>
          <td></td>
          <td></td>
          <td></td>
          <td></td>
        </tr>
 
        <tr>
          <td colspan="4">小计</td>
          <td>{{getQuantity(item.productDetail)}}</td>
          <td>{{getArea(item.productDetail)}}</td>
          <td>{{getPerimeter(item.productDetail)}}</td>
          <td colspan="6"></td>
        </tr>
 
 
      </tbody>
        <tr>
          <td colspan="4">总计</td>
          <td>{{grossNum.quantity}}</td>
          <td>{{grossNum.grossArea}}</td>
          <td>{{grossNum.perimeter}}</td>
          <td colspan="6"></td>
        </tr>
        <tr>
          <td colspan="13">
<!--            v-model=""-->
            <el-input
                v-model="data.order.processingNote"
                :rows="2"
                type="textarea"
                placeholder=""
                readonly
                autosize
                resize="none"
 
            />
          </td>
        </tr>
    </table>
    <print-foot :order='data.order' />
  </div>
</template>
 
<style scoped>
#sheet{
  text-align: center;
}
h1,h3{
   left:0;
    right:0;
    top:0;
    bottom:0;
    margin:auto;
}
h1{
  font-size: 1.5rem;
}
h3{
  font-size: 1.2rem;
  font-weight: bolder;
}
 
 
table{
  border-collapse: collapse;
  border: 1px solid black;
  width: 100%;
  text-align: center;
}
th,.no-change-row {
  white-space: nowrap;
}
 
.title-1{
  width: 76px;
}
 
.hr-border{
  height: 2px;
  width: 100%;
  background-color: black;
  color: black;
}
 
 
 
</style>