| New file |
| | |
| | | <script setup> |
| | | import request from "@/utils/request" |
| | | import {computed, onMounted, ref} from "vue" |
| | | import PrintFoot from "@/components/sd/order/PrintFoot.vue" |
| | | import companyInfo from "@/stores/sd/companyInfo" |
| | | import deepClone from "@/utils/deepClone"; |
| | | import {ElMessage} from "element-plus"; |
| | | import {add,multiply,multiplyAuto,divideAuto} from '@/utils/decimal'; |
| | | |
| | | |
| | | /*ä¸è¡ä¸¤ååè´§åæå°*/ |
| | | |
| | | const company = companyInfo() |
| | | let produceList = ref([]) |
| | | let otherMoney = [] |
| | | let otherMoney1 = [] |
| | | let delivery = ref([]) |
| | | let money = ref("") |
| | | let otherMoneys = 0 |
| | | let sumMoney = 0 |
| | | let takeCare =ref("注æ:请妥åä¿ç®¡å¥½æå¸çç»çæ¶ï¼å¦æä¸¢å¤±ææåï¼æ1500å
åªèµå¿ã谢谢é
å!") |
| | | let remark =ref(company.deliveryRemark) |
| | | |
| | | |
| | | |
| | | let props = defineProps({ |
| | | deliveryId:null |
| | | }) |
| | | const form = ref({ |
| | | }) |
| | | let produceList2 = ref([]) |
| | | |
| | | |
| | | |
| | | const getData = () => { |
| | | if(props.deliveryId===null || props.deliveryId===undefined || props.deliveryId===''){ |
| | | return |
| | | } |
| | | form.value.deliveryId=props.deliveryId |
| | | form.value.type=company.productName |
| | | |
| | | |
| | | request.post(`/delivery/getSelectDeliveryPrinting`,form.value).then((res) => { |
| | | if(res.code==200){ |
| | | produceList.value = deepClone(res.data) |
| | | for(let i=0;i<produceList.value.length;i++){ |
| | | let produceList1= ({ |
| | | data:null, |
| | | otherMoney:null, |
| | | otherMoney1:null, |
| | | delivery:null, |
| | | money:null, |
| | | otherMoneys:0, |
| | | sumMoney:0 |
| | | }) |
| | | produceList1.data=produceList.value[i].data |
| | | produceList1.delivery=produceList.value[i].delivery |
| | | produceList1.money=produceList.value[i].money |
| | | produceList1.otherMoney=produceList.value[i].otherMoney |
| | | for(let j=0;j<produceList1.data.length;j++){ |
| | | produceList1.sumMoney+=produceList1.data[j].DeliveryDetail.money |
| | | } |
| | | otherMoney1=[] |
| | | for(let i=0;i<produceList1.otherMoney.length;i++){ |
| | | if(produceList1.otherMoney[i].DeliveryDetailOtherMoney.monery!=null){ |
| | | produceList1.otherMoneys+=produceList1.otherMoney[i].DeliveryDetailOtherMoney.monery |
| | | if(otherMoney1.length===0){ |
| | | otherMoney1.push(produceList1.otherMoney[i]) |
| | | } |
| | | else{ |
| | | for(let s=0;s<otherMoney1.length;s++){ |
| | | if(produceList1.otherMoney[i].DeliveryDetailOtherMoney.alias===otherMoney1[s].DeliveryDetailOtherMoney.alias){ |
| | | |
| | | otherMoney1[s].DeliveryDetailOtherMoney.count=add(produceList1.otherMoney[i].DeliveryDetailOtherMoney.count,otherMoney1[s].DeliveryDetailOtherMoney.count) |
| | | otherMoney1[s].DeliveryDetailOtherMoney.monery =add(produceList1.otherMoney[i].DeliveryDetailOtherMoney.monery,otherMoney1[s].DeliveryDetailOtherMoney.monery) |
| | | break |
| | | } |
| | | if(s+1===otherMoney1.length){ |
| | | otherMoney1.push(produceList1.otherMoney[i]) |
| | | break |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | produceList1.otherMoney1=otherMoney1 |
| | | produceList2.value.push(produceList1) |
| | | } |
| | | for(let j=0;j<produceList2.value.length;j++){ |
| | | |
| | | if(produceList2.value[j].delivery.money.toFixed(0)!==(produceList2.value[j].otherMoneys |
| | | +produceList2.value[j].sumMoney+produceList2.value[j].delivery.freight).toFixed(0)){ |
| | | console.log(produceList2.value[j]) |
| | | console.log(produceList2.value[j].delivery.money) |
| | | console.log((produceList2.value[j].otherMoneys |
| | | +produceList2.value[j].sumMoney).toFixed(0)) |
| | | console.log(produceList2.value[j].delivery.deliveryId) |
| | | } |
| | | |
| | | } |
| | | |
| | | }else{ |
| | | ElMessage.warning(res.msg) |
| | | router.push("/login") |
| | | } |
| | | }) |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getData() |
| | | }) |
| | | |
| | | const stringToJson = (productList) => { |
| | | productList.forEach(item => { |
| | | item.otherColumns = JSON.parse(item.otherColumns) |
| | | }) |
| | | } |
| | | |
| | | 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 = () => { |
| | | } |
| | | |
| | | |
| | | const groupedData = computed(() => { |
| | | // åç»å½æ°ï¼å°æ°ç»ææ¯2æ¡æå |
| | | const groupArray = (arr, size) => { |
| | | const result = []; |
| | | for (let i = 0; i < arr.length; i += size) { |
| | | result.push(arr.slice(i, i + size)); |
| | | } |
| | | return result; |
| | | }; |
| | | |
| | | // 对æ¯ä¸ªitemçDeliveryDetailListè¿è¡åç» |
| | | return produceList2.value.map(produce => { |
| | | const groupedDetails = produce.data.map(item => ({ |
| | | ...item, |
| | | // 对å½åitemçæç»è¿è¡åç»ï¼æ¯2æ¡ä¸ç»ï¼ |
| | | groupedDeliveryDetails: groupArray(item.DeliveryDetailList, 2) |
| | | })); |
| | | return { ...produce, data: groupedDetails }; |
| | | }); |
| | | }); |
| | | |
| | | |
| | | |
| | | defineExpose({ |
| | | printSheet |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <div id="sheet"> |
| | | <table class="pages" v-for="(itme1, index) in groupedData" :key="index" > |
| | | <thead> |
| | | <tr class="title-s"> |
| | | <th colspan="11"> |
| | | <h1> |
| | | {{company.companyName}} |
| | | </h1> |
| | | </th> |
| | | </tr> |
| | | |
| | | <tr class="title-s"> |
| | | <th colspan="2" style="width: 20%"></th> |
| | | <th colspan="7" style="width: 60%;"> |
| | | <h4 v-if="!company.showDeliveryCreator" >éåå¸ä¹å¨æºè½ç§ææéå
¬å¸</h4> |
| | | <h3>éå®åè´§å</h3> |
| | | </th> |
| | | <th colspan="2" style="width: 20%;text-align: left;">åè´§åå·ï¼<span>{{itme1.delivery.deliveryId}}</span></th> |
| | | </tr> |
| | | <tr> |
| | | <th style="text-align: left;border:none;" colspan="3">客æ·åç§°ï¼<span>{{itme1.delivery.customerName}}</span></th> |
| | | <th style="text-align: left;border:none;" colspan="6">项ç®åç§°ï¼<span>{{itme1.delivery.project}}</span></th> |
| | | <th style="text-align: left;border:none;" colspan="2">è系人ï¼<span>{{itme1.delivery.contacts}}</span></th> |
| | | </tr> |
| | | <tr> |
| | | <th style="text-align: left;border:none;" colspan="9">éè´§å°åï¼<span>{{itme1.delivery.deliveryAddress}}</span></th> |
| | | <th style="text-align: left;border:none;" colspan="2">èç³»çµè¯ï¼<span>{{itme1.delivery.contactNumber}}</span></th> |
| | | </tr> |
| | | |
| | | |
| | | </thead> |
| | | <tr style="border-style: none"> |
| | | <td colspan="11" style="border-style: none"> |
| | | <table style="border-style: none;width: 100%;height: 100%;"> |
| | | <template v-for="(item, index) in itme1.data" :key="index" > |
| | | <thead> |
| | | <tr v-if="index===0"> |
| | | <th style="width: 14%;" colspan="3">宽Xé«</th> |
| | | <th style="width: 8%;">æ°é</th> |
| | | <th style="width: 9%;">é¢ç§¯</th> |
| | | <th style="width: 1%;"></th> |
| | | <th style="width: 14%;" colspan="3">宽Xé«</th> |
| | | <th style="width: 8%;">æ°é</th> |
| | | <th style="width: 9%;">é¢ç§¯</th> |
| | | </tr> |
| | | |
| | | |
| | | </thead> |
| | | <tr> |
| | | <td style="font-size: 15px;text-align: left" colspan="5">产ååç§°:<span>{{item.DeliveryDetail.orderDetail.productName}}</span></td> |
| | | <td style="font-size: 15px;text-align: left" colspan="3">æ¹æ¬¡:<span>{{item.DeliveryDetail.order.batch}}</span></td> |
| | | <td style="font-size: 15px;text-align: left" colspan="3">订åç¼å·:<span>{{item.DeliveryDetail.orderDetail.orderId}}</span></td> |
| | | </tr> |
| | | |
| | | <tr class="day-in" v-for="(group, groupIndex) in item.groupedDeliveryDetails" :key="groupIndex"> |
| | | <!-- 第ä¸åæ°æ®ï¼ç»å
ç¬¬ä¸æ¡ï¼ --> |
| | | <td style="font-size: 15px;font-weight: bold;" colspan="3"> |
| | | {{ group[0].parsedOtherColumns?.S02 ? `(${group[0].parsedOtherColumns.S02})` : '' }} |
| | | {{ group[0].width }}x{{ group[0].height }} |
| | | </td> |
| | | <td>{{ group[0].quantity }}</td> |
| | | <td>{{ group[0].area }}</td> |
| | | <td></td> <!-- åéå --> |
| | | |
| | | <!-- 第äºåæ°æ®ï¼ç»å
ç¬¬äºæ¡ï¼è¥åå¨ï¼ --> |
| | | <td style="font-size: 15px;font-weight: bold;" colspan="3" v-if="group[1]"> |
| | | {{ group[1].parsedOtherColumns?.S02 ? `(${group[1].parsedOtherColumns.S02})` : '' }} |
| | | {{ group[1].width }}x{{ group[1].height }} |
| | | </td> |
| | | <td v-if="group[1]">{{ group[1].quantity }}</td> |
| | | <td v-if="group[1]">{{ group[1].area }}</td> |
| | | |
| | | <!-- è¥ç»å
åªæä¸æ¡æ°æ®ï¼ç¬¬äºåç空 --> |
| | | <td v-else colspan="5"></td> |
| | | </tr> |
| | | <tr class="day-in" > |
| | | <td style="font-size: 15px;" colspan="9">å°è®¡:</td> |
| | | <td>{{item.DeliveryDetail.quantity}}</td> |
| | | <td>{{item.DeliveryDetail.area}}</td> |
| | | </tr> |
| | | |
| | | </template> |
| | | <tr class="day-in"> |
| | | <td style="font-size: 15px;" colspan="9">å计:</td> |
| | | <td>{{itme1.delivery.quantity}}</td> |
| | | <td>{{itme1.delivery.area}}</td> |
| | | </tr> |
| | | |
| | | |
| | | |
| | | <!-- <el-row :gutter="24"> |
| | | <el-col :span="4"><div style="font-size: 12px" class="bottom">å¶ååï¼{{data.order.creator}}<span style="font-size: 10px"></span></div></el-col> |
| | | <el-col :span="6"><div style="font-size: 12px" class="bottom">å¶åæ¥æï¼{{data.order.createTime}}<span style="font-size: 10px"></span></div></el-col> |
| | | <el-col :span="4"><div style="font-size: 12px" class="bottom">å®¡æ ¸åï¼{{data.order.verifier}}</div></el-col> |
| | | <el-col :span="6"><div style="font-size: 12px" class="bottom">å®¡æ ¸æ¥æï¼{{data.order.updateTime}}</div></el-col> |
| | | <el-col :span="4"><div style="font-size: 12px" class="bottom">æå°äººï¼{{username}}</div></el-col> |
| | | |
| | | </el-row>--> |
| | | |
| | | <tr class="day-in" style="border: 0;" v-if="company.showDeliveryCreator"> |
| | | <td colspan="11" style="border: 0"> |
| | | <div style="display:flex;text-align: left" class="bottom"> |
| | | <div style="width: 15%">å¶ååï¼{{ itme1.delivery.creator }}</div> |
| | | <div style="width: 25%">å¶åæ¥æï¼{{ itme1.delivery.createTime }}</div> |
| | | <div style="width: 10%">åè´§åï¼</div> |
| | | <div style="width: 10%">叿ºï¼</div> |
| | | <div style="width: 15%">客æ·ç¾åï¼</div> |
| | | <div style="width: 15%">ç¾æ¶æ¥æï¼</div> |
| | | </div> |
| | | </td> |
| | | </tr> |
| | | <tr class="day-in" style="border: 0;" v-if="company.showDeliveryCreator"> |
| | | <td colspan="11" style="border: 0;"> |
| | | <div style="display:flex;" class="bottom"> |
| | | æ¶å åª |
| | | {{takeCare}} |
| | | </div> |
| | | </td> |
| | | </tr> |
| | | <tr class="day-in" style="border: 0;"> |
| | | <td colspan="11" style="border: 0;"> |
| | | <div style="display:flex;text-align: left;border: 0;margin-top: 10px " class="bottom" > |
| | | <el-input type="textarea" :autosize="{ minRows: 7, maxRows: 20 }" v-model="remark"/> |
| | | </div> |
| | | |
| | | </td> |
| | | </tr> |
| | | |
| | | <tr class="day-in" style="border: 0" v-if="!company.showDeliveryCreator"> |
| | | <td colspan="11" style="border: 0"> |
| | | <div style="width: 100%;height: 50px"></div> |
| | | </td> |
| | | </tr> |
| | | <tr class="day-in" style="border: 0" v-if="!company.showDeliveryCreator"> |
| | | <td colspan="11" style="border: 0"> |
| | | <div style="display:flex;text-align: left" class="bottom"> |
| | | <div style="width: 15%">å¶ååï¼{{ itme1.delivery.creator }}</div> |
| | | <div style="width: 15%">å¶åæ¥æï¼{{ itme1.delivery.createTime1 }}</div> |
| | | <div style="width: 15%">åè´§åï¼</div> |
| | | <div style="width: 15%">叿ºï¼</div> |
| | | <div style="width: 15%">客æ·ç¾åï¼</div> |
| | | <div style="width: 15%">ç¾æ¶æ¥æï¼</div> |
| | | </div> |
| | | </td> |
| | | </tr> |
| | | |
| | | </table> |
| | | </td> |
| | | </tr> |
| | | |
| | | </table> |
| | | |
| | | |
| | | |
| | | </div> |
| | | |
| | | |
| | | </template> |
| | | |
| | | |
| | | |
| | | |
| | | <style scoped> |
| | | @media print { |
| | | @page { |
| | | margin: 12mm 10mm 20mm 10mm !important; |
| | | } |
| | | .pages { |
| | | page-break-after: always; |
| | | } |
| | | |
| | | @page { |
| | | @top-right { |
| | | margin-top: 50px; |
| | | content: "第 " counter(page) " 页"; /* 使ç¨counteræ·»å 页ç */ |
| | | } |
| | | } |
| | | } |
| | | 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; |
| | | width: 100%; |
| | | text-align: center; |
| | | } |
| | | tr,td,th{ |
| | | border: 1px solid black; |
| | | } |
| | | |
| | | th,.no-change-row { |
| | | white-space: nowrap; |
| | | } |
| | | |
| | | .title-1{ |
| | | width: 76px; |
| | | } |
| | | .title-s,.title-s th{ |
| | | border:0 |
| | | } |
| | | |
| | | .hr-border{ |
| | | height: 2px; |
| | | width: 100%; |
| | | background-color: black; |
| | | color: black; |
| | | } |
| | | table { |
| | | border-collapse: collapse; |
| | | width: 100%; |
| | | |
| | | } |
| | | td > table { |
| | | margin: 0; |
| | | padding: 0; |
| | | } |
| | | |
| | | |
| | | |
| | | </style> |