| | |
| | | import companyInfo from "@/stores/sd/companyInfo" |
| | | import deepClone from "@/utils/deepClone"; |
| | | import {ElMessage} from "element-plus"; |
| | | import {add,addAuto} from '@/utils/decimal'; |
| | | import {add, addAuto} from '@/utils/decimal'; |
| | | |
| | | const company = companyInfo() |
| | | let produceList = ref([]) |
| | |
| | | let money = ref("") |
| | | let otherMoneys = 0 |
| | | let sumMoney = 0 |
| | | let takeCare =ref("具体规格详见清单") |
| | | let remark =ref(company.deliveryRemark) |
| | | |
| | | let takeCare = ref("具体规格详见清单") |
| | | let remark = ref(company.deliveryRemark) |
| | | |
| | | |
| | | let props = defineProps({ |
| | | deliveryId:null, |
| | | type:null |
| | | deliveryId: null, |
| | | type: null |
| | | }) |
| | | const form = ref({ |
| | | }) |
| | | const form = ref({}) |
| | | let produceList2 = ref([]) |
| | | |
| | | |
| | |
| | | |
| | | const pageData = ref() |
| | | const getData = () => { |
| | | if(props.deliveryId===null || props.deliveryId===undefined || props.deliveryId===''){ |
| | | if (props.deliveryId === null || props.deliveryId === undefined || props.deliveryId === '') { |
| | | return |
| | | } |
| | | deliveryId.value = props.deliveryId[0].deliveryId |
| | | form.value.deliveryId=props.deliveryId |
| | | form.value.type=company.productName |
| | | form.value.state=props.type |
| | | form.value.deliveryId = props.deliveryId |
| | | form.value.type = company.productName |
| | | form.value.state = props.type |
| | | |
| | | |
| | | request.post(`/delivery/getSelectDeliveryPrinting`,form.value).then((res) => { |
| | | if(res.code==200){ |
| | | console.log(res.data) |
| | | request.post(`/delivery/getSelectDeliveryPrinting`, form.value).then((res) => { |
| | | if (res.code == 200) { |
| | | //console.log(res.data) |
| | | produceList.value = deepClone(res.data) |
| | | for(let i=0;i<produceList.value.length;i++){ |
| | | produceList.value[i].data.forEach(item =>{ |
| | | for (let i = 0; i < produceList.value.length; i++) { |
| | | produceList.value[i].data.forEach(item => { |
| | | |
| | | |
| | | }) |
| | | let produceList1= ({ |
| | | data:null, |
| | | otherMoney:null, |
| | | otherMoney1:null, |
| | | delivery:null, |
| | | money:null, |
| | | otherMoneys:0, |
| | | sumMoney:0 |
| | | 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 |
| | | 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 = [] |
| | | 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){ |
| | | } 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) |
| | | 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){ |
| | | if (s + 1 === otherMoney1.length) { |
| | | otherMoney1.push(produceList1.otherMoney[i]) |
| | | break |
| | | } |
| | |
| | | } |
| | | |
| | | } |
| | | produceList1.otherMoney1=otherMoney1 |
| | | produceList1.otherMoney1 = otherMoney1 |
| | | produceList2.value.push(produceList1) |
| | | } |
| | | for(let j=0;j<produceList2.value.length;j++){ |
| | | 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)){ |
| | | 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)) |
| | | + produceList2.value[j].sumMoney).toFixed(0)) |
| | | console.log(produceList2.value[j].delivery.deliveryId) |
| | | } |
| | | |
| | | } |
| | | //给数据进行分页 |
| | | pageData.value = groupArrayByFive(produceList2.value[0].data) |
| | | console.log(pageData.value) |
| | | //console.log(pageData.value) |
| | | delivery.value = produceList2.value[0].delivery |
| | | console.log(delivery.value) |
| | | //console.log(delivery.value) |
| | | |
| | | |
| | | |
| | | }else{ |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | router.push("/login") |
| | | } |
| | |
| | | |
| | | function groupArrayByFive(arr) { |
| | | |
| | | let result = []; |
| | | /*let result = []; |
| | | let productName=ref() |
| | | arr.forEach(item=>{ |
| | | for (let i = 0; i < item.DeliveryDetailList.length; i += 8) { |
| | |
| | | result.push(resultMap) |
| | | } |
| | | |
| | | })*/ |
| | | let result = []; |
| | | arr.forEach(item => { |
| | | item.DeliveryDetailList.forEach(items => { |
| | | result.push(items) |
| | | }) |
| | | }) |
| | | console.log(result) |
| | | let index=0 |
| | | let number=0 |
| | | let numberResult = []; |
| | | let results = []; |
| | | let productName=result[0]['product_name'] |
| | | for (let i = 0; i < result.length; i ++) { |
| | | if(productName!=result[i]['product_name']){ |
| | | productName=result[i]['product_name'] |
| | | index++ |
| | | } |
| | | number++ |
| | | numberResult.push(result[i]) |
| | | |
| | | return result; |
| | | |
| | | let next=false |
| | | if (i + 1 != result.length) { |
| | | if(result[i+1]['product_name']!=productName){ |
| | | next=true |
| | | } |
| | | }else{ |
| | | next=true |
| | | } |
| | | |
| | | if((index==3 && next) ||number==8){ |
| | | results.push(numberResult); |
| | | index=0 |
| | | number=0 |
| | | numberResult=[] |
| | | }else{ |
| | | if (i + 1 == result.length) { |
| | | results.push(numberResult); |
| | | index=0 |
| | | number=0 |
| | | numberResult=[] |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | console.log(results) |
| | | |
| | | /*for (let i = 0; i < result.length; i += 8) { |
| | | results.push(result.slice(i, i + 8)); |
| | | }*/ |
| | | |
| | | for (let i = 0; i < results.length; i++) { |
| | | let name = results[i][0]['product_name'] //上一次名称 |
| | | let key = 0; //相同数 |
| | | for (let j = 0; j < results[i].length; j++) { |
| | | let thisName = results[i][j]['product_name']; |
| | | if (thisName != name) { |
| | | results[i][key].rowspan = j - key; |
| | | name=results[i][j]['product_name'] |
| | | key = j; |
| | | } |
| | | if (j + 1 == results[i].length) { |
| | | results[i][key].rowspan = j - key+1; |
| | | name=results[i][j]['product_name'] |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | return results; |
| | | } |
| | | |
| | | let deliveryDate = ref() |
| | | onMounted(() => { |
| | | const today = new Date |
| | |
| | | }) |
| | | |
| | | |
| | | |
| | | const printSheet = () => { |
| | | } |
| | | let companyName = ref('洛阳玻璃公司') |
| | | |
| | | const getQuantitySum = (page)=>{ |
| | | if(pageData.value[page] === undefined){ |
| | | return 0 |
| | | const getQuantitySum = (page) => { |
| | | if (pageData.value[page] === undefined) { |
| | | return 0 |
| | | } |
| | | return pageData.value[page].DeliveryDetailList[0].reduce((accumulator, currentValue) => { |
| | | return add(accumulator,currentValue.quantity) |
| | | return pageData.value[page].reduce((accumulator, currentValue) => { |
| | | return add(accumulator, currentValue.quantity) |
| | | }, 0) |
| | | |
| | | |
| | | } |
| | | const getAreaSum = (page)=>{ |
| | | if(pageData.value[page] === undefined){ |
| | | return 0 |
| | | const getAreaSum = (page) => { |
| | | if (pageData.value[page] === undefined) { |
| | | return 0 |
| | | } |
| | | return pageData.value[page].DeliveryDetailList[0].reduce((accumulator, currentValue) => { |
| | | return addAuto(accumulator,currentValue.area,2) |
| | | return pageData.value[page].reduce((accumulator, currentValue) => { |
| | | return addAuto(accumulator, currentValue.area, 2) |
| | | }, 0) |
| | | } |
| | | const getMoneySum = (page)=>{ |
| | | if(pageData.value[page] === undefined){ |
| | | return 0 |
| | | const getMoneySum = (page) => { |
| | | if (pageData.value[page] === undefined) { |
| | | return 0 |
| | | } |
| | | return pageData.value[page].DeliveryDetailList[0].reduce((accumulator, currentValue) => { |
| | | return addAuto(accumulator,currentValue.money,2) |
| | | return pageData.value[page].reduce((accumulator, currentValue) => { |
| | | return addAuto(accumulator, currentValue.money, 2) |
| | | }, 0) |
| | | } |
| | | |
| | |
| | | </script> |
| | | |
| | | <template> |
| | | <div > |
| | | <el-row id="footsum" :gutter="20" > |
| | | <div> |
| | | <el-row id="footsum" :gutter="20"> |
| | | <el-col :span="20"></el-col> |
| | | <el-col :span="4" style="font-size: 17px" >{{delivery.creator}}</el-col> |
| | | <el-col :span="4" style="font-size: 17px">{{ delivery.creator }}</el-col> |
| | | </el-row> |
| | | <el-row id="footsum1" :gutter="20" > |
| | | <el-col :span="2" ></el-col> |
| | | <el-row id="footsum1" :gutter="20"> |
| | | <el-col :span="2"></el-col> |
| | | <el-col :span="3" style="font-size: 17px">{{ delivery.contacts }}</el-col> |
| | | <el-col :span="7" style="font-size: 17px">{{ delivery.contactNumber }}</el-col> |
| | | <el-col :span="1" ></el-col> |
| | | <el-col :span="1"></el-col> |
| | | <el-col :span="11" style="font-size: 17px">{{ delivery.deliveryAddress }}</el-col> |
| | | </el-row> |
| | | |
| | | <table class="content1" v-for="(page,pageIndex) in pageData" > |
| | | <table class="content1" v-for="(page,pageIndex) in pageData"> |
| | | <thead> |
| | | <tr style="height: 3.6cm"><td></td></tr> |
| | | <tr style="height: 3.6cm"> |
| | | <td></td> |
| | | </tr> |
| | | |
| | | <tr> |
| | | <td colspan="6" > |
| | | <el-row :gutter="20"> |
| | | <el-col :span="2"></el-col> |
| | | <el-col :span="9"> |
| | | <input v-model="companyName" |
| | | style="border: 0;width: 100%; |
| | | <tr> |
| | | <td colspan="6"> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="2"></el-col> |
| | | <el-col :span="9"> |
| | | <input v-model="companyName" |
| | | style="border: 0;width: 100%; |
| | | height: 100%;font-size:19px;font-weight: bold "/> |
| | | </el-col> |
| | | <el-col :span="5" style="font-size:19px;font-weight: bold"> {{deliveryId}} </el-col> |
| | | <el-col :span="6"></el-col> |
| | | <el-col :span="2" style="white-space: nowrap;font-size:19px;font-weight: bold">{{deliveryDate}}</el-col> |
| | | </el-row> |
| | | </td> |
| | | </tr> |
| | | <tr style="height: 0.1cm"><td></td></tr> |
| | | </el-col> |
| | | <el-col :span="5" style="font-size:19px;font-weight: bold"> {{ deliveryId }}</el-col> |
| | | <el-col :span="6"></el-col> |
| | | <el-col :span="2" style="white-space: nowrap;font-size:19px;font-weight: bold">{{ deliveryDate }}</el-col> |
| | | </el-row> |
| | | </td> |
| | | </tr> |
| | | <tr style="height: 0.1cm"> |
| | | <td></td> |
| | | </tr> |
| | | |
| | | <tr style="margin-top: 20px"> |
| | | <td colspan="6"> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="2"></el-col> |
| | | <el-col :span="17" style="font-size: 16px;">{{delivery.customerName }}</el-col> |
| | | <tr style="margin-top: 20px"> |
| | | <td colspan="6"> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="2"></el-col> |
| | | <el-col :span="17" style="font-size: 16px;">{{ delivery.customerName }}</el-col> |
| | | |
| | | <el-col :span="5" style="font-size: 16px;white-space: nowrap;"> {{delivery.project }}</el-col> |
| | | </el-row> |
| | | </td> |
| | | </tr> |
| | | <tr style="height: 0.1cm"><td></td></tr> |
| | | <tr> |
| | | <td colspan="6"> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="2"></el-col> |
| | | <el-col :span="12" style="font-size: 17px;font-weight: bold"> {{delivery.orderId }}</el-col> |
| | | </el-row> |
| | | </td> |
| | | </tr> |
| | | <el-col :span="5" style="font-size: 16px;white-space: nowrap;"> {{ delivery.project }}</el-col> |
| | | </el-row> |
| | | </td> |
| | | </tr> |
| | | <tr style="height: 0.1cm"> |
| | | <td></td> |
| | | </tr> |
| | | <tr> |
| | | <td colspan="6"> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="2"></el-col> |
| | | <el-col :span="12" style="font-size: 16px;"> {{ delivery.orderId }}</el-col> |
| | | </el-row> |
| | | </td> |
| | | </tr> |
| | | |
| | | <tr style="height: 1cm"><td></td></tr> |
| | | |
| | | <tr style="height: 1cm"> |
| | | <td></td> |
| | | </tr> |
| | | |
| | | |
| | | </thead> |
| | | <tbody > |
| | | <template v-for="(items,index1) in page.DeliveryDetailList[0]"> |
| | | <tbody> |
| | | <template v-for="(items,index1) in page"> |
| | | <tr> |
| | | |
| | | <td style="width: 4cm" :rowspan="page.id" v-if="index1===0"> |
| | | <el-input class="textarea" type="textarea" |
| | | :autosize="{ minRows: 1, maxRows: 20 }" |
| | | v-model="page.DeliveryDetail.orderDetail.productName" /> |
| | | <td style="width: 4cm" :rowspan="items.rowspan" v-if="items.rowspan!==undefined"> |
| | | <el-input class="textarea" type="textarea" |
| | | :autosize="{ minRows: 1, maxRows: 20 }" |
| | | v-model="items.product_name"/> |
| | | </td> |
| | | <td style="width: 0.8cm"></td> |
| | | |
| | | <td style="width: 2cm"> |
| | | <el-input class="textarea" type="textarea" |
| | | :autosize="{ minRows: 1, maxRows: 20 }" |
| | | v-model="items.width" /> |
| | | <el-input class="textarea" type="textarea" |
| | | :autosize="{ minRows: 1, maxRows: 20 }" |
| | | v-model="items.width"/> |
| | | |
| | | </td> |
| | | <td style="width: 2cm"> |
| | | <el-input class="textarea" type="textarea" |
| | | :autosize="{ minRows: 1, maxRows: 20 }" |
| | | v-model="items.height" /> |
| | | <td style="width: 2cm"> |
| | | <el-input class="textarea" type="textarea" |
| | | :autosize="{ minRows: 1, maxRows: 20 }" |
| | | v-model="items.height"/> |
| | | |
| | | </td> |
| | | <td style="width: 60px"> |
| | | {{items.quantity}} |
| | | </td> |
| | | <td style="width: 60px"> |
| | | {{ items.quantity }} |
| | | </td> |
| | | <td style="width: 100px"> |
| | | <input style="border: 0;width: 100px" v-model="items.area"> |
| | | <input style="border: 0;width: 100px" v-model="items.area"> |
| | | </td> |
| | | |
| | | <td |
| | | v-if="props.type===1||props.type===3" |
| | | style="width: 80px" |
| | | > |
| | | {{items.price}} |
| | | {{ items.price }} |
| | | </td> |
| | | <td |
| | | v-if="props.type===1||props.type===3" |
| | | > |
| | | {{items.money}} |
| | | {{ items.money }} |
| | | </td> |
| | | |
| | | </tr> |
| | | </template> |
| | | <tr> |
| | | <td></td> |
| | | <td></td> |
| | | <td></td> |
| | | <td></td> |
| | | <td> |
| | | {{getQuantitySum(pageIndex)}} |
| | | </td> |
| | | <td> |
| | | <input style="border: 0;width: 100px" :value="getAreaSum(pageIndex)"> |
| | | </td> |
| | | <td></td> |
| | | <td v-if="props.type===1||props.type===3"> |
| | | {{getMoneySum(pageIndex)}} |
| | | </td> |
| | | <tr id="table-sum"> |
| | | <td id="sum_td"></td> |
| | | <td></td> |
| | | <td></td> |
| | | <td></td> |
| | | <td style="width: 60px"> |
| | | {{ getQuantitySum(pageIndex) }} |
| | | </td> |
| | | <td style="width: 100px"> |
| | | <input style="border: 0;width: 100px" :value="getAreaSum(pageIndex)"> |
| | | </td> |
| | | <td style="width: 80px"></td> |
| | | <td v-if="props.type===1||props.type===3"> |
| | | {{ getMoneySum(pageIndex) }} |
| | | </td> |
| | | |
| | | </tr> |
| | | </tr> |
| | | |
| | | </tbody> |
| | | </table> |
| | |
| | | </template> |
| | | |
| | | |
| | | |
| | | |
| | | <style scoped> |
| | | *{ |
| | | * { |
| | | color: rgba(0, 0, 0, 0.8); /* 更深的黑色 */ |
| | | font-family: 'Microsoft YaHei', '微软雅黑', sans-serif; |
| | | outline: none; |
| | | } |
| | | #sheet{ |
| | | |
| | | #sheet { |
| | | width: 21cm; |
| | | } |
| | | table{ |
| | | |
| | | table { |
| | | width: 18.3cm |
| | | |
| | | } |
| | | .content1{ |
| | | |
| | | .content1 { |
| | | page-break-after: always; |
| | | |
| | | } |
| | | span{ |
| | | |
| | | span { |
| | | width: 7cm; |
| | | text-align: center; |
| | | } |
| | | tbody *{ |
| | | font-size: 12px; |
| | | |
| | | tbody * { |
| | | font-size: 14px; |
| | | } |
| | | #footsum1,#footsum{ |
| | | |
| | | #footsum1, #footsum { |
| | | font-size: 17px; |
| | | } |
| | | |
| | | @media print { |
| | | #footsum{ |
| | | #footsum { |
| | | position: fixed; |
| | | bottom: 3.5cm; |
| | | width: 100%; /* 或者设置成具体的宽度 */ |
| | | font-size: 17px; |
| | | } |
| | | #footsum1{ |
| | | |
| | | #footsum1 { |
| | | position: fixed; |
| | | bottom: 1cm; |
| | | width: 100%; /* 或者设置成具体的宽度 */ |
| | | } |
| | | #table-sum { |
| | | position: absolute; /* 或者使用 relative,根据具体需求 */ |
| | | bottom: 5cm; |
| | | } |
| | | #sum_td{ |
| | | width: 9cm; |
| | | } |
| | | } |
| | | |
| | | .textarea{ |
| | | --el-border-color: rgba(255,255,255,0.0); |
| | | --el-input-focus-border-color: rgba(255,255,255,0.0); |
| | | --el-input-focus-border-width: 0px; |
| | | --el-input-hover-border-color: rgba(255,255,255,0.0); |
| | | --el-input-hover-border-width: 0px; |
| | | .textarea { |
| | | --el-border-color: rgba(255, 255, 255, 0.0); |
| | | --el-input-focus-border-color: rgba(255, 255, 255, 0.0); |
| | | --el-input-focus-border-width: 0px; |
| | | --el-input-hover-border-color: rgba(255, 255, 255, 0.0); |
| | | --el-input-hover-border-width: 0px; |
| | | } |
| | | |
| | | /*textarea { |
| | | |
| | | font-size: 16px; |
| | |
| | | width: 100%; |
| | | height: 100%; |
| | | }*/ |
| | | :deep(.el-textarea__inner){ |
| | | :deep(.el-textarea__inner) { |
| | | color: #333333; |
| | | font-family: 'Microsoft YaHei', '微软雅黑', sans-serif; |
| | | font-size: 12px; |
| | | font-size: 14px; |
| | | } |
| | | |
| | | :deep(#table-sum td){ |
| | | font-size: 17px; |
| | | } |
| | | |
| | | </style> |